scipy - python numpy 矩阵行交换 无效
大家讲道理
大家讲道理 2017-04-17 17:47:12
0
1
542

如题

>>> import numpy as np
>>> A = np.mat('1 2;3 4')
>>> A
matrix([[1, 2],
        [3, 4]])
>>> A[0],A[1] = A[1],A[0]
>>> A
matrix([[3, 4],
        [3, 4]])
>>> 

为什么交换无效
顺便求Python矩阵变换的相关资料

大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

reply all(1)
刘奇

Write like this:

A[[0,1]] = A[[1,0]]
// 上面相当于 A[[0,1],:] = A[[1,0],:]

As for information, it is recommended that you read NumPy’s official documentation (or domestic technical blogs about NumPy)

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template