Write a NumPy program to generate a matrix product of two arrays.
import numpy as np x = [[1, 0], [1, 1]] y = [[3, 1], [2, 2]] print("Matrices and vectors.") print("x:") print(x) print("y:") print(y) print("Matrix product of above two arrays:") print(np.matmul(x, y))
Sample Output:
Matrices and vectors. x: [[1, 0], [1, 1]] y: [[3, 1], [2, 2]] Matrix product of above two arrays: [[3 1] [5 3]]
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
Sample Output:
need an explanation for this answer? contact us directly to get an explanation for this answer