Skip to main content

Module sparse

Module sparse 

Source
Expand description

Sparse Tensor Support

Provides sparse tensor representations for memory-efficient storage and computation when tensors have many zero elements.

§Formats

  • COO (Coordinate): Best for construction and random access
  • CSR (Compressed Sparse Row): Best for row-wise operations and matrix-vector products

§Example

use axonml_tensor::sparse::{SparseTensor, SparseFormat};

// Create from COO format
let indices = vec![(0, 1), (1, 0), (2, 2)];
let values = vec![1.0, 2.0, 3.0];
let sparse = SparseTensor::from_coo(&indices, &values, &[3, 3]);

// Convert to dense
let dense = sparse.to_dense();

@version 0.1.0

Structs§

SparseCOO
Sparse tensor in COO (Coordinate) format.
SparseCSR
Sparse tensor in CSR (Compressed Sparse Row) format.

Enums§

SparseFormat
Sparse tensor storage format.
SparseTensor
Unified sparse tensor interface supporting multiple formats.