Python | Numpy matrix.dot() (original) (raw)
Last Updated : 12 Apr, 2019
With the help of **Numpy matrix.dot()**
method, we are able to find a product
of two given matrix and gives output as new dimensional matrix.
Syntax :
matrix.dot()
Return : Return product of two matrix
Example #1 :
In this example we can see that with the help of matrix.dot()
method we are able to find the product of two given matrix.
import
numpy as np
gfg1
=
np.matrix(
'[6, 2, 3]'
)
gfg2
=
np.matrix(
'[4; 5; 9]'
)
geeks
=
gfg1.dot(gfg2)
print
(geeks)
Example #2 :
import
numpy as np
gfg1
=
np.matrix(
'[1, 2, 3; 4, 5, 6; 7, 8, 9]'
)
gfg2
=
np.matrix(
'[1, 2, 3; 4, 5, 6; 7, 8, 9]'
)
geeks
=
gfg1.dot(gfg2)
print
(geeks)
Output:
[[ 30 36 42] [ 66 81 96] [102 126 150]]
Similar Reads
- numpy.matrix() in Python This class returns a matrix from a string of data or array-like object. Matrix obtained is a specialised 2D array. Syntax : numpy.matrix(data, dtype = None) : Parameters : data : data needs to be array-like or string dtype : Data type of returned array. Returns : data interpreted as a matrix # Pytho 1 min read
- numpy.dot() in Python numpy.dot(vector_a, vector_b, out = None) returns the dot product of vectors a and b. It can handle 2D arrays but considers them as matrix and will perform matrix multiplication. For N dimensions it is a sum-product over the last axis of a and the second-to-last of b : dot(a, b)[i,j,k,m] = sum(a[i,j 2 min read
- Python | Numpy matrix.var() With the help of Numpy matrix.var() method, we can find the variance of a matrix by using the matrix.var() method. Syntax : matrix.var() Return : Return variance of a matrix Example #1 : In this example we can see that by using matrix.var() method we are able to find the variance of a given matrix. 1 min read
- Python | Numpy matrix.std() With the help of matrix.std() method, we are able to find the standard deviation a matrix by using the same method. Syntax : matrix.std() Return : Return standard deviation of a matrix Example #1 : In this example we are able to find the standard deviation of a matrix by using matrix.std() method. # 1 min read
- numpy.asmatrix() in Python numpy.asmatrix(data, dtype = None) Returns a matrix by interpreting the input as a matrix. Parameters : data : array-like input data dtype : Data type of returned array Returns : Interprets the input as a matrix # Python Programming illustrating # numpy.asmatrix import numpy as geek # array-like inp 1 min read
- Python | Numpy matrix.take() With the help of Numpy matrix.take() method, we can select the elements from a given matrix by passing the parameter as index value of that element. It will return a matrix having one dimension. Remember it will work for one axis at a time. Syntax : matrix.take(index, axis) Return : Return matrix of 1 min read
- Python | Numpy numpy.matrix.A() With the help of Numpy numpy.matrix.A() method, we can get the same matrix as self. It means through this method we can get the identical matrix. Syntax : numpy.matrix.A() Return : Return self matrix Example #1 : In this example we can see that with the help of matrix.A() method, we are able to get 1 min read
- Numpy matrix.I function | Python With the help ofnumpy.matrix.I() function we can get the multiplicative inverse of the same size as of our given matrix. Syntax : numpy.matrix.I() Return : [matrix object] If self is non-singular, ret is such that ret * self == self * ret == np.matrix(np.eye(self[0, :].size) all return True. Return 1 min read
- numpy.matrix.A() function - Python numpy.matrix.A() function return self as an ndarray object. Syntax : numpy.matrix.A() Parameters : None Return : [ndarray] Return self as an ndarray. Code #1 : # Python program explaining # numpy.matrix.A() function # importing numpy as geek import numpy as geek mat = geek.matrix(geek.arange(9).resh 1 min read
- Python | Numpy matrix.round() With the help of Numpy matrix.round() method, we are able to round off the values of the given matrix. Syntax : matrix.round() Return : Return rounded values in matrix Example #1 : In the given example we are able to round off the given matrix by using matrix.round() method. # import the important m 1 min read