pub trait Dot<Rhs: ?Sized> {
type Output;
// Required method
fn dot(&self, rhs: &Rhs) -> Self::Output;
}Expand description
Matrix Multiplication
For two-dimensional arrays, the dot method computes the matrix multiplication.
Required Associated Types§
Required Methods§
Implementors§
Source§impl<A> Dot<ArrayRef<A, Dim<IxDynImpl>>> for ArrayRef<A, IxDyn>where
A: LinalgScalar,
Dot product for dynamic-dimensional arrays (ArrayD).
impl<A> Dot<ArrayRef<A, Dim<IxDynImpl>>> for ArrayRef<A, IxDyn>where
A: LinalgScalar,
Dot product for dynamic-dimensional arrays (ArrayD).
For one-dimensional arrays, computes the vector dot product, which is the sum of the elementwise products (no conjugation of complex operands). Both arrays must have the same length.
For two-dimensional arrays, performs matrix multiplication. The array shapes must be compatible in the following ways:
- If
selfis M × N, thenrhsmust be N × K for matrix-matrix multiplication - If
selfis M × N andrhsis N, returns a vector of length M - If
selfis M andrhsis M × N, returns a vector of length N - If both arrays are one-dimensional of length N, returns a scalar
Panics if:
- The arrays have dimensions other than 1 or 2
- The array shapes are incompatible for the operation
- For vector dot product: the vectors have different lengths
Source§impl<A> Dot<ArrayRef<A, Dim<[usize; 1]>>> for ArrayRef<A, Ix2>where
A: LinalgScalar,
Perform the matrix multiplication of the rectangular array self and
column vector rhs.
impl<A> Dot<ArrayRef<A, Dim<[usize; 1]>>> for ArrayRef<A, Ix2>where
A: LinalgScalar,
Perform the matrix multiplication of the rectangular array self and
column vector rhs.
The array shapes must agree in the way that
if self is M × N, then rhs is N.
Return a result array with shape M.
Panics if shapes are incompatible.