/** \eigenManualPage SparseQuickRefPage Quick reference guide for sparse matrices
\eigenAutoToc
<hr>
In this page, we give a quick summary of the main operations available for sparse matrices in the class SparseMatrix. First, it is recommended to read the introductory tutorial at \ref TutorialSparse. The important point to have in mind when working on sparse matrices is how they are stored :
i.e either row major or column major. The default is column major. Most arithmetic operations on sparse matrices will assert that they have the same storage order.
sm1.reserve(nnz); // Allocate room for nnz nonzeros elements.
\endcode
</td>
<td> Note that when calling reserve(), it is not required that nnz is the exact number of nonzero elements in the final matrix. However, an exact estimation will avoid multiple reallocations during the insertion phase. </td>
</tr>
<tr>
<td> Assignment </td>
<td>
\code
SparseMatrix<double,Colmajor> sm1;
// Initialize sm2 with sm1.
SparseMatrix<double,Rowmajor> sm2(sm1), sm3;
// Assignment and evaluations modify the storage order.
sm3 = sm1;
\endcode
</td>
<td> The copy constructor can be used to convert from a storage order to another</td>
</tr>
<tr class="alt">
<td> Element-wise Insertion</td>
<td>
\code
// Insert a new element;
sm1.insert(i, j) = v_ij;
// Update the value v_ij
sm1.coeffRef(i,j) = v_ij;
sm1.coeffRef(i,j) += v_ij;
sm1.coeffRef(i,j) -= v_ij;
\endcode
</td>
<td> insert() assumes that the element does not already exist; otherwise, use coeffRef()</td>
<td>A complete example is available at \link TutorialSparseFilling Triplet Insertion \endlink.</td>
</tr>
<tr class="alt">
<td> Constant or Random Insertion</td>
<td>
\code
sm1.setZero();
\endcode
</td>
<td>Remove all non-zero coefficients</td>
</tr>
</table>
\section SparseBasicInfos Matrix properties
Beyond the basic functions rows() and cols(), there are some useful functions that are available to easily get some informations from the matrix.
<table class="manual">
<tr>
<td> \code
sm1.rows(); // Number of rows
sm1.cols(); // Number of columns
sm1.nonZeros(); // Number of non zero values
sm1.outerSize(); // Number of columns (resp. rows) for a column major (resp. row major )
sm1.innerSize(); // Number of rows (resp. columns) for a row major (resp. column major)
sm1.norm(); // Euclidian norm of the matrix
sm1.squaredNorm(); // Squared norm of the matrix
sm1.blueNorm();
sm1.isVector(); // Check if sm1 is a sparse vector or a sparse matrix
sm1.isCompressed(); // Check if sm1 is in compressed form
...
\endcode </td>
</tr>
</table>
\section SparseBasicOps Arithmetic operations
It is easy to perform arithmetic operations on sparse matrices provided that the dimensions are adequate and that the matrices have the same storage order. Note that the evaluation can always be done in a matrix with a different storage order. In the following, \b sm denotes a sparse matrix, \b dm a dense matrix and \b dv a dense vector.
If the matrix is not in compressed form, makeCompressed() should be called before.\n
Note that these functions are mostly provided for interoperability purposes with external libraries.\n
A better access to the values of the matrix is done by using the InnerIterator class as described in \link TutorialSparse the Tutorial Sparse \endlink section</td>