Gistlib Logo

gistlib

how to multiply a matrix anda vector in python

main.py
import numpy as np

matrix = np.array([[1, 2], [3, 4]])
vector = np.array([1, 2])

result = np.dot(matrix, vector)
print(result)
129 chars
8 lines

similar python code snippets

generate a random array in python
find the variance of all elements in an array in python
meandershaped array in numpy in python
get a normally distributed random number in python
find the average of all elements in an array in python
get a random number from a normal distribution with a mean of 0 and a standard deviation of 1 in python
python genetic simulator in python
meander shaped matrix in numpy in python
find the standard deviation of all elements in an array in python
run a machine learning model in python

related categories

python
numpy

gistlibby LogSnag