Skip to content

lazymatrix::WeightedColumnSumsInto ​

LazyMatrix for Rust · 0.8.1

Source

rust
pub trait WeightedColumnSumsInto<F: Scalar>: MatrixShape + MatrixErrorType

Weighted logical-column sums out[j] = sum_i A[i,j] * weights[i].

Unlike a factored normalized transpose product, implementations center entries before accumulation. This preserves small variations around large offsets when constructing an intercept's weighted Gram cross terms. Signed and nonfinite weights are preserved, including IEEE operations on implicit zeros. Empty sums are zero. Every output entry is overwritten.

Dense ndarray and faer take O(nrows * ncols) work and constant scratch space. Canonical finite CSC inputs take O(nrows + ncols + nnz) work without centering, or O(nrows + ncols + nnz * log(nrows + 1)) with centering. Centered CSC uses O(nrows) scratch. Noncanonical columns or nonfinite arithmetic may require O(nrows * ncols + nnz) work and one working column. No full design matrix is materialized.

Errors ​

Returns the matrix's operational error. Output may be partial on failure.

Panics ​

Panics before writing unless weights have length nrows and output has length ncols.

Methods ​

weighted_column_sums_into ​

rust
fn weighted_column_sums_into<W, O>(
    &self,
    weights: &W,
    out: &mut O
) -> Result<(), <Self as MatrixErrorType>::Error> where W: VectorView<F> + ?Sized, O: VectorViewMut<F> + ?Sized

Source

Implementation of WeightedColumnSumsInto ​

Source

rust
impl<F, IP, IS, DS, Iptr> WeightedColumnSumsInto<F> for lazymatrix::SprsCsc<sprs::CsMatBase<F, usize, IP, IS, DS, Iptr>> where F: Scalar, Iptr: SpIndex, IP: Deref<Target = [Iptr]>, IS: Deref<Target = [usize]>, DS: Deref<Target = [F]>

Implementation of WeightedColumnSumsInto ​

Source

rust
impl<M, F> WeightedColumnSumsInto<F> for WithIntercept<M, F> where F: Scalar, M: WeightedColumnSumsInto<F>

Implementation of WeightedColumnSumsInto ​

Source

rust
impl<M, F> WeightedColumnSumsInto<F> for LazyMatrix<M, F> where F: Scalar, M: lazymatrix::WeightedColumnSumsKernel<F>

Implementation of WeightedColumnSumsInto ​

Source

rust
impl<M: WeightedColumnSumsInto<F>, F: Scalar, T> WeightedColumnSumsInto<F> for EagerMatrix<M, T>

Released under the MIT and Apache 2.0 licenses.