Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8687f1d641 | ||
|
|
45bc3e2781 | ||
|
|
eae8dea3dd | ||
|
|
5c82dd9538 | ||
|
|
f5bf32c5ae | ||
|
|
be109e1f87 | ||
|
|
22d27cb9dc | ||
|
|
b04ed326c4 | ||
|
|
aff2df8a3a | ||
|
|
4decbcb0dc | ||
|
|
205c553314 | ||
|
|
80883afcbb | ||
|
|
5dca4d081d | ||
|
|
31571783c6 | ||
|
|
8411f0462d | ||
|
|
bf2ad91d0e | ||
|
|
7911d428ab | ||
|
|
57915c6829 | ||
|
|
e8b929057a | ||
|
|
6f42ad81bc | ||
|
|
d1ff882b6d | ||
|
|
340fcd6098 | ||
|
|
891f6be585 | ||
|
|
5dab351d5a | ||
|
|
6391abd43f | ||
|
|
6baba4874f | ||
|
|
ae1e45b5f4 | ||
|
|
c74a679811 | ||
|
|
a95c008e4f | ||
|
|
7b53baebad | ||
|
|
e6d538d3b6 | ||
|
|
24cc3bd4fa | ||
|
|
d92c5f1db4 | ||
|
|
2602b4c5cd | ||
|
|
19c8ea1dfc | ||
|
|
3badbee4dd | ||
|
|
50fb1d1f79 | ||
|
|
569b90aa8b | ||
|
|
bf58905ccc | ||
|
|
39d7e52edd | ||
|
|
daca57f026 | ||
|
|
9f5cada7a8 | ||
|
|
32344bea0f | ||
|
|
35c1c08d5c | ||
|
|
c0189ee325 | ||
|
|
f1c4aef217 | ||
|
|
90d325fc67 | ||
|
|
e9d3fae770 | ||
|
|
cfbdd908c5 | ||
|
|
807ad7df69 | ||
|
|
dcf06a3a8d | ||
|
|
18e13074e1 | ||
|
|
cc7de6b5f0 | ||
|
|
83b37ab286 | ||
|
|
34bf20a5e5 | ||
|
|
0f336255c8 | ||
|
|
21143960d9 | ||
|
|
882868acef | ||
|
|
1f60dcab4c | ||
|
|
407077ba03 | ||
|
|
782a01190c | ||
|
|
a98b3eacc9 | ||
|
|
85d06ca845 | ||
|
|
b667aa1a42 | ||
|
|
b3e864f3be | ||
|
|
576f24ee19 | ||
|
|
0713427be7 | ||
|
|
fa460e0b33 | ||
|
|
ffb3ae2559 | ||
|
|
4e79b4baae | ||
|
|
ddd1a2b4f3 | ||
|
|
28ba324471 | ||
|
|
6023d8ea88 | ||
|
|
8af3b53cc6 | ||
|
|
68ac406468 | ||
|
|
214e6a5933 | ||
|
|
93bf6ec80e | ||
|
|
4d15f3b706 | ||
|
|
115f530306 | ||
|
|
328f928c48 | ||
|
|
7caf3c23f6 | ||
|
|
2a97320d1f | ||
|
|
694bcf1d0f | ||
|
|
947391cf88 | ||
|
|
d2a1a72fc9 | ||
|
|
325e5cb501 | ||
|
|
80e3b533f4 | ||
|
|
ab9a7a2921 | ||
|
|
ec22f2167a | ||
|
|
7ff191d4d9 | ||
|
|
88bcc11160 | ||
|
|
1a9a31ee17 | ||
|
|
5a10026512 | ||
|
|
a347cec938 | ||
|
|
1b15151d75 | ||
|
|
8ad53507d9 | ||
|
|
b723b59a28 | ||
|
|
ce5dc6cc81 | ||
|
|
dd8b62e660 | ||
|
|
2dd7cfd123 | ||
|
|
98876ab174 | ||
|
|
ee40a879d7 | ||
|
|
b99d943858 | ||
|
|
ecd00d7b37 | ||
|
|
4da9f7ad45 | ||
|
|
765e9700fd | ||
|
|
b3717e02e9 | ||
|
|
122fb68122 | ||
|
|
11c72ca792 | ||
|
|
a15315e320 | ||
|
|
7ccf937a81 | ||
|
|
189aadca8f | ||
|
|
4e96a42c81 | ||
|
|
3a12b86552 | ||
|
|
93abe2557d | ||
|
|
332b3cc853 | ||
|
|
28f79c0220 | ||
|
|
cbdec3e63e | ||
|
|
b398efc161 | ||
|
|
e62c3d5053 | ||
|
|
c2b1152d8f | ||
|
|
cde8f16c55 | ||
|
|
c23f14db29 | ||
|
|
f83e8d0efc | ||
|
|
0f3c1eec74 | ||
|
|
b21eefc349 | ||
|
|
fbb4d4b1f1 | ||
|
|
0d38132f48 | ||
|
|
17bed92da1 | ||
|
|
edb8c9baa6 | ||
|
|
3ee77a6ded | ||
|
|
ea906f7916 | ||
|
|
80f810a4c1 | ||
|
|
a1795621f8 | ||
|
|
bf5a62b099 | ||
|
|
567ad10f36 | ||
|
|
f6d51cbd44 | ||
|
|
07e5cc59cd | ||
|
|
0f51020a06 | ||
|
|
c223b70d2d | ||
|
|
3d6fd3139a | ||
|
|
3b9e384ecb | ||
|
|
43dc821982 | ||
|
|
aec3f3046d | ||
|
|
d9b38626f0 | ||
|
|
239e0ac643 | ||
|
|
43718b402d | ||
|
|
42a4110a33 | ||
|
|
c1c156ac4c | ||
|
|
91f82106ef | ||
|
|
fbc5297318 | ||
|
|
95939acacd | ||
|
|
181a0d328e | ||
|
|
bec06a2c8b | ||
|
|
62674c9f54 | ||
|
|
6253097d1a | ||
|
|
b8a4806f1a | ||
|
|
85cdc822be | ||
|
|
6475be3cbd | ||
|
|
140962708c | ||
|
|
23110bd728 | ||
|
|
f729048800 | ||
|
|
5448d0b758 | ||
|
|
3769c40b0a | ||
|
|
798d943a16 | ||
|
|
6008caafd6 | ||
|
|
12977d32b6 | ||
|
|
8a846f1881 | ||
|
|
20735fa847 | ||
|
|
d8836a59ce | ||
|
|
c34719bac4 | ||
|
|
0d4a76f08a | ||
|
|
07a731c28e | ||
|
|
57b1402bbc | ||
|
|
3927599903 | ||
|
|
37636f79c7 | ||
|
|
923413058d | ||
|
|
9a345a2bf1 | ||
|
|
22b9bb9dff | ||
|
|
3dee8a53ec | ||
|
|
3453c2c29c | ||
|
|
017bd14cf4 | ||
|
|
6ee9bb29e0 | ||
|
|
a1cf627cb7 | ||
|
|
b4ae414a3b | ||
|
|
ca2e55dc87 | ||
|
|
01f084cbb1 | ||
|
|
8b21698904 | ||
|
|
0ef34c8fe0 | ||
|
|
e4c2459d44 | ||
|
|
6e38cda2cf | ||
|
|
89abc9bd95 | ||
|
|
971ad8b22d | ||
|
|
0e949f440e | ||
|
|
6ed04c84a2 | ||
|
|
fa94617b7c | ||
|
|
86b384cde0 | ||
|
|
0b2b77275c | ||
|
|
1f126e0015 | ||
|
|
1824bff7b2 | ||
|
|
48bf439468 | ||
|
|
94b4bb49d1 | ||
|
|
75b1cee3fe | ||
|
|
950f5cb67b | ||
|
|
4e68fc568e | ||
|
|
5cd47e4a5f | ||
|
|
d2f582d687 | ||
|
|
1b346c62b0 | ||
|
|
3e8ff3e586 | ||
|
|
9f20635676 | ||
|
|
0ef22a7d45 | ||
|
|
d15e852bd5 | ||
|
|
abcd0e6536 | ||
|
|
c02b00d817 | ||
|
|
6a4ea5716e | ||
|
|
6024ff7915 | ||
|
|
b829608b35 | ||
|
|
819da3a353 | ||
|
|
46486467e2 | ||
|
|
858a389250 | ||
|
|
b16faaf719 | ||
|
|
edab0bb57e | ||
|
|
64a6207c1b | ||
|
|
283229956d | ||
|
|
e3e71c1920 | ||
|
|
0b55380367 | ||
|
|
654726628b | ||
|
|
f4321b78c9 | ||
|
|
003f98c65a | ||
|
|
037c713006 | ||
|
|
7ca6df6c03 | ||
|
|
6f49b3e29b | ||
|
|
801709342c | ||
|
|
2413580838 | ||
|
|
b0e707ff0c | ||
|
|
7f84831ad5 | ||
|
|
288b8d7aa1 | ||
|
|
3efb0934ee | ||
|
|
02c88eda25 | ||
|
|
8e9a6d3475 | ||
|
|
a78f419b03 | ||
|
|
ad93a9eb4b | ||
|
|
3163e17563 | ||
|
|
f3f5607eb4 | ||
|
|
25400b64cd | ||
|
|
bc655f3e69 | ||
|
|
e6a8fd427f | ||
|
|
0be09a4569 | ||
|
|
eb47b8924f | ||
|
|
55a1fb33a0 | ||
|
|
4fe10bebb1 | ||
|
|
3cb1632fa4 | ||
|
|
1ea2c69c39 | ||
|
|
781670cc8b | ||
|
|
e0bee86037 | ||
|
|
1e11ebd499 | ||
|
|
7c9526582b | ||
|
|
53ead8be9f | ||
|
|
01fb08b8cf | ||
|
|
6e30a2554b | ||
|
|
df3f18e2a9 | ||
|
|
4a1695cd1a | ||
|
|
595bac19f1 | ||
|
|
7c7c94e831 | ||
|
|
5de154398f | ||
|
|
106d15336f | ||
|
|
c77227050a | ||
|
|
a8a97d1613 | ||
|
|
3dd4d6f123 | ||
|
|
6ee8237866 | ||
|
|
806ea6c893 | ||
|
|
13d1505f72 | ||
|
|
5fab481759 | ||
|
|
b17d15c4f0 | ||
|
|
0dc6d0c43e | ||
|
|
49d46b9347 | ||
|
|
3d344d59c5 | ||
|
|
b957c788de | ||
|
|
c43e3f8afe | ||
|
|
a618439546 | ||
|
|
b529572a26 | ||
|
|
df94abdfe3 | ||
|
|
ae9ee36708 | ||
|
|
de5b771360 | ||
|
|
2a84a32ced | ||
|
|
300acccb7f | ||
|
|
6b0d4b0753 | ||
|
|
3bf6b9d8b6 | ||
|
|
1438dc70da | ||
|
|
203b8edc59 | ||
|
|
3260d531c2 | ||
|
|
9fbc6e175c | ||
|
|
a5c8c3c4ad | ||
|
|
352909ed77 | ||
|
|
dee2e4d9a4 | ||
|
|
e03dfbe80a | ||
|
|
1f60240d64 | ||
|
|
0678dddef7 | ||
|
|
26c85fca3b | ||
|
|
de7ac59cd1 | ||
|
|
90583f252b | ||
|
|
622eb49768 | ||
|
|
3e6e4df209 | ||
|
|
9cd78c2287 | ||
|
|
c14c4a3975 | ||
|
|
50c6ce40f3 | ||
|
|
4529818c7d | ||
|
|
fcf83808b4 | ||
|
|
2e3857063d | ||
|
|
4bf1e67fef | ||
|
|
c856ef7248 | ||
|
|
27036df322 | ||
|
|
8c97ea4df1 | ||
|
|
c9a848dc5d | ||
|
|
317718223f | ||
|
|
7fb6bd1532 | ||
|
|
ca436d3aca | ||
|
|
355a3b9a9f | ||
|
|
421aae25e5 | ||
|
|
ab314e186d | ||
|
|
8781d9f2e7 | ||
|
|
1c43f43a40 | ||
|
|
40c0f346bd | ||
|
|
5bc4f7b321 | ||
|
|
e11ceea0fa | ||
|
|
e8f745c3ae | ||
|
|
49ff02882a | ||
|
|
d6f14704ba | ||
|
|
b9bd406c93 | ||
|
|
7b4e11c6ed | ||
|
|
a0a60acbf0 | ||
|
|
656189c899 | ||
|
|
7caf00caff | ||
|
|
dff7f6017d | ||
|
|
d484903646 | ||
|
|
df2120d22a | ||
|
|
ab89a05146 | ||
|
|
2c9e2851d5 | ||
|
|
8826ae9306 | ||
|
|
cf2f390059 | ||
|
|
0300641b8f | ||
|
|
903d75bd95 | ||
|
|
9f737e592d | ||
|
|
fcc145f755 | ||
|
|
012ab663e0 | ||
|
|
67600133c2 | ||
|
|
66c32403a0 | ||
|
|
d0c0bcec22 | ||
|
|
d6a2b6e185 | ||
|
|
c7e0038ff2 | ||
|
|
8cec5cdc13 | ||
|
|
e592d9f496 | ||
|
|
17acca7dd9 | ||
|
|
5e7c574c25 | ||
|
|
2b3e4bec4f | ||
|
|
4b29ef0cb4 | ||
|
|
de53ec68e1 | ||
|
|
27c625980b | ||
|
|
f9462b4114 | ||
|
|
92b36de2c9 | ||
|
|
ce546a0c1c | ||
|
|
4a505badd4 | ||
|
|
aa8ee5e1c0 | ||
|
|
f2be0da21c | ||
|
|
0297cb58f7 | ||
|
|
76f6f4ff41 | ||
|
|
e6c58ad5b7 | ||
|
|
a5479bd433 | ||
|
|
39c7f39388 | ||
|
|
483fee2b46 | ||
|
|
19d7540f0c | ||
|
|
2f66c3c306 | ||
|
|
8de8c98ed4 | ||
|
|
11362c5db5 | ||
|
|
764c77d5a3 | ||
|
|
78711ba006 | ||
|
|
4a5293ec87 | ||
|
|
393754f3d9 | ||
|
|
12c9ec507c | ||
|
|
72386a6550 | ||
|
|
d04cefe711 | ||
|
|
7894aefa8e | ||
|
|
7e2427b769 | ||
|
|
faf6c8f4ae | ||
|
|
8efc4504ce | ||
|
|
00600d5346 | ||
|
|
7706301d3e | ||
|
|
b021217b28 | ||
|
|
4ff464fb03 | ||
|
|
a1e0c3044e | ||
|
|
0894c11b33 | ||
|
|
d5752c4d27 | ||
|
|
11c8a05f85 | ||
|
|
7ca483dea2 | ||
|
|
4d54a830d9 | ||
|
|
ee6ce32ebc | ||
|
|
968cbee845 | ||
|
|
17a9e4cf6b | ||
|
|
0e00caf722 | ||
|
|
07579bb194 | ||
|
|
c351f5ebd0 | ||
|
|
87e631421b | ||
|
|
3fd74d24b1 | ||
|
|
be96b16f9b | ||
|
|
8b94ae0a62 | ||
|
|
e3ab3b6d59 | ||
|
|
ae95b1a7e0 | ||
|
|
1c3b9e6d16 | ||
|
|
12bcca3735 | ||
|
|
d5b78a0d01 | ||
|
|
0545b947ff | ||
|
|
6486ae9475 | ||
|
|
9394ff58ec | ||
|
|
76d54d89bf | ||
|
|
8e0935fa0b | ||
|
|
00f64f669f | ||
|
|
7f0b5288c3 | ||
|
|
18f6c8af7e | ||
|
|
bbb7a7efb9 | ||
|
|
ee37df8881 | ||
|
|
2926282ec9 | ||
|
|
a330eed2eb | ||
|
|
65e247f87e | ||
|
|
1f8ace7746 | ||
|
|
29e899ef75 | ||
|
|
a78b84267e | ||
|
|
6a7c6ccc3e | ||
|
|
dcd4dae132 | ||
|
|
109bfe0afd | ||
|
|
fb7c7b57d9 | ||
|
|
048284acf6 | ||
|
|
56789b49db | ||
|
|
caab70d82b | ||
|
|
601d7e0ae6 | ||
|
|
13c006fe6d | ||
|
|
7380f02d41 | ||
|
|
bc0522c75c | ||
|
|
489789e42f | ||
|
|
fa22fc0cb9 | ||
|
|
857671fe95 | ||
|
|
36e170567b | ||
|
|
452325649d | ||
|
|
eb8375c41e | ||
|
|
32b8702db6 | ||
|
|
8037558eae | ||
|
|
8e41215cdb | ||
|
|
864383539e | ||
|
|
2f28fdc95d | ||
|
|
f8107fd755 | ||
|
|
fa58cb30a6 | ||
|
|
a514cab055 | ||
|
|
95fde83a53 | ||
|
|
2fbeeb1e70 | ||
|
|
02f13b4252 | ||
|
|
11ec3eaa32 | ||
|
|
72d1fb3d75 | ||
|
|
2c2731d0ab | ||
|
|
7f6234517c | ||
|
|
90c4a0d1e1 | ||
|
|
69c2baeb48 | ||
|
|
943792dccb | ||
|
|
dfbc0f9f13 | ||
|
|
b42e48120a | ||
|
|
aeb1b18d55 | ||
|
|
022115407b | ||
|
|
549d4ee7be | ||
|
|
87714d6b4b | ||
|
|
16d2a5f83d | ||
|
|
1bed2c877a | ||
|
|
b0473b91a5 | ||
|
|
6540d2c4ae | ||
|
|
f45a7a02a3 | ||
|
|
ec91e4c531 | ||
|
|
a9e89d4e16 | ||
|
|
3104825f15 | ||
|
|
45f5c64452 | ||
|
|
4b7a0157e7 | ||
|
|
cdd7a683b7 | ||
|
|
8410cd39ae | ||
|
|
0be3e9a5fe | ||
|
|
974da0f5d6 | ||
|
|
cb0f746360 | ||
|
|
61b1992262 | ||
|
|
0d910d2933 | ||
|
|
e9a37b82a1 | ||
|
|
14cb8ebc0c | ||
|
|
b41fb82e6d | ||
|
|
84bb2f7bc1 | ||
|
|
f3313cedaa | ||
|
|
f699d74143 | ||
|
|
fd0203fd42 | ||
|
|
a6b42aad6a | ||
|
|
85b5cd7d54 | ||
|
|
4dddc39393 | ||
|
|
ebbdb875e7 | ||
|
|
9f6f54773f | ||
|
|
210d4fa538 | ||
|
|
b25f1dd7e0 | ||
|
|
da6c1c544a | ||
|
|
b9dc70685b | ||
|
|
02dd750910 | ||
|
|
7848942f3b | ||
|
|
23c69de1cd | ||
|
|
3080ca054c | ||
|
|
ac74ca46e1 | ||
|
|
8869d4be56 | ||
|
|
a8b3078aab | ||
|
|
5587ab30b9 | ||
|
|
4b3d4d0046 | ||
|
|
8d3b604950 | ||
|
|
4b2ab56578 | ||
|
|
390595a283 | ||
|
|
85f6a8cb6c | ||
|
|
df333988b3 | ||
|
|
ce1bef655a | ||
|
|
8c88a21a3a | ||
|
|
70b505d7ed | ||
|
|
8bd711a821 | ||
|
|
49510144d4 | ||
|
|
92ee3f6105 | ||
|
|
828c5d6f5b | ||
|
|
65c6c114d6 | ||
|
|
3780012898 | ||
|
|
d677f54523 | ||
|
|
43c2e3d1f8 | ||
|
|
781cd15876 | ||
|
|
9af0e68fa5 | ||
|
|
f83f586217 | ||
|
|
a29435d9b2 | ||
|
|
dbe6f84c80 | ||
|
|
b8b66837ec | ||
|
|
175a0bcbd7 | ||
|
|
57973528c1 | ||
|
|
ad2e8b738e | ||
|
|
d9465926cb | ||
|
|
2ff3aacbb3 | ||
|
|
2b94aec335 | ||
|
|
ec660d9b42 | ||
|
|
a48c8a3418 | ||
|
|
c4b83ca819 | ||
|
|
0c03145f3c | ||
|
|
2ab5022f53 | ||
|
|
50f5c7ec30 | ||
|
|
ca5275b0b3 | ||
|
|
be8320df9f | ||
|
|
76f6581d9f | ||
|
|
7aa34895e5 | ||
|
|
1cd2edbcda | ||
|
|
c7fb0a1ff3 | ||
|
|
7f60495339 | ||
|
|
d8ecfcc070 | ||
|
|
1ba51cc8f4 | ||
|
|
41daad48d0 | ||
|
|
f9f30d4442 | ||
|
|
8474154cd4 | ||
|
|
780c66aac1 | ||
|
|
80a3dbbb06 | ||
|
|
8ab81926d0 | ||
|
|
97821103ef | ||
|
|
9346674cd4 | ||
|
|
50ed7cb085 | ||
|
|
6d17f9d83a | ||
|
|
1bc734f406 | ||
|
|
16bca26dbd | ||
|
|
9c621161d5 | ||
|
|
97eefbce85 | ||
|
|
be701c8e1f | ||
|
|
14d0b35966 | ||
|
|
7f074a3de4 | ||
|
|
12137d75e0 | ||
|
|
c5fcced0c1 | ||
|
|
eaf958e0a2 | ||
|
|
006ffdda6b | ||
|
|
a825994703 | ||
|
|
5fdfb73957 | ||
|
|
bfe9c5059b | ||
|
|
d72d553148 | ||
|
|
7737e1be06 | ||
|
|
b305164abb | ||
|
|
caded84893 | ||
|
|
320b9df1eb | ||
|
|
9fb5734753 | ||
|
|
008e5b1b78 | ||
|
|
52bd1fa7c8 | ||
|
|
9e66f44bc2 | ||
|
|
0309803163 | ||
|
|
7bc2c8b142 | ||
|
|
ff717633c1 | ||
|
|
ff89ff6ea4 | ||
|
|
2eae2d149d | ||
|
|
ba074fa4a2 | ||
|
|
b18cd1d446 | ||
|
|
731147c3de | ||
|
|
3b1ae81058 | ||
|
|
e52c303c67 | ||
|
|
493914da78 | ||
|
|
af12a4aa37 | ||
|
|
7d72563c85 | ||
|
|
382f18b0d3 | ||
|
|
b8a5b62aa8 | ||
|
|
b8ed2568dc | ||
|
|
7845181f7e | ||
|
|
662271be92 | ||
|
|
b51e071685 | ||
|
|
8cf41788f8 | ||
|
|
6fcbeeb013 | ||
|
|
f2de89541a | ||
|
|
2ebb82b374 | ||
|
|
dbae094980 | ||
|
|
4044feb7ca | ||
|
|
039c7faaf6 | ||
|
|
aff58dc294 | ||
|
|
717b780703 | ||
|
|
30c55dff82 | ||
|
|
793334fa3e | ||
|
|
d76364133a | ||
|
|
a6d5cd67ee | ||
|
|
32013b7974 | ||
|
|
9a83cb65b1 | ||
|
|
bf719fd6df | ||
|
|
a3101d7ac9 | ||
|
|
4743b282b0 | ||
|
|
ef1074fb68 | ||
|
|
213fca90a2 | ||
|
|
3efe33ccc1 | ||
|
|
823761e043 | ||
|
|
938e3a6c96 | ||
|
|
0e435da1b1 | ||
|
|
a460ed5d1d | ||
|
|
f19ea94e10 | ||
|
|
7e7aee7a55 | ||
|
|
0a8669adc2 | ||
|
|
781afeaaaa | ||
|
|
f26a4d2b1b | ||
|
|
586a7c8e94 | ||
|
|
b0f383e5d2 | ||
|
|
1dbc0edf2f | ||
|
|
6bd8af3c5f | ||
|
|
4aa7d3c100 | ||
|
|
21d1664162 | ||
|
|
3d75451826 | ||
|
|
9dee1a4dbb | ||
|
|
74e0c0e6a1 | ||
|
|
e19f957010 | ||
|
|
8bab20aa77 | ||
|
|
aa17f7695f | ||
|
|
8bb1c42bdd | ||
|
|
8fe04ed8f9 | ||
|
|
06ed83432b | ||
|
|
18d26e1ae6 | ||
|
|
87c3483ded | ||
|
|
c01c0b8117 | ||
|
|
7f05420c0b | ||
|
|
d201e2d386 | ||
|
|
75a05aa1e3 | ||
|
|
c95866fef2 | ||
|
|
953083bd5f | ||
|
|
e2a2841d77 | ||
|
|
4fc196456e | ||
|
|
3075947ac9 | ||
|
|
b0898e9ca5 | ||
|
|
5dddbc62f7 | ||
|
|
91b9c040fd | ||
|
|
4759411ad7 | ||
|
|
3d3927432e | ||
|
|
0b241845c9 | ||
|
|
8c7c8e0d92 | ||
|
|
264e12219a | ||
|
|
b59e8e33bf | ||
|
|
98cb70e8d3 | ||
|
|
179b9cd5d4 | ||
|
|
1629402e9a | ||
|
|
c7e8cd5c7c | ||
|
|
b7364724d3 | ||
|
|
a44ab07f76 | ||
|
|
6e7ca42af9 | ||
|
|
660cb7057f | ||
|
|
578318a6a0 | ||
|
|
9319bd3b2e | ||
|
|
88df744fe6 | ||
|
|
29974b3db5 | ||
|
|
c83f7c0b45 | ||
|
|
ef44673388 | ||
|
|
d949264004 | ||
|
|
515165a4e9 | ||
|
|
dce4fa2543 | ||
|
|
7ffbad6f58 | ||
|
|
9585223136 | ||
|
|
19f654b8b5 | ||
|
|
576e8bfa12 | ||
|
|
f58d82e119 | ||
|
|
462ee3124a | ||
|
|
2ee8e3238d | ||
|
|
525b9c7946 | ||
|
|
d931550db2 | ||
|
|
6f5af15aae | ||
|
|
ec71e88d5e | ||
|
|
6d999bef03 | ||
|
|
f84dfb41a0 | ||
|
|
7454f5da0e | ||
|
|
f77f895a19 | ||
|
|
f182863b48 | ||
|
|
a963125b53 | ||
|
|
5d757c7223 | ||
|
|
d3d0c0dfe5 | ||
|
|
876fc63145 | ||
|
|
4c74530c50 | ||
|
|
0fae00dab7 | ||
|
|
a3c1bcce2f | ||
|
|
7637c48134 | ||
|
|
3113ba4a19 | ||
|
|
425513809e | ||
|
|
5140062d2e | ||
|
|
2af6937ea6 | ||
|
|
07cccc2c59 | ||
|
|
7146cf6ba1 | ||
|
|
8500ba52b0 | ||
|
|
8fa243c3d0 | ||
|
|
6a312a98f6 | ||
|
|
c87115f8b7 | ||
|
|
5b52a24623 | ||
|
|
5369a67a77 | ||
|
|
ca957411fb | ||
|
|
c5b74cf058 | ||
|
|
30cf527b52 | ||
|
|
ce7198743e | ||
|
|
9a93002548 | ||
|
|
5c066d8e5d | ||
|
|
8aeaf791f1 | ||
|
|
0dee8ff8b0 | ||
|
|
ae6659117f | ||
|
|
7687998b17 | ||
|
|
9359342ae5 | ||
|
|
b14a983cda | ||
|
|
70e0a0143f | ||
|
|
73f062375b | ||
|
|
b59c2a70e1 | ||
|
|
e36eb079f1 | ||
|
|
07307b676d | ||
|
|
83985768e3 | ||
|
|
5cba95b45c | ||
|
|
6a054092b2 | ||
|
|
b98f39c2f8 | ||
|
|
4880d5a677 | ||
|
|
dcf185a9d8 | ||
|
|
51a5e72184 | ||
|
|
bab9ca0c77 | ||
|
|
47c8e30124 | ||
|
|
ead5b7c324 | ||
|
|
a77f9bbcdb | ||
|
|
2c9a6da52f | ||
|
|
5bae907be1 | ||
|
|
effd25ecfd | ||
|
|
ba0907e006 | ||
|
|
662b0f5f3c | ||
|
|
bab1a903b0 | ||
|
|
cea7cde9b0 | ||
|
|
6e9f37dbdb | ||
|
|
0b31edad18 | ||
|
|
1fcb59a621 | ||
|
|
fe2c0d0100 | ||
|
|
d9002c70fb | ||
|
|
a87f4385b3 | ||
|
|
a88aeaaed3 | ||
|
|
71e0ce6c48 | ||
|
|
7eef719fe8 | ||
|
|
7ebfb9d871 | ||
|
|
2265a1eea2 | ||
|
|
f044cc0feb | ||
|
|
8eeb5ada8c | ||
|
|
700b14652e | ||
|
|
d9c4a2e620 | ||
|
|
d59ec062a8 | ||
|
|
ba147a25de | ||
|
|
8879cde0fd | ||
|
|
462c575cb0 | ||
|
|
dc71b4cd71 | ||
|
|
31a6a5e998 | ||
|
|
108c4a9c26 | ||
|
|
8434da8909 | ||
|
|
fe8097439b | ||
|
|
cf01df3922 | ||
|
|
abfb31c43f | ||
|
|
2bd8600f5a | ||
|
|
801977b24a | ||
|
|
adf3303ba8 | ||
|
|
a83ca16904 | ||
|
|
7ed3cd84cb | ||
|
|
07feeed4f8 | ||
|
|
a850a94312 | ||
|
|
02cd01e0e5 | ||
|
|
bc9b66f805 | ||
|
|
9b4445f73b | ||
|
|
a433da4102 | ||
|
|
7c9308a7d7 | ||
|
|
66a9bddbf7 | ||
|
|
6525c8e4c2 | ||
|
|
263918521f | ||
|
|
51e0fd2141 | ||
|
|
7044c0cd7d | ||
|
|
abc2603dae | ||
|
|
0180fd1bfc | ||
|
|
1fe3102d43 | ||
|
|
45f0eceebc | ||
|
|
fd5a72590e | ||
|
|
17f9c1aedc | ||
|
|
5079bb81ed | ||
|
|
328a2e6c0b | ||
|
|
1e9e58a7bb | ||
|
|
79dcdaa098 | ||
|
|
c04f1179ec | ||
|
|
8a7e98acd0 | ||
|
|
059fafdbcb | ||
|
|
0189e8a272 | ||
|
|
b28be4758a | ||
|
|
e64b65049b | ||
|
|
9eca672ea7 | ||
|
|
e392914538 | ||
|
|
39e7e0bc57 | ||
|
|
5fed339dd8 | ||
|
|
0706c1c801 | ||
|
|
cd2618bfd6 | ||
|
|
c9c7cf4473 | ||
|
|
332e2288ca | ||
|
|
8b458f0b74 | ||
|
|
138b28801a | ||
|
|
ab767d88d6 | ||
|
|
a8bf6364bd | ||
|
|
a84d443bc5 | ||
|
|
717c88a7f8 | ||
|
|
deb48cfa48 | ||
|
|
c95b5854d2 | ||
|
|
696ed8b9ce | ||
|
|
0a3859089d | ||
|
|
94d98a0bb7 | ||
|
|
842a4b67e2 | ||
|
|
a458d9ee0a | ||
|
|
06eea7f650 | ||
|
|
c4ecb6a2ba | ||
|
|
16137cecf5 | ||
|
|
9b0847a0bf | ||
|
|
3c1b59f5cf | ||
|
|
b9d3601b58 | ||
|
|
fd100e5adb | ||
|
|
7e1efbf148 | ||
|
|
c795ead421 | ||
|
|
28e7077452 | ||
|
|
74f08f9ae2 | ||
|
|
cae62f3324 | ||
|
|
b24d7ff5ce | ||
|
|
50c5c2d619 | ||
|
|
7cf2f8e471 | ||
|
|
5f8849ec8d | ||
|
|
d5a49c1248 | ||
|
|
465a790af3 | ||
|
|
d369d17ade | ||
|
|
2815c1ba41 | ||
|
|
1816944d2f | ||
|
|
aea4628197 | ||
|
|
e3cd540e36 | ||
|
|
a8a4fa1f6b | ||
|
|
6eec74eda9 | ||
|
|
56c08ad518 | ||
|
|
41176cee37 | ||
|
|
e897911e14 | ||
|
|
9a1c4bd680 | ||
|
|
f4dbbe685d | ||
|
|
85cb532501 | ||
|
|
d3d18b5aa4 | ||
|
|
7b409e7aad | ||
|
|
9297300b8b | ||
|
|
24b4762cbf | ||
|
|
63362ad085 | ||
|
|
98ef3af28d | ||
|
|
37fd55cc51 | ||
|
|
f681205216 | ||
|
|
0f1eba56bd | ||
|
|
348d8fe45e | ||
|
|
b49a3e283e |
@@ -0,0 +1,10 @@
|
||||
<html>
|
||||
<body>
|
||||
<br>
|
||||
The list of changes is part of the documentation:
|
||||
<ul>
|
||||
<li><a href="http://arma.sourceforge.net/docs.html#changelog">docs.html#changelog</a> (online copy)</li>
|
||||
<li><a href="docs.html#changelog">docs.html#changelog</a> (local copy)</li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
||||
+145
-105
@@ -1,4 +1,5 @@
|
||||
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
# Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
#
|
||||
@@ -37,6 +38,13 @@ if(NOT (${CMAKE_MAJOR_VERSION} LESS 3))
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT (CMAKE_VERSION VERSION_LESS "3.1"))
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
message(STATUS "CMAKE_CXX_STANDARD = ${CMAKE_CXX_STANDARD}")
|
||||
endif()
|
||||
|
||||
project(armadillo CXX C)
|
||||
include(CheckIncludeFileCXX)
|
||||
include(CheckLibraryExists)
|
||||
@@ -45,24 +53,13 @@ set(ARMA_USE_WRAPPER true)
|
||||
|
||||
# the settings below will be automatically configured by the rest of this script
|
||||
|
||||
set(ARMA_USE_LAPACK false)
|
||||
set(ARMA_USE_BLAS false)
|
||||
set(ARMA_USE_ATLAS false)
|
||||
set(ARMA_USE_HDF5_ALT false)
|
||||
set(ARMA_USE_ARPACK false)
|
||||
set(ARMA_USE_EXTERN_CXX11_RNG false)
|
||||
set(ARMA_USE_SUPERLU false) # Caveat: only SuperLU version 5.x can be used!
|
||||
|
||||
## NOTE: OpenBLAS appears to have its own LAPACK functions,
|
||||
## NOTE: but on some systems the installed version of OpenBLAS
|
||||
## NOTE: has been modified not to include LAPACK functions.
|
||||
## NOTE: As the presence of LAPACK functions in OpenBLAS can't be guaranteed,
|
||||
## NOTE: this installer script requires LAPACK to be present on the system
|
||||
## NOTE: in order to enable the use of LAPACK functions by Armadillo.
|
||||
## NOTE: This installer will link with OpenBLAS first,
|
||||
## NOTE: so if a full version of OpenBLAS is actually present on the system,
|
||||
## NOTE: the linker should make use of LAPACK functions from OpenBLAS
|
||||
## NOTE: instead of standard LAPACK.
|
||||
set(ARMA_USE_LAPACK false)
|
||||
set(ARMA_USE_BLAS false)
|
||||
set(ARMA_USE_ATLAS false)
|
||||
set(ARMA_USE_HDF5_ALT false)
|
||||
set(ARMA_USE_ARPACK false)
|
||||
set(ARMA_USE_EXTERN_RNG false)
|
||||
set(ARMA_USE_SUPERLU false) # Caveat: only SuperLU version 5.x can be used!
|
||||
|
||||
|
||||
## extract version from sources
|
||||
@@ -80,6 +77,69 @@ string(REGEX REPLACE ".*#define ARMA_VERSION_PATCH ([0-9]+).*" "\\1" ARMA_VERSIO
|
||||
|
||||
message(STATUS "Configuring Armadillo ${ARMA_VERSION_MAJOR}.${ARMA_VERSION_MINOR}.${ARMA_VERSION_PATCH}")
|
||||
|
||||
string(COMPARE EQUAL "${CMAKE_CXX_FLAGS}" "" CXX_FLAGS_EMPTY)
|
||||
if(NOT CXX_FLAGS_EMPTY)
|
||||
message(STATUS "")
|
||||
message(STATUS "*** WARNING: variable 'CMAKE_CXX_FLAGS' is not empty; this may cause problems!")
|
||||
message(STATUS "")
|
||||
endif()
|
||||
|
||||
|
||||
# NOTE: ARMA_USE_EXTERN_RNG requires compiler support for thread_local and C++11
|
||||
# NOTE: for Linux, this is available with gcc 4.8.3 onwards
|
||||
# NOTE: for macOS, thread_local is supoported in Xcode 8 (mid 2016 onwards) in C++11 mode
|
||||
|
||||
# NOTE: thread_local appears broken again on macOS 11 (Big Sur) and/or AppleClang 12.0
|
||||
# NOTE: see comments in include/armadillo_bits/arma_rng.hpp
|
||||
|
||||
if(DEFINED CMAKE_CXX_COMPILER_ID AND DEFINED CMAKE_CXX_COMPILER_VERSION)
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
if(NOT (${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 4.8.3))
|
||||
set(ARMA_USE_EXTERN_RNG true)
|
||||
message(STATUS "Detected gcc 4.8.3 or later")
|
||||
if(NOT DEFINED CMAKE_CXX_STANDARD)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||||
message(STATUS "Added '-std=c++11' to compiler flags")
|
||||
endif()
|
||||
else()
|
||||
message(FATAL_ERROR "Compiler too old")
|
||||
endif()
|
||||
else()
|
||||
if(NOT (${CMAKE_MAJOR_VERSION} LESS 3))
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
if(NOT ${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 6.0)
|
||||
set(ARMA_USE_EXTERN_RNG true)
|
||||
message(STATUS "Detected Clang 6.0 or later")
|
||||
if(NOT DEFINED CMAKE_CXX_STANDARD)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
|
||||
message(STATUS "Added '-std=c++14' to compiler flags")
|
||||
endif()
|
||||
else()
|
||||
message(FATAL_ERROR "Compiler too old")
|
||||
endif()
|
||||
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
|
||||
if(NOT ${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 8.0)
|
||||
set(ARMA_USE_EXTERN_RNG true)
|
||||
message(STATUS "Detected AppleClang 8.0 or later")
|
||||
if(NOT DEFINED CMAKE_CXX_STANDARD)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
|
||||
message(STATUS "Added '-std=c++14' to compiler flags")
|
||||
endif()
|
||||
else()
|
||||
message(FATAL_ERROR "Compiler too old")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(MINGW OR MSYS OR CYGWIN OR MSVC)
|
||||
# MinGW doesn't correctly handle thread_local
|
||||
set(ARMA_USE_EXTERN_RNG false)
|
||||
endif()
|
||||
|
||||
message(STATUS "ARMA_USE_EXTERN_RNG = ${ARMA_USE_EXTERN_RNG}")
|
||||
|
||||
|
||||
# As Red Hat Enterprise Linux (and related systems such as Fedora)
|
||||
# does not search /usr/local/lib by default, we need to place the
|
||||
@@ -138,9 +198,15 @@ option(DETECT_HDF5 "Detect HDF5 and include HDF5 support, if found" ON)
|
||||
## you can also disable HDF5 detection directly on the command line:
|
||||
## cmake -D DETECT_HDF5=false .
|
||||
|
||||
option(ALLOW_FLEXIBLAS_LINUX "Allow detection of FlexiBLAS on Linux (EXPERIMENTAL)" OFF)
|
||||
option(OPENBLAS_PROVIDES_LAPACK "Assume that OpenBLAS provides LAPACK functions" OFF)
|
||||
## Example use on the command line:
|
||||
## cmake -D ALLOW_FLEXIBLAS_LINUX=true .
|
||||
## cmake -D OPENBLAS_PROVIDES_LAPACK=true .
|
||||
|
||||
option(ALLOW_FLEXIBLAS_LINUX "Allow detection of FlexiBLAS on Linux" ON)
|
||||
# set(ALLOW_FLEXIBLAS_LINUX false)
|
||||
## uncomment the above line to disable the detection of FlexiBLAS;
|
||||
## you can also disable FlexiBLAS detection directly on the command line:
|
||||
## cmake -D ALLOW_FLEXIBLAS_LINUX=false .
|
||||
|
||||
option(ALLOW_OPENBLAS_MACOS "Allow detection of OpenBLAS on macOS" OFF)
|
||||
## Example use on the command line:
|
||||
@@ -177,8 +243,10 @@ message(STATUS "CMAKE_SYSTEM_NAME = ${CMAKE_SYSTEM_NAME}" )
|
||||
message(STATUS "CMAKE_CXX_COMPILER_ID = ${CMAKE_CXX_COMPILER_ID}" )
|
||||
message(STATUS "CMAKE_CXX_COMPILER_VERSION = ${CMAKE_CXX_COMPILER_VERSION}")
|
||||
message(STATUS "CMAKE_COMPILER_IS_GNUCXX = ${CMAKE_COMPILER_IS_GNUCXX}" )
|
||||
message(STATUS "" )
|
||||
message(STATUS "BUILD_SHARED_LIBS = ${BUILD_SHARED_LIBS}" )
|
||||
message(STATUS "DETECT_HDF5 = ${DETECT_HDF5}" )
|
||||
message(STATUS "OPENBLAS_PROVIDES_LAPACK = ${OPENBLAS_PROVIDES_LAPACK}" )
|
||||
message(STATUS "ALLOW_FLEXIBLAS_LINUX = ${ALLOW_FLEXIBLAS_LINUX}" )
|
||||
message(STATUS "ALLOW_OPENBLAS_MACOS = ${ALLOW_OPENBLAS_MACOS}" )
|
||||
message(STATUS "ALLOW_BLAS_LAPACK_MACOS = ${ALLOW_BLAS_LAPACK_MACOS}" )
|
||||
@@ -196,8 +264,6 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake_au
|
||||
if(APPLE)
|
||||
message(STATUS "Detected macOS")
|
||||
|
||||
set(ARMA_OS macos)
|
||||
|
||||
set(ARMA_USE_LAPACK true)
|
||||
set(ARMA_USE_BLAS true)
|
||||
set(ARMA_USE_ACCELERATE true)
|
||||
@@ -258,11 +324,7 @@ if(APPLE)
|
||||
|
||||
else()
|
||||
|
||||
set(ARMA_OS unix)
|
||||
|
||||
include(ARMA_FindMKL)
|
||||
include(ARMA_FindACMLMP)
|
||||
include(ARMA_FindACML)
|
||||
include(ARMA_FindOpenBLAS)
|
||||
include(ARMA_FindATLAS)
|
||||
include(ARMA_FindBLAS)
|
||||
@@ -273,8 +335,6 @@ else()
|
||||
endif()
|
||||
|
||||
message(STATUS " MKL_FOUND = ${MKL_FOUND}" )
|
||||
message(STATUS " ACMLMP_FOUND = ${ACMLMP_FOUND}" )
|
||||
message(STATUS " ACML_FOUND = ${ACML_FOUND}" )
|
||||
message(STATUS " OpenBLAS_FOUND = ${OpenBLAS_FOUND}" )
|
||||
message(STATUS " ATLAS_FOUND = ${ATLAS_FOUND}" )
|
||||
message(STATUS " BLAS_FOUND = ${BLAS_FOUND}" )
|
||||
@@ -291,72 +351,42 @@ else()
|
||||
|
||||
message(STATUS "")
|
||||
message(STATUS "*** Using FlexiBLAS to access BLAS and LAPACK functions.")
|
||||
message(STATUS "*** WARNING:")
|
||||
message(STATUS "*** if SuperLU and/or ARPACK are used, they must also be linked with FlexiBLAS.")
|
||||
message(STATUS "")
|
||||
message(STATUS "*** If using FlexiBLAS causes problems, please file a bug")
|
||||
message(STATUS "*** report with the FlexiBLAS developers:")
|
||||
message(STATUS "*** https://www.mpi-magdeburg.mpg.de/projects/flexiblas")
|
||||
message(STATUS "*** WARNING: SuperLU and ARPACK must also link with FlexiBLAS.")
|
||||
message(STATUS "")
|
||||
message(STATUS "*** To disable detection of FlexiBLAS,")
|
||||
message(STATUS "*** If using FlexiBLAS causes problems, ")
|
||||
message(STATUS "*** rerun cmake with FlexiBLAS detection disabled:")
|
||||
message(STATUS "*** cmake -D ALLOW_FLEXIBLAS_LINUX=false .")
|
||||
message(STATUS "")
|
||||
|
||||
elseif(MKL_FOUND OR ACMLMP_FOUND OR ACML_FOUND)
|
||||
elseif(MKL_FOUND)
|
||||
|
||||
set(ARMA_USE_LAPACK true)
|
||||
set(ARMA_USE_BLAS true)
|
||||
set(ARMA_LIBS ${ARMA_LIBS} ${MKL_LIBRARIES})
|
||||
|
||||
message(STATUS "")
|
||||
message(STATUS "*** If the MKL or ACML libraries are installed in non-standard locations such as")
|
||||
message(STATUS "*** If the MKL libraries are installed in non-standard locations such as")
|
||||
message(STATUS "*** /opt/intel/mkl, /opt/intel/composerxe/, /usr/local/intel/mkl")
|
||||
message(STATUS "*** make sure the run-time linker can find them.")
|
||||
message(STATUS "*** On Linux systems this can be done by editing /etc/ld.so.conf")
|
||||
message(STATUS "*** or modifying the LD_LIBRARY_PATH environment variable.")
|
||||
message(STATUS "")
|
||||
message(STATUS "*** On systems with SELinux enabled (eg. Fedora, RHEL),")
|
||||
message(STATUS "*** you may need to change the SELinux type of all MKL/ACML libraries")
|
||||
message(STATUS "*** you may need to change the SELinux type of all MKL libraries")
|
||||
message(STATUS "*** to fix permission problems that may occur during run-time.")
|
||||
message(STATUS "")
|
||||
|
||||
if(MKL_FOUND)
|
||||
set(ARMA_LIBS ${ARMA_LIBS} ${MKL_LIBRARIES})
|
||||
|
||||
if(ACMLMP_FOUND OR ACML_FOUND)
|
||||
message(STATUS "*** Intel MKL as well as AMD ACML libraries were found.")
|
||||
message(STATUS "*** Using only the MKL library to avoid linking conflicts.")
|
||||
message(STATUS "*** If you wish to use ACML instead, please link manually with")
|
||||
message(STATUS "*** acml or acml_mp instead of the armadillo wrapper library.")
|
||||
message(STATUS "*** Alternatively, remove MKL from your system and rerun")
|
||||
message(STATUS "*** Armadillo's configuration using ./configure")
|
||||
endif()
|
||||
|
||||
else()
|
||||
|
||||
if(ACMLMP_FOUND)
|
||||
set(ARMA_LIBS ${ARMA_LIBS} ${ACMLMP_LIBRARIES})
|
||||
|
||||
message(STATUS "*** Both single-core and multi-core ACML libraries were found.")
|
||||
message(STATUS "*** Using only the multi-core library to avoid linking conflicts.")
|
||||
else()
|
||||
if(ACML_FOUND)
|
||||
set(ARMA_LIBS ${ARMA_LIBS} ${ACML_LIBRARIES})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
else()
|
||||
|
||||
if(OpenBLAS_FOUND AND ATLAS_FOUND)
|
||||
message(STATUS "")
|
||||
message(STATUS "*** WARNING: found both OpenBLAS and ATLAS; ATLAS will not be used")
|
||||
message(STATUS "*** NOTE: found both OpenBLAS and ATLAS; ATLAS will not be used")
|
||||
endif()
|
||||
|
||||
if(OpenBLAS_FOUND AND BLAS_FOUND)
|
||||
message(STATUS "")
|
||||
message(STATUS "*** WARNING: found both OpenBLAS and BLAS; BLAS will not be used")
|
||||
message(STATUS "*** NOTE: found both OpenBLAS and BLAS; BLAS will not be used")
|
||||
endif()
|
||||
|
||||
if(OpenBLAS_FOUND)
|
||||
@@ -364,6 +394,15 @@ else()
|
||||
set(ARMA_USE_BLAS true)
|
||||
set(ARMA_LIBS ${ARMA_LIBS} ${OpenBLAS_LIBRARIES})
|
||||
|
||||
if(OPENBLAS_PROVIDES_LAPACK)
|
||||
set(ARMA_USE_LAPACK true)
|
||||
else()
|
||||
message(STATUS "")
|
||||
message(STATUS "*** NOTE: if OpenBLAS is known to provide LAPACK functions, recommend to")
|
||||
message(STATUS "*** NOTE: rerun cmake with the OPENBLAS_PROVIDES_LAPACK option enabled:")
|
||||
message(STATUS "*** NOTE: cmake -D OPENBLAS_PROVIDES_LAPACK=true .")
|
||||
endif()
|
||||
|
||||
message(STATUS "")
|
||||
message(STATUS "*** If the OpenBLAS library is installed in")
|
||||
message(STATUS "*** /usr/local/lib or /usr/local/lib64")
|
||||
@@ -390,10 +429,17 @@ else()
|
||||
endif()
|
||||
|
||||
if(LAPACK_FOUND)
|
||||
set(ARMA_USE_LAPACK true)
|
||||
set(ARMA_LIBS ${ARMA_LIBS} ${LAPACK_LIBRARIES})
|
||||
if(OpenBLAS_FOUND AND OPENBLAS_PROVIDES_LAPACK)
|
||||
message(STATUS "*** NOTE: found both OpenBLAS and LAPACK;")
|
||||
message(STATUS "*** NOTE: option OPENBLAS_PROVIDES_LAPACK is enabled,")
|
||||
message(STATUS "*** NOTE: so will not link with plain LAPACK.")
|
||||
message(STATUS "")
|
||||
else()
|
||||
set(ARMA_USE_LAPACK true)
|
||||
set(ARMA_LIBS ${ARMA_LIBS} ${LAPACK_LIBRARIES})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
endif()
|
||||
|
||||
endif()
|
||||
@@ -464,45 +510,38 @@ if(SuperLU_FOUND)
|
||||
set(ARMA_SUPERLU_INCLUDE_DIR ${SuperLU_INCLUDE_DIR})
|
||||
endif()
|
||||
|
||||
message(STATUS "")
|
||||
message(STATUS "*** Armadillo wrapper library will use the following libraries:")
|
||||
message(STATUS "*** ARMA_LIBS = ${ARMA_LIBS}")
|
||||
message(STATUS "")
|
||||
|
||||
if(NOT ARMA_USE_LAPACK)
|
||||
message(STATUS "")
|
||||
message(STATUS "*** WARNING: Use of LAPACK is not enabled, as no LAPACK compatible library has been found.")
|
||||
message(STATUS "*** WARNING: This will materially degrade the available functionality in Armadillo.")
|
||||
|
||||
# NOTE: ARMA_USE_EXTERN_CXX11_RNG requires compiler support for thread_local and C++11
|
||||
# NOTE: for Linux, this is available with gcc 4.8.3 onwards
|
||||
# NOTE: for macOS, thread_local is supoported in Xcode 8 (mid 2016 onwards) in C++11 mode
|
||||
|
||||
if(DEFINED CMAKE_CXX_COMPILER_ID AND DEFINED CMAKE_CXX_COMPILER_VERSION)
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND NOT ${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 4.8.3)
|
||||
set(ARMA_USE_EXTERN_CXX11_RNG true)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||||
message(STATUS "Detected gcc 4.8.3 or later. Added '-std=c++11' to compiler flags")
|
||||
else()
|
||||
if(NOT (${CMAKE_MAJOR_VERSION} LESS 3))
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND NOT ${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 6.0)
|
||||
set(ARMA_USE_EXTERN_CXX11_RNG true)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
|
||||
message(STATUS "Detected Clang 6.0 or later. Added '-std=c++14' to compiler flags")
|
||||
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" AND NOT ${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 8.0)
|
||||
set(ARMA_USE_EXTERN_CXX11_RNG true)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
|
||||
message(STATUS "Detected AppleClang 8.0 or later. Added '-std=c++14' to compiler flags")
|
||||
endif()
|
||||
|
||||
endif()
|
||||
if(OpenBLAS_FOUND)
|
||||
message(STATUS "")
|
||||
message(STATUS "*** NOTE: OpenBLAS found but LAPACK not found.")
|
||||
message(STATUS "*** NOTE: OpenBLAS may have been built without LAPACK functions,")
|
||||
message(STATUS "*** NOTE: so cannot assume that LAPACK functions are available.")
|
||||
message(STATUS "*** NOTE: To forcefully assume that OpenBLAS provides LAPACK functions,")
|
||||
message(STATUS "*** NOTE: rerun cmake with the OPENBLAS_PROVIDES_LAPACK option enabled:")
|
||||
message(STATUS "*** NOTE: cmake -D OPENBLAS_PROVIDES_LAPACK=true .")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
if(MINGW OR MSYS OR CYGWIN OR MSVC)
|
||||
# MinGW doesn't correctly handle thread_local
|
||||
set(ARMA_USE_EXTERN_CXX11_RNG false)
|
||||
endif()
|
||||
|
||||
message(STATUS "ARMA_USE_EXTERN_CXX11_RNG = ${ARMA_USE_EXTERN_CXX11_RNG}")
|
||||
message(STATUS "")
|
||||
message(STATUS "*** Result of configuration:")
|
||||
message(STATUS "*** ARMA_USE_WRAPPER = ${ARMA_USE_WRAPPER}")
|
||||
message(STATUS "*** ARMA_USE_LAPACK = ${ARMA_USE_LAPACK}")
|
||||
message(STATUS "*** ARMA_USE_BLAS = ${ARMA_USE_BLAS}")
|
||||
message(STATUS "*** ARMA_USE_ATLAS = ${ARMA_USE_ATLAS}")
|
||||
message(STATUS "*** ARMA_USE_HDF5_ALT = ${ARMA_USE_HDF5_ALT}")
|
||||
message(STATUS "*** ARMA_USE_ARPACK = ${ARMA_USE_ARPACK}")
|
||||
message(STATUS "*** ARMA_USE_EXTERN_RNG = ${ARMA_USE_EXTERN_RNG}")
|
||||
message(STATUS "*** ARMA_USE_SUPERLU = ${ARMA_USE_SUPERLU}")
|
||||
message(STATUS "")
|
||||
message(STATUS "*** Armadillo wrapper library will use the following libraries:")
|
||||
message(STATUS "*** ARMA_LIBS = ${ARMA_LIBS}")
|
||||
message(STATUS "")
|
||||
|
||||
|
||||
message(STATUS "Copying ${PROJECT_SOURCE_DIR}/include/ to ${PROJECT_BINARY_DIR}/tmp/include/")
|
||||
@@ -555,7 +594,8 @@ message(STATUS "CMAKE_REQUIRED_INCLUDES = ${CMAKE_REQUIRED_INCLUDES}" )
|
||||
|
||||
add_library( armadillo ${PROJECT_SOURCE_DIR}/src/wrapper1.cpp ${PROJECT_SOURCE_DIR}/src/wrapper2.cpp )
|
||||
target_link_libraries( armadillo ${ARMA_LIBS} )
|
||||
target_include_directories(armadillo INTERFACE $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include> $<INSTALL_INTERFACE:include>)
|
||||
# target_include_directories(armadillo INTERFACE $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include> $<INSTALL_INTERFACE:include>)
|
||||
target_include_directories(armadillo INTERFACE $<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/tmp/include> $<INSTALL_INTERFACE:include>)
|
||||
set_target_properties(armadillo PROPERTIES VERSION ${ARMA_VERSION_MAJOR}.${ARMA_VERSION_MINOR_ALT}.${ARMA_VERSION_PATCH} SOVERSION ${ARMA_VERSION_MAJOR})
|
||||
|
||||
|
||||
@@ -651,5 +691,5 @@ install(FILES "${PROJECT_BINARY_DIR}/tmp/misc/armadillo.pc" DESTINATION ${CMAKE_
|
||||
if(BUILD_SMOKE_TEST)
|
||||
message(STATUS "*** configuring smoke_test")
|
||||
enable_testing()
|
||||
add_subdirectory(smoke_test)
|
||||
add_subdirectory(tests1)
|
||||
endif()
|
||||
|
||||
+3
-4
@@ -1,10 +1,9 @@
|
||||
Armadillo C++ Linear Algebra Library
|
||||
Copyright 2008-2020 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
Copyright 2008-2022 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
Copyright 2017-2020 Arroyo Consortium
|
||||
Copyright 2017-2020 Data61, CSIRO
|
||||
Copyright 2017-2022 Data61 / CSIRO
|
||||
|
||||
This product includes software developed by Conrad Sanderson (http://conradsanderson.id.au)
|
||||
This product includes software developed at National ICT Australia (NICTA)
|
||||
This product includes software developed at Arroyo Consortium
|
||||
This product includes software developed at Data61, CSIRO
|
||||
This product includes software developed at Data61 / CSIRO
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
### Armadillo: C++ Library for Linear Algebra & Scientific Computing
|
||||
http://arma.sourceforge.net
|
||||
|
||||
Copyright 2008-2020 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
Copyright 2008-2022 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
Copyright 2017-2020 Arroyo Consortium
|
||||
Copyright 2017-2020 Data61, CSIRO
|
||||
Copyright 2017-2022 Data61 / CSIRO
|
||||
|
||||
---
|
||||
|
||||
@@ -22,7 +21,7 @@ Copyright 2017-2020 Data61, CSIRO
|
||||
2. [Citation Details](#2-citation-details)
|
||||
3. [Distribution License](#3-distribution-license)
|
||||
|
||||
4. [Compilers and External Dependencies](#4-compilers-and-external-dependencies)
|
||||
4. [Prerequisites and Dependencies](#4-prerequisites-and-dependencies)
|
||||
|
||||
5. [Linux and macOS: Installation](#5-linux-and-macos-installation)
|
||||
6. [Linux and macOS: Compiling and Linking](#6-linux-and-macos-compiling-and-linking)
|
||||
@@ -32,10 +31,10 @@ Copyright 2017-2020 Data61, CSIRO
|
||||
|
||||
9. [Support for OpenBLAS and Intel MKL](#9-support-for-openblas-and-intel-mkl)
|
||||
10. [Support for ATLAS](#10-support-for-atlas)
|
||||
11. [Support for C++11 / C++14 Features](#11-support-for-c11-c14-features)
|
||||
11. [Caveat on use of C++11 auto Keyword](#11-caveat-on-use-of-c11-auto-keyword)
|
||||
12. [Support for OpenMP](#12-support-for-openmp)
|
||||
|
||||
13. [Documentation](#13-documentation)
|
||||
13. [Documentation of Functions and Classes](#13-documentation-of-functions-and-classes)
|
||||
14. [API Stability and Versioning](#14-api-stability-and-versioning)
|
||||
15. [Bug Reports and Frequently Asked Questions](#15-bug-reports-and-frequently-asked-questions)
|
||||
|
||||
@@ -57,8 +56,8 @@ The library provides efficient classes for vectors, matrices and cubes,
|
||||
as well as 200+ associated functions covering essential and advanced functionality
|
||||
for data processing and manipulation of matrices.
|
||||
|
||||
Various matrix decompositions are provided through integration with LAPACK,
|
||||
or one of its high performance drop-in replacements
|
||||
Various matrix decompositions (eigen, SVD, QR, etc) are provided through
|
||||
integration with LAPACK, or one of its high performance drop-in replacements
|
||||
(eg. OpenBLAS, Intel MKL, Apple Accelerate framework, etc).
|
||||
|
||||
A sophisticated expression evaluator (via C++ template meta-programming)
|
||||
@@ -104,154 +103,159 @@ informational purposes only and do not modify the License.
|
||||
|
||||
---
|
||||
|
||||
### 4: Compilers and External Dependencies
|
||||
|
||||
A compiler that properly supports the C++98/C++03 standards is required,
|
||||
as Armadillo makes extensive use of template meta-programming.
|
||||
### 4: Prerequisites and Dependencies
|
||||
|
||||
The functionality of Armadillo is partly dependent on other libraries:
|
||||
LAPACK, BLAS (preferably OpenBLAS), ARPACK and SuperLU.
|
||||
LAPACK and BLAS are used for dense matrices,
|
||||
while ARPACK and SuperLU are used for sparse matrices.
|
||||
OpenBLAS (or standard BLAS) and LAPACK (for dense matrices),
|
||||
as well as ARPACK and SuperLU (for sparse matrices).
|
||||
Caveat: only SuperLU versions 5.2.x can be used.
|
||||
On macOS, the Accelerate framework can be used for BLAS and LAPACK functions.
|
||||
Use of OpenBLAS is strongly recommended on all systems.
|
||||
|
||||
Armadillo can work without the above libraries, but its functionality will be reduced.
|
||||
Basic functionality will be available (eg. matrix addition and multiplication),
|
||||
but operations like eigen decomposition or matrix inversion will not be.
|
||||
Matrix multiplication (mainly for big matrices) may not be as fast.
|
||||
Armadillo 10.x requires a C++ compiler that supports at least the C++11 standard.
|
||||
Use Armadillo 9.900 if your compiler only supports the old C++98/C++03 standards.
|
||||
|
||||
As Armadillo is a template library, we recommended that optimisation
|
||||
is enabled during compilation of programs that use Armadillo.
|
||||
For example, for GCC and Clang compilers use -O2 or -O3
|
||||
On Linux-based systems, install the GCC C++ compiler, which is available as a pre-built package.
|
||||
The package name might be `g++` or `gcc-c++` depending on your system.
|
||||
|
||||
On macOS systems, a C++ compiler can be obtained by first installing Xcode (version 8 or later)
|
||||
and then running the following command in a terminal window:
|
||||
|
||||
xcode-select --install
|
||||
|
||||
On Windows systems, the MinGW toolset or Visual Studio C++ 2019 (MSVC) can be used.
|
||||
|
||||
---
|
||||
|
||||
### 5: Linux and macOS: Installation
|
||||
|
||||
* Step 1:
|
||||
Ensure a C++ compiler is installed on your system.
|
||||
Armadillo can be installed in several ways: either manually or via cmake, with or without root access.
|
||||
The cmake based installation is preferred.
|
||||
The cmake tool can be downloaded from http://www.cmake.org
|
||||
or (preferably) installed using the package manager on your system;
|
||||
on macOS systems, cmake can be installed through MacPorts or Homebrew.
|
||||
|
||||
- On macOS systems install Xcode (version 8 or later)
|
||||
and then type the following command in a terminal window:
|
||||
Before installing Armadillo, first install OpenBLAS and LAPACK, and optionally ARPACK and SuperLU.
|
||||
It is also necessary to install the corresponding development files for each library.
|
||||
For example, when installing the `libopenblas` package, also install the `libopenblas-dev` package.
|
||||
|
||||
xcode-select --install
|
||||
|
||||
* Step 2:
|
||||
Ensure the CMake tool is installed on your system.
|
||||
#### 5a: Installation via CMake
|
||||
|
||||
- Cmake can be downloaded from http://www.cmake.org
|
||||
or (preferably) installed using the package manager on your system.
|
||||
The cmake based installer detects which relevant libraries
|
||||
are installed on your system (eg. OpenBLAS, LAPACK, SuperLU, ARPACK, etc)
|
||||
and correspondingly modifies Armadillo's configuration.
|
||||
The installer also generates the Armadillo runtime library,
|
||||
which is a wrapper for all the detected libraries,
|
||||
and provides a thread-safe random number generator.
|
||||
|
||||
- On Linux-based systems, CMake can be installed using dnf, yum, apt, aptitude, ...
|
||||
|
||||
- On macOS systems, CMake can be installed through MacPorts or Homebrew.
|
||||
|
||||
* Step 3:
|
||||
Ensure that OpenBLAS (or standard BLAS and LAPACK) is installed on your system.
|
||||
On macOS, the Accelerate framework can be used for BLAS/LAPACK.
|
||||
|
||||
- On macOS, optionally install OpenBLAS for better performance.
|
||||
|
||||
- If support for sparse matrices is required, also install ARPACK and SuperLU.
|
||||
Caveat: only SuperLU version 5.2 can be used!
|
||||
|
||||
- On Linux-based systems, the following libraries are recommended
|
||||
to be present: OpenBLAS, LAPACK, SuperLU and ARPACK.
|
||||
It is also necessary to install the corresponding development
|
||||
files for each library. For example, when installing the "lapack"
|
||||
package, also install the "lapack-devel" or "lapack-dev" package.
|
||||
|
||||
* Step 4:
|
||||
Run the cmake installer.
|
||||
|
||||
- Open a terminal window and change into the directory that was created
|
||||
by unpacking the armadillo archive.
|
||||
|
||||
- The simplest case is to run cmake using:
|
||||
Change into the directory that was created by unpacking the armadillo archive
|
||||
(eg. `cd armadillo-10.6.1`) and then run cmake using:
|
||||
|
||||
cmake .
|
||||
|
||||
- NOTE: the full stop separated from "cmake" by a space is important.
|
||||
|
||||
- Options to the cmake installer:
|
||||
|
||||
- On Linux, to enable the detection of FlexiBLAS,
|
||||
use the additional ALLOW_FLEXIBLAS_LINUX option when running cmake:
|
||||
**NOTE:** the full stop (.) separated from `cmake` by a space is important.
|
||||
|
||||
cmake -DALLOW_FLEXIBLAS_LINUX=ON .
|
||||
On macOS, to enable the detection of OpenBLAS,
|
||||
use the additional `ALLOW_OPENBLAS_MACOS` option when running cmake:
|
||||
|
||||
- On macOS, to enable the detection of OpenBLAS,
|
||||
use the additional ALLOW_OPENBLAS_MACOS option when running cmake:
|
||||
cmake -DALLOW_OPENBLAS_MACOS=ON .
|
||||
|
||||
cmake -DALLOW_OPENBLAS_MACOS=ON .
|
||||
Depending on your installation, OpenBLAS may masquerade as standard BLAS.
|
||||
To detect standard BLAS and LAPACK, use the `ALLOW_BLAS_LAPACK_MACOS` option:
|
||||
|
||||
Note: depending on your installation, OpenBLAS may masquerade as standard BLAS.
|
||||
To detect standard BLAS and LAPACK, use the ALLOW_BLAS_LAPACK_MACOS option:
|
||||
cmake -DALLOW_BLAS_LAPACK_MACOS=ON .
|
||||
|
||||
cmake -DALLOW_BLAS_LAPACK_MACOS=ON .
|
||||
By default, cmake assumes that the Armadillo runtime library and the corresponding header files
|
||||
will be installed in the default system directory (eg. in the `/usr` hierarchy in Linux-based systems).
|
||||
To install the library and headers in an alternative directory,
|
||||
use the additional option `CMAKE_INSTALL_PREFIX` in this form:
|
||||
|
||||
- By default, cmake assumes that the Armadillo library and the
|
||||
corresponding header files will be installed in the default
|
||||
system directory (eg. in the /usr hierarchy in Linux-based systems).
|
||||
To install the library and headers in an alternative directory,
|
||||
use the additional option CMAKE_INSTALL_PREFIX in this form:
|
||||
cmake . -DCMAKE_INSTALL_PREFIX:PATH=alternative_directory
|
||||
|
||||
cmake . -DCMAKE_INSTALL_PREFIX:PATH=alternative_directory
|
||||
If cmake needs to be re-run, it's a good idea to first delete the `CMakeCache.txt` file
|
||||
(not `CMakeLists.txt`).
|
||||
|
||||
- CMake will detect which relevant libraries are installed on your system
|
||||
(eg. OpenBLAS, LAPACK, SuperLU, ARPACK, etc)
|
||||
and will modify Armadillo's configuration correspondingly.
|
||||
CMake will also generate the Armadillo run-time library,
|
||||
which is a wrapper for all the detected libraries.
|
||||
**Caveat:** if Armadillo is installed in a non-system directory,
|
||||
make sure that the C++ compiler is configured to use the `lib` and `include`
|
||||
sub-directories present within this directory.
|
||||
Note that the `lib` directory might be named differently on your system.
|
||||
On recent 64 bit Debian & Ubuntu systems it is `lib/x86_64-linux-gnu`.
|
||||
On recent 64 bit Fedora & RHEL systems it is `lib64`.
|
||||
|
||||
- If cmake needs to re-run, it's a good idea to first delete the
|
||||
"CMakeCache.txt" file (not "CMakeLists.txt").
|
||||
|
||||
- Caveat: if Armadillo is installed in a non-system directory,
|
||||
make sure that the C++ compiler is configured to use the "lib" and "include"
|
||||
sub-directories present within this directory. Note that the "lib"
|
||||
directory might be named differently on your system.
|
||||
On recent 64 bit Debian & Ubuntu systems it is "lib/x86_64-linux-gnu".
|
||||
On recent 64 bit Fedora & RHEL systems it is "lib64".
|
||||
|
||||
* Step 5:
|
||||
If you and have access to root/administrator/superuser privileges
|
||||
(ie. able to use "sudo") and didn't use the CMAKE_INSTALL_PREFIX option,
|
||||
type the following command:
|
||||
If you have sudo access (ie. root/administrator/superuser privileges)
|
||||
and didn't use the `CMAKE_INSTALL_PREFIX` option, run the following command:
|
||||
|
||||
sudo make install
|
||||
|
||||
If you don't have root/administrator/superuser privileges,
|
||||
make sure that you use the CMAKE_INSTALL_PREFIX option in Step 4,
|
||||
and type the following command:
|
||||
If you don't have sudo access, make sure to use the `CMAKE_INSTALL_PREFIX` option
|
||||
and run the following command:
|
||||
|
||||
make install
|
||||
|
||||
|
||||
#### 5b: Manual Installation
|
||||
|
||||
Manual installation involves simply copying the `include/armadillo` header
|
||||
**and** the associated `include/armadillo_bits` directory to a location
|
||||
such as `/usr/include/` which is searched by your C++ compiler.
|
||||
If you don't have sudo access or don't have write access to `/usr/include/`,
|
||||
use a directory within your own home directory (eg. `/home/blah/include/`).
|
||||
|
||||
If required, modify `include/armadillo_bits/config.hpp`
|
||||
to indicate which libraries are currently available on your system.
|
||||
Comment or uncomment the following lines:
|
||||
|
||||
#define ARMA_USE_LAPACK
|
||||
#define ARMA_USE_BLAS
|
||||
#define ARMA_USE_ARPACK
|
||||
#define ARMA_USE_SUPERLU
|
||||
|
||||
If support for sparse matrices is not needed, ARPACK and SuperLU are not necessary.
|
||||
|
||||
Note that the manual installation will not generate the Armadillo runtime library,
|
||||
and hence you will need to link your programs directly with OpenBLAS, LAPACK, etc.
|
||||
|
||||
---
|
||||
|
||||
### 6: Linux and macOS: Compiling and Linking
|
||||
|
||||
If you have installed Armadillo via the CMake installer,
|
||||
use the following command:
|
||||
If you have installed Armadillo via the cmake installer,
|
||||
use the following command to compile your programs:
|
||||
|
||||
g++ prog.cpp -o prog -O2 -larmadillo
|
||||
g++ prog.cpp -o prog -O2 -std=c++11 -larmadillo
|
||||
|
||||
Otherwise, if you want to use Armadillo without installation
|
||||
(ie. without the Armadillo runtime library), use the following command:
|
||||
|
||||
g++ prog.cpp -o prog.cpp -O2 -I /home/blah/armadillo-7.200.3/include -DARMA_DONT_USE_WRAPPER -lopenblas
|
||||
If you have installed Armadillo manually, link with OpenBLAS and LAPACK
|
||||
instead of the Armadillo runtime library:
|
||||
|
||||
The above command assumes that the armadillo archive was unpacked into /home/blah/
|
||||
The command needs to be adjusted if the archive was unpacked into a different directory
|
||||
and/or for each specific version of Armadillo (ie. "7.200.3" needs to be changed).
|
||||
|
||||
If you don't have OpenBLAS, on Linux change -lopenblas to -lblas -llapack
|
||||
and on macOS change -lopenblas to -framework Accelerate
|
||||
g++ prog.cpp -o prog -O2 -std=c++11 -lopenblas -llapack
|
||||
|
||||
See the Questions page for more info on linking:
|
||||
If you have manually installed Armadillo in a non-standard location,
|
||||
such as `/home/blah/include/`, you will need to make sure
|
||||
that your C++ compiler searches `/home/blah/include/`
|
||||
by explicitly specifying the directory as an argument/option.
|
||||
For example, using the `-I` switch in GCC and Clang:
|
||||
|
||||
g++ prog.cpp -o prog -O2 -std=c++11 -I /home/blah/include/ -lopenblas -llapack
|
||||
|
||||
If you're getting linking issues (unresolved symbols),
|
||||
enable the `ARMA_DONT_USE_WRAPPER` option:
|
||||
|
||||
g++ prog.cpp -o prog -O2 -std=c++11 -I /home/blah/include/ -DARMA_DONT_USE_WRAPPER -lopenblas -llapack
|
||||
|
||||
If you don't have OpenBLAS, on Linux change `-lopenblas` to `-lblas`;
|
||||
on macOS change `-lopenblas -llapack` to `-framework Accelerate`
|
||||
|
||||
The `examples` directory contains a short example program that uses Armadillo.
|
||||
|
||||
We recommend that compilation is done with optimisation enabled,
|
||||
in order to make best use of the extensive template meta-programming
|
||||
techniques employed in Armadillo.
|
||||
For GCC and Clang compilers use `-O2` or `-O3` to enable optimisation.
|
||||
|
||||
For more information on compiling and linking, see the Questions page:
|
||||
http://arma.sourceforge.net/faq.html
|
||||
|
||||
The "examples" directory contains a short example program that uses the Armadillo library.
|
||||
|
||||
---
|
||||
|
||||
### 7: Windows: Installation
|
||||
@@ -259,57 +263,50 @@ The "examples" directory contains a short example program that uses the Armadill
|
||||
The installation is comprised of 3 steps:
|
||||
|
||||
* Step 1:
|
||||
Copy the entire "include" folder to a convenient location
|
||||
Copy the entire `include` folder to a convenient location
|
||||
and tell your compiler to use that location for header files
|
||||
(in addition to the locations it uses already).
|
||||
Alternatively, the "include" folder can be used directly.
|
||||
Alternatively, the `include` folder can be used directly.
|
||||
|
||||
* Step 2:
|
||||
Modify "include/armadillo_bits/config.hpp" to indicate which
|
||||
libraries are currently available on your system. For example,
|
||||
if LAPACK, BLAS (or OpenBLAS), ARPACK and SuperLU present,
|
||||
uncomment the following lines:
|
||||
If required, modify `include/armadillo_bits/config.hpp`
|
||||
to indicate which libraries are currently available on your system:
|
||||
|
||||
#define ARMA_USE_LAPACK
|
||||
#define ARMA_USE_BLAS
|
||||
#define ARMA_USE_ARPACK
|
||||
#define ARMA_USE_SUPERLU
|
||||
|
||||
If support for sparse matrices is not required,
|
||||
don't worry about ARPACK or SuperLU.
|
||||
If support for sparse matrices is not needed, ARPACK or SuperLU are not necessary.
|
||||
|
||||
* Step 3:
|
||||
Configure your compiler to link with LAPACK and BLAS
|
||||
(and optionally ARPACK and SuperLU).
|
||||
Note that OpenBLAS can be used as a high-performance substitute
|
||||
for both LAPACK and BLAS.
|
||||
|
||||
---
|
||||
|
||||
### 8: Windows: Compiling and Linking
|
||||
|
||||
Within the "examples" folder, there is an MSVC project named "example1_win64"
|
||||
which can be used to compile "example1.cpp". The project needs to be compiled as a
|
||||
64 bit program: the active solution platform must be set to x64, instead of win32.
|
||||
Within the `examples` folder, the MSVC project named `example1_win64`
|
||||
can be used to compile `example1.cpp`.
|
||||
The project needs to be compiled as a 64 bit program:
|
||||
the active solution platform must be set to x64, instead of win32.
|
||||
|
||||
The MSVC project was tested on Windows 7 (64 bit) with Visual Studio C++ 2012.
|
||||
Adaptations may need to be made for 32 bit systems, later versions of Windows
|
||||
and/or the compiler. For example, options such as ARMA_BLAS_LONG and ARMA_BLAS_UNDERSCORE,
|
||||
defined in "armadillo_bits/config.hpp", may need to be either enabled or disabled.
|
||||
The MSVC project was tested on Windows 10 (64 bit) with Visual Studio C++ 2019.
|
||||
Adaptations may be required for 32 bit systems, later versions of Windows and/or the compiler.
|
||||
For example, options such as `ARMA_BLAS_LONG` and `ARMA_BLAS_UNDERSCORE`,
|
||||
defined in `include/armadillo_bits/config.hpp`, may need to be either enabled or disabled.
|
||||
|
||||
The folder "examples/lib_win64" contains baseline (unoptimised) LAPACK and BLAS
|
||||
libraries compiled for 64 bit Windows. The compilation was done by a third party.
|
||||
USE AT YOUR OWN RISK. The compiled versions of LAPACK and BLAS were obtained from:
|
||||
http://ylzhao.blogspot.com.au/2013/10/blas-lapack-precompiled-binaries-for.html
|
||||
|
||||
Faster and/or alternative implementations of BLAS and LAPACK are available:
|
||||
* http://www.openblas.net/
|
||||
* http://icl.cs.utk.edu/lapack-for-windows/lapack/
|
||||
* http://software.intel.com/en-us/intel-mkl/
|
||||
|
||||
OpenBLAS and Intel MKL are generally the fastest replacements for both BLAS and LAPACK.
|
||||
The folder `examples/lib_win64` contains a copy of lib and dll files
|
||||
obtained from a pre-compiled release of OpenBLAS:
|
||||
https://github.com/xianyi/OpenBLAS/releases/
|
||||
The compilation was done by a third party. USE AT YOUR OWN RISK.
|
||||
|
||||
**Caveat:**
|
||||
for any high performance scientific/engineering workloads,
|
||||
we strongly recommend using a Linux based operating system:
|
||||
we strongly recommend using a Linux-based operating system:
|
||||
* Fedora http://fedoraproject.org/
|
||||
* Ubuntu http://www.ubuntu.com/
|
||||
* CentOS http://centos.org/
|
||||
@@ -322,7 +319,7 @@ Armadillo can use OpenBLAS or Intel Math Kernel Library (MKL) as high-speed
|
||||
replacements for BLAS and LAPACK. In essence this involves linking with the
|
||||
replacement libraries instead of BLAS and LAPACK.
|
||||
|
||||
Minor modifications to include/armadillo_bits/config.hpp may be required
|
||||
Minor modifications to `include/armadillo_bits/config.hpp` may be required
|
||||
to ensure Armadillo uses the same integer sizes and style of function names
|
||||
as used by the replacement libraries. Specifically, the following defines
|
||||
may need to be enabled or disabled:
|
||||
@@ -335,61 +332,47 @@ may need to be enabled or disabled:
|
||||
|
||||
See the documentation for more information on the above defines.
|
||||
|
||||
On Linux-based systems, MKL might be installed in a non-standard location
|
||||
such as /opt which can cause problems during linking. Before installing
|
||||
Armadillo, the system should know where the MKL libraries are located.
|
||||
For example, /opt/intel/mkl/lib/intel64/. This can be achieved by setting
|
||||
the LD_LIBRARY_PATH environment variable, or for a more permanent solution,
|
||||
adding the directory locations to /etc/ld.so.conf. It may also be possible
|
||||
to store a text file with the locations in the /etc/ld.so.conf.d directory.
|
||||
For example, /etc/ld.so.conf.d/mkl.conf. If /etc/ld.so.conf is modified
|
||||
or /etc/ld.so.conf.d/mkl.conf is created, /sbin/ldconfig must be run afterwards.
|
||||
On Linux-based systems, MKL might be installed in a non-standard location such as `/opt`
|
||||
which can cause problems during linking.
|
||||
Before installing Armadillo, the system should know where the MKL libraries are located.
|
||||
For example, `/opt/intel/mkl/lib/intel64/`.
|
||||
This can be achieved by setting the `LD_LIBRARY_PATH` environment variable,
|
||||
or for a more permanent solution, adding the directory locations to `/etc/ld.so.conf`.
|
||||
It may also be possible to store a text file with the locations
|
||||
in the `/etc/ld.so.conf.d` directory. For example, `/etc/ld.so.conf.d/mkl.conf`.
|
||||
If `/etc/ld.so.conf` is modified or `/etc/ld.so.conf.d/mkl.conf` is created,
|
||||
`/sbin/ldconfig` must be run afterwards.
|
||||
|
||||
Below is an example of /etc/ld.so.conf.d/mkl.conf
|
||||
where Intel MKL is installed in /opt/intel
|
||||
Below is an example of `/etc/ld.so.conf.d/mkl.conf`
|
||||
where Intel MKL is installed in `/opt/intel`
|
||||
|
||||
/opt/intel/lib/intel64
|
||||
/opt/intel/mkl/lib/intel64
|
||||
|
||||
If MKL is installed and it is persistently giving problems during linking,
|
||||
Support for MKL can be disabled by editing the CMakeLists.txt file,
|
||||
deleting CMakeCache.txt and re-running the CMake based installation.
|
||||
Comment out the lines containing:
|
||||
deleting CMakeCache.txt and re-running the cmake based installation.
|
||||
Comment out the line containing:
|
||||
|
||||
INCLUDE(ARMA_FindMKL)
|
||||
INCLUDE(ARMA_FindACMLMP)
|
||||
INCLUDE(ARMA_FindACML)
|
||||
INCLUDE(ARMA_FindMKL)
|
||||
|
||||
---
|
||||
|
||||
### 10: Support for ATLAS
|
||||
|
||||
Armadillo can use the ATLAS library for faster versions of a subset
|
||||
of LAPACK and BLAS functions. LAPACK should still be installed to
|
||||
obtain full functionality.
|
||||
|
||||
Caveat: the minimum recommended version of ATLAS is 3.10;
|
||||
earlier versions (such as 3.6 and 3.8) can produce incorrect
|
||||
results and/or corrupt memory, leading to random crashes.
|
||||
If OpenBLAS is not available, Armadillo can use the ATLAS library for faster versions
|
||||
of a subset of LAPACK and BLAS functions.
|
||||
LAPACK should still be installed to obtain full functionality.
|
||||
The minimum recommended version of ATLAS is 3.10.
|
||||
|
||||
---
|
||||
|
||||
### 11: Support for C++11 / C++14 Features
|
||||
### 11: Caveat on use of C++11 auto Keyword
|
||||
|
||||
Armadillo works with compilers supporting the older C++98 and C++03 standards,
|
||||
as well as the newer C++11 and C++14 standards.
|
||||
Use of the C++11 `auto` keyword is not recommended with Armadillo objects and expressions.
|
||||
|
||||
Armadillo will enable extra features (such as move constructors)
|
||||
when a C++11/C++14 compiler is detected. You can also force Armadillo
|
||||
to make use of C++11 features by defining ARMA_USE_CXX11 before
|
||||
`#include <armadillo>` in your code.
|
||||
|
||||
You may need to explicitly enable C++11 mode in your compiler.
|
||||
For example, use the -std=c++11 or -std=c++14 options in gcc & clang.
|
||||
|
||||
**Caveat:** use of the C++11 "auto" keyword is not recommended with Armadillo
|
||||
objects and expressions. Armadillo has a template meta-programming framework
|
||||
which creates lots of short lived temporaries that are not handled by auto.
|
||||
Armadillo has a template meta-programming framework which creates lots of short lived temporaries
|
||||
that are not properly handled by `auto`.
|
||||
|
||||
---
|
||||
|
||||
@@ -399,21 +382,18 @@ Armadillo can use OpenMP to automatically speed up computationally
|
||||
expensive element-wise functions such as exp(), log(), cos(), etc.
|
||||
This requires a C++11/C++14 compiler with OpenMP 3.1+ support.
|
||||
|
||||
When using gcc or clang, use the following options to enable both
|
||||
C++11 and OpenMP: -std=c++11 -fopenmp
|
||||
|
||||
Caveat: when using gcc, use of -march=native in conjunction with -fopenmp
|
||||
may lead to speed regressions on recent processors.
|
||||
For GCC and Clang compilers, use the following options to enable both C++11 and OpenMP:
|
||||
`-std=c++11 -fopenmp`
|
||||
|
||||
---
|
||||
|
||||
### 13: Documentation
|
||||
### 13: Documentation of Functions and Classes
|
||||
|
||||
The documentation for Armadillo functions and classes is available at:
|
||||
The documentation of Armadillo functions and classes is available at:
|
||||
http://arma.sourceforge.net/docs.html
|
||||
|
||||
The documentation is also in the "docs.html" file in this folder,
|
||||
which can be viewed with a web browser.
|
||||
The documentation is also in the `docs.html` file distributed with Armadillo.
|
||||
Use a web browser to view it.
|
||||
|
||||
---
|
||||
|
||||
@@ -474,21 +454,25 @@ http://arma.sourceforge.net/faq.html
|
||||
|
||||
### 16: MEX Interface to Octave/Matlab
|
||||
|
||||
The "mex_interface" folder contains examples of how to interface
|
||||
The `mex_interface` folder contains examples of how to interface
|
||||
Octave/Matlab with C++ code that uses Armadillo matrices.
|
||||
|
||||
---
|
||||
|
||||
### 17: Related Software Using Armadillo
|
||||
|
||||
* ensmallen: fast non-linear numerical optimisation library
|
||||
http://ensmallen.org/
|
||||
|
||||
* MLPACK: extensive library of machine learning algorithms
|
||||
http://mlpack.org
|
||||
|
||||
* ensmallen: C++ library of numerical optimisation methods
|
||||
http://ensmallen.org/
|
||||
|
||||
* SigPack: C++ signal processing library
|
||||
http://sigpack.sourceforge.net
|
||||
* CARMA: bidirectional interface between Python and Armadillo
|
||||
https://github.com/RUrlus/carma
|
||||
|
||||
* RcppArmadillo: integration of Armadillo with the R system and environment
|
||||
http://dirk.eddelbuettel.com/code/rcpp.armadillo.html
|
||||
|
||||
* PyArmadillo: streamlined linear algebra library for Python
|
||||
https://pyarma.sourceforge.io
|
||||
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,16 @@
|
||||
# - Config file for the Armadillo package
|
||||
# It defines the following variables
|
||||
# ARMADILLO_INCLUDE_DIRS - include directories for Armadillo
|
||||
# ARMADILLO_LIBRARY_DIRS - library directories for Armadillo (normally not used!)
|
||||
# ARMADILLO_LIBRARIES - libraries to link against
|
||||
|
||||
# Tell the user project where to find our headers and libraries
|
||||
set(ARMADILLO_INCLUDE_DIRS "@ARMADILLO_INCLUDE_DIRS@")
|
||||
set(ARMADILLO_LIBRARY_DIRS "@ARMADILLO_LIB_DIR@")
|
||||
|
||||
# Our library dependencies (contains definitions for IMPORTED targets)
|
||||
include("@ARMADILLO_CMAKE_DIR@/ArmadilloLibraryDepends.cmake")
|
||||
|
||||
# These are IMPORTED targets created by ArmadilloLibraryDepends.cmake
|
||||
set(ARMADILLO_LIBRARIES armadillo)
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
set(PACKAGE_VERSION "@ARMA_VERSION_MAJOR@.@ARMA_VERSION_MINOR@.@ARMA_VERSION_PATCH@")
|
||||
|
||||
# Check whether the requested PACKAGE_FIND_VERSION is compatible
|
||||
if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}")
|
||||
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||
else()
|
||||
set(PACKAGE_VERSION_COMPATIBLE TRUE)
|
||||
if ("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}")
|
||||
set(PACKAGE_VERSION_EXACT TRUE)
|
||||
endif()
|
||||
endif()
|
||||
@@ -1,37 +0,0 @@
|
||||
# - Find AMD's ACML library (no includes) which provides optimised BLAS and LAPACK functions
|
||||
# This module defines
|
||||
# ACML_LIBRARIES, the libraries needed to use ACML.
|
||||
# ACML_FOUND, If false, do not try to use ACML.
|
||||
# also defined, but not for general use are
|
||||
# ACML_LIBRARY, where to find the ACML library.
|
||||
|
||||
SET(ACML_NAMES ${ACML_NAMES} acml)
|
||||
FIND_LIBRARY(ACML_LIBRARY
|
||||
NAMES ${ACML_NAMES}
|
||||
PATHS /usr/lib64 /usr/lib /usr/*/lib64 /usr/*/lib /usr/*/gfortran64/lib/ /usr/*/gfortran32/lib/ /usr/local/lib64 /usr/local/lib /opt/lib64 /opt/lib /opt/*/lib64 /opt/*/lib /opt/*/gfortran64/lib/ /opt/*/gfortran32/lib/
|
||||
)
|
||||
|
||||
IF (ACML_LIBRARY)
|
||||
SET(ACML_LIBRARIES ${ACML_LIBRARY})
|
||||
SET(ACML_FOUND "YES")
|
||||
ELSE (ACML_LIBRARY)
|
||||
SET(ACML_FOUND "NO")
|
||||
ENDIF (ACML_LIBRARY)
|
||||
|
||||
|
||||
IF (ACML_FOUND)
|
||||
IF (NOT ACML_FIND_QUIETLY)
|
||||
MESSAGE(STATUS "Found ACML: ${ACML_LIBRARIES}")
|
||||
ENDIF (NOT ACML_FIND_QUIETLY)
|
||||
ELSE (ACML_FOUND)
|
||||
IF (ACML_FIND_REQUIRED)
|
||||
MESSAGE(FATAL_ERROR "Could not find ACML")
|
||||
ENDIF (ACML_FIND_REQUIRED)
|
||||
ENDIF (ACML_FOUND)
|
||||
|
||||
# Deprecated declarations.
|
||||
GET_FILENAME_COMPONENT (NATIVE_ACML_LIB_PATH ${ACML_LIBRARY} PATH)
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
ACML_LIBRARY
|
||||
)
|
||||
@@ -1,37 +0,0 @@
|
||||
# - Find AMD's ACMLMP library (no includes) which provides optimised and parallelised BLAS and LAPACK functions
|
||||
# This module defines
|
||||
# ACMLMP_LIBRARIES, the libraries needed to use ACMLMP.
|
||||
# ACMLMP_FOUND, If false, do not try to use ACMLMP.
|
||||
# also defined, but not for general use are
|
||||
# ACMLMP_LIBRARY, where to find the ACMLMP library.
|
||||
|
||||
SET(ACMLMP_NAMES ${ACMLMP_NAMES} acml_mp)
|
||||
FIND_LIBRARY(ACMLMP_LIBRARY
|
||||
NAMES ${ACMLMP_NAMES}
|
||||
PATHS /usr/lib64 /usr/lib /usr/*/lib64 /usr/*/lib /usr/*/gfortran64_mp/lib/ /usr/*/gfortran32_mp/lib/ /usr/local/lib64 /usr/local/lib /opt/lib64 /opt/lib /opt/*/lib64 /opt/*/lib /opt/*/gfortran64_mp/lib/ /opt/*/gfortran32_mp/lib/
|
||||
)
|
||||
|
||||
IF (ACMLMP_LIBRARY)
|
||||
SET(ACMLMP_LIBRARIES ${ACMLMP_LIBRARY})
|
||||
SET(ACMLMP_FOUND "YES")
|
||||
ELSE (ACMLMP_LIBRARY)
|
||||
SET(ACMLMP_FOUND "NO")
|
||||
ENDIF (ACMLMP_LIBRARY)
|
||||
|
||||
|
||||
IF (ACMLMP_FOUND)
|
||||
IF (NOT ACMLMP_FIND_QUIETLY)
|
||||
MESSAGE(STATUS "Found ACMLMP: ${ACMLMP_LIBRARIES}")
|
||||
ENDIF (NOT ACMLMP_FIND_QUIETLY)
|
||||
ELSE (ACMLMP_FOUND)
|
||||
IF (ACMLMP_FIND_REQUIRED)
|
||||
MESSAGE(FATAL_ERROR "Could not find ACMLMP")
|
||||
ENDIF (ACMLMP_FIND_REQUIRED)
|
||||
ENDIF (ACMLMP_FOUND)
|
||||
|
||||
# Deprecated declarations.
|
||||
GET_FILENAME_COMPONENT (NATIVE_ACMLMP_LIB_PATH ${ACMLMP_LIBRARY} PATH)
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
ACMLMP_LIBRARY
|
||||
)
|
||||
+15
-15
@@ -1,24 +1,24 @@
|
||||
How to compile example1.cpp
|
||||
|
||||
|
||||
* Linux and macOS
|
||||
** Linux and macOS **
|
||||
|
||||
If you have installed Armadillo via the CMake installer:
|
||||
g++ example1.cpp -o example1 -std=c++11 -O2 -larmadillo
|
||||
|
||||
If you have installed Armadillo via the CMake installer:
|
||||
g++ example1.cpp -o example1 -O2 -larmadillo
|
||||
Otherwise, if you want to use Armadillo without installation:
|
||||
g++ example1.cpp -o example1 -std=c++11 -O2 -I /home/blah/armadillo-7.200.3/include -DARMA_DONT_USE_WRAPPER -lopenblas
|
||||
|
||||
Otherwise, if you want to use Armadillo without installation:
|
||||
g++ example1.cpp -o example1 -O2 -I /home/blah/armadillo-7.200.3/include -DARMA_DONT_USE_WRAPPER -lopenblas
|
||||
The above command assumes that the armadillo archive was unpacked into /home/blah/
|
||||
The command needs to be adjusted if the archive was unpacked into a different directory
|
||||
and/or for each specific version of Armadillo (ie. "7.200.3" needs to be changed)
|
||||
|
||||
The above command assumes that the armadillo archive was unpacked into /home/blah/
|
||||
The command needs to be adjusted if the archive was unpacked into a different directory
|
||||
and/or for each specific version of Armadillo (ie. "7.200.3" needs to be changed)
|
||||
|
||||
If you don't have OpenBLAS, on Linux change -lopenblas to -lblas -llapack
|
||||
and on macOS change -lopenblas to -framework Accelerate
|
||||
If you don't have OpenBLAS, on Linux change -lopenblas to -lblas -llapack
|
||||
and on macOS change -lopenblas to -framework Accelerate
|
||||
|
||||
|
||||
* Windows
|
||||
** Windows **
|
||||
|
||||
Open "example1_win64.sln" or "example1_win64.vcxproj" with Visual Studio.
|
||||
The example1_win64 project needs to be compiled as a 64 bit program.
|
||||
Make sure the active solution platform is set to x64, instead of win32.
|
||||
Open "example1_win64.sln" or "example1_win64.vcxproj" with Visual Studio.
|
||||
The example1_win64 project needs to be compiled as a 64 bit program.
|
||||
Make sure the active solution platform is set to x64, instead of win32.
|
||||
|
||||
+20
-19
@@ -14,12 +14,14 @@ main(int argc, char** argv)
|
||||
{
|
||||
cout << "Armadillo version: " << arma_version::as_string() << endl;
|
||||
|
||||
mat A(2,3); // directly specify the matrix size (elements are uninitialised)
|
||||
// construct a matrix according to given size and form of element initialisation
|
||||
mat A(2,3,fill::zeros);
|
||||
|
||||
cout << "A.n_rows: " << A.n_rows << endl; // .n_rows and .n_cols are read only
|
||||
// .n_rows and .n_cols are read only
|
||||
cout << "A.n_rows: " << A.n_rows << endl;
|
||||
cout << "A.n_cols: " << A.n_cols << endl;
|
||||
|
||||
A(1,2) = 456.0; // directly access an element (indexing starts at 0)
|
||||
A(1,2) = 456.0; // access an element (indexing starts at 0)
|
||||
A.print("A:");
|
||||
|
||||
A = 5.0; // scalars are treated as a 1x1 matrix
|
||||
@@ -27,16 +29,15 @@ main(int argc, char** argv)
|
||||
|
||||
A.set_size(4,5); // change the size (data is not preserved)
|
||||
|
||||
A.fill(5.0); // set all elements to a particular value
|
||||
A.fill(5.0); // set all elements to a specific value
|
||||
A.print("A:");
|
||||
|
||||
// endr indicates "end of row"
|
||||
A << 0.165300 << 0.454037 << 0.995795 << 0.124098 << 0.047084 << endr
|
||||
<< 0.688782 << 0.036549 << 0.552848 << 0.937664 << 0.866401 << endr
|
||||
<< 0.348740 << 0.479388 << 0.506228 << 0.145673 << 0.491547 << endr
|
||||
<< 0.148678 << 0.682258 << 0.571154 << 0.874724 << 0.444632 << endr
|
||||
<< 0.245726 << 0.595218 << 0.409327 << 0.367827 << 0.385736 << endr;
|
||||
|
||||
A = { { 0.165300, 0.454037, 0.995795, 0.124098, 0.047084 },
|
||||
{ 0.688782, 0.036549, 0.552848, 0.937664, 0.866401 },
|
||||
{ 0.348740, 0.479388, 0.506228, 0.145673, 0.491547 },
|
||||
{ 0.148678, 0.682258, 0.571154, 0.874724, 0.444632 },
|
||||
{ 0.245726, 0.595218, 0.409327, 0.367827, 0.385736 } };
|
||||
|
||||
A.print("A:");
|
||||
|
||||
// determinant
|
||||
@@ -93,13 +94,11 @@ main(int argc, char** argv)
|
||||
D.print("D:");
|
||||
|
||||
// row vectors are treated like a matrix with one row
|
||||
rowvec r;
|
||||
r << 0.59119 << 0.77321 << 0.60275 << 0.35887 << 0.51683;
|
||||
rowvec r = { 0.59119, 0.77321, 0.60275, 0.35887, 0.51683 };
|
||||
r.print("r:");
|
||||
|
||||
// column vectors are treated like a matrix with one column
|
||||
vec q;
|
||||
q << 0.14333 << 0.59478 << 0.14481 << 0.58558 << 0.60809;
|
||||
vec q = { 0.14333, 0.59478, 0.14481, 0.58558, 0.60809 };
|
||||
q.print("q:");
|
||||
|
||||
// convert matrix to vector; data in matrices is stored column-by-column
|
||||
@@ -120,11 +119,13 @@ main(int argc, char** argv)
|
||||
B.print("B:");
|
||||
|
||||
// imat specifies an integer matrix
|
||||
imat AA;
|
||||
imat BB;
|
||||
imat AA = { { 1, 2, 3 },
|
||||
{ 4, 5, 6 },
|
||||
{ 7, 8, 9 } };
|
||||
|
||||
AA << 1 << 2 << 3 << endr << 4 << 5 << 6 << endr << 7 << 8 << 9;
|
||||
BB << 3 << 2 << 1 << endr << 6 << 5 << 4 << endr << 9 << 8 << 7;
|
||||
imat BB = { { 3, 2, 1 },
|
||||
{ 6, 5, 4 },
|
||||
{ 9, 8, 7 } };
|
||||
|
||||
// comparison of matrices (element-wise); output of a relational operator is a umat
|
||||
umat ZZ = (AA >= BB);
|
||||
|
||||
@@ -5,18 +5,12 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example1_win64", "example1_
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Debug|x64 = Debug|x64
|
||||
Release|Win32 = Release|Win32
|
||||
Release|x64 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{BDE105B5-0B52-4D77-832F-3465D464A901}.Debug|Win32.ActiveCfg = Release|x64
|
||||
{BDE105B5-0B52-4D77-832F-3465D464A901}.Debug|Win32.Build.0 = Release|x64
|
||||
{BDE105B5-0B52-4D77-832F-3465D464A901}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{BDE105B5-0B52-4D77-832F-3465D464A901}.Debug|x64.Build.0 = Debug|x64
|
||||
{BDE105B5-0B52-4D77-832F-3465D464A901}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{BDE105B5-0B52-4D77-832F-3465D464A901}.Release|Win32.Build.0 = Release|Win32
|
||||
{BDE105B5-0B52-4D77-832F-3465D464A901}.Release|x64.ActiveCfg = Release|x64
|
||||
{BDE105B5-0B52-4D77-832F-3465D464A901}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
|
||||
@@ -1,18 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
@@ -23,67 +15,24 @@
|
||||
<RootNamespace>example1_win64</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup />
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>ARMA_USE_LAPACK;ARMA_USE_BLAS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>lapack_win64_MT.lib;blas_win64_MT.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>libopenblas.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>lib_win64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
@@ -100,7 +49,7 @@
|
||||
<PreprocessorDefinitions>ARMA_USE_LAPACK;ARMA_USE_BLAS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>lapack_win64_MT.lib;blas_win64_MT.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>libopenblas.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>lib_win64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
</Link>
|
||||
@@ -117,4 +66,4 @@
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
||||
@@ -1,19 +1,25 @@
|
||||
The lib and dll files in this folder are for 64 bit Windows 7.
|
||||
They are compiled versions of standard BLAS and LAPACK libraries,
|
||||
which are distributed under a BSD license (see below).
|
||||
The lib and dll files in this folder are for MSVC running on Windows 10 (64 bit).
|
||||
|
||||
The files were obtained from a pre-compiled release of OpenBLAS 0.3.13:
|
||||
https://github.com/xianyi/OpenBLAS/releases/download/v0.3.13/OpenBLAS-0.3.13-x64.zip
|
||||
|
||||
The compilation was done by a third party. USE AT YOUR OWN RISK.
|
||||
The compiled versions of LAPACK and BLAS were obtained from:
|
||||
http://ylzhao.blogspot.com.au/2013/10/blas-lapack-precompiled-binaries-for.html
|
||||
|
||||
You can find the original sources for standard BLAS and LAPACK at:
|
||||
libopenblas.dll is a copy of OpenBLAS-0.3.13-x64/bin/libopenblas.dll
|
||||
libopenblas.lib is a copy of OpenBLAS-0.3.13-x64/lib/libopenblas.dll.a
|
||||
|
||||
The original sources for OpenBLAS are at:
|
||||
https://github.com/xianyi/OpenBLAS/
|
||||
|
||||
OpenBLAS is a high-performance implementation of BLAS and LAPACK.
|
||||
The original sources for standard BLAS and LAPACK are at:
|
||||
http://www.netlib.org/blas/
|
||||
http://www.netlib.org/lapack/
|
||||
|
||||
Faster and/or alternative implementations of BLAS and LAPACK are available:
|
||||
http://xianyi.github.com/OpenBLAS/
|
||||
|
||||
Alternative implementations and/or distributions of BLAS and LAPACK are available at:
|
||||
http://software.intel.com/en-us/intel-mkl/
|
||||
http://icl.cs.utk.edu/lapack-for-windows/lapack/
|
||||
http://ylzhao.blogspot.com.au/2013/10/blas-lapack-precompiled-binaries-for.html
|
||||
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Executable
BIN
Binary file not shown.
Binary file not shown.
+41
-48
@@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
// Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
//
|
||||
@@ -17,12 +19,15 @@
|
||||
#ifndef ARMA_INCLUDES
|
||||
#define ARMA_INCLUDES
|
||||
|
||||
#include "armadillo_bits/config.hpp"
|
||||
#include "armadillo_bits/compiler_check.hpp"
|
||||
|
||||
#include <cstdlib>
|
||||
#include <cstddef>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <climits>
|
||||
#include <cstdint>
|
||||
#include <cmath>
|
||||
#include <ctime>
|
||||
|
||||
@@ -37,66 +42,41 @@
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
#include <map>
|
||||
#include <initializer_list>
|
||||
#include <random>
|
||||
#include <functional>
|
||||
#include <chrono>
|
||||
|
||||
#if !defined(ARMA_DONT_USE_STD_MUTEX)
|
||||
#include <mutex>
|
||||
#include <atomic>
|
||||
#endif
|
||||
|
||||
#if defined(ARMA_USE_TBB_ALLOC)
|
||||
#include <tbb/scalable_allocator.h>
|
||||
#endif
|
||||
|
||||
#if defined(ARMA_USE_MKL_ALLOC)
|
||||
#include <mkl_service.h>
|
||||
#endif
|
||||
|
||||
#if ( defined(__unix__) || defined(__unix) || defined(_POSIX_C_SOURCE) || (defined(__APPLE__) && defined(__MACH__)) ) && !defined(_WIN32)
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
|
||||
#if (defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200112L))
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
|
||||
#include "armadillo_bits/compiler_extra.hpp"
|
||||
#include "armadillo_bits/config.hpp"
|
||||
#include "armadillo_bits/compiler_setup.hpp"
|
||||
|
||||
|
||||
#if defined(ARMA_USE_CXX11)
|
||||
#include <initializer_list>
|
||||
#include <cstdint>
|
||||
#include <random>
|
||||
#include <functional>
|
||||
#include <chrono>
|
||||
#endif
|
||||
|
||||
|
||||
#if (defined(ARMA_USE_CXX11) && !defined(ARMA_DONT_USE_CXX11_MUTEX))
|
||||
#include <mutex>
|
||||
#include <atomic>
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(ARMA_USE_TBB_ALLOC)
|
||||
#include <tbb/scalable_allocator.h>
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(ARMA_USE_MKL_ALLOC)
|
||||
#include <mkl_service.h>
|
||||
#endif
|
||||
|
||||
|
||||
#if !defined(ARMA_USE_CXX11)
|
||||
#if defined(ARMA_HAVE_TR1)
|
||||
#include <tr1/cmath>
|
||||
#include <tr1/complex>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#include "armadillo_bits/include_atlas.hpp"
|
||||
#include "armadillo_bits/include_hdf5.hpp"
|
||||
#include "armadillo_bits/include_superlu.hpp"
|
||||
|
||||
|
||||
#if defined(ARMA_USE_OPENMP)
|
||||
#include <omp.h>
|
||||
#endif
|
||||
|
||||
|
||||
#include "armadillo_bits/include_atlas.hpp"
|
||||
#include "armadillo_bits/include_hdf5.hpp"
|
||||
#include "armadillo_bits/include_superlu.hpp"
|
||||
|
||||
|
||||
//! \namespace arma namespace for Armadillo classes and functions
|
||||
namespace arma
|
||||
@@ -123,6 +103,7 @@ namespace arma
|
||||
#include "armadillo_bits/constants_old.hpp"
|
||||
#include "armadillo_bits/mp_misc.hpp"
|
||||
#include "armadillo_bits/arma_rel_comparators.hpp"
|
||||
#include "armadillo_bits/fill.hpp"
|
||||
|
||||
#ifdef ARMA_RNG_ALT
|
||||
#include ARMA_INCFILE_WRAP(ARMA_RNG_ALT)
|
||||
@@ -176,6 +157,7 @@ namespace arma
|
||||
#include "armadillo_bits/SpCol_bones.hpp"
|
||||
#include "armadillo_bits/SpRow_bones.hpp"
|
||||
#include "armadillo_bits/SpSubview_bones.hpp"
|
||||
#include "armadillo_bits/SpSubview_col_list_bones.hpp"
|
||||
#include "armadillo_bits/spdiagview_bones.hpp"
|
||||
#include "armadillo_bits/MapMat_bones.hpp"
|
||||
|
||||
@@ -232,6 +214,8 @@ namespace arma
|
||||
#include "armadillo_bits/op_diagmat_bones.hpp"
|
||||
#include "armadillo_bits/op_diagvec_bones.hpp"
|
||||
#include "armadillo_bits/op_dot_bones.hpp"
|
||||
#include "armadillo_bits/op_det_bones.hpp"
|
||||
#include "armadillo_bits/op_log_det_bones.hpp"
|
||||
#include "armadillo_bits/op_inv_bones.hpp"
|
||||
#include "armadillo_bits/op_htrans_bones.hpp"
|
||||
#include "armadillo_bits/op_max_bones.hpp"
|
||||
@@ -294,6 +278,7 @@ namespace arma
|
||||
#include "armadillo_bits/op_sp_plus_bones.hpp"
|
||||
#include "armadillo_bits/op_sp_minus_bones.hpp"
|
||||
#include "armadillo_bits/op_powmat_bones.hpp"
|
||||
#include "armadillo_bits/op_rank_bones.hpp"
|
||||
|
||||
#include "armadillo_bits/glue_times_bones.hpp"
|
||||
#include "armadillo_bits/glue_mixed_bones.hpp"
|
||||
@@ -339,8 +324,8 @@ namespace arma
|
||||
#include "armadillo_bits/spop_reverse_bones.hpp"
|
||||
#include "armadillo_bits/spop_repmat_bones.hpp"
|
||||
#include "armadillo_bits/spop_vectorise_bones.hpp"
|
||||
#include "armadillo_bits/spop_norm_bones.hpp"
|
||||
|
||||
#include "armadillo_bits/spglue_elem_helper_bones.hpp"
|
||||
#include "armadillo_bits/spglue_plus_bones.hpp"
|
||||
#include "armadillo_bits/spglue_minus_bones.hpp"
|
||||
#include "armadillo_bits/spglue_schur_bones.hpp"
|
||||
@@ -356,9 +341,11 @@ namespace arma
|
||||
#include "armadillo_bits/newarp_EigsSelect.hpp"
|
||||
#include "armadillo_bits/newarp_DenseGenMatProd_bones.hpp"
|
||||
#include "armadillo_bits/newarp_SparseGenMatProd_bones.hpp"
|
||||
#include "armadillo_bits/newarp_SparseGenRealShiftSolve_bones.hpp"
|
||||
#include "armadillo_bits/newarp_DoubleShiftQR_bones.hpp"
|
||||
#include "armadillo_bits/newarp_GenEigsSolver_bones.hpp"
|
||||
#include "armadillo_bits/newarp_SymEigsSolver_bones.hpp"
|
||||
#include "armadillo_bits/newarp_SymEigsShiftSolver_bones.hpp"
|
||||
#include "armadillo_bits/newarp_TridiagEigen_bones.hpp"
|
||||
#include "armadillo_bits/newarp_UpperHessenbergEigen_bones.hpp"
|
||||
#include "armadillo_bits/newarp_UpperHessenbergQR_bones.hpp"
|
||||
@@ -502,7 +489,7 @@ namespace arma
|
||||
#include "armadillo_bits/fn_cumsum.hpp"
|
||||
#include "armadillo_bits/fn_cumprod.hpp"
|
||||
#include "armadillo_bits/fn_symmat.hpp"
|
||||
#include "armadillo_bits/fn_syl_lyap.hpp"
|
||||
#include "armadillo_bits/fn_sylvester.hpp"
|
||||
#include "armadillo_bits/fn_hist.hpp"
|
||||
#include "armadillo_bits/fn_histc.hpp"
|
||||
#include "armadillo_bits/fn_unique.hpp"
|
||||
@@ -645,6 +632,7 @@ namespace arma
|
||||
#include "armadillo_bits/SpRow_meat.hpp"
|
||||
#include "armadillo_bits/SpSubview_meat.hpp"
|
||||
#include "armadillo_bits/SpSubview_iterators_meat.hpp"
|
||||
#include "armadillo_bits/SpSubview_col_list_meat.hpp"
|
||||
#include "armadillo_bits/spdiagview_meat.hpp"
|
||||
#include "armadillo_bits/MapMat_meat.hpp"
|
||||
|
||||
@@ -656,6 +644,8 @@ namespace arma
|
||||
#include "armadillo_bits/op_diagmat_meat.hpp"
|
||||
#include "armadillo_bits/op_diagvec_meat.hpp"
|
||||
#include "armadillo_bits/op_dot_meat.hpp"
|
||||
#include "armadillo_bits/op_det_meat.hpp"
|
||||
#include "armadillo_bits/op_log_det_meat.hpp"
|
||||
#include "armadillo_bits/op_inv_meat.hpp"
|
||||
#include "armadillo_bits/op_htrans_meat.hpp"
|
||||
#include "armadillo_bits/op_max_meat.hpp"
|
||||
@@ -718,6 +708,7 @@ namespace arma
|
||||
#include "armadillo_bits/op_sp_plus_meat.hpp"
|
||||
#include "armadillo_bits/op_sp_minus_meat.hpp"
|
||||
#include "armadillo_bits/op_powmat_meat.hpp"
|
||||
#include "armadillo_bits/op_rank_meat.hpp"
|
||||
|
||||
#include "armadillo_bits/glue_times_meat.hpp"
|
||||
#include "armadillo_bits/glue_mixed_meat.hpp"
|
||||
@@ -763,8 +754,8 @@ namespace arma
|
||||
#include "armadillo_bits/spop_reverse_meat.hpp"
|
||||
#include "armadillo_bits/spop_repmat_meat.hpp"
|
||||
#include "armadillo_bits/spop_vectorise_meat.hpp"
|
||||
#include "armadillo_bits/spop_norm_meat.hpp"
|
||||
|
||||
#include "armadillo_bits/spglue_elem_helper_meat.hpp"
|
||||
#include "armadillo_bits/spglue_plus_meat.hpp"
|
||||
#include "armadillo_bits/spglue_minus_meat.hpp"
|
||||
#include "armadillo_bits/spglue_schur_meat.hpp"
|
||||
@@ -781,9 +772,11 @@ namespace arma
|
||||
#include "armadillo_bits/newarp_SortEigenvalue.hpp"
|
||||
#include "armadillo_bits/newarp_DenseGenMatProd_meat.hpp"
|
||||
#include "armadillo_bits/newarp_SparseGenMatProd_meat.hpp"
|
||||
#include "armadillo_bits/newarp_SparseGenRealShiftSolve_meat.hpp"
|
||||
#include "armadillo_bits/newarp_DoubleShiftQR_meat.hpp"
|
||||
#include "armadillo_bits/newarp_GenEigsSolver_meat.hpp"
|
||||
#include "armadillo_bits/newarp_SymEigsSolver_meat.hpp"
|
||||
#include "armadillo_bits/newarp_SymEigsShiftSolver_meat.hpp"
|
||||
#include "armadillo_bits/newarp_TridiagEigen_meat.hpp"
|
||||
#include "armadillo_bits/newarp_UpperHessenbergEigen_meat.hpp"
|
||||
#include "armadillo_bits/newarp_UpperHessenbergQR_meat.hpp"
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
// Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
//
|
||||
@@ -22,14 +24,14 @@
|
||||
template<typename elem_type, typename derived>
|
||||
struct BaseCube_eval_Cube
|
||||
{
|
||||
arma_inline const derived& eval() const;
|
||||
arma_inline arma_warn_unused const derived& eval() const;
|
||||
};
|
||||
|
||||
|
||||
template<typename elem_type, typename derived>
|
||||
struct BaseCube_eval_expr
|
||||
{
|
||||
arma_inline Cube<elem_type> eval() const; //!< force the immediate evaluation of a delayed expression
|
||||
inline arma_warn_unused Cube<elem_type> eval() const; //!< force the immediate evaluation of a delayed expression
|
||||
};
|
||||
|
||||
|
||||
@@ -57,6 +59,9 @@ struct BaseCube
|
||||
arma_cold inline void raw_print( const std::string extra_text = "") const;
|
||||
arma_cold inline void raw_print(std::ostream& user_stream, const std::string extra_text = "") const;
|
||||
|
||||
arma_cold inline void brief_print( const std::string extra_text = "") const;
|
||||
arma_cold inline void brief_print(std::ostream& user_stream, const std::string extra_text = "") const;
|
||||
|
||||
inline arma_warn_unused elem_type min() const;
|
||||
inline arma_warn_unused elem_type max() const;
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
// Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
//
|
||||
@@ -35,9 +37,20 @@ inline
|
||||
void
|
||||
BaseCube<elem_type,derived>::print(const std::string extra_text) const
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
const unwrap_cube<derived> tmp( (*this).get_ref() );
|
||||
|
||||
tmp.M.impl_print(extra_text);
|
||||
if(extra_text.length() != 0)
|
||||
{
|
||||
const std::streamsize orig_width = get_cout_stream().width();
|
||||
|
||||
get_cout_stream() << extra_text << '\n';
|
||||
|
||||
get_cout_stream().width(orig_width);
|
||||
}
|
||||
|
||||
arma_ostream::print(get_cout_stream(), tmp.M, true);
|
||||
}
|
||||
|
||||
|
||||
@@ -48,9 +61,20 @@ inline
|
||||
void
|
||||
BaseCube<elem_type,derived>::print(std::ostream& user_stream, const std::string extra_text) const
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
const unwrap_cube<derived> tmp( (*this).get_ref() );
|
||||
|
||||
tmp.M.impl_print(user_stream, extra_text);
|
||||
if(extra_text.length() != 0)
|
||||
{
|
||||
const std::streamsize orig_width = user_stream.width();
|
||||
|
||||
user_stream << extra_text << '\n';
|
||||
|
||||
user_stream.width(orig_width);
|
||||
}
|
||||
|
||||
arma_ostream::print(user_stream, tmp.M, true);
|
||||
}
|
||||
|
||||
|
||||
@@ -61,9 +85,20 @@ inline
|
||||
void
|
||||
BaseCube<elem_type,derived>::raw_print(const std::string extra_text) const
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
const unwrap_cube<derived> tmp( (*this).get_ref() );
|
||||
|
||||
tmp.M.impl_raw_print(extra_text);
|
||||
if(extra_text.length() != 0)
|
||||
{
|
||||
const std::streamsize orig_width = get_cout_stream().width();
|
||||
|
||||
get_cout_stream() << extra_text << '\n';
|
||||
|
||||
get_cout_stream().width(orig_width);
|
||||
}
|
||||
|
||||
arma_ostream::print(get_cout_stream(), tmp.M, false);
|
||||
}
|
||||
|
||||
|
||||
@@ -74,9 +109,68 @@ inline
|
||||
void
|
||||
BaseCube<elem_type,derived>::raw_print(std::ostream& user_stream, const std::string extra_text) const
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
const unwrap_cube<derived> tmp( (*this).get_ref() );
|
||||
|
||||
tmp.M.impl_raw_print(user_stream, extra_text);
|
||||
if(extra_text.length() != 0)
|
||||
{
|
||||
const std::streamsize orig_width = user_stream.width();
|
||||
|
||||
user_stream << extra_text << '\n';
|
||||
|
||||
user_stream.width(orig_width);
|
||||
}
|
||||
|
||||
arma_ostream::print(user_stream, tmp.M, false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename elem_type, typename derived>
|
||||
arma_cold
|
||||
inline
|
||||
void
|
||||
BaseCube<elem_type,derived>::brief_print(const std::string extra_text) const
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
const unwrap_cube<derived> tmp( (*this).get_ref() );
|
||||
|
||||
if(extra_text.length() != 0)
|
||||
{
|
||||
const std::streamsize orig_width = get_cout_stream().width();
|
||||
|
||||
get_cout_stream() << extra_text << '\n';
|
||||
|
||||
get_cout_stream().width(orig_width);
|
||||
}
|
||||
|
||||
arma_ostream::brief_print(get_cout_stream(), tmp.M);
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename elem_type, typename derived>
|
||||
arma_cold
|
||||
inline
|
||||
void
|
||||
BaseCube<elem_type,derived>::brief_print(std::ostream& user_stream, const std::string extra_text) const
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
const unwrap_cube<derived> tmp( (*this).get_ref() );
|
||||
|
||||
if(extra_text.length() != 0)
|
||||
{
|
||||
const std::streamsize orig_width = user_stream.width();
|
||||
|
||||
user_stream << extra_text << '\n';
|
||||
|
||||
user_stream.width(orig_width);
|
||||
}
|
||||
|
||||
arma_ostream::brief_print(user_stream, tmp.M);
|
||||
}
|
||||
|
||||
|
||||
@@ -187,15 +281,15 @@ BaseCube<elem_type,derived>::is_zero(const typename get_pod_type<elem_type>::res
|
||||
const T val_real = access::tmp_real(val);
|
||||
const T val_imag = access::tmp_imag(val);
|
||||
|
||||
if(std::abs(val_real) > tol) { return false; }
|
||||
if(std::abs(val_imag) > tol) { return false; }
|
||||
if(eop_aux::arma_abs(val_real) > tol) { return false; }
|
||||
if(eop_aux::arma_abs(val_imag) > tol) { return false; }
|
||||
}
|
||||
}
|
||||
else // not complex
|
||||
{
|
||||
for(uword i=0; i < n_elem; ++i)
|
||||
{
|
||||
if(std::abs(Pea[i]) > tol) { return false; }
|
||||
if(eop_aux::arma_abs(Pea[i]) > tol) { return false; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -323,6 +417,7 @@ BaseCube<elem_type,derived>::has_nan() const
|
||||
|
||||
template<typename elem_type, typename derived>
|
||||
arma_inline
|
||||
arma_warn_unused
|
||||
const derived&
|
||||
BaseCube_eval_Cube<elem_type, derived>::eval() const
|
||||
{
|
||||
@@ -337,7 +432,8 @@ BaseCube_eval_Cube<elem_type, derived>::eval() const
|
||||
// extra functions defined in BaseCube_eval_expr
|
||||
|
||||
template<typename elem_type, typename derived>
|
||||
arma_inline
|
||||
inline
|
||||
arma_warn_unused
|
||||
Cube<elem_type>
|
||||
BaseCube_eval_expr<elem_type, derived>::eval() const
|
||||
{
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
// Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
//
|
||||
@@ -22,10 +24,7 @@
|
||||
template<typename elem_type, typename derived>
|
||||
struct Base_extra_yes
|
||||
{
|
||||
arma_inline const Op<derived,op_inv> i() const; //!< matrix inverse
|
||||
|
||||
arma_deprecated inline const Op<derived,op_inv> i(const bool ) const; //!< kept only for compatibility with old user code
|
||||
arma_deprecated inline const Op<derived,op_inv> i(const char*) const; //!< kept only for compatibility with old user code
|
||||
inline arma_warn_unused const Op<derived,op_inv> i() const; //!< matrix inverse
|
||||
|
||||
inline arma_warn_unused bool is_sympd() const;
|
||||
inline arma_warn_unused bool is_sympd(typename get_pod_type<elem_type>::result tol) const;
|
||||
@@ -52,14 +51,14 @@ struct Base_extra<elem_type, derived, false> { typedef Base_extra_no<elem_type,
|
||||
template<typename elem_type, typename derived>
|
||||
struct Base_eval_Mat
|
||||
{
|
||||
arma_inline const derived& eval() const;
|
||||
arma_inline arma_warn_unused const derived& eval() const;
|
||||
};
|
||||
|
||||
|
||||
template<typename elem_type, typename derived>
|
||||
struct Base_eval_expr
|
||||
{
|
||||
arma_inline Mat<elem_type> eval() const; //!< force the immediate evaluation of a delayed expression
|
||||
inline arma_warn_unused Mat<elem_type> eval() const; //!< force the immediate evaluation of a delayed expression
|
||||
};
|
||||
|
||||
|
||||
@@ -77,18 +76,18 @@ struct Base_eval<elem_type, derived, false> { typedef Base_eval_expr<elem_type,
|
||||
template<typename derived>
|
||||
struct Base_trans_cx
|
||||
{
|
||||
arma_inline const Op<derived,op_htrans> t() const;
|
||||
arma_inline const Op<derived,op_htrans> ht() const;
|
||||
arma_inline const Op<derived,op_strans> st() const; // simple transpose: no complex conjugates
|
||||
arma_inline arma_warn_unused const Op<derived,op_htrans> t() const;
|
||||
arma_inline arma_warn_unused const Op<derived,op_htrans> ht() const;
|
||||
arma_inline arma_warn_unused const Op<derived,op_strans> st() const; // simple transpose: no complex conjugates
|
||||
};
|
||||
|
||||
|
||||
template<typename derived>
|
||||
struct Base_trans_default
|
||||
{
|
||||
arma_inline const Op<derived,op_htrans> t() const;
|
||||
arma_inline const Op<derived,op_htrans> ht() const;
|
||||
arma_inline const Op<derived,op_htrans> st() const; // return op_htrans instead of op_strans, as it's handled better by matrix multiplication code
|
||||
arma_inline arma_warn_unused const Op<derived,op_htrans> t() const;
|
||||
arma_inline arma_warn_unused const Op<derived,op_htrans> ht() const;
|
||||
arma_inline arma_warn_unused const Op<derived,op_htrans> st() const; // return op_htrans instead of op_strans, as it's handled better by matrix multiplication code
|
||||
};
|
||||
|
||||
|
||||
@@ -105,7 +104,7 @@ struct Base_trans<derived, false> { typedef Base_trans_default<derived> result;
|
||||
|
||||
//! Class for static polymorphism, modelled after the "Curiously Recurring Template Pattern" (CRTP).
|
||||
//! Used for type-safe downcasting in functions that restrict their input(s) to be classes that are
|
||||
//! derived from Base (e.g. Mat, Op, Glue, diagview, subview).
|
||||
//! derived from Base (eg. Mat, Op, Glue, diagview, subview).
|
||||
//! A Base object can be converted to a Mat object by the unwrap class.
|
||||
|
||||
template<typename elem_type, typename derived>
|
||||
@@ -122,6 +121,9 @@ struct Base
|
||||
arma_cold inline void raw_print( const std::string extra_text = "") const;
|
||||
arma_cold inline void raw_print(std::ostream& user_stream, const std::string extra_text = "") const;
|
||||
|
||||
arma_cold inline void brief_print( const std::string extra_text = "") const;
|
||||
arma_cold inline void brief_print(std::ostream& user_stream, const std::string extra_text = "") const;
|
||||
|
||||
inline arma_warn_unused elem_type min() const;
|
||||
inline arma_warn_unused elem_type max() const;
|
||||
|
||||
@@ -154,8 +156,8 @@ struct Base
|
||||
inline arma_warn_unused bool has_inf() const;
|
||||
inline arma_warn_unused bool has_nan() const;
|
||||
|
||||
arma_inline const Op<derived,op_vectorise_col> as_col() const;
|
||||
arma_inline const Op<derived,op_vectorise_row> as_row() const;
|
||||
inline arma_warn_unused const Op<derived,op_vectorise_col> as_col() const;
|
||||
inline arma_warn_unused const Op<derived,op_vectorise_row> as_row() const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
// Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
//
|
||||
@@ -35,9 +37,20 @@ inline
|
||||
void
|
||||
Base<elem_type,derived>::print(const std::string extra_text) const
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
const quasi_unwrap<derived> tmp( (*this).get_ref() );
|
||||
|
||||
tmp.M.impl_print(extra_text);
|
||||
if(extra_text.length() != 0)
|
||||
{
|
||||
const std::streamsize orig_width = get_cout_stream().width();
|
||||
|
||||
get_cout_stream() << extra_text << '\n';
|
||||
|
||||
get_cout_stream().width(orig_width);
|
||||
}
|
||||
|
||||
arma_ostream::print(get_cout_stream(), tmp.M, true);
|
||||
}
|
||||
|
||||
|
||||
@@ -48,9 +61,20 @@ inline
|
||||
void
|
||||
Base<elem_type,derived>::print(std::ostream& user_stream, const std::string extra_text) const
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
const quasi_unwrap<derived> tmp( (*this).get_ref() );
|
||||
|
||||
tmp.M.impl_print(user_stream, extra_text);
|
||||
if(extra_text.length() != 0)
|
||||
{
|
||||
const std::streamsize orig_width = user_stream.width();
|
||||
|
||||
user_stream << extra_text << '\n';
|
||||
|
||||
user_stream.width(orig_width);
|
||||
}
|
||||
|
||||
arma_ostream::print(user_stream, tmp.M, true);
|
||||
}
|
||||
|
||||
|
||||
@@ -61,9 +85,20 @@ inline
|
||||
void
|
||||
Base<elem_type,derived>::raw_print(const std::string extra_text) const
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
const quasi_unwrap<derived> tmp( (*this).get_ref() );
|
||||
|
||||
tmp.M.impl_raw_print(extra_text);
|
||||
if(extra_text.length() != 0)
|
||||
{
|
||||
const std::streamsize orig_width = get_cout_stream().width();
|
||||
|
||||
get_cout_stream() << extra_text << '\n';
|
||||
|
||||
get_cout_stream().width(orig_width);
|
||||
}
|
||||
|
||||
arma_ostream::print(get_cout_stream(), tmp.M, false);
|
||||
}
|
||||
|
||||
|
||||
@@ -74,9 +109,68 @@ inline
|
||||
void
|
||||
Base<elem_type,derived>::raw_print(std::ostream& user_stream, const std::string extra_text) const
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
const quasi_unwrap<derived> tmp( (*this).get_ref() );
|
||||
|
||||
tmp.M.impl_raw_print(user_stream, extra_text);
|
||||
if(extra_text.length() != 0)
|
||||
{
|
||||
const std::streamsize orig_width = user_stream.width();
|
||||
|
||||
user_stream << extra_text << '\n';
|
||||
|
||||
user_stream.width(orig_width);
|
||||
}
|
||||
|
||||
arma_ostream::print(user_stream, tmp.M, false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename elem_type, typename derived>
|
||||
arma_cold
|
||||
inline
|
||||
void
|
||||
Base<elem_type,derived>::brief_print(const std::string extra_text) const
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
const quasi_unwrap<derived> tmp( (*this).get_ref() );
|
||||
|
||||
if(extra_text.length() != 0)
|
||||
{
|
||||
const std::streamsize orig_width = get_cout_stream().width();
|
||||
|
||||
get_cout_stream() << extra_text << '\n';
|
||||
|
||||
get_cout_stream().width(orig_width);
|
||||
}
|
||||
|
||||
arma_ostream::brief_print(get_cout_stream(), tmp.M);
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename elem_type, typename derived>
|
||||
arma_cold
|
||||
inline
|
||||
void
|
||||
Base<elem_type,derived>::brief_print(std::ostream& user_stream, const std::string extra_text) const
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
const quasi_unwrap<derived> tmp( (*this).get_ref() );
|
||||
|
||||
if(extra_text.length() != 0)
|
||||
{
|
||||
const std::streamsize orig_width = user_stream.width();
|
||||
|
||||
user_stream << extra_text << '\n';
|
||||
|
||||
user_stream.width(orig_width);
|
||||
}
|
||||
|
||||
arma_ostream::brief_print(user_stream, tmp.M);
|
||||
}
|
||||
|
||||
|
||||
@@ -411,15 +505,15 @@ Base<elem_type,derived>::is_zero(const typename get_pod_type<elem_type>::result
|
||||
const T val_real = access::tmp_real(val);
|
||||
const T val_imag = access::tmp_imag(val);
|
||||
|
||||
if(std::abs(val_real) > tol) { return false; }
|
||||
if(std::abs(val_imag) > tol) { return false; }
|
||||
if(eop_aux::arma_abs(val_real) > tol) { return false; }
|
||||
if(eop_aux::arma_abs(val_imag) > tol) { return false; }
|
||||
}
|
||||
}
|
||||
else // not complex
|
||||
{
|
||||
for(uword i=0; i<n_elem; ++i)
|
||||
{
|
||||
if(std::abs(Pea[i]) > tol) { return false; }
|
||||
if(eop_aux::arma_abs(Pea[i]) > tol) { return false; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -723,7 +817,8 @@ Base<elem_type,derived>::has_nan() const
|
||||
|
||||
|
||||
template<typename elem_type, typename derived>
|
||||
arma_inline
|
||||
inline
|
||||
arma_warn_unused
|
||||
const Op<derived,op_vectorise_col>
|
||||
Base<elem_type, derived>::as_col() const
|
||||
{
|
||||
@@ -733,7 +828,8 @@ Base<elem_type, derived>::as_col() const
|
||||
|
||||
|
||||
template<typename elem_type, typename derived>
|
||||
arma_inline
|
||||
inline
|
||||
arma_warn_unused
|
||||
const Op<derived,op_vectorise_row>
|
||||
Base<elem_type, derived>::as_row() const
|
||||
{
|
||||
@@ -746,7 +842,8 @@ Base<elem_type, derived>::as_row() const
|
||||
// extra functions defined in Base_extra_yes
|
||||
|
||||
template<typename elem_type, typename derived>
|
||||
arma_inline
|
||||
inline
|
||||
arma_warn_unused
|
||||
const Op<derived,op_inv>
|
||||
Base_extra_yes<elem_type, derived>::i() const
|
||||
{
|
||||
@@ -755,32 +852,6 @@ Base_extra_yes<elem_type, derived>::i() const
|
||||
|
||||
|
||||
|
||||
template<typename elem_type, typename derived>
|
||||
arma_deprecated
|
||||
inline
|
||||
const Op<derived,op_inv>
|
||||
Base_extra_yes<elem_type, derived>::i(const bool) const // argument kept only for compatibility with old user code
|
||||
{
|
||||
// arma_debug_warn(".i(bool) is deprecated and will be removed; change to .i()");
|
||||
|
||||
return Op<derived,op_inv>(static_cast<const derived&>(*this));
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename elem_type, typename derived>
|
||||
arma_deprecated
|
||||
inline
|
||||
const Op<derived,op_inv>
|
||||
Base_extra_yes<elem_type, derived>::i(const char*) const // argument kept only for compatibility with old user code
|
||||
{
|
||||
// arma_debug_warn(".i(char*) is deprecated and will be removed; change to .i()");
|
||||
|
||||
return Op<derived,op_inv>(static_cast<const derived&>(*this));
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename elem_type, typename derived>
|
||||
inline
|
||||
arma_warn_unused
|
||||
@@ -837,6 +908,7 @@ Base_extra_yes<elem_type,derived>::is_sympd(typename get_pod_type<elem_type>::re
|
||||
|
||||
template<typename elem_type, typename derived>
|
||||
arma_inline
|
||||
arma_warn_unused
|
||||
const derived&
|
||||
Base_eval_Mat<elem_type, derived>::eval() const
|
||||
{
|
||||
@@ -851,7 +923,8 @@ Base_eval_Mat<elem_type, derived>::eval() const
|
||||
// extra functions defined in Base_eval_expr
|
||||
|
||||
template<typename elem_type, typename derived>
|
||||
arma_inline
|
||||
inline
|
||||
arma_warn_unused
|
||||
Mat<elem_type>
|
||||
Base_eval_expr<elem_type, derived>::eval() const
|
||||
{
|
||||
@@ -867,6 +940,7 @@ Base_eval_expr<elem_type, derived>::eval() const
|
||||
|
||||
template<typename derived>
|
||||
arma_inline
|
||||
arma_warn_unused
|
||||
const Op<derived,op_htrans>
|
||||
Base_trans_cx<derived>::t() const
|
||||
{
|
||||
@@ -877,6 +951,7 @@ Base_trans_cx<derived>::t() const
|
||||
|
||||
template<typename derived>
|
||||
arma_inline
|
||||
arma_warn_unused
|
||||
const Op<derived,op_htrans>
|
||||
Base_trans_cx<derived>::ht() const
|
||||
{
|
||||
@@ -887,6 +962,7 @@ Base_trans_cx<derived>::ht() const
|
||||
|
||||
template<typename derived>
|
||||
arma_inline
|
||||
arma_warn_unused
|
||||
const Op<derived,op_strans>
|
||||
Base_trans_cx<derived>::st() const
|
||||
{
|
||||
@@ -900,6 +976,7 @@ Base_trans_cx<derived>::st() const
|
||||
|
||||
template<typename derived>
|
||||
arma_inline
|
||||
arma_warn_unused
|
||||
const Op<derived,op_htrans>
|
||||
Base_trans_default<derived>::t() const
|
||||
{
|
||||
@@ -910,6 +987,7 @@ Base_trans_default<derived>::t() const
|
||||
|
||||
template<typename derived>
|
||||
arma_inline
|
||||
arma_warn_unused
|
||||
const Op<derived,op_htrans>
|
||||
Base_trans_default<derived>::ht() const
|
||||
{
|
||||
@@ -920,6 +998,7 @@ Base_trans_default<derived>::ht() const
|
||||
|
||||
template<typename derived>
|
||||
arma_inline
|
||||
arma_warn_unused
|
||||
const Op<derived,op_htrans>
|
||||
Base_trans_default<derived>::st() const
|
||||
{
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
// Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
//
|
||||
@@ -27,20 +29,29 @@ class Col : public Mat<eT>
|
||||
typedef eT elem_type;
|
||||
typedef typename get_pod_type<eT>::result pod_type;
|
||||
|
||||
static const bool is_col = true;
|
||||
static const bool is_row = false;
|
||||
static const bool is_xvec = false;
|
||||
static constexpr bool is_col = true;
|
||||
static constexpr bool is_row = false;
|
||||
static constexpr bool is_xvec = false;
|
||||
|
||||
inline Col();
|
||||
inline Col(const Col<eT>& X);
|
||||
|
||||
inline Col();
|
||||
inline Col(const Col<eT>& X);
|
||||
inline explicit Col(const uword n_elem);
|
||||
inline explicit Col(const uword in_rows, const uword in_cols);
|
||||
inline explicit Col(const SizeMat& s);
|
||||
|
||||
template<bool do_zeros> inline explicit Col(const uword n_elem, const arma_initmode_indicator<do_zeros>&);
|
||||
template<bool do_zeros> inline explicit Col(const uword in_rows, const uword in_cols, const arma_initmode_indicator<do_zeros>&);
|
||||
template<bool do_zeros> inline explicit Col(const SizeMat& s, const arma_initmode_indicator<do_zeros>&);
|
||||
|
||||
template<typename fill_type> inline Col(const uword n_elem, const fill::fill_class<fill_type>& f);
|
||||
template<typename fill_type> inline Col(const uword in_rows, const uword in_cols, const fill::fill_class<fill_type>& f);
|
||||
template<typename fill_type> inline Col(const SizeMat& s, const fill::fill_class<fill_type>& f);
|
||||
|
||||
inline Col(const uword N, const fill::scalar_holder<eT> f);
|
||||
inline Col(const uword in_rows, const uword in_cols, const fill::scalar_holder<eT> f);
|
||||
inline Col(const SizeMat& s, const fill::scalar_holder<eT> f);
|
||||
|
||||
inline Col(const char* text);
|
||||
inline Col& operator=(const char* text);
|
||||
|
||||
@@ -50,13 +61,11 @@ class Col : public Mat<eT>
|
||||
inline Col(const std::vector<eT>& x);
|
||||
inline Col& operator=(const std::vector<eT>& x);
|
||||
|
||||
#if defined(ARMA_USE_CXX11)
|
||||
inline Col(const std::initializer_list<eT>& list);
|
||||
inline Col& operator=(const std::initializer_list<eT>& list);
|
||||
|
||||
inline Col(Col&& m);
|
||||
inline Col& operator=(Col&& m);
|
||||
#endif
|
||||
|
||||
inline Col& operator=(const eT val);
|
||||
inline Col& operator=(const Col& m);
|
||||
@@ -79,13 +88,13 @@ class Col : public Mat<eT>
|
||||
inline Col(const subview_cube<eT>& X);
|
||||
inline Col& operator=(const subview_cube<eT>& X);
|
||||
|
||||
inline mat_injector<Col> operator<<(const eT val);
|
||||
arma_deprecated inline mat_injector<Col> operator<<(const eT val);
|
||||
|
||||
arma_inline const Op<Col<eT>,op_htrans> t() const;
|
||||
arma_inline const Op<Col<eT>,op_htrans> ht() const;
|
||||
arma_inline const Op<Col<eT>,op_strans> st() const;
|
||||
arma_inline arma_warn_unused const Op<Col<eT>,op_htrans> t() const;
|
||||
arma_inline arma_warn_unused const Op<Col<eT>,op_htrans> ht() const;
|
||||
arma_inline arma_warn_unused const Op<Col<eT>,op_strans> st() const;
|
||||
|
||||
arma_inline const Op<Col<eT>,op_strans> as_row() const;
|
||||
arma_inline arma_warn_unused const Op<Col<eT>,op_strans> as_row() const;
|
||||
|
||||
arma_inline subview_col<eT> row(const uword row_num);
|
||||
arma_inline const subview_col<eT> row(const uword row_num) const;
|
||||
@@ -173,7 +182,7 @@ class Col<eT>::fixed : public Col<eT>
|
||||
{
|
||||
private:
|
||||
|
||||
static const bool use_extra = (fixed_n_elem > arma_config::mat_prealloc);
|
||||
static constexpr bool use_extra = (fixed_n_elem > arma_config::mat_prealloc);
|
||||
|
||||
arma_align_mem eT mem_local_extra[ (use_extra) ? fixed_n_elem : 1 ];
|
||||
|
||||
@@ -185,9 +194,9 @@ class Col<eT>::fixed : public Col<eT>
|
||||
typedef eT elem_type;
|
||||
typedef typename get_pod_type<eT>::result pod_type;
|
||||
|
||||
static const bool is_col = true;
|
||||
static const bool is_row = false;
|
||||
static const bool is_xvec = false;
|
||||
static constexpr bool is_col = true;
|
||||
static constexpr bool is_row = false;
|
||||
static constexpr bool is_xvec = false;
|
||||
|
||||
static const uword n_rows; // value provided below the class definition
|
||||
static const uword n_cols; // value provided below the class definition
|
||||
@@ -197,6 +206,7 @@ class Col<eT>::fixed : public Col<eT>
|
||||
arma_inline fixed(const fixed<fixed_n_elem>& X);
|
||||
inline fixed(const subview_cube<eT>& X);
|
||||
|
||||
inline fixed(const fill::scalar_holder<eT> f);
|
||||
template<typename fill_type> inline fixed(const fill::fill_class<fill_type>& f);
|
||||
template<typename T1> inline fixed(const Base<eT,T1>& A);
|
||||
template<typename T1, typename T2> inline fixed(const Base<pod_type,T1>& A, const Base<pod_type,T2>& B);
|
||||
@@ -215,10 +225,8 @@ class Col<eT>::fixed : public Col<eT>
|
||||
|
||||
using Col<eT>::operator();
|
||||
|
||||
#if defined(ARMA_USE_CXX11)
|
||||
inline fixed(const std::initializer_list<eT>& list);
|
||||
inline Col& operator=(const std::initializer_list<eT>& list);
|
||||
#endif
|
||||
inline fixed(const std::initializer_list<eT>& list);
|
||||
inline Col& operator=(const std::initializer_list<eT>& list);
|
||||
|
||||
arma_inline Col& operator=(const fixed<fixed_n_elem>& X);
|
||||
|
||||
@@ -227,9 +235,9 @@ class Col<eT>::fixed : public Col<eT>
|
||||
template<typename T1, typename T2, typename eglue_type> inline Col& operator=(const eGlue<T1, T2, eglue_type>& X);
|
||||
#endif
|
||||
|
||||
arma_inline const Op< Col_fixed_type, op_htrans > t() const;
|
||||
arma_inline const Op< Col_fixed_type, op_htrans > ht() const;
|
||||
arma_inline const Op< Col_fixed_type, op_strans > st() const;
|
||||
arma_inline arma_warn_unused const Op< Col_fixed_type, op_htrans > t() const;
|
||||
arma_inline arma_warn_unused const Op< Col_fixed_type, op_htrans > ht() const;
|
||||
arma_inline arma_warn_unused const Op< Col_fixed_type, op_strans > st() const;
|
||||
|
||||
arma_inline arma_warn_unused const eT& at_alt (const uword i) const;
|
||||
|
||||
|
||||
+291
-145
@@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
// Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
//
|
||||
@@ -48,6 +50,13 @@ Col<eT>::Col(const uword in_n_elem)
|
||||
: Mat<eT>(arma_vec_indicator(), in_n_elem, 1, 1)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
#if (!defined(ARMA_DONT_ZERO_INIT))
|
||||
{
|
||||
arma_extra_debug_print("Col::constructor: zeroing memory");
|
||||
arrayops::fill_zeros(Mat<eT>::memptr(), Mat<eT>::n_elem);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -60,6 +69,13 @@ Col<eT>::Col(const uword in_n_rows, const uword in_n_cols)
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
Mat<eT>::init_warm(in_n_rows, in_n_cols);
|
||||
|
||||
#if (!defined(ARMA_DONT_ZERO_INIT))
|
||||
{
|
||||
arma_extra_debug_print("Col::constructor: zeroing memory");
|
||||
arrayops::fill_zeros(Mat<eT>::memptr(), Mat<eT>::n_elem);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -72,6 +88,71 @@ Col<eT>::Col(const SizeMat& s)
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
Mat<eT>::init_warm(s.n_rows, s.n_cols);
|
||||
|
||||
#if (!defined(ARMA_DONT_ZERO_INIT))
|
||||
{
|
||||
arma_extra_debug_print("Col::constructor: zeroing memory");
|
||||
arrayops::fill_zeros(Mat<eT>::memptr(), Mat<eT>::n_elem);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
//! internal use only
|
||||
template<typename eT>
|
||||
template<bool do_zeros>
|
||||
inline
|
||||
Col<eT>::Col(const uword in_n_elem, const arma_initmode_indicator<do_zeros>&)
|
||||
: Mat<eT>(arma_vec_indicator(), in_n_elem, 1, 1)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
if(do_zeros)
|
||||
{
|
||||
arma_extra_debug_print("Col::constructor: zeroing memory");
|
||||
arrayops::fill_zeros(Mat<eT>::memptr(), Mat<eT>::n_elem);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//! internal use only
|
||||
template<typename eT>
|
||||
template<bool do_zeros>
|
||||
inline
|
||||
Col<eT>::Col(const uword in_n_rows, const uword in_n_cols, const arma_initmode_indicator<do_zeros>&)
|
||||
: Mat<eT>(arma_vec_indicator(), 0, 0, 1)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
Mat<eT>::init_warm(in_n_rows, in_n_cols);
|
||||
|
||||
if(do_zeros)
|
||||
{
|
||||
arma_extra_debug_print("Col::constructor: zeroing memory");
|
||||
arrayops::fill_zeros(Mat<eT>::memptr(), Mat<eT>::n_elem);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//! internal use only
|
||||
template<typename eT>
|
||||
template<bool do_zeros>
|
||||
inline
|
||||
Col<eT>::Col(const SizeMat& s, const arma_initmode_indicator<do_zeros>&)
|
||||
: Mat<eT>(arma_vec_indicator(), 0, 0, 1)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
Mat<eT>::init_warm(s.n_rows, s.n_cols);
|
||||
|
||||
if(do_zeros)
|
||||
{
|
||||
arma_extra_debug_print("Col::constructor: zeroing memory");
|
||||
arrayops::fill_zeros(Mat<eT>::memptr(), Mat<eT>::n_elem);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -119,6 +200,46 @@ Col<eT>::Col(const SizeMat& s, const fill::fill_class<fill_type>& f)
|
||||
|
||||
|
||||
|
||||
template<typename eT>
|
||||
inline
|
||||
Col<eT>::Col(const uword in_n_elem, const fill::scalar_holder<eT> f)
|
||||
: Mat<eT>(arma_vec_indicator(), in_n_elem, 1, 1)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
(*this).fill(f.scalar);
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename eT>
|
||||
inline
|
||||
Col<eT>::Col(const uword in_n_rows, const uword in_n_cols, const fill::scalar_holder<eT> f)
|
||||
: Mat<eT>(arma_vec_indicator(), 0, 0, 1)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
Mat<eT>::init_warm(in_n_rows, in_n_cols);
|
||||
|
||||
(*this).fill(f.scalar);
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename eT>
|
||||
inline
|
||||
Col<eT>::Col(const SizeMat& s, const fill::scalar_holder<eT> f)
|
||||
: Mat<eT>(arma_vec_indicator(), 0, 0, 1)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
Mat<eT>::init_warm(s.n_rows, s.n_cols);
|
||||
|
||||
(*this).fill(f.scalar);
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename eT>
|
||||
inline
|
||||
Col<eT>::Col(const char* text)
|
||||
@@ -221,102 +342,100 @@ Col<eT>::operator=(const std::vector<eT>& x)
|
||||
|
||||
|
||||
|
||||
#if defined(ARMA_USE_CXX11)
|
||||
template<typename eT>
|
||||
inline
|
||||
Col<eT>::Col(const std::initializer_list<eT>& list)
|
||||
: Mat<eT>(arma_vec_indicator(), 1)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
template<typename eT>
|
||||
inline
|
||||
Col<eT>::Col(const std::initializer_list<eT>& list)
|
||||
: Mat<eT>(arma_vec_indicator(), 1)
|
||||
(*this).operator=(list);
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename eT>
|
||||
inline
|
||||
Col<eT>&
|
||||
Col<eT>::operator=(const std::initializer_list<eT>& list)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
Mat<eT> tmp(list);
|
||||
|
||||
arma_debug_check( ((tmp.n_elem > 0) && (tmp.is_vec() == false)), "Mat::init(): requested size is not compatible with column vector layout" );
|
||||
|
||||
access::rw(tmp.n_rows) = tmp.n_elem;
|
||||
access::rw(tmp.n_cols) = 1;
|
||||
|
||||
(*this).steal_mem(tmp);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename eT>
|
||||
inline
|
||||
Col<eT>::Col(Col<eT>&& X)
|
||||
: Mat<eT>(arma_vec_indicator(), 1)
|
||||
{
|
||||
arma_extra_debug_sigprint(arma_str::format("this = %x X = %x") % this % &X);
|
||||
|
||||
access::rw(Mat<eT>::n_rows) = X.n_rows;
|
||||
access::rw(Mat<eT>::n_cols) = 1;
|
||||
access::rw(Mat<eT>::n_elem) = X.n_elem;
|
||||
access::rw(Mat<eT>::n_alloc) = X.n_alloc;
|
||||
|
||||
if( (X.n_alloc > arma_config::mat_prealloc) || (X.mem_state == 1) || (X.mem_state == 2) )
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
access::rw(Mat<eT>::mem_state) = X.mem_state;
|
||||
access::rw(Mat<eT>::mem) = X.mem;
|
||||
|
||||
(*this).operator=(list);
|
||||
access::rw(X.n_rows) = 0;
|
||||
access::rw(X.n_cols) = 1;
|
||||
access::rw(X.n_elem) = 0;
|
||||
access::rw(X.n_alloc) = 0;
|
||||
access::rw(X.mem_state) = 0;
|
||||
access::rw(X.mem) = nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename eT>
|
||||
inline
|
||||
Col<eT>&
|
||||
Col<eT>::operator=(const std::initializer_list<eT>& list)
|
||||
else // condition: (X.n_alloc <= arma_config::mat_prealloc) || (X.mem_state == 0) || (X.mem_state == 3)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
(*this).init_cold();
|
||||
|
||||
Mat<eT> tmp(list);
|
||||
arrayops::copy( (*this).memptr(), X.mem, X.n_elem );
|
||||
|
||||
arma_debug_check( ((tmp.n_elem > 0) && (tmp.is_vec() == false)), "Mat::init(): requested size is not compatible with column vector layout" );
|
||||
|
||||
access::rw(tmp.n_rows) = tmp.n_elem;
|
||||
access::rw(tmp.n_cols) = 1;
|
||||
|
||||
(*this).steal_mem(tmp);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename eT>
|
||||
inline
|
||||
Col<eT>::Col(Col<eT>&& X)
|
||||
: Mat<eT>(arma_vec_indicator(), 1)
|
||||
{
|
||||
arma_extra_debug_sigprint(arma_str::format("this = %x X = %x") % this % &X);
|
||||
|
||||
access::rw(Mat<eT>::n_rows) = X.n_rows;
|
||||
access::rw(Mat<eT>::n_cols) = 1;
|
||||
access::rw(Mat<eT>::n_elem) = X.n_elem;
|
||||
|
||||
if( ((X.mem_state == 0) && (X.n_elem > arma_config::mat_prealloc)) || (X.mem_state == 1) || (X.mem_state == 2) )
|
||||
if( (X.mem_state == 0) && (X.n_alloc <= arma_config::mat_prealloc) )
|
||||
{
|
||||
access::rw(Mat<eT>::mem_state) = X.mem_state;
|
||||
access::rw(Mat<eT>::mem) = X.mem;
|
||||
|
||||
access::rw(X.n_rows) = 0;
|
||||
access::rw(X.n_cols) = 1;
|
||||
access::rw(X.n_elem) = 0;
|
||||
access::rw(X.mem_state) = 0;
|
||||
access::rw(X.mem) = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
(*this).init_cold();
|
||||
|
||||
arrayops::copy( (*this).memptr(), X.mem, X.n_elem );
|
||||
|
||||
if( (X.mem_state == 0) && (X.n_elem <= arma_config::mat_prealloc) )
|
||||
{
|
||||
access::rw(X.n_rows) = 0;
|
||||
access::rw(X.n_cols) = 1;
|
||||
access::rw(X.n_elem) = 0;
|
||||
access::rw(X.mem) = 0;
|
||||
}
|
||||
access::rw(X.n_rows) = 0;
|
||||
access::rw(X.n_cols) = 1;
|
||||
access::rw(X.n_elem) = 0;
|
||||
access::rw(X.mem) = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename eT>
|
||||
inline
|
||||
Col<eT>&
|
||||
Col<eT>::operator=(Col<eT>&& X)
|
||||
{
|
||||
arma_extra_debug_sigprint(arma_str::format("this = %x X = %x") % this % &X);
|
||||
|
||||
(*this).steal_mem(X);
|
||||
|
||||
|
||||
template<typename eT>
|
||||
inline
|
||||
Col<eT>&
|
||||
Col<eT>::operator=(Col<eT>&& X)
|
||||
if( (X.mem_state == 0) && (X.n_alloc <= arma_config::mat_prealloc) && (this != &X) )
|
||||
{
|
||||
arma_extra_debug_sigprint(arma_str::format("this = %x X = %x") % this % &X);
|
||||
|
||||
(*this).steal_mem(X);
|
||||
|
||||
if( (X.mem_state == 0) && (X.n_elem <= arma_config::mat_prealloc) && (this != &X) )
|
||||
{
|
||||
access::rw(X.n_rows) = 0;
|
||||
access::rw(X.n_cols) = 1;
|
||||
access::rw(X.n_elem) = 0;
|
||||
access::rw(X.mem) = 0;
|
||||
}
|
||||
|
||||
return *this;
|
||||
access::rw(X.n_rows) = 0;
|
||||
access::rw(X.n_cols) = 1;
|
||||
access::rw(X.n_elem) = 0;
|
||||
access::rw(X.mem) = nullptr;
|
||||
}
|
||||
|
||||
#endif
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -506,6 +625,7 @@ Col<eT>::operator=(const subview_cube<eT>& X)
|
||||
|
||||
template<typename eT>
|
||||
inline
|
||||
arma_deprecated
|
||||
mat_injector< Col<eT> >
|
||||
Col<eT>::operator<<(const eT val)
|
||||
{
|
||||
@@ -516,6 +636,7 @@ Col<eT>::operator<<(const eT val)
|
||||
|
||||
template<typename eT>
|
||||
arma_inline
|
||||
arma_warn_unused
|
||||
const Op<Col<eT>,op_htrans>
|
||||
Col<eT>::t() const
|
||||
{
|
||||
@@ -526,6 +647,7 @@ Col<eT>::t() const
|
||||
|
||||
template<typename eT>
|
||||
arma_inline
|
||||
arma_warn_unused
|
||||
const Op<Col<eT>,op_htrans>
|
||||
Col<eT>::ht() const
|
||||
{
|
||||
@@ -536,6 +658,7 @@ Col<eT>::ht() const
|
||||
|
||||
template<typename eT>
|
||||
arma_inline
|
||||
arma_warn_unused
|
||||
const Op<Col<eT>,op_strans>
|
||||
Col<eT>::st() const
|
||||
{
|
||||
@@ -546,6 +669,7 @@ Col<eT>::st() const
|
||||
|
||||
template<typename eT>
|
||||
arma_inline
|
||||
arma_warn_unused
|
||||
const Op<Col<eT>,op_strans>
|
||||
Col<eT>::as_row() const
|
||||
{
|
||||
@@ -561,7 +685,7 @@ Col<eT>::row(const uword in_row1)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
arma_debug_check( (in_row1 >= Mat<eT>::n_rows), "Col::row(): indices out of bounds or incorrectly used");
|
||||
arma_debug_check_bounds( (in_row1 >= Mat<eT>::n_rows), "Col::row(): indices out of bounds or incorrectly used" );
|
||||
|
||||
return subview_col<eT>(*this, 0, in_row1, 1);
|
||||
}
|
||||
@@ -575,7 +699,7 @@ Col<eT>::row(const uword in_row1) const
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
arma_debug_check( (in_row1 >= Mat<eT>::n_rows), "Col::row(): indices out of bounds or incorrectly used");
|
||||
arma_debug_check_bounds( (in_row1 >= Mat<eT>::n_rows), "Col::row(): indices out of bounds or incorrectly used" );
|
||||
|
||||
return subview_col<eT>(*this, 0, in_row1, 1);
|
||||
}
|
||||
@@ -589,7 +713,7 @@ Col<eT>::rows(const uword in_row1, const uword in_row2)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
arma_debug_check( ( (in_row1 > in_row2) || (in_row2 >= Mat<eT>::n_rows) ), "Col::rows(): indices out of bounds or incorrectly used");
|
||||
arma_debug_check_bounds( ( (in_row1 > in_row2) || (in_row2 >= Mat<eT>::n_rows) ), "Col::rows(): indices out of bounds or incorrectly used" );
|
||||
|
||||
const uword subview_n_rows = in_row2 - in_row1 + 1;
|
||||
|
||||
@@ -605,7 +729,7 @@ Col<eT>::rows(const uword in_row1, const uword in_row2) const
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
arma_debug_check( ( (in_row1 > in_row2) || (in_row2 >= Mat<eT>::n_rows) ), "Col::rows(): indices out of bounds or incorrectly used");
|
||||
arma_debug_check_bounds( ( (in_row1 > in_row2) || (in_row2 >= Mat<eT>::n_rows) ), "Col::rows(): indices out of bounds or incorrectly used" );
|
||||
|
||||
const uword subview_n_rows = in_row2 - in_row1 + 1;
|
||||
|
||||
@@ -621,7 +745,7 @@ Col<eT>::subvec(const uword in_row1, const uword in_row2)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
arma_debug_check( ( (in_row1 > in_row2) || (in_row2 >= Mat<eT>::n_rows) ), "Col::subvec(): indices out of bounds or incorrectly used");
|
||||
arma_debug_check_bounds( ( (in_row1 > in_row2) || (in_row2 >= Mat<eT>::n_rows) ), "Col::subvec(): indices out of bounds or incorrectly used" );
|
||||
|
||||
const uword subview_n_rows = in_row2 - in_row1 + 1;
|
||||
|
||||
@@ -637,7 +761,7 @@ Col<eT>::subvec(const uword in_row1, const uword in_row2) const
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
arma_debug_check( ( (in_row1 > in_row2) || (in_row2 >= Mat<eT>::n_rows) ), "Col::subvec(): indices out of bounds or incorrectly used");
|
||||
arma_debug_check_bounds( ( (in_row1 > in_row2) || (in_row2 >= Mat<eT>::n_rows) ), "Col::subvec(): indices out of bounds or incorrectly used" );
|
||||
|
||||
const uword subview_n_rows = in_row2 - in_row1 + 1;
|
||||
|
||||
@@ -685,7 +809,7 @@ Col<eT>::subvec(const span& row_span)
|
||||
const uword in_row2 = row_span.b;
|
||||
const uword subvec_n_rows = row_all ? local_n_rows : in_row2 - in_row1 + 1;
|
||||
|
||||
arma_debug_check( ( row_all ? false : ((in_row1 > in_row2) || (in_row2 >= local_n_rows)) ), "Col::subvec(): indices out of bounds or incorrectly used");
|
||||
arma_debug_check_bounds( ( row_all ? false : ((in_row1 > in_row2) || (in_row2 >= local_n_rows)) ), "Col::subvec(): indices out of bounds or incorrectly used" );
|
||||
|
||||
return subview_col<eT>(*this, 0, in_row1, subvec_n_rows);
|
||||
}
|
||||
@@ -707,7 +831,7 @@ Col<eT>::subvec(const span& row_span) const
|
||||
const uword in_row2 = row_span.b;
|
||||
const uword subvec_n_rows = row_all ? local_n_rows : in_row2 - in_row1 + 1;
|
||||
|
||||
arma_debug_check( ( row_all ? false : ((in_row1 > in_row2) || (in_row2 >= local_n_rows)) ), "Col::subvec(): indices out of bounds or incorrectly used");
|
||||
arma_debug_check_bounds( ( row_all ? false : ((in_row1 > in_row2) || (in_row2 >= local_n_rows)) ), "Col::subvec(): indices out of bounds or incorrectly used" );
|
||||
|
||||
return subview_col<eT>(*this, 0, in_row1, subvec_n_rows);
|
||||
}
|
||||
@@ -747,7 +871,7 @@ Col<eT>::subvec(const uword start_row, const SizeMat& s)
|
||||
|
||||
arma_debug_check( (s.n_cols != 1), "Col::subvec(): given size does not specify a column vector" );
|
||||
|
||||
arma_debug_check( ( (start_row >= Mat<eT>::n_rows) || ((start_row + s.n_rows) > Mat<eT>::n_rows) ), "Col::subvec(): size out of bounds" );
|
||||
arma_debug_check_bounds( ( (start_row >= Mat<eT>::n_rows) || ((start_row + s.n_rows) > Mat<eT>::n_rows) ), "Col::subvec(): size out of bounds" );
|
||||
|
||||
return subview_col<eT>(*this, 0, start_row, s.n_rows);
|
||||
}
|
||||
@@ -763,7 +887,7 @@ Col<eT>::subvec(const uword start_row, const SizeMat& s) const
|
||||
|
||||
arma_debug_check( (s.n_cols != 1), "Col::subvec(): given size does not specify a column vector" );
|
||||
|
||||
arma_debug_check( ( (start_row >= Mat<eT>::n_rows) || ((start_row + s.n_rows) > Mat<eT>::n_rows) ), "Col::subvec(): size out of bounds" );
|
||||
arma_debug_check_bounds( ( (start_row >= Mat<eT>::n_rows) || ((start_row + s.n_rows) > Mat<eT>::n_rows) ), "Col::subvec(): size out of bounds" );
|
||||
|
||||
return subview_col<eT>(*this, 0, start_row, s.n_rows);
|
||||
}
|
||||
@@ -777,7 +901,7 @@ Col<eT>::head(const uword N)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
arma_debug_check( (N > Mat<eT>::n_rows), "Col::head(): size out of bounds");
|
||||
arma_debug_check_bounds( (N > Mat<eT>::n_rows), "Col::head(): size out of bounds" );
|
||||
|
||||
return subview_col<eT>(*this, 0, 0, N);
|
||||
}
|
||||
@@ -791,7 +915,7 @@ Col<eT>::head(const uword N) const
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
arma_debug_check( (N > Mat<eT>::n_rows), "Col::head(): size out of bounds");
|
||||
arma_debug_check_bounds( (N > Mat<eT>::n_rows), "Col::head(): size out of bounds" );
|
||||
|
||||
return subview_col<eT>(*this, 0, 0, N);
|
||||
}
|
||||
@@ -805,7 +929,7 @@ Col<eT>::tail(const uword N)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
arma_debug_check( (N > Mat<eT>::n_rows), "Col::tail(): size out of bounds");
|
||||
arma_debug_check_bounds( (N > Mat<eT>::n_rows), "Col::tail(): size out of bounds" );
|
||||
|
||||
const uword start_row = Mat<eT>::n_rows - N;
|
||||
|
||||
@@ -821,7 +945,7 @@ Col<eT>::tail(const uword N) const
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
arma_debug_check( (N > Mat<eT>::n_rows), "Col::tail(): size out of bounds");
|
||||
arma_debug_check_bounds( (N > Mat<eT>::n_rows), "Col::tail(): size out of bounds" );
|
||||
|
||||
const uword start_row = Mat<eT>::n_rows - N;
|
||||
|
||||
@@ -886,7 +1010,7 @@ Col<eT>::shed_row(const uword row_num)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
arma_debug_check( row_num >= Mat<eT>::n_rows, "Col::shed_row(): index out of bounds");
|
||||
arma_debug_check_bounds( row_num >= Mat<eT>::n_rows, "Col::shed_row(): index out of bounds" );
|
||||
|
||||
shed_rows(row_num, row_num);
|
||||
}
|
||||
@@ -901,7 +1025,7 @@ Col<eT>::shed_rows(const uword in_row1, const uword in_row2)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
arma_debug_check
|
||||
arma_debug_check_bounds
|
||||
(
|
||||
(in_row1 > in_row2) || (in_row2 >= Mat<eT>::n_rows),
|
||||
"Col::shed_rows(): indices out of bounds or incorrectly used"
|
||||
@@ -910,7 +1034,7 @@ Col<eT>::shed_rows(const uword in_row1, const uword in_row2)
|
||||
const uword n_keep_front = in_row1;
|
||||
const uword n_keep_back = Mat<eT>::n_rows - (in_row2 + 1);
|
||||
|
||||
Col<eT> X(n_keep_front + n_keep_back);
|
||||
Col<eT> X(n_keep_front + n_keep_back, arma_nozeros_indicator());
|
||||
|
||||
eT* X_mem = X.memptr();
|
||||
const eT* t_mem = (*this).memptr();
|
||||
@@ -959,11 +1083,11 @@ Col<eT>::insert_rows(const uword row_num, const uword N, const bool set_to_zero)
|
||||
const uword B_n_rows = t_n_rows - row_num;
|
||||
|
||||
// insertion at row_num == n_rows is in effect an append operation
|
||||
arma_debug_check( (row_num > t_n_rows), "Col::insert_rows(): index out of bounds");
|
||||
arma_debug_check_bounds( (row_num > t_n_rows), "Col::insert_rows(): index out of bounds" );
|
||||
|
||||
if(N > 0)
|
||||
{
|
||||
Col<eT> out(t_n_rows + N);
|
||||
Col<eT> out(t_n_rows + N, arma_nozeros_indicator());
|
||||
|
||||
eT* out_mem = out.memptr();
|
||||
const eT* t_mem = (*this).memptr();
|
||||
@@ -1055,7 +1179,7 @@ Col<eT>::begin_row(const uword row_num)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
arma_debug_check( (row_num >= Mat<eT>::n_rows), "Col::begin_row(): index out of bounds");
|
||||
arma_debug_check_bounds( (row_num >= Mat<eT>::n_rows), "Col::begin_row(): index out of bounds" );
|
||||
|
||||
return Mat<eT>::memptr() + row_num;
|
||||
}
|
||||
@@ -1069,7 +1193,7 @@ Col<eT>::begin_row(const uword row_num) const
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
arma_debug_check( (row_num >= Mat<eT>::n_rows), "Col::begin_row(): index out of bounds");
|
||||
arma_debug_check_bounds( (row_num >= Mat<eT>::n_rows), "Col::begin_row(): index out of bounds" );
|
||||
|
||||
return Mat<eT>::memptr() + row_num;
|
||||
}
|
||||
@@ -1083,7 +1207,7 @@ Col<eT>::end_row(const uword row_num)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
arma_debug_check( (row_num >= Mat<eT>::n_rows), "Col::end_row(): index out of bounds");
|
||||
arma_debug_check_bounds( (row_num >= Mat<eT>::n_rows), "Col::end_row(): index out of bounds" );
|
||||
|
||||
return Mat<eT>::memptr() + row_num + 1;
|
||||
}
|
||||
@@ -1097,7 +1221,7 @@ Col<eT>::end_row(const uword row_num) const
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
arma_debug_check( (row_num >= Mat<eT>::n_rows), "Col::end_row(): index out of bounds");
|
||||
arma_debug_check_bounds( (row_num >= Mat<eT>::n_rows), "Col::end_row(): index out of bounds" );
|
||||
|
||||
return Mat<eT>::memptr() + row_num + 1;
|
||||
}
|
||||
@@ -1111,6 +1235,16 @@ Col<eT>::fixed<fixed_n_elem>::fixed()
|
||||
: Col<eT>( arma_fixed_indicator(), fixed_n_elem, ((use_extra) ? mem_local_extra : Mat<eT>::mem_local) )
|
||||
{
|
||||
arma_extra_debug_sigprint_this(this);
|
||||
|
||||
#if (!defined(ARMA_DONT_ZERO_INIT))
|
||||
{
|
||||
arma_extra_debug_print("Col::fixed::constructor: zeroing memory");
|
||||
|
||||
eT* mem_use = (use_extra) ? &(mem_local_extra[0]) : &(Mat<eT>::mem_local[0]);
|
||||
|
||||
arrayops::inplace_set_fixed<eT,fixed_n_elem>( mem_use, eT(0) );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -1144,6 +1278,19 @@ Col<eT>::fixed<fixed_n_elem>::fixed(const subview_cube<eT>& X)
|
||||
|
||||
|
||||
|
||||
template<typename eT>
|
||||
template<uword fixed_n_elem>
|
||||
inline
|
||||
Col<eT>::fixed<fixed_n_elem>::fixed(const fill::scalar_holder<eT> f)
|
||||
: Col<eT>( arma_fixed_indicator(), fixed_n_elem, ((use_extra) ? mem_local_extra : Mat<eT>::mem_local) )
|
||||
{
|
||||
arma_extra_debug_sigprint_this(this);
|
||||
|
||||
(*this).fill(f.scalar);
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename eT>
|
||||
template<uword fixed_n_elem>
|
||||
template<typename fill_type>
|
||||
@@ -1153,11 +1300,11 @@ Col<eT>::fixed<fixed_n_elem>::fixed(const fill::fill_class<fill_type>&)
|
||||
{
|
||||
arma_extra_debug_sigprint_this(this);
|
||||
|
||||
if(is_same_type<fill_type, fill::fill_zeros>::yes) (*this).zeros();
|
||||
if(is_same_type<fill_type, fill::fill_ones >::yes) (*this).ones();
|
||||
if(is_same_type<fill_type, fill::fill_eye >::yes) (*this).eye();
|
||||
if(is_same_type<fill_type, fill::fill_randu>::yes) (*this).randu();
|
||||
if(is_same_type<fill_type, fill::fill_randn>::yes) (*this).randn();
|
||||
if(is_same_type<fill_type, fill::fill_zeros>::yes) { (*this).zeros(); }
|
||||
if(is_same_type<fill_type, fill::fill_ones >::yes) { (*this).ones(); }
|
||||
if(is_same_type<fill_type, fill::fill_eye >::yes) { (*this).eye(); }
|
||||
if(is_same_type<fill_type, fill::fill_randu>::yes) { (*this).randu(); }
|
||||
if(is_same_type<fill_type, fill::fill_randn>::yes) { (*this).randn(); }
|
||||
}
|
||||
|
||||
|
||||
@@ -1302,43 +1449,39 @@ Col<eT>::fixed<fixed_n_elem>::operator=(const subview_cube<eT>& X)
|
||||
|
||||
|
||||
|
||||
#if defined(ARMA_USE_CXX11)
|
||||
template<typename eT>
|
||||
template<uword fixed_n_elem>
|
||||
inline
|
||||
Col<eT>::fixed<fixed_n_elem>::fixed(const std::initializer_list<eT>& list)
|
||||
: Col<eT>( arma_fixed_indicator(), fixed_n_elem, ((use_extra) ? mem_local_extra : Mat<eT>::mem_local) )
|
||||
{
|
||||
arma_extra_debug_sigprint_this(this);
|
||||
|
||||
template<typename eT>
|
||||
template<uword fixed_n_elem>
|
||||
inline
|
||||
Col<eT>::fixed<fixed_n_elem>::fixed(const std::initializer_list<eT>& list)
|
||||
: Col<eT>( arma_fixed_indicator(), fixed_n_elem, ((use_extra) ? mem_local_extra : Mat<eT>::mem_local) )
|
||||
{
|
||||
arma_extra_debug_sigprint_this(this);
|
||||
|
||||
(*this).operator=(list);
|
||||
}
|
||||
(*this).operator=(list);
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename eT>
|
||||
template<uword fixed_n_elem>
|
||||
inline
|
||||
Col<eT>&
|
||||
Col<eT>::fixed<fixed_n_elem>::operator=(const std::initializer_list<eT>& list)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
const uword N = uword(list.size());
|
||||
|
||||
arma_debug_check( (N > fixed_n_elem), "Col::fixed: initialiser list is too long" );
|
||||
|
||||
template<typename eT>
|
||||
template<uword fixed_n_elem>
|
||||
inline
|
||||
Col<eT>&
|
||||
Col<eT>::fixed<fixed_n_elem>::operator=(const std::initializer_list<eT>& list)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
const uword N = uword(list.size());
|
||||
|
||||
arma_debug_check( (N > fixed_n_elem), "Col::fixed: initialiser list is too long" );
|
||||
|
||||
eT* this_mem = (*this).memptr();
|
||||
|
||||
arrayops::copy( this_mem, list.begin(), N );
|
||||
|
||||
for(uword iq=N; iq < fixed_n_elem; ++iq) { this_mem[iq] = eT(0); }
|
||||
|
||||
return *this;
|
||||
}
|
||||
eT* this_mem = (*this).memptr();
|
||||
|
||||
#endif
|
||||
arrayops::copy( this_mem, list.begin(), N );
|
||||
|
||||
for(uword iq=N; iq < fixed_n_elem; ++iq) { this_mem[iq] = eT(0); }
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1442,6 +1585,7 @@ Col<eT>::fixed<fixed_n_elem>::operator=(const fixed<fixed_n_elem>& X)
|
||||
template<typename eT>
|
||||
template<uword fixed_n_elem>
|
||||
arma_inline
|
||||
arma_warn_unused
|
||||
const Op< typename Col<eT>::template fixed<fixed_n_elem>::Col_fixed_type, op_htrans >
|
||||
Col<eT>::fixed<fixed_n_elem>::t() const
|
||||
{
|
||||
@@ -1453,6 +1597,7 @@ Col<eT>::fixed<fixed_n_elem>::t() const
|
||||
template<typename eT>
|
||||
template<uword fixed_n_elem>
|
||||
arma_inline
|
||||
arma_warn_unused
|
||||
const Op< typename Col<eT>::template fixed<fixed_n_elem>::Col_fixed_type, op_htrans >
|
||||
Col<eT>::fixed<fixed_n_elem>::ht() const
|
||||
{
|
||||
@@ -1464,6 +1609,7 @@ Col<eT>::fixed<fixed_n_elem>::ht() const
|
||||
template<typename eT>
|
||||
template<uword fixed_n_elem>
|
||||
arma_inline
|
||||
arma_warn_unused
|
||||
const Op< typename Col<eT>::template fixed<fixed_n_elem>::Col_fixed_type, op_strans >
|
||||
Col<eT>::fixed<fixed_n_elem>::st() const
|
||||
{
|
||||
@@ -1549,7 +1695,7 @@ arma_warn_unused
|
||||
eT&
|
||||
Col<eT>::fixed<fixed_n_elem>::operator() (const uword ii)
|
||||
{
|
||||
arma_debug_check( (ii >= fixed_n_elem), "Col::operator(): index out of bounds");
|
||||
arma_debug_check_bounds( (ii >= fixed_n_elem), "Col::operator(): index out of bounds" );
|
||||
|
||||
return (use_extra) ? mem_local_extra[ii] : Mat<eT>::mem_local[ii];
|
||||
}
|
||||
@@ -1563,7 +1709,7 @@ arma_warn_unused
|
||||
const eT&
|
||||
Col<eT>::fixed<fixed_n_elem>::operator() (const uword ii) const
|
||||
{
|
||||
arma_debug_check( (ii >= fixed_n_elem), "Col::operator(): index out of bounds");
|
||||
arma_debug_check_bounds( (ii >= fixed_n_elem), "Col::operator(): index out of bounds" );
|
||||
|
||||
return (use_extra) ? mem_local_extra[ii] : Mat<eT>::mem_local[ii];
|
||||
}
|
||||
@@ -1601,7 +1747,7 @@ arma_warn_unused
|
||||
eT&
|
||||
Col<eT>::fixed<fixed_n_elem>::operator() (const uword in_row, const uword in_col)
|
||||
{
|
||||
arma_debug_check( ((in_row >= fixed_n_elem) || (in_col > 0)), "Col::operator(): index out of bounds" );
|
||||
arma_debug_check_bounds( ((in_row >= fixed_n_elem) || (in_col > 0)), "Col::operator(): index out of bounds" );
|
||||
|
||||
return (use_extra) ? mem_local_extra[in_row] : Mat<eT>::mem_local[in_row];
|
||||
}
|
||||
@@ -1615,7 +1761,7 @@ arma_warn_unused
|
||||
const eT&
|
||||
Col<eT>::fixed<fixed_n_elem>::operator() (const uword in_row, const uword in_col) const
|
||||
{
|
||||
arma_debug_check( ((in_row >= fixed_n_elem) || (in_col > 0)), "Col::operator(): index out of bounds" );
|
||||
arma_debug_check_bounds( ((in_row >= fixed_n_elem) || (in_col > 0)), "Col::operator(): index out of bounds" );
|
||||
|
||||
return (use_extra) ? mem_local_extra[in_row] : Mat<eT>::mem_local[in_row];
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
// Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
//
|
||||
@@ -20,7 +22,7 @@
|
||||
|
||||
|
||||
template<typename T1, typename op_type>
|
||||
class CubeToMatOp : public Base<typename T1::elem_type, CubeToMatOp<T1, op_type> >
|
||||
class CubeToMatOp : public Base< typename T1::elem_type, CubeToMatOp<T1, op_type> >
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -34,9 +36,9 @@ class CubeToMatOp : public Base<typename T1::elem_type, CubeToMatOp<T1, op_type>
|
||||
arma_aligned const T1& m; //!< the operand; must be derived from BaseCube
|
||||
arma_aligned elem_type aux; //!< auxiliary data, using the element type as used by T1
|
||||
|
||||
static const bool is_row = op_type::template traits<T1>::is_row;
|
||||
static const bool is_col = op_type::template traits<T1>::is_col;
|
||||
static const bool is_xvec = op_type::template traits<T1>::is_xvec;
|
||||
static constexpr bool is_row = op_type::template traits<T1>::is_row;
|
||||
static constexpr bool is_col = op_type::template traits<T1>::is_col;
|
||||
static constexpr bool is_xvec = op_type::template traits<T1>::is_xvec;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
// Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
//
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
// Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
//
|
||||
@@ -21,8 +23,8 @@
|
||||
|
||||
struct Cube_prealloc
|
||||
{
|
||||
static const uword mat_ptrs_size = 4;
|
||||
static const uword mem_n_elem = 64;
|
||||
static constexpr uword mat_ptrs_size = 4;
|
||||
static constexpr uword mem_n_elem = 64;
|
||||
};
|
||||
|
||||
|
||||
@@ -42,6 +44,7 @@ class Cube : public BaseCube< eT, Cube<eT> >
|
||||
const uword n_elem_slice; //!< number of elements in each slice (read-only)
|
||||
const uword n_slices; //!< number of slices in the cube (read-only)
|
||||
const uword n_elem; //!< number of elements in the cube (read-only)
|
||||
const uword n_alloc; //!< number of allocated elements (read-only); NOTE: n_alloc can be 0, even if n_elem > 0
|
||||
const uword mem_state;
|
||||
|
||||
// mem_state = 0: normal cube which manages its own memory
|
||||
@@ -65,28 +68,32 @@ class Cube : public BaseCube< eT, Cube<eT> >
|
||||
inline ~Cube();
|
||||
inline Cube();
|
||||
|
||||
inline explicit Cube(const uword in_rows, const uword in_cols, const uword in_slices);
|
||||
inline explicit Cube(const uword in_n_rows, const uword in_n_cols, const uword in_n_slices);
|
||||
inline explicit Cube(const SizeCube& s);
|
||||
|
||||
template<typename fill_type> inline Cube(const uword in_rows, const uword in_cols, const uword in_slices, const fill::fill_class<fill_type>& f);
|
||||
template<typename fill_type> inline Cube(const SizeCube& s, const fill::fill_class<fill_type>& f);
|
||||
template<bool do_zeros> inline explicit Cube(const uword in_n_rows, const uword in_n_cols, const uword in_n_slices, const arma_initmode_indicator<do_zeros>&);
|
||||
template<bool do_zeros> inline explicit Cube(const SizeCube& s, const arma_initmode_indicator<do_zeros>&);
|
||||
|
||||
template<typename fill_type> inline Cube(const uword in_n_rows, const uword in_n_cols, const uword in_n_slices, const fill::fill_class<fill_type>& f);
|
||||
template<typename fill_type> inline Cube(const SizeCube& s, const fill::fill_class<fill_type>& f);
|
||||
|
||||
inline Cube(const uword in_rows, const uword in_cols, const uword in_slices, const fill::scalar_holder<eT> f);
|
||||
inline Cube(const SizeCube& s, const fill::scalar_holder<eT> f);
|
||||
|
||||
#if defined(ARMA_USE_CXX11)
|
||||
inline Cube(Cube&& m);
|
||||
inline Cube& operator=(Cube&& m);
|
||||
#endif
|
||||
|
||||
inline Cube( eT* aux_mem, const uword aux_n_rows, const uword aux_n_cols, const uword aux_n_slices, const bool copy_aux_mem = true, const bool strict = false, const bool prealloc_mat = false);
|
||||
inline Cube(const eT* aux_mem, const uword aux_n_rows, const uword aux_n_cols, const uword aux_n_slices);
|
||||
|
||||
inline Cube& operator=(const eT val);
|
||||
inline Cube& operator= (const eT val);
|
||||
inline Cube& operator+=(const eT val);
|
||||
inline Cube& operator-=(const eT val);
|
||||
inline Cube& operator*=(const eT val);
|
||||
inline Cube& operator/=(const eT val);
|
||||
|
||||
inline Cube(const Cube& m);
|
||||
inline Cube& operator=(const Cube& m);
|
||||
inline Cube& operator= (const Cube& m);
|
||||
inline Cube& operator+=(const Cube& m);
|
||||
inline Cube& operator-=(const Cube& m);
|
||||
inline Cube& operator%=(const Cube& m);
|
||||
@@ -96,14 +103,14 @@ class Cube : public BaseCube< eT, Cube<eT> >
|
||||
inline explicit Cube(const BaseCube<pod_type,T1>& A, const BaseCube<pod_type,T2>& B);
|
||||
|
||||
inline Cube(const subview_cube<eT>& X);
|
||||
inline Cube& operator=(const subview_cube<eT>& X);
|
||||
inline Cube& operator= (const subview_cube<eT>& X);
|
||||
inline Cube& operator+=(const subview_cube<eT>& X);
|
||||
inline Cube& operator-=(const subview_cube<eT>& X);
|
||||
inline Cube& operator%=(const subview_cube<eT>& X);
|
||||
inline Cube& operator/=(const subview_cube<eT>& X);
|
||||
|
||||
template<typename T1> inline Cube(const subview_cube_slices<eT,T1>& X);
|
||||
template<typename T1> inline Cube& operator=(const subview_cube_slices<eT,T1>& X);
|
||||
template<typename T1> inline Cube& operator= (const subview_cube_slices<eT,T1>& X);
|
||||
template<typename T1> inline Cube& operator+=(const subview_cube_slices<eT,T1>& X);
|
||||
template<typename T1> inline Cube& operator-=(const subview_cube_slices<eT,T1>& X);
|
||||
template<typename T1> inline Cube& operator%=(const subview_cube_slices<eT,T1>& X);
|
||||
@@ -173,13 +180,11 @@ class Cube : public BaseCube< eT, Cube<eT> >
|
||||
template<typename T1> inline subview_cube_each2<eT, T1> each_slice(const Base<uword, T1>& indices);
|
||||
template<typename T1> inline const subview_cube_each2<eT, T1> each_slice(const Base<uword, T1>& indices) const;
|
||||
|
||||
#if defined(ARMA_USE_CXX11)
|
||||
inline const Cube& each_slice(const std::function< void( Mat<eT>&) >& F);
|
||||
inline const Cube& each_slice(const std::function< void(const Mat<eT>&) >& F) const;
|
||||
|
||||
inline const Cube& each_slice(const std::function< void( Mat<eT>&) >& F, const bool use_mp);
|
||||
inline const Cube& each_slice(const std::function< void(const Mat<eT>&) >& F, const bool use_mp) const;
|
||||
#endif
|
||||
|
||||
|
||||
template<typename T1> arma_inline subview_cube_slices<eT,T1> slices(const Base<uword,T1>& indices);
|
||||
@@ -206,49 +211,49 @@ class Cube : public BaseCube< eT, Cube<eT> >
|
||||
|
||||
|
||||
template<typename gen_type> inline Cube(const GenCube<eT, gen_type>& X);
|
||||
template<typename gen_type> inline Cube& operator=(const GenCube<eT, gen_type>& X);
|
||||
template<typename gen_type> inline Cube& operator= (const GenCube<eT, gen_type>& X);
|
||||
template<typename gen_type> inline Cube& operator+=(const GenCube<eT, gen_type>& X);
|
||||
template<typename gen_type> inline Cube& operator-=(const GenCube<eT, gen_type>& X);
|
||||
template<typename gen_type> inline Cube& operator%=(const GenCube<eT, gen_type>& X);
|
||||
template<typename gen_type> inline Cube& operator/=(const GenCube<eT, gen_type>& X);
|
||||
|
||||
template<typename T1, typename op_type> inline Cube(const OpCube<T1, op_type>& X);
|
||||
template<typename T1, typename op_type> inline Cube& operator=(const OpCube<T1, op_type>& X);
|
||||
template<typename T1, typename op_type> inline Cube& operator= (const OpCube<T1, op_type>& X);
|
||||
template<typename T1, typename op_type> inline Cube& operator+=(const OpCube<T1, op_type>& X);
|
||||
template<typename T1, typename op_type> inline Cube& operator-=(const OpCube<T1, op_type>& X);
|
||||
template<typename T1, typename op_type> inline Cube& operator%=(const OpCube<T1, op_type>& X);
|
||||
template<typename T1, typename op_type> inline Cube& operator/=(const OpCube<T1, op_type>& X);
|
||||
|
||||
template<typename T1, typename eop_type> inline Cube(const eOpCube<T1, eop_type>& X);
|
||||
template<typename T1, typename eop_type> inline Cube& operator=(const eOpCube<T1, eop_type>& X);
|
||||
template<typename T1, typename eop_type> inline Cube& operator= (const eOpCube<T1, eop_type>& X);
|
||||
template<typename T1, typename eop_type> inline Cube& operator+=(const eOpCube<T1, eop_type>& X);
|
||||
template<typename T1, typename eop_type> inline Cube& operator-=(const eOpCube<T1, eop_type>& X);
|
||||
template<typename T1, typename eop_type> inline Cube& operator%=(const eOpCube<T1, eop_type>& X);
|
||||
template<typename T1, typename eop_type> inline Cube& operator/=(const eOpCube<T1, eop_type>& X);
|
||||
|
||||
template<typename T1, typename op_type> inline Cube(const mtOpCube<eT, T1, op_type>& X);
|
||||
template<typename T1, typename op_type> inline Cube& operator=(const mtOpCube<eT, T1, op_type>& X);
|
||||
template<typename T1, typename op_type> inline Cube& operator= (const mtOpCube<eT, T1, op_type>& X);
|
||||
template<typename T1, typename op_type> inline Cube& operator+=(const mtOpCube<eT, T1, op_type>& X);
|
||||
template<typename T1, typename op_type> inline Cube& operator-=(const mtOpCube<eT, T1, op_type>& X);
|
||||
template<typename T1, typename op_type> inline Cube& operator%=(const mtOpCube<eT, T1, op_type>& X);
|
||||
template<typename T1, typename op_type> inline Cube& operator/=(const mtOpCube<eT, T1, op_type>& X);
|
||||
|
||||
template<typename T1, typename T2, typename glue_type> inline Cube(const GlueCube<T1, T2, glue_type>& X);
|
||||
template<typename T1, typename T2, typename glue_type> inline Cube& operator=(const GlueCube<T1, T2, glue_type>& X);
|
||||
template<typename T1, typename T2, typename glue_type> inline Cube& operator= (const GlueCube<T1, T2, glue_type>& X);
|
||||
template<typename T1, typename T2, typename glue_type> inline Cube& operator+=(const GlueCube<T1, T2, glue_type>& X);
|
||||
template<typename T1, typename T2, typename glue_type> inline Cube& operator-=(const GlueCube<T1, T2, glue_type>& X);
|
||||
template<typename T1, typename T2, typename glue_type> inline Cube& operator%=(const GlueCube<T1, T2, glue_type>& X);
|
||||
template<typename T1, typename T2, typename glue_type> inline Cube& operator/=(const GlueCube<T1, T2, glue_type>& X);
|
||||
|
||||
template<typename T1, typename T2, typename eglue_type> inline Cube(const eGlueCube<T1, T2, eglue_type>& X);
|
||||
template<typename T1, typename T2, typename eglue_type> inline Cube& operator=(const eGlueCube<T1, T2, eglue_type>& X);
|
||||
template<typename T1, typename T2, typename eglue_type> inline Cube& operator= (const eGlueCube<T1, T2, eglue_type>& X);
|
||||
template<typename T1, typename T2, typename eglue_type> inline Cube& operator+=(const eGlueCube<T1, T2, eglue_type>& X);
|
||||
template<typename T1, typename T2, typename eglue_type> inline Cube& operator-=(const eGlueCube<T1, T2, eglue_type>& X);
|
||||
template<typename T1, typename T2, typename eglue_type> inline Cube& operator%=(const eGlueCube<T1, T2, eglue_type>& X);
|
||||
template<typename T1, typename T2, typename eglue_type> inline Cube& operator/=(const eGlueCube<T1, T2, eglue_type>& X);
|
||||
|
||||
template<typename T1, typename T2, typename glue_type> inline Cube(const mtGlueCube<eT, T1, T2, glue_type>& X);
|
||||
template<typename T1, typename T2, typename glue_type> inline Cube& operator=(const mtGlueCube<eT, T1, T2, glue_type>& X);
|
||||
template<typename T1, typename T2, typename glue_type> inline Cube& operator= (const mtGlueCube<eT, T1, T2, glue_type>& X);
|
||||
template<typename T1, typename T2, typename glue_type> inline Cube& operator+=(const mtGlueCube<eT, T1, T2, glue_type>& X);
|
||||
template<typename T1, typename T2, typename glue_type> inline Cube& operator-=(const mtGlueCube<eT, T1, T2, glue_type>& X);
|
||||
template<typename T1, typename T2, typename glue_type> inline Cube& operator%=(const mtGlueCube<eT, T1, T2, glue_type>& X);
|
||||
@@ -301,23 +306,15 @@ class Cube : public BaseCube< eT, Cube<eT> >
|
||||
arma_inline arma_warn_unused eT* slice_colptr(const uword in_slice, const uword in_col);
|
||||
arma_inline arma_warn_unused const eT* slice_colptr(const uword in_slice, const uword in_col) const;
|
||||
|
||||
arma_cold inline void impl_print( const std::string& extra_text) const;
|
||||
arma_cold inline void impl_print(std::ostream& user_stream, const std::string& extra_text) const;
|
||||
|
||||
arma_cold inline void impl_raw_print( const std::string& extra_text) const;
|
||||
arma_cold inline void impl_raw_print(std::ostream& user_stream, const std::string& extra_text) const;
|
||||
|
||||
inline void set_size(const uword in_rows, const uword in_cols, const uword in_slices);
|
||||
inline void set_size(const uword new_n_rows, const uword new_n_cols, const uword new_n_slices);
|
||||
inline void set_size(const SizeCube& s);
|
||||
|
||||
inline void reshape(const uword in_rows, const uword in_cols, const uword in_slices);
|
||||
inline void reshape(const uword new_n_rows, const uword new_n_cols, const uword new_n_slices);
|
||||
inline void reshape(const SizeCube& s);
|
||||
|
||||
inline void resize(const uword in_rows, const uword in_cols, const uword in_slices);
|
||||
inline void resize(const uword new_n_rows, const uword new_n_cols, const uword new_n_slices);
|
||||
inline void resize(const SizeCube& s);
|
||||
|
||||
arma_deprecated inline void reshape(const uword in_rows, const uword in_cols, const uword in_slices, const uword dim); //!< NOTE: don't use this form: it will be removed
|
||||
|
||||
|
||||
template<typename eT2> inline void copy_size(const Cube<eT2>& m);
|
||||
|
||||
@@ -331,22 +328,24 @@ class Cube : public BaseCube< eT, Cube<eT> >
|
||||
|
||||
inline const Cube& clean(const pod_type threshold);
|
||||
|
||||
inline const Cube& clamp(const eT min_val, const eT max_val);
|
||||
|
||||
inline const Cube& fill(const eT val);
|
||||
|
||||
inline const Cube& zeros();
|
||||
inline const Cube& zeros(const uword in_rows, const uword in_cols, const uword in_slices);
|
||||
inline const Cube& zeros(const uword new_n_rows, const uword new_n_cols, const uword new_n_slices);
|
||||
inline const Cube& zeros(const SizeCube& s);
|
||||
|
||||
inline const Cube& ones();
|
||||
inline const Cube& ones(const uword in_rows, const uword in_cols, const uword in_slices);
|
||||
inline const Cube& ones(const uword new_n_rows, const uword new_n_cols, const uword new_n_slices);
|
||||
inline const Cube& ones(const SizeCube& s);
|
||||
|
||||
inline const Cube& randu();
|
||||
inline const Cube& randu(const uword in_rows, const uword in_cols, const uword in_slices);
|
||||
inline const Cube& randu(const uword new_n_rows, const uword new_n_cols, const uword new_n_slices);
|
||||
inline const Cube& randu(const SizeCube& s);
|
||||
|
||||
inline const Cube& randn();
|
||||
inline const Cube& randn(const uword in_rows, const uword in_cols, const uword in_slices);
|
||||
inline const Cube& randn(const uword new_n_rows, const uword new_n_cols, const uword new_n_slices);
|
||||
inline const Cube& randn(const SizeCube& s);
|
||||
|
||||
inline void reset();
|
||||
@@ -367,13 +366,13 @@ class Cube : public BaseCube< eT, Cube<eT> >
|
||||
inline eT max(uword& row_of_max_val, uword& col_of_max_val, uword& slice_of_max_val) const;
|
||||
|
||||
|
||||
inline arma_cold bool save(const std::string name, const file_type type = arma_binary, const bool print_status = true) const;
|
||||
inline arma_cold bool save(const hdf5_name& spec, const file_type type = hdf5_binary, const bool print_status = true) const;
|
||||
inline arma_cold bool save( std::ostream& os, const file_type type = arma_binary, const bool print_status = true) const;
|
||||
inline arma_cold bool save(const std::string name, const file_type type = arma_binary) const;
|
||||
inline arma_cold bool save(const hdf5_name& spec, const file_type type = hdf5_binary) const;
|
||||
inline arma_cold bool save( std::ostream& os, const file_type type = arma_binary) const;
|
||||
|
||||
inline arma_cold bool load(const std::string name, const file_type type = auto_detect, const bool print_status = true);
|
||||
inline arma_cold bool load(const hdf5_name& spec, const file_type type = hdf5_binary, const bool print_status = true);
|
||||
inline arma_cold bool load( std::istream& is, const file_type type = auto_detect, const bool print_status = true);
|
||||
inline arma_cold bool load(const std::string name, const file_type type = auto_detect);
|
||||
inline arma_cold bool load(const hdf5_name& spec, const file_type type = hdf5_binary);
|
||||
inline arma_cold bool load( std::istream& is, const file_type type = auto_detect);
|
||||
|
||||
inline arma_cold bool quiet_save(const std::string name, const file_type type = arma_binary) const;
|
||||
inline arma_cold bool quiet_save(const hdf5_name& spec, const file_type type = hdf5_binary) const;
|
||||
@@ -410,11 +409,11 @@ class Cube : public BaseCube< eT, Cube<eT> >
|
||||
inline bool empty() const;
|
||||
inline uword size() const;
|
||||
|
||||
inline eT& front();
|
||||
inline const eT& front() const;
|
||||
inline arma_warn_unused eT& front();
|
||||
inline arma_warn_unused const eT& front() const;
|
||||
|
||||
inline eT& back();
|
||||
inline const eT& back() const;
|
||||
inline arma_warn_unused eT& back();
|
||||
inline arma_warn_unused const eT& back() const;
|
||||
|
||||
inline void swap(Cube& B);
|
||||
|
||||
@@ -426,7 +425,7 @@ class Cube : public BaseCube< eT, Cube<eT> >
|
||||
protected:
|
||||
|
||||
inline void init_cold();
|
||||
inline void init_warm(const uword in_rows, const uword in_cols, const uword in_slices);
|
||||
inline void init_warm(const uword in_n_rows, const uword in_n_cols, const uword in_n_slices);
|
||||
|
||||
template<typename T1, typename T2>
|
||||
inline void init(const BaseCube<pod_type,T1>& A, const BaseCube<pod_type,T2>& B);
|
||||
@@ -455,10 +454,10 @@ class Cube<eT>::fixed : public Cube<eT>
|
||||
{
|
||||
private:
|
||||
|
||||
static const uword fixed_n_elem = fixed_n_rows * fixed_n_cols * fixed_n_slices;
|
||||
static const uword fixed_n_elem_slice = fixed_n_rows * fixed_n_cols;
|
||||
static constexpr uword fixed_n_elem = fixed_n_rows * fixed_n_cols * fixed_n_slices;
|
||||
static constexpr uword fixed_n_elem_slice = fixed_n_rows * fixed_n_cols;
|
||||
|
||||
static const bool use_extra = (fixed_n_elem > Cube_prealloc::mem_n_elem);
|
||||
static constexpr bool use_extra = (fixed_n_elem > Cube_prealloc::mem_n_elem);
|
||||
|
||||
arma_aligned Mat<eT>* mat_ptrs_local_extra[ (fixed_n_slices > Cube_prealloc::mat_ptrs_size) ? fixed_n_slices : 1 ];
|
||||
arma_align_mem eT mem_local_extra [ use_extra ? fixed_n_elem : 1 ];
|
||||
@@ -471,6 +470,7 @@ class Cube<eT>::fixed : public Cube<eT>
|
||||
inline fixed();
|
||||
inline fixed(const fixed<fixed_n_rows, fixed_n_cols, fixed_n_slices>& X);
|
||||
|
||||
inline fixed(const fill::scalar_holder<eT> f);
|
||||
template<typename fill_type> inline fixed(const fill::fill_class<fill_type>& f);
|
||||
template<typename T1> inline fixed(const BaseCube<eT,T1>& A);
|
||||
template<typename T1, typename T2> inline fixed(const BaseCube<pod_type,T1>& A, const BaseCube<pod_type,T2>& B);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
// Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
//
|
||||
@@ -21,7 +23,7 @@
|
||||
//! support class for generator functions (eg. zeros, randu, randn, ...)
|
||||
template<typename eT, typename gen_type>
|
||||
class GenCube
|
||||
: public BaseCube<eT, GenCube<eT, gen_type> >
|
||||
: public BaseCube< eT, GenCube<eT, gen_type> >
|
||||
, public GenSpecialiser<eT, is_same_type<gen_type, gen_zeros>::yes, is_same_type<gen_type, gen_ones>::yes, is_same_type<gen_type, gen_randu>::yes, is_same_type<gen_type, gen_randn>::yes>
|
||||
{
|
||||
public:
|
||||
@@ -29,8 +31,8 @@ class GenCube
|
||||
typedef eT elem_type;
|
||||
typedef typename get_pod_type<elem_type>::result pod_type;
|
||||
|
||||
static const bool use_at = false;
|
||||
static const bool is_simple = (is_same_type<gen_type, gen_ones>::value) || (is_same_type<gen_type, gen_zeros>::value);
|
||||
static constexpr bool use_at = false;
|
||||
static constexpr bool is_simple = (is_same_type<gen_type, gen_ones>::value) || (is_same_type<gen_type, gen_zeros>::value);
|
||||
|
||||
arma_aligned const uword n_rows;
|
||||
arma_aligned const uword n_cols;
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
// Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
//
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
// Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
//
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
// Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
//
|
||||
@@ -21,7 +23,7 @@
|
||||
//! support class for generator functions (eg. zeros, randu, randn, ...)
|
||||
template<typename T1, typename gen_type>
|
||||
class Gen
|
||||
: public Base<typename T1::elem_type, Gen<T1, gen_type> >
|
||||
: public Base< typename T1::elem_type, Gen<T1, gen_type> >
|
||||
, public GenSpecialiser<typename T1::elem_type, is_same_type<gen_type, gen_zeros>::yes, is_same_type<gen_type, gen_ones>::yes, is_same_type<gen_type, gen_randu>::yes, is_same_type<gen_type, gen_randn>::yes>
|
||||
{
|
||||
public:
|
||||
@@ -29,12 +31,12 @@ class Gen
|
||||
typedef typename T1::elem_type elem_type;
|
||||
typedef typename get_pod_type<elem_type>::result pod_type;
|
||||
|
||||
static const bool use_at = (is_same_type<gen_type, gen_eye>::value);
|
||||
static const bool is_simple = (is_same_type<gen_type, gen_ones>::value) || (is_same_type<gen_type, gen_zeros>::value);
|
||||
static constexpr bool use_at = (is_same_type<gen_type, gen_eye>::value);
|
||||
static constexpr bool is_simple = (is_same_type<gen_type, gen_ones>::value) || (is_same_type<gen_type, gen_zeros>::value);
|
||||
|
||||
static const bool is_row = T1::is_row;
|
||||
static const bool is_col = T1::is_col;
|
||||
static const bool is_xvec = T1::is_xvec;
|
||||
static constexpr bool is_row = T1::is_row;
|
||||
static constexpr bool is_col = T1::is_col;
|
||||
static constexpr bool is_xvec = T1::is_xvec;
|
||||
|
||||
arma_aligned const uword n_rows;
|
||||
arma_aligned const uword n_cols;
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
// Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
//
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
// Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
//
|
||||
@@ -21,19 +23,18 @@
|
||||
|
||||
//! analog of the Glue class, intended for Cube objects
|
||||
template<typename T1, typename T2, typename glue_type>
|
||||
class GlueCube : public BaseCube<typename T1::elem_type, GlueCube<T1, T2, glue_type> >
|
||||
class GlueCube : public BaseCube< typename T1::elem_type, GlueCube<T1, T2, glue_type> >
|
||||
{
|
||||
public:
|
||||
|
||||
typedef typename T1::elem_type elem_type;
|
||||
typedef typename get_pod_type<elem_type>::result pod_type;
|
||||
|
||||
arma_inline GlueCube(const BaseCube<typename T1::elem_type, T1>& in_A, const BaseCube<typename T1::elem_type, T2>& in_B);
|
||||
arma_inline ~GlueCube();
|
||||
|
||||
inline GlueCube(const BaseCube<typename T1::elem_type, T1>& in_A, const BaseCube<typename T1::elem_type, T2>& in_B);
|
||||
inline ~GlueCube();
|
||||
|
||||
const T1& A; //!< first operand; must be derived from BaseCube
|
||||
const T2& B; //!< second operand; must be derived from BaseCube
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
// Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
//
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
// Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
//
|
||||
@@ -26,33 +28,33 @@ struct Glue_traits {};
|
||||
template<typename T1, typename T2, typename glue_type>
|
||||
struct Glue_traits<T1, T2, glue_type, true>
|
||||
{
|
||||
static const bool is_row = glue_type::template traits<T1,T2>::is_row;
|
||||
static const bool is_col = glue_type::template traits<T1,T2>::is_col;
|
||||
static const bool is_xvec = glue_type::template traits<T1,T2>::is_xvec;
|
||||
static constexpr bool is_row = glue_type::template traits<T1,T2>::is_row;
|
||||
static constexpr bool is_col = glue_type::template traits<T1,T2>::is_col;
|
||||
static constexpr bool is_xvec = glue_type::template traits<T1,T2>::is_xvec;
|
||||
};
|
||||
|
||||
template<typename T1, typename T2, typename glue_type>
|
||||
struct Glue_traits<T1, T2, glue_type, false>
|
||||
{
|
||||
static const bool is_row = false;
|
||||
static const bool is_col = false;
|
||||
static const bool is_xvec = false;
|
||||
static constexpr bool is_row = false;
|
||||
static constexpr bool is_col = false;
|
||||
static constexpr bool is_xvec = false;
|
||||
};
|
||||
|
||||
|
||||
template<typename T1, typename T2, typename glue_type>
|
||||
class Glue
|
||||
: public Base<typename T1::elem_type, Glue<T1, T2, glue_type> >
|
||||
, public Glue_traits<T1, T2, glue_type, has_nested_glue_traits<glue_type>::value >
|
||||
: public Base< typename T1::elem_type, Glue<T1, T2, glue_type> >
|
||||
, public Glue_traits<T1, T2, glue_type, has_nested_glue_traits<glue_type>::value>
|
||||
{
|
||||
public:
|
||||
|
||||
typedef typename T1::elem_type elem_type;
|
||||
typedef typename get_pod_type<elem_type>::result pod_type;
|
||||
|
||||
arma_inline Glue(const T1& in_A, const T2& in_B);
|
||||
arma_inline Glue(const T1& in_A, const T2& in_B, const uword in_aux_uword);
|
||||
arma_inline ~Glue();
|
||||
inline Glue(const T1& in_A, const T2& in_B);
|
||||
inline Glue(const T1& in_A, const T2& in_B, const uword in_aux_uword);
|
||||
inline ~Glue();
|
||||
|
||||
const T1& A; //!< first operand; must be derived from Base
|
||||
const T2& B; //!< second operand; must be derived from Base
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
// Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
//
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
// Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
//
|
||||
@@ -28,9 +30,9 @@ class MapMat
|
||||
typedef eT elem_type; //!< the type of elements stored in the matrix
|
||||
typedef typename get_pod_type<eT>::result pod_type; //!< if eT is std::complex<T>, pod_type is T; otherwise pod_type is eT
|
||||
|
||||
static const bool is_row = false;
|
||||
static const bool is_col = false;
|
||||
static const bool is_xvec = false;
|
||||
static constexpr bool is_row = false;
|
||||
static constexpr bool is_col = false;
|
||||
static constexpr bool is_xvec = false;
|
||||
|
||||
const uword n_rows; //!< number of rows (read-only)
|
||||
const uword n_cols; //!< number of columns (read-only)
|
||||
@@ -58,10 +60,8 @@ class MapMat
|
||||
inline explicit MapMat(const SpMat<eT>& x);
|
||||
inline void operator=(const SpMat<eT>& x);
|
||||
|
||||
#if defined(ARMA_USE_CXX11)
|
||||
inline MapMat(MapMat<eT>&& x);
|
||||
inline void operator=(MapMat<eT>&& x);
|
||||
#endif
|
||||
|
||||
inline void reset();
|
||||
inline void set_size(const uword in_n_rows);
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
// Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
//
|
||||
@@ -28,7 +30,7 @@ MapMat<eT>::~MapMat()
|
||||
if(map_ptr) { (*map_ptr).clear(); delete map_ptr; }
|
||||
|
||||
// try to expose buggy user code that accesses deleted objects
|
||||
if(arma_config::debug) { map_ptr = NULL; }
|
||||
if(arma_config::debug) { map_ptr = nullptr; }
|
||||
|
||||
arma_type_check(( is_supported_elem_type<eT>::value == false ));
|
||||
}
|
||||
@@ -41,7 +43,7 @@ MapMat<eT>::MapMat()
|
||||
: n_rows (0)
|
||||
, n_cols (0)
|
||||
, n_elem (0)
|
||||
, map_ptr(NULL)
|
||||
, map_ptr(nullptr)
|
||||
{
|
||||
arma_extra_debug_sigprint_this(this);
|
||||
|
||||
@@ -56,7 +58,7 @@ MapMat<eT>::MapMat(const uword in_n_rows, const uword in_n_cols)
|
||||
: n_rows (in_n_rows)
|
||||
, n_cols (in_n_cols)
|
||||
, n_elem (in_n_rows * in_n_cols)
|
||||
, map_ptr(NULL)
|
||||
, map_ptr(nullptr)
|
||||
{
|
||||
arma_extra_debug_sigprint_this(this);
|
||||
|
||||
@@ -71,7 +73,7 @@ MapMat<eT>::MapMat(const SizeMat& s)
|
||||
: n_rows (s.n_rows)
|
||||
, n_cols (s.n_cols)
|
||||
, n_elem (s.n_rows * s.n_cols)
|
||||
, map_ptr(NULL)
|
||||
, map_ptr(nullptr)
|
||||
{
|
||||
arma_extra_debug_sigprint_this(this);
|
||||
|
||||
@@ -86,7 +88,7 @@ MapMat<eT>::MapMat(const MapMat<eT>& x)
|
||||
: n_rows (0)
|
||||
, n_cols (0)
|
||||
, n_elem (0)
|
||||
, map_ptr(NULL)
|
||||
, map_ptr(nullptr)
|
||||
{
|
||||
arma_extra_debug_sigprint_this(this);
|
||||
|
||||
@@ -121,7 +123,7 @@ MapMat<eT>::MapMat(const SpMat<eT>& x)
|
||||
: n_rows (0)
|
||||
, n_cols (0)
|
||||
, n_elem (0)
|
||||
, map_ptr(NULL)
|
||||
, map_ptr(nullptr)
|
||||
{
|
||||
arma_extra_debug_sigprint_this(this);
|
||||
|
||||
@@ -164,60 +166,52 @@ MapMat<eT>::operator=(const SpMat<eT>& x)
|
||||
|
||||
const uword index = (x_n_rows * col) + row;
|
||||
|
||||
#if defined(ARMA_USE_CXX11)
|
||||
map_ref.emplace_hint(map_ref.cend(), index, val);
|
||||
#else
|
||||
map_ref.operator[](index) = val;
|
||||
#endif
|
||||
map_ref.emplace_hint(map_ref.cend(), index, val);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#if defined(ARMA_USE_CXX11)
|
||||
template<typename eT>
|
||||
inline
|
||||
MapMat<eT>::MapMat(MapMat<eT>&& x)
|
||||
: n_rows (x.n_rows )
|
||||
, n_cols (x.n_cols )
|
||||
, n_elem (x.n_elem )
|
||||
, map_ptr(x.map_ptr)
|
||||
{
|
||||
arma_extra_debug_sigprint_this(this);
|
||||
|
||||
access::rw(x.n_rows) = 0;
|
||||
access::rw(x.n_cols) = 0;
|
||||
access::rw(x.n_elem) = 0;
|
||||
access::rw(x.map_ptr) = nullptr;
|
||||
}
|
||||
|
||||
template<typename eT>
|
||||
inline
|
||||
MapMat<eT>::MapMat(MapMat<eT>&& x)
|
||||
: n_rows (x.n_rows )
|
||||
, n_cols (x.n_cols )
|
||||
, n_elem (x.n_elem )
|
||||
, map_ptr(x.map_ptr)
|
||||
{
|
||||
arma_extra_debug_sigprint_this(this);
|
||||
|
||||
access::rw(x.n_rows) = 0;
|
||||
access::rw(x.n_cols) = 0;
|
||||
access::rw(x.n_elem) = 0;
|
||||
access::rw(x.map_ptr) = NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename eT>
|
||||
inline
|
||||
void
|
||||
MapMat<eT>::operator=(MapMat<eT>&& x)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
reset();
|
||||
|
||||
if(map_ptr) { delete map_ptr; }
|
||||
|
||||
access::rw(n_rows) = x.n_rows;
|
||||
access::rw(n_cols) = x.n_cols;
|
||||
access::rw(n_elem) = x.n_elem;
|
||||
access::rw(map_ptr) = x.map_ptr;
|
||||
|
||||
access::rw(x.n_rows) = 0;
|
||||
access::rw(x.n_cols) = 0;
|
||||
access::rw(x.n_elem) = 0;
|
||||
access::rw(x.map_ptr) = NULL;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
template<typename eT>
|
||||
inline
|
||||
void
|
||||
MapMat<eT>::operator=(MapMat<eT>&& x)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
reset();
|
||||
|
||||
if(map_ptr) { delete map_ptr; }
|
||||
|
||||
access::rw(n_rows) = x.n_rows;
|
||||
access::rw(n_cols) = x.n_cols;
|
||||
access::rw(n_elem) = x.n_elem;
|
||||
access::rw(map_ptr) = x.map_ptr;
|
||||
|
||||
access::rw(x.n_rows) = 0;
|
||||
access::rw(x.n_cols) = 0;
|
||||
access::rw(x.n_elem) = 0;
|
||||
access::rw(x.map_ptr) = nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -356,11 +350,7 @@ MapMat<eT>::eye(const uword in_n_rows, const uword in_n_cols)
|
||||
{
|
||||
const uword index = (in_n_rows * i) + i;
|
||||
|
||||
#if defined(ARMA_USE_CXX11)
|
||||
map_ref.emplace_hint(map_ref.cend(), index, eT(1));
|
||||
#else
|
||||
map_ref.operator[](index) = eT(1);
|
||||
#endif
|
||||
map_ref.emplace_hint(map_ref.cend(), index, eT(1));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -447,7 +437,7 @@ arma_warn_unused
|
||||
MapMat_val<eT>
|
||||
MapMat<eT>::operator()(const uword index)
|
||||
{
|
||||
arma_debug_check( (index >= n_elem), "MapMat::operator(): index out of bounds" );
|
||||
arma_debug_check_bounds( (index >= n_elem), "MapMat::operator(): index out of bounds" );
|
||||
|
||||
return MapMat_val<eT>(*this, index);
|
||||
}
|
||||
@@ -460,7 +450,7 @@ arma_warn_unused
|
||||
eT
|
||||
MapMat<eT>::operator()(const uword index) const
|
||||
{
|
||||
arma_debug_check( (index >= n_elem), "MapMat::operator(): index out of bounds" );
|
||||
arma_debug_check_bounds( (index >= n_elem), "MapMat::operator(): index out of bounds" );
|
||||
|
||||
map_type& map_ref = (*map_ptr);
|
||||
|
||||
@@ -509,7 +499,7 @@ arma_warn_unused
|
||||
MapMat_val<eT>
|
||||
MapMat<eT>::operator()(const uword in_row, const uword in_col)
|
||||
{
|
||||
arma_debug_check( ((in_row >= n_rows) || (in_col >= n_cols)), "MapMat::operator(): index out of bounds" );
|
||||
arma_debug_check_bounds( ((in_row >= n_rows) || (in_col >= n_cols)), "MapMat::operator(): index out of bounds" );
|
||||
|
||||
const uword index = (n_rows * in_col) + in_row;
|
||||
|
||||
@@ -524,7 +514,7 @@ arma_warn_unused
|
||||
eT
|
||||
MapMat<eT>::operator()(const uword in_row, const uword in_col) const
|
||||
{
|
||||
arma_debug_check( ((in_row >= n_rows) || (in_col >= n_cols)), "MapMat::operator(): index out of bounds" );
|
||||
arma_debug_check_bounds( ((in_row >= n_rows) || (in_col >= n_cols)), "MapMat::operator(): index out of bounds" );
|
||||
|
||||
const uword index = (n_rows * in_col) + in_row;
|
||||
|
||||
@@ -619,11 +609,7 @@ MapMat<eT>::sprandu(const uword in_n_rows, const uword in_n_cols, const double d
|
||||
const uword index = indx_mem[i];
|
||||
const eT val = vals_mem[i];
|
||||
|
||||
#if defined(ARMA_USE_CXX11)
|
||||
map_ref.emplace_hint(map_ref.cend(), index, val);
|
||||
#else
|
||||
map_ref.operator[](index) = val;
|
||||
#endif
|
||||
map_ref.emplace_hint(map_ref.cend(), index, val);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -747,7 +733,7 @@ MapMat<eT>::init_cold()
|
||||
#if defined(ARMA_64BIT_WORD)
|
||||
const char* error_message = "MapMat(): requested size is too large";
|
||||
#else
|
||||
const char* error_message = "MapMat(): requested size is too large; suggest to compile in C++11 mode and/or enable ARMA_64BIT_WORD";
|
||||
const char* error_message = "MapMat(): requested size is too large; suggest to enable ARMA_64BIT_WORD";
|
||||
#endif
|
||||
|
||||
arma_debug_check
|
||||
@@ -762,7 +748,7 @@ MapMat<eT>::init_cold()
|
||||
|
||||
map_ptr = new (std::nothrow) map_type;
|
||||
|
||||
arma_check_bad_alloc( (map_ptr == NULL), "MapMat(): out of memory" );
|
||||
arma_check_bad_alloc( (map_ptr == nullptr), "MapMat(): out of memory" );
|
||||
}
|
||||
|
||||
|
||||
@@ -781,7 +767,7 @@ MapMat<eT>::init_warm(const uword in_n_rows, const uword in_n_cols)
|
||||
#if defined(ARMA_64BIT_WORD)
|
||||
const char* error_message = "MapMat(): requested size is too large";
|
||||
#else
|
||||
const char* error_message = "MapMat(): requested size is too large; suggest to compile in C++11 mode and/or enable ARMA_64BIT_WORD";
|
||||
const char* error_message = "MapMat(): requested size is too large; suggest to enable ARMA_64BIT_WORD";
|
||||
#endif
|
||||
|
||||
arma_debug_check
|
||||
@@ -814,24 +800,16 @@ MapMat<eT>::set_val(const uword index, const eT& in_val)
|
||||
|
||||
if(in_val != eT(0))
|
||||
{
|
||||
#if defined(ARMA_USE_CXX11)
|
||||
map_type& map_ref = (*map_ptr);
|
||||
|
||||
if( (map_ref.empty() == false) && (index > uword(map_ref.crbegin()->first)) )
|
||||
{
|
||||
map_type& map_ref = (*map_ptr);
|
||||
|
||||
if( (map_ref.empty() == false) && (index > uword(map_ref.crbegin()->first)) )
|
||||
{
|
||||
map_ref.emplace_hint(map_ref.cend(), index, in_val);
|
||||
}
|
||||
else
|
||||
{
|
||||
map_ref.operator[](index) = in_val;
|
||||
}
|
||||
map_ref.emplace_hint(map_ref.cend(), index, in_val);
|
||||
}
|
||||
#else
|
||||
else
|
||||
{
|
||||
(*map_ptr).operator[](index) = in_val;
|
||||
map_ref.operator[](index) = in_val;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1204,7 +1182,7 @@ SpMat_MapMat_val<eT>::operator=(const eT in_val)
|
||||
(*this).set(in_val);
|
||||
}
|
||||
}
|
||||
#elif (defined(ARMA_USE_CXX11) && !defined(ARMA_DONT_USE_CXX11_MUTEX))
|
||||
#elif (!defined(ARMA_DONT_USE_STD_MUTEX))
|
||||
{
|
||||
s_parent.cache_mutex.lock();
|
||||
|
||||
@@ -1239,7 +1217,7 @@ SpMat_MapMat_val<eT>::operator+=(const eT in_val)
|
||||
(*this).add(in_val);
|
||||
}
|
||||
}
|
||||
#elif (defined(ARMA_USE_CXX11) && !defined(ARMA_DONT_USE_CXX11_MUTEX))
|
||||
#elif (!defined(ARMA_DONT_USE_STD_MUTEX))
|
||||
{
|
||||
s_parent.cache_mutex.lock();
|
||||
|
||||
@@ -1274,7 +1252,7 @@ SpMat_MapMat_val<eT>::operator-=(const eT in_val)
|
||||
(*this).sub(in_val);
|
||||
}
|
||||
}
|
||||
#elif (defined(ARMA_USE_CXX11) && !defined(ARMA_DONT_USE_CXX11_MUTEX))
|
||||
#elif (!defined(ARMA_DONT_USE_STD_MUTEX))
|
||||
{
|
||||
s_parent.cache_mutex.lock();
|
||||
|
||||
@@ -1307,7 +1285,7 @@ SpMat_MapMat_val<eT>::operator*=(const eT in_val)
|
||||
(*this).mul(in_val);
|
||||
}
|
||||
}
|
||||
#elif (defined(ARMA_USE_CXX11) && !defined(ARMA_DONT_USE_CXX11_MUTEX))
|
||||
#elif (!defined(ARMA_DONT_USE_STD_MUTEX))
|
||||
{
|
||||
s_parent.cache_mutex.lock();
|
||||
|
||||
@@ -1340,7 +1318,7 @@ SpMat_MapMat_val<eT>::operator/=(const eT in_val)
|
||||
(*this).div(in_val);
|
||||
}
|
||||
}
|
||||
#elif (defined(ARMA_USE_CXX11) && !defined(ARMA_DONT_USE_CXX11_MUTEX))
|
||||
#elif (!defined(ARMA_DONT_USE_STD_MUTEX))
|
||||
{
|
||||
s_parent.cache_mutex.lock();
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
// Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
//
|
||||
@@ -29,9 +31,10 @@ class Mat : public Base< eT, Mat<eT> >
|
||||
typedef eT elem_type; //!< the type of elements stored in the matrix
|
||||
typedef typename get_pod_type<eT>::result pod_type; //!< if eT is std::complex<T>, pod_type is T; otherwise pod_type is eT
|
||||
|
||||
const uword n_rows; //!< number of rows (read-only)
|
||||
const uword n_cols; //!< number of columns (read-only)
|
||||
const uword n_elem; //!< number of elements (read-only)
|
||||
const uword n_rows; //!< number of rows (read-only)
|
||||
const uword n_cols; //!< number of columns (read-only)
|
||||
const uword n_elem; //!< number of elements (read-only)
|
||||
const uword n_alloc; //!< number of allocated elements (read-only); NOTE: n_alloc can be 0, even if n_elem > 0
|
||||
const uhword vec_state; //!< 0: matrix layout; 1: column vector layout; 2: row vector layout
|
||||
const uhword mem_state;
|
||||
|
||||
@@ -50,18 +53,24 @@ class Mat : public Base< eT, Mat<eT> >
|
||||
|
||||
public:
|
||||
|
||||
static const bool is_col = false;
|
||||
static const bool is_row = false;
|
||||
static const bool is_xvec = false;
|
||||
static constexpr bool is_col = false;
|
||||
static constexpr bool is_row = false;
|
||||
static constexpr bool is_xvec = false;
|
||||
|
||||
inline ~Mat();
|
||||
inline Mat();
|
||||
|
||||
inline explicit Mat(const uword in_rows, const uword in_cols);
|
||||
inline explicit Mat(const uword in_n_rows, const uword in_n_cols);
|
||||
inline explicit Mat(const SizeMat& s);
|
||||
|
||||
template<typename fill_type> inline Mat(const uword in_rows, const uword in_cols, const fill::fill_class<fill_type>& f);
|
||||
template<typename fill_type> inline Mat(const SizeMat& s, const fill::fill_class<fill_type>& f);
|
||||
template<bool do_zeros> inline explicit Mat(const uword in_n_rows, const uword in_n_cols, const arma_initmode_indicator<do_zeros>&);
|
||||
template<bool do_zeros> inline explicit Mat(const SizeMat& s, const arma_initmode_indicator<do_zeros>&);
|
||||
|
||||
template<typename fill_type> inline Mat(const uword in_n_rows, const uword in_n_cols, const fill::fill_class<fill_type>& f);
|
||||
template<typename fill_type> inline Mat(const SizeMat& s, const fill::fill_class<fill_type>& f);
|
||||
|
||||
inline Mat(const uword in_n_rows, const uword in_n_cols, const fill::scalar_holder<eT> f);
|
||||
inline Mat(const SizeMat& s, const fill::scalar_holder<eT> f);
|
||||
|
||||
inline arma_cold Mat(const char* text);
|
||||
inline arma_cold Mat& operator=(const char* text);
|
||||
@@ -72,7 +81,6 @@ class Mat : public Base< eT, Mat<eT> >
|
||||
inline Mat(const std::vector<eT>& x);
|
||||
inline Mat& operator=(const std::vector<eT>& x);
|
||||
|
||||
#if defined(ARMA_USE_CXX11)
|
||||
inline Mat(const std::initializer_list<eT>& list);
|
||||
inline Mat& operator=(const std::initializer_list<eT>& list);
|
||||
|
||||
@@ -81,19 +89,18 @@ class Mat : public Base< eT, Mat<eT> >
|
||||
|
||||
inline Mat(Mat&& m);
|
||||
inline Mat& operator=(Mat&& m);
|
||||
#endif
|
||||
|
||||
inline Mat( eT* aux_mem, const uword aux_n_rows, const uword aux_n_cols, const bool copy_aux_mem = true, const bool strict = false);
|
||||
inline Mat(const eT* aux_mem, const uword aux_n_rows, const uword aux_n_cols);
|
||||
|
||||
inline Mat& operator=(const eT val);
|
||||
inline Mat& operator= (const eT val);
|
||||
inline Mat& operator+=(const eT val);
|
||||
inline Mat& operator-=(const eT val);
|
||||
inline Mat& operator*=(const eT val);
|
||||
inline Mat& operator/=(const eT val);
|
||||
|
||||
inline Mat(const Mat& m);
|
||||
inline Mat& operator=(const Mat& m);
|
||||
inline Mat& operator= (const Mat& m);
|
||||
inline Mat& operator+=(const Mat& m);
|
||||
inline Mat& operator-=(const Mat& m);
|
||||
inline Mat& operator*=(const Mat& m);
|
||||
@@ -101,7 +108,7 @@ class Mat : public Base< eT, Mat<eT> >
|
||||
inline Mat& operator/=(const Mat& m);
|
||||
|
||||
template<typename T1> inline Mat(const BaseCube<eT,T1>& X);
|
||||
template<typename T1> inline Mat& operator=(const BaseCube<eT,T1>& X);
|
||||
template<typename T1> inline Mat& operator= (const BaseCube<eT,T1>& X);
|
||||
template<typename T1> inline Mat& operator+=(const BaseCube<eT,T1>& X);
|
||||
template<typename T1> inline Mat& operator-=(const BaseCube<eT,T1>& X);
|
||||
template<typename T1> inline Mat& operator*=(const BaseCube<eT,T1>& X);
|
||||
@@ -114,7 +121,7 @@ class Mat : public Base< eT, Mat<eT> >
|
||||
inline explicit Mat(const subview<eT>& X, const bool use_colmem); // only to be used by the quasi_unwrap class
|
||||
|
||||
inline Mat(const subview<eT>& X);
|
||||
inline Mat& operator=(const subview<eT>& X);
|
||||
inline Mat& operator= (const subview<eT>& X);
|
||||
inline Mat& operator+=(const subview<eT>& X);
|
||||
inline Mat& operator-=(const subview<eT>& X);
|
||||
inline Mat& operator*=(const subview<eT>& X);
|
||||
@@ -129,7 +136,7 @@ class Mat : public Base< eT, Mat<eT> >
|
||||
inline Mat(const xtrans_mat<eT,do_conj>& X); // xtrans_mat can only be generated by the Proxy class
|
||||
|
||||
inline Mat(const subview_cube<eT>& X);
|
||||
inline Mat& operator=(const subview_cube<eT>& X);
|
||||
inline Mat& operator= (const subview_cube<eT>& X);
|
||||
inline Mat& operator+=(const subview_cube<eT>& X);
|
||||
inline Mat& operator-=(const subview_cube<eT>& X);
|
||||
inline Mat& operator*=(const subview_cube<eT>& X);
|
||||
@@ -137,7 +144,7 @@ class Mat : public Base< eT, Mat<eT> >
|
||||
inline Mat& operator/=(const subview_cube<eT>& X);
|
||||
|
||||
inline Mat(const diagview<eT>& X);
|
||||
inline Mat& operator=(const diagview<eT>& X);
|
||||
inline Mat& operator= (const diagview<eT>& X);
|
||||
inline Mat& operator+=(const diagview<eT>& X);
|
||||
inline Mat& operator-=(const diagview<eT>& X);
|
||||
inline Mat& operator*=(const diagview<eT>& X);
|
||||
@@ -162,7 +169,7 @@ class Mat : public Base< eT, Mat<eT> >
|
||||
|
||||
// Operators on sparse matrices (and subviews)
|
||||
template<typename T1> inline explicit Mat(const SpBase<eT, T1>& m);
|
||||
template<typename T1> inline Mat& operator=(const SpBase<eT, T1>& m);
|
||||
template<typename T1> inline Mat& operator= (const SpBase<eT, T1>& m);
|
||||
template<typename T1> inline Mat& operator+=(const SpBase<eT, T1>& m);
|
||||
template<typename T1> inline Mat& operator-=(const SpBase<eT, T1>& m);
|
||||
template<typename T1> inline Mat& operator*=(const SpBase<eT, T1>& m);
|
||||
@@ -170,10 +177,10 @@ class Mat : public Base< eT, Mat<eT> >
|
||||
template<typename T1> inline Mat& operator/=(const SpBase<eT, T1>& m);
|
||||
|
||||
inline explicit Mat(const SpSubview<eT>& X);
|
||||
inline Mat& operator=(const SpSubview<eT>& X);
|
||||
inline Mat& operator= (const SpSubview<eT>& X);
|
||||
|
||||
inline explicit Mat(const spdiagview<eT>& X);
|
||||
inline Mat& operator=(const spdiagview<eT>& X);
|
||||
inline Mat& operator= (const spdiagview<eT>& X);
|
||||
inline Mat& operator+=(const spdiagview<eT>& X);
|
||||
inline Mat& operator-=(const spdiagview<eT>& X);
|
||||
inline Mat& operator*=(const spdiagview<eT>& X);
|
||||
@@ -181,8 +188,8 @@ class Mat : public Base< eT, Mat<eT> >
|
||||
inline Mat& operator/=(const spdiagview<eT>& X);
|
||||
|
||||
|
||||
inline mat_injector<Mat> operator<<(const eT val);
|
||||
inline mat_injector<Mat> operator<<(const injector_end_of_row<>& x);
|
||||
arma_deprecated inline mat_injector<Mat> operator<<(const eT val);
|
||||
arma_deprecated inline mat_injector<Mat> operator<<(const injector_end_of_row<>& x);
|
||||
|
||||
|
||||
arma_inline subview_row<eT> row(const uword row_num);
|
||||
@@ -202,17 +209,17 @@ class Mat : public Base< eT, Mat<eT> >
|
||||
inline const Col<eT> unsafe_col(const uword col_num) const;
|
||||
|
||||
|
||||
arma_inline subview<eT> rows(const uword in_row1, const uword in_row2);
|
||||
arma_inline const subview<eT> rows(const uword in_row1, const uword in_row2) const;
|
||||
arma_inline subview<eT> rows(const uword in_row1, const uword in_row2);
|
||||
arma_inline const subview<eT> rows(const uword in_row1, const uword in_row2) const;
|
||||
|
||||
arma_inline subview<eT> cols(const uword in_col1, const uword in_col2);
|
||||
arma_inline const subview<eT> cols(const uword in_col1, const uword in_col2) const;
|
||||
arma_inline subview_cols<eT> cols(const uword in_col1, const uword in_col2);
|
||||
arma_inline const subview_cols<eT> cols(const uword in_col1, const uword in_col2) const;
|
||||
|
||||
inline subview<eT> rows(const span& row_span);
|
||||
inline const subview<eT> rows(const span& row_span) const;
|
||||
inline subview<eT> rows(const span& row_span);
|
||||
inline const subview<eT> rows(const span& row_span) const;
|
||||
|
||||
arma_inline subview<eT> cols(const span& col_span);
|
||||
arma_inline const subview<eT> cols(const span& col_span) const;
|
||||
arma_inline subview_cols<eT> cols(const span& col_span);
|
||||
arma_inline const subview_cols<eT> cols(const span& col_span) const;
|
||||
|
||||
|
||||
arma_inline subview<eT> submat(const uword in_row1, const uword in_col1, const uword in_row2, const uword in_col2);
|
||||
@@ -236,11 +243,11 @@ class Mat : public Base< eT, Mat<eT> >
|
||||
inline subview<eT> tail_rows(const uword N);
|
||||
inline const subview<eT> tail_rows(const uword N) const;
|
||||
|
||||
inline subview<eT> head_cols(const uword N);
|
||||
inline const subview<eT> head_cols(const uword N) const;
|
||||
inline subview_cols<eT> head_cols(const uword N);
|
||||
inline const subview_cols<eT> head_cols(const uword N) const;
|
||||
|
||||
inline subview<eT> tail_cols(const uword N);
|
||||
inline const subview<eT> tail_cols(const uword N) const;
|
||||
inline subview_cols<eT> tail_cols(const uword N);
|
||||
inline const subview_cols<eT> tail_cols(const uword N) const;
|
||||
|
||||
template<typename T1> arma_inline subview_elem1<eT,T1> elem(const Base<uword,T1>& a);
|
||||
template<typename T1> arma_inline const subview_elem1<eT,T1> elem(const Base<uword,T1>& a) const;
|
||||
@@ -278,13 +285,11 @@ class Mat : public Base< eT, Mat<eT> >
|
||||
template<typename T1> inline const subview_each2< Mat<eT>, 0, T1 > each_col(const Base<uword, T1>& indices) const;
|
||||
template<typename T1> inline const subview_each2< Mat<eT>, 1, T1 > each_row(const Base<uword, T1>& indices) const;
|
||||
|
||||
#if defined(ARMA_USE_CXX11)
|
||||
inline const Mat& each_col(const std::function< void( Col<eT>&) >& F);
|
||||
inline const Mat& each_col(const std::function< void(const Col<eT>&) >& F) const;
|
||||
|
||||
inline const Mat& each_row(const std::function< void( Row<eT>&) >& F);
|
||||
inline const Mat& each_row(const std::function< void(const Row<eT>&) >& F) const;
|
||||
#endif
|
||||
|
||||
|
||||
arma_inline diagview<eT> diag(const sword in_id = 0);
|
||||
@@ -311,7 +316,7 @@ class Mat : public Base< eT, Mat<eT> >
|
||||
|
||||
|
||||
template<typename T1, typename gen_type> inline Mat(const Gen<T1, gen_type>& X);
|
||||
template<typename T1, typename gen_type> inline Mat& operator=(const Gen<T1, gen_type>& X);
|
||||
template<typename T1, typename gen_type> inline Mat& operator= (const Gen<T1, gen_type>& X);
|
||||
template<typename T1, typename gen_type> inline Mat& operator+=(const Gen<T1, gen_type>& X);
|
||||
template<typename T1, typename gen_type> inline Mat& operator-=(const Gen<T1, gen_type>& X);
|
||||
template<typename T1, typename gen_type> inline Mat& operator*=(const Gen<T1, gen_type>& X);
|
||||
@@ -319,7 +324,7 @@ class Mat : public Base< eT, Mat<eT> >
|
||||
template<typename T1, typename gen_type> inline Mat& operator/=(const Gen<T1, gen_type>& X);
|
||||
|
||||
template<typename T1, typename op_type> inline Mat(const Op<T1, op_type>& X);
|
||||
template<typename T1, typename op_type> inline Mat& operator=(const Op<T1, op_type>& X);
|
||||
template<typename T1, typename op_type> inline Mat& operator= (const Op<T1, op_type>& X);
|
||||
template<typename T1, typename op_type> inline Mat& operator+=(const Op<T1, op_type>& X);
|
||||
template<typename T1, typename op_type> inline Mat& operator-=(const Op<T1, op_type>& X);
|
||||
template<typename T1, typename op_type> inline Mat& operator*=(const Op<T1, op_type>& X);
|
||||
@@ -327,7 +332,7 @@ class Mat : public Base< eT, Mat<eT> >
|
||||
template<typename T1, typename op_type> inline Mat& operator/=(const Op<T1, op_type>& X);
|
||||
|
||||
template<typename T1, typename eop_type> inline Mat(const eOp<T1, eop_type>& X);
|
||||
template<typename T1, typename eop_type> inline Mat& operator=(const eOp<T1, eop_type>& X);
|
||||
template<typename T1, typename eop_type> inline Mat& operator= (const eOp<T1, eop_type>& X);
|
||||
template<typename T1, typename eop_type> inline Mat& operator+=(const eOp<T1, eop_type>& X);
|
||||
template<typename T1, typename eop_type> inline Mat& operator-=(const eOp<T1, eop_type>& X);
|
||||
template<typename T1, typename eop_type> inline Mat& operator*=(const eOp<T1, eop_type>& X);
|
||||
@@ -335,7 +340,7 @@ class Mat : public Base< eT, Mat<eT> >
|
||||
template<typename T1, typename eop_type> inline Mat& operator/=(const eOp<T1, eop_type>& X);
|
||||
|
||||
template<typename T1, typename op_type> inline Mat(const mtOp<eT, T1, op_type>& X);
|
||||
template<typename T1, typename op_type> inline Mat& operator=(const mtOp<eT, T1, op_type>& X);
|
||||
template<typename T1, typename op_type> inline Mat& operator= (const mtOp<eT, T1, op_type>& X);
|
||||
template<typename T1, typename op_type> inline Mat& operator+=(const mtOp<eT, T1, op_type>& X);
|
||||
template<typename T1, typename op_type> inline Mat& operator-=(const mtOp<eT, T1, op_type>& X);
|
||||
template<typename T1, typename op_type> inline Mat& operator*=(const mtOp<eT, T1, op_type>& X);
|
||||
@@ -343,7 +348,7 @@ class Mat : public Base< eT, Mat<eT> >
|
||||
template<typename T1, typename op_type> inline Mat& operator/=(const mtOp<eT, T1, op_type>& X);
|
||||
|
||||
template<typename T1, typename op_type> inline Mat(const CubeToMatOp<T1, op_type>& X);
|
||||
template<typename T1, typename op_type> inline Mat& operator=(const CubeToMatOp<T1, op_type>& X);
|
||||
template<typename T1, typename op_type> inline Mat& operator= (const CubeToMatOp<T1, op_type>& X);
|
||||
template<typename T1, typename op_type> inline Mat& operator+=(const CubeToMatOp<T1, op_type>& X);
|
||||
template<typename T1, typename op_type> inline Mat& operator-=(const CubeToMatOp<T1, op_type>& X);
|
||||
template<typename T1, typename op_type> inline Mat& operator*=(const CubeToMatOp<T1, op_type>& X);
|
||||
@@ -351,7 +356,7 @@ class Mat : public Base< eT, Mat<eT> >
|
||||
template<typename T1, typename op_type> inline Mat& operator/=(const CubeToMatOp<T1, op_type>& X);
|
||||
|
||||
template<typename T1, typename op_type> inline Mat(const SpToDOp<T1, op_type>& X);
|
||||
template<typename T1, typename op_type> inline Mat& operator=(const SpToDOp<T1, op_type>& X);
|
||||
template<typename T1, typename op_type> inline Mat& operator= (const SpToDOp<T1, op_type>& X);
|
||||
template<typename T1, typename op_type> inline Mat& operator+=(const SpToDOp<T1, op_type>& X);
|
||||
template<typename T1, typename op_type> inline Mat& operator-=(const SpToDOp<T1, op_type>& X);
|
||||
template<typename T1, typename op_type> inline Mat& operator*=(const SpToDOp<T1, op_type>& X);
|
||||
@@ -359,7 +364,7 @@ class Mat : public Base< eT, Mat<eT> >
|
||||
template<typename T1, typename op_type> inline Mat& operator/=(const SpToDOp<T1, op_type>& X);
|
||||
|
||||
template<typename T1, typename T2, typename glue_type> inline Mat(const Glue<T1, T2, glue_type>& X);
|
||||
template<typename T1, typename T2, typename glue_type> inline Mat& operator=(const Glue<T1, T2, glue_type>& X);
|
||||
template<typename T1, typename T2, typename glue_type> inline Mat& operator= (const Glue<T1, T2, glue_type>& X);
|
||||
template<typename T1, typename T2, typename glue_type> inline Mat& operator+=(const Glue<T1, T2, glue_type>& X);
|
||||
template<typename T1, typename T2, typename glue_type> inline Mat& operator-=(const Glue<T1, T2, glue_type>& X);
|
||||
template<typename T1, typename T2, typename glue_type> inline Mat& operator*=(const Glue<T1, T2, glue_type>& X);
|
||||
@@ -370,7 +375,7 @@ class Mat : public Base< eT, Mat<eT> >
|
||||
template<typename T1, typename T2> inline Mat& operator-=(const Glue<T1, T2, glue_times>& X);
|
||||
|
||||
template<typename T1, typename T2, typename eglue_type> inline Mat(const eGlue<T1, T2, eglue_type>& X);
|
||||
template<typename T1, typename T2, typename eglue_type> inline Mat& operator=(const eGlue<T1, T2, eglue_type>& X);
|
||||
template<typename T1, typename T2, typename eglue_type> inline Mat& operator= (const eGlue<T1, T2, eglue_type>& X);
|
||||
template<typename T1, typename T2, typename eglue_type> inline Mat& operator+=(const eGlue<T1, T2, eglue_type>& X);
|
||||
template<typename T1, typename T2, typename eglue_type> inline Mat& operator-=(const eGlue<T1, T2, eglue_type>& X);
|
||||
template<typename T1, typename T2, typename eglue_type> inline Mat& operator*=(const eGlue<T1, T2, eglue_type>& X);
|
||||
@@ -378,7 +383,7 @@ class Mat : public Base< eT, Mat<eT> >
|
||||
template<typename T1, typename T2, typename eglue_type> inline Mat& operator/=(const eGlue<T1, T2, eglue_type>& X);
|
||||
|
||||
template<typename T1, typename T2, typename glue_type> inline Mat(const mtGlue<eT, T1, T2, glue_type>& X);
|
||||
template<typename T1, typename T2, typename glue_type> inline Mat& operator=(const mtGlue<eT, T1, T2, glue_type>& X);
|
||||
template<typename T1, typename T2, typename glue_type> inline Mat& operator= (const mtGlue<eT, T1, T2, glue_type>& X);
|
||||
template<typename T1, typename T2, typename glue_type> inline Mat& operator+=(const mtGlue<eT, T1, T2, glue_type>& X);
|
||||
template<typename T1, typename T2, typename glue_type> inline Mat& operator-=(const mtGlue<eT, T1, T2, glue_type>& X);
|
||||
template<typename T1, typename T2, typename glue_type> inline Mat& operator*=(const mtGlue<eT, T1, T2, glue_type>& X);
|
||||
@@ -439,28 +444,21 @@ class Mat : public Base< eT, Mat<eT> >
|
||||
arma_inline arma_warn_unused const eT* memptr() const;
|
||||
|
||||
|
||||
arma_cold inline void impl_print( const std::string& extra_text) const;
|
||||
arma_cold inline void impl_print(std::ostream& user_stream, const std::string& extra_text) const;
|
||||
|
||||
arma_cold inline void impl_raw_print( const std::string& extra_text) const;
|
||||
arma_cold inline void impl_raw_print(std::ostream& user_stream, const std::string& extra_text) const;
|
||||
|
||||
|
||||
template<typename eT2, typename expr>
|
||||
inline void copy_size(const Base<eT2,expr>& X);
|
||||
|
||||
inline void set_size(const uword in_elem);
|
||||
inline void set_size(const uword in_rows, const uword in_cols);
|
||||
inline void set_size(const uword new_n_elem);
|
||||
inline void set_size(const uword new_n_rows, const uword new_n_cols);
|
||||
inline void set_size(const SizeMat& s);
|
||||
|
||||
inline void resize(const uword in_elem);
|
||||
inline void resize(const uword in_rows, const uword in_cols);
|
||||
inline void resize(const uword new_n_elem);
|
||||
inline void resize(const uword new_n_rows, const uword new_n_cols);
|
||||
inline void resize(const SizeMat& s);
|
||||
|
||||
inline void reshape(const uword in_rows, const uword in_cols);
|
||||
inline void reshape(const uword new_n_rows, const uword new_n_cols);
|
||||
inline void reshape(const SizeMat& s);
|
||||
|
||||
arma_deprecated inline void reshape(const uword in_rows, const uword in_cols, const uword dim); //!< NOTE: don't use this form: it will be removed
|
||||
arma_deprecated inline void reshape(const uword new_n_rows, const uword new_n_cols, const uword dim); //!< NOTE: don't use this form: it will be removed
|
||||
|
||||
|
||||
template<typename functor> inline const Mat& for_each(functor F);
|
||||
@@ -474,33 +472,35 @@ class Mat : public Base< eT, Mat<eT> >
|
||||
|
||||
inline const Mat& clean(const pod_type threshold);
|
||||
|
||||
inline const Mat& clamp(const eT min_val, const eT max_val);
|
||||
|
||||
inline const Mat& fill(const eT val);
|
||||
|
||||
template<typename fill_type>
|
||||
inline const Mat& fill(const fill::fill_class<fill_type>& f);
|
||||
|
||||
inline const Mat& zeros();
|
||||
inline const Mat& zeros(const uword in_elem);
|
||||
inline const Mat& zeros(const uword in_rows, const uword in_cols);
|
||||
inline const Mat& zeros(const uword new_n_elem);
|
||||
inline const Mat& zeros(const uword new_n_rows, const uword new_n_cols);
|
||||
inline const Mat& zeros(const SizeMat& s);
|
||||
|
||||
inline const Mat& ones();
|
||||
inline const Mat& ones(const uword in_elem);
|
||||
inline const Mat& ones(const uword in_rows, const uword in_cols);
|
||||
inline const Mat& ones(const uword new_n_elem);
|
||||
inline const Mat& ones(const uword new_n_rows, const uword new_n_cols);
|
||||
inline const Mat& ones(const SizeMat& s);
|
||||
|
||||
inline const Mat& randu();
|
||||
inline const Mat& randu(const uword in_elem);
|
||||
inline const Mat& randu(const uword in_rows, const uword in_cols);
|
||||
inline const Mat& randu(const uword new_n_elem);
|
||||
inline const Mat& randu(const uword new_n_rows, const uword new_n_cols);
|
||||
inline const Mat& randu(const SizeMat& s);
|
||||
|
||||
inline const Mat& randn();
|
||||
inline const Mat& randn(const uword in_elem);
|
||||
inline const Mat& randn(const uword in_rows, const uword in_cols);
|
||||
inline const Mat& randn(const uword new_n_elem);
|
||||
inline const Mat& randn(const uword new_n_rows, const uword new_n_cols);
|
||||
inline const Mat& randn(const SizeMat& s);
|
||||
|
||||
inline const Mat& eye();
|
||||
inline const Mat& eye(const uword in_rows, const uword in_cols);
|
||||
inline const Mat& eye(const uword new_n_rows, const uword new_n_cols);
|
||||
inline const Mat& eye(const SizeMat& s);
|
||||
|
||||
inline arma_cold void reset();
|
||||
@@ -521,15 +521,15 @@ class Mat : public Base< eT, Mat<eT> >
|
||||
inline eT max(uword& row_of_max_val, uword& col_of_max_val) const;
|
||||
|
||||
|
||||
inline arma_cold bool save(const std::string name, const file_type type = arma_binary, const bool print_status = true) const;
|
||||
inline arma_cold bool save(const hdf5_name& spec, const file_type type = hdf5_binary, const bool print_status = true) const;
|
||||
inline arma_cold bool save(const csv_name& spec, const file_type type = csv_ascii, const bool print_status = true) const;
|
||||
inline arma_cold bool save( std::ostream& os, const file_type type = arma_binary, const bool print_status = true) const;
|
||||
inline arma_cold bool save(const std::string name, const file_type type = arma_binary) const;
|
||||
inline arma_cold bool save(const hdf5_name& spec, const file_type type = hdf5_binary) const;
|
||||
inline arma_cold bool save(const csv_name& spec, const file_type type = csv_ascii) const;
|
||||
inline arma_cold bool save( std::ostream& os, const file_type type = arma_binary) const;
|
||||
|
||||
inline arma_cold bool load(const std::string name, const file_type type = auto_detect, const bool print_status = true);
|
||||
inline arma_cold bool load(const hdf5_name& spec, const file_type type = hdf5_binary, const bool print_status = true);
|
||||
inline arma_cold bool load(const csv_name& spec, const file_type type = csv_ascii, const bool print_status = true);
|
||||
inline arma_cold bool load( std::istream& is, const file_type type = auto_detect, const bool print_status = true);
|
||||
inline arma_cold bool load(const std::string name, const file_type type = auto_detect);
|
||||
inline arma_cold bool load(const hdf5_name& spec, const file_type type = hdf5_binary);
|
||||
inline arma_cold bool load(const csv_name& spec, const file_type type = csv_ascii);
|
||||
inline arma_cold bool load( std::istream& is, const file_type type = auto_detect);
|
||||
|
||||
inline arma_cold bool quiet_save(const std::string name, const file_type type = arma_binary) const;
|
||||
inline arma_cold bool quiet_save(const hdf5_name& spec, const file_type type = hdf5_binary) const;
|
||||
@@ -731,11 +731,11 @@ class Mat : public Base< eT, Mat<eT> >
|
||||
inline bool empty() const;
|
||||
inline uword size() const;
|
||||
|
||||
inline eT& front();
|
||||
inline const eT& front() const;
|
||||
inline arma_warn_unused eT& front();
|
||||
inline arma_warn_unused const eT& front() const;
|
||||
|
||||
inline eT& back();
|
||||
inline const eT& back() const;
|
||||
inline arma_warn_unused eT& back();
|
||||
inline arma_warn_unused const eT& back() const;
|
||||
|
||||
inline void swap(Mat& B);
|
||||
|
||||
@@ -750,14 +750,12 @@ class Mat : public Base< eT, Mat<eT> >
|
||||
protected:
|
||||
|
||||
inline void init_cold();
|
||||
inline void init_warm(uword in_rows, uword in_cols);
|
||||
inline void init_warm(uword in_n_rows, uword in_n_cols);
|
||||
|
||||
inline arma_cold void init(const std::string& text);
|
||||
|
||||
#if defined(ARMA_USE_CXX11)
|
||||
inline void init(const std::initializer_list<eT>& list);
|
||||
inline void init(const std::initializer_list< std::initializer_list<eT> >& list);
|
||||
#endif
|
||||
inline void init(const std::initializer_list<eT>& list);
|
||||
inline void init(const std::initializer_list< std::initializer_list<eT> >& list);
|
||||
|
||||
template<typename T1, typename T2>
|
||||
inline void init(const Base<pod_type,T1>& A, const Base<pod_type,T2>& B);
|
||||
@@ -796,8 +794,8 @@ class Mat<eT>::fixed : public Mat<eT>
|
||||
{
|
||||
private:
|
||||
|
||||
static const uword fixed_n_elem = fixed_n_rows * fixed_n_cols;
|
||||
static const bool use_extra = (fixed_n_elem > arma_config::mat_prealloc);
|
||||
static constexpr uword fixed_n_elem = fixed_n_rows * fixed_n_cols;
|
||||
static constexpr bool use_extra = (fixed_n_elem > arma_config::mat_prealloc);
|
||||
|
||||
arma_align_mem eT mem_local_extra[ (use_extra) ? fixed_n_elem : 1 ];
|
||||
|
||||
@@ -809,9 +807,9 @@ class Mat<eT>::fixed : public Mat<eT>
|
||||
typedef eT elem_type;
|
||||
typedef typename get_pod_type<eT>::result pod_type;
|
||||
|
||||
static const bool is_col = (fixed_n_cols == 1);
|
||||
static const bool is_row = (fixed_n_rows == 1);
|
||||
static const bool is_xvec = false;
|
||||
static constexpr bool is_col = (fixed_n_cols == 1);
|
||||
static constexpr bool is_row = (fixed_n_rows == 1);
|
||||
static constexpr bool is_xvec = false;
|
||||
|
||||
static const uword n_rows; // value provided below the class definition
|
||||
static const uword n_cols; // value provided below the class definition
|
||||
@@ -820,6 +818,7 @@ class Mat<eT>::fixed : public Mat<eT>
|
||||
arma_inline fixed();
|
||||
arma_inline fixed(const fixed<fixed_n_rows, fixed_n_cols>& X);
|
||||
|
||||
inline fixed(const fill::scalar_holder<eT> f);
|
||||
template<typename fill_type> inline fixed(const fill::fill_class<fill_type>& f);
|
||||
template<typename T1> inline fixed(const Base<eT,T1>& A);
|
||||
template<typename T1, typename T2> inline fixed(const Base<pod_type,T1>& A, const Base<pod_type,T2>& B);
|
||||
@@ -832,13 +831,11 @@ class Mat<eT>::fixed : public Mat<eT>
|
||||
using Mat<eT>::operator=;
|
||||
using Mat<eT>::operator();
|
||||
|
||||
#if defined(ARMA_USE_CXX11)
|
||||
inline fixed(const std::initializer_list<eT>& list);
|
||||
inline Mat& operator=(const std::initializer_list<eT>& list);
|
||||
|
||||
inline fixed(const std::initializer_list< std::initializer_list<eT> >& list);
|
||||
inline Mat& operator=(const std::initializer_list< std::initializer_list<eT> >& list);
|
||||
#endif
|
||||
inline fixed(const std::initializer_list<eT>& list);
|
||||
inline Mat& operator=(const std::initializer_list<eT>& list);
|
||||
|
||||
inline fixed(const std::initializer_list< std::initializer_list<eT> >& list);
|
||||
inline Mat& operator=(const std::initializer_list< std::initializer_list<eT> >& list);
|
||||
|
||||
arma_inline Mat& operator=(const fixed<fixed_n_rows, fixed_n_cols>& X);
|
||||
|
||||
@@ -847,9 +844,9 @@ class Mat<eT>::fixed : public Mat<eT>
|
||||
template<typename T1, typename T2, typename eglue_type> inline Mat& operator=(const eGlue<T1, T2, eglue_type>& X);
|
||||
#endif
|
||||
|
||||
arma_inline const Op< Mat_fixed_type, op_htrans > t() const;
|
||||
arma_inline const Op< Mat_fixed_type, op_htrans > ht() const;
|
||||
arma_inline const Op< Mat_fixed_type, op_strans > st() const;
|
||||
arma_inline arma_warn_unused const Op< Mat_fixed_type, op_htrans > t() const;
|
||||
arma_inline arma_warn_unused const Op< Mat_fixed_type, op_htrans > ht() const;
|
||||
arma_inline arma_warn_unused const Op< Mat_fixed_type, op_strans > st() const;
|
||||
|
||||
arma_inline arma_warn_unused const eT& at_alt (const uword i) const;
|
||||
|
||||
|
||||
+923
-841
File diff suppressed because it is too large
Load Diff
@@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
// Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
//
|
||||
@@ -21,7 +23,7 @@
|
||||
//! Analog of the Op class, intended for cubes
|
||||
|
||||
template<typename T1, typename op_type>
|
||||
class OpCube : public BaseCube<typename T1::elem_type, OpCube<T1, op_type> >
|
||||
class OpCube : public BaseCube< typename T1::elem_type, OpCube<T1, op_type> >
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
// Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
//
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
// Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
//
|
||||
@@ -26,24 +28,24 @@ struct Op_traits {};
|
||||
template<typename T1, typename op_type>
|
||||
struct Op_traits<T1, op_type, true>
|
||||
{
|
||||
static const bool is_row = op_type::template traits<T1>::is_row;
|
||||
static const bool is_col = op_type::template traits<T1>::is_col;
|
||||
static const bool is_xvec = op_type::template traits<T1>::is_xvec;
|
||||
static constexpr bool is_row = op_type::template traits<T1>::is_row;
|
||||
static constexpr bool is_col = op_type::template traits<T1>::is_col;
|
||||
static constexpr bool is_xvec = op_type::template traits<T1>::is_xvec;
|
||||
};
|
||||
|
||||
template<typename T1, typename op_type>
|
||||
struct Op_traits<T1, op_type, false>
|
||||
{
|
||||
static const bool is_row = false;
|
||||
static const bool is_col = false;
|
||||
static const bool is_xvec = false;
|
||||
static constexpr bool is_row = false;
|
||||
static constexpr bool is_col = false;
|
||||
static constexpr bool is_xvec = false;
|
||||
};
|
||||
|
||||
|
||||
template<typename T1, typename op_type>
|
||||
class Op
|
||||
: public Base<typename T1::elem_type, Op<T1, op_type> >
|
||||
, public Op_traits<T1, op_type, has_nested_op_traits<op_type>::value >
|
||||
: public Base< typename T1::elem_type, Op<T1, op_type> >
|
||||
, public Op_traits<T1, op_type, has_nested_op_traits<op_type>::value>
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
// Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
//
|
||||
|
||||
+688
-599
File diff suppressed because it is too large
Load Diff
@@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
// Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
//
|
||||
@@ -20,9 +22,8 @@
|
||||
|
||||
|
||||
template<typename T1>
|
||||
class ProxyCube
|
||||
struct ProxyCube
|
||||
{
|
||||
public:
|
||||
inline ProxyCube(const T1&)
|
||||
{
|
||||
arma_type_check(( is_arma_cube_type<T1>::value == false ));
|
||||
@@ -35,19 +36,17 @@ class ProxyCube
|
||||
// which can provide access to elements via operator[]
|
||||
|
||||
template<typename eT>
|
||||
class ProxyCube< Cube<eT> >
|
||||
struct ProxyCube< Cube<eT> >
|
||||
{
|
||||
public:
|
||||
|
||||
typedef eT elem_type;
|
||||
typedef typename get_pod_type<elem_type>::result pod_type;
|
||||
typedef Cube<eT> stored_type;
|
||||
typedef const eT* ea_type;
|
||||
typedef const Cube<eT>& aligned_ea_type;
|
||||
|
||||
static const bool use_at = false;
|
||||
static const bool use_mp = false;
|
||||
static const bool has_subview = false;
|
||||
static constexpr bool use_at = false;
|
||||
static constexpr bool use_mp = false;
|
||||
static constexpr bool has_subview = false;
|
||||
|
||||
arma_aligned const Cube<eT>& Q;
|
||||
|
||||
@@ -63,9 +62,9 @@ class ProxyCube< Cube<eT> >
|
||||
arma_inline uword get_n_slices() const { return Q.n_slices; }
|
||||
arma_inline uword get_n_elem() const { return Q.n_elem; }
|
||||
|
||||
arma_inline elem_type operator[] (const uword i) const { return Q[i]; }
|
||||
arma_inline elem_type at (const uword row, const uword col, const uword slice) const { return Q.at(row, col, slice); }
|
||||
arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); }
|
||||
arma_inline elem_type operator[] (const uword i) const { return Q[i]; }
|
||||
arma_inline elem_type at (const uword r, const uword c, const uword s) const { return Q.at(r, c, s); }
|
||||
arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); }
|
||||
|
||||
arma_inline ea_type get_ea() const { return Q.memptr(); }
|
||||
arma_inline aligned_ea_type get_aligned_ea() const { return Q; }
|
||||
@@ -73,25 +72,26 @@ class ProxyCube< Cube<eT> >
|
||||
template<typename eT2>
|
||||
arma_inline bool is_alias(const Cube<eT2>& X) const { return (void_ptr(&Q) == void_ptr(&X)); }
|
||||
|
||||
template<typename eT2>
|
||||
arma_inline bool has_overlap(const subview_cube<eT2>& X) const { return is_alias(X.m); }
|
||||
|
||||
arma_inline bool is_aligned() const { return memory::is_aligned(Q.memptr()); }
|
||||
};
|
||||
|
||||
|
||||
|
||||
template<typename eT, typename gen_type>
|
||||
class ProxyCube< GenCube<eT, gen_type> >
|
||||
struct ProxyCube< GenCube<eT, gen_type> >
|
||||
{
|
||||
public:
|
||||
|
||||
typedef eT elem_type;
|
||||
typedef typename get_pod_type<elem_type>::result pod_type;
|
||||
typedef GenCube<eT, gen_type> stored_type;
|
||||
typedef const GenCube<eT, gen_type>& ea_type;
|
||||
typedef const GenCube<eT, gen_type>& aligned_ea_type;
|
||||
|
||||
static const bool use_at = false;
|
||||
static const bool use_mp = false;
|
||||
static const bool has_subview = false;
|
||||
static constexpr bool use_at = false;
|
||||
static constexpr bool use_mp = false;
|
||||
static constexpr bool has_subview = false;
|
||||
|
||||
arma_aligned const GenCube<eT, gen_type>& Q;
|
||||
|
||||
@@ -107,15 +107,18 @@ class ProxyCube< GenCube<eT, gen_type> >
|
||||
arma_inline uword get_n_slices() const { return Q.n_slices; }
|
||||
arma_inline uword get_n_elem() const { return Q.n_rows*Q.n_cols*Q.n_slices; }
|
||||
|
||||
arma_inline elem_type operator[] (const uword i) const { return Q[i]; }
|
||||
arma_inline elem_type at (const uword row, const uword col, const uword slice) const { return Q.at(row, col, slice); }
|
||||
arma_inline elem_type at_alt (const uword i) const { return Q[i]; }
|
||||
arma_inline elem_type operator[] (const uword i) const { return Q[i]; }
|
||||
arma_inline elem_type at (const uword r, const uword c, const uword s) const { return Q.at(r, c, s); }
|
||||
arma_inline elem_type at_alt (const uword i) const { return Q[i]; }
|
||||
|
||||
arma_inline ea_type get_ea() const { return Q; }
|
||||
arma_inline aligned_ea_type get_aligned_ea() const { return Q; }
|
||||
|
||||
template<typename eT2>
|
||||
arma_inline bool is_alias(const Cube<eT2>&) const { return false; }
|
||||
constexpr bool is_alias(const Cube<eT2>&) const { return false; }
|
||||
|
||||
template<typename eT2>
|
||||
constexpr bool has_overlap(const subview_cube<eT2>&) const { return false; }
|
||||
|
||||
arma_inline bool is_aligned() const { return GenCube<eT, gen_type>::is_simple; }
|
||||
};
|
||||
@@ -123,19 +126,17 @@ class ProxyCube< GenCube<eT, gen_type> >
|
||||
|
||||
|
||||
template<typename eT>
|
||||
class ProxyCube< GenCube<eT, gen_randu> >
|
||||
struct ProxyCube< GenCube<eT, gen_randu> >
|
||||
{
|
||||
public:
|
||||
|
||||
typedef eT elem_type;
|
||||
typedef typename get_pod_type<elem_type>::result pod_type;
|
||||
typedef Cube<eT> stored_type;
|
||||
typedef const eT* ea_type;
|
||||
typedef const Cube<eT>& aligned_ea_type;
|
||||
|
||||
static const bool use_at = false;
|
||||
static const bool use_mp = false;
|
||||
static const bool has_subview = false;
|
||||
static constexpr bool use_at = false;
|
||||
static constexpr bool use_mp = false;
|
||||
static constexpr bool has_subview = false;
|
||||
|
||||
arma_aligned const Cube<eT> Q;
|
||||
|
||||
@@ -151,15 +152,18 @@ class ProxyCube< GenCube<eT, gen_randu> >
|
||||
arma_inline uword get_n_slices() const { return Q.n_slices; }
|
||||
arma_inline uword get_n_elem() const { return Q.n_elem; }
|
||||
|
||||
arma_inline elem_type operator[] (const uword i) const { return Q[i]; }
|
||||
arma_inline elem_type at (const uword row, const uword col, const uword slice) const { return Q.at(row, col, slice); }
|
||||
arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); }
|
||||
arma_inline elem_type operator[] (const uword i) const { return Q[i]; }
|
||||
arma_inline elem_type at (const uword r, const uword c, const uword s) const { return Q.at(r, c, s); }
|
||||
arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); }
|
||||
|
||||
arma_inline ea_type get_ea() const { return Q.memptr(); }
|
||||
arma_inline aligned_ea_type get_aligned_ea() const { return Q; }
|
||||
|
||||
template<typename eT2>
|
||||
arma_inline bool is_alias(const Cube<eT2>&) const { return false; }
|
||||
constexpr bool is_alias(const Cube<eT2>&) const { return false; }
|
||||
|
||||
template<typename eT2>
|
||||
constexpr bool has_overlap(const subview_cube<eT2>&) const { return false; }
|
||||
|
||||
arma_inline bool is_aligned() const { return memory::is_aligned(Q.memptr()); }
|
||||
};
|
||||
@@ -167,19 +171,17 @@ class ProxyCube< GenCube<eT, gen_randu> >
|
||||
|
||||
|
||||
template<typename eT>
|
||||
class ProxyCube< GenCube<eT, gen_randn> >
|
||||
struct ProxyCube< GenCube<eT, gen_randn> >
|
||||
{
|
||||
public:
|
||||
|
||||
typedef eT elem_type;
|
||||
typedef typename get_pod_type<elem_type>::result pod_type;
|
||||
typedef Cube<eT> stored_type;
|
||||
typedef const eT* ea_type;
|
||||
typedef const Cube<eT>& aligned_ea_type;
|
||||
|
||||
static const bool use_at = false;
|
||||
static const bool use_mp = false;
|
||||
static const bool has_subview = false;
|
||||
static constexpr bool use_at = false;
|
||||
static constexpr bool use_mp = false;
|
||||
static constexpr bool has_subview = false;
|
||||
|
||||
arma_aligned const Cube<eT> Q;
|
||||
|
||||
@@ -195,15 +197,18 @@ class ProxyCube< GenCube<eT, gen_randn> >
|
||||
arma_inline uword get_n_slices() const { return Q.n_slices; }
|
||||
arma_inline uword get_n_elem() const { return Q.n_elem; }
|
||||
|
||||
arma_inline elem_type operator[] (const uword i) const { return Q[i]; }
|
||||
arma_inline elem_type at (const uword row, const uword col, const uword slice) const { return Q.at(row, col, slice); }
|
||||
arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); }
|
||||
arma_inline elem_type operator[] (const uword i) const { return Q[i]; }
|
||||
arma_inline elem_type at (const uword r, const uword c, const uword s) const { return Q.at(r, c, s); }
|
||||
arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); }
|
||||
|
||||
arma_inline ea_type get_ea() const { return Q.memptr(); }
|
||||
arma_inline aligned_ea_type get_aligned_ea() const { return Q; }
|
||||
|
||||
template<typename eT2>
|
||||
arma_inline bool is_alias(const Cube<eT2>&) const { return false; }
|
||||
constexpr bool is_alias(const Cube<eT2>&) const { return false; }
|
||||
|
||||
template<typename eT2>
|
||||
constexpr bool has_overlap(const subview_cube<eT2>&) const { return false; }
|
||||
|
||||
arma_inline bool is_aligned() const { return memory::is_aligned(Q.memptr()); }
|
||||
};
|
||||
@@ -211,19 +216,17 @@ class ProxyCube< GenCube<eT, gen_randn> >
|
||||
|
||||
|
||||
template<typename T1, typename op_type>
|
||||
class ProxyCube< OpCube<T1, op_type> >
|
||||
struct ProxyCube< OpCube<T1, op_type> >
|
||||
{
|
||||
public:
|
||||
|
||||
typedef typename T1::elem_type elem_type;
|
||||
typedef typename get_pod_type<elem_type>::result pod_type;
|
||||
typedef Cube<elem_type> stored_type;
|
||||
typedef const elem_type* ea_type;
|
||||
typedef const Cube<elem_type>& aligned_ea_type;
|
||||
|
||||
static const bool use_at = false;
|
||||
static const bool use_mp = false;
|
||||
static const bool has_subview = false;
|
||||
static constexpr bool use_at = false;
|
||||
static constexpr bool use_mp = false;
|
||||
static constexpr bool has_subview = false;
|
||||
|
||||
arma_aligned const Cube<elem_type> Q;
|
||||
|
||||
@@ -239,15 +242,18 @@ class ProxyCube< OpCube<T1, op_type> >
|
||||
arma_inline uword get_n_slices() const { return Q.n_slices; }
|
||||
arma_inline uword get_n_elem() const { return Q.n_elem; }
|
||||
|
||||
arma_inline elem_type operator[] (const uword i) const { return Q[i]; }
|
||||
arma_inline elem_type at (const uword row, const uword col, const uword slice) const { return Q.at(row, col, slice); }
|
||||
arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); }
|
||||
arma_inline elem_type operator[] (const uword i) const { return Q[i]; }
|
||||
arma_inline elem_type at (const uword r, const uword c, const uword s) const { return Q.at(r, c, s); }
|
||||
arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); }
|
||||
|
||||
arma_inline ea_type get_ea() const { return Q.memptr(); }
|
||||
arma_inline aligned_ea_type get_aligned_ea() const { return Q; }
|
||||
|
||||
template<typename eT2>
|
||||
arma_inline bool is_alias(const Cube<eT2>&) const { return false; }
|
||||
constexpr bool is_alias(const Cube<eT2>&) const { return false; }
|
||||
|
||||
template<typename eT2>
|
||||
constexpr bool has_overlap(const subview_cube<eT2>&) const { return false; }
|
||||
|
||||
arma_inline bool is_aligned() const { return memory::is_aligned(Q.memptr()); }
|
||||
};
|
||||
@@ -255,19 +261,17 @@ class ProxyCube< OpCube<T1, op_type> >
|
||||
|
||||
|
||||
template<typename T1, typename T2, typename glue_type>
|
||||
class ProxyCube< GlueCube<T1, T2, glue_type> >
|
||||
struct ProxyCube< GlueCube<T1, T2, glue_type> >
|
||||
{
|
||||
public:
|
||||
|
||||
typedef typename T1::elem_type elem_type;
|
||||
typedef typename get_pod_type<elem_type>::result pod_type;
|
||||
typedef Cube<elem_type> stored_type;
|
||||
typedef const elem_type* ea_type;
|
||||
typedef const Cube<elem_type>& aligned_ea_type;
|
||||
|
||||
static const bool use_at = false;
|
||||
static const bool use_mp = false;
|
||||
static const bool has_subview = false;
|
||||
static constexpr bool use_at = false;
|
||||
static constexpr bool use_mp = false;
|
||||
static constexpr bool has_subview = false;
|
||||
|
||||
arma_aligned const Cube<elem_type> Q;
|
||||
|
||||
@@ -283,15 +287,18 @@ class ProxyCube< GlueCube<T1, T2, glue_type> >
|
||||
arma_inline uword get_n_slices() const { return Q.n_slices; }
|
||||
arma_inline uword get_n_elem() const { return Q.n_elem; }
|
||||
|
||||
arma_inline elem_type operator[] (const uword i) const { return Q[i]; }
|
||||
arma_inline elem_type at (const uword row, const uword col, const uword slice) const { return Q.at(row, col, slice); }
|
||||
arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); }
|
||||
arma_inline elem_type operator[] (const uword i) const { return Q[i]; }
|
||||
arma_inline elem_type at (const uword r, const uword c, const uword s) const { return Q.at(r, c, s); }
|
||||
arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); }
|
||||
|
||||
arma_inline ea_type get_ea() const { return Q.memptr(); }
|
||||
arma_inline aligned_ea_type get_aligned_ea() const { return Q; }
|
||||
|
||||
template<typename eT2>
|
||||
arma_inline bool is_alias(const Cube<eT2>&) const { return false; }
|
||||
constexpr bool is_alias(const Cube<eT2>&) const { return false; }
|
||||
|
||||
template<typename eT2>
|
||||
constexpr bool has_overlap(const subview_cube<eT2>&) const { return false; }
|
||||
|
||||
arma_inline bool is_aligned() const { return memory::is_aligned(Q.memptr()); }
|
||||
};
|
||||
@@ -299,19 +306,17 @@ class ProxyCube< GlueCube<T1, T2, glue_type> >
|
||||
|
||||
|
||||
template<typename eT>
|
||||
class ProxyCube< subview_cube<eT> >
|
||||
struct ProxyCube< subview_cube<eT> >
|
||||
{
|
||||
public:
|
||||
|
||||
typedef eT elem_type;
|
||||
typedef typename get_pod_type<elem_type>::result pod_type;
|
||||
typedef subview_cube<eT> stored_type;
|
||||
typedef const subview_cube<eT>& ea_type;
|
||||
typedef const subview_cube<eT>& aligned_ea_type;
|
||||
|
||||
static const bool use_at = true;
|
||||
static const bool use_mp = false;
|
||||
static const bool has_subview = true;
|
||||
static constexpr bool use_at = true;
|
||||
static constexpr bool use_mp = false;
|
||||
static constexpr bool has_subview = true;
|
||||
|
||||
arma_aligned const subview_cube<eT>& Q;
|
||||
|
||||
@@ -327,9 +332,9 @@ class ProxyCube< subview_cube<eT> >
|
||||
arma_inline uword get_n_slices() const { return Q.n_slices; }
|
||||
arma_inline uword get_n_elem() const { return Q.n_elem; }
|
||||
|
||||
arma_inline elem_type operator[] (const uword i) const { return Q[i]; }
|
||||
arma_inline elem_type at (const uword row, const uword col, const uword slice) const { return Q.at(row, col, slice); }
|
||||
arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); }
|
||||
arma_inline elem_type operator[] (const uword i) const { return Q[i]; }
|
||||
arma_inline elem_type at (const uword r, const uword c, const uword s) const { return Q.at(r, c, s); }
|
||||
arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); }
|
||||
|
||||
arma_inline ea_type get_ea() const { return Q; }
|
||||
arma_inline aligned_ea_type get_aligned_ea() const { return Q; }
|
||||
@@ -337,25 +342,26 @@ class ProxyCube< subview_cube<eT> >
|
||||
template<typename eT2>
|
||||
arma_inline bool is_alias(const Cube<eT2>& X) const { return (void_ptr(&(Q.m)) == void_ptr(&X)); }
|
||||
|
||||
arma_inline bool is_aligned() const { return false; }
|
||||
template<typename eT2>
|
||||
arma_inline bool has_overlap(const subview_cube<eT2>& X) const { return Q.check_overlap(X); }
|
||||
|
||||
constexpr bool is_aligned() const { return false; }
|
||||
};
|
||||
|
||||
|
||||
|
||||
template<typename eT, typename T1>
|
||||
class ProxyCube< subview_cube_slices<eT,T1> >
|
||||
struct ProxyCube< subview_cube_slices<eT,T1> >
|
||||
{
|
||||
public:
|
||||
|
||||
typedef eT elem_type;
|
||||
typedef typename get_pod_type<elem_type>::result pod_type;
|
||||
typedef Cube<eT> stored_type;
|
||||
typedef const eT* ea_type;
|
||||
typedef const Cube<eT>& aligned_ea_type;
|
||||
|
||||
static const bool use_at = false;
|
||||
static const bool use_mp = false;
|
||||
static const bool has_subview = false;
|
||||
static constexpr bool use_at = false;
|
||||
static constexpr bool use_mp = false;
|
||||
static constexpr bool has_subview = false;
|
||||
|
||||
arma_aligned const Cube<eT> Q;
|
||||
|
||||
@@ -371,15 +377,18 @@ class ProxyCube< subview_cube_slices<eT,T1> >
|
||||
arma_inline uword get_n_slices() const { return Q.n_slices; }
|
||||
arma_inline uword get_n_elem() const { return Q.n_elem; }
|
||||
|
||||
arma_inline elem_type operator[] (const uword i) const { return Q[i]; }
|
||||
arma_inline elem_type at (const uword row, const uword col, const uword slice) const { return Q.at(row, col, slice); }
|
||||
arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); }
|
||||
arma_inline elem_type operator[] (const uword i) const { return Q[i]; }
|
||||
arma_inline elem_type at (const uword r, const uword c, const uword s) const { return Q.at(r, c, s); }
|
||||
arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); }
|
||||
|
||||
arma_inline ea_type get_ea() const { return Q.memptr(); }
|
||||
arma_inline aligned_ea_type get_aligned_ea() const { return Q; }
|
||||
|
||||
template<typename eT2>
|
||||
arma_inline bool is_alias(const Cube<eT2>&) const { return false; }
|
||||
constexpr bool is_alias(const Cube<eT2>&) const { return false; }
|
||||
|
||||
template<typename eT2>
|
||||
constexpr bool has_overlap(const subview_cube<eT2>&) const { return false; }
|
||||
|
||||
arma_inline bool is_aligned() const { return memory::is_aligned(Q.memptr()); }
|
||||
};
|
||||
@@ -387,19 +396,17 @@ class ProxyCube< subview_cube_slices<eT,T1> >
|
||||
|
||||
|
||||
template<typename T1, typename eop_type>
|
||||
class ProxyCube< eOpCube<T1, eop_type > >
|
||||
struct ProxyCube< eOpCube<T1, eop_type > >
|
||||
{
|
||||
public:
|
||||
|
||||
typedef typename T1::elem_type elem_type;
|
||||
typedef typename get_pod_type<elem_type>::result pod_type;
|
||||
typedef eOpCube<T1, eop_type> stored_type;
|
||||
typedef const eOpCube<T1, eop_type>& ea_type;
|
||||
typedef const eOpCube<T1, eop_type>& aligned_ea_type;
|
||||
|
||||
static const bool use_at = eOpCube<T1, eop_type>::use_at;
|
||||
static const bool use_mp = eOpCube<T1, eop_type>::use_mp;
|
||||
static const bool has_subview = eOpCube<T1, eop_type>::has_subview;
|
||||
static constexpr bool use_at = eOpCube<T1, eop_type>::use_at;
|
||||
static constexpr bool use_mp = eOpCube<T1, eop_type>::use_mp;
|
||||
static constexpr bool has_subview = eOpCube<T1, eop_type>::has_subview;
|
||||
|
||||
arma_aligned const eOpCube<T1, eop_type>& Q;
|
||||
|
||||
@@ -415,9 +422,9 @@ class ProxyCube< eOpCube<T1, eop_type > >
|
||||
arma_inline uword get_n_slices() const { return Q.get_n_slices(); }
|
||||
arma_inline uword get_n_elem() const { return Q.get_n_elem(); }
|
||||
|
||||
arma_inline elem_type operator[] (const uword i) const { return Q[i]; }
|
||||
arma_inline elem_type at (const uword row, const uword col, const uword slice) const { return Q.at(row, col, slice); }
|
||||
arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); }
|
||||
arma_inline elem_type operator[] (const uword i) const { return Q[i]; }
|
||||
arma_inline elem_type at (const uword r, const uword c, const uword s) const { return Q.at(r, c, s); }
|
||||
arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); }
|
||||
|
||||
arma_inline ea_type get_ea() const { return Q; }
|
||||
arma_inline aligned_ea_type get_aligned_ea() const { return Q; }
|
||||
@@ -425,25 +432,26 @@ class ProxyCube< eOpCube<T1, eop_type > >
|
||||
template<typename eT2>
|
||||
arma_inline bool is_alias(const Cube<eT2>& X) const { return Q.P.is_alias(X); }
|
||||
|
||||
template<typename eT2>
|
||||
arma_inline bool has_overlap(const subview_cube<eT2>& X) const { return Q.P.has_overlap(X); }
|
||||
|
||||
arma_inline bool is_aligned() const { return Q.P.is_aligned(); }
|
||||
};
|
||||
|
||||
|
||||
|
||||
template<typename T1, typename T2, typename eglue_type>
|
||||
class ProxyCube< eGlueCube<T1, T2, eglue_type > >
|
||||
struct ProxyCube< eGlueCube<T1, T2, eglue_type > >
|
||||
{
|
||||
public:
|
||||
|
||||
typedef typename T1::elem_type elem_type;
|
||||
typedef typename get_pod_type<elem_type>::result pod_type;
|
||||
typedef eGlueCube<T1, T2, eglue_type> stored_type;
|
||||
typedef const eGlueCube<T1, T2, eglue_type>& ea_type;
|
||||
typedef const eGlueCube<T1, T2, eglue_type>& aligned_ea_type;
|
||||
|
||||
static const bool use_at = eGlueCube<T1, T2, eglue_type>::use_at;
|
||||
static const bool use_mp = eGlueCube<T1, T2, eglue_type>::use_mp;
|
||||
static const bool has_subview = eGlueCube<T1, T2, eglue_type>::has_subview;
|
||||
static constexpr bool use_at = eGlueCube<T1, T2, eglue_type>::use_at;
|
||||
static constexpr bool use_mp = eGlueCube<T1, T2, eglue_type>::use_mp;
|
||||
static constexpr bool has_subview = eGlueCube<T1, T2, eglue_type>::has_subview;
|
||||
|
||||
arma_aligned const eGlueCube<T1, T2, eglue_type>& Q;
|
||||
|
||||
@@ -459,9 +467,9 @@ class ProxyCube< eGlueCube<T1, T2, eglue_type > >
|
||||
arma_inline uword get_n_slices() const { return Q.get_n_slices(); }
|
||||
arma_inline uword get_n_elem() const { return Q.get_n_elem(); }
|
||||
|
||||
arma_inline elem_type operator[] (const uword i) const { return Q[i]; }
|
||||
arma_inline elem_type at (const uword row, const uword col, const uword slice) const { return Q.at(row, col, slice); }
|
||||
arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); }
|
||||
arma_inline elem_type operator[] (const uword i) const { return Q[i]; }
|
||||
arma_inline elem_type at (const uword r, const uword c, const uword s) const { return Q.at(r, c, s); }
|
||||
arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); }
|
||||
|
||||
arma_inline ea_type get_ea() const { return Q; }
|
||||
arma_inline aligned_ea_type get_aligned_ea() const { return Q; }
|
||||
@@ -469,25 +477,26 @@ class ProxyCube< eGlueCube<T1, T2, eglue_type > >
|
||||
template<typename eT2>
|
||||
arma_inline bool is_alias(const Cube<eT2>& X) const { return (Q.P1.is_alias(X) || Q.P2.is_alias(X)); }
|
||||
|
||||
template<typename eT2>
|
||||
arma_inline bool has_overlap(const subview_cube<eT2>& X) const { return (Q.P1.has_overlap(X) || Q.P2.has_overlap(X)); }
|
||||
|
||||
arma_inline bool is_aligned() const { return Q.P1.is_aligned() && Q.P2.is_aligned(); }
|
||||
};
|
||||
|
||||
|
||||
|
||||
template<typename out_eT, typename T1, typename op_type>
|
||||
class ProxyCube< mtOpCube<out_eT, T1, op_type> >
|
||||
struct ProxyCube< mtOpCube<out_eT, T1, op_type> >
|
||||
{
|
||||
public:
|
||||
|
||||
typedef out_eT elem_type;
|
||||
typedef typename get_pod_type<out_eT>::result pod_type;
|
||||
typedef Cube<out_eT> stored_type;
|
||||
typedef const elem_type* ea_type;
|
||||
typedef const Cube<out_eT>& aligned_ea_type;
|
||||
|
||||
static const bool use_at = false;
|
||||
static const bool use_mp = false;
|
||||
static const bool has_subview = false;
|
||||
static constexpr bool use_at = false;
|
||||
static constexpr bool use_mp = false;
|
||||
static constexpr bool has_subview = false;
|
||||
|
||||
arma_aligned const Cube<out_eT> Q;
|
||||
|
||||
@@ -503,15 +512,18 @@ class ProxyCube< mtOpCube<out_eT, T1, op_type> >
|
||||
arma_inline uword get_n_slices() const { return Q.n_slices; }
|
||||
arma_inline uword get_n_elem() const { return Q.n_elem; }
|
||||
|
||||
arma_inline elem_type operator[] (const uword i) const { return Q[i]; }
|
||||
arma_inline elem_type at (const uword row, const uword col, const uword slice) const { return Q.at(row, col, slice); }
|
||||
arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); }
|
||||
arma_inline elem_type operator[] (const uword i) const { return Q[i]; }
|
||||
arma_inline elem_type at (const uword r, const uword c, const uword s) const { return Q.at(r, c, s); }
|
||||
arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); }
|
||||
|
||||
arma_inline ea_type get_ea() const { return Q.memptr(); }
|
||||
arma_inline aligned_ea_type get_aligned_ea() const { return Q; }
|
||||
|
||||
template<typename eT2>
|
||||
arma_inline bool is_alias(const Cube<eT2>&) const { return false; }
|
||||
constexpr bool is_alias(const Cube<eT2>&) const { return false; }
|
||||
|
||||
template<typename eT2>
|
||||
constexpr bool has_overlap(const subview_cube<eT2>&) const { return false; }
|
||||
|
||||
arma_inline bool is_aligned() const { return memory::is_aligned(Q.memptr()); }
|
||||
};
|
||||
@@ -519,19 +531,17 @@ class ProxyCube< mtOpCube<out_eT, T1, op_type> >
|
||||
|
||||
|
||||
template<typename out_eT, typename T1, typename T2, typename glue_type>
|
||||
class ProxyCube< mtGlueCube<out_eT, T1, T2, glue_type > >
|
||||
struct ProxyCube< mtGlueCube<out_eT, T1, T2, glue_type > >
|
||||
{
|
||||
public:
|
||||
|
||||
typedef out_eT elem_type;
|
||||
typedef typename get_pod_type<out_eT>::result pod_type;
|
||||
typedef Cube<out_eT> stored_type;
|
||||
typedef const elem_type* ea_type;
|
||||
typedef const Cube<out_eT>& aligned_ea_type;
|
||||
|
||||
static const bool use_at = false;
|
||||
static const bool use_mp = false;
|
||||
static const bool has_subview = false;
|
||||
static constexpr bool use_at = false;
|
||||
static constexpr bool use_mp = false;
|
||||
static constexpr bool has_subview = false;
|
||||
|
||||
arma_aligned const Cube<out_eT> Q;
|
||||
|
||||
@@ -547,15 +557,18 @@ class ProxyCube< mtGlueCube<out_eT, T1, T2, glue_type > >
|
||||
arma_inline uword get_n_slices() const { return Q.n_slices; }
|
||||
arma_inline uword get_n_elem() const { return Q.n_elem; }
|
||||
|
||||
arma_inline elem_type operator[] (const uword i) const { return Q[i]; }
|
||||
arma_inline elem_type at (const uword row, const uword col, const uword slice) const { return Q.at(row, col, slice); }
|
||||
arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); }
|
||||
arma_inline elem_type operator[] (const uword i) const { return Q[i]; }
|
||||
arma_inline elem_type at (const uword r, const uword c, const uword s) const { return Q.at(r, c, s); }
|
||||
arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); }
|
||||
|
||||
arma_inline ea_type get_ea() const { return Q.memptr(); }
|
||||
arma_inline aligned_ea_type get_aligned_ea() const { return Q; }
|
||||
|
||||
template<typename eT2>
|
||||
arma_inline bool is_alias(const Cube<eT2>&) const { return false; }
|
||||
constexpr bool is_alias(const Cube<eT2>&) const { return false; }
|
||||
|
||||
template<typename eT2>
|
||||
constexpr bool has_overlap(const subview_cube<eT2>&) const { return false; }
|
||||
|
||||
arma_inline bool is_aligned() const { return memory::is_aligned(Q.memptr()); }
|
||||
};
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
// Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
//
|
||||
@@ -27,20 +29,29 @@ class Row : public Mat<eT>
|
||||
typedef eT elem_type;
|
||||
typedef typename get_pod_type<eT>::result pod_type;
|
||||
|
||||
static const bool is_col = false;
|
||||
static const bool is_row = true;
|
||||
static const bool is_xvec = false;
|
||||
static constexpr bool is_col = false;
|
||||
static constexpr bool is_row = true;
|
||||
static constexpr bool is_xvec = false;
|
||||
|
||||
inline Row();
|
||||
inline Row(const Row<eT>& X);
|
||||
|
||||
inline Row();
|
||||
inline Row(const Row<eT>& X);
|
||||
inline explicit Row(const uword N);
|
||||
inline explicit Row(const uword in_rows, const uword in_cols);
|
||||
inline explicit Row(const SizeMat& s);
|
||||
|
||||
template<bool do_zeros> inline explicit Row(const uword N, const arma_initmode_indicator<do_zeros>&);
|
||||
template<bool do_zeros> inline explicit Row(const uword in_rows, const uword in_cols, const arma_initmode_indicator<do_zeros>&);
|
||||
template<bool do_zeros> inline explicit Row(const SizeMat& s, const arma_initmode_indicator<do_zeros>&);
|
||||
|
||||
template<typename fill_type> inline Row(const uword n_elem, const fill::fill_class<fill_type>& f);
|
||||
template<typename fill_type> inline Row(const uword in_rows, const uword in_cols, const fill::fill_class<fill_type>& f);
|
||||
template<typename fill_type> inline Row(const SizeMat& s, const fill::fill_class<fill_type>& f);
|
||||
|
||||
inline Row(const uword N, const fill::scalar_holder<eT> f);
|
||||
inline Row(const uword in_rows, const uword in_cols, const fill::scalar_holder<eT> f);
|
||||
inline Row(const SizeMat& s, const fill::scalar_holder<eT> f);
|
||||
|
||||
inline Row(const char* text);
|
||||
inline Row& operator=(const char* text);
|
||||
|
||||
@@ -50,13 +61,11 @@ class Row : public Mat<eT>
|
||||
inline Row(const std::vector<eT>& x);
|
||||
inline Row& operator=(const std::vector<eT>& x);
|
||||
|
||||
#if defined(ARMA_USE_CXX11)
|
||||
inline Row(const std::initializer_list<eT>& list);
|
||||
inline Row& operator=(const std::initializer_list<eT>& list);
|
||||
|
||||
inline Row(Row&& m);
|
||||
inline Row& operator=(Row&& m);
|
||||
#endif
|
||||
|
||||
inline Row& operator=(const eT val);
|
||||
inline Row& operator=(const Row& X);
|
||||
@@ -79,13 +88,13 @@ class Row : public Mat<eT>
|
||||
inline Row(const subview_cube<eT>& X);
|
||||
inline Row& operator=(const subview_cube<eT>& X);
|
||||
|
||||
inline mat_injector<Row> operator<<(const eT val);
|
||||
arma_deprecated inline mat_injector<Row> operator<<(const eT val);
|
||||
|
||||
arma_inline const Op<Row<eT>,op_htrans> t() const;
|
||||
arma_inline const Op<Row<eT>,op_htrans> ht() const;
|
||||
arma_inline const Op<Row<eT>,op_strans> st() const;
|
||||
arma_inline arma_warn_unused const Op<Row<eT>,op_htrans> t() const;
|
||||
arma_inline arma_warn_unused const Op<Row<eT>,op_htrans> ht() const;
|
||||
arma_inline arma_warn_unused const Op<Row<eT>,op_strans> st() const;
|
||||
|
||||
arma_inline const Op<Row<eT>,op_strans> as_col() const;
|
||||
arma_inline arma_warn_unused const Op<Row<eT>,op_strans> as_col() const;
|
||||
|
||||
arma_inline subview_row<eT> col(const uword col_num);
|
||||
arma_inline const subview_row<eT> col(const uword col_num) const;
|
||||
@@ -173,7 +182,7 @@ class Row<eT>::fixed : public Row<eT>
|
||||
{
|
||||
private:
|
||||
|
||||
static const bool use_extra = (fixed_n_elem > arma_config::mat_prealloc);
|
||||
static constexpr bool use_extra = (fixed_n_elem > arma_config::mat_prealloc);
|
||||
|
||||
arma_align_mem eT mem_local_extra[ (use_extra) ? fixed_n_elem : 1 ];
|
||||
|
||||
@@ -185,9 +194,9 @@ class Row<eT>::fixed : public Row<eT>
|
||||
typedef eT elem_type;
|
||||
typedef typename get_pod_type<eT>::result pod_type;
|
||||
|
||||
static const bool is_col = false;
|
||||
static const bool is_row = true;
|
||||
static const bool is_xvec = false;
|
||||
static constexpr bool is_col = false;
|
||||
static constexpr bool is_row = true;
|
||||
static constexpr bool is_xvec = false;
|
||||
|
||||
static const uword n_rows; // value provided below the class definition
|
||||
static const uword n_cols; // value provided below the class definition
|
||||
@@ -197,6 +206,7 @@ class Row<eT>::fixed : public Row<eT>
|
||||
arma_inline fixed(const fixed<fixed_n_elem>& X);
|
||||
inline fixed(const subview_cube<eT>& X);
|
||||
|
||||
inline fixed(const fill::scalar_holder<eT> f);
|
||||
template<typename fill_type> inline fixed(const fill::fill_class<fill_type>& f);
|
||||
template<typename T1> inline fixed(const Base<eT,T1>& A);
|
||||
template<typename T1, typename T2> inline fixed(const Base<pod_type,T1>& A, const Base<pod_type,T2>& B);
|
||||
@@ -215,10 +225,8 @@ class Row<eT>::fixed : public Row<eT>
|
||||
|
||||
using Row<eT>::operator();
|
||||
|
||||
#if defined(ARMA_USE_CXX11)
|
||||
inline fixed(const std::initializer_list<eT>& list);
|
||||
inline Row& operator=(const std::initializer_list<eT>& list);
|
||||
#endif
|
||||
inline fixed(const std::initializer_list<eT>& list);
|
||||
inline Row& operator=(const std::initializer_list<eT>& list);
|
||||
|
||||
arma_inline Row& operator=(const fixed<fixed_n_elem>& X);
|
||||
|
||||
@@ -227,9 +235,9 @@ class Row<eT>::fixed : public Row<eT>
|
||||
template<typename T1, typename T2, typename eglue_type> inline Row& operator=(const eGlue<T1, T2, eglue_type>& X);
|
||||
#endif
|
||||
|
||||
arma_inline const Op< Row_fixed_type, op_htrans > t() const;
|
||||
arma_inline const Op< Row_fixed_type, op_htrans > ht() const;
|
||||
arma_inline const Op< Row_fixed_type, op_strans > st() const;
|
||||
arma_inline arma_warn_unused const Op< Row_fixed_type, op_htrans > t() const;
|
||||
arma_inline arma_warn_unused const Op< Row_fixed_type, op_htrans > ht() const;
|
||||
arma_inline arma_warn_unused const Op< Row_fixed_type, op_strans > st() const;
|
||||
|
||||
arma_inline arma_warn_unused const eT& at_alt (const uword i) const;
|
||||
|
||||
|
||||
+291
-145
@@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
// Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
//
|
||||
@@ -48,6 +50,13 @@ Row<eT>::Row(const uword in_n_elem)
|
||||
: Mat<eT>(arma_vec_indicator(), 1, in_n_elem, 2)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
#if (!defined(ARMA_DONT_ZERO_INIT))
|
||||
{
|
||||
arma_extra_debug_print("Row::constructor: zeroing memory");
|
||||
arrayops::fill_zeros(Mat<eT>::memptr(), Mat<eT>::n_elem);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -60,6 +69,13 @@ Row<eT>::Row(const uword in_n_rows, const uword in_n_cols)
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
Mat<eT>::init_warm(in_n_rows, in_n_cols);
|
||||
|
||||
#if (!defined(ARMA_DONT_ZERO_INIT))
|
||||
{
|
||||
arma_extra_debug_print("Row::constructor: zeroing memory");
|
||||
arrayops::fill_zeros(Mat<eT>::memptr(), Mat<eT>::n_elem);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -72,6 +88,71 @@ Row<eT>::Row(const SizeMat& s)
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
Mat<eT>::init_warm(s.n_rows, s.n_cols);
|
||||
|
||||
#if (!defined(ARMA_DONT_ZERO_INIT))
|
||||
{
|
||||
arma_extra_debug_print("Row::constructor: zeroing memory");
|
||||
arrayops::fill_zeros(Mat<eT>::memptr(), Mat<eT>::n_elem);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
//! internal use only
|
||||
template<typename eT>
|
||||
template<bool do_zeros>
|
||||
inline
|
||||
Row<eT>::Row(const uword in_n_elem, const arma_initmode_indicator<do_zeros>&)
|
||||
: Mat<eT>(arma_vec_indicator(), 1, in_n_elem, 2)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
if(do_zeros)
|
||||
{
|
||||
arma_extra_debug_print("Row::constructor: zeroing memory");
|
||||
arrayops::fill_zeros(Mat<eT>::memptr(), Mat<eT>::n_elem);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//! internal use only
|
||||
template<typename eT>
|
||||
template<bool do_zeros>
|
||||
inline
|
||||
Row<eT>::Row(const uword in_n_rows, const uword in_n_cols, const arma_initmode_indicator<do_zeros>&)
|
||||
: Mat<eT>(arma_vec_indicator(), 0, 0, 2)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
Mat<eT>::init_warm(in_n_rows, in_n_cols);
|
||||
|
||||
if(do_zeros)
|
||||
{
|
||||
arma_extra_debug_print("Row::constructor: zeroing memory");
|
||||
arrayops::fill_zeros(Mat<eT>::memptr(), Mat<eT>::n_elem);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//! internal use only
|
||||
template<typename eT>
|
||||
template<bool do_zeros>
|
||||
inline
|
||||
Row<eT>::Row(const SizeMat& s, const arma_initmode_indicator<do_zeros>&)
|
||||
: Mat<eT>(arma_vec_indicator(), 0, 0, 2)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
Mat<eT>::init_warm(s.n_rows, s.n_cols);
|
||||
|
||||
if(do_zeros)
|
||||
{
|
||||
arma_extra_debug_print("Row::constructor: zeroing memory");
|
||||
arrayops::fill_zeros(Mat<eT>::memptr(), Mat<eT>::n_elem);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -119,6 +200,46 @@ Row<eT>::Row(const SizeMat& s, const fill::fill_class<fill_type>& f)
|
||||
|
||||
|
||||
|
||||
template<typename eT>
|
||||
inline
|
||||
Row<eT>::Row(const uword in_n_elem, const fill::scalar_holder<eT> f)
|
||||
: Mat<eT>(arma_vec_indicator(), 1, in_n_elem, 2)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
(*this).fill(f.scalar);
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename eT>
|
||||
inline
|
||||
Row<eT>::Row(const uword in_n_rows, const uword in_n_cols, const fill::scalar_holder<eT> f)
|
||||
: Mat<eT>(arma_vec_indicator(), 0, 0, 2)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
Mat<eT>::init_warm(in_n_rows, in_n_cols);
|
||||
|
||||
(*this).fill(f.scalar);
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename eT>
|
||||
inline
|
||||
Row<eT>::Row(const SizeMat& s, const fill::scalar_holder<eT> f)
|
||||
: Mat<eT>(arma_vec_indicator(), 0, 0, 2)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
Mat<eT>::init_warm(s.n_rows, s.n_cols);
|
||||
|
||||
(*this).fill(f.scalar);
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename eT>
|
||||
inline
|
||||
Row<eT>::Row(const char* text)
|
||||
@@ -221,102 +342,100 @@ Row<eT>::operator=(const std::vector<eT>& x)
|
||||
|
||||
|
||||
|
||||
#if defined(ARMA_USE_CXX11)
|
||||
template<typename eT>
|
||||
inline
|
||||
Row<eT>::Row(const std::initializer_list<eT>& list)
|
||||
: Mat<eT>(arma_vec_indicator(), 2)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
template<typename eT>
|
||||
inline
|
||||
Row<eT>::Row(const std::initializer_list<eT>& list)
|
||||
: Mat<eT>(arma_vec_indicator(), 2)
|
||||
(*this).operator=(list);
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename eT>
|
||||
inline
|
||||
Row<eT>&
|
||||
Row<eT>::operator=(const std::initializer_list<eT>& list)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
Mat<eT> tmp(list);
|
||||
|
||||
arma_debug_check( ((tmp.n_elem > 0) && (tmp.is_vec() == false)), "Mat::init(): requested size is not compatible with row vector layout" );
|
||||
|
||||
access::rw(tmp.n_rows) = 1;
|
||||
access::rw(tmp.n_cols) = tmp.n_elem;
|
||||
|
||||
(*this).steal_mem(tmp);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename eT>
|
||||
inline
|
||||
Row<eT>::Row(Row<eT>&& X)
|
||||
: Mat<eT>(arma_vec_indicator(), 2)
|
||||
{
|
||||
arma_extra_debug_sigprint(arma_str::format("this = %x X = %x") % this % &X);
|
||||
|
||||
access::rw(Mat<eT>::n_rows) = 1;
|
||||
access::rw(Mat<eT>::n_cols) = X.n_cols;
|
||||
access::rw(Mat<eT>::n_elem) = X.n_elem;
|
||||
access::rw(Mat<eT>::n_alloc) = X.n_alloc;
|
||||
|
||||
if( (X.n_alloc > arma_config::mat_prealloc) || (X.mem_state == 1) || (X.mem_state == 2) )
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
access::rw(Mat<eT>::mem_state) = X.mem_state;
|
||||
access::rw(Mat<eT>::mem) = X.mem;
|
||||
|
||||
(*this).operator=(list);
|
||||
access::rw(X.n_rows) = 1;
|
||||
access::rw(X.n_cols) = 0;
|
||||
access::rw(X.n_elem) = 0;
|
||||
access::rw(X.n_alloc) = 0;
|
||||
access::rw(X.mem_state) = 0;
|
||||
access::rw(X.mem) = nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename eT>
|
||||
inline
|
||||
Row<eT>&
|
||||
Row<eT>::operator=(const std::initializer_list<eT>& list)
|
||||
else // condition: (X.n_alloc <= arma_config::mat_prealloc) || (X.mem_state == 0) || (X.mem_state == 3)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
(*this).init_cold();
|
||||
|
||||
Mat<eT> tmp(list);
|
||||
arrayops::copy( (*this).memptr(), X.mem, X.n_elem );
|
||||
|
||||
arma_debug_check( ((tmp.n_elem > 0) && (tmp.is_vec() == false)), "Mat::init(): requested size is not compatible with row vector layout" );
|
||||
|
||||
access::rw(tmp.n_rows) = 1;
|
||||
access::rw(tmp.n_cols) = tmp.n_elem;
|
||||
|
||||
(*this).steal_mem(tmp);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename eT>
|
||||
inline
|
||||
Row<eT>::Row(Row<eT>&& X)
|
||||
: Mat<eT>(arma_vec_indicator(), 2)
|
||||
{
|
||||
arma_extra_debug_sigprint(arma_str::format("this = %x X = %x") % this % &X);
|
||||
|
||||
access::rw(Mat<eT>::n_rows) = 1;
|
||||
access::rw(Mat<eT>::n_cols) = X.n_cols;
|
||||
access::rw(Mat<eT>::n_elem) = X.n_elem;
|
||||
|
||||
if( ((X.mem_state == 0) && (X.n_elem > arma_config::mat_prealloc)) || (X.mem_state == 1) || (X.mem_state == 2) )
|
||||
if( (X.mem_state == 0) && (X.n_alloc <= arma_config::mat_prealloc) )
|
||||
{
|
||||
access::rw(Mat<eT>::mem_state) = X.mem_state;
|
||||
access::rw(Mat<eT>::mem) = X.mem;
|
||||
|
||||
access::rw(X.n_rows) = 1;
|
||||
access::rw(X.n_cols) = 0;
|
||||
access::rw(X.n_elem) = 0;
|
||||
access::rw(X.mem_state) = 0;
|
||||
access::rw(X.mem) = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
(*this).init_cold();
|
||||
|
||||
arrayops::copy( (*this).memptr(), X.mem, X.n_elem );
|
||||
|
||||
if( (X.mem_state == 0) && (X.n_elem <= arma_config::mat_prealloc) )
|
||||
{
|
||||
access::rw(X.n_rows) = 1;
|
||||
access::rw(X.n_cols) = 0;
|
||||
access::rw(X.n_elem) = 0;
|
||||
access::rw(X.mem) = 0;
|
||||
}
|
||||
access::rw(X.n_rows) = 1;
|
||||
access::rw(X.n_cols) = 0;
|
||||
access::rw(X.n_elem) = 0;
|
||||
access::rw(X.mem) = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename eT>
|
||||
inline
|
||||
Row<eT>&
|
||||
Row<eT>::operator=(Row<eT>&& X)
|
||||
{
|
||||
arma_extra_debug_sigprint(arma_str::format("this = %x X = %x") % this % &X);
|
||||
|
||||
(*this).steal_mem(X);
|
||||
|
||||
|
||||
template<typename eT>
|
||||
inline
|
||||
Row<eT>&
|
||||
Row<eT>::operator=(Row<eT>&& X)
|
||||
if( (X.mem_state == 0) && (X.n_alloc <= arma_config::mat_prealloc) && (this != &X) )
|
||||
{
|
||||
arma_extra_debug_sigprint(arma_str::format("this = %x X = %x") % this % &X);
|
||||
|
||||
(*this).steal_mem(X);
|
||||
|
||||
if( (X.mem_state == 0) && (X.n_elem <= arma_config::mat_prealloc) && (this != &X) )
|
||||
{
|
||||
access::rw(X.n_rows) = 1;
|
||||
access::rw(X.n_cols) = 0;
|
||||
access::rw(X.n_elem) = 0;
|
||||
access::rw(X.mem) = 0;
|
||||
}
|
||||
|
||||
return *this;
|
||||
access::rw(X.n_rows) = 1;
|
||||
access::rw(X.n_cols) = 0;
|
||||
access::rw(X.n_elem) = 0;
|
||||
access::rw(X.mem) = nullptr;
|
||||
}
|
||||
|
||||
#endif
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -506,6 +625,7 @@ Row<eT>::operator=(const subview_cube<eT>& X)
|
||||
|
||||
template<typename eT>
|
||||
inline
|
||||
arma_deprecated
|
||||
mat_injector< Row<eT> >
|
||||
Row<eT>::operator<<(const eT val)
|
||||
{
|
||||
@@ -516,6 +636,7 @@ Row<eT>::operator<<(const eT val)
|
||||
|
||||
template<typename eT>
|
||||
arma_inline
|
||||
arma_warn_unused
|
||||
const Op<Row<eT>,op_htrans>
|
||||
Row<eT>::t() const
|
||||
{
|
||||
@@ -526,6 +647,7 @@ Row<eT>::t() const
|
||||
|
||||
template<typename eT>
|
||||
arma_inline
|
||||
arma_warn_unused
|
||||
const Op<Row<eT>,op_htrans>
|
||||
Row<eT>::ht() const
|
||||
{
|
||||
@@ -536,6 +658,7 @@ Row<eT>::ht() const
|
||||
|
||||
template<typename eT>
|
||||
arma_inline
|
||||
arma_warn_unused
|
||||
const Op<Row<eT>,op_strans>
|
||||
Row<eT>::st() const
|
||||
{
|
||||
@@ -546,6 +669,7 @@ Row<eT>::st() const
|
||||
|
||||
template<typename eT>
|
||||
arma_inline
|
||||
arma_warn_unused
|
||||
const Op<Row<eT>,op_strans>
|
||||
Row<eT>::as_col() const
|
||||
{
|
||||
@@ -561,7 +685,7 @@ Row<eT>::col(const uword in_col1)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
arma_debug_check( (in_col1 >= Mat<eT>::n_cols), "Row::col(): indices out of bounds or incorrectly used");
|
||||
arma_debug_check_bounds( (in_col1 >= Mat<eT>::n_cols), "Row::col(): indices out of bounds or incorrectly used" );
|
||||
|
||||
return subview_row<eT>(*this, 0, in_col1, 1);
|
||||
}
|
||||
@@ -575,7 +699,7 @@ Row<eT>::col(const uword in_col1) const
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
arma_debug_check( (in_col1 >= Mat<eT>::n_cols), "Row::col(): indices out of bounds or incorrectly used");
|
||||
arma_debug_check_bounds( (in_col1 >= Mat<eT>::n_cols), "Row::col(): indices out of bounds or incorrectly used" );
|
||||
|
||||
return subview_row<eT>(*this, 0, in_col1, 1);
|
||||
}
|
||||
@@ -589,7 +713,7 @@ Row<eT>::cols(const uword in_col1, const uword in_col2)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
arma_debug_check( ( (in_col1 > in_col2) || (in_col2 >= Mat<eT>::n_cols) ), "Row::cols(): indices out of bounds or incorrectly used");
|
||||
arma_debug_check_bounds( ( (in_col1 > in_col2) || (in_col2 >= Mat<eT>::n_cols) ), "Row::cols(): indices out of bounds or incorrectly used" );
|
||||
|
||||
const uword subview_n_cols = in_col2 - in_col1 + 1;
|
||||
|
||||
@@ -605,7 +729,7 @@ Row<eT>::cols(const uword in_col1, const uword in_col2) const
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
arma_debug_check( ( (in_col1 > in_col2) || (in_col2 >= Mat<eT>::n_cols) ), "Row::cols(): indices out of bounds or incorrectly used");
|
||||
arma_debug_check_bounds( ( (in_col1 > in_col2) || (in_col2 >= Mat<eT>::n_cols) ), "Row::cols(): indices out of bounds or incorrectly used" );
|
||||
|
||||
const uword subview_n_cols = in_col2 - in_col1 + 1;
|
||||
|
||||
@@ -621,7 +745,7 @@ Row<eT>::subvec(const uword in_col1, const uword in_col2)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
arma_debug_check( ( (in_col1 > in_col2) || (in_col2 >= Mat<eT>::n_cols) ), "Row::subvec(): indices out of bounds or incorrectly used");
|
||||
arma_debug_check_bounds( ( (in_col1 > in_col2) || (in_col2 >= Mat<eT>::n_cols) ), "Row::subvec(): indices out of bounds or incorrectly used" );
|
||||
|
||||
const uword subview_n_cols = in_col2 - in_col1 + 1;
|
||||
|
||||
@@ -637,7 +761,7 @@ Row<eT>::subvec(const uword in_col1, const uword in_col2) const
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
arma_debug_check( ( (in_col1 > in_col2) || (in_col2 >= Mat<eT>::n_cols) ), "Row::subvec(): indices out of bounds or incorrectly used");
|
||||
arma_debug_check_bounds( ( (in_col1 > in_col2) || (in_col2 >= Mat<eT>::n_cols) ), "Row::subvec(): indices out of bounds or incorrectly used" );
|
||||
|
||||
const uword subview_n_cols = in_col2 - in_col1 + 1;
|
||||
|
||||
@@ -685,7 +809,7 @@ Row<eT>::subvec(const span& col_span)
|
||||
const uword in_col2 = col_span.b;
|
||||
const uword subvec_n_cols = col_all ? local_n_cols : in_col2 - in_col1 + 1;
|
||||
|
||||
arma_debug_check( ( col_all ? false : ((in_col1 > in_col2) || (in_col2 >= local_n_cols)) ), "Row::subvec(): indices out of bounds or incorrectly used");
|
||||
arma_debug_check_bounds( ( col_all ? false : ((in_col1 > in_col2) || (in_col2 >= local_n_cols)) ), "Row::subvec(): indices out of bounds or incorrectly used" );
|
||||
|
||||
return subview_row<eT>(*this, 0, in_col1, subvec_n_cols);
|
||||
}
|
||||
@@ -707,7 +831,7 @@ Row<eT>::subvec(const span& col_span) const
|
||||
const uword in_col2 = col_span.b;
|
||||
const uword subvec_n_cols = col_all ? local_n_cols : in_col2 - in_col1 + 1;
|
||||
|
||||
arma_debug_check( ( col_all ? false : ((in_col1 > in_col2) || (in_col2 >= local_n_cols)) ), "Row::subvec(): indices out of bounds or incorrectly used");
|
||||
arma_debug_check_bounds( ( col_all ? false : ((in_col1 > in_col2) || (in_col2 >= local_n_cols)) ), "Row::subvec(): indices out of bounds or incorrectly used" );
|
||||
|
||||
return subview_row<eT>(*this, 0, in_col1, subvec_n_cols);
|
||||
}
|
||||
@@ -747,7 +871,7 @@ Row<eT>::subvec(const uword start_col, const SizeMat& s)
|
||||
|
||||
arma_debug_check( (s.n_rows != 1), "Row::subvec(): given size does not specify a row vector" );
|
||||
|
||||
arma_debug_check( ( (start_col >= Mat<eT>::n_cols) || ((start_col + s.n_cols) > Mat<eT>::n_cols) ), "Row::subvec(): size out of bounds" );
|
||||
arma_debug_check_bounds( ( (start_col >= Mat<eT>::n_cols) || ((start_col + s.n_cols) > Mat<eT>::n_cols) ), "Row::subvec(): size out of bounds" );
|
||||
|
||||
return subview_row<eT>(*this, 0, start_col, s.n_cols);
|
||||
}
|
||||
@@ -763,7 +887,7 @@ Row<eT>::subvec(const uword start_col, const SizeMat& s) const
|
||||
|
||||
arma_debug_check( (s.n_rows != 1), "Row::subvec(): given size does not specify a row vector" );
|
||||
|
||||
arma_debug_check( ( (start_col >= Mat<eT>::n_cols) || ((start_col + s.n_cols) > Mat<eT>::n_cols) ), "Row::subvec(): size out of bounds" );
|
||||
arma_debug_check_bounds( ( (start_col >= Mat<eT>::n_cols) || ((start_col + s.n_cols) > Mat<eT>::n_cols) ), "Row::subvec(): size out of bounds" );
|
||||
|
||||
return subview_row<eT>(*this, 0, start_col, s.n_cols);
|
||||
}
|
||||
@@ -777,7 +901,7 @@ Row<eT>::head(const uword N)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
arma_debug_check( (N > Mat<eT>::n_cols), "Row::head(): size out of bounds");
|
||||
arma_debug_check_bounds( (N > Mat<eT>::n_cols), "Row::head(): size out of bounds" );
|
||||
|
||||
return subview_row<eT>(*this, 0, 0, N);
|
||||
}
|
||||
@@ -791,7 +915,7 @@ Row<eT>::head(const uword N) const
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
arma_debug_check( (N > Mat<eT>::n_cols), "Row::head(): size out of bounds");
|
||||
arma_debug_check_bounds( (N > Mat<eT>::n_cols), "Row::head(): size out of bounds" );
|
||||
|
||||
return subview_row<eT>(*this, 0, 0, N);
|
||||
}
|
||||
@@ -805,7 +929,7 @@ Row<eT>::tail(const uword N)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
arma_debug_check( (N > Mat<eT>::n_cols), "Row::tail(): size out of bounds");
|
||||
arma_debug_check_bounds( (N > Mat<eT>::n_cols), "Row::tail(): size out of bounds" );
|
||||
|
||||
const uword start_col = Mat<eT>::n_cols - N;
|
||||
|
||||
@@ -821,7 +945,7 @@ Row<eT>::tail(const uword N) const
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
arma_debug_check( (N > Mat<eT>::n_cols), "Row::tail(): size out of bounds");
|
||||
arma_debug_check_bounds( (N > Mat<eT>::n_cols), "Row::tail(): size out of bounds" );
|
||||
|
||||
const uword start_col = Mat<eT>::n_cols - N;
|
||||
|
||||
@@ -886,7 +1010,7 @@ Row<eT>::shed_col(const uword col_num)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
arma_debug_check( col_num >= Mat<eT>::n_cols, "Row::shed_col(): index out of bounds");
|
||||
arma_debug_check_bounds( col_num >= Mat<eT>::n_cols, "Row::shed_col(): index out of bounds" );
|
||||
|
||||
shed_cols(col_num, col_num);
|
||||
}
|
||||
@@ -901,7 +1025,7 @@ Row<eT>::shed_cols(const uword in_col1, const uword in_col2)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
arma_debug_check
|
||||
arma_debug_check_bounds
|
||||
(
|
||||
(in_col1 > in_col2) || (in_col2 >= Mat<eT>::n_cols),
|
||||
"Row::shed_cols(): indices out of bounds or incorrectly used"
|
||||
@@ -910,7 +1034,7 @@ Row<eT>::shed_cols(const uword in_col1, const uword in_col2)
|
||||
const uword n_keep_front = in_col1;
|
||||
const uword n_keep_back = Mat<eT>::n_cols - (in_col2 + 1);
|
||||
|
||||
Row<eT> X(n_keep_front + n_keep_back);
|
||||
Row<eT> X(n_keep_front + n_keep_back, arma_nozeros_indicator());
|
||||
|
||||
eT* X_mem = X.memptr();
|
||||
const eT* t_mem = (*this).memptr();
|
||||
@@ -959,11 +1083,11 @@ Row<eT>::insert_cols(const uword col_num, const uword N, const bool set_to_zero)
|
||||
const uword B_n_cols = t_n_cols - col_num;
|
||||
|
||||
// insertion at col_num == n_cols is in effect an append operation
|
||||
arma_debug_check( (col_num > t_n_cols), "Row::insert_cols(): index out of bounds");
|
||||
arma_debug_check_bounds( (col_num > t_n_cols), "Row::insert_cols(): index out of bounds" );
|
||||
|
||||
if(N > 0)
|
||||
{
|
||||
Row<eT> out(t_n_cols + N);
|
||||
Row<eT> out(t_n_cols + N, arma_nozeros_indicator());
|
||||
|
||||
eT* out_mem = out.memptr();
|
||||
const eT* t_mem = (*this).memptr();
|
||||
@@ -1055,7 +1179,7 @@ Row<eT>::begin_row(const uword row_num)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
arma_debug_check( (row_num >= Mat<eT>::n_rows), "Row::begin_row(): index out of bounds");
|
||||
arma_debug_check_bounds( (row_num >= Mat<eT>::n_rows), "Row::begin_row(): index out of bounds" );
|
||||
|
||||
return Mat<eT>::memptr();
|
||||
}
|
||||
@@ -1069,7 +1193,7 @@ Row<eT>::begin_row(const uword row_num) const
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
arma_debug_check( (row_num >= Mat<eT>::n_rows), "Row::begin_row(): index out of bounds");
|
||||
arma_debug_check_bounds( (row_num >= Mat<eT>::n_rows), "Row::begin_row(): index out of bounds" );
|
||||
|
||||
return Mat<eT>::memptr();
|
||||
}
|
||||
@@ -1083,7 +1207,7 @@ Row<eT>::end_row(const uword row_num)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
arma_debug_check( (row_num >= Mat<eT>::n_rows), "Row::end_row(): index out of bounds");
|
||||
arma_debug_check_bounds( (row_num >= Mat<eT>::n_rows), "Row::end_row(): index out of bounds" );
|
||||
|
||||
return Mat<eT>::memptr() + Mat<eT>::n_cols;
|
||||
}
|
||||
@@ -1097,7 +1221,7 @@ Row<eT>::end_row(const uword row_num) const
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
arma_debug_check( (row_num >= Mat<eT>::n_rows), "Row::end_row(): index out of bounds");
|
||||
arma_debug_check_bounds( (row_num >= Mat<eT>::n_rows), "Row::end_row(): index out of bounds" );
|
||||
|
||||
return Mat<eT>::memptr() + Mat<eT>::n_cols;
|
||||
}
|
||||
@@ -1111,6 +1235,16 @@ Row<eT>::fixed<fixed_n_elem>::fixed()
|
||||
: Row<eT>( arma_fixed_indicator(), fixed_n_elem, ((use_extra) ? mem_local_extra : Mat<eT>::mem_local) )
|
||||
{
|
||||
arma_extra_debug_sigprint_this(this);
|
||||
|
||||
#if (!defined(ARMA_DONT_ZERO_INIT))
|
||||
{
|
||||
arma_extra_debug_print("Row::fixed::constructor: zeroing memory");
|
||||
|
||||
eT* mem_use = (use_extra) ? &(mem_local_extra[0]) : &(Mat<eT>::mem_local[0]);
|
||||
|
||||
arrayops::inplace_set_fixed<eT,fixed_n_elem>( mem_use, eT(0) );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -1144,6 +1278,19 @@ Row<eT>::fixed<fixed_n_elem>::fixed(const subview_cube<eT>& X)
|
||||
|
||||
|
||||
|
||||
template<typename eT>
|
||||
template<uword fixed_n_elem>
|
||||
inline
|
||||
Row<eT>::fixed<fixed_n_elem>::fixed(const fill::scalar_holder<eT> f)
|
||||
: Row<eT>( arma_fixed_indicator(), fixed_n_elem, ((use_extra) ? mem_local_extra : Mat<eT>::mem_local) )
|
||||
{
|
||||
arma_extra_debug_sigprint_this(this);
|
||||
|
||||
(*this).fill(f.scalar);
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename eT>
|
||||
template<uword fixed_n_elem>
|
||||
template<typename fill_type>
|
||||
@@ -1153,11 +1300,11 @@ Row<eT>::fixed<fixed_n_elem>::fixed(const fill::fill_class<fill_type>&)
|
||||
{
|
||||
arma_extra_debug_sigprint_this(this);
|
||||
|
||||
if(is_same_type<fill_type, fill::fill_zeros>::yes) (*this).zeros();
|
||||
if(is_same_type<fill_type, fill::fill_ones >::yes) (*this).ones();
|
||||
if(is_same_type<fill_type, fill::fill_eye >::yes) (*this).eye();
|
||||
if(is_same_type<fill_type, fill::fill_randu>::yes) (*this).randu();
|
||||
if(is_same_type<fill_type, fill::fill_randn>::yes) (*this).randn();
|
||||
if(is_same_type<fill_type, fill::fill_zeros>::yes) { (*this).zeros(); }
|
||||
if(is_same_type<fill_type, fill::fill_ones >::yes) { (*this).ones(); }
|
||||
if(is_same_type<fill_type, fill::fill_eye >::yes) { (*this).eye(); }
|
||||
if(is_same_type<fill_type, fill::fill_randu>::yes) { (*this).randu(); }
|
||||
if(is_same_type<fill_type, fill::fill_randn>::yes) { (*this).randn(); }
|
||||
}
|
||||
|
||||
|
||||
@@ -1302,43 +1449,39 @@ Row<eT>::fixed<fixed_n_elem>::operator=(const subview_cube<eT>& X)
|
||||
|
||||
|
||||
|
||||
#if defined(ARMA_USE_CXX11)
|
||||
template<typename eT>
|
||||
template<uword fixed_n_elem>
|
||||
inline
|
||||
Row<eT>::fixed<fixed_n_elem>::fixed(const std::initializer_list<eT>& list)
|
||||
: Row<eT>( arma_fixed_indicator(), fixed_n_elem, ((use_extra) ? mem_local_extra : Mat<eT>::mem_local) )
|
||||
{
|
||||
arma_extra_debug_sigprint_this(this);
|
||||
|
||||
template<typename eT>
|
||||
template<uword fixed_n_elem>
|
||||
inline
|
||||
Row<eT>::fixed<fixed_n_elem>::fixed(const std::initializer_list<eT>& list)
|
||||
: Row<eT>( arma_fixed_indicator(), fixed_n_elem, ((use_extra) ? mem_local_extra : Mat<eT>::mem_local) )
|
||||
{
|
||||
arma_extra_debug_sigprint_this(this);
|
||||
|
||||
(*this).operator=(list);
|
||||
}
|
||||
(*this).operator=(list);
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename eT>
|
||||
template<uword fixed_n_elem>
|
||||
inline
|
||||
Row<eT>&
|
||||
Row<eT>::fixed<fixed_n_elem>::operator=(const std::initializer_list<eT>& list)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
const uword N = uword(list.size());
|
||||
|
||||
arma_debug_check( (N > fixed_n_elem), "Row::fixed: initialiser list is too long" );
|
||||
|
||||
template<typename eT>
|
||||
template<uword fixed_n_elem>
|
||||
inline
|
||||
Row<eT>&
|
||||
Row<eT>::fixed<fixed_n_elem>::operator=(const std::initializer_list<eT>& list)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
const uword N = uword(list.size());
|
||||
|
||||
arma_debug_check( (N > fixed_n_elem), "Row::fixed: initialiser list is too long" );
|
||||
|
||||
eT* this_mem = (*this).memptr();
|
||||
|
||||
arrayops::copy( this_mem, list.begin(), N );
|
||||
|
||||
for(uword iq=N; iq < fixed_n_elem; ++iq) { this_mem[iq] = eT(0); }
|
||||
|
||||
return *this;
|
||||
}
|
||||
eT* this_mem = (*this).memptr();
|
||||
|
||||
#endif
|
||||
arrayops::copy( this_mem, list.begin(), N );
|
||||
|
||||
for(uword iq=N; iq < fixed_n_elem; ++iq) { this_mem[iq] = eT(0); }
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1442,6 +1585,7 @@ Row<eT>::fixed<fixed_n_elem>::operator=(const fixed<fixed_n_elem>& X)
|
||||
template<typename eT>
|
||||
template<uword fixed_n_elem>
|
||||
arma_inline
|
||||
arma_warn_unused
|
||||
const Op< typename Row<eT>::template fixed<fixed_n_elem>::Row_fixed_type, op_htrans >
|
||||
Row<eT>::fixed<fixed_n_elem>::t() const
|
||||
{
|
||||
@@ -1453,6 +1597,7 @@ Row<eT>::fixed<fixed_n_elem>::t() const
|
||||
template<typename eT>
|
||||
template<uword fixed_n_elem>
|
||||
arma_inline
|
||||
arma_warn_unused
|
||||
const Op< typename Row<eT>::template fixed<fixed_n_elem>::Row_fixed_type, op_htrans >
|
||||
Row<eT>::fixed<fixed_n_elem>::ht() const
|
||||
{
|
||||
@@ -1464,6 +1609,7 @@ Row<eT>::fixed<fixed_n_elem>::ht() const
|
||||
template<typename eT>
|
||||
template<uword fixed_n_elem>
|
||||
arma_inline
|
||||
arma_warn_unused
|
||||
const Op< typename Row<eT>::template fixed<fixed_n_elem>::Row_fixed_type, op_strans >
|
||||
Row<eT>::fixed<fixed_n_elem>::st() const
|
||||
{
|
||||
@@ -1549,7 +1695,7 @@ arma_warn_unused
|
||||
eT&
|
||||
Row<eT>::fixed<fixed_n_elem>::operator() (const uword ii)
|
||||
{
|
||||
arma_debug_check( (ii >= fixed_n_elem), "Row::operator(): index out of bounds");
|
||||
arma_debug_check_bounds( (ii >= fixed_n_elem), "Row::operator(): index out of bounds" );
|
||||
|
||||
return (use_extra) ? mem_local_extra[ii] : Mat<eT>::mem_local[ii];
|
||||
}
|
||||
@@ -1563,7 +1709,7 @@ arma_warn_unused
|
||||
const eT&
|
||||
Row<eT>::fixed<fixed_n_elem>::operator() (const uword ii) const
|
||||
{
|
||||
arma_debug_check( (ii >= fixed_n_elem), "Row::operator(): index out of bounds");
|
||||
arma_debug_check_bounds( (ii >= fixed_n_elem), "Row::operator(): index out of bounds" );
|
||||
|
||||
return (use_extra) ? mem_local_extra[ii] : Mat<eT>::mem_local[ii];
|
||||
}
|
||||
@@ -1601,7 +1747,7 @@ arma_warn_unused
|
||||
eT&
|
||||
Row<eT>::fixed<fixed_n_elem>::operator() (const uword in_row, const uword in_col)
|
||||
{
|
||||
arma_debug_check( ((in_row > 0) || (in_col >= fixed_n_elem)), "Row::operator(): index out of bounds" );
|
||||
arma_debug_check_bounds( ((in_row > 0) || (in_col >= fixed_n_elem)), "Row::operator(): index out of bounds" );
|
||||
|
||||
return (use_extra) ? mem_local_extra[in_col] : Mat<eT>::mem_local[in_col];
|
||||
}
|
||||
@@ -1615,7 +1761,7 @@ arma_warn_unused
|
||||
const eT&
|
||||
Row<eT>::fixed<fixed_n_elem>::operator() (const uword in_row, const uword in_col) const
|
||||
{
|
||||
arma_debug_check( ((in_row > 0) || (in_col >= fixed_n_elem)), "Row::operator(): index out of bounds" );
|
||||
arma_debug_check_bounds( ((in_row > 0) || (in_col >= fixed_n_elem)), "Row::operator(): index out of bounds" );
|
||||
|
||||
return (use_extra) ? mem_local_extra[in_col] : Mat<eT>::mem_local[in_col];
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
// Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
//
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
// Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
//
|
||||
@@ -51,7 +53,7 @@ SizeCube::operator()(const uword dim) const
|
||||
if(dim == 1) { return n_cols; }
|
||||
if(dim == 2) { return n_slices; }
|
||||
|
||||
arma_debug_check(true, "size(): index out of bounds");
|
||||
arma_debug_check_bounds(true, "size(): index out of bounds");
|
||||
|
||||
return uword(1);
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
// Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
//
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
// Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
//
|
||||
@@ -48,7 +50,7 @@ SizeMat::operator()(const uword dim) const
|
||||
if(dim == 0) { return n_rows; }
|
||||
if(dim == 1) { return n_cols; }
|
||||
|
||||
arma_debug_check(true, "size(): index out of bounds");
|
||||
arma_debug_check_bounds(true, "size(): index out of bounds");
|
||||
|
||||
return uword(1);
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
// Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
//
|
||||
@@ -22,14 +24,14 @@
|
||||
template<typename elem_type, typename derived>
|
||||
struct SpBase_eval_SpMat
|
||||
{
|
||||
inline const derived& eval() const;
|
||||
inline arma_warn_unused const derived& eval() const;
|
||||
};
|
||||
|
||||
|
||||
template<typename elem_type, typename derived>
|
||||
struct SpBase_eval_expr
|
||||
{
|
||||
inline SpMat<elem_type> eval() const; //!< force the immediate evaluation of a delayed expression
|
||||
inline arma_warn_unused SpMat<elem_type> eval() const; //!< force the immediate evaluation of a delayed expression
|
||||
};
|
||||
|
||||
|
||||
@@ -52,9 +54,9 @@ struct SpBase
|
||||
|
||||
arma_inline bool is_alias(const SpMat<elem_type>& X) const;
|
||||
|
||||
inline const SpOp<derived,spop_htrans> t() const; //!< Hermitian transpose
|
||||
inline const SpOp<derived,spop_htrans> ht() const; //!< Hermitian transpose
|
||||
inline const SpOp<derived,spop_strans> st() const; //!< simple transpose
|
||||
inline arma_warn_unused const SpOp<derived,spop_htrans> t() const; //!< Hermitian transpose
|
||||
inline arma_warn_unused const SpOp<derived,spop_htrans> ht() const; //!< Hermitian transpose
|
||||
inline arma_warn_unused const SpOp<derived,spop_strans> st() const; //!< simple transpose
|
||||
|
||||
arma_cold inline void print( const std::string extra_text = "") const;
|
||||
arma_cold inline void print(std::ostream& user_stream, const std::string extra_text = "") const;
|
||||
@@ -68,6 +70,9 @@ struct SpBase
|
||||
arma_cold inline void raw_print_dense( const std::string extra_text = "") const;
|
||||
arma_cold inline void raw_print_dense(std::ostream& user_stream, const std::string extra_text = "") const;
|
||||
|
||||
arma_cold inline void brief_print( const std::string extra_text = "") const;
|
||||
arma_cold inline void brief_print(std::ostream& user_stream, const std::string extra_text = "") const;
|
||||
|
||||
inline arma_warn_unused elem_type min() const;
|
||||
inline arma_warn_unused elem_type max() const;
|
||||
|
||||
@@ -100,9 +105,8 @@ struct SpBase
|
||||
inline arma_warn_unused bool has_inf() const;
|
||||
inline arma_warn_unused bool has_nan() const;
|
||||
|
||||
inline const SpOp<derived,spop_vectorise_col> as_col() const;
|
||||
inline const SpOp<derived,spop_vectorise_row> as_row() const;
|
||||
|
||||
inline arma_warn_unused const SpOp<derived,spop_vectorise_col> as_col() const;
|
||||
inline arma_warn_unused const SpOp<derived,spop_vectorise_row> as_row() const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
// Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
//
|
||||
@@ -41,6 +43,7 @@ SpBase<elem_type,derived>::is_alias(const SpMat<elem_type>& X) const
|
||||
|
||||
template<typename elem_type, typename derived>
|
||||
inline
|
||||
arma_warn_unused
|
||||
const SpOp<derived, spop_htrans>
|
||||
SpBase<elem_type,derived>::t() const
|
||||
{
|
||||
@@ -50,6 +53,7 @@ SpBase<elem_type,derived>::t() const
|
||||
|
||||
template<typename elem_type, typename derived>
|
||||
inline
|
||||
arma_warn_unused
|
||||
const SpOp<derived, spop_htrans>
|
||||
SpBase<elem_type,derived>::ht() const
|
||||
{
|
||||
@@ -60,6 +64,7 @@ SpBase<elem_type,derived>::ht() const
|
||||
|
||||
template<typename elem_type, typename derived>
|
||||
inline
|
||||
arma_warn_unused
|
||||
const SpOp<derived, spop_strans>
|
||||
SpBase<elem_type,derived>::st() const
|
||||
{
|
||||
@@ -74,9 +79,20 @@ inline
|
||||
void
|
||||
SpBase<elem_type,derived>::print(const std::string extra_text) const
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
const unwrap_spmat<derived> tmp( (*this).get_ref() );
|
||||
|
||||
tmp.M.impl_print(extra_text);
|
||||
if(extra_text.length() != 0)
|
||||
{
|
||||
const std::streamsize orig_width = get_cout_stream().width();
|
||||
|
||||
get_cout_stream() << extra_text << '\n';
|
||||
|
||||
get_cout_stream().width(orig_width);
|
||||
}
|
||||
|
||||
arma_ostream::print(get_cout_stream(), tmp.M, true);
|
||||
}
|
||||
|
||||
|
||||
@@ -87,9 +103,20 @@ inline
|
||||
void
|
||||
SpBase<elem_type,derived>::print(std::ostream& user_stream, const std::string extra_text) const
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
const unwrap_spmat<derived> tmp( (*this).get_ref() );
|
||||
|
||||
tmp.M.impl_print(user_stream, extra_text);
|
||||
if(extra_text.length() != 0)
|
||||
{
|
||||
const std::streamsize orig_width = user_stream.width();
|
||||
|
||||
user_stream << extra_text << '\n';
|
||||
|
||||
user_stream.width(orig_width);
|
||||
}
|
||||
|
||||
arma_ostream::print(user_stream, tmp.M, true);
|
||||
}
|
||||
|
||||
|
||||
@@ -100,9 +127,20 @@ inline
|
||||
void
|
||||
SpBase<elem_type,derived>::raw_print(const std::string extra_text) const
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
const unwrap_spmat<derived> tmp( (*this).get_ref() );
|
||||
|
||||
tmp.M.impl_raw_print(extra_text);
|
||||
if(extra_text.length() != 0)
|
||||
{
|
||||
const std::streamsize orig_width = get_cout_stream().width();
|
||||
|
||||
get_cout_stream() << extra_text << '\n';
|
||||
|
||||
get_cout_stream().width(orig_width);
|
||||
}
|
||||
|
||||
arma_ostream::print(get_cout_stream(), tmp.M, false);
|
||||
}
|
||||
|
||||
|
||||
@@ -113,9 +151,20 @@ inline
|
||||
void
|
||||
SpBase<elem_type,derived>::raw_print(std::ostream& user_stream, const std::string extra_text) const
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
const unwrap_spmat<derived> tmp( (*this).get_ref() );
|
||||
|
||||
tmp.M.impl_raw_print(user_stream, extra_text);
|
||||
if(extra_text.length() != 0)
|
||||
{
|
||||
const std::streamsize orig_width = user_stream.width();
|
||||
|
||||
user_stream << extra_text << '\n';
|
||||
|
||||
user_stream.width(orig_width);
|
||||
}
|
||||
|
||||
arma_ostream::print(user_stream, tmp.M, false);
|
||||
}
|
||||
|
||||
|
||||
@@ -126,9 +175,20 @@ inline
|
||||
void
|
||||
SpBase<elem_type, derived>::print_dense(const std::string extra_text) const
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
const unwrap_spmat<derived> tmp( (*this).get_ref() );
|
||||
|
||||
tmp.M.impl_print_dense(extra_text);
|
||||
if(extra_text.length() != 0)
|
||||
{
|
||||
const std::streamsize orig_width = get_cout_stream().width();
|
||||
|
||||
get_cout_stream() << extra_text << '\n';
|
||||
|
||||
get_cout_stream().width(orig_width);
|
||||
}
|
||||
|
||||
arma_ostream::print_dense(get_cout_stream(), tmp.M, true);
|
||||
}
|
||||
|
||||
|
||||
@@ -139,9 +199,20 @@ inline
|
||||
void
|
||||
SpBase<elem_type, derived>::print_dense(std::ostream& user_stream, const std::string extra_text) const
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
const unwrap_spmat<derived> tmp( (*this).get_ref() );
|
||||
|
||||
tmp.M.impl_print_dense(user_stream, extra_text);
|
||||
if(extra_text.length() != 0)
|
||||
{
|
||||
const std::streamsize orig_width = user_stream.width();
|
||||
|
||||
user_stream << extra_text << '\n';
|
||||
|
||||
user_stream.width(orig_width);
|
||||
}
|
||||
|
||||
arma_ostream::print_dense(user_stream, tmp.M, true);
|
||||
}
|
||||
|
||||
|
||||
@@ -152,9 +223,20 @@ inline
|
||||
void
|
||||
SpBase<elem_type, derived>::raw_print_dense(const std::string extra_text) const
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
const unwrap_spmat<derived> tmp( (*this).get_ref() );
|
||||
|
||||
tmp.M.impl_raw_print_dense(extra_text);
|
||||
if(extra_text.length() != 0)
|
||||
{
|
||||
const std::streamsize orig_width = get_cout_stream().width();
|
||||
|
||||
get_cout_stream() << extra_text << '\n';
|
||||
|
||||
get_cout_stream().width(orig_width);
|
||||
}
|
||||
|
||||
arma_ostream::print_dense(get_cout_stream(), tmp.M, false);
|
||||
}
|
||||
|
||||
|
||||
@@ -165,18 +247,78 @@ inline
|
||||
void
|
||||
SpBase<elem_type, derived>::raw_print_dense(std::ostream& user_stream, const std::string extra_text) const
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
const unwrap_spmat<derived> tmp( (*this).get_ref() );
|
||||
|
||||
tmp.M.impl_raw_print_dense(user_stream, extra_text);
|
||||
if(extra_text.length() != 0)
|
||||
{
|
||||
const std::streamsize orig_width = user_stream.width();
|
||||
|
||||
user_stream << extra_text << '\n';
|
||||
|
||||
user_stream.width(orig_width);
|
||||
}
|
||||
|
||||
arma_ostream::print_dense(user_stream, tmp.M, false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename elem_type, typename derived>
|
||||
arma_cold
|
||||
inline
|
||||
void
|
||||
SpBase<elem_type,derived>::brief_print(const std::string extra_text) const
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
const unwrap_spmat<derived> tmp( (*this).get_ref() );
|
||||
|
||||
if(extra_text.length() != 0)
|
||||
{
|
||||
const std::streamsize orig_width = get_cout_stream().width();
|
||||
|
||||
get_cout_stream() << extra_text << '\n';
|
||||
|
||||
get_cout_stream().width(orig_width);
|
||||
}
|
||||
|
||||
arma_ostream::brief_print(get_cout_stream(), tmp.M);
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename elem_type, typename derived>
|
||||
arma_cold
|
||||
inline
|
||||
void
|
||||
SpBase<elem_type,derived>::brief_print(std::ostream& user_stream, const std::string extra_text) const
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
const unwrap_spmat<derived> tmp( (*this).get_ref() );
|
||||
|
||||
if(extra_text.length() != 0)
|
||||
{
|
||||
const std::streamsize orig_width = user_stream.width();
|
||||
|
||||
user_stream << extra_text << '\n';
|
||||
|
||||
user_stream.width(orig_width);
|
||||
}
|
||||
|
||||
arma_ostream::brief_print(user_stream, tmp.M);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// extra functions defined in SpBase_eval_SpMat
|
||||
|
||||
template<typename elem_type, typename derived>
|
||||
inline
|
||||
arma_warn_unused
|
||||
const derived&
|
||||
SpBase_eval_SpMat<elem_type, derived>::eval() const
|
||||
{
|
||||
@@ -192,6 +334,7 @@ SpBase_eval_SpMat<elem_type, derived>::eval() const
|
||||
|
||||
template<typename elem_type, typename derived>
|
||||
inline
|
||||
arma_warn_unused
|
||||
SpMat<elem_type>
|
||||
SpBase_eval_expr<elem_type, derived>::eval() const
|
||||
{
|
||||
@@ -435,8 +578,8 @@ SpBase<elem_type,derived>::is_zero(const typename get_pod_type<elem_type>::resul
|
||||
const T val_real = access::tmp_real(val);
|
||||
const T val_imag = access::tmp_imag(val);
|
||||
|
||||
if(std::abs(val_real) > tol) { return false; }
|
||||
if(std::abs(val_imag) > tol) { return false; }
|
||||
if(eop_aux::arma_abs(val_real) > tol) { return false; }
|
||||
if(eop_aux::arma_abs(val_imag) > tol) { return false; }
|
||||
|
||||
++it;
|
||||
}
|
||||
@@ -445,7 +588,7 @@ SpBase<elem_type,derived>::is_zero(const typename get_pod_type<elem_type>::resul
|
||||
{
|
||||
while(it != it_end)
|
||||
{
|
||||
if(std::abs(*it) > tol) { return false; }
|
||||
if(eop_aux::arma_abs(*it) > tol) { return false; }
|
||||
|
||||
++it;
|
||||
}
|
||||
@@ -714,6 +857,7 @@ SpBase<elem_type,derived>::has_nan() const
|
||||
|
||||
template<typename elem_type, typename derived>
|
||||
inline
|
||||
arma_warn_unused
|
||||
const SpOp<derived,spop_vectorise_col>
|
||||
SpBase<elem_type, derived>::as_col() const
|
||||
{
|
||||
@@ -724,6 +868,7 @@ SpBase<elem_type, derived>::as_col() const
|
||||
|
||||
template<typename elem_type, typename derived>
|
||||
inline
|
||||
arma_warn_unused
|
||||
const SpOp<derived,spop_vectorise_row>
|
||||
SpBase<elem_type, derived>::as_row() const
|
||||
{
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
// Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
//
|
||||
@@ -27,9 +29,9 @@ class SpCol : public SpMat<eT>
|
||||
typedef eT elem_type;
|
||||
typedef typename get_pod_type<eT>::result pod_type;
|
||||
|
||||
static const bool is_row = false;
|
||||
static const bool is_col = true;
|
||||
static const bool is_xvec = false;
|
||||
static constexpr bool is_row = false;
|
||||
static constexpr bool is_col = true;
|
||||
static constexpr bool is_xvec = false;
|
||||
|
||||
|
||||
inline SpCol();
|
||||
@@ -54,9 +56,9 @@ class SpCol : public SpMat<eT>
|
||||
template<typename T1, typename T2>
|
||||
inline explicit SpCol(const SpBase<pod_type,T1>& A, const SpBase<pod_type,T2>& B);
|
||||
|
||||
inline const SpOp<SpCol<eT>,spop_htrans> t() const;
|
||||
inline const SpOp<SpCol<eT>,spop_htrans> ht() const;
|
||||
inline const SpOp<SpCol<eT>,spop_strans> st() const;
|
||||
inline arma_warn_unused const SpOp<SpCol<eT>,spop_htrans> t() const;
|
||||
inline arma_warn_unused const SpOp<SpCol<eT>,spop_htrans> ht() const;
|
||||
inline arma_warn_unused const SpOp<SpCol<eT>,spop_strans> st() const;
|
||||
|
||||
inline void shed_row (const uword row_num);
|
||||
inline void shed_rows(const uword in_row1, const uword in_row2);
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
// Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
//
|
||||
@@ -202,6 +204,7 @@ SpCol<eT>::SpCol
|
||||
|
||||
template<typename eT>
|
||||
inline
|
||||
arma_warn_unused
|
||||
const SpOp<SpCol<eT>,spop_htrans>
|
||||
SpCol<eT>::t() const
|
||||
{
|
||||
@@ -212,6 +215,7 @@ SpCol<eT>::t() const
|
||||
|
||||
template<typename eT>
|
||||
inline
|
||||
arma_warn_unused
|
||||
const SpOp<SpCol<eT>,spop_htrans>
|
||||
SpCol<eT>::ht() const
|
||||
{
|
||||
@@ -222,6 +226,7 @@ SpCol<eT>::ht() const
|
||||
|
||||
template<typename eT>
|
||||
inline
|
||||
arma_warn_unused
|
||||
const SpOp<SpCol<eT>,spop_strans>
|
||||
SpCol<eT>::st() const
|
||||
{
|
||||
@@ -238,7 +243,7 @@ SpCol<eT>::shed_row(const uword row_num)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
arma_debug_check( row_num >= SpMat<eT>::n_rows, "SpCol::shed_row(): out of bounds");
|
||||
arma_debug_check_bounds( row_num >= SpMat<eT>::n_rows, "SpCol::shed_row(): out of bounds" );
|
||||
|
||||
shed_rows(row_num, row_num);
|
||||
}
|
||||
@@ -253,7 +258,7 @@ SpCol<eT>::shed_rows(const uword in_row1, const uword in_row2)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
arma_debug_check
|
||||
arma_debug_check_bounds
|
||||
(
|
||||
(in_row1 > in_row2) || (in_row2 >= SpMat<eT>::n_rows),
|
||||
"SpCol::shed_rows(): indices out of bounds or incorrectly used"
|
||||
@@ -269,14 +274,14 @@ SpCol<eT>::shed_rows(const uword in_row1, const uword in_row2)
|
||||
for(uword i = 0; i < SpMat<eT>::n_nonzero; ++i)
|
||||
{
|
||||
// Start position found?
|
||||
if (SpMat<eT>::row_indices[i] >= in_row1 && !start_found)
|
||||
if(SpMat<eT>::row_indices[i] >= in_row1 && !start_found)
|
||||
{
|
||||
start = i;
|
||||
start_found = true;
|
||||
}
|
||||
|
||||
// End position found?
|
||||
if (SpMat<eT>::row_indices[i] > in_row2)
|
||||
if(SpMat<eT>::row_indices[i] > in_row2)
|
||||
{
|
||||
end = i;
|
||||
end_found = true;
|
||||
@@ -284,13 +289,13 @@ SpCol<eT>::shed_rows(const uword in_row1, const uword in_row2)
|
||||
}
|
||||
}
|
||||
|
||||
if (!end_found)
|
||||
if(!end_found)
|
||||
{
|
||||
end = SpMat<eT>::n_nonzero;
|
||||
}
|
||||
|
||||
// Now we can make the copy.
|
||||
if (start != end)
|
||||
if(start != end)
|
||||
{
|
||||
const uword elem_diff = end - start;
|
||||
|
||||
@@ -298,14 +303,14 @@ SpCol<eT>::shed_rows(const uword in_row1, const uword in_row2)
|
||||
uword* new_row_indices = memory::acquire<uword>(SpMat<eT>::n_nonzero - elem_diff);
|
||||
|
||||
// Copy before the section we are dropping (if it exists).
|
||||
if (start > 0)
|
||||
if(start > 0)
|
||||
{
|
||||
arrayops::copy(new_values, SpMat<eT>::values, start);
|
||||
arrayops::copy(new_row_indices, SpMat<eT>::row_indices, start);
|
||||
}
|
||||
|
||||
// Copy after the section we are dropping (if it exists).
|
||||
if (end != SpMat<eT>::n_nonzero)
|
||||
if(end != SpMat<eT>::n_nonzero)
|
||||
{
|
||||
arrayops::copy(new_values + start, SpMat<eT>::values + end, (SpMat<eT>::n_nonzero - end));
|
||||
arrayops::copy(new_row_indices + start, SpMat<eT>::row_indices + end, (SpMat<eT>::n_nonzero - end));
|
||||
@@ -341,11 +346,11 @@ SpCol<eT>::shed_rows(const uword in_row1, const uword in_row2)
|
||||
//
|
||||
// arma_debug_check(set_to_zero == false, "SpCol::insert_rows(): cannot set nonzero values");
|
||||
//
|
||||
// arma_debug_check((row_num > SpMat<eT>::n_rows), "SpCol::insert_rows(): out of bounds");
|
||||
// arma_debug_check_bounds((row_num > SpMat<eT>::n_rows), "SpCol::insert_rows(): out of bounds");
|
||||
//
|
||||
// for(uword row = 0; row < SpMat<eT>::n_rows; ++row)
|
||||
// {
|
||||
// if (SpMat<eT>::row_indices[row] >= row_num)
|
||||
// if(SpMat<eT>::row_indices[row] >= row_num)
|
||||
// {
|
||||
// access::rw(SpMat<eT>::row_indices[row]) += N;
|
||||
// }
|
||||
@@ -364,7 +369,7 @@ SpCol<eT>::begin_row(const uword row_num)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
arma_debug_check( (row_num >= SpMat<eT>::n_rows), "SpCol::begin_row(): index out of bounds");
|
||||
arma_debug_check_bounds( (row_num >= SpMat<eT>::n_rows), "SpCol::begin_row(): index out of bounds" );
|
||||
|
||||
SpMat<eT>::sync_csc();
|
||||
|
||||
@@ -380,7 +385,7 @@ SpCol<eT>::begin_row(const uword row_num) const
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
arma_debug_check( (row_num >= SpMat<eT>::n_rows), "SpCol::begin_row(): index out of bounds");
|
||||
arma_debug_check_bounds( (row_num >= SpMat<eT>::n_rows), "SpCol::begin_row(): index out of bounds" );
|
||||
|
||||
SpMat<eT>::sync_csc();
|
||||
|
||||
@@ -396,7 +401,7 @@ SpCol<eT>::end_row(const uword row_num)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
arma_debug_check( (row_num >= SpMat<eT>::n_rows), "SpCol::end_row(): index out of bounds");
|
||||
arma_debug_check_bounds( (row_num >= SpMat<eT>::n_rows), "SpCol::end_row(): index out of bounds" );
|
||||
|
||||
SpMat<eT>::sync_csc();
|
||||
|
||||
@@ -412,7 +417,7 @@ SpCol<eT>::end_row(const uword row_num) const
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
arma_debug_check( (row_num >= SpMat<eT>::n_rows), "SpCol::end_row(): index out of bounds");
|
||||
arma_debug_check_bounds( (row_num >= SpMat<eT>::n_rows), "SpCol::end_row(): index out of bounds" );
|
||||
|
||||
SpMat<eT>::sync_csc();
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
// Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
//
|
||||
@@ -20,16 +22,16 @@
|
||||
|
||||
|
||||
template<typename T1, typename T2, typename spglue_type>
|
||||
class SpGlue : public SpBase<typename T1::elem_type, SpGlue<T1, T2, spglue_type> >
|
||||
class SpGlue : public SpBase< typename T1::elem_type, SpGlue<T1, T2, spglue_type> >
|
||||
{
|
||||
public:
|
||||
|
||||
typedef typename T1::elem_type elem_type;
|
||||
typedef typename get_pod_type<elem_type>::result pod_type;
|
||||
|
||||
static const bool is_row = spglue_type::template traits<T1,T2>::is_row;
|
||||
static const bool is_col = spglue_type::template traits<T1,T2>::is_col;
|
||||
static const bool is_xvec = spglue_type::template traits<T1,T2>::is_xvec;
|
||||
static constexpr bool is_row = spglue_type::template traits<T1,T2>::is_row;
|
||||
static constexpr bool is_col = spglue_type::template traits<T1,T2>::is_col;
|
||||
static constexpr bool is_xvec = spglue_type::template traits<T1,T2>::is_xvec;
|
||||
|
||||
inline SpGlue(const T1& in_A, const T2& in_B);
|
||||
inline SpGlue(const T1& in_A, const T2& in_B, const elem_type in_aux);
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
// Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
//
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
// Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
//
|
||||
@@ -27,9 +29,9 @@ class SpMat : public SpBase< eT, SpMat<eT> >
|
||||
typedef eT elem_type; //!< the type of elements stored in the matrix
|
||||
typedef typename get_pod_type<eT>::result pod_type; //!< if eT is std::complex<T>, pod_type is T; otherwise pod_type is eT
|
||||
|
||||
static const bool is_row = false;
|
||||
static const bool is_col = false;
|
||||
static const bool is_xvec = false;
|
||||
static constexpr bool is_row = false;
|
||||
static constexpr bool is_col = false;
|
||||
static constexpr bool is_xvec = false;
|
||||
|
||||
const uword n_rows; //!< number of rows (read-only)
|
||||
const uword n_cols; //!< number of columns (read-only)
|
||||
@@ -92,13 +94,11 @@ class SpMat : public SpBase< eT, SpMat<eT> >
|
||||
inline SpMat& operator=(const std::string& text);
|
||||
inline SpMat(const SpMat<eT>& x);
|
||||
|
||||
#if defined(ARMA_USE_CXX11)
|
||||
inline SpMat(SpMat&& m);
|
||||
inline SpMat& operator=(SpMat&& m);
|
||||
#endif
|
||||
|
||||
inline explicit SpMat(const MapMat<eT>& x);
|
||||
inline SpMat& operator=(const MapMat<eT>& x);
|
||||
inline SpMat& operator= (const MapMat<eT>& x);
|
||||
|
||||
template<typename T1, typename T2, typename T3>
|
||||
inline SpMat(const Base<uword,T1>& rowind, const Base<uword,T2>& colptr, const Base<eT,T3>& values, const uword n_rows, const uword n_cols);
|
||||
@@ -112,12 +112,12 @@ class SpMat : public SpBase< eT, SpMat<eT> >
|
||||
template<typename T1, typename T2>
|
||||
inline SpMat(const bool add_values, const Base<uword,T1>& locations, const Base<eT,T2>& values, const uword n_rows, const uword n_cols, const bool sort_locations = true, const bool check_for_zeros = true);
|
||||
|
||||
inline SpMat& operator=(const eT val); //! sets size to 1x1
|
||||
inline SpMat& operator= (const eT val); //! sets size to 1x1
|
||||
inline SpMat& operator*=(const eT val);
|
||||
inline SpMat& operator/=(const eT val);
|
||||
// operator+=(val) and operator-=(val) are not defined as they don't make sense for sparse matrices
|
||||
|
||||
inline SpMat& operator=(const SpMat& m);
|
||||
inline SpMat& operator= (const SpMat& m);
|
||||
inline SpMat& operator+=(const SpMat& m);
|
||||
inline SpMat& operator-=(const SpMat& m);
|
||||
inline SpMat& operator*=(const SpMat& m);
|
||||
@@ -125,7 +125,7 @@ class SpMat : public SpBase< eT, SpMat<eT> >
|
||||
inline SpMat& operator/=(const SpMat& m);
|
||||
|
||||
template<typename T1> inline explicit SpMat(const Base<eT, T1>& m);
|
||||
template<typename T1> inline SpMat& operator=(const Base<eT, T1>& m);
|
||||
template<typename T1> inline SpMat& operator= (const Base<eT, T1>& m);
|
||||
template<typename T1> inline SpMat& operator+=(const Base<eT, T1>& m);
|
||||
template<typename T1> inline SpMat& operator-=(const Base<eT, T1>& m);
|
||||
template<typename T1> inline SpMat& operator*=(const Base<eT, T1>& m);
|
||||
@@ -133,7 +133,7 @@ class SpMat : public SpBase< eT, SpMat<eT> >
|
||||
template<typename T1> inline SpMat& operator%=(const Base<eT, T1>& m);
|
||||
|
||||
template<typename T1> inline explicit SpMat(const Op<T1, op_diagmat>& expr);
|
||||
template<typename T1> inline SpMat& operator=(const Op<T1, op_diagmat>& expr);
|
||||
template<typename T1> inline SpMat& operator= (const Op<T1, op_diagmat>& expr);
|
||||
template<typename T1> inline SpMat& operator+=(const Op<T1, op_diagmat>& expr);
|
||||
template<typename T1> inline SpMat& operator-=(const Op<T1, op_diagmat>& expr);
|
||||
template<typename T1> inline SpMat& operator*=(const Op<T1, op_diagmat>& expr);
|
||||
@@ -148,15 +148,23 @@ class SpMat : public SpBase< eT, SpMat<eT> >
|
||||
inline explicit SpMat(const SpBase<pod_type, T1>& A, const SpBase<pod_type, T2>& B);
|
||||
|
||||
inline SpMat(const SpSubview<eT>& X);
|
||||
inline SpMat& operator=(const SpSubview<eT>& X);
|
||||
inline SpMat& operator= (const SpSubview<eT>& X);
|
||||
inline SpMat& operator+=(const SpSubview<eT>& X);
|
||||
inline SpMat& operator-=(const SpSubview<eT>& X);
|
||||
inline SpMat& operator*=(const SpSubview<eT>& X);
|
||||
inline SpMat& operator%=(const SpSubview<eT>& X);
|
||||
inline SpMat& operator/=(const SpSubview<eT>& X);
|
||||
|
||||
template<typename T1> inline SpMat(const SpSubview_col_list<eT,T1>& X);
|
||||
template<typename T1> inline SpMat& operator= (const SpSubview_col_list<eT,T1>& X);
|
||||
template<typename T1> inline SpMat& operator+=(const SpSubview_col_list<eT,T1>& X);
|
||||
template<typename T1> inline SpMat& operator-=(const SpSubview_col_list<eT,T1>& X);
|
||||
template<typename T1> inline SpMat& operator*=(const SpSubview_col_list<eT,T1>& X);
|
||||
template<typename T1> inline SpMat& operator%=(const SpSubview_col_list<eT,T1>& X);
|
||||
template<typename T1> inline SpMat& operator/=(const SpSubview_col_list<eT,T1>& X);
|
||||
|
||||
inline SpMat(const spdiagview<eT>& X);
|
||||
inline SpMat& operator=(const spdiagview<eT>& X);
|
||||
inline SpMat& operator= (const spdiagview<eT>& X);
|
||||
inline SpMat& operator+=(const spdiagview<eT>& X);
|
||||
inline SpMat& operator-=(const spdiagview<eT>& X);
|
||||
inline SpMat& operator*=(const spdiagview<eT>& X);
|
||||
@@ -165,7 +173,7 @@ class SpMat : public SpBase< eT, SpMat<eT> >
|
||||
|
||||
// delayed unary ops
|
||||
template<typename T1, typename spop_type> inline SpMat(const SpOp<T1, spop_type>& X);
|
||||
template<typename T1, typename spop_type> inline SpMat& operator=(const SpOp<T1, spop_type>& X);
|
||||
template<typename T1, typename spop_type> inline SpMat& operator= (const SpOp<T1, spop_type>& X);
|
||||
template<typename T1, typename spop_type> inline SpMat& operator+=(const SpOp<T1, spop_type>& X);
|
||||
template<typename T1, typename spop_type> inline SpMat& operator-=(const SpOp<T1, spop_type>& X);
|
||||
template<typename T1, typename spop_type> inline SpMat& operator*=(const SpOp<T1, spop_type>& X);
|
||||
@@ -174,7 +182,7 @@ class SpMat : public SpBase< eT, SpMat<eT> >
|
||||
|
||||
// delayed binary ops
|
||||
template<typename T1, typename T2, typename spglue_type> inline SpMat(const SpGlue<T1, T2, spglue_type>& X);
|
||||
template<typename T1, typename T2, typename spglue_type> inline SpMat& operator=(const SpGlue<T1, T2, spglue_type>& X);
|
||||
template<typename T1, typename T2, typename spglue_type> inline SpMat& operator= (const SpGlue<T1, T2, spglue_type>& X);
|
||||
template<typename T1, typename T2, typename spglue_type> inline SpMat& operator+=(const SpGlue<T1, T2, spglue_type>& X);
|
||||
template<typename T1, typename T2, typename spglue_type> inline SpMat& operator-=(const SpGlue<T1, T2, spglue_type>& X);
|
||||
template<typename T1, typename T2, typename spglue_type> inline SpMat& operator*=(const SpGlue<T1, T2, spglue_type>& X);
|
||||
@@ -183,7 +191,7 @@ class SpMat : public SpBase< eT, SpMat<eT> >
|
||||
|
||||
// delayed mixed-type unary ops
|
||||
template<typename T1, typename spop_type> inline SpMat(const mtSpOp<eT, T1, spop_type>& X);
|
||||
template<typename T1, typename spop_type> inline SpMat& operator=(const mtSpOp<eT, T1, spop_type>& X);
|
||||
template<typename T1, typename spop_type> inline SpMat& operator= (const mtSpOp<eT, T1, spop_type>& X);
|
||||
template<typename T1, typename spop_type> inline SpMat& operator+=(const mtSpOp<eT, T1, spop_type>& X);
|
||||
template<typename T1, typename spop_type> inline SpMat& operator-=(const mtSpOp<eT, T1, spop_type>& X);
|
||||
template<typename T1, typename spop_type> inline SpMat& operator*=(const mtSpOp<eT, T1, spop_type>& X);
|
||||
@@ -192,7 +200,7 @@ class SpMat : public SpBase< eT, SpMat<eT> >
|
||||
|
||||
// delayed mixed-type binary ops
|
||||
template<typename T1, typename T2, typename spglue_type> inline SpMat(const mtSpGlue<eT, T1, T2, spglue_type>& X);
|
||||
template<typename T1, typename T2, typename spglue_type> inline SpMat& operator=(const mtSpGlue<eT, T1, T2, spglue_type>& X);
|
||||
template<typename T1, typename T2, typename spglue_type> inline SpMat& operator= (const mtSpGlue<eT, T1, T2, spglue_type>& X);
|
||||
template<typename T1, typename T2, typename spglue_type> inline SpMat& operator+=(const mtSpGlue<eT, T1, T2, spglue_type>& X);
|
||||
template<typename T1, typename T2, typename spglue_type> inline SpMat& operator-=(const mtSpGlue<eT, T1, T2, spglue_type>& X);
|
||||
template<typename T1, typename T2, typename spglue_type> inline SpMat& operator*=(const mtSpGlue<eT, T1, T2, spglue_type>& X);
|
||||
@@ -247,6 +255,10 @@ class SpMat : public SpBase< eT, SpMat<eT> >
|
||||
inline const SpSubview<eT> tail_cols(const uword N) const;
|
||||
|
||||
|
||||
template<typename T1> arma_inline SpSubview_col_list<eT,T1> cols(const Base<uword,T1>& ci);
|
||||
template<typename T1> arma_inline const SpSubview_col_list<eT,T1> cols(const Base<uword,T1>& ci) const;
|
||||
|
||||
|
||||
inline spdiagview<eT> diag(const sword in_id = 0);
|
||||
inline const spdiagview<eT> diag(const sword in_id = 0) const;
|
||||
|
||||
@@ -303,19 +315,6 @@ class SpMat : public SpBase< eT, SpMat<eT> >
|
||||
arma_inline arma_warn_unused bool in_range(const uword in_row, const uword in_col, const SizeMat& s) const;
|
||||
|
||||
|
||||
arma_cold inline void impl_print( const std::string& extra_text) const;
|
||||
arma_cold inline void impl_print(std::ostream& user_stream, const std::string& extra_text) const;
|
||||
|
||||
arma_cold inline void impl_raw_print( const std::string& extra_text) const;
|
||||
arma_cold inline void impl_raw_print(std::ostream& user_stream, const std::string& extra_text) const;
|
||||
|
||||
arma_cold inline void impl_print_dense( const std::string& extra_text) const;
|
||||
arma_cold inline void impl_print_dense(std::ostream& user_stream, const std::string& extra_text) const;
|
||||
|
||||
arma_cold inline void impl_raw_print_dense( const std::string& extra_text) const;
|
||||
arma_cold inline void impl_raw_print_dense(std::ostream& user_stream, const std::string& extra_text) const;
|
||||
|
||||
|
||||
template<typename eT2> inline void copy_size(const SpMat<eT2>& m);
|
||||
template<typename eT2> inline void copy_size(const Mat<eT2>& m);
|
||||
|
||||
@@ -332,8 +331,6 @@ class SpMat : public SpBase< eT, SpMat<eT> >
|
||||
inline void reshape_helper_generic(const uword in_rows, const uword in_cols); //! internal use only
|
||||
inline void reshape_helper_intovec(); //! internal use only
|
||||
|
||||
arma_deprecated inline void reshape(const uword in_rows, const uword in_cols, const uword dim); //!< NOTE: don't use this form: it will be removed
|
||||
|
||||
template<typename functor> inline const SpMat& for_each(functor F);
|
||||
template<typename functor> inline const SpMat& for_each(functor F) const;
|
||||
|
||||
@@ -343,6 +340,8 @@ class SpMat : public SpBase< eT, SpMat<eT> >
|
||||
|
||||
inline const SpMat& clean(const pod_type threshold);
|
||||
|
||||
inline const SpMat& clamp(const eT min_val, const eT max_val);
|
||||
|
||||
inline const SpMat& zeros();
|
||||
inline const SpMat& zeros(const uword in_elem);
|
||||
inline const SpMat& zeros(const uword in_rows, const uword in_cols);
|
||||
@@ -363,6 +362,7 @@ class SpMat : public SpBase< eT, SpMat<eT> >
|
||||
inline const SpMat& sprandn(const SizeMat& s, const double density);
|
||||
|
||||
inline void reset();
|
||||
inline void reset_cache();
|
||||
|
||||
//! don't use this unless you're writing internal Armadillo code
|
||||
inline void reserve(const uword in_rows, const uword in_cols, const uword new_n_nonzero);
|
||||
@@ -381,13 +381,13 @@ class SpMat : public SpBase< eT, SpMat<eT> >
|
||||
// saving and loading
|
||||
// TODO: implement auto_detect for sparse matrices
|
||||
|
||||
inline arma_cold bool save(const std::string name, const file_type type = arma_binary, const bool print_status = true) const;
|
||||
inline arma_cold bool save(const csv_name& spec, const file_type type = csv_ascii, const bool print_status = true) const;
|
||||
inline arma_cold bool save( std::ostream& os, const file_type type = arma_binary, const bool print_status = true) const;
|
||||
inline arma_cold bool save(const std::string name, const file_type type = arma_binary) const;
|
||||
inline arma_cold bool save(const csv_name& spec, const file_type type = csv_ascii) const;
|
||||
inline arma_cold bool save( std::ostream& os, const file_type type = arma_binary) const;
|
||||
|
||||
inline arma_cold bool load(const std::string name, const file_type type = arma_binary, const bool print_status = true);
|
||||
inline arma_cold bool load(const csv_name& spec, const file_type type = csv_ascii, const bool print_status = true);
|
||||
inline arma_cold bool load( std::istream& is, const file_type type = arma_binary, const bool print_status = true);
|
||||
inline arma_cold bool load(const std::string name, const file_type type = arma_binary);
|
||||
inline arma_cold bool load(const csv_name& spec, const file_type type = csv_ascii);
|
||||
inline arma_cold bool load( std::istream& is, const file_type type = arma_binary);
|
||||
|
||||
inline arma_cold bool quiet_save(const std::string name, const file_type type = arma_binary) const;
|
||||
inline arma_cold bool quiet_save(const csv_name& spec, const file_type type = csv_ascii) const;
|
||||
@@ -479,7 +479,7 @@ class SpMat : public SpBase< eT, SpMat<eT> >
|
||||
inline iterator(SpMat& in_M, uword in_row, uword in_col, uword in_pos) : const_iterator(in_M, in_row, in_col, in_pos) { }
|
||||
inline iterator(const iterator& other) : const_iterator(other) { }
|
||||
|
||||
inline arma_hot SpValProxy<SpMat<eT> > operator*();
|
||||
inline arma_hot SpValProxy< SpMat<eT> > operator*();
|
||||
|
||||
// overloads needed for return type correctness
|
||||
inline arma_hot iterator& operator++();
|
||||
@@ -489,9 +489,9 @@ class SpMat : public SpBase< eT, SpMat<eT> >
|
||||
inline arma_warn_unused iterator operator--(int);
|
||||
|
||||
// this has a different value_type than iterator_base
|
||||
typedef SpValProxy<SpMat<eT> > value_type;
|
||||
typedef const SpValProxy<SpMat<eT> >* pointer;
|
||||
typedef const SpValProxy<SpMat<eT> >& reference;
|
||||
typedef SpValProxy< SpMat<eT> > value_type;
|
||||
typedef const SpValProxy< SpMat<eT> >* pointer;
|
||||
typedef const SpValProxy< SpMat<eT> >& reference;
|
||||
};
|
||||
|
||||
class const_row_iterator : public iterator_base
|
||||
@@ -540,7 +540,7 @@ class SpMat : public SpBase< eT, SpMat<eT> >
|
||||
inline row_iterator(SpMat& in_M, uword in_row, uword in_col) : const_row_iterator(in_M, in_row, in_col) { }
|
||||
inline row_iterator(const row_iterator& other) : const_row_iterator(other) { }
|
||||
|
||||
inline arma_hot SpValProxy<SpMat<eT> > operator*();
|
||||
inline arma_hot SpValProxy< SpMat<eT> > operator*();
|
||||
|
||||
// overloads required for return type correctness
|
||||
inline arma_hot row_iterator& operator++();
|
||||
@@ -550,9 +550,9 @@ class SpMat : public SpBase< eT, SpMat<eT> >
|
||||
inline arma_warn_unused row_iterator operator--(int);
|
||||
|
||||
// this has a different value_type than iterator_base
|
||||
typedef SpValProxy<SpMat<eT> > value_type;
|
||||
typedef const SpValProxy<SpMat<eT> >* pointer;
|
||||
typedef const SpValProxy<SpMat<eT> >& reference;
|
||||
typedef SpValProxy< SpMat<eT> > value_type;
|
||||
typedef const SpValProxy< SpMat<eT> >* pointer;
|
||||
typedef const SpValProxy< SpMat<eT> >& reference;
|
||||
};
|
||||
|
||||
|
||||
@@ -628,8 +628,8 @@ class SpMat : public SpBase< eT, SpMat<eT> >
|
||||
inline void steal_mem_simple(SpMat& X);
|
||||
|
||||
//! don't use this unless you're writing internal Armadillo code
|
||||
template< typename T1, typename Functor> arma_hot inline void init_xform (const SpBase<eT, T1>& x, const Functor& func);
|
||||
template<typename eT2, typename T1, typename Functor> arma_hot inline void init_xform_mt(const SpBase<eT2,T1>& x, const Functor& func);
|
||||
template< typename T1, typename Functor> inline void init_xform (const SpBase<eT, T1>& x, const Functor& func);
|
||||
template<typename eT2, typename T1, typename Functor> inline void init_xform_mt(const SpBase<eT2,T1>& x, const Functor& func);
|
||||
|
||||
//! don't use this unless you're writing internal Armadillo code
|
||||
arma_inline bool is_alias(const SpMat<eT>& X) const;
|
||||
@@ -681,7 +681,7 @@ class SpMat : public SpBase< eT, SpMat<eT> >
|
||||
// 1: CSC needs to be updated from cache (ie. cache has more recent data)
|
||||
// 2: no update required (ie. CSC and cache contain the same data)
|
||||
|
||||
#if (defined(ARMA_USE_CXX11) && !defined(ARMA_DONT_USE_CXX11_MUTEX))
|
||||
#if (!defined(ARMA_DONT_USE_STD_MUTEX))
|
||||
arma_aligned mutable std::mutex cache_mutex;
|
||||
#endif
|
||||
|
||||
@@ -702,6 +702,7 @@ class SpMat : public SpBase< eT, SpMat<eT> >
|
||||
friend class SpSubview_MapMat_val<eT>;
|
||||
friend class spdiagview<eT>;
|
||||
|
||||
template<typename xT1, typename xT2> friend class SpSubview_col_list;
|
||||
|
||||
public:
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
// Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
//
|
||||
@@ -26,7 +28,7 @@
|
||||
template<typename eT>
|
||||
inline
|
||||
SpMat<eT>::iterator_base::iterator_base()
|
||||
: M(NULL)
|
||||
: M(nullptr)
|
||||
, internal_col(0)
|
||||
, internal_pos(0)
|
||||
{
|
||||
@@ -80,6 +82,8 @@ SpMat<eT>::const_iterator::const_iterator()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename eT>
|
||||
inline
|
||||
SpMat<eT>::const_iterator::const_iterator(const SpMat<eT>& in_M, uword initial_pos)
|
||||
@@ -91,7 +95,7 @@ SpMat<eT>::const_iterator::const_iterator(const SpMat<eT>& in_M, uword initial_p
|
||||
iterator_base::internal_col = in_M.n_cols;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Determine which column we should be in.
|
||||
while(iterator_base::M->col_ptrs[iterator_base::internal_col + 1] <= iterator_base::internal_pos)
|
||||
{
|
||||
@@ -108,13 +112,13 @@ SpMat<eT>::const_iterator::const_iterator(const SpMat<eT>& in_M, uword in_row, u
|
||||
{
|
||||
// So we have a position we want to be right after. Skip to the column.
|
||||
iterator_base::internal_pos = iterator_base::M->col_ptrs[iterator_base::internal_col];
|
||||
|
||||
|
||||
// Now we have to make sure that is the right column.
|
||||
while(iterator_base::M->col_ptrs[iterator_base::internal_col + 1] <= iterator_base::internal_pos)
|
||||
{
|
||||
iterator_base::internal_col++;
|
||||
}
|
||||
|
||||
|
||||
// Now we have to get to the right row.
|
||||
while((iterator_base::M->row_indices[iterator_base::internal_pos] < in_row) && (iterator_base::internal_col == in_col))
|
||||
{
|
||||
@@ -151,19 +155,19 @@ typename SpMat<eT>::const_iterator&
|
||||
SpMat<eT>::const_iterator::operator++()
|
||||
{
|
||||
++iterator_base::internal_pos;
|
||||
|
||||
if (iterator_base::internal_pos == iterator_base::M->n_nonzero)
|
||||
|
||||
if(iterator_base::internal_pos == iterator_base::M->n_nonzero)
|
||||
{
|
||||
iterator_base::internal_col = iterator_base::M->n_cols;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
// Check to see if we moved a column.
|
||||
while (iterator_base::M->col_ptrs[iterator_base::internal_col + 1] <= iterator_base::internal_pos)
|
||||
while(iterator_base::M->col_ptrs[iterator_base::internal_col + 1] <= iterator_base::internal_pos)
|
||||
{
|
||||
++iterator_base::internal_col;
|
||||
}
|
||||
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -176,9 +180,9 @@ typename SpMat<eT>::const_iterator
|
||||
SpMat<eT>::const_iterator::operator++(int)
|
||||
{
|
||||
typename SpMat<eT>::const_iterator tmp(*this);
|
||||
|
||||
|
||||
++(*this);
|
||||
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
@@ -193,12 +197,11 @@ SpMat<eT>::const_iterator::operator--()
|
||||
--iterator_base::internal_pos;
|
||||
|
||||
// First, see if we moved back a column.
|
||||
while (iterator_base::internal_pos < iterator_base::M->col_ptrs[iterator_base::internal_col])
|
||||
while(iterator_base::internal_pos < iterator_base::M->col_ptrs[iterator_base::internal_col])
|
||||
{
|
||||
--iterator_base::internal_col;
|
||||
}
|
||||
|
||||
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -211,9 +214,9 @@ typename SpMat<eT>::const_iterator
|
||||
SpMat<eT>::const_iterator::operator--(int)
|
||||
{
|
||||
typename SpMat<eT>::const_iterator tmp(*this);
|
||||
|
||||
|
||||
--(*this);
|
||||
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
@@ -314,10 +317,10 @@ SpMat<eT>::const_iterator::operator!=(const typename SpSubview<eT>::const_row_it
|
||||
template<typename eT>
|
||||
inline
|
||||
arma_hot
|
||||
SpValProxy<SpMat<eT> >
|
||||
SpValProxy< SpMat<eT> >
|
||||
SpMat<eT>::iterator::operator*()
|
||||
{
|
||||
return SpValProxy<SpMat<eT> >(
|
||||
return SpValProxy< SpMat<eT> >(
|
||||
iterator_base::M->row_indices[iterator_base::internal_pos],
|
||||
iterator_base::internal_col,
|
||||
access::rw(*iterator_base::M),
|
||||
@@ -333,6 +336,7 @@ typename SpMat<eT>::iterator&
|
||||
SpMat<eT>::iterator::operator++()
|
||||
{
|
||||
const_iterator::operator++();
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -345,9 +349,9 @@ typename SpMat<eT>::iterator
|
||||
SpMat<eT>::iterator::operator++(int)
|
||||
{
|
||||
typename SpMat<eT>::iterator tmp(*this);
|
||||
|
||||
|
||||
const_iterator::operator++();
|
||||
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
@@ -360,6 +364,7 @@ typename SpMat<eT>::iterator&
|
||||
SpMat<eT>::iterator::operator--()
|
||||
{
|
||||
const_iterator::operator--();
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -372,9 +377,9 @@ typename SpMat<eT>::iterator
|
||||
SpMat<eT>::iterator::operator--(int)
|
||||
{
|
||||
typename SpMat<eT>::iterator tmp(*this);
|
||||
|
||||
|
||||
const_iterator::operator--();
|
||||
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
@@ -407,73 +412,71 @@ SpMat<eT>::const_row_iterator::const_row_iterator(const SpMat<eT>& in_M, uword i
|
||||
, actual_pos(0)
|
||||
{
|
||||
// Corner case for the end of a matrix.
|
||||
if (initial_pos == in_M.n_nonzero)
|
||||
if(initial_pos == in_M.n_nonzero)
|
||||
{
|
||||
iterator_base::internal_col = 0;
|
||||
internal_row = in_M.n_rows;
|
||||
actual_pos = in_M.n_nonzero;
|
||||
iterator_base::internal_pos = in_M.n_nonzero;
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// We don't count zeros in our position count, so we have to find the nonzero
|
||||
// value corresponding to the given initial position. We assume initial_pos
|
||||
// is valid.
|
||||
|
||||
// This is irritating because we don't know where the elements are in each
|
||||
// row. What we will do is loop across all columns looking for elements in
|
||||
// row 0 (and add to our sum), then in row 1, and so forth, until we get to
|
||||
// the desired position.
|
||||
|
||||
// This is irritating because we don't know where the elements are in each row.
|
||||
// What we will do is loop across all columns looking for elements in row 0
|
||||
// (and add to our sum), then in row 1, and so forth, until we get to the desired position.
|
||||
uword cur_pos = std::numeric_limits<uword>::max(); // Invalid value.
|
||||
uword cur_actual_pos = 0;
|
||||
|
||||
for (uword row = 0; row < iterator_base::M->n_rows; ++row)
|
||||
|
||||
for(uword row = 0; row < iterator_base::M->n_rows; ++row)
|
||||
{
|
||||
for (uword col = 0; col < iterator_base::M->n_cols; ++col)
|
||||
for(uword col = 0; col < iterator_base::M->n_cols; ++col)
|
||||
{
|
||||
// Find the first element with row greater than or equal to in_row.
|
||||
const uword col_offset = iterator_base::M->col_ptrs[col ];
|
||||
const uword next_col_offset = iterator_base::M->col_ptrs[col + 1];
|
||||
|
||||
|
||||
const uword* start_ptr = &iterator_base::M->row_indices[ col_offset];
|
||||
const uword* end_ptr = &iterator_base::M->row_indices[next_col_offset];
|
||||
|
||||
if (start_ptr != end_ptr)
|
||||
|
||||
if(start_ptr != end_ptr)
|
||||
{
|
||||
const uword* pos_ptr = std::lower_bound(start_ptr, end_ptr, row);
|
||||
|
||||
// This is the number of elements in the column with row index less than
|
||||
// in_row.
|
||||
|
||||
// This is the number of elements in the column with row index less than in_row.
|
||||
const uword offset = uword(pos_ptr - start_ptr);
|
||||
|
||||
if (iterator_base::M->row_indices[col_offset + offset] == row)
|
||||
|
||||
if(iterator_base::M->row_indices[col_offset + offset] == row)
|
||||
{
|
||||
cur_actual_pos = col_offset + offset;
|
||||
|
||||
|
||||
// Increment position portably.
|
||||
if (cur_pos == std::numeric_limits<uword>::max())
|
||||
cur_pos = 0;
|
||||
if(cur_pos == std::numeric_limits<uword>::max())
|
||||
{ cur_pos = 0; }
|
||||
else
|
||||
++cur_pos;
|
||||
|
||||
{ ++cur_pos; }
|
||||
|
||||
// Do we terminate?
|
||||
if (cur_pos == initial_pos)
|
||||
if(cur_pos == initial_pos)
|
||||
{
|
||||
internal_row = row;
|
||||
iterator_base::internal_col = col;
|
||||
iterator_base::internal_pos = cur_pos;
|
||||
actual_pos = cur_actual_pos;
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If we got to here, then we have gone past the end of the matrix. This
|
||||
// shouldn't happen...
|
||||
|
||||
// If we got to here, then we have gone past the end of the matrix.
|
||||
// This shouldn't happen...
|
||||
iterator_base::internal_pos = iterator_base::M->n_nonzero;
|
||||
iterator_base::internal_col = 0;
|
||||
internal_row = iterator_base::M->n_rows;
|
||||
@@ -497,41 +500,40 @@ SpMat<eT>::const_row_iterator::const_row_iterator(const SpMat<eT>& in_M, uword i
|
||||
//
|
||||
// We'll find these simultaneously, though we will have to loop over all
|
||||
// columns.
|
||||
|
||||
|
||||
// This will hold the total number of points with rows less than in_row.
|
||||
uword cur_pos = 0;
|
||||
uword cur_min_row = iterator_base::M->n_rows;
|
||||
uword cur_min_col = 0;
|
||||
uword cur_actual_pos = 0;
|
||||
|
||||
for (uword col = 0; col < iterator_base::M->n_cols; ++col)
|
||||
|
||||
for(uword col = 0; col < iterator_base::M->n_cols; ++col)
|
||||
{
|
||||
// Find the first element with row greater than or equal to in_row.
|
||||
const uword col_offset = iterator_base::M->col_ptrs[col ];
|
||||
const uword next_col_offset = iterator_base::M->col_ptrs[col + 1];
|
||||
|
||||
|
||||
const uword* start_ptr = &iterator_base::M->row_indices[ col_offset];
|
||||
const uword* end_ptr = &iterator_base::M->row_indices[next_col_offset];
|
||||
|
||||
if (start_ptr != end_ptr)
|
||||
if(start_ptr != end_ptr)
|
||||
{
|
||||
const uword* pos_ptr = std::lower_bound(start_ptr, end_ptr, in_row);
|
||||
|
||||
// This is the number of elements in the column with row index less than
|
||||
// in_row.
|
||||
|
||||
// This is the number of elements in the column with row index less than in_row.
|
||||
const uword offset = uword(pos_ptr - start_ptr);
|
||||
|
||||
|
||||
cur_pos += offset;
|
||||
|
||||
if (pos_ptr != end_ptr)
|
||||
|
||||
if(pos_ptr != end_ptr)
|
||||
{
|
||||
// This is the row index of the first element in the column with row index
|
||||
// greater than or equal to in_row.
|
||||
if ((*pos_ptr) < cur_min_row)
|
||||
if((*pos_ptr) < cur_min_row)
|
||||
{
|
||||
// If we are in the desired row but before the desired column, we
|
||||
// can't take this.
|
||||
if (col >= in_col)
|
||||
// If we are in the desired row but before the desired column,
|
||||
// we can't take this.
|
||||
if(col >= in_col)
|
||||
{
|
||||
cur_min_row = (*pos_ptr);
|
||||
cur_min_col = col;
|
||||
@@ -541,7 +543,7 @@ SpMat<eT>::const_row_iterator::const_row_iterator(const SpMat<eT>& in_M, uword i
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Now we know what the minimum row is.
|
||||
internal_row = cur_min_row;
|
||||
iterator_base::internal_col = cur_min_col;
|
||||
@@ -577,48 +579,48 @@ SpMat<eT>::const_row_iterator::operator++()
|
||||
{
|
||||
// We just need to find the next nonzero element.
|
||||
iterator_base::internal_pos++;
|
||||
|
||||
|
||||
if(iterator_base::internal_pos == iterator_base::M->n_nonzero)
|
||||
{
|
||||
internal_row = iterator_base::M->n_rows;
|
||||
iterator_base::internal_col = 0;
|
||||
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
// Otherwise, we need to search. We can start in the next column and use
|
||||
// lower_bound() to find the next element.
|
||||
uword next_min_row = iterator_base::M->n_rows;
|
||||
uword next_min_col = iterator_base::M->n_cols;
|
||||
uword next_actual_pos = 0;
|
||||
|
||||
|
||||
// Search from the current column to the end of the matrix.
|
||||
for (uword col = iterator_base::internal_col + 1; col < iterator_base::M->n_cols; ++col)
|
||||
for(uword col = iterator_base::internal_col + 1; col < iterator_base::M->n_cols; ++col)
|
||||
{
|
||||
// Find the first element with row greater than or equal to in_row.
|
||||
const uword col_offset = iterator_base::M->col_ptrs[col ];
|
||||
const uword next_col_offset = iterator_base::M->col_ptrs[col + 1];
|
||||
|
||||
|
||||
const uword* start_ptr = &iterator_base::M->row_indices[ col_offset];
|
||||
const uword* end_ptr = &iterator_base::M->row_indices[next_col_offset];
|
||||
|
||||
if (start_ptr != end_ptr)
|
||||
|
||||
if(start_ptr != end_ptr)
|
||||
{
|
||||
// Find the first element in the column with row greater than or equal to
|
||||
// the current row.
|
||||
const uword* pos_ptr = std::lower_bound(start_ptr, end_ptr, internal_row);
|
||||
|
||||
if (pos_ptr != end_ptr)
|
||||
|
||||
if(pos_ptr != end_ptr)
|
||||
{
|
||||
// We found something in the column, but is the row index correct?
|
||||
if ((*pos_ptr) == internal_row)
|
||||
if((*pos_ptr) == internal_row)
|
||||
{
|
||||
// Exact match---so we are done.
|
||||
iterator_base::internal_col = col;
|
||||
actual_pos = col_offset + (pos_ptr - start_ptr);
|
||||
return *this;
|
||||
}
|
||||
else if ((*pos_ptr) < next_min_row)
|
||||
else if((*pos_ptr) < next_min_row)
|
||||
{
|
||||
// The first element in this column is in a subsequent row, but it's
|
||||
// the minimum row we've seen so far.
|
||||
@@ -626,7 +628,7 @@ SpMat<eT>::const_row_iterator::operator++()
|
||||
next_min_col = col;
|
||||
next_actual_pos = col_offset + (pos_ptr - start_ptr);
|
||||
}
|
||||
else if ((*pos_ptr) == next_min_row && col < next_min_col)
|
||||
else if((*pos_ptr) == next_min_row && col < next_min_col)
|
||||
{
|
||||
// The first element in this column is in a subsequent row that we
|
||||
// already have another element for, but the column index is less so
|
||||
@@ -637,25 +639,25 @@ SpMat<eT>::const_row_iterator::operator++()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Restart the search in the next row.
|
||||
for (uword col = 0; col <= iterator_base::internal_col; ++col)
|
||||
for(uword col = 0; col <= iterator_base::internal_col; ++col)
|
||||
{
|
||||
// Find the first element with row greater than or equal to in_row + 1.
|
||||
const uword col_offset = iterator_base::M->col_ptrs[col ];
|
||||
const uword next_col_offset = iterator_base::M->col_ptrs[col + 1];
|
||||
|
||||
|
||||
const uword* start_ptr = &iterator_base::M->row_indices[ col_offset];
|
||||
const uword* end_ptr = &iterator_base::M->row_indices[next_col_offset];
|
||||
|
||||
if (start_ptr != end_ptr)
|
||||
|
||||
if(start_ptr != end_ptr)
|
||||
{
|
||||
const uword* pos_ptr = std::lower_bound(start_ptr, end_ptr, internal_row + 1);
|
||||
|
||||
if (pos_ptr != end_ptr)
|
||||
|
||||
if(pos_ptr != end_ptr)
|
||||
{
|
||||
// We found something in the column, but is the row index correct?
|
||||
if ((*pos_ptr) == internal_row + 1)
|
||||
if((*pos_ptr) == internal_row + 1)
|
||||
{
|
||||
// Exact match---so we are done.
|
||||
iterator_base::internal_col = col;
|
||||
@@ -663,15 +665,15 @@ SpMat<eT>::const_row_iterator::operator++()
|
||||
actual_pos = col_offset + (pos_ptr - start_ptr);
|
||||
return *this;
|
||||
}
|
||||
else if ((*pos_ptr) < next_min_row)
|
||||
else if((*pos_ptr) < next_min_row)
|
||||
{
|
||||
// The first element in this column is in a subsequent row, but it's
|
||||
// the minimum row we've seen so far.
|
||||
// The first element in this column is in a subsequent row,
|
||||
// but it's the minimum row we've seen so far.
|
||||
next_min_row = (*pos_ptr);
|
||||
next_min_col = col;
|
||||
next_actual_pos = col_offset + (pos_ptr - start_ptr);
|
||||
}
|
||||
else if ((*pos_ptr) == next_min_row && col < next_min_col)
|
||||
else if((*pos_ptr) == next_min_row && col < next_min_col)
|
||||
{
|
||||
// The first element in this column is in a subsequent row that we
|
||||
// already have another element for, but the column index is less so
|
||||
@@ -682,11 +684,11 @@ SpMat<eT>::const_row_iterator::operator++()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
iterator_base::internal_col = next_min_col;
|
||||
internal_row = next_min_row;
|
||||
actual_pos = next_actual_pos;
|
||||
|
||||
|
||||
return *this; // Now we are done.
|
||||
}
|
||||
|
||||
@@ -702,9 +704,9 @@ typename SpMat<eT>::const_row_iterator
|
||||
SpMat<eT>::const_row_iterator::operator++(int)
|
||||
{
|
||||
typename SpMat<eT>::const_row_iterator tmp(*this);
|
||||
|
||||
|
||||
++(*this);
|
||||
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
@@ -719,45 +721,45 @@ arma_hot
|
||||
typename SpMat<eT>::const_row_iterator&
|
||||
SpMat<eT>::const_row_iterator::operator--()
|
||||
{
|
||||
if (iterator_base::internal_pos == 0)
|
||||
if(iterator_base::internal_pos == 0)
|
||||
{
|
||||
// Do nothing; we are already at the beginning.
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
iterator_base::internal_pos--;
|
||||
|
||||
|
||||
// We have to search backwards. We'll do this by going backwards over columns
|
||||
// and seeing if we find an element in the same row.
|
||||
uword max_row = 0;
|
||||
uword max_col = 0;
|
||||
uword next_actual_pos = 0;
|
||||
|
||||
//for (uword col = iterator_base::internal_col; col > 1; --col)
|
||||
for (uword col = iterator_base::internal_col; col >= 1; --col)
|
||||
|
||||
//for(uword col = iterator_base::internal_col; col > 1; --col)
|
||||
for(uword col = iterator_base::internal_col; col >= 1; --col)
|
||||
{
|
||||
// Find the first element with row greater than or equal to in_row + 1.
|
||||
const uword col_offset = iterator_base::M->col_ptrs[col - 1];
|
||||
const uword next_col_offset = iterator_base::M->col_ptrs[col ];
|
||||
|
||||
|
||||
const uword* start_ptr = &iterator_base::M->row_indices[ col_offset];
|
||||
const uword* end_ptr = &iterator_base::M->row_indices[next_col_offset];
|
||||
|
||||
if (start_ptr != end_ptr)
|
||||
|
||||
if(start_ptr != end_ptr)
|
||||
{
|
||||
// There are elements in this column.
|
||||
const uword* pos_ptr = std::lower_bound(start_ptr, end_ptr, internal_row + 1);
|
||||
|
||||
if (pos_ptr != start_ptr)
|
||||
|
||||
if(pos_ptr != start_ptr)
|
||||
{
|
||||
// The element before pos_ptr is the one we are interested in.
|
||||
if (*(pos_ptr - 1) > max_row)
|
||||
if(*(pos_ptr - 1) > max_row)
|
||||
{
|
||||
max_row = *(pos_ptr - 1);
|
||||
max_col = col - 1;
|
||||
next_actual_pos = col_offset + (pos_ptr - 1 - start_ptr);
|
||||
}
|
||||
else if (*(pos_ptr - 1) == max_row && (col - 1) > max_col)
|
||||
else if(*(pos_ptr - 1) == max_row && (col - 1) > max_col)
|
||||
{
|
||||
max_col = col - 1;
|
||||
next_actual_pos = col_offset + (pos_ptr - 1 - start_ptr);
|
||||
@@ -765,49 +767,49 @@ SpMat<eT>::const_row_iterator::operator--()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Now loop around to the columns at the end of the matrix.
|
||||
for (uword col = iterator_base::M->n_cols - 1; col >= iterator_base::internal_col; --col)
|
||||
for(uword col = iterator_base::M->n_cols - 1; col >= iterator_base::internal_col; --col)
|
||||
{
|
||||
// Find the first element with row greater than or equal to in_row + 1.
|
||||
const uword col_offset = iterator_base::M->col_ptrs[col ];
|
||||
const uword next_col_offset = iterator_base::M->col_ptrs[col + 1];
|
||||
|
||||
|
||||
const uword* start_ptr = &iterator_base::M->row_indices[ col_offset];
|
||||
const uword* end_ptr = &iterator_base::M->row_indices[next_col_offset];
|
||||
|
||||
if (start_ptr != end_ptr)
|
||||
|
||||
if(start_ptr != end_ptr)
|
||||
{
|
||||
// There are elements in this column.
|
||||
const uword* pos_ptr = std::lower_bound(start_ptr, end_ptr, internal_row);
|
||||
|
||||
if (pos_ptr != start_ptr)
|
||||
|
||||
if(pos_ptr != start_ptr)
|
||||
{
|
||||
// There are elements in this column with row index < internal_row.
|
||||
if (*(pos_ptr - 1) > max_row)
|
||||
if(*(pos_ptr - 1) > max_row)
|
||||
{
|
||||
max_row = *(pos_ptr - 1);
|
||||
max_col = col;
|
||||
next_actual_pos = col_offset + (pos_ptr - 1 - start_ptr);
|
||||
}
|
||||
else if (*(pos_ptr - 1) == max_row && col > max_col)
|
||||
else if(*(pos_ptr - 1) == max_row && col > max_col)
|
||||
{
|
||||
max_col = col;
|
||||
next_actual_pos = col_offset + (pos_ptr - 1 - start_ptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (col == 0) // Catch edge case that the loop termination condition won't.
|
||||
|
||||
if(col == 0) // Catch edge case that the loop termination condition won't.
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
iterator_base::internal_col = max_col;
|
||||
internal_row = max_row;
|
||||
actual_pos = next_actual_pos;
|
||||
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -823,9 +825,9 @@ typename SpMat<eT>::const_row_iterator
|
||||
SpMat<eT>::const_row_iterator::operator--(int)
|
||||
{
|
||||
typename SpMat<eT>::const_row_iterator tmp(*this);
|
||||
|
||||
|
||||
--(*this);
|
||||
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
@@ -926,10 +928,10 @@ SpMat<eT>::const_row_iterator::operator!=(const typename SpSubview<eT>::const_ro
|
||||
template<typename eT>
|
||||
inline
|
||||
arma_hot
|
||||
SpValProxy<SpMat<eT> >
|
||||
SpValProxy< SpMat<eT> >
|
||||
SpMat<eT>::row_iterator::operator*()
|
||||
{
|
||||
return SpValProxy<SpMat<eT> >(
|
||||
return SpValProxy< SpMat<eT> >(
|
||||
const_row_iterator::internal_row,
|
||||
iterator_base::internal_col,
|
||||
access::rw(*iterator_base::M),
|
||||
@@ -945,6 +947,7 @@ typename SpMat<eT>::row_iterator&
|
||||
SpMat<eT>::row_iterator::operator++()
|
||||
{
|
||||
const_row_iterator::operator++();
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -957,9 +960,9 @@ typename SpMat<eT>::row_iterator
|
||||
SpMat<eT>::row_iterator::operator++(int)
|
||||
{
|
||||
typename SpMat<eT>::row_iterator tmp(*this);
|
||||
|
||||
|
||||
const_row_iterator::operator++();
|
||||
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
@@ -972,6 +975,7 @@ typename SpMat<eT>::row_iterator&
|
||||
SpMat<eT>::row_iterator::operator--()
|
||||
{
|
||||
const_row_iterator::operator--();
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -984,10 +988,11 @@ typename SpMat<eT>::row_iterator
|
||||
SpMat<eT>::row_iterator::operator--(int)
|
||||
{
|
||||
typename SpMat<eT>::row_iterator tmp(*this);
|
||||
|
||||
|
||||
const_row_iterator::operator--();
|
||||
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
|
||||
//! @}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
// Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
//
|
||||
@@ -20,16 +22,16 @@
|
||||
|
||||
|
||||
template<typename T1, typename op_type>
|
||||
class SpOp : public SpBase<typename T1::elem_type, SpOp<T1, op_type> >
|
||||
class SpOp : public SpBase< typename T1::elem_type, SpOp<T1, op_type> >
|
||||
{
|
||||
public:
|
||||
|
||||
typedef typename T1::elem_type elem_type;
|
||||
typedef typename get_pod_type<elem_type>::result pod_type;
|
||||
|
||||
static const bool is_row = op_type::template traits<T1>::is_row;
|
||||
static const bool is_col = op_type::template traits<T1>::is_col;
|
||||
static const bool is_xvec = op_type::template traits<T1>::is_xvec;
|
||||
static constexpr bool is_row = op_type::template traits<T1>::is_row;
|
||||
static constexpr bool is_col = op_type::template traits<T1>::is_col;
|
||||
static constexpr bool is_xvec = op_type::template traits<T1>::is_xvec;
|
||||
|
||||
inline explicit SpOp(const T1& in_m);
|
||||
inline SpOp(const T1& in_m, const elem_type in_aux);
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
// Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
//
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
// Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
//
|
||||
@@ -64,10 +66,8 @@
|
||||
|
||||
|
||||
template<typename eT>
|
||||
class SpProxy< SpMat<eT> >
|
||||
struct SpProxy< SpMat<eT> >
|
||||
{
|
||||
public:
|
||||
|
||||
typedef eT elem_type;
|
||||
typedef typename get_pod_type<elem_type>::result pod_type;
|
||||
typedef SpMat<eT> stored_type;
|
||||
@@ -75,12 +75,12 @@ class SpProxy< SpMat<eT> >
|
||||
typedef typename SpMat<eT>::const_iterator const_iterator_type;
|
||||
typedef typename SpMat<eT>::const_row_iterator const_row_iterator_type;
|
||||
|
||||
static const bool use_iterator = false;
|
||||
static const bool Q_is_generated = false;
|
||||
static constexpr bool use_iterator = false;
|
||||
static constexpr bool Q_is_generated = false;
|
||||
|
||||
static const bool is_row = false;
|
||||
static const bool is_col = false;
|
||||
static const bool is_xvec = false;
|
||||
static constexpr bool is_row = false;
|
||||
static constexpr bool is_col = false;
|
||||
static constexpr bool is_xvec = false;
|
||||
|
||||
arma_aligned const SpMat<eT>& Q;
|
||||
|
||||
@@ -118,10 +118,8 @@ class SpProxy< SpMat<eT> >
|
||||
|
||||
|
||||
template<typename eT>
|
||||
class SpProxy< SpCol<eT> >
|
||||
struct SpProxy< SpCol<eT> >
|
||||
{
|
||||
public:
|
||||
|
||||
typedef eT elem_type;
|
||||
typedef typename get_pod_type<elem_type>::result pod_type;
|
||||
typedef SpCol<eT> stored_type;
|
||||
@@ -129,12 +127,12 @@ class SpProxy< SpCol<eT> >
|
||||
typedef typename SpCol<eT>::const_iterator const_iterator_type;
|
||||
typedef typename SpCol<eT>::const_row_iterator const_row_iterator_type;
|
||||
|
||||
static const bool use_iterator = false;
|
||||
static const bool Q_is_generated = false;
|
||||
static constexpr bool use_iterator = false;
|
||||
static constexpr bool Q_is_generated = false;
|
||||
|
||||
static const bool is_row = false;
|
||||
static const bool is_col = true;
|
||||
static const bool is_xvec = false;
|
||||
static constexpr bool is_row = false;
|
||||
static constexpr bool is_col = true;
|
||||
static constexpr bool is_xvec = false;
|
||||
|
||||
arma_aligned const SpCol<eT>& Q;
|
||||
|
||||
@@ -172,10 +170,8 @@ class SpProxy< SpCol<eT> >
|
||||
|
||||
|
||||
template<typename eT>
|
||||
class SpProxy< SpRow<eT> >
|
||||
struct SpProxy< SpRow<eT> >
|
||||
{
|
||||
public:
|
||||
|
||||
typedef eT elem_type;
|
||||
typedef typename get_pod_type<elem_type>::result pod_type;
|
||||
typedef SpRow<eT> stored_type;
|
||||
@@ -183,12 +179,12 @@ class SpProxy< SpRow<eT> >
|
||||
typedef typename SpRow<eT>::const_iterator const_iterator_type;
|
||||
typedef typename SpRow<eT>::const_row_iterator const_row_iterator_type;
|
||||
|
||||
static const bool use_iterator = false;
|
||||
static const bool Q_is_generated = false;
|
||||
static constexpr bool use_iterator = false;
|
||||
static constexpr bool Q_is_generated = false;
|
||||
|
||||
static const bool is_row = true;
|
||||
static const bool is_col = false;
|
||||
static const bool is_xvec = false;
|
||||
static constexpr bool is_row = true;
|
||||
static constexpr bool is_col = false;
|
||||
static constexpr bool is_xvec = false;
|
||||
|
||||
arma_aligned const SpRow<eT>& Q;
|
||||
|
||||
@@ -226,10 +222,8 @@ class SpProxy< SpRow<eT> >
|
||||
|
||||
|
||||
template<typename eT>
|
||||
class SpProxy< SpSubview<eT> >
|
||||
struct SpProxy< SpSubview<eT> >
|
||||
{
|
||||
public:
|
||||
|
||||
typedef eT elem_type;
|
||||
typedef typename get_pod_type<elem_type>::result pod_type;
|
||||
typedef SpSubview<eT> stored_type;
|
||||
@@ -237,12 +231,12 @@ class SpProxy< SpSubview<eT> >
|
||||
typedef typename SpSubview<eT>::const_iterator const_iterator_type;
|
||||
typedef typename SpSubview<eT>::const_row_iterator const_row_iterator_type;
|
||||
|
||||
static const bool use_iterator = true;
|
||||
static const bool Q_is_generated = false;
|
||||
static constexpr bool use_iterator = true;
|
||||
static constexpr bool Q_is_generated = false;
|
||||
|
||||
static const bool is_row = false;
|
||||
static const bool is_col = false;
|
||||
static const bool is_xvec = false;
|
||||
static constexpr bool is_row = false;
|
||||
static constexpr bool is_col = false;
|
||||
static constexpr bool is_xvec = false;
|
||||
|
||||
arma_aligned const SpSubview<eT>& Q;
|
||||
|
||||
@@ -280,10 +274,8 @@ class SpProxy< SpSubview<eT> >
|
||||
|
||||
|
||||
template<typename eT>
|
||||
class SpProxy< SpSubview_col<eT> >
|
||||
struct SpProxy< SpSubview_col<eT> >
|
||||
{
|
||||
public:
|
||||
|
||||
typedef eT elem_type;
|
||||
typedef typename get_pod_type<elem_type>::result pod_type;
|
||||
typedef SpSubview_col<eT> stored_type;
|
||||
@@ -291,12 +283,12 @@ class SpProxy< SpSubview_col<eT> >
|
||||
typedef typename SpSubview<eT>::const_iterator const_iterator_type;
|
||||
typedef typename SpSubview<eT>::const_row_iterator const_row_iterator_type;
|
||||
|
||||
static const bool use_iterator = true;
|
||||
static const bool Q_is_generated = false;
|
||||
static constexpr bool use_iterator = true;
|
||||
static constexpr bool Q_is_generated = false;
|
||||
|
||||
static const bool is_row = false;
|
||||
static const bool is_col = true;
|
||||
static const bool is_xvec = false;
|
||||
static constexpr bool is_row = false;
|
||||
static constexpr bool is_col = true;
|
||||
static constexpr bool is_xvec = false;
|
||||
|
||||
arma_aligned const SpSubview_col<eT>& Q;
|
||||
|
||||
@@ -333,11 +325,60 @@ class SpProxy< SpSubview_col<eT> >
|
||||
|
||||
|
||||
|
||||
template<typename eT>
|
||||
class SpProxy< SpSubview_row<eT> >
|
||||
template<typename eT, typename T1>
|
||||
struct SpProxy< SpSubview_col_list<eT,T1> >
|
||||
{
|
||||
public:
|
||||
typedef eT elem_type;
|
||||
typedef typename get_pod_type<elem_type>::result pod_type;
|
||||
typedef SpMat<eT> stored_type;
|
||||
|
||||
typedef typename SpMat<eT>::const_iterator const_iterator_type;
|
||||
typedef typename SpMat<eT>::const_row_iterator const_row_iterator_type;
|
||||
|
||||
static constexpr bool use_iterator = false;
|
||||
static constexpr bool Q_is_generated = true;
|
||||
|
||||
static constexpr bool is_row = false;
|
||||
static constexpr bool is_col = false;
|
||||
static constexpr bool is_xvec = false;
|
||||
|
||||
arma_aligned const SpMat<eT> Q;
|
||||
|
||||
inline explicit SpProxy(const SpSubview_col_list<eT,T1>& A)
|
||||
: Q(A)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
}
|
||||
|
||||
arma_inline uword get_n_rows() const { return Q.n_rows; }
|
||||
arma_inline uword get_n_cols() const { return Q.n_cols; }
|
||||
arma_inline uword get_n_elem() const { return Q.n_elem; }
|
||||
arma_inline uword get_n_nonzero() const { return Q.n_nonzero; }
|
||||
|
||||
arma_inline elem_type operator[](const uword i) const { return Q[i]; }
|
||||
arma_inline elem_type at (const uword row, const uword col) const { return Q.at(row, col); }
|
||||
|
||||
arma_inline const eT* get_values() const { return Q.values; }
|
||||
arma_inline const uword* get_row_indices() const { return Q.row_indices; }
|
||||
arma_inline const uword* get_col_ptrs() const { return Q.col_ptrs; }
|
||||
|
||||
arma_inline const_iterator_type begin() const { return Q.begin(); }
|
||||
arma_inline const_iterator_type begin_col(const uword col_num) const { return Q.begin_col(col_num); }
|
||||
arma_inline const_row_iterator_type begin_row(const uword row_num = 0) const { return Q.begin_row(row_num); }
|
||||
|
||||
arma_inline const_iterator_type end() const { return Q.end(); }
|
||||
arma_inline const_row_iterator_type end_row() const { return Q.end_row(); }
|
||||
arma_inline const_row_iterator_type end_row(const uword row_num) const { return Q.end_row(row_num); }
|
||||
|
||||
template<typename eT2>
|
||||
constexpr bool is_alias(const SpMat<eT2>&) const { return false; }
|
||||
};
|
||||
|
||||
|
||||
|
||||
template<typename eT>
|
||||
struct SpProxy< SpSubview_row<eT> >
|
||||
{
|
||||
typedef eT elem_type;
|
||||
typedef typename get_pod_type<elem_type>::result pod_type;
|
||||
typedef SpSubview_row<eT> stored_type;
|
||||
@@ -345,12 +386,12 @@ class SpProxy< SpSubview_row<eT> >
|
||||
typedef typename SpSubview<eT>::const_iterator const_iterator_type;
|
||||
typedef typename SpSubview<eT>::const_row_iterator const_row_iterator_type;
|
||||
|
||||
static const bool use_iterator = true;
|
||||
static const bool Q_is_generated = false;
|
||||
static constexpr bool use_iterator = true;
|
||||
static constexpr bool Q_is_generated = false;
|
||||
|
||||
static const bool is_row = true;
|
||||
static const bool is_col = false;
|
||||
static const bool is_xvec = false;
|
||||
static constexpr bool is_row = true;
|
||||
static constexpr bool is_col = false;
|
||||
static constexpr bool is_xvec = false;
|
||||
|
||||
arma_aligned const SpSubview_row<eT>& Q;
|
||||
|
||||
@@ -388,10 +429,8 @@ class SpProxy< SpSubview_row<eT> >
|
||||
|
||||
|
||||
template<typename eT>
|
||||
class SpProxy< spdiagview<eT> >
|
||||
struct SpProxy< spdiagview<eT> >
|
||||
{
|
||||
public:
|
||||
|
||||
typedef eT elem_type;
|
||||
typedef typename get_pod_type<elem_type>::result pod_type;
|
||||
typedef SpMat<eT> stored_type;
|
||||
@@ -399,12 +438,12 @@ class SpProxy< spdiagview<eT> >
|
||||
typedef typename SpMat<eT>::const_iterator const_iterator_type;
|
||||
typedef typename SpMat<eT>::const_row_iterator const_row_iterator_type;
|
||||
|
||||
static const bool use_iterator = false;
|
||||
static const bool Q_is_generated = true;
|
||||
static constexpr bool use_iterator = false;
|
||||
static constexpr bool Q_is_generated = true;
|
||||
|
||||
static const bool is_row = false;
|
||||
static const bool is_col = true;
|
||||
static const bool is_xvec = false;
|
||||
static constexpr bool is_row = false;
|
||||
static constexpr bool is_col = true;
|
||||
static constexpr bool is_xvec = false;
|
||||
|
||||
arma_aligned const SpMat<eT> Q;
|
||||
|
||||
@@ -435,16 +474,14 @@ class SpProxy< spdiagview<eT> >
|
||||
arma_inline const_row_iterator_type end_row(const uword row_num) const { return Q.end_row(row_num); }
|
||||
|
||||
template<typename eT2>
|
||||
arma_inline bool is_alias(const SpMat<eT2>&) const { return false; }
|
||||
constexpr bool is_alias(const SpMat<eT2>&) const { return false; }
|
||||
};
|
||||
|
||||
|
||||
|
||||
template<typename T1, typename spop_type>
|
||||
class SpProxy< SpOp<T1, spop_type> >
|
||||
struct SpProxy< SpOp<T1, spop_type> >
|
||||
{
|
||||
public:
|
||||
|
||||
typedef typename T1::elem_type elem_type;
|
||||
typedef typename T1::elem_type eT;
|
||||
typedef typename get_pod_type<elem_type>::result pod_type;
|
||||
@@ -453,12 +490,12 @@ class SpProxy< SpOp<T1, spop_type> >
|
||||
typedef typename SpMat<eT>::const_iterator const_iterator_type;
|
||||
typedef typename SpMat<eT>::const_row_iterator const_row_iterator_type;
|
||||
|
||||
static const bool use_iterator = false;
|
||||
static const bool Q_is_generated = true;
|
||||
static constexpr bool use_iterator = false;
|
||||
static constexpr bool Q_is_generated = true;
|
||||
|
||||
static const bool is_row = SpOp<T1, spop_type>::is_row;
|
||||
static const bool is_col = SpOp<T1, spop_type>::is_col;
|
||||
static const bool is_xvec = SpOp<T1, spop_type>::is_xvec;
|
||||
static constexpr bool is_row = SpOp<T1, spop_type>::is_row;
|
||||
static constexpr bool is_col = SpOp<T1, spop_type>::is_col;
|
||||
static constexpr bool is_xvec = SpOp<T1, spop_type>::is_xvec;
|
||||
|
||||
arma_aligned const SpMat<eT> Q;
|
||||
|
||||
@@ -489,16 +526,14 @@ class SpProxy< SpOp<T1, spop_type> >
|
||||
arma_inline const_row_iterator_type end_row(const uword row_num) const { return Q.end_row(row_num); }
|
||||
|
||||
template<typename eT2>
|
||||
arma_inline bool is_alias(const SpMat<eT2>&) const { return false; }
|
||||
constexpr bool is_alias(const SpMat<eT2>&) const { return false; }
|
||||
};
|
||||
|
||||
|
||||
|
||||
template<typename T1, typename T2, typename spglue_type>
|
||||
class SpProxy< SpGlue<T1, T2, spglue_type> >
|
||||
struct SpProxy< SpGlue<T1, T2, spglue_type> >
|
||||
{
|
||||
public:
|
||||
|
||||
typedef typename T1::elem_type elem_type;
|
||||
typedef typename T1::elem_type eT;
|
||||
typedef typename get_pod_type<elem_type>::result pod_type;
|
||||
@@ -507,12 +542,12 @@ class SpProxy< SpGlue<T1, T2, spglue_type> >
|
||||
typedef typename SpMat<eT>::const_iterator const_iterator_type;
|
||||
typedef typename SpMat<eT>::const_row_iterator const_row_iterator_type;
|
||||
|
||||
static const bool use_iterator = false;
|
||||
static const bool Q_is_generated = true;
|
||||
static constexpr bool use_iterator = false;
|
||||
static constexpr bool Q_is_generated = true;
|
||||
|
||||
static const bool is_row = SpGlue<T1, T2, spglue_type>::is_row;
|
||||
static const bool is_col = SpGlue<T1, T2, spglue_type>::is_col;
|
||||
static const bool is_xvec = SpGlue<T1, T2, spglue_type>::is_xvec;
|
||||
static constexpr bool is_row = SpGlue<T1, T2, spglue_type>::is_row;
|
||||
static constexpr bool is_col = SpGlue<T1, T2, spglue_type>::is_col;
|
||||
static constexpr bool is_xvec = SpGlue<T1, T2, spglue_type>::is_xvec;
|
||||
|
||||
arma_aligned const SpMat<eT> Q;
|
||||
|
||||
@@ -543,16 +578,14 @@ class SpProxy< SpGlue<T1, T2, spglue_type> >
|
||||
arma_inline const_row_iterator_type end_row(const uword row_num) const { return Q.end_row(row_num); }
|
||||
|
||||
template<typename eT2>
|
||||
arma_inline bool is_alias(const SpMat<eT2>&) const { return false; }
|
||||
constexpr bool is_alias(const SpMat<eT2>&) const { return false; }
|
||||
};
|
||||
|
||||
|
||||
|
||||
template<typename out_eT, typename T1, typename spop_type>
|
||||
class SpProxy< mtSpOp<out_eT, T1, spop_type> >
|
||||
struct SpProxy< mtSpOp<out_eT, T1, spop_type> >
|
||||
{
|
||||
public:
|
||||
|
||||
typedef out_eT elem_type;
|
||||
typedef typename get_pod_type<elem_type>::result pod_type;
|
||||
typedef SpMat<out_eT> stored_type;
|
||||
@@ -560,12 +593,12 @@ class SpProxy< mtSpOp<out_eT, T1, spop_type> >
|
||||
typedef typename SpMat<out_eT>::const_iterator const_iterator_type;
|
||||
typedef typename SpMat<out_eT>::const_row_iterator const_row_iterator_type;
|
||||
|
||||
static const bool use_iterator = false;
|
||||
static const bool Q_is_generated = true;
|
||||
static constexpr bool use_iterator = false;
|
||||
static constexpr bool Q_is_generated = true;
|
||||
|
||||
static const bool is_row = mtSpOp<out_eT, T1, spop_type>::is_row;
|
||||
static const bool is_col = mtSpOp<out_eT, T1, spop_type>::is_col;
|
||||
static const bool is_xvec = mtSpOp<out_eT, T1, spop_type>::is_xvec;
|
||||
static constexpr bool is_row = mtSpOp<out_eT, T1, spop_type>::is_row;
|
||||
static constexpr bool is_col = mtSpOp<out_eT, T1, spop_type>::is_col;
|
||||
static constexpr bool is_xvec = mtSpOp<out_eT, T1, spop_type>::is_xvec;
|
||||
|
||||
arma_aligned const SpMat<out_eT> Q;
|
||||
|
||||
@@ -596,16 +629,14 @@ class SpProxy< mtSpOp<out_eT, T1, spop_type> >
|
||||
arma_inline const_row_iterator_type end_row(const uword row_num) const { return Q.end_row(row_num); }
|
||||
|
||||
template<typename eT2>
|
||||
arma_inline bool is_alias(const SpMat<eT2>&) const { return false; }
|
||||
constexpr bool is_alias(const SpMat<eT2>&) const { return false; }
|
||||
};
|
||||
|
||||
|
||||
|
||||
template<typename out_eT, typename T1, typename T2, typename spglue_type>
|
||||
class SpProxy< mtSpGlue<out_eT, T1, T2, spglue_type> >
|
||||
struct SpProxy< mtSpGlue<out_eT, T1, T2, spglue_type> >
|
||||
{
|
||||
public:
|
||||
|
||||
typedef out_eT elem_type;
|
||||
typedef typename get_pod_type<elem_type>::result pod_type;
|
||||
typedef SpMat<out_eT> stored_type;
|
||||
@@ -613,12 +644,12 @@ class SpProxy< mtSpGlue<out_eT, T1, T2, spglue_type> >
|
||||
typedef typename SpMat<out_eT>::const_iterator const_iterator_type;
|
||||
typedef typename SpMat<out_eT>::const_row_iterator const_row_iterator_type;
|
||||
|
||||
static const bool use_iterator = false;
|
||||
static const bool Q_is_generated = true;
|
||||
static constexpr bool use_iterator = false;
|
||||
static constexpr bool Q_is_generated = true;
|
||||
|
||||
static const bool is_row = mtSpGlue<out_eT, T1, T2, spglue_type>::is_row;
|
||||
static const bool is_col = mtSpGlue<out_eT, T1, T2, spglue_type>::is_col;
|
||||
static const bool is_xvec = mtSpGlue<out_eT, T1, T2, spglue_type>::is_xvec;
|
||||
static constexpr bool is_row = mtSpGlue<out_eT, T1, T2, spglue_type>::is_row;
|
||||
static constexpr bool is_col = mtSpGlue<out_eT, T1, T2, spglue_type>::is_col;
|
||||
static constexpr bool is_xvec = mtSpGlue<out_eT, T1, T2, spglue_type>::is_xvec;
|
||||
|
||||
arma_aligned const SpMat<out_eT> Q;
|
||||
|
||||
@@ -649,7 +680,7 @@ class SpProxy< mtSpGlue<out_eT, T1, T2, spglue_type> >
|
||||
arma_inline const_row_iterator_type end_row(const uword row_num) const { return Q.end_row(row_num); }
|
||||
|
||||
template<typename eT2>
|
||||
arma_inline bool is_alias(const SpMat<eT2>&) const { return false; }
|
||||
constexpr bool is_alias(const SpMat<eT2>&) const { return false; }
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
// Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
//
|
||||
@@ -27,9 +29,9 @@ class SpRow : public SpMat<eT>
|
||||
typedef eT elem_type;
|
||||
typedef typename get_pod_type<eT>::result pod_type;
|
||||
|
||||
static const bool is_row = true;
|
||||
static const bool is_col = false;
|
||||
static const bool is_xvec = false;
|
||||
static constexpr bool is_row = true;
|
||||
static constexpr bool is_col = false;
|
||||
static constexpr bool is_xvec = false;
|
||||
|
||||
|
||||
inline SpRow();
|
||||
@@ -54,9 +56,9 @@ class SpRow : public SpMat<eT>
|
||||
template<typename T1, typename T2>
|
||||
inline explicit SpRow(const SpBase<pod_type,T1>& A, const SpBase<pod_type,T2>& B);
|
||||
|
||||
inline const SpOp<SpRow<eT>,spop_htrans> t() const;
|
||||
inline const SpOp<SpRow<eT>,spop_htrans> ht() const;
|
||||
inline const SpOp<SpRow<eT>,spop_strans> st() const;
|
||||
inline arma_warn_unused const SpOp<SpRow<eT>,spop_htrans> t() const;
|
||||
inline arma_warn_unused const SpOp<SpRow<eT>,spop_htrans> ht() const;
|
||||
inline arma_warn_unused const SpOp<SpRow<eT>,spop_strans> st() const;
|
||||
|
||||
inline void shed_col (const uword col_num);
|
||||
inline void shed_cols(const uword in_col1, const uword in_col2);
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
// Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
//
|
||||
@@ -202,6 +204,7 @@ SpRow<eT>::SpRow
|
||||
|
||||
template<typename eT>
|
||||
inline
|
||||
arma_warn_unused
|
||||
const SpOp<SpRow<eT>,spop_htrans>
|
||||
SpRow<eT>::t() const
|
||||
{
|
||||
@@ -212,6 +215,7 @@ SpRow<eT>::t() const
|
||||
|
||||
template<typename eT>
|
||||
inline
|
||||
arma_warn_unused
|
||||
const SpOp<SpRow<eT>,spop_htrans>
|
||||
SpRow<eT>::ht() const
|
||||
{
|
||||
@@ -222,6 +226,7 @@ SpRow<eT>::ht() const
|
||||
|
||||
template<typename eT>
|
||||
inline
|
||||
arma_warn_unused
|
||||
const SpOp<SpRow<eT>,spop_strans>
|
||||
SpRow<eT>::st() const
|
||||
{
|
||||
@@ -238,7 +243,7 @@ SpRow<eT>::shed_col(const uword col_num)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
arma_debug_check( col_num >= SpMat<eT>::n_cols, "SpRow::shed_col(): out of bounds");
|
||||
arma_debug_check_bounds( col_num >= SpMat<eT>::n_cols, "SpRow::shed_col(): out of bounds" );
|
||||
|
||||
shed_cols(col_num, col_num);
|
||||
}
|
||||
@@ -253,7 +258,7 @@ SpRow<eT>::shed_cols(const uword in_col1, const uword in_col2)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
arma_debug_check
|
||||
arma_debug_check_bounds
|
||||
(
|
||||
(in_col1 > in_col2) || (in_col2 >= SpMat<eT>::n_cols),
|
||||
"SpRow::shed_cols(): indices out of bounds or incorrectly used"
|
||||
@@ -267,7 +272,7 @@ SpRow<eT>::shed_cols(const uword in_col1, const uword in_col2)
|
||||
const uword start = SpMat<eT>::col_ptrs[in_col1];
|
||||
const uword end = SpMat<eT>::col_ptrs[in_col2 + 1];
|
||||
|
||||
if (start != end)
|
||||
if(start != end)
|
||||
{
|
||||
const uword elem_diff = end - start;
|
||||
|
||||
@@ -275,14 +280,14 @@ SpRow<eT>::shed_cols(const uword in_col1, const uword in_col2)
|
||||
uword* new_row_indices = memory::acquire<uword>(SpMat<eT>::n_nonzero - elem_diff);
|
||||
|
||||
// Copy first set of elements, if necessary.
|
||||
if (start > 0)
|
||||
if(start > 0)
|
||||
{
|
||||
arrayops::copy(new_values, SpMat<eT>::values, start);
|
||||
arrayops::copy(new_row_indices, SpMat<eT>::row_indices, start);
|
||||
}
|
||||
|
||||
// Copy last set of elements, if necessary.
|
||||
if (end != SpMat<eT>::n_nonzero)
|
||||
if(end != SpMat<eT>::n_nonzero)
|
||||
{
|
||||
arrayops::copy(new_values + start, SpMat<eT>::values + end, (SpMat<eT>::n_nonzero - end));
|
||||
arrayops::copy(new_row_indices + start, SpMat<eT>::row_indices + end, (SpMat<eT>::n_nonzero - end));
|
||||
@@ -301,13 +306,13 @@ SpRow<eT>::shed_cols(const uword in_col1, const uword in_col2)
|
||||
uword* new_col_ptrs = memory::acquire<uword>(SpMat<eT>::n_cols - diff + 1);
|
||||
|
||||
// Copy first part of column pointers.
|
||||
if (in_col1 > 0)
|
||||
if(in_col1 > 0)
|
||||
{
|
||||
arrayops::copy(new_col_ptrs, SpMat<eT>::col_ptrs, in_col1);
|
||||
}
|
||||
|
||||
// Copy last part of column pointers (and adjust their values as necessary).
|
||||
if (in_col2 < SpMat<eT>::n_cols - 1)
|
||||
if(in_col2 < SpMat<eT>::n_cols - 1)
|
||||
{
|
||||
arrayops::copy(new_col_ptrs + in_col1, SpMat<eT>::col_ptrs + in_col2 + 1, SpMat<eT>::n_cols - in_col2);
|
||||
// Modify their values.
|
||||
@@ -336,9 +341,9 @@ SpRow<eT>::shed_cols(const uword in_col1, const uword in_col2)
|
||||
// arma_extra_debug_sigprint();
|
||||
//
|
||||
// // insertion at col_num == n_cols is in effect an append operation
|
||||
// arma_debug_check( (col_num > SpMat<eT>::n_cols), "SpRow::insert_cols(): out of bounds");
|
||||
// arma_debug_check_bounds( (col_num > SpMat<eT>::n_cols), "SpRow::insert_cols(): out of bounds" );
|
||||
//
|
||||
// arma_debug_check( (set_to_zero == false), "SpRow::insert_cols(): cannot set elements to nonzero values");
|
||||
// arma_debug_check( (set_to_zero == false), "SpRow::insert_cols(): cannot set elements to nonzero values" );
|
||||
//
|
||||
// uword newVal = (col_num == 0) ? 0 : SpMat<eT>::col_ptrs[col_num];
|
||||
// SpMat<eT>::col_ptrs.insert(col_num, N, newVal);
|
||||
@@ -366,7 +371,7 @@ SpRow<eT>::begin_row(const uword row_num)
|
||||
|
||||
// Since this is a row, row_num can only be 0. But the option is provided for
|
||||
// compatibility.
|
||||
arma_debug_check((row_num >= 1), "SpRow::begin_row(): index out of bounds");
|
||||
arma_debug_check_bounds((row_num >= 1), "SpRow::begin_row(): index out of bounds");
|
||||
|
||||
return SpMat<eT>::begin();
|
||||
}
|
||||
@@ -382,7 +387,7 @@ SpRow<eT>::begin_row(const uword row_num) const
|
||||
|
||||
// Since this is a row, row_num can only be 0. But the option is provided for
|
||||
// compatibility.
|
||||
arma_debug_check((row_num >= 1), "SpRow::begin_row(): index out of bounds");
|
||||
arma_debug_check_bounds((row_num >= 1), "SpRow::begin_row(): index out of bounds");
|
||||
|
||||
return SpMat<eT>::begin();
|
||||
}
|
||||
@@ -398,7 +403,7 @@ SpRow<eT>::end_row(const uword row_num)
|
||||
|
||||
// Since this is a row, row_num can only be 0. But the option is provided for
|
||||
// compatibility.
|
||||
arma_debug_check((row_num >= 1), "SpRow::end_row(): index out of bounds");
|
||||
arma_debug_check_bounds((row_num >= 1), "SpRow::end_row(): index out of bounds");
|
||||
|
||||
return SpMat<eT>::end();
|
||||
}
|
||||
@@ -414,7 +419,7 @@ SpRow<eT>::end_row(const uword row_num) const
|
||||
|
||||
// Since this is a row, row_num can only be 0. But the option is provided for
|
||||
// compatibility.
|
||||
arma_debug_check((row_num >= 1), "SpRow::end_row(): index out of bounds");
|
||||
arma_debug_check_bounds((row_num >= 1), "SpRow::end_row(): index out of bounds");
|
||||
|
||||
return SpMat<eT>::end();
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
// Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
//
|
||||
@@ -19,7 +21,7 @@
|
||||
|
||||
|
||||
template<typename eT>
|
||||
class SpSubview : public SpBase<eT, SpSubview<eT> >
|
||||
class SpSubview : public SpBase< eT, SpSubview<eT> >
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -28,9 +30,9 @@ class SpSubview : public SpBase<eT, SpSubview<eT> >
|
||||
typedef eT elem_type;
|
||||
typedef typename get_pod_type<elem_type>::result pod_type;
|
||||
|
||||
static const bool is_row = false;
|
||||
static const bool is_col = false;
|
||||
static const bool is_xvec = false;
|
||||
static constexpr bool is_row = false;
|
||||
static constexpr bool is_col = false;
|
||||
static constexpr bool is_xvec = false;
|
||||
|
||||
const uword aux_row1;
|
||||
const uword aux_col1;
|
||||
@@ -39,31 +41,32 @@ class SpSubview : public SpBase<eT, SpSubview<eT> >
|
||||
const uword n_elem;
|
||||
const uword n_nonzero;
|
||||
|
||||
friend class SpValProxy< SpSubview<eT> >; // allow SpValProxy to call insert_element() and delete_element()
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
inline SpSubview(const SpMat<eT>& in_m, const uword in_row1, const uword in_col1, const uword in_n_rows, const uword in_n_cols);
|
||||
inline SpSubview( SpMat<eT>& in_m, const uword in_row1, const uword in_col1, const uword in_n_rows, const uword in_n_cols);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
|
||||
inline ~SpSubview();
|
||||
|
||||
inline SpSubview() = delete;
|
||||
|
||||
inline SpSubview(const SpSubview& in);
|
||||
inline SpSubview( SpSubview&& in);
|
||||
|
||||
inline const SpSubview& operator+= (const eT val);
|
||||
inline const SpSubview& operator-= (const eT val);
|
||||
inline const SpSubview& operator*= (const eT val);
|
||||
inline const SpSubview& operator/= (const eT val);
|
||||
|
||||
|
||||
inline const SpSubview& operator=(const SpSubview& x);
|
||||
|
||||
|
||||
template<typename T1> inline const SpSubview& operator= (const Base<eT, T1>& x);
|
||||
template<typename T1> inline const SpSubview& operator+=(const Base<eT, T1>& x);
|
||||
template<typename T1> inline const SpSubview& operator-=(const Base<eT, T1>& x);
|
||||
template<typename T1> inline const SpSubview& operator*=(const Base<eT, T1>& x);
|
||||
template<typename T1> inline const SpSubview& operator%=(const Base<eT, T1>& x);
|
||||
template<typename T1> inline const SpSubview& operator/=(const Base<eT, T1>& x);
|
||||
|
||||
|
||||
template<typename T1> inline const SpSubview& operator_equ_common(const SpBase<eT, T1>& x);
|
||||
|
||||
template<typename T1> inline const SpSubview& operator= (const SpBase<eT, T1>& x);
|
||||
@@ -75,7 +78,7 @@ class SpSubview : public SpBase<eT, SpSubview<eT> >
|
||||
|
||||
/*
|
||||
inline static void extract(SpMat<eT>& out, const SpSubview& in);
|
||||
|
||||
|
||||
inline static void plus_inplace(Mat<eT>& out, const subview& in);
|
||||
inline static void minus_inplace(Mat<eT>& out, const subview& in);
|
||||
inline static void schur_inplace(Mat<eT>& out, const subview& in);
|
||||
@@ -91,205 +94,210 @@ class SpSubview : public SpBase<eT, SpSubview<eT> >
|
||||
|
||||
inline void clean(const pod_type threshold);
|
||||
|
||||
inline void clamp(const eT min_val, const eT max_val);
|
||||
|
||||
inline void fill(const eT val);
|
||||
inline void zeros();
|
||||
inline void ones();
|
||||
inline void eye();
|
||||
|
||||
inline void randu();
|
||||
inline void randn();
|
||||
|
||||
|
||||
arma_hot inline SpSubview_MapMat_val<eT> operator[](const uword i);
|
||||
arma_hot inline eT operator[](const uword i) const;
|
||||
|
||||
|
||||
arma_hot inline SpSubview_MapMat_val<eT> operator()(const uword i);
|
||||
arma_hot inline eT operator()(const uword i) const;
|
||||
|
||||
|
||||
arma_hot inline SpSubview_MapMat_val<eT> operator()(const uword in_row, const uword in_col);
|
||||
arma_hot inline eT operator()(const uword in_row, const uword in_col) const;
|
||||
|
||||
|
||||
arma_hot inline SpSubview_MapMat_val<eT> at(const uword i);
|
||||
arma_hot inline eT at(const uword i) const;
|
||||
|
||||
|
||||
arma_hot inline SpSubview_MapMat_val<eT> at(const uword in_row, const uword in_col);
|
||||
arma_hot inline eT at(const uword in_row, const uword in_col) const;
|
||||
|
||||
|
||||
inline bool check_overlap(const SpSubview& x) const;
|
||||
|
||||
|
||||
inline bool is_vec() const;
|
||||
|
||||
|
||||
inline SpSubview_row<eT> row(const uword row_num);
|
||||
inline const SpSubview_row<eT> row(const uword row_num) const;
|
||||
|
||||
|
||||
inline SpSubview_col<eT> col(const uword col_num);
|
||||
inline const SpSubview_col<eT> col(const uword col_num) const;
|
||||
|
||||
|
||||
inline SpSubview rows(const uword in_row1, const uword in_row2);
|
||||
inline const SpSubview rows(const uword in_row1, const uword in_row2) const;
|
||||
|
||||
|
||||
inline SpSubview cols(const uword in_col1, const uword in_col2);
|
||||
inline const SpSubview cols(const uword in_col1, const uword in_col2) const;
|
||||
|
||||
|
||||
inline SpSubview submat(const uword in_row1, const uword in_col1, const uword in_row2, const uword in_col2);
|
||||
inline const SpSubview submat(const uword in_row1, const uword in_col1, const uword in_row2, const uword in_col2) const;
|
||||
|
||||
|
||||
inline SpSubview submat(const span& row_span, const span& col_span);
|
||||
inline const SpSubview submat(const span& row_span, const span& col_span) const;
|
||||
|
||||
|
||||
inline SpSubview operator()(const uword row_num, const span& col_span);
|
||||
inline const SpSubview operator()(const uword row_num, const span& col_span) const;
|
||||
|
||||
|
||||
inline SpSubview operator()(const span& row_span, const uword col_num);
|
||||
inline const SpSubview operator()(const span& row_span, const uword col_num) const;
|
||||
|
||||
|
||||
inline SpSubview operator()(const span& row_span, const span& col_span);
|
||||
inline const SpSubview operator()(const span& row_span, const span& col_span) const;
|
||||
|
||||
|
||||
inline void swap_rows(const uword in_row1, const uword in_row2);
|
||||
inline void swap_cols(const uword in_col1, const uword in_col2);
|
||||
|
||||
|
||||
// Forward declarations.
|
||||
class iterator_base;
|
||||
class const_iterator;
|
||||
class iterator;
|
||||
class const_row_iterator;
|
||||
class row_iterator;
|
||||
|
||||
|
||||
// Similar to SpMat iterators but automatically iterates past and ignores values not in the subview.
|
||||
class iterator_base
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
inline iterator_base(const SpSubview& in_M);
|
||||
inline iterator_base(const SpSubview& in_M, const uword col, const uword pos);
|
||||
|
||||
|
||||
arma_inline uword col() const { return internal_col; }
|
||||
arma_inline uword pos() const { return internal_pos; }
|
||||
|
||||
|
||||
arma_aligned const SpSubview* M;
|
||||
arma_aligned uword internal_col;
|
||||
arma_aligned uword internal_pos;
|
||||
|
||||
|
||||
typedef std::bidirectional_iterator_tag iterator_category;
|
||||
typedef eT value_type;
|
||||
typedef std::ptrdiff_t difference_type; // TODO: not certain on this one
|
||||
typedef const eT* pointer;
|
||||
typedef const eT& reference;
|
||||
};
|
||||
|
||||
|
||||
class const_iterator : public iterator_base
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
inline const_iterator(const SpSubview& in_M, uword initial_pos = 0);
|
||||
inline const_iterator(const SpSubview& in_M, uword in_row, uword in_col);
|
||||
inline const_iterator(const SpSubview& in_M, uword in_row, uword in_col, uword in_pos, uword skip_pos);
|
||||
inline const_iterator(const const_iterator& other);
|
||||
|
||||
|
||||
arma_inline eT operator*() const;
|
||||
|
||||
|
||||
// Don't hold location internally; call "dummy" methods to get that information.
|
||||
arma_inline uword row() const { return iterator_base::M->m.row_indices[iterator_base::internal_pos + skip_pos] - iterator_base::M->aux_row1; }
|
||||
|
||||
|
||||
inline arma_hot const_iterator& operator++();
|
||||
inline arma_warn_unused const_iterator operator++(int);
|
||||
|
||||
|
||||
inline arma_hot const_iterator& operator--();
|
||||
inline arma_warn_unused const_iterator operator--(int);
|
||||
|
||||
|
||||
inline arma_hot bool operator!=(const const_iterator& rhs) const;
|
||||
inline arma_hot bool operator==(const const_iterator& rhs) const;
|
||||
|
||||
|
||||
inline arma_hot bool operator!=(const typename SpMat<eT>::const_iterator& rhs) const;
|
||||
inline arma_hot bool operator==(const typename SpMat<eT>::const_iterator& rhs) const;
|
||||
|
||||
|
||||
inline arma_hot bool operator!=(const const_row_iterator& rhs) const;
|
||||
inline arma_hot bool operator==(const const_row_iterator& rhs) const;
|
||||
|
||||
|
||||
inline arma_hot bool operator!=(const typename SpMat<eT>::const_row_iterator& rhs) const;
|
||||
inline arma_hot bool operator==(const typename SpMat<eT>::const_row_iterator& rhs) const;
|
||||
|
||||
|
||||
arma_aligned uword skip_pos; // not used in row_iterator or const_row_iterator
|
||||
};
|
||||
|
||||
|
||||
class iterator : public const_iterator
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
inline iterator(SpSubview& in_M, const uword initial_pos = 0) : const_iterator(in_M, initial_pos) { }
|
||||
inline iterator(SpSubview& in_M, const uword in_row, const uword in_col) : const_iterator(in_M, in_row, in_col) { }
|
||||
inline iterator(SpSubview& in_M, const uword in_row, const uword in_col, const uword in_pos, const uword in_skip_pos) : const_iterator(in_M, in_row, in_col, in_pos, in_skip_pos) { }
|
||||
inline iterator(const iterator& other) : const_iterator(other) { }
|
||||
|
||||
inline arma_hot SpValProxy<SpSubview<eT> > operator*();
|
||||
|
||||
|
||||
inline arma_hot SpValProxy< SpSubview<eT> > operator*();
|
||||
|
||||
// overloads needed for return type correctness
|
||||
inline arma_hot iterator& operator++();
|
||||
inline arma_warn_unused iterator operator++(int);
|
||||
|
||||
|
||||
inline arma_hot iterator& operator--();
|
||||
inline arma_warn_unused iterator operator--(int);
|
||||
|
||||
|
||||
// This has a different value_type than iterator_base.
|
||||
typedef SpValProxy<SpSubview<eT> > value_type;
|
||||
typedef const SpValProxy<SpSubview<eT> >* pointer;
|
||||
typedef const SpValProxy<SpSubview<eT> >& reference;
|
||||
typedef SpValProxy< SpSubview<eT> > value_type;
|
||||
typedef const SpValProxy< SpSubview<eT> >* pointer;
|
||||
typedef const SpValProxy< SpSubview<eT> >& reference;
|
||||
};
|
||||
|
||||
|
||||
class const_row_iterator : public iterator_base
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
inline const_row_iterator();
|
||||
inline const_row_iterator(const SpSubview& in_M, uword initial_pos = 0);
|
||||
inline const_row_iterator(const SpSubview& in_M, uword in_row, uword in_col);
|
||||
inline const_row_iterator(const const_row_iterator& other);
|
||||
|
||||
|
||||
inline arma_hot const_row_iterator& operator++();
|
||||
inline arma_warn_unused const_row_iterator operator++(int);
|
||||
|
||||
|
||||
inline arma_hot const_row_iterator& operator--();
|
||||
inline arma_warn_unused const_row_iterator operator--(int);
|
||||
|
||||
|
||||
uword internal_row; // Hold row internally because we use internal_pos differently.
|
||||
uword actual_pos; // Actual position in subview's parent matrix.
|
||||
|
||||
|
||||
arma_inline eT operator*() const { return iterator_base::M->m.values[actual_pos]; }
|
||||
|
||||
|
||||
arma_inline uword row() const { return internal_row; }
|
||||
|
||||
|
||||
inline arma_hot bool operator!=(const const_iterator& rhs) const;
|
||||
inline arma_hot bool operator==(const const_iterator& rhs) const;
|
||||
|
||||
|
||||
inline arma_hot bool operator!=(const typename SpMat<eT>::const_iterator& rhs) const;
|
||||
inline arma_hot bool operator==(const typename SpMat<eT>::const_iterator& rhs) const;
|
||||
|
||||
|
||||
inline arma_hot bool operator!=(const const_row_iterator& rhs) const;
|
||||
inline arma_hot bool operator==(const const_row_iterator& rhs) const;
|
||||
|
||||
|
||||
inline arma_hot bool operator!=(const typename SpMat<eT>::const_row_iterator& rhs) const;
|
||||
inline arma_hot bool operator==(const typename SpMat<eT>::const_row_iterator& rhs) const;
|
||||
};
|
||||
|
||||
|
||||
class row_iterator : public const_row_iterator
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
inline row_iterator(SpSubview& in_M, uword initial_pos = 0) : const_row_iterator(in_M, initial_pos) { }
|
||||
inline row_iterator(SpSubview& in_M, uword in_row, uword in_col) : const_row_iterator(in_M, in_row, in_col) { }
|
||||
inline row_iterator(const row_iterator& other) : const_row_iterator(other) { }
|
||||
|
||||
inline arma_hot SpValProxy<SpSubview<eT> > operator*();
|
||||
|
||||
|
||||
inline arma_hot SpValProxy< SpSubview<eT> > operator*();
|
||||
|
||||
// overloads needed for return type correctness
|
||||
inline arma_hot row_iterator& operator++();
|
||||
inline arma_warn_unused row_iterator operator++(int);
|
||||
|
||||
|
||||
inline arma_hot row_iterator& operator--();
|
||||
inline arma_warn_unused row_iterator operator--(int);
|
||||
|
||||
|
||||
// This has a different value_type than iterator_base.
|
||||
typedef SpValProxy<SpSubview<eT> > value_type;
|
||||
typedef const SpValProxy<SpSubview<eT> >* pointer;
|
||||
typedef const SpValProxy<SpSubview<eT> >& reference;
|
||||
typedef SpValProxy< SpSubview<eT> > value_type;
|
||||
typedef const SpValProxy< SpSubview<eT> >* pointer;
|
||||
typedef const SpValProxy< SpSubview<eT> >& reference;
|
||||
};
|
||||
|
||||
inline iterator begin();
|
||||
@@ -298,31 +306,30 @@ class SpSubview : public SpBase<eT, SpSubview<eT> >
|
||||
|
||||
inline iterator begin_col(const uword col_num);
|
||||
inline const_iterator begin_col(const uword col_num) const;
|
||||
|
||||
|
||||
inline row_iterator begin_row(const uword row_num = 0);
|
||||
inline const_row_iterator begin_row(const uword row_num = 0) const;
|
||||
|
||||
|
||||
inline iterator end();
|
||||
inline const_iterator end() const;
|
||||
inline const_iterator cend() const;
|
||||
|
||||
|
||||
inline row_iterator end_row();
|
||||
inline const_row_iterator end_row() const;
|
||||
|
||||
|
||||
inline row_iterator end_row(const uword row_num);
|
||||
inline const_row_iterator end_row(const uword row_num) const;
|
||||
|
||||
//! don't use this unless you're writing internal Armadillo code
|
||||
arma_inline bool is_alias(const SpMat<eT>& X) const;
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
friend class SpMat<eT>;
|
||||
friend class SpSubview_col<eT>;
|
||||
friend class SpSubview_row<eT>;
|
||||
|
||||
SpSubview();
|
||||
friend class SpValProxy< SpSubview<eT> >; // allow SpValProxy to call insert_element() and delete_element()
|
||||
|
||||
inline arma_warn_unused eT& insert_element(const uword in_row, const uword in_col, const eT in_val = eT(0));
|
||||
inline void delete_element(const uword in_row, const uword in_col);
|
||||
@@ -340,9 +347,9 @@ class SpSubview_col : public SpSubview<eT>
|
||||
typedef eT elem_type;
|
||||
typedef typename get_pod_type<elem_type>::result pod_type;
|
||||
|
||||
static const bool is_row = false;
|
||||
static const bool is_col = true;
|
||||
static const bool is_xvec = false;
|
||||
static constexpr bool is_row = false;
|
||||
static constexpr bool is_col = true;
|
||||
static constexpr bool is_xvec = false;
|
||||
|
||||
inline void operator= (const SpSubview<eT>& x);
|
||||
inline void operator= (const SpSubview_col& x);
|
||||
@@ -350,26 +357,22 @@ class SpSubview_col : public SpSubview<eT>
|
||||
template<typename T1> inline void operator= (const SpBase<eT,T1>& x);
|
||||
template<typename T1> inline void operator= (const Base<eT,T1>& x);
|
||||
|
||||
inline const SpOp<SpSubview_col<eT>,spop_htrans> t() const;
|
||||
inline const SpOp<SpSubview_col<eT>,spop_htrans> ht() const;
|
||||
inline const SpOp<SpSubview_col<eT>,spop_strans> st() const;
|
||||
inline arma_warn_unused const SpOp<SpSubview_col<eT>,spop_htrans> t() const;
|
||||
inline arma_warn_unused const SpOp<SpSubview_col<eT>,spop_htrans> ht() const;
|
||||
inline arma_warn_unused const SpOp<SpSubview_col<eT>,spop_strans> st() const;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
inline SpSubview_col(const SpMat<eT>& in_m, const uword in_col);
|
||||
inline SpSubview_col( SpMat<eT>& in_m, const uword in_col);
|
||||
|
||||
inline SpSubview_col(const SpMat<eT>& in_m, const uword in_col, const uword in_row1, const uword in_n_rows);
|
||||
inline SpSubview_col( SpMat<eT>& in_m, const uword in_col, const uword in_row1, const uword in_n_rows);
|
||||
inline SpSubview_col() = delete;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
friend class SpMat<eT>;
|
||||
friend class SpSubview<eT>;
|
||||
|
||||
SpSubview_col();
|
||||
};
|
||||
|
||||
|
||||
@@ -382,9 +385,9 @@ class SpSubview_row : public SpSubview<eT>
|
||||
typedef eT elem_type;
|
||||
typedef typename get_pod_type<elem_type>::result pod_type;
|
||||
|
||||
static const bool is_row = true;
|
||||
static const bool is_col = false;
|
||||
static const bool is_xvec = false;
|
||||
static constexpr bool is_row = true;
|
||||
static constexpr bool is_col = false;
|
||||
static constexpr bool is_xvec = false;
|
||||
|
||||
inline void operator= (const SpSubview<eT>& x);
|
||||
inline void operator= (const SpSubview_row& x);
|
||||
@@ -392,26 +395,22 @@ class SpSubview_row : public SpSubview<eT>
|
||||
template<typename T1> inline void operator= (const SpBase<eT,T1>& x);
|
||||
template<typename T1> inline void operator= (const Base<eT,T1>& x);
|
||||
|
||||
inline const SpOp<SpSubview_row<eT>,spop_htrans> t() const;
|
||||
inline const SpOp<SpSubview_row<eT>,spop_htrans> ht() const;
|
||||
inline const SpOp<SpSubview_row<eT>,spop_strans> st() const;
|
||||
inline arma_warn_unused const SpOp<SpSubview_row<eT>,spop_htrans> t() const;
|
||||
inline arma_warn_unused const SpOp<SpSubview_row<eT>,spop_htrans> ht() const;
|
||||
inline arma_warn_unused const SpOp<SpSubview_row<eT>,spop_strans> st() const;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
inline SpSubview_row(const SpMat<eT>& in_m, const uword in_row);
|
||||
inline SpSubview_row( SpMat<eT>& in_m, const uword in_row);
|
||||
|
||||
inline SpSubview_row(const SpMat<eT>& in_m, const uword in_row, const uword in_col1, const uword in_n_cols);
|
||||
inline SpSubview_row( SpMat<eT>& in_m, const uword in_row, const uword in_col1, const uword in_n_cols);
|
||||
inline SpSubview_row() = delete;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
friend class SpMat<eT>;
|
||||
friend class SpSubview<eT>;
|
||||
|
||||
SpSubview_row();
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
// Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
|
||||
//! \addtogroup SpSubview_col_list
|
||||
//! @{
|
||||
|
||||
|
||||
|
||||
template<typename eT, typename T1>
|
||||
class SpSubview_col_list : public SpBase< eT, SpSubview_col_list<eT,T1> >
|
||||
{
|
||||
public:
|
||||
|
||||
typedef eT elem_type;
|
||||
typedef typename get_pod_type<elem_type>::result pod_type;
|
||||
|
||||
static constexpr bool is_row = false;
|
||||
static constexpr bool is_col = false;
|
||||
static constexpr bool is_xvec = false;
|
||||
|
||||
const SpMat<eT>& m;
|
||||
const quasi_unwrap<T1> U_ci;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
arma_inline SpSubview_col_list(const SpMat<eT>& in_m, const Base<uword,T1>& in_ci);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
inline ~SpSubview_col_list();
|
||||
inline SpSubview_col_list() = delete;
|
||||
|
||||
template<typename functor> inline void for_each(functor F);
|
||||
template<typename functor> inline void for_each(functor F) const;
|
||||
|
||||
template<typename functor> inline void transform(functor F);
|
||||
|
||||
inline void replace(const eT old_val, const eT new_val);
|
||||
|
||||
inline void clean(const pod_type threshold);
|
||||
|
||||
inline void fill(const eT val);
|
||||
inline void zeros();
|
||||
inline void ones();
|
||||
|
||||
inline void operator+= (const eT val);
|
||||
inline void operator-= (const eT val);
|
||||
inline void operator*= (const eT val);
|
||||
inline void operator/= (const eT val);
|
||||
|
||||
template<typename expr> inline void operator= (const Base<eT, expr>& x);
|
||||
template<typename expr> inline void operator+=(const Base<eT, expr>& x);
|
||||
template<typename expr> inline void operator-=(const Base<eT, expr>& x);
|
||||
template<typename expr> inline void operator%=(const Base<eT, expr>& x);
|
||||
template<typename expr> inline void operator/=(const Base<eT, expr>& x);
|
||||
|
||||
inline void operator= (const SpSubview_col_list<eT,T1>& x);
|
||||
template<typename T2> inline void operator= (const SpSubview_col_list<eT,T2>& x);
|
||||
|
||||
template<typename expr> inline void operator= (const SpBase<eT,expr>& x);
|
||||
template<typename expr> inline void operator+= (const SpBase<eT,expr>& x);
|
||||
template<typename expr> inline void operator-= (const SpBase<eT,expr>& x);
|
||||
template<typename expr> inline void operator%= (const SpBase<eT,expr>& x);
|
||||
template<typename expr> inline void operator/= (const SpBase<eT,expr>& x);
|
||||
|
||||
inline static void extract(SpMat<eT>& out, const SpSubview_col_list& in);
|
||||
|
||||
inline static void plus_inplace(SpMat<eT>& out, const SpSubview_col_list& in);
|
||||
inline static void minus_inplace(SpMat<eT>& out, const SpSubview_col_list& in);
|
||||
inline static void schur_inplace(SpMat<eT>& out, const SpSubview_col_list& in);
|
||||
inline static void div_inplace(SpMat<eT>& out, const SpSubview_col_list& in);
|
||||
|
||||
|
||||
friend class SpMat<eT>;
|
||||
};
|
||||
|
||||
|
||||
|
||||
//! @}
|
||||
@@ -0,0 +1,719 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
// Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
|
||||
//! \addtogroup SpSubview_col_list
|
||||
//! @{
|
||||
|
||||
|
||||
|
||||
template<typename eT, typename T1>
|
||||
inline
|
||||
SpSubview_col_list<eT,T1>::~SpSubview_col_list()
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename eT, typename T1>
|
||||
arma_inline
|
||||
SpSubview_col_list<eT,T1>::SpSubview_col_list
|
||||
(
|
||||
const SpMat<eT>& in_m,
|
||||
const Base<uword,T1>& in_ci
|
||||
)
|
||||
: m (in_m )
|
||||
, U_ci(in_ci.get_ref())
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
const umat& ci = U_ci.M;
|
||||
const uword* ci_mem = ci.memptr();
|
||||
const uword ci_n_elem = ci.n_elem;
|
||||
|
||||
arma_debug_check
|
||||
(
|
||||
( (ci.is_vec() == false) && (ci.is_empty() == false) ),
|
||||
"SpMat::cols(): given object must be a vector"
|
||||
);
|
||||
|
||||
for(uword ci_count=0; ci_count < ci_n_elem; ++ci_count)
|
||||
{
|
||||
const uword i = ci_mem[ci_count];
|
||||
|
||||
arma_debug_check_bounds( (i >= in_m.n_cols), "SpMat::cols(): index out of bounds" );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//! apply a functor to each element
|
||||
template<typename eT, typename T1>
|
||||
template<typename functor>
|
||||
inline
|
||||
void
|
||||
SpSubview_col_list<eT,T1>::for_each(functor F)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
SpMat<eT> tmp(*this);
|
||||
|
||||
tmp.for_each(F);
|
||||
|
||||
(*this).operator=(tmp);
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename eT, typename T1>
|
||||
template<typename functor>
|
||||
inline
|
||||
void
|
||||
SpSubview_col_list<eT,T1>::for_each(functor F) const
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
const SpMat<eT> tmp(*this);
|
||||
|
||||
tmp.for_each(F);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//! transform each element using a functor
|
||||
template<typename eT, typename T1>
|
||||
template<typename functor>
|
||||
inline
|
||||
void
|
||||
SpSubview_col_list<eT,T1>::transform(functor F)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
SpMat<eT> tmp(*this);
|
||||
|
||||
tmp.transform(F);
|
||||
|
||||
(*this).operator=(tmp);
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename eT, typename T1>
|
||||
inline
|
||||
void
|
||||
SpSubview_col_list<eT,T1>::replace(const eT old_val, const eT new_val)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
SpMat<eT> tmp(*this);
|
||||
|
||||
tmp.replace(old_val, new_val);
|
||||
|
||||
(*this).operator=(tmp);
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename eT, typename T1>
|
||||
inline
|
||||
void
|
||||
SpSubview_col_list<eT,T1>::clean(const typename get_pod_type<eT>::result threshold)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
SpMat<eT> tmp(*this);
|
||||
|
||||
tmp.clean(threshold);
|
||||
|
||||
(*this).operator=(tmp);
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename eT, typename T1>
|
||||
inline
|
||||
void
|
||||
SpSubview_col_list<eT,T1>::fill(const eT val)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
Mat<eT> tmp(m.n_rows, U_ci.M.n_elem, arma_nozeros_indicator()); tmp.fill(val);
|
||||
|
||||
(*this).operator=(tmp);
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename eT, typename T1>
|
||||
inline
|
||||
void
|
||||
SpSubview_col_list<eT,T1>::zeros()
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
SpMat<eT>& m_local = const_cast< SpMat<eT>& >(m);
|
||||
|
||||
const umat& ci = U_ci.M;
|
||||
const uword* ci_mem = ci.memptr();
|
||||
const uword ci_n_elem = ci.n_elem;
|
||||
|
||||
m_local.sync_csc();
|
||||
m_local.invalidate_cache();
|
||||
|
||||
for(uword ci_count=0; ci_count < ci_n_elem; ++ci_count)
|
||||
{
|
||||
const uword i = ci_mem[ci_count];
|
||||
|
||||
const uword col_n_nonzero = m_local.col_ptrs[i+1] - m_local.col_ptrs[i];
|
||||
|
||||
uword offset = m_local.col_ptrs[i];
|
||||
|
||||
for(uword j=0; j < col_n_nonzero; ++j)
|
||||
{
|
||||
access::rw(m_local.values[offset]) = eT(0);
|
||||
|
||||
++offset;
|
||||
}
|
||||
}
|
||||
|
||||
m_local.remove_zeros();
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename eT, typename T1>
|
||||
inline
|
||||
void
|
||||
SpSubview_col_list<eT,T1>::ones()
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
const Mat<eT> tmp(m.n_rows, U_ci.M.n_elem, fill::ones);
|
||||
|
||||
(*this).operator=(tmp);
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename eT, typename T1>
|
||||
inline
|
||||
void
|
||||
SpSubview_col_list<eT,T1>::operator+= (const eT val)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
const SpMat<eT> tmp1(*this);
|
||||
|
||||
Mat<eT> tmp2(tmp1.n_rows, tmp1.n_cols, arma_nozeros_indicator()); tmp2.fill(val);
|
||||
|
||||
const Mat<eT> tmp3 = tmp1 + tmp2;
|
||||
|
||||
(*this).operator=(tmp3);
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename eT, typename T1>
|
||||
inline
|
||||
void
|
||||
SpSubview_col_list<eT,T1>::operator-= (const eT val)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
const SpMat<eT> tmp1(*this);
|
||||
|
||||
Mat<eT> tmp2(tmp1.n_rows, tmp1.n_cols, arma_nozeros_indicator()); tmp2.fill(val);
|
||||
|
||||
const Mat<eT> tmp3 = tmp1 - tmp2;
|
||||
|
||||
(*this).operator=(tmp3);
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename eT, typename T1>
|
||||
inline
|
||||
void
|
||||
SpSubview_col_list<eT,T1>::operator*= (const eT val)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
if(val == eT(0)) { (*this).zeros(); return; }
|
||||
|
||||
SpMat<eT>& m_local = const_cast< SpMat<eT>& >(m);
|
||||
|
||||
const umat& ci = U_ci.M;
|
||||
const uword* ci_mem = ci.memptr();
|
||||
const uword ci_n_elem = ci.n_elem;
|
||||
|
||||
m_local.sync_csc();
|
||||
m_local.invalidate_cache();
|
||||
|
||||
bool has_zero = false;
|
||||
|
||||
for(uword ci_count=0; ci_count < ci_n_elem; ++ci_count)
|
||||
{
|
||||
const uword i = ci_mem[ci_count];
|
||||
|
||||
const uword col_n_nonzero = m_local.col_ptrs[i+1] - m_local.col_ptrs[i];
|
||||
|
||||
uword offset = m_local.col_ptrs[i];
|
||||
|
||||
for(uword j=0; j < col_n_nonzero; ++j)
|
||||
{
|
||||
eT& m_local_val = access::rw(m_local.values[offset]);
|
||||
|
||||
m_local_val *= val;
|
||||
|
||||
if(m_local_val == eT(0)) { has_zero = true; }
|
||||
|
||||
++offset;
|
||||
}
|
||||
}
|
||||
|
||||
if(has_zero) { m_local.remove_zeros(); }
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename eT, typename T1>
|
||||
inline
|
||||
void
|
||||
SpSubview_col_list<eT,T1>::operator/= (const eT val)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
const SpMat<eT> tmp1(*this);
|
||||
|
||||
Mat<eT> tmp2(tmp1.n_rows, tmp1.n_cols, arma_nozeros_indicator()); tmp2.fill(val);
|
||||
|
||||
const SpMat<eT> tmp3 = tmp1 / tmp2;
|
||||
|
||||
(*this).operator=(tmp3);
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename eT, typename T1>
|
||||
template<typename expr>
|
||||
inline
|
||||
void
|
||||
SpSubview_col_list<eT,T1>::operator= (const Base<eT,expr>& x)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
const quasi_unwrap<expr> U(x.get_ref());
|
||||
const Mat<eT>& X = U.M;
|
||||
|
||||
SpMat<eT>& m_local = const_cast< SpMat<eT>& >(m);
|
||||
|
||||
const umat& ci = U_ci.M;
|
||||
const uword* ci_mem = ci.memptr();
|
||||
const uword ci_n_elem = ci.n_elem;
|
||||
|
||||
arma_debug_assert_same_size( m_local.n_rows, ci_n_elem, X.n_rows, X.n_cols, "SpMat::cols()" );
|
||||
|
||||
const uword X_n_elem = X.n_elem;
|
||||
const eT* X_mem = X.memptr();
|
||||
|
||||
uword X_n_nonzero = 0;
|
||||
|
||||
for(uword i=0; i < X_n_elem; ++i) { X_n_nonzero += (X_mem[i] != eT(0)) ? uword(1) : uword(0); }
|
||||
|
||||
SpMat<eT> Y(arma_reserve_indicator(), X.n_rows, m_local.n_cols, X_n_nonzero);
|
||||
|
||||
uword count = 0;
|
||||
|
||||
for(uword ci_count=0; ci_count < ci_n_elem; ++ci_count)
|
||||
{
|
||||
const uword i = ci_mem[ci_count];
|
||||
|
||||
for(uword row=0; row < X.n_rows; ++row)
|
||||
{
|
||||
const eT X_val = (*X_mem); ++X_mem;
|
||||
|
||||
if(X_val != eT(0))
|
||||
{
|
||||
access::rw(Y.row_indices[count]) = row;
|
||||
access::rw(Y.values [count]) = X_val;
|
||||
++count;
|
||||
++access::rw(Y.col_ptrs[i + 1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// fix the column pointers
|
||||
for(uword i = 0; i < Y.n_cols; ++i)
|
||||
{
|
||||
access::rw(Y.col_ptrs[i+1]) += Y.col_ptrs[i];
|
||||
}
|
||||
|
||||
(*this).zeros();
|
||||
|
||||
SpMat<eT> tmp = m_local + Y;
|
||||
|
||||
m_local.steal_mem(tmp);
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename eT, typename T1>
|
||||
template<typename expr>
|
||||
inline
|
||||
void
|
||||
SpSubview_col_list<eT,T1>::operator+= (const Base<eT,expr>& x)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
const Mat<eT> tmp = SpMat<eT>(*this) + x.get_ref();
|
||||
|
||||
(*this).operator=(tmp);
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename eT, typename T1>
|
||||
template<typename expr>
|
||||
inline
|
||||
void
|
||||
SpSubview_col_list<eT,T1>::operator-= (const Base<eT,expr>& x)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
const Mat<eT> tmp = SpMat<eT>(*this) - x.get_ref();
|
||||
|
||||
(*this).operator=(tmp);
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename eT, typename T1>
|
||||
template<typename expr>
|
||||
inline
|
||||
void
|
||||
SpSubview_col_list<eT,T1>::operator%= (const Base<eT,expr>& x)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
const SpMat<eT> tmp = SpMat<eT>(*this) % x.get_ref();
|
||||
|
||||
(*this).operator=(tmp);
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename eT, typename T1>
|
||||
template<typename expr>
|
||||
inline
|
||||
void
|
||||
SpSubview_col_list<eT,T1>::operator/= (const Base<eT,expr>& x)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
const SpMat<eT> tmp = SpMat<eT>(*this) / x.get_ref();
|
||||
|
||||
(*this).operator=(tmp);
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename eT, typename T1>
|
||||
inline
|
||||
void
|
||||
SpSubview_col_list<eT,T1>::operator= (const SpSubview_col_list<eT,T1>& x)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
const SpMat<eT> tmp(x);
|
||||
|
||||
(*this).operator=(tmp);
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename eT, typename T1>
|
||||
template<typename T2>
|
||||
inline
|
||||
void
|
||||
SpSubview_col_list<eT,T1>::operator= (const SpSubview_col_list<eT,T2>& x)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
const SpMat<eT> tmp(x);
|
||||
|
||||
(*this).operator=(tmp);
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename eT, typename T1>
|
||||
template<typename expr>
|
||||
inline
|
||||
void
|
||||
SpSubview_col_list<eT,T1>::operator= (const SpBase<eT,expr>& x)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
const unwrap_spmat<expr> U(x.get_ref());
|
||||
const SpMat<eT>& X = U.M;
|
||||
|
||||
if(U.is_alias(m))
|
||||
{
|
||||
const SpMat<eT> tmp(X);
|
||||
|
||||
(*this).operator=(tmp);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
SpMat<eT>& m_local = const_cast< SpMat<eT>& >(m);
|
||||
|
||||
const umat& ci = U_ci.M;
|
||||
const uword* ci_mem = ci.memptr();
|
||||
const uword ci_n_elem = ci.n_elem;
|
||||
|
||||
arma_debug_assert_same_size( m_local.n_rows, ci_n_elem, X.n_rows, X.n_cols, "SpMat::cols()" );
|
||||
|
||||
SpMat<eT> Y(arma_reserve_indicator(), X.n_rows, m_local.n_cols, X.n_nonzero);
|
||||
|
||||
uword count = 0;
|
||||
|
||||
for(uword ci_count=0; ci_count < ci_n_elem; ++ci_count)
|
||||
{
|
||||
const uword i = ci_mem[ci_count];
|
||||
|
||||
typename SpMat<eT>::const_col_iterator X_col_it = X.begin_col(ci_count);
|
||||
typename SpMat<eT>::const_col_iterator X_col_it_end = X.end_col(ci_count);
|
||||
|
||||
while(X_col_it != X_col_it_end)
|
||||
{
|
||||
access::rw(Y.row_indices[count]) = X_col_it.row();
|
||||
access::rw(Y.values [count]) = (*X_col_it);
|
||||
++count;
|
||||
++access::rw(Y.col_ptrs[i + 1]);
|
||||
++X_col_it;
|
||||
}
|
||||
}
|
||||
|
||||
// fix the column pointers
|
||||
for(uword i = 0; i < Y.n_cols; ++i)
|
||||
{
|
||||
access::rw(Y.col_ptrs[i+1]) += Y.col_ptrs[i];
|
||||
}
|
||||
|
||||
(*this).zeros();
|
||||
|
||||
SpMat<eT> tmp = m_local + Y;
|
||||
|
||||
m_local.steal_mem(tmp);
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename eT, typename T1>
|
||||
template<typename expr>
|
||||
inline
|
||||
void
|
||||
SpSubview_col_list<eT,T1>::operator+= (const SpBase<eT,expr>& x)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
const SpMat<eT> tmp = SpMat<eT>(*this) + x.get_ref();
|
||||
|
||||
(*this).operator=(tmp);
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename eT, typename T1>
|
||||
template<typename expr>
|
||||
inline
|
||||
void
|
||||
SpSubview_col_list<eT,T1>::operator-= (const SpBase<eT,expr>& x)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
const SpMat<eT> tmp = SpMat<eT>(*this) - x.get_ref();
|
||||
|
||||
(*this).operator=(tmp);
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename eT, typename T1>
|
||||
template<typename expr>
|
||||
inline
|
||||
void
|
||||
SpSubview_col_list<eT,T1>::operator%= (const SpBase<eT,expr>& x)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
const SpMat<eT> tmp = SpMat<eT>(*this) % x.get_ref();
|
||||
|
||||
(*this).operator=(tmp);
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename eT, typename T1>
|
||||
template<typename expr>
|
||||
inline
|
||||
void
|
||||
SpSubview_col_list<eT,T1>::operator/= (const SpBase<eT,expr>& x)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
SpMat<eT> tmp(*this);
|
||||
|
||||
tmp /= x.get_ref();
|
||||
|
||||
(*this).operator=(tmp);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
|
||||
template<typename eT, typename T1>
|
||||
inline
|
||||
void
|
||||
SpSubview_col_list<eT,T1>::extract(SpMat<eT>& out, const SpSubview_col_list<eT,T1>& in)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
// NOTE: aliasing is handled by SpMat<eT>::operator=(const SpSubview_col_list<eT,T1>& in)
|
||||
|
||||
const umat& ci = in.U_ci.M;
|
||||
const uword* ci_mem = ci.memptr();
|
||||
const uword ci_n_elem = ci.n_elem;
|
||||
|
||||
const SpMat<eT>& in_m = in.m;
|
||||
|
||||
in_m.sync_csc();
|
||||
|
||||
uword total_n_nonzero = 0;
|
||||
|
||||
for(uword ci_count=0; ci_count < ci_n_elem; ++ci_count)
|
||||
{
|
||||
const uword i = ci_mem[ci_count];
|
||||
|
||||
const uword col_n_nonzero = in_m.col_ptrs[i+1] - in_m.col_ptrs[i];
|
||||
|
||||
total_n_nonzero += col_n_nonzero;
|
||||
}
|
||||
|
||||
out.reserve(in.m.n_rows, ci_n_elem, total_n_nonzero);
|
||||
|
||||
uword out_n_nonzero = 0;
|
||||
uword out_col_count = 0;
|
||||
|
||||
for(uword ci_count=0; ci_count < ci_n_elem; ++ci_count)
|
||||
{
|
||||
const uword i = ci_mem[ci_count];
|
||||
|
||||
const uword col_n_nonzero = in_m.col_ptrs[i+1] - in_m.col_ptrs[i];
|
||||
|
||||
uword offset = in_m.col_ptrs[i];
|
||||
|
||||
for(uword j=0; j < col_n_nonzero; ++j)
|
||||
{
|
||||
const eT val = in_m.values [ offset ];
|
||||
const uword row = in_m.row_indices[ offset ];
|
||||
|
||||
++offset;
|
||||
|
||||
access::rw(out.values [out_n_nonzero]) = val;
|
||||
access::rw(out.row_indices[out_n_nonzero]) = row;
|
||||
|
||||
access::rw(out.col_ptrs[out_col_count+1])++;
|
||||
|
||||
++out_n_nonzero;
|
||||
}
|
||||
|
||||
++out_col_count;
|
||||
}
|
||||
|
||||
// fix the column pointers
|
||||
for(uword i = 0; i < out.n_cols; ++i)
|
||||
{
|
||||
access::rw(out.col_ptrs[i+1]) += out.col_ptrs[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename eT, typename T1>
|
||||
inline
|
||||
void
|
||||
SpSubview_col_list<eT,T1>::plus_inplace(SpMat<eT>& out, const SpSubview_col_list& in)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
const SpMat<eT> tmp(in);
|
||||
|
||||
out += tmp;
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename eT, typename T1>
|
||||
inline
|
||||
void
|
||||
SpSubview_col_list<eT,T1>::minus_inplace(SpMat<eT>& out, const SpSubview_col_list& in)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
const SpMat<eT> tmp(in);
|
||||
|
||||
out -= tmp;
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename eT, typename T1>
|
||||
inline
|
||||
void
|
||||
SpSubview_col_list<eT,T1>::schur_inplace(SpMat<eT>& out, const SpSubview_col_list& in)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
const SpMat<eT> tmp(in);
|
||||
|
||||
out %= tmp;
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename eT, typename T1>
|
||||
inline
|
||||
void
|
||||
SpSubview_col_list<eT,T1>::div_inplace(SpMat<eT>& out, const SpSubview_col_list& in)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
const SpMat<eT> tmp(in);
|
||||
|
||||
out /= tmp;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//! @}
|
||||
@@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
// Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
//
|
||||
@@ -516,10 +518,10 @@ SpSubview<eT>::const_iterator::operator!=(const typename SpMat<eT>::const_row_it
|
||||
template<typename eT>
|
||||
inline
|
||||
arma_hot
|
||||
SpValProxy<SpSubview<eT> >
|
||||
SpValProxy< SpSubview<eT> >
|
||||
SpSubview<eT>::iterator::operator*()
|
||||
{
|
||||
return SpValProxy<SpSubview<eT> >(
|
||||
return SpValProxy< SpSubview<eT> >(
|
||||
const_iterator::row(),
|
||||
iterator_base::col(),
|
||||
access::rw(*iterator_base::M),
|
||||
@@ -625,9 +627,9 @@ SpSubview<eT>::const_row_iterator::const_row_iterator(const SpSubview<eT>& in_M,
|
||||
// Since we don't know where the elements are in each row, we have to loop
|
||||
// across all columns looking for elements in row 0 and add to our sum, then
|
||||
// in row 1, and so forth, until we get to the desired position.
|
||||
for (uword row = 0; row < iterator_base::M->n_rows; ++row)
|
||||
for(uword row = 0; row < iterator_base::M->n_rows; ++row)
|
||||
{
|
||||
for (uword col = 0; col < iterator_base::M->n_cols; ++col)
|
||||
for(uword col = 0; col < iterator_base::M->n_cols; ++col)
|
||||
{
|
||||
// Find the first element with row greater than or equal to row + aux_row.
|
||||
const uword col_offset = iterator_base::M->m.col_ptrs[col + aux_col ];
|
||||
@@ -636,24 +638,24 @@ SpSubview<eT>::const_row_iterator::const_row_iterator(const SpSubview<eT>& in_M,
|
||||
const uword* start_ptr = &iterator_base::M->m.row_indices[ col_offset];
|
||||
const uword* end_ptr = &iterator_base::M->m.row_indices[next_col_offset];
|
||||
|
||||
if (start_ptr != end_ptr)
|
||||
if(start_ptr != end_ptr)
|
||||
{
|
||||
const uword* pos_ptr = std::lower_bound(start_ptr, end_ptr, row + aux_row);
|
||||
|
||||
const uword offset = uword(pos_ptr - start_ptr);
|
||||
|
||||
if (iterator_base::M->m.row_indices[col_offset + offset] == row + aux_row)
|
||||
if(iterator_base::M->m.row_indices[col_offset + offset] == row + aux_row)
|
||||
{
|
||||
cur_actual_pos = col_offset + offset;
|
||||
|
||||
// Increment position portably.
|
||||
if (cur_pos == std::numeric_limits<uword>::max())
|
||||
if(cur_pos == std::numeric_limits<uword>::max())
|
||||
cur_pos = 0;
|
||||
else
|
||||
++cur_pos;
|
||||
|
||||
// Do we terminate?
|
||||
if (cur_pos == initial_pos)
|
||||
if(cur_pos == initial_pos)
|
||||
{
|
||||
internal_row = row;
|
||||
iterator_base::internal_col = col;
|
||||
@@ -702,7 +704,7 @@ SpSubview<eT>::const_row_iterator::const_row_iterator(const SpSubview<eT>& in_M,
|
||||
uword cur_min_col = 0;
|
||||
uword cur_actual_pos = 0;
|
||||
|
||||
for (uword col = 0; col < iterator_base::M->n_cols; ++col)
|
||||
for(uword col = 0; col < iterator_base::M->n_cols; ++col)
|
||||
{
|
||||
// Find the first element with row greater than or equal to in_row.
|
||||
const uword col_offset = iterator_base::M->m.col_ptrs[col + aux_col ];
|
||||
@@ -711,12 +713,12 @@ SpSubview<eT>::const_row_iterator::const_row_iterator(const SpSubview<eT>& in_M,
|
||||
const uword* start_ptr = &iterator_base::M->m.row_indices[ col_offset];
|
||||
const uword* end_ptr = &iterator_base::M->m.row_indices[next_col_offset];
|
||||
|
||||
if (start_ptr != end_ptr)
|
||||
if(start_ptr != end_ptr)
|
||||
{
|
||||
// First let us find the first element that is in the subview.
|
||||
const uword* first_subview_ptr = std::lower_bound(start_ptr, end_ptr, aux_row);
|
||||
|
||||
if (first_subview_ptr != end_ptr && (*first_subview_ptr) < aux_row + iterator_base::M->n_rows)
|
||||
if(first_subview_ptr != end_ptr && (*first_subview_ptr) < aux_row + iterator_base::M->n_rows)
|
||||
{
|
||||
// There exists at least one element in the subview.
|
||||
const uword* pos_ptr = std::lower_bound(first_subview_ptr, end_ptr, aux_row + in_row);
|
||||
@@ -725,15 +727,15 @@ SpSubview<eT>::const_row_iterator::const_row_iterator(const SpSubview<eT>& in_M,
|
||||
// than in_row.
|
||||
cur_pos += uword(pos_ptr - first_subview_ptr);
|
||||
|
||||
if (pos_ptr != end_ptr && (*pos_ptr) < aux_row + iterator_base::M->n_rows)
|
||||
if(pos_ptr != end_ptr && (*pos_ptr) < aux_row + iterator_base::M->n_rows)
|
||||
{
|
||||
// This is the row index of the first element in the column with row
|
||||
// index greater than or equal to in_row + aux_row.
|
||||
if ((*pos_ptr) - aux_row < cur_min_row)
|
||||
if((*pos_ptr) - aux_row < cur_min_row)
|
||||
{
|
||||
// If we are in the desired row but before the desired column, we
|
||||
// can't take this.
|
||||
if (col >= in_col)
|
||||
if(col >= in_col)
|
||||
{
|
||||
cur_min_row = (*pos_ptr) - aux_row;
|
||||
cur_min_col = col;
|
||||
@@ -795,7 +797,7 @@ SpSubview<eT>::const_row_iterator::operator++()
|
||||
uword next_min_col = 0;
|
||||
uword next_actual_pos = 0;
|
||||
|
||||
for (uword col = iterator_base::internal_col + 1; col < M_n_cols; ++col)
|
||||
for(uword col = iterator_base::internal_col + 1; col < M_n_cols; ++col)
|
||||
{
|
||||
// Find the first element with row greater than or equal to row.
|
||||
const uword col_offset = iterator_base::M->m.col_ptrs[col + aux_col ];
|
||||
@@ -804,24 +806,24 @@ SpSubview<eT>::const_row_iterator::operator++()
|
||||
const uword* start_ptr = &iterator_base::M->m.row_indices[ col_offset];
|
||||
const uword* end_ptr = &iterator_base::M->m.row_indices[next_col_offset];
|
||||
|
||||
if (start_ptr != end_ptr)
|
||||
if(start_ptr != end_ptr)
|
||||
{
|
||||
// Find the first element in the column with row greater than or equal to
|
||||
// the current row. Since this is a subview, it's possible that we may
|
||||
// find rows past the end of the subview.
|
||||
const uword* pos_ptr = std::lower_bound(start_ptr, end_ptr, internal_row + aux_row);
|
||||
|
||||
if (pos_ptr != end_ptr)
|
||||
if(pos_ptr != end_ptr)
|
||||
{
|
||||
// We found something; is the row index correct?
|
||||
if ((*pos_ptr) == internal_row + aux_row && (*pos_ptr) < aux_row + iterator_base::M->n_rows)
|
||||
if((*pos_ptr) == internal_row + aux_row && (*pos_ptr) < aux_row + iterator_base::M->n_rows)
|
||||
{
|
||||
// Exact match---so we are done.
|
||||
iterator_base::internal_col = col;
|
||||
actual_pos = col_offset + (pos_ptr - start_ptr);
|
||||
return *this;
|
||||
}
|
||||
else if ((*pos_ptr) < next_min_row + aux_row && (*pos_ptr) < aux_row + iterator_base::M->n_rows)
|
||||
else if((*pos_ptr) < next_min_row + aux_row && (*pos_ptr) < aux_row + iterator_base::M->n_rows)
|
||||
{
|
||||
// The first element in this column is in a subsequent row, but it's
|
||||
// the minimum row we've seen so far.
|
||||
@@ -829,7 +831,7 @@ SpSubview<eT>::const_row_iterator::operator++()
|
||||
next_min_col = col;
|
||||
next_actual_pos = col_offset + (pos_ptr - start_ptr);
|
||||
}
|
||||
else if ((*pos_ptr) == next_min_row + aux_row && col < next_min_col && (*pos_ptr) < aux_row + iterator_base::M->n_rows)
|
||||
else if((*pos_ptr) == next_min_row + aux_row && col < next_min_col && (*pos_ptr) < aux_row + iterator_base::M->n_rows)
|
||||
{
|
||||
// The first element in this column is in a subsequent row that we
|
||||
// already have another elemnt for, but the column index is less so
|
||||
@@ -842,7 +844,7 @@ SpSubview<eT>::const_row_iterator::operator++()
|
||||
}
|
||||
|
||||
// Restart the search in the next row.
|
||||
for (uword col = 0; col <= iterator_base::internal_col; ++col)
|
||||
for(uword col = 0; col <= iterator_base::internal_col; ++col)
|
||||
{
|
||||
// Find the first element with row greater than or equal to row + 1.
|
||||
const uword col_offset = iterator_base::M->m.col_ptrs[col + aux_col ];
|
||||
@@ -851,14 +853,14 @@ SpSubview<eT>::const_row_iterator::operator++()
|
||||
const uword* start_ptr = &iterator_base::M->m.row_indices[ col_offset];
|
||||
const uword* end_ptr = &iterator_base::M->m.row_indices[next_col_offset];
|
||||
|
||||
if (start_ptr != end_ptr)
|
||||
if(start_ptr != end_ptr)
|
||||
{
|
||||
const uword* pos_ptr = std::lower_bound(start_ptr, end_ptr, internal_row + aux_row + 1);
|
||||
|
||||
if (pos_ptr != end_ptr)
|
||||
if(pos_ptr != end_ptr)
|
||||
{
|
||||
// We found something in the column, but is the row index correct?
|
||||
if ((*pos_ptr) == internal_row + aux_row + 1 && (*pos_ptr) < aux_row + iterator_base::M->n_rows)
|
||||
if((*pos_ptr) == internal_row + aux_row + 1 && (*pos_ptr) < aux_row + iterator_base::M->n_rows)
|
||||
{
|
||||
// Exact match---so we are done.
|
||||
iterator_base::internal_col = col;
|
||||
@@ -866,7 +868,7 @@ SpSubview<eT>::const_row_iterator::operator++()
|
||||
actual_pos = col_offset + (pos_ptr - start_ptr);
|
||||
return *this;
|
||||
}
|
||||
else if ((*pos_ptr) < next_min_row + aux_row && (*pos_ptr) < aux_row + iterator_base::M->n_rows)
|
||||
else if((*pos_ptr) < next_min_row + aux_row && (*pos_ptr) < aux_row + iterator_base::M->n_rows)
|
||||
{
|
||||
// The first element in this column is in a subsequent row, but it's
|
||||
// the minimum row we've seen so far.
|
||||
@@ -874,7 +876,7 @@ SpSubview<eT>::const_row_iterator::operator++()
|
||||
next_min_col = col;
|
||||
next_actual_pos = col_offset + (pos_ptr - start_ptr);
|
||||
}
|
||||
else if ((*pos_ptr) == next_min_row + aux_row && col < next_min_col && (*pos_ptr) < aux_row + iterator_base::M->n_rows)
|
||||
else if((*pos_ptr) == next_min_row + aux_row && col < next_min_col && (*pos_ptr) < aux_row + iterator_base::M->n_rows)
|
||||
{
|
||||
// We've found a better column.
|
||||
next_min_col = col;
|
||||
@@ -914,7 +916,7 @@ arma_hot
|
||||
typename SpSubview<eT>::const_row_iterator&
|
||||
SpSubview<eT>::const_row_iterator::operator--()
|
||||
{
|
||||
if (iterator_base::internal_pos == 0)
|
||||
if(iterator_base::internal_pos == 0)
|
||||
{
|
||||
// We are already at the beginning.
|
||||
return *this;
|
||||
@@ -930,7 +932,7 @@ SpSubview<eT>::const_row_iterator::operator--()
|
||||
uword max_col = 0;
|
||||
uword next_actual_pos = 0;
|
||||
|
||||
for (uword col = iterator_base::internal_col; col >= 1; --col)
|
||||
for(uword col = iterator_base::internal_col; col >= 1; --col)
|
||||
{
|
||||
// Find the first element with row greater than or equal to in_row + 1.
|
||||
const uword col_offset = iterator_base::M->m.col_ptrs[col + aux_col - 1];
|
||||
@@ -939,21 +941,21 @@ SpSubview<eT>::const_row_iterator::operator--()
|
||||
const uword* start_ptr = &iterator_base::M->m.row_indices[ col_offset];
|
||||
const uword* end_ptr = &iterator_base::M->m.row_indices[next_col_offset];
|
||||
|
||||
if (start_ptr != end_ptr)
|
||||
if(start_ptr != end_ptr)
|
||||
{
|
||||
// There are elements in this column.
|
||||
const uword* pos_ptr = std::lower_bound(start_ptr, end_ptr, internal_row + aux_row + 1);
|
||||
|
||||
if (pos_ptr != start_ptr)
|
||||
if(pos_ptr != start_ptr)
|
||||
{
|
||||
if (*(pos_ptr - 1) > max_row + aux_row)
|
||||
if(*(pos_ptr - 1) > max_row + aux_row)
|
||||
{
|
||||
// There are elements in this column with row index < internal_row.
|
||||
max_row = *(pos_ptr - 1) - aux_row;
|
||||
max_col = col - 1;
|
||||
next_actual_pos = col_offset + (pos_ptr - 1 - start_ptr);
|
||||
}
|
||||
else if (*(pos_ptr - 1) == max_row + aux_row && (col - 1) >= max_col)
|
||||
else if(*(pos_ptr - 1) == max_row + aux_row && (col - 1) >= max_col)
|
||||
{
|
||||
max_col = col - 1;
|
||||
next_actual_pos = col_offset + (pos_ptr - 1 - start_ptr);
|
||||
@@ -962,7 +964,7 @@ SpSubview<eT>::const_row_iterator::operator--()
|
||||
}
|
||||
}
|
||||
|
||||
for (uword col = iterator_base::M->n_cols - 1; col >= iterator_base::internal_col; --col)
|
||||
for(uword col = iterator_base::M->n_cols - 1; col >= iterator_base::internal_col; --col)
|
||||
{
|
||||
// Find the first element with row greater than or equal to row + 1.
|
||||
const uword col_offset = iterator_base::M->m.col_ptrs[col + aux_col ];
|
||||
@@ -971,21 +973,21 @@ SpSubview<eT>::const_row_iterator::operator--()
|
||||
const uword* start_ptr = &iterator_base::M->m.row_indices[ col_offset];
|
||||
const uword* end_ptr = &iterator_base::M->m.row_indices[next_col_offset];
|
||||
|
||||
if (start_ptr != end_ptr)
|
||||
if(start_ptr != end_ptr)
|
||||
{
|
||||
// There are elements in this column.
|
||||
const uword* pos_ptr = std::lower_bound(start_ptr, end_ptr, internal_row + aux_row);
|
||||
|
||||
if (pos_ptr != start_ptr)
|
||||
if(pos_ptr != start_ptr)
|
||||
{
|
||||
// There are elements in this column with row index < internal_row.
|
||||
if (*(pos_ptr - 1) > max_row + aux_row)
|
||||
if(*(pos_ptr - 1) > max_row + aux_row)
|
||||
{
|
||||
max_row = *(pos_ptr - 1) - aux_row;
|
||||
max_col = col;
|
||||
next_actual_pos = col_offset + (pos_ptr - 1 - start_ptr);
|
||||
}
|
||||
else if (*(pos_ptr - 1) == max_row + aux_row && col >= max_col)
|
||||
else if(*(pos_ptr - 1) == max_row + aux_row && col >= max_col)
|
||||
{
|
||||
max_col = col;
|
||||
next_actual_pos = col_offset + (pos_ptr - 1 - start_ptr);
|
||||
@@ -993,7 +995,7 @@ SpSubview<eT>::const_row_iterator::operator--()
|
||||
}
|
||||
}
|
||||
|
||||
if (col == 0) // Catch edge case that the loop termination condition won't.
|
||||
if(col == 0) // Catch edge case that the loop termination condition won't.
|
||||
{
|
||||
break;
|
||||
}
|
||||
@@ -1118,10 +1120,10 @@ SpSubview<eT>::const_row_iterator::operator!=(const typename SpMat<eT>::const_ro
|
||||
template<typename eT>
|
||||
inline
|
||||
arma_hot
|
||||
SpValProxy<SpSubview<eT> >
|
||||
SpValProxy< SpSubview<eT> >
|
||||
SpSubview<eT>::row_iterator::operator*()
|
||||
{
|
||||
return SpValProxy<SpSubview<eT> >(
|
||||
return SpValProxy< SpSubview<eT> >(
|
||||
const_row_iterator::internal_row,
|
||||
iterator_base::internal_col,
|
||||
access::rw(*iterator_base::M),
|
||||
@@ -1182,4 +1184,5 @@ SpSubview<eT>::row_iterator::operator--(int)
|
||||
return tmp;
|
||||
}
|
||||
|
||||
|
||||
//! @}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
// Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
//
|
||||
@@ -18,6 +20,15 @@
|
||||
//! @{
|
||||
|
||||
|
||||
template<typename eT>
|
||||
inline
|
||||
SpSubview<eT>::~SpSubview()
|
||||
{
|
||||
arma_extra_debug_sigprint_this(this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename eT>
|
||||
inline
|
||||
SpSubview<eT>::SpSubview(const SpMat<eT>& in_m, const uword in_row1, const uword in_col1, const uword in_n_rows, const uword in_n_cols)
|
||||
@@ -29,7 +40,7 @@ SpSubview<eT>::SpSubview(const SpMat<eT>& in_m, const uword in_row1, const uword
|
||||
, n_elem(in_n_rows * in_n_cols)
|
||||
, n_nonzero(0)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_extra_debug_sigprint_this(this);
|
||||
|
||||
m.sync_csc();
|
||||
|
||||
@@ -54,43 +65,41 @@ SpSubview<eT>::SpSubview(const SpMat<eT>& in_m, const uword in_row1, const uword
|
||||
|
||||
template<typename eT>
|
||||
inline
|
||||
SpSubview<eT>::SpSubview(SpMat<eT>& in_m, const uword in_row1, const uword in_col1, const uword in_n_rows, const uword in_n_cols)
|
||||
: m(in_m)
|
||||
, aux_row1(in_row1)
|
||||
, aux_col1(in_col1)
|
||||
, n_rows(in_n_rows)
|
||||
, n_cols(in_n_cols)
|
||||
, n_elem(in_n_rows * in_n_cols)
|
||||
, n_nonzero(0)
|
||||
SpSubview<eT>::SpSubview(const SpSubview<eT>& in)
|
||||
: m (in.m )
|
||||
, aux_row1 (in.aux_row1 )
|
||||
, aux_col1 (in.aux_col1 )
|
||||
, n_rows (in.n_rows )
|
||||
, n_cols (in.n_cols )
|
||||
, n_elem (in.n_elem )
|
||||
, n_nonzero(in.n_nonzero)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
m.sync_csc();
|
||||
|
||||
// There must be a O(1) way to do this
|
||||
uword lend = m.col_ptrs[in_col1 + in_n_cols];
|
||||
uword lend_row = in_row1 + in_n_rows;
|
||||
uword count = 0;
|
||||
|
||||
for(uword i = m.col_ptrs[in_col1]; i < lend; ++i)
|
||||
{
|
||||
const uword m_row_indices_i = m.row_indices[i];
|
||||
|
||||
const bool condition = (m_row_indices_i >= in_row1) && (m_row_indices_i < lend_row);
|
||||
|
||||
count += condition ? uword(1) : uword(0);
|
||||
}
|
||||
|
||||
access::rw(n_nonzero) = count;
|
||||
arma_extra_debug_sigprint(arma_str::format("this = %x in = %x") % this % &in);
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename eT>
|
||||
inline
|
||||
SpSubview<eT>::~SpSubview()
|
||||
SpSubview<eT>::SpSubview(SpSubview<eT>&& in)
|
||||
: m (in.m )
|
||||
, aux_row1 (in.aux_row1 )
|
||||
, aux_col1 (in.aux_col1 )
|
||||
, n_rows (in.n_rows )
|
||||
, n_cols (in.n_cols )
|
||||
, n_elem (in.n_elem )
|
||||
, n_nonzero(in.n_nonzero)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_extra_debug_sigprint(arma_str::format("this = %x in = %x") % this % &in);
|
||||
|
||||
// for paranoia
|
||||
|
||||
access::rw(in.aux_row1 ) = 0;
|
||||
access::rw(in.aux_col1 ) = 0;
|
||||
access::rw(in.n_rows ) = 0;
|
||||
access::rw(in.n_cols ) = 0;
|
||||
access::rw(in.n_elem ) = 0;
|
||||
access::rw(in.n_nonzero) = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -102,12 +111,9 @@ SpSubview<eT>::operator+=(const eT val)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
if(val == eT(0))
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
if(val == eT(0)) { return *this; }
|
||||
|
||||
Mat<eT> tmp( (*this).n_rows, (*this).n_cols );
|
||||
Mat<eT> tmp( (*this).n_rows, (*this).n_cols, arma_nozeros_indicator() );
|
||||
|
||||
tmp.fill(val);
|
||||
|
||||
@@ -122,13 +128,10 @@ const SpSubview<eT>&
|
||||
SpSubview<eT>::operator-=(const eT val)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
if(val == eT(0))
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
Mat<eT> tmp( (*this).n_rows, (*this).n_cols );
|
||||
|
||||
if(val == eT(0)) { return *this; }
|
||||
|
||||
Mat<eT> tmp( (*this).n_rows, (*this).n_cols, arma_nozeros_indicator() );
|
||||
|
||||
tmp.fill(val);
|
||||
|
||||
@@ -320,7 +323,7 @@ const SpSubview<eT>&
|
||||
SpSubview<eT>::operator-=(const Base<eT, T1>& x)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
|
||||
return (*this).operator=( (*this) - x.get_ref() );
|
||||
}
|
||||
|
||||
@@ -350,7 +353,7 @@ const SpSubview<eT>&
|
||||
SpSubview<eT>::operator%=(const Base<eT, T1>& x)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
|
||||
return (*this).operator=( (*this) % x.get_ref() );
|
||||
}
|
||||
|
||||
@@ -363,7 +366,7 @@ const SpSubview<eT>&
|
||||
SpSubview<eT>::operator/=(const Base<eT, T1>& x)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
|
||||
return (*this).operator=( (*this) / x.get_ref() );
|
||||
}
|
||||
|
||||
@@ -404,16 +407,18 @@ SpSubview<eT>::operator_equ_common(const SpBase<eT, T1>& in)
|
||||
|
||||
const unwrap_spmat<T1> U(in.get_ref());
|
||||
|
||||
arma_debug_assert_same_size(n_rows, n_cols, U.M.n_rows, U.M.n_cols, "insertion into sparse submatrix");
|
||||
|
||||
if(U.is_alias(m))
|
||||
{
|
||||
const SpMat<eT> tmp(U.M);
|
||||
|
||||
return (*this).operator_equ_common(tmp);
|
||||
spglue_merge::subview_merge(*this, tmp);
|
||||
}
|
||||
else
|
||||
{
|
||||
spglue_merge::subview_merge(*this, U.M);
|
||||
}
|
||||
|
||||
arma_debug_assert_same_size(n_rows, n_cols, U.M.n_rows, U.M.n_cols, "insertion into sparse submatrix");
|
||||
|
||||
spglue_merge::subview_merge(*this, U.M);
|
||||
|
||||
return *this;
|
||||
}
|
||||
@@ -455,7 +460,7 @@ const SpSubview<eT>&
|
||||
SpSubview<eT>::operator*=(const SpBase<eT, T1>& x)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
|
||||
return (*this).operator=( (*this) * x.get_ref() );
|
||||
}
|
||||
|
||||
@@ -475,7 +480,6 @@ SpSubview<eT>::operator%=(const SpBase<eT, T1>& x)
|
||||
|
||||
|
||||
|
||||
//! If you are using this function, you are probably misguided.
|
||||
template<typename eT>
|
||||
template<typename T1>
|
||||
inline
|
||||
@@ -484,6 +488,8 @@ SpSubview<eT>::operator/=(const SpBase<eT, T1>& x)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
// NOTE: use of this function is not advised; it is implemented only for completeness
|
||||
|
||||
SpProxy<T1> p(x.get_ref());
|
||||
|
||||
arma_debug_assert_same_size(n_rows, n_cols, p.get_n_rows(), p.get_n_cols(), "element-wise division");
|
||||
@@ -768,6 +774,36 @@ SpSubview<eT>::clean(const typename get_pod_type<eT>::result threshold)
|
||||
|
||||
|
||||
|
||||
template<typename eT>
|
||||
inline
|
||||
void
|
||||
SpSubview<eT>::clamp(const eT min_val, const eT max_val)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
if(is_cx<eT>::no)
|
||||
{
|
||||
arma_debug_check( (access::tmp_real(min_val) > access::tmp_real(max_val)), "SpSubview::clamp(): min_val must be less than max_val" );
|
||||
}
|
||||
else
|
||||
{
|
||||
arma_debug_check( (access::tmp_real(min_val) > access::tmp_real(max_val)), "SpSubview::clamp(): real(min_val) must be less than real(max_val)" );
|
||||
arma_debug_check( (access::tmp_imag(min_val) > access::tmp_imag(max_val)), "SpSubview::clamp(): imag(min_val) must be less than imag(max_val)" );
|
||||
}
|
||||
|
||||
if((n_elem == 0) || (n_nonzero == 0)) { return; }
|
||||
|
||||
// TODO: replace with a more efficient implementation
|
||||
|
||||
SpMat<eT> tmp(*this);
|
||||
|
||||
tmp.clamp(min_val, max_val);
|
||||
|
||||
(*this).operator=(tmp);
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename eT>
|
||||
inline
|
||||
void
|
||||
@@ -777,7 +813,7 @@ SpSubview<eT>::fill(const eT val)
|
||||
|
||||
if(val != eT(0))
|
||||
{
|
||||
Mat<eT> tmp( (*this).n_rows, (*this).n_cols );
|
||||
Mat<eT> tmp( (*this).n_rows, (*this).n_cols, arma_nozeros_indicator() );
|
||||
|
||||
tmp.fill(val);
|
||||
|
||||
@@ -854,7 +890,7 @@ void
|
||||
SpSubview<eT>::ones()
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
|
||||
(*this).fill(eT(1));
|
||||
}
|
||||
|
||||
@@ -876,6 +912,34 @@ SpSubview<eT>::eye()
|
||||
|
||||
|
||||
|
||||
template<typename eT>
|
||||
inline
|
||||
void
|
||||
SpSubview<eT>::randu()
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
Mat<eT> tmp( (*this).n_rows, (*this).n_cols, fill::randu );
|
||||
|
||||
(*this).operator=(tmp);
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename eT>
|
||||
inline
|
||||
void
|
||||
SpSubview<eT>::randn()
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
Mat<eT> tmp( (*this).n_rows, (*this).n_cols, fill::randn );
|
||||
|
||||
(*this).operator=(tmp);
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename eT>
|
||||
arma_hot
|
||||
inline
|
||||
@@ -884,7 +948,7 @@ SpSubview<eT>::operator[](const uword i)
|
||||
{
|
||||
const uword lrow = i % n_rows;
|
||||
const uword lcol = i / n_rows;
|
||||
|
||||
|
||||
return (*this).at(lrow, lcol);
|
||||
}
|
||||
|
||||
@@ -898,7 +962,7 @@ SpSubview<eT>::operator[](const uword i) const
|
||||
{
|
||||
const uword lrow = i % n_rows;
|
||||
const uword lcol = i / n_rows;
|
||||
|
||||
|
||||
return (*this).at(lrow, lcol);
|
||||
}
|
||||
|
||||
@@ -910,11 +974,11 @@ inline
|
||||
SpSubview_MapMat_val<eT>
|
||||
SpSubview<eT>::operator()(const uword i)
|
||||
{
|
||||
arma_debug_check( (i >= n_elem), "SpSubview::operator(): index out of bounds");
|
||||
|
||||
arma_debug_check_bounds( (i >= n_elem), "SpSubview::operator(): index out of bounds" );
|
||||
|
||||
const uword lrow = i % n_rows;
|
||||
const uword lcol = i / n_rows;
|
||||
|
||||
|
||||
return (*this).at(lrow, lcol);
|
||||
}
|
||||
|
||||
@@ -926,11 +990,11 @@ inline
|
||||
eT
|
||||
SpSubview<eT>::operator()(const uword i) const
|
||||
{
|
||||
arma_debug_check( (i >= n_elem), "SpSubview::operator(): index out of bounds");
|
||||
|
||||
arma_debug_check_bounds( (i >= n_elem), "SpSubview::operator(): index out of bounds" );
|
||||
|
||||
const uword lrow = i % n_rows;
|
||||
const uword lcol = i / n_rows;
|
||||
|
||||
|
||||
return (*this).at(lrow, lcol);
|
||||
}
|
||||
|
||||
@@ -942,8 +1006,8 @@ inline
|
||||
SpSubview_MapMat_val<eT>
|
||||
SpSubview<eT>::operator()(const uword in_row, const uword in_col)
|
||||
{
|
||||
arma_debug_check( (in_row >= n_rows) || (in_col >= n_cols), "SpSubview::operator(): index out of bounds");
|
||||
|
||||
arma_debug_check_bounds( (in_row >= n_rows) || (in_col >= n_cols), "SpSubview::operator(): index out of bounds" );
|
||||
|
||||
return (*this).at(in_row, in_col);
|
||||
}
|
||||
|
||||
@@ -955,8 +1019,8 @@ inline
|
||||
eT
|
||||
SpSubview<eT>::operator()(const uword in_row, const uword in_col) const
|
||||
{
|
||||
arma_debug_check( (in_row >= n_rows) || (in_col >= n_cols), "SpSubview::operator(): index out of bounds");
|
||||
|
||||
arma_debug_check_bounds( (in_row >= n_rows) || (in_col >= n_cols), "SpSubview::operator(): index out of bounds" );
|
||||
|
||||
return (*this).at(in_row, in_col);
|
||||
}
|
||||
|
||||
@@ -970,7 +1034,7 @@ SpSubview<eT>::at(const uword i)
|
||||
{
|
||||
const uword lrow = i % n_rows;
|
||||
const uword lcol = i / n_cols;
|
||||
|
||||
|
||||
return (*this).at(lrow, lcol);
|
||||
}
|
||||
|
||||
@@ -984,7 +1048,7 @@ SpSubview<eT>::at(const uword i) const
|
||||
{
|
||||
const uword lrow = i % n_rows;
|
||||
const uword lcol = i / n_cols;
|
||||
|
||||
|
||||
return (*this).at(lrow, lcol);
|
||||
}
|
||||
|
||||
@@ -1017,8 +1081,8 @@ inline
|
||||
bool
|
||||
SpSubview<eT>::check_overlap(const SpSubview<eT>& x) const
|
||||
{
|
||||
const subview<eT>& t = *this;
|
||||
|
||||
const SpSubview<eT>& t = *this;
|
||||
|
||||
if(&t.m != &x.m)
|
||||
{
|
||||
return false;
|
||||
@@ -1033,19 +1097,19 @@ SpSubview<eT>::check_overlap(const SpSubview<eT>& x) const
|
||||
{
|
||||
const uword t_row_start = t.aux_row1;
|
||||
const uword t_row_end_p1 = t_row_start + t.n_rows;
|
||||
|
||||
|
||||
const uword t_col_start = t.aux_col1;
|
||||
const uword t_col_end_p1 = t_col_start + t.n_cols;
|
||||
|
||||
|
||||
const uword x_row_start = x.aux_row1;
|
||||
const uword x_row_end_p1 = x_row_start + x.n_rows;
|
||||
|
||||
|
||||
const uword x_col_start = x.aux_col1;
|
||||
const uword x_col_end_p1 = x_col_start + x.n_cols;
|
||||
|
||||
|
||||
const bool outside_rows = ( (x_row_start >= t_row_end_p1) || (t_row_start >= x_row_end_p1) );
|
||||
const bool outside_cols = ( (x_col_start >= t_col_end_p1) || (t_col_start >= x_col_end_p1) );
|
||||
|
||||
|
||||
return ( (outside_rows == false) && (outside_cols == false) );
|
||||
}
|
||||
}
|
||||
@@ -1070,7 +1134,7 @@ SpSubview<eT>::row(const uword row_num)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
arma_debug_check(row_num >= n_rows, "SpSubview::row(): out of bounds");
|
||||
arma_debug_check_bounds(row_num >= n_rows, "SpSubview::row(): out of bounds");
|
||||
|
||||
return SpSubview_row<eT>(const_cast< SpMat<eT>& >(m), row_num + aux_row1, aux_col1, n_cols);
|
||||
}
|
||||
@@ -1084,7 +1148,7 @@ SpSubview<eT>::row(const uword row_num) const
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
arma_debug_check(row_num >= n_rows, "SpSubview::row(): out of bounds");
|
||||
arma_debug_check_bounds(row_num >= n_rows, "SpSubview::row(): out of bounds");
|
||||
|
||||
return SpSubview_row<eT>(m, row_num + aux_row1, aux_col1, n_cols);
|
||||
}
|
||||
@@ -1098,7 +1162,7 @@ SpSubview<eT>::col(const uword col_num)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
arma_debug_check(col_num >= n_cols, "SpSubview::col(): out of bounds");
|
||||
arma_debug_check_bounds(col_num >= n_cols, "SpSubview::col(): out of bounds");
|
||||
|
||||
return SpSubview_col<eT>(const_cast< SpMat<eT>& >(m), col_num + aux_col1, aux_row1, n_rows);
|
||||
}
|
||||
@@ -1112,7 +1176,7 @@ SpSubview<eT>::col(const uword col_num) const
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
arma_debug_check(col_num >= n_cols, "SpSubview::col(): out of bounds");
|
||||
arma_debug_check_bounds(col_num >= n_cols, "SpSubview::col(): out of bounds");
|
||||
|
||||
return SpSubview_col<eT>(m, col_num + aux_col1, aux_row1, n_rows);
|
||||
}
|
||||
@@ -1125,13 +1189,13 @@ SpSubview<eT>
|
||||
SpSubview<eT>::rows(const uword in_row1, const uword in_row2)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
arma_debug_check
|
||||
|
||||
arma_debug_check_bounds
|
||||
(
|
||||
(in_row1 > in_row2) || (in_row2 >= n_rows),
|
||||
"SpSubview::rows(): indices out of bounds or incorrectly used"
|
||||
);
|
||||
|
||||
|
||||
return submat(in_row1, 0, in_row2, n_cols - 1);
|
||||
}
|
||||
|
||||
@@ -1143,8 +1207,8 @@ const SpSubview<eT>
|
||||
SpSubview<eT>::rows(const uword in_row1, const uword in_row2) const
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
arma_debug_check
|
||||
|
||||
arma_debug_check_bounds
|
||||
(
|
||||
(in_row1 > in_row2) || (in_row2 >= n_rows),
|
||||
"SpSubview::rows(): indices out of bounds or incorrectly used"
|
||||
@@ -1161,13 +1225,13 @@ SpSubview<eT>
|
||||
SpSubview<eT>::cols(const uword in_col1, const uword in_col2)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
arma_debug_check
|
||||
|
||||
arma_debug_check_bounds
|
||||
(
|
||||
(in_col1 > in_col2) || (in_col2 >= n_cols),
|
||||
"SpSubview::cols(): indices out of bounds or incorrectly used"
|
||||
);
|
||||
|
||||
|
||||
return submat(0, in_col1, n_rows - 1, in_col2);
|
||||
}
|
||||
|
||||
@@ -1179,13 +1243,13 @@ const SpSubview<eT>
|
||||
SpSubview<eT>::cols(const uword in_col1, const uword in_col2) const
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
arma_debug_check
|
||||
|
||||
arma_debug_check_bounds
|
||||
(
|
||||
(in_col1 > in_col2) || (in_col2 >= n_cols),
|
||||
"SpSubview::cols(): indices out of bounds or incorrectly used"
|
||||
);
|
||||
|
||||
|
||||
return submat(0, in_col1, n_rows - 1, in_col2);
|
||||
}
|
||||
|
||||
@@ -1197,13 +1261,13 @@ SpSubview<eT>
|
||||
SpSubview<eT>::submat(const uword in_row1, const uword in_col1, const uword in_row2, const uword in_col2)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
arma_debug_check
|
||||
|
||||
arma_debug_check_bounds
|
||||
(
|
||||
(in_row1 > in_row2) || (in_col1 > in_col2) || (in_row2 >= n_rows) || (in_col2 >= n_cols),
|
||||
"SpSubview::submat(): indices out of bounds or incorrectly used"
|
||||
);
|
||||
|
||||
|
||||
return access::rw(m).submat(in_row1 + aux_row1, in_col1 + aux_col1, in_row2 + aux_row1, in_col2 + aux_col1);
|
||||
}
|
||||
|
||||
@@ -1215,13 +1279,13 @@ const SpSubview<eT>
|
||||
SpSubview<eT>::submat(const uword in_row1, const uword in_col1, const uword in_row2, const uword in_col2) const
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
arma_debug_check
|
||||
|
||||
arma_debug_check_bounds
|
||||
(
|
||||
(in_row1 > in_row2) || (in_col1 > in_col2) || (in_row2 >= n_rows) || (in_col2 >= n_cols),
|
||||
"SpSubview::submat(): indices out of bounds or incorrectly used"
|
||||
);
|
||||
|
||||
|
||||
return m.submat(in_row1 + aux_row1, in_col1 + aux_col1, in_row2 + aux_row1, in_col2 + aux_col1);
|
||||
}
|
||||
|
||||
@@ -1233,24 +1297,24 @@ SpSubview<eT>
|
||||
SpSubview<eT>::submat(const span& row_span, const span& col_span)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
|
||||
const bool row_all = row_span.whole;
|
||||
const bool col_all = row_span.whole;
|
||||
|
||||
|
||||
const uword in_row1 = row_all ? 0 : row_span.a;
|
||||
const uword in_row2 = row_all ? n_rows : row_span.b;
|
||||
|
||||
|
||||
const uword in_col1 = col_all ? 0 : col_span.a;
|
||||
const uword in_col2 = col_all ? n_cols : col_span.b;
|
||||
|
||||
arma_debug_check
|
||||
|
||||
arma_debug_check_bounds
|
||||
(
|
||||
( row_all ? false : ((in_row1 > in_row2) || (in_row2 >= n_rows)))
|
||||
||
|
||||
( col_all ? false : ((in_col1 > in_col2) || (in_col2 >= n_cols))),
|
||||
"SpSubview::submat(): indices out of bounds or incorrectly used"
|
||||
);
|
||||
|
||||
|
||||
return submat(in_row1, in_col1, in_row2, in_col2);
|
||||
}
|
||||
|
||||
@@ -1262,24 +1326,24 @@ const SpSubview<eT>
|
||||
SpSubview<eT>::submat(const span& row_span, const span& col_span) const
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
|
||||
const bool row_all = row_span.whole;
|
||||
const bool col_all = row_span.whole;
|
||||
|
||||
|
||||
const uword in_row1 = row_all ? 0 : row_span.a;
|
||||
const uword in_row2 = row_all ? n_rows - 1 : row_span.b;
|
||||
|
||||
|
||||
const uword in_col1 = col_all ? 0 : col_span.a;
|
||||
const uword in_col2 = col_all ? n_cols - 1 : col_span.b;
|
||||
|
||||
arma_debug_check
|
||||
|
||||
arma_debug_check_bounds
|
||||
(
|
||||
( row_all ? false : ((in_row1 > in_row2) || (in_row2 >= n_rows)))
|
||||
||
|
||||
( col_all ? false : ((in_col1 > in_col2) || (in_col2 >= n_cols))),
|
||||
"SpSubview::submat(): indices out of bounds or incorrectly used"
|
||||
);
|
||||
|
||||
|
||||
return submat(in_row1, in_col1, in_row2, in_col2);
|
||||
}
|
||||
|
||||
@@ -1291,7 +1355,7 @@ SpSubview<eT>
|
||||
SpSubview<eT>::operator()(const uword row_num, const span& col_span)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
|
||||
return submat(span(row_num, row_num), col_span);
|
||||
}
|
||||
|
||||
@@ -1303,7 +1367,7 @@ const SpSubview<eT>
|
||||
SpSubview<eT>::operator()(const uword row_num, const span& col_span) const
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
|
||||
return submat(span(row_num, row_num), col_span);
|
||||
}
|
||||
|
||||
@@ -1315,7 +1379,7 @@ SpSubview<eT>
|
||||
SpSubview<eT>::operator()(const span& row_span, const uword col_num)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
|
||||
return submat(row_span, span(col_num, col_num));
|
||||
}
|
||||
|
||||
@@ -1327,7 +1391,7 @@ const SpSubview<eT>
|
||||
SpSubview<eT>::operator()(const span& row_span, const uword col_num) const
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
|
||||
return submat(row_span, span(col_num, col_num));
|
||||
}
|
||||
|
||||
@@ -1339,7 +1403,7 @@ SpSubview<eT>
|
||||
SpSubview<eT>::operator()(const span& row_span, const span& col_span)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
|
||||
return submat(row_span, col_span);
|
||||
}
|
||||
|
||||
@@ -1351,7 +1415,7 @@ const SpSubview<eT>
|
||||
SpSubview<eT>::operator()(const span& row_span, const span& col_span) const
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
|
||||
return submat(row_span, col_span);
|
||||
}
|
||||
|
||||
@@ -1363,12 +1427,12 @@ void
|
||||
SpSubview<eT>::swap_rows(const uword in_row1, const uword in_row2)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
|
||||
arma_debug_check((in_row1 >= n_rows) || (in_row2 >= n_rows), "SpSubview::swap_rows(): invalid row index");
|
||||
|
||||
|
||||
const uword lstart_col = aux_col1;
|
||||
const uword lend_col = aux_col1 + n_cols;
|
||||
|
||||
|
||||
for(uword c = lstart_col; c < lend_col; ++c)
|
||||
{
|
||||
const eT val = access::rw(m).at(in_row1 + aux_row1, c);
|
||||
@@ -1385,12 +1449,12 @@ void
|
||||
SpSubview<eT>::swap_cols(const uword in_col1, const uword in_col2)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
|
||||
arma_debug_check((in_col1 >= n_cols) || (in_col2 >= n_cols), "SpSubview::swap_cols(): invalid column index");
|
||||
|
||||
|
||||
const uword lstart_row = aux_row1;
|
||||
const uword lend_row = aux_row1 + n_rows;
|
||||
|
||||
|
||||
for(uword r = lstart_row; r < lend_row; ++r)
|
||||
{
|
||||
const eT val = access::rw(m).at(r, in_col1 + aux_col1);
|
||||
@@ -1583,13 +1647,13 @@ eT&
|
||||
SpSubview<eT>::insert_element(const uword in_row, const uword in_col, const eT in_val)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
|
||||
// This may not actually insert an element.
|
||||
const uword old_n_nonzero = m.n_nonzero;
|
||||
eT& retval = access::rw(m).insert_element(in_row + aux_row1, in_col + aux_col1, in_val);
|
||||
// Update n_nonzero (if necessary).
|
||||
access::rw(n_nonzero) += (m.n_nonzero - old_n_nonzero);
|
||||
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -1601,7 +1665,7 @@ void
|
||||
SpSubview<eT>::delete_element(const uword in_row, const uword in_col)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
|
||||
// This may not actually delete an element.
|
||||
const uword old_n_nonzero = m.n_nonzero;
|
||||
access::rw(m).delete_element(in_row + aux_row1, in_col + aux_col1);
|
||||
@@ -1638,16 +1702,6 @@ SpSubview_col<eT>::SpSubview_col(const SpMat<eT>& in_m, const uword in_col)
|
||||
|
||||
|
||||
|
||||
template<typename eT>
|
||||
inline
|
||||
SpSubview_col<eT>::SpSubview_col(SpMat<eT>& in_m, const uword in_col)
|
||||
: SpSubview<eT>(in_m, 0, in_col, in_m.n_rows, 1)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename eT>
|
||||
inline
|
||||
SpSubview_col<eT>::SpSubview_col(const SpMat<eT>& in_m, const uword in_col, const uword in_row1, const uword in_n_rows)
|
||||
@@ -1658,16 +1712,6 @@ SpSubview_col<eT>::SpSubview_col(const SpMat<eT>& in_m, const uword in_col, cons
|
||||
|
||||
|
||||
|
||||
template<typename eT>
|
||||
inline
|
||||
SpSubview_col<eT>::SpSubview_col(SpMat<eT>& in_m, const uword in_col, const uword in_row1, const uword in_n_rows)
|
||||
: SpSubview<eT>(in_m, in_row1, in_col, in_n_rows, 1)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename eT>
|
||||
inline
|
||||
void
|
||||
@@ -1720,6 +1764,7 @@ SpSubview_col<eT>::operator=(const Base<eT,T1>& x)
|
||||
|
||||
template<typename eT>
|
||||
inline
|
||||
arma_warn_unused
|
||||
const SpOp<SpSubview_col<eT>,spop_htrans>
|
||||
SpSubview_col<eT>::t() const
|
||||
{
|
||||
@@ -1730,6 +1775,7 @@ SpSubview_col<eT>::t() const
|
||||
|
||||
template<typename eT>
|
||||
inline
|
||||
arma_warn_unused
|
||||
const SpOp<SpSubview_col<eT>,spop_htrans>
|
||||
SpSubview_col<eT>::ht() const
|
||||
{
|
||||
@@ -1740,6 +1786,7 @@ SpSubview_col<eT>::ht() const
|
||||
|
||||
template<typename eT>
|
||||
inline
|
||||
arma_warn_unused
|
||||
const SpOp<SpSubview_col<eT>,spop_strans>
|
||||
SpSubview_col<eT>::st() const
|
||||
{
|
||||
@@ -1764,16 +1811,6 @@ SpSubview_row<eT>::SpSubview_row(const SpMat<eT>& in_m, const uword in_row)
|
||||
|
||||
|
||||
|
||||
template<typename eT>
|
||||
inline
|
||||
SpSubview_row<eT>::SpSubview_row(SpMat<eT>& in_m, const uword in_row)
|
||||
: SpSubview<eT>(in_m, in_row, 0, 1, in_m.n_cols)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename eT>
|
||||
inline
|
||||
SpSubview_row<eT>::SpSubview_row(const SpMat<eT>& in_m, const uword in_row, const uword in_col1, const uword in_n_cols)
|
||||
@@ -1784,16 +1821,6 @@ SpSubview_row<eT>::SpSubview_row(const SpMat<eT>& in_m, const uword in_row, cons
|
||||
|
||||
|
||||
|
||||
template<typename eT>
|
||||
inline
|
||||
SpSubview_row<eT>::SpSubview_row(SpMat<eT>& in_m, const uword in_row, const uword in_col1, const uword in_n_cols)
|
||||
: SpSubview<eT>(in_m, in_row, in_col1, 1, in_n_cols)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename eT>
|
||||
inline
|
||||
void
|
||||
@@ -1846,6 +1873,7 @@ SpSubview_row<eT>::operator=(const Base<eT,T1>& x)
|
||||
|
||||
template<typename eT>
|
||||
inline
|
||||
arma_warn_unused
|
||||
const SpOp<SpSubview_row<eT>,spop_htrans>
|
||||
SpSubview_row<eT>::t() const
|
||||
{
|
||||
@@ -1856,6 +1884,7 @@ SpSubview_row<eT>::t() const
|
||||
|
||||
template<typename eT>
|
||||
inline
|
||||
arma_warn_unused
|
||||
const SpOp<SpSubview_row<eT>,spop_htrans>
|
||||
SpSubview_row<eT>::ht() const
|
||||
{
|
||||
@@ -1866,6 +1895,7 @@ SpSubview_row<eT>::ht() const
|
||||
|
||||
template<typename eT>
|
||||
inline
|
||||
arma_warn_unused
|
||||
const SpOp<SpSubview_row<eT>,spop_strans>
|
||||
SpSubview_row<eT>::st() const
|
||||
{
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
// Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
//
|
||||
@@ -21,7 +23,7 @@
|
||||
|
||||
//! Class for storing data required for delayed unary operations on a sparse
|
||||
//! matrix that produce a dense matrix; the data for storage may include
|
||||
//! the operand (e.g. the matrix to which the operation is to be applied) and the unary operator (e.g. inverse).
|
||||
//! the operand (eg. the matrix to which the operation is to be applied) and the unary operator (eg. inverse).
|
||||
//! The operand is stored as a reference (which can be optimised away),
|
||||
//! while the operator is "stored" through the template definition (op_type).
|
||||
//! The operands can be 'SpMat', 'SpRow', 'SpCol', 'SpOp', and 'SpGlue'.
|
||||
@@ -31,24 +33,23 @@
|
||||
//! SpToDOp< SpGlue< SpMat, SpMat, sp_glue_times >, op_sp_plus >
|
||||
|
||||
template<typename T1, typename op_type>
|
||||
class SpToDOp : public Base<typename T1::elem_type, SpToDOp<T1, op_type> >
|
||||
class SpToDOp : public Base< typename T1::elem_type, SpToDOp<T1, op_type> >
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
typedef typename T1::elem_type elem_type;
|
||||
typedef typename get_pod_type<elem_type>::result pod_type;
|
||||
|
||||
|
||||
inline explicit SpToDOp(const T1& in_m);
|
||||
inline SpToDOp(const T1& in_m, const elem_type in_aux);
|
||||
inline ~SpToDOp();
|
||||
|
||||
|
||||
arma_aligned const T1& m; //!< the operand; must be derived from SpBase
|
||||
arma_aligned elem_type aux; //!< auxiliary data, using the element type as used by T1
|
||||
|
||||
static const bool is_row = op_type::template traits<T1>::is_row;
|
||||
static const bool is_col = op_type::template traits<T1>::is_col;
|
||||
static const bool is_xvec = op_type::template traits<T1>::is_xvec;
|
||||
|
||||
|
||||
static constexpr bool is_row = op_type::template traits<T1>::is_row;
|
||||
static constexpr bool is_col = op_type::template traits<T1>::is_col;
|
||||
static constexpr bool is_xvec = op_type::template traits<T1>::is_xvec;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
// Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
//
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
// Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
//
|
||||
@@ -36,7 +38,8 @@ class SpValProxy
|
||||
* Create the sparse value proxy.
|
||||
* Otherwise, pass a pointer to a reference of the value.
|
||||
*/
|
||||
arma_inline SpValProxy(uword row, uword col, T1& in_parent, eT* in_val_ptr = NULL);
|
||||
arma_inline SpValProxy(uword row, uword col, T1& in_parent, eT* in_val_ptr = nullptr);
|
||||
inline SpValProxy() = delete;
|
||||
|
||||
//! For swapping operations.
|
||||
arma_inline SpValProxy& operator=(const SpValProxy& rhs);
|
||||
@@ -66,7 +69,7 @@ class SpValProxy
|
||||
|
||||
private:
|
||||
|
||||
// Deletes the element if it is zero. Does not check if val_ptr == NULL!
|
||||
// Deletes the element if it is zero; NOTE: does not check if val_ptr == nullptr
|
||||
arma_inline void check_zero();
|
||||
|
||||
arma_aligned const uword row;
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
// Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
//
|
||||
@@ -58,10 +60,10 @@ arma_inline
|
||||
SpValProxy<T1>&
|
||||
SpValProxy<T1>::operator=(const eT rhs)
|
||||
{
|
||||
if (rhs != eT(0)) // A nonzero element is being assigned.
|
||||
if(rhs != eT(0)) // A nonzero element is being assigned.
|
||||
{
|
||||
|
||||
if (val_ptr)
|
||||
if(val_ptr)
|
||||
{
|
||||
// The value exists and merely needs to be updated.
|
||||
*val_ptr = rhs;
|
||||
@@ -78,11 +80,11 @@ SpValProxy<T1>::operator=(const eT rhs)
|
||||
else // A zero is being assigned.~
|
||||
{
|
||||
|
||||
if (val_ptr)
|
||||
if(val_ptr)
|
||||
{
|
||||
// The element exists, but we need to remove it, because it is being set to 0.
|
||||
parent.delete_element(row, col);
|
||||
val_ptr = NULL;
|
||||
val_ptr = nullptr;
|
||||
}
|
||||
|
||||
// If the element does not exist, we do not need to do anything at all.
|
||||
@@ -99,7 +101,7 @@ arma_inline
|
||||
SpValProxy<T1>&
|
||||
SpValProxy<T1>::operator+=(const eT rhs)
|
||||
{
|
||||
if (val_ptr)
|
||||
if(val_ptr)
|
||||
{
|
||||
// The value already exists and merely needs to be updated.
|
||||
*val_ptr += rhs;
|
||||
@@ -108,7 +110,7 @@ SpValProxy<T1>::operator+=(const eT rhs)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (rhs != eT(0))
|
||||
if(rhs != eT(0))
|
||||
{
|
||||
// The value does not exist and must be inserted.
|
||||
val_ptr = &parent.insert_element(row, col, rhs);
|
||||
@@ -125,7 +127,7 @@ arma_inline
|
||||
SpValProxy<T1>&
|
||||
SpValProxy<T1>::operator-=(const eT rhs)
|
||||
{
|
||||
if (val_ptr)
|
||||
if(val_ptr)
|
||||
{
|
||||
// The value already exists and merely needs to be updated.
|
||||
*val_ptr -= rhs;
|
||||
@@ -134,7 +136,7 @@ SpValProxy<T1>::operator-=(const eT rhs)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (rhs != eT(0))
|
||||
if(rhs != eT(0))
|
||||
{
|
||||
// The value does not exist and must be inserted.
|
||||
val_ptr = &parent.insert_element(row, col, -rhs);
|
||||
@@ -151,10 +153,10 @@ arma_inline
|
||||
SpValProxy<T1>&
|
||||
SpValProxy<T1>::operator*=(const eT rhs)
|
||||
{
|
||||
if (rhs != eT(0))
|
||||
if(rhs != eT(0))
|
||||
{
|
||||
|
||||
if (val_ptr)
|
||||
if(val_ptr)
|
||||
{
|
||||
// The value already exists and merely needs to be updated.
|
||||
*val_ptr *= rhs;
|
||||
@@ -166,11 +168,11 @@ SpValProxy<T1>::operator*=(const eT rhs)
|
||||
else
|
||||
{
|
||||
|
||||
if (val_ptr)
|
||||
if(val_ptr)
|
||||
{
|
||||
// Since we are multiplying by zero, the value can be deleted.
|
||||
parent.delete_element(row, col);
|
||||
val_ptr = NULL;
|
||||
val_ptr = nullptr;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -185,10 +187,10 @@ arma_inline
|
||||
SpValProxy<T1>&
|
||||
SpValProxy<T1>::operator/=(const eT rhs)
|
||||
{
|
||||
if (rhs != eT(0)) // I hope this is true!
|
||||
if(rhs != eT(0)) // I hope this is true!
|
||||
{
|
||||
|
||||
if (val_ptr)
|
||||
if(val_ptr)
|
||||
{
|
||||
*val_ptr /= rhs;
|
||||
parent.invalidate_cache();
|
||||
@@ -199,14 +201,14 @@ SpValProxy<T1>::operator/=(const eT rhs)
|
||||
else
|
||||
{
|
||||
|
||||
if (val_ptr)
|
||||
if(val_ptr)
|
||||
{
|
||||
*val_ptr /= rhs; // That is where it gets ugly.
|
||||
// Now check if it's 0.
|
||||
if (*val_ptr == eT(0))
|
||||
if(*val_ptr == eT(0))
|
||||
{
|
||||
parent.delete_element(row, col);
|
||||
val_ptr = NULL;
|
||||
val_ptr = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -214,7 +216,7 @@ SpValProxy<T1>::operator/=(const eT rhs)
|
||||
{
|
||||
eT val = eT(0) / rhs; // This may vary depending on type and implementation.
|
||||
|
||||
if (val != eT(0))
|
||||
if(val != eT(0))
|
||||
{
|
||||
// Ok, now we have to insert it.
|
||||
val_ptr = &parent.insert_element(row, col, val);
|
||||
@@ -233,7 +235,7 @@ arma_inline
|
||||
SpValProxy<T1>&
|
||||
SpValProxy<T1>::operator++()
|
||||
{
|
||||
if (val_ptr)
|
||||
if(val_ptr)
|
||||
{
|
||||
(*val_ptr) += eT(1);
|
||||
parent.invalidate_cache();
|
||||
@@ -255,7 +257,7 @@ arma_inline
|
||||
SpValProxy<T1>&
|
||||
SpValProxy<T1>::operator--()
|
||||
{
|
||||
if (val_ptr)
|
||||
if(val_ptr)
|
||||
{
|
||||
(*val_ptr) -= eT(1);
|
||||
parent.invalidate_cache();
|
||||
@@ -277,7 +279,7 @@ arma_inline
|
||||
typename T1::elem_type
|
||||
SpValProxy<T1>::operator++(const int)
|
||||
{
|
||||
if (val_ptr)
|
||||
if(val_ptr)
|
||||
{
|
||||
(*val_ptr) += eT(1);
|
||||
parent.invalidate_cache();
|
||||
@@ -289,7 +291,7 @@ SpValProxy<T1>::operator++(const int)
|
||||
val_ptr = &parent.insert_element(row, col, eT(1));
|
||||
}
|
||||
|
||||
if (val_ptr) // It may have changed to now be 0.
|
||||
if(val_ptr) // It may have changed to now be 0.
|
||||
{
|
||||
return *(val_ptr) - eT(1);
|
||||
}
|
||||
@@ -306,7 +308,7 @@ arma_inline
|
||||
typename T1::elem_type
|
||||
SpValProxy<T1>::operator--(const int)
|
||||
{
|
||||
if (val_ptr)
|
||||
if(val_ptr)
|
||||
{
|
||||
(*val_ptr) -= eT(1);
|
||||
parent.invalidate_cache();
|
||||
@@ -318,7 +320,7 @@ SpValProxy<T1>::operator--(const int)
|
||||
val_ptr = &parent.insert_element(row, col, eT(-1));
|
||||
}
|
||||
|
||||
if (val_ptr) // It may have changed to now be 0.
|
||||
if(val_ptr) // It may have changed to now be 0.
|
||||
{
|
||||
return *(val_ptr) + eT(1);
|
||||
}
|
||||
@@ -368,10 +370,10 @@ arma_inline
|
||||
void
|
||||
SpValProxy<T1>::check_zero()
|
||||
{
|
||||
if (*val_ptr == eT(0))
|
||||
if(*val_ptr == eT(0))
|
||||
{
|
||||
parent.delete_element(row, col);
|
||||
val_ptr = NULL;
|
||||
val_ptr = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
// Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
//
|
||||
@@ -23,19 +25,19 @@ class access
|
||||
public:
|
||||
|
||||
//! internal function to allow modification of data declared as read-only (use with caution)
|
||||
template<typename T1> arma_inline static T1& rw (const T1& x) { return const_cast<T1& >(x); }
|
||||
template<typename T1> arma_inline static T1*& rwp(const T1* const& x) { return const_cast<T1*&>(x); }
|
||||
template<typename T1> constexpr static T1& rw (const T1& x) { return const_cast<T1& >(x); }
|
||||
template<typename T1> constexpr static T1*& rwp(const T1* const& x) { return const_cast<T1*&>(x); }
|
||||
|
||||
//! internal function to obtain the real part of either a plain number or a complex number
|
||||
template<typename eT> arma_inline static const eT& tmp_real(const eT& X) { return X; }
|
||||
template<typename T> arma_inline static const T tmp_real(const std::complex<T>& X) { return X.real(); }
|
||||
template<typename eT> constexpr static const eT& tmp_real(const eT& X) { return X; }
|
||||
template<typename T> constexpr static const T tmp_real(const std::complex<T>& X) { return X.real(); }
|
||||
|
||||
//! internal function to obtain the imag part of either a plain number or a complex number
|
||||
template<typename eT> arma_inline static const eT tmp_imag(const eT ) { return eT(0); }
|
||||
template<typename T> arma_inline static const T tmp_imag(const std::complex<T>& X) { return X.imag(); }
|
||||
template<typename eT> constexpr static const eT tmp_imag(const eT ) { return eT(0); }
|
||||
template<typename T> constexpr static const T tmp_imag(const std::complex<T>& X) { return X.imag(); }
|
||||
|
||||
//! internal function to work around braindead compilers
|
||||
template<typename eT> arma_inline static const typename enable_if2<is_cx<eT>::no, const eT&>::result alt_conj(const eT& X) { return X; }
|
||||
template<typename eT> constexpr static const typename enable_if2<is_cx<eT>::no, const eT&>::result alt_conj(const eT& X) { return X; }
|
||||
template<typename eT> arma_inline static const typename enable_if2<is_cx<eT>::yes, const eT >::result alt_conj(const eT& X) { return std::conj(X); }
|
||||
};
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
// Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
//
|
||||
@@ -25,90 +27,41 @@
|
||||
|
||||
|
||||
template<typename eT>
|
||||
arma_inline
|
||||
inline
|
||||
bool
|
||||
arma_isfinite(eT val)
|
||||
arma_isfinite(eT)
|
||||
{
|
||||
arma_ignore(val);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<>
|
||||
arma_inline
|
||||
inline
|
||||
bool
|
||||
arma_isfinite(float x)
|
||||
{
|
||||
#if defined(ARMA_USE_CXX11)
|
||||
{
|
||||
return std::isfinite(x);
|
||||
}
|
||||
#elif defined(ARMA_HAVE_TR1)
|
||||
{
|
||||
return std::tr1::isfinite(x);
|
||||
}
|
||||
#elif defined(ARMA_HAVE_ISFINITE)
|
||||
{
|
||||
return (std::isfinite(x) != 0);
|
||||
}
|
||||
#else
|
||||
{
|
||||
const float y = (std::numeric_limits<float>::max)();
|
||||
|
||||
const volatile float xx = x;
|
||||
|
||||
return (xx == xx) && (x >= -y) && (x <= y);
|
||||
}
|
||||
#endif
|
||||
return std::isfinite(x);
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<>
|
||||
arma_inline
|
||||
inline
|
||||
bool
|
||||
arma_isfinite(double x)
|
||||
{
|
||||
#if defined(ARMA_USE_CXX11)
|
||||
{
|
||||
return std::isfinite(x);
|
||||
}
|
||||
#elif defined(ARMA_HAVE_TR1)
|
||||
{
|
||||
return std::tr1::isfinite(x);
|
||||
}
|
||||
#elif defined(ARMA_HAVE_ISFINITE)
|
||||
{
|
||||
return (std::isfinite(x) != 0);
|
||||
}
|
||||
#else
|
||||
{
|
||||
const double y = (std::numeric_limits<double>::max)();
|
||||
|
||||
const volatile double xx = x;
|
||||
|
||||
return (xx == xx) && (x >= -y) && (x <= y);
|
||||
}
|
||||
#endif
|
||||
return std::isfinite(x);
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename T>
|
||||
arma_inline
|
||||
inline
|
||||
bool
|
||||
arma_isfinite(const std::complex<T>& x)
|
||||
{
|
||||
if( (arma_isfinite(x.real()) == false) || (arma_isfinite(x.imag()) == false) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return ( arma_isfinite(x.real()) && arma_isfinite(x.imag()) );
|
||||
}
|
||||
|
||||
|
||||
@@ -118,71 +71,37 @@ arma_isfinite(const std::complex<T>& x)
|
||||
|
||||
|
||||
template<typename eT>
|
||||
arma_inline
|
||||
inline
|
||||
bool
|
||||
arma_isinf(eT val)
|
||||
arma_isinf(eT)
|
||||
{
|
||||
arma_ignore(val);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<>
|
||||
arma_inline
|
||||
inline
|
||||
bool
|
||||
arma_isinf(float x)
|
||||
{
|
||||
#if defined(ARMA_USE_CXX11)
|
||||
{
|
||||
return std::isinf(x);
|
||||
}
|
||||
#elif defined(ARMA_HAVE_ISINF)
|
||||
{
|
||||
return (std::isinf(x) != 0);
|
||||
}
|
||||
#else
|
||||
{
|
||||
const float y = (std::numeric_limits<float>::max)();
|
||||
|
||||
const volatile float xx = x;
|
||||
|
||||
return (xx == xx) && ((x < -y) || (x > y));
|
||||
}
|
||||
#endif
|
||||
return std::isinf(x);
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<>
|
||||
arma_inline
|
||||
inline
|
||||
bool
|
||||
arma_isinf(double x)
|
||||
{
|
||||
#if defined(ARMA_USE_CXX11)
|
||||
{
|
||||
return std::isinf(x);
|
||||
}
|
||||
#elif defined(ARMA_HAVE_ISINF)
|
||||
{
|
||||
return (std::isinf(x) != 0);
|
||||
}
|
||||
#else
|
||||
{
|
||||
const double y = (std::numeric_limits<double>::max)();
|
||||
|
||||
const volatile double xx = x;
|
||||
|
||||
return (xx == xx) && ((x < -y) || (x > y));
|
||||
}
|
||||
#endif
|
||||
return std::isinf(x);
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename T>
|
||||
arma_inline
|
||||
inline
|
||||
bool
|
||||
arma_isinf(const std::complex<T>& x)
|
||||
{
|
||||
@@ -196,7 +115,7 @@ arma_isinf(const std::complex<T>& x)
|
||||
|
||||
|
||||
template<typename eT>
|
||||
arma_inline
|
||||
inline
|
||||
bool
|
||||
arma_isnan(eT val)
|
||||
{
|
||||
@@ -208,55 +127,27 @@ arma_isnan(eT val)
|
||||
|
||||
|
||||
template<>
|
||||
arma_inline
|
||||
inline
|
||||
bool
|
||||
arma_isnan(float x)
|
||||
{
|
||||
#if defined(ARMA_USE_CXX11)
|
||||
{
|
||||
return std::isnan(x);
|
||||
}
|
||||
#elif defined(ARMA_HAVE_ISNAN)
|
||||
{
|
||||
return (std::isnan(x) != 0);
|
||||
}
|
||||
#else
|
||||
{
|
||||
const volatile float xx = x;
|
||||
|
||||
return (xx != xx);
|
||||
}
|
||||
#endif
|
||||
return std::isnan(x);
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<>
|
||||
arma_inline
|
||||
inline
|
||||
bool
|
||||
arma_isnan(double x)
|
||||
{
|
||||
#if defined(ARMA_USE_CXX11)
|
||||
{
|
||||
return std::isnan(x);
|
||||
}
|
||||
#elif defined(ARMA_HAVE_ISNAN)
|
||||
{
|
||||
return (std::isnan(x) != 0);
|
||||
}
|
||||
#else
|
||||
{
|
||||
const volatile double xx = x;
|
||||
|
||||
return (xx != xx);
|
||||
}
|
||||
#endif
|
||||
return std::isnan(x);
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename T>
|
||||
arma_inline
|
||||
inline
|
||||
bool
|
||||
arma_isnan(const std::complex<T>& x)
|
||||
{
|
||||
@@ -265,76 +156,12 @@ arma_isnan(const std::complex<T>& x)
|
||||
|
||||
|
||||
|
||||
// rudimentary wrappers for log1p()
|
||||
|
||||
arma_inline
|
||||
float
|
||||
arma_log1p(const float x)
|
||||
{
|
||||
#if defined(ARMA_USE_CXX11)
|
||||
{
|
||||
return std::log1p(x);
|
||||
}
|
||||
#else
|
||||
{
|
||||
if((x >= float(0)) && (x < std::numeric_limits<float>::epsilon()))
|
||||
{
|
||||
return x;
|
||||
}
|
||||
else
|
||||
if((x < float(0)) && (-x < std::numeric_limits<float>::epsilon()))
|
||||
{
|
||||
return x;
|
||||
}
|
||||
else
|
||||
{
|
||||
return std::log(float(1) + x);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
arma_inline
|
||||
double
|
||||
arma_log1p(const double x)
|
||||
{
|
||||
#if defined(ARMA_USE_CXX11)
|
||||
{
|
||||
return std::log1p(x);
|
||||
}
|
||||
#elif defined(ARMA_HAVE_LOG1P)
|
||||
{
|
||||
return log1p(x);
|
||||
}
|
||||
#else
|
||||
{
|
||||
if((x >= double(0)) && (x < std::numeric_limits<double>::epsilon()))
|
||||
{
|
||||
return x;
|
||||
}
|
||||
else
|
||||
if((x < double(0)) && (-x < std::numeric_limits<double>::epsilon()))
|
||||
{
|
||||
return x;
|
||||
}
|
||||
else
|
||||
{
|
||||
return std::log(double(1) + x);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// implementation of arma_sign()
|
||||
|
||||
|
||||
template<typename eT>
|
||||
arma_inline
|
||||
constexpr
|
||||
typename arma_unsigned_integral_only<eT>::result
|
||||
arma_sign(const eT x)
|
||||
{
|
||||
@@ -344,7 +171,7 @@ arma_sign(const eT x)
|
||||
|
||||
|
||||
template<typename eT>
|
||||
arma_inline
|
||||
constexpr
|
||||
typename arma_signed_integral_only<eT>::result
|
||||
arma_sign(const eT x)
|
||||
{
|
||||
@@ -354,17 +181,17 @@ arma_sign(const eT x)
|
||||
|
||||
|
||||
template<typename eT>
|
||||
arma_inline
|
||||
constexpr
|
||||
typename arma_real_only<eT>::result
|
||||
arma_sign(const eT x)
|
||||
{
|
||||
return (x > eT(0)) ? eT(+1) : ( (x < eT(0)) ? eT(-1) : eT(0) );
|
||||
return (x > eT(0)) ? eT(+1) : ( (x < eT(0)) ? eT(-1) : ((x == eT(0)) ? eT(0) : x) );
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename eT>
|
||||
arma_inline
|
||||
inline
|
||||
typename arma_cx_only<eT>::result
|
||||
arma_sign(const eT& x)
|
||||
{
|
||||
@@ -377,322 +204,10 @@ arma_sign(const eT& x)
|
||||
|
||||
|
||||
|
||||
//
|
||||
// wrappers for trigonometric functions
|
||||
//
|
||||
// wherever possible, try to use C++11 or TR1 versions of the following functions:
|
||||
//
|
||||
// complex acos
|
||||
// complex asin
|
||||
// complex atan
|
||||
//
|
||||
// real acosh
|
||||
// real asinh
|
||||
// real atanh
|
||||
//
|
||||
// complex acosh
|
||||
// complex asinh
|
||||
// complex atanh
|
||||
//
|
||||
//
|
||||
// if C++11 or TR1 are not available, we have rudimentary versions of:
|
||||
//
|
||||
// real acosh
|
||||
// real asinh
|
||||
// real atanh
|
||||
|
||||
|
||||
|
||||
template<typename T>
|
||||
arma_inline
|
||||
std::complex<T>
|
||||
arma_acos(const std::complex<T>& x)
|
||||
{
|
||||
#if defined(ARMA_USE_CXX11)
|
||||
{
|
||||
return std::acos(x);
|
||||
}
|
||||
#elif defined(ARMA_HAVE_TR1)
|
||||
{
|
||||
return std::tr1::acos(x);
|
||||
}
|
||||
#else
|
||||
{
|
||||
arma_ignore(x);
|
||||
arma_stop_logic_error("acos(): C++11 compiler required");
|
||||
|
||||
return std::complex<T>(0);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename T>
|
||||
arma_inline
|
||||
std::complex<T>
|
||||
arma_asin(const std::complex<T>& x)
|
||||
{
|
||||
#if defined(ARMA_USE_CXX11)
|
||||
{
|
||||
return std::asin(x);
|
||||
}
|
||||
#elif defined(ARMA_HAVE_TR1)
|
||||
{
|
||||
return std::tr1::asin(x);
|
||||
}
|
||||
#else
|
||||
{
|
||||
arma_ignore(x);
|
||||
arma_stop_logic_error("asin(): C++11 compiler required");
|
||||
|
||||
return std::complex<T>(0);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename T>
|
||||
arma_inline
|
||||
std::complex<T>
|
||||
arma_atan(const std::complex<T>& x)
|
||||
{
|
||||
#if defined(ARMA_USE_CXX11)
|
||||
{
|
||||
return std::atan(x);
|
||||
}
|
||||
#elif defined(ARMA_HAVE_TR1)
|
||||
{
|
||||
return std::tr1::atan(x);
|
||||
}
|
||||
#else
|
||||
{
|
||||
arma_ignore(x);
|
||||
arma_stop_logic_error("atan(): C++11 compiler required");
|
||||
|
||||
return std::complex<T>(0);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename eT>
|
||||
arma_inline
|
||||
eT
|
||||
arma_acosh(const eT x)
|
||||
{
|
||||
#if defined(ARMA_USE_CXX11)
|
||||
{
|
||||
return std::acosh(x);
|
||||
}
|
||||
#elif defined(ARMA_HAVE_TR1)
|
||||
{
|
||||
return std::tr1::acosh(x);
|
||||
}
|
||||
#else
|
||||
{
|
||||
if(x >= eT(1))
|
||||
{
|
||||
// http://functions.wolfram.com/ElementaryFunctions/ArcCosh/02/
|
||||
return std::log( x + std::sqrt(x*x - eT(1)) );
|
||||
}
|
||||
else
|
||||
{
|
||||
if(std::numeric_limits<eT>::has_quiet_NaN)
|
||||
{
|
||||
return -(std::numeric_limits<eT>::quiet_NaN());
|
||||
}
|
||||
else
|
||||
{
|
||||
return eT(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename eT>
|
||||
arma_inline
|
||||
eT
|
||||
arma_asinh(const eT x)
|
||||
{
|
||||
#if defined(ARMA_USE_CXX11)
|
||||
{
|
||||
return std::asinh(x);
|
||||
}
|
||||
#elif defined(ARMA_HAVE_TR1)
|
||||
{
|
||||
return std::tr1::asinh(x);
|
||||
}
|
||||
#else
|
||||
{
|
||||
// http://functions.wolfram.com/ElementaryFunctions/ArcSinh/02/
|
||||
return std::log( x + std::sqrt(x*x + eT(1)) );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename eT>
|
||||
arma_inline
|
||||
eT
|
||||
arma_atanh(const eT x)
|
||||
{
|
||||
#if defined(ARMA_USE_CXX11)
|
||||
{
|
||||
return std::atanh(x);
|
||||
}
|
||||
#elif defined(ARMA_HAVE_TR1)
|
||||
{
|
||||
return std::tr1::atanh(x);
|
||||
}
|
||||
#else
|
||||
{
|
||||
if( (x >= eT(-1)) && (x <= eT(+1)) )
|
||||
{
|
||||
// http://functions.wolfram.com/ElementaryFunctions/ArcTanh/02/
|
||||
return std::log( ( eT(1)+x ) / ( eT(1)-x ) ) / eT(2);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(std::numeric_limits<eT>::has_quiet_NaN)
|
||||
{
|
||||
return -(std::numeric_limits<eT>::quiet_NaN());
|
||||
}
|
||||
else
|
||||
{
|
||||
return eT(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename T>
|
||||
arma_inline
|
||||
std::complex<T>
|
||||
arma_acosh(const std::complex<T>& x)
|
||||
{
|
||||
#if defined(ARMA_USE_CXX11)
|
||||
{
|
||||
return std::acosh(x);
|
||||
}
|
||||
#elif defined(ARMA_HAVE_TR1)
|
||||
{
|
||||
return std::tr1::acosh(x);
|
||||
}
|
||||
#else
|
||||
{
|
||||
arma_ignore(x);
|
||||
arma_stop_logic_error("acosh(): C++11 compiler required");
|
||||
|
||||
return std::complex<T>(0);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename T>
|
||||
arma_inline
|
||||
std::complex<T>
|
||||
arma_asinh(const std::complex<T>& x)
|
||||
{
|
||||
#if defined(ARMA_USE_CXX11)
|
||||
{
|
||||
return std::asinh(x);
|
||||
}
|
||||
#elif defined(ARMA_HAVE_TR1)
|
||||
{
|
||||
return std::tr1::asinh(x);
|
||||
}
|
||||
#else
|
||||
{
|
||||
arma_ignore(x);
|
||||
arma_stop_logic_error("asinh(): C++11 compiler required");
|
||||
|
||||
return std::complex<T>(0);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename T>
|
||||
arma_inline
|
||||
std::complex<T>
|
||||
arma_atanh(const std::complex<T>& x)
|
||||
{
|
||||
#if defined(ARMA_USE_CXX11)
|
||||
{
|
||||
return std::atanh(x);
|
||||
}
|
||||
#elif defined(ARMA_HAVE_TR1)
|
||||
{
|
||||
return std::tr1::atanh(x);
|
||||
}
|
||||
#else
|
||||
{
|
||||
arma_ignore(x);
|
||||
arma_stop_logic_error("atanh(): C++11 compiler required");
|
||||
|
||||
return std::complex<T>(0);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// wrappers for hypot(x, y) = sqrt(x^2 + y^2)
|
||||
|
||||
|
||||
template<typename eT>
|
||||
inline
|
||||
eT
|
||||
arma_hypot_generic(const eT x, const eT y)
|
||||
{
|
||||
#if defined(ARMA_USE_CXX11)
|
||||
{
|
||||
return std::hypot(x, y);
|
||||
}
|
||||
#elif defined(ARMA_HAVE_TR1)
|
||||
{
|
||||
return std::tr1::hypot(x, y);
|
||||
}
|
||||
#else
|
||||
{
|
||||
const eT xabs = std::abs(x);
|
||||
const eT yabs = std::abs(y);
|
||||
|
||||
eT larger;
|
||||
eT ratio;
|
||||
|
||||
if(xabs > yabs)
|
||||
{
|
||||
larger = xabs;
|
||||
ratio = yabs / xabs;
|
||||
}
|
||||
else
|
||||
{
|
||||
larger = yabs;
|
||||
ratio = xabs / yabs;
|
||||
}
|
||||
|
||||
return (larger == eT(0)) ? eT(0) : (larger * std::sqrt(eT(1) + ratio * ratio));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename eT>
|
||||
inline
|
||||
eT
|
||||
@@ -709,21 +224,21 @@ arma_hypot(const eT x, const eT y)
|
||||
|
||||
|
||||
template<>
|
||||
arma_inline
|
||||
inline
|
||||
float
|
||||
arma_hypot(const float x, const float y)
|
||||
{
|
||||
return arma_hypot_generic(x,y);
|
||||
return std::hypot(x, y);
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<>
|
||||
arma_inline
|
||||
inline
|
||||
double
|
||||
arma_hypot(const double x, const double y)
|
||||
{
|
||||
return arma_hypot_generic(x,y);
|
||||
return std::hypot(x, y);
|
||||
}
|
||||
|
||||
|
||||
@@ -733,7 +248,7 @@ arma_hypot(const double x, const double y)
|
||||
|
||||
|
||||
template<typename eT>
|
||||
arma_inline
|
||||
inline
|
||||
eT
|
||||
arma_sinc_generic(const eT x)
|
||||
{
|
||||
@@ -747,7 +262,7 @@ arma_sinc_generic(const eT x)
|
||||
|
||||
|
||||
template<typename eT>
|
||||
arma_inline
|
||||
inline
|
||||
eT
|
||||
arma_sinc(const eT x)
|
||||
{
|
||||
@@ -757,7 +272,7 @@ arma_sinc(const eT x)
|
||||
|
||||
|
||||
template<>
|
||||
arma_inline
|
||||
inline
|
||||
float
|
||||
arma_sinc(const float x)
|
||||
{
|
||||
@@ -767,7 +282,7 @@ arma_sinc(const float x)
|
||||
|
||||
|
||||
template<>
|
||||
arma_inline
|
||||
inline
|
||||
double
|
||||
arma_sinc(const double x)
|
||||
{
|
||||
@@ -777,7 +292,7 @@ arma_sinc(const double x)
|
||||
|
||||
|
||||
template<typename T>
|
||||
arma_inline
|
||||
inline
|
||||
std::complex<T>
|
||||
arma_sinc(const std::complex<T>& x)
|
||||
{
|
||||
@@ -798,18 +313,7 @@ struct arma_arg
|
||||
eT
|
||||
eval(const eT x)
|
||||
{
|
||||
#if defined(ARMA_USE_CXX11)
|
||||
{
|
||||
return eT( std::arg(x) );
|
||||
}
|
||||
#else
|
||||
{
|
||||
arma_ignore(x);
|
||||
arma_stop_logic_error("arg(): C++11 compiler required");
|
||||
|
||||
return eT(0);
|
||||
}
|
||||
#endif
|
||||
return eT( std::arg(x) );
|
||||
}
|
||||
};
|
||||
|
||||
@@ -819,19 +323,11 @@ template<>
|
||||
struct arma_arg<float>
|
||||
{
|
||||
static
|
||||
arma_inline
|
||||
inline
|
||||
float
|
||||
eval(const float x)
|
||||
{
|
||||
#if defined(ARMA_USE_CXX11)
|
||||
{
|
||||
return std::arg(x);
|
||||
}
|
||||
#else
|
||||
{
|
||||
return std::arg( std::complex<float>( x, float(0) ) );
|
||||
}
|
||||
#endif
|
||||
return std::arg(x);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -841,19 +337,11 @@ template<>
|
||||
struct arma_arg<double>
|
||||
{
|
||||
static
|
||||
arma_inline
|
||||
inline
|
||||
double
|
||||
eval(const double x)
|
||||
{
|
||||
#if defined(ARMA_USE_CXX11)
|
||||
{
|
||||
return std::arg(x);
|
||||
}
|
||||
#else
|
||||
{
|
||||
return std::arg( std::complex<double>( x, double(0) ) );
|
||||
}
|
||||
#endif
|
||||
return std::arg(x);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -863,7 +351,7 @@ template<>
|
||||
struct arma_arg< std::complex<float> >
|
||||
{
|
||||
static
|
||||
arma_inline
|
||||
inline
|
||||
float
|
||||
eval(const std::complex<float>& x)
|
||||
{
|
||||
@@ -877,7 +365,7 @@ template<>
|
||||
struct arma_arg< std::complex<double> >
|
||||
{
|
||||
static
|
||||
arma_inline
|
||||
inline
|
||||
double
|
||||
eval(const std::complex<double>& x)
|
||||
{
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
// Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
//
|
||||
@@ -22,93 +24,93 @@
|
||||
struct arma_config
|
||||
{
|
||||
#if defined(ARMA_MAT_PREALLOC)
|
||||
static const uword mat_prealloc = (sword(ARMA_MAT_PREALLOC) > 0) ? uword(ARMA_MAT_PREALLOC) : 1;
|
||||
static constexpr uword mat_prealloc = (sword(ARMA_MAT_PREALLOC) > 0) ? uword(ARMA_MAT_PREALLOC) : 1;
|
||||
#else
|
||||
static const uword mat_prealloc = 16;
|
||||
static constexpr uword mat_prealloc = 16;
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(ARMA_OPENMP_THRESHOLD)
|
||||
static const uword mp_threshold = (sword(ARMA_OPENMP_THRESHOLD) > 0) ? uword(ARMA_OPENMP_THRESHOLD) : 240;
|
||||
static constexpr uword mp_threshold = (sword(ARMA_OPENMP_THRESHOLD) > 0) ? uword(ARMA_OPENMP_THRESHOLD) : 320;
|
||||
#else
|
||||
static const uword mp_threshold = 240;
|
||||
static constexpr uword mp_threshold = 320;
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(ARMA_OPENMP_THREADS)
|
||||
static const uword mp_threads = (sword(ARMA_OPENMP_THREADS) > 0) ? uword(ARMA_OPENMP_THREADS) : 10;
|
||||
static constexpr uword mp_threads = (sword(ARMA_OPENMP_THREADS) > 0) ? uword(ARMA_OPENMP_THREADS) : 8;
|
||||
#else
|
||||
static const uword mp_threads = 10;
|
||||
static constexpr uword mp_threads = 8;
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(ARMA_USE_ATLAS)
|
||||
static const bool atlas = true;
|
||||
static constexpr bool atlas = true;
|
||||
#else
|
||||
static const bool atlas = false;
|
||||
static constexpr bool atlas = false;
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(ARMA_USE_LAPACK)
|
||||
static const bool lapack = true;
|
||||
static constexpr bool lapack = true;
|
||||
#else
|
||||
static const bool lapack = false;
|
||||
static constexpr bool lapack = false;
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(ARMA_USE_BLAS)
|
||||
static const bool blas = true;
|
||||
static constexpr bool blas = true;
|
||||
#else
|
||||
static const bool blas = false;
|
||||
static constexpr bool blas = false;
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(ARMA_USE_NEWARP)
|
||||
static const bool newarp = true;
|
||||
static constexpr bool newarp = true;
|
||||
#else
|
||||
static const bool newarp = false;
|
||||
static constexpr bool newarp = false;
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(ARMA_USE_ARPACK)
|
||||
static const bool arpack = true;
|
||||
static constexpr bool arpack = true;
|
||||
#else
|
||||
static const bool arpack = false;
|
||||
static constexpr bool arpack = false;
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(ARMA_USE_SUPERLU)
|
||||
static const bool superlu = true;
|
||||
static constexpr bool superlu = true;
|
||||
#else
|
||||
static const bool superlu = false;
|
||||
static constexpr bool superlu = false;
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(ARMA_USE_HDF5)
|
||||
static const bool hdf5 = true;
|
||||
static constexpr bool hdf5 = true;
|
||||
#else
|
||||
static const bool hdf5 = false;
|
||||
static constexpr bool hdf5 = false;
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(ARMA_NO_DEBUG)
|
||||
static const bool debug = false;
|
||||
static constexpr bool debug = false;
|
||||
#else
|
||||
static const bool debug = true;
|
||||
static constexpr bool debug = true;
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(ARMA_EXTRA_DEBUG)
|
||||
static const bool extra_debug = true;
|
||||
static constexpr bool extra_debug = true;
|
||||
#else
|
||||
static const bool extra_debug = false;
|
||||
static constexpr bool extra_debug = false;
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(ARMA_GOOD_COMPILER)
|
||||
static const bool good_comp = true;
|
||||
static constexpr bool good_comp = true;
|
||||
#else
|
||||
static const bool good_comp = false;
|
||||
static constexpr bool good_comp = false;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -121,53 +123,65 @@ struct arma_config
|
||||
|| defined(ARMA_EXTRA_SPMAT_PROTO) || defined(ARMA_EXTRA_SPMAT_MEAT) \
|
||||
|| defined(ARMA_EXTRA_SPCOL_PROTO) || defined(ARMA_EXTRA_SPCOL_MEAT) \
|
||||
|| defined(ARMA_EXTRA_SPROW_PROTO) || defined(ARMA_EXTRA_SPROW_MEAT) \
|
||||
|| defined(ARMA_ALIEN_MEM_ALLOC_FUNCTION) \
|
||||
|| defined(ARMA_ALIEN_MEM_FREE_FUNCTION) \
|
||||
)
|
||||
static const bool extra_code = true;
|
||||
static constexpr bool extra_code = true;
|
||||
#else
|
||||
static const bool extra_code = false;
|
||||
static constexpr bool extra_code = false;
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(ARMA_USE_CXX11)
|
||||
static const bool cxx11 = true;
|
||||
#if defined(ARMA_HAVE_CXX14)
|
||||
static constexpr bool cxx14 = true;
|
||||
#else
|
||||
static const bool cxx11 = false;
|
||||
static constexpr bool cxx14 = false;
|
||||
#endif
|
||||
|
||||
|
||||
#if (defined(ARMA_USE_CXX11) && !defined(ARMA_DONT_USE_CXX11_MUTEX))
|
||||
static const bool cxx11_mutex = true;
|
||||
#if defined(ARMA_HAVE_CXX17)
|
||||
static constexpr bool cxx17 = true;
|
||||
#else
|
||||
static const bool cxx11_mutex = false;
|
||||
static constexpr bool cxx17 = false;
|
||||
#endif
|
||||
|
||||
|
||||
#if (!defined(ARMA_DONT_USE_STD_MUTEX))
|
||||
static constexpr bool std_mutex = true;
|
||||
#else
|
||||
static constexpr bool std_mutex = false;
|
||||
#endif
|
||||
|
||||
|
||||
#if (defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200112L))
|
||||
static const bool posix = true;
|
||||
static constexpr bool posix = true;
|
||||
#else
|
||||
static const bool posix = false;
|
||||
static constexpr bool posix = false;
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(ARMA_USE_WRAPPER)
|
||||
static const bool wrapper = true;
|
||||
static constexpr bool wrapper = true;
|
||||
#else
|
||||
static const bool wrapper = false;
|
||||
static constexpr bool wrapper = false;
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(ARMA_USE_OPENMP)
|
||||
static const bool openmp = true;
|
||||
static constexpr bool openmp = true;
|
||||
#else
|
||||
static const bool openmp = false;
|
||||
static constexpr bool openmp = false;
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(ARMA_USE_FORTRAN_HIDDEN_ARGS)
|
||||
static const bool hidden_args = true;
|
||||
static constexpr bool hidden_args = true;
|
||||
#else
|
||||
static const bool hidden_args = false;
|
||||
static constexpr bool hidden_args = false;
|
||||
#endif
|
||||
|
||||
|
||||
static constexpr uword warn_level = (sword(ARMA_WARN_LEVEL) > 0) ? uword(ARMA_WARN_LEVEL) : 0;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
// Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
//
|
||||
@@ -35,6 +37,7 @@ template<typename eT, bool do_conj> class xtrans_mat;
|
||||
|
||||
template<typename eT> class subview;
|
||||
template<typename eT> class subview_col;
|
||||
template<typename eT> class subview_cols;
|
||||
template<typename eT> class subview_row;
|
||||
template<typename eT> class subview_row_strans;
|
||||
template<typename eT> class subview_row_htrans;
|
||||
@@ -67,6 +70,8 @@ template<typename eT> class subview_cube_each1;
|
||||
template<typename eT, typename TB> class subview_cube_each2;
|
||||
template<typename eT, typename T1> class subview_cube_slices;
|
||||
|
||||
template<typename eT, typename T1> class SpSubview_col_list;
|
||||
|
||||
|
||||
class SizeMat;
|
||||
class SizeCube;
|
||||
@@ -144,9 +149,9 @@ struct traits_op_default
|
||||
template<typename T1>
|
||||
struct traits
|
||||
{
|
||||
static const bool is_row = false;
|
||||
static const bool is_col = false;
|
||||
static const bool is_xvec = false;
|
||||
static constexpr bool is_row = false;
|
||||
static constexpr bool is_col = false;
|
||||
static constexpr bool is_xvec = false;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -156,9 +161,9 @@ struct traits_op_xvec
|
||||
template<typename T1>
|
||||
struct traits
|
||||
{
|
||||
static const bool is_row = false;
|
||||
static const bool is_col = false;
|
||||
static const bool is_xvec = true;
|
||||
static constexpr bool is_row = false;
|
||||
static constexpr bool is_col = false;
|
||||
static constexpr bool is_xvec = true;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -168,9 +173,9 @@ struct traits_op_col
|
||||
template<typename T1>
|
||||
struct traits
|
||||
{
|
||||
static const bool is_row = false;
|
||||
static const bool is_col = true;
|
||||
static const bool is_xvec = false;
|
||||
static constexpr bool is_row = false;
|
||||
static constexpr bool is_col = true;
|
||||
static constexpr bool is_xvec = false;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -180,9 +185,9 @@ struct traits_op_row
|
||||
template<typename T1>
|
||||
struct traits
|
||||
{
|
||||
static const bool is_row = true;
|
||||
static const bool is_col = false;
|
||||
static const bool is_xvec = false;
|
||||
static constexpr bool is_row = true;
|
||||
static constexpr bool is_col = false;
|
||||
static constexpr bool is_xvec = false;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -192,9 +197,9 @@ struct traits_op_passthru
|
||||
template<typename T1>
|
||||
struct traits
|
||||
{
|
||||
static const bool is_row = T1::is_row;
|
||||
static const bool is_col = T1::is_col;
|
||||
static const bool is_xvec = T1::is_xvec;
|
||||
static constexpr bool is_row = T1::is_row;
|
||||
static constexpr bool is_col = T1::is_col;
|
||||
static constexpr bool is_xvec = T1::is_xvec;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -204,9 +209,9 @@ struct traits_glue_default
|
||||
template<typename T1, typename T2>
|
||||
struct traits
|
||||
{
|
||||
static const bool is_row = false;
|
||||
static const bool is_col = false;
|
||||
static const bool is_xvec = false;
|
||||
static constexpr bool is_row = false;
|
||||
static constexpr bool is_col = false;
|
||||
static constexpr bool is_xvec = false;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -216,9 +221,9 @@ struct traits_glue_or
|
||||
template<typename T1, typename T2>
|
||||
struct traits
|
||||
{
|
||||
static const bool is_row = (T1::is_row || T2::is_row );
|
||||
static const bool is_col = (T1::is_col || T2::is_col );
|
||||
static const bool is_xvec = (T1::is_xvec || T2::is_xvec);
|
||||
static constexpr bool is_row = (T1::is_row || T2::is_row );
|
||||
static constexpr bool is_col = (T1::is_col || T2::is_col );
|
||||
static constexpr bool is_xvec = (T1::is_xvec || T2::is_xvec);
|
||||
};
|
||||
};
|
||||
|
||||
@@ -253,12 +258,13 @@ template< typename T1, typename T2, typename eglue_type> class
|
||||
template<typename out_eT, typename T1, typename T2, typename glue_type> class mtGlueCube;
|
||||
|
||||
|
||||
template<typename T1> class Proxy;
|
||||
template<typename T1> class ProxyCube;
|
||||
template<typename T1> struct Proxy;
|
||||
template<typename T1> struct ProxyCube;
|
||||
|
||||
template<typename T1> class diagmat_proxy;
|
||||
|
||||
template<typename T1> struct unwrap;
|
||||
template<typename T1> struct quasi_unwrap;
|
||||
template<typename T1> struct unwrap_cube;
|
||||
template<typename T1> struct unwrap_spmat;
|
||||
|
||||
@@ -269,7 +275,7 @@ struct state_type
|
||||
{
|
||||
#if defined(ARMA_USE_OPENMP)
|
||||
int state;
|
||||
#elif (defined(ARMA_USE_CXX11) && !defined(ARMA_DONT_USE_CXX11_MUTEX))
|
||||
#elif (!defined(ARMA_DONT_USE_STD_MUTEX))
|
||||
std::atomic<int> state;
|
||||
#else
|
||||
int state;
|
||||
@@ -288,7 +294,7 @@ struct state_type
|
||||
#if defined(ARMA_USE_OPENMP)
|
||||
#pragma omp atomic read
|
||||
out = state;
|
||||
#elif (defined(ARMA_USE_CXX11) && !defined(ARMA_DONT_USE_CXX11_MUTEX))
|
||||
#elif (!defined(ARMA_DONT_USE_STD_MUTEX))
|
||||
out = state.load();
|
||||
#else
|
||||
out = state;
|
||||
@@ -304,7 +310,7 @@ struct state_type
|
||||
#if defined(ARMA_USE_OPENMP)
|
||||
#pragma omp atomic write
|
||||
state = in_state;
|
||||
#elif (defined(ARMA_USE_CXX11) && !defined(ARMA_DONT_USE_CXX11_MUTEX))
|
||||
#elif (!defined(ARMA_DONT_USE_STD_MUTEX))
|
||||
state.store(in_state);
|
||||
#else
|
||||
state = in_state;
|
||||
@@ -320,7 +326,7 @@ template< typename T1, typename T2, typename spglue_type> class
|
||||
template<typename out_eT, typename T1, typename T2, typename spglue_type> class mtSpGlue;
|
||||
|
||||
|
||||
template<typename T1> class SpProxy;
|
||||
template<typename T1> struct SpProxy;
|
||||
|
||||
|
||||
|
||||
@@ -329,6 +335,11 @@ struct arma_fixed_indicator {};
|
||||
struct arma_reserve_indicator {};
|
||||
struct arma_layout_indicator {};
|
||||
|
||||
template<bool do_zeros> struct arma_initmode_indicator {};
|
||||
|
||||
struct arma_zeros_indicator : public arma_initmode_indicator<true > {};
|
||||
struct arma_nozeros_indicator : public arma_initmode_indicator<false> {};
|
||||
|
||||
|
||||
//! \addtogroup injector
|
||||
//! @{
|
||||
@@ -347,7 +358,7 @@ static const injector_end_of_row<> endr = injector_end_of_row<>();
|
||||
//! @{
|
||||
|
||||
|
||||
enum file_type
|
||||
enum struct file_type : unsigned int
|
||||
{
|
||||
file_type_unknown,
|
||||
auto_detect, //!< attempt to automatically detect the file type
|
||||
@@ -359,11 +370,27 @@ enum file_type
|
||||
pgm_binary, //!< Portable Grey Map (greyscale image)
|
||||
ppm_binary, //!< Portable Pixel Map (colour image), used by the field and cube classes
|
||||
hdf5_binary, //!< HDF5: open binary format, not specific to Armadillo, which can store arbitrary data
|
||||
hdf5_binary_trans, //!< [DO NOT USE - deprecated] as per hdf5_binary, but save/load the data with columns transposed to rows
|
||||
coord_ascii //!< simple co-ordinate format for sparse matrices (indices start at zero)
|
||||
hdf5_binary_trans, //!< [NOTE: DO NOT USE - deprecated] as per hdf5_binary, but save/load the data with columns transposed to rows
|
||||
coord_ascii, //!< simple co-ordinate format for sparse matrices (indices start at zero)
|
||||
ssv_ascii, //!< similar to csv_ascii; uses semicolon (;) instead of comma (,) as the separator
|
||||
};
|
||||
|
||||
|
||||
static constexpr file_type file_type_unknown = file_type::file_type_unknown;
|
||||
static constexpr file_type auto_detect = file_type::auto_detect;
|
||||
static constexpr file_type raw_ascii = file_type::raw_ascii;
|
||||
static constexpr file_type arma_ascii = file_type::arma_ascii;
|
||||
static constexpr file_type csv_ascii = file_type::csv_ascii;
|
||||
static constexpr file_type raw_binary = file_type::raw_binary;
|
||||
static constexpr file_type arma_binary = file_type::arma_binary;
|
||||
static constexpr file_type pgm_binary = file_type::pgm_binary;
|
||||
static constexpr file_type ppm_binary = file_type::ppm_binary;
|
||||
static constexpr file_type hdf5_binary = file_type::hdf5_binary;
|
||||
static constexpr file_type hdf5_binary_trans = file_type::hdf5_binary_trans;
|
||||
static constexpr file_type coord_ascii = file_type::coord_ascii;
|
||||
static constexpr file_type ssv_ascii = file_type::ssv_ascii;
|
||||
|
||||
|
||||
struct hdf5_name;
|
||||
struct csv_name;
|
||||
|
||||
@@ -372,33 +399,6 @@ struct csv_name;
|
||||
|
||||
|
||||
|
||||
//! \addtogroup fill
|
||||
//! @{
|
||||
|
||||
namespace fill
|
||||
{
|
||||
struct fill_none {};
|
||||
struct fill_zeros {};
|
||||
struct fill_ones {};
|
||||
struct fill_eye {};
|
||||
struct fill_randu {};
|
||||
struct fill_randn {};
|
||||
|
||||
template<typename fill_type>
|
||||
struct fill_class { inline fill_class() {} };
|
||||
|
||||
static const fill_class<fill_none > none;
|
||||
static const fill_class<fill_zeros> zeros;
|
||||
static const fill_class<fill_ones > ones;
|
||||
static const fill_class<fill_eye > eye;
|
||||
static const fill_class<fill_randu> randu;
|
||||
static const fill_class<fill_randn> randn;
|
||||
}
|
||||
|
||||
//! @}
|
||||
|
||||
|
||||
|
||||
//! \addtogroup fn_spsolve
|
||||
//! @{
|
||||
|
||||
@@ -444,3 +444,26 @@ struct superlu_opts : public spsolve_opts_base
|
||||
|
||||
|
||||
//! @}
|
||||
|
||||
|
||||
|
||||
//! \ingroup fn_eigs_sym fs_eigs_gen
|
||||
//! @{
|
||||
|
||||
|
||||
struct eigs_opts
|
||||
{
|
||||
double tol; // tolerance
|
||||
unsigned int maxiter; // max iterations
|
||||
unsigned int subdim; // subspace dimension
|
||||
|
||||
inline eigs_opts()
|
||||
{
|
||||
tol = 0.0;
|
||||
maxiter = 1000;
|
||||
subdim = 0;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//! @}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
// Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
//
|
||||
@@ -22,15 +24,15 @@
|
||||
class arma_ostream_state
|
||||
{
|
||||
private:
|
||||
|
||||
|
||||
const ios::fmtflags orig_flags;
|
||||
const std::streamsize orig_precision;
|
||||
const std::streamsize orig_width;
|
||||
const char orig_fill;
|
||||
|
||||
|
||||
|
||||
|
||||
public:
|
||||
|
||||
|
||||
inline arma_ostream_state(const std::ostream& o);
|
||||
|
||||
inline void restore(std::ostream& o) const;
|
||||
@@ -44,8 +46,8 @@ class arma_ostream
|
||||
|
||||
template<typename eT> inline static std::streamsize modify_stream(std::ostream& o, const eT* data, const uword n_elem);
|
||||
template<typename T> inline static std::streamsize modify_stream(std::ostream& o, const std::complex<T>* data, const uword n_elem);
|
||||
template<typename eT> inline static std::streamsize modify_stream(std::ostream& o, typename SpMat<eT>::const_iterator begin, const uword n_elem, const typename arma_not_cx<eT>::result* junk = 0);
|
||||
template<typename T> inline static std::streamsize modify_stream(std::ostream& o, typename SpMat< T>::const_iterator begin, const uword n_elem, const typename arma_cx_only<T>::result* junk = 0);
|
||||
template<typename eT> inline static std::streamsize modify_stream(std::ostream& o, typename SpMat<eT>::const_iterator begin, const uword n_elem, const typename arma_not_cx<eT>::result* junk = nullptr);
|
||||
template<typename eT> inline static std::streamsize modify_stream(std::ostream& o, typename SpMat<eT>::const_iterator begin, const uword n_elem, const typename arma_cx_only<eT>::result* junk = nullptr);
|
||||
|
||||
template<typename eT> inline static void print_elem_zero(std::ostream& o, const bool modify);
|
||||
template<typename eT> inline static void raw_print_elem_zero(std::ostream& o);
|
||||
@@ -61,13 +63,16 @@ class arma_ostream
|
||||
|
||||
template<typename oT> arma_cold inline static void print(std::ostream& o, const field<oT>& m);
|
||||
template<typename oT> arma_cold inline static void print(std::ostream& o, const subview_field<oT>& m);
|
||||
|
||||
|
||||
|
||||
template<typename eT> arma_cold inline static void print_dense(std::ostream& o, const SpMat<eT>& m, const bool modify);
|
||||
template<typename eT> arma_cold inline static void print(std::ostream& o, const SpMat<eT>& m, const bool modify);
|
||||
|
||||
arma_cold inline static void print(std::ostream& o, const SizeMat& S);
|
||||
arma_cold inline static void print(std::ostream& o, const SizeCube& S);
|
||||
|
||||
template<typename eT> arma_cold inline static void brief_print(std::ostream& o, const Mat<eT>& m, const bool print_size = true);
|
||||
template<typename eT> arma_cold inline static void brief_print(std::ostream& o, const Cube<eT>& m);
|
||||
template<typename eT> arma_cold inline static void brief_print(std::ostream& o, const SpMat<eT>& m);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
// Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
//
|
||||
@@ -190,18 +192,18 @@ arma_ostream::modify_stream(std::ostream& o, typename SpMat<eT>::const_iterator
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_ignore(junk);
|
||||
|
||||
|
||||
o.unsetf(ios::showbase);
|
||||
o.unsetf(ios::uppercase);
|
||||
o.unsetf(ios::showpos);
|
||||
|
||||
|
||||
o.fill(' ');
|
||||
|
||||
|
||||
std::streamsize cell_width;
|
||||
|
||||
|
||||
bool use_layout_B = false;
|
||||
bool use_layout_C = false;
|
||||
|
||||
|
||||
for(typename SpMat<eT>::const_iterator it = begin; it.pos() < n_elem; ++it)
|
||||
{
|
||||
const eT val = (*it);
|
||||
@@ -218,7 +220,7 @@ arma_ostream::modify_stream(std::ostream& o, typename SpMat<eT>::const_iterator
|
||||
use_layout_C = true;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if(
|
||||
(val >= eT(+10)) || ( (is_signed<eT>::value) && (val <= eT(-10)) )
|
||||
)
|
||||
@@ -226,7 +228,7 @@ arma_ostream::modify_stream(std::ostream& o, typename SpMat<eT>::const_iterator
|
||||
use_layout_B = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(use_layout_C)
|
||||
{
|
||||
o.setf(ios::scientific);
|
||||
@@ -259,10 +261,10 @@ arma_ostream::modify_stream(std::ostream& o, typename SpMat<eT>::const_iterator
|
||||
|
||||
|
||||
//! "better than nothing" settings for complex numbers
|
||||
template<typename T>
|
||||
template<typename eT>
|
||||
inline
|
||||
std::streamsize
|
||||
arma_ostream::modify_stream(std::ostream& o, typename SpMat<T>::const_iterator begin, const uword n_elem, const typename arma_cx_only<T>::result* junk)
|
||||
arma_ostream::modify_stream(std::ostream& o, typename SpMat<eT>::const_iterator begin, const uword n_elem, const typename arma_cx_only<eT>::result* junk)
|
||||
{
|
||||
arma_ignore(begin);
|
||||
arma_ignore(n_elem);
|
||||
@@ -474,6 +476,14 @@ arma_ostream::print(std::ostream& o, const Mat<eT>& m, const bool modify)
|
||||
}
|
||||
else
|
||||
{
|
||||
if(modify)
|
||||
{
|
||||
o.unsetf(ios::showbase);
|
||||
o.unsetf(ios::uppercase);
|
||||
o.unsetf(ios::showpos);
|
||||
o.setf(ios::fixed);
|
||||
}
|
||||
|
||||
o << "[matrix size: " << m_n_rows << 'x' << m_n_cols << "]\n";
|
||||
}
|
||||
|
||||
@@ -500,16 +510,25 @@ arma_ostream::print(std::ostream& o, const Cube<eT>& x, const bool modify)
|
||||
{
|
||||
const Mat<eT> tmp(const_cast<eT*>(x.slice_memptr(slice)), x.n_rows, x.n_cols, false);
|
||||
|
||||
o << "[cube slice " << slice << ']' << '\n';
|
||||
o << "[cube slice: " << slice << ']' << '\n';
|
||||
arma_ostream::print(o, tmp, modify);
|
||||
o << '\n';
|
||||
|
||||
if((slice+1) < x.n_slices) { o << '\n'; }
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(modify)
|
||||
{
|
||||
o.unsetf(ios::showbase);
|
||||
o.unsetf(ios::uppercase);
|
||||
o.unsetf(ios::showpos);
|
||||
o.setf(ios::fixed);
|
||||
}
|
||||
|
||||
o << "[cube size: " << x.n_rows << 'x' << x.n_cols << 'x' << x.n_slices << "]\n";
|
||||
}
|
||||
|
||||
|
||||
stream_state.restore(o);
|
||||
}
|
||||
|
||||
@@ -517,7 +536,7 @@ arma_ostream::print(std::ostream& o, const Cube<eT>& x, const bool modify)
|
||||
|
||||
|
||||
//! Print a field to the specified stream
|
||||
//! Assumes type oT can be printed, i.e. oT has std::ostream& operator<< (std::ostream&, const oT&)
|
||||
//! Assumes type oT can be printed, ie. oT has std::ostream& operator<< (std::ostream&, const oT&)
|
||||
template<typename oT>
|
||||
arma_cold
|
||||
inline
|
||||
@@ -538,11 +557,11 @@ arma_ostream::print(std::ostream& o, const field<oT>& x)
|
||||
{
|
||||
if(x_n_slices == 1)
|
||||
{
|
||||
for(uword col=0; col<x_n_cols; ++col)
|
||||
for(uword col=0; col < x_n_cols; ++col)
|
||||
{
|
||||
o << "[field column " << col << ']' << '\n';
|
||||
o << "[field column: " << col << ']' << '\n';
|
||||
|
||||
for(uword row=0; row<x_n_rows; ++row)
|
||||
for(uword row=0; row < x_n_rows; ++row)
|
||||
{
|
||||
o.width(cell_width);
|
||||
o << x.at(row,col) << '\n';
|
||||
@@ -553,15 +572,15 @@ arma_ostream::print(std::ostream& o, const field<oT>& x)
|
||||
}
|
||||
else
|
||||
{
|
||||
for(uword slice=0; slice<x_n_slices; ++slice)
|
||||
for(uword slice=0; slice < x_n_slices; ++slice)
|
||||
{
|
||||
o << "[field slice " << slice << ']' << '\n';
|
||||
o << "[field slice: " << slice << ']' << '\n';
|
||||
|
||||
for(uword col=0; col<x_n_cols; ++col)
|
||||
for(uword col=0; col < x_n_cols; ++col)
|
||||
{
|
||||
o << "[field column " << col << ']' << '\n';
|
||||
o << "[field column: " << col << ']' << '\n';
|
||||
|
||||
for(uword row=0; row<x_n_rows; ++row)
|
||||
for(uword row=0; row < x_n_rows; ++row)
|
||||
{
|
||||
o.width(cell_width);
|
||||
o << x.at(row,col,slice) << '\n';
|
||||
@@ -576,6 +595,11 @@ arma_ostream::print(std::ostream& o, const field<oT>& x)
|
||||
}
|
||||
else
|
||||
{
|
||||
o.unsetf(ios::showbase);
|
||||
o.unsetf(ios::uppercase);
|
||||
o.unsetf(ios::showpos);
|
||||
o.setf(ios::fixed);
|
||||
|
||||
o << "[field size: " << x_n_rows << 'x' << x_n_cols << 'x' << x_n_slices << "]\n";
|
||||
}
|
||||
|
||||
@@ -586,7 +610,7 @@ arma_ostream::print(std::ostream& o, const field<oT>& x)
|
||||
|
||||
|
||||
//! Print a subfield to the specified stream
|
||||
//! Assumes type oT can be printed, i.e. oT has std::ostream& operator<< (std::ostream&, const oT&)
|
||||
//! Assumes type oT can be printed, ie. oT has std::ostream& operator<< (std::ostream&, const oT&)
|
||||
template<typename oT>
|
||||
arma_cold
|
||||
inline
|
||||
@@ -607,9 +631,9 @@ arma_ostream::print(std::ostream& o, const subview_field<oT>& x)
|
||||
{
|
||||
if(x_n_slices == 1)
|
||||
{
|
||||
for(uword col=0; col<x_n_cols; ++col)
|
||||
for(uword col=0; col < x_n_cols; ++col)
|
||||
{
|
||||
o << "[field column " << col << ']' << '\n';
|
||||
o << "[field column: " << col << ']' << '\n';
|
||||
for(uword row=0; row<x_n_rows; ++row)
|
||||
{
|
||||
o.width(cell_width);
|
||||
@@ -621,15 +645,15 @@ arma_ostream::print(std::ostream& o, const subview_field<oT>& x)
|
||||
}
|
||||
else
|
||||
{
|
||||
for(uword slice=0; slice<x_n_slices; ++slice)
|
||||
for(uword slice=0; slice < x_n_slices; ++slice)
|
||||
{
|
||||
o << "[field slice " << slice << ']' << '\n';
|
||||
o << "[field slice: " << slice << ']' << '\n';
|
||||
|
||||
for(uword col=0; col<x_n_cols; ++col)
|
||||
for(uword col=0; col < x_n_cols; ++col)
|
||||
{
|
||||
o << "[field column " << col << ']' << '\n';
|
||||
o << "[field column: " << col << ']' << '\n';
|
||||
|
||||
for(uword row=0; row<x_n_rows; ++row)
|
||||
for(uword row=0; row < x_n_rows; ++row)
|
||||
{
|
||||
o.width(cell_width);
|
||||
o << x.at(row,col,slice) << '\n';
|
||||
@@ -644,6 +668,11 @@ arma_ostream::print(std::ostream& o, const subview_field<oT>& x)
|
||||
}
|
||||
else
|
||||
{
|
||||
o.unsetf(ios::showbase);
|
||||
o.unsetf(ios::uppercase);
|
||||
o.unsetf(ios::showpos);
|
||||
o.setf(ios::fixed);
|
||||
|
||||
o << "[field size: " << x_n_rows << 'x' << x_n_cols << 'x' << x_n_slices << "]\n";
|
||||
}
|
||||
|
||||
@@ -719,6 +748,14 @@ arma_ostream::print_dense(std::ostream& o, const SpMat<eT>& m, const bool modify
|
||||
}
|
||||
else
|
||||
{
|
||||
if(modify)
|
||||
{
|
||||
o.unsetf(ios::showbase);
|
||||
o.unsetf(ios::uppercase);
|
||||
o.unsetf(ios::showpos);
|
||||
o.setf(ios::fixed);
|
||||
}
|
||||
|
||||
o << "[matrix size: " << m_n_rows << 'x' << m_n_cols << "]\n";
|
||||
}
|
||||
|
||||
@@ -789,37 +826,38 @@ arma_ostream::print(std::ostream& o, const SpMat<eT>& m, const bool modify)
|
||||
{
|
||||
const std::streamsize cell_width = modify ? arma_ostream::modify_stream<eT>(o, m.begin(), m_n_nonzero) : o.width();
|
||||
|
||||
typename SpMat<eT>::const_iterator begin = m.begin();
|
||||
typename SpMat<eT>::const_iterator m_end = m.end();
|
||||
typename SpMat<eT>::const_iterator it = m.begin();
|
||||
typename SpMat<eT>::const_iterator it_end = m.end();
|
||||
|
||||
while(begin != m_end)
|
||||
while(it != it_end)
|
||||
{
|
||||
const uword row = begin.row();
|
||||
const uword row = it.row();
|
||||
const uword col = it.col();
|
||||
|
||||
// TODO: change the maximum number of spaces before and after each location to be dependent on n_rows and n_cols
|
||||
|
||||
if(row < 10) { o << " "; }
|
||||
else if(row < 100) { o << " "; }
|
||||
else if(row < 1000) { o << " "; }
|
||||
else if(row < 10000) { o << " "; }
|
||||
else if(row < 100000) { o << ' '; }
|
||||
|
||||
const uword col = begin.col();
|
||||
if(row < 10) { o << " "; }
|
||||
else if(row < 100) { o << " "; }
|
||||
else if(row < 1000) { o << " "; }
|
||||
else if(row < 10000) { o << " "; }
|
||||
else if(row < 100000) { o << " "; }
|
||||
else if(row < 1000000) { o << ' '; }
|
||||
|
||||
o << '(' << row << ", " << col << ") ";
|
||||
|
||||
if(col < 10) { o << " "; }
|
||||
else if(col < 100) { o << " "; }
|
||||
else if(col < 1000) { o << " "; }
|
||||
else if(col < 10000) { o << " "; }
|
||||
else if(col < 100000) { o << ' '; }
|
||||
if(col < 10) { o << " "; }
|
||||
else if(col < 100) { o << " "; }
|
||||
else if(col < 1000) { o << " "; }
|
||||
else if(col < 10000) { o << " "; }
|
||||
else if(col < 100000) { o << " "; }
|
||||
else if(col < 1000000) { o << ' '; }
|
||||
|
||||
if(cell_width > 0) { o.width(cell_width); }
|
||||
|
||||
arma_ostream::print_elem(o, eT(*begin), modify);
|
||||
arma_ostream::print_elem(o, eT(*it), modify);
|
||||
o << '\n';
|
||||
|
||||
++begin;
|
||||
++it;
|
||||
}
|
||||
|
||||
o << '\n';
|
||||
@@ -875,4 +913,373 @@ arma_ostream::print(std::ostream& o, const SizeCube& S)
|
||||
|
||||
|
||||
|
||||
template<typename eT>
|
||||
arma_cold
|
||||
inline
|
||||
void
|
||||
arma_ostream::brief_print(std::ostream& o, const Mat<eT>& m, const bool print_size)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
const arma_ostream_state stream_state(o);
|
||||
|
||||
if(print_size)
|
||||
{
|
||||
o.unsetf(ios::showbase);
|
||||
o.unsetf(ios::uppercase);
|
||||
o.unsetf(ios::showpos);
|
||||
o.setf(ios::fixed);
|
||||
|
||||
o << "[matrix size: " << m.n_rows << 'x' << m.n_cols << "]\n";
|
||||
}
|
||||
|
||||
if(m.n_elem == 0) { o.flush(); stream_state.restore(o); return; }
|
||||
|
||||
if((m.n_rows <= 5) && (m.n_cols <= 5)) { arma_ostream::print(o, m, true); return; }
|
||||
|
||||
const bool print_row_ellipsis = (m.n_rows >= 6);
|
||||
const bool print_col_ellipsis = (m.n_cols >= 6);
|
||||
|
||||
if( (print_row_ellipsis == true) && (print_col_ellipsis == true) )
|
||||
{
|
||||
Mat<eT> X(4, 4, arma_nozeros_indicator());
|
||||
|
||||
X( span(0,2), span(0,2) ) = m( span(0,2), span(0,2) ); // top left submatrix
|
||||
X( 3, span(0,2) ) = m( m.n_rows-1, span(0,2) ); // truncated last row
|
||||
X( span(0,2), 3 ) = m( span(0,2), m.n_cols-1 ); // truncated last column
|
||||
X( 3, 3 ) = m( m.n_rows-1, m.n_cols-1 ); // bottom right element
|
||||
|
||||
const std::streamsize cell_width = arma_ostream::modify_stream(o, X.memptr(), X.n_elem);
|
||||
|
||||
for(uword row=0; row <= 2; ++row)
|
||||
{
|
||||
for(uword col=0; col <= 2; ++col)
|
||||
{
|
||||
o.width(cell_width);
|
||||
arma_ostream::print_elem(o, X.at(row,col), true);
|
||||
}
|
||||
|
||||
o.width(6);
|
||||
o << "...";
|
||||
|
||||
o.width(cell_width);
|
||||
arma_ostream::print_elem(o, X.at(row,3), true);
|
||||
o << '\n';
|
||||
}
|
||||
|
||||
for(uword col=0; col <= 2; ++col)
|
||||
{
|
||||
o.width(cell_width);
|
||||
o << ':';
|
||||
}
|
||||
|
||||
o.width(6);
|
||||
o << "...";
|
||||
|
||||
o.width(cell_width);
|
||||
o << ':' << '\n';
|
||||
|
||||
const uword row = 3;
|
||||
{
|
||||
for(uword col=0; col <= 2; ++col)
|
||||
{
|
||||
o.width(cell_width);
|
||||
arma_ostream::print_elem(o, X.at(row,col), true);
|
||||
}
|
||||
|
||||
o.width(6);
|
||||
o << "...";
|
||||
|
||||
o.width(cell_width);
|
||||
arma_ostream::print_elem(o, X.at(row,3), true);
|
||||
o << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if( (print_row_ellipsis == true) && (print_col_ellipsis == false) )
|
||||
{
|
||||
Mat<eT> X(4, m.n_cols, arma_nozeros_indicator());
|
||||
|
||||
X( span(0,2), span::all ) = m( span(0,2), span::all ); // top
|
||||
X( 3, span::all ) = m( m.n_rows-1, span::all ); // bottom
|
||||
|
||||
const std::streamsize cell_width = arma_ostream::modify_stream(o, X.memptr(), X.n_elem);
|
||||
|
||||
for(uword row=0; row <= 2; ++row) // first 3 rows
|
||||
{
|
||||
for(uword col=0; col < m.n_cols; ++col)
|
||||
{
|
||||
o.width(cell_width);
|
||||
arma_ostream::print_elem(o, X.at(row,col), true);
|
||||
}
|
||||
|
||||
o << '\n';
|
||||
}
|
||||
|
||||
for(uword col=0; col < m.n_cols; ++col)
|
||||
{
|
||||
o.width(cell_width);
|
||||
o << ':';
|
||||
}
|
||||
|
||||
o.width(cell_width);
|
||||
o << '\n';
|
||||
|
||||
const uword row = 3;
|
||||
{
|
||||
for(uword col=0; col < m.n_cols; ++col)
|
||||
{
|
||||
o.width(cell_width);
|
||||
arma_ostream::print_elem(o, X.at(row,col), true);
|
||||
}
|
||||
}
|
||||
|
||||
o << '\n';
|
||||
}
|
||||
|
||||
|
||||
if( (print_row_ellipsis == false) && (print_col_ellipsis == true) )
|
||||
{
|
||||
Mat<eT> X(m.n_rows, 4, arma_nozeros_indicator());
|
||||
|
||||
X( span::all, span(0,2) ) = m( span::all, span(0,2) ); // left
|
||||
X( span::all, 3 ) = m( span::all, m.n_cols-1 ); // right
|
||||
|
||||
const std::streamsize cell_width = arma_ostream::modify_stream(o, X.memptr(), X.n_elem);
|
||||
|
||||
for(uword row=0; row < m.n_rows; ++row)
|
||||
{
|
||||
for(uword col=0; col <= 2; ++col)
|
||||
{
|
||||
o.width(cell_width);
|
||||
arma_ostream::print_elem(o, X.at(row,col), true);
|
||||
}
|
||||
|
||||
o.width(6);
|
||||
o << "...";
|
||||
|
||||
o.width(cell_width);
|
||||
arma_ostream::print_elem(o, X.at(row,3), true);
|
||||
o << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
o.flush();
|
||||
stream_state.restore(o);
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename eT>
|
||||
arma_cold
|
||||
inline
|
||||
void
|
||||
arma_ostream::brief_print(std::ostream& o, const Cube<eT>& x)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
const arma_ostream_state stream_state(o);
|
||||
|
||||
o.unsetf(ios::showbase);
|
||||
o.unsetf(ios::uppercase);
|
||||
o.unsetf(ios::showpos);
|
||||
o.setf(ios::fixed);
|
||||
|
||||
o << "[cube size: " << x.n_rows << 'x' << x.n_cols << 'x' << x.n_slices << "]\n";
|
||||
|
||||
if(x.n_elem == 0) { o.flush(); stream_state.restore(o); return; }
|
||||
|
||||
if(x.n_slices <= 3)
|
||||
{
|
||||
for(uword slice=0; slice < x.n_slices; ++slice)
|
||||
{
|
||||
const Mat<eT> tmp(const_cast<eT*>(x.slice_memptr(slice)), x.n_rows, x.n_cols, false);
|
||||
|
||||
o << "[cube slice: " << slice << ']' << '\n';
|
||||
arma_ostream::brief_print(o, tmp, false);
|
||||
|
||||
if((slice+1) < x.n_slices) { o << '\n'; }
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for(uword slice=0; slice <= 1; ++slice)
|
||||
{
|
||||
const Mat<eT> tmp(const_cast<eT*>(x.slice_memptr(slice)), x.n_rows, x.n_cols, false);
|
||||
|
||||
o << "[cube slice: " << slice << ']' << '\n';
|
||||
arma_ostream::brief_print(o, tmp, false);
|
||||
o << '\n';
|
||||
}
|
||||
|
||||
o << "[cube slice: ...]\n\n";
|
||||
|
||||
const uword slice = x.n_slices-1;
|
||||
{
|
||||
const Mat<eT> tmp(const_cast<eT*>(x.slice_memptr(slice)), x.n_rows, x.n_cols, false);
|
||||
|
||||
o << "[cube slice: " << slice << ']' << '\n';
|
||||
arma_ostream::brief_print(o, tmp, false);
|
||||
}
|
||||
}
|
||||
|
||||
stream_state.restore(o);
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename eT>
|
||||
arma_cold
|
||||
inline
|
||||
void
|
||||
arma_ostream::brief_print(std::ostream& o, const SpMat<eT>& m)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
if(m.n_nonzero <= 10) { arma_ostream::print(o, m, true); return; }
|
||||
|
||||
const arma_ostream_state stream_state(o);
|
||||
|
||||
o.unsetf(ios::showbase);
|
||||
o.unsetf(ios::uppercase);
|
||||
o.unsetf(ios::showpos);
|
||||
o.unsetf(ios::scientific);
|
||||
o.setf(ios::right);
|
||||
o.setf(ios::fixed);
|
||||
|
||||
const uword m_n_nonzero = m.n_nonzero;
|
||||
const double density = (m.n_elem > 0) ? (double(m_n_nonzero) / double(m.n_elem) * double(100)) : double(0);
|
||||
|
||||
o << "[matrix size: " << m.n_rows << 'x' << m.n_cols << "; n_nonzero: " << m_n_nonzero;
|
||||
|
||||
if(density == double(0))
|
||||
{
|
||||
o.precision(0);
|
||||
}
|
||||
else
|
||||
if(density >= (double(10.0)-std::numeric_limits<double>::epsilon()))
|
||||
{
|
||||
o.precision(1);
|
||||
}
|
||||
else
|
||||
if(density > (double(0.01)-std::numeric_limits<double>::epsilon()))
|
||||
{
|
||||
o.precision(2);
|
||||
}
|
||||
else
|
||||
if(density > (double(0.001)-std::numeric_limits<double>::epsilon()))
|
||||
{
|
||||
o.precision(3);
|
||||
}
|
||||
else
|
||||
if(density > (double(0.0001)-std::numeric_limits<double>::epsilon()))
|
||||
{
|
||||
o.precision(4);
|
||||
}
|
||||
else
|
||||
{
|
||||
o.unsetf(ios::fixed);
|
||||
o.setf(ios::scientific);
|
||||
o.precision(2);
|
||||
}
|
||||
|
||||
o << "; density: " << density << "%]\n\n";
|
||||
|
||||
// get the first 9 elements and the last element
|
||||
|
||||
typename SpMat<eT>::const_iterator it = m.begin();
|
||||
typename SpMat<eT>::const_iterator it_end = m.end();
|
||||
|
||||
uvec storage_row(10);
|
||||
uvec storage_col(10);
|
||||
Col<eT> storage_val(10);
|
||||
|
||||
uword count = 0;
|
||||
|
||||
while( (it != it_end) && (count < 9) )
|
||||
{
|
||||
storage_row(count) = it.row();
|
||||
storage_col(count) = it.col();
|
||||
storage_val(count) = (*it);
|
||||
|
||||
++it;
|
||||
++count;
|
||||
}
|
||||
|
||||
it = it_end;
|
||||
--it;
|
||||
|
||||
storage_row(count) = it.row();
|
||||
storage_col(count) = it.col();
|
||||
storage_val(count) = (*it);
|
||||
|
||||
const std::streamsize cell_width = arma_ostream::modify_stream(o, storage_val.memptr(), 10);
|
||||
|
||||
for(uword i=0; i < 9; ++i)
|
||||
{
|
||||
const uword row = storage_row(i);
|
||||
const uword col = storage_col(i);
|
||||
|
||||
if(row < 10) { o << " "; }
|
||||
else if(row < 100) { o << " "; }
|
||||
else if(row < 1000) { o << " "; }
|
||||
else if(row < 10000) { o << " "; }
|
||||
else if(row < 100000) { o << " "; }
|
||||
else if(row < 1000000) { o << ' '; }
|
||||
|
||||
o << '(' << row << ", " << col << ") ";
|
||||
|
||||
if(col < 10) { o << " "; }
|
||||
else if(col < 100) { o << " "; }
|
||||
else if(col < 1000) { o << " "; }
|
||||
else if(col < 10000) { o << " "; }
|
||||
else if(col < 100000) { o << " "; }
|
||||
else if(col < 1000000) { o << ' '; }
|
||||
|
||||
if(cell_width > 0) { o.width(cell_width); }
|
||||
|
||||
arma_ostream::print_elem(o, storage_val(i), true);
|
||||
o << '\n';
|
||||
}
|
||||
|
||||
o << " (:, :) ";
|
||||
if(cell_width > 0) { o.width(cell_width); }
|
||||
o << "...\n";
|
||||
|
||||
|
||||
const uword i = 9;
|
||||
{
|
||||
const uword row = storage_row(i);
|
||||
const uword col = storage_col(i);
|
||||
|
||||
if(row < 10) { o << " "; }
|
||||
else if(row < 100) { o << " "; }
|
||||
else if(row < 1000) { o << " "; }
|
||||
else if(row < 10000) { o << " "; }
|
||||
else if(row < 100000) { o << " "; }
|
||||
else if(row < 1000000) { o << ' '; }
|
||||
|
||||
o << '(' << row << ", " << col << ") ";
|
||||
|
||||
if(col < 10) { o << " "; }
|
||||
else if(col < 100) { o << " "; }
|
||||
else if(col < 1000) { o << " "; }
|
||||
else if(col < 10000) { o << " "; }
|
||||
else if(col < 100000) { o << " "; }
|
||||
else if(col < 1000000) { o << ' '; }
|
||||
|
||||
if(cell_width > 0) { o.width(cell_width); }
|
||||
|
||||
arma_ostream::print_elem(o, storage_val(i), true);
|
||||
o << '\n';
|
||||
}
|
||||
|
||||
o.flush();
|
||||
stream_state.restore(o);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//! @}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
// Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
//
|
||||
@@ -67,6 +69,33 @@ struct arma_lt_comparator< std::complex<T> >
|
||||
//
|
||||
// return ( (abs_a != abs_b) ? (abs_a < abs_b) : (std::arg(a) < std::arg(b)) );
|
||||
// }
|
||||
|
||||
// inline
|
||||
// bool
|
||||
// operator() (const eT& a, const eT& b) const
|
||||
// {
|
||||
// const T a_real = a.real();
|
||||
// const T a_imag = a.imag();
|
||||
//
|
||||
// const T a_mag_squared = a_real*a_real + a_imag*a_imag;
|
||||
//
|
||||
// const T b_real = b.real();
|
||||
// const T b_imag = b.imag();
|
||||
//
|
||||
// const T b_mag_squared = b_real*b_real + b_imag*b_imag;
|
||||
//
|
||||
// if( (a_mag_squared != T(0)) && (b_mag_squared != T(0)) && std::isfinite(a_mag_squared) && std::isfinite(b_mag_squared) )
|
||||
// {
|
||||
// return ( (a_mag_squared != b_mag_squared) ? (a_mag_squared < b_mag_squared) : (std::arg(a) < std::arg(b)) );
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// const T abs_a = std::abs(a);
|
||||
// const T abs_b = std::abs(b);
|
||||
//
|
||||
// return ( (abs_a != abs_b) ? (abs_a < abs_b) : (std::arg(a) < std::arg(b)) );
|
||||
// }
|
||||
// }
|
||||
};
|
||||
|
||||
|
||||
@@ -87,6 +116,33 @@ struct arma_gt_comparator< std::complex<T> >
|
||||
//
|
||||
// return ( (abs_a != abs_b) ? (abs_a > abs_b) : (std::arg(a) > std::arg(b)) );
|
||||
// }
|
||||
|
||||
// inline
|
||||
// bool
|
||||
// operator() (const eT& a, const eT& b) const
|
||||
// {
|
||||
// const T a_real = a.real();
|
||||
// const T a_imag = a.imag();
|
||||
//
|
||||
// const T a_mag_squared = a_real*a_real + a_imag*a_imag;
|
||||
//
|
||||
// const T b_real = b.real();
|
||||
// const T b_imag = b.imag();
|
||||
//
|
||||
// const T b_mag_squared = b_real*b_real + b_imag*b_imag;
|
||||
//
|
||||
// if( (a_mag_squared != T(0)) && (b_mag_squared != T(0)) && std::isfinite(a_mag_squared) && std::isfinite(b_mag_squared) )
|
||||
// {
|
||||
// return ( (a_mag_squared != b_mag_squared) ? (a_mag_squared > b_mag_squared) : (std::arg(a) > std::arg(b)) );
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// const T abs_a = std::abs(a);
|
||||
// const T abs_b = std::abs(b);
|
||||
//
|
||||
// return ( (abs_a != abs_b) ? (abs_a > abs_b) : (std::arg(a) > std::arg(b)) );
|
||||
// }
|
||||
// }
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
// Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
//
|
||||
@@ -19,39 +21,74 @@
|
||||
|
||||
|
||||
#if defined(ARMA_RNG_ALT)
|
||||
#undef ARMA_USE_EXTERN_CXX11_RNG
|
||||
#undef ARMA_USE_EXTERN_RNG
|
||||
#endif
|
||||
|
||||
|
||||
#if !defined(ARMA_USE_CXX11)
|
||||
#undef ARMA_USE_EXTERN_CXX11_RNG
|
||||
// NOTE: mt19937_64_instance_warmup is used as a workaround
|
||||
// NOTE: for thread_local issue on macOS 11 and/or AppleClang 12.0
|
||||
// NOTE: see https://gitlab.com/conradsnicta/armadillo-code/-/issues/173
|
||||
// NOTE: if this workaround causes problems, please report it and
|
||||
// NOTE: disable the workaround by uncommenting the code block below:
|
||||
|
||||
// #if defined(__APPLE__) || defined(__apple_build_version__)
|
||||
// #if !defined(ARMA_DONT_DISABLE_EXTERN_RNG)
|
||||
// #undef ARMA_USE_EXTERN_RNG
|
||||
// #endif
|
||||
// #endif
|
||||
|
||||
|
||||
// NOTE: workaround for another thread_local issue on macOS
|
||||
// NOTE: where GCC (not Clang) may not have support for thread_local
|
||||
|
||||
#if (defined(__APPLE__) && defined(__GNUG__) && !defined(__clang__))
|
||||
#if !defined(ARMA_DONT_DISABLE_EXTERN_RNG)
|
||||
#undef ARMA_USE_EXTERN_RNG
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(ARMA_USE_EXTERN_CXX11_RNG)
|
||||
extern thread_local arma_rng_cxx11 arma_rng_cxx11_instance;
|
||||
// namespace { thread_local arma_rng_cxx11 arma_rng_cxx11_instance; }
|
||||
|
||||
#if defined(ARMA_USE_EXTERN_RNG)
|
||||
extern thread_local std::mt19937_64 mt19937_64_instance;
|
||||
|
||||
#if defined(__APPLE__) || defined(__apple_build_version__)
|
||||
namespace
|
||||
{
|
||||
struct mt19937_64_instance_warmup
|
||||
{
|
||||
inline mt19937_64_instance_warmup()
|
||||
{
|
||||
typename std::mt19937_64::result_type junk = mt19937_64_instance();
|
||||
arma_ignore(junk);
|
||||
}
|
||||
};
|
||||
|
||||
static mt19937_64_instance_warmup mt19937_64_instance_warmup_run;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
class arma_rng
|
||||
{
|
||||
public:
|
||||
|
||||
#if defined(ARMA_RNG_ALT)
|
||||
typedef arma_rng_alt::seed_type seed_type;
|
||||
#elif defined(ARMA_USE_EXTERN_CXX11_RNG)
|
||||
typedef arma_rng_cxx11::seed_type seed_type;
|
||||
typedef arma_rng_alt::seed_type seed_type;
|
||||
#elif defined(ARMA_USE_EXTERN_RNG)
|
||||
typedef std::mt19937_64::result_type seed_type;
|
||||
#else
|
||||
typedef arma_rng_cxx98::seed_type seed_type;
|
||||
typedef arma_rng_cxx98::seed_type seed_type;
|
||||
#endif
|
||||
|
||||
#if defined(ARMA_RNG_ALT)
|
||||
static const int rng_method = 2;
|
||||
#elif defined(ARMA_USE_EXTERN_CXX11_RNG)
|
||||
static const int rng_method = 1;
|
||||
static constexpr int rng_method = 2;
|
||||
#elif defined(ARMA_USE_EXTERN_RNG)
|
||||
static constexpr int rng_method = 1;
|
||||
#else
|
||||
static const int rng_method = 0;
|
||||
static constexpr int rng_method = 0;
|
||||
#endif
|
||||
|
||||
inline static void set_seed(const seed_type val);
|
||||
@@ -60,6 +97,7 @@ class arma_rng
|
||||
template<typename eT> struct randi;
|
||||
template<typename eT> struct randu;
|
||||
template<typename eT> struct randn;
|
||||
template<typename eT> struct randg;
|
||||
};
|
||||
|
||||
|
||||
@@ -72,9 +110,9 @@ arma_rng::set_seed(const arma_rng::seed_type val)
|
||||
{
|
||||
arma_rng_alt::set_seed(val);
|
||||
}
|
||||
#elif defined(ARMA_USE_EXTERN_CXX11_RNG)
|
||||
#elif defined(ARMA_USE_EXTERN_RNG)
|
||||
{
|
||||
arma_rng_cxx11_instance.set_seed(val);
|
||||
mt19937_64_instance.seed(val);
|
||||
}
|
||||
#else
|
||||
{
|
||||
@@ -94,23 +132,18 @@ arma_rng::set_seed_random()
|
||||
seed_type seed2 = seed_type(0);
|
||||
seed_type seed3 = seed_type(0);
|
||||
seed_type seed4 = seed_type(0);
|
||||
seed_type seed5 = seed_type(0);
|
||||
|
||||
bool have_seed = false;
|
||||
|
||||
#if defined(ARMA_USE_CXX11)
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
std::random_device rd;
|
||||
|
||||
if(rd.entropy() > double(0)) { seed1 = static_cast<seed_type>( rd() ); }
|
||||
|
||||
if(seed1 != seed_type(0)) { have_seed = true; }
|
||||
}
|
||||
catch(...) {}
|
||||
std::random_device rd;
|
||||
|
||||
if(rd.entropy() > double(0)) { seed1 = static_cast<seed_type>( rd() ); }
|
||||
|
||||
if(seed1 != seed_type(0)) { have_seed = true; }
|
||||
}
|
||||
#endif
|
||||
catch(...) {}
|
||||
|
||||
|
||||
if(have_seed == false)
|
||||
@@ -144,17 +177,11 @@ arma_rng::set_seed_random()
|
||||
{
|
||||
// get better-than-nothing seeds in case reading /dev/urandom failed
|
||||
|
||||
#if defined(ARMA_HAVE_GETTIMEOFDAY)
|
||||
{
|
||||
struct timeval posix_time;
|
||||
|
||||
gettimeofday(&posix_time, 0);
|
||||
|
||||
seed3 = static_cast<seed_type>(posix_time.tv_usec);
|
||||
}
|
||||
#endif
|
||||
const std::chrono::system_clock::time_point tp_now = std::chrono::system_clock::now();
|
||||
|
||||
seed4 = static_cast<seed_type>( std::time(NULL) & 0xFFFF );
|
||||
auto since_epoch_usec = std::chrono::duration_cast<std::chrono::microseconds>(tp_now.time_since_epoch()).count();
|
||||
|
||||
seed3 = static_cast<seed_type>( since_epoch_usec & 0xFFFF );
|
||||
|
||||
union
|
||||
{
|
||||
@@ -164,32 +191,38 @@ arma_rng::set_seed_random()
|
||||
|
||||
tmp.a = (uword*)malloc(sizeof(uword));
|
||||
|
||||
if(tmp.a != NULL)
|
||||
if(tmp.a != nullptr)
|
||||
{
|
||||
for(size_t i=0; i<sizeof(uword*); ++i) { seed5 += seed_type(tmp.b[i]); }
|
||||
for(size_t i=0; i<sizeof(uword*); ++i) { seed4 += seed_type(tmp.b[i]); }
|
||||
|
||||
free(tmp.a);
|
||||
}
|
||||
}
|
||||
|
||||
arma_rng::set_seed( seed1 + seed2 + seed3 + seed4 + seed5 );
|
||||
arma_rng::set_seed( seed1 + seed2 + seed3 + seed4 );
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
|
||||
|
||||
|
||||
template<typename eT>
|
||||
struct arma_rng::randi
|
||||
{
|
||||
arma_inline
|
||||
inline
|
||||
operator eT ()
|
||||
{
|
||||
#if defined(ARMA_RNG_ALT)
|
||||
{
|
||||
return eT( arma_rng_alt::randi_val() );
|
||||
}
|
||||
#elif defined(ARMA_USE_EXTERN_CXX11_RNG)
|
||||
#elif defined(ARMA_USE_EXTERN_RNG)
|
||||
{
|
||||
return eT( arma_rng_cxx11_instance.randi_val() );
|
||||
constexpr double scale = double(std::numeric_limits<int>::max()) / double(std::mt19937_64::max());
|
||||
|
||||
return eT( double(mt19937_64_instance()) * scale );
|
||||
}
|
||||
#else
|
||||
{
|
||||
@@ -208,9 +241,9 @@ struct arma_rng::randi
|
||||
{
|
||||
return arma_rng_alt::randi_max_val();
|
||||
}
|
||||
#elif defined(ARMA_USE_EXTERN_CXX11_RNG)
|
||||
#elif defined(ARMA_USE_EXTERN_RNG)
|
||||
{
|
||||
return arma_rng_cxx11::randi_max_val();
|
||||
return std::numeric_limits<int>::max();
|
||||
}
|
||||
#else
|
||||
{
|
||||
@@ -229,13 +262,24 @@ struct arma_rng::randi
|
||||
{
|
||||
arma_rng_alt::randi_fill(mem, N, a, b);
|
||||
}
|
||||
#elif defined(ARMA_USE_EXTERN_CXX11_RNG)
|
||||
#elif defined(ARMA_USE_EXTERN_RNG)
|
||||
{
|
||||
arma_rng_cxx11_instance.randi_fill(mem, N, a, b);
|
||||
std::uniform_int_distribution<int> local_i_distr(a, b);
|
||||
|
||||
for(uword i=0; i<N; ++i) { mem[i] = eT(local_i_distr(mt19937_64_instance)); }
|
||||
}
|
||||
#else
|
||||
{
|
||||
arma_rng_cxx98::randi_fill(mem, N, a, b);
|
||||
if(N == uword(1)) { arma_rng_cxx98::randi_fill(mem, uword(1), a, b); return; }
|
||||
|
||||
typedef typename std::mt19937_64::result_type local_seed_type;
|
||||
|
||||
std::mt19937_64 local_engine;
|
||||
std::uniform_int_distribution<int> local_i_distr(a, b);
|
||||
|
||||
local_engine.seed( local_seed_type(std::rand()) );
|
||||
|
||||
for(uword i=0; i<N; ++i) { mem[i] = eT(local_i_distr(local_engine)); }
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -243,19 +287,25 @@ struct arma_rng::randi
|
||||
|
||||
|
||||
|
||||
//
|
||||
|
||||
|
||||
|
||||
template<typename eT>
|
||||
struct arma_rng::randu
|
||||
{
|
||||
arma_inline
|
||||
inline
|
||||
operator eT ()
|
||||
{
|
||||
#if defined(ARMA_RNG_ALT)
|
||||
{
|
||||
return eT( arma_rng_alt::randu_val() );
|
||||
}
|
||||
#elif defined(ARMA_USE_EXTERN_CXX11_RNG)
|
||||
#elif defined(ARMA_USE_EXTERN_RNG)
|
||||
{
|
||||
return eT( arma_rng_cxx11_instance.randu_val() );
|
||||
constexpr double scale = double(1.0) / double(std::mt19937_64::max());
|
||||
|
||||
return eT( double(mt19937_64_instance()) * scale );
|
||||
}
|
||||
#else
|
||||
{
|
||||
@@ -270,21 +320,30 @@ struct arma_rng::randu
|
||||
void
|
||||
fill(eT* mem, const uword N)
|
||||
{
|
||||
uword j;
|
||||
|
||||
for(j=1; j < N; j+=2)
|
||||
#if defined(ARMA_RNG_ALT)
|
||||
{
|
||||
const eT tmp_i = eT( arma_rng::randu<eT>() );
|
||||
const eT tmp_j = eT( arma_rng::randu<eT>() );
|
||||
for(uword i=0; i < N; ++i) { mem[i] = eT( arma_rng_alt::randu_val() ); }
|
||||
}
|
||||
#elif defined(ARMA_USE_EXTERN_RNG)
|
||||
{
|
||||
std::uniform_real_distribution<double> local_u_distr;
|
||||
|
||||
(*mem) = tmp_i; mem++;
|
||||
(*mem) = tmp_j; mem++;
|
||||
for(uword i=0; i < N; ++i) { mem[i] = eT( local_u_distr(mt19937_64_instance) ); }
|
||||
}
|
||||
|
||||
if((j-1) < N)
|
||||
#else
|
||||
{
|
||||
(*mem) = eT( arma_rng::randu<eT>() );
|
||||
if(N == uword(1)) { mem[0] = eT( arma_rng_cxx98::randu_val() ); return; }
|
||||
|
||||
typedef typename std::mt19937_64::result_type local_seed_type;
|
||||
|
||||
std::mt19937_64 local_engine;
|
||||
std::uniform_real_distribution<double> local_u_distr;
|
||||
|
||||
local_engine.seed( local_seed_type(std::rand()) );
|
||||
|
||||
for(uword i=0; i < N; ++i) { mem[i] = eT( local_u_distr(local_engine) ); }
|
||||
}
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
@@ -296,10 +355,30 @@ struct arma_rng::randu< std::complex<T> >
|
||||
arma_inline
|
||||
operator std::complex<T> ()
|
||||
{
|
||||
const T a = T( arma_rng::randu<T>() );
|
||||
const T b = T( arma_rng::randu<T>() );
|
||||
|
||||
return std::complex<T>(a, b);
|
||||
#if defined(ARMA_RNG_ALT)
|
||||
{
|
||||
const T a = T( arma_rng_alt::randu_val() );
|
||||
const T b = T( arma_rng_alt::randu_val() );
|
||||
|
||||
return std::complex<T>(a, b);
|
||||
}
|
||||
#elif defined(ARMA_USE_EXTERN_RNG)
|
||||
{
|
||||
std::uniform_real_distribution<double> local_u_distr;
|
||||
|
||||
const T a = T( local_u_distr(mt19937_64_instance) );
|
||||
const T b = T( local_u_distr(mt19937_64_instance) );
|
||||
|
||||
return std::complex<T>(a, b);
|
||||
}
|
||||
#else
|
||||
{
|
||||
const T a = T( arma_rng_cxx98::randu_val() );
|
||||
const T b = T( arma_rng_cxx98::randu_val() );
|
||||
|
||||
return std::complex<T>(a, b);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -308,18 +387,65 @@ struct arma_rng::randu< std::complex<T> >
|
||||
void
|
||||
fill(std::complex<T>* mem, const uword N)
|
||||
{
|
||||
for(uword i=0; i < N; ++i)
|
||||
#if defined(ARMA_RNG_ALT)
|
||||
{
|
||||
const T a = T( arma_rng::randu<T>() );
|
||||
const T b = T( arma_rng::randu<T>() );
|
||||
|
||||
mem[i] = std::complex<T>(a, b);
|
||||
for(uword i=0; i < N; ++i)
|
||||
{
|
||||
const T a = T( arma_rng_alt::randu_val() );
|
||||
const T b = T( arma_rng_alt::randu_val() );
|
||||
|
||||
mem[i] = std::complex<T>(a, b);
|
||||
}
|
||||
}
|
||||
#elif defined(ARMA_USE_EXTERN_RNG)
|
||||
{
|
||||
std::uniform_real_distribution<double> local_u_distr;
|
||||
|
||||
for(uword i=0; i < N; ++i)
|
||||
{
|
||||
const T a = T( local_u_distr(mt19937_64_instance) );
|
||||
const T b = T( local_u_distr(mt19937_64_instance) );
|
||||
|
||||
mem[i] = std::complex<T>(a, b);
|
||||
}
|
||||
}
|
||||
#else
|
||||
{
|
||||
if(N == uword(1))
|
||||
{
|
||||
const T a = T( arma_rng_cxx98::randu_val() );
|
||||
const T b = T( arma_rng_cxx98::randu_val() );
|
||||
|
||||
mem[0] = std::complex<T>(a, b);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
typedef typename std::mt19937_64::result_type local_seed_type;
|
||||
|
||||
std::mt19937_64 local_engine;
|
||||
std::uniform_real_distribution<double> local_u_distr;
|
||||
|
||||
local_engine.seed( local_seed_type(std::rand()) );
|
||||
|
||||
for(uword i=0; i < N; ++i)
|
||||
{
|
||||
const T a = T( local_u_distr(local_engine) );
|
||||
const T b = T( local_u_distr(local_engine) );
|
||||
|
||||
mem[i] = std::complex<T>(a, b);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
//
|
||||
|
||||
|
||||
|
||||
template<typename eT>
|
||||
struct arma_rng::randn
|
||||
{
|
||||
@@ -330,9 +456,11 @@ struct arma_rng::randn
|
||||
{
|
||||
return eT( arma_rng_alt::randn_val() );
|
||||
}
|
||||
#elif defined(ARMA_USE_EXTERN_CXX11_RNG)
|
||||
#elif defined(ARMA_USE_EXTERN_RNG)
|
||||
{
|
||||
return eT( arma_rng_cxx11_instance.randn_val() );
|
||||
std::normal_distribution<double> local_n_distr;
|
||||
|
||||
return eT( local_n_distr(mt19937_64_instance) );
|
||||
}
|
||||
#else
|
||||
{
|
||||
@@ -342,7 +470,7 @@ struct arma_rng::randn
|
||||
}
|
||||
|
||||
|
||||
arma_inline
|
||||
inline
|
||||
static
|
||||
void
|
||||
dual_val(eT& out1, eT& out2)
|
||||
@@ -351,9 +479,12 @@ struct arma_rng::randn
|
||||
{
|
||||
arma_rng_alt::randn_dual_val(out1, out2);
|
||||
}
|
||||
#elif defined(ARMA_USE_EXTERN_CXX11_RNG)
|
||||
#elif defined(ARMA_USE_EXTERN_RNG)
|
||||
{
|
||||
arma_rng_cxx11_instance.randn_dual_val(out1, out2);
|
||||
std::normal_distribution<double> local_n_distr;
|
||||
|
||||
out1 = eT( local_n_distr(mt19937_64_instance) );
|
||||
out2 = eT( local_n_distr(mt19937_64_instance) );
|
||||
}
|
||||
#else
|
||||
{
|
||||
@@ -368,17 +499,36 @@ struct arma_rng::randn
|
||||
void
|
||||
fill_simple(eT* mem, const uword N)
|
||||
{
|
||||
uword i, j;
|
||||
|
||||
for(i=0, j=1; j < N; i+=2, j+=2)
|
||||
#if defined(ARMA_RNG_ALT)
|
||||
{
|
||||
arma_rng::randn<eT>::dual_val( mem[i], mem[j] );
|
||||
// NOTE: old method to avoid regressions in user code that assumes specific sequence
|
||||
|
||||
uword i, j;
|
||||
|
||||
for(i=0, j=1; j < N; i+=2, j+=2) { arma_rng_alt::randn_dual_val( mem[i], mem[j] ); }
|
||||
|
||||
if(i < N) { mem[i] = eT( arma_rng_alt::randn_val() ); }
|
||||
}
|
||||
|
||||
if(i < N)
|
||||
#elif defined(ARMA_USE_EXTERN_RNG)
|
||||
{
|
||||
mem[i] = eT( arma_rng::randn<eT>() );
|
||||
std::normal_distribution<double> local_n_distr;
|
||||
|
||||
for(uword i=0; i < N; ++i) { mem[i] = eT( local_n_distr(mt19937_64_instance) ); }
|
||||
}
|
||||
#else
|
||||
{
|
||||
if(N == uword(1)) { mem[0] = eT( arma_rng_cxx98::randn_val() ); return; }
|
||||
|
||||
typedef typename std::mt19937_64::result_type local_seed_type;
|
||||
|
||||
std::mt19937_64 local_engine;
|
||||
std::normal_distribution<double> local_n_distr;
|
||||
|
||||
local_engine.seed( local_seed_type(std::rand()) );
|
||||
|
||||
for(uword i=0; i < N; ++i) { mem[i] = eT( local_n_distr(local_engine) ); }
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -387,11 +537,11 @@ struct arma_rng::randn
|
||||
void
|
||||
fill(eT* mem, const uword N)
|
||||
{
|
||||
#if defined(ARMA_USE_CXX11) && defined(ARMA_USE_OPENMP)
|
||||
#if defined(ARMA_USE_OPENMP)
|
||||
{
|
||||
if((N < 1024) || omp_in_parallel()) { arma_rng::randn<eT>::fill_simple(mem, N); return; }
|
||||
|
||||
typedef std::mt19937_64::result_type seed_type;
|
||||
typedef typename std::mt19937_64::result_type local_seed_type;
|
||||
|
||||
const uword n_threads = uword( mp_thread_limit::get() );
|
||||
|
||||
@@ -402,7 +552,7 @@ struct arma_rng::randn
|
||||
{
|
||||
std::mt19937_64& t_engine = engine[t];
|
||||
|
||||
t_engine.seed( seed_type(t) + seed_type(arma_rng::randi<seed_type>()) );
|
||||
t_engine.seed( local_seed_type(t) + local_seed_type(arma_rng::randi<local_seed_type>()) );
|
||||
}
|
||||
|
||||
const uword chunk_size = N / n_threads;
|
||||
@@ -457,15 +607,78 @@ struct arma_rng::randn< std::complex<T> >
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
static
|
||||
void
|
||||
dual_val(std::complex<T>& out1, std::complex<T>& out2)
|
||||
{
|
||||
#if defined(_MSC_VER)
|
||||
T a;
|
||||
T b;
|
||||
#else
|
||||
T a(0);
|
||||
T b(0);
|
||||
#endif
|
||||
|
||||
arma_rng::randn<T>::dual_val(a,b);
|
||||
out1 = std::complex<T>(a,b);
|
||||
|
||||
arma_rng::randn<T>::dual_val(a,b);
|
||||
out2 = std::complex<T>(a,b);
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
static
|
||||
void
|
||||
fill_simple(std::complex<T>* mem, const uword N)
|
||||
{
|
||||
for(uword i=0; i < N; ++i)
|
||||
#if defined(ARMA_RNG_ALT)
|
||||
{
|
||||
mem[i] = std::complex<T>( arma_rng::randn< std::complex<T> >() );
|
||||
for(uword i=0; i < N; ++i) { mem[i] = std::complex<T>( arma_rng::randn< std::complex<T> >() ); }
|
||||
}
|
||||
#elif defined(ARMA_USE_EXTERN_RNG)
|
||||
{
|
||||
std::normal_distribution<double> local_n_distr;
|
||||
|
||||
for(uword i=0; i < N; ++i)
|
||||
{
|
||||
const T a = T( local_n_distr(mt19937_64_instance) );
|
||||
const T b = T( local_n_distr(mt19937_64_instance) );
|
||||
|
||||
mem[i] = std::complex<T>(a,b);
|
||||
}
|
||||
}
|
||||
#else
|
||||
{
|
||||
if(N == uword(1))
|
||||
{
|
||||
T a = T(0);
|
||||
T b = T(0);
|
||||
|
||||
arma_rng_cxx98::randn_dual_val(a,b);
|
||||
|
||||
mem[0] = std::complex<T>(a,b);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
typedef typename std::mt19937_64::result_type local_seed_type;
|
||||
|
||||
std::mt19937_64 local_engine;
|
||||
std::normal_distribution<double> local_n_distr;
|
||||
|
||||
local_engine.seed( local_seed_type(std::rand()) );
|
||||
|
||||
for(uword i=0; i < N; ++i)
|
||||
{
|
||||
const T a = T( local_n_distr(local_engine) );
|
||||
const T b = T( local_n_distr(local_engine) );
|
||||
|
||||
mem[i] = std::complex<T>(a,b);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -474,11 +687,11 @@ struct arma_rng::randn< std::complex<T> >
|
||||
void
|
||||
fill(std::complex<T>* mem, const uword N)
|
||||
{
|
||||
#if defined(ARMA_USE_CXX11) && defined(ARMA_USE_OPENMP)
|
||||
#if defined(ARMA_USE_OPENMP)
|
||||
{
|
||||
if((N < 512) || omp_in_parallel()) { arma_rng::randn< std::complex<T> >::fill_simple(mem, N); return; }
|
||||
|
||||
typedef std::mt19937_64::result_type seed_type;
|
||||
typedef typename std::mt19937_64::result_type local_seed_type;
|
||||
|
||||
const uword n_threads = uword( mp_thread_limit::get() );
|
||||
|
||||
@@ -489,7 +702,7 @@ struct arma_rng::randn< std::complex<T> >
|
||||
{
|
||||
std::mt19937_64& t_engine = engine[t];
|
||||
|
||||
t_engine.seed( seed_type(t) + seed_type(arma_rng::randi<seed_type>()) );
|
||||
t_engine.seed( local_seed_type(t) + local_seed_type(arma_rng::randi<local_seed_type>()) );
|
||||
}
|
||||
|
||||
const uword chunk_size = N / n_threads;
|
||||
@@ -533,4 +746,97 @@ struct arma_rng::randn< std::complex<T> >
|
||||
|
||||
|
||||
|
||||
//
|
||||
|
||||
|
||||
|
||||
template<typename eT>
|
||||
struct arma_rng::randg
|
||||
{
|
||||
inline
|
||||
static
|
||||
void
|
||||
fill_simple(eT* mem, const uword N, const double a, const double b)
|
||||
{
|
||||
#if defined(ARMA_USE_EXTERN_RNG)
|
||||
{
|
||||
std::gamma_distribution<double> local_g_distr(a,b);
|
||||
|
||||
for(uword i=0; i<N; ++i) { mem[i] = eT(local_g_distr(mt19937_64_instance)); }
|
||||
}
|
||||
#else
|
||||
{
|
||||
typedef typename std::mt19937_64::result_type local_seed_type;
|
||||
|
||||
std::mt19937_64 local_engine;
|
||||
std::gamma_distribution<double> local_g_distr(a,b);
|
||||
|
||||
local_engine.seed( local_seed_type(arma_rng::randi<local_seed_type>()) );
|
||||
|
||||
for(uword i=0; i<N; ++i) { mem[i] = eT(local_g_distr(local_engine)); }
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
static
|
||||
void
|
||||
fill(eT* mem, const uword N, const double a, const double b)
|
||||
{
|
||||
#if defined(ARMA_USE_OPENMP)
|
||||
{
|
||||
if((N < 512) || omp_in_parallel()) { arma_rng::randg<eT>::fill_simple(mem, N, a, b); return; }
|
||||
|
||||
typedef std::mt19937_64 motor_type;
|
||||
typedef std::mt19937_64::result_type ovum_type;
|
||||
typedef std::gamma_distribution<double> distr_type;
|
||||
|
||||
const uword n_threads = uword( mp_thread_limit::get() );
|
||||
|
||||
std::vector<motor_type> g_motor(n_threads);
|
||||
std::vector<distr_type> g_distr(n_threads);
|
||||
|
||||
const distr_type g_distr_base(a,b);
|
||||
|
||||
for(uword t=0; t < n_threads; ++t)
|
||||
{
|
||||
motor_type& g_motor_t = g_motor[t];
|
||||
distr_type& g_distr_t = g_distr[t];
|
||||
|
||||
g_motor_t.seed( ovum_type(t) + ovum_type(arma_rng::randi<ovum_type>()) );
|
||||
|
||||
g_distr_t.param( g_distr_base.param() );
|
||||
}
|
||||
|
||||
const uword chunk_size = N / n_threads;
|
||||
|
||||
#pragma omp parallel for schedule(static) num_threads(int(n_threads))
|
||||
for(uword t=0; t < n_threads; ++t)
|
||||
{
|
||||
const uword start = (t+0) * chunk_size;
|
||||
const uword endp1 = (t+1) * chunk_size;
|
||||
|
||||
motor_type& g_motor_t = g_motor[t];
|
||||
distr_type& g_distr_t = g_distr[t];
|
||||
|
||||
for(uword i=start; i < endp1; ++i) { mem[i] = eT( g_distr_t(g_motor_t)); }
|
||||
}
|
||||
|
||||
motor_type& g_motor_0 = g_motor[0];
|
||||
distr_type& g_distr_0 = g_distr[0];
|
||||
|
||||
for(uword i=(n_threads*chunk_size); i < N; ++i) { mem[i] = eT( g_distr_0(g_motor_0)); }
|
||||
}
|
||||
#else
|
||||
{
|
||||
arma_rng::randg<eT>::fill_simple(mem, N, a, b);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
//! @}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
// Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
//
|
||||
@@ -18,9 +20,6 @@
|
||||
//! @{
|
||||
|
||||
|
||||
#if defined(ARMA_USE_CXX11)
|
||||
|
||||
|
||||
class arma_rng_cxx11
|
||||
{
|
||||
public:
|
||||
@@ -208,7 +207,4 @@ arma_rng_cxx11::randg_fill(eT* mem, const uword N, const double a, const double
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
//! @}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
// Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
//
|
||||
@@ -104,7 +106,7 @@ arma_rng_cxx98::randn_val()
|
||||
|
||||
w = tmp1*tmp1 + tmp2*tmp2;
|
||||
}
|
||||
while ( w >= double(1) );
|
||||
while( w >= double(1) );
|
||||
|
||||
return double( tmp1 * std::sqrt( (double(-2) * std::log(w)) / w) );
|
||||
}
|
||||
@@ -130,7 +132,7 @@ arma_rng_cxx98::randn_dual_val(eT& out1, eT& out2)
|
||||
|
||||
w = tmp1*tmp1 + tmp2*tmp2;
|
||||
}
|
||||
while ( w >= eTp(1) );
|
||||
while( w >= eTp(1) );
|
||||
|
||||
const eTp k = std::sqrt( (eTp(-2) * std::log(w)) / w);
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
// Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
//
|
||||
@@ -18,52 +20,11 @@
|
||||
//! @{
|
||||
|
||||
|
||||
#undef arma_static_check
|
||||
#define arma_static_check(condition, message) static_assert( !(condition), message )
|
||||
|
||||
template<bool ERROR___TYPE_MISMATCH_OR_UNSUPPORTED_TYPE>
|
||||
struct arma_type_check_cxx1998
|
||||
{
|
||||
arma_inline
|
||||
static
|
||||
void
|
||||
apply()
|
||||
{
|
||||
static const char
|
||||
junk[ ERROR___TYPE_MISMATCH_OR_UNSUPPORTED_TYPE ? -1 : +1 ];
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
template<>
|
||||
struct arma_type_check_cxx1998<false>
|
||||
{
|
||||
arma_inline
|
||||
static
|
||||
void
|
||||
apply()
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
#undef arma_static_check
|
||||
#undef arma_type_check
|
||||
|
||||
#if defined(ARMA_USE_CXX11)
|
||||
|
||||
#define arma_static_check(condition, message) static_assert( !(condition), #message )
|
||||
|
||||
#define arma_type_check(condition) static_assert( !(condition), "error: type mismatch or unsupported type" )
|
||||
|
||||
#else
|
||||
|
||||
#define arma_static_check(condition, message) static const char message[ (condition) ? -1 : +1 ]
|
||||
|
||||
#define arma_type_check(condition) arma_type_check_cxx1998<condition>::apply()
|
||||
|
||||
#endif
|
||||
|
||||
#undef arma_type_check
|
||||
#define arma_type_check(condition) static_assert( !(condition), "error: type mismatch or unsupported type" )
|
||||
|
||||
|
||||
//! @}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
// Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
//
|
||||
@@ -21,37 +23,6 @@
|
||||
namespace arma_str
|
||||
{
|
||||
|
||||
#if ( defined(ARMA_USE_CXX11) || defined(ARMA_HAVE_SNPRINTF) )
|
||||
|
||||
#define arma_snprintf std::snprintf
|
||||
|
||||
#else
|
||||
|
||||
// better-than-nothing emulation of C99 snprintf(),
|
||||
// with correct return value and null-terminated output string.
|
||||
// note that _snprintf() provided by MS is not a good substitute for snprintf()
|
||||
|
||||
inline
|
||||
int
|
||||
arma_snprintf(char* out, size_t size, const char* fmt, ...)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
for(i=0; i<size; ++i)
|
||||
{
|
||||
out[i] = fmt[i];
|
||||
if(fmt[i] == char(0))
|
||||
break;
|
||||
}
|
||||
|
||||
if(size > 0)
|
||||
out[size-1] = char(0);
|
||||
|
||||
return int(i);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
class format
|
||||
{
|
||||
public:
|
||||
@@ -66,6 +37,7 @@ namespace arma_str
|
||||
{
|
||||
}
|
||||
|
||||
// TODO: constructor to handle std::string&& ?
|
||||
|
||||
const std::string A;
|
||||
|
||||
@@ -137,7 +109,7 @@ namespace arma_str
|
||||
buffer = new char[size_t(buffer_size)];
|
||||
}
|
||||
|
||||
required_size = arma_snprintf(buffer, size_t(buffer_size), X.A.A.c_str(), X.B);
|
||||
required_size = std::snprintf(buffer, size_t(buffer_size), X.A.A.c_str(), X.B);
|
||||
|
||||
if(required_size < 0) { break; }
|
||||
|
||||
@@ -191,7 +163,7 @@ namespace arma_str
|
||||
buffer = new char[size_t(buffer_size)];
|
||||
}
|
||||
|
||||
required_size = arma_snprintf(buffer, size_t(buffer_size), X.A.A.A.c_str(), X.A.B, X.B);
|
||||
required_size = std::snprintf(buffer, size_t(buffer_size), X.A.A.A.c_str(), X.A.B, X.B);
|
||||
|
||||
if(required_size < 0) { break; }
|
||||
|
||||
@@ -245,7 +217,7 @@ namespace arma_str
|
||||
buffer = new char[size_t(buffer_size)];
|
||||
}
|
||||
|
||||
required_size = arma_snprintf(buffer, size_t(buffer_size), X.A.A.A.A.c_str(), X.A.A.B, X.A.B, X.B);
|
||||
required_size = std::snprintf(buffer, size_t(buffer_size), X.A.A.A.A.c_str(), X.A.A.B, X.A.B, X.B);
|
||||
|
||||
if(required_size < 0) { break; }
|
||||
|
||||
@@ -299,7 +271,7 @@ namespace arma_str
|
||||
buffer = new char[size_t(buffer_size)];
|
||||
}
|
||||
|
||||
required_size = arma_snprintf(buffer, size_t(buffer_size), X.A.A.A.A.A.c_str(), X.A.A.A.B, X.A.A.B, X.A.B, X.B);
|
||||
required_size = std::snprintf(buffer, size_t(buffer_size), X.A.A.A.A.A.c_str(), X.A.A.A.B, X.A.A.B, X.A.B, X.B);
|
||||
|
||||
if(required_size < 0) { break; }
|
||||
|
||||
@@ -353,7 +325,7 @@ namespace arma_str
|
||||
buffer = new char[size_t(buffer_size)];
|
||||
}
|
||||
|
||||
required_size = arma_snprintf(buffer, size_t(buffer_size), X.A.A.A.A.A.A.c_str(), X.A.A.A.A.B, X.A.A.A.B, X.A.A.B, X.A.B, X.B);
|
||||
required_size = std::snprintf(buffer, size_t(buffer_size), X.A.A.A.A.A.A.c_str(), X.A.A.A.A.B, X.A.A.A.B, X.A.A.B, X.A.B, X.B);
|
||||
|
||||
if(required_size < 0) { break; }
|
||||
|
||||
@@ -407,7 +379,7 @@ namespace arma_str
|
||||
buffer = new char[size_t(buffer_size)];
|
||||
}
|
||||
|
||||
required_size = arma_snprintf(buffer, size_t(buffer_size), X.A.A.A.A.A.A.A.c_str(), X.A.A.A.A.A.B, X.A.A.A.A.B, X.A.A.A.B, X.A.A.B, X.A.B, X.B);
|
||||
required_size = std::snprintf(buffer, size_t(buffer_size), X.A.A.A.A.A.A.A.c_str(), X.A.A.A.A.A.B, X.A.A.A.A.B, X.A.A.A.B, X.A.A.B, X.A.B, X.B);
|
||||
|
||||
if(required_size < 0) { break; }
|
||||
|
||||
@@ -442,7 +414,7 @@ namespace arma_str
|
||||
template<typename T1>
|
||||
struct format_metaprog
|
||||
{
|
||||
static const uword depth = 0;
|
||||
static constexpr uword depth = 0;
|
||||
|
||||
inline
|
||||
static
|
||||
@@ -459,7 +431,7 @@ namespace arma_str
|
||||
template<typename T1, typename T2>
|
||||
struct format_metaprog< basic_format<T1,T2> >
|
||||
{
|
||||
static const uword depth = 1 + format_metaprog<T1>::depth;
|
||||
static constexpr uword depth = 1 + format_metaprog<T1>::depth;
|
||||
|
||||
inline
|
||||
static
|
||||
@@ -511,7 +483,7 @@ namespace arma_str
|
||||
inline
|
||||
static
|
||||
const T1&
|
||||
str_wrapper(const T1& x, const typename string_only<T1>::result* junk = 0)
|
||||
str_wrapper(const T1& x, const typename string_only<T1>::result* junk = nullptr)
|
||||
{
|
||||
arma_ignore(junk);
|
||||
|
||||
@@ -524,7 +496,7 @@ namespace arma_str
|
||||
inline
|
||||
static
|
||||
const T1*
|
||||
str_wrapper(const T1* x, const typename char_only<T1>::result* junk = 0)
|
||||
str_wrapper(const T1* x, const typename char_only<T1>::result* junk = nullptr)
|
||||
{
|
||||
arma_ignore(junk);
|
||||
|
||||
@@ -537,7 +509,7 @@ namespace arma_str
|
||||
inline
|
||||
static
|
||||
std::string
|
||||
str_wrapper(const T1& x, const typename basic_format_only<T1>::result* junk = 0)
|
||||
str_wrapper(const T1& x, const typename basic_format_only<T1>::result* junk = nullptr)
|
||||
{
|
||||
arma_ignore(junk);
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
// Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
//
|
||||
@@ -19,18 +21,18 @@
|
||||
|
||||
|
||||
|
||||
#define ARMA_VERSION_MAJOR 9
|
||||
#define ARMA_VERSION_MINOR 900
|
||||
#define ARMA_VERSION_PATCH 4
|
||||
#define ARMA_VERSION_NAME "Nocturnal Misbehaviour"
|
||||
#define ARMA_VERSION_MAJOR 10
|
||||
#define ARMA_VERSION_MINOR 8
|
||||
#define ARMA_VERSION_PATCH 2
|
||||
#define ARMA_VERSION_NAME "Realm Raider"
|
||||
|
||||
|
||||
|
||||
struct arma_version
|
||||
{
|
||||
static const unsigned int major = ARMA_VERSION_MAJOR;
|
||||
static const unsigned int minor = ARMA_VERSION_MINOR;
|
||||
static const unsigned int patch = ARMA_VERSION_PATCH;
|
||||
static constexpr unsigned int major = ARMA_VERSION_MAJOR;
|
||||
static constexpr unsigned int minor = ARMA_VERSION_MINOR;
|
||||
static constexpr unsigned int patch = ARMA_VERSION_PATCH;
|
||||
|
||||
static
|
||||
inline
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
// Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
//
|
||||
@@ -23,48 +25,51 @@ class arrayops
|
||||
public:
|
||||
|
||||
template<typename eT>
|
||||
arma_hot arma_inline static void
|
||||
arma_inline static void
|
||||
copy(eT* dest, const eT* src, const uword n_elem);
|
||||
|
||||
|
||||
template<typename eT>
|
||||
arma_cold inline static void
|
||||
copy_small(eT* dest, const eT* src, const uword n_elem);
|
||||
|
||||
|
||||
template<typename eT>
|
||||
inline static void
|
||||
fill_zeros(eT* dest, const uword n_elem);
|
||||
|
||||
|
||||
template<typename eT>
|
||||
arma_hot inline static void
|
||||
replace(eT* mem, const uword n_elem, const eT old_val, const eT new_val);
|
||||
|
||||
|
||||
template<typename eT>
|
||||
arma_hot inline static void
|
||||
clean(eT* mem, const uword n_elem, const eT abs_limit, const typename arma_not_cx<eT>::result* junk = 0);
|
||||
|
||||
clean(eT* mem, const uword n_elem, const eT abs_limit, const typename arma_not_cx<eT>::result* junk = nullptr);
|
||||
|
||||
template<typename T>
|
||||
arma_hot inline static void
|
||||
clean(std::complex<T>* mem, const uword n_elem, const T abs_limit);
|
||||
|
||||
template<typename eT>
|
||||
inline static void
|
||||
clamp(eT* mem, const uword n_elem, const eT min_val, const eT max_val, const typename arma_not_cx<eT>::result* junk = nullptr);
|
||||
|
||||
template<typename T>
|
||||
inline static void
|
||||
clamp(std::complex<T>* mem, const uword n_elem, const std::complex<T>& min_val, const std::complex<T>& max_val);
|
||||
|
||||
|
||||
//
|
||||
// array = convert(array)
|
||||
|
||||
template<typename out_eT, typename in_eT>
|
||||
arma_hot arma_inline static void
|
||||
convert_cx_scalar(out_eT& out, const in_eT& in, const typename arma_not_cx<out_eT>::result* junk1 = 0, const typename arma_not_cx< in_eT>::result* junk2 = 0);
|
||||
arma_inline static void
|
||||
convert_cx_scalar(out_eT& out, const in_eT& in, const typename arma_not_cx<out_eT>::result* junk1 = nullptr, const typename arma_not_cx< in_eT>::result* junk2 = nullptr);
|
||||
|
||||
template<typename out_eT, typename in_T>
|
||||
arma_hot arma_inline static void
|
||||
convert_cx_scalar(out_eT& out, const std::complex<in_T>& in, const typename arma_not_cx<out_eT>::result* junk = 0);
|
||||
arma_inline static void
|
||||
convert_cx_scalar(out_eT& out, const std::complex<in_T>& in, const typename arma_not_cx<out_eT>::result* junk = nullptr);
|
||||
|
||||
template<typename out_T, typename in_T>
|
||||
arma_hot arma_inline static void
|
||||
arma_inline static void
|
||||
convert_cx_scalar(std::complex<out_T>& out, const std::complex< in_T>& in);
|
||||
|
||||
template<typename out_eT, typename in_eT>
|
||||
@@ -205,7 +210,7 @@ class arrayops
|
||||
template<typename eT>
|
||||
arma_hot inline static
|
||||
bool
|
||||
is_zero(const eT* mem, const uword n_elem, const eT abs_limit, const typename arma_not_cx<eT>::result* junk = 0);
|
||||
is_zero(const eT* mem, const uword n_elem, const eT abs_limit, const typename arma_not_cx<eT>::result* junk = nullptr);
|
||||
|
||||
template<typename T>
|
||||
arma_hot inline static
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
// Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
//
|
||||
@@ -20,11 +22,12 @@
|
||||
|
||||
|
||||
template<typename eT>
|
||||
arma_hot
|
||||
arma_inline
|
||||
void
|
||||
arrayops::copy(eT* dest, const eT* src, const uword n_elem)
|
||||
{
|
||||
if( (dest == src) || (n_elem == 0) ) { return; }
|
||||
|
||||
if(is_cx<eT>::no)
|
||||
{
|
||||
if(n_elem <= 9)
|
||||
@@ -38,7 +41,7 @@ arrayops::copy(eT* dest, const eT* src, const uword n_elem)
|
||||
}
|
||||
else
|
||||
{
|
||||
if(n_elem > 0) { std::memcpy(dest, src, n_elem*sizeof(eT)); }
|
||||
std::memcpy(dest, src, n_elem*sizeof(eT));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,9 +86,11 @@ arrayops::fill_zeros(eT* dest, const uword n_elem)
|
||||
{
|
||||
typedef typename get_pod_type<eT>::result pod_type;
|
||||
|
||||
if(n_elem == 0) { return; }
|
||||
|
||||
if(std::numeric_limits<eT>::is_integer || std::numeric_limits<pod_type>::is_iec559)
|
||||
{
|
||||
if(n_elem > 0) { std::memset((void*)dest, 0, sizeof(eT)*n_elem); }
|
||||
std::memset((void*)dest, 0, sizeof(eT)*n_elem);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -135,7 +140,7 @@ arrayops::clean(eT* mem, const uword n_elem, const eT abs_limit, const typename
|
||||
{
|
||||
eT& val = mem[i];
|
||||
|
||||
val = (std::abs(val) <= abs_limit) ? eT(0) : val;
|
||||
val = (eop_aux::arma_abs(val) <= abs_limit) ? eT(0) : val;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -172,8 +177,53 @@ arrayops::clean(std::complex<T>* mem, const uword n_elem, const T abs_limit)
|
||||
|
||||
|
||||
|
||||
template<typename eT>
|
||||
inline
|
||||
void
|
||||
arrayops::clamp(eT* mem, const uword n_elem, const eT min_val, const eT max_val, const typename arma_not_cx<eT>::result* junk)
|
||||
{
|
||||
arma_ignore(junk);
|
||||
|
||||
for(uword i=0; i<n_elem; ++i)
|
||||
{
|
||||
eT& val = mem[i];
|
||||
|
||||
val = (val < min_val) ? min_val : ((val > max_val) ? max_val : val);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename T>
|
||||
inline
|
||||
void
|
||||
arrayops::clamp(std::complex<T>* mem, const uword n_elem, const std::complex<T>& min_val, const std::complex<T>& max_val)
|
||||
{
|
||||
typedef typename std::complex<T> eT;
|
||||
|
||||
const T min_val_real = std::real(min_val);
|
||||
const T min_val_imag = std::imag(min_val);
|
||||
|
||||
const T max_val_real = std::real(max_val);
|
||||
const T max_val_imag = std::imag(max_val);
|
||||
|
||||
for(uword i=0; i<n_elem; ++i)
|
||||
{
|
||||
eT& val = mem[i];
|
||||
|
||||
T val_real = std::real(val);
|
||||
T val_imag = std::imag(val);
|
||||
|
||||
val_real = (val_real < min_val_real) ? min_val_real : ((val_real > max_val_real) ? max_val_real : val_real);
|
||||
val_imag = (val_imag < min_val_imag) ? min_val_imag : ((val_imag > max_val_imag) ? max_val_imag : val_imag);
|
||||
|
||||
val = std::complex<T>(val_real,val_imag);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename out_eT, typename in_eT>
|
||||
arma_hot
|
||||
arma_inline
|
||||
void
|
||||
arrayops::convert_cx_scalar
|
||||
@@ -193,7 +243,6 @@ arrayops::convert_cx_scalar
|
||||
|
||||
|
||||
template<typename out_eT, typename in_T>
|
||||
arma_hot
|
||||
arma_inline
|
||||
void
|
||||
arrayops::convert_cx_scalar
|
||||
@@ -205,13 +254,16 @@ arrayops::convert_cx_scalar
|
||||
{
|
||||
arma_ignore(junk);
|
||||
|
||||
out = out_eT( in.real() );
|
||||
const in_T val = in.real();
|
||||
|
||||
const bool conversion_ok = (std::is_integral<out_eT>::value && std::is_floating_point<in_T>::value) ? arma_isfinite(val) : true;
|
||||
|
||||
out = conversion_ok ? out_eT(val) : out_eT(0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename out_T, typename in_T>
|
||||
arma_hot
|
||||
arma_inline
|
||||
void
|
||||
arrayops::convert_cx_scalar
|
||||
@@ -242,6 +294,7 @@ arrayops::convert(out_eT* dest, const in_eT* src, const uword n_elem)
|
||||
return;
|
||||
}
|
||||
|
||||
const bool check_finite = (std::is_integral<out_eT>::value && std::is_floating_point<in_eT>::value);
|
||||
|
||||
uword j;
|
||||
|
||||
@@ -253,15 +306,26 @@ arrayops::convert(out_eT* dest, const in_eT* src, const uword n_elem)
|
||||
// dest[i] = out_eT( tmp_i );
|
||||
// dest[j] = out_eT( tmp_j );
|
||||
|
||||
(*dest) = (is_signed<out_eT>::value)
|
||||
? out_eT( tmp_i )
|
||||
: ( cond_rel< is_signed<in_eT>::value >::lt(tmp_i, in_eT(0)) ? out_eT(0) : out_eT(tmp_i) );
|
||||
const bool ok_i = check_finite ? arma_isfinite(tmp_i) : true;
|
||||
const bool ok_j = check_finite ? arma_isfinite(tmp_j) : true;
|
||||
|
||||
(*dest) = ok_i
|
||||
? (
|
||||
(is_signed<out_eT>::value)
|
||||
? out_eT( tmp_i )
|
||||
: ( cond_rel< is_signed<in_eT>::value >::lt(tmp_i, in_eT(0)) ? out_eT(0) : out_eT(tmp_i) )
|
||||
)
|
||||
: out_eT(0);
|
||||
|
||||
dest++;
|
||||
|
||||
(*dest) = (is_signed<out_eT>::value)
|
||||
? out_eT( tmp_j )
|
||||
: ( cond_rel< is_signed<in_eT>::value >::lt(tmp_j, in_eT(0)) ? out_eT(0) : out_eT(tmp_j) );
|
||||
(*dest) = ok_j
|
||||
? (
|
||||
(is_signed<out_eT>::value)
|
||||
? out_eT( tmp_j )
|
||||
: ( cond_rel< is_signed<in_eT>::value >::lt(tmp_j, in_eT(0)) ? out_eT(0) : out_eT(tmp_j) )
|
||||
)
|
||||
: out_eT(0);
|
||||
dest++;
|
||||
}
|
||||
|
||||
@@ -271,9 +335,15 @@ arrayops::convert(out_eT* dest, const in_eT* src, const uword n_elem)
|
||||
|
||||
// dest[i] = out_eT( tmp_i );
|
||||
|
||||
(*dest) = (is_signed<out_eT>::value)
|
||||
? out_eT( tmp_i )
|
||||
: ( cond_rel< is_signed<in_eT>::value >::lt(tmp_i, in_eT(0)) ? out_eT(0) : out_eT(tmp_i) );
|
||||
const bool ok_i = check_finite ? arma_isfinite(tmp_i) : true;
|
||||
|
||||
(*dest) = ok_i
|
||||
? (
|
||||
(is_signed<out_eT>::value)
|
||||
? out_eT( tmp_i )
|
||||
: ( cond_rel< is_signed<in_eT>::value >::lt(tmp_i, in_eT(0)) ? out_eT(0) : out_eT(tmp_i) )
|
||||
)
|
||||
: out_eT(0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1028,7 +1098,7 @@ arrayops::is_zero(const eT* mem, const uword n_elem, const eT abs_limit, const t
|
||||
{
|
||||
for(uword i=0; i<n_elem; ++i)
|
||||
{
|
||||
if(std::abs(mem[i]) > abs_limit) { return false; }
|
||||
if(eop_aux::arma_abs(mem[i]) > abs_limit) { return false; }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
// Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
//
|
||||
@@ -23,54 +25,42 @@ class auxlib
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
template<const uword row, const uword col>
|
||||
struct pos
|
||||
{
|
||||
static const uword n2 = row + col*2;
|
||||
static const uword n3 = row + col*3;
|
||||
static const uword n4 = row + col*4;
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// inv
|
||||
|
||||
template<typename eT>
|
||||
inline static bool inv(Mat<eT>& out, const Mat<eT>& A);
|
||||
inline static bool inv(Mat<eT>& A);
|
||||
|
||||
template<typename eT>
|
||||
arma_cold inline static bool inv_tiny(Mat<eT>& out, const Mat<eT>& X);
|
||||
|
||||
template<typename eT, typename T1>
|
||||
inline static bool inv_tr(Mat<eT>& out, const Base<eT,T1>& X, const uword layout);
|
||||
|
||||
template<typename eT, typename T1>
|
||||
inline static bool inv_sympd(Mat<eT>& out, const Base<eT,T1>& X);
|
||||
inline static bool inv(Mat<eT>& out, const Mat<eT>& X);
|
||||
|
||||
template<typename eT>
|
||||
arma_cold inline static bool inv_sympd_tiny(Mat<eT>& out, const Mat<eT>& X);
|
||||
inline static bool inv_tr(Mat<eT>& A, const uword layout);
|
||||
|
||||
template<typename eT>
|
||||
inline static bool inv_sympd(Mat<eT>& A);
|
||||
|
||||
template<typename eT>
|
||||
inline static bool inv_sympd(Mat<eT>& out, const Mat<eT>& X);
|
||||
|
||||
template<typename eT>
|
||||
inline static bool inv_sympd_rcond(Mat<eT>& A, const eT rcond_threshold);
|
||||
|
||||
template<typename T>
|
||||
inline static bool inv_sympd_rcond(Mat< std::complex<T> >& A, const T rcond_threshold);
|
||||
|
||||
|
||||
//
|
||||
// det
|
||||
// det and log_det
|
||||
|
||||
template<typename eT>
|
||||
inline static eT det(const Mat<eT>& A);
|
||||
inline static bool det(eT& out_val, Mat<eT>& A);
|
||||
|
||||
template<typename eT>
|
||||
arma_cold inline static eT det_tinymat(const Mat<eT>& X, const uword N);
|
||||
inline static bool log_det(eT& out_val, typename get_pod_type<eT>::result& out_sign, Mat<eT>& A);
|
||||
|
||||
template<typename eT>
|
||||
inline static eT det_lapack(const Mat<eT>& X);
|
||||
|
||||
|
||||
//
|
||||
// log_det
|
||||
|
||||
template<typename eT, typename T1>
|
||||
inline static bool log_det(eT& out_val, typename get_pod_type<eT>::result& out_sign, const Base<eT,T1>& X);
|
||||
inline static bool log_det_sympd(typename get_pod_type<eT>::result& out_val, Mat<eT>& A);
|
||||
|
||||
|
||||
//
|
||||
@@ -149,11 +139,11 @@ class auxlib
|
||||
//
|
||||
// eig_sym
|
||||
|
||||
template<typename eT, typename T1>
|
||||
inline static bool eig_sym(Col<eT>& eigval, const Base<eT,T1>& X);
|
||||
template<typename eT>
|
||||
inline static bool eig_sym(Col<eT>& eigval, Mat<eT>& A);
|
||||
|
||||
template<typename T, typename T1>
|
||||
inline static bool eig_sym(Col<T>& eigval, const Base<std::complex<T>,T1>& X);
|
||||
template<typename T>
|
||||
inline static bool eig_sym(Col<T>& eigval, Mat< std::complex<T> >& A);
|
||||
|
||||
template<typename eT>
|
||||
inline static bool eig_sym(Col<eT>& eigval, Mat<eT>& eigvec, const Mat<eT>& X);
|
||||
@@ -186,6 +176,9 @@ class auxlib
|
||||
template<typename eT>
|
||||
inline static bool chol_band_common(Mat<eT>& X, const uword KD, const uword layout);
|
||||
|
||||
template<typename eT>
|
||||
inline static bool chol_pivot(Mat<eT>& X, Mat<uword>& P, const uword layout);
|
||||
|
||||
|
||||
//
|
||||
// hessenberg decomposition
|
||||
@@ -213,55 +206,44 @@ class auxlib
|
||||
//
|
||||
// svd
|
||||
|
||||
template<typename eT, typename T1>
|
||||
inline static bool svd(Col<eT>& S, const Base<eT,T1>& X, uword& n_rows, uword& n_cols);
|
||||
template<typename eT>
|
||||
inline static bool svd(Col<eT>& S, Mat<eT>& A);
|
||||
|
||||
template<typename T, typename T1>
|
||||
inline static bool svd(Col<T>& S, const Base<std::complex<T>, T1>& X, uword& n_rows, uword& n_cols);
|
||||
|
||||
template<typename eT, typename T1>
|
||||
inline static bool svd(Col<eT>& S, const Base<eT,T1>& X);
|
||||
|
||||
template<typename T, typename T1>
|
||||
inline static bool svd(Col<T>& S, const Base<std::complex<T>, T1>& X);
|
||||
|
||||
template<typename eT, typename T1>
|
||||
inline static bool svd(Mat<eT>& U, Col<eT>& S, Mat<eT>& V, const Base<eT,T1>& X);
|
||||
|
||||
template<typename T, typename T1>
|
||||
inline static bool svd(Mat< std::complex<T> >& U, Col<T>& S, Mat< std::complex<T> >& V, const Base< std::complex<T>, T1>& X);
|
||||
|
||||
template<typename eT, typename T1>
|
||||
inline static bool svd_econ(Mat<eT>& U, Col<eT>& S, Mat<eT>& V, const Base<eT,T1>& X, const char mode);
|
||||
|
||||
template<typename T, typename T1>
|
||||
inline static bool svd_econ(Mat< std::complex<T> >& U, Col<T>& S, Mat< std::complex<T> >& V, const Base< std::complex<T>, T1>& X, const char mode);
|
||||
template<typename T>
|
||||
inline static bool svd(Col<T>& S, Mat< std::complex<T> >& A);
|
||||
|
||||
|
||||
template<typename eT, typename T1>
|
||||
inline static bool svd_dc(Col<eT>& S, const Base<eT,T1>& X, uword& n_rows, uword& n_cols);
|
||||
template<typename eT>
|
||||
inline static bool svd(Mat<eT>& U, Col<eT>& S, Mat<eT>& V, Mat<eT>& A);
|
||||
|
||||
template<typename T, typename T1>
|
||||
inline static bool svd_dc(Col<T>& S, const Base<std::complex<T>, T1>& X, uword& n_rows, uword& n_cols);
|
||||
template<typename T>
|
||||
inline static bool svd(Mat< std::complex<T> >& U, Col<T>& S, Mat< std::complex<T> >& V, Mat< std::complex<T> >& A);
|
||||
|
||||
template<typename eT, typename T1>
|
||||
inline static bool svd_dc(Col<eT>& S, const Base<eT,T1>& X);
|
||||
template<typename eT>
|
||||
inline static bool svd_econ(Mat<eT>& U, Col<eT>& S, Mat<eT>& V, Mat<eT>& A, const char mode);
|
||||
|
||||
template<typename T, typename T1>
|
||||
inline static bool svd_dc(Col<T>& S, const Base<std::complex<T>, T1>& X);
|
||||
template<typename T>
|
||||
inline static bool svd_econ(Mat< std::complex<T> >& U, Col<T>& S, Mat< std::complex<T> >& V, Mat< std::complex<T> >& A, const char mode);
|
||||
|
||||
|
||||
template<typename eT, typename T1>
|
||||
inline static bool svd_dc(Mat<eT>& U, Col<eT>& S, Mat<eT>& V, const Base<eT,T1>& X);
|
||||
template<typename eT>
|
||||
inline static bool svd_dc(Col<eT>& S, Mat<eT>& A);
|
||||
|
||||
template<typename T, typename T1>
|
||||
inline static bool svd_dc(Mat< std::complex<T> >& U, Col<T>& S, Mat< std::complex<T> >& V, const Base< std::complex<T>, T1>& X);
|
||||
template<typename T>
|
||||
inline static bool svd_dc(Col<T>& S, Mat< std::complex<T> >& A);
|
||||
|
||||
template<typename eT, typename T1>
|
||||
inline static bool svd_dc_econ(Mat<eT>& U, Col<eT>& S, Mat<eT>& V, const Base<eT,T1>& X);
|
||||
|
||||
template<typename T, typename T1>
|
||||
inline static bool svd_dc_econ(Mat< std::complex<T> >& U, Col<T>& S, Mat< std::complex<T> >& V, const Base< std::complex<T>, T1>& X);
|
||||
template<typename eT>
|
||||
inline static bool svd_dc(Mat<eT>& U, Col<eT>& S, Mat<eT>& V, Mat<eT>& A);
|
||||
|
||||
template<typename T>
|
||||
inline static bool svd_dc(Mat< std::complex<T> >& U, Col<T>& S, Mat< std::complex<T> >& V, Mat< std::complex<T> >& A);
|
||||
|
||||
template<typename eT>
|
||||
inline static bool svd_dc_econ(Mat<eT>& U, Col<eT>& S, Mat<eT>& V, Mat<eT>& A);
|
||||
|
||||
template<typename T>
|
||||
inline static bool svd_dc_econ(Mat< std::complex<T> >& U, Col<T>& S, Mat< std::complex<T> >& V, Mat< std::complex<T> >& A);
|
||||
|
||||
|
||||
//
|
||||
@@ -371,13 +353,13 @@ class auxlib
|
||||
inline static bool schur(Mat<eT>& U, Mat<eT>& S, const Base<eT,T1>& X, const bool calc_U = true);
|
||||
|
||||
template<typename T, typename T1>
|
||||
inline static bool schur(Mat<std::complex<T> >& U, Mat<std::complex<T> >& S, const Base<std::complex<T>,T1>& X, const bool calc_U = true);
|
||||
inline static bool schur(Mat< std::complex<T> >& U, Mat< std::complex<T> >& S, const Base<std::complex<T>,T1>& X, const bool calc_U = true);
|
||||
|
||||
template<typename T>
|
||||
inline static bool schur(Mat<std::complex<T> >& U, Mat<std::complex<T> >& S, const bool calc_U = true);
|
||||
inline static bool schur(Mat< std::complex<T> >& U, Mat< std::complex<T> >& S, const bool calc_U = true);
|
||||
|
||||
//
|
||||
// syl (solution of the Sylvester equation AX + XB = C)
|
||||
// solve the Sylvester equation AX + XB = C
|
||||
|
||||
template<typename eT>
|
||||
inline static bool syl(Mat<eT>& X, const Mat<eT>& A, const Mat<eT>& B, const Mat<eT>& C);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
// Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
//
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
// Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
|
||||
#undef ARMA_HAVE_CXX11
|
||||
#undef ARMA_HAVE_CXX14
|
||||
#undef ARMA_HAVE_CXX17
|
||||
#undef ARMA_HAVE_CXX20
|
||||
|
||||
#if (__cplusplus >= 201103L)
|
||||
#define ARMA_HAVE_CXX11
|
||||
#endif
|
||||
|
||||
#if (__cplusplus >= 201402L)
|
||||
#define ARMA_HAVE_CXX14
|
||||
#endif
|
||||
|
||||
#if (__cplusplus >= 201703L)
|
||||
#define ARMA_HAVE_CXX17
|
||||
#endif
|
||||
|
||||
#if (__cplusplus >= 202002L)
|
||||
#define ARMA_HAVE_CXX20
|
||||
#endif
|
||||
|
||||
|
||||
// MS really can't get its proverbial shit together
|
||||
#if defined(_MSVC_LANG)
|
||||
|
||||
#if (_MSVC_LANG >= 201402L)
|
||||
#undef ARMA_HAVE_CXX11
|
||||
#undef ARMA_HAVE_CXX14
|
||||
|
||||
#define ARMA_HAVE_CXX11
|
||||
#define ARMA_HAVE_CXX14
|
||||
#endif
|
||||
|
||||
#if (_MSVC_LANG >= 201703L)
|
||||
#undef ARMA_HAVE_CXX17
|
||||
#define ARMA_HAVE_CXX17
|
||||
#endif
|
||||
|
||||
#if (_MSVC_LANG >= 202002L)
|
||||
#undef ARMA_HAVE_CXX20
|
||||
#define ARMA_HAVE_CXX20
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
// warn about ignored option used in old versions of Armadillo
|
||||
#if defined(ARMA_DONT_USE_CXX11)
|
||||
#pragma message ("WARNING: option ARMA_DONT_USE_CXX11 ignored")
|
||||
#endif
|
||||
|
||||
|
||||
#if !defined(ARMA_HAVE_CXX11)
|
||||
#error "*** C++11 compiler required; enable C++11 mode in your compiler, or use an earlier version of Armadillo"
|
||||
#endif
|
||||
|
||||
|
||||
// for compatibility with earlier versions of Armadillo
|
||||
#undef ARMA_USE_CXX11
|
||||
#define ARMA_USE_CXX11
|
||||
@@ -1,3 +1,5 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
// Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
//
|
||||
@@ -78,29 +80,17 @@
|
||||
#undef ARMA_INCFILE_WRAP
|
||||
#define ARMA_INCFILE_WRAP(x) <x>
|
||||
|
||||
#if defined(ARMA_USE_CXX11)
|
||||
|
||||
#undef ARMA_USE_U64S64
|
||||
#define ARMA_USE_U64S64
|
||||
|
||||
#if !defined(ARMA_32BIT_WORD)
|
||||
#undef ARMA_64BIT_WORD
|
||||
#define ARMA_64BIT_WORD
|
||||
#endif
|
||||
|
||||
#if defined(ARMA_64BIT_WORD) && defined(SIZE_MAX)
|
||||
#if (SIZE_MAX < 0xFFFFFFFFFFFFFFFFull)
|
||||
// #pragma message ("WARNING: disabled use of 64 bit integers, as std::size_t is smaller than 64 bits")
|
||||
#undef ARMA_64BIT_WORD
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#if !defined(ARMA_32BIT_WORD)
|
||||
#undef ARMA_64BIT_WORD
|
||||
#define ARMA_64BIT_WORD
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(ARMA_64BIT_WORD)
|
||||
#undef ARMA_USE_U64S64
|
||||
#define ARMA_USE_U64S64
|
||||
#if defined(ARMA_64BIT_WORD) && defined(SIZE_MAX)
|
||||
#if (SIZE_MAX < 0xFFFFFFFFFFFFFFFFull)
|
||||
// #pragma message ("WARNING: disabled use of 64 bit integers, as std::size_t is smaller than 64 bits")
|
||||
#undef ARMA_64BIT_WORD
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
@@ -111,20 +101,6 @@
|
||||
|
||||
#undef ARMA_GOOD_COMPILER
|
||||
|
||||
#undef ARMA_HAVE_TR1
|
||||
#undef ARMA_HAVE_GETTIMEOFDAY
|
||||
#undef ARMA_HAVE_SNPRINTF
|
||||
#undef ARMA_HAVE_ISFINITE
|
||||
#undef ARMA_HAVE_LOG1P
|
||||
#undef ARMA_HAVE_ISINF
|
||||
#undef ARMA_HAVE_ISNAN
|
||||
|
||||
|
||||
#if (defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200112L))
|
||||
#define ARMA_HAVE_GETTIMEOFDAY
|
||||
#endif
|
||||
|
||||
|
||||
// posix_memalign() is part of IEEE standard 1003.1
|
||||
// http://pubs.opengroup.org/onlinepubs/009696899/functions/posix_memalign.html
|
||||
// http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/unistd.h.html
|
||||
@@ -141,10 +117,6 @@
|
||||
|
||||
// #undef ARMA_HAVE_POSIX_MEMALIGN
|
||||
// NOTE: posix_memalign() is available since macOS 10.6 (late 2009 onwards)
|
||||
|
||||
// #undef ARMA_USE_EXTERN_CXX11_RNG
|
||||
// NOTE: thread_local seems to work in Apple clang since Xcode 8 (mid 2016 onwards)
|
||||
// NOTE: https://stackoverflow.com/questions/28094794/why-does-apple-clang-disallow-c11-thread-local-when-official-clang-supports
|
||||
#endif
|
||||
|
||||
|
||||
@@ -161,13 +133,16 @@
|
||||
#define ARMA_FNSIG __FUNCSIG__
|
||||
#elif defined(__INTEL_COMPILER)
|
||||
#define ARMA_FNSIG __FUNCTION__
|
||||
#elif defined(ARMA_USE_CXX11)
|
||||
#define ARMA_FNSIG __func__
|
||||
#else
|
||||
#define ARMA_FNSIG "(unknown)"
|
||||
#define ARMA_FNSIG __func__
|
||||
#endif
|
||||
|
||||
|
||||
// #if defined(ARMA_HAVE_CXX17)
|
||||
// #define arma_warn_unused [[nodiscard]]
|
||||
// #endif
|
||||
|
||||
|
||||
#if !defined(ARMA_ALLOW_FAKE_GCC)
|
||||
#if (defined(__GNUG__) || defined(__GNUC__)) && (defined(__INTEL_COMPILER) || defined(__NVCC__) || defined(__CUDACC__) || defined(__PGI) || defined(__PATHSCALE__) || defined(__ARMCC_VERSION) || defined(__IBMCPP__))
|
||||
#undef ARMA_DETECTED_FAKE_GCC
|
||||
@@ -219,12 +194,6 @@
|
||||
#undef ARMA_HAVE_GCC_ASSUME_ALIGNED
|
||||
#define ARMA_HAVE_GCC_ASSUME_ALIGNED
|
||||
|
||||
#if !defined(ARMA_USE_CXX11) && !defined(__GXX_EXPERIMENTAL_CXX0X__) && (__cplusplus < 201103L) && !defined(ARMA_DONT_USE_TR1)
|
||||
#if defined(_GLIBCXX_USE_C99_MATH_TR1) && defined(_GLIBCXX_USE_C99_COMPLEX_TR1)
|
||||
#define ARMA_HAVE_TR1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// gcc's vectoriser can handle elaborate loops
|
||||
#undef ARMA_SIMPLE_LOOPS
|
||||
|
||||
@@ -232,14 +201,6 @@
|
||||
#define ARMA_SIMPLE_LOOPS
|
||||
#endif
|
||||
|
||||
#if !defined(ARMA_USE_CXX11) && (defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200112L))
|
||||
#define ARMA_HAVE_SNPRINTF
|
||||
#define ARMA_HAVE_ISFINITE
|
||||
#define ARMA_HAVE_LOG1P
|
||||
#define ARMA_HAVE_ISINF
|
||||
#define ARMA_HAVE_ISNAN
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -319,14 +280,6 @@
|
||||
#define ARMA_HAVE_GCC_ASSUME_ALIGNED
|
||||
#endif
|
||||
|
||||
#if !defined(ARMA_USE_CXX11) && (defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200112L))
|
||||
#define ARMA_HAVE_SNPRINTF
|
||||
#define ARMA_HAVE_ISFINITE
|
||||
#define ARMA_HAVE_LOG1P
|
||||
#define ARMA_HAVE_ISINF
|
||||
#define ARMA_HAVE_ISNAN
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -336,7 +289,7 @@
|
||||
#error "*** newer compiler required ***"
|
||||
#endif
|
||||
|
||||
#if (__INTEL_COMPILER < 1400)
|
||||
#if (__INTEL_COMPILER < 1500)
|
||||
#error "*** newer compiler required ***"
|
||||
#endif
|
||||
|
||||
@@ -344,34 +297,15 @@
|
||||
#undef ARMA_HAVE_ICC_ASSUME_ALIGNED
|
||||
#define ARMA_HAVE_ICC_ASSUME_ALIGNED
|
||||
|
||||
#if defined(ARMA_USE_CXX11)
|
||||
#if (__INTEL_COMPILER < 1500)
|
||||
#undef ARMA_PRINT_CXX11_WARNING
|
||||
#define ARMA_PRINT_CXX11_WARNING
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
|
||||
#if (_MSC_VER < 1700)
|
||||
#if (_MSC_VER < 1900)
|
||||
#error "*** newer compiler required ***"
|
||||
#endif
|
||||
|
||||
#if (_MSC_VER < 1800)
|
||||
#undef ARMA_PRINT_CXX98_WARNING
|
||||
#define ARMA_PRINT_CXX98_WARNING
|
||||
#endif
|
||||
|
||||
#if defined(ARMA_USE_CXX11)
|
||||
#if (_MSC_VER < 1900)
|
||||
#undef ARMA_PRINT_CXX11_WARNING
|
||||
#define ARMA_PRINT_CXX11_WARNING
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#undef arma_deprecated
|
||||
#define arma_deprecated __declspec(deprecated)
|
||||
// #undef arma_inline
|
||||
@@ -397,10 +331,7 @@
|
||||
#pragma warning(disable: 4711) // call was inlined
|
||||
#pragma warning(disable: 4714) // __forceinline can't be inlined
|
||||
#pragma warning(disable: 4800) // value forced to bool
|
||||
|
||||
#if defined(ARMA_USE_CXX11)
|
||||
#pragma warning(disable: 4519) // default template args are only allowed on a class template
|
||||
#endif
|
||||
#pragma warning(disable: 4519) // C++11: default template args are only allowed on a class template
|
||||
|
||||
|
||||
// #if (_MANAGED == 1) || (_M_CEE == 1)
|
||||
@@ -433,49 +364,29 @@
|
||||
// http://www.oracle.com/technetwork/server-storage/solarisstudio/training/index-jsp-141991.html
|
||||
// http://www.oracle.com/technetwork/server-storage/solarisstudio/documentation/cplusplus-faq-355066.html
|
||||
|
||||
#if (__SUNPRO_CC < 0x5130)
|
||||
#if (__SUNPRO_CC < 0x5140)
|
||||
#error "*** newer compiler required ***"
|
||||
#endif
|
||||
|
||||
#if defined(ARMA_USE_CXX11)
|
||||
#if (__SUNPRO_CC < 0x5140)
|
||||
#undef ARMA_PRINT_CXX11_WARNING
|
||||
#define ARMA_PRINT_CXX11_WARNING
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(ARMA_USE_CXX11) && defined(__CYGWIN__) && !defined(ARMA_DONT_PRINT_CXX11_WARNING)
|
||||
#if defined(__CYGWIN__) && !defined(ARMA_DONT_PRINT_CXX11_WARNING)
|
||||
#pragma message ("WARNING: Cygwin may have incomplete support for C++11 features.")
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(ARMA_USE_CXX11) && (__cplusplus < 201103L)
|
||||
#undef ARMA_PRINT_CXX11_WARNING
|
||||
#define ARMA_PRINT_CXX11_WARNING
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(ARMA_PRINT_CXX98_WARNING) && !defined(ARMA_DONT_PRINT_CXX98_WARNING)
|
||||
#pragma message ("WARNING: this compiler is OUTDATED and has INCOMPLETE support for the C++ standard;")
|
||||
#pragma message ("WARNING: if something breaks, you get to keep all the pieces.")
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(ARMA_PRINT_CXX11_WARNING) && !defined(ARMA_DONT_PRINT_CXX11_WARNING)
|
||||
#pragma message ("WARNING: use of C++11 features has been enabled,")
|
||||
#pragma message ("WARNING: but this compiler has INCOMPLETE support for C++11;")
|
||||
#pragma message ("WARNING: if something breaks, you get to keep all the pieces.")
|
||||
#pragma message ("WARNING: to forcefully prevent Armadillo from using C++11 features,")
|
||||
#pragma message ("WARNING: #define ARMA_DONT_USE_CXX11 before #include <armadillo>")
|
||||
#if !defined(ARMA_DONT_USE_OPENMP)
|
||||
#if (defined(_OPENMP) && (_OPENMP >= 201107))
|
||||
#undef ARMA_USE_OPENMP
|
||||
#define ARMA_USE_OPENMP
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#if ( defined(ARMA_USE_OPENMP) && (!defined(_OPENMP) || (defined(_OPENMP) && (_OPENMP < 201107))) )
|
||||
// OpenMP 3.1 required for atomic read and atomic write
|
||||
// OpenMP 3.0 required for parallelisation of loops with unsigned integers
|
||||
// OpenMP 3.1 required for atomic read and atomic write
|
||||
#undef ARMA_USE_OPENMP
|
||||
#undef ARMA_PRINT_OPENMP_WARNING
|
||||
#define ARMA_PRINT_OPENMP_WARNING
|
||||
@@ -492,20 +403,7 @@
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(ARMA_USE_OPENMP) && !defined(ARMA_USE_CXX11)
|
||||
#if (defined(ARMA_GCC_VERSION) && (ARMA_GCC_VERSION >= 50400)) || (defined(__clang__) && !defined(ARMA_DETECTED_FAKE_CLANG))
|
||||
#undef ARMA_PRINT_OPENMP_CXX11_WARNING
|
||||
#define ARMA_PRINT_OPENMP_CXX11_WARNING
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(ARMA_PRINT_OPENMP_CXX11_WARNING) && !defined(ARMA_DONT_PRINT_OPENMP_WARNING)
|
||||
#pragma message ("WARNING: support for OpenMP requires C++11/C++14; add -std=c++11 or -std=c++14 to compiler flags")
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(ARMA_USE_OPENMP) && defined(ARMA_USE_CXX11)
|
||||
#if defined(ARMA_USE_OPENMP)
|
||||
#if (defined(ARMA_GCC_VERSION) && (ARMA_GCC_VERSION < 50400))
|
||||
// due to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57580
|
||||
// TODO: gcc 4.9.4 is also fixed, so use a more fine-grained gcc version check?
|
||||
@@ -517,10 +415,14 @@
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(ARMA_GCC_VERSION) && (ARMA_GCC_VERSION >= 50400) && !defined(ARMA_USE_CXX11)
|
||||
#if !defined(ARMA_PRINT_CXX11_WARNING) && !defined(ARMA_PRINT_OPENMP_CXX11_WARNING) && !defined(ARMA_DONT_PRINT_CXX11_WARNING)
|
||||
#pragma message ("NOTE: suggest to enable C++14 mode for faster code; add -std=c++14 to compiler flags")
|
||||
#endif
|
||||
#if ( defined(_WIN32) || defined(_WIN64) || defined(_MSC_VER) || defined(__MINGW32__) || defined(__MINGW64__) )
|
||||
#undef ARMA_PRINT_EXCEPTIONS
|
||||
#define ARMA_PRINT_EXCEPTIONS
|
||||
#endif
|
||||
|
||||
|
||||
#if (defined(ARMA_ALIEN_MEM_ALLOC_FUNCTION) && !defined(ARMA_ALIEN_MEM_FREE_FUNCTION)) || (!defined(ARMA_ALIEN_MEM_ALLOC_FUNCTION) && defined(ARMA_ALIEN_MEM_FREE_FUNCTION))
|
||||
#error "*** both ARMA_ALIEN_MEM_ALLOC_FUNCTION and ARMA_ALIEN_MEM_FREE_FUNCTION must be defined ***"
|
||||
#endif
|
||||
|
||||
|
||||
@@ -530,10 +432,7 @@
|
||||
#undef ARMA_DETECTED_FAKE_GCC
|
||||
#undef ARMA_DETECTED_FAKE_CLANG
|
||||
#undef ARMA_GCC_VERSION
|
||||
#undef ARMA_PRINT_CXX98_WARNING
|
||||
#undef ARMA_PRINT_CXX11_WARNING
|
||||
#undef ARMA_PRINT_OPENMP_WARNING
|
||||
#undef ARMA_PRINT_OPENMP_CXX11_WARNING
|
||||
|
||||
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user