Skip to main content

SparseView

Struct SparseView 

Source
pub struct SparseView<'a, T, Format, Arch>
where T: 'a, Format: SparseFormat, Arch: SimdArch,
{ /* private fields */ }
Expand description

Format-parameterized sparse matrix view.

Implementations§

Source§

impl<'a, T, Format, Arch> SparseView<'a, T, Format, Arch>
where T: 'a, Format: SparseFormat, Arch: SimdArch,

Source

pub fn new( data: <Format as SparseFormat>::Storage<'a, T>, ) -> SparseView<'a, T, Format, Arch>

Create a SparseView from the format’s storage representation.

§Panics

If Arch cannot execute on this host.

Source

pub fn storage(&self) -> &<Format as SparseFormat>::Storage<'a, T>

Get a reference to the underlying storage representation.

Source

pub fn nrows(&self) -> usize

Number of rows in the sparse matrix.

Source

pub fn ncols(&self) -> usize

Number of columns in the sparse matrix.

Source§

impl<'a, T, Arch> SparseView<'a, T, Csr, Arch>
where T: 'a, Arch: SimdArch,

Source

pub fn from_csr( data: CsrMatrix<T, &'a [T], &'a [i32]>, ) -> SparseView<'a, T, Csr, Arch>

Create a SparseView over CSR data.

§Panics

If Arch cannot execute on this host.

Source

pub fn csr_data(&self) -> &CsrMatrix<T, &'a [T], &'a [i32]>

Access the underlying CSR data.

Source§

impl<'a, T, Arch> SparseView<'a, T, Validated<Csr>, Arch>
where T: 'a, Arch: SimdArch,

Source

pub fn try_from_csr( data: CsrMatrix<T, &'a [T], &'a [i32]>, ) -> Result<SparseView<'a, T, Validated<Csr>, Arch>, SimdError>

Validate CSR storage and create a SpMV-ready view.

Source

pub fn from_validated_csr( data: ValidatedData<CsrMatrix<T, &'a [T], &'a [i32]>>, ) -> SparseView<'a, T, Validated<Csr>, Arch>

Create a SpMV-ready view from already-validated CSR storage.

§Panics

If Arch cannot execute on this host.

Source§

impl<'a, T, const C: usize, Arch> SparseView<'a, T, SellP<C>, Arch>
where T: 'a, Arch: SimdArch,

Source

pub fn from_sellp( data: SellPMatrix<T, C, &'a [T], &'a [i32]>, ) -> SparseView<'a, T, SellP<C>, Arch>

Create a SparseView over SELL-p data (generic C).

§Panics

If Arch cannot execute on this host.

Source§

impl<'a, T, const C: usize, Arch> SparseView<'a, T, Validated<SellP<C>>, Arch>
where T: 'a, Arch: SimdArch,

Source

pub fn try_from_sellp( data: SellPMatrix<T, C, &'a [T], &'a [i32]>, ) -> Result<SparseView<'a, T, Validated<SellP<C>>, Arch>, SimdError>

Validate SELL-p storage and create a SpMV-ready view.

Source

pub fn from_validated_sellp( data: ValidatedData<SellPMatrix<T, C, &'a [T], &'a [i32]>>, ) -> SparseView<'a, T, Validated<SellP<C>>, Arch>

Create a SpMV-ready view from already-validated SELL-p storage.

§Panics

If Arch cannot execute on this host.

Source§

impl<'a, T, const BM: usize, const BN: usize, Arch> SparseView<'a, T, BlockedCoo<BM, BN>, Arch>
where T: 'a, Arch: SimdArch,

Source

pub fn from_blocked_coo( data: BlockedCooMatrix<T, BM, BN, &'a [T], &'a [i32]>, ) -> SparseView<'a, T, BlockedCoo<BM, BN>, Arch>

Create a SparseView over Blocked-COO data (generic BM, BN).

§Panics

If Arch cannot execute on this host.

Source§

impl<'a, T, const BM: usize, const BN: usize, Arch> SparseView<'a, T, Validated<BlockedCoo<BM, BN>>, Arch>
where T: 'a, Arch: SimdArch,

Source

pub fn try_from_blocked_coo( data: BlockedCooMatrix<T, BM, BN, &'a [T], &'a [i32]>, ) -> Result<SparseView<'a, T, Validated<BlockedCoo<BM, BN>>, Arch>, SimdError>

Validate Blocked-COO storage and create a SpMV-ready view.

Source

pub fn from_validated_blocked_coo( data: ValidatedData<BlockedCooMatrix<T, BM, BN, &'a [T], &'a [i32]>>, ) -> SparseView<'a, T, Validated<BlockedCoo<BM, BN>>, Arch>

Create a SpMV-ready view from already-validated Blocked-COO storage.

§Panics

If Arch cannot execute on this host.

Source§

impl<'a, T, Arch> SparseView<'a, T, DenseWithMask, Arch>
where T: 'a, Arch: SimdArch,

Source

pub fn from_dense_with_mask( data: DenseWithMaskMatrix<T, &'a [T], &'a [bool]>, ) -> SparseView<'a, T, DenseWithMask, Arch>

Create a SparseView over dense-with-mask data.

§Panics

If Arch cannot execute on this host.

Trait Implementations§

Source§

impl<'a, T, Format, Arch> ComputeView for SparseView<'a, T, Format, Arch>
where Format: SparseFormat, Arch: SimdArch,

Source§

type Element = T

Scalar element type of the view (e.g. f32, f64, u64).
Source§

type Arch = Arch

SIMD architecture ZST marker.
Source§

type Backend = Format

Backend/format/execution mode selection marker. Read more
Source§

fn len(&self) -> usize

Returns the logical size of the view. Read more
Source§

fn is_empty(&self) -> bool

Returns true if the view contains no elements.
Source§

impl<'a, T, Arch> SparseOps<T> for SparseView<'a, T, Csr, Arch>
where T: NumericElement, Arch: SimdArch + SimdKernel<T>,

Source§

fn sum_values(&self) -> T

Compute the sum of all elements stored in the sparse matrix.
Source§

fn elementwise_mul_dense(&self, dense: &[T], out_values: &mut [T])

Elementwise multiply the sparse matrix values by corresponding entries in a dense matrix, writing the results to out_values.
Source§

impl<'a, T, const C: usize, Arch> SparseOps<T> for SparseView<'a, T, SellP<C>, Arch>
where T: NumericElement, Arch: SimdArch + SimdKernel<T>,

Source§

fn sum_values(&self) -> T

Compute the sum of all elements stored in the sparse matrix.
Source§

fn elementwise_mul_dense(&self, dense: &[T], out_values: &mut [T])

Elementwise multiply the sparse matrix values by corresponding entries in a dense matrix, writing the results to out_values.
Source§

impl<'a, T, const BM: usize, const BN: usize, Arch> SparseOps<T> for SparseView<'a, T, BlockedCoo<BM, BN>, Arch>
where T: NumericElement, Arch: SimdArch + SimdKernel<T>,

Source§

fn sum_values(&self) -> T

Compute the sum of all elements stored in the sparse matrix.
Source§

fn elementwise_mul_dense(&self, dense: &[T], out_values: &mut [T])

Elementwise multiply the sparse matrix values by corresponding entries in a dense matrix, writing the results to out_values.
Source§

impl<'a, T, Arch> SparseOps<T> for SparseView<'a, T, DenseWithMask, Arch>
where T: NumericElement, Arch: SimdArch + SimdKernel<T>,

Source§

fn sum_values(&self) -> T

Compute the sum of all elements stored in the sparse matrix.
Source§

fn elementwise_mul_dense(&self, dense: &[T], out_values: &mut [T])

Elementwise multiply the sparse matrix values by corresponding entries in a dense matrix, writing the results to out_values.
Source§

impl<'a, T, Arch> SparseSpMv<T> for SparseView<'a, T, Validated<Csr>, Arch>
where T: NumericElement, Arch: SimdArch + SimdKernel<T>,

Source§

fn spmv(&self, x: &[T], y: &mut [T])

Perform matrix-vector multiplication: y += A * x. Read more
Source§

impl<'a, T, Arch> SparseSpMv<T> for SparseView<'a, T, DenseWithMask, Arch>
where T: NumericElement, Arch: SimdArch + SimdKernel<T>,

Source§

fn spmv(&self, x: &[T], y: &mut [T])

Perform matrix-vector multiplication: y += A * x. Read more
Source§

impl<'a, T, const BM: usize, const BN: usize, Arch> SparseSpMv<T> for SparseView<'a, T, Validated<BlockedCoo<BM, BN>>, Arch>
where T: NumericElement, Arch: SimdArch + SimdKernel<T>,

Source§

fn spmv(&self, x: &[T], y: &mut [T])

Perform matrix-vector multiplication: y += A * x. Read more
Source§

impl<'a, T, const C: usize, Arch> SparseSpMv<T> for SparseView<'a, T, Validated<SellP<C>>, Arch>
where T: NumericElement, Arch: SimdArch + SimdKernel<T>,

Source§

fn spmv(&self, x: &[T], y: &mut [T])

Perform matrix-vector multiplication: y += A * x. Read more
Source§

impl<'a, T, Format, Arch> SparseValidate for SparseView<'a, T, Format, Arch>
where T: 'a, Format: SparseFormat, Arch: SimdArch, <Format as SparseFormat>::Storage<'a, T>: SparseValidate,

Source§

fn validate(&self) -> Result<(), SimdError>

Validate structural correctness and bounds checks.
Source§

impl<'a, T, Format, Arch> SparseViewShape for SparseView<'a, T, Format, Arch>
where T: 'a, Format: SparseFormat, Arch: SimdArch, <Format as SparseFormat>::Storage<'a, T>: SparseShape,

Source§

fn nrows(&self) -> usize

Number of rows.
Source§

fn ncols(&self) -> usize

Number of columns.

Auto Trait Implementations§

§

impl<'a, T, Format, Arch> Freeze for SparseView<'a, T, Format, Arch>
where <Format as SparseFormat>::Storage<'a, T>: Freeze,

§

impl<'a, T, Format, Arch> RefUnwindSafe for SparseView<'a, T, Format, Arch>
where <Format as SparseFormat>::Storage<'a, T>: RefUnwindSafe, Arch: RefUnwindSafe,

§

impl<'a, T, Format, Arch> Send for SparseView<'a, T, Format, Arch>
where <Format as SparseFormat>::Storage<'a, T>: Send,

§

impl<'a, T, Format, Arch> Sync for SparseView<'a, T, Format, Arch>
where <Format as SparseFormat>::Storage<'a, T>: Sync,

§

impl<'a, T, Format, Arch> Unpin for SparseView<'a, T, Format, Arch>
where <Format as SparseFormat>::Storage<'a, T>: Unpin, Arch: Unpin,

§

impl<'a, T, Format, Arch> UnsafeUnpin for SparseView<'a, T, Format, Arch>
where <Format as SparseFormat>::Storage<'a, T>: UnsafeUnpin,

§

impl<'a, T, Format, Arch> UnwindSafe for SparseView<'a, T, Format, Arch>
where <Format as SparseFormat>::Storage<'a, T>: UnwindSafe, Arch: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> ArchivePointee for T

Source§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
Source§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<F, W, T, D> Deserialize<With<T, W>, D> for F
where W: DeserializeWith<F, T, D>, D: Fallible + ?Sized, F: ?Sized,

Source§

fn deserialize( &self, deserializer: &mut D, ) -> Result<With<T, W>, <D as Fallible>::Error>

Deserializes using the given deserializer
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pointee for T

Source§

type Metadata = ()

The type for metadata in pointers and references to Self.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.