lazymatrix::WeightedColumnSumsInto
LazyMatrix for Rust · 0.8.1
pub trait WeightedColumnSumsInto<F: Scalar>: MatrixShape + MatrixErrorTypeWeighted 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
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> + ?SizedImplementation of WeightedColumnSumsInto
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
impl<M, F> WeightedColumnSumsInto<F> for WithIntercept<M, F> where F: Scalar, M: WeightedColumnSumsInto<F>Implementation of WeightedColumnSumsInto
impl<M, F> WeightedColumnSumsInto<F> for LazyMatrix<M, F> where F: Scalar, M: lazymatrix::WeightedColumnSumsKernel<F>Implementation of WeightedColumnSumsInto
impl<M: WeightedColumnSumsInto<F>, F: Scalar, T> WeightedColumnSumsInto<F> for EagerMatrix<M, T>
