numpoly.matmul¶
- numpoly.matmul(x1: numpoly.typing.PolyLike, x2: numpoly.typing.PolyLike, out: Optional[numpoly.baseclass.ndpoly] = None, **kwargs: Any) → numpoly.baseclass.ndpoly[source]¶
Matrix product of two arrays.
- Args:
- x1, x2:
Input arrays, scalars not allowed.
- out:
A location into which the result is stored. If provided, it must have a shape that matches the signature (n,k),(k,m)->(n,m). If not provided or None, a freshly-allocated array is returned.
- Return:
The matrix product of the inputs. This is a scalar only when both x1, x2 are 1-d vectors.
- Raise:
- ValueError:
If the last dimension of x1 is not the same size as the second-to-last dimension of x2.
- Example:
>>> poly = numpoly.variable(4).reshape(2, 2) >>> poly polynomial([[q0, q1], [q2, q3]]) >>> numpoly.matmul(poly, [[0, 1], [2, 3]]) polynomial([[2*q1, 3*q1+q0], [2*q3, 3*q3+q2]]) >>> numpoly.matmul(poly, [4, 5]) polynomial([[4*q1+4*q0, 5*q1+5*q0], [4*q3+4*q2, 5*q3+5*q2]]) >>> numpoly.matmul(*poly) polynomial([q1*q2+q0*q2, q1*q3+q0*q3])