Skip to main content

Module dot_general

Module dot_general 

Source
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§

DotGeneralConfig
DotGeneral dimension configuration.

Functions§

dot_general_into
Compute C = alpha * dot_general(A, B) + beta * C with the active backend.
dot_general_with_backend_into
Compute C = alpha * dot_general(A, B) + beta * C with an explicit backend.