Python教程

python numpy 矩阵

本文主要是介绍python numpy 矩阵,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

python numpy 矩阵

 

from numpy import *;
import numpy as np;


randomMat1=np.matrix([0.26358242,0.35134772,0.43263799,2.87872261]);
mul1 = np.matrix([100,15,100,15]);
T1 = np.matrix([[316.22776602,0.,0.,0.],[0.,3.16227766,0.,0.],[0.,0.,316.22776602,0.],[0.,0.,0.,3.16227766]]);

print("randomMat1 shape:",shape(randomMat1));
print("mul1 shape:",shape(mul1));
print("T1 shape:",shape(T1));


T2 = randomMat1*T1;
print("T2:",T2);
print("T2 shape:",shape(T2));

 

(wind_2021) F:\PythonProject\ckf>
(wind_2021) F:\PythonProject\ckf>python mat1.py
randomMat1 shape: (1, 4)
mul1 shape: (1, 4)
T1 shape: (4, 4)
T2: [[ 83.35207984   1.11105905 136.81214507   9.1033202 ]]
T2 shape: (1, 4)

(wind_2021) F:\PythonProject\ckf>
(wind_2021) F:\PythonProject\ckf>

 

##########

这篇关于python numpy 矩阵的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!