forked from M-Labs/nalgebra
Make CSR/CSC matrix examples more self contained
This commit is contained in:
parent
eb2b23b103
commit
c596e4985d
@ -24,6 +24,7 @@ use std::slice::{Iter, IterMut};
|
|||||||
/// # Usage
|
/// # Usage
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
|
/// use nalgebra_sparse::coo::CooMatrix;
|
||||||
/// use nalgebra_sparse::csc::CscMatrix;
|
/// use nalgebra_sparse::csc::CscMatrix;
|
||||||
/// use nalgebra::{DMatrix, Matrix3x4};
|
/// use nalgebra::{DMatrix, Matrix3x4};
|
||||||
/// use matrixcompare::assert_matrix_eq;
|
/// use matrixcompare::assert_matrix_eq;
|
||||||
@ -32,8 +33,9 @@ use std::slice::{Iter, IterMut};
|
|||||||
/// // change the sparsity pattern of the matrix after it has been constructed. The easiest
|
/// // change the sparsity pattern of the matrix after it has been constructed. The easiest
|
||||||
/// // way to construct a CSC matrix is to first incrementally construct a COO matrix,
|
/// // way to construct a CSC matrix is to first incrementally construct a COO matrix,
|
||||||
/// // and then convert it to CSC.
|
/// // and then convert it to CSC.
|
||||||
/// # use nalgebra_sparse::coo::CooMatrix;
|
///
|
||||||
/// # let coo = CooMatrix::<f64>::new(3, 3);
|
/// let mut coo = CooMatrix::<f64>::new(3, 3);
|
||||||
|
/// coo.push(2, 0, 1.0);
|
||||||
/// let csc = CscMatrix::from(&coo);
|
/// let csc = CscMatrix::from(&coo);
|
||||||
///
|
///
|
||||||
/// // Alternatively, a CSC matrix can be constructed directly from raw CSC data.
|
/// // Alternatively, a CSC matrix can be constructed directly from raw CSC data.
|
||||||
|
@ -25,6 +25,7 @@ use std::slice::{Iter, IterMut};
|
|||||||
/// # Usage
|
/// # Usage
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
|
/// use nalgebra_sparse::coo::CooMatrix;
|
||||||
/// use nalgebra_sparse::csr::CsrMatrix;
|
/// use nalgebra_sparse::csr::CsrMatrix;
|
||||||
/// use nalgebra::{DMatrix, Matrix3x4};
|
/// use nalgebra::{DMatrix, Matrix3x4};
|
||||||
/// use matrixcompare::assert_matrix_eq;
|
/// use matrixcompare::assert_matrix_eq;
|
||||||
@ -33,8 +34,9 @@ use std::slice::{Iter, IterMut};
|
|||||||
/// // change the sparsity pattern of the matrix after it has been constructed. The easiest
|
/// // change the sparsity pattern of the matrix after it has been constructed. The easiest
|
||||||
/// // way to construct a CSR matrix is to first incrementally construct a COO matrix,
|
/// // way to construct a CSR matrix is to first incrementally construct a COO matrix,
|
||||||
/// // and then convert it to CSR.
|
/// // and then convert it to CSR.
|
||||||
/// # use nalgebra_sparse::coo::CooMatrix;
|
///
|
||||||
/// # let coo = CooMatrix::<f64>::new(3, 3);
|
/// let mut coo = CooMatrix::<f64>::new(3, 3);
|
||||||
|
/// coo.push(2, 0, 1.0);
|
||||||
/// let csr = CsrMatrix::from(&coo);
|
/// let csr = CsrMatrix::from(&coo);
|
||||||
///
|
///
|
||||||
/// // Alternatively, a CSR matrix can be constructed directly from raw CSR data.
|
/// // Alternatively, a CSR matrix can be constructed directly from raw CSR data.
|
||||||
|
Loading…
Reference in New Issue
Block a user