mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Compare commits
1438 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b9827c495e | ||
|
|
6056f4404c | ||
|
|
efd484546e | ||
|
|
a92681e0d2 | ||
|
|
47592d31ea | ||
|
|
1a9dda6bfd | ||
|
|
4c1a2b5614 | ||
|
|
c308cb1b24 | ||
|
|
85e9e6e780 | ||
|
|
c030925a66 | ||
|
|
fd074be1a0 | ||
|
|
e685bd7f46 | ||
|
|
e82f507747 | ||
|
|
1eea595550 | ||
|
|
d0980c7706 | ||
|
|
9055400f3d | ||
|
|
acb3c60295 | ||
|
|
f8b88d21a6 | ||
|
|
89a222ce50 | ||
|
|
960ec7aef2 | ||
|
|
e8bd2d49b3 | ||
|
|
f444996a7a | ||
|
|
a7c2e62a52 | ||
|
|
9ff967199a | ||
|
|
dc0ef2cbed | ||
|
|
7aa90a3b0f | ||
|
|
56488ddc0f | ||
|
|
165b69ca74 | ||
|
|
7abf6d02db | ||
|
|
73cb54835c | ||
|
|
cfe315476f | ||
|
|
f1583e86f6 | ||
|
|
4bd69750ed | ||
|
|
d40e32c94e | ||
|
|
a0bf1b4242 | ||
|
|
cf645db95b | ||
|
|
13135a82bd | ||
|
|
769cb99845 | ||
|
|
ba9add3c59 | ||
|
|
ddfb72a92f | ||
|
|
8c7e281c9e | ||
|
|
66c092e44e | ||
|
|
3ec6d38f35 | ||
|
|
96f64441f7 | ||
|
|
5af4d77511 | ||
|
|
88ac8ffad5 | ||
|
|
edb0183e0c | ||
|
|
befa141699 | ||
|
|
5c70b43abd | ||
|
|
6a3797f46f | ||
|
|
c4432aad15 | ||
|
|
ea0168c5a5 | ||
|
|
05fad4959a | ||
|
|
98eedb0c9a | ||
|
|
71424c4bf8 | ||
|
|
e59b246b08 | ||
|
|
4aa7038074 | ||
|
|
d9c80169e0 | ||
|
|
b514c943c7 | ||
|
|
8ba643a903 | ||
|
|
595c00157c | ||
|
|
1c6b224fb3 | ||
|
|
2361ec9c0e | ||
|
|
fcd213a297 | ||
|
|
37ed0d991a | ||
|
|
62b08cf9f9 | ||
|
|
46f011466b | ||
|
|
f600bdd76b | ||
|
|
421aa4f358 | ||
|
|
554356b034 | ||
|
|
97119f854f | ||
|
|
51ab034f63 | ||
|
|
0ebce69424 | ||
|
|
a748673bbb | ||
|
|
8597ee502b | ||
|
|
ac66f1c73d | ||
|
|
b392e6b21c | ||
|
|
e88aaae5f4 | ||
|
|
2d217a60a7 | ||
|
|
ef1439252c | ||
|
|
847bb317cd | ||
|
|
62d334c7d3 | ||
|
|
7713b29084 | ||
|
|
a08df3ff34 | ||
|
|
5bb9459124 | ||
|
|
80fd8fab87 | ||
|
|
84eeabd223 | ||
|
|
058fa781d7 | ||
|
|
b03209a7a6 | ||
|
|
71590d0ac7 | ||
|
|
1e1b4b6678 | ||
|
|
2e3353634f | ||
|
|
2461531e5a | ||
|
|
a68917594b | ||
|
|
3b93b1afb3 | ||
|
|
0fb74c1f8b | ||
|
|
bf650a3686 | ||
|
|
8fa951e31d | ||
|
|
1b64edbfd4 | ||
|
|
c74284ed81 | ||
|
|
b09316fbea | ||
|
|
c5fc8e6bdc | ||
|
|
88c844ae2f | ||
|
|
500c36de61 | ||
|
|
26234720bd | ||
|
|
0e38796e1c | ||
|
|
a2d9a4806a | ||
|
|
a72bf09e6d | ||
|
|
bb3e5c29cc | ||
|
|
81b3d29b26 | ||
|
|
f0b1b1df9b | ||
|
|
e061b7a538 | ||
|
|
8768ff3c31 | ||
|
|
77af14fb62 | ||
|
|
64b29e06b9 | ||
|
|
1c0e8bcf09 | ||
|
|
69fa405096 | ||
|
|
0f464d9d87 | ||
|
|
470d26d580 | ||
|
|
4dded73227 | ||
|
|
953d5ccfd5 | ||
|
|
98604576d1 | ||
|
|
45cbb0bbb1 | ||
|
|
cc641aabb7 | ||
|
|
aa6c516ec1 | ||
|
|
b39413794e | ||
|
|
bd511dde9d | ||
|
|
e2cfddf75f | ||
|
|
0927801a84 | ||
|
|
e972b55ec4 | ||
|
|
fc202bab39 | ||
|
|
fe51319980 | ||
|
|
0918c51e60 | ||
|
|
409547a0c8 | ||
|
|
4470c99975 | ||
|
|
6620aaa4b3 | ||
|
|
f669f5656a | ||
|
|
029d236ceb | ||
|
|
fe25f3b8e3 | ||
|
|
ceb4c9c10b | ||
|
|
cc5d7ff523 | ||
|
|
d771295554 | ||
|
|
fefec723aa | ||
|
|
780b2422e2 | ||
|
|
c21e45fbc5 | ||
|
|
057cfd2f02 | ||
|
|
114e863f08 | ||
|
|
410895a7e4 | ||
|
|
4716c2c666 | ||
|
|
91fe3a3004 | ||
|
|
84bba80916 | ||
|
|
91953d2d37 | ||
|
|
7b35b4cacc | ||
|
|
c3f3580b8f | ||
|
|
deecff97ed | ||
|
|
c6e8caf090 | ||
|
|
d10d6a40dd | ||
|
|
87629cd639 | ||
|
|
bde98df03f | ||
|
|
d4ec48575e | ||
|
|
554aa9b31d | ||
|
|
3af29caae8 | ||
|
|
f2ff8c091e | ||
|
|
f3be317614 | ||
|
|
08081f8293 | ||
|
|
7838fda82c | ||
|
|
3ba6647398 | ||
|
|
01f7918788 | ||
|
|
b50ffaddf2 | ||
|
|
74e460b995 | ||
|
|
c03c73c9b7 | ||
|
|
668518aed6 | ||
|
|
c739102ef9 | ||
|
|
2559fa9b0f | ||
|
|
dcb2a8b184 | ||
|
|
a8f2c6eec7 | ||
|
|
b1eca55328 | ||
|
|
f9931a0392 | ||
|
|
ebdf6a2dbb | ||
|
|
f64045a060 | ||
|
|
590f4b0aa3 | ||
|
|
5ef95fabee | ||
|
|
0f21613698 | ||
|
|
340b8afb14 | ||
|
|
9f99f61e69 | ||
|
|
759bd92a85 | ||
|
|
f89ba2a58b | ||
|
|
f1092d2f73 | ||
|
|
8296c4aaed | ||
|
|
9d82f7e30d | ||
|
|
e896c0ade7 | ||
|
|
5a6ea4edf6 | ||
|
|
b613173350 | ||
|
|
a727a2c4ed | ||
|
|
9dfdbd7e56 | ||
|
|
46fc881e4a | ||
|
|
c6eb84aabc | ||
|
|
e1f1091fde | ||
|
|
638c6948d7 | ||
|
|
e6952a51ba | ||
|
|
b9d314ae19 | ||
|
|
0039cd9cf9 | ||
|
|
14f537c296 | ||
|
|
641e824c56 | ||
|
|
b5124e7cfd | ||
|
|
54e3633b43 | ||
|
|
f697df7237 | ||
|
|
6559d09c60 | ||
|
|
8a382aa119 | ||
|
|
703c526355 | ||
|
|
4cdf3fe427 | ||
|
|
0feff6e987 | ||
|
|
cd679f2c47 | ||
|
|
f074d43f4b | ||
|
|
1ac8600126 | ||
|
|
378bdfb7f0 | ||
|
|
0526dc1bb4 | ||
|
|
1a36590e84 | ||
|
|
7e0b6c56b4 | ||
|
|
b12dd1ae3c | ||
|
|
71676eaddd | ||
|
|
0a0ab6dd15 | ||
|
|
5692723c58 | ||
|
|
8f4b8d204b | ||
|
|
3bd2b41b2e | ||
|
|
4928ea1212 | ||
|
|
b00fe1590d | ||
|
|
c94174b4fe | ||
|
|
91dd53e54d | ||
|
|
279786e987 | ||
|
|
699c80e404 | ||
|
|
ae4644cc68 | ||
|
|
36f7c1337f | ||
|
|
5023afc0af | ||
|
|
63974bcb88 | ||
|
|
79f4a59ed9 | ||
|
|
9f98650d0a | ||
|
|
8638dbb809 | ||
|
|
db5b0741b5 | ||
|
|
8efa5bb439 | ||
|
|
f5f6e2c6f4 | ||
|
|
a5a3a994c8 | ||
|
|
25c7d9164f | ||
|
|
ba44761435 | ||
|
|
1a96594607 | ||
|
|
61db9a0e89 | ||
|
|
bc129ad79c | ||
|
|
f5328be65a | ||
|
|
735f1fda39 | ||
|
|
57ab550a17 | ||
|
|
e887c61b3d | ||
|
|
b8d9eaa19b | ||
|
|
f806c23012 | ||
|
|
99501a2c4c | ||
|
|
7dad5f797e | ||
|
|
dcad508986 | ||
|
|
26977e281e | ||
|
|
1e109e1757 | ||
|
|
e469ac55c3 | ||
|
|
874f345562 | ||
|
|
608733415a | ||
|
|
57ec399ec9 | ||
|
|
d85abc89c5 | ||
|
|
309620ee1f | ||
|
|
56ca44ad1a | ||
|
|
e8cdbedefb | ||
|
|
6ccf97f3e6 | ||
|
|
433bce5c3a | ||
|
|
775f7e5fbb | ||
|
|
a819fa148d | ||
|
|
1a8dc85142 | ||
|
|
4974d1d2b4 | ||
|
|
e2f3e4e4aa | ||
|
|
b26e697182 | ||
|
|
b1f9f603a0 | ||
|
|
5384e89147 | ||
|
|
8518ba0bbc | ||
|
|
80cae358b0 | ||
|
|
0efaff9b3b | ||
|
|
41a20994cc | ||
|
|
a910a7466e | ||
|
|
4371911861 | ||
|
|
5fc4ce6449 | ||
|
|
77294047d6 | ||
|
|
bea36925db | ||
|
|
7f7a712062 | ||
|
|
30c849669d | ||
|
|
e0a8615b94 | ||
|
|
8efd9142b3 | ||
|
|
80ed5bd90c | ||
|
|
eb3695d2fc | ||
|
|
48db34a7b9 | ||
|
|
da584912b6 | ||
|
|
509e4ddc02 | ||
|
|
b33cf92878 | ||
|
|
1d3c8306f8 | ||
|
|
ec785b0180 | ||
|
|
eeabf7975e | ||
|
|
c2d1074932 | ||
|
|
722916e19d | ||
|
|
cb37f818ca | ||
|
|
9a06a71627 | ||
|
|
4577bafb91 | ||
|
|
739ed32222 | ||
|
|
58f0647f96 | ||
|
|
d0c3fcd382 | ||
|
|
19e16fe15f | ||
|
|
8f87be9e03 | ||
|
|
58725ff08c | ||
|
|
15bff016d1 | ||
|
|
c6fefe5d8e | ||
|
|
ee06f78679 | ||
|
|
9ea09179b5 | ||
|
|
b1789c112b | ||
|
|
2dde63499c | ||
|
|
7f2c6ed2fa | ||
|
|
c5a3777666 | ||
|
|
0833b82efd | ||
|
|
85c3389b28 | ||
|
|
67fcf47ecb | ||
|
|
fcecafde3a | ||
|
|
d62bfe73a9 | ||
|
|
bc99c5f7db | ||
|
|
1946cc4478 | ||
|
|
5e62427e22 | ||
|
|
4ec2f07a5b | ||
|
|
883168ed94 | ||
|
|
e5f134006b | ||
|
|
d2fc597d5b | ||
|
|
3d25b1f5b8 | ||
|
|
acecb7b09f | ||
|
|
21c0a2ce0c | ||
|
|
debc97821c | ||
|
|
e2e7ba9f85 | ||
|
|
bd2d330b25 | ||
|
|
79225db0b6 | ||
|
|
c426054767 | ||
|
|
1fa793cb97 | ||
|
|
04ffb9956e | ||
|
|
94ed7c81e6 | ||
|
|
fcb3573d17 | ||
|
|
fae4fd7a26 | ||
|
|
cf09c5f687 | ||
|
|
b508619392 | ||
|
|
0f65f2762d | ||
|
|
87524922dc | ||
|
|
a303b6a733 | ||
|
|
fe57b2f963 | ||
|
|
c12b7896d0 | ||
|
|
973e6a035f | ||
|
|
84aaa03182 | ||
|
|
aa5f79206f | ||
|
|
b4a9b3f496 | ||
|
|
d04f23260d | ||
|
|
8838b0a1ff | ||
|
|
f786897e4b | ||
|
|
7acd38d19e | ||
|
|
b50e5bc816 | ||
|
|
a370b1f2e2 | ||
|
|
a13bc22204 | ||
|
|
4b7c3abbea | ||
|
|
feacfa5f83 | ||
|
|
8472e697ca | ||
|
|
65af852b54 | ||
|
|
ae697b471c | ||
|
|
94e47798f4 | ||
|
|
d853adffdb | ||
|
|
880e72c130 | ||
|
|
bfdd9f3ac9 | ||
|
|
c566cfe2ba | ||
|
|
dba55041ab | ||
|
|
fd1aaf4772 | ||
|
|
c806009453 | ||
|
|
2cc41dbe83 | ||
|
|
c26e8a1af3 | ||
|
|
0ec1fc9e11 | ||
|
|
99d75235a9 | ||
|
|
4c70b0a762 | ||
|
|
d3f52debc6 | ||
|
|
0219f8aed4 | ||
|
|
2ed1838aeb | ||
|
|
4b36c3591f | ||
|
|
a991f94c0e | ||
|
|
498b7eed25 | ||
|
|
767424af18 | ||
|
|
a80e17cfe8 | ||
|
|
349c2c9235 | ||
|
|
48d537f59f | ||
|
|
538c059aa4 | ||
|
|
a48b82eece | ||
|
|
ccd70ba123 | ||
|
|
44beee9d68 | ||
|
|
0a07ac574e | ||
|
|
6c047d398d | ||
|
|
4b886e6b39 | ||
|
|
5741349294 | ||
|
|
118b1113d9 | ||
|
|
503c176d8e | ||
|
|
dbdd8b0883 | ||
|
|
d44d432baa | ||
|
|
893bfcf95f | ||
|
|
fb53ff1eda | ||
|
|
7a17639953 | ||
|
|
bbce6fa65d | ||
|
|
95a430a2ca | ||
|
|
152f3218ac | ||
|
|
af2e5995e2 | ||
|
|
1269392822 | ||
|
|
b7271dffb5 | ||
|
|
8b2afe33a1 | ||
|
|
5cc23199be | ||
|
|
7caaf6453b | ||
|
|
1c236f4c9a | ||
|
|
1fa6fe2abd | ||
|
|
9d3c69952b | ||
|
|
5180bb5e47 | ||
|
|
0187504912 | ||
|
|
6d26deb894 | ||
|
|
81517eebc1 | ||
|
|
12d59465cb | ||
|
|
e404841235 | ||
|
|
15c946338f | ||
|
|
56a0bbbbee | ||
|
|
842e31cf5c | ||
|
|
abd3502e9e | ||
|
|
76c3cf6949 | ||
|
|
bc34ee3365 | ||
|
|
9a04cd307c | ||
|
|
f0a62c90bc | ||
|
|
2946992ad4 | ||
|
|
821ff0ecfb | ||
|
|
2c4cace56c | ||
|
|
8a502233d8 | ||
|
|
b2755edcdd | ||
|
|
d1ef3c3546 | ||
|
|
edaefeb978 | ||
|
|
3bd31e21b5 | ||
|
|
75e269c77b | ||
|
|
74cde0c925 | ||
|
|
ce2035af86 | ||
|
|
6d0f0b8cec | ||
|
|
4ba8aa1482 | ||
|
|
27d6b4daf9 | ||
|
|
446001ef51 | ||
|
|
13cbc751c9 | ||
|
|
421feea3b2 | ||
|
|
7817bc19a4 | ||
|
|
eb13ada3aa | ||
|
|
36448c9e28 | ||
|
|
de0d8a010e | ||
|
|
72569f17ec | ||
|
|
3878e6f170 | ||
|
|
ff46ec0f24 | ||
|
|
ae514ddfe5 | ||
|
|
f9d6d3780f | ||
|
|
abba11bdcf | ||
|
|
d9e0336a78 | ||
|
|
333905b0c2 | ||
|
|
5fa69422a2 | ||
|
|
de38ff2499 | ||
|
|
60e093a9dc | ||
|
|
56408504e4 | ||
|
|
974fe38ca3 | ||
|
|
c0205ca4af | ||
|
|
10f8aabb61 | ||
|
|
80de35b6c5 | ||
|
|
60663a510a | ||
|
|
03dd4dd91a | ||
|
|
0a18eecab3 | ||
|
|
7b044c0ead | ||
|
|
755e77266f | ||
|
|
07c5500d70 | ||
|
|
e70506dd8f | ||
|
|
2ae20d558b | ||
|
|
62bce6e5e6 | ||
|
|
060e835ee9 | ||
|
|
0ca43f7e9a | ||
|
|
8b3be4907d | ||
|
|
0bf5894861 | ||
|
|
e44d78dab3 | ||
|
|
c2f66c65aa | ||
|
|
125619146b | ||
|
|
341ae8665d | ||
|
|
fc23e93707 | ||
|
|
0f0580b97c | ||
|
|
486ca277a0 | ||
|
|
10a79ca3a3 | ||
|
|
466d6d41c6 | ||
|
|
8514179aa3 | ||
|
|
0403d49006 | ||
|
|
c83e01f2d6 | ||
|
|
26db954776 | ||
|
|
fda680f9cf | ||
|
|
dfc54e1bbf | ||
|
|
749b56f6af | ||
|
|
af9c9f7706 | ||
|
|
9452eb38f8 | ||
|
|
470aa15c35 | ||
|
|
188a13f9fe | ||
|
|
efdff15749 | ||
|
|
dacd39ea76 | ||
|
|
74db22455a | ||
|
|
b23556bbbd | ||
|
|
1abe4ed14c | ||
|
|
d43f737b4a | ||
|
|
f50548e86a | ||
|
|
15bad3670b | ||
|
|
8846aa6d1b | ||
|
|
80993b95d3 | ||
|
|
b24fe22b1a | ||
|
|
c82dc227f1 | ||
|
|
a96f3d629c | ||
|
|
47829e2d16 | ||
|
|
1f398dfc82 | ||
|
|
b3a0365429 | ||
|
|
eb39296028 | ||
|
|
72c4f8ca8f | ||
|
|
b121eecf60 | ||
|
|
8754341848 | ||
|
|
daad9585a3 | ||
|
|
b051bbd64f | ||
|
|
b3d63b4db2 | ||
|
|
1c4b69c5fb | ||
|
|
8a74ce922c | ||
|
|
863b7362bc | ||
|
|
1bf3b34849 | ||
|
|
f9580a3473 | ||
|
|
fbb53b6cbb | ||
|
|
85c7659574 | ||
|
|
bc065c75d2 | ||
|
|
e6cc24cbd6 | ||
|
|
0369db12af | ||
|
|
7ff266e3ce | ||
|
|
b4a709520d | ||
|
|
c1d0f15bde | ||
|
|
124d12a915 | ||
|
|
f29dbec321 | ||
|
|
01f3ca3e8d | ||
|
|
aec3d90ca6 | ||
|
|
460662cbcc | ||
|
|
1ed9e2d004 | ||
|
|
e49e84d979 | ||
|
|
c3e4080474 | ||
|
|
2959045f2f | ||
|
|
36fffe48f7 | ||
|
|
fb5c1e9097 | ||
|
|
0ba490cf80 | ||
|
|
25a3e65a68 | ||
|
|
be3477e206 | ||
|
|
2e50289ba3 | ||
|
|
b49ef99617 | ||
|
|
9c0aa81fbf | ||
|
|
3d298da269 | ||
|
|
eeadc06e83 | ||
|
|
4403800e11 | ||
|
|
9062f74d13 | ||
|
|
6a3423da80 | ||
|
|
9ac3c821ea | ||
|
|
33c702c79f | ||
|
|
756292f8aa | ||
|
|
8c8db49331 | ||
|
|
eeb43f9e2b | ||
|
|
16047c8d4a | ||
|
|
916ef48846 | ||
|
|
f1d8c13dbc | ||
|
|
9faad2932f | ||
|
|
f8fad09301 | ||
|
|
72e7529708 | ||
|
|
1aa2bf8274 | ||
|
|
b1892ab14d | ||
|
|
439feca139 | ||
|
|
e6d55c081b | ||
|
|
57f71a5552 | ||
|
|
5e890d3ad7 | ||
|
|
2d90484450 | ||
|
|
84a7ead059 | ||
|
|
d6236d3b26 | ||
|
|
921a645481 | ||
|
|
4b678b96eb | ||
|
|
51b3f558bb | ||
|
|
6162672dc5 | ||
|
|
e54898f53e | ||
|
|
fafc829424 | ||
|
|
abb33258ce | ||
|
|
25bceefb4e | ||
|
|
60314beb38 | ||
|
|
280661e67d | ||
|
|
ff9bfc45f7 | ||
|
|
42e27d41a2 | ||
|
|
a44a343f03 | ||
|
|
18fbe7e7d4 | ||
|
|
3eb5253ca1 | ||
|
|
305aa1f9c5 | ||
|
|
50085d2c28 | ||
|
|
e51da9c3a8 | ||
|
|
953ec08089 | ||
|
|
3e59163a24 | ||
|
|
4dd55a2958 | ||
|
|
f25338f4d7 | ||
|
|
51357a6622 | ||
|
|
107bb308c3 | ||
|
|
c2ff44cbf3 | ||
|
|
c53f88297c | ||
|
|
6f58a41097 | ||
|
|
2a3c3c49a1 | ||
|
|
fc13b37c55 | ||
|
|
db76193bc7 | ||
|
|
647622281e | ||
|
|
d79516660c | ||
|
|
26d2cdefd4 | ||
|
|
db183ca7b3 | ||
|
|
702a3c17db | ||
|
|
5f5a8d97c0 | ||
|
|
bae2e3327b | ||
|
|
cd0ff253ec | ||
|
|
929e77192c | ||
|
|
ba694ce8cf | ||
|
|
2116e261fb | ||
|
|
5f3d542b8a | ||
|
|
a0a87410d0 | ||
|
|
2c625ec9ba | ||
|
|
1f371e78e6 | ||
|
|
f7bb7ee3f3 | ||
|
|
d1e9f39a9a | ||
|
|
7f15f27a9e | ||
|
|
922694a2d1 | ||
|
|
baa77ffe38 | ||
|
|
a8283e0ed2 | ||
|
|
4aac87251f | ||
|
|
6daa6a0d16 | ||
|
|
2a251ffab0 | ||
|
|
9b729f93a1 | ||
|
|
946b99dd5c | ||
|
|
50eef6dfc3 | ||
|
|
62f332fc04 | ||
|
|
3eba5e1101 | ||
|
|
529e6cb552 | ||
|
|
36e6c9064f | ||
|
|
a325d1cb1e | ||
|
|
da62eb22e4 | ||
|
|
77af4cc3c9 | ||
|
|
5e72151ca5 | ||
|
|
2cd38a6634 | ||
|
|
84ad8ce7e3 | ||
|
|
40b74411e4 | ||
|
|
14c8793a70 | ||
|
|
424c3ad266 | ||
|
|
a53f2b0e43 | ||
|
|
cd0b433540 | ||
|
|
338d2ec42b | ||
|
|
0a945687b7 | ||
|
|
a0d1aac6c5 | ||
|
|
2bdb3b1afd | ||
|
|
3c7686630d | ||
|
|
4f440b8123 | ||
|
|
a20e2462bf | ||
|
|
c0f76ce2cf | ||
|
|
df604e4f49 | ||
|
|
5f1eedd655 | ||
|
|
296cb40161 | ||
|
|
40bb98e76a | ||
|
|
9b7a6f0122 | ||
|
|
ffd3654f67 | ||
|
|
b1169ce40c | ||
|
|
d1460d9278 | ||
|
|
cf7cf7b490 | ||
|
|
f27f55bee3 | ||
|
|
e955725ff1 | ||
|
|
25b2f6624d | ||
|
|
23bb592a2d | ||
|
|
547d660f1d | ||
|
|
5633cde9ad | ||
|
|
fe8757a576 | ||
|
|
ff29221951 | ||
|
|
7fbc9d8409 | ||
|
|
79c3cfabe3 | ||
|
|
e0f390793c | ||
|
|
97812ad0d3 | ||
|
|
d66b5a1d91 | ||
|
|
b0152fdb1d | ||
|
|
e9c5418249 | ||
|
|
b25b517817 | ||
|
|
ce0fb1bca1 | ||
|
|
92fce631ed | ||
|
|
238308e0f7 | ||
|
|
719ac0d6b0 | ||
|
|
8e61a7aab6 | ||
|
|
09e992ce9f | ||
|
|
cdd401f743 | ||
|
|
59b7615d31 | ||
|
|
a8cb0dfcf5 | ||
|
|
0e7a26c19f | ||
|
|
13c636d864 | ||
|
|
00ec1629ca | ||
|
|
a72eabec9b | ||
|
|
235c97ba92 | ||
|
|
4126cb6369 | ||
|
|
8ea2ab4829 | ||
|
|
9b79607579 | ||
|
|
aadbfe78c2 | ||
|
|
7d5e16c733 | ||
|
|
e395a8042a | ||
|
|
91f1a161ca | ||
|
|
16bca3bfe2 | ||
|
|
e0ab58d815 | ||
|
|
c67a7148c4 | ||
|
|
38dc683901 | ||
|
|
cad0fa5d77 | ||
|
|
5daebe0a27 | ||
|
|
05fb735d1d | ||
|
|
7443d8b4e9 | ||
|
|
36506511a1 | ||
|
|
3afdc6d95a | ||
|
|
c14c03490f | ||
|
|
c880590d27 | ||
|
|
54294e2293 | ||
|
|
c7331ebb06 | ||
|
|
0321449944 | ||
|
|
44c390a370 | ||
|
|
bbaf01712c | ||
|
|
8e875d3c38 | ||
|
|
8d69b87c53 | ||
|
|
49cbaf3856 | ||
|
|
9b00035438 | ||
|
|
e215740e8e | ||
|
|
0cc67589d3 | ||
|
|
51e2e93019 | ||
|
|
9d3e0da385 | ||
|
|
6ff72f40cf | ||
|
|
75d19bb087 | ||
|
|
62f948c56a | ||
|
|
da1e356306 | ||
|
|
54fbbe7b4e | ||
|
|
ea0906dfd8 | ||
|
|
cc1bacea5b | ||
|
|
c285fda7f4 | ||
|
|
160034bba1 | ||
|
|
1967e7f2f3 | ||
|
|
6eb16aae2d | ||
|
|
77d57cd681 | ||
|
|
4777ca1afb | ||
|
|
e3557e8dd2 | ||
|
|
5214466b7a | ||
|
|
0e0ae40084 | ||
|
|
5c4733f6e4 | ||
|
|
b73908000c | ||
|
|
b47ef1431f | ||
|
|
e25e674852 | ||
|
|
4b6b76463a | ||
|
|
904509fbb6 | ||
|
|
08b0c08e5e | ||
|
|
0dfb73d46a | ||
|
|
7fa83e7374 | ||
|
|
7d53633e05 | ||
|
|
bc072c5cba | ||
|
|
47981c5925 | ||
|
|
1eefa5a841 | ||
|
|
e4b6979334 | ||
|
|
b9ee880f07 | ||
|
|
2bf58316ee | ||
|
|
85777fc131 | ||
|
|
58687aa5e6 | ||
|
|
339f14b8d1 | ||
|
|
d4cc1bdc7f | ||
|
|
8e19027130 | ||
|
|
ef4a86d6b8 | ||
|
|
68eafc10b1 | ||
|
|
1cb71a8782 | ||
|
|
ac1bb3e5b3 | ||
|
|
4860da2de1 | ||
|
|
7a915f6846 | ||
|
|
1a817d3b70 | ||
|
|
8ee38d2db6 | ||
|
|
f365380496 | ||
|
|
3a9f9faada | ||
|
|
bbe9e22d60 | ||
|
|
998455a570 | ||
|
|
b18a7ff6be | ||
|
|
0a8e4712d1 | ||
|
|
61b88d2feb | ||
|
|
e84bdbb445 | ||
|
|
bf334b8ae5 | ||
|
|
8f4cdbbc8f | ||
|
|
7390af91b6 | ||
|
|
1e6f53e070 | ||
|
|
6f846ef9c6 | ||
|
|
324e7e8fc9 | ||
|
|
3c63446507 | ||
|
|
746d2db6ed | ||
|
|
441f97b2df | ||
|
|
0ad7a644df | ||
|
|
7ffd55c980 | ||
|
|
065344a06b | ||
|
|
75e574275c | ||
|
|
c401167712 | ||
|
|
73e686c6a4 | ||
|
|
ae039dde13 | ||
|
|
e1f1f66a52 | ||
|
|
f0648f8860 | ||
|
|
08c615f1e4 | ||
|
|
54607665ab | ||
|
|
d73ee84d37 | ||
|
|
a7bd4c455a | ||
|
|
b868bfb84a | ||
|
|
3b19b466a7 | ||
|
|
199ac3f2e7 | ||
|
|
e3ba5329ff | ||
|
|
17f119689e | ||
|
|
f9496d341f | ||
|
|
e745a450de | ||
|
|
e86adc87e9 | ||
|
|
b59f045c07 | ||
|
|
755be9016a | ||
|
|
957c2c291b | ||
|
|
15c2c083e8 | ||
|
|
3117036b80 | ||
|
|
1c3843bf86 | ||
|
|
0ddde223e9 | ||
|
|
3849cc65ee | ||
|
|
5dbbe6b400 | ||
|
|
ec0a8b2e6d | ||
|
|
7fa87a8b12 | ||
|
|
b29b81a1f4 | ||
|
|
47585c8ab2 | ||
|
|
c415b627a7 | ||
|
|
78bb808337 | ||
|
|
963d338922 | ||
|
|
caf4936661 | ||
|
|
98ef44fe55 | ||
|
|
1fdef63d1f | ||
|
|
de150b1e14 | ||
|
|
55453c51e8 | ||
|
|
eb49100de9 | ||
|
|
afb1a8c124 | ||
|
|
c06ec0f464 | ||
|
|
95ecd582a3 | ||
|
|
b0979b8598 | ||
|
|
774c3c1e0a | ||
|
|
f80c8e17eb | ||
|
|
38ab7e6ed0 | ||
|
|
1ee4e2db15 | ||
|
|
aa664eabb9 | ||
|
|
4304c73542 | ||
|
|
925fb6b937 | ||
|
|
a77458a8ff | ||
|
|
a669052f12 | ||
|
|
36a2b2e9dc | ||
|
|
2859a31ac8 | ||
|
|
d13711a363 | ||
|
|
fe102248ac | ||
|
|
8c8ae2d819 | ||
|
|
29aebf96e6 | ||
|
|
79085e08e9 | ||
|
|
a961d72e65 | ||
|
|
abc1ca0af1 | ||
|
|
c331ce6b8e | ||
|
|
ed37c44765 | ||
|
|
8998f4099e | ||
|
|
96cb58fa3b | ||
|
|
ea99433523 | ||
|
|
cee62018fc | ||
|
|
58cfac9a12 | ||
|
|
45515779d3 | ||
|
|
6fa6cdd2b9 | ||
|
|
0f1e321dd4 | ||
|
|
789674809f | ||
|
|
eb56461ac2 | ||
|
|
736267cf6b | ||
|
|
7402fea0a8 | ||
|
|
e3ab46b8c9 | ||
|
|
c794099e69 | ||
|
|
aa524604b7 | ||
|
|
c55c5763fe | ||
|
|
eda79321be | ||
|
|
df92649379 | ||
|
|
0f94607947 | ||
|
|
edebb15275 | ||
|
|
9aa3dc4e21 | ||
|
|
881aab14b4 | ||
|
|
0320f7e3a7 | ||
|
|
5811e68dd1 | ||
|
|
9217de8bf2 | ||
|
|
84cb1d72b8 | ||
|
|
56de8d3816 | ||
|
|
b4beba72a2 | ||
|
|
b5e3d76aa5 | ||
|
|
0b7f95a03f | ||
|
|
d67aa1549b | ||
|
|
07986189b7 | ||
|
|
c0f2cb016e | ||
|
|
2fb64578aa | ||
|
|
ecf1f1d589 | ||
|
|
e7ef26fa44 | ||
|
|
450d0c3de0 | ||
|
|
f9d2f3903e | ||
|
|
6f64b0b487 | ||
|
|
c20e3641de | ||
|
|
2dbfd83424 | ||
|
|
7388fdf560 | ||
|
|
c9788d55b9 | ||
|
|
ae4d9434e2 | ||
|
|
4def7b1fa5 | ||
|
|
c79bd4b64b | ||
|
|
cf7eaed38d | ||
|
|
3d8d0f6269 | ||
|
|
b0e19db1cf | ||
|
|
8d85ce88e1 | ||
|
|
4eb92e5647 | ||
|
|
ccb4dec719 | ||
|
|
82b09fcb91 | ||
|
|
ecbd67a15a | ||
|
|
934ce93886 | ||
|
|
5c5231ab71 | ||
|
|
2606abed53 | ||
|
|
a7d20038df | ||
|
|
3454b4e5f1 | ||
|
|
94684721bd | ||
|
|
1388f4f9fd | ||
|
|
6d665d446b | ||
|
|
2c3c95990d | ||
|
|
6d6df90c9a | ||
|
|
c354bd47f7 | ||
|
|
9777a5ca60 | ||
|
|
9746396d1b | ||
|
|
e5d0cb54a5 | ||
|
|
1dd015fea6 | ||
|
|
45a4aad572 | ||
|
|
e1d461352e | ||
|
|
11fbdcbc38 | ||
|
|
0fa8290366 | ||
|
|
d936ddc3d1 | ||
|
|
de8336a9bc | ||
|
|
ffc995c9e4 | ||
|
|
d5a795f673 | ||
|
|
b30706bd5c | ||
|
|
e0dbb68c2f | ||
|
|
59f5f155c2 | ||
|
|
20c840be15 | ||
|
|
1afd50e0f3 | ||
|
|
3c66bb136b | ||
|
|
7098e6d976 | ||
|
|
feaf7c7e6d | ||
|
|
d567e3b893 | ||
|
|
148acf8e4f | ||
|
|
0587db8bf5 | ||
|
|
7903d3f27b | ||
|
|
a803ff18a9 | ||
|
|
91288e9bf9 | ||
|
|
fbd5eac7cf | ||
|
|
1b333c89c9 | ||
|
|
a1fcf599fa | ||
|
|
a91a7a1964 | ||
|
|
3b2321e3ab | ||
|
|
b446ff037e | ||
|
|
5afcb4965c | ||
|
|
096af59799 | ||
|
|
8044b00a7f | ||
|
|
aecc78325a | ||
|
|
1cb8de1250 | ||
|
|
56c4851323 | ||
|
|
ceae5b4145 | ||
|
|
ec65e6648c | ||
|
|
d992634fbc | ||
|
|
5e8622477b | ||
|
|
1221dd90aa | ||
|
|
93870d95b7 | ||
|
|
f603823ef3 | ||
|
|
8d0441052e | ||
|
|
82c8163067 | ||
|
|
1c0728043a | ||
|
|
e497a27ddc | ||
|
|
ad59ade116 | ||
|
|
39bfbd43f0 | ||
|
|
10aa14592a | ||
|
|
8d2bb2c20d | ||
|
|
c94fde118a | ||
|
|
51e85c936d | ||
|
|
8a94cb3edd | ||
|
|
7f3162f707 | ||
|
|
ee86679096 | ||
|
|
58fe2fc2b2 | ||
|
|
729363114f | ||
|
|
1697d7a179 | ||
|
|
3e1fe8e416 | ||
|
|
b776458ccb | ||
|
|
c4902a3d01 | ||
|
|
7d73c7f18b | ||
|
|
6f123d209e | ||
|
|
052aedd394 | ||
|
|
fb03b56647 | ||
|
|
6a81594771 | ||
|
|
9ce0d78513 | ||
|
|
a419cea4a0 | ||
|
|
ba3457cab2 | ||
|
|
14bc4b9704 | ||
|
|
e45a6bed45 | ||
|
|
cc73164aa8 | ||
|
|
f0a4c9d5ab | ||
|
|
8be011e776 | ||
|
|
a078f442a3 | ||
|
|
cf1a7bfbe1 | ||
|
|
bc401eb6fa | ||
|
|
b286a1e75c | ||
|
|
6bf3cc2732 | ||
|
|
7ae9b0805d | ||
|
|
08f7b3221d | ||
|
|
72707a8664 | ||
|
|
8a0845ebd7 | ||
|
|
3e42b775ea | ||
|
|
dead9085c0 | ||
|
|
4fe56a0e02 | ||
|
|
35a2c9cde7 | ||
|
|
bb4b67cf39 | ||
|
|
0a6c472335 | ||
|
|
2db792852f | ||
|
|
847d801a4c | ||
|
|
aceae8314b | ||
|
|
16d4c7a5e8 | ||
|
|
a395024d44 | ||
|
|
f74ed34539 | ||
|
|
5e26b7cf9d | ||
|
|
74b1d79d77 | ||
|
|
0b362e0c9a | ||
|
|
a6be1952f4 | ||
|
|
2379ccffcb | ||
|
|
88aa18df64 | ||
|
|
0bd5671b9e | ||
|
|
8dd3b716e3 | ||
|
|
7eefdb948c | ||
|
|
082f7ddc37 | ||
|
|
bbc0ada12a | ||
|
|
9be72cda2a | ||
|
|
ae40583965 | ||
|
|
5806e73800 | ||
|
|
2bf63c6b4a | ||
|
|
1b3d7fc04c | ||
|
|
da6ec81282 | ||
|
|
354bd8a428 | ||
|
|
5c0f294098 | ||
|
|
804ef2350d | ||
|
|
a6b130c63c | ||
|
|
8eac97138a | ||
|
|
1dd176b0b0 | ||
|
|
131027ee0a | ||
|
|
db7d49efbb | ||
|
|
9fdc6258cf | ||
|
|
21fecd5252 | ||
|
|
6fecb6f1b6 | ||
|
|
3e439889e0 | ||
|
|
cbc572caf7 | ||
|
|
1e0c2f6ddb | ||
|
|
c98881e130 | ||
|
|
d67548f345 | ||
|
|
6c7ab50811 | ||
|
|
728c3d2cb9 | ||
|
|
af31b6c37a | ||
|
|
93125e372d | ||
|
|
b2e1453e1e | ||
|
|
9621333545 | ||
|
|
5f6ec95291 | ||
|
|
ecd2c8f37b | ||
|
|
5960befc20 | ||
|
|
2eee6eaf3c | ||
|
|
8af02d19b2 | ||
|
|
95b0a6707b | ||
|
|
b1ab6a8e0b | ||
|
|
61cff28618 | ||
|
|
68e8ddaf94 | ||
|
|
3a735a6cf1 | ||
|
|
ccc41128fb | ||
|
|
b3a07eecc5 | ||
|
|
c16b80746a | ||
|
|
cbd7e98174 | ||
|
|
7ed9441ea4 | ||
|
|
5b78780def | ||
|
|
8169c6ac59 | ||
|
|
463554c254 | ||
|
|
82c066b3c4 | ||
|
|
0543cb51b5 | ||
|
|
99e27916cf | ||
|
|
37a1d736bf | ||
|
|
06545058bb | ||
|
|
7002aa858f | ||
|
|
8cfb138e73 | ||
|
|
1b5de5a37b | ||
|
|
a08cba6b5f | ||
|
|
573c587e3d | ||
|
|
551bf5c66a | ||
|
|
2d136d3d7f | ||
|
|
873401032b | ||
|
|
d595fd31f5 | ||
|
|
bffa15142c | ||
|
|
b14a4628af | ||
|
|
3573a10712 | ||
|
|
bd6eca059d | ||
|
|
ed461ba9bc | ||
|
|
3bb57e21a8 | ||
|
|
4b6b3f310f | ||
|
|
cd606bbc94 | ||
|
|
0508af4287 | ||
|
|
3283d98d13 | ||
|
|
0d3f496233 | ||
|
|
6df3bee687 | ||
|
|
97965dde9b | ||
|
|
0b1430ae10 | ||
|
|
c0e08e9e4b | ||
|
|
0715d49908 | ||
|
|
3291580630 | ||
|
|
14422decc2 | ||
|
|
7ea6ef8969 | ||
|
|
31c63ef0b4 | ||
|
|
e170e7070b | ||
|
|
c1921ad3e2 | ||
|
|
c4f08cfc05 | ||
|
|
9e71ecbeec | ||
|
|
ff8d81762d | ||
|
|
6c527bd811 | ||
|
|
e722f36ffa | ||
|
|
febfc7b9b4 | ||
|
|
64a85800bd | ||
|
|
94acccc126 | ||
|
|
34694d8828 | ||
|
|
ee1c55f923 | ||
|
|
f54e62e4a9 | ||
|
|
5fa7262e4c | ||
|
|
fef534f52e | ||
|
|
a7621809fe | ||
|
|
6cf938df53 | ||
|
|
afcfb560a2 | ||
|
|
40c42d9788 | ||
|
|
deab937d45 | ||
|
|
66f1c56aab | ||
|
|
aa0db35185 | ||
|
|
4c08385b74 | ||
|
|
4ccff2d028 | ||
|
|
3a4616d6e3 | ||
|
|
92190a1caf | ||
|
|
ac409f51f1 | ||
|
|
a6a57748dd | ||
|
|
c8c81c1e74 | ||
|
|
60cd361ebe | ||
|
|
c8bfbf4a7e | ||
|
|
01fd880424 | ||
|
|
e3fb190edf | ||
|
|
cfd3d6ce9c | ||
|
|
c39a3fa7a1 | ||
|
|
2a564695f0 | ||
|
|
a58325ac2f | ||
|
|
4cd4be97a7 | ||
|
|
548216b7ca | ||
|
|
e15cb9f4f8 | ||
|
|
bbf373bbe9 | ||
|
|
1200bd2ef0 | ||
|
|
8a49dd5626 | ||
|
|
ce99b502ce | ||
|
|
033ee7f6d9 | ||
|
|
ba2f79e680 | ||
|
|
72461be962 | ||
|
|
33ca9b4ee6 | ||
|
|
ce41b72eb8 | ||
|
|
d5cc083782 | ||
|
|
7313f32efa | ||
|
|
04e1e38eed | ||
|
|
47679c50ae | ||
|
|
76d2ca27e5 | ||
|
|
41e89c73c7 | ||
|
|
ac69d8769f | ||
|
|
6b6071866b | ||
|
|
d357bbd9c0 | ||
|
|
27c068e9d6 | ||
|
|
e94fe4cc3e | ||
|
|
2ca0ccd2f2 | ||
|
|
8d8acc3ab4 | ||
|
|
6c5e915e9a | ||
|
|
f0b82c3ab9 | ||
|
|
6f1a0479b3 | ||
|
|
b5fd774775 | ||
|
|
34ca81b1bf | ||
|
|
7f917807c6 | ||
|
|
8af1ba5346 | ||
|
|
c6f7337032 | ||
|
|
626821b0e3 | ||
|
|
27ca9437a1 | ||
|
|
d0261bd26c | ||
|
|
276801b25a | ||
|
|
d61345f366 | ||
|
|
c15c65990f | ||
|
|
fb6e32a62f | ||
|
|
d331def6cc | ||
|
|
5584275325 | ||
|
|
cc6dd878ee | ||
|
|
fc6ecebc69 | ||
|
|
49034d1570 | ||
|
|
230f5c3aa9 | ||
|
|
c550a0e634 | ||
|
|
28b2abdbea | ||
|
|
654eab3bd6 | ||
|
|
5d1291a4de | ||
|
|
8b4dd78d57 | ||
|
|
f6bac196d5 | ||
|
|
46dd1bb1be | ||
|
|
6b471f205e | ||
|
|
03a956925a | ||
|
|
f97b3cd024 | ||
|
|
5e28c41549 | ||
|
|
e59b38abef | ||
|
|
8f2d068e84 | ||
|
|
5c2d1b4710 | ||
|
|
b93520b1a5 | ||
|
|
cb8da751a0 | ||
|
|
fe0b44e876 | ||
|
|
ae83f5ede9 | ||
|
|
76c230a84d | ||
|
|
57327cc2d5 | ||
|
|
5887e82729 | ||
|
|
af9851d1d7 | ||
|
|
8fe609311d | ||
|
|
8edc964734 | ||
|
|
a37bdfc955 | ||
|
|
03de5c2410 | ||
|
|
4f572e4c14 | ||
|
|
87aee5fda1 | ||
|
|
1bb1a57ef7 | ||
|
|
7c9cdd6030 | ||
|
|
a236e15048 | ||
|
|
ad1dc50b57 | ||
|
|
0c4fc69d62 | ||
|
|
019dcfc21d | ||
|
|
19521c83b8 | ||
|
|
e16e52d493 | ||
|
|
c49421a82b | ||
|
|
ccd7beba90 | ||
|
|
84a99f3a93 | ||
|
|
bbd49d194a | ||
|
|
8f496cd3a3 | ||
|
|
6dc0e59b1e | ||
|
|
2702788da7 | ||
|
|
58c0a6f0fd | ||
|
|
5974685866 | ||
|
|
7fae9b358d | ||
|
|
e14f529dac | ||
|
|
fe2f437642 | ||
|
|
90b5d303db | ||
|
|
9b863c1830 | ||
|
|
11fbbc51fa | ||
|
|
d3e84b747a | ||
|
|
2e606394b1 | ||
|
|
285112fc55 | ||
|
|
9f3f42d66a | ||
|
|
a0e8577b49 | ||
|
|
a6bff116f9 | ||
|
|
36052c4911 | ||
|
|
3d2a3bc755 | ||
|
|
ad9dc05663 | ||
|
|
ff075def5c | ||
|
|
4d7dfafbe7 | ||
|
|
3390db099a | ||
|
|
c6da881849 | ||
|
|
b61facb08b | ||
|
|
4a42843513 | ||
|
|
b433fb2857 | ||
|
|
2c0303c89e | ||
|
|
0bce534c8f | ||
|
|
6bef527f9d | ||
|
|
2d186da58a | ||
|
|
3736e00ae7 | ||
|
|
40f1548b32 | ||
|
|
446320b226 | ||
|
|
54e576c88a | ||
|
|
fe19f972e1 | ||
|
|
00dc45d0f9 | ||
|
|
4bb1c48f25 | ||
|
|
bd21c82a94 | ||
|
|
1b4623e713 | ||
|
|
a1f056cf2a | ||
|
|
4612a1cd87 | ||
|
|
07417bd03f | ||
|
|
7fa007e8bf | ||
|
|
ed78a76161 | ||
|
|
eda2f8948a | ||
|
|
16cbd3d72d | ||
|
|
86daf2f75c | ||
|
|
69c057ccb1 | ||
|
|
94a7a1ec00 | ||
|
|
5864e3fbd5 | ||
|
|
d2c4f4ab21 | ||
|
|
41321e4366 | ||
|
|
e6462c2ce3 | ||
|
|
1472f4bc61 | ||
|
|
a147500dee | ||
|
|
d1c48f1606 | ||
|
|
1b8394f71f | ||
|
|
4ecfdc4716 | ||
|
|
43c2747e92 | ||
|
|
d9381598bc | ||
|
|
403be74861 | ||
|
|
1c61e28b32 | ||
|
|
c06e373beb | ||
|
|
3c5e82ee0b | ||
|
|
d132159ba3 | ||
|
|
075b1168b4 | ||
|
|
be027bede8 | ||
|
|
f1ed1b7d11 | ||
|
|
20b0747bdb | ||
|
|
11462c1a29 | ||
|
|
e667819055 | ||
|
|
35c9f8779d | ||
|
|
da81e863e2 | ||
|
|
c5c4269961 | ||
|
|
b734863536 | ||
|
|
1046ea7a89 | ||
|
|
8b10081dea | ||
|
|
042bd9cbe2 | ||
|
|
93e867b63c | ||
|
|
e702934dfa | ||
|
|
eef44fb2a5 | ||
|
|
eb9c8cffd6 | ||
|
|
240e2f4162 | ||
|
|
b0702dca05 | ||
|
|
7191f31961 | ||
|
|
6d7bd066e0 | ||
|
|
66078fbd58 | ||
|
|
7bca2910c7 | ||
|
|
2cf513e973 | ||
|
|
150c9fe536 | ||
|
|
6f7f0ab6c2 | ||
|
|
e4ffb7729a | ||
|
|
68069af969 | ||
|
|
d908ccc01c | ||
|
|
2b15e00106 | ||
|
|
127d7f2071 | ||
|
|
c47010e3d2 | ||
|
|
d4dd6aaed2 | ||
|
|
d3635b08da | ||
|
|
ebd6a7a46c | ||
|
|
e0dbc2913a | ||
|
|
1d89554f1b | ||
|
|
ace2ed7b87 | ||
|
|
956251b738 | ||
|
|
6f5f488a80 | ||
|
|
916d29e58f | ||
|
|
bffdc491b3 | ||
|
|
6719e56b5b | ||
|
|
c13e9bbabf | ||
|
|
e4acd6e2fd | ||
|
|
8a89ba9275 | ||
|
|
097a105603 | ||
|
|
306ce33e1c | ||
|
|
616f9cc593 | ||
|
|
2f0faf117e | ||
|
|
8710440951 | ||
|
|
8fdffdd573 | ||
|
|
3444f06f68 | ||
|
|
8f4d93a4b7 | ||
|
|
51b361b3bb | ||
|
|
7c99b38b7c | ||
|
|
b72a686830 | ||
|
|
e3058dd88b | ||
|
|
8ea7413a64 | ||
|
|
e90229a429 | ||
|
|
cf884a9815 | ||
|
|
ddf7753631 | ||
|
|
222eedf5f3 | ||
|
|
d0e543be26 | ||
|
|
8e6d0cba5f | ||
|
|
32d46dd9b8 | ||
|
|
e41bc6cbbf | ||
|
|
55b57fcba6 | ||
|
|
39491e3b75 | ||
|
|
68168e9eae | ||
|
|
6126ad801f | ||
|
|
43df1e707c | ||
|
|
b1f4601bf9 | ||
|
|
acb82c7f16 | ||
|
|
9ef3645cc7 | ||
|
|
5f11db695b | ||
|
|
2437215221 | ||
|
|
dd27b5c4a8 | ||
|
|
70131120ab | ||
|
|
6d86cd7224 | ||
|
|
75dab1ce5e | ||
|
|
e43934d60f | ||
|
|
75edc7cc8b | ||
|
|
5897695e8a | ||
|
|
a3a55357db | ||
|
|
084dc63b4c | ||
|
|
463343fb37 | ||
|
|
5879937f58 | ||
|
|
01190b3544 | ||
|
|
c00f688c64 | ||
|
|
51573da3a4 | ||
|
|
1191949e87 | ||
|
|
3d94ed9fa0 | ||
|
|
ede27f5780 | ||
|
|
dda869051d | ||
|
|
2320073e41 | ||
|
|
c587e63631 | ||
|
|
660b905e12 | ||
|
|
4f0bd557a4 | ||
|
|
736fe99fbf | ||
|
|
6fab4012a3 | ||
|
|
2f593ee67c | ||
|
|
20e535e142 | ||
|
|
4b780553e0 | ||
|
|
9be658f701 | ||
|
|
b8f0364a1c | ||
|
|
cbe92de2b5 | ||
|
|
eeb744dc8d | ||
|
|
d5501d3a90 | ||
|
|
3c423ccfe2 | ||
|
|
738d75d3eb | ||
|
|
a992fa74eb | ||
|
|
4466875d54 | ||
|
|
5c95892b83 | ||
|
|
639d03d900 | ||
|
|
d204bb57d0 | ||
|
|
c52cbd9de9 | ||
|
|
159a3bed9e | ||
|
|
25544dbec3 | ||
|
|
04bd1e3fc0 | ||
|
|
00e30a5fc4 | ||
|
|
55ec3cc6d5 | ||
|
|
9e2b4eeac0 | ||
|
|
c273a6c37c | ||
|
|
04a9ad6e10 | ||
|
|
4e26057f66 | ||
|
|
cce68d4e91 | ||
|
|
75b3391e3f | ||
|
|
231d4a6fda | ||
|
|
64054ee396 | ||
|
|
12e69ec896 | ||
|
|
8556ca3de5 | ||
|
|
9cd2d14005 | ||
|
|
4e2e615a7c | ||
|
|
12439e1249 | ||
|
|
d93c1c113b | ||
|
|
968f7591f8 | ||
|
|
5adcc6c7b4 |
@@ -301,7 +301,7 @@ if(EIGEN_INCLUDE_INSTALL_DIR)
|
|||||||
)
|
)
|
||||||
else()
|
else()
|
||||||
set(INCLUDE_INSTALL_DIR
|
set(INCLUDE_INSTALL_DIR
|
||||||
"${CMAKE_INSTALL_PREFIX}/include/eigen3"
|
"include/eigen3"
|
||||||
CACHE INTERNAL
|
CACHE INTERNAL
|
||||||
"The directory where we install the header files (internal)"
|
"The directory where we install the header files (internal)"
|
||||||
)
|
)
|
||||||
@@ -404,7 +404,7 @@ if(cmake_generator_tolower MATCHES "makefile")
|
|||||||
message(STATUS "make install | Install to ${CMAKE_INSTALL_PREFIX}. To change that:")
|
message(STATUS "make install | Install to ${CMAKE_INSTALL_PREFIX}. To change that:")
|
||||||
message(STATUS " | cmake . -DCMAKE_INSTALL_PREFIX=yourpath")
|
message(STATUS " | cmake . -DCMAKE_INSTALL_PREFIX=yourpath")
|
||||||
message(STATUS " | Eigen headers will then be installed to:")
|
message(STATUS " | Eigen headers will then be installed to:")
|
||||||
message(STATUS " | ${INCLUDE_INSTALL_DIR}")
|
message(STATUS " | ${CMAKE_INSTALL_PREFIX}/${INCLUDE_INSTALL_DIR}")
|
||||||
message(STATUS " | To install Eigen headers to a separate location, do:")
|
message(STATUS " | To install Eigen headers to a separate location, do:")
|
||||||
message(STATUS " | cmake . -DEIGEN_INCLUDE_INSTALL_DIR=yourpath")
|
message(STATUS " | cmake . -DEIGEN_INCLUDE_INSTALL_DIR=yourpath")
|
||||||
message(STATUS "make doc | Generate the API documentation, requires Doxygen & LaTeX")
|
message(STATUS "make doc | Generate the API documentation, requires Doxygen & LaTeX")
|
||||||
|
|||||||
@@ -4,14 +4,10 @@
|
|||||||
## # The following are required to uses Dart and the Cdash dashboard
|
## # The following are required to uses Dart and the Cdash dashboard
|
||||||
## ENABLE_TESTING()
|
## ENABLE_TESTING()
|
||||||
## INCLUDE(CTest)
|
## INCLUDE(CTest)
|
||||||
set(CTEST_PROJECT_NAME "Eigen")
|
set(CTEST_PROJECT_NAME "Eigen3.2")
|
||||||
set(CTEST_NIGHTLY_START_TIME "00:00:00 UTC")
|
set(CTEST_NIGHTLY_START_TIME "00:00:00 UTC")
|
||||||
|
|
||||||
set(CTEST_DROP_METHOD "http")
|
set(CTEST_DROP_METHOD "http")
|
||||||
set(CTEST_DROP_SITE "manao.inria.fr")
|
set(CTEST_DROP_SITE "manao.inria.fr")
|
||||||
set(CTEST_DROP_LOCATION "/CDash/submit.php?project=Eigen")
|
set(CTEST_DROP_LOCATION "/CDash/submit.php?project=Eigen3.2")
|
||||||
set(CTEST_DROP_SITE_CDASH TRUE)
|
set(CTEST_DROP_SITE_CDASH TRUE)
|
||||||
set(CTEST_PROJECT_SUBPROJECTS
|
|
||||||
Official
|
|
||||||
Unsupported
|
|
||||||
)
|
|
||||||
|
|||||||
@@ -95,7 +95,7 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
// In theory we should only include immintrin.h and not the other *mmintrin.h header files directly.
|
// In theory we should only include immintrin.h and not the other *mmintrin.h header files directly.
|
||||||
// Doing so triggers some issues with ICC. However old gcc versions seems to not have this file, thus:
|
// Doing so triggers some issues with ICC. However old gcc versions seems to not have this file, thus:
|
||||||
#ifdef __INTEL_COMPILER
|
#if defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 1110
|
||||||
#include <immintrin.h>
|
#include <immintrin.h>
|
||||||
#else
|
#else
|
||||||
#include <emmintrin.h>
|
#include <emmintrin.h>
|
||||||
@@ -123,7 +123,7 @@
|
|||||||
#undef bool
|
#undef bool
|
||||||
#undef vector
|
#undef vector
|
||||||
#undef pixel
|
#undef pixel
|
||||||
#elif defined __ARM_NEON__
|
#elif defined __ARM_NEON
|
||||||
#define EIGEN_VECTORIZE
|
#define EIGEN_VECTORIZE
|
||||||
#define EIGEN_VECTORIZE_NEON
|
#define EIGEN_VECTORIZE_NEON
|
||||||
#include <arm_neon.h>
|
#include <arm_neon.h>
|
||||||
@@ -165,7 +165,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// required for __cpuid, needs to be included after cmath
|
// required for __cpuid, needs to be included after cmath
|
||||||
#if defined(_MSC_VER) && (defined(_M_IX86)||defined(_M_X64))
|
#if defined(_MSC_VER) && (defined(_M_IX86)||defined(_M_X64)) && (!defined(_WIN32_WCE))
|
||||||
#include <intrin.h>
|
#include <intrin.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
/**
|
/**
|
||||||
* \defgroup SparseCore_Module SparseCore module
|
* \defgroup SparseCore_Module SparseCore module
|
||||||
*
|
*
|
||||||
* This module provides a sparse matrix representation, and basic associatd matrix manipulations
|
* This module provides a sparse matrix representation, and basic associated matrix manipulations
|
||||||
* and operations.
|
* and operations.
|
||||||
*
|
*
|
||||||
* See the \ref TutorialSparse "Sparse tutorial"
|
* See the \ref TutorialSparse "Sparse tutorial"
|
||||||
|
|||||||
@@ -235,6 +235,11 @@ template<typename _MatrixType, int _UpLo> class LDLT
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
static void check_template_parameters()
|
||||||
|
{
|
||||||
|
EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar);
|
||||||
|
}
|
||||||
|
|
||||||
/** \internal
|
/** \internal
|
||||||
* Used to compute and store the Cholesky decomposition A = L D L^* = U^* D U.
|
* Used to compute and store the Cholesky decomposition A = L D L^* = U^* D U.
|
||||||
@@ -274,30 +279,13 @@ template<> struct ldlt_inplace<Lower>
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
RealScalar cutoff(0), biggest_in_corner;
|
|
||||||
|
|
||||||
for (Index k = 0; k < size; ++k)
|
for (Index k = 0; k < size; ++k)
|
||||||
{
|
{
|
||||||
// Find largest diagonal element
|
// Find largest diagonal element
|
||||||
Index index_of_biggest_in_corner;
|
Index index_of_biggest_in_corner;
|
||||||
biggest_in_corner = mat.diagonal().tail(size-k).cwiseAbs().maxCoeff(&index_of_biggest_in_corner);
|
mat.diagonal().tail(size-k).cwiseAbs().maxCoeff(&index_of_biggest_in_corner);
|
||||||
index_of_biggest_in_corner += k;
|
index_of_biggest_in_corner += k;
|
||||||
|
|
||||||
if(k == 0)
|
|
||||||
{
|
|
||||||
// The biggest overall is the point of reference to which further diagonals
|
|
||||||
// are compared; if any diagonal is negligible compared
|
|
||||||
// to the largest overall, the algorithm bails.
|
|
||||||
cutoff = abs(NumTraits<Scalar>::epsilon() * biggest_in_corner);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Finish early if the matrix is not full rank.
|
|
||||||
if(biggest_in_corner < cutoff)
|
|
||||||
{
|
|
||||||
for(Index i = k; i < size; i++) transpositions.coeffRef(i) = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
transpositions.coeffRef(k) = index_of_biggest_in_corner;
|
transpositions.coeffRef(k) = index_of_biggest_in_corner;
|
||||||
if(k != index_of_biggest_in_corner)
|
if(k != index_of_biggest_in_corner)
|
||||||
{
|
{
|
||||||
@@ -328,15 +316,20 @@ template<> struct ldlt_inplace<Lower>
|
|||||||
|
|
||||||
if(k>0)
|
if(k>0)
|
||||||
{
|
{
|
||||||
temp.head(k) = mat.diagonal().head(k).asDiagonal() * A10.adjoint();
|
temp.head(k) = mat.diagonal().real().head(k).asDiagonal() * A10.adjoint();
|
||||||
mat.coeffRef(k,k) -= (A10 * temp.head(k)).value();
|
mat.coeffRef(k,k) -= (A10 * temp.head(k)).value();
|
||||||
if(rs>0)
|
if(rs>0)
|
||||||
A21.noalias() -= A20 * temp.head(k);
|
A21.noalias() -= A20 * temp.head(k);
|
||||||
}
|
}
|
||||||
if((rs>0) && (abs(mat.coeffRef(k,k)) > cutoff))
|
|
||||||
A21 /= mat.coeffRef(k,k);
|
// In some previous versions of Eigen (e.g., 3.2.1), the scaling was omitted if the pivot
|
||||||
|
// was smaller than the cutoff value. However, soince LDLT is not rank-revealing
|
||||||
|
// we should only make sure we do not introduce INF or NaN values.
|
||||||
|
// LAPACK also uses 0 as the cutoff value.
|
||||||
RealScalar realAkk = numext::real(mat.coeffRef(k,k));
|
RealScalar realAkk = numext::real(mat.coeffRef(k,k));
|
||||||
|
if((rs>0) && (abs(realAkk) > RealScalar(0)))
|
||||||
|
A21 /= realAkk;
|
||||||
|
|
||||||
if (sign == PositiveSemiDef) {
|
if (sign == PositiveSemiDef) {
|
||||||
if (realAkk < 0) sign = Indefinite;
|
if (realAkk < 0) sign = Indefinite;
|
||||||
} else if (sign == NegativeSemiDef) {
|
} else if (sign == NegativeSemiDef) {
|
||||||
@@ -446,6 +439,8 @@ template<typename MatrixType> struct LDLT_Traits<MatrixType,Upper>
|
|||||||
template<typename MatrixType, int _UpLo>
|
template<typename MatrixType, int _UpLo>
|
||||||
LDLT<MatrixType,_UpLo>& LDLT<MatrixType,_UpLo>::compute(const MatrixType& a)
|
LDLT<MatrixType,_UpLo>& LDLT<MatrixType,_UpLo>::compute(const MatrixType& a)
|
||||||
{
|
{
|
||||||
|
check_template_parameters();
|
||||||
|
|
||||||
eigen_assert(a.rows()==a.cols());
|
eigen_assert(a.rows()==a.cols());
|
||||||
const Index size = a.rows();
|
const Index size = a.rows();
|
||||||
|
|
||||||
@@ -454,6 +449,7 @@ LDLT<MatrixType,_UpLo>& LDLT<MatrixType,_UpLo>::compute(const MatrixType& a)
|
|||||||
m_transpositions.resize(size);
|
m_transpositions.resize(size);
|
||||||
m_isInitialized = false;
|
m_isInitialized = false;
|
||||||
m_temporary.resize(size);
|
m_temporary.resize(size);
|
||||||
|
m_sign = internal::ZeroSign;
|
||||||
|
|
||||||
internal::ldlt_inplace<UpLo>::unblocked(m_matrix, m_transpositions, m_temporary, m_sign);
|
internal::ldlt_inplace<UpLo>::unblocked(m_matrix, m_transpositions, m_temporary, m_sign);
|
||||||
|
|
||||||
@@ -468,7 +464,7 @@ LDLT<MatrixType,_UpLo>& LDLT<MatrixType,_UpLo>::compute(const MatrixType& a)
|
|||||||
*/
|
*/
|
||||||
template<typename MatrixType, int _UpLo>
|
template<typename MatrixType, int _UpLo>
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
LDLT<MatrixType,_UpLo>& LDLT<MatrixType,_UpLo>::rankUpdate(const MatrixBase<Derived>& w, const typename NumTraits<typename MatrixType::Scalar>::Real& sigma)
|
LDLT<MatrixType,_UpLo>& LDLT<MatrixType,_UpLo>::rankUpdate(const MatrixBase<Derived>& w, const typename LDLT<MatrixType,_UpLo>::RealScalar& sigma)
|
||||||
{
|
{
|
||||||
const Index size = w.rows();
|
const Index size = w.rows();
|
||||||
if (m_isInitialized)
|
if (m_isInitialized)
|
||||||
@@ -514,16 +510,21 @@ struct solve_retval<LDLT<_MatrixType,_UpLo>, Rhs>
|
|||||||
using std::abs;
|
using std::abs;
|
||||||
using std::max;
|
using std::max;
|
||||||
typedef typename LDLTType::MatrixType MatrixType;
|
typedef typename LDLTType::MatrixType MatrixType;
|
||||||
typedef typename LDLTType::Scalar Scalar;
|
|
||||||
typedef typename LDLTType::RealScalar RealScalar;
|
typedef typename LDLTType::RealScalar RealScalar;
|
||||||
const Diagonal<const MatrixType> vectorD = dec().vectorD();
|
const typename Diagonal<const MatrixType>::RealReturnType vectorD(dec().vectorD());
|
||||||
RealScalar tolerance = (max)(vectorD.array().abs().maxCoeff() * NumTraits<Scalar>::epsilon(),
|
// In some previous versions, tolerance was set to the max of 1/highest and the maximal diagonal entry * epsilon
|
||||||
RealScalar(1) / NumTraits<RealScalar>::highest()); // motivated by LAPACK's xGELSS
|
// as motivated by LAPACK's xGELSS:
|
||||||
|
// RealScalar tolerance = (max)(vectorD.array().abs().maxCoeff() *NumTraits<RealScalar>::epsilon(),RealScalar(1) / NumTraits<RealScalar>::highest());
|
||||||
|
// However, LDLT is not rank revealing, and so adjusting the tolerance wrt to the highest
|
||||||
|
// diagonal element is not well justified and to numerical issues in some cases.
|
||||||
|
// Moreover, Lapack's xSYTRS routines use 0 for the tolerance.
|
||||||
|
RealScalar tolerance = RealScalar(1) / NumTraits<RealScalar>::highest();
|
||||||
|
|
||||||
for (Index i = 0; i < vectorD.size(); ++i) {
|
for (Index i = 0; i < vectorD.size(); ++i) {
|
||||||
if(abs(vectorD(i)) > tolerance)
|
if(abs(vectorD(i)) > tolerance)
|
||||||
dst.row(i) /= vectorD(i);
|
dst.row(i) /= vectorD(i);
|
||||||
else
|
else
|
||||||
dst.row(i).setZero();
|
dst.row(i).setZero();
|
||||||
}
|
}
|
||||||
|
|
||||||
// dst = L^-T (D^-1 L^-1 P b)
|
// dst = L^-T (D^-1 L^-1 P b)
|
||||||
@@ -576,7 +577,7 @@ MatrixType LDLT<MatrixType,_UpLo>::reconstructedMatrix() const
|
|||||||
// L^* P
|
// L^* P
|
||||||
res = matrixU() * res;
|
res = matrixU() * res;
|
||||||
// D(L^*P)
|
// D(L^*P)
|
||||||
res = vectorD().asDiagonal() * res;
|
res = vectorD().real().asDiagonal() * res;
|
||||||
// L(DL^*P)
|
// L(DL^*P)
|
||||||
res = matrixL() * res;
|
res = matrixL() * res;
|
||||||
// P^T (LDL^*P)
|
// P^T (LDL^*P)
|
||||||
|
|||||||
@@ -174,6 +174,12 @@ template<typename _MatrixType, int _UpLo> class LLT
|
|||||||
LLT rankUpdate(const VectorType& vec, const RealScalar& sigma = 1);
|
LLT rankUpdate(const VectorType& vec, const RealScalar& sigma = 1);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
static void check_template_parameters()
|
||||||
|
{
|
||||||
|
EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar);
|
||||||
|
}
|
||||||
|
|
||||||
/** \internal
|
/** \internal
|
||||||
* Used to compute and store L
|
* Used to compute and store L
|
||||||
* The strict upper part is not used and even not initialized.
|
* The strict upper part is not used and even not initialized.
|
||||||
@@ -283,7 +289,7 @@ template<typename Scalar> struct llt_inplace<Scalar, Lower>
|
|||||||
return k;
|
return k;
|
||||||
mat.coeffRef(k,k) = x = sqrt(x);
|
mat.coeffRef(k,k) = x = sqrt(x);
|
||||||
if (k>0 && rs>0) A21.noalias() -= A20 * A10.adjoint();
|
if (k>0 && rs>0) A21.noalias() -= A20 * A10.adjoint();
|
||||||
if (rs>0) A21 *= RealScalar(1)/x;
|
if (rs>0) A21 /= x;
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -384,6 +390,8 @@ template<typename MatrixType> struct LLT_Traits<MatrixType,Upper>
|
|||||||
template<typename MatrixType, int _UpLo>
|
template<typename MatrixType, int _UpLo>
|
||||||
LLT<MatrixType,_UpLo>& LLT<MatrixType,_UpLo>::compute(const MatrixType& a)
|
LLT<MatrixType,_UpLo>& LLT<MatrixType,_UpLo>::compute(const MatrixType& a)
|
||||||
{
|
{
|
||||||
|
check_template_parameters();
|
||||||
|
|
||||||
eigen_assert(a.rows()==a.cols());
|
eigen_assert(a.rows()==a.cols());
|
||||||
const Index size = a.rows();
|
const Index size = a.rows();
|
||||||
m_matrix.resize(size, size);
|
m_matrix.resize(size, size);
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ template<> struct mkl_llt<EIGTYPE> \
|
|||||||
lda = m.outerStride(); \
|
lda = m.outerStride(); \
|
||||||
\
|
\
|
||||||
info = LAPACKE_##MKLPREFIX##potrf( matrix_order, uplo, size, (MKLTYPE*)a, lda ); \
|
info = LAPACKE_##MKLPREFIX##potrf( matrix_order, uplo, size, (MKLTYPE*)a, lda ); \
|
||||||
info = (info==0) ? Success : NumericalIssue; \
|
info = (info==0) ? -1 : info>0 ? info-1 : size; \
|
||||||
return info; \
|
return info; \
|
||||||
} \
|
} \
|
||||||
}; \
|
}; \
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ cholmod_sparse viewAsCholmod(SparseMatrix<_Scalar,_Options,_Index>& mat)
|
|||||||
{
|
{
|
||||||
res.itype = CHOLMOD_INT;
|
res.itype = CHOLMOD_INT;
|
||||||
}
|
}
|
||||||
else if (internal::is_same<_Index,UF_long>::value)
|
else if (internal::is_same<_Index,SuiteSparse_long>::value)
|
||||||
{
|
{
|
||||||
res.itype = CHOLMOD_LONG;
|
res.itype = CHOLMOD_LONG;
|
||||||
}
|
}
|
||||||
@@ -395,7 +395,7 @@ class CholmodSimplicialLLT : public CholmodBase<_MatrixType, _UpLo, CholmodSimpl
|
|||||||
CholmodSimplicialLLT(const MatrixType& matrix) : Base()
|
CholmodSimplicialLLT(const MatrixType& matrix) : Base()
|
||||||
{
|
{
|
||||||
init();
|
init();
|
||||||
compute(matrix);
|
Base::compute(matrix);
|
||||||
}
|
}
|
||||||
|
|
||||||
~CholmodSimplicialLLT() {}
|
~CholmodSimplicialLLT() {}
|
||||||
@@ -442,7 +442,7 @@ class CholmodSimplicialLDLT : public CholmodBase<_MatrixType, _UpLo, CholmodSimp
|
|||||||
CholmodSimplicialLDLT(const MatrixType& matrix) : Base()
|
CholmodSimplicialLDLT(const MatrixType& matrix) : Base()
|
||||||
{
|
{
|
||||||
init();
|
init();
|
||||||
compute(matrix);
|
Base::compute(matrix);
|
||||||
}
|
}
|
||||||
|
|
||||||
~CholmodSimplicialLDLT() {}
|
~CholmodSimplicialLDLT() {}
|
||||||
@@ -487,7 +487,7 @@ class CholmodSupernodalLLT : public CholmodBase<_MatrixType, _UpLo, CholmodSuper
|
|||||||
CholmodSupernodalLLT(const MatrixType& matrix) : Base()
|
CholmodSupernodalLLT(const MatrixType& matrix) : Base()
|
||||||
{
|
{
|
||||||
init();
|
init();
|
||||||
compute(matrix);
|
Base::compute(matrix);
|
||||||
}
|
}
|
||||||
|
|
||||||
~CholmodSupernodalLLT() {}
|
~CholmodSupernodalLLT() {}
|
||||||
@@ -534,7 +534,7 @@ class CholmodDecomposition : public CholmodBase<_MatrixType, _UpLo, CholmodDecom
|
|||||||
CholmodDecomposition(const MatrixType& matrix) : Base()
|
CholmodDecomposition(const MatrixType& matrix) : Base()
|
||||||
{
|
{
|
||||||
init();
|
init();
|
||||||
compute(matrix);
|
Base::compute(matrix);
|
||||||
}
|
}
|
||||||
|
|
||||||
~CholmodDecomposition() {}
|
~CholmodDecomposition() {}
|
||||||
|
|||||||
@@ -124,6 +124,21 @@ class Array
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef EIGEN_HAVE_RVALUE_REFERENCES
|
||||||
|
Array(Array&& other)
|
||||||
|
: Base(std::move(other))
|
||||||
|
{
|
||||||
|
Base::_check_template_params();
|
||||||
|
if (RowsAtCompileTime!=Dynamic && ColsAtCompileTime!=Dynamic)
|
||||||
|
Base::_set_noalias(other);
|
||||||
|
}
|
||||||
|
Array& operator=(Array&& other)
|
||||||
|
{
|
||||||
|
other.swap(*this);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/** Constructs a vector or row-vector with given dimension. \only_for_vectors
|
/** Constructs a vector or row-vector with given dimension. \only_for_vectors
|
||||||
*
|
*
|
||||||
* Note that this is only useful for dynamic-size vectors. For fixed-size vectors,
|
* Note that this is only useful for dynamic-size vectors. For fixed-size vectors,
|
||||||
|
|||||||
@@ -46,9 +46,6 @@ template<typename Derived> class ArrayBase
|
|||||||
|
|
||||||
typedef ArrayBase Eigen_BaseClassForSpecializationOfGlobalMathFuncImpl;
|
typedef ArrayBase Eigen_BaseClassForSpecializationOfGlobalMathFuncImpl;
|
||||||
|
|
||||||
using internal::special_scalar_op_base<Derived,typename internal::traits<Derived>::Scalar,
|
|
||||||
typename NumTraits<typename internal::traits<Derived>::Scalar>::Real>::operator*;
|
|
||||||
|
|
||||||
typedef typename internal::traits<Derived>::StorageKind StorageKind;
|
typedef typename internal::traits<Derived>::StorageKind StorageKind;
|
||||||
typedef typename internal::traits<Derived>::Index Index;
|
typedef typename internal::traits<Derived>::Index Index;
|
||||||
typedef typename internal::traits<Derived>::Scalar Scalar;
|
typedef typename internal::traits<Derived>::Scalar Scalar;
|
||||||
@@ -56,6 +53,7 @@ template<typename Derived> class ArrayBase
|
|||||||
typedef typename NumTraits<Scalar>::Real RealScalar;
|
typedef typename NumTraits<Scalar>::Real RealScalar;
|
||||||
|
|
||||||
typedef DenseBase<Derived> Base;
|
typedef DenseBase<Derived> Base;
|
||||||
|
using Base::operator*;
|
||||||
using Base::RowsAtCompileTime;
|
using Base::RowsAtCompileTime;
|
||||||
using Base::ColsAtCompileTime;
|
using Base::ColsAtCompileTime;
|
||||||
using Base::SizeAtCompileTime;
|
using Base::SizeAtCompileTime;
|
||||||
|
|||||||
@@ -29,6 +29,11 @@ struct traits<ArrayWrapper<ExpressionType> >
|
|||||||
: public traits<typename remove_all<typename ExpressionType::Nested>::type >
|
: public traits<typename remove_all<typename ExpressionType::Nested>::type >
|
||||||
{
|
{
|
||||||
typedef ArrayXpr XprKind;
|
typedef ArrayXpr XprKind;
|
||||||
|
// Let's remove NestByRefBit
|
||||||
|
enum {
|
||||||
|
Flags0 = traits<typename remove_all<typename ExpressionType::Nested>::type >::Flags,
|
||||||
|
Flags = Flags0 & ~NestByRefBit
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -149,6 +154,11 @@ struct traits<MatrixWrapper<ExpressionType> >
|
|||||||
: public traits<typename remove_all<typename ExpressionType::Nested>::type >
|
: public traits<typename remove_all<typename ExpressionType::Nested>::type >
|
||||||
{
|
{
|
||||||
typedef MatrixXpr XprKind;
|
typedef MatrixXpr XprKind;
|
||||||
|
// Let's remove NestByRefBit
|
||||||
|
enum {
|
||||||
|
Flags0 = traits<typename remove_all<typename ExpressionType::Nested>::type >::Flags,
|
||||||
|
Flags = Flags0 & ~NestByRefBit
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -439,19 +439,26 @@ struct assign_impl<Derived1, Derived2, SliceVectorizedTraversal, NoUnrolling, Ve
|
|||||||
typedef typename Derived1::Index Index;
|
typedef typename Derived1::Index Index;
|
||||||
static inline void run(Derived1 &dst, const Derived2 &src)
|
static inline void run(Derived1 &dst, const Derived2 &src)
|
||||||
{
|
{
|
||||||
typedef packet_traits<typename Derived1::Scalar> PacketTraits;
|
typedef typename Derived1::Scalar Scalar;
|
||||||
|
typedef packet_traits<Scalar> PacketTraits;
|
||||||
enum {
|
enum {
|
||||||
packetSize = PacketTraits::size,
|
packetSize = PacketTraits::size,
|
||||||
alignable = PacketTraits::AlignedOnScalar,
|
alignable = PacketTraits::AlignedOnScalar,
|
||||||
dstAlignment = alignable ? Aligned : int(assign_traits<Derived1,Derived2>::DstIsAligned) ,
|
dstIsAligned = assign_traits<Derived1,Derived2>::DstIsAligned,
|
||||||
|
dstAlignment = alignable ? Aligned : int(dstIsAligned),
|
||||||
srcAlignment = assign_traits<Derived1,Derived2>::JointAlignment
|
srcAlignment = assign_traits<Derived1,Derived2>::JointAlignment
|
||||||
};
|
};
|
||||||
|
const Scalar *dst_ptr = &dst.coeffRef(0,0);
|
||||||
|
if((!bool(dstIsAligned)) && (size_t(dst_ptr) % sizeof(Scalar))>0)
|
||||||
|
{
|
||||||
|
// the pointer is not aligend-on scalar, so alignment is not possible
|
||||||
|
return assign_impl<Derived1,Derived2,DefaultTraversal,NoUnrolling>::run(dst, src);
|
||||||
|
}
|
||||||
const Index packetAlignedMask = packetSize - 1;
|
const Index packetAlignedMask = packetSize - 1;
|
||||||
const Index innerSize = dst.innerSize();
|
const Index innerSize = dst.innerSize();
|
||||||
const Index outerSize = dst.outerSize();
|
const Index outerSize = dst.outerSize();
|
||||||
const Index alignedStep = alignable ? (packetSize - dst.outerStride() % packetSize) & packetAlignedMask : 0;
|
const Index alignedStep = alignable ? (packetSize - dst.outerStride() % packetSize) & packetAlignedMask : 0;
|
||||||
Index alignedStart = ((!alignable) || assign_traits<Derived1,Derived2>::DstIsAligned) ? 0
|
Index alignedStart = ((!alignable) || bool(dstIsAligned)) ? 0 : internal::first_aligned(dst_ptr, innerSize);
|
||||||
: internal::first_aligned(&dst.coeffRef(0,0), innerSize);
|
|
||||||
|
|
||||||
for(Index outer = 0; outer < outerSize; ++outer)
|
for(Index outer = 0; outer < outerSize; ++outer)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -66,8 +66,9 @@ struct traits<Block<XprType, BlockRows, BlockCols, InnerPanel> > : traits<XprTyp
|
|||||||
: ColsAtCompileTime != Dynamic ? int(ColsAtCompileTime)
|
: ColsAtCompileTime != Dynamic ? int(ColsAtCompileTime)
|
||||||
: int(traits<XprType>::MaxColsAtCompileTime),
|
: int(traits<XprType>::MaxColsAtCompileTime),
|
||||||
XprTypeIsRowMajor = (int(traits<XprType>::Flags)&RowMajorBit) != 0,
|
XprTypeIsRowMajor = (int(traits<XprType>::Flags)&RowMajorBit) != 0,
|
||||||
IsRowMajor = (MaxRowsAtCompileTime==1&&MaxColsAtCompileTime!=1) ? 1
|
IsDense = is_same<StorageKind,Dense>::value,
|
||||||
: (MaxColsAtCompileTime==1&&MaxRowsAtCompileTime!=1) ? 0
|
IsRowMajor = (IsDense&&MaxRowsAtCompileTime==1&&MaxColsAtCompileTime!=1) ? 1
|
||||||
|
: (IsDense&&MaxColsAtCompileTime==1&&MaxRowsAtCompileTime!=1) ? 0
|
||||||
: XprTypeIsRowMajor,
|
: XprTypeIsRowMajor,
|
||||||
HasSameStorageOrderAsXprType = (IsRowMajor == XprTypeIsRowMajor),
|
HasSameStorageOrderAsXprType = (IsRowMajor == XprTypeIsRowMajor),
|
||||||
InnerSize = IsRowMajor ? int(ColsAtCompileTime) : int(RowsAtCompileTime),
|
InnerSize = IsRowMajor ? int(ColsAtCompileTime) : int(RowsAtCompileTime),
|
||||||
@@ -81,7 +82,7 @@ struct traits<Block<XprType, BlockRows, BlockCols, InnerPanel> > : traits<XprTyp
|
|||||||
&& (InnerStrideAtCompileTime == 1)
|
&& (InnerStrideAtCompileTime == 1)
|
||||||
? PacketAccessBit : 0,
|
? PacketAccessBit : 0,
|
||||||
MaskAlignedBit = (InnerPanel && (OuterStrideAtCompileTime!=Dynamic) && (((OuterStrideAtCompileTime * int(sizeof(Scalar))) % 16) == 0)) ? AlignedBit : 0,
|
MaskAlignedBit = (InnerPanel && (OuterStrideAtCompileTime!=Dynamic) && (((OuterStrideAtCompileTime * int(sizeof(Scalar))) % 16) == 0)) ? AlignedBit : 0,
|
||||||
FlagsLinearAccessBit = (RowsAtCompileTime == 1 || ColsAtCompileTime == 1) ? LinearAccessBit : 0,
|
FlagsLinearAccessBit = (RowsAtCompileTime == 1 || ColsAtCompileTime == 1 || (InnerPanel && (traits<XprType>::Flags&LinearAccessBit))) ? LinearAccessBit : 0,
|
||||||
FlagsLvalueBit = is_lvalue<XprType>::value ? LvalueBit : 0,
|
FlagsLvalueBit = is_lvalue<XprType>::value ? LvalueBit : 0,
|
||||||
FlagsRowMajorBit = IsRowMajor ? RowMajorBit : 0,
|
FlagsRowMajorBit = IsRowMajor ? RowMajorBit : 0,
|
||||||
Flags0 = traits<XprType>::Flags & ( (HereditaryBits & ~RowMajorBit) |
|
Flags0 = traits<XprType>::Flags & ( (HereditaryBits & ~RowMajorBit) |
|
||||||
|
|||||||
@@ -43,6 +43,17 @@ struct CommaInitializer
|
|||||||
m_xpr.block(0, 0, other.rows(), other.cols()) = other;
|
m_xpr.block(0, 0, other.rows(), other.cols()) = other;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Copy/Move constructor which transfers ownership. This is crucial in
|
||||||
|
* absence of return value optimization to avoid assertions during destruction. */
|
||||||
|
// FIXME in C++11 mode this could be replaced by a proper RValue constructor
|
||||||
|
inline CommaInitializer(const CommaInitializer& o)
|
||||||
|
: m_xpr(o.m_xpr), m_row(o.m_row), m_col(o.m_col), m_currentBlockRows(o.m_currentBlockRows) {
|
||||||
|
// Mark original object as finished. In absence of R-value references we need to const_cast:
|
||||||
|
const_cast<CommaInitializer&>(o).m_row = m_xpr.rows();
|
||||||
|
const_cast<CommaInitializer&>(o).m_col = m_xpr.cols();
|
||||||
|
const_cast<CommaInitializer&>(o).m_currentBlockRows = 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* inserts a scalar value in the target matrix */
|
/* inserts a scalar value in the target matrix */
|
||||||
CommaInitializer& operator,(const Scalar& s)
|
CommaInitializer& operator,(const Scalar& s)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -81,7 +81,8 @@ struct traits<CwiseBinaryOp<BinaryOp, Lhs, Rhs> >
|
|||||||
)
|
)
|
||||||
),
|
),
|
||||||
Flags = (Flags0 & ~RowMajorBit) | (LhsFlags & RowMajorBit),
|
Flags = (Flags0 & ~RowMajorBit) | (LhsFlags & RowMajorBit),
|
||||||
CoeffReadCost = LhsCoeffReadCost + RhsCoeffReadCost + functor_traits<BinaryOp>::Cost
|
Cost0 = EIGEN_ADD_COST(LhsCoeffReadCost,RhsCoeffReadCost),
|
||||||
|
CoeffReadCost = EIGEN_ADD_COST(Cost0,functor_traits<BinaryOp>::Cost)
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
} // end namespace internal
|
} // end namespace internal
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ struct traits<CwiseUnaryOp<UnaryOp, XprType> >
|
|||||||
Flags = _XprTypeNested::Flags & (
|
Flags = _XprTypeNested::Flags & (
|
||||||
HereditaryBits | LinearAccessBit | AlignedBit
|
HereditaryBits | LinearAccessBit | AlignedBit
|
||||||
| (functor_traits<UnaryOp>::PacketAccess ? PacketAccessBit : 0)),
|
| (functor_traits<UnaryOp>::PacketAccess ? PacketAccessBit : 0)),
|
||||||
CoeffReadCost = _XprTypeNested::CoeffReadCost + functor_traits<UnaryOp>::Cost
|
CoeffReadCost = EIGEN_ADD_COST(_XprTypeNested::CoeffReadCost, functor_traits<UnaryOp>::Cost)
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,15 +40,14 @@ static inline void check_DenseIndex_is_signed() {
|
|||||||
*/
|
*/
|
||||||
template<typename Derived> class DenseBase
|
template<typename Derived> class DenseBase
|
||||||
#ifndef EIGEN_PARSED_BY_DOXYGEN
|
#ifndef EIGEN_PARSED_BY_DOXYGEN
|
||||||
: public internal::special_scalar_op_base<Derived,typename internal::traits<Derived>::Scalar,
|
: public internal::special_scalar_op_base<Derived, typename internal::traits<Derived>::Scalar,
|
||||||
typename NumTraits<typename internal::traits<Derived>::Scalar>::Real>
|
typename NumTraits<typename internal::traits<Derived>::Scalar>::Real,
|
||||||
|
DenseCoeffsBase<Derived> >
|
||||||
#else
|
#else
|
||||||
: public DenseCoeffsBase<Derived>
|
: public DenseCoeffsBase<Derived>
|
||||||
#endif // not EIGEN_PARSED_BY_DOXYGEN
|
#endif // not EIGEN_PARSED_BY_DOXYGEN
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
using internal::special_scalar_op_base<Derived,typename internal::traits<Derived>::Scalar,
|
|
||||||
typename NumTraits<typename internal::traits<Derived>::Scalar>::Real>::operator*;
|
|
||||||
|
|
||||||
class InnerIterator;
|
class InnerIterator;
|
||||||
|
|
||||||
@@ -63,8 +62,9 @@ template<typename Derived> class DenseBase
|
|||||||
typedef typename internal::traits<Derived>::Scalar Scalar;
|
typedef typename internal::traits<Derived>::Scalar Scalar;
|
||||||
typedef typename internal::packet_traits<Scalar>::type PacketScalar;
|
typedef typename internal::packet_traits<Scalar>::type PacketScalar;
|
||||||
typedef typename NumTraits<Scalar>::Real RealScalar;
|
typedef typename NumTraits<Scalar>::Real RealScalar;
|
||||||
|
typedef internal::special_scalar_op_base<Derived,Scalar,RealScalar, DenseCoeffsBase<Derived> > Base;
|
||||||
|
|
||||||
typedef DenseCoeffsBase<Derived> Base;
|
using Base::operator*;
|
||||||
using Base::derived;
|
using Base::derived;
|
||||||
using Base::const_cast_derived;
|
using Base::const_cast_derived;
|
||||||
using Base::rows;
|
using Base::rows;
|
||||||
@@ -183,10 +183,6 @@ template<typename Derived> class DenseBase
|
|||||||
/** \returns the number of nonzero coefficients which is in practice the number
|
/** \returns the number of nonzero coefficients which is in practice the number
|
||||||
* of stored coefficients. */
|
* of stored coefficients. */
|
||||||
inline Index nonZeros() const { return size(); }
|
inline Index nonZeros() const { return size(); }
|
||||||
/** \returns true if either the number of rows or the number of columns is equal to 1.
|
|
||||||
* In other words, this function returns
|
|
||||||
* \code rows()==1 || cols()==1 \endcode
|
|
||||||
* \sa rows(), cols(), IsVectorAtCompileTime. */
|
|
||||||
|
|
||||||
/** \returns the outer size.
|
/** \returns the outer size.
|
||||||
*
|
*
|
||||||
@@ -266,11 +262,13 @@ template<typename Derived> class DenseBase
|
|||||||
template<typename OtherDerived>
|
template<typename OtherDerived>
|
||||||
Derived& operator=(const ReturnByValue<OtherDerived>& func);
|
Derived& operator=(const ReturnByValue<OtherDerived>& func);
|
||||||
|
|
||||||
#ifndef EIGEN_PARSED_BY_DOXYGEN
|
/** \internal Copies \a other into *this without evaluating other. \returns a reference to *this. */
|
||||||
/** Copies \a other into *this without evaluating other. \returns a reference to *this. */
|
|
||||||
template<typename OtherDerived>
|
template<typename OtherDerived>
|
||||||
Derived& lazyAssign(const DenseBase<OtherDerived>& other);
|
Derived& lazyAssign(const DenseBase<OtherDerived>& other);
|
||||||
#endif // not EIGEN_PARSED_BY_DOXYGEN
|
|
||||||
|
/** \internal Evaluates \a other into *this. \returns a reference to *this. */
|
||||||
|
template<typename OtherDerived>
|
||||||
|
Derived& lazyAssign(const ReturnByValue<OtherDerived>& other);
|
||||||
|
|
||||||
CommaInitializer<Derived> operator<< (const Scalar& s);
|
CommaInitializer<Derived> operator<< (const Scalar& s);
|
||||||
|
|
||||||
@@ -462,8 +460,10 @@ template<typename Derived> class DenseBase
|
|||||||
template<int p> RealScalar lpNorm() const;
|
template<int p> RealScalar lpNorm() const;
|
||||||
|
|
||||||
template<int RowFactor, int ColFactor>
|
template<int RowFactor, int ColFactor>
|
||||||
const Replicate<Derived,RowFactor,ColFactor> replicate() const;
|
inline const Replicate<Derived,RowFactor,ColFactor> replicate() const;
|
||||||
const Replicate<Derived,Dynamic,Dynamic> replicate(Index rowFacor,Index colFactor) const;
|
|
||||||
|
typedef Replicate<Derived,Dynamic,Dynamic> ReplicateReturnType;
|
||||||
|
inline const ReplicateReturnType replicate(Index rowFacor,Index colFactor) const;
|
||||||
|
|
||||||
typedef Reverse<Derived, BothDirections> ReverseReturnType;
|
typedef Reverse<Derived, BothDirections> ReverseReturnType;
|
||||||
typedef const Reverse<const Derived, BothDirections> ConstReverseReturnType;
|
typedef const Reverse<const Derived, BothDirections> ConstReverseReturnType;
|
||||||
|
|||||||
@@ -24,6 +24,14 @@ namespace internal {
|
|||||||
|
|
||||||
struct constructor_without_unaligned_array_assert {};
|
struct constructor_without_unaligned_array_assert {};
|
||||||
|
|
||||||
|
template<typename T, int Size> void check_static_allocation_size()
|
||||||
|
{
|
||||||
|
// if EIGEN_STACK_ALLOCATION_LIMIT is defined to 0, then no limit
|
||||||
|
#if EIGEN_STACK_ALLOCATION_LIMIT
|
||||||
|
EIGEN_STATIC_ASSERT(Size * sizeof(T) <= EIGEN_STACK_ALLOCATION_LIMIT, OBJECT_ALLOCATED_ON_STACK_IS_TOO_BIG);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/** \internal
|
/** \internal
|
||||||
* Static array. If the MatrixOrArrayOptions require auto-alignment, the array will be automatically aligned:
|
* Static array. If the MatrixOrArrayOptions require auto-alignment, the array will be automatically aligned:
|
||||||
* to 16 bytes boundary if the total size is a multiple of 16 bytes.
|
* to 16 bytes boundary if the total size is a multiple of 16 bytes.
|
||||||
@@ -38,12 +46,12 @@ struct plain_array
|
|||||||
|
|
||||||
plain_array()
|
plain_array()
|
||||||
{
|
{
|
||||||
EIGEN_STATIC_ASSERT(Size * sizeof(T) <= 128 * 128 * 8, OBJECT_ALLOCATED_ON_STACK_IS_TOO_BIG);
|
check_static_allocation_size<T,Size>();
|
||||||
}
|
}
|
||||||
|
|
||||||
plain_array(constructor_without_unaligned_array_assert)
|
plain_array(constructor_without_unaligned_array_assert)
|
||||||
{
|
{
|
||||||
EIGEN_STATIC_ASSERT(Size * sizeof(T) <= 128 * 128 * 8, OBJECT_ALLOCATED_ON_STACK_IS_TOO_BIG);
|
check_static_allocation_size<T,Size>();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -76,12 +84,12 @@ struct plain_array<T, Size, MatrixOrArrayOptions, 16>
|
|||||||
plain_array()
|
plain_array()
|
||||||
{
|
{
|
||||||
EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(0xf);
|
EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(0xf);
|
||||||
EIGEN_STATIC_ASSERT(Size * sizeof(T) <= 128 * 128 * 8, OBJECT_ALLOCATED_ON_STACK_IS_TOO_BIG);
|
check_static_allocation_size<T,Size>();
|
||||||
}
|
}
|
||||||
|
|
||||||
plain_array(constructor_without_unaligned_array_assert)
|
plain_array(constructor_without_unaligned_array_assert)
|
||||||
{
|
{
|
||||||
EIGEN_STATIC_ASSERT(Size * sizeof(T) <= 128 * 128 * 8, OBJECT_ALLOCATED_ON_STACK_IS_TOO_BIG);
|
check_static_allocation_size<T,Size>();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -114,33 +122,41 @@ template<typename T, int Size, int _Rows, int _Cols, int _Options> class DenseSt
|
|||||||
{
|
{
|
||||||
internal::plain_array<T,Size,_Options> m_data;
|
internal::plain_array<T,Size,_Options> m_data;
|
||||||
public:
|
public:
|
||||||
inline DenseStorage() {}
|
DenseStorage() {}
|
||||||
inline DenseStorage(internal::constructor_without_unaligned_array_assert)
|
DenseStorage(internal::constructor_without_unaligned_array_assert)
|
||||||
: m_data(internal::constructor_without_unaligned_array_assert()) {}
|
: m_data(internal::constructor_without_unaligned_array_assert()) {}
|
||||||
inline DenseStorage(DenseIndex,DenseIndex,DenseIndex) {}
|
DenseStorage(const DenseStorage& other) : m_data(other.m_data) {}
|
||||||
inline void swap(DenseStorage& other) { std::swap(m_data,other.m_data); }
|
DenseStorage& operator=(const DenseStorage& other)
|
||||||
static inline DenseIndex rows(void) {return _Rows;}
|
{
|
||||||
static inline DenseIndex cols(void) {return _Cols;}
|
if (this != &other) m_data = other.m_data;
|
||||||
inline void conservativeResize(DenseIndex,DenseIndex,DenseIndex) {}
|
return *this;
|
||||||
inline void resize(DenseIndex,DenseIndex,DenseIndex) {}
|
}
|
||||||
inline const T *data() const { return m_data.array; }
|
DenseStorage(DenseIndex,DenseIndex,DenseIndex) {}
|
||||||
inline T *data() { return m_data.array; }
|
void swap(DenseStorage& other) { std::swap(m_data,other.m_data); }
|
||||||
|
static DenseIndex rows(void) {return _Rows;}
|
||||||
|
static DenseIndex cols(void) {return _Cols;}
|
||||||
|
void conservativeResize(DenseIndex,DenseIndex,DenseIndex) {}
|
||||||
|
void resize(DenseIndex,DenseIndex,DenseIndex) {}
|
||||||
|
const T *data() const { return m_data.array; }
|
||||||
|
T *data() { return m_data.array; }
|
||||||
};
|
};
|
||||||
|
|
||||||
// null matrix
|
// null matrix
|
||||||
template<typename T, int _Rows, int _Cols, int _Options> class DenseStorage<T, 0, _Rows, _Cols, _Options>
|
template<typename T, int _Rows, int _Cols, int _Options> class DenseStorage<T, 0, _Rows, _Cols, _Options>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
inline DenseStorage() {}
|
DenseStorage() {}
|
||||||
inline DenseStorage(internal::constructor_without_unaligned_array_assert) {}
|
DenseStorage(internal::constructor_without_unaligned_array_assert) {}
|
||||||
inline DenseStorage(DenseIndex,DenseIndex,DenseIndex) {}
|
DenseStorage(const DenseStorage&) {}
|
||||||
inline void swap(DenseStorage& ) {}
|
DenseStorage& operator=(const DenseStorage&) { return *this; }
|
||||||
static inline DenseIndex rows(void) {return _Rows;}
|
DenseStorage(DenseIndex,DenseIndex,DenseIndex) {}
|
||||||
static inline DenseIndex cols(void) {return _Cols;}
|
void swap(DenseStorage& ) {}
|
||||||
inline void conservativeResize(DenseIndex,DenseIndex,DenseIndex) {}
|
static DenseIndex rows(void) {return _Rows;}
|
||||||
inline void resize(DenseIndex,DenseIndex,DenseIndex) {}
|
static DenseIndex cols(void) {return _Cols;}
|
||||||
inline const T *data() const { return 0; }
|
void conservativeResize(DenseIndex,DenseIndex,DenseIndex) {}
|
||||||
inline T *data() { return 0; }
|
void resize(DenseIndex,DenseIndex,DenseIndex) {}
|
||||||
|
const T *data() const { return 0; }
|
||||||
|
T *data() { return 0; }
|
||||||
};
|
};
|
||||||
|
|
||||||
// more specializations for null matrices; these are necessary to resolve ambiguities
|
// more specializations for null matrices; these are necessary to resolve ambiguities
|
||||||
@@ -160,18 +176,29 @@ template<typename T, int Size, int _Options> class DenseStorage<T, Size, Dynamic
|
|||||||
DenseIndex m_rows;
|
DenseIndex m_rows;
|
||||||
DenseIndex m_cols;
|
DenseIndex m_cols;
|
||||||
public:
|
public:
|
||||||
inline DenseStorage() : m_rows(0), m_cols(0) {}
|
DenseStorage() : m_rows(0), m_cols(0) {}
|
||||||
inline DenseStorage(internal::constructor_without_unaligned_array_assert)
|
DenseStorage(internal::constructor_without_unaligned_array_assert)
|
||||||
: m_data(internal::constructor_without_unaligned_array_assert()), m_rows(0), m_cols(0) {}
|
: m_data(internal::constructor_without_unaligned_array_assert()), m_rows(0), m_cols(0) {}
|
||||||
inline DenseStorage(DenseIndex, DenseIndex nbRows, DenseIndex nbCols) : m_rows(nbRows), m_cols(nbCols) {}
|
DenseStorage(const DenseStorage& other) : m_data(other.m_data), m_rows(other.m_rows), m_cols(other.m_cols) {}
|
||||||
inline void swap(DenseStorage& other)
|
DenseStorage& operator=(const DenseStorage& other)
|
||||||
|
{
|
||||||
|
if (this != &other)
|
||||||
|
{
|
||||||
|
m_data = other.m_data;
|
||||||
|
m_rows = other.m_rows;
|
||||||
|
m_cols = other.m_cols;
|
||||||
|
}
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
DenseStorage(DenseIndex, DenseIndex nbRows, DenseIndex nbCols) : m_rows(nbRows), m_cols(nbCols) {}
|
||||||
|
void swap(DenseStorage& other)
|
||||||
{ std::swap(m_data,other.m_data); std::swap(m_rows,other.m_rows); std::swap(m_cols,other.m_cols); }
|
{ std::swap(m_data,other.m_data); std::swap(m_rows,other.m_rows); std::swap(m_cols,other.m_cols); }
|
||||||
inline DenseIndex rows() const {return m_rows;}
|
DenseIndex rows() const {return m_rows;}
|
||||||
inline DenseIndex cols() const {return m_cols;}
|
DenseIndex cols() const {return m_cols;}
|
||||||
inline void conservativeResize(DenseIndex, DenseIndex nbRows, DenseIndex nbCols) { m_rows = nbRows; m_cols = nbCols; }
|
void conservativeResize(DenseIndex, DenseIndex nbRows, DenseIndex nbCols) { m_rows = nbRows; m_cols = nbCols; }
|
||||||
inline void resize(DenseIndex, DenseIndex nbRows, DenseIndex nbCols) { m_rows = nbRows; m_cols = nbCols; }
|
void resize(DenseIndex, DenseIndex nbRows, DenseIndex nbCols) { m_rows = nbRows; m_cols = nbCols; }
|
||||||
inline const T *data() const { return m_data.array; }
|
const T *data() const { return m_data.array; }
|
||||||
inline T *data() { return m_data.array; }
|
T *data() { return m_data.array; }
|
||||||
};
|
};
|
||||||
|
|
||||||
// dynamic-size matrix with fixed-size storage and fixed width
|
// dynamic-size matrix with fixed-size storage and fixed width
|
||||||
@@ -180,17 +207,27 @@ template<typename T, int Size, int _Cols, int _Options> class DenseStorage<T, Si
|
|||||||
internal::plain_array<T,Size,_Options> m_data;
|
internal::plain_array<T,Size,_Options> m_data;
|
||||||
DenseIndex m_rows;
|
DenseIndex m_rows;
|
||||||
public:
|
public:
|
||||||
inline DenseStorage() : m_rows(0) {}
|
DenseStorage() : m_rows(0) {}
|
||||||
inline DenseStorage(internal::constructor_without_unaligned_array_assert)
|
DenseStorage(internal::constructor_without_unaligned_array_assert)
|
||||||
: m_data(internal::constructor_without_unaligned_array_assert()), m_rows(0) {}
|
: m_data(internal::constructor_without_unaligned_array_assert()), m_rows(0) {}
|
||||||
inline DenseStorage(DenseIndex, DenseIndex nbRows, DenseIndex) : m_rows(nbRows) {}
|
DenseStorage(const DenseStorage& other) : m_data(other.m_data), m_rows(other.m_rows) {}
|
||||||
inline void swap(DenseStorage& other) { std::swap(m_data,other.m_data); std::swap(m_rows,other.m_rows); }
|
DenseStorage& operator=(const DenseStorage& other)
|
||||||
inline DenseIndex rows(void) const {return m_rows;}
|
{
|
||||||
inline DenseIndex cols(void) const {return _Cols;}
|
if (this != &other)
|
||||||
inline void conservativeResize(DenseIndex, DenseIndex nbRows, DenseIndex) { m_rows = nbRows; }
|
{
|
||||||
inline void resize(DenseIndex, DenseIndex nbRows, DenseIndex) { m_rows = nbRows; }
|
m_data = other.m_data;
|
||||||
inline const T *data() const { return m_data.array; }
|
m_rows = other.m_rows;
|
||||||
inline T *data() { return m_data.array; }
|
}
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
DenseStorage(DenseIndex, DenseIndex nbRows, DenseIndex) : m_rows(nbRows) {}
|
||||||
|
void swap(DenseStorage& other) { std::swap(m_data,other.m_data); std::swap(m_rows,other.m_rows); }
|
||||||
|
DenseIndex rows(void) const {return m_rows;}
|
||||||
|
DenseIndex cols(void) const {return _Cols;}
|
||||||
|
void conservativeResize(DenseIndex, DenseIndex nbRows, DenseIndex) { m_rows = nbRows; }
|
||||||
|
void resize(DenseIndex, DenseIndex nbRows, DenseIndex) { m_rows = nbRows; }
|
||||||
|
const T *data() const { return m_data.array; }
|
||||||
|
T *data() { return m_data.array; }
|
||||||
};
|
};
|
||||||
|
|
||||||
// dynamic-size matrix with fixed-size storage and fixed height
|
// dynamic-size matrix with fixed-size storage and fixed height
|
||||||
@@ -199,17 +236,27 @@ template<typename T, int Size, int _Rows, int _Options> class DenseStorage<T, Si
|
|||||||
internal::plain_array<T,Size,_Options> m_data;
|
internal::plain_array<T,Size,_Options> m_data;
|
||||||
DenseIndex m_cols;
|
DenseIndex m_cols;
|
||||||
public:
|
public:
|
||||||
inline DenseStorage() : m_cols(0) {}
|
DenseStorage() : m_cols(0) {}
|
||||||
inline DenseStorage(internal::constructor_without_unaligned_array_assert)
|
DenseStorage(internal::constructor_without_unaligned_array_assert)
|
||||||
: m_data(internal::constructor_without_unaligned_array_assert()), m_cols(0) {}
|
: m_data(internal::constructor_without_unaligned_array_assert()), m_cols(0) {}
|
||||||
inline DenseStorage(DenseIndex, DenseIndex, DenseIndex nbCols) : m_cols(nbCols) {}
|
DenseStorage(const DenseStorage& other) : m_data(other.m_data), m_cols(other.m_cols) {}
|
||||||
inline void swap(DenseStorage& other) { std::swap(m_data,other.m_data); std::swap(m_cols,other.m_cols); }
|
DenseStorage& operator=(const DenseStorage& other)
|
||||||
inline DenseIndex rows(void) const {return _Rows;}
|
{
|
||||||
inline DenseIndex cols(void) const {return m_cols;}
|
if (this != &other)
|
||||||
inline void conservativeResize(DenseIndex, DenseIndex, DenseIndex nbCols) { m_cols = nbCols; }
|
{
|
||||||
inline void resize(DenseIndex, DenseIndex, DenseIndex nbCols) { m_cols = nbCols; }
|
m_data = other.m_data;
|
||||||
inline const T *data() const { return m_data.array; }
|
m_cols = other.m_cols;
|
||||||
inline T *data() { return m_data.array; }
|
}
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
DenseStorage(DenseIndex, DenseIndex, DenseIndex nbCols) : m_cols(nbCols) {}
|
||||||
|
void swap(DenseStorage& other) { std::swap(m_data,other.m_data); std::swap(m_cols,other.m_cols); }
|
||||||
|
DenseIndex rows(void) const {return _Rows;}
|
||||||
|
DenseIndex cols(void) const {return m_cols;}
|
||||||
|
void conservativeResize(DenseIndex, DenseIndex, DenseIndex nbCols) { m_cols = nbCols; }
|
||||||
|
void resize(DenseIndex, DenseIndex, DenseIndex nbCols) { m_cols = nbCols; }
|
||||||
|
const T *data() const { return m_data.array; }
|
||||||
|
T *data() { return m_data.array; }
|
||||||
};
|
};
|
||||||
|
|
||||||
// purely dynamic matrix.
|
// purely dynamic matrix.
|
||||||
@@ -219,18 +266,35 @@ template<typename T, int _Options> class DenseStorage<T, Dynamic, Dynamic, Dynam
|
|||||||
DenseIndex m_rows;
|
DenseIndex m_rows;
|
||||||
DenseIndex m_cols;
|
DenseIndex m_cols;
|
||||||
public:
|
public:
|
||||||
inline DenseStorage() : m_data(0), m_rows(0), m_cols(0) {}
|
DenseStorage() : m_data(0), m_rows(0), m_cols(0) {}
|
||||||
inline DenseStorage(internal::constructor_without_unaligned_array_assert)
|
DenseStorage(internal::constructor_without_unaligned_array_assert)
|
||||||
: m_data(0), m_rows(0), m_cols(0) {}
|
: m_data(0), m_rows(0), m_cols(0) {}
|
||||||
inline DenseStorage(DenseIndex size, DenseIndex nbRows, DenseIndex nbCols)
|
DenseStorage(DenseIndex size, DenseIndex nbRows, DenseIndex nbCols)
|
||||||
: m_data(internal::conditional_aligned_new_auto<T,(_Options&DontAlign)==0>(size)), m_rows(nbRows), m_cols(nbCols)
|
: m_data(internal::conditional_aligned_new_auto<T,(_Options&DontAlign)==0>(size)), m_rows(nbRows), m_cols(nbCols)
|
||||||
{ EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN }
|
{ EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN }
|
||||||
inline ~DenseStorage() { internal::conditional_aligned_delete_auto<T,(_Options&DontAlign)==0>(m_data, m_rows*m_cols); }
|
#ifdef EIGEN_HAVE_RVALUE_REFERENCES
|
||||||
inline void swap(DenseStorage& other)
|
DenseStorage(DenseStorage&& other)
|
||||||
|
: m_data(std::move(other.m_data))
|
||||||
|
, m_rows(std::move(other.m_rows))
|
||||||
|
, m_cols(std::move(other.m_cols))
|
||||||
|
{
|
||||||
|
other.m_data = nullptr;
|
||||||
|
}
|
||||||
|
DenseStorage& operator=(DenseStorage&& other)
|
||||||
|
{
|
||||||
|
using std::swap;
|
||||||
|
swap(m_data, other.m_data);
|
||||||
|
swap(m_rows, other.m_rows);
|
||||||
|
swap(m_cols, other.m_cols);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
~DenseStorage() { internal::conditional_aligned_delete_auto<T,(_Options&DontAlign)==0>(m_data, m_rows*m_cols); }
|
||||||
|
void swap(DenseStorage& other)
|
||||||
{ std::swap(m_data,other.m_data); std::swap(m_rows,other.m_rows); std::swap(m_cols,other.m_cols); }
|
{ std::swap(m_data,other.m_data); std::swap(m_rows,other.m_rows); std::swap(m_cols,other.m_cols); }
|
||||||
inline DenseIndex rows(void) const {return m_rows;}
|
DenseIndex rows(void) const {return m_rows;}
|
||||||
inline DenseIndex cols(void) const {return m_cols;}
|
DenseIndex cols(void) const {return m_cols;}
|
||||||
inline void conservativeResize(DenseIndex size, DenseIndex nbRows, DenseIndex nbCols)
|
void conservativeResize(DenseIndex size, DenseIndex nbRows, DenseIndex nbCols)
|
||||||
{
|
{
|
||||||
m_data = internal::conditional_aligned_realloc_new_auto<T,(_Options&DontAlign)==0>(m_data, size, m_rows*m_cols);
|
m_data = internal::conditional_aligned_realloc_new_auto<T,(_Options&DontAlign)==0>(m_data, size, m_rows*m_cols);
|
||||||
m_rows = nbRows;
|
m_rows = nbRows;
|
||||||
@@ -250,8 +314,11 @@ template<typename T, int _Options> class DenseStorage<T, Dynamic, Dynamic, Dynam
|
|||||||
m_rows = nbRows;
|
m_rows = nbRows;
|
||||||
m_cols = nbCols;
|
m_cols = nbCols;
|
||||||
}
|
}
|
||||||
inline const T *data() const { return m_data; }
|
const T *data() const { return m_data; }
|
||||||
inline T *data() { return m_data; }
|
T *data() { return m_data; }
|
||||||
|
private:
|
||||||
|
DenseStorage(const DenseStorage&);
|
||||||
|
DenseStorage& operator=(const DenseStorage&);
|
||||||
};
|
};
|
||||||
|
|
||||||
// matrix with dynamic width and fixed height (so that matrix has dynamic size).
|
// matrix with dynamic width and fixed height (so that matrix has dynamic size).
|
||||||
@@ -260,15 +327,30 @@ template<typename T, int _Rows, int _Options> class DenseStorage<T, Dynamic, _Ro
|
|||||||
T *m_data;
|
T *m_data;
|
||||||
DenseIndex m_cols;
|
DenseIndex m_cols;
|
||||||
public:
|
public:
|
||||||
inline DenseStorage() : m_data(0), m_cols(0) {}
|
DenseStorage() : m_data(0), m_cols(0) {}
|
||||||
inline DenseStorage(internal::constructor_without_unaligned_array_assert) : m_data(0), m_cols(0) {}
|
DenseStorage(internal::constructor_without_unaligned_array_assert) : m_data(0), m_cols(0) {}
|
||||||
inline DenseStorage(DenseIndex size, DenseIndex, DenseIndex nbCols) : m_data(internal::conditional_aligned_new_auto<T,(_Options&DontAlign)==0>(size)), m_cols(nbCols)
|
DenseStorage(DenseIndex size, DenseIndex, DenseIndex nbCols) : m_data(internal::conditional_aligned_new_auto<T,(_Options&DontAlign)==0>(size)), m_cols(nbCols)
|
||||||
{ EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN }
|
{ EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN }
|
||||||
inline ~DenseStorage() { internal::conditional_aligned_delete_auto<T,(_Options&DontAlign)==0>(m_data, _Rows*m_cols); }
|
#ifdef EIGEN_HAVE_RVALUE_REFERENCES
|
||||||
inline void swap(DenseStorage& other) { std::swap(m_data,other.m_data); std::swap(m_cols,other.m_cols); }
|
DenseStorage(DenseStorage&& other)
|
||||||
static inline DenseIndex rows(void) {return _Rows;}
|
: m_data(std::move(other.m_data))
|
||||||
inline DenseIndex cols(void) const {return m_cols;}
|
, m_cols(std::move(other.m_cols))
|
||||||
inline void conservativeResize(DenseIndex size, DenseIndex, DenseIndex nbCols)
|
{
|
||||||
|
other.m_data = nullptr;
|
||||||
|
}
|
||||||
|
DenseStorage& operator=(DenseStorage&& other)
|
||||||
|
{
|
||||||
|
using std::swap;
|
||||||
|
swap(m_data, other.m_data);
|
||||||
|
swap(m_cols, other.m_cols);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
~DenseStorage() { internal::conditional_aligned_delete_auto<T,(_Options&DontAlign)==0>(m_data, _Rows*m_cols); }
|
||||||
|
void swap(DenseStorage& other) { std::swap(m_data,other.m_data); std::swap(m_cols,other.m_cols); }
|
||||||
|
static DenseIndex rows(void) {return _Rows;}
|
||||||
|
DenseIndex cols(void) const {return m_cols;}
|
||||||
|
void conservativeResize(DenseIndex size, DenseIndex, DenseIndex nbCols)
|
||||||
{
|
{
|
||||||
m_data = internal::conditional_aligned_realloc_new_auto<T,(_Options&DontAlign)==0>(m_data, size, _Rows*m_cols);
|
m_data = internal::conditional_aligned_realloc_new_auto<T,(_Options&DontAlign)==0>(m_data, size, _Rows*m_cols);
|
||||||
m_cols = nbCols;
|
m_cols = nbCols;
|
||||||
@@ -286,8 +368,11 @@ template<typename T, int _Rows, int _Options> class DenseStorage<T, Dynamic, _Ro
|
|||||||
}
|
}
|
||||||
m_cols = nbCols;
|
m_cols = nbCols;
|
||||||
}
|
}
|
||||||
inline const T *data() const { return m_data; }
|
const T *data() const { return m_data; }
|
||||||
inline T *data() { return m_data; }
|
T *data() { return m_data; }
|
||||||
|
private:
|
||||||
|
DenseStorage(const DenseStorage&);
|
||||||
|
DenseStorage& operator=(const DenseStorage&);
|
||||||
};
|
};
|
||||||
|
|
||||||
// matrix with dynamic height and fixed width (so that matrix has dynamic size).
|
// matrix with dynamic height and fixed width (so that matrix has dynamic size).
|
||||||
@@ -296,15 +381,30 @@ template<typename T, int _Cols, int _Options> class DenseStorage<T, Dynamic, Dyn
|
|||||||
T *m_data;
|
T *m_data;
|
||||||
DenseIndex m_rows;
|
DenseIndex m_rows;
|
||||||
public:
|
public:
|
||||||
inline DenseStorage() : m_data(0), m_rows(0) {}
|
DenseStorage() : m_data(0), m_rows(0) {}
|
||||||
inline DenseStorage(internal::constructor_without_unaligned_array_assert) : m_data(0), m_rows(0) {}
|
DenseStorage(internal::constructor_without_unaligned_array_assert) : m_data(0), m_rows(0) {}
|
||||||
inline DenseStorage(DenseIndex size, DenseIndex nbRows, DenseIndex) : m_data(internal::conditional_aligned_new_auto<T,(_Options&DontAlign)==0>(size)), m_rows(nbRows)
|
DenseStorage(DenseIndex size, DenseIndex nbRows, DenseIndex) : m_data(internal::conditional_aligned_new_auto<T,(_Options&DontAlign)==0>(size)), m_rows(nbRows)
|
||||||
{ EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN }
|
{ EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN }
|
||||||
inline ~DenseStorage() { internal::conditional_aligned_delete_auto<T,(_Options&DontAlign)==0>(m_data, _Cols*m_rows); }
|
#ifdef EIGEN_HAVE_RVALUE_REFERENCES
|
||||||
inline void swap(DenseStorage& other) { std::swap(m_data,other.m_data); std::swap(m_rows,other.m_rows); }
|
DenseStorage(DenseStorage&& other)
|
||||||
inline DenseIndex rows(void) const {return m_rows;}
|
: m_data(std::move(other.m_data))
|
||||||
static inline DenseIndex cols(void) {return _Cols;}
|
, m_rows(std::move(other.m_rows))
|
||||||
inline void conservativeResize(DenseIndex size, DenseIndex nbRows, DenseIndex)
|
{
|
||||||
|
other.m_data = nullptr;
|
||||||
|
}
|
||||||
|
DenseStorage& operator=(DenseStorage&& other)
|
||||||
|
{
|
||||||
|
using std::swap;
|
||||||
|
swap(m_data, other.m_data);
|
||||||
|
swap(m_rows, other.m_rows);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
~DenseStorage() { internal::conditional_aligned_delete_auto<T,(_Options&DontAlign)==0>(m_data, _Cols*m_rows); }
|
||||||
|
void swap(DenseStorage& other) { std::swap(m_data,other.m_data); std::swap(m_rows,other.m_rows); }
|
||||||
|
DenseIndex rows(void) const {return m_rows;}
|
||||||
|
static DenseIndex cols(void) {return _Cols;}
|
||||||
|
void conservativeResize(DenseIndex size, DenseIndex nbRows, DenseIndex)
|
||||||
{
|
{
|
||||||
m_data = internal::conditional_aligned_realloc_new_auto<T,(_Options&DontAlign)==0>(m_data, size, m_rows*_Cols);
|
m_data = internal::conditional_aligned_realloc_new_auto<T,(_Options&DontAlign)==0>(m_data, size, m_rows*_Cols);
|
||||||
m_rows = nbRows;
|
m_rows = nbRows;
|
||||||
@@ -322,8 +422,11 @@ template<typename T, int _Cols, int _Options> class DenseStorage<T, Dynamic, Dyn
|
|||||||
}
|
}
|
||||||
m_rows = nbRows;
|
m_rows = nbRows;
|
||||||
}
|
}
|
||||||
inline const T *data() const { return m_data; }
|
const T *data() const { return m_data; }
|
||||||
inline T *data() { return m_data; }
|
T *data() { return m_data; }
|
||||||
|
private:
|
||||||
|
DenseStorage(const DenseStorage&);
|
||||||
|
DenseStorage& operator=(const DenseStorage&);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end namespace Eigen
|
} // end namespace Eigen
|
||||||
|
|||||||
@@ -190,18 +190,18 @@ MatrixBase<Derived>::diagonal() const
|
|||||||
*
|
*
|
||||||
* \sa MatrixBase::diagonal(), class Diagonal */
|
* \sa MatrixBase::diagonal(), class Diagonal */
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
inline typename MatrixBase<Derived>::template DiagonalIndexReturnType<DynamicIndex>::Type
|
inline typename MatrixBase<Derived>::DiagonalDynamicIndexReturnType
|
||||||
MatrixBase<Derived>::diagonal(Index index)
|
MatrixBase<Derived>::diagonal(Index index)
|
||||||
{
|
{
|
||||||
return typename DiagonalIndexReturnType<DynamicIndex>::Type(derived(), index);
|
return DiagonalDynamicIndexReturnType(derived(), index);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** This is the const version of diagonal(Index). */
|
/** This is the const version of diagonal(Index). */
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
inline typename MatrixBase<Derived>::template ConstDiagonalIndexReturnType<DynamicIndex>::Type
|
inline typename MatrixBase<Derived>::ConstDiagonalDynamicIndexReturnType
|
||||||
MatrixBase<Derived>::diagonal(Index index) const
|
MatrixBase<Derived>::diagonal(Index index) const
|
||||||
{
|
{
|
||||||
return typename ConstDiagonalIndexReturnType<DynamicIndex>::Type(derived(), index);
|
return ConstDiagonalDynamicIndexReturnType(derived(), index);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** \returns an expression of the \a DiagIndex-th sub or super diagonal of the matrix \c *this
|
/** \returns an expression of the \a DiagIndex-th sub or super diagonal of the matrix \c *this
|
||||||
|
|||||||
@@ -34,8 +34,9 @@ struct traits<DiagonalProduct<MatrixType, DiagonalType, ProductOrder> >
|
|||||||
_Vectorizable = bool(int(MatrixType::Flags)&PacketAccessBit) && _SameTypes && (_ScalarAccessOnDiag || (bool(int(DiagonalType::DiagonalVectorType::Flags)&PacketAccessBit))),
|
_Vectorizable = bool(int(MatrixType::Flags)&PacketAccessBit) && _SameTypes && (_ScalarAccessOnDiag || (bool(int(DiagonalType::DiagonalVectorType::Flags)&PacketAccessBit))),
|
||||||
_LinearAccessMask = (RowsAtCompileTime==1 || ColsAtCompileTime==1) ? LinearAccessBit : 0,
|
_LinearAccessMask = (RowsAtCompileTime==1 || ColsAtCompileTime==1) ? LinearAccessBit : 0,
|
||||||
|
|
||||||
Flags = ((HereditaryBits|_LinearAccessMask) & (unsigned int)(MatrixType::Flags)) | (_Vectorizable ? PacketAccessBit : 0) | AlignedBit,//(int(MatrixType::Flags)&int(DiagonalType::DiagonalVectorType::Flags)&AlignedBit),
|
Flags = ((HereditaryBits|_LinearAccessMask|AlignedBit) & (unsigned int)(MatrixType::Flags)) | (_Vectorizable ? PacketAccessBit : 0),//(int(MatrixType::Flags)&int(DiagonalType::DiagonalVectorType::Flags)&AlignedBit),
|
||||||
CoeffReadCost = NumTraits<Scalar>::MulCost + MatrixType::CoeffReadCost + DiagonalType::DiagonalVectorType::CoeffReadCost
|
Cost0 = EIGEN_ADD_COST(NumTraits<Scalar>::MulCost, MatrixType::CoeffReadCost),
|
||||||
|
CoeffReadCost = EIGEN_ADD_COST(Cost0,DiagonalType::DiagonalVectorType::CoeffReadCost)
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -259,6 +259,47 @@ template<> struct functor_traits<scalar_boolean_or_op> {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** \internal
|
||||||
|
* \brief Template functors for comparison of two scalars
|
||||||
|
* \todo Implement packet-comparisons
|
||||||
|
*/
|
||||||
|
template<typename Scalar, ComparisonName cmp> struct scalar_cmp_op;
|
||||||
|
|
||||||
|
template<typename Scalar, ComparisonName cmp>
|
||||||
|
struct functor_traits<scalar_cmp_op<Scalar, cmp> > {
|
||||||
|
enum {
|
||||||
|
Cost = NumTraits<Scalar>::AddCost,
|
||||||
|
PacketAccess = false
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
template<ComparisonName Cmp, typename Scalar>
|
||||||
|
struct result_of<scalar_cmp_op<Scalar, Cmp>(Scalar,Scalar)> {
|
||||||
|
typedef bool type;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
template<typename Scalar> struct scalar_cmp_op<Scalar, cmp_EQ> {
|
||||||
|
EIGEN_EMPTY_STRUCT_CTOR(scalar_cmp_op)
|
||||||
|
EIGEN_STRONG_INLINE bool operator()(const Scalar& a, const Scalar& b) const {return a==b;}
|
||||||
|
};
|
||||||
|
template<typename Scalar> struct scalar_cmp_op<Scalar, cmp_LT> {
|
||||||
|
EIGEN_EMPTY_STRUCT_CTOR(scalar_cmp_op)
|
||||||
|
EIGEN_STRONG_INLINE bool operator()(const Scalar& a, const Scalar& b) const {return a<b;}
|
||||||
|
};
|
||||||
|
template<typename Scalar> struct scalar_cmp_op<Scalar, cmp_LE> {
|
||||||
|
EIGEN_EMPTY_STRUCT_CTOR(scalar_cmp_op)
|
||||||
|
EIGEN_STRONG_INLINE bool operator()(const Scalar& a, const Scalar& b) const {return a<=b;}
|
||||||
|
};
|
||||||
|
template<typename Scalar> struct scalar_cmp_op<Scalar, cmp_UNORD> {
|
||||||
|
EIGEN_EMPTY_STRUCT_CTOR(scalar_cmp_op)
|
||||||
|
EIGEN_STRONG_INLINE bool operator()(const Scalar& a, const Scalar& b) const {return !(a<=b || b<=a);}
|
||||||
|
};
|
||||||
|
template<typename Scalar> struct scalar_cmp_op<Scalar, cmp_NEQ> {
|
||||||
|
EIGEN_EMPTY_STRUCT_CTOR(scalar_cmp_op)
|
||||||
|
EIGEN_STRONG_INLINE bool operator()(const Scalar& a, const Scalar& b) const {return a!=b;}
|
||||||
|
};
|
||||||
|
|
||||||
// unary functors:
|
// unary functors:
|
||||||
|
|
||||||
/** \internal
|
/** \internal
|
||||||
@@ -589,7 +630,7 @@ struct linspaced_op_impl<Scalar,true>
|
|||||||
|
|
||||||
template<typename Index>
|
template<typename Index>
|
||||||
EIGEN_STRONG_INLINE const Packet packetOp(Index i) const
|
EIGEN_STRONG_INLINE const Packet packetOp(Index i) const
|
||||||
{ return internal::padd(m_lowPacket, pmul(m_stepPacket, padd(pset1<Packet>(i),m_interPacket))); }
|
{ return internal::padd(m_lowPacket, pmul(m_stepPacket, padd(pset1<Packet>(Scalar(i)),m_interPacket))); }
|
||||||
|
|
||||||
const Scalar m_low;
|
const Scalar m_low;
|
||||||
const Scalar m_step;
|
const Scalar m_step;
|
||||||
@@ -609,7 +650,7 @@ template <typename Scalar, bool RandomAccess> struct functor_traits< linspaced_o
|
|||||||
template <typename Scalar, bool RandomAccess> struct linspaced_op
|
template <typename Scalar, bool RandomAccess> struct linspaced_op
|
||||||
{
|
{
|
||||||
typedef typename packet_traits<Scalar>::type Packet;
|
typedef typename packet_traits<Scalar>::type Packet;
|
||||||
linspaced_op(const Scalar& low, const Scalar& high, DenseIndex num_steps) : impl((num_steps==1 ? high : low), (num_steps==1 ? Scalar() : (high-low)/(num_steps-1))) {}
|
linspaced_op(const Scalar& low, const Scalar& high, DenseIndex num_steps) : impl((num_steps==1 ? high : low), (num_steps==1 ? Scalar() : (high-low)/Scalar(num_steps-1))) {}
|
||||||
|
|
||||||
template<typename Index>
|
template<typename Index>
|
||||||
EIGEN_STRONG_INLINE const Scalar operator() (Index i) const { return impl(i); }
|
EIGEN_STRONG_INLINE const Scalar operator() (Index i) const { return impl(i); }
|
||||||
|
|||||||
@@ -232,7 +232,7 @@ EIGEN_DONT_INLINE void outer_product_selector_run(const ProductType& prod, Dest&
|
|||||||
// FIXME not very good if rhs is real and lhs complex while alpha is real too
|
// FIXME not very good if rhs is real and lhs complex while alpha is real too
|
||||||
const Index cols = dest.cols();
|
const Index cols = dest.cols();
|
||||||
for (Index j=0; j<cols; ++j)
|
for (Index j=0; j<cols; ++j)
|
||||||
func(dest.col(j), prod.rhs().coeff(j) * prod.lhs());
|
func(dest.col(j), prod.rhs().coeff(0,j) * prod.lhs());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Row major
|
// Row major
|
||||||
@@ -243,7 +243,7 @@ EIGEN_DONT_INLINE void outer_product_selector_run(const ProductType& prod, Dest&
|
|||||||
// FIXME not very good if lhs is real and rhs complex while alpha is real too
|
// FIXME not very good if lhs is real and rhs complex while alpha is real too
|
||||||
const Index rows = dest.rows();
|
const Index rows = dest.rows();
|
||||||
for (Index i=0; i<rows; ++i)
|
for (Index i=0; i<rows; ++i)
|
||||||
func(dest.row(i), prod.lhs().coeff(i) * prod.rhs());
|
func(dest.row(i), prod.lhs().coeff(i,0) * prod.rhs());
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Lhs, typename Rhs>
|
template<typename Lhs, typename Rhs>
|
||||||
@@ -257,7 +257,7 @@ template<typename Lhs, typename Rhs>
|
|||||||
class GeneralProduct<Lhs, Rhs, OuterProduct>
|
class GeneralProduct<Lhs, Rhs, OuterProduct>
|
||||||
: public ProductBase<GeneralProduct<Lhs,Rhs,OuterProduct>, Lhs, Rhs>
|
: public ProductBase<GeneralProduct<Lhs,Rhs,OuterProduct>, Lhs, Rhs>
|
||||||
{
|
{
|
||||||
template<typename T> struct IsRowMajor : internal::conditional<(int(T::Flags)&RowMajorBit), internal::true_type, internal::false_type>::type {};
|
template<typename T> struct is_row_major : internal::conditional<(int(T::Flags)&RowMajorBit), internal::true_type, internal::false_type>::type {};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
EIGEN_PRODUCT_PUBLIC_INTERFACE(GeneralProduct)
|
EIGEN_PRODUCT_PUBLIC_INTERFACE(GeneralProduct)
|
||||||
@@ -281,22 +281,22 @@ class GeneralProduct<Lhs, Rhs, OuterProduct>
|
|||||||
|
|
||||||
template<typename Dest>
|
template<typename Dest>
|
||||||
inline void evalTo(Dest& dest) const {
|
inline void evalTo(Dest& dest) const {
|
||||||
internal::outer_product_selector_run(*this, dest, set(), IsRowMajor<Dest>());
|
internal::outer_product_selector_run(*this, dest, set(), is_row_major<Dest>());
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Dest>
|
template<typename Dest>
|
||||||
inline void addTo(Dest& dest) const {
|
inline void addTo(Dest& dest) const {
|
||||||
internal::outer_product_selector_run(*this, dest, add(), IsRowMajor<Dest>());
|
internal::outer_product_selector_run(*this, dest, add(), is_row_major<Dest>());
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Dest>
|
template<typename Dest>
|
||||||
inline void subTo(Dest& dest) const {
|
inline void subTo(Dest& dest) const {
|
||||||
internal::outer_product_selector_run(*this, dest, sub(), IsRowMajor<Dest>());
|
internal::outer_product_selector_run(*this, dest, sub(), is_row_major<Dest>());
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Dest> void scaleAndAddTo(Dest& dest, const Scalar& alpha) const
|
template<typename Dest> void scaleAndAddTo(Dest& dest, const Scalar& alpha) const
|
||||||
{
|
{
|
||||||
internal::outer_product_selector_run(*this, dest, adds(alpha), IsRowMajor<Dest>());
|
internal::outer_product_selector_run(*this, dest, adds(alpha), is_row_major<Dest>());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ template<typename Derived> class MapBase<Derived, ReadOnlyAccessors>
|
|||||||
return internal::ploadt<PacketScalar, LoadMode>(m_data + index * innerStride());
|
return internal::ploadt<PacketScalar, LoadMode>(m_data + index * innerStride());
|
||||||
}
|
}
|
||||||
|
|
||||||
inline MapBase(PointerType dataPtr) : m_data(dataPtr), m_rows(RowsAtCompileTime), m_cols(ColsAtCompileTime)
|
explicit inline MapBase(PointerType dataPtr) : m_data(dataPtr), m_rows(RowsAtCompileTime), m_cols(ColsAtCompileTime)
|
||||||
{
|
{
|
||||||
EIGEN_STATIC_ASSERT_FIXED_SIZE(Derived)
|
EIGEN_STATIC_ASSERT_FIXED_SIZE(Derived)
|
||||||
checkSanity();
|
checkSanity();
|
||||||
@@ -157,7 +157,7 @@ template<typename Derived> class MapBase<Derived, ReadOnlyAccessors>
|
|||||||
internal::inner_stride_at_compile_time<Derived>::ret==1),
|
internal::inner_stride_at_compile_time<Derived>::ret==1),
|
||||||
PACKET_ACCESS_REQUIRES_TO_HAVE_INNER_STRIDE_FIXED_TO_1);
|
PACKET_ACCESS_REQUIRES_TO_HAVE_INNER_STRIDE_FIXED_TO_1);
|
||||||
eigen_assert(EIGEN_IMPLIES(internal::traits<Derived>::Flags&AlignedBit, (size_t(m_data) % 16) == 0)
|
eigen_assert(EIGEN_IMPLIES(internal::traits<Derived>::Flags&AlignedBit, (size_t(m_data) % 16) == 0)
|
||||||
&& "data is not aligned");
|
&& "input pointer is not aligned on a 16 byte boundary");
|
||||||
}
|
}
|
||||||
|
|
||||||
PointerType m_data;
|
PointerType m_data;
|
||||||
@@ -168,6 +168,7 @@ template<typename Derived> class MapBase<Derived, ReadOnlyAccessors>
|
|||||||
template<typename Derived> class MapBase<Derived, WriteAccessors>
|
template<typename Derived> class MapBase<Derived, WriteAccessors>
|
||||||
: public MapBase<Derived, ReadOnlyAccessors>
|
: public MapBase<Derived, ReadOnlyAccessors>
|
||||||
{
|
{
|
||||||
|
typedef MapBase<Derived, ReadOnlyAccessors> ReadOnlyMapBase;
|
||||||
public:
|
public:
|
||||||
|
|
||||||
typedef MapBase<Derived, ReadOnlyAccessors> Base;
|
typedef MapBase<Derived, ReadOnlyAccessors> Base;
|
||||||
@@ -230,13 +231,17 @@ template<typename Derived> class MapBase<Derived, WriteAccessors>
|
|||||||
|
|
||||||
Derived& operator=(const MapBase& other)
|
Derived& operator=(const MapBase& other)
|
||||||
{
|
{
|
||||||
Base::Base::operator=(other);
|
ReadOnlyMapBase::Base::operator=(other);
|
||||||
return derived();
|
return derived();
|
||||||
}
|
}
|
||||||
|
|
||||||
using Base::Base::operator=;
|
// In theory we could simply refer to Base:Base::operator=, but MSVC does not like Base::Base,
|
||||||
|
// see bugs 821 and 920.
|
||||||
|
using ReadOnlyMapBase::Base::operator=;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#undef EIGEN_STATIC_ASSERT_INDEX_BASED_ACCESS
|
||||||
|
|
||||||
} // end namespace Eigen
|
} // end namespace Eigen
|
||||||
|
|
||||||
#endif // EIGEN_MAPBASE_H
|
#endif // EIGEN_MAPBASE_H
|
||||||
|
|||||||
@@ -294,7 +294,7 @@ struct hypot_impl
|
|||||||
RealScalar _x = abs(x);
|
RealScalar _x = abs(x);
|
||||||
RealScalar _y = abs(y);
|
RealScalar _y = abs(y);
|
||||||
RealScalar p = (max)(_x, _y);
|
RealScalar p = (max)(_x, _y);
|
||||||
if(p==RealScalar(0)) return 0;
|
if(p==RealScalar(0)) return RealScalar(0);
|
||||||
RealScalar q = (min)(_x, _y);
|
RealScalar q = (min)(_x, _y);
|
||||||
RealScalar qp = q/p;
|
RealScalar qp = q/p;
|
||||||
return p * sqrt(RealScalar(1) + qp*qp);
|
return p * sqrt(RealScalar(1) + qp*qp);
|
||||||
|
|||||||
@@ -211,6 +211,21 @@ class Matrix
|
|||||||
: Base(internal::constructor_without_unaligned_array_assert())
|
: Base(internal::constructor_without_unaligned_array_assert())
|
||||||
{ Base::_check_template_params(); EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED }
|
{ Base::_check_template_params(); EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED }
|
||||||
|
|
||||||
|
#ifdef EIGEN_HAVE_RVALUE_REFERENCES
|
||||||
|
Matrix(Matrix&& other)
|
||||||
|
: Base(std::move(other))
|
||||||
|
{
|
||||||
|
Base::_check_template_params();
|
||||||
|
if (RowsAtCompileTime!=Dynamic && ColsAtCompileTime!=Dynamic)
|
||||||
|
Base::_set_noalias(other);
|
||||||
|
}
|
||||||
|
Matrix& operator=(Matrix&& other)
|
||||||
|
{
|
||||||
|
other.swap(*this);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/** \brief Constructs a vector or row-vector with given dimension. \only_for_vectors
|
/** \brief Constructs a vector or row-vector with given dimension. \only_for_vectors
|
||||||
*
|
*
|
||||||
* Note that this is only useful for dynamic-size vectors. For fixed-size vectors,
|
* Note that this is only useful for dynamic-size vectors. For fixed-size vectors,
|
||||||
|
|||||||
@@ -159,13 +159,11 @@ template<typename Derived> class MatrixBase
|
|||||||
template<typename OtherDerived>
|
template<typename OtherDerived>
|
||||||
Derived& operator=(const ReturnByValue<OtherDerived>& other);
|
Derived& operator=(const ReturnByValue<OtherDerived>& other);
|
||||||
|
|
||||||
#ifndef EIGEN_PARSED_BY_DOXYGEN
|
|
||||||
template<typename ProductDerived, typename Lhs, typename Rhs>
|
template<typename ProductDerived, typename Lhs, typename Rhs>
|
||||||
Derived& lazyAssign(const ProductBase<ProductDerived, Lhs,Rhs>& other);
|
Derived& lazyAssign(const ProductBase<ProductDerived, Lhs,Rhs>& other);
|
||||||
|
|
||||||
template<typename MatrixPower, typename Lhs, typename Rhs>
|
template<typename MatrixPower, typename Lhs, typename Rhs>
|
||||||
Derived& lazyAssign(const MatrixPowerProduct<MatrixPower, Lhs,Rhs>& other);
|
Derived& lazyAssign(const MatrixPowerProduct<MatrixPower, Lhs,Rhs>& other);
|
||||||
#endif // not EIGEN_PARSED_BY_DOXYGEN
|
|
||||||
|
|
||||||
template<typename OtherDerived>
|
template<typename OtherDerived>
|
||||||
Derived& operator+=(const MatrixBase<OtherDerived>& other);
|
Derived& operator+=(const MatrixBase<OtherDerived>& other);
|
||||||
@@ -215,7 +213,7 @@ template<typename Derived> class MatrixBase
|
|||||||
|
|
||||||
typedef Diagonal<Derived> DiagonalReturnType;
|
typedef Diagonal<Derived> DiagonalReturnType;
|
||||||
DiagonalReturnType diagonal();
|
DiagonalReturnType diagonal();
|
||||||
typedef typename internal::add_const<Diagonal<const Derived> >::type ConstDiagonalReturnType;
|
typedef typename internal::add_const<Diagonal<const Derived> >::type ConstDiagonalReturnType;
|
||||||
ConstDiagonalReturnType diagonal() const;
|
ConstDiagonalReturnType diagonal() const;
|
||||||
|
|
||||||
template<int Index> struct DiagonalIndexReturnType { typedef Diagonal<Derived,Index> Type; };
|
template<int Index> struct DiagonalIndexReturnType { typedef Diagonal<Derived,Index> Type; };
|
||||||
@@ -223,16 +221,12 @@ template<typename Derived> class MatrixBase
|
|||||||
|
|
||||||
template<int Index> typename DiagonalIndexReturnType<Index>::Type diagonal();
|
template<int Index> typename DiagonalIndexReturnType<Index>::Type diagonal();
|
||||||
template<int Index> typename ConstDiagonalIndexReturnType<Index>::Type diagonal() const;
|
template<int Index> typename ConstDiagonalIndexReturnType<Index>::Type diagonal() const;
|
||||||
|
|
||||||
|
typedef Diagonal<Derived,DynamicIndex> DiagonalDynamicIndexReturnType;
|
||||||
|
typedef typename internal::add_const<Diagonal<const Derived,DynamicIndex> >::type ConstDiagonalDynamicIndexReturnType;
|
||||||
|
|
||||||
// Note: The "MatrixBase::" prefixes are added to help MSVC9 to match these declarations with the later implementations.
|
DiagonalDynamicIndexReturnType diagonal(Index index);
|
||||||
// On the other hand they confuse MSVC8...
|
ConstDiagonalDynamicIndexReturnType diagonal(Index index) const;
|
||||||
#if (defined _MSC_VER) && (_MSC_VER >= 1500) // 2008 or later
|
|
||||||
typename MatrixBase::template DiagonalIndexReturnType<DynamicIndex>::Type diagonal(Index index);
|
|
||||||
typename MatrixBase::template ConstDiagonalIndexReturnType<DynamicIndex>::Type diagonal(Index index) const;
|
|
||||||
#else
|
|
||||||
typename DiagonalIndexReturnType<DynamicIndex>::Type diagonal(Index index);
|
|
||||||
typename ConstDiagonalIndexReturnType<DynamicIndex>::Type diagonal(Index index) const;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef EIGEN2_SUPPORT
|
#ifdef EIGEN2_SUPPORT
|
||||||
template<unsigned int Mode> typename internal::eigen2_part_return_type<Derived, Mode>::type part();
|
template<unsigned int Mode> typename internal::eigen2_part_return_type<Derived, Mode>::type part();
|
||||||
@@ -446,6 +440,15 @@ template<typename Derived> class MatrixBase
|
|||||||
template<typename OtherScalar>
|
template<typename OtherScalar>
|
||||||
void applyOnTheRight(Index p, Index q, const JacobiRotation<OtherScalar>& j);
|
void applyOnTheRight(Index p, Index q, const JacobiRotation<OtherScalar>& j);
|
||||||
|
|
||||||
|
///////// SparseCore module /////////
|
||||||
|
|
||||||
|
template<typename OtherDerived>
|
||||||
|
EIGEN_STRONG_INLINE const typename SparseMatrixBase<OtherDerived>::template CwiseProductDenseReturnType<Derived>::Type
|
||||||
|
cwiseProduct(const SparseMatrixBase<OtherDerived> &other) const
|
||||||
|
{
|
||||||
|
return other.cwiseProduct(derived());
|
||||||
|
}
|
||||||
|
|
||||||
///////// MatrixFunctions module /////////
|
///////// MatrixFunctions module /////////
|
||||||
|
|
||||||
typedef typename internal::stem_function<Scalar>::type StemFunction;
|
typedef typename internal::stem_function<Scalar>::type StemFunction;
|
||||||
|
|||||||
@@ -250,6 +250,35 @@ class PermutationBase : public EigenBase<Derived>
|
|||||||
template<typename Other> friend
|
template<typename Other> friend
|
||||||
inline PlainPermutationType operator*(const Transpose<PermutationBase<Other> >& other, const PermutationBase& perm)
|
inline PlainPermutationType operator*(const Transpose<PermutationBase<Other> >& other, const PermutationBase& perm)
|
||||||
{ return PlainPermutationType(internal::PermPermProduct, other.eval(), perm); }
|
{ return PlainPermutationType(internal::PermPermProduct, other.eval(), perm); }
|
||||||
|
|
||||||
|
/** \returns the determinant of the permutation matrix, which is either 1 or -1 depending on the parity of the permutation.
|
||||||
|
*
|
||||||
|
* This function is O(\c n) procedure allocating a buffer of \c n booleans.
|
||||||
|
*/
|
||||||
|
Index determinant() const
|
||||||
|
{
|
||||||
|
Index res = 1;
|
||||||
|
Index n = size();
|
||||||
|
Matrix<bool,RowsAtCompileTime,1,0,MaxRowsAtCompileTime> mask(n);
|
||||||
|
mask.fill(false);
|
||||||
|
Index r = 0;
|
||||||
|
while(r < n)
|
||||||
|
{
|
||||||
|
// search for the next seed
|
||||||
|
while(r<n && mask[r]) r++;
|
||||||
|
if(r>=n)
|
||||||
|
break;
|
||||||
|
// we got one, let's follow it until we are back to the seed
|
||||||
|
Index k0 = r++;
|
||||||
|
mask.coeffRef(k0) = true;
|
||||||
|
for(Index k=indices().coeff(k0); k!=k0; k=indices().coeff(k))
|
||||||
|
{
|
||||||
|
mask.coeffRef(k) = true;
|
||||||
|
res = -res;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
@@ -555,7 +584,10 @@ struct permut_matrix_product_retval
|
|||||||
const Index n = Side==OnTheLeft ? rows() : cols();
|
const Index n = Side==OnTheLeft ? rows() : cols();
|
||||||
// FIXME we need an is_same for expression that is not sensitive to constness. For instance
|
// FIXME we need an is_same for expression that is not sensitive to constness. For instance
|
||||||
// is_same_xpr<Block<const Matrix>, Block<Matrix> >::value should be true.
|
// is_same_xpr<Block<const Matrix>, Block<Matrix> >::value should be true.
|
||||||
if(is_same<MatrixTypeNestedCleaned,Dest>::value && extract_data(dst) == extract_data(m_matrix))
|
if( is_same<MatrixTypeNestedCleaned,Dest>::value
|
||||||
|
&& blas_traits<MatrixTypeNestedCleaned>::HasUsableDirectAccess
|
||||||
|
&& blas_traits<Dest>::HasUsableDirectAccess
|
||||||
|
&& extract_data(dst) == extract_data(m_matrix))
|
||||||
{
|
{
|
||||||
// apply the permutation inplace
|
// apply the permutation inplace
|
||||||
Matrix<bool,PermutationType::RowsAtCompileTime,1,0,PermutationType::MaxRowsAtCompileTime> mask(m_permutation.size());
|
Matrix<bool,PermutationType::RowsAtCompileTime,1,0,PermutationType::MaxRowsAtCompileTime> mask(m_permutation.size());
|
||||||
|
|||||||
@@ -437,6 +437,36 @@ class PlainObjectBase : public internal::dense_xpr_base<Derived>::type
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef EIGEN_HAVE_RVALUE_REFERENCES
|
||||||
|
PlainObjectBase(PlainObjectBase&& other)
|
||||||
|
: m_storage( std::move(other.m_storage) )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
PlainObjectBase& operator=(PlainObjectBase&& other)
|
||||||
|
{
|
||||||
|
using std::swap;
|
||||||
|
swap(m_storage, other.m_storage);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** Copy constructor */
|
||||||
|
EIGEN_STRONG_INLINE PlainObjectBase(const PlainObjectBase& other)
|
||||||
|
: m_storage()
|
||||||
|
{
|
||||||
|
_check_template_params();
|
||||||
|
lazyAssign(other);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename OtherDerived>
|
||||||
|
EIGEN_STRONG_INLINE PlainObjectBase(const DenseBase<OtherDerived> &other)
|
||||||
|
: m_storage()
|
||||||
|
{
|
||||||
|
_check_template_params();
|
||||||
|
lazyAssign(other);
|
||||||
|
}
|
||||||
|
|
||||||
EIGEN_STRONG_INLINE PlainObjectBase(Index a_size, Index nbRows, Index nbCols)
|
EIGEN_STRONG_INLINE PlainObjectBase(Index a_size, Index nbRows, Index nbCols)
|
||||||
: m_storage(a_size, nbRows, nbCols)
|
: m_storage(a_size, nbRows, nbCols)
|
||||||
{
|
{
|
||||||
@@ -573,6 +603,8 @@ class PlainObjectBase : public internal::dense_xpr_base<Derived>::type
|
|||||||
: (rows() == other.rows() && cols() == other.cols())))
|
: (rows() == other.rows() && cols() == other.cols())))
|
||||||
&& "Size mismatch. Automatic resizing is disabled because EIGEN_NO_AUTOMATIC_RESIZING is defined");
|
&& "Size mismatch. Automatic resizing is disabled because EIGEN_NO_AUTOMATIC_RESIZING is defined");
|
||||||
EIGEN_ONLY_USED_FOR_DEBUG(other);
|
EIGEN_ONLY_USED_FOR_DEBUG(other);
|
||||||
|
if(this->size()==0)
|
||||||
|
resizeLike(other);
|
||||||
#else
|
#else
|
||||||
resizeLike(other);
|
resizeLike(other);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -85,7 +85,14 @@ class ProductBase : public MatrixBase<Derived>
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
#ifndef EIGEN_NO_MALLOC
|
||||||
|
typedef typename Base::PlainObject BasePlainObject;
|
||||||
|
typedef Matrix<Scalar,RowsAtCompileTime==1?1:Dynamic,ColsAtCompileTime==1?1:Dynamic,BasePlainObject::Options> DynPlainObject;
|
||||||
|
typedef typename internal::conditional<(BasePlainObject::SizeAtCompileTime==Dynamic) || (BasePlainObject::SizeAtCompileTime*int(sizeof(Scalar)) < int(EIGEN_STACK_ALLOCATION_LIMIT)),
|
||||||
|
BasePlainObject, DynPlainObject>::type PlainObject;
|
||||||
|
#else
|
||||||
typedef typename Base::PlainObject PlainObject;
|
typedef typename Base::PlainObject PlainObject;
|
||||||
|
#endif
|
||||||
|
|
||||||
ProductBase(const Lhs& a_lhs, const Rhs& a_rhs)
|
ProductBase(const Lhs& a_lhs, const Rhs& a_rhs)
|
||||||
: m_lhs(a_lhs), m_rhs(a_rhs)
|
: m_lhs(a_lhs), m_rhs(a_rhs)
|
||||||
@@ -180,7 +187,12 @@ namespace internal {
|
|||||||
template<typename Lhs, typename Rhs, int Mode, int N, typename PlainObject>
|
template<typename Lhs, typename Rhs, int Mode, int N, typename PlainObject>
|
||||||
struct nested<GeneralProduct<Lhs,Rhs,Mode>, N, PlainObject>
|
struct nested<GeneralProduct<Lhs,Rhs,Mode>, N, PlainObject>
|
||||||
{
|
{
|
||||||
typedef PlainObject const& type;
|
typedef typename GeneralProduct<Lhs,Rhs,Mode>::PlainObject const& type;
|
||||||
|
};
|
||||||
|
template<typename Lhs, typename Rhs, int Mode, int N, typename PlainObject>
|
||||||
|
struct nested<const GeneralProduct<Lhs,Rhs,Mode>, N, PlainObject>
|
||||||
|
{
|
||||||
|
typedef typename GeneralProduct<Lhs,Rhs,Mode>::PlainObject const& type;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -247,8 +247,9 @@ struct redux_impl<Func, Derived, LinearVectorizedTraversal, NoUnrolling>
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename Func, typename Derived>
|
// NOTE: for SliceVectorizedTraversal we simply bypass unrolling
|
||||||
struct redux_impl<Func, Derived, SliceVectorizedTraversal, NoUnrolling>
|
template<typename Func, typename Derived, int Unrolling>
|
||||||
|
struct redux_impl<Func, Derived, SliceVectorizedTraversal, Unrolling>
|
||||||
{
|
{
|
||||||
typedef typename Derived::Scalar Scalar;
|
typedef typename Derived::Scalar Scalar;
|
||||||
typedef typename packet_traits<Scalar>::type PacketScalar;
|
typedef typename packet_traits<Scalar>::type PacketScalar;
|
||||||
|
|||||||
@@ -101,14 +101,15 @@ struct traits<Ref<_PlainObjectType, _Options, _StrideType> >
|
|||||||
template<typename Derived> struct match {
|
template<typename Derived> struct match {
|
||||||
enum {
|
enum {
|
||||||
HasDirectAccess = internal::has_direct_access<Derived>::ret,
|
HasDirectAccess = internal::has_direct_access<Derived>::ret,
|
||||||
StorageOrderMatch = PlainObjectType::IsVectorAtCompileTime || ((PlainObjectType::Flags&RowMajorBit)==(Derived::Flags&RowMajorBit)),
|
StorageOrderMatch = PlainObjectType::IsVectorAtCompileTime || Derived::IsVectorAtCompileTime || ((PlainObjectType::Flags&RowMajorBit)==(Derived::Flags&RowMajorBit)),
|
||||||
InnerStrideMatch = int(StrideType::InnerStrideAtCompileTime)==int(Dynamic)
|
InnerStrideMatch = int(StrideType::InnerStrideAtCompileTime)==int(Dynamic)
|
||||||
|| int(StrideType::InnerStrideAtCompileTime)==int(Derived::InnerStrideAtCompileTime)
|
|| int(StrideType::InnerStrideAtCompileTime)==int(Derived::InnerStrideAtCompileTime)
|
||||||
|| (int(StrideType::InnerStrideAtCompileTime)==0 && int(Derived::InnerStrideAtCompileTime)==1),
|
|| (int(StrideType::InnerStrideAtCompileTime)==0 && int(Derived::InnerStrideAtCompileTime)==1),
|
||||||
OuterStrideMatch = Derived::IsVectorAtCompileTime
|
OuterStrideMatch = Derived::IsVectorAtCompileTime
|
||||||
|| int(StrideType::OuterStrideAtCompileTime)==int(Dynamic) || int(StrideType::OuterStrideAtCompileTime)==int(Derived::OuterStrideAtCompileTime),
|
|| int(StrideType::OuterStrideAtCompileTime)==int(Dynamic) || int(StrideType::OuterStrideAtCompileTime)==int(Derived::OuterStrideAtCompileTime),
|
||||||
AlignmentMatch = (_Options!=Aligned) || ((PlainObjectType::Flags&AlignedBit)==0) || ((traits<Derived>::Flags&AlignedBit)==AlignedBit),
|
AlignmentMatch = (_Options!=Aligned) || ((PlainObjectType::Flags&AlignedBit)==0) || ((traits<Derived>::Flags&AlignedBit)==AlignedBit),
|
||||||
MatchAtCompileTime = HasDirectAccess && StorageOrderMatch && InnerStrideMatch && OuterStrideMatch && AlignmentMatch
|
ScalarTypeMatch = internal::is_same<typename PlainObjectType::Scalar, typename Derived::Scalar>::value,
|
||||||
|
MatchAtCompileTime = HasDirectAccess && StorageOrderMatch && InnerStrideMatch && OuterStrideMatch && AlignmentMatch && ScalarTypeMatch
|
||||||
};
|
};
|
||||||
typedef typename internal::conditional<MatchAtCompileTime,internal::true_type,internal::false_type>::type type;
|
typedef typename internal::conditional<MatchAtCompileTime,internal::true_type,internal::false_type>::type type;
|
||||||
};
|
};
|
||||||
@@ -172,8 +173,12 @@ protected:
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
::new (static_cast<Base*>(this)) Base(expr.data(), expr.rows(), expr.cols());
|
::new (static_cast<Base*>(this)) Base(expr.data(), expr.rows(), expr.cols());
|
||||||
::new (&m_stride) StrideBase(StrideType::OuterStrideAtCompileTime==0?0:expr.outerStride(),
|
|
||||||
StrideType::InnerStrideAtCompileTime==0?0:expr.innerStride());
|
if(Expression::IsVectorAtCompileTime && (!PlainObjectType::IsVectorAtCompileTime) && ((Expression::Flags&RowMajorBit)!=(PlainObjectType::Flags&RowMajorBit)))
|
||||||
|
::new (&m_stride) StrideBase(expr.innerStride(), StrideType::InnerStrideAtCompileTime==0?0:1);
|
||||||
|
else
|
||||||
|
::new (&m_stride) StrideBase(StrideType::OuterStrideAtCompileTime==0?0:expr.outerStride(),
|
||||||
|
StrideType::InnerStrideAtCompileTime==0?0:expr.innerStride());
|
||||||
}
|
}
|
||||||
|
|
||||||
StrideBase m_stride;
|
StrideBase m_stride;
|
||||||
@@ -183,7 +188,11 @@ protected:
|
|||||||
template<typename PlainObjectType, int Options, typename StrideType> class Ref
|
template<typename PlainObjectType, int Options, typename StrideType> class Ref
|
||||||
: public RefBase<Ref<PlainObjectType, Options, StrideType> >
|
: public RefBase<Ref<PlainObjectType, Options, StrideType> >
|
||||||
{
|
{
|
||||||
|
private:
|
||||||
typedef internal::traits<Ref> Traits;
|
typedef internal::traits<Ref> Traits;
|
||||||
|
template<typename Derived>
|
||||||
|
inline Ref(const PlainObjectBase<Derived>& expr,
|
||||||
|
typename internal::enable_if<bool(Traits::template match<Derived>::MatchAtCompileTime),Derived>::type* = 0);
|
||||||
public:
|
public:
|
||||||
|
|
||||||
typedef RefBase<Ref> Base;
|
typedef RefBase<Ref> Base;
|
||||||
@@ -195,17 +204,20 @@ template<typename PlainObjectType, int Options, typename StrideType> class Ref
|
|||||||
inline Ref(PlainObjectBase<Derived>& expr,
|
inline Ref(PlainObjectBase<Derived>& expr,
|
||||||
typename internal::enable_if<bool(Traits::template match<Derived>::MatchAtCompileTime),Derived>::type* = 0)
|
typename internal::enable_if<bool(Traits::template match<Derived>::MatchAtCompileTime),Derived>::type* = 0)
|
||||||
{
|
{
|
||||||
Base::construct(expr);
|
EIGEN_STATIC_ASSERT(static_cast<bool>(Traits::template match<Derived>::MatchAtCompileTime), STORAGE_LAYOUT_DOES_NOT_MATCH);
|
||||||
|
Base::construct(expr.derived());
|
||||||
}
|
}
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
inline Ref(const DenseBase<Derived>& expr,
|
inline Ref(const DenseBase<Derived>& expr,
|
||||||
typename internal::enable_if<bool(internal::is_lvalue<Derived>::value&&bool(Traits::template match<Derived>::MatchAtCompileTime)),Derived>::type* = 0,
|
typename internal::enable_if<bool(Traits::template match<Derived>::MatchAtCompileTime),Derived>::type* = 0)
|
||||||
int = Derived::ThisConstantIsPrivateInPlainObjectBase)
|
|
||||||
#else
|
#else
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
inline Ref(DenseBase<Derived>& expr)
|
inline Ref(DenseBase<Derived>& expr)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
EIGEN_STATIC_ASSERT(static_cast<bool>(internal::is_lvalue<Derived>::value), THIS_EXPRESSION_IS_NOT_A_LVALUE__IT_IS_READ_ONLY);
|
||||||
|
EIGEN_STATIC_ASSERT(static_cast<bool>(Traits::template match<Derived>::MatchAtCompileTime), STORAGE_LAYOUT_DOES_NOT_MATCH);
|
||||||
|
enum { THIS_EXPRESSION_IS_NOT_A_LVALUE__IT_IS_READ_ONLY = Derived::ThisConstantIsPrivateInPlainObjectBase};
|
||||||
Base::construct(expr.const_cast_derived());
|
Base::construct(expr.const_cast_derived());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -224,13 +236,23 @@ template<typename TPlainObjectType, int Options, typename StrideType> class Ref<
|
|||||||
EIGEN_DENSE_PUBLIC_INTERFACE(Ref)
|
EIGEN_DENSE_PUBLIC_INTERFACE(Ref)
|
||||||
|
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
inline Ref(const DenseBase<Derived>& expr)
|
inline Ref(const DenseBase<Derived>& expr,
|
||||||
|
typename internal::enable_if<bool(Traits::template match<Derived>::ScalarTypeMatch),Derived>::type* = 0)
|
||||||
{
|
{
|
||||||
// std::cout << match_helper<Derived>::HasDirectAccess << "," << match_helper<Derived>::OuterStrideMatch << "," << match_helper<Derived>::InnerStrideMatch << "\n";
|
// std::cout << match_helper<Derived>::HasDirectAccess << "," << match_helper<Derived>::OuterStrideMatch << "," << match_helper<Derived>::InnerStrideMatch << "\n";
|
||||||
// std::cout << int(StrideType::OuterStrideAtCompileTime) << " - " << int(Derived::OuterStrideAtCompileTime) << "\n";
|
// std::cout << int(StrideType::OuterStrideAtCompileTime) << " - " << int(Derived::OuterStrideAtCompileTime) << "\n";
|
||||||
// std::cout << int(StrideType::InnerStrideAtCompileTime) << " - " << int(Derived::InnerStrideAtCompileTime) << "\n";
|
// std::cout << int(StrideType::InnerStrideAtCompileTime) << " - " << int(Derived::InnerStrideAtCompileTime) << "\n";
|
||||||
construct(expr.derived(), typename Traits::template match<Derived>::type());
|
construct(expr.derived(), typename Traits::template match<Derived>::type());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline Ref(const Ref& other) : Base(other) {
|
||||||
|
// copy constructor shall not copy the m_object, to avoid unnecessary malloc and copy
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename OtherRef>
|
||||||
|
inline Ref(const RefBase<OtherRef>& other) {
|
||||||
|
construct(other.derived(), typename Traits::template match<OtherRef>::type());
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ template<typename MatrixType,int RowFactor,int ColFactor> class Replicate
|
|||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
template<int RowFactor, int ColFactor>
|
template<int RowFactor, int ColFactor>
|
||||||
inline const Replicate<Derived,RowFactor,ColFactor>
|
const Replicate<Derived,RowFactor,ColFactor>
|
||||||
DenseBase<Derived>::replicate() const
|
DenseBase<Derived>::replicate() const
|
||||||
{
|
{
|
||||||
return Replicate<Derived,RowFactor,ColFactor>(derived());
|
return Replicate<Derived,RowFactor,ColFactor>(derived());
|
||||||
@@ -150,7 +150,7 @@ DenseBase<Derived>::replicate() const
|
|||||||
* \sa VectorwiseOp::replicate(), DenseBase::replicate<int,int>(), class Replicate
|
* \sa VectorwiseOp::replicate(), DenseBase::replicate<int,int>(), class Replicate
|
||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
inline const Replicate<Derived,Dynamic,Dynamic>
|
const typename DenseBase<Derived>::ReplicateReturnType
|
||||||
DenseBase<Derived>::replicate(Index rowFactor,Index colFactor) const
|
DenseBase<Derived>::replicate(Index rowFactor,Index colFactor) const
|
||||||
{
|
{
|
||||||
return Replicate<Derived,Dynamic,Dynamic>(derived(),rowFactor,colFactor);
|
return Replicate<Derived,Dynamic,Dynamic>(derived(),rowFactor,colFactor);
|
||||||
|
|||||||
@@ -72,6 +72,8 @@ template<typename Derived> class ReturnByValue
|
|||||||
const Unusable& coeff(Index,Index) const { return *reinterpret_cast<const Unusable*>(this); }
|
const Unusable& coeff(Index,Index) const { return *reinterpret_cast<const Unusable*>(this); }
|
||||||
Unusable& coeffRef(Index) { return *reinterpret_cast<Unusable*>(this); }
|
Unusable& coeffRef(Index) { return *reinterpret_cast<Unusable*>(this); }
|
||||||
Unusable& coeffRef(Index,Index) { return *reinterpret_cast<Unusable*>(this); }
|
Unusable& coeffRef(Index,Index) { return *reinterpret_cast<Unusable*>(this); }
|
||||||
|
template<int LoadMode> Unusable& packet(Index) const;
|
||||||
|
template<int LoadMode> Unusable& packet(Index, Index) const;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -83,6 +85,15 @@ Derived& DenseBase<Derived>::operator=(const ReturnByValue<OtherDerived>& other)
|
|||||||
return derived();
|
return derived();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<typename Derived>
|
||||||
|
template<typename OtherDerived>
|
||||||
|
Derived& DenseBase<Derived>::lazyAssign(const ReturnByValue<OtherDerived>& other)
|
||||||
|
{
|
||||||
|
other.evalTo(derived());
|
||||||
|
return derived();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} // end namespace Eigen
|
} // end namespace Eigen
|
||||||
|
|
||||||
#endif // EIGEN_RETURNBYVALUE_H
|
#endif // EIGEN_RETURNBYVALUE_H
|
||||||
|
|||||||
@@ -180,15 +180,9 @@ inline Derived& DenseBase<Derived>::operator*=(const Scalar& other)
|
|||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
inline Derived& DenseBase<Derived>::operator/=(const Scalar& other)
|
inline Derived& DenseBase<Derived>::operator/=(const Scalar& other)
|
||||||
{
|
{
|
||||||
typedef typename internal::conditional<NumTraits<Scalar>::IsInteger,
|
|
||||||
internal::scalar_quotient_op<Scalar>,
|
|
||||||
internal::scalar_product_op<Scalar> >::type BinOp;
|
|
||||||
typedef typename Derived::PlainObject PlainObject;
|
typedef typename Derived::PlainObject PlainObject;
|
||||||
SelfCwiseBinaryOp<BinOp, Derived, typename PlainObject::ConstantReturnType> tmp(derived());
|
SelfCwiseBinaryOp<internal::scalar_quotient_op<Scalar>, Derived, typename PlainObject::ConstantReturnType> tmp(derived());
|
||||||
Scalar actual_other;
|
tmp = PlainObject::Constant(rows(),cols(), other);
|
||||||
if(NumTraits<Scalar>::IsInteger) actual_other = other;
|
|
||||||
else actual_other = Scalar(1)/other;
|
|
||||||
tmp = PlainObject::Constant(rows(),cols(), actual_other);
|
|
||||||
return derived();
|
return derived();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -278,21 +278,21 @@ template<typename _MatrixType, unsigned int _Mode> class TriangularView
|
|||||||
|
|
||||||
/** Efficient triangular matrix times vector/matrix product */
|
/** Efficient triangular matrix times vector/matrix product */
|
||||||
template<typename OtherDerived>
|
template<typename OtherDerived>
|
||||||
TriangularProduct<Mode,true,MatrixType,false,OtherDerived, OtherDerived::IsVectorAtCompileTime>
|
TriangularProduct<Mode, true, MatrixType, false, OtherDerived, OtherDerived::ColsAtCompileTime==1>
|
||||||
operator*(const MatrixBase<OtherDerived>& rhs) const
|
operator*(const MatrixBase<OtherDerived>& rhs) const
|
||||||
{
|
{
|
||||||
return TriangularProduct
|
return TriangularProduct
|
||||||
<Mode,true,MatrixType,false,OtherDerived,OtherDerived::IsVectorAtCompileTime>
|
<Mode, true, MatrixType, false, OtherDerived, OtherDerived::ColsAtCompileTime==1>
|
||||||
(m_matrix, rhs.derived());
|
(m_matrix, rhs.derived());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Efficient vector/matrix times triangular matrix product */
|
/** Efficient vector/matrix times triangular matrix product */
|
||||||
template<typename OtherDerived> friend
|
template<typename OtherDerived> friend
|
||||||
TriangularProduct<Mode,false,OtherDerived,OtherDerived::IsVectorAtCompileTime,MatrixType,false>
|
TriangularProduct<Mode, false, OtherDerived, OtherDerived::RowsAtCompileTime==1, MatrixType, false>
|
||||||
operator*(const MatrixBase<OtherDerived>& lhs, const TriangularView& rhs)
|
operator*(const MatrixBase<OtherDerived>& lhs, const TriangularView& rhs)
|
||||||
{
|
{
|
||||||
return TriangularProduct
|
return TriangularProduct
|
||||||
<Mode,false,OtherDerived,OtherDerived::IsVectorAtCompileTime,MatrixType,false>
|
<Mode, false, OtherDerived, OtherDerived::RowsAtCompileTime==1, MatrixType, false>
|
||||||
(lhs.derived(),rhs.m_matrix);
|
(lhs.derived(),rhs.m_matrix);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -380,19 +380,19 @@ template<typename _MatrixType, unsigned int _Mode> class TriangularView
|
|||||||
EIGEN_STRONG_INLINE TriangularView& operator=(const ProductBase<ProductDerived, Lhs,Rhs>& other)
|
EIGEN_STRONG_INLINE TriangularView& operator=(const ProductBase<ProductDerived, Lhs,Rhs>& other)
|
||||||
{
|
{
|
||||||
setZero();
|
setZero();
|
||||||
return assignProduct(other,1);
|
return assignProduct(other.derived(),1);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename ProductDerived, typename Lhs, typename Rhs>
|
template<typename ProductDerived, typename Lhs, typename Rhs>
|
||||||
EIGEN_STRONG_INLINE TriangularView& operator+=(const ProductBase<ProductDerived, Lhs,Rhs>& other)
|
EIGEN_STRONG_INLINE TriangularView& operator+=(const ProductBase<ProductDerived, Lhs,Rhs>& other)
|
||||||
{
|
{
|
||||||
return assignProduct(other,1);
|
return assignProduct(other.derived(),1);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename ProductDerived, typename Lhs, typename Rhs>
|
template<typename ProductDerived, typename Lhs, typename Rhs>
|
||||||
EIGEN_STRONG_INLINE TriangularView& operator-=(const ProductBase<ProductDerived, Lhs,Rhs>& other)
|
EIGEN_STRONG_INLINE TriangularView& operator-=(const ProductBase<ProductDerived, Lhs,Rhs>& other)
|
||||||
{
|
{
|
||||||
return assignProduct(other,-1);
|
return assignProduct(other.derived(),-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -400,25 +400,34 @@ template<typename _MatrixType, unsigned int _Mode> class TriangularView
|
|||||||
EIGEN_STRONG_INLINE TriangularView& operator=(const ScaledProduct<ProductDerived>& other)
|
EIGEN_STRONG_INLINE TriangularView& operator=(const ScaledProduct<ProductDerived>& other)
|
||||||
{
|
{
|
||||||
setZero();
|
setZero();
|
||||||
return assignProduct(other,other.alpha());
|
return assignProduct(other.derived(),other.alpha());
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename ProductDerived>
|
template<typename ProductDerived>
|
||||||
EIGEN_STRONG_INLINE TriangularView& operator+=(const ScaledProduct<ProductDerived>& other)
|
EIGEN_STRONG_INLINE TriangularView& operator+=(const ScaledProduct<ProductDerived>& other)
|
||||||
{
|
{
|
||||||
return assignProduct(other,other.alpha());
|
return assignProduct(other.derived(),other.alpha());
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename ProductDerived>
|
template<typename ProductDerived>
|
||||||
EIGEN_STRONG_INLINE TriangularView& operator-=(const ScaledProduct<ProductDerived>& other)
|
EIGEN_STRONG_INLINE TriangularView& operator-=(const ScaledProduct<ProductDerived>& other)
|
||||||
{
|
{
|
||||||
return assignProduct(other,-other.alpha());
|
return assignProduct(other.derived(),-other.alpha());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
template<typename ProductDerived, typename Lhs, typename Rhs>
|
template<typename ProductDerived, typename Lhs, typename Rhs>
|
||||||
EIGEN_STRONG_INLINE TriangularView& assignProduct(const ProductBase<ProductDerived, Lhs,Rhs>& prod, const Scalar& alpha);
|
EIGEN_STRONG_INLINE TriangularView& assignProduct(const ProductBase<ProductDerived, Lhs,Rhs>& prod, const Scalar& alpha);
|
||||||
|
|
||||||
|
template<int Mode, bool LhsIsTriangular,
|
||||||
|
typename Lhs, bool LhsIsVector,
|
||||||
|
typename Rhs, bool RhsIsVector>
|
||||||
|
EIGEN_STRONG_INLINE TriangularView& assignProduct(const TriangularProduct<Mode, LhsIsTriangular, Lhs, LhsIsVector, Rhs, RhsIsVector>& prod, const Scalar& alpha)
|
||||||
|
{
|
||||||
|
lazyAssign(alpha*prod.eval());
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
MatrixTypeNested m_matrix;
|
MatrixTypeNested m_matrix;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ template<> EIGEN_STRONG_INLINE Packet2cf ploaddup<Packet2cf>(const std::complex<
|
|||||||
template<> EIGEN_STRONG_INLINE void pstore <std::complex<float> >(std::complex<float> * to, const Packet2cf& from) { EIGEN_DEBUG_ALIGNED_STORE pstore((float*)to, from.v); }
|
template<> EIGEN_STRONG_INLINE void pstore <std::complex<float> >(std::complex<float> * to, const Packet2cf& from) { EIGEN_DEBUG_ALIGNED_STORE pstore((float*)to, from.v); }
|
||||||
template<> EIGEN_STRONG_INLINE void pstoreu<std::complex<float> >(std::complex<float> * to, const Packet2cf& from) { EIGEN_DEBUG_UNALIGNED_STORE pstoreu((float*)to, from.v); }
|
template<> EIGEN_STRONG_INLINE void pstoreu<std::complex<float> >(std::complex<float> * to, const Packet2cf& from) { EIGEN_DEBUG_UNALIGNED_STORE pstoreu((float*)to, from.v); }
|
||||||
|
|
||||||
template<> EIGEN_STRONG_INLINE void prefetch<std::complex<float> >(const std::complex<float> * addr) { __pld((float *)addr); }
|
template<> EIGEN_STRONG_INLINE void prefetch<std::complex<float> >(const std::complex<float> * addr) { EIGEN_ARM_PREFETCH((float *)addr); }
|
||||||
|
|
||||||
template<> EIGEN_STRONG_INLINE std::complex<float> pfirst<Packet2cf>(const Packet2cf& a)
|
template<> EIGEN_STRONG_INLINE std::complex<float> pfirst<Packet2cf>(const Packet2cf& a)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -48,9 +48,18 @@ typedef uint32x4_t Packet4ui;
|
|||||||
#define EIGEN_INIT_NEON_PACKET2(X, Y) {X, Y}
|
#define EIGEN_INIT_NEON_PACKET2(X, Y) {X, Y}
|
||||||
#define EIGEN_INIT_NEON_PACKET4(X, Y, Z, W) {X, Y, Z, W}
|
#define EIGEN_INIT_NEON_PACKET4(X, Y, Z, W) {X, Y, Z, W}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef __pld
|
// arm64 does have the pld instruction. If available, let's trust the __builtin_prefetch built-in function
|
||||||
#define __pld(x) asm volatile ( " pld [%[addr]]\n" :: [addr] "r" (x) : "cc" );
|
// which available on LLVM and GCC (at least)
|
||||||
|
#if EIGEN_HAS_BUILTIN(__builtin_prefetch) || defined(__GNUC__)
|
||||||
|
#define EIGEN_ARM_PREFETCH(ADDR) __builtin_prefetch(ADDR);
|
||||||
|
#elif defined __pld
|
||||||
|
#define EIGEN_ARM_PREFETCH(ADDR) __pld(ADDR)
|
||||||
|
#elif !defined(__aarch64__)
|
||||||
|
#define EIGEN_ARM_PREFETCH(ADDR) __asm__ __volatile__ ( " pld [%[addr]]\n" :: [addr] "r" (ADDR) : "cc" );
|
||||||
|
#else
|
||||||
|
// by default no explicit prefetching
|
||||||
|
#define EIGEN_ARM_PREFETCH(ADDR)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
template<> struct packet_traits<float> : default_packet_traits
|
template<> struct packet_traits<float> : default_packet_traits
|
||||||
@@ -209,8 +218,8 @@ template<> EIGEN_STRONG_INLINE void pstore<int>(int* to, const Packet4i& f
|
|||||||
template<> EIGEN_STRONG_INLINE void pstoreu<float>(float* to, const Packet4f& from) { EIGEN_DEBUG_UNALIGNED_STORE vst1q_f32(to, from); }
|
template<> EIGEN_STRONG_INLINE void pstoreu<float>(float* to, const Packet4f& from) { EIGEN_DEBUG_UNALIGNED_STORE vst1q_f32(to, from); }
|
||||||
template<> EIGEN_STRONG_INLINE void pstoreu<int>(int* to, const Packet4i& from) { EIGEN_DEBUG_UNALIGNED_STORE vst1q_s32(to, from); }
|
template<> EIGEN_STRONG_INLINE void pstoreu<int>(int* to, const Packet4i& from) { EIGEN_DEBUG_UNALIGNED_STORE vst1q_s32(to, from); }
|
||||||
|
|
||||||
template<> EIGEN_STRONG_INLINE void prefetch<float>(const float* addr) { __pld(addr); }
|
template<> EIGEN_STRONG_INLINE void prefetch<float>(const float* addr) { EIGEN_ARM_PREFETCH(addr); }
|
||||||
template<> EIGEN_STRONG_INLINE void prefetch<int>(const int* addr) { __pld(addr); }
|
template<> EIGEN_STRONG_INLINE void prefetch<int>(const int* addr) { EIGEN_ARM_PREFETCH(addr); }
|
||||||
|
|
||||||
// FIXME only store the 2 first elements ?
|
// FIXME only store the 2 first elements ?
|
||||||
template<> EIGEN_STRONG_INLINE float pfirst<Packet4f>(const Packet4f& a) { float EIGEN_ALIGN16 x[4]; vst1q_f32(x, a); return x[0]; }
|
template<> EIGEN_STRONG_INLINE float pfirst<Packet4f>(const Packet4f& a) { float EIGEN_ALIGN16 x[4]; vst1q_f32(x, a); return x[0]; }
|
||||||
@@ -375,6 +384,7 @@ template<> EIGEN_STRONG_INLINE int predux_max<Packet4i>(const Packet4i& a)
|
|||||||
a_lo = vget_low_s32(a);
|
a_lo = vget_low_s32(a);
|
||||||
a_hi = vget_high_s32(a);
|
a_hi = vget_high_s32(a);
|
||||||
max = vpmax_s32(a_lo, a_hi);
|
max = vpmax_s32(a_lo, a_hi);
|
||||||
|
max = vpmax_s32(max, max);
|
||||||
|
|
||||||
return vget_lane_s32(max, 0);
|
return vget_lane_s32(max, 0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ Packet4f plog<Packet4f>(const Packet4f& _x)
|
|||||||
|
|
||||||
Packet4i emm0;
|
Packet4i emm0;
|
||||||
|
|
||||||
Packet4f invalid_mask = _mm_cmplt_ps(x, _mm_setzero_ps());
|
Packet4f invalid_mask = _mm_cmpnge_ps(x, _mm_setzero_ps()); // not greater equal is true if x is NaN
|
||||||
Packet4f iszero_mask = _mm_cmpeq_ps(x, _mm_setzero_ps());
|
Packet4f iszero_mask = _mm_cmpeq_ps(x, _mm_setzero_ps());
|
||||||
|
|
||||||
x = pmax(x, p4f_min_norm_pos); /* cut off denormalized stuff */
|
x = pmax(x, p4f_min_norm_pos); /* cut off denormalized stuff */
|
||||||
@@ -126,7 +126,7 @@ Packet4f pexp<Packet4f>(const Packet4f& _x)
|
|||||||
_EIGEN_DECLARE_CONST_Packet4f(cephes_exp_p4, 1.6666665459E-1f);
|
_EIGEN_DECLARE_CONST_Packet4f(cephes_exp_p4, 1.6666665459E-1f);
|
||||||
_EIGEN_DECLARE_CONST_Packet4f(cephes_exp_p5, 5.0000001201E-1f);
|
_EIGEN_DECLARE_CONST_Packet4f(cephes_exp_p5, 5.0000001201E-1f);
|
||||||
|
|
||||||
Packet4f tmp = _mm_setzero_ps(), fx;
|
Packet4f tmp, fx;
|
||||||
Packet4i emm0;
|
Packet4i emm0;
|
||||||
|
|
||||||
// clamp x
|
// clamp x
|
||||||
@@ -166,7 +166,7 @@ Packet4f pexp<Packet4f>(const Packet4f& _x)
|
|||||||
emm0 = _mm_cvttps_epi32(fx);
|
emm0 = _mm_cvttps_epi32(fx);
|
||||||
emm0 = _mm_add_epi32(emm0, p4i_0x7f);
|
emm0 = _mm_add_epi32(emm0, p4i_0x7f);
|
||||||
emm0 = _mm_slli_epi32(emm0, 23);
|
emm0 = _mm_slli_epi32(emm0, 23);
|
||||||
return pmul(y, _mm_castsi128_ps(emm0));
|
return pmax(pmul(y, Packet4f(_mm_castsi128_ps(emm0))), _x);
|
||||||
}
|
}
|
||||||
template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED
|
template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED
|
||||||
Packet2d pexp<Packet2d>(const Packet2d& _x)
|
Packet2d pexp<Packet2d>(const Packet2d& _x)
|
||||||
@@ -195,7 +195,7 @@ Packet2d pexp<Packet2d>(const Packet2d& _x)
|
|||||||
_EIGEN_DECLARE_CONST_Packet2d(cephes_exp_C2, 1.42860682030941723212e-6);
|
_EIGEN_DECLARE_CONST_Packet2d(cephes_exp_C2, 1.42860682030941723212e-6);
|
||||||
static const __m128i p4i_1023_0 = _mm_setr_epi32(1023, 1023, 0, 0);
|
static const __m128i p4i_1023_0 = _mm_setr_epi32(1023, 1023, 0, 0);
|
||||||
|
|
||||||
Packet2d tmp = _mm_setzero_pd(), fx;
|
Packet2d tmp, fx;
|
||||||
Packet4i emm0;
|
Packet4i emm0;
|
||||||
|
|
||||||
// clamp x
|
// clamp x
|
||||||
@@ -239,7 +239,7 @@ Packet2d pexp<Packet2d>(const Packet2d& _x)
|
|||||||
emm0 = _mm_add_epi32(emm0, p4i_1023_0);
|
emm0 = _mm_add_epi32(emm0, p4i_1023_0);
|
||||||
emm0 = _mm_slli_epi32(emm0, 20);
|
emm0 = _mm_slli_epi32(emm0, 20);
|
||||||
emm0 = _mm_shuffle_epi32(emm0, _MM_SHUFFLE(1,2,0,3));
|
emm0 = _mm_shuffle_epi32(emm0, _MM_SHUFFLE(1,2,0,3));
|
||||||
return pmul(x, _mm_castsi128_pd(emm0));
|
return pmax(pmul(x, Packet2d(_mm_castsi128_pd(emm0))), _x);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* evaluation of 4 sines at onces, using SSE2 intrinsics.
|
/* evaluation of 4 sines at onces, using SSE2 intrinsics.
|
||||||
@@ -279,7 +279,7 @@ Packet4f psin<Packet4f>(const Packet4f& _x)
|
|||||||
_EIGEN_DECLARE_CONST_Packet4f(coscof_p2, 4.166664568298827E-002f);
|
_EIGEN_DECLARE_CONST_Packet4f(coscof_p2, 4.166664568298827E-002f);
|
||||||
_EIGEN_DECLARE_CONST_Packet4f(cephes_FOPI, 1.27323954473516f); // 4 / M_PI
|
_EIGEN_DECLARE_CONST_Packet4f(cephes_FOPI, 1.27323954473516f); // 4 / M_PI
|
||||||
|
|
||||||
Packet4f xmm1, xmm2 = _mm_setzero_ps(), xmm3, sign_bit, y;
|
Packet4f xmm1, xmm2, xmm3, sign_bit, y;
|
||||||
|
|
||||||
Packet4i emm0, emm2;
|
Packet4i emm0, emm2;
|
||||||
sign_bit = x;
|
sign_bit = x;
|
||||||
@@ -378,7 +378,7 @@ Packet4f pcos<Packet4f>(const Packet4f& _x)
|
|||||||
_EIGEN_DECLARE_CONST_Packet4f(coscof_p2, 4.166664568298827E-002f);
|
_EIGEN_DECLARE_CONST_Packet4f(coscof_p2, 4.166664568298827E-002f);
|
||||||
_EIGEN_DECLARE_CONST_Packet4f(cephes_FOPI, 1.27323954473516f); // 4 / M_PI
|
_EIGEN_DECLARE_CONST_Packet4f(cephes_FOPI, 1.27323954473516f); // 4 / M_PI
|
||||||
|
|
||||||
Packet4f xmm1, xmm2 = _mm_setzero_ps(), xmm3, y;
|
Packet4f xmm1, xmm2, xmm3, y;
|
||||||
Packet4i emm0, emm2;
|
Packet4i emm0, emm2;
|
||||||
|
|
||||||
x = pabs(x);
|
x = pabs(x);
|
||||||
|
|||||||
@@ -90,6 +90,7 @@ struct traits<CoeffBasedProduct<LhsNested,RhsNested,NestingFlags> >
|
|||||||
| (SameType && (CanVectorizeLhs || CanVectorizeRhs) ? PacketAccessBit : 0),
|
| (SameType && (CanVectorizeLhs || CanVectorizeRhs) ? PacketAccessBit : 0),
|
||||||
|
|
||||||
CoeffReadCost = InnerSize == Dynamic ? Dynamic
|
CoeffReadCost = InnerSize == Dynamic ? Dynamic
|
||||||
|
: InnerSize == 0 ? 0
|
||||||
: InnerSize * (NumTraits<Scalar>::MulCost + LhsCoeffReadCost + RhsCoeffReadCost)
|
: InnerSize * (NumTraits<Scalar>::MulCost + LhsCoeffReadCost + RhsCoeffReadCost)
|
||||||
+ (InnerSize - 1) * NumTraits<Scalar>::AddCost,
|
+ (InnerSize - 1) * NumTraits<Scalar>::AddCost,
|
||||||
|
|
||||||
@@ -133,7 +134,7 @@ class CoeffBasedProduct
|
|||||||
};
|
};
|
||||||
|
|
||||||
typedef internal::product_coeff_impl<CanVectorizeInner ? InnerVectorizedTraversal : DefaultTraversal,
|
typedef internal::product_coeff_impl<CanVectorizeInner ? InnerVectorizedTraversal : DefaultTraversal,
|
||||||
Unroll ? InnerSize-1 : Dynamic,
|
Unroll ? InnerSize : Dynamic,
|
||||||
_LhsNested, _RhsNested, Scalar> ScalarCoeffImpl;
|
_LhsNested, _RhsNested, Scalar> ScalarCoeffImpl;
|
||||||
|
|
||||||
typedef CoeffBasedProduct<LhsNested,RhsNested,NestByRefBit> LazyCoeffBasedProductType;
|
typedef CoeffBasedProduct<LhsNested,RhsNested,NestByRefBit> LazyCoeffBasedProductType;
|
||||||
@@ -184,7 +185,7 @@ class CoeffBasedProduct
|
|||||||
{
|
{
|
||||||
PacketScalar res;
|
PacketScalar res;
|
||||||
internal::product_packet_impl<Flags&RowMajorBit ? RowMajor : ColMajor,
|
internal::product_packet_impl<Flags&RowMajorBit ? RowMajor : ColMajor,
|
||||||
Unroll ? InnerSize-1 : Dynamic,
|
Unroll ? InnerSize : Dynamic,
|
||||||
_LhsNested, _RhsNested, PacketScalar, LoadMode>
|
_LhsNested, _RhsNested, PacketScalar, LoadMode>
|
||||||
::run(row, col, m_lhs, m_rhs, res);
|
::run(row, col, m_lhs, m_rhs, res);
|
||||||
return res;
|
return res;
|
||||||
@@ -242,12 +243,12 @@ struct product_coeff_impl<DefaultTraversal, UnrollingIndex, Lhs, Rhs, RetScalar>
|
|||||||
static EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, RetScalar &res)
|
static EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, RetScalar &res)
|
||||||
{
|
{
|
||||||
product_coeff_impl<DefaultTraversal, UnrollingIndex-1, Lhs, Rhs, RetScalar>::run(row, col, lhs, rhs, res);
|
product_coeff_impl<DefaultTraversal, UnrollingIndex-1, Lhs, Rhs, RetScalar>::run(row, col, lhs, rhs, res);
|
||||||
res += lhs.coeff(row, UnrollingIndex) * rhs.coeff(UnrollingIndex, col);
|
res += lhs.coeff(row, UnrollingIndex-1) * rhs.coeff(UnrollingIndex-1, col);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename Lhs, typename Rhs, typename RetScalar>
|
template<typename Lhs, typename Rhs, typename RetScalar>
|
||||||
struct product_coeff_impl<DefaultTraversal, 0, Lhs, Rhs, RetScalar>
|
struct product_coeff_impl<DefaultTraversal, 1, Lhs, Rhs, RetScalar>
|
||||||
{
|
{
|
||||||
typedef typename Lhs::Index Index;
|
typedef typename Lhs::Index Index;
|
||||||
static EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, RetScalar &res)
|
static EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, RetScalar &res)
|
||||||
@@ -256,16 +257,23 @@ struct product_coeff_impl<DefaultTraversal, 0, Lhs, Rhs, RetScalar>
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<typename Lhs, typename Rhs, typename RetScalar>
|
||||||
|
struct product_coeff_impl<DefaultTraversal, 0, Lhs, Rhs, RetScalar>
|
||||||
|
{
|
||||||
|
typedef typename Lhs::Index Index;
|
||||||
|
static EIGEN_STRONG_INLINE void run(Index /*row*/, Index /*col*/, const Lhs& /*lhs*/, const Rhs& /*rhs*/, RetScalar &res)
|
||||||
|
{
|
||||||
|
res = RetScalar(0);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
template<typename Lhs, typename Rhs, typename RetScalar>
|
template<typename Lhs, typename Rhs, typename RetScalar>
|
||||||
struct product_coeff_impl<DefaultTraversal, Dynamic, Lhs, Rhs, RetScalar>
|
struct product_coeff_impl<DefaultTraversal, Dynamic, Lhs, Rhs, RetScalar>
|
||||||
{
|
{
|
||||||
typedef typename Lhs::Index Index;
|
typedef typename Lhs::Index Index;
|
||||||
static EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, RetScalar& res)
|
static EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, RetScalar& res)
|
||||||
{
|
{
|
||||||
eigen_assert(lhs.cols()>0 && "you are using a non initialized matrix");
|
res = (lhs.row(row).transpose().cwiseProduct( rhs.col(col) )).sum();
|
||||||
res = lhs.coeff(row, 0) * rhs.coeff(0, col);
|
|
||||||
for(Index i = 1; i < lhs.cols(); ++i)
|
|
||||||
res += lhs.coeff(row, i) * rhs.coeff(i, col);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -295,6 +303,16 @@ struct product_coeff_vectorized_unroller<0, Lhs, Rhs, Packet>
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<typename Lhs, typename Rhs, typename RetScalar>
|
||||||
|
struct product_coeff_impl<InnerVectorizedTraversal, 0, Lhs, Rhs, RetScalar>
|
||||||
|
{
|
||||||
|
typedef typename Lhs::Index Index;
|
||||||
|
static EIGEN_STRONG_INLINE void run(Index /*row*/, Index /*col*/, const Lhs& /*lhs*/, const Rhs& /*rhs*/, RetScalar &res)
|
||||||
|
{
|
||||||
|
res = 0;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
template<int UnrollingIndex, typename Lhs, typename Rhs, typename RetScalar>
|
template<int UnrollingIndex, typename Lhs, typename Rhs, typename RetScalar>
|
||||||
struct product_coeff_impl<InnerVectorizedTraversal, UnrollingIndex, Lhs, Rhs, RetScalar>
|
struct product_coeff_impl<InnerVectorizedTraversal, UnrollingIndex, Lhs, Rhs, RetScalar>
|
||||||
{
|
{
|
||||||
@@ -304,8 +322,7 @@ struct product_coeff_impl<InnerVectorizedTraversal, UnrollingIndex, Lhs, Rhs, Re
|
|||||||
static EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, RetScalar &res)
|
static EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, RetScalar &res)
|
||||||
{
|
{
|
||||||
Packet pres;
|
Packet pres;
|
||||||
product_coeff_vectorized_unroller<UnrollingIndex+1-PacketSize, Lhs, Rhs, Packet>::run(row, col, lhs, rhs, pres);
|
product_coeff_vectorized_unroller<UnrollingIndex-PacketSize, Lhs, Rhs, Packet>::run(row, col, lhs, rhs, pres);
|
||||||
product_coeff_impl<DefaultTraversal,UnrollingIndex,Lhs,Rhs,RetScalar>::run(row, col, lhs, rhs, res);
|
|
||||||
res = predux(pres);
|
res = predux(pres);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -373,7 +390,7 @@ struct product_packet_impl<RowMajor, UnrollingIndex, Lhs, Rhs, Packet, LoadMode>
|
|||||||
static EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, Packet &res)
|
static EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, Packet &res)
|
||||||
{
|
{
|
||||||
product_packet_impl<RowMajor, UnrollingIndex-1, Lhs, Rhs, Packet, LoadMode>::run(row, col, lhs, rhs, res);
|
product_packet_impl<RowMajor, UnrollingIndex-1, Lhs, Rhs, Packet, LoadMode>::run(row, col, lhs, rhs, res);
|
||||||
res = pmadd(pset1<Packet>(lhs.coeff(row, UnrollingIndex)), rhs.template packet<LoadMode>(UnrollingIndex, col), res);
|
res = pmadd(pset1<Packet>(lhs.coeff(row, UnrollingIndex-1)), rhs.template packet<LoadMode>(UnrollingIndex-1, col), res);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -384,12 +401,12 @@ struct product_packet_impl<ColMajor, UnrollingIndex, Lhs, Rhs, Packet, LoadMode>
|
|||||||
static EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, Packet &res)
|
static EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, Packet &res)
|
||||||
{
|
{
|
||||||
product_packet_impl<ColMajor, UnrollingIndex-1, Lhs, Rhs, Packet, LoadMode>::run(row, col, lhs, rhs, res);
|
product_packet_impl<ColMajor, UnrollingIndex-1, Lhs, Rhs, Packet, LoadMode>::run(row, col, lhs, rhs, res);
|
||||||
res = pmadd(lhs.template packet<LoadMode>(row, UnrollingIndex), pset1<Packet>(rhs.coeff(UnrollingIndex, col)), res);
|
res = pmadd(lhs.template packet<LoadMode>(row, UnrollingIndex-1), pset1<Packet>(rhs.coeff(UnrollingIndex-1, col)), res);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename Lhs, typename Rhs, typename Packet, int LoadMode>
|
template<typename Lhs, typename Rhs, typename Packet, int LoadMode>
|
||||||
struct product_packet_impl<RowMajor, 0, Lhs, Rhs, Packet, LoadMode>
|
struct product_packet_impl<RowMajor, 1, Lhs, Rhs, Packet, LoadMode>
|
||||||
{
|
{
|
||||||
typedef typename Lhs::Index Index;
|
typedef typename Lhs::Index Index;
|
||||||
static EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, Packet &res)
|
static EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, Packet &res)
|
||||||
@@ -399,7 +416,7 @@ struct product_packet_impl<RowMajor, 0, Lhs, Rhs, Packet, LoadMode>
|
|||||||
};
|
};
|
||||||
|
|
||||||
template<typename Lhs, typename Rhs, typename Packet, int LoadMode>
|
template<typename Lhs, typename Rhs, typename Packet, int LoadMode>
|
||||||
struct product_packet_impl<ColMajor, 0, Lhs, Rhs, Packet, LoadMode>
|
struct product_packet_impl<ColMajor, 1, Lhs, Rhs, Packet, LoadMode>
|
||||||
{
|
{
|
||||||
typedef typename Lhs::Index Index;
|
typedef typename Lhs::Index Index;
|
||||||
static EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, Packet &res)
|
static EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, Packet &res)
|
||||||
@@ -408,16 +425,35 @@ struct product_packet_impl<ColMajor, 0, Lhs, Rhs, Packet, LoadMode>
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<typename Lhs, typename Rhs, typename Packet, int LoadMode>
|
||||||
|
struct product_packet_impl<RowMajor, 0, Lhs, Rhs, Packet, LoadMode>
|
||||||
|
{
|
||||||
|
typedef typename Lhs::Index Index;
|
||||||
|
static EIGEN_STRONG_INLINE void run(Index /*row*/, Index /*col*/, const Lhs& /*lhs*/, const Rhs& /*rhs*/, Packet &res)
|
||||||
|
{
|
||||||
|
res = pset1<Packet>(0);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename Lhs, typename Rhs, typename Packet, int LoadMode>
|
||||||
|
struct product_packet_impl<ColMajor, 0, Lhs, Rhs, Packet, LoadMode>
|
||||||
|
{
|
||||||
|
typedef typename Lhs::Index Index;
|
||||||
|
static EIGEN_STRONG_INLINE void run(Index /*row*/, Index /*col*/, const Lhs& /*lhs*/, const Rhs& /*rhs*/, Packet &res)
|
||||||
|
{
|
||||||
|
res = pset1<Packet>(0);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
template<typename Lhs, typename Rhs, typename Packet, int LoadMode>
|
template<typename Lhs, typename Rhs, typename Packet, int LoadMode>
|
||||||
struct product_packet_impl<RowMajor, Dynamic, Lhs, Rhs, Packet, LoadMode>
|
struct product_packet_impl<RowMajor, Dynamic, Lhs, Rhs, Packet, LoadMode>
|
||||||
{
|
{
|
||||||
typedef typename Lhs::Index Index;
|
typedef typename Lhs::Index Index;
|
||||||
static EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, Packet& res)
|
static EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, Packet& res)
|
||||||
{
|
{
|
||||||
eigen_assert(lhs.cols()>0 && "you are using a non initialized matrix");
|
res = pset1<Packet>(0);
|
||||||
res = pmul(pset1<Packet>(lhs.coeff(row, 0)),rhs.template packet<LoadMode>(0, col));
|
for(Index i = 0; i < lhs.cols(); ++i)
|
||||||
for(Index i = 1; i < lhs.cols(); ++i)
|
res = pmadd(pset1<Packet>(lhs.coeff(row, i)), rhs.template packet<LoadMode>(i, col), res);
|
||||||
res = pmadd(pset1<Packet>(lhs.coeff(row, i)), rhs.template packet<LoadMode>(i, col), res);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -427,10 +463,9 @@ struct product_packet_impl<ColMajor, Dynamic, Lhs, Rhs, Packet, LoadMode>
|
|||||||
typedef typename Lhs::Index Index;
|
typedef typename Lhs::Index Index;
|
||||||
static EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, Packet& res)
|
static EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, Packet& res)
|
||||||
{
|
{
|
||||||
eigen_assert(lhs.cols()>0 && "you are using a non initialized matrix");
|
res = pset1<Packet>(0);
|
||||||
res = pmul(lhs.template packet<LoadMode>(row, 0), pset1<Packet>(rhs.coeff(0, col)));
|
for(Index i = 0; i < lhs.cols(); ++i)
|
||||||
for(Index i = 1; i < lhs.cols(); ++i)
|
res = pmadd(lhs.template packet<LoadMode>(row, i), pset1<Packet>(rhs.coeff(i, col)), res);
|
||||||
res = pmadd(lhs.template packet<LoadMode>(row, i), pset1<Packet>(rhs.coeff(i, col)), res);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -125,19 +125,22 @@ void parallelize_gemm(const Functor& func, Index rows, Index cols, bool transpos
|
|||||||
if(transpose)
|
if(transpose)
|
||||||
std::swap(rows,cols);
|
std::swap(rows,cols);
|
||||||
|
|
||||||
Index blockCols = (cols / threads) & ~Index(0x3);
|
|
||||||
Index blockRows = (rows / threads) & ~Index(0x7);
|
|
||||||
|
|
||||||
GemmParallelInfo<Index>* info = new GemmParallelInfo<Index>[threads];
|
GemmParallelInfo<Index>* info = new GemmParallelInfo<Index>[threads];
|
||||||
|
|
||||||
#pragma omp parallel for schedule(static,1) num_threads(threads)
|
#pragma omp parallel num_threads(threads)
|
||||||
for(Index i=0; i<threads; ++i)
|
|
||||||
{
|
{
|
||||||
|
Index i = omp_get_thread_num();
|
||||||
|
// Note that the actual number of threads might be lower than the number of request ones.
|
||||||
|
Index actual_threads = omp_get_num_threads();
|
||||||
|
|
||||||
|
Index blockCols = (cols / actual_threads) & ~Index(0x3);
|
||||||
|
Index blockRows = (rows / actual_threads) & ~Index(0x7);
|
||||||
|
|
||||||
Index r0 = i*blockRows;
|
Index r0 = i*blockRows;
|
||||||
Index actualBlockRows = (i+1==threads) ? rows-r0 : blockRows;
|
Index actualBlockRows = (i+1==actual_threads) ? rows-r0 : blockRows;
|
||||||
|
|
||||||
Index c0 = i*blockCols;
|
Index c0 = i*blockCols;
|
||||||
Index actualBlockCols = (i+1==threads) ? cols-c0 : blockCols;
|
Index actualBlockCols = (i+1==actual_threads) ? cols-c0 : blockCols;
|
||||||
|
|
||||||
info[i].rhs_start = c0;
|
info[i].rhs_start = c0;
|
||||||
info[i].rhs_length = actualBlockCols;
|
info[i].rhs_length = actualBlockCols;
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ struct product_triangular_matrix_matrix_trmm<EIGTYPE,Index,Mode,true, \
|
|||||||
/* Non-square case - doesn't fit to MKL ?TRMM. Fall to default triangular product or call MKL ?GEMM*/ \
|
/* Non-square case - doesn't fit to MKL ?TRMM. Fall to default triangular product or call MKL ?GEMM*/ \
|
||||||
if (rows != depth) { \
|
if (rows != depth) { \
|
||||||
\
|
\
|
||||||
int nthr = mkl_domain_get_max_threads(MKL_BLAS); \
|
int nthr = mkl_domain_get_max_threads(EIGEN_MKL_DOMAIN_BLAS); \
|
||||||
\
|
\
|
||||||
if (((nthr==1) && (((std::max)(rows,depth)-diagSize)/(double)diagSize < 0.5))) { \
|
if (((nthr==1) && (((std::max)(rows,depth)-diagSize)/(double)diagSize < 0.5))) { \
|
||||||
/* Most likely no benefit to call TRMM or GEMM from MKL*/ \
|
/* Most likely no benefit to call TRMM or GEMM from MKL*/ \
|
||||||
@@ -223,7 +223,7 @@ struct product_triangular_matrix_matrix_trmm<EIGTYPE,Index,Mode,false, \
|
|||||||
/* Non-square case - doesn't fit to MKL ?TRMM. Fall to default triangular product or call MKL ?GEMM*/ \
|
/* Non-square case - doesn't fit to MKL ?TRMM. Fall to default triangular product or call MKL ?GEMM*/ \
|
||||||
if (cols != depth) { \
|
if (cols != depth) { \
|
||||||
\
|
\
|
||||||
int nthr = mkl_domain_get_max_threads(MKL_BLAS); \
|
int nthr = mkl_domain_get_max_threads(EIGEN_MKL_DOMAIN_BLAS); \
|
||||||
\
|
\
|
||||||
if ((nthr==1) && (((std::max)(cols,depth)-diagSize)/(double)diagSize < 0.5)) { \
|
if ((nthr==1) && (((std::max)(cols,depth)-diagSize)/(double)diagSize < 0.5)) { \
|
||||||
/* Most likely no benefit to call TRMM or GEMM from MKL*/ \
|
/* Most likely no benefit to call TRMM or GEMM from MKL*/ \
|
||||||
|
|||||||
@@ -302,9 +302,12 @@ EIGEN_DONT_INLINE void triangular_solve_matrix<Scalar,Index,OnTheRight,Mode,Conj
|
|||||||
for (Index i=0; i<actual_mc; ++i)
|
for (Index i=0; i<actual_mc; ++i)
|
||||||
r[i] -= a[i] * b;
|
r[i] -= a[i] * b;
|
||||||
}
|
}
|
||||||
Scalar b = (Mode & UnitDiag) ? Scalar(1) : Scalar(1)/conj(rhs(j,j));
|
if((Mode & UnitDiag)==0)
|
||||||
for (Index i=0; i<actual_mc; ++i)
|
{
|
||||||
r[i] *= b;
|
Scalar b = conj(rhs(j,j));
|
||||||
|
for (Index i=0; i<actual_mc; ++i)
|
||||||
|
r[i] /= b;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// pack the just computed part of lhs to A
|
// pack the just computed part of lhs to A
|
||||||
|
|||||||
@@ -433,6 +433,19 @@ struct MatrixXpr {};
|
|||||||
/** The type used to identify an array expression */
|
/** The type used to identify an array expression */
|
||||||
struct ArrayXpr {};
|
struct ArrayXpr {};
|
||||||
|
|
||||||
|
namespace internal {
|
||||||
|
/** \internal
|
||||||
|
* Constants for comparison functors
|
||||||
|
*/
|
||||||
|
enum ComparisonName {
|
||||||
|
cmp_EQ = 0,
|
||||||
|
cmp_LT = 1,
|
||||||
|
cmp_LE = 2,
|
||||||
|
cmp_UNORD = 3,
|
||||||
|
cmp_NEQ = 4
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
} // end namespace Eigen
|
} // end namespace Eigen
|
||||||
|
|
||||||
#endif // EIGEN_CONSTANTS_H
|
#endif // EIGEN_CONSTANTS_H
|
||||||
|
|||||||
@@ -235,6 +235,9 @@ template<typename Scalar> class Rotation2D;
|
|||||||
template<typename Scalar> class AngleAxis;
|
template<typename Scalar> class AngleAxis;
|
||||||
template<typename Scalar,int Dim> class Translation;
|
template<typename Scalar,int Dim> class Translation;
|
||||||
|
|
||||||
|
// Sparse module:
|
||||||
|
template<typename Derived> class SparseMatrixBase;
|
||||||
|
|
||||||
#ifdef EIGEN2_SUPPORT
|
#ifdef EIGEN2_SUPPORT
|
||||||
template<typename Derived, int _Dim> class eigen2_RotationBase;
|
template<typename Derived, int _Dim> class eigen2_RotationBase;
|
||||||
template<typename Lhs, typename Rhs> class eigen2_Cross;
|
template<typename Lhs, typename Rhs> class eigen2_Cross;
|
||||||
|
|||||||
@@ -54,11 +54,60 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined EIGEN_USE_MKL
|
#if defined EIGEN_USE_MKL
|
||||||
|
# include <mkl.h>
|
||||||
|
/*Check IMKL version for compatibility: < 10.3 is not usable with Eigen*/
|
||||||
|
# ifndef INTEL_MKL_VERSION
|
||||||
|
# undef EIGEN_USE_MKL /* INTEL_MKL_VERSION is not even defined on older versions */
|
||||||
|
# elif INTEL_MKL_VERSION < 100305 /* the intel-mkl-103-release-notes say this was when the lapacke.h interface was added*/
|
||||||
|
# undef EIGEN_USE_MKL
|
||||||
|
# endif
|
||||||
|
# ifndef EIGEN_USE_MKL
|
||||||
|
/*If the MKL version is too old, undef everything*/
|
||||||
|
# undef EIGEN_USE_MKL_ALL
|
||||||
|
# undef EIGEN_USE_BLAS
|
||||||
|
# undef EIGEN_USE_LAPACKE
|
||||||
|
# undef EIGEN_USE_MKL_VML
|
||||||
|
# undef EIGEN_USE_LAPACKE_STRICT
|
||||||
|
# undef EIGEN_USE_LAPACKE
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <mkl.h>
|
#if defined EIGEN_USE_MKL
|
||||||
#include <mkl_lapacke.h>
|
#include <mkl_lapacke.h>
|
||||||
#define EIGEN_MKL_VML_THRESHOLD 128
|
#define EIGEN_MKL_VML_THRESHOLD 128
|
||||||
|
|
||||||
|
/* MKL_DOMAIN_BLAS, etc are defined only in 10.3 update 7 */
|
||||||
|
/* MKL_BLAS, etc are not defined in 11.2 */
|
||||||
|
#ifdef MKL_DOMAIN_ALL
|
||||||
|
#define EIGEN_MKL_DOMAIN_ALL MKL_DOMAIN_ALL
|
||||||
|
#else
|
||||||
|
#define EIGEN_MKL_DOMAIN_ALL MKL_ALL
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef MKL_DOMAIN_BLAS
|
||||||
|
#define EIGEN_MKL_DOMAIN_BLAS MKL_DOMAIN_BLAS
|
||||||
|
#else
|
||||||
|
#define EIGEN_MKL_DOMAIN_BLAS MKL_BLAS
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef MKL_DOMAIN_FFT
|
||||||
|
#define EIGEN_MKL_DOMAIN_FFT MKL_DOMAIN_FFT
|
||||||
|
#else
|
||||||
|
#define EIGEN_MKL_DOMAIN_FFT MKL_FFT
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef MKL_DOMAIN_VML
|
||||||
|
#define EIGEN_MKL_DOMAIN_VML MKL_DOMAIN_VML
|
||||||
|
#else
|
||||||
|
#define EIGEN_MKL_DOMAIN_VML MKL_VML
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef MKL_DOMAIN_PARDISO
|
||||||
|
#define EIGEN_MKL_DOMAIN_PARDISO MKL_DOMAIN_PARDISO
|
||||||
|
#else
|
||||||
|
#define EIGEN_MKL_DOMAIN_PARDISO MKL_PARDISO
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace Eigen {
|
namespace Eigen {
|
||||||
|
|
||||||
typedef std::complex<double> dcomplex;
|
typedef std::complex<double> dcomplex;
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
#define EIGEN_WORLD_VERSION 3
|
#define EIGEN_WORLD_VERSION 3
|
||||||
#define EIGEN_MAJOR_VERSION 2
|
#define EIGEN_MAJOR_VERSION 2
|
||||||
#define EIGEN_MINOR_VERSION 1
|
#define EIGEN_MINOR_VERSION 7
|
||||||
|
|
||||||
#define EIGEN_VERSION_AT_LEAST(x,y,z) (EIGEN_WORLD_VERSION>x || (EIGEN_WORLD_VERSION>=x && \
|
#define EIGEN_VERSION_AT_LEAST(x,y,z) (EIGEN_WORLD_VERSION>x || (EIGEN_WORLD_VERSION>=x && \
|
||||||
(EIGEN_MAJOR_VERSION>y || (EIGEN_MAJOR_VERSION>=y && \
|
(EIGEN_MAJOR_VERSION>y || (EIGEN_MAJOR_VERSION>=y && \
|
||||||
@@ -96,6 +96,27 @@
|
|||||||
#define EIGEN_DEFAULT_DENSE_INDEX_TYPE std::ptrdiff_t
|
#define EIGEN_DEFAULT_DENSE_INDEX_TYPE std::ptrdiff_t
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// A Clang feature extension to determine compiler features.
|
||||||
|
// We use it to determine 'cxx_rvalue_references'
|
||||||
|
#ifndef __has_feature
|
||||||
|
# define __has_feature(x) 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Do we support r-value references?
|
||||||
|
#if (__has_feature(cxx_rvalue_references) || \
|
||||||
|
defined(__GXX_EXPERIMENTAL_CXX0X__) || \
|
||||||
|
(defined(_MSC_VER) && _MSC_VER >= 1600))
|
||||||
|
#define EIGEN_HAVE_RVALUE_REFERENCES
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
// Cross compiler wrapper around LLVM's __has_builtin
|
||||||
|
#ifdef __has_builtin
|
||||||
|
# define EIGEN_HAS_BUILTIN(x) __has_builtin(x)
|
||||||
|
#else
|
||||||
|
# define EIGEN_HAS_BUILTIN(x) 0
|
||||||
|
#endif
|
||||||
|
|
||||||
/** Allows to disable some optimizations which might affect the accuracy of the result.
|
/** Allows to disable some optimizations which might affect the accuracy of the result.
|
||||||
* Such optimization are enabled by default, and set EIGEN_FAST_MATH to 0 to disable them.
|
* Such optimization are enabled by default, and set EIGEN_FAST_MATH to 0 to disable them.
|
||||||
* They currently include:
|
* They currently include:
|
||||||
@@ -247,7 +268,7 @@ namespace Eigen {
|
|||||||
|
|
||||||
#if !defined(EIGEN_ASM_COMMENT)
|
#if !defined(EIGEN_ASM_COMMENT)
|
||||||
#if (defined __GNUC__) && ( defined(__i386__) || defined(__x86_64__) )
|
#if (defined __GNUC__) && ( defined(__i386__) || defined(__x86_64__) )
|
||||||
#define EIGEN_ASM_COMMENT(X) asm("#" X)
|
#define EIGEN_ASM_COMMENT(X) __asm__("#" X)
|
||||||
#else
|
#else
|
||||||
#define EIGEN_ASM_COMMENT(X)
|
#define EIGEN_ASM_COMMENT(X)
|
||||||
#endif
|
#endif
|
||||||
@@ -271,6 +292,7 @@ namespace Eigen {
|
|||||||
#error Please tell me what is the equivalent of __attribute__((aligned(n))) for your compiler
|
#error Please tell me what is the equivalent of __attribute__((aligned(n))) for your compiler
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define EIGEN_ALIGN8 EIGEN_ALIGN_TO_BOUNDARY(8)
|
||||||
#define EIGEN_ALIGN16 EIGEN_ALIGN_TO_BOUNDARY(16)
|
#define EIGEN_ALIGN16 EIGEN_ALIGN_TO_BOUNDARY(16)
|
||||||
|
|
||||||
#if EIGEN_ALIGN_STATICALLY
|
#if EIGEN_ALIGN_STATICALLY
|
||||||
@@ -289,7 +311,8 @@ namespace Eigen {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef EIGEN_STACK_ALLOCATION_LIMIT
|
#ifndef EIGEN_STACK_ALLOCATION_LIMIT
|
||||||
#define EIGEN_STACK_ALLOCATION_LIMIT 20000
|
// 131072 == 128 KB
|
||||||
|
#define EIGEN_STACK_ALLOCATION_LIMIT 131072
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef EIGEN_DEFAULT_IO_FORMAT
|
#ifndef EIGEN_DEFAULT_IO_FORMAT
|
||||||
@@ -305,7 +328,7 @@ namespace Eigen {
|
|||||||
// just an empty macro !
|
// just an empty macro !
|
||||||
#define EIGEN_EMPTY
|
#define EIGEN_EMPTY
|
||||||
|
|
||||||
#if defined(_MSC_VER) && (!defined(__INTEL_COMPILER))
|
#if defined(_MSC_VER) && (_MSC_VER < 1900) && (!defined(__INTEL_COMPILER))
|
||||||
#define EIGEN_INHERIT_ASSIGNMENT_EQUAL_OPERATOR(Derived) \
|
#define EIGEN_INHERIT_ASSIGNMENT_EQUAL_OPERATOR(Derived) \
|
||||||
using Base::operator =;
|
using Base::operator =;
|
||||||
#elif defined(__clang__) // workaround clang bug (see http://forum.kde.org/viewtopic.php?f=74&t=102653)
|
#elif defined(__clang__) // workaround clang bug (see http://forum.kde.org/viewtopic.php?f=74&t=102653)
|
||||||
@@ -324,8 +347,11 @@ namespace Eigen {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Derived) \
|
/** \internal
|
||||||
EIGEN_INHERIT_ASSIGNMENT_EQUAL_OPERATOR(Derived)
|
* \brief Macro to manually inherit assignment operators.
|
||||||
|
* This is necessary, because the implicitly defined assignment operator gets deleted when a custom operator= is defined.
|
||||||
|
*/
|
||||||
|
#define EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Derived) EIGEN_INHERIT_ASSIGNMENT_EQUAL_OPERATOR(Derived)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Just a side note. Commenting within defines works only by documenting
|
* Just a side note. Commenting within defines works only by documenting
|
||||||
@@ -397,6 +423,8 @@ namespace Eigen {
|
|||||||
#define EIGEN_SIZE_MAX(a,b) (((int)a == Dynamic || (int)b == Dynamic) ? Dynamic \
|
#define EIGEN_SIZE_MAX(a,b) (((int)a == Dynamic || (int)b == Dynamic) ? Dynamic \
|
||||||
: ((int)a >= (int)b) ? (int)a : (int)b)
|
: ((int)a >= (int)b) ? (int)a : (int)b)
|
||||||
|
|
||||||
|
#define EIGEN_ADD_COST(a,b) int(a)==Dynamic || int(b)==Dynamic ? Dynamic : int(a)+int(b)
|
||||||
|
|
||||||
#define EIGEN_LOGICAL_XOR(a,b) (((a) || (b)) && !((a) && (b)))
|
#define EIGEN_LOGICAL_XOR(a,b) (((a) || (b)) && !((a) && (b)))
|
||||||
|
|
||||||
#define EIGEN_IMPLIES(a,b) (!(a) || (b))
|
#define EIGEN_IMPLIES(a,b) (!(a) || (b))
|
||||||
|
|||||||
@@ -63,7 +63,7 @@
|
|||||||
// Currently, let's include it only on unix systems:
|
// Currently, let's include it only on unix systems:
|
||||||
#if defined(__unix__) || defined(__unix)
|
#if defined(__unix__) || defined(__unix)
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#if ((defined __QNXNTO__) || (defined _GNU_SOURCE) || ((defined _XOPEN_SOURCE) && (_XOPEN_SOURCE >= 600))) && (defined _POSIX_ADVISORY_INFO) && (_POSIX_ADVISORY_INFO > 0)
|
#if ((defined __QNXNTO__) || (defined _GNU_SOURCE) || (defined __PGI) || ((defined _XOPEN_SOURCE) && (_XOPEN_SOURCE >= 600))) && (defined _POSIX_ADVISORY_INFO) && (_POSIX_ADVISORY_INFO > 0)
|
||||||
#define EIGEN_HAS_POSIX_MEMALIGN 1
|
#define EIGEN_HAS_POSIX_MEMALIGN 1
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
@@ -272,12 +272,12 @@ inline void* aligned_realloc(void *ptr, size_t new_size, size_t old_size)
|
|||||||
// The defined(_mm_free) is just here to verify that this MSVC version
|
// The defined(_mm_free) is just here to verify that this MSVC version
|
||||||
// implements _mm_malloc/_mm_free based on the corresponding _aligned_
|
// implements _mm_malloc/_mm_free based on the corresponding _aligned_
|
||||||
// functions. This may not always be the case and we just try to be safe.
|
// functions. This may not always be the case and we just try to be safe.
|
||||||
#if defined(_MSC_VER) && defined(_mm_free)
|
#if defined(_MSC_VER) && (!defined(_WIN32_WCE)) && defined(_mm_free)
|
||||||
result = _aligned_realloc(ptr,new_size,16);
|
result = _aligned_realloc(ptr,new_size,16);
|
||||||
#else
|
#else
|
||||||
result = generic_aligned_realloc(ptr,new_size,old_size);
|
result = generic_aligned_realloc(ptr,new_size,old_size);
|
||||||
#endif
|
#endif
|
||||||
#elif defined(_MSC_VER)
|
#elif defined(_MSC_VER) && (!defined(_WIN32_WCE))
|
||||||
result = _aligned_realloc(ptr,new_size,16);
|
result = _aligned_realloc(ptr,new_size,16);
|
||||||
#else
|
#else
|
||||||
result = handmade_aligned_realloc(ptr,new_size,old_size);
|
result = handmade_aligned_realloc(ptr,new_size,old_size);
|
||||||
@@ -417,6 +417,8 @@ template<typename T, bool Align> inline T* conditional_aligned_realloc_new(T* pt
|
|||||||
|
|
||||||
template<typename T, bool Align> inline T* conditional_aligned_new_auto(size_t size)
|
template<typename T, bool Align> inline T* conditional_aligned_new_auto(size_t size)
|
||||||
{
|
{
|
||||||
|
if(size==0)
|
||||||
|
return 0; // short-cut. Also fixes Bug 884
|
||||||
check_size_for_overflow<T>(size);
|
check_size_for_overflow<T>(size);
|
||||||
T *result = reinterpret_cast<T*>(conditional_aligned_malloc<Align>(sizeof(T)*size));
|
T *result = reinterpret_cast<T*>(conditional_aligned_malloc<Align>(sizeof(T)*size));
|
||||||
if(NumTraits<T>::RequireInitialization)
|
if(NumTraits<T>::RequireInitialization)
|
||||||
@@ -464,9 +466,8 @@ template<typename T, bool Align> inline void conditional_aligned_delete_auto(T *
|
|||||||
template<typename Scalar, typename Index>
|
template<typename Scalar, typename Index>
|
||||||
static inline Index first_aligned(const Scalar* array, Index size)
|
static inline Index first_aligned(const Scalar* array, Index size)
|
||||||
{
|
{
|
||||||
enum { PacketSize = packet_traits<Scalar>::size,
|
static const Index PacketSize = packet_traits<Scalar>::size;
|
||||||
PacketAlignedMask = PacketSize-1
|
static const Index PacketAlignedMask = PacketSize-1;
|
||||||
};
|
|
||||||
|
|
||||||
if(PacketSize==1)
|
if(PacketSize==1)
|
||||||
{
|
{
|
||||||
@@ -522,7 +523,7 @@ template<typename T> struct smart_copy_helper<T,false> {
|
|||||||
// you can overwrite Eigen's default behavior regarding alloca by defining EIGEN_ALLOCA
|
// you can overwrite Eigen's default behavior regarding alloca by defining EIGEN_ALLOCA
|
||||||
// to the appropriate stack allocation function
|
// to the appropriate stack allocation function
|
||||||
#ifndef EIGEN_ALLOCA
|
#ifndef EIGEN_ALLOCA
|
||||||
#if (defined __linux__)
|
#if (defined __linux__) || (defined __APPLE__) || (defined alloca)
|
||||||
#define EIGEN_ALLOCA alloca
|
#define EIGEN_ALLOCA alloca
|
||||||
#elif defined(_MSC_VER)
|
#elif defined(_MSC_VER)
|
||||||
#define EIGEN_ALLOCA _alloca
|
#define EIGEN_ALLOCA _alloca
|
||||||
@@ -612,7 +613,6 @@ template<typename T> class aligned_stack_memory_handler
|
|||||||
void* operator new(size_t size, const std::nothrow_t&) throw() { \
|
void* operator new(size_t size, const std::nothrow_t&) throw() { \
|
||||||
try { return Eigen::internal::conditional_aligned_malloc<NeedsToAlign>(size); } \
|
try { return Eigen::internal::conditional_aligned_malloc<NeedsToAlign>(size); } \
|
||||||
catch (...) { return 0; } \
|
catch (...) { return 0; } \
|
||||||
return 0; \
|
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
#define EIGEN_MAKE_ALIGNED_OPERATOR_NEW_NOTHROW(NeedsToAlign) \
|
#define EIGEN_MAKE_ALIGNED_OPERATOR_NEW_NOTHROW(NeedsToAlign) \
|
||||||
@@ -777,9 +777,9 @@ namespace internal {
|
|||||||
|
|
||||||
#ifdef EIGEN_CPUID
|
#ifdef EIGEN_CPUID
|
||||||
|
|
||||||
inline bool cpuid_is_vendor(int abcd[4], const char* vendor)
|
inline bool cpuid_is_vendor(int abcd[4], const int vendor[3])
|
||||||
{
|
{
|
||||||
return abcd[1]==(reinterpret_cast<const int*>(vendor))[0] && abcd[3]==(reinterpret_cast<const int*>(vendor))[1] && abcd[2]==(reinterpret_cast<const int*>(vendor))[2];
|
return abcd[1]==vendor[0] && abcd[3]==vendor[1] && abcd[2]==vendor[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void queryCacheSizes_intel_direct(int& l1, int& l2, int& l3)
|
inline void queryCacheSizes_intel_direct(int& l1, int& l2, int& l3)
|
||||||
@@ -921,13 +921,16 @@ inline void queryCacheSizes(int& l1, int& l2, int& l3)
|
|||||||
{
|
{
|
||||||
#ifdef EIGEN_CPUID
|
#ifdef EIGEN_CPUID
|
||||||
int abcd[4];
|
int abcd[4];
|
||||||
|
const int GenuineIntel[] = {0x756e6547, 0x49656e69, 0x6c65746e};
|
||||||
|
const int AuthenticAMD[] = {0x68747541, 0x69746e65, 0x444d4163};
|
||||||
|
const int AMDisbetter_[] = {0x69444d41, 0x74656273, 0x21726574}; // "AMDisbetter!"
|
||||||
|
|
||||||
// identify the CPU vendor
|
// identify the CPU vendor
|
||||||
EIGEN_CPUID(abcd,0x0,0);
|
EIGEN_CPUID(abcd,0x0,0);
|
||||||
int max_std_funcs = abcd[1];
|
int max_std_funcs = abcd[1];
|
||||||
if(cpuid_is_vendor(abcd,"GenuineIntel"))
|
if(cpuid_is_vendor(abcd,GenuineIntel))
|
||||||
queryCacheSizes_intel(l1,l2,l3,max_std_funcs);
|
queryCacheSizes_intel(l1,l2,l3,max_std_funcs);
|
||||||
else if(cpuid_is_vendor(abcd,"AuthenticAMD") || cpuid_is_vendor(abcd,"AMDisbetter!"))
|
else if(cpuid_is_vendor(abcd,AuthenticAMD) || cpuid_is_vendor(abcd,AMDisbetter_))
|
||||||
queryCacheSizes_amd(l1,l2,l3);
|
queryCacheSizes_amd(l1,l2,l3);
|
||||||
else
|
else
|
||||||
// by default let's use Intel's API
|
// by default let's use Intel's API
|
||||||
|
|||||||
@@ -90,7 +90,9 @@
|
|||||||
YOU_PASSED_A_COLUMN_VECTOR_BUT_A_ROW_VECTOR_WAS_EXPECTED,
|
YOU_PASSED_A_COLUMN_VECTOR_BUT_A_ROW_VECTOR_WAS_EXPECTED,
|
||||||
THE_INDEX_TYPE_MUST_BE_A_SIGNED_TYPE,
|
THE_INDEX_TYPE_MUST_BE_A_SIGNED_TYPE,
|
||||||
THE_STORAGE_ORDER_OF_BOTH_SIDES_MUST_MATCH,
|
THE_STORAGE_ORDER_OF_BOTH_SIDES_MUST_MATCH,
|
||||||
OBJECT_ALLOCATED_ON_STACK_IS_TOO_BIG
|
OBJECT_ALLOCATED_ON_STACK_IS_TOO_BIG,
|
||||||
|
IMPLICIT_CONVERSION_TO_SCALAR_IS_FOR_INNER_PRODUCT_ONLY,
|
||||||
|
STORAGE_LAYOUT_DOES_NOT_MATCH
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -341,7 +341,7 @@ template<typename T, int n=1, typename PlainObject = typename eval<T>::type> str
|
|||||||
};
|
};
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
T* const_cast_ptr(const T* ptr)
|
inline T* const_cast_ptr(const T* ptr)
|
||||||
{
|
{
|
||||||
return const_cast<T*>(ptr);
|
return const_cast<T*>(ptr);
|
||||||
}
|
}
|
||||||
@@ -366,17 +366,17 @@ struct dense_xpr_base<Derived, ArrayXpr>
|
|||||||
|
|
||||||
/** \internal Helper base class to add a scalar multiple operator
|
/** \internal Helper base class to add a scalar multiple operator
|
||||||
* overloads for complex types */
|
* overloads for complex types */
|
||||||
template<typename Derived,typename Scalar,typename OtherScalar,
|
template<typename Derived, typename Scalar, typename OtherScalar, typename BaseType,
|
||||||
bool EnableIt = !is_same<Scalar,OtherScalar>::value >
|
bool EnableIt = !is_same<Scalar,OtherScalar>::value >
|
||||||
struct special_scalar_op_base : public DenseCoeffsBase<Derived>
|
struct special_scalar_op_base : public BaseType
|
||||||
{
|
{
|
||||||
// dummy operator* so that the
|
// dummy operator* so that the
|
||||||
// "using special_scalar_op_base::operator*" compiles
|
// "using special_scalar_op_base::operator*" compiles
|
||||||
void operator*() const;
|
void operator*() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename Derived,typename Scalar,typename OtherScalar>
|
template<typename Derived,typename Scalar,typename OtherScalar, typename BaseType>
|
||||||
struct special_scalar_op_base<Derived,Scalar,OtherScalar,true> : public DenseCoeffsBase<Derived>
|
struct special_scalar_op_base<Derived,Scalar,OtherScalar,BaseType,true> : public BaseType
|
||||||
{
|
{
|
||||||
const CwiseUnaryOp<scalar_multiple2_op<Scalar,OtherScalar>, Derived>
|
const CwiseUnaryOp<scalar_multiple2_op<Scalar,OtherScalar>, Derived>
|
||||||
operator*(const OtherScalar& scalar) const
|
operator*(const OtherScalar& scalar) const
|
||||||
|
|||||||
@@ -147,7 +147,6 @@ void fitHyperplane(int numPoints,
|
|||||||
|
|
||||||
// compute the covariance matrix
|
// compute the covariance matrix
|
||||||
CovMatrixType covMat = CovMatrixType::Zero(size, size);
|
CovMatrixType covMat = CovMatrixType::Zero(size, size);
|
||||||
VectorType remean = VectorType::Zero(size);
|
|
||||||
for(int i = 0; i < numPoints; ++i)
|
for(int i = 0; i < numPoints; ++i)
|
||||||
{
|
{
|
||||||
VectorType diff = (*(points[i]) - mean).conjugate();
|
VectorType diff = (*(points[i]) - mean).conjugate();
|
||||||
|
|||||||
@@ -234,6 +234,12 @@ template<typename _MatrixType> class ComplexEigenSolver
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
static void check_template_parameters()
|
||||||
|
{
|
||||||
|
EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar);
|
||||||
|
}
|
||||||
|
|
||||||
EigenvectorType m_eivec;
|
EigenvectorType m_eivec;
|
||||||
EigenvalueType m_eivalues;
|
EigenvalueType m_eivalues;
|
||||||
ComplexSchur<MatrixType> m_schur;
|
ComplexSchur<MatrixType> m_schur;
|
||||||
@@ -251,6 +257,8 @@ template<typename MatrixType>
|
|||||||
ComplexEigenSolver<MatrixType>&
|
ComplexEigenSolver<MatrixType>&
|
||||||
ComplexEigenSolver<MatrixType>::compute(const MatrixType& matrix, bool computeEigenvectors)
|
ComplexEigenSolver<MatrixType>::compute(const MatrixType& matrix, bool computeEigenvectors)
|
||||||
{
|
{
|
||||||
|
check_template_parameters();
|
||||||
|
|
||||||
// this code is inspired from Jampack
|
// this code is inspired from Jampack
|
||||||
eigen_assert(matrix.cols() == matrix.rows());
|
eigen_assert(matrix.cols() == matrix.rows());
|
||||||
|
|
||||||
|
|||||||
@@ -298,6 +298,13 @@ template<typename _MatrixType> class EigenSolver
|
|||||||
void doComputeEigenvectors();
|
void doComputeEigenvectors();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
static void check_template_parameters()
|
||||||
|
{
|
||||||
|
EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar);
|
||||||
|
EIGEN_STATIC_ASSERT(!NumTraits<Scalar>::IsComplex, NUMERIC_TYPE_MUST_BE_REAL);
|
||||||
|
}
|
||||||
|
|
||||||
MatrixType m_eivec;
|
MatrixType m_eivec;
|
||||||
EigenvalueType m_eivalues;
|
EigenvalueType m_eivalues;
|
||||||
bool m_isInitialized;
|
bool m_isInitialized;
|
||||||
@@ -364,6 +371,8 @@ template<typename MatrixType>
|
|||||||
EigenSolver<MatrixType>&
|
EigenSolver<MatrixType>&
|
||||||
EigenSolver<MatrixType>::compute(const MatrixType& matrix, bool computeEigenvectors)
|
EigenSolver<MatrixType>::compute(const MatrixType& matrix, bool computeEigenvectors)
|
||||||
{
|
{
|
||||||
|
check_template_parameters();
|
||||||
|
|
||||||
using std::sqrt;
|
using std::sqrt;
|
||||||
using std::abs;
|
using std::abs;
|
||||||
eigen_assert(matrix.cols() == matrix.rows());
|
eigen_assert(matrix.cols() == matrix.rows());
|
||||||
|
|||||||
@@ -263,6 +263,13 @@ template<typename _MatrixType> class GeneralizedEigenSolver
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
static void check_template_parameters()
|
||||||
|
{
|
||||||
|
EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar);
|
||||||
|
EIGEN_STATIC_ASSERT(!NumTraits<Scalar>::IsComplex, NUMERIC_TYPE_MUST_BE_REAL);
|
||||||
|
}
|
||||||
|
|
||||||
MatrixType m_eivec;
|
MatrixType m_eivec;
|
||||||
ComplexVectorType m_alphas;
|
ComplexVectorType m_alphas;
|
||||||
VectorType m_betas;
|
VectorType m_betas;
|
||||||
@@ -290,6 +297,8 @@ template<typename MatrixType>
|
|||||||
GeneralizedEigenSolver<MatrixType>&
|
GeneralizedEigenSolver<MatrixType>&
|
||||||
GeneralizedEigenSolver<MatrixType>::compute(const MatrixType& A, const MatrixType& B, bool computeEigenvectors)
|
GeneralizedEigenSolver<MatrixType>::compute(const MatrixType& A, const MatrixType& B, bool computeEigenvectors)
|
||||||
{
|
{
|
||||||
|
check_template_parameters();
|
||||||
|
|
||||||
using std::sqrt;
|
using std::sqrt;
|
||||||
using std::abs;
|
using std::abs;
|
||||||
eigen_assert(A.cols() == A.rows() && B.cols() == A.rows() && B.cols() == B.rows());
|
eigen_assert(A.cols() == A.rows() && B.cols() == A.rows() && B.cols() == B.rows());
|
||||||
|
|||||||
@@ -240,10 +240,10 @@ namespace Eigen {
|
|||||||
m_S.coeffRef(i,j) = Scalar(0.0);
|
m_S.coeffRef(i,j) = Scalar(0.0);
|
||||||
m_S.rightCols(dim-j-1).applyOnTheLeft(i-1,i,G.adjoint());
|
m_S.rightCols(dim-j-1).applyOnTheLeft(i-1,i,G.adjoint());
|
||||||
m_T.rightCols(dim-i+1).applyOnTheLeft(i-1,i,G.adjoint());
|
m_T.rightCols(dim-i+1).applyOnTheLeft(i-1,i,G.adjoint());
|
||||||
|
// update Q
|
||||||
|
if (m_computeQZ)
|
||||||
|
m_Q.applyOnTheRight(i-1,i,G);
|
||||||
}
|
}
|
||||||
// update Q
|
|
||||||
if (m_computeQZ)
|
|
||||||
m_Q.applyOnTheRight(i-1,i,G);
|
|
||||||
// kill T(i,i-1)
|
// kill T(i,i-1)
|
||||||
if(m_T.coeff(i,i-1)!=Scalar(0))
|
if(m_T.coeff(i,i-1)!=Scalar(0))
|
||||||
{
|
{
|
||||||
@@ -251,10 +251,10 @@ namespace Eigen {
|
|||||||
m_T.coeffRef(i,i-1) = Scalar(0.0);
|
m_T.coeffRef(i,i-1) = Scalar(0.0);
|
||||||
m_S.applyOnTheRight(i,i-1,G);
|
m_S.applyOnTheRight(i,i-1,G);
|
||||||
m_T.topRows(i).applyOnTheRight(i,i-1,G);
|
m_T.topRows(i).applyOnTheRight(i,i-1,G);
|
||||||
|
// update Z
|
||||||
|
if (m_computeQZ)
|
||||||
|
m_Z.applyOnTheLeft(i,i-1,G.adjoint());
|
||||||
}
|
}
|
||||||
// update Z
|
|
||||||
if (m_computeQZ)
|
|
||||||
m_Z.applyOnTheLeft(i,i-1,G.adjoint());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -313,7 +313,7 @@ namespace Eigen {
|
|||||||
using std::abs;
|
using std::abs;
|
||||||
using std::sqrt;
|
using std::sqrt;
|
||||||
const Index dim=m_S.cols();
|
const Index dim=m_S.cols();
|
||||||
if (abs(m_S.coeff(i+1,i)==Scalar(0)))
|
if (abs(m_S.coeff(i+1,i))==Scalar(0))
|
||||||
return;
|
return;
|
||||||
Index z = findSmallDiagEntry(i,i+1);
|
Index z = findSmallDiagEntry(i,i+1);
|
||||||
if (z==i-1)
|
if (z==i-1)
|
||||||
|
|||||||
@@ -234,7 +234,7 @@ template<typename _MatrixType> class RealSchur
|
|||||||
typedef Matrix<Scalar,3,1> Vector3s;
|
typedef Matrix<Scalar,3,1> Vector3s;
|
||||||
|
|
||||||
Scalar computeNormOfT();
|
Scalar computeNormOfT();
|
||||||
Index findSmallSubdiagEntry(Index iu, const Scalar& norm);
|
Index findSmallSubdiagEntry(Index iu);
|
||||||
void splitOffTwoRows(Index iu, bool computeU, const Scalar& exshift);
|
void splitOffTwoRows(Index iu, bool computeU, const Scalar& exshift);
|
||||||
void computeShift(Index iu, Index iter, Scalar& exshift, Vector3s& shiftInfo);
|
void computeShift(Index iu, Index iter, Scalar& exshift, Vector3s& shiftInfo);
|
||||||
void initFrancisQRStep(Index il, Index iu, const Vector3s& shiftInfo, Index& im, Vector3s& firstHouseholderVector);
|
void initFrancisQRStep(Index il, Index iu, const Vector3s& shiftInfo, Index& im, Vector3s& firstHouseholderVector);
|
||||||
@@ -286,7 +286,7 @@ RealSchur<MatrixType>& RealSchur<MatrixType>::computeFromHessenberg(const HessMa
|
|||||||
{
|
{
|
||||||
while (iu >= 0)
|
while (iu >= 0)
|
||||||
{
|
{
|
||||||
Index il = findSmallSubdiagEntry(iu, norm);
|
Index il = findSmallSubdiagEntry(iu);
|
||||||
|
|
||||||
// Check for convergence
|
// Check for convergence
|
||||||
if (il == iu) // One root found
|
if (il == iu) // One root found
|
||||||
@@ -343,16 +343,14 @@ inline typename MatrixType::Scalar RealSchur<MatrixType>::computeNormOfT()
|
|||||||
|
|
||||||
/** \internal Look for single small sub-diagonal element and returns its index */
|
/** \internal Look for single small sub-diagonal element and returns its index */
|
||||||
template<typename MatrixType>
|
template<typename MatrixType>
|
||||||
inline typename MatrixType::Index RealSchur<MatrixType>::findSmallSubdiagEntry(Index iu, const Scalar& norm)
|
inline typename MatrixType::Index RealSchur<MatrixType>::findSmallSubdiagEntry(Index iu)
|
||||||
{
|
{
|
||||||
using std::abs;
|
using std::abs;
|
||||||
Index res = iu;
|
Index res = iu;
|
||||||
while (res > 0)
|
while (res > 0)
|
||||||
{
|
{
|
||||||
Scalar s = abs(m_matT.coeff(res-1,res-1)) + abs(m_matT.coeff(res,res));
|
Scalar s = abs(m_matT.coeff(res-1,res-1)) + abs(m_matT.coeff(res,res));
|
||||||
if (s == 0.0)
|
if (abs(m_matT.coeff(res,res-1)) <= NumTraits<Scalar>::epsilon() * s)
|
||||||
s = norm;
|
|
||||||
if (abs(m_matT.coeff(res,res-1)) < NumTraits<Scalar>::epsilon() * s)
|
|
||||||
break;
|
break;
|
||||||
res--;
|
res--;
|
||||||
}
|
}
|
||||||
@@ -457,9 +455,7 @@ inline void RealSchur<MatrixType>::initFrancisQRStep(Index il, Index iu, const V
|
|||||||
const Scalar lhs = m_matT.coeff(im,im-1) * (abs(v.coeff(1)) + abs(v.coeff(2)));
|
const Scalar lhs = m_matT.coeff(im,im-1) * (abs(v.coeff(1)) + abs(v.coeff(2)));
|
||||||
const Scalar rhs = v.coeff(0) * (abs(m_matT.coeff(im-1,im-1)) + abs(Tmm) + abs(m_matT.coeff(im+1,im+1)));
|
const Scalar rhs = v.coeff(0) * (abs(m_matT.coeff(im-1,im-1)) + abs(Tmm) + abs(m_matT.coeff(im+1,im+1)));
|
||||||
if (abs(lhs) < NumTraits<Scalar>::epsilon() * rhs)
|
if (abs(lhs) < NumTraits<Scalar>::epsilon() * rhs)
|
||||||
{
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -80,6 +80,8 @@ template<typename _MatrixType> class SelfAdjointEigenSolver
|
|||||||
/** \brief Scalar type for matrices of type \p _MatrixType. */
|
/** \brief Scalar type for matrices of type \p _MatrixType. */
|
||||||
typedef typename MatrixType::Scalar Scalar;
|
typedef typename MatrixType::Scalar Scalar;
|
||||||
typedef typename MatrixType::Index Index;
|
typedef typename MatrixType::Index Index;
|
||||||
|
|
||||||
|
typedef Matrix<Scalar,Size,Size,ColMajor,MaxColsAtCompileTime,MaxColsAtCompileTime> EigenvectorsType;
|
||||||
|
|
||||||
/** \brief Real scalar type for \p _MatrixType.
|
/** \brief Real scalar type for \p _MatrixType.
|
||||||
*
|
*
|
||||||
@@ -225,7 +227,7 @@ template<typename _MatrixType> class SelfAdjointEigenSolver
|
|||||||
*
|
*
|
||||||
* \sa eigenvalues()
|
* \sa eigenvalues()
|
||||||
*/
|
*/
|
||||||
const MatrixType& eigenvectors() const
|
const EigenvectorsType& eigenvectors() const
|
||||||
{
|
{
|
||||||
eigen_assert(m_isInitialized && "SelfAdjointEigenSolver is not initialized.");
|
eigen_assert(m_isInitialized && "SelfAdjointEigenSolver is not initialized.");
|
||||||
eigen_assert(m_eigenvectorsOk && "The eigenvectors have not been computed together with the eigenvalues.");
|
eigen_assert(m_eigenvectorsOk && "The eigenvectors have not been computed together with the eigenvalues.");
|
||||||
@@ -351,7 +353,12 @@ template<typename _MatrixType> class SelfAdjointEigenSolver
|
|||||||
#endif // EIGEN2_SUPPORT
|
#endif // EIGEN2_SUPPORT
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
MatrixType m_eivec;
|
static void check_template_parameters()
|
||||||
|
{
|
||||||
|
EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar);
|
||||||
|
}
|
||||||
|
|
||||||
|
EigenvectorsType m_eivec;
|
||||||
RealVectorType m_eivalues;
|
RealVectorType m_eivalues;
|
||||||
typename TridiagonalizationType::SubDiagonalType m_subdiag;
|
typename TridiagonalizationType::SubDiagonalType m_subdiag;
|
||||||
ComputationInfo m_info;
|
ComputationInfo m_info;
|
||||||
@@ -376,7 +383,7 @@ template<typename _MatrixType> class SelfAdjointEigenSolver
|
|||||||
* "implicit symmetric QR step with Wilkinson shift"
|
* "implicit symmetric QR step with Wilkinson shift"
|
||||||
*/
|
*/
|
||||||
namespace internal {
|
namespace internal {
|
||||||
template<int StorageOrder,typename RealScalar, typename Scalar, typename Index>
|
template<typename RealScalar, typename Scalar, typename Index>
|
||||||
static void tridiagonal_qr_step(RealScalar* diag, RealScalar* subdiag, Index start, Index end, Scalar* matrixQ, Index n);
|
static void tridiagonal_qr_step(RealScalar* diag, RealScalar* subdiag, Index start, Index end, Scalar* matrixQ, Index n);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -384,6 +391,8 @@ template<typename MatrixType>
|
|||||||
SelfAdjointEigenSolver<MatrixType>& SelfAdjointEigenSolver<MatrixType>
|
SelfAdjointEigenSolver<MatrixType>& SelfAdjointEigenSolver<MatrixType>
|
||||||
::compute(const MatrixType& matrix, int options)
|
::compute(const MatrixType& matrix, int options)
|
||||||
{
|
{
|
||||||
|
check_template_parameters();
|
||||||
|
|
||||||
using std::abs;
|
using std::abs;
|
||||||
eigen_assert(matrix.cols() == matrix.rows());
|
eigen_assert(matrix.cols() == matrix.rows());
|
||||||
eigen_assert((options&~(EigVecMask|GenEigMask))==0
|
eigen_assert((options&~(EigVecMask|GenEigMask))==0
|
||||||
@@ -406,7 +415,7 @@ SelfAdjointEigenSolver<MatrixType>& SelfAdjointEigenSolver<MatrixType>
|
|||||||
|
|
||||||
// declare some aliases
|
// declare some aliases
|
||||||
RealVectorType& diag = m_eivalues;
|
RealVectorType& diag = m_eivalues;
|
||||||
MatrixType& mat = m_eivec;
|
EigenvectorsType& mat = m_eivec;
|
||||||
|
|
||||||
// map the matrix coefficients to [-1:1] to avoid over- and underflow.
|
// map the matrix coefficients to [-1:1] to avoid over- and underflow.
|
||||||
mat = matrix.template triangularView<Lower>();
|
mat = matrix.template triangularView<Lower>();
|
||||||
@@ -442,7 +451,7 @@ SelfAdjointEigenSolver<MatrixType>& SelfAdjointEigenSolver<MatrixType>
|
|||||||
while (start>0 && m_subdiag[start-1]!=0)
|
while (start>0 && m_subdiag[start-1]!=0)
|
||||||
start--;
|
start--;
|
||||||
|
|
||||||
internal::tridiagonal_qr_step<MatrixType::Flags&RowMajorBit ? RowMajor : ColMajor>(diag.data(), m_subdiag.data(), start, end, computeEigenvectors ? m_eivec.data() : (Scalar*)0, n);
|
internal::tridiagonal_qr_step(diag.data(), m_subdiag.data(), start, end, computeEigenvectors ? m_eivec.data() : (Scalar*)0, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (iter <= m_maxIterations * n)
|
if (iter <= m_maxIterations * n)
|
||||||
@@ -490,7 +499,13 @@ template<typename SolverType> struct direct_selfadjoint_eigenvalues<SolverType,3
|
|||||||
typedef typename SolverType::MatrixType MatrixType;
|
typedef typename SolverType::MatrixType MatrixType;
|
||||||
typedef typename SolverType::RealVectorType VectorType;
|
typedef typename SolverType::RealVectorType VectorType;
|
||||||
typedef typename SolverType::Scalar Scalar;
|
typedef typename SolverType::Scalar Scalar;
|
||||||
|
typedef typename MatrixType::Index Index;
|
||||||
|
typedef typename SolverType::EigenvectorsType EigenvectorsType;
|
||||||
|
|
||||||
|
/** \internal
|
||||||
|
* Computes the roots of the characteristic polynomial of \a m.
|
||||||
|
* For numerical stability m.trace() should be near zero and to avoid over- or underflow m should be normalized.
|
||||||
|
*/
|
||||||
static inline void computeRoots(const MatrixType& m, VectorType& roots)
|
static inline void computeRoots(const MatrixType& m, VectorType& roots)
|
||||||
{
|
{
|
||||||
using std::sqrt;
|
using std::sqrt;
|
||||||
@@ -510,148 +525,123 @@ template<typename SolverType> struct direct_selfadjoint_eigenvalues<SolverType,3
|
|||||||
// Construct the parameters used in classifying the roots of the equation
|
// Construct the parameters used in classifying the roots of the equation
|
||||||
// and in solving the equation for the roots in closed form.
|
// and in solving the equation for the roots in closed form.
|
||||||
Scalar c2_over_3 = c2*s_inv3;
|
Scalar c2_over_3 = c2*s_inv3;
|
||||||
Scalar a_over_3 = (c1 - c2*c2_over_3)*s_inv3;
|
Scalar a_over_3 = (c2*c2_over_3 - c1)*s_inv3;
|
||||||
if (a_over_3 > Scalar(0))
|
if(a_over_3<Scalar(0))
|
||||||
a_over_3 = Scalar(0);
|
a_over_3 = Scalar(0);
|
||||||
|
|
||||||
Scalar half_b = Scalar(0.5)*(c0 + c2_over_3*(Scalar(2)*c2_over_3*c2_over_3 - c1));
|
Scalar half_b = Scalar(0.5)*(c0 + c2_over_3*(Scalar(2)*c2_over_3*c2_over_3 - c1));
|
||||||
|
|
||||||
Scalar q = half_b*half_b + a_over_3*a_over_3*a_over_3;
|
Scalar q = a_over_3*a_over_3*a_over_3 - half_b*half_b;
|
||||||
if (q > Scalar(0))
|
if(q<Scalar(0))
|
||||||
q = Scalar(0);
|
q = Scalar(0);
|
||||||
|
|
||||||
// Compute the eigenvalues by solving for the roots of the polynomial.
|
// Compute the eigenvalues by solving for the roots of the polynomial.
|
||||||
Scalar rho = sqrt(-a_over_3);
|
Scalar rho = sqrt(a_over_3);
|
||||||
Scalar theta = atan2(sqrt(-q),half_b)*s_inv3;
|
Scalar theta = atan2(sqrt(q),half_b)*s_inv3; // since sqrt(q) > 0, atan2 is in [0, pi] and theta is in [0, pi/3]
|
||||||
Scalar cos_theta = cos(theta);
|
Scalar cos_theta = cos(theta);
|
||||||
Scalar sin_theta = sin(theta);
|
Scalar sin_theta = sin(theta);
|
||||||
roots(0) = c2_over_3 + Scalar(2)*rho*cos_theta;
|
// roots are already sorted, since cos is monotonically decreasing on [0, pi]
|
||||||
roots(1) = c2_over_3 - rho*(cos_theta + s_sqrt3*sin_theta);
|
roots(0) = c2_over_3 - rho*(cos_theta + s_sqrt3*sin_theta); // == 2*rho*cos(theta+2pi/3)
|
||||||
roots(2) = c2_over_3 - rho*(cos_theta - s_sqrt3*sin_theta);
|
roots(1) = c2_over_3 - rho*(cos_theta - s_sqrt3*sin_theta); // == 2*rho*cos(theta+ pi/3)
|
||||||
|
roots(2) = c2_over_3 + Scalar(2)*rho*cos_theta;
|
||||||
// Sort in increasing order.
|
|
||||||
if (roots(0) >= roots(1))
|
|
||||||
std::swap(roots(0),roots(1));
|
|
||||||
if (roots(1) >= roots(2))
|
|
||||||
{
|
|
||||||
std::swap(roots(1),roots(2));
|
|
||||||
if (roots(0) >= roots(1))
|
|
||||||
std::swap(roots(0),roots(1));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline bool extract_kernel(MatrixType& mat, Ref<VectorType> res, Ref<VectorType> representative)
|
||||||
|
{
|
||||||
|
using std::abs;
|
||||||
|
Index i0;
|
||||||
|
// Find non-zero column i0 (by construction, there must exist a non zero coefficient on the diagonal):
|
||||||
|
mat.diagonal().cwiseAbs().maxCoeff(&i0);
|
||||||
|
// mat.col(i0) is a good candidate for an orthogonal vector to the current eigenvector,
|
||||||
|
// so let's save it:
|
||||||
|
representative = mat.col(i0);
|
||||||
|
Scalar n0, n1;
|
||||||
|
VectorType c0, c1;
|
||||||
|
n0 = (c0 = representative.cross(mat.col((i0+1)%3))).squaredNorm();
|
||||||
|
n1 = (c1 = representative.cross(mat.col((i0+2)%3))).squaredNorm();
|
||||||
|
if(n0>n1) res = c0/std::sqrt(n0);
|
||||||
|
else res = c1/std::sqrt(n1);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
static inline void run(SolverType& solver, const MatrixType& mat, int options)
|
static inline void run(SolverType& solver, const MatrixType& mat, int options)
|
||||||
{
|
{
|
||||||
using std::sqrt;
|
|
||||||
eigen_assert(mat.cols() == 3 && mat.cols() == mat.rows());
|
eigen_assert(mat.cols() == 3 && mat.cols() == mat.rows());
|
||||||
eigen_assert((options&~(EigVecMask|GenEigMask))==0
|
eigen_assert((options&~(EigVecMask|GenEigMask))==0
|
||||||
&& (options&EigVecMask)!=EigVecMask
|
&& (options&EigVecMask)!=EigVecMask
|
||||||
&& "invalid option parameter");
|
&& "invalid option parameter");
|
||||||
bool computeEigenvectors = (options&ComputeEigenvectors)==ComputeEigenvectors;
|
bool computeEigenvectors = (options&ComputeEigenvectors)==ComputeEigenvectors;
|
||||||
|
|
||||||
MatrixType& eivecs = solver.m_eivec;
|
EigenvectorsType& eivecs = solver.m_eivec;
|
||||||
VectorType& eivals = solver.m_eivalues;
|
VectorType& eivals = solver.m_eivalues;
|
||||||
|
|
||||||
// map the matrix coefficients to [-1:1] to avoid over- and underflow.
|
// Shift the matrix to the mean eigenvalue and map the matrix coefficients to [-1:1] to avoid over- and underflow.
|
||||||
Scalar scale = mat.cwiseAbs().maxCoeff();
|
Scalar shift = mat.trace() / Scalar(3);
|
||||||
MatrixType scaledMat = mat / scale;
|
// TODO Avoid this copy. Currently it is necessary to suppress bogus values when determining maxCoeff and for computing the eigenvectors later
|
||||||
|
MatrixType scaledMat = mat.template selfadjointView<Lower>();
|
||||||
|
scaledMat.diagonal().array() -= shift;
|
||||||
|
Scalar scale = scaledMat.cwiseAbs().maxCoeff();
|
||||||
|
if(scale > 0) scaledMat /= scale; // TODO for scale==0 we could save the remaining operations
|
||||||
|
|
||||||
// compute the eigenvalues
|
// compute the eigenvalues
|
||||||
computeRoots(scaledMat,eivals);
|
computeRoots(scaledMat,eivals);
|
||||||
|
|
||||||
// compute the eigen vectors
|
// compute the eigenvectors
|
||||||
if(computeEigenvectors)
|
if(computeEigenvectors)
|
||||||
{
|
{
|
||||||
Scalar safeNorm2 = Eigen::NumTraits<Scalar>::epsilon();
|
|
||||||
safeNorm2 *= safeNorm2;
|
|
||||||
if((eivals(2)-eivals(0))<=Eigen::NumTraits<Scalar>::epsilon())
|
if((eivals(2)-eivals(0))<=Eigen::NumTraits<Scalar>::epsilon())
|
||||||
{
|
{
|
||||||
|
// All three eigenvalues are numerically the same
|
||||||
eivecs.setIdentity();
|
eivecs.setIdentity();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
scaledMat = scaledMat.template selfadjointView<Lower>();
|
|
||||||
MatrixType tmp;
|
MatrixType tmp;
|
||||||
tmp = scaledMat;
|
tmp = scaledMat;
|
||||||
|
|
||||||
|
// Compute the eigenvector of the most distinct eigenvalue
|
||||||
Scalar d0 = eivals(2) - eivals(1);
|
Scalar d0 = eivals(2) - eivals(1);
|
||||||
Scalar d1 = eivals(1) - eivals(0);
|
Scalar d1 = eivals(1) - eivals(0);
|
||||||
int k = d0 > d1 ? 2 : 0;
|
Index k(0), l(2);
|
||||||
d0 = d0 > d1 ? d1 : d0;
|
if(d0 > d1)
|
||||||
|
|
||||||
tmp.diagonal().array () -= eivals(k);
|
|
||||||
VectorType cross;
|
|
||||||
Scalar n;
|
|
||||||
n = (cross = tmp.row(0).cross(tmp.row(1))).squaredNorm();
|
|
||||||
|
|
||||||
if(n>safeNorm2)
|
|
||||||
eivecs.col(k) = cross / sqrt(n);
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
n = (cross = tmp.row(0).cross(tmp.row(2))).squaredNorm();
|
std::swap(k,l);
|
||||||
|
d0 = d1;
|
||||||
if(n>safeNorm2)
|
|
||||||
eivecs.col(k) = cross / sqrt(n);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
n = (cross = tmp.row(1).cross(tmp.row(2))).squaredNorm();
|
|
||||||
|
|
||||||
if(n>safeNorm2)
|
|
||||||
eivecs.col(k) = cross / sqrt(n);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// the input matrix and/or the eigenvaues probably contains some inf/NaN,
|
|
||||||
// => exit
|
|
||||||
// scale back to the original size.
|
|
||||||
eivals *= scale;
|
|
||||||
|
|
||||||
solver.m_info = NumericalIssue;
|
|
||||||
solver.m_isInitialized = true;
|
|
||||||
solver.m_eigenvectorsOk = computeEigenvectors;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tmp = scaledMat;
|
// Compute the eigenvector of index k
|
||||||
tmp.diagonal().array() -= eivals(1);
|
|
||||||
|
|
||||||
if(d0<=Eigen::NumTraits<Scalar>::epsilon())
|
|
||||||
eivecs.col(1) = eivecs.col(k).unitOrthogonal();
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
n = (cross = eivecs.col(k).cross(tmp.row(0).normalized())).squaredNorm();
|
tmp.diagonal().array () -= eivals(k);
|
||||||
if(n>safeNorm2)
|
// By construction, 'tmp' is of rank 2, and its kernel corresponds to the respective eigenvector.
|
||||||
eivecs.col(1) = cross / sqrt(n);
|
extract_kernel(tmp, eivecs.col(k), eivecs.col(l));
|
||||||
else
|
|
||||||
{
|
|
||||||
n = (cross = eivecs.col(k).cross(tmp.row(1))).squaredNorm();
|
|
||||||
if(n>safeNorm2)
|
|
||||||
eivecs.col(1) = cross / sqrt(n);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
n = (cross = eivecs.col(k).cross(tmp.row(2))).squaredNorm();
|
|
||||||
if(n>safeNorm2)
|
|
||||||
eivecs.col(1) = cross / sqrt(n);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// we should never reach this point,
|
|
||||||
// if so the last two eigenvalues are likely to ve very closed to each other
|
|
||||||
eivecs.col(1) = eivecs.col(k).unitOrthogonal();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// make sure that eivecs[1] is orthogonal to eivecs[2]
|
|
||||||
Scalar d = eivecs.col(1).dot(eivecs.col(k));
|
|
||||||
eivecs.col(1) = (eivecs.col(1) - d * eivecs.col(k)).normalized();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
eivecs.col(k==2 ? 0 : 2) = eivecs.col(k).cross(eivecs.col(1)).normalized();
|
// Compute eigenvector of index l
|
||||||
|
if(d0<=2*Eigen::NumTraits<Scalar>::epsilon()*d1)
|
||||||
|
{
|
||||||
|
// If d0 is too small, then the two other eigenvalues are numerically the same,
|
||||||
|
// and thus we only have to ortho-normalize the near orthogonal vector we saved above.
|
||||||
|
eivecs.col(l) -= eivecs.col(k).dot(eivecs.col(l))*eivecs.col(l);
|
||||||
|
eivecs.col(l).normalize();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tmp = scaledMat;
|
||||||
|
tmp.diagonal().array () -= eivals(l);
|
||||||
|
|
||||||
|
VectorType dummy;
|
||||||
|
extract_kernel(tmp, eivecs.col(l), dummy);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Compute last eigenvector from the other two
|
||||||
|
eivecs.col(1) = eivecs.col(2).cross(eivecs.col(0)).normalized();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Rescale back to the original size.
|
// Rescale back to the original size.
|
||||||
eivals *= scale;
|
eivals *= scale;
|
||||||
|
eivals.array() += shift;
|
||||||
|
|
||||||
solver.m_info = Success;
|
solver.m_info = Success;
|
||||||
solver.m_isInitialized = true;
|
solver.m_isInitialized = true;
|
||||||
@@ -665,11 +655,12 @@ template<typename SolverType> struct direct_selfadjoint_eigenvalues<SolverType,2
|
|||||||
typedef typename SolverType::MatrixType MatrixType;
|
typedef typename SolverType::MatrixType MatrixType;
|
||||||
typedef typename SolverType::RealVectorType VectorType;
|
typedef typename SolverType::RealVectorType VectorType;
|
||||||
typedef typename SolverType::Scalar Scalar;
|
typedef typename SolverType::Scalar Scalar;
|
||||||
|
typedef typename SolverType::EigenvectorsType EigenvectorsType;
|
||||||
|
|
||||||
static inline void computeRoots(const MatrixType& m, VectorType& roots)
|
static inline void computeRoots(const MatrixType& m, VectorType& roots)
|
||||||
{
|
{
|
||||||
using std::sqrt;
|
using std::sqrt;
|
||||||
const Scalar t0 = Scalar(0.5) * sqrt( numext::abs2(m(0,0)-m(1,1)) + Scalar(4)*m(1,0)*m(1,0));
|
const Scalar t0 = Scalar(0.5) * sqrt( numext::abs2(m(0,0)-m(1,1)) + Scalar(4)*numext::abs2(m(1,0)));
|
||||||
const Scalar t1 = Scalar(0.5) * (m(0,0) + m(1,1));
|
const Scalar t1 = Scalar(0.5) * (m(0,0) + m(1,1));
|
||||||
roots(0) = t1 - t0;
|
roots(0) = t1 - t0;
|
||||||
roots(1) = t1 + t0;
|
roots(1) = t1 + t0;
|
||||||
@@ -678,13 +669,15 @@ template<typename SolverType> struct direct_selfadjoint_eigenvalues<SolverType,2
|
|||||||
static inline void run(SolverType& solver, const MatrixType& mat, int options)
|
static inline void run(SolverType& solver, const MatrixType& mat, int options)
|
||||||
{
|
{
|
||||||
using std::sqrt;
|
using std::sqrt;
|
||||||
|
using std::abs;
|
||||||
|
|
||||||
eigen_assert(mat.cols() == 2 && mat.cols() == mat.rows());
|
eigen_assert(mat.cols() == 2 && mat.cols() == mat.rows());
|
||||||
eigen_assert((options&~(EigVecMask|GenEigMask))==0
|
eigen_assert((options&~(EigVecMask|GenEigMask))==0
|
||||||
&& (options&EigVecMask)!=EigVecMask
|
&& (options&EigVecMask)!=EigVecMask
|
||||||
&& "invalid option parameter");
|
&& "invalid option parameter");
|
||||||
bool computeEigenvectors = (options&ComputeEigenvectors)==ComputeEigenvectors;
|
bool computeEigenvectors = (options&ComputeEigenvectors)==ComputeEigenvectors;
|
||||||
|
|
||||||
MatrixType& eivecs = solver.m_eivec;
|
EigenvectorsType& eivecs = solver.m_eivec;
|
||||||
VectorType& eivals = solver.m_eivalues;
|
VectorType& eivals = solver.m_eivalues;
|
||||||
|
|
||||||
// map the matrix coefficients to [-1:1] to avoid over- and underflow.
|
// map the matrix coefficients to [-1:1] to avoid over- and underflow.
|
||||||
@@ -698,22 +691,29 @@ template<typename SolverType> struct direct_selfadjoint_eigenvalues<SolverType,2
|
|||||||
// compute the eigen vectors
|
// compute the eigen vectors
|
||||||
if(computeEigenvectors)
|
if(computeEigenvectors)
|
||||||
{
|
{
|
||||||
scaledMat.diagonal().array () -= eivals(1);
|
if((eivals(1)-eivals(0))<=abs(eivals(1))*Eigen::NumTraits<Scalar>::epsilon())
|
||||||
Scalar a2 = numext::abs2(scaledMat(0,0));
|
|
||||||
Scalar c2 = numext::abs2(scaledMat(1,1));
|
|
||||||
Scalar b2 = numext::abs2(scaledMat(1,0));
|
|
||||||
if(a2>c2)
|
|
||||||
{
|
{
|
||||||
eivecs.col(1) << -scaledMat(1,0), scaledMat(0,0);
|
eivecs.setIdentity();
|
||||||
eivecs.col(1) /= sqrt(a2+b2);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
eivecs.col(1) << -scaledMat(1,1), scaledMat(1,0);
|
scaledMat.diagonal().array () -= eivals(1);
|
||||||
eivecs.col(1) /= sqrt(c2+b2);
|
Scalar a2 = numext::abs2(scaledMat(0,0));
|
||||||
}
|
Scalar c2 = numext::abs2(scaledMat(1,1));
|
||||||
|
Scalar b2 = numext::abs2(scaledMat(1,0));
|
||||||
|
if(a2>c2)
|
||||||
|
{
|
||||||
|
eivecs.col(1) << -scaledMat(1,0), scaledMat(0,0);
|
||||||
|
eivecs.col(1) /= sqrt(a2+b2);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
eivecs.col(1) << -scaledMat(1,1), scaledMat(1,0);
|
||||||
|
eivecs.col(1) /= sqrt(c2+b2);
|
||||||
|
}
|
||||||
|
|
||||||
eivecs.col(0) << eivecs.col(1).unitOrthogonal();
|
eivecs.col(0) << eivecs.col(1).unitOrthogonal();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Rescale back to the original size.
|
// Rescale back to the original size.
|
||||||
@@ -736,7 +736,7 @@ SelfAdjointEigenSolver<MatrixType>& SelfAdjointEigenSolver<MatrixType>
|
|||||||
}
|
}
|
||||||
|
|
||||||
namespace internal {
|
namespace internal {
|
||||||
template<int StorageOrder,typename RealScalar, typename Scalar, typename Index>
|
template<typename RealScalar, typename Scalar, typename Index>
|
||||||
static void tridiagonal_qr_step(RealScalar* diag, RealScalar* subdiag, Index start, Index end, Scalar* matrixQ, Index n)
|
static void tridiagonal_qr_step(RealScalar* diag, RealScalar* subdiag, Index start, Index end, Scalar* matrixQ, Index n)
|
||||||
{
|
{
|
||||||
using std::abs;
|
using std::abs;
|
||||||
@@ -788,8 +788,7 @@ static void tridiagonal_qr_step(RealScalar* diag, RealScalar* subdiag, Index sta
|
|||||||
// apply the givens rotation to the unit matrix Q = Q * G
|
// apply the givens rotation to the unit matrix Q = Q * G
|
||||||
if (matrixQ)
|
if (matrixQ)
|
||||||
{
|
{
|
||||||
// FIXME if StorageOrder == RowMajor this operation is not very efficient
|
Map<Matrix<Scalar,Dynamic,Dynamic,ColMajor> > q(matrixQ,n,n);
|
||||||
Map<Matrix<Scalar,Dynamic,Dynamic,StorageOrder> > q(matrixQ,n,n);
|
|
||||||
q.applyOnTheRight(k,k+1,rot);
|
q.applyOnTheRight(k,k+1,rot);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,10 +19,12 @@ namespace Eigen {
|
|||||||
*
|
*
|
||||||
* \brief An axis aligned box
|
* \brief An axis aligned box
|
||||||
*
|
*
|
||||||
* \param _Scalar the type of the scalar coefficients
|
* \tparam _Scalar the type of the scalar coefficients
|
||||||
* \param _AmbientDim the dimension of the ambient space, can be a compile time value or Dynamic.
|
* \tparam _AmbientDim the dimension of the ambient space, can be a compile time value or Dynamic.
|
||||||
*
|
*
|
||||||
* This class represents an axis aligned box as a pair of the minimal and maximal corners.
|
* This class represents an axis aligned box as a pair of the minimal and maximal corners.
|
||||||
|
* \warning The result of most methods is undefined when applied to an empty box. You can check for empty boxes using isEmpty().
|
||||||
|
* \sa alignedboxtypedefs
|
||||||
*/
|
*/
|
||||||
template <typename _Scalar, int _AmbientDim>
|
template <typename _Scalar, int _AmbientDim>
|
||||||
class AlignedBox
|
class AlignedBox
|
||||||
@@ -40,18 +42,21 @@ EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(_Scalar,_AmbientDim)
|
|||||||
/** Define constants to name the corners of a 1D, 2D or 3D axis aligned bounding box */
|
/** Define constants to name the corners of a 1D, 2D or 3D axis aligned bounding box */
|
||||||
enum CornerType
|
enum CornerType
|
||||||
{
|
{
|
||||||
/** 1D names */
|
/** 1D names @{ */
|
||||||
Min=0, Max=1,
|
Min=0, Max=1,
|
||||||
|
/** @} */
|
||||||
|
|
||||||
/** Added names for 2D */
|
/** Identifier for 2D corner @{ */
|
||||||
BottomLeft=0, BottomRight=1,
|
BottomLeft=0, BottomRight=1,
|
||||||
TopLeft=2, TopRight=3,
|
TopLeft=2, TopRight=3,
|
||||||
|
/** @} */
|
||||||
|
|
||||||
/** Added names for 3D */
|
/** Identifier for 3D corner @{ */
|
||||||
BottomLeftFloor=0, BottomRightFloor=1,
|
BottomLeftFloor=0, BottomRightFloor=1,
|
||||||
TopLeftFloor=2, TopRightFloor=3,
|
TopLeftFloor=2, TopRightFloor=3,
|
||||||
BottomLeftCeil=4, BottomRightCeil=5,
|
BottomLeftCeil=4, BottomRightCeil=5,
|
||||||
TopLeftCeil=6, TopRightCeil=7
|
TopLeftCeil=6, TopRightCeil=7
|
||||||
|
/** @} */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -63,34 +68,33 @@ EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(_Scalar,_AmbientDim)
|
|||||||
inline explicit AlignedBox(Index _dim) : m_min(_dim), m_max(_dim)
|
inline explicit AlignedBox(Index _dim) : m_min(_dim), m_max(_dim)
|
||||||
{ setEmpty(); }
|
{ setEmpty(); }
|
||||||
|
|
||||||
/** Constructs a box with extremities \a _min and \a _max. */
|
/** Constructs a box with extremities \a _min and \a _max.
|
||||||
|
* \warning If either component of \a _min is larger than the same component of \a _max, the constructed box is empty. */
|
||||||
template<typename OtherVectorType1, typename OtherVectorType2>
|
template<typename OtherVectorType1, typename OtherVectorType2>
|
||||||
inline AlignedBox(const OtherVectorType1& _min, const OtherVectorType2& _max) : m_min(_min), m_max(_max) {}
|
inline AlignedBox(const OtherVectorType1& _min, const OtherVectorType2& _max) : m_min(_min), m_max(_max) {}
|
||||||
|
|
||||||
/** Constructs a box containing a single point \a p. */
|
/** Constructs a box containing a single point \a p. */
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
inline explicit AlignedBox(const MatrixBase<Derived>& a_p)
|
inline explicit AlignedBox(const MatrixBase<Derived>& p) : m_min(p), m_max(m_min)
|
||||||
{
|
{ }
|
||||||
typename internal::nested<Derived,2>::type p(a_p.derived());
|
|
||||||
m_min = p;
|
|
||||||
m_max = p;
|
|
||||||
}
|
|
||||||
|
|
||||||
~AlignedBox() {}
|
~AlignedBox() {}
|
||||||
|
|
||||||
/** \returns the dimension in which the box holds */
|
/** \returns the dimension in which the box holds */
|
||||||
inline Index dim() const { return AmbientDimAtCompileTime==Dynamic ? m_min.size() : Index(AmbientDimAtCompileTime); }
|
inline Index dim() const { return AmbientDimAtCompileTime==Dynamic ? m_min.size() : Index(AmbientDimAtCompileTime); }
|
||||||
|
|
||||||
/** \deprecated use isEmpty */
|
/** \deprecated use isEmpty() */
|
||||||
inline bool isNull() const { return isEmpty(); }
|
inline bool isNull() const { return isEmpty(); }
|
||||||
|
|
||||||
/** \deprecated use setEmpty */
|
/** \deprecated use setEmpty() */
|
||||||
inline void setNull() { setEmpty(); }
|
inline void setNull() { setEmpty(); }
|
||||||
|
|
||||||
/** \returns true if the box is empty. */
|
/** \returns true if the box is empty.
|
||||||
|
* \sa setEmpty */
|
||||||
inline bool isEmpty() const { return (m_min.array() > m_max.array()).any(); }
|
inline bool isEmpty() const { return (m_min.array() > m_max.array()).any(); }
|
||||||
|
|
||||||
/** Makes \c *this an empty box. */
|
/** Makes \c *this an empty box.
|
||||||
|
* \sa isEmpty */
|
||||||
inline void setEmpty()
|
inline void setEmpty()
|
||||||
{
|
{
|
||||||
m_min.setConstant( ScalarTraits::highest() );
|
m_min.setConstant( ScalarTraits::highest() );
|
||||||
@@ -159,7 +163,7 @@ EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(_Scalar,_AmbientDim)
|
|||||||
* a uniform distribution */
|
* a uniform distribution */
|
||||||
inline VectorType sample() const
|
inline VectorType sample() const
|
||||||
{
|
{
|
||||||
VectorType r;
|
VectorType r(dim());
|
||||||
for(Index d=0; d<dim(); ++d)
|
for(Index d=0; d<dim(); ++d)
|
||||||
{
|
{
|
||||||
if(!ScalarTraits::IsInteger)
|
if(!ScalarTraits::IsInteger)
|
||||||
@@ -175,27 +179,34 @@ EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(_Scalar,_AmbientDim)
|
|||||||
|
|
||||||
/** \returns true if the point \a p is inside the box \c *this. */
|
/** \returns true if the point \a p is inside the box \c *this. */
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
inline bool contains(const MatrixBase<Derived>& a_p) const
|
inline bool contains(const MatrixBase<Derived>& p) const
|
||||||
{
|
{
|
||||||
typename internal::nested<Derived,2>::type p(a_p.derived());
|
typename internal::nested<Derived,2>::type p_n(p.derived());
|
||||||
return (m_min.array()<=p.array()).all() && (p.array()<=m_max.array()).all();
|
return (m_min.array()<=p_n.array()).all() && (p_n.array()<=m_max.array()).all();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** \returns true if the box \a b is entirely inside the box \c *this. */
|
/** \returns true if the box \a b is entirely inside the box \c *this. */
|
||||||
inline bool contains(const AlignedBox& b) const
|
inline bool contains(const AlignedBox& b) const
|
||||||
{ return (m_min.array()<=(b.min)().array()).all() && ((b.max)().array()<=m_max.array()).all(); }
|
{ return (m_min.array()<=(b.min)().array()).all() && ((b.max)().array()<=m_max.array()).all(); }
|
||||||
|
|
||||||
/** Extends \c *this such that it contains the point \a p and returns a reference to \c *this. */
|
/** \returns true if the box \a b is intersecting the box \c *this.
|
||||||
|
* \sa intersection, clamp */
|
||||||
|
inline bool intersects(const AlignedBox& b) const
|
||||||
|
{ return (m_min.array()<=(b.max)().array()).all() && ((b.min)().array()<=m_max.array()).all(); }
|
||||||
|
|
||||||
|
/** Extends \c *this such that it contains the point \a p and returns a reference to \c *this.
|
||||||
|
* \sa extend(const AlignedBox&) */
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
inline AlignedBox& extend(const MatrixBase<Derived>& a_p)
|
inline AlignedBox& extend(const MatrixBase<Derived>& p)
|
||||||
{
|
{
|
||||||
typename internal::nested<Derived,2>::type p(a_p.derived());
|
typename internal::nested<Derived,2>::type p_n(p.derived());
|
||||||
m_min = m_min.cwiseMin(p);
|
m_min = m_min.cwiseMin(p_n);
|
||||||
m_max = m_max.cwiseMax(p);
|
m_max = m_max.cwiseMax(p_n);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Extends \c *this such that it contains the box \a b and returns a reference to \c *this. */
|
/** Extends \c *this such that it contains the box \a b and returns a reference to \c *this.
|
||||||
|
* \sa merged, extend(const MatrixBase&) */
|
||||||
inline AlignedBox& extend(const AlignedBox& b)
|
inline AlignedBox& extend(const AlignedBox& b)
|
||||||
{
|
{
|
||||||
m_min = m_min.cwiseMin(b.m_min);
|
m_min = m_min.cwiseMin(b.m_min);
|
||||||
@@ -203,7 +214,9 @@ EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(_Scalar,_AmbientDim)
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Clamps \c *this by the box \a b and returns a reference to \c *this. */
|
/** Clamps \c *this by the box \a b and returns a reference to \c *this.
|
||||||
|
* \note If the boxes don't intersect, the resulting box is empty.
|
||||||
|
* \sa intersection(), intersects() */
|
||||||
inline AlignedBox& clamp(const AlignedBox& b)
|
inline AlignedBox& clamp(const AlignedBox& b)
|
||||||
{
|
{
|
||||||
m_min = m_min.cwiseMax(b.m_min);
|
m_min = m_min.cwiseMax(b.m_min);
|
||||||
@@ -211,11 +224,15 @@ EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(_Scalar,_AmbientDim)
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns an AlignedBox that is the intersection of \a b and \c *this */
|
/** Returns an AlignedBox that is the intersection of \a b and \c *this
|
||||||
|
* \note If the boxes don't intersect, the resulting box is empty.
|
||||||
|
* \sa intersects(), clamp, contains() */
|
||||||
inline AlignedBox intersection(const AlignedBox& b) const
|
inline AlignedBox intersection(const AlignedBox& b) const
|
||||||
{return AlignedBox(m_min.cwiseMax(b.m_min), m_max.cwiseMin(b.m_max)); }
|
{return AlignedBox(m_min.cwiseMax(b.m_min), m_max.cwiseMin(b.m_max)); }
|
||||||
|
|
||||||
/** Returns an AlignedBox that is the union of \a b and \c *this */
|
/** Returns an AlignedBox that is the union of \a b and \c *this.
|
||||||
|
* \note Merging with an empty box may result in a box bigger than \c *this.
|
||||||
|
* \sa extend(const AlignedBox&) */
|
||||||
inline AlignedBox merged(const AlignedBox& b) const
|
inline AlignedBox merged(const AlignedBox& b) const
|
||||||
{ return AlignedBox(m_min.cwiseMin(b.m_min), m_max.cwiseMax(b.m_max)); }
|
{ return AlignedBox(m_min.cwiseMin(b.m_min), m_max.cwiseMax(b.m_max)); }
|
||||||
|
|
||||||
@@ -231,20 +248,20 @@ EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(_Scalar,_AmbientDim)
|
|||||||
|
|
||||||
/** \returns the squared distance between the point \a p and the box \c *this,
|
/** \returns the squared distance between the point \a p and the box \c *this,
|
||||||
* and zero if \a p is inside the box.
|
* and zero if \a p is inside the box.
|
||||||
* \sa exteriorDistance()
|
* \sa exteriorDistance(const MatrixBase&), squaredExteriorDistance(const AlignedBox&)
|
||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
inline Scalar squaredExteriorDistance(const MatrixBase<Derived>& a_p) const;
|
inline Scalar squaredExteriorDistance(const MatrixBase<Derived>& p) const;
|
||||||
|
|
||||||
/** \returns the squared distance between the boxes \a b and \c *this,
|
/** \returns the squared distance between the boxes \a b and \c *this,
|
||||||
* and zero if the boxes intersect.
|
* and zero if the boxes intersect.
|
||||||
* \sa exteriorDistance()
|
* \sa exteriorDistance(const AlignedBox&), squaredExteriorDistance(const MatrixBase&)
|
||||||
*/
|
*/
|
||||||
inline Scalar squaredExteriorDistance(const AlignedBox& b) const;
|
inline Scalar squaredExteriorDistance(const AlignedBox& b) const;
|
||||||
|
|
||||||
/** \returns the distance between the point \a p and the box \c *this,
|
/** \returns the distance between the point \a p and the box \c *this,
|
||||||
* and zero if \a p is inside the box.
|
* and zero if \a p is inside the box.
|
||||||
* \sa squaredExteriorDistance()
|
* \sa squaredExteriorDistance(const MatrixBase&), exteriorDistance(const AlignedBox&)
|
||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
inline NonInteger exteriorDistance(const MatrixBase<Derived>& p) const
|
inline NonInteger exteriorDistance(const MatrixBase<Derived>& p) const
|
||||||
@@ -252,7 +269,7 @@ EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(_Scalar,_AmbientDim)
|
|||||||
|
|
||||||
/** \returns the distance between the boxes \a b and \c *this,
|
/** \returns the distance between the boxes \a b and \c *this,
|
||||||
* and zero if the boxes intersect.
|
* and zero if the boxes intersect.
|
||||||
* \sa squaredExteriorDistance()
|
* \sa squaredExteriorDistance(const AlignedBox&), exteriorDistance(const MatrixBase&)
|
||||||
*/
|
*/
|
||||||
inline NonInteger exteriorDistance(const AlignedBox& b) const
|
inline NonInteger exteriorDistance(const AlignedBox& b) const
|
||||||
{ using std::sqrt; return sqrt(NonInteger(squaredExteriorDistance(b))); }
|
{ using std::sqrt; return sqrt(NonInteger(squaredExteriorDistance(b))); }
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ public:
|
|||||||
m_angle = Scalar(other.angle());
|
m_angle = Scalar(other.angle());
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline const AngleAxis Identity() { return AngleAxis(0, Vector3::UnitX()); }
|
static inline const AngleAxis Identity() { return AngleAxis(Scalar(0), Vector3::UnitX()); }
|
||||||
|
|
||||||
/** \returns \c true if \c *this is approximately equal to \a other, within the precision
|
/** \returns \c true if \c *this is approximately equal to \a other, within the precision
|
||||||
* determined by \a prec.
|
* determined by \a prec.
|
||||||
@@ -165,8 +165,8 @@ AngleAxis<Scalar>& AngleAxis<Scalar>::operator=(const QuaternionBase<QuatDerived
|
|||||||
Scalar n2 = q.vec().squaredNorm();
|
Scalar n2 = q.vec().squaredNorm();
|
||||||
if (n2 < NumTraits<Scalar>::dummy_precision()*NumTraits<Scalar>::dummy_precision())
|
if (n2 < NumTraits<Scalar>::dummy_precision()*NumTraits<Scalar>::dummy_precision())
|
||||||
{
|
{
|
||||||
m_angle = 0;
|
m_angle = Scalar(0);
|
||||||
m_axis << 1, 0, 0;
|
m_axis << Scalar(1), Scalar(0), Scalar(0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ template<typename MatrixType,int _Direction> class Homogeneous
|
|||||||
{
|
{
|
||||||
if( (int(Direction)==Vertical && row==m_matrix.rows())
|
if( (int(Direction)==Vertical && row==m_matrix.rows())
|
||||||
|| (int(Direction)==Horizontal && col==m_matrix.cols()))
|
|| (int(Direction)==Horizontal && col==m_matrix.cols()))
|
||||||
return 1;
|
return Scalar(1);
|
||||||
return m_matrix.coeff(row, col);
|
return m_matrix.coeff(row, col);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -100,7 +100,17 @@ public:
|
|||||||
{
|
{
|
||||||
EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(VectorType, 3)
|
EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(VectorType, 3)
|
||||||
Hyperplane result(p0.size());
|
Hyperplane result(p0.size());
|
||||||
result.normal() = (p2 - p0).cross(p1 - p0).normalized();
|
VectorType v0(p2 - p0), v1(p1 - p0);
|
||||||
|
result.normal() = v0.cross(v1);
|
||||||
|
RealScalar norm = result.normal().norm();
|
||||||
|
if(norm <= v0.norm() * v1.norm() * NumTraits<RealScalar>::epsilon())
|
||||||
|
{
|
||||||
|
Matrix<Scalar,2,3> m; m << v0.transpose(), v1.transpose();
|
||||||
|
JacobiSVD<Matrix<Scalar,2,3> > svd(m, ComputeFullV);
|
||||||
|
result.normal() = svd.matrixV().col(2);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
result.normal() /= norm;
|
||||||
result.offset() = -p0.dot(result.normal());
|
result.offset() = -p0.dot(result.normal());
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -102,11 +102,11 @@ public:
|
|||||||
/** \returns a quaternion representing an identity rotation
|
/** \returns a quaternion representing an identity rotation
|
||||||
* \sa MatrixBase::Identity()
|
* \sa MatrixBase::Identity()
|
||||||
*/
|
*/
|
||||||
static inline Quaternion<Scalar> Identity() { return Quaternion<Scalar>(1, 0, 0, 0); }
|
static inline Quaternion<Scalar> Identity() { return Quaternion<Scalar>(Scalar(1), Scalar(0), Scalar(0), Scalar(0)); }
|
||||||
|
|
||||||
/** \sa QuaternionBase::Identity(), MatrixBase::setIdentity()
|
/** \sa QuaternionBase::Identity(), MatrixBase::setIdentity()
|
||||||
*/
|
*/
|
||||||
inline QuaternionBase& setIdentity() { coeffs() << 0, 0, 0, 1; return *this; }
|
inline QuaternionBase& setIdentity() { coeffs() << Scalar(0), Scalar(0), Scalar(0), Scalar(1); return *this; }
|
||||||
|
|
||||||
/** \returns the squared norm of the quaternion's coefficients
|
/** \returns the squared norm of the quaternion's coefficients
|
||||||
* \sa QuaternionBase::norm(), MatrixBase::squaredNorm()
|
* \sa QuaternionBase::norm(), MatrixBase::squaredNorm()
|
||||||
@@ -161,7 +161,7 @@ public:
|
|||||||
{ return coeffs().isApprox(other.coeffs(), prec); }
|
{ return coeffs().isApprox(other.coeffs(), prec); }
|
||||||
|
|
||||||
/** return the result vector of \a v through the rotation*/
|
/** return the result vector of \a v through the rotation*/
|
||||||
EIGEN_STRONG_INLINE Vector3 _transformVector(Vector3 v) const;
|
EIGEN_STRONG_INLINE Vector3 _transformVector(const Vector3& v) const;
|
||||||
|
|
||||||
/** \returns \c *this with scalar type casted to \a NewScalarType
|
/** \returns \c *this with scalar type casted to \a NewScalarType
|
||||||
*
|
*
|
||||||
@@ -203,6 +203,8 @@ public:
|
|||||||
* \li \c Quaternionf for \c float
|
* \li \c Quaternionf for \c float
|
||||||
* \li \c Quaterniond for \c double
|
* \li \c Quaterniond for \c double
|
||||||
*
|
*
|
||||||
|
* \warning Operations interpreting the quaternion as rotation have undefined behavior if the quaternion is not normalized.
|
||||||
|
*
|
||||||
* \sa class AngleAxis, class Transform
|
* \sa class AngleAxis, class Transform
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -229,7 +231,7 @@ class Quaternion : public QuaternionBase<Quaternion<_Scalar,_Options> >
|
|||||||
public:
|
public:
|
||||||
typedef _Scalar Scalar;
|
typedef _Scalar Scalar;
|
||||||
|
|
||||||
EIGEN_INHERIT_ASSIGNMENT_EQUAL_OPERATOR(Quaternion)
|
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Quaternion)
|
||||||
using Base::operator*=;
|
using Base::operator*=;
|
||||||
|
|
||||||
typedef typename internal::traits<Quaternion>::Coefficients Coefficients;
|
typedef typename internal::traits<Quaternion>::Coefficients Coefficients;
|
||||||
@@ -339,12 +341,12 @@ class Map<const Quaternion<_Scalar>, _Options >
|
|||||||
public:
|
public:
|
||||||
typedef _Scalar Scalar;
|
typedef _Scalar Scalar;
|
||||||
typedef typename internal::traits<Map>::Coefficients Coefficients;
|
typedef typename internal::traits<Map>::Coefficients Coefficients;
|
||||||
EIGEN_INHERIT_ASSIGNMENT_EQUAL_OPERATOR(Map)
|
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Map)
|
||||||
using Base::operator*=;
|
using Base::operator*=;
|
||||||
|
|
||||||
/** Constructs a Mapped Quaternion object from the pointer \a coeffs
|
/** Constructs a Mapped Quaternion object from the pointer \a coeffs
|
||||||
*
|
*
|
||||||
* The pointer \a coeffs must reference the four coeffecients of Quaternion in the following order:
|
* The pointer \a coeffs must reference the four coefficients of Quaternion in the following order:
|
||||||
* \code *coeffs == {x, y, z, w} \endcode
|
* \code *coeffs == {x, y, z, w} \endcode
|
||||||
*
|
*
|
||||||
* If the template parameter _Options is set to #Aligned, then the pointer coeffs must be aligned. */
|
* If the template parameter _Options is set to #Aligned, then the pointer coeffs must be aligned. */
|
||||||
@@ -376,7 +378,7 @@ class Map<Quaternion<_Scalar>, _Options >
|
|||||||
public:
|
public:
|
||||||
typedef _Scalar Scalar;
|
typedef _Scalar Scalar;
|
||||||
typedef typename internal::traits<Map>::Coefficients Coefficients;
|
typedef typename internal::traits<Map>::Coefficients Coefficients;
|
||||||
EIGEN_INHERIT_ASSIGNMENT_EQUAL_OPERATOR(Map)
|
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Map)
|
||||||
using Base::operator*=;
|
using Base::operator*=;
|
||||||
|
|
||||||
/** Constructs a Mapped Quaternion object from the pointer \a coeffs
|
/** Constructs a Mapped Quaternion object from the pointer \a coeffs
|
||||||
@@ -459,12 +461,12 @@ EIGEN_STRONG_INLINE Derived& QuaternionBase<Derived>::operator*= (const Quaterni
|
|||||||
*/
|
*/
|
||||||
template <class Derived>
|
template <class Derived>
|
||||||
EIGEN_STRONG_INLINE typename QuaternionBase<Derived>::Vector3
|
EIGEN_STRONG_INLINE typename QuaternionBase<Derived>::Vector3
|
||||||
QuaternionBase<Derived>::_transformVector(Vector3 v) const
|
QuaternionBase<Derived>::_transformVector(const Vector3& v) const
|
||||||
{
|
{
|
||||||
// Note that this algorithm comes from the optimization by hand
|
// Note that this algorithm comes from the optimization by hand
|
||||||
// of the conversion to a Matrix followed by a Matrix/Vector product.
|
// of the conversion to a Matrix followed by a Matrix/Vector product.
|
||||||
// It appears to be much faster than the common algorithm found
|
// It appears to be much faster than the common algorithm found
|
||||||
// in the litterature (30 versus 39 flops). It also requires two
|
// in the literature (30 versus 39 flops). It also requires two
|
||||||
// Vector3 as temporaries.
|
// Vector3 as temporaries.
|
||||||
Vector3 uv = this->vec().cross(v);
|
Vector3 uv = this->vec().cross(v);
|
||||||
uv += uv;
|
uv += uv;
|
||||||
@@ -584,7 +586,7 @@ inline Derived& QuaternionBase<Derived>::setFromTwoVectors(const MatrixBase<Deri
|
|||||||
// which yields a singular value problem
|
// which yields a singular value problem
|
||||||
if (c < Scalar(-1)+NumTraits<Scalar>::dummy_precision())
|
if (c < Scalar(-1)+NumTraits<Scalar>::dummy_precision())
|
||||||
{
|
{
|
||||||
c = max<Scalar>(c,-1);
|
c = (max)(c,Scalar(-1));
|
||||||
Matrix<Scalar,2,3> m; m << v0.transpose(), v1.transpose();
|
Matrix<Scalar,2,3> m; m << v0.transpose(), v1.transpose();
|
||||||
JacobiSVD<Matrix<Scalar,2,3> > svd(m, ComputeFullV);
|
JacobiSVD<Matrix<Scalar,2,3> > svd(m, ComputeFullV);
|
||||||
Vector3 axis = svd.matrixV().col(2);
|
Vector3 axis = svd.matrixV().col(2);
|
||||||
@@ -635,7 +637,7 @@ inline Quaternion<typename internal::traits<Derived>::Scalar> QuaternionBase<Der
|
|||||||
{
|
{
|
||||||
// FIXME should this function be called multiplicativeInverse and conjugate() be called inverse() or opposite() ??
|
// FIXME should this function be called multiplicativeInverse and conjugate() be called inverse() or opposite() ??
|
||||||
Scalar n2 = this->squaredNorm();
|
Scalar n2 = this->squaredNorm();
|
||||||
if (n2 > 0)
|
if (n2 > Scalar(0))
|
||||||
return Quaternion<Scalar>(conjugate().coeffs() / n2);
|
return Quaternion<Scalar>(conjugate().coeffs() / n2);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -665,12 +667,10 @@ template <class OtherDerived>
|
|||||||
inline typename internal::traits<Derived>::Scalar
|
inline typename internal::traits<Derived>::Scalar
|
||||||
QuaternionBase<Derived>::angularDistance(const QuaternionBase<OtherDerived>& other) const
|
QuaternionBase<Derived>::angularDistance(const QuaternionBase<OtherDerived>& other) const
|
||||||
{
|
{
|
||||||
using std::acos;
|
using std::atan2;
|
||||||
using std::abs;
|
using std::abs;
|
||||||
double d = abs(this->dot(other));
|
Quaternion<Scalar> d = (*this) * other.conjugate();
|
||||||
if (d>=1.0)
|
return Scalar(2) * atan2( d.vec().norm(), abs(d.w()) );
|
||||||
return Scalar(0);
|
|
||||||
return static_cast<Scalar>(2 * acos(d));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -710,7 +710,7 @@ QuaternionBase<Derived>::slerp(const Scalar& t, const QuaternionBase<OtherDerive
|
|||||||
scale0 = sin( ( Scalar(1) - t ) * theta) / sinTheta;
|
scale0 = sin( ( Scalar(1) - t ) * theta) / sinTheta;
|
||||||
scale1 = sin( ( t * theta) ) / sinTheta;
|
scale1 = sin( ( t * theta) ) / sinTheta;
|
||||||
}
|
}
|
||||||
if(d<0) scale1 = -scale1;
|
if(d<Scalar(0)) scale1 = -scale1;
|
||||||
|
|
||||||
return Quaternion<Scalar>(scale0 * coeffs() + scale1 * other.coeffs());
|
return Quaternion<Scalar>(scale0 * coeffs() + scale1 * other.coeffs());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,6 +60,9 @@ public:
|
|||||||
|
|
||||||
/** Construct a 2D counter clock wise rotation from the angle \a a in radian. */
|
/** Construct a 2D counter clock wise rotation from the angle \a a in radian. */
|
||||||
inline Rotation2D(const Scalar& a) : m_angle(a) {}
|
inline Rotation2D(const Scalar& a) : m_angle(a) {}
|
||||||
|
|
||||||
|
/** Default constructor wihtout initialization. The represented rotation is undefined. */
|
||||||
|
Rotation2D() {}
|
||||||
|
|
||||||
/** \returns the rotation angle */
|
/** \returns the rotation angle */
|
||||||
inline Scalar angle() const { return m_angle; }
|
inline Scalar angle() const { return m_angle; }
|
||||||
@@ -81,10 +84,10 @@ public:
|
|||||||
/** Applies the rotation to a 2D vector */
|
/** Applies the rotation to a 2D vector */
|
||||||
Vector2 operator* (const Vector2& vec) const
|
Vector2 operator* (const Vector2& vec) const
|
||||||
{ return toRotationMatrix() * vec; }
|
{ return toRotationMatrix() * vec; }
|
||||||
|
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
Rotation2D& fromRotationMatrix(const MatrixBase<Derived>& m);
|
Rotation2D& fromRotationMatrix(const MatrixBase<Derived>& m);
|
||||||
Matrix2 toRotationMatrix(void) const;
|
Matrix2 toRotationMatrix() const;
|
||||||
|
|
||||||
/** \returns the spherical interpolation between \c *this and \a other using
|
/** \returns the spherical interpolation between \c *this and \a other using
|
||||||
* parameter \a t. It is in fact equivalent to a linear interpolation.
|
* parameter \a t. It is in fact equivalent to a linear interpolation.
|
||||||
|
|||||||
@@ -62,6 +62,8 @@ struct transform_construct_from_matrix;
|
|||||||
|
|
||||||
template<typename TransformType> struct transform_take_affine_part;
|
template<typename TransformType> struct transform_take_affine_part;
|
||||||
|
|
||||||
|
template<int Mode> struct transform_make_affine;
|
||||||
|
|
||||||
} // end namespace internal
|
} // end namespace internal
|
||||||
|
|
||||||
/** \geometry_module \ingroup Geometry_Module
|
/** \geometry_module \ingroup Geometry_Module
|
||||||
@@ -194,9 +196,9 @@ public:
|
|||||||
/** type of the matrix used to represent the linear part of the transformation */
|
/** type of the matrix used to represent the linear part of the transformation */
|
||||||
typedef Matrix<Scalar,Dim,Dim,Options> LinearMatrixType;
|
typedef Matrix<Scalar,Dim,Dim,Options> LinearMatrixType;
|
||||||
/** type of read/write reference to the linear part of the transformation */
|
/** type of read/write reference to the linear part of the transformation */
|
||||||
typedef Block<MatrixType,Dim,Dim,int(Mode)==(AffineCompact)> LinearPart;
|
typedef Block<MatrixType,Dim,Dim,int(Mode)==(AffineCompact) && (Options&RowMajor)==0> LinearPart;
|
||||||
/** type of read reference to the linear part of the transformation */
|
/** type of read reference to the linear part of the transformation */
|
||||||
typedef const Block<ConstMatrixType,Dim,Dim,int(Mode)==(AffineCompact)> ConstLinearPart;
|
typedef const Block<ConstMatrixType,Dim,Dim,int(Mode)==(AffineCompact) && (Options&RowMajor)==0> ConstLinearPart;
|
||||||
/** type of read/write reference to the affine part of the transformation */
|
/** type of read/write reference to the affine part of the transformation */
|
||||||
typedef typename internal::conditional<int(Mode)==int(AffineCompact),
|
typedef typename internal::conditional<int(Mode)==int(AffineCompact),
|
||||||
MatrixType&,
|
MatrixType&,
|
||||||
@@ -230,8 +232,7 @@ public:
|
|||||||
inline Transform()
|
inline Transform()
|
||||||
{
|
{
|
||||||
check_template_params();
|
check_template_params();
|
||||||
if (int(Mode)==Affine)
|
internal::transform_make_affine<(int(Mode)==Affine) ? Affine : AffineCompact>::run(m_matrix);
|
||||||
makeAffine();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Transform(const Transform& other)
|
inline Transform(const Transform& other)
|
||||||
@@ -591,11 +592,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
void makeAffine()
|
void makeAffine()
|
||||||
{
|
{
|
||||||
if(int(Mode)!=int(AffineCompact))
|
internal::transform_make_affine<int(Mode)>::run(m_matrix);
|
||||||
{
|
|
||||||
matrix().template block<1,Dim>(Dim,0).setZero();
|
|
||||||
matrix().coeffRef(Dim,Dim) = Scalar(1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** \internal
|
/** \internal
|
||||||
@@ -1079,6 +1076,24 @@ Transform<Scalar,Dim,Mode,Options>::fromPositionOrientationScale(const MatrixBas
|
|||||||
|
|
||||||
namespace internal {
|
namespace internal {
|
||||||
|
|
||||||
|
template<int Mode>
|
||||||
|
struct transform_make_affine
|
||||||
|
{
|
||||||
|
template<typename MatrixType>
|
||||||
|
static void run(MatrixType &mat)
|
||||||
|
{
|
||||||
|
static const int Dim = MatrixType::ColsAtCompileTime-1;
|
||||||
|
mat.template block<1,Dim>(Dim,0).setZero();
|
||||||
|
mat.coeffRef(Dim,Dim) = typename MatrixType::Scalar(1);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct transform_make_affine<AffineCompact>
|
||||||
|
{
|
||||||
|
template<typename MatrixType> static void run(MatrixType &) { }
|
||||||
|
};
|
||||||
|
|
||||||
// selector needed to avoid taking the inverse of a 3x4 matrix
|
// selector needed to avoid taking the inverse of a 3x4 matrix
|
||||||
template<typename TransformType, int Mode=TransformType::Mode>
|
template<typename TransformType, int Mode=TransformType::Mode>
|
||||||
struct projective_transform_inverse
|
struct projective_transform_inverse
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ umeyama(const MatrixBase<Derived>& src, const MatrixBase<OtherDerived>& dst, boo
|
|||||||
const Index n = src.cols(); // number of measurements
|
const Index n = src.cols(); // number of measurements
|
||||||
|
|
||||||
// required for demeaning ...
|
// required for demeaning ...
|
||||||
const RealScalar one_over_n = 1 / static_cast<RealScalar>(n);
|
const RealScalar one_over_n = RealScalar(1) / static_cast<RealScalar>(n);
|
||||||
|
|
||||||
// computation of mean
|
// computation of mean
|
||||||
const VectorType src_mean = src.rowwise().sum() * one_over_n;
|
const VectorType src_mean = src.rowwise().sum() * one_over_n;
|
||||||
@@ -136,16 +136,16 @@ umeyama(const MatrixBase<Derived>& src, const MatrixBase<OtherDerived>& dst, boo
|
|||||||
|
|
||||||
// Eq. (39)
|
// Eq. (39)
|
||||||
VectorType S = VectorType::Ones(m);
|
VectorType S = VectorType::Ones(m);
|
||||||
if (sigma.determinant()<0) S(m-1) = -1;
|
if (sigma.determinant()<Scalar(0)) S(m-1) = Scalar(-1);
|
||||||
|
|
||||||
// Eq. (40) and (43)
|
// Eq. (40) and (43)
|
||||||
const VectorType& d = svd.singularValues();
|
const VectorType& d = svd.singularValues();
|
||||||
Index rank = 0; for (Index i=0; i<m; ++i) if (!internal::isMuchSmallerThan(d.coeff(i),d.coeff(0))) ++rank;
|
Index rank = 0; for (Index i=0; i<m; ++i) if (!internal::isMuchSmallerThan(d.coeff(i),d.coeff(0))) ++rank;
|
||||||
if (rank == m-1) {
|
if (rank == m-1) {
|
||||||
if ( svd.matrixU().determinant() * svd.matrixV().determinant() > 0 ) {
|
if ( svd.matrixU().determinant() * svd.matrixV().determinant() > Scalar(0) ) {
|
||||||
Rt.block(0,0,m,m).noalias() = svd.matrixU()*svd.matrixV().transpose();
|
Rt.block(0,0,m,m).noalias() = svd.matrixU()*svd.matrixV().transpose();
|
||||||
} else {
|
} else {
|
||||||
const Scalar s = S(m-1); S(m-1) = -1;
|
const Scalar s = S(m-1); S(m-1) = Scalar(-1);
|
||||||
Rt.block(0,0,m,m).noalias() = svd.matrixU() * S.asDiagonal() * svd.matrixV().transpose();
|
Rt.block(0,0,m,m).noalias() = svd.matrixU() * S.asDiagonal() * svd.matrixV().transpose();
|
||||||
S(m-1) = s;
|
S(m-1) = s;
|
||||||
}
|
}
|
||||||
@@ -156,7 +156,7 @@ umeyama(const MatrixBase<Derived>& src, const MatrixBase<OtherDerived>& dst, boo
|
|||||||
if (with_scaling)
|
if (with_scaling)
|
||||||
{
|
{
|
||||||
// Eq. (42)
|
// Eq. (42)
|
||||||
const Scalar c = 1/src_var * svd.singularValues().dot(S);
|
const Scalar c = Scalar(1)/src_var * svd.singularValues().dot(S);
|
||||||
|
|
||||||
// Eq. (41)
|
// Eq. (41)
|
||||||
Rt.col(m).head(m) = dst_mean;
|
Rt.col(m).head(m) = dst_mean;
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ void apply_block_householder_on_the_left(MatrixType& mat, const VectorsType& vec
|
|||||||
typedef typename MatrixType::Index Index;
|
typedef typename MatrixType::Index Index;
|
||||||
enum { TFactorSize = MatrixType::ColsAtCompileTime };
|
enum { TFactorSize = MatrixType::ColsAtCompileTime };
|
||||||
Index nbVecs = vectors.cols();
|
Index nbVecs = vectors.cols();
|
||||||
Matrix<typename MatrixType::Scalar, TFactorSize, TFactorSize> T(nbVecs,nbVecs);
|
Matrix<typename MatrixType::Scalar, TFactorSize, TFactorSize, ColMajor> T(nbVecs,nbVecs);
|
||||||
make_block_householder_triangular_factor(T, vectors, hCoeffs);
|
make_block_householder_triangular_factor(T, vectors, hCoeffs);
|
||||||
|
|
||||||
const TriangularView<const VectorsType, UnitLower>& V(vectors);
|
const TriangularView<const VectorsType, UnitLower>& V(vectors);
|
||||||
|
|||||||
@@ -65,10 +65,10 @@ class DiagonalPreconditioner
|
|||||||
{
|
{
|
||||||
typename MatType::InnerIterator it(mat,j);
|
typename MatType::InnerIterator it(mat,j);
|
||||||
while(it && it.index()!=j) ++it;
|
while(it && it.index()!=j) ++it;
|
||||||
if(it && it.index()==j)
|
if(it && it.index()==j && it.value()!=Scalar(0))
|
||||||
m_invdiag(j) = Scalar(1)/it.value();
|
m_invdiag(j) = Scalar(1)/it.value();
|
||||||
else
|
else
|
||||||
m_invdiag(j) = 0;
|
m_invdiag(j) = Scalar(1);
|
||||||
}
|
}
|
||||||
m_isInitialized = true;
|
m_isInitialized = true;
|
||||||
return *this;
|
return *this;
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ bool bicgstab(const MatrixType& mat, const Rhs& rhs, Dest& x,
|
|||||||
int maxIters = iters;
|
int maxIters = iters;
|
||||||
|
|
||||||
int n = mat.cols();
|
int n = mat.cols();
|
||||||
x = precond.solve(x);
|
|
||||||
VectorType r = rhs - mat * x;
|
VectorType r = rhs - mat * x;
|
||||||
VectorType r0 = r;
|
VectorType r0 = r;
|
||||||
|
|
||||||
@@ -61,6 +60,7 @@ bool bicgstab(const MatrixType& mat, const Rhs& rhs, Dest& x,
|
|||||||
VectorType s(n), t(n);
|
VectorType s(n), t(n);
|
||||||
|
|
||||||
RealScalar tol2 = tol*tol;
|
RealScalar tol2 = tol*tol;
|
||||||
|
RealScalar eps2 = NumTraits<Scalar>::epsilon()*NumTraits<Scalar>::epsilon();
|
||||||
int i = 0;
|
int i = 0;
|
||||||
int restarts = 0;
|
int restarts = 0;
|
||||||
|
|
||||||
@@ -69,7 +69,7 @@ bool bicgstab(const MatrixType& mat, const Rhs& rhs, Dest& x,
|
|||||||
Scalar rho_old = rho;
|
Scalar rho_old = rho;
|
||||||
|
|
||||||
rho = r0.dot(r);
|
rho = r0.dot(r);
|
||||||
if (internal::isMuchSmallerThan(rho,r0_sqnorm))
|
if (abs(rho) < eps2*r0_sqnorm)
|
||||||
{
|
{
|
||||||
// The new residual vector became too orthogonal to the arbitrarily choosen direction r0
|
// The new residual vector became too orthogonal to the arbitrarily choosen direction r0
|
||||||
// Let's restart with a new r0:
|
// Let's restart with a new r0:
|
||||||
@@ -142,7 +142,7 @@ struct traits<BiCGSTAB<_MatrixType,_Preconditioner> >
|
|||||||
* SparseMatrix<double> A(n,n);
|
* SparseMatrix<double> A(n,n);
|
||||||
* // fill A and b
|
* // fill A and b
|
||||||
* BiCGSTAB<SparseMatrix<double> > solver;
|
* BiCGSTAB<SparseMatrix<double> > solver;
|
||||||
* solver(A);
|
* solver.compute(A);
|
||||||
* x = solver.solve(b);
|
* x = solver.solve(b);
|
||||||
* std::cout << "#iterations: " << solver.iterations() << std::endl;
|
* std::cout << "#iterations: " << solver.iterations() << std::endl;
|
||||||
* std::cout << "estimated error: " << solver.error() << std::endl;
|
* std::cout << "estimated error: " << solver.error() << std::endl;
|
||||||
@@ -151,20 +151,7 @@ struct traits<BiCGSTAB<_MatrixType,_Preconditioner> >
|
|||||||
* \endcode
|
* \endcode
|
||||||
*
|
*
|
||||||
* By default the iterations start with x=0 as an initial guess of the solution.
|
* By default the iterations start with x=0 as an initial guess of the solution.
|
||||||
* One can control the start using the solveWithGuess() method. Here is a step by
|
* One can control the start using the solveWithGuess() method.
|
||||||
* step execution example starting with a random guess and printing the evolution
|
|
||||||
* of the estimated error:
|
|
||||||
* * \code
|
|
||||||
* x = VectorXd::Random(n);
|
|
||||||
* solver.setMaxIterations(1);
|
|
||||||
* int i = 0;
|
|
||||||
* do {
|
|
||||||
* x = solver.solveWithGuess(b,x);
|
|
||||||
* std::cout << i << " : " << solver.error() << std::endl;
|
|
||||||
* ++i;
|
|
||||||
* } while (solver.info()!=Success && i<100);
|
|
||||||
* \endcode
|
|
||||||
* Note that such a step by step excution is slightly slower.
|
|
||||||
*
|
*
|
||||||
* \sa class SimplicialCholesky, DiagonalPreconditioner, IdentityPreconditioner
|
* \sa class SimplicialCholesky, DiagonalPreconditioner, IdentityPreconditioner
|
||||||
*/
|
*/
|
||||||
@@ -199,7 +186,8 @@ public:
|
|||||||
* this class becomes invalid. Call compute() to update it with the new
|
* this class becomes invalid. Call compute() to update it with the new
|
||||||
* matrix A, or modify a copy of A.
|
* matrix A, or modify a copy of A.
|
||||||
*/
|
*/
|
||||||
BiCGSTAB(const MatrixType& A) : Base(A) {}
|
template<typename MatrixDerived>
|
||||||
|
explicit BiCGSTAB(const EigenBase<MatrixDerived>& A) : Base(A.derived()) {}
|
||||||
|
|
||||||
~BiCGSTAB() {}
|
~BiCGSTAB() {}
|
||||||
|
|
||||||
|
|||||||
@@ -112,9 +112,9 @@ struct traits<ConjugateGradient<_MatrixType,_UpLo,_Preconditioner> >
|
|||||||
* This class allows to solve for A.x = b sparse linear problems using a conjugate gradient algorithm.
|
* This class allows to solve for A.x = b sparse linear problems using a conjugate gradient algorithm.
|
||||||
* The sparse matrix A must be selfadjoint. The vectors x and b can be either dense or sparse.
|
* The sparse matrix A must be selfadjoint. The vectors x and b can be either dense or sparse.
|
||||||
*
|
*
|
||||||
* \tparam _MatrixType the type of the sparse matrix A, can be a dense or a sparse matrix.
|
* \tparam _MatrixType the type of the matrix A, can be a dense or a sparse matrix.
|
||||||
* \tparam _UpLo the triangular part that will be used for the computations. It can be Lower
|
* \tparam _UpLo the triangular part that will be used for the computations. It can be Lower,
|
||||||
* or Upper. Default is Lower.
|
* Upper, or Lower|Upper in which the full matrix entries will be considered. Default is Lower.
|
||||||
* \tparam _Preconditioner the type of the preconditioner. Default is DiagonalPreconditioner
|
* \tparam _Preconditioner the type of the preconditioner. Default is DiagonalPreconditioner
|
||||||
*
|
*
|
||||||
* The maximal number of iterations and tolerance value can be controlled via the setMaxIterations()
|
* The maximal number of iterations and tolerance value can be controlled via the setMaxIterations()
|
||||||
@@ -137,20 +137,7 @@ struct traits<ConjugateGradient<_MatrixType,_UpLo,_Preconditioner> >
|
|||||||
* \endcode
|
* \endcode
|
||||||
*
|
*
|
||||||
* By default the iterations start with x=0 as an initial guess of the solution.
|
* By default the iterations start with x=0 as an initial guess of the solution.
|
||||||
* One can control the start using the solveWithGuess() method. Here is a step by
|
* One can control the start using the solveWithGuess() method.
|
||||||
* step execution example starting with a random guess and printing the evolution
|
|
||||||
* of the estimated error:
|
|
||||||
* * \code
|
|
||||||
* x = VectorXd::Random(n);
|
|
||||||
* cg.setMaxIterations(1);
|
|
||||||
* int i = 0;
|
|
||||||
* do {
|
|
||||||
* x = cg.solveWithGuess(b,x);
|
|
||||||
* std::cout << i << " : " << cg.error() << std::endl;
|
|
||||||
* ++i;
|
|
||||||
* } while (cg.info()!=Success && i<100);
|
|
||||||
* \endcode
|
|
||||||
* Note that such a step by step excution is slightly slower.
|
|
||||||
*
|
*
|
||||||
* \sa class SimplicialCholesky, DiagonalPreconditioner, IdentityPreconditioner
|
* \sa class SimplicialCholesky, DiagonalPreconditioner, IdentityPreconditioner
|
||||||
*/
|
*/
|
||||||
@@ -189,7 +176,8 @@ public:
|
|||||||
* this class becomes invalid. Call compute() to update it with the new
|
* this class becomes invalid. Call compute() to update it with the new
|
||||||
* matrix A, or modify a copy of A.
|
* matrix A, or modify a copy of A.
|
||||||
*/
|
*/
|
||||||
ConjugateGradient(const MatrixType& A) : Base(A) {}
|
template<typename MatrixDerived>
|
||||||
|
explicit ConjugateGradient(const EigenBase<MatrixDerived>& A) : Base(A.derived()) {}
|
||||||
|
|
||||||
~ConjugateGradient() {}
|
~ConjugateGradient() {}
|
||||||
|
|
||||||
@@ -213,6 +201,10 @@ public:
|
|||||||
template<typename Rhs,typename Dest>
|
template<typename Rhs,typename Dest>
|
||||||
void _solveWithGuess(const Rhs& b, Dest& x) const
|
void _solveWithGuess(const Rhs& b, Dest& x) const
|
||||||
{
|
{
|
||||||
|
typedef typename internal::conditional<UpLo==(Lower|Upper),
|
||||||
|
const MatrixType&,
|
||||||
|
SparseSelfAdjointView<const MatrixType, UpLo>
|
||||||
|
>::type MatrixWrapperType;
|
||||||
m_iterations = Base::maxIterations();
|
m_iterations = Base::maxIterations();
|
||||||
m_error = Base::m_tolerance;
|
m_error = Base::m_tolerance;
|
||||||
|
|
||||||
@@ -222,8 +214,7 @@ public:
|
|||||||
m_error = Base::m_tolerance;
|
m_error = Base::m_tolerance;
|
||||||
|
|
||||||
typename Dest::ColXpr xj(x,j);
|
typename Dest::ColXpr xj(x,j);
|
||||||
internal::conjugate_gradient(mp_matrix->template selfadjointView<UpLo>(), b.col(j), xj,
|
internal::conjugate_gradient(MatrixWrapperType(*mp_matrix), b.col(j), xj, Base::m_preconditioner, m_iterations, m_error);
|
||||||
Base::m_preconditioner, m_iterations, m_error);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_isInitialized = true;
|
m_isInitialized = true;
|
||||||
@@ -234,7 +225,7 @@ public:
|
|||||||
template<typename Rhs,typename Dest>
|
template<typename Rhs,typename Dest>
|
||||||
void _solve(const Rhs& b, Dest& x) const
|
void _solve(const Rhs& b, Dest& x) const
|
||||||
{
|
{
|
||||||
x.setOnes();
|
x.setZero();
|
||||||
_solveWithGuess(b,x);
|
_solveWithGuess(b,x);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -150,7 +150,6 @@ class IncompleteLUT : internal::noncopyable
|
|||||||
{
|
{
|
||||||
analyzePattern(amat);
|
analyzePattern(amat);
|
||||||
factorize(amat);
|
factorize(amat);
|
||||||
m_isInitialized = m_factorizationIsOk;
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -160,7 +159,7 @@ class IncompleteLUT : internal::noncopyable
|
|||||||
template<typename Rhs, typename Dest>
|
template<typename Rhs, typename Dest>
|
||||||
void _solve(const Rhs& b, Dest& x) const
|
void _solve(const Rhs& b, Dest& x) const
|
||||||
{
|
{
|
||||||
x = m_Pinv * b;
|
x = m_Pinv * b;
|
||||||
x = m_lu.template triangularView<UnitLower>().solve(x);
|
x = m_lu.template triangularView<UnitLower>().solve(x);
|
||||||
x = m_lu.template triangularView<Upper>().solve(x);
|
x = m_lu.template triangularView<Upper>().solve(x);
|
||||||
x = m_P * x;
|
x = m_P * x;
|
||||||
@@ -223,18 +222,29 @@ template<typename _MatrixType>
|
|||||||
void IncompleteLUT<Scalar>::analyzePattern(const _MatrixType& amat)
|
void IncompleteLUT<Scalar>::analyzePattern(const _MatrixType& amat)
|
||||||
{
|
{
|
||||||
// Compute the Fill-reducing permutation
|
// Compute the Fill-reducing permutation
|
||||||
|
// Since ILUT does not perform any numerical pivoting,
|
||||||
|
// it is highly preferable to keep the diagonal through symmetric permutations.
|
||||||
|
#ifndef EIGEN_MPL2_ONLY
|
||||||
|
// To this end, let's symmetrize the pattern and perform AMD on it.
|
||||||
SparseMatrix<Scalar,ColMajor, Index> mat1 = amat;
|
SparseMatrix<Scalar,ColMajor, Index> mat1 = amat;
|
||||||
SparseMatrix<Scalar,ColMajor, Index> mat2 = amat.transpose();
|
SparseMatrix<Scalar,ColMajor, Index> mat2 = amat.transpose();
|
||||||
// Symmetrize the pattern
|
|
||||||
// FIXME for a matrix with nearly symmetric pattern, mat2+mat1 is the appropriate choice.
|
// FIXME for a matrix with nearly symmetric pattern, mat2+mat1 is the appropriate choice.
|
||||||
// on the other hand for a really non-symmetric pattern, mat2*mat1 should be prefered...
|
// on the other hand for a really non-symmetric pattern, mat2*mat1 should be prefered...
|
||||||
SparseMatrix<Scalar,ColMajor, Index> AtA = mat2 + mat1;
|
SparseMatrix<Scalar,ColMajor, Index> AtA = mat2 + mat1;
|
||||||
AtA.prune(keep_diag());
|
AMDOrdering<Index> ordering;
|
||||||
internal::minimum_degree_ordering<Scalar, Index>(AtA, m_P); // Then compute the AMD ordering...
|
ordering(AtA,m_P);
|
||||||
|
m_Pinv = m_P.inverse(); // cache the inverse permutation
|
||||||
m_Pinv = m_P.inverse(); // ... and the inverse permutation
|
#else
|
||||||
|
// If AMD is not available, (MPL2-only), then let's use the slower COLAMD routine.
|
||||||
|
SparseMatrix<Scalar,ColMajor, Index> mat1 = amat;
|
||||||
|
COLAMDOrdering<Index> ordering;
|
||||||
|
ordering(mat1,m_Pinv);
|
||||||
|
m_P = m_Pinv.inverse();
|
||||||
|
#endif
|
||||||
|
|
||||||
m_analysisIsOk = true;
|
m_analysisIsOk = true;
|
||||||
|
m_factorizationIsOk = false;
|
||||||
|
m_isInitialized = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Scalar>
|
template <typename Scalar>
|
||||||
@@ -442,6 +452,7 @@ void IncompleteLUT<Scalar>::factorize(const _MatrixType& amat)
|
|||||||
m_lu.makeCompressed();
|
m_lu.makeCompressed();
|
||||||
|
|
||||||
m_factorizationIsOk = true;
|
m_factorizationIsOk = true;
|
||||||
|
m_isInitialized = m_factorizationIsOk;
|
||||||
m_info = Success;
|
m_info = Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -49,10 +49,11 @@ public:
|
|||||||
* this class becomes invalid. Call compute() to update it with the new
|
* this class becomes invalid. Call compute() to update it with the new
|
||||||
* matrix A, or modify a copy of A.
|
* matrix A, or modify a copy of A.
|
||||||
*/
|
*/
|
||||||
IterativeSolverBase(const MatrixType& A)
|
template<typename InputDerived>
|
||||||
|
IterativeSolverBase(const EigenBase<InputDerived>& A)
|
||||||
{
|
{
|
||||||
init();
|
init();
|
||||||
compute(A);
|
compute(A.derived());
|
||||||
}
|
}
|
||||||
|
|
||||||
~IterativeSolverBase() {}
|
~IterativeSolverBase() {}
|
||||||
@@ -62,9 +63,11 @@ public:
|
|||||||
* Currently, this function mostly call analyzePattern on the preconditioner. In the future
|
* Currently, this function mostly call analyzePattern on the preconditioner. In the future
|
||||||
* we might, for instance, implement column reodering for faster matrix vector products.
|
* we might, for instance, implement column reodering for faster matrix vector products.
|
||||||
*/
|
*/
|
||||||
Derived& analyzePattern(const MatrixType& A)
|
template<typename InputDerived>
|
||||||
|
Derived& analyzePattern(const EigenBase<InputDerived>& A)
|
||||||
{
|
{
|
||||||
m_preconditioner.analyzePattern(A);
|
grabInput(A.derived());
|
||||||
|
m_preconditioner.analyzePattern(*mp_matrix);
|
||||||
m_isInitialized = true;
|
m_isInitialized = true;
|
||||||
m_analysisIsOk = true;
|
m_analysisIsOk = true;
|
||||||
m_info = Success;
|
m_info = Success;
|
||||||
@@ -80,11 +83,12 @@ public:
|
|||||||
* this class becomes invalid. Call compute() to update it with the new
|
* this class becomes invalid. Call compute() to update it with the new
|
||||||
* matrix A, or modify a copy of A.
|
* matrix A, or modify a copy of A.
|
||||||
*/
|
*/
|
||||||
Derived& factorize(const MatrixType& A)
|
template<typename InputDerived>
|
||||||
|
Derived& factorize(const EigenBase<InputDerived>& A)
|
||||||
{
|
{
|
||||||
|
grabInput(A.derived());
|
||||||
eigen_assert(m_analysisIsOk && "You must first call analyzePattern()");
|
eigen_assert(m_analysisIsOk && "You must first call analyzePattern()");
|
||||||
mp_matrix = &A;
|
m_preconditioner.factorize(*mp_matrix);
|
||||||
m_preconditioner.factorize(A);
|
|
||||||
m_factorizationIsOk = true;
|
m_factorizationIsOk = true;
|
||||||
m_info = Success;
|
m_info = Success;
|
||||||
return derived();
|
return derived();
|
||||||
@@ -100,10 +104,11 @@ public:
|
|||||||
* this class becomes invalid. Call compute() to update it with the new
|
* this class becomes invalid. Call compute() to update it with the new
|
||||||
* matrix A, or modify a copy of A.
|
* matrix A, or modify a copy of A.
|
||||||
*/
|
*/
|
||||||
Derived& compute(const MatrixType& A)
|
template<typename InputDerived>
|
||||||
|
Derived& compute(const EigenBase<InputDerived>& A)
|
||||||
{
|
{
|
||||||
mp_matrix = &A;
|
grabInput(A.derived());
|
||||||
m_preconditioner.compute(A);
|
m_preconditioner.compute(*mp_matrix);
|
||||||
m_isInitialized = true;
|
m_isInitialized = true;
|
||||||
m_analysisIsOk = true;
|
m_analysisIsOk = true;
|
||||||
m_factorizationIsOk = true;
|
m_factorizationIsOk = true;
|
||||||
@@ -212,6 +217,28 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
template<typename InputDerived>
|
||||||
|
void grabInput(const EigenBase<InputDerived>& A)
|
||||||
|
{
|
||||||
|
// we const cast to prevent the creation of a MatrixType temporary by the compiler.
|
||||||
|
grabInput_impl(A.const_cast_derived());
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename InputDerived>
|
||||||
|
void grabInput_impl(const EigenBase<InputDerived>& A)
|
||||||
|
{
|
||||||
|
m_copyMatrix = A;
|
||||||
|
mp_matrix = &m_copyMatrix;
|
||||||
|
}
|
||||||
|
|
||||||
|
void grabInput_impl(MatrixType& A)
|
||||||
|
{
|
||||||
|
if(MatrixType::RowsAtCompileTime==Dynamic && MatrixType::ColsAtCompileTime==Dynamic)
|
||||||
|
m_copyMatrix.resize(0,0);
|
||||||
|
mp_matrix = &A;
|
||||||
|
}
|
||||||
|
|
||||||
void init()
|
void init()
|
||||||
{
|
{
|
||||||
m_isInitialized = false;
|
m_isInitialized = false;
|
||||||
@@ -220,6 +247,7 @@ protected:
|
|||||||
m_maxIterations = -1;
|
m_maxIterations = -1;
|
||||||
m_tolerance = NumTraits<Scalar>::epsilon();
|
m_tolerance = NumTraits<Scalar>::epsilon();
|
||||||
}
|
}
|
||||||
|
MatrixType m_copyMatrix;
|
||||||
const MatrixType* mp_matrix;
|
const MatrixType* mp_matrix;
|
||||||
Preconditioner m_preconditioner;
|
Preconditioner m_preconditioner;
|
||||||
|
|
||||||
|
|||||||
@@ -20,10 +20,11 @@ namespace Eigen {
|
|||||||
*
|
*
|
||||||
* \param MatrixType the type of the matrix of which we are computing the LU decomposition
|
* \param MatrixType the type of the matrix of which we are computing the LU decomposition
|
||||||
*
|
*
|
||||||
* This class represents a LU decomposition of any matrix, with complete pivoting: the matrix A
|
* This class represents a LU decomposition of any matrix, with complete pivoting: the matrix A is
|
||||||
* is decomposed as A = PLUQ where L is unit-lower-triangular, U is upper-triangular, and P and Q
|
* decomposed as \f$ A = P^{-1} L U Q^{-1} \f$ where L is unit-lower-triangular, U is
|
||||||
* are permutation matrices. This is a rank-revealing LU decomposition. The eigenvalues (diagonal
|
* upper-triangular, and P and Q are permutation matrices. This is a rank-revealing LU
|
||||||
* coefficients) of U are sorted in such a way that any zeros are at the end.
|
* decomposition. The eigenvalues (diagonal coefficients) of U are sorted in such a way that any
|
||||||
|
* zeros are at the end.
|
||||||
*
|
*
|
||||||
* This decomposition provides the generic approach to solving systems of linear equations, computing
|
* This decomposition provides the generic approach to solving systems of linear equations, computing
|
||||||
* the rank, invertibility, inverse, kernel, and determinant.
|
* the rank, invertibility, inverse, kernel, and determinant.
|
||||||
@@ -373,6 +374,12 @@ template<typename _MatrixType> class FullPivLU
|
|||||||
inline Index cols() const { return m_lu.cols(); }
|
inline Index cols() const { return m_lu.cols(); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
static void check_template_parameters()
|
||||||
|
{
|
||||||
|
EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar);
|
||||||
|
}
|
||||||
|
|
||||||
MatrixType m_lu;
|
MatrixType m_lu;
|
||||||
PermutationPType m_p;
|
PermutationPType m_p;
|
||||||
PermutationQType m_q;
|
PermutationQType m_q;
|
||||||
@@ -417,6 +424,8 @@ FullPivLU<MatrixType>::FullPivLU(const MatrixType& matrix)
|
|||||||
template<typename MatrixType>
|
template<typename MatrixType>
|
||||||
FullPivLU<MatrixType>& FullPivLU<MatrixType>::compute(const MatrixType& matrix)
|
FullPivLU<MatrixType>& FullPivLU<MatrixType>::compute(const MatrixType& matrix)
|
||||||
{
|
{
|
||||||
|
check_template_parameters();
|
||||||
|
|
||||||
// the permutations are stored as int indices, so just to be sure:
|
// the permutations are stored as int indices, so just to be sure:
|
||||||
eigen_assert(matrix.rows()<=NumTraits<int>::highest() && matrix.cols()<=NumTraits<int>::highest());
|
eigen_assert(matrix.rows()<=NumTraits<int>::highest() && matrix.cols()<=NumTraits<int>::highest());
|
||||||
|
|
||||||
@@ -511,8 +520,8 @@ typename internal::traits<MatrixType>::Scalar FullPivLU<MatrixType>::determinant
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** \returns the matrix represented by the decomposition,
|
/** \returns the matrix represented by the decomposition,
|
||||||
* i.e., it returns the product: P^{-1} L U Q^{-1}.
|
* i.e., it returns the product: \f$ P^{-1} L U Q^{-1} \f$.
|
||||||
* This function is provided for debug purpose. */
|
* This function is provided for debug purposes. */
|
||||||
template<typename MatrixType>
|
template<typename MatrixType>
|
||||||
MatrixType FullPivLU<MatrixType>::reconstructedMatrix() const
|
MatrixType FullPivLU<MatrixType>::reconstructedMatrix() const
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -171,6 +171,12 @@ template<typename _MatrixType> class PartialPivLU
|
|||||||
inline Index cols() const { return m_lu.cols(); }
|
inline Index cols() const { return m_lu.cols(); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
static void check_template_parameters()
|
||||||
|
{
|
||||||
|
EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar);
|
||||||
|
}
|
||||||
|
|
||||||
MatrixType m_lu;
|
MatrixType m_lu;
|
||||||
PermutationType m_p;
|
PermutationType m_p;
|
||||||
TranspositionType m_rowsTranspositions;
|
TranspositionType m_rowsTranspositions;
|
||||||
@@ -386,6 +392,8 @@ void partial_lu_inplace(MatrixType& lu, TranspositionType& row_transpositions, t
|
|||||||
template<typename MatrixType>
|
template<typename MatrixType>
|
||||||
PartialPivLU<MatrixType>& PartialPivLU<MatrixType>::compute(const MatrixType& matrix)
|
PartialPivLU<MatrixType>& PartialPivLU<MatrixType>::compute(const MatrixType& matrix)
|
||||||
{
|
{
|
||||||
|
check_template_parameters();
|
||||||
|
|
||||||
// the row permutation is stored as int indices, so just to be sure:
|
// the row permutation is stored as int indices, so just to be sure:
|
||||||
eigen_assert(matrix.rows()<NumTraits<int>::highest());
|
eigen_assert(matrix.rows()<NumTraits<int>::highest());
|
||||||
|
|
||||||
|
|||||||
@@ -137,22 +137,27 @@ void minimum_degree_ordering(SparseMatrix<Scalar,ColMajor,Index>& C, Permutation
|
|||||||
degree[i] = len[i]; // degree of node i
|
degree[i] = len[i]; // degree of node i
|
||||||
}
|
}
|
||||||
mark = internal::cs_wclear<Index>(0, 0, w, n); /* clear w */
|
mark = internal::cs_wclear<Index>(0, 0, w, n); /* clear w */
|
||||||
elen[n] = -2; /* n is a dead element */
|
|
||||||
Cp[n] = -1; /* n is a root of assembly tree */
|
|
||||||
w[n] = 0; /* n is a dead element */
|
|
||||||
|
|
||||||
/* --- Initialize degree lists ------------------------------------------ */
|
/* --- Initialize degree lists ------------------------------------------ */
|
||||||
for(i = 0; i < n; i++)
|
for(i = 0; i < n; i++)
|
||||||
{
|
{
|
||||||
|
bool has_diag = false;
|
||||||
|
for(p = Cp[i]; p<Cp[i+1]; ++p)
|
||||||
|
if(Ci[p]==i)
|
||||||
|
{
|
||||||
|
has_diag = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
d = degree[i];
|
d = degree[i];
|
||||||
if(d == 0) /* node i is empty */
|
if(d == 1 && has_diag) /* node i is empty */
|
||||||
{
|
{
|
||||||
elen[i] = -2; /* element i is dead */
|
elen[i] = -2; /* element i is dead */
|
||||||
nel++;
|
nel++;
|
||||||
Cp[i] = -1; /* i is a root of assembly tree */
|
Cp[i] = -1; /* i is a root of assembly tree */
|
||||||
w[i] = 0;
|
w[i] = 0;
|
||||||
}
|
}
|
||||||
else if(d > dense) /* node i is dense */
|
else if(d > dense || !has_diag) /* node i is dense or has no structural diagonal element */
|
||||||
{
|
{
|
||||||
nv[i] = 0; /* absorb i into element n */
|
nv[i] = 0; /* absorb i into element n */
|
||||||
elen[i] = -1; /* node i is dead */
|
elen[i] = -1; /* node i is dead */
|
||||||
@@ -168,6 +173,10 @@ void minimum_degree_ordering(SparseMatrix<Scalar,ColMajor,Index>& C, Permutation
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
elen[n] = -2; /* n is a dead element */
|
||||||
|
Cp[n] = -1; /* n is a root of assembly tree */
|
||||||
|
w[n] = 0; /* n is a dead element */
|
||||||
|
|
||||||
while (nel < n) /* while (selecting pivots) do */
|
while (nel < n) /* while (selecting pivots) do */
|
||||||
{
|
{
|
||||||
/* --- Select node of minimum approximate degree -------------------- */
|
/* --- Select node of minimum approximate degree -------------------- */
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ class NaturalOrdering
|
|||||||
* \class COLAMDOrdering
|
* \class COLAMDOrdering
|
||||||
*
|
*
|
||||||
* Functor computing the \em column \em approximate \em minimum \em degree ordering
|
* Functor computing the \em column \em approximate \em minimum \em degree ordering
|
||||||
* The matrix should be in column-major format
|
* The matrix should be in column-major and \b compressed format (see SparseMatrix::makeCompressed()).
|
||||||
*/
|
*/
|
||||||
template<typename Index>
|
template<typename Index>
|
||||||
class COLAMDOrdering
|
class COLAMDOrdering
|
||||||
@@ -118,10 +118,14 @@ class COLAMDOrdering
|
|||||||
typedef PermutationMatrix<Dynamic, Dynamic, Index> PermutationType;
|
typedef PermutationMatrix<Dynamic, Dynamic, Index> PermutationType;
|
||||||
typedef Matrix<Index, Dynamic, 1> IndexVector;
|
typedef Matrix<Index, Dynamic, 1> IndexVector;
|
||||||
|
|
||||||
/** Compute the permutation vector form a sparse matrix */
|
/** Compute the permutation vector \a perm form the sparse matrix \a mat
|
||||||
|
* \warning The input sparse matrix \a mat must be in compressed mode (see SparseMatrix::makeCompressed()).
|
||||||
|
*/
|
||||||
template <typename MatrixType>
|
template <typename MatrixType>
|
||||||
void operator() (const MatrixType& mat, PermutationType& perm)
|
void operator() (const MatrixType& mat, PermutationType& perm)
|
||||||
{
|
{
|
||||||
|
eigen_assert(mat.isCompressed() && "COLAMDOrdering requires a sparse matrix in compressed mode. Call .makeCompressed() before passing it to COLAMDOrdering");
|
||||||
|
|
||||||
Index m = mat.rows();
|
Index m = mat.rows();
|
||||||
Index n = mat.cols();
|
Index n = mat.cols();
|
||||||
Index nnz = mat.nonZeros();
|
Index nnz = mat.nonZeros();
|
||||||
@@ -132,12 +136,12 @@ class COLAMDOrdering
|
|||||||
Index stats [COLAMD_STATS];
|
Index stats [COLAMD_STATS];
|
||||||
internal::colamd_set_defaults(knobs);
|
internal::colamd_set_defaults(knobs);
|
||||||
|
|
||||||
Index info;
|
|
||||||
IndexVector p(n+1), A(Alen);
|
IndexVector p(n+1), A(Alen);
|
||||||
for(Index i=0; i <= n; i++) p(i) = mat.outerIndexPtr()[i];
|
for(Index i=0; i <= n; i++) p(i) = mat.outerIndexPtr()[i];
|
||||||
for(Index i=0; i < nnz; i++) A(i) = mat.innerIndexPtr()[i];
|
for(Index i=0; i < nnz; i++) A(i) = mat.innerIndexPtr()[i];
|
||||||
// Call Colamd routine to compute the ordering
|
// Call Colamd routine to compute the ordering
|
||||||
info = internal::colamd(m, n, Alen, A.data(), p.data(), knobs, stats);
|
Index info = internal::colamd(m, n, Alen, A.data(), p.data(), knobs, stats);
|
||||||
|
EIGEN_UNUSED_VARIABLE(info);
|
||||||
eigen_assert( info && "COLAMD failed " );
|
eigen_assert( info && "COLAMD failed " );
|
||||||
|
|
||||||
perm.resize(n);
|
perm.resize(n);
|
||||||
|
|||||||
@@ -219,7 +219,7 @@ class PardisoImpl
|
|||||||
void pardisoInit(int type)
|
void pardisoInit(int type)
|
||||||
{
|
{
|
||||||
m_type = type;
|
m_type = type;
|
||||||
bool symmetric = abs(m_type) < 10;
|
bool symmetric = std::abs(m_type) < 10;
|
||||||
m_iparm[0] = 1; // No solver default
|
m_iparm[0] = 1; // No solver default
|
||||||
m_iparm[1] = 3; // use Metis for the ordering
|
m_iparm[1] = 3; // use Metis for the ordering
|
||||||
m_iparm[2] = 1; // Numbers of processors, value of OMP_NUM_THREADS
|
m_iparm[2] = 1; // Numbers of processors, value of OMP_NUM_THREADS
|
||||||
|
|||||||
@@ -76,7 +76,8 @@ template<typename _MatrixType> class ColPivHouseholderQR
|
|||||||
m_colsTranspositions(),
|
m_colsTranspositions(),
|
||||||
m_temp(),
|
m_temp(),
|
||||||
m_colSqNorms(),
|
m_colSqNorms(),
|
||||||
m_isInitialized(false) {}
|
m_isInitialized(false),
|
||||||
|
m_usePrescribedThreshold(false) {}
|
||||||
|
|
||||||
/** \brief Default Constructor with memory preallocation
|
/** \brief Default Constructor with memory preallocation
|
||||||
*
|
*
|
||||||
@@ -383,6 +384,12 @@ template<typename _MatrixType> class ColPivHouseholderQR
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
static void check_template_parameters()
|
||||||
|
{
|
||||||
|
EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar);
|
||||||
|
}
|
||||||
|
|
||||||
MatrixType m_qr;
|
MatrixType m_qr;
|
||||||
HCoeffsType m_hCoeffs;
|
HCoeffsType m_hCoeffs;
|
||||||
PermutationType m_colsPermutation;
|
PermutationType m_colsPermutation;
|
||||||
@@ -421,6 +428,8 @@ typename MatrixType::RealScalar ColPivHouseholderQR<MatrixType>::logAbsDetermina
|
|||||||
template<typename MatrixType>
|
template<typename MatrixType>
|
||||||
ColPivHouseholderQR<MatrixType>& ColPivHouseholderQR<MatrixType>::compute(const MatrixType& matrix)
|
ColPivHouseholderQR<MatrixType>& ColPivHouseholderQR<MatrixType>::compute(const MatrixType& matrix)
|
||||||
{
|
{
|
||||||
|
check_template_parameters();
|
||||||
|
|
||||||
using std::abs;
|
using std::abs;
|
||||||
Index rows = matrix.rows();
|
Index rows = matrix.rows();
|
||||||
Index cols = matrix.cols();
|
Index cols = matrix.cols();
|
||||||
@@ -462,20 +471,10 @@ ColPivHouseholderQR<MatrixType>& ColPivHouseholderQR<MatrixType>::compute(const
|
|||||||
// we store that back into our table: it can't hurt to correct our table.
|
// we store that back into our table: it can't hurt to correct our table.
|
||||||
m_colSqNorms.coeffRef(biggest_col_index) = biggest_col_sq_norm;
|
m_colSqNorms.coeffRef(biggest_col_index) = biggest_col_sq_norm;
|
||||||
|
|
||||||
// if the current biggest column is smaller than epsilon times the initial biggest column,
|
// Track the number of meaningful pivots but do not stop the decomposition to make
|
||||||
// terminate to avoid generating nan/inf values.
|
// sure that the initial matrix is properly reproduced. See bug 941.
|
||||||
// Note that here, if we test instead for "biggest == 0", we get a failure every 1000 (or so)
|
if(m_nonzero_pivots==size && biggest_col_sq_norm < threshold_helper * RealScalar(rows-k))
|
||||||
// repetitions of the unit test, with the result of solve() filled with large values of the order
|
|
||||||
// of 1/(size*epsilon).
|
|
||||||
if(biggest_col_sq_norm < threshold_helper * RealScalar(rows-k))
|
|
||||||
{
|
|
||||||
m_nonzero_pivots = k;
|
m_nonzero_pivots = k;
|
||||||
m_hCoeffs.tail(size-k).setZero();
|
|
||||||
m_qr.bottomRightCorner(rows-k,cols-k)
|
|
||||||
.template triangularView<StrictlyLower>()
|
|
||||||
.setZero();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// apply the transposition to the columns
|
// apply the transposition to the columns
|
||||||
m_colsTranspositions.coeffRef(k) = biggest_col_index;
|
m_colsTranspositions.coeffRef(k) = biggest_col_index;
|
||||||
@@ -504,7 +503,7 @@ ColPivHouseholderQR<MatrixType>& ColPivHouseholderQR<MatrixType>::compute(const
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_colsPermutation.setIdentity(PermIndexType(cols));
|
m_colsPermutation.setIdentity(PermIndexType(cols));
|
||||||
for(PermIndexType k = 0; k < m_nonzero_pivots; ++k)
|
for(PermIndexType k = 0; k < size/*m_nonzero_pivots*/; ++k)
|
||||||
m_colsPermutation.applyTranspositionOnTheRight(k, PermIndexType(m_colsTranspositions.coeff(k)));
|
m_colsPermutation.applyTranspositionOnTheRight(k, PermIndexType(m_colsTranspositions.coeff(k)));
|
||||||
|
|
||||||
m_det_pq = (number_of_transpositions%2) ? -1 : 1;
|
m_det_pq = (number_of_transpositions%2) ? -1 : 1;
|
||||||
@@ -554,13 +553,15 @@ struct solve_retval<ColPivHouseholderQR<_MatrixType>, Rhs>
|
|||||||
|
|
||||||
} // end namespace internal
|
} // end namespace internal
|
||||||
|
|
||||||
/** \returns the matrix Q as a sequence of householder transformations */
|
/** \returns the matrix Q as a sequence of householder transformations.
|
||||||
|
* You can extract the meaningful part only by using:
|
||||||
|
* \code qr.householderQ().setLength(qr.nonzeroPivots()) \endcode*/
|
||||||
template<typename MatrixType>
|
template<typename MatrixType>
|
||||||
typename ColPivHouseholderQR<MatrixType>::HouseholderSequenceType ColPivHouseholderQR<MatrixType>
|
typename ColPivHouseholderQR<MatrixType>::HouseholderSequenceType ColPivHouseholderQR<MatrixType>
|
||||||
::householderQ() const
|
::householderQ() const
|
||||||
{
|
{
|
||||||
eigen_assert(m_isInitialized && "ColPivHouseholderQR is not initialized.");
|
eigen_assert(m_isInitialized && "ColPivHouseholderQR is not initialized.");
|
||||||
return HouseholderSequenceType(m_qr, m_hCoeffs.conjugate()).setLength(m_nonzero_pivots);
|
return HouseholderSequenceType(m_qr, m_hCoeffs.conjugate());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** \return the column-pivoting Householder QR decomposition of \c *this.
|
/** \return the column-pivoting Householder QR decomposition of \c *this.
|
||||||
|
|||||||
@@ -368,6 +368,12 @@ template<typename _MatrixType> class FullPivHouseholderQR
|
|||||||
RealScalar maxPivot() const { return m_maxpivot; }
|
RealScalar maxPivot() const { return m_maxpivot; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
static void check_template_parameters()
|
||||||
|
{
|
||||||
|
EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar);
|
||||||
|
}
|
||||||
|
|
||||||
MatrixType m_qr;
|
MatrixType m_qr;
|
||||||
HCoeffsType m_hCoeffs;
|
HCoeffsType m_hCoeffs;
|
||||||
IntDiagSizeVectorType m_rows_transpositions;
|
IntDiagSizeVectorType m_rows_transpositions;
|
||||||
@@ -407,6 +413,8 @@ typename MatrixType::RealScalar FullPivHouseholderQR<MatrixType>::logAbsDetermin
|
|||||||
template<typename MatrixType>
|
template<typename MatrixType>
|
||||||
FullPivHouseholderQR<MatrixType>& FullPivHouseholderQR<MatrixType>::compute(const MatrixType& matrix)
|
FullPivHouseholderQR<MatrixType>& FullPivHouseholderQR<MatrixType>::compute(const MatrixType& matrix)
|
||||||
{
|
{
|
||||||
|
check_template_parameters();
|
||||||
|
|
||||||
using std::abs;
|
using std::abs;
|
||||||
Index rows = matrix.rows();
|
Index rows = matrix.rows();
|
||||||
Index cols = matrix.cols();
|
Index cols = matrix.cols();
|
||||||
|
|||||||
@@ -189,6 +189,12 @@ template<typename _MatrixType> class HouseholderQR
|
|||||||
const HCoeffsType& hCoeffs() const { return m_hCoeffs; }
|
const HCoeffsType& hCoeffs() const { return m_hCoeffs; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
static void check_template_parameters()
|
||||||
|
{
|
||||||
|
EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar);
|
||||||
|
}
|
||||||
|
|
||||||
MatrixType m_qr;
|
MatrixType m_qr;
|
||||||
HCoeffsType m_hCoeffs;
|
HCoeffsType m_hCoeffs;
|
||||||
RowVectorType m_temp;
|
RowVectorType m_temp;
|
||||||
@@ -251,56 +257,62 @@ void householder_qr_inplace_unblocked(MatrixQR& mat, HCoeffs& hCoeffs, typename
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** \internal */
|
/** \internal */
|
||||||
template<typename MatrixQR, typename HCoeffs>
|
template<typename MatrixQR, typename HCoeffs,
|
||||||
void householder_qr_inplace_blocked(MatrixQR& mat, HCoeffs& hCoeffs,
|
typename MatrixQRScalar = typename MatrixQR::Scalar,
|
||||||
typename MatrixQR::Index maxBlockSize=32,
|
bool InnerStrideIsOne = (MatrixQR::InnerStrideAtCompileTime == 1 && HCoeffs::InnerStrideAtCompileTime == 1)>
|
||||||
typename MatrixQR::Scalar* tempData = 0)
|
struct householder_qr_inplace_blocked
|
||||||
{
|
{
|
||||||
typedef typename MatrixQR::Index Index;
|
// This is specialized for MKL-supported Scalar types in HouseholderQR_MKL.h
|
||||||
typedef typename MatrixQR::Scalar Scalar;
|
static void run(MatrixQR& mat, HCoeffs& hCoeffs,
|
||||||
typedef Block<MatrixQR,Dynamic,Dynamic> BlockType;
|
typename MatrixQR::Index maxBlockSize=32,
|
||||||
|
typename MatrixQR::Scalar* tempData = 0)
|
||||||
Index rows = mat.rows();
|
|
||||||
Index cols = mat.cols();
|
|
||||||
Index size = (std::min)(rows, cols);
|
|
||||||
|
|
||||||
typedef Matrix<Scalar,Dynamic,1,ColMajor,MatrixQR::MaxColsAtCompileTime,1> TempType;
|
|
||||||
TempType tempVector;
|
|
||||||
if(tempData==0)
|
|
||||||
{
|
{
|
||||||
tempVector.resize(cols);
|
typedef typename MatrixQR::Index Index;
|
||||||
tempData = tempVector.data();
|
typedef typename MatrixQR::Scalar Scalar;
|
||||||
}
|
typedef Block<MatrixQR,Dynamic,Dynamic> BlockType;
|
||||||
|
|
||||||
Index blockSize = (std::min)(maxBlockSize,size);
|
Index rows = mat.rows();
|
||||||
|
Index cols = mat.cols();
|
||||||
|
Index size = (std::min)(rows, cols);
|
||||||
|
|
||||||
Index k = 0;
|
typedef Matrix<Scalar,Dynamic,1,ColMajor,MatrixQR::MaxColsAtCompileTime,1> TempType;
|
||||||
for (k = 0; k < size; k += blockSize)
|
TempType tempVector;
|
||||||
{
|
if(tempData==0)
|
||||||
Index bs = (std::min)(size-k,blockSize); // actual size of the block
|
|
||||||
Index tcols = cols - k - bs; // trailing columns
|
|
||||||
Index brows = rows-k; // rows of the block
|
|
||||||
|
|
||||||
// partition the matrix:
|
|
||||||
// A00 | A01 | A02
|
|
||||||
// mat = A10 | A11 | A12
|
|
||||||
// A20 | A21 | A22
|
|
||||||
// and performs the qr dec of [A11^T A12^T]^T
|
|
||||||
// and update [A21^T A22^T]^T using level 3 operations.
|
|
||||||
// Finally, the algorithm continue on A22
|
|
||||||
|
|
||||||
BlockType A11_21 = mat.block(k,k,brows,bs);
|
|
||||||
Block<HCoeffs,Dynamic,1> hCoeffsSegment = hCoeffs.segment(k,bs);
|
|
||||||
|
|
||||||
householder_qr_inplace_unblocked(A11_21, hCoeffsSegment, tempData);
|
|
||||||
|
|
||||||
if(tcols)
|
|
||||||
{
|
{
|
||||||
BlockType A21_22 = mat.block(k,k+bs,brows,tcols);
|
tempVector.resize(cols);
|
||||||
apply_block_householder_on_the_left(A21_22,A11_21,hCoeffsSegment.adjoint());
|
tempData = tempVector.data();
|
||||||
|
}
|
||||||
|
|
||||||
|
Index blockSize = (std::min)(maxBlockSize,size);
|
||||||
|
|
||||||
|
Index k = 0;
|
||||||
|
for (k = 0; k < size; k += blockSize)
|
||||||
|
{
|
||||||
|
Index bs = (std::min)(size-k,blockSize); // actual size of the block
|
||||||
|
Index tcols = cols - k - bs; // trailing columns
|
||||||
|
Index brows = rows-k; // rows of the block
|
||||||
|
|
||||||
|
// partition the matrix:
|
||||||
|
// A00 | A01 | A02
|
||||||
|
// mat = A10 | A11 | A12
|
||||||
|
// A20 | A21 | A22
|
||||||
|
// and performs the qr dec of [A11^T A12^T]^T
|
||||||
|
// and update [A21^T A22^T]^T using level 3 operations.
|
||||||
|
// Finally, the algorithm continue on A22
|
||||||
|
|
||||||
|
BlockType A11_21 = mat.block(k,k,brows,bs);
|
||||||
|
Block<HCoeffs,Dynamic,1> hCoeffsSegment = hCoeffs.segment(k,bs);
|
||||||
|
|
||||||
|
householder_qr_inplace_unblocked(A11_21, hCoeffsSegment, tempData);
|
||||||
|
|
||||||
|
if(tcols)
|
||||||
|
{
|
||||||
|
BlockType A21_22 = mat.block(k,k+bs,brows,tcols);
|
||||||
|
apply_block_householder_on_the_left(A21_22,A11_21,hCoeffsSegment.adjoint());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
template<typename _MatrixType, typename Rhs>
|
template<typename _MatrixType, typename Rhs>
|
||||||
struct solve_retval<HouseholderQR<_MatrixType>, Rhs>
|
struct solve_retval<HouseholderQR<_MatrixType>, Rhs>
|
||||||
@@ -343,6 +355,8 @@ struct solve_retval<HouseholderQR<_MatrixType>, Rhs>
|
|||||||
template<typename MatrixType>
|
template<typename MatrixType>
|
||||||
HouseholderQR<MatrixType>& HouseholderQR<MatrixType>::compute(const MatrixType& matrix)
|
HouseholderQR<MatrixType>& HouseholderQR<MatrixType>::compute(const MatrixType& matrix)
|
||||||
{
|
{
|
||||||
|
check_template_parameters();
|
||||||
|
|
||||||
Index rows = matrix.rows();
|
Index rows = matrix.rows();
|
||||||
Index cols = matrix.cols();
|
Index cols = matrix.cols();
|
||||||
Index size = (std::min)(rows,cols);
|
Index size = (std::min)(rows,cols);
|
||||||
@@ -352,7 +366,7 @@ HouseholderQR<MatrixType>& HouseholderQR<MatrixType>::compute(const MatrixType&
|
|||||||
|
|
||||||
m_temp.resize(cols);
|
m_temp.resize(cols);
|
||||||
|
|
||||||
internal::householder_qr_inplace_blocked(m_qr, m_hCoeffs, 48, m_temp.data());
|
internal::householder_qr_inplace_blocked<MatrixType, HCoeffsType>::run(m_qr, m_hCoeffs, 48, m_temp.data());
|
||||||
|
|
||||||
m_isInitialized = true;
|
m_isInitialized = true;
|
||||||
return *this;
|
return *this;
|
||||||
|
|||||||
@@ -34,28 +34,30 @@
|
|||||||
#ifndef EIGEN_QR_MKL_H
|
#ifndef EIGEN_QR_MKL_H
|
||||||
#define EIGEN_QR_MKL_H
|
#define EIGEN_QR_MKL_H
|
||||||
|
|
||||||
#include "Eigen/src/Core/util/MKL_support.h"
|
#include "../Core/util/MKL_support.h"
|
||||||
|
|
||||||
namespace Eigen {
|
namespace Eigen {
|
||||||
|
|
||||||
namespace internal {
|
namespace internal {
|
||||||
|
|
||||||
/** \internal Specialization for the data types supported by MKL */
|
/** \internal Specialization for the data types supported by MKL */
|
||||||
|
|
||||||
#define EIGEN_MKL_QR_NOPIV(EIGTYPE, MKLTYPE, MKLPREFIX) \
|
#define EIGEN_MKL_QR_NOPIV(EIGTYPE, MKLTYPE, MKLPREFIX) \
|
||||||
template<typename MatrixQR, typename HCoeffs> \
|
template<typename MatrixQR, typename HCoeffs> \
|
||||||
void householder_qr_inplace_blocked(MatrixQR& mat, HCoeffs& hCoeffs, \
|
struct householder_qr_inplace_blocked<MatrixQR, HCoeffs, EIGTYPE, true> \
|
||||||
typename MatrixQR::Index maxBlockSize=32, \
|
|
||||||
EIGTYPE* tempData = 0) \
|
|
||||||
{ \
|
{ \
|
||||||
lapack_int m = mat.rows(); \
|
static void run(MatrixQR& mat, HCoeffs& hCoeffs, \
|
||||||
lapack_int n = mat.cols(); \
|
typename MatrixQR::Index = 32, \
|
||||||
lapack_int lda = mat.outerStride(); \
|
typename MatrixQR::Scalar* = 0) \
|
||||||
lapack_int matrix_order = (MatrixQR::IsRowMajor) ? LAPACK_ROW_MAJOR : LAPACK_COL_MAJOR; \
|
{ \
|
||||||
LAPACKE_##MKLPREFIX##geqrf( matrix_order, m, n, (MKLTYPE*)mat.data(), lda, (MKLTYPE*)hCoeffs.data()); \
|
lapack_int m = (lapack_int) mat.rows(); \
|
||||||
hCoeffs.adjointInPlace(); \
|
lapack_int n = (lapack_int) mat.cols(); \
|
||||||
\
|
lapack_int lda = (lapack_int) mat.outerStride(); \
|
||||||
}
|
lapack_int matrix_order = (MatrixQR::IsRowMajor) ? LAPACK_ROW_MAJOR : LAPACK_COL_MAJOR; \
|
||||||
|
LAPACKE_##MKLPREFIX##geqrf( matrix_order, m, n, (MKLTYPE*)mat.data(), lda, (MKLTYPE*)hCoeffs.data()); \
|
||||||
|
hCoeffs.adjointInPlace(); \
|
||||||
|
} \
|
||||||
|
};
|
||||||
|
|
||||||
EIGEN_MKL_QR_NOPIV(double, double, d)
|
EIGEN_MKL_QR_NOPIV(double, double, d)
|
||||||
EIGEN_MKL_QR_NOPIV(float, float, s)
|
EIGEN_MKL_QR_NOPIV(float, float, s)
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ namespace Eigen {
|
|||||||
* You can then apply it to a vector.
|
* You can then apply it to a vector.
|
||||||
*
|
*
|
||||||
* R is the sparse triangular factor. Use matrixQR() to get it as SparseMatrix.
|
* R is the sparse triangular factor. Use matrixQR() to get it as SparseMatrix.
|
||||||
* NOTE : The Index type of R is always UF_long. You can get it with SPQR::Index
|
* NOTE : The Index type of R is always SuiteSparse_long. You can get it with SPQR::Index
|
||||||
*
|
*
|
||||||
* \tparam _MatrixType The type of the sparse matrix A, must be a column-major SparseMatrix<>
|
* \tparam _MatrixType The type of the sparse matrix A, must be a column-major SparseMatrix<>
|
||||||
* NOTE
|
* NOTE
|
||||||
@@ -59,24 +59,18 @@ class SPQR
|
|||||||
public:
|
public:
|
||||||
typedef typename _MatrixType::Scalar Scalar;
|
typedef typename _MatrixType::Scalar Scalar;
|
||||||
typedef typename _MatrixType::RealScalar RealScalar;
|
typedef typename _MatrixType::RealScalar RealScalar;
|
||||||
typedef UF_long Index ;
|
typedef SuiteSparse_long Index ;
|
||||||
typedef SparseMatrix<Scalar, ColMajor, Index> MatrixType;
|
typedef SparseMatrix<Scalar, ColMajor, Index> MatrixType;
|
||||||
typedef PermutationMatrix<Dynamic, Dynamic> PermutationType;
|
typedef PermutationMatrix<Dynamic, Dynamic> PermutationType;
|
||||||
public:
|
public:
|
||||||
SPQR()
|
SPQR()
|
||||||
: m_isInitialized(false),
|
: m_isInitialized(false), m_ordering(SPQR_ORDERING_DEFAULT), m_allow_tol(SPQR_DEFAULT_TOL), m_tolerance (NumTraits<Scalar>::epsilon()), m_useDefaultThreshold(true)
|
||||||
m_ordering(SPQR_ORDERING_DEFAULT),
|
|
||||||
m_allow_tol(SPQR_DEFAULT_TOL),
|
|
||||||
m_tolerance (NumTraits<Scalar>::epsilon())
|
|
||||||
{
|
{
|
||||||
cholmod_l_start(&m_cc);
|
cholmod_l_start(&m_cc);
|
||||||
}
|
}
|
||||||
|
|
||||||
SPQR(const _MatrixType& matrix)
|
SPQR(const _MatrixType& matrix)
|
||||||
: m_isInitialized(false),
|
: m_isInitialized(false), m_ordering(SPQR_ORDERING_DEFAULT), m_allow_tol(SPQR_DEFAULT_TOL), m_tolerance (NumTraits<Scalar>::epsilon()), m_useDefaultThreshold(true)
|
||||||
m_ordering(SPQR_ORDERING_DEFAULT),
|
|
||||||
m_allow_tol(SPQR_DEFAULT_TOL),
|
|
||||||
m_tolerance (NumTraits<Scalar>::epsilon())
|
|
||||||
{
|
{
|
||||||
cholmod_l_start(&m_cc);
|
cholmod_l_start(&m_cc);
|
||||||
compute(matrix);
|
compute(matrix);
|
||||||
@@ -101,10 +95,26 @@ class SPQR
|
|||||||
if(m_isInitialized) SPQR_free();
|
if(m_isInitialized) SPQR_free();
|
||||||
|
|
||||||
MatrixType mat(matrix);
|
MatrixType mat(matrix);
|
||||||
|
|
||||||
|
/* Compute the default threshold as in MatLab, see:
|
||||||
|
* Tim Davis, "Algorithm 915, SuiteSparseQR: Multifrontal Multithreaded Rank-Revealing
|
||||||
|
* Sparse QR Factorization, ACM Trans. on Math. Soft. 38(1), 2011, Page 8:3
|
||||||
|
*/
|
||||||
|
RealScalar pivotThreshold = m_tolerance;
|
||||||
|
if(m_useDefaultThreshold)
|
||||||
|
{
|
||||||
|
using std::max;
|
||||||
|
RealScalar max2Norm = 0.0;
|
||||||
|
for (int j = 0; j < mat.cols(); j++) max2Norm = (max)(max2Norm, mat.col(j).norm());
|
||||||
|
if(max2Norm==RealScalar(0))
|
||||||
|
max2Norm = RealScalar(1);
|
||||||
|
pivotThreshold = 20 * (mat.rows() + mat.cols()) * max2Norm * NumTraits<RealScalar>::epsilon();
|
||||||
|
}
|
||||||
|
|
||||||
cholmod_sparse A;
|
cholmod_sparse A;
|
||||||
A = viewAsCholmod(mat);
|
A = viewAsCholmod(mat);
|
||||||
Index col = matrix.cols();
|
Index col = matrix.cols();
|
||||||
m_rank = SuiteSparseQR<Scalar>(m_ordering, m_tolerance, col, &A,
|
m_rank = SuiteSparseQR<Scalar>(m_ordering, pivotThreshold, col, &A,
|
||||||
&m_cR, &m_E, &m_H, &m_HPinv, &m_HTau, &m_cc);
|
&m_cR, &m_E, &m_H, &m_HPinv, &m_HTau, &m_cc);
|
||||||
|
|
||||||
if (!m_cR)
|
if (!m_cR)
|
||||||
@@ -120,7 +130,7 @@ class SPQR
|
|||||||
/**
|
/**
|
||||||
* Get the number of rows of the input matrix and the Q matrix
|
* Get the number of rows of the input matrix and the Q matrix
|
||||||
*/
|
*/
|
||||||
inline Index rows() const {return m_H->nrow; }
|
inline Index rows() const {return m_cR->nrow; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the number of columns of the input matrix.
|
* Get the number of columns of the input matrix.
|
||||||
@@ -145,16 +155,25 @@ class SPQR
|
|||||||
{
|
{
|
||||||
eigen_assert(m_isInitialized && " The QR factorization should be computed first, call compute()");
|
eigen_assert(m_isInitialized && " The QR factorization should be computed first, call compute()");
|
||||||
eigen_assert(b.cols()==1 && "This method is for vectors only");
|
eigen_assert(b.cols()==1 && "This method is for vectors only");
|
||||||
|
|
||||||
//Compute Q^T * b
|
//Compute Q^T * b
|
||||||
typename Dest::PlainObject y;
|
typename Dest::PlainObject y, y2;
|
||||||
y = matrixQ().transpose() * b;
|
y = matrixQ().transpose() * b;
|
||||||
// Solves with the triangular matrix R
|
|
||||||
|
// Solves with the triangular matrix R
|
||||||
Index rk = this->rank();
|
Index rk = this->rank();
|
||||||
y.topRows(rk) = this->matrixR().topLeftCorner(rk, rk).template triangularView<Upper>().solve(y.topRows(rk));
|
y2 = y;
|
||||||
y.bottomRows(cols()-rk).setZero();
|
y.resize((std::max)(cols(),Index(y.rows())),y.cols());
|
||||||
|
y.topRows(rk) = this->matrixR().topLeftCorner(rk, rk).template triangularView<Upper>().solve(y2.topRows(rk));
|
||||||
|
|
||||||
// Apply the column permutation
|
// Apply the column permutation
|
||||||
dest.topRows(cols()) = colsPermutation() * y.topRows(cols());
|
// colsPermutation() performs a copy of the permutation,
|
||||||
|
// so let's apply it manually:
|
||||||
|
for(Index i = 0; i < rk; ++i) dest.row(m_E[i]) = y.row(i);
|
||||||
|
for(Index i = rk; i < cols(); ++i) dest.row(m_E[i]).setZero();
|
||||||
|
|
||||||
|
// y.bottomRows(y.rows()-rk).setZero();
|
||||||
|
// dest = colsPermutation() * y.topRows(cols());
|
||||||
|
|
||||||
m_info = Success;
|
m_info = Success;
|
||||||
}
|
}
|
||||||
@@ -197,7 +216,11 @@ class SPQR
|
|||||||
/// Set the fill-reducing ordering method to be used
|
/// Set the fill-reducing ordering method to be used
|
||||||
void setSPQROrdering(int ord) { m_ordering = ord;}
|
void setSPQROrdering(int ord) { m_ordering = ord;}
|
||||||
/// Set the tolerance tol to treat columns with 2-norm < =tol as zero
|
/// Set the tolerance tol to treat columns with 2-norm < =tol as zero
|
||||||
void setPivotThreshold(const RealScalar& tol) { m_tolerance = tol; }
|
void setPivotThreshold(const RealScalar& tol)
|
||||||
|
{
|
||||||
|
m_useDefaultThreshold = false;
|
||||||
|
m_tolerance = tol;
|
||||||
|
}
|
||||||
|
|
||||||
/** \returns a pointer to the SPQR workspace */
|
/** \returns a pointer to the SPQR workspace */
|
||||||
cholmod_common *cholmodCommon() const { return &m_cc; }
|
cholmod_common *cholmodCommon() const { return &m_cc; }
|
||||||
@@ -230,6 +253,7 @@ class SPQR
|
|||||||
mutable cholmod_dense *m_HTau; // The Householder coefficients
|
mutable cholmod_dense *m_HTau; // The Householder coefficients
|
||||||
mutable Index m_rank; // The rank of the matrix
|
mutable Index m_rank; // The rank of the matrix
|
||||||
mutable cholmod_common m_cc; // Workspace and parameters
|
mutable cholmod_common m_cc; // Workspace and parameters
|
||||||
|
bool m_useDefaultThreshold; // Use default threshold
|
||||||
template<typename ,typename > friend struct SPQR_QProduct;
|
template<typename ,typename > friend struct SPQR_QProduct;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -375,17 +375,19 @@ struct svd_precondition_2x2_block_to_be_real<MatrixType, QRPreconditioner, true>
|
|||||||
Scalar z;
|
Scalar z;
|
||||||
JacobiRotation<Scalar> rot;
|
JacobiRotation<Scalar> rot;
|
||||||
RealScalar n = sqrt(numext::abs2(work_matrix.coeff(p,p)) + numext::abs2(work_matrix.coeff(q,p)));
|
RealScalar n = sqrt(numext::abs2(work_matrix.coeff(p,p)) + numext::abs2(work_matrix.coeff(q,p)));
|
||||||
|
|
||||||
if(n==0)
|
if(n==0)
|
||||||
{
|
{
|
||||||
z = abs(work_matrix.coeff(p,q)) / work_matrix.coeff(p,q);
|
z = abs(work_matrix.coeff(p,q)) / work_matrix.coeff(p,q);
|
||||||
work_matrix.row(p) *= z;
|
work_matrix.row(p) *= z;
|
||||||
if(svd.computeU()) svd.m_matrixU.col(p) *= conj(z);
|
if(svd.computeU()) svd.m_matrixU.col(p) *= conj(z);
|
||||||
if(work_matrix.coeff(q,q)!=Scalar(0))
|
if(work_matrix.coeff(q,q)!=Scalar(0))
|
||||||
|
{
|
||||||
z = abs(work_matrix.coeff(q,q)) / work_matrix.coeff(q,q);
|
z = abs(work_matrix.coeff(q,q)) / work_matrix.coeff(q,q);
|
||||||
else
|
work_matrix.row(q) *= z;
|
||||||
z = Scalar(0);
|
if(svd.computeU()) svd.m_matrixU.col(q) *= conj(z);
|
||||||
work_matrix.row(q) *= z;
|
}
|
||||||
if(svd.computeU()) svd.m_matrixU.col(q) *= conj(z);
|
// otherwise the second row is already zero, so we have nothing to do.
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -415,6 +417,7 @@ void real_2x2_jacobi_svd(const MatrixType& matrix, Index p, Index q,
|
|||||||
JacobiRotation<RealScalar> *j_right)
|
JacobiRotation<RealScalar> *j_right)
|
||||||
{
|
{
|
||||||
using std::sqrt;
|
using std::sqrt;
|
||||||
|
using std::abs;
|
||||||
Matrix<RealScalar,2,2> m;
|
Matrix<RealScalar,2,2> m;
|
||||||
m << numext::real(matrix.coeff(p,p)), numext::real(matrix.coeff(p,q)),
|
m << numext::real(matrix.coeff(p,p)), numext::real(matrix.coeff(p,q)),
|
||||||
numext::real(matrix.coeff(q,p)), numext::real(matrix.coeff(q,q));
|
numext::real(matrix.coeff(q,p)), numext::real(matrix.coeff(q,q));
|
||||||
@@ -428,9 +431,11 @@ void real_2x2_jacobi_svd(const MatrixType& matrix, Index p, Index q,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
RealScalar u = d / t;
|
RealScalar t2d2 = numext::hypot(t,d);
|
||||||
rot1.c() = RealScalar(1) / sqrt(RealScalar(1) + numext::abs2(u));
|
rot1.c() = abs(t)/t2d2;
|
||||||
rot1.s() = rot1.c() * u;
|
rot1.s() = d/t2d2;
|
||||||
|
if(t<RealScalar(0))
|
||||||
|
rot1.s() = -rot1.s();
|
||||||
}
|
}
|
||||||
m.applyOnTheLeft(0,1,rot1);
|
m.applyOnTheLeft(0,1,rot1);
|
||||||
j_right->makeJacobi(m,0,1);
|
j_right->makeJacobi(m,0,1);
|
||||||
@@ -531,8 +536,9 @@ template<typename _MatrixType, int QRPreconditioner> class JacobiSVD
|
|||||||
JacobiSVD()
|
JacobiSVD()
|
||||||
: m_isInitialized(false),
|
: m_isInitialized(false),
|
||||||
m_isAllocated(false),
|
m_isAllocated(false),
|
||||||
|
m_usePrescribedThreshold(false),
|
||||||
m_computationOptions(0),
|
m_computationOptions(0),
|
||||||
m_rows(-1), m_cols(-1)
|
m_rows(-1), m_cols(-1), m_diagSize(0)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@@ -545,6 +551,7 @@ template<typename _MatrixType, int QRPreconditioner> class JacobiSVD
|
|||||||
JacobiSVD(Index rows, Index cols, unsigned int computationOptions = 0)
|
JacobiSVD(Index rows, Index cols, unsigned int computationOptions = 0)
|
||||||
: m_isInitialized(false),
|
: m_isInitialized(false),
|
||||||
m_isAllocated(false),
|
m_isAllocated(false),
|
||||||
|
m_usePrescribedThreshold(false),
|
||||||
m_computationOptions(0),
|
m_computationOptions(0),
|
||||||
m_rows(-1), m_cols(-1)
|
m_rows(-1), m_cols(-1)
|
||||||
{
|
{
|
||||||
@@ -564,6 +571,7 @@ template<typename _MatrixType, int QRPreconditioner> class JacobiSVD
|
|||||||
JacobiSVD(const MatrixType& matrix, unsigned int computationOptions = 0)
|
JacobiSVD(const MatrixType& matrix, unsigned int computationOptions = 0)
|
||||||
: m_isInitialized(false),
|
: m_isInitialized(false),
|
||||||
m_isAllocated(false),
|
m_isAllocated(false),
|
||||||
|
m_usePrescribedThreshold(false),
|
||||||
m_computationOptions(0),
|
m_computationOptions(0),
|
||||||
m_rows(-1), m_cols(-1)
|
m_rows(-1), m_cols(-1)
|
||||||
{
|
{
|
||||||
@@ -665,23 +673,92 @@ template<typename _MatrixType, int QRPreconditioner> class JacobiSVD
|
|||||||
eigen_assert(m_isInitialized && "JacobiSVD is not initialized.");
|
eigen_assert(m_isInitialized && "JacobiSVD is not initialized.");
|
||||||
return m_nonzeroSingularValues;
|
return m_nonzeroSingularValues;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** \returns the rank of the matrix of which \c *this is the SVD.
|
||||||
|
*
|
||||||
|
* \note This method has to determine which singular values should be considered nonzero.
|
||||||
|
* For that, it uses the threshold value that you can control by calling
|
||||||
|
* setThreshold(const RealScalar&).
|
||||||
|
*/
|
||||||
|
inline Index rank() const
|
||||||
|
{
|
||||||
|
using std::abs;
|
||||||
|
eigen_assert(m_isInitialized && "JacobiSVD is not initialized.");
|
||||||
|
if(m_singularValues.size()==0) return 0;
|
||||||
|
RealScalar premultiplied_threshold = m_singularValues.coeff(0) * threshold();
|
||||||
|
Index i = m_nonzeroSingularValues-1;
|
||||||
|
while(i>=0 && m_singularValues.coeff(i) < premultiplied_threshold) --i;
|
||||||
|
return i+1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Allows to prescribe a threshold to be used by certain methods, such as rank() and solve(),
|
||||||
|
* which need to determine when singular values are to be considered nonzero.
|
||||||
|
* This is not used for the SVD decomposition itself.
|
||||||
|
*
|
||||||
|
* When it needs to get the threshold value, Eigen calls threshold().
|
||||||
|
* The default is \c NumTraits<Scalar>::epsilon()
|
||||||
|
*
|
||||||
|
* \param threshold The new value to use as the threshold.
|
||||||
|
*
|
||||||
|
* A singular value will be considered nonzero if its value is strictly greater than
|
||||||
|
* \f$ \vert singular value \vert \leqslant threshold \times \vert max singular value \vert \f$.
|
||||||
|
*
|
||||||
|
* If you want to come back to the default behavior, call setThreshold(Default_t)
|
||||||
|
*/
|
||||||
|
JacobiSVD& setThreshold(const RealScalar& threshold)
|
||||||
|
{
|
||||||
|
m_usePrescribedThreshold = true;
|
||||||
|
m_prescribedThreshold = threshold;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Allows to come back to the default behavior, letting Eigen use its default formula for
|
||||||
|
* determining the threshold.
|
||||||
|
*
|
||||||
|
* You should pass the special object Eigen::Default as parameter here.
|
||||||
|
* \code svd.setThreshold(Eigen::Default); \endcode
|
||||||
|
*
|
||||||
|
* See the documentation of setThreshold(const RealScalar&).
|
||||||
|
*/
|
||||||
|
JacobiSVD& setThreshold(Default_t)
|
||||||
|
{
|
||||||
|
m_usePrescribedThreshold = false;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Returns the threshold that will be used by certain methods such as rank().
|
||||||
|
*
|
||||||
|
* See the documentation of setThreshold(const RealScalar&).
|
||||||
|
*/
|
||||||
|
RealScalar threshold() const
|
||||||
|
{
|
||||||
|
eigen_assert(m_isInitialized || m_usePrescribedThreshold);
|
||||||
|
return m_usePrescribedThreshold ? m_prescribedThreshold
|
||||||
|
: (std::max<Index>)(1,m_diagSize)*NumTraits<Scalar>::epsilon();
|
||||||
|
}
|
||||||
|
|
||||||
inline Index rows() const { return m_rows; }
|
inline Index rows() const { return m_rows; }
|
||||||
inline Index cols() const { return m_cols; }
|
inline Index cols() const { return m_cols; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void allocate(Index rows, Index cols, unsigned int computationOptions);
|
void allocate(Index rows, Index cols, unsigned int computationOptions);
|
||||||
|
|
||||||
|
static void check_template_parameters()
|
||||||
|
{
|
||||||
|
EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar);
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
MatrixUType m_matrixU;
|
MatrixUType m_matrixU;
|
||||||
MatrixVType m_matrixV;
|
MatrixVType m_matrixV;
|
||||||
SingularValuesType m_singularValues;
|
SingularValuesType m_singularValues;
|
||||||
WorkMatrixType m_workMatrix;
|
WorkMatrixType m_workMatrix;
|
||||||
bool m_isInitialized, m_isAllocated;
|
bool m_isInitialized, m_isAllocated, m_usePrescribedThreshold;
|
||||||
bool m_computeFullU, m_computeThinU;
|
bool m_computeFullU, m_computeThinU;
|
||||||
bool m_computeFullV, m_computeThinV;
|
bool m_computeFullV, m_computeThinV;
|
||||||
unsigned int m_computationOptions;
|
unsigned int m_computationOptions;
|
||||||
Index m_nonzeroSingularValues, m_rows, m_cols, m_diagSize;
|
Index m_nonzeroSingularValues, m_rows, m_cols, m_diagSize;
|
||||||
|
RealScalar m_prescribedThreshold;
|
||||||
|
|
||||||
template<typename __MatrixType, int _QRPreconditioner, bool _IsComplex>
|
template<typename __MatrixType, int _QRPreconditioner, bool _IsComplex>
|
||||||
friend struct internal::svd_precondition_2x2_block_to_be_real;
|
friend struct internal::svd_precondition_2x2_block_to_be_real;
|
||||||
@@ -690,6 +767,7 @@ template<typename _MatrixType, int QRPreconditioner> class JacobiSVD
|
|||||||
|
|
||||||
internal::qr_preconditioner_impl<MatrixType, QRPreconditioner, internal::PreconditionIfMoreColsThanRows> m_qr_precond_morecols;
|
internal::qr_preconditioner_impl<MatrixType, QRPreconditioner, internal::PreconditionIfMoreColsThanRows> m_qr_precond_morecols;
|
||||||
internal::qr_preconditioner_impl<MatrixType, QRPreconditioner, internal::PreconditionIfMoreRowsThanCols> m_qr_precond_morerows;
|
internal::qr_preconditioner_impl<MatrixType, QRPreconditioner, internal::PreconditionIfMoreRowsThanCols> m_qr_precond_morerows;
|
||||||
|
MatrixType m_scaledMatrix;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename MatrixType, int QRPreconditioner>
|
template<typename MatrixType, int QRPreconditioner>
|
||||||
@@ -736,14 +814,17 @@ void JacobiSVD<MatrixType, QRPreconditioner>::allocate(Index rows, Index cols, u
|
|||||||
: 0);
|
: 0);
|
||||||
m_workMatrix.resize(m_diagSize, m_diagSize);
|
m_workMatrix.resize(m_diagSize, m_diagSize);
|
||||||
|
|
||||||
if(m_cols>m_rows) m_qr_precond_morecols.allocate(*this);
|
if(m_cols>m_rows) m_qr_precond_morecols.allocate(*this);
|
||||||
if(m_rows>m_cols) m_qr_precond_morerows.allocate(*this);
|
if(m_rows>m_cols) m_qr_precond_morerows.allocate(*this);
|
||||||
|
if(m_cols!=m_cols) m_scaledMatrix.resize(rows,cols);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename MatrixType, int QRPreconditioner>
|
template<typename MatrixType, int QRPreconditioner>
|
||||||
JacobiSVD<MatrixType, QRPreconditioner>&
|
JacobiSVD<MatrixType, QRPreconditioner>&
|
||||||
JacobiSVD<MatrixType, QRPreconditioner>::compute(const MatrixType& matrix, unsigned int computationOptions)
|
JacobiSVD<MatrixType, QRPreconditioner>::compute(const MatrixType& matrix, unsigned int computationOptions)
|
||||||
{
|
{
|
||||||
|
check_template_parameters();
|
||||||
|
|
||||||
using std::abs;
|
using std::abs;
|
||||||
allocate(matrix.rows(), matrix.cols(), computationOptions);
|
allocate(matrix.rows(), matrix.cols(), computationOptions);
|
||||||
|
|
||||||
@@ -754,11 +835,21 @@ JacobiSVD<MatrixType, QRPreconditioner>::compute(const MatrixType& matrix, unsig
|
|||||||
// limit for very small denormal numbers to be considered zero in order to avoid infinite loops (see bug 286)
|
// limit for very small denormal numbers to be considered zero in order to avoid infinite loops (see bug 286)
|
||||||
const RealScalar considerAsZero = RealScalar(2) * std::numeric_limits<RealScalar>::denorm_min();
|
const RealScalar considerAsZero = RealScalar(2) * std::numeric_limits<RealScalar>::denorm_min();
|
||||||
|
|
||||||
|
// Scaling factor to reduce over/under-flows
|
||||||
|
RealScalar scale = matrix.cwiseAbs().maxCoeff();
|
||||||
|
if(scale==RealScalar(0)) scale = RealScalar(1);
|
||||||
|
|
||||||
/*** step 1. The R-SVD step: we use a QR decomposition to reduce to the case of a square matrix */
|
/*** step 1. The R-SVD step: we use a QR decomposition to reduce to the case of a square matrix */
|
||||||
|
|
||||||
if(!m_qr_precond_morecols.run(*this, matrix) && !m_qr_precond_morerows.run(*this, matrix))
|
if(m_rows!=m_cols)
|
||||||
{
|
{
|
||||||
m_workMatrix = matrix.block(0,0,m_diagSize,m_diagSize);
|
m_scaledMatrix = matrix / scale;
|
||||||
|
m_qr_precond_morecols.run(*this, m_scaledMatrix);
|
||||||
|
m_qr_precond_morerows.run(*this, m_scaledMatrix);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_workMatrix = matrix.block(0,0,m_diagSize,m_diagSize) / scale;
|
||||||
if(m_computeFullU) m_matrixU.setIdentity(m_rows,m_rows);
|
if(m_computeFullU) m_matrixU.setIdentity(m_rows,m_rows);
|
||||||
if(m_computeThinU) m_matrixU.setIdentity(m_rows,m_diagSize);
|
if(m_computeThinU) m_matrixU.setIdentity(m_rows,m_diagSize);
|
||||||
if(m_computeFullV) m_matrixV.setIdentity(m_cols,m_cols);
|
if(m_computeFullV) m_matrixV.setIdentity(m_cols,m_cols);
|
||||||
@@ -784,7 +875,8 @@ JacobiSVD<MatrixType, QRPreconditioner>::compute(const MatrixType& matrix, unsig
|
|||||||
using std::max;
|
using std::max;
|
||||||
RealScalar threshold = (max)(considerAsZero, precision * (max)(abs(m_workMatrix.coeff(p,p)),
|
RealScalar threshold = (max)(considerAsZero, precision * (max)(abs(m_workMatrix.coeff(p,p)),
|
||||||
abs(m_workMatrix.coeff(q,q))));
|
abs(m_workMatrix.coeff(q,q))));
|
||||||
if((max)(abs(m_workMatrix.coeff(p,q)),abs(m_workMatrix.coeff(q,p))) > threshold)
|
// We compare both values to threshold instead of calling max to be robust to NaN (See bug 791)
|
||||||
|
if(abs(m_workMatrix.coeff(p,q))>threshold || abs(m_workMatrix.coeff(q,p)) > threshold)
|
||||||
{
|
{
|
||||||
finished = false;
|
finished = false;
|
||||||
|
|
||||||
@@ -833,6 +925,8 @@ JacobiSVD<MatrixType, QRPreconditioner>::compute(const MatrixType& matrix, unsig
|
|||||||
if(computeV()) m_matrixV.col(pos).swap(m_matrixV.col(i));
|
if(computeV()) m_matrixV.col(pos).swap(m_matrixV.col(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_singularValues *= scale;
|
||||||
|
|
||||||
m_isInitialized = true;
|
m_isInitialized = true;
|
||||||
return *this;
|
return *this;
|
||||||
@@ -854,11 +948,11 @@ struct solve_retval<JacobiSVD<_MatrixType, QRPreconditioner>, Rhs>
|
|||||||
// So A^{-1} = V S^{-1} U^*
|
// So A^{-1} = V S^{-1} U^*
|
||||||
|
|
||||||
Matrix<Scalar, Dynamic, Rhs::ColsAtCompileTime, 0, _MatrixType::MaxRowsAtCompileTime, Rhs::MaxColsAtCompileTime> tmp;
|
Matrix<Scalar, Dynamic, Rhs::ColsAtCompileTime, 0, _MatrixType::MaxRowsAtCompileTime, Rhs::MaxColsAtCompileTime> tmp;
|
||||||
Index nonzeroSingVals = dec().nonzeroSingularValues();
|
Index rank = dec().rank();
|
||||||
|
|
||||||
tmp.noalias() = dec().matrixU().leftCols(nonzeroSingVals).adjoint() * rhs();
|
tmp.noalias() = dec().matrixU().leftCols(rank).adjoint() * rhs();
|
||||||
tmp = dec().singularValues().head(nonzeroSingVals).asDiagonal().inverse() * tmp;
|
tmp = dec().singularValues().head(rank).asDiagonal().inverse() * tmp;
|
||||||
dst = dec().matrixV().leftCols(nonzeroSingVals) * tmp;
|
dst = dec().matrixV().leftCols(rank) * tmp;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
} // end namespace internal
|
} // end namespace internal
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ class SimplicialCholeskyBase : internal::noncopyable
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef typename internal::traits<Derived>::MatrixType MatrixType;
|
typedef typename internal::traits<Derived>::MatrixType MatrixType;
|
||||||
|
typedef typename internal::traits<Derived>::OrderingType OrderingType;
|
||||||
enum { UpLo = internal::traits<Derived>::UpLo };
|
enum { UpLo = internal::traits<Derived>::UpLo };
|
||||||
typedef typename MatrixType::Scalar Scalar;
|
typedef typename MatrixType::Scalar Scalar;
|
||||||
typedef typename MatrixType::RealScalar RealScalar;
|
typedef typename MatrixType::RealScalar RealScalar;
|
||||||
@@ -240,15 +241,16 @@ class SimplicialCholeskyBase : internal::noncopyable
|
|||||||
RealScalar m_shiftScale;
|
RealScalar m_shiftScale;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename _MatrixType, int _UpLo = Lower> class SimplicialLLT;
|
template<typename _MatrixType, int _UpLo = Lower, typename _Ordering = AMDOrdering<typename _MatrixType::Index> > class SimplicialLLT;
|
||||||
template<typename _MatrixType, int _UpLo = Lower> class SimplicialLDLT;
|
template<typename _MatrixType, int _UpLo = Lower, typename _Ordering = AMDOrdering<typename _MatrixType::Index> > class SimplicialLDLT;
|
||||||
template<typename _MatrixType, int _UpLo = Lower> class SimplicialCholesky;
|
template<typename _MatrixType, int _UpLo = Lower, typename _Ordering = AMDOrdering<typename _MatrixType::Index> > class SimplicialCholesky;
|
||||||
|
|
||||||
namespace internal {
|
namespace internal {
|
||||||
|
|
||||||
template<typename _MatrixType, int _UpLo> struct traits<SimplicialLLT<_MatrixType,_UpLo> >
|
template<typename _MatrixType, int _UpLo, typename _Ordering> struct traits<SimplicialLLT<_MatrixType,_UpLo,_Ordering> >
|
||||||
{
|
{
|
||||||
typedef _MatrixType MatrixType;
|
typedef _MatrixType MatrixType;
|
||||||
|
typedef _Ordering OrderingType;
|
||||||
enum { UpLo = _UpLo };
|
enum { UpLo = _UpLo };
|
||||||
typedef typename MatrixType::Scalar Scalar;
|
typedef typename MatrixType::Scalar Scalar;
|
||||||
typedef typename MatrixType::Index Index;
|
typedef typename MatrixType::Index Index;
|
||||||
@@ -259,9 +261,10 @@ template<typename _MatrixType, int _UpLo> struct traits<SimplicialLLT<_MatrixTyp
|
|||||||
static inline MatrixU getU(const MatrixType& m) { return m.adjoint(); }
|
static inline MatrixU getU(const MatrixType& m) { return m.adjoint(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename _MatrixType,int _UpLo> struct traits<SimplicialLDLT<_MatrixType,_UpLo> >
|
template<typename _MatrixType,int _UpLo, typename _Ordering> struct traits<SimplicialLDLT<_MatrixType,_UpLo,_Ordering> >
|
||||||
{
|
{
|
||||||
typedef _MatrixType MatrixType;
|
typedef _MatrixType MatrixType;
|
||||||
|
typedef _Ordering OrderingType;
|
||||||
enum { UpLo = _UpLo };
|
enum { UpLo = _UpLo };
|
||||||
typedef typename MatrixType::Scalar Scalar;
|
typedef typename MatrixType::Scalar Scalar;
|
||||||
typedef typename MatrixType::Index Index;
|
typedef typename MatrixType::Index Index;
|
||||||
@@ -272,9 +275,10 @@ template<typename _MatrixType,int _UpLo> struct traits<SimplicialLDLT<_MatrixTyp
|
|||||||
static inline MatrixU getU(const MatrixType& m) { return m.adjoint(); }
|
static inline MatrixU getU(const MatrixType& m) { return m.adjoint(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename _MatrixType, int _UpLo> struct traits<SimplicialCholesky<_MatrixType,_UpLo> >
|
template<typename _MatrixType, int _UpLo, typename _Ordering> struct traits<SimplicialCholesky<_MatrixType,_UpLo,_Ordering> >
|
||||||
{
|
{
|
||||||
typedef _MatrixType MatrixType;
|
typedef _MatrixType MatrixType;
|
||||||
|
typedef _Ordering OrderingType;
|
||||||
enum { UpLo = _UpLo };
|
enum { UpLo = _UpLo };
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -294,11 +298,12 @@ template<typename _MatrixType, int _UpLo> struct traits<SimplicialCholesky<_Matr
|
|||||||
* \tparam _MatrixType the type of the sparse matrix A, it must be a SparseMatrix<>
|
* \tparam _MatrixType the type of the sparse matrix A, it must be a SparseMatrix<>
|
||||||
* \tparam _UpLo the triangular part that will be used for the computations. It can be Lower
|
* \tparam _UpLo the triangular part that will be used for the computations. It can be Lower
|
||||||
* or Upper. Default is Lower.
|
* or Upper. Default is Lower.
|
||||||
|
* \tparam _Ordering The ordering method to use, either AMDOrdering<> or NaturalOrdering<>. Default is AMDOrdering<>
|
||||||
*
|
*
|
||||||
* \sa class SimplicialLDLT
|
* \sa class SimplicialLDLT, class AMDOrdering, class NaturalOrdering
|
||||||
*/
|
*/
|
||||||
template<typename _MatrixType, int _UpLo>
|
template<typename _MatrixType, int _UpLo, typename _Ordering>
|
||||||
class SimplicialLLT : public SimplicialCholeskyBase<SimplicialLLT<_MatrixType,_UpLo> >
|
class SimplicialLLT : public SimplicialCholeskyBase<SimplicialLLT<_MatrixType,_UpLo,_Ordering> >
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef _MatrixType MatrixType;
|
typedef _MatrixType MatrixType;
|
||||||
@@ -382,11 +387,12 @@ public:
|
|||||||
* \tparam _MatrixType the type of the sparse matrix A, it must be a SparseMatrix<>
|
* \tparam _MatrixType the type of the sparse matrix A, it must be a SparseMatrix<>
|
||||||
* \tparam _UpLo the triangular part that will be used for the computations. It can be Lower
|
* \tparam _UpLo the triangular part that will be used for the computations. It can be Lower
|
||||||
* or Upper. Default is Lower.
|
* or Upper. Default is Lower.
|
||||||
|
* \tparam _Ordering The ordering method to use, either AMDOrdering<> or NaturalOrdering<>. Default is AMDOrdering<>
|
||||||
*
|
*
|
||||||
* \sa class SimplicialLLT
|
* \sa class SimplicialLLT, class AMDOrdering, class NaturalOrdering
|
||||||
*/
|
*/
|
||||||
template<typename _MatrixType, int _UpLo>
|
template<typename _MatrixType, int _UpLo, typename _Ordering>
|
||||||
class SimplicialLDLT : public SimplicialCholeskyBase<SimplicialLDLT<_MatrixType,_UpLo> >
|
class SimplicialLDLT : public SimplicialCholeskyBase<SimplicialLDLT<_MatrixType,_UpLo,_Ordering> >
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef _MatrixType MatrixType;
|
typedef _MatrixType MatrixType;
|
||||||
@@ -467,8 +473,8 @@ public:
|
|||||||
*
|
*
|
||||||
* \sa class SimplicialLDLT, class SimplicialLLT
|
* \sa class SimplicialLDLT, class SimplicialLLT
|
||||||
*/
|
*/
|
||||||
template<typename _MatrixType, int _UpLo>
|
template<typename _MatrixType, int _UpLo, typename _Ordering>
|
||||||
class SimplicialCholesky : public SimplicialCholeskyBase<SimplicialCholesky<_MatrixType,_UpLo> >
|
class SimplicialCholesky : public SimplicialCholeskyBase<SimplicialCholesky<_MatrixType,_UpLo,_Ordering> >
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef _MatrixType MatrixType;
|
typedef _MatrixType MatrixType;
|
||||||
@@ -612,15 +618,13 @@ void SimplicialCholeskyBase<Derived>::ordering(const MatrixType& a, CholMatrixTy
|
|||||||
{
|
{
|
||||||
eigen_assert(a.rows()==a.cols());
|
eigen_assert(a.rows()==a.cols());
|
||||||
const Index size = a.rows();
|
const Index size = a.rows();
|
||||||
// TODO allows to configure the permutation
|
|
||||||
// Note that amd compute the inverse permutation
|
// Note that amd compute the inverse permutation
|
||||||
{
|
{
|
||||||
CholMatrixType C;
|
CholMatrixType C;
|
||||||
C = a.template selfadjointView<UpLo>();
|
C = a.template selfadjointView<UpLo>();
|
||||||
// remove diagonal entries:
|
|
||||||
// seems not to be needed
|
OrderingType ordering;
|
||||||
// C.prune(keep_diag());
|
ordering(C,m_Pinv);
|
||||||
internal::minimum_degree_ordering(C, m_Pinv);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(m_Pinv.size()>0)
|
if(m_Pinv.size()>0)
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ class AmbiVector
|
|||||||
delete[] m_buffer;
|
delete[] m_buffer;
|
||||||
if (size<1000)
|
if (size<1000)
|
||||||
{
|
{
|
||||||
Index allocSize = (size * sizeof(ListEl))/sizeof(Scalar);
|
Index allocSize = (size * sizeof(ListEl) + sizeof(Scalar) - 1)/sizeof(Scalar);
|
||||||
m_allocatedElements = (allocSize*sizeof(Scalar))/sizeof(ListEl);
|
m_allocatedElements = (allocSize*sizeof(Scalar))/sizeof(ListEl);
|
||||||
m_buffer = new Scalar[allocSize];
|
m_buffer = new Scalar[allocSize];
|
||||||
}
|
}
|
||||||
@@ -88,7 +88,7 @@ class AmbiVector
|
|||||||
Index copyElements = m_allocatedElements;
|
Index copyElements = m_allocatedElements;
|
||||||
m_allocatedElements = (std::min)(Index(m_allocatedElements*1.5),m_size);
|
m_allocatedElements = (std::min)(Index(m_allocatedElements*1.5),m_size);
|
||||||
Index allocSize = m_allocatedElements * sizeof(ListEl);
|
Index allocSize = m_allocatedElements * sizeof(ListEl);
|
||||||
allocSize = allocSize/sizeof(Scalar) + (allocSize%sizeof(Scalar)>0?1:0);
|
allocSize = (allocSize + sizeof(Scalar) - 1)/sizeof(Scalar);
|
||||||
Scalar* newBuffer = new Scalar[allocSize];
|
Scalar* newBuffer = new Scalar[allocSize];
|
||||||
memcpy(newBuffer, m_buffer, copyElements * sizeof(ListEl));
|
memcpy(newBuffer, m_buffer, copyElements * sizeof(ListEl));
|
||||||
delete[] m_buffer;
|
delete[] m_buffer;
|
||||||
|
|||||||
@@ -51,8 +51,8 @@ class CompressedStorage
|
|||||||
CompressedStorage& operator=(const CompressedStorage& other)
|
CompressedStorage& operator=(const CompressedStorage& other)
|
||||||
{
|
{
|
||||||
resize(other.size());
|
resize(other.size());
|
||||||
memcpy(m_values, other.m_values, m_size * sizeof(Scalar));
|
internal::smart_copy(other.m_values, other.m_values + m_size, m_values);
|
||||||
memcpy(m_indices, other.m_indices, m_size * sizeof(Index));
|
internal::smart_copy(other.m_indices, other.m_indices + m_size, m_indices);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,10 +83,10 @@ class CompressedStorage
|
|||||||
reallocate(m_size);
|
reallocate(m_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void resize(size_t size, float reserveSizeFactor = 0)
|
void resize(size_t size, double reserveSizeFactor = 0)
|
||||||
{
|
{
|
||||||
if (m_allocatedSize<size)
|
if (m_allocatedSize<size)
|
||||||
reallocate(size + size_t(reserveSizeFactor*size));
|
reallocate(size + size_t(reserveSizeFactor*double(size)));
|
||||||
m_size = size;
|
m_size = size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -57,6 +57,16 @@ public:
|
|||||||
inline BlockImpl(const XprType& xpr, int startRow, int startCol, int blockRows, int blockCols)
|
inline BlockImpl(const XprType& xpr, int startRow, int startCol, int blockRows, int blockCols)
|
||||||
: m_matrix(xpr), m_outerStart(IsRowMajor ? startRow : startCol), m_outerSize(IsRowMajor ? blockRows : blockCols)
|
: m_matrix(xpr), m_outerStart(IsRowMajor ? startRow : startCol), m_outerSize(IsRowMajor ? blockRows : blockCols)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
inline const Scalar coeff(int row, int col) const
|
||||||
|
{
|
||||||
|
return m_matrix.coeff(row + IsRowMajor ? m_outerStart : 0, col +IsRowMajor ? 0 : m_outerStart);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline const Scalar coeff(int index) const
|
||||||
|
{
|
||||||
|
return m_matrix.coeff(IsRowMajor ? m_outerStart : index, IsRowMajor ? index : m_outerStart);
|
||||||
|
}
|
||||||
|
|
||||||
EIGEN_STRONG_INLINE Index rows() const { return IsRowMajor ? m_outerSize.value() : m_matrix.rows(); }
|
EIGEN_STRONG_INLINE Index rows() const { return IsRowMajor ? m_outerSize.value() : m_matrix.rows(); }
|
||||||
EIGEN_STRONG_INLINE Index cols() const { return IsRowMajor ? m_matrix.cols() : m_outerSize.value(); }
|
EIGEN_STRONG_INLINE Index cols() const { return IsRowMajor ? m_matrix.cols() : m_outerSize.value(); }
|
||||||
@@ -68,6 +78,8 @@ public:
|
|||||||
const internal::variable_if_dynamic<Index, OuterSize> m_outerSize;
|
const internal::variable_if_dynamic<Index, OuterSize> m_outerSize;
|
||||||
|
|
||||||
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(BlockImpl)
|
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(BlockImpl)
|
||||||
|
private:
|
||||||
|
Index nonZeros() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -82,6 +94,7 @@ class BlockImpl<SparseMatrix<_Scalar, _Options, _Index>,BlockRows,BlockCols,true
|
|||||||
typedef SparseMatrix<_Scalar, _Options, _Index> SparseMatrixType;
|
typedef SparseMatrix<_Scalar, _Options, _Index> SparseMatrixType;
|
||||||
typedef typename internal::remove_all<typename SparseMatrixType::Nested>::type _MatrixTypeNested;
|
typedef typename internal::remove_all<typename SparseMatrixType::Nested>::type _MatrixTypeNested;
|
||||||
typedef Block<SparseMatrixType, BlockRows, BlockCols, true> BlockType;
|
typedef Block<SparseMatrixType, BlockRows, BlockCols, true> BlockType;
|
||||||
|
typedef Block<const SparseMatrixType, BlockRows, BlockCols, true> ConstBlockType;
|
||||||
public:
|
public:
|
||||||
enum { IsRowMajor = internal::traits<BlockType>::IsRowMajor };
|
enum { IsRowMajor = internal::traits<BlockType>::IsRowMajor };
|
||||||
EIGEN_SPARSE_PUBLIC_INTERFACE(BlockType)
|
EIGEN_SPARSE_PUBLIC_INTERFACE(BlockType)
|
||||||
@@ -223,6 +236,118 @@ public:
|
|||||||
else
|
else
|
||||||
return Map<const Matrix<Index,OuterSize,1> >(m_matrix.innerNonZeroPtr()+m_outerStart, m_outerSize.value()).sum();
|
return Map<const Matrix<Index,OuterSize,1> >(m_matrix.innerNonZeroPtr()+m_outerStart, m_outerSize.value()).sum();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline Scalar& coeffRef(int row, int col)
|
||||||
|
{
|
||||||
|
return m_matrix.const_cast_derived().coeffRef(row + (IsRowMajor ? m_outerStart : 0), col + (IsRowMajor ? 0 : m_outerStart));
|
||||||
|
}
|
||||||
|
|
||||||
|
inline const Scalar coeff(int row, int col) const
|
||||||
|
{
|
||||||
|
return m_matrix.coeff(row + (IsRowMajor ? m_outerStart : 0), col + (IsRowMajor ? 0 : m_outerStart));
|
||||||
|
}
|
||||||
|
|
||||||
|
inline const Scalar coeff(int index) const
|
||||||
|
{
|
||||||
|
return m_matrix.coeff(IsRowMajor ? m_outerStart : index, IsRowMajor ? index : m_outerStart);
|
||||||
|
}
|
||||||
|
|
||||||
|
const Scalar& lastCoeff() const
|
||||||
|
{
|
||||||
|
EIGEN_STATIC_ASSERT_VECTOR_ONLY(BlockImpl);
|
||||||
|
eigen_assert(nonZeros()>0);
|
||||||
|
if(m_matrix.isCompressed())
|
||||||
|
return m_matrix.valuePtr()[m_matrix.outerIndexPtr()[m_outerStart+1]-1];
|
||||||
|
else
|
||||||
|
return m_matrix.valuePtr()[m_matrix.outerIndexPtr()[m_outerStart]+m_matrix.innerNonZeroPtr()[m_outerStart]-1];
|
||||||
|
}
|
||||||
|
|
||||||
|
EIGEN_STRONG_INLINE Index rows() const { return IsRowMajor ? m_outerSize.value() : m_matrix.rows(); }
|
||||||
|
EIGEN_STRONG_INLINE Index cols() const { return IsRowMajor ? m_matrix.cols() : m_outerSize.value(); }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
typename SparseMatrixType::Nested m_matrix;
|
||||||
|
Index m_outerStart;
|
||||||
|
const internal::variable_if_dynamic<Index, OuterSize> m_outerSize;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
template<typename _Scalar, int _Options, typename _Index, int BlockRows, int BlockCols>
|
||||||
|
class BlockImpl<const SparseMatrix<_Scalar, _Options, _Index>,BlockRows,BlockCols,true,Sparse>
|
||||||
|
: public SparseMatrixBase<Block<const SparseMatrix<_Scalar, _Options, _Index>,BlockRows,BlockCols,true> >
|
||||||
|
{
|
||||||
|
typedef SparseMatrix<_Scalar, _Options, _Index> SparseMatrixType;
|
||||||
|
typedef typename internal::remove_all<typename SparseMatrixType::Nested>::type _MatrixTypeNested;
|
||||||
|
typedef Block<const SparseMatrixType, BlockRows, BlockCols, true> BlockType;
|
||||||
|
public:
|
||||||
|
enum { IsRowMajor = internal::traits<BlockType>::IsRowMajor };
|
||||||
|
EIGEN_SPARSE_PUBLIC_INTERFACE(BlockType)
|
||||||
|
protected:
|
||||||
|
enum { OuterSize = IsRowMajor ? BlockRows : BlockCols };
|
||||||
|
public:
|
||||||
|
|
||||||
|
class InnerIterator: public SparseMatrixType::InnerIterator
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
inline InnerIterator(const BlockType& xpr, Index outer)
|
||||||
|
: SparseMatrixType::InnerIterator(xpr.m_matrix, xpr.m_outerStart + outer), m_outer(outer)
|
||||||
|
{}
|
||||||
|
inline Index row() const { return IsRowMajor ? m_outer : this->index(); }
|
||||||
|
inline Index col() const { return IsRowMajor ? this->index() : m_outer; }
|
||||||
|
protected:
|
||||||
|
Index m_outer;
|
||||||
|
};
|
||||||
|
class ReverseInnerIterator: public SparseMatrixType::ReverseInnerIterator
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
inline ReverseInnerIterator(const BlockType& xpr, Index outer)
|
||||||
|
: SparseMatrixType::ReverseInnerIterator(xpr.m_matrix, xpr.m_outerStart + outer), m_outer(outer)
|
||||||
|
{}
|
||||||
|
inline Index row() const { return IsRowMajor ? m_outer : this->index(); }
|
||||||
|
inline Index col() const { return IsRowMajor ? this->index() : m_outer; }
|
||||||
|
protected:
|
||||||
|
Index m_outer;
|
||||||
|
};
|
||||||
|
|
||||||
|
inline BlockImpl(const SparseMatrixType& xpr, int i)
|
||||||
|
: m_matrix(xpr), m_outerStart(i), m_outerSize(OuterSize)
|
||||||
|
{}
|
||||||
|
|
||||||
|
inline BlockImpl(const SparseMatrixType& xpr, int startRow, int startCol, int blockRows, int blockCols)
|
||||||
|
: m_matrix(xpr), m_outerStart(IsRowMajor ? startRow : startCol), m_outerSize(IsRowMajor ? blockRows : blockCols)
|
||||||
|
{}
|
||||||
|
|
||||||
|
inline const Scalar* valuePtr() const
|
||||||
|
{ return m_matrix.valuePtr() + m_matrix.outerIndexPtr()[m_outerStart]; }
|
||||||
|
|
||||||
|
inline const Index* innerIndexPtr() const
|
||||||
|
{ return m_matrix.innerIndexPtr() + m_matrix.outerIndexPtr()[m_outerStart]; }
|
||||||
|
|
||||||
|
inline const Index* outerIndexPtr() const
|
||||||
|
{ return m_matrix.outerIndexPtr() + m_outerStart; }
|
||||||
|
|
||||||
|
Index nonZeros() const
|
||||||
|
{
|
||||||
|
if(m_matrix.isCompressed())
|
||||||
|
return std::size_t(m_matrix.outerIndexPtr()[m_outerStart+m_outerSize.value()])
|
||||||
|
- std::size_t(m_matrix.outerIndexPtr()[m_outerStart]);
|
||||||
|
else if(m_outerSize.value()==0)
|
||||||
|
return 0;
|
||||||
|
else
|
||||||
|
return Map<const Matrix<Index,OuterSize,1> >(m_matrix.innerNonZeroPtr()+m_outerStart, m_outerSize.value()).sum();
|
||||||
|
}
|
||||||
|
|
||||||
|
inline const Scalar coeff(int row, int col) const
|
||||||
|
{
|
||||||
|
return m_matrix.coeff(row + (IsRowMajor ? m_outerStart : 0), col + (IsRowMajor ? 0 : m_outerStart));
|
||||||
|
}
|
||||||
|
|
||||||
|
inline const Scalar coeff(int index) const
|
||||||
|
{
|
||||||
|
return m_matrix.coeff(IsRowMajor ? m_outerStart : index, IsRowMajor ? index : m_outerStart);
|
||||||
|
}
|
||||||
|
|
||||||
const Scalar& lastCoeff() const
|
const Scalar& lastCoeff() const
|
||||||
{
|
{
|
||||||
@@ -265,7 +390,8 @@ const typename SparseMatrixBase<Derived>::ConstInnerVectorReturnType SparseMatri
|
|||||||
* is col-major (resp. row-major).
|
* is col-major (resp. row-major).
|
||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
Block<Derived,Dynamic,Dynamic,true> SparseMatrixBase<Derived>::innerVectors(Index outerStart, Index outerSize)
|
typename SparseMatrixBase<Derived>::InnerVectorsReturnType
|
||||||
|
SparseMatrixBase<Derived>::innerVectors(Index outerStart, Index outerSize)
|
||||||
{
|
{
|
||||||
return Block<Derived,Dynamic,Dynamic,true>(derived(),
|
return Block<Derived,Dynamic,Dynamic,true>(derived(),
|
||||||
IsRowMajor ? outerStart : 0, IsRowMajor ? 0 : outerStart,
|
IsRowMajor ? outerStart : 0, IsRowMajor ? 0 : outerStart,
|
||||||
@@ -277,7 +403,8 @@ Block<Derived,Dynamic,Dynamic,true> SparseMatrixBase<Derived>::innerVectors(Inde
|
|||||||
* is col-major (resp. row-major). Read-only.
|
* is col-major (resp. row-major). Read-only.
|
||||||
*/
|
*/
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
const Block<const Derived,Dynamic,Dynamic,true> SparseMatrixBase<Derived>::innerVectors(Index outerStart, Index outerSize) const
|
const typename SparseMatrixBase<Derived>::ConstInnerVectorsReturnType
|
||||||
|
SparseMatrixBase<Derived>::innerVectors(Index outerStart, Index outerSize) const
|
||||||
{
|
{
|
||||||
return Block<const Derived,Dynamic,Dynamic,true>(derived(),
|
return Block<const Derived,Dynamic,Dynamic,true>(derived(),
|
||||||
IsRowMajor ? outerStart : 0, IsRowMajor ? 0 : outerStart,
|
IsRowMajor ? outerStart : 0, IsRowMajor ? 0 : outerStart,
|
||||||
@@ -304,8 +431,8 @@ public:
|
|||||||
: m_matrix(xpr),
|
: m_matrix(xpr),
|
||||||
m_startRow( (BlockRows==1) && (BlockCols==XprType::ColsAtCompileTime) ? i : 0),
|
m_startRow( (BlockRows==1) && (BlockCols==XprType::ColsAtCompileTime) ? i : 0),
|
||||||
m_startCol( (BlockRows==XprType::RowsAtCompileTime) && (BlockCols==1) ? i : 0),
|
m_startCol( (BlockRows==XprType::RowsAtCompileTime) && (BlockCols==1) ? i : 0),
|
||||||
m_blockRows(xpr.rows()),
|
m_blockRows(BlockRows==1 ? 1 : xpr.rows()),
|
||||||
m_blockCols(xpr.cols())
|
m_blockCols(BlockCols==1 ? 1 : xpr.cols())
|
||||||
{}
|
{}
|
||||||
|
|
||||||
/** Dynamic-size constructor
|
/** Dynamic-size constructor
|
||||||
@@ -407,3 +534,4 @@ public:
|
|||||||
} // end namespace Eigen
|
} // end namespace Eigen
|
||||||
|
|
||||||
#endif // EIGEN_SPARSE_BLOCK_H
|
#endif // EIGEN_SPARSE_BLOCK_H
|
||||||
|
|
||||||
|
|||||||
@@ -73,7 +73,8 @@ class CwiseBinaryOpImpl<BinaryOp,Lhs,Rhs,Sparse>::InnerIterator
|
|||||||
typedef internal::sparse_cwise_binary_op_inner_iterator_selector<
|
typedef internal::sparse_cwise_binary_op_inner_iterator_selector<
|
||||||
BinaryOp,Lhs,Rhs, InnerIterator> Base;
|
BinaryOp,Lhs,Rhs, InnerIterator> Base;
|
||||||
|
|
||||||
EIGEN_STRONG_INLINE InnerIterator(const CwiseBinaryOpImpl& binOp, Index outer)
|
// NOTE: we have to prefix Index by "typename Lhs::" to avoid an ICE with VC11
|
||||||
|
EIGEN_STRONG_INLINE InnerIterator(const CwiseBinaryOpImpl& binOp, typename Lhs::Index outer)
|
||||||
: Base(binOp.derived(),outer)
|
: Base(binOp.derived(),outer)
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
@@ -313,10 +314,10 @@ SparseMatrixBase<Derived>::operator+=(const SparseMatrixBase<OtherDerived>& othe
|
|||||||
|
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
template<typename OtherDerived>
|
template<typename OtherDerived>
|
||||||
EIGEN_STRONG_INLINE const EIGEN_SPARSE_CWISE_PRODUCT_RETURN_TYPE
|
EIGEN_STRONG_INLINE const typename SparseMatrixBase<Derived>::template CwiseProductDenseReturnType<OtherDerived>::Type
|
||||||
SparseMatrixBase<Derived>::cwiseProduct(const MatrixBase<OtherDerived> &other) const
|
SparseMatrixBase<Derived>::cwiseProduct(const MatrixBase<OtherDerived> &other) const
|
||||||
{
|
{
|
||||||
return EIGEN_SPARSE_CWISE_PRODUCT_RETURN_TYPE(derived(), other.derived());
|
return typename CwiseProductDenseReturnType<OtherDerived>::Type(derived(), other.derived());
|
||||||
}
|
}
|
||||||
|
|
||||||
} // end namespace Eigen
|
} // end namespace Eigen
|
||||||
|
|||||||
@@ -19,7 +19,10 @@ template<typename Lhs, typename Rhs, int InnerSize> struct SparseDenseProductRet
|
|||||||
|
|
||||||
template<typename Lhs, typename Rhs> struct SparseDenseProductReturnType<Lhs,Rhs,1>
|
template<typename Lhs, typename Rhs> struct SparseDenseProductReturnType<Lhs,Rhs,1>
|
||||||
{
|
{
|
||||||
typedef SparseDenseOuterProduct<Lhs,Rhs,false> Type;
|
typedef typename internal::conditional<
|
||||||
|
Lhs::IsRowMajor,
|
||||||
|
SparseDenseOuterProduct<Rhs,Lhs,true>,
|
||||||
|
SparseDenseOuterProduct<Lhs,Rhs,false> >::type Type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename Lhs, typename Rhs, int InnerSize> struct DenseSparseProductReturnType
|
template<typename Lhs, typename Rhs, int InnerSize> struct DenseSparseProductReturnType
|
||||||
@@ -29,7 +32,10 @@ template<typename Lhs, typename Rhs, int InnerSize> struct DenseSparseProductRet
|
|||||||
|
|
||||||
template<typename Lhs, typename Rhs> struct DenseSparseProductReturnType<Lhs,Rhs,1>
|
template<typename Lhs, typename Rhs> struct DenseSparseProductReturnType<Lhs,Rhs,1>
|
||||||
{
|
{
|
||||||
typedef SparseDenseOuterProduct<Rhs,Lhs,true> Type;
|
typedef typename internal::conditional<
|
||||||
|
Rhs::IsRowMajor,
|
||||||
|
SparseDenseOuterProduct<Rhs,Lhs,true>,
|
||||||
|
SparseDenseOuterProduct<Lhs,Rhs,false> >::type Type;
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace internal {
|
namespace internal {
|
||||||
@@ -114,17 +120,30 @@ class SparseDenseOuterProduct<Lhs,Rhs,Transpose>::InnerIterator : public _LhsNes
|
|||||||
typedef typename SparseDenseOuterProduct::Index Index;
|
typedef typename SparseDenseOuterProduct::Index Index;
|
||||||
public:
|
public:
|
||||||
EIGEN_STRONG_INLINE InnerIterator(const SparseDenseOuterProduct& prod, Index outer)
|
EIGEN_STRONG_INLINE InnerIterator(const SparseDenseOuterProduct& prod, Index outer)
|
||||||
: Base(prod.lhs(), 0), m_outer(outer), m_factor(prod.rhs().coeff(outer))
|
: Base(prod.lhs(), 0), m_outer(outer), m_factor(get(prod.rhs(), outer, typename internal::traits<Rhs>::StorageKind() ))
|
||||||
{
|
{ }
|
||||||
}
|
|
||||||
|
|
||||||
inline Index outer() const { return m_outer; }
|
inline Index outer() const { return m_outer; }
|
||||||
inline Index row() const { return Transpose ? Base::row() : m_outer; }
|
inline Index row() const { return Transpose ? m_outer : Base::index(); }
|
||||||
inline Index col() const { return Transpose ? m_outer : Base::row(); }
|
inline Index col() const { return Transpose ? Base::index() : m_outer; }
|
||||||
|
|
||||||
inline Scalar value() const { return Base::value() * m_factor; }
|
inline Scalar value() const { return Base::value() * m_factor; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
static Scalar get(const _RhsNested &rhs, Index outer, Dense = Dense())
|
||||||
|
{
|
||||||
|
return rhs.coeff(outer);
|
||||||
|
}
|
||||||
|
|
||||||
|
static Scalar get(const _RhsNested &rhs, Index outer, Sparse = Sparse())
|
||||||
|
{
|
||||||
|
typename Traits::_RhsNested::InnerIterator it(rhs, outer);
|
||||||
|
if (it && it.index()==0)
|
||||||
|
return it.value();
|
||||||
|
|
||||||
|
return Scalar(0);
|
||||||
|
}
|
||||||
|
|
||||||
Index m_outer;
|
Index m_outer;
|
||||||
Scalar m_factor;
|
Scalar m_factor;
|
||||||
};
|
};
|
||||||
@@ -161,7 +180,7 @@ struct sparse_time_dense_product_impl<SparseLhsType,DenseRhsType,DenseResType, R
|
|||||||
typename Res::Scalar tmp(0);
|
typename Res::Scalar tmp(0);
|
||||||
for(LhsInnerIterator it(lhs,j); it ;++it)
|
for(LhsInnerIterator it(lhs,j); it ;++it)
|
||||||
tmp += it.value() * rhs.coeff(it.index(),c);
|
tmp += it.value() * rhs.coeff(it.index(),c);
|
||||||
res.coeffRef(j,c) = alpha * tmp;
|
res.coeffRef(j,c) += alpha * tmp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -287,15 +306,6 @@ class DenseTimeSparseProduct
|
|||||||
DenseTimeSparseProduct& operator=(const DenseTimeSparseProduct&);
|
DenseTimeSparseProduct& operator=(const DenseTimeSparseProduct&);
|
||||||
};
|
};
|
||||||
|
|
||||||
// sparse * dense
|
|
||||||
template<typename Derived>
|
|
||||||
template<typename OtherDerived>
|
|
||||||
inline const typename SparseDenseProductReturnType<Derived,OtherDerived>::Type
|
|
||||||
SparseMatrixBase<Derived>::operator*(const MatrixBase<OtherDerived> &other) const
|
|
||||||
{
|
|
||||||
return typename SparseDenseProductReturnType<Derived,OtherDerived>::Type(derived(), other.derived());
|
|
||||||
}
|
|
||||||
|
|
||||||
} // end namespace Eigen
|
} // end namespace Eigen
|
||||||
|
|
||||||
#endif // EIGEN_SPARSEDENSEPRODUCT_H
|
#endif // EIGEN_SPARSEDENSEPRODUCT_H
|
||||||
|
|||||||
@@ -691,7 +691,8 @@ class SparseMatrix
|
|||||||
m_data.swap(other.m_data);
|
m_data.swap(other.m_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Sets *this to the identity matrix */
|
/** Sets *this to the identity matrix.
|
||||||
|
* This function also turns the matrix into compressed mode, and drop any reserved memory. */
|
||||||
inline void setIdentity()
|
inline void setIdentity()
|
||||||
{
|
{
|
||||||
eigen_assert(rows() == cols() && "ONLY FOR SQUARED MATRICES");
|
eigen_assert(rows() == cols() && "ONLY FOR SQUARED MATRICES");
|
||||||
@@ -699,6 +700,8 @@ class SparseMatrix
|
|||||||
Eigen::Map<Matrix<Index, Dynamic, 1> >(&this->m_data.index(0), rows()).setLinSpaced(0, rows()-1);
|
Eigen::Map<Matrix<Index, Dynamic, 1> >(&this->m_data.index(0), rows()).setLinSpaced(0, rows()-1);
|
||||||
Eigen::Map<Matrix<Scalar, Dynamic, 1> >(&this->m_data.value(0), rows()).setOnes();
|
Eigen::Map<Matrix<Scalar, Dynamic, 1> >(&this->m_data.value(0), rows()).setOnes();
|
||||||
Eigen::Map<Matrix<Index, Dynamic, 1> >(this->m_outerIndex, rows()+1).setLinSpaced(0, rows());
|
Eigen::Map<Matrix<Index, Dynamic, 1> >(this->m_outerIndex, rows()+1).setLinSpaced(0, rows());
|
||||||
|
std::free(m_innerNonZeros);
|
||||||
|
m_innerNonZeros = 0;
|
||||||
}
|
}
|
||||||
inline SparseMatrix& operator=(const SparseMatrix& other)
|
inline SparseMatrix& operator=(const SparseMatrix& other)
|
||||||
{
|
{
|
||||||
@@ -940,7 +943,7 @@ void set_from_triplets(const InputIterator& begin, const InputIterator& end, Spa
|
|||||||
enum { IsRowMajor = SparseMatrixType::IsRowMajor };
|
enum { IsRowMajor = SparseMatrixType::IsRowMajor };
|
||||||
typedef typename SparseMatrixType::Scalar Scalar;
|
typedef typename SparseMatrixType::Scalar Scalar;
|
||||||
typedef typename SparseMatrixType::Index Index;
|
typedef typename SparseMatrixType::Index Index;
|
||||||
SparseMatrix<Scalar,IsRowMajor?ColMajor:RowMajor> trMat(mat.rows(),mat.cols());
|
SparseMatrix<Scalar,IsRowMajor?ColMajor:RowMajor,Index> trMat(mat.rows(),mat.cols());
|
||||||
|
|
||||||
if(begin!=end)
|
if(begin!=end)
|
||||||
{
|
{
|
||||||
@@ -1178,7 +1181,7 @@ EIGEN_DONT_INLINE typename SparseMatrix<_Scalar,_Options,_Index>::Scalar& Sparse
|
|||||||
size_t p = m_outerIndex[outer+1];
|
size_t p = m_outerIndex[outer+1];
|
||||||
++m_outerIndex[outer+1];
|
++m_outerIndex[outer+1];
|
||||||
|
|
||||||
float reallocRatio = 1;
|
double reallocRatio = 1;
|
||||||
if (m_data.allocatedSize()<=m_data.size())
|
if (m_data.allocatedSize()<=m_data.size())
|
||||||
{
|
{
|
||||||
// if there is no preallocated memory, let's reserve a minimum of 32 elements
|
// if there is no preallocated memory, let's reserve a minimum of 32 elements
|
||||||
@@ -1190,13 +1193,13 @@ EIGEN_DONT_INLINE typename SparseMatrix<_Scalar,_Options,_Index>::Scalar& Sparse
|
|||||||
{
|
{
|
||||||
// we need to reallocate the data, to reduce multiple reallocations
|
// we need to reallocate the data, to reduce multiple reallocations
|
||||||
// we use a smart resize algorithm based on the current filling ratio
|
// we use a smart resize algorithm based on the current filling ratio
|
||||||
// in addition, we use float to avoid integers overflows
|
// in addition, we use double to avoid integers overflows
|
||||||
float nnzEstimate = float(m_outerIndex[outer])*float(m_outerSize)/float(outer+1);
|
double nnzEstimate = double(m_outerIndex[outer])*double(m_outerSize)/double(outer+1);
|
||||||
reallocRatio = (nnzEstimate-float(m_data.size()))/float(m_data.size());
|
reallocRatio = (nnzEstimate-double(m_data.size()))/double(m_data.size());
|
||||||
// furthermore we bound the realloc ratio to:
|
// furthermore we bound the realloc ratio to:
|
||||||
// 1) reduce multiple minor realloc when the matrix is almost filled
|
// 1) reduce multiple minor realloc when the matrix is almost filled
|
||||||
// 2) avoid to allocate too much memory when the matrix is almost empty
|
// 2) avoid to allocate too much memory when the matrix is almost empty
|
||||||
reallocRatio = (std::min)((std::max)(reallocRatio,1.5f),8.f);
|
reallocRatio = (std::min)((std::max)(reallocRatio,1.5),8.);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_data.resize(m_data.size()+1,reallocRatio);
|
m_data.resize(m_data.size()+1,reallocRatio);
|
||||||
|
|||||||
@@ -23,7 +23,14 @@ namespace Eigen {
|
|||||||
* This class can be extended with the help of the plugin mechanism described on the page
|
* This class can be extended with the help of the plugin mechanism described on the page
|
||||||
* \ref TopicCustomizingEigen by defining the preprocessor symbol \c EIGEN_SPARSEMATRIXBASE_PLUGIN.
|
* \ref TopicCustomizingEigen by defining the preprocessor symbol \c EIGEN_SPARSEMATRIXBASE_PLUGIN.
|
||||||
*/
|
*/
|
||||||
template<typename Derived> class SparseMatrixBase : public EigenBase<Derived>
|
template<typename Derived> class SparseMatrixBase
|
||||||
|
#ifndef EIGEN_PARSED_BY_DOXYGEN
|
||||||
|
: public internal::special_scalar_op_base<Derived,typename internal::traits<Derived>::Scalar,
|
||||||
|
typename NumTraits<typename internal::traits<Derived>::Scalar>::Real,
|
||||||
|
EigenBase<Derived> >
|
||||||
|
#else
|
||||||
|
: public EigenBase<Derived>
|
||||||
|
#endif // not EIGEN_PARSED_BY_DOXYGEN
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@@ -36,7 +43,6 @@ template<typename Derived> class SparseMatrixBase : public EigenBase<Derived>
|
|||||||
>::type PacketReturnType;
|
>::type PacketReturnType;
|
||||||
|
|
||||||
typedef SparseMatrixBase StorageBaseType;
|
typedef SparseMatrixBase StorageBaseType;
|
||||||
typedef EigenBase<Derived> Base;
|
|
||||||
|
|
||||||
template<typename OtherDerived>
|
template<typename OtherDerived>
|
||||||
Derived& operator=(const EigenBase<OtherDerived> &other)
|
Derived& operator=(const EigenBase<OtherDerived> &other)
|
||||||
@@ -132,6 +138,9 @@ template<typename Derived> class SparseMatrixBase : public EigenBase<Derived>
|
|||||||
inline Derived& derived() { return *static_cast<Derived*>(this); }
|
inline Derived& derived() { return *static_cast<Derived*>(this); }
|
||||||
inline Derived& const_cast_derived() const
|
inline Derived& const_cast_derived() const
|
||||||
{ return *static_cast<Derived*>(const_cast<SparseMatrixBase*>(this)); }
|
{ return *static_cast<Derived*>(const_cast<SparseMatrixBase*>(this)); }
|
||||||
|
|
||||||
|
typedef internal::special_scalar_op_base<Derived, Scalar, RealScalar, EigenBase<Derived> > Base;
|
||||||
|
using Base::operator*;
|
||||||
#endif // not EIGEN_PARSED_BY_DOXYGEN
|
#endif // not EIGEN_PARSED_BY_DOXYGEN
|
||||||
|
|
||||||
#define EIGEN_CURRENT_STORAGE_BASE_CLASS Eigen::SparseMatrixBase
|
#define EIGEN_CURRENT_STORAGE_BASE_CLASS Eigen::SparseMatrixBase
|
||||||
@@ -317,20 +326,18 @@ template<typename Derived> class SparseMatrixBase : public EigenBase<Derived>
|
|||||||
Derived& operator*=(const Scalar& other);
|
Derived& operator*=(const Scalar& other);
|
||||||
Derived& operator/=(const Scalar& other);
|
Derived& operator/=(const Scalar& other);
|
||||||
|
|
||||||
#define EIGEN_SPARSE_CWISE_PRODUCT_RETURN_TYPE \
|
template<typename OtherDerived> struct CwiseProductDenseReturnType {
|
||||||
CwiseBinaryOp< \
|
typedef CwiseBinaryOp<internal::scalar_product_op<typename internal::scalar_product_traits<
|
||||||
internal::scalar_product_op< \
|
typename internal::traits<Derived>::Scalar,
|
||||||
typename internal::scalar_product_traits< \
|
typename internal::traits<OtherDerived>::Scalar
|
||||||
typename internal::traits<Derived>::Scalar, \
|
>::ReturnType>,
|
||||||
typename internal::traits<OtherDerived>::Scalar \
|
const Derived,
|
||||||
>::ReturnType \
|
const OtherDerived
|
||||||
>, \
|
> Type;
|
||||||
const Derived, \
|
};
|
||||||
const OtherDerived \
|
|
||||||
>
|
|
||||||
|
|
||||||
template<typename OtherDerived>
|
template<typename OtherDerived>
|
||||||
EIGEN_STRONG_INLINE const EIGEN_SPARSE_CWISE_PRODUCT_RETURN_TYPE
|
EIGEN_STRONG_INLINE const typename CwiseProductDenseReturnType<OtherDerived>::Type
|
||||||
cwiseProduct(const MatrixBase<OtherDerived> &other) const;
|
cwiseProduct(const MatrixBase<OtherDerived> &other) const;
|
||||||
|
|
||||||
// sparse * sparse
|
// sparse * sparse
|
||||||
@@ -358,7 +365,8 @@ template<typename Derived> class SparseMatrixBase : public EigenBase<Derived>
|
|||||||
/** sparse * dense (returns a dense object unless it is an outer product) */
|
/** sparse * dense (returns a dense object unless it is an outer product) */
|
||||||
template<typename OtherDerived>
|
template<typename OtherDerived>
|
||||||
const typename SparseDenseProductReturnType<Derived,OtherDerived>::Type
|
const typename SparseDenseProductReturnType<Derived,OtherDerived>::Type
|
||||||
operator*(const MatrixBase<OtherDerived> &other) const;
|
operator*(const MatrixBase<OtherDerived> &other) const
|
||||||
|
{ return typename SparseDenseProductReturnType<Derived,OtherDerived>::Type(derived(), other.derived()); }
|
||||||
|
|
||||||
/** \returns an expression of P H P^-1 where H is the matrix represented by \c *this */
|
/** \returns an expression of P H P^-1 where H is the matrix represented by \c *this */
|
||||||
SparseSymmetricPermutationProduct<Derived,Upper|Lower> twistedBy(const PermutationMatrix<Dynamic,Dynamic,Index>& perm) const
|
SparseSymmetricPermutationProduct<Derived,Upper|Lower> twistedBy(const PermutationMatrix<Dynamic,Dynamic,Index>& perm) const
|
||||||
@@ -403,8 +411,10 @@ template<typename Derived> class SparseMatrixBase : public EigenBase<Derived>
|
|||||||
const ConstInnerVectorReturnType innerVector(Index outer) const;
|
const ConstInnerVectorReturnType innerVector(Index outer) const;
|
||||||
|
|
||||||
// set of inner-vectors
|
// set of inner-vectors
|
||||||
Block<Derived,Dynamic,Dynamic,true> innerVectors(Index outerStart, Index outerSize);
|
typedef Block<Derived,Dynamic,Dynamic,true> InnerVectorsReturnType;
|
||||||
const Block<const Derived,Dynamic,Dynamic,true> innerVectors(Index outerStart, Index outerSize) const;
|
typedef Block<const Derived,Dynamic,Dynamic,true> ConstInnerVectorsReturnType;
|
||||||
|
InnerVectorsReturnType innerVectors(Index outerStart, Index outerSize);
|
||||||
|
const ConstInnerVectorsReturnType innerVectors(Index outerStart, Index outerSize) const;
|
||||||
|
|
||||||
/** \internal use operator= */
|
/** \internal use operator= */
|
||||||
template<typename DenseDerived>
|
template<typename DenseDerived>
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ struct permut_sparsematrix_product_retval
|
|||||||
for(Index j=0; j<m_matrix.outerSize(); ++j)
|
for(Index j=0; j<m_matrix.outerSize(); ++j)
|
||||||
{
|
{
|
||||||
Index jp = m_permutation.indices().coeff(j);
|
Index jp = m_permutation.indices().coeff(j);
|
||||||
sizes[((Side==OnTheLeft) ^ Transposed) ? jp : j] = m_matrix.innerVector(((Side==OnTheRight) ^ Transposed) ? jp : j).size();
|
sizes[((Side==OnTheLeft) ^ Transposed) ? jp : j] = m_matrix.innerVector(((Side==OnTheRight) ^ Transposed) ? jp : j).nonZeros();
|
||||||
}
|
}
|
||||||
tmp.reserve(sizes);
|
tmp.reserve(sizes);
|
||||||
for(Index j=0; j<m_matrix.outerSize(); ++j)
|
for(Index j=0; j<m_matrix.outerSize(); ++j)
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ template<typename MatrixType> class TransposeImpl<MatrixType,Sparse>
|
|||||||
inline Index nonZeros() const { return derived().nestedExpression().nonZeros(); }
|
inline Index nonZeros() const { return derived().nestedExpression().nonZeros(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
// NOTE: VC10 trigger an ICE if don't put typename TransposeImpl<MatrixType,Sparse>:: in front of Index,
|
// NOTE: VC10 and VC11 trigger an ICE if don't put typename TransposeImpl<MatrixType,Sparse>:: in front of Index,
|
||||||
// a typedef typename TransposeImpl<MatrixType,Sparse>::Index Index;
|
// a typedef typename TransposeImpl<MatrixType,Sparse>::Index Index;
|
||||||
// does not fix the issue.
|
// does not fix the issue.
|
||||||
// An alternative is to define the nested class in the parent class itself.
|
// An alternative is to define the nested class in the parent class itself.
|
||||||
@@ -40,8 +40,8 @@ template<typename MatrixType> class TransposeImpl<MatrixType,Sparse>::InnerItera
|
|||||||
EIGEN_STRONG_INLINE InnerIterator(const TransposeImpl& trans, typename TransposeImpl<MatrixType,Sparse>::Index outer)
|
EIGEN_STRONG_INLINE InnerIterator(const TransposeImpl& trans, typename TransposeImpl<MatrixType,Sparse>::Index outer)
|
||||||
: Base(trans.derived().nestedExpression(), outer)
|
: Base(trans.derived().nestedExpression(), outer)
|
||||||
{}
|
{}
|
||||||
Index row() const { return Base::col(); }
|
typename TransposeImpl<MatrixType,Sparse>::Index row() const { return Base::col(); }
|
||||||
Index col() const { return Base::row(); }
|
typename TransposeImpl<MatrixType,Sparse>::Index col() const { return Base::row(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename MatrixType> class TransposeImpl<MatrixType,Sparse>::ReverseInnerIterator
|
template<typename MatrixType> class TransposeImpl<MatrixType,Sparse>::ReverseInnerIterator
|
||||||
@@ -54,8 +54,8 @@ template<typename MatrixType> class TransposeImpl<MatrixType,Sparse>::ReverseInn
|
|||||||
EIGEN_STRONG_INLINE ReverseInnerIterator(const TransposeImpl& xpr, typename TransposeImpl<MatrixType,Sparse>::Index outer)
|
EIGEN_STRONG_INLINE ReverseInnerIterator(const TransposeImpl& xpr, typename TransposeImpl<MatrixType,Sparse>::Index outer)
|
||||||
: Base(xpr.derived().nestedExpression(), outer)
|
: Base(xpr.derived().nestedExpression(), outer)
|
||||||
{}
|
{}
|
||||||
Index row() const { return Base::col(); }
|
typename TransposeImpl<MatrixType,Sparse>::Index row() const { return Base::col(); }
|
||||||
Index col() const { return Base::row(); }
|
typename TransposeImpl<MatrixType,Sparse>::Index col() const { return Base::row(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end namespace Eigen
|
} // end namespace Eigen
|
||||||
|
|||||||
@@ -67,7 +67,6 @@ const int InnerRandomAccessPattern = 0x2 | CoherentAccessPattern;
|
|||||||
const int OuterRandomAccessPattern = 0x4 | CoherentAccessPattern;
|
const int OuterRandomAccessPattern = 0x4 | CoherentAccessPattern;
|
||||||
const int RandomAccessPattern = 0x8 | OuterRandomAccessPattern | InnerRandomAccessPattern;
|
const int RandomAccessPattern = 0x8 | OuterRandomAccessPattern | InnerRandomAccessPattern;
|
||||||
|
|
||||||
template<typename Derived> class SparseMatrixBase;
|
|
||||||
template<typename _Scalar, int _Flags = 0, typename _Index = int> class SparseMatrix;
|
template<typename _Scalar, int _Flags = 0, typename _Index = int> class SparseMatrix;
|
||||||
template<typename _Scalar, int _Flags = 0, typename _Index = int> class DynamicSparseMatrix;
|
template<typename _Scalar, int _Flags = 0, typename _Index = int> class DynamicSparseMatrix;
|
||||||
template<typename _Scalar, int _Flags = 0, typename _Index = int> class SparseVector;
|
template<typename _Scalar, int _Flags = 0, typename _Index = int> class SparseVector;
|
||||||
@@ -84,8 +83,10 @@ template<typename Lhs, typename Rhs> class DenseTimeSparseProduct;
|
|||||||
template<typename Lhs, typename Rhs, bool Transpose> class SparseDenseOuterProduct;
|
template<typename Lhs, typename Rhs, bool Transpose> class SparseDenseOuterProduct;
|
||||||
|
|
||||||
template<typename Lhs, typename Rhs> struct SparseSparseProductReturnType;
|
template<typename Lhs, typename Rhs> struct SparseSparseProductReturnType;
|
||||||
template<typename Lhs, typename Rhs, int InnerSize = internal::traits<Lhs>::ColsAtCompileTime> struct DenseSparseProductReturnType;
|
template<typename Lhs, typename Rhs,
|
||||||
template<typename Lhs, typename Rhs, int InnerSize = internal::traits<Lhs>::ColsAtCompileTime> struct SparseDenseProductReturnType;
|
int InnerSize = EIGEN_SIZE_MIN_PREFER_FIXED(internal::traits<Lhs>::ColsAtCompileTime,internal::traits<Rhs>::RowsAtCompileTime)> struct DenseSparseProductReturnType;
|
||||||
|
template<typename Lhs, typename Rhs,
|
||||||
|
int InnerSize = EIGEN_SIZE_MIN_PREFER_FIXED(internal::traits<Lhs>::ColsAtCompileTime,internal::traits<Rhs>::RowsAtCompileTime)> struct SparseDenseProductReturnType;
|
||||||
template<typename MatrixType,int UpLo> class SparseSymmetricPermutationProduct;
|
template<typename MatrixType,int UpLo> class SparseSymmetricPermutationProduct;
|
||||||
|
|
||||||
namespace internal {
|
namespace internal {
|
||||||
|
|||||||
@@ -158,6 +158,7 @@ class SparseVector
|
|||||||
|
|
||||||
Index inner = IsColVector ? row : col;
|
Index inner = IsColVector ? row : col;
|
||||||
Index outer = IsColVector ? col : row;
|
Index outer = IsColVector ? col : row;
|
||||||
|
EIGEN_ONLY_USED_FOR_DEBUG(outer);
|
||||||
eigen_assert(outer==0);
|
eigen_assert(outer==0);
|
||||||
return insert(inner);
|
return insert(inner);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ struct sparse_solve_triangular_selector<Lhs,Rhs,Mode,Upper,RowMajor>
|
|||||||
for(int i=lhs.rows()-1 ; i>=0 ; --i)
|
for(int i=lhs.rows()-1 ; i>=0 ; --i)
|
||||||
{
|
{
|
||||||
Scalar tmp = other.coeff(i,col);
|
Scalar tmp = other.coeff(i,col);
|
||||||
Scalar l_ii = 0;
|
Scalar l_ii(0);
|
||||||
typename Lhs::InnerIterator it(lhs, i);
|
typename Lhs::InnerIterator it(lhs, i);
|
||||||
while(it && it.index()<i)
|
while(it && it.index()<i)
|
||||||
++it;
|
++it;
|
||||||
|
|||||||
@@ -260,16 +260,16 @@ class SparseLU : public internal::SparseLUImpl<typename _MatrixType::Scalar, typ
|
|||||||
eigen_assert(m_factorizationIsOk && "The matrix should be factorized first.");
|
eigen_assert(m_factorizationIsOk && "The matrix should be factorized first.");
|
||||||
// Initialize with the determinant of the row matrix
|
// Initialize with the determinant of the row matrix
|
||||||
Scalar det = Scalar(1.);
|
Scalar det = Scalar(1.);
|
||||||
//Note that the diagonal blocks of U are stored in supernodes,
|
// Note that the diagonal blocks of U are stored in supernodes,
|
||||||
// which are available in the L part :)
|
// which are available in the L part :)
|
||||||
for (Index j = 0; j < this->cols(); ++j)
|
for (Index j = 0; j < this->cols(); ++j)
|
||||||
{
|
{
|
||||||
for (typename SCMatrix::InnerIterator it(m_Lstore, j); it; ++it)
|
for (typename SCMatrix::InnerIterator it(m_Lstore, j); it; ++it)
|
||||||
{
|
{
|
||||||
if(it.row() < j) continue;
|
if(it.index() == j)
|
||||||
if(it.row() == j)
|
|
||||||
{
|
{
|
||||||
det *= (std::abs)(it.value());
|
using std::abs;
|
||||||
|
det *= abs(it.value());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -296,7 +296,8 @@ class SparseLU : public internal::SparseLUImpl<typename _MatrixType::Scalar, typ
|
|||||||
if(it.row() < j) continue;
|
if(it.row() < j) continue;
|
||||||
if(it.row() == j)
|
if(it.row() == j)
|
||||||
{
|
{
|
||||||
det += (std::log)((std::abs)(it.value()));
|
using std::log; using std::abs;
|
||||||
|
det += log(abs(it.value()));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -304,21 +305,64 @@ class SparseLU : public internal::SparseLUImpl<typename _MatrixType::Scalar, typ
|
|||||||
return det;
|
return det;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** \returns A number representing the sign of the determinant
|
/** \returns A number representing the sign of the determinant
|
||||||
*
|
*
|
||||||
* \sa absDeterminant(), logAbsDeterminant()
|
* \sa absDeterminant(), logAbsDeterminant()
|
||||||
*/
|
*/
|
||||||
Scalar signDeterminant()
|
Scalar signDeterminant()
|
||||||
{
|
{
|
||||||
eigen_assert(m_factorizationIsOk && "The matrix should be factorized first.");
|
eigen_assert(m_factorizationIsOk && "The matrix should be factorized first.");
|
||||||
return Scalar(m_detPermR);
|
// Initialize with the determinant of the row matrix
|
||||||
}
|
Index det = 1;
|
||||||
|
// Note that the diagonal blocks of U are stored in supernodes,
|
||||||
|
// which are available in the L part :)
|
||||||
|
for (Index j = 0; j < this->cols(); ++j)
|
||||||
|
{
|
||||||
|
for (typename SCMatrix::InnerIterator it(m_Lstore, j); it; ++it)
|
||||||
|
{
|
||||||
|
if(it.index() == j)
|
||||||
|
{
|
||||||
|
if(it.value()<0)
|
||||||
|
det = -det;
|
||||||
|
else if(it.value()==0)
|
||||||
|
return 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return det * m_detPermR * m_detPermC;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** \returns The determinant of the matrix.
|
||||||
|
*
|
||||||
|
* \sa absDeterminant(), logAbsDeterminant()
|
||||||
|
*/
|
||||||
|
Scalar determinant()
|
||||||
|
{
|
||||||
|
eigen_assert(m_factorizationIsOk && "The matrix should be factorized first.");
|
||||||
|
// Initialize with the determinant of the row matrix
|
||||||
|
Scalar det = Scalar(1.);
|
||||||
|
// Note that the diagonal blocks of U are stored in supernodes,
|
||||||
|
// which are available in the L part :)
|
||||||
|
for (Index j = 0; j < this->cols(); ++j)
|
||||||
|
{
|
||||||
|
for (typename SCMatrix::InnerIterator it(m_Lstore, j); it; ++it)
|
||||||
|
{
|
||||||
|
if(it.index() == j)
|
||||||
|
{
|
||||||
|
det *= it.value();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return det * Scalar(m_detPermR * m_detPermC);
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Functions
|
// Functions
|
||||||
void initperfvalues()
|
void initperfvalues()
|
||||||
{
|
{
|
||||||
m_perfv.panel_size = 1;
|
m_perfv.panel_size = 16;
|
||||||
m_perfv.relax = 1;
|
m_perfv.relax = 1;
|
||||||
m_perfv.maxsuper = 128;
|
m_perfv.maxsuper = 128;
|
||||||
m_perfv.rowblk = 16;
|
m_perfv.rowblk = 16;
|
||||||
@@ -346,8 +390,8 @@ class SparseLU : public internal::SparseLUImpl<typename _MatrixType::Scalar, typ
|
|||||||
// values for performance
|
// values for performance
|
||||||
internal::perfvalues<Index> m_perfv;
|
internal::perfvalues<Index> m_perfv;
|
||||||
RealScalar m_diagpivotthresh; // Specifies the threshold used for a diagonal entry to be an acceptable pivot
|
RealScalar m_diagpivotthresh; // Specifies the threshold used for a diagonal entry to be an acceptable pivot
|
||||||
Index m_nnzL, m_nnzU; // Nonzeros in L and U factors
|
Index m_nnzL, m_nnzU; // Nonzeros in L and U factors
|
||||||
Index m_detPermR; // Determinant of the coefficient matrix
|
Index m_detPermR, m_detPermC; // Determinants of the permutation matrices
|
||||||
private:
|
private:
|
||||||
// Disable copy constructor
|
// Disable copy constructor
|
||||||
SparseLU (const SparseLU& );
|
SparseLU (const SparseLU& );
|
||||||
@@ -623,7 +667,8 @@ void SparseLU<MatrixType, OrderingType>::factorize(const MatrixType& matrix)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Update the determinant of the row permutation matrix
|
// Update the determinant of the row permutation matrix
|
||||||
if (pivrow != jj) m_detPermR *= -1;
|
// FIXME: the following test is not correct, we should probably take iperm_c into account and pivrow is not directly the row pivot.
|
||||||
|
if (pivrow != jj) m_detPermR = -m_detPermR;
|
||||||
|
|
||||||
// Prune columns (0:jj-1) using column jj
|
// Prune columns (0:jj-1) using column jj
|
||||||
Base::pruneL(jj, m_perm_r.indices(), pivrow, nseg, segrep, repfnz_k, xprune, m_glu);
|
Base::pruneL(jj, m_perm_r.indices(), pivrow, nseg, segrep, repfnz_k, xprune, m_glu);
|
||||||
@@ -638,10 +683,13 @@ void SparseLU<MatrixType, OrderingType>::factorize(const MatrixType& matrix)
|
|||||||
jcol += panel_size; // Move to the next panel
|
jcol += panel_size; // Move to the next panel
|
||||||
} // end for -- end elimination
|
} // end for -- end elimination
|
||||||
|
|
||||||
|
m_detPermR = m_perm_r.determinant();
|
||||||
|
m_detPermC = m_perm_c.determinant();
|
||||||
|
|
||||||
// Count the number of nonzeros in factors
|
// Count the number of nonzeros in factors
|
||||||
Base::countnz(n, m_nnzL, m_nnzU, m_glu);
|
Base::countnz(n, m_nnzL, m_nnzU, m_glu);
|
||||||
// Apply permutation to the L subscripts
|
// Apply permutation to the L subscripts
|
||||||
Base::fixupL(n, m_perm_r.indices(), m_glu);
|
Base::fixupL(n, m_perm_r.indices(), m_glu);
|
||||||
|
|
||||||
// Create supernode matrix L
|
// Create supernode matrix L
|
||||||
m_Lstore.setInfos(m, n, m_glu.lusup, m_glu.xlusup, m_glu.lsub, m_glu.xlsub, m_glu.supno, m_glu.xsup);
|
m_Lstore.setInfos(m, n, m_glu.lusup, m_glu.xlusup, m_glu.lsub, m_glu.xlsub, m_glu.supno, m_glu.xsup);
|
||||||
@@ -701,8 +749,8 @@ struct SparseLUMatrixUReturnType : internal::no_assignment_operator
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Map<const Matrix<Scalar,Dynamic,Dynamic>, 0, OuterStride<> > A( &(m_mapL.valuePtr()[luptr]), nsupc, nsupc, OuterStride<>(lda) );
|
Map<const Matrix<Scalar,Dynamic,Dynamic, ColMajor>, 0, OuterStride<> > A( &(m_mapL.valuePtr()[luptr]), nsupc, nsupc, OuterStride<>(lda) );
|
||||||
Map< Matrix<Scalar,Dynamic,Dynamic>, 0, OuterStride<> > U (&(X(fsupc,0)), nsupc, nrhs, OuterStride<>(n) );
|
Map< Matrix<Scalar,Dynamic,Dynamic, ColMajor>, 0, OuterStride<> > U (&(X(fsupc,0)), nsupc, nrhs, OuterStride<>(n) );
|
||||||
U = A.template triangularView<Upper>().solve(U);
|
U = A.template triangularView<Upper>().solve(U);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,8 @@ class SparseLUImpl
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef Matrix<Scalar,Dynamic,1> ScalarVector;
|
typedef Matrix<Scalar,Dynamic,1> ScalarVector;
|
||||||
|
typedef Matrix<Scalar,Dynamic,Dynamic,ColMajor> ScalarMatrix;
|
||||||
|
typedef Map<ScalarMatrix, 0, OuterStride<> > MappedMatrixBlock;
|
||||||
typedef Matrix<Index,Dynamic,1> IndexVector;
|
typedef Matrix<Index,Dynamic,1> IndexVector;
|
||||||
typedef typename ScalarVector::RealScalar RealScalar;
|
typedef typename ScalarVector::RealScalar RealScalar;
|
||||||
typedef Ref<Matrix<Scalar,Dynamic,1> > BlockScalarVector;
|
typedef Ref<Matrix<Scalar,Dynamic,1> > BlockScalarVector;
|
||||||
|
|||||||
@@ -153,8 +153,8 @@ Index SparseLUImpl<Scalar,Index>::memInit(Index m, Index n, Index annz, Index lw
|
|||||||
{
|
{
|
||||||
Index& num_expansions = glu.num_expansions; //No memory expansions so far
|
Index& num_expansions = glu.num_expansions; //No memory expansions so far
|
||||||
num_expansions = 0;
|
num_expansions = 0;
|
||||||
glu.nzumax = glu.nzlumax = (std::min)(fillratio * annz / n, m) * n; // estimated number of nonzeros in U
|
glu.nzumax = glu.nzlumax = (std::min)(fillratio * (annz+1) / n, m) * n; // estimated number of nonzeros in U
|
||||||
glu.nzlmax = (std::max)(Index(4), fillratio) * annz / 4; // estimated nnz in L factor
|
glu.nzlmax = (std::max)(Index(4), fillratio) * (annz+1) / 4; // estimated nnz in L factor
|
||||||
// Return the estimated size to the user if necessary
|
// Return the estimated size to the user if necessary
|
||||||
Index tempSpace;
|
Index tempSpace;
|
||||||
tempSpace = (2*panel_size + 4 + LUNoMarker) * m * sizeof(Index) + (panel_size + 1) * m * sizeof(Scalar);
|
tempSpace = (2*panel_size + 4 + LUNoMarker) * m * sizeof(Index) + (panel_size + 1) * m * sizeof(Scalar);
|
||||||
|
|||||||
@@ -189,8 +189,8 @@ class MappedSuperNodalMatrix<Scalar,Index>::InnerIterator
|
|||||||
m_idval(mat.colIndexPtr()[outer]),
|
m_idval(mat.colIndexPtr()[outer]),
|
||||||
m_startidval(m_idval),
|
m_startidval(m_idval),
|
||||||
m_endidval(mat.colIndexPtr()[outer+1]),
|
m_endidval(mat.colIndexPtr()[outer+1]),
|
||||||
m_idrow(mat.rowIndexPtr()[outer]),
|
m_idrow(mat.rowIndexPtr()[mat.supToCol()[mat.colToSup()[outer]]]),
|
||||||
m_endidrow(mat.rowIndexPtr()[outer+1])
|
m_endidrow(mat.rowIndexPtr()[mat.supToCol()[mat.colToSup()[outer]]+1])
|
||||||
{}
|
{}
|
||||||
inline InnerIterator& operator++()
|
inline InnerIterator& operator++()
|
||||||
{
|
{
|
||||||
@@ -236,7 +236,7 @@ void MappedSuperNodalMatrix<Scalar,Index>::solveInPlace( MatrixBase<Dest>&X) con
|
|||||||
Index n = X.rows();
|
Index n = X.rows();
|
||||||
Index nrhs = X.cols();
|
Index nrhs = X.cols();
|
||||||
const Scalar * Lval = valuePtr(); // Nonzero values
|
const Scalar * Lval = valuePtr(); // Nonzero values
|
||||||
Matrix<Scalar,Dynamic,Dynamic> work(n, nrhs); // working vector
|
Matrix<Scalar,Dynamic,Dynamic, ColMajor> work(n, nrhs); // working vector
|
||||||
work.setZero();
|
work.setZero();
|
||||||
for (Index k = 0; k <= nsuper(); k ++)
|
for (Index k = 0; k <= nsuper(); k ++)
|
||||||
{
|
{
|
||||||
@@ -267,12 +267,12 @@ void MappedSuperNodalMatrix<Scalar,Index>::solveInPlace( MatrixBase<Dest>&X) con
|
|||||||
Index lda = colIndexPtr()[fsupc+1] - luptr;
|
Index lda = colIndexPtr()[fsupc+1] - luptr;
|
||||||
|
|
||||||
// Triangular solve
|
// Triangular solve
|
||||||
Map<const Matrix<Scalar,Dynamic,Dynamic>, 0, OuterStride<> > A( &(Lval[luptr]), nsupc, nsupc, OuterStride<>(lda) );
|
Map<const Matrix<Scalar,Dynamic,Dynamic, ColMajor>, 0, OuterStride<> > A( &(Lval[luptr]), nsupc, nsupc, OuterStride<>(lda) );
|
||||||
Map< Matrix<Scalar,Dynamic,Dynamic>, 0, OuterStride<> > U (&(X(fsupc,0)), nsupc, nrhs, OuterStride<>(n) );
|
Map< Matrix<Scalar,Dynamic,Dynamic, ColMajor>, 0, OuterStride<> > U (&(X(fsupc,0)), nsupc, nrhs, OuterStride<>(n) );
|
||||||
U = A.template triangularView<UnitLower>().solve(U);
|
U = A.template triangularView<UnitLower>().solve(U);
|
||||||
|
|
||||||
// Matrix-vector product
|
// Matrix-vector product
|
||||||
new (&A) Map<const Matrix<Scalar,Dynamic,Dynamic>, 0, OuterStride<> > ( &(Lval[luptr+nsupc]), nrow, nsupc, OuterStride<>(lda) );
|
new (&A) Map<const Matrix<Scalar,Dynamic,Dynamic, ColMajor>, 0, OuterStride<> > ( &(Lval[luptr+nsupc]), nrow, nsupc, OuterStride<>(lda) );
|
||||||
work.block(0, 0, nrow, nrhs) = A * U;
|
work.block(0, 0, nrow, nrhs) = A * U;
|
||||||
|
|
||||||
//Begin Scatter
|
//Begin Scatter
|
||||||
|
|||||||
@@ -162,11 +162,11 @@ Index SparseLUImpl<Scalar,Index>::column_bmod(const Index jcol, const Index nseg
|
|||||||
// points to the beginning of jcol in snode L\U(jsupno)
|
// points to the beginning of jcol in snode L\U(jsupno)
|
||||||
ufirst = glu.xlusup(jcol) + d_fsupc;
|
ufirst = glu.xlusup(jcol) + d_fsupc;
|
||||||
Index lda = glu.xlusup(jcol+1) - glu.xlusup(jcol);
|
Index lda = glu.xlusup(jcol+1) - glu.xlusup(jcol);
|
||||||
Map<Matrix<Scalar,Dynamic,Dynamic>, 0, OuterStride<> > A( &(glu.lusup.data()[luptr]), nsupc, nsupc, OuterStride<>(lda) );
|
MappedMatrixBlock A( &(glu.lusup.data()[luptr]), nsupc, nsupc, OuterStride<>(lda) );
|
||||||
VectorBlock<ScalarVector> u(glu.lusup, ufirst, nsupc);
|
VectorBlock<ScalarVector> u(glu.lusup, ufirst, nsupc);
|
||||||
u = A.template triangularView<UnitLower>().solve(u);
|
u = A.template triangularView<UnitLower>().solve(u);
|
||||||
|
|
||||||
new (&A) Map<Matrix<Scalar,Dynamic,Dynamic>, 0, OuterStride<> > ( &(glu.lusup.data()[luptr+nsupc]), nrow, nsupc, OuterStride<>(lda) );
|
new (&A) MappedMatrixBlock ( &(glu.lusup.data()[luptr+nsupc]), nrow, nsupc, OuterStride<>(lda) );
|
||||||
VectorBlock<ScalarVector> l(glu.lusup, ufirst+nsupc, nrow);
|
VectorBlock<ScalarVector> l(glu.lusup, ufirst+nsupc, nrow);
|
||||||
l.noalias() -= A * u;
|
l.noalias() -= A * u;
|
||||||
|
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ EIGEN_DONT_INLINE void LU_kernel_bmod<SegSizeAtCompileTime>::run(const int segsi
|
|||||||
// Dense triangular solve -- start effective triangle
|
// Dense triangular solve -- start effective triangle
|
||||||
luptr += lda * no_zeros + no_zeros;
|
luptr += lda * no_zeros + no_zeros;
|
||||||
// Form Eigen matrix and vector
|
// Form Eigen matrix and vector
|
||||||
Map<Matrix<Scalar,SegSizeAtCompileTime,SegSizeAtCompileTime>, 0, OuterStride<> > A( &(lusup.data()[luptr]), segsize, segsize, OuterStride<>(lda) );
|
Map<Matrix<Scalar,SegSizeAtCompileTime,SegSizeAtCompileTime, ColMajor>, 0, OuterStride<> > A( &(lusup.data()[luptr]), segsize, segsize, OuterStride<>(lda) );
|
||||||
Map<Matrix<Scalar,SegSizeAtCompileTime,1> > u(tempv.data(), segsize);
|
Map<Matrix<Scalar,SegSizeAtCompileTime,1> > u(tempv.data(), segsize);
|
||||||
|
|
||||||
u = A.template triangularView<UnitLower>().solve(u);
|
u = A.template triangularView<UnitLower>().solve(u);
|
||||||
@@ -65,7 +65,7 @@ EIGEN_DONT_INLINE void LU_kernel_bmod<SegSizeAtCompileTime>::run(const int segsi
|
|||||||
luptr += segsize;
|
luptr += segsize;
|
||||||
const Index PacketSize = internal::packet_traits<Scalar>::size;
|
const Index PacketSize = internal::packet_traits<Scalar>::size;
|
||||||
Index ldl = internal::first_multiple(nrow, PacketSize);
|
Index ldl = internal::first_multiple(nrow, PacketSize);
|
||||||
Map<Matrix<Scalar,Dynamic,SegSizeAtCompileTime>, 0, OuterStride<> > B( &(lusup.data()[luptr]), nrow, segsize, OuterStride<>(lda) );
|
Map<Matrix<Scalar,Dynamic,SegSizeAtCompileTime, ColMajor>, 0, OuterStride<> > B( &(lusup.data()[luptr]), nrow, segsize, OuterStride<>(lda) );
|
||||||
Index aligned_offset = internal::first_aligned(tempv.data()+segsize, PacketSize);
|
Index aligned_offset = internal::first_aligned(tempv.data()+segsize, PacketSize);
|
||||||
Index aligned_with_B_offset = (PacketSize-internal::first_aligned(B.data(), PacketSize))%PacketSize;
|
Index aligned_with_B_offset = (PacketSize-internal::first_aligned(B.data(), PacketSize))%PacketSize;
|
||||||
Map<Matrix<Scalar,Dynamic,1>, 0, OuterStride<> > l(tempv.data()+segsize+aligned_offset+aligned_with_B_offset, nrow, OuterStride<>(ldl) );
|
Map<Matrix<Scalar,Dynamic,1>, 0, OuterStride<> > l(tempv.data()+segsize+aligned_offset+aligned_with_B_offset, nrow, OuterStride<>(ldl) );
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user