本文整理匯總了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