mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-12 03:39:01 +08:00
Extend doc on dense+sparse
This commit is contained in:
parent
1bc207c528
commit
102fa96a96
@ -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:
|
||||
|
Loading…
x
Reference in New Issue
Block a user