如题
>>> 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矩阵变换的相关资料
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
这样写:
至于资料,推荐你看 NumPy 的官方文档(或者国内关于 NumPy 的技术博客)