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