Skip to main content

SpMat

Struct SpMat 

Source
pub struct SpMat<'buf, T> { /* private fields */ }
Expand description

A sparse-matrix descriptor (CSR / CSC / COO / BSR). The descriptor keeps pointers to externally-owned device buffers; the lifetime parameter ties those buffers to the descriptor.

Implementations§

Source§

impl<'buf, T: SparseScalar + DeviceRepr> SpMat<'buf, T>

Source

pub fn csr( rows: i64, cols: i64, nnz: i64, row_offsets: &'buf mut DeviceBuffer<i32>, col_indices: &'buf mut DeviceBuffer<i32>, values: &'buf mut DeviceBuffer<T>, ) -> Result<Self>

Build a CSR (compressed sparse row) descriptor.

row_offsets.len() must equal rows + 1; col_indices.len() and values.len() must equal nnz.

Source

pub fn csc( rows: i64, cols: i64, nnz: i64, col_offsets: &'buf mut DeviceBuffer<i32>, row_indices: &'buf mut DeviceBuffer<i32>, values: &'buf mut DeviceBuffer<T>, ) -> Result<Self>

Build a CSC (compressed sparse column) descriptor.

Source

pub fn bsr( brows: i64, bcols: i64, bnnz: i64, row_block_dim: i64, col_block_dim: i64, order: Order, row_offsets: &'buf mut DeviceBuffer<i32>, col_indices: &'buf mut DeviceBuffer<i32>, values: &'buf mut DeviceBuffer<T>, ) -> Result<Self>

Build a BSR (block-sparse-row) descriptor.

Source

pub fn coo( rows: i64, cols: i64, nnz: i64, row_indices: &'buf mut DeviceBuffer<i32>, col_indices: &'buf mut DeviceBuffer<i32>, values: &'buf mut DeviceBuffer<T>, ) -> Result<Self>

Build a COO (coordinate) descriptor.

Source§

impl<T> SpMat<'_, T>

Source

pub fn shape(&self) -> Result<(i64, i64, i64)>

Sparse matrix dimensions: (rows, cols, nnz).

Source

pub fn set_fill(&self, fill: Fill) -> Result<()>

Set the fill-triangle attribute (for triangular solves).

Source

pub fn set_diag(&self, diag: Diag) -> Result<()>

Set the diagonal-type attribute (unit vs non-unit, for triangular solves).

Source

pub fn as_raw(&self) -> cusparseSpMatDescr_t

Trait Implementations§

Source§

impl<T> Debug for SpMat<'_, T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T> Drop for SpMat<'_, T>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<T> Send for SpMat<'_, T>

Auto Trait Implementations§

§

impl<'buf, T> Freeze for SpMat<'buf, T>

§

impl<'buf, T> RefUnwindSafe for SpMat<'buf, T>
where T: RefUnwindSafe,

§

impl<'buf, T> !Sync for SpMat<'buf, T>

§

impl<'buf, T> Unpin for SpMat<'buf, T>

§

impl<'buf, T> UnsafeUnpin for SpMat<'buf, T>

§

impl<'buf, T> !UnwindSafe for SpMat<'buf, T>

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