diff options
author | Gael Guennebaud <g.gael@free.fr> | 2016-01-30 14:58:21 +0100 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2016-01-30 14:58:21 +0100 |
commit | 102fa96a9610ccee4f246f8c1030c0bdc380a429 (patch) | |
tree | d61fd37b0482e7b94e0614d629fa383e54ea6343 /doc/TutorialSparse.dox | |
parent | 1bc207c528bcfc4d9fb27ada28a8aaf1b9e8d3f5 (diff) |
Extend doc on dense+sparse
Diffstat (limited to 'doc/TutorialSparse.dox')
-rw-r--r-- | doc/TutorialSparse.dox | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/doc/TutorialSparse.dox b/doc/TutorialSparse.dox index fb07adaa2..1f0be387d 100644 --- a/doc/TutorialSparse.dox +++ b/doc/TutorialSparse.dox @@ -257,7 +257,14 @@ Binary coefficient wise operators can also mix sparse and dense expressions: \code sm2 = sm1.cwiseProduct(dm1); dm2 = sm1 + dm1; +dm2 = dm1 - sm1; \endcode +Performance-wise, the adding/subtracting sparse and dense matrices is better performed in two steps. For instance, instead of doing <tt>dm2 = sm1 + dm1</tt>, better write: +\code +dm2 = dm1; +dm2 += sm1; +\endcode +This version has the advantage to fully exploit the higher performance of dense storage (no indirection, SIMD, etc.), and to pay the cost of slow sparse evaluation on the few non-zeros of the sparse matrix only. %Sparse expressions also support transposition: |