Skip to content
This repository has been archived by the owner on Oct 25, 2019. It is now read-only.

Commit

Permalink
Documentation update, fixes #30
Browse files Browse the repository at this point in the history
  • Loading branch information
tdegeus committed Jul 17, 2018
1 parent 11a31a9 commit 3f048ff
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
13 changes: 12 additions & 1 deletion docs/cppmat_var_diagonal.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ cppmat::diagonal::matrix

Square, diagonal, matrix, whereby only the diagonal components are stored:

.. code-block:: cpp
.. code-block:: none
[ X ;
X ;
Expand All @@ -39,3 +39,14 @@ Square, diagonal, matrix, whereby only the diagonal components are stored:
return 0;
}
Storage
-------

The storage order is as follows:

.. code-block:: none
[ 0 ;
1 ;
2 ]
20 changes: 19 additions & 1 deletion docs/cppmat_var_symmetric.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ cppmat::symmetric::matrix

Square, symmetric, matrix, whereby only the upper-diagonal components are stored:

.. code-block:: cpp
.. code-block:: none
[ X, X, X ;
X, X ;
Expand All @@ -38,3 +38,21 @@ Square, symmetric, matrix, whereby only the upper-diagonal components are stored
return 0;
}
Storage
-------

The storage order is as follows:

.. code-block:: none
[ 0, 1, 2 ;
3, 4 ;
5 ]
For an ``NxN`` matrix (square by definition), the component ``(i,j)`` can be extracted by

.. code-block:: cpp
if (i <= j) i*N - (i-1)*i/2 + j - i;
else j*N - (j-1)*j/2 + i - j;

0 comments on commit 3f048ff

Please sign in to comment.