Skip to main content

SparseView

Struct SparseView 

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

Format-parameterized sparse matrix view.

Implementations§

Source§

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

Source

pub fn new(data: Format::Storage<'a, T>) -> Self

Create a SparseView from the format’s storage representation.

§Panics

If Arch cannot execute on this host.

Source

pub fn storage(&self) -> &Format::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: 'a, Arch> SparseView<'a, T, Csr, Arch>
where Arch: SimdArch,

Source

pub fn from_csr(data: CsrData<'a, T>) -> Self

Create a SparseView over CSR data.

§Panics

If Arch cannot execute on this host.

Source

pub fn csr_data(&self) -> &CsrData<'a, T>

Access the underlying CSR data.

Source§

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

Source

pub fn try_from_csr(data: CsrData<'a, T>) -> Result<Self, SimdError>

Validate CSR storage and create a SpMV-ready view.

Source

pub fn from_validated_csr(data: ValidatedData<CsrData<'a, T>>) -> Self

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

§Panics

If Arch cannot execute on this host.

Source§

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

Source

pub fn from_sellp(data: SellPData<'a, T, C>) -> Self

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

§Panics

If Arch cannot execute on this host.

Source§

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

Source

pub fn try_from_sellp(data: SellPData<'a, T, C>) -> Result<Self, SimdError>

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

Source

pub fn from_validated_sellp(data: ValidatedData<SellPData<'a, T, C>>) -> Self

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

§Panics

If Arch cannot execute on this host.

Source§

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

Source

pub fn from_blocked_coo(data: BlockedCooData<'a, T, BM, BN>) -> Self

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

§Panics

If Arch cannot execute on this host.

Source§

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

Source

pub fn try_from_blocked_coo( data: BlockedCooData<'a, T, BM, BN>, ) -> Result<Self, SimdError>

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

Source

pub fn from_validated_blocked_coo( data: ValidatedData<BlockedCooData<'a, T, BM, BN>>, ) -> Self

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

§Panics

If Arch cannot execute on this host.

Source§

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

Source

pub fn from_dense_with_mask(data: DenseWithMaskData<'a, T>) -> Self

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: Scalar, 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: Scalar, 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: Scalar, 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: Scalar, 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: Scalar, 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: Scalar, 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: Scalar, 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: Scalar, 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: 'a, Format, Arch> SparseValidate for SparseView<'a, T, Format, Arch>
where Format: SparseFormat, Arch: SimdArch, Format::Storage<'a, T>: SparseValidate,

Source§

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

Validate structural correctness and bounds checks.
Source§

impl<'a, T: 'a, Format, Arch> SparseViewShape for SparseView<'a, T, Format, Arch>
where Format: SparseFormat, Arch: SimdArch, Format::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<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> LayoutRaw for T

Source§

fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>

Returns the layout of the type.
Source§

impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
where T: SharedNiching<N1, N2>, N1: Niching<T>, N2: Niching<T>,

Source§

unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool

Returns whether the given value has been niched. Read more
Source§

fn resolve_niched(out: Place<NichedOption<T, N1>>)

Writes data to out indicating that a T is niched.
Source§

impl<T> Pointee for T

Source§

type Metadata = ()

The metadata type for pointers and references to this type.
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.