lazymatrix::WeightedGramInto
LazyMatrix for Rust · 0.8.1
pub trait WeightedGramInto<F: Scalar>: MatrixShape + MatrixErrorTypeWeighted Gram product out = Aᵀ diag(weights) A.
Overwrites the entire symmetric ncols × ncols output, including both triangles. Weights may be signed, zero, or nonfinite. Empty sums are zero. Temporary workspace is internal; reusing output does not imply that the implementation allocates no scratch storage.
Dense ndarray and faer kernels use bounded panels and O(nrows * ncols²) work. CSC kernels use O(ncols) workspace without centering, or O(nrows + ncols) with centering. For sorted, unique columns and finite arithmetic, their work is O(nrows + ncols * nnz + ncols²) without centering and at most O(nrows + ncols * nnz * log(nrows + 1) + ncols²) with centering. Centered CSC inputs with enough stored entries instead use bounded panels and O(nrows * ncols²) work to avoid repeated sparse range queries. Noncanonical columns or nonfinite arithmetic can require O(nrows) scratch and O(nrows * ncols² + ncols * nnz) work. Output always occupies O(ncols²). CSR kernels scan borrowed rows into fixed-size panels. Workspace is bounded, and arithmetic costs O(nrows × ncols²). They do not convert storage.
Gram kernels run serially; an externally enabled BLAS library may use its own threads.
Errors
Returns the matrix's operational error. After an error, output may be partially overwritten and must not be used as a product result.
Panics
Panics before writing unless weights have length nrows and output has shape (ncols, ncols).
Methods
weighted_gram_into
fn weighted_gram_into<W, O>(
&self,
weights: &W,
out: &mut O
) -> Result<(), <Self as MatrixErrorType>::Error> where W: VectorView<F> + ?Sized, O: MatrixWrite<F> + ?SizedImplementation of WeightedGramInto
impl<F, IP, IS, DS, Iptr> WeightedGramInto<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 WeightedGramInto
impl<F, IP, IS, DS, Iptr> WeightedGramInto<F> for lazymatrix::SprsCsr<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 WeightedGramInto
impl<M, F, T> WeightedGramInto<F> for EagerMatrix<M, T> where M: WeightedGramInto<F>, F: ScalarImplementation of WeightedGramInto
impl<M, F> WeightedGramInto<F> for WithIntercept<M, F> where F: Scalar, M: WeightedGramInto<F> + WeightedColumnSumsInto<F>Implementation of WeightedGramInto
impl<M, F> WeightedGramInto<F> for LazyMatrix<M, F> where F: Scalar, M: lazymatrix::WeightedGramKernel<F>
