Expand description
Axis-based general dot product API. Axis-based general dot product API.
The dimension-numbering config borrows axis slices so callers can reuse their existing metadata without allocating a second owned config.
use strided_einsum2::{dot_general_into, DotGeneralConfig};
use strided_view::StridedArray;
let a = StridedArray::<f64>::from_fn_col_major(&[2, 3], |idx| {
(idx[0] + 2 * idx[1] + 1) as f64
});
let b = StridedArray::<f64>::from_fn_col_major(&[3, 2], |idx| {
(idx[0] + 3 * idx[1] + 1) as f64
});
let mut c = StridedArray::<f64>::col_major(&[2, 2]);
let config = DotGeneralConfig {
lhs_contracting_dims: &[1],
rhs_contracting_dims: &[0],
lhs_batch_dims: &[],
rhs_batch_dims: &[],
};
dot_general_into(c.view_mut(), &a.view(), &b.view(), &config, 1.0, 0.0).unwrap();Structs§
- DotGeneral
Config - DotGeneral dimension configuration.
Functions§
- dot_
general_ into - Compute
C = alpha * dot_general(A, B) + beta * Cwith the active backend. - dot_
general_ with_ backend_ into - Compute
C = alpha * dot_general(A, B) + beta * Cwith an explicit backend.