本文整理汇总了Python中sympy.tensor.array.dense_ndim_array.MutableDenseNDimArray._get_tuple_index方法的典型用法代码示例。如果您正苦于以下问题:Python MutableDenseNDimArray._get_tuple_index方法的具体用法?Python MutableDenseNDimArray._get_tuple_index怎么用?Python MutableDenseNDimArray._get_tuple_index使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sympy.tensor.array.dense_ndim_array.MutableDenseNDimArray
的用法示例。
在下文中一共展示了MutableDenseNDimArray._get_tuple_index方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_higher_dimenions
# 需要导入模块: from sympy.tensor.array.dense_ndim_array import MutableDenseNDimArray [as 别名]
# 或者: from sympy.tensor.array.dense_ndim_array.MutableDenseNDimArray import _get_tuple_index [as 别名]
def test_higher_dimenions():
m3 = MutableDenseNDimArray(range(10, 34), (2, 3, 4))
assert m3.tolist() == [
[[10, 11, 12, 13], [14, 15, 16, 17], [18, 19, 20, 21]],
[[22, 23, 24, 25], [26, 27, 28, 29], [30, 31, 32, 33]],
]
assert m3._get_tuple_index(0) == (0, 0, 0)
assert m3._get_tuple_index(1) == (0, 0, 1)
assert m3._get_tuple_index(4) == (0, 1, 0)
assert m3._get_tuple_index(12) == (1, 0, 0)
assert (
str(m3)
== "[[[10, 11, 12, 13], [14, 15, 16, 17], [18, 19, 20, 21]], [[22, 23, 24, 25], [26, 27, 28, 29], [30, 31, 32, 33]]]"
)
m3_rebuilt = MutableDenseNDimArray(
[[[10, 11, 12, 13], [14, 15, 16, 17], [18, 19, 20, 21]], [[22, 23, 24, 25], [26, 27, 28, 29], [30, 31, 32, 33]]]
)
assert m3 == m3_rebuilt
m3_other = MutableDenseNDimArray(
[
[[10, 11, 12, 13], [14, 15, 16, 17], [18, 19, 20, 21]],
[[22, 23, 24, 25], [26, 27, 28, 29], [30, 31, 32, 33]],
],
(2, 3, 4),
)
assert m3 == m3_other