# yum install epel-release # yum install python34 python34-libs python34-devel python34-pip # pip3 install numpy
# vi matrix.py # coding: utf-8 import numpy as np import math def main(): #行列の積 matrixA = np.matrix([ [6, 2, -2], [1, 4, 5] ]) matrixB = np.matrix([ [7, 2, 5], [7, 2, -2], [1, 3, 9] ]) retMatrix = matrixA * matrixB print(retMatrix) if __name__ == '__main__': main()
# python3 matrix.py [[54 10 8] [40 25 42]]