Dew MtxVec NET
TSparseMtx.DenseToSparse Method
Summary
Convert dense matrix to sparse matrix format.

Class
TSparseMtx

Declaration
Procedure DenseToSparse(A: TMtx; ZeroThreshold: TSample = 0);

Description
Convert dense matrix A to modified compressed column sparse matrix format.
 See Also 
SparseToDense 

Example 1

Step 1: Construct dense matrix

var A,B: Matrix; SparseA: TSparseMtx; /// ... A.SetIt(3,3,false,[1,0,0,0,2,0,0,1,3]);

Step 2: Convert dense matrix to sparse matrix
/// ... SparseA.DenseToSparse(A);

Step 3: Convert sparse matrix back to dense and compare
/// ... SparseA.SparseToDense(B); if not A.Equal(B,1.0e-5) then ERaise('Not Equal!');

Copyright 2008 Dew Research
http://www.dewresearch.com