identity

Function identity 

Source
pub fn identity(n: usize) -> SparseResult<CsrMatrix<f64>>
Expand description

Create an identity matrix in CSR format

§Arguments

  • n - Size of the matrix (n x n)

§Returns

  • Identity matrix in CSR format

§Example

use scirs2_sparse::utils::identity;

// Create a 3x3 identity matrix
let eye = identity(3).unwrap();