Skip to main content

DeviceCsrMatrix

Struct DeviceCsrMatrix 

Source
pub struct DeviceCsrMatrix<T: FvmScalar, B: AcceleratorBackend> {
    pub row_offsets: B::Buffer<u32>,
    pub column_indices: B::Buffer<u32>,
    pub values: B::Buffer<T>,
    pub row_count: usize,
    pub column_count: usize,
    pub workspace: Option<B::Buffer<u8>>,
}
Expand description

A validated CSR matrix with device-resident structure and values.

Fields§

§row_offsets: B::Buffer<u32>

Zero-based row offsets, with row_count + 1 entries.

§column_indices: B::Buffer<u32>

Zero-based column indices.

§values: B::Buffer<T>

Nonzero values in row-major CSR order.

§row_count: usize

Number of represented rows.

§column_count: usize

Required input vector length.

§workspace: Option<B::Buffer<u8>>

Reusable implementation-specific SpMV scratch allocation.

Implementations§

Source§

impl<T: FvmScalar, B: AcceleratorBackend> DeviceCsrMatrix<T, B>

Source

pub fn from_pattern( backend: &B, pattern: &CsrPattern, values: &[T], ) -> Result<Self, AcceleratorError>

Build a square matrix from a symbolic closure-DOF pattern.

Source

pub fn from_global_pattern( backend: &B, pattern: &GlobalCsrPattern, values: &[T], ) -> Result<Self, AcceleratorError>

Build a compact-row matrix from a globally numbered pattern.

Output rows follow pattern.rows; input columns retain their global numbers, so column_count is one greater than the largest column.

Source§

impl<T: FvmScalar> DeviceCsrMatrix<T, CpuBackend>

Source

pub fn spmv( &self, alpha: T, x: &<CpuBackend as AcceleratorBackend>::Buffer<T>, beta: T, y: &mut <CpuBackend as AcceleratorBackend>::Buffer<T>, ) -> Result<(), AcceleratorError>

Compute y = alpha * A * x + beta * y in deterministic row order.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> AccumulatePathExt for T

Source§

fn accumulate_path<O, I>(path: I) -> O
where O: Orientation, I: IntoIterator<Item = O>,

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> 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, 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.