Installation
sudo yum install NumPy
From numpy Import *
Produces an array
Random.rand (4,5)
Result
Array ([[0.79056842, 0.31659893, 0.34054779, 0.97328131, 0.32648329],
[0.51585845, 0.70683055, 0.31476985, 0.07952725, 0.80907845],
[0.81623517, 0.61038487, 0.66679161, 0.77412742, 0.03394483],
[0.41758993, 0.54425978, 0.65350633, 0.90397197, 0.72706079]])
Produce a matrix
>>> Randmat=mat (Random.rand (bis))
>>> randmat.i
Matrix ([[[1.72265179, 0.82071484, 0.8218207,-3.20005387],
[0.60602642,-1.2873106, 0.4826296, 0.61948819],
[-1.58733496, 0.1095752, 0.88187595, 1.44921728],
[-0.97809315, 0.25648172,-1.44365489, 2.67132684]])
Matrix multiplication:
>>> invrandmat=randmat.i
>>> Randmat.i*invrandmat
Matrix ([[5.29035012,-0.37341318, 7.15632948,-12.3615484],
[-1.10818373, 2.3663151,-0.59195686,-0.38250032],
[-5.48532196,-0.9754772,-2.56608491, 10.29680078],
[-1.85072184,-0.60594947,-5.80963009, 8.33265564]])
>>>
Matrix addition:
>>> Randmat.i+invrandmat
Matrix ([[[3.44530359, 1.64142968, 1.6436414,-6.40010773],
[1.21205284,-2.57462121, 0.9652592, 1.23897638],
[-3.17466991, 0.2191504, 1.7637519, 2.89843456],
[-1.9561863, 0.51296344,-2.88730977, 5.34265368]])
>>> Myeye=randmat.i*invrandmat
>>> Myeye-eye (4)
Matrix ([[4.29035012,-0.37341318, 7.15632948,-12.3615484],
[-1.10818373, 1.3663151,-0.59195686,-0.38250032],
[-5.48532196,-0.9754772,-3.56608491, 10.29680078],
[-1.85072184,-0.60594947,-5.80963009, 7.33265564]])
>>>
Eye (4) Create a unit matrix
Python numpy machine Learning Library Use example