Struct SymCsrArray

Source
pub struct SymCsrArray<T>
where T: Float + Debug + Copy,
{ /* private fields */ }
Expand description

Array-based SymCSR implementation compatible with SparseArray trait

Implementations§

Source§

impl<T> SymCsrArray<T>
where T: Float + Debug + Copy + 'static + Add<Output = T> + Sub<Output = T> + Mul<Output = T> + Div<Output = T>,

Source

pub fn new(matrix: SymCsrMatrix<T>) -> Self

Create a new SymCSR array from a SymCSR matrix

§Arguments
  • matrix - Symmetric CSR matrix
§Returns

SymCSR array

Source

pub fn from_csr_array(array: &CsrArray<T>) -> SparseResult<Self>

Create a SymCSR array from a regular CSR array

§Arguments
  • array - CSR array to convert
§Returns

A symmetric CSR array

Source

pub fn inner(&self) -> &SymCsrMatrix<T>

Get the underlying matrix

§Returns

Reference to the inner SymCSR matrix

Source

pub fn data(&self) -> &[T]

Get access to the underlying data array

§Returns

Reference to the data array

Source

pub fn indices(&self) -> &[usize]

Get access to the underlying indices array

§Returns

Reference to the indices array

Source

pub fn indptr(&self) -> &[usize]

Get access to the underlying indptr array

§Returns

Reference to the indptr array

Source

pub fn to_csr_array(&self) -> SparseResult<CsrArray<T>>

Convert to a standard CSR array

§Returns

CSR array containing the full symmetric matrix

Trait Implementations§

Source§

impl<T> Clone for SymCsrArray<T>
where T: Float + Debug + Copy + Clone,

Source§

fn clone(&self) -> SymCsrArray<T>

Returns a duplicate of the value. Read more
1.0.0 · Source§

const fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T> Debug for SymCsrArray<T>
where T: Float + Debug + Copy + Debug,

Source§

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

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

impl<T> SparseArray<T> for SymCsrArray<T>
where T: Float + Debug + Copy + 'static + Add<Output = T> + Sub<Output = T> + Mul<Output = T> + Div<Output = T>,

Implementation of SparseArray for SymCsrArray

Source§

fn to_coo(&self) -> SparseResult<Box<dyn SparseArray<T>>>

Returns a sparse array in COO format.
Source§

fn to_csr(&self) -> SparseResult<Box<dyn SparseArray<T>>>

Returns a sparse array in CSR format.
Source§

fn shape(&self) -> (usize, usize)

Returns the shape of the sparse array.
Source§

fn nnz(&self) -> usize

Returns the number of stored (non-zero) elements.
Source§

fn dtype(&self) -> &str

Returns the data type of the sparse array.
Source§

fn get(&self, row: usize, col: usize) -> T

Get a value at the specified position.
Source§

fn to_array(&self) -> Array2<T>

Returns a view of the sparse array as a dense ndarray.
Source§

fn toarray(&self) -> Array2<T>

Returns a dense copy of the sparse array.
Source§

fn set(&mut self, _i: usize, _j: usize, _value: T) -> SparseResult<()>

Set a value at the specified position.
Source§

fn dot_vector(&self, other: &ArrayView1<'_, T>) -> SparseResult<Array1<T>>

Matrix-vector multiplication.
Source§

fn copy(&self) -> Box<dyn SparseArray<T>>

Return a copy of the sparse array with the specified elements.
Source§

fn sub( &self, other: &dyn SparseArray<T>, ) -> SparseResult<Box<dyn SparseArray<T>>>

Element-wise subtraction.
Source§

fn div( &self, other: &dyn SparseArray<T>, ) -> SparseResult<Box<dyn SparseArray<T>>>

Element-wise division.
Source§

fn eliminate_zeros(&mut self)

Eliminate zeros from the sparse array.
Source§

fn sort_indices(&mut self)

Sort indices of the sparse array.
Source§

fn sorted_indices(&self) -> Box<dyn SparseArray<T>>

Return a sorted copy of this sparse array.
Source§

fn has_sorted_indices(&self) -> bool

Check if indices are sorted.
Source§

fn sum(&self, axis: Option<usize>) -> SparseResult<SparseSum<T>>

Sum the sparse array elements. Read more
Source§

fn max(&self) -> T

Compute the maximum value of the sparse array elements.
Source§

fn min(&self) -> T

Compute the minimum value of the sparse array elements.
Source§

fn slice( &self, rows: (usize, usize), cols: (usize, usize), ) -> SparseResult<Box<dyn SparseArray<T>>>

Return a slice of the sparse array.
Source§

fn as_any(&self) -> &dyn Any

Returns the concrete type of the array for downcasting.
Source§

fn find(&self) -> (Array1<usize>, Array1<usize>, Array1<T>)

Return the indices and values of the nonzero elements.
Source§

fn add( &self, other: &dyn SparseArray<T>, ) -> SparseResult<Box<dyn SparseArray<T>>>

Element-wise addition.
Source§

fn mul( &self, other: &dyn SparseArray<T>, ) -> SparseResult<Box<dyn SparseArray<T>>>

Element-wise multiplication.
Source§

fn dot( &self, other: &dyn SparseArray<T>, ) -> SparseResult<Box<dyn SparseArray<T>>>

Matrix multiplication.
Source§

fn transpose(&self) -> SparseResult<Box<dyn SparseArray<T>>>

Transpose the sparse array.
Source§

fn to_csc(&self) -> SparseResult<Box<dyn SparseArray<T>>>

Returns a sparse array in CSC format.
Source§

fn to_dia(&self) -> SparseResult<Box<dyn SparseArray<T>>>

Returns a sparse array in DIA format.
Source§

fn to_dok(&self) -> SparseResult<Box<dyn SparseArray<T>>>

Returns a sparse array in DOK format.
Source§

fn to_lil(&self) -> SparseResult<Box<dyn SparseArray<T>>>

Returns a sparse array in LIL format.
Source§

fn to_bsr(&self) -> SparseResult<Box<dyn SparseArray<T>>>

Returns a sparse array in BSR format.
Source§

impl<T> SymSparseArray<T> for SymCsrArray<T>
where T: Float + Debug + Copy + 'static + Add<Output = T> + Sub<Output = T> + Mul<Output = T> + Div<Output = T>,

Implementation of SymSparseArray for SymCsrArray

Source§

fn nnz_stored(&self) -> usize

Get the number of stored non-zero elements Read more
Source§

fn to_csr(&self) -> SparseResult<CsrArray<T>>

Convert to standard CSR array Read more
Source§

fn to_coo(&self) -> SparseResult<CooArray<T>>

Convert to standard COO array Read more
Source§

fn to_sym_csr(&self) -> SparseResult<SymCsrArray<T>>

Convert to symmetric CSR array Read more
Source§

fn to_sym_coo(&self) -> SparseResult<SymCooArray<T>>

Convert to symmetric COO array Read more
Source§

fn is_symmetric(&self) -> bool

Check if the matrix is guaranteed to be symmetric Read more

Auto Trait Implementations§

§

impl<T> Freeze for SymCsrArray<T>

§

impl<T> RefUnwindSafe for SymCsrArray<T>
where T: RefUnwindSafe,

§

impl<T> Send for SymCsrArray<T>
where T: Send,

§

impl<T> Sync for SymCsrArray<T>
where T: Sync,

§

impl<T> Unpin for SymCsrArray<T>
where T: Unpin,

§

impl<T> UnwindSafe for SymCsrArray<T>
where T: 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> 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V