pub trait MatmulAlgorithm<R: ?Sized + RingBase> {
// Required method
fn add_matmul<S, V1, V2, V3, const T1: bool, const T2: bool, const T3: bool>(
&self,
lhs: TransposableSubmatrix<'_, V1, R::Element, T1>,
rhs: TransposableSubmatrix<'_, V2, R::Element, T2>,
dst: TransposableSubmatrixMut<'_, V3, R::Element, T3>,
ring: S,
)
where V1: AsPointerToSlice<R::Element>,
V2: AsPointerToSlice<R::Element>,
V3: AsPointerToSlice<R::Element>,
S: RingStore<Type = R> + Copy;
// Provided method
fn matmul<S, V1, V2, V3, const T1: bool, const T2: bool, const T3: bool>(
&self,
lhs: TransposableSubmatrix<'_, V1, R::Element, T1>,
rhs: TransposableSubmatrix<'_, V2, R::Element, T2>,
dst: TransposableSubmatrixMut<'_, V3, R::Element, T3>,
ring: S,
)
where V1: AsPointerToSlice<R::Element>,
V2: AsPointerToSlice<R::Element>,
V3: AsPointerToSlice<R::Element>,
S: RingStore<Type = R> + Copy { ... }
}
unstable-enable
only.Expand description
Trait for objects that can compute a matrix multiplications over some ring.
§Availability
This API is marked as unstable and is only available when the unstable-enable
crate feature is enabled. This comes with no stability guarantees, and could be changed or removed at any time.
Required Methods§
Sourcefn add_matmul<S, V1, V2, V3, const T1: bool, const T2: bool, const T3: bool>(
&self,
lhs: TransposableSubmatrix<'_, V1, R::Element, T1>,
rhs: TransposableSubmatrix<'_, V2, R::Element, T2>,
dst: TransposableSubmatrixMut<'_, V3, R::Element, T3>,
ring: S,
)where
V1: AsPointerToSlice<R::Element>,
V2: AsPointerToSlice<R::Element>,
V3: AsPointerToSlice<R::Element>,
S: RingStore<Type = R> + Copy,
fn add_matmul<S, V1, V2, V3, const T1: bool, const T2: bool, const T3: bool>(
&self,
lhs: TransposableSubmatrix<'_, V1, R::Element, T1>,
rhs: TransposableSubmatrix<'_, V2, R::Element, T2>,
dst: TransposableSubmatrixMut<'_, V3, R::Element, T3>,
ring: S,
)where
V1: AsPointerToSlice<R::Element>,
V2: AsPointerToSlice<R::Element>,
V3: AsPointerToSlice<R::Element>,
S: RingStore<Type = R> + Copy,
Computes the matrix product of lhs
and rhs
, and adds the result to dst
.
This requires that lhs
is a nxk
matrix, rhs
is a kxm
matrix and dst
is a nxm
matrix.
In this case, the function concretely computes dst[i, j] += sum_l lhs[i, l] * rhs[l, j]
where
l
runs from 0
to k - 1
.
Provided Methods§
Sourcefn matmul<S, V1, V2, V3, const T1: bool, const T2: bool, const T3: bool>(
&self,
lhs: TransposableSubmatrix<'_, V1, R::Element, T1>,
rhs: TransposableSubmatrix<'_, V2, R::Element, T2>,
dst: TransposableSubmatrixMut<'_, V3, R::Element, T3>,
ring: S,
)where
V1: AsPointerToSlice<R::Element>,
V2: AsPointerToSlice<R::Element>,
V3: AsPointerToSlice<R::Element>,
S: RingStore<Type = R> + Copy,
fn matmul<S, V1, V2, V3, const T1: bool, const T2: bool, const T3: bool>(
&self,
lhs: TransposableSubmatrix<'_, V1, R::Element, T1>,
rhs: TransposableSubmatrix<'_, V2, R::Element, T2>,
dst: TransposableSubmatrixMut<'_, V3, R::Element, T3>,
ring: S,
)where
V1: AsPointerToSlice<R::Element>,
V2: AsPointerToSlice<R::Element>,
V3: AsPointerToSlice<R::Element>,
S: RingStore<Type = R> + Copy,
Computes the matrix product of lhs
and rhs
, and stores the result in dst
.
This requires that lhs
is a nxk
matrix, rhs
is a kxm
matrix and dst
is a nxm
matrix.
In this case, the function concretely computes dst[i, j] = sum_l lhs[i, l] * rhs[l, j]
where
l
runs from 0
to k - 1
.
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.