pub trait MatMul<T: One> {
// Required methods
fn matmul<'a, La, Lb>(
&self,
a: &'a DSlice<T, 2, La>,
b: &'a DSlice<T, 2, Lb>,
) -> impl MatMulBuilder<'a, T, La, Lb>
where T: One,
La: Layout,
Lb: Layout;
fn contract_all<'a, La, Lb>(
&self,
a: &'a Slice<T, DynRank, La>,
b: &'a Slice<T, DynRank, Lb>,
) -> impl ContractBuilder<'a, T, La, Lb>
where T: 'a,
La: Layout,
Lb: Layout;
fn contract_n<'a, La, Lb>(
&self,
a: &'a Slice<T, DynRank, La>,
b: &'a Slice<T, DynRank, Lb>,
n: usize,
) -> impl ContractBuilder<'a, T, La, Lb>
where T: 'a,
La: Layout,
Lb: Layout;
fn contract<'a, La, Lb>(
&self,
a: &'a Slice<T, DynRank, La>,
b: &'a Slice<T, DynRank, Lb>,
axes_a: impl Into<Box<[usize]>>,
axes_b: impl Into<Box<[usize]>>,
) -> impl ContractBuilder<'a, T, La, Lb>
where T: 'a,
La: Layout,
Lb: Layout;
}Expand description
Matrix-matrix multiplication and related operations
Required Methods§
fn matmul<'a, La, Lb>( &self, a: &'a DSlice<T, 2, La>, b: &'a DSlice<T, 2, Lb>, ) -> impl MatMulBuilder<'a, T, La, Lb>
Sourcefn contract_all<'a, La, Lb>(
&self,
a: &'a Slice<T, DynRank, La>,
b: &'a Slice<T, DynRank, Lb>,
) -> impl ContractBuilder<'a, T, La, Lb>
fn contract_all<'a, La, Lb>( &self, a: &'a Slice<T, DynRank, La>, b: &'a Slice<T, DynRank, Lb>, ) -> impl ContractBuilder<'a, T, La, Lb>
Contracts all axes of the first tensor with all axes of the second tensor.
Sourcefn contract_n<'a, La, Lb>(
&self,
a: &'a Slice<T, DynRank, La>,
b: &'a Slice<T, DynRank, Lb>,
n: usize,
) -> impl ContractBuilder<'a, T, La, Lb>
fn contract_n<'a, La, Lb>( &self, a: &'a Slice<T, DynRank, La>, b: &'a Slice<T, DynRank, Lb>, n: usize, ) -> impl ContractBuilder<'a, T, La, Lb>
Contracts the last n axes of the first tensor with the first n axes of the second tensor.
§Example
For two matrices (2D tensors), contract_n(1) performs standard matrix multiplication.
Sourcefn contract<'a, La, Lb>(
&self,
a: &'a Slice<T, DynRank, La>,
b: &'a Slice<T, DynRank, Lb>,
axes_a: impl Into<Box<[usize]>>,
axes_b: impl Into<Box<[usize]>>,
) -> impl ContractBuilder<'a, T, La, Lb>
fn contract<'a, La, Lb>( &self, a: &'a Slice<T, DynRank, La>, b: &'a Slice<T, DynRank, Lb>, axes_a: impl Into<Box<[usize]>>, axes_b: impl Into<Box<[usize]>>, ) -> impl ContractBuilder<'a, T, La, Lb>
Specifies exactly which axes to contract_all.
§Example
specific([1, 2], [3, 4]) contracts axis 1 and 2 of a
with axes 3 and 4 of b.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.