Matrix multiplication in python numpy

Matrix product with numpy

mat_multi.py



import numpy as np

a=np.array([[1,2], [3,4]])
b=np.array([[5,6], [7,8]])

#a.*b in MATLAB
x=a*b
print (x)
#[[ 5 12]
# [21 32]]

#a*b in MATLAB
y=np.dot(a,b)
print (y)
#[[19 22]
# [43 50]]

####################
#You pointed out.
y=a@b
But it seems that you can go.

Note that it is the opposite of MATLAB.

Recommended Posts

Matrix multiplication in python numpy
[Python] Matrix multiplication processing time using NumPy
Python Math Series ② Matrix Multiplication
Transposed matrix in Python standard
Matrix multiplication
Draw a scatterplot matrix in python
Put python, numpy, opencv3 in ubuntu14
Self-organizing map in Python NumPy version
Quadtree in Python --2
My Numpy (Python)
Python in optimization
CURL in python
Metaprogramming in Python
Python 3.3 in Anaconda
Geocoding in python
where in numpy
SendKeys in Python
Meta-analysis in Python
Unittest in python
Epoch in Python
Discord in Python
Sudoku in Python
DCI in Python
quicksort in python
N-Gram in Python
Programming in python
How to display multiplication table in python
#Python basics (#Numpy 1/2)
Plink in Python
Constant in python
#Python basics (#Numpy 2/2)
Find and check inverse matrix in Python
Lifegame in Python.
FizzBuzz in Python
Sqlite in python
StepAIC in Python
[Python] Matrix operation
N-gram in python
LINE-Bot [0] in Python
Csv in python
Disassemble in Python
Reflection in Python
Constant in python
nCr in Python.
format in python
Scons in Python3
Puyo Puyo in python
python in virtualenv
PPAP in Python
Python #Numpy basics
Quad-tree in Python
Reflection in Python
Chemistry in Python
Hashable in python
DirectLiNGAM in Python
LiNGAM in Python
Flatten in python
[Python] Numpy memo
flatten in python
[Scientific / technical calculation by Python] Inverse matrix calculation, numpy
One liner that outputs multiplication tables in Python