本文整理汇总了Python中sympy.tensor.array.dense_ndim_array.MutableDenseNDimArray.reshape方法的典型用法代码示例。如果您正苦于以下问题:Python MutableDenseNDimArray.reshape方法的具体用法?Python MutableDenseNDimArray.reshape怎么用?Python MutableDenseNDimArray.reshape使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sympy.tensor.array.dense_ndim_array.MutableDenseNDimArray
的用法示例。
在下文中一共展示了MutableDenseNDimArray.reshape方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_reshape
# 需要导入模块: from sympy.tensor.array.dense_ndim_array import MutableDenseNDimArray [as 别名]
# 或者: from sympy.tensor.array.dense_ndim_array.MutableDenseNDimArray import reshape [as 别名]
def test_reshape():
array = MutableDenseNDimArray(range(50), 50)
assert array.shape == (50,)
assert array.rank() == 1
array = array.reshape(5, 5, 2)
assert array.shape == (5, 5, 2)
assert array.rank() == 3
assert len(array) == 50
示例2: test_iterator
# 需要导入模块: from sympy.tensor.array.dense_ndim_array import MutableDenseNDimArray [as 别名]
# 或者: from sympy.tensor.array.dense_ndim_array.MutableDenseNDimArray import reshape [as 别名]
def test_iterator():
array = MutableDenseNDimArray(range(4), (2, 2))
j = 0
for i in array:
assert i == j
j += 1
array = array.reshape(4)
j = 0
for i in array:
assert i == j
j += 1