Struct SymbolicSparseColMat

Source
pub struct SymbolicSparseColMat<I> { /* private fields */ }
Expand description

Symbolic structure of sparse matrix in column format, either compressed or uncompressed.

Requires:

  • nrows <= I::Signed::MAX (always checked)

  • ncols <= I::Signed::MAX (always checked)

  • col_ptrs has length ncols + 1 (always checked)

  • col_ptrs is non-decreasing

  • col_ptrs[0]..col_ptrs[ncols] is a valid range in row_indices (always checked, assuming non-decreasing)

  • if nnz_per_col is None, elements of row_indices[col_ptrs[j]..col_ptrs[j + 1]] are less than nrows

  • nnz_per_col[j] <= col_ptrs[j+1] - col_ptrs[j]

  • if nnz_per_col is Some(_), elements of row_indices[col_ptrs[j]..][..nnz_per_col[j]] are less than nrows

Implementations§

Source§

impl<I: Index> SymbolicSparseColMat<I>

Source

pub fn new_checked( nrows: usize, ncols: usize, col_ptrs: Vec<I>, nnz_per_col: Option<Vec<I>>, row_indices: Vec<I>, ) -> Self

Creates a new symbolic matrix view after asserting its invariants.

§Panics

See type level documentation.

Source

pub fn new_unsorted_checked( nrows: usize, ncols: usize, col_ptrs: Vec<I>, nnz_per_col: Option<Vec<I>>, row_indices: Vec<I>, ) -> Self

Creates a new symbolic matrix view from data containing duplicate and/or unsorted row indices per column, after asserting its other invariants.

§Panics

See type level documentation.

Source

pub unsafe fn new_unchecked( nrows: usize, ncols: usize, col_ptrs: Vec<I>, nnz_per_col: Option<Vec<I>>, row_indices: Vec<I>, ) -> Self

Creates a new symbolic matrix view without asserting its invariants.

§Safety

See type level documentation.

Source

pub fn into_parts(self) -> (usize, usize, Vec<I>, Option<Vec<I>>, Vec<I>)

Returns the components of the matrix in the order:

  • row count,
  • column count,
  • column pointers,
  • nonzeros per column,
  • row indices.
Source

pub fn as_ref(&self) -> SymbolicSparseColMatRef<'_, I>

Returns a view over the symbolic structure of self.

Source

pub fn nrows(&self) -> usize

Returns the number of rows of the matrix.

Source

pub fn ncols(&self) -> usize

Returns the number of columns of the matrix.

Source

pub fn into_transpose(self) -> SymbolicSparseRowMat<I>

Consumes the matrix, and returns its transpose in row-major format without reallocating.

§Note

Allows unsorted matrices, producing an unsorted output.

Source

pub fn to_owned(&self) -> Result<SymbolicSparseColMat<I>, FaerError>

Copies the current matrix into a newly allocated matrix.

§Note

Allows unsorted matrices, producing an unsorted output.

Source

pub fn to_row_major(&self) -> Result<SymbolicSparseRowMat<I>, FaerError>

Copies the current matrix into a newly allocated matrix, with row-major order.

§Note

Allows unsorted matrices, producing a sorted output. Duplicate entries are kept, however.

Source

pub fn compute_nnz(&self) -> usize

Returns the number of symbolic non-zeros in the matrix.

The value is guaranteed to be less than I::Signed::MAX.

§Note

Allows unsorted matrices, but the output is a count of all the entries, including the duplicate ones.

Source

pub fn col_ptrs(&self) -> &[I]

Returns the column pointers.

Source

pub fn nnz_per_col(&self) -> Option<&[I]>

Returns the count of non-zeros per column of the matrix.

Source

pub fn row_indices(&self) -> &[I]

Returns the row indices.

Source

pub fn row_indices_of_col_raw(&self, j: usize) -> &[I]

Returns the row indices of column j.

§Panics

Panics if j >= self.ncols().

Source

pub fn row_indices_of_col( &self, j: usize, ) -> impl '_ + ExactSizeIterator + DoubleEndedIterator<Item = usize>

Returns the row indices of column j.

§Panics

Panics if j >= self.ncols().

Source

pub fn col_range(&self, j: usize) -> Range<usize>

Returns the range that the column j occupies in self.row_indices().

§Panics

Panics if j >= self.ncols().

Source

pub unsafe fn col_range_unchecked(&self, j: usize) -> Range<usize>

Returns the range that the column j occupies in self.row_indices().

§Safety

The behavior is undefined if j >= self.ncols().

Source§

impl<I: Index> SymbolicSparseColMat<I>

Source

pub fn try_new_from_indices( nrows: usize, ncols: usize, indices: &[(I, I)], ) -> Result<(Self, ValuesOrder<I>), CreationError>

Create a new symbolic structure, and the corresponding order for the numerical values from pairs of indices (row, col).

Source

pub fn try_new_from_nonnegative_indices( nrows: usize, ncols: usize, indices: &[(I::Signed, I::Signed)], ) -> Result<(Self, ValuesOrder<I>), CreationError>

Create a new symbolic structure, and the corresponding order for the numerical values from pairs of indices (row, col).

Negative indices are ignored.

Trait Implementations§

Source§

impl<I: Clone> Clone for SymbolicSparseColMat<I>

Source§

fn clone(&self) -> SymbolicSparseColMat<I>

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

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

Performs copy-assignment from source. Read more
Source§

impl<I: Index> Debug for SymbolicSparseColMat<I>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<I> Freeze for SymbolicSparseColMat<I>

§

impl<I> RefUnwindSafe for SymbolicSparseColMat<I>
where I: RefUnwindSafe,

§

impl<I> Send for SymbolicSparseColMat<I>
where I: Send,

§

impl<I> Sync for SymbolicSparseColMat<I>
where I: Sync,

§

impl<I> Unpin for SymbolicSparseColMat<I>
where I: Unpin,

§

impl<I> UnwindSafe for SymbolicSparseColMat<I>
where I: 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.