2

I tried constructing a toeplitz matrix in Python using scipy.linalg.toeplitz(c, r=None). Although I was successful, I was not able to maintain the Fortran ordering. I need to make sure that the toeplitz array being constructed maintain a Fortran ordering since I'm calling BLAS functions.

Is there a way I can do this?

4

1 回答 1

1

在 Fortran 排序中制作副本是最简单的。 toeplitz创建一个新数组,但不能让您控制排序。

例如

x = scipy.linalg.toeplitz([1, 2, 3, 4])
x = np.asfortranarray(x)

如果您想节省内存,也可以就地执行此操作。例如

x[:] = x.T
x = x.T
于 2014-01-17T19:45:57.853 回答