- nlcpy.matmul = <ufunc 'nlcpy_matmul'>
Matrix product of two arrays.
Input arrays, scalars not allowed.
- outndarray or None, optional
A location into which the result is stored. If provided, it must have a shape that the inputs broadcast to. If not provided or None, a freshly-allocated array is returned. A tuple (possible only as a keyword argument) must have length equal to the number of outputs.
The matrix product of the inputs. If x1 and x2 are both scalars, this function returns the result as a 0-dimension array.
Dot product of two arrays.
The behavior depends on the arguments in the following way.
If both arguments are 2-D they are multiplied like conventional matrices.
If the first argument is 1-D, it is promoted to a matrix by prepending a 1 to its dimensions. After matrix multiplication the prepended 1 is removed.
If the second argument is 1-D, it is promoted to a matrix by appending a 1 to its dimensions. After matrix multiplication the appended 1 is removed.
x1.ndim > 2or
x2.ndim > 2: NotImplementedError occurs.
For 2-D arrays it is the matrix product:
>>> import nlcpy as vp >>> a = vp.array([[1, 0],[0, 1]]) >>> b = vp.array([[4, 1],[2, 2]]) >>> vp.matmul(a, b) array([[4, 1], [2, 2]])
For 2-D mixed with 1-D, the result is the usual.
>>> a = vp.array([[1, 0],[0, 1]]) >>> b = vp.array([1, 2]) >>> vp.matmul(a, b) array([1, 2]) >>> vp.matmul(b, a) array([1, 2])