#[non_exhaustive]pub struct CscLayout {
pub nnz: u64,
}Expand description
Descriptor for the CSC (Compressed Sparse Column) sparse layout.
CSC is the column analog of CSR and is defined only for rank-2 tensors.
A conforming implementation MUST reject a CSC descriptor whose tensor rank
is not 2 (checked by [LayoutDescriptor::validate_against_shape]).
Three buffers are required:
| Buffer | Contents |
|---|---|
0 — values | Non-zero values in column-major order; nnz elements. |
1 — row_indices | Row index of each non-zero; nnz uint64 elements. |
2 — col_ptr | Column pointer array; ncols + 1 uint64 elements where ncols = shape[1]. |
The byte_offset field MUST be 0 for CSC tensors.
Also known as CCS (Compressed Column Storage).
§Examples
use hurray_core::layout::{CscLayout, LayoutDescriptor};
let layout = LayoutDescriptor::Csc(CscLayout::new(5));
assert_eq!(layout.tag(), 0x08);
assert_eq!(layout.buffer_count().map(|n| n.get()), Some(3));Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.nnz: u64Number of stored (non-zero) elements. MAY be 0 for an empty sparse matrix.
Implementations§
Trait Implementations§
impl Eq for CscLayout
impl StructuralPartialEq for CscLayout
Auto Trait Implementations§
impl Freeze for CscLayout
impl RefUnwindSafe for CscLayout
impl Send for CscLayout
impl Sync for CscLayout
impl Unpin for CscLayout
impl UnsafeUnpin for CscLayout
impl UnwindSafe for CscLayout
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more