Compare commits

...
668 Commits
Author SHA1 Message Date
conrad 07414596d4 version bump 2026-06-18 13:21:37 +10:00
conrad 585b369988 fix layout 2026-06-18 12:56:19 +10:00
conrad a957b25a29 explicitly ignore unused value 2026-06-17 12:18:45 +10:00
conrad 61bb3e0ae8 change fill::pos_inf to shorter fill::inf 2026-06-17 11:36:30 +10:00
conrad d5f00fd4a8 mark as RC1 2026-06-16 14:42:41 +10:00
conrad 4dc011f5d3 keep requested mem_state even if n_elem is zero 2026-06-16 14:12:08 +10:00
conrad 922ccf9154 rearrange 2026-06-16 13:24:10 +10:00
conrad ba33c24e8a simpler conversion of std::vector 2026-06-16 13:19:00 +10:00
conrad fea46c6f84 more robust handling of aux_mem 2026-06-16 13:02:05 +10:00
conrad 033c93196c more robust handling of aux_mem 2026-06-16 12:33:54 +10:00
conrad 453bef9283 update list of changes 2026-06-15 15:37:28 +10:00
conrad 598df0100e minor cleanup 2026-06-15 15:35:38 +10:00
conrad 45347ce825 avoid copying when element types are the same 2026-06-15 15:12:11 +10:00
conrad 3318e018d0 faster initial vector growth 2026-06-15 12:07:45 +10:00
conrad 8d350a1534 remove unused code 2026-06-15 11:52:45 +10:00
conrad 11b885085a update list of changes 2026-06-13 00:56:07 +10:00
conrad 724dc98eb8 speedp for contiguous subcubes 2026-06-13 00:51:39 +10:00
conrad 452a6c1b49 use partially unrolled loops 2026-06-13 00:29:21 +10:00
conrad 5c2892a2b5 add specialised handling of find() within .elem() 2026-06-13 00:26:17 +10:00
conrad 88003f8ab8 obtain memory pointers earlier 2026-06-13 00:20:14 +10:00
conrad 248ce5fe7f use same variable name for definition and implementation 2026-06-13 00:14:14 +10:00
conrad e493eb3b34 simplify bounds checks 2026-06-13 00:11:16 +10:00
conrad 03411c40a6 add stored_type typedef to quasi_unwrap<> 2026-06-13 00:06:27 +10:00
conrad 3c6c443be6 more precise alias check 2026-06-12 23:54:07 +10:00
conrad a638683e6f remove unnecessary alignment attribute 2026-06-12 22:02:22 +10:00
conrad e299f5e189 simplify by reusing extract_noalias() 2026-06-12 21:59:36 +10:00
conrad 053de98101 rename unwrap objects 2026-06-12 21:56:57 +10:00
conrad 6b1ce2116b remove rarely used specialisations 2026-06-12 21:48:17 +10:00
conrad b7afc7e5fb add has_subview trait 2026-06-12 20:25:01 +10:00
conrad 1e61d46e5b rename op_find to op_find_generic; rename op_find_simple to op_find_default 2026-06-12 20:13:50 +10:00
conrad 139d9f4d62 user better name and constexpr variable to indicate half threshold 2026-06-12 20:09:12 +10:00
conrad f123904e82 add docs for .push_back() 2026-06-12 20:04:24 +10:00
conrad 6e224f38bd add .push_back() 2026-06-12 20:02:11 +10:00
conrad c088151876 remove unnecessary forced inlines 2026-06-12 19:52:15 +10:00
conrad a839bc49d3 expand deprecation notices 2026-06-12 19:45:34 +10:00
conrad c13b71fc69 rename unwrap<> to plain_unwrap<> for consistency with bandicoot 2026-06-12 19:08:54 +10:00
conrad 69fc9f29a0 mark as experimental 2026-06-12 16:17:33 +10:00
conrad 730594f6da mark as experimental 2026-06-12 16:17:20 +10:00
conrad 80087a3a55 patch bump 2026-05-28 15:12:21 +10:00
conrad d0b07c02a3 skip alias checks when extracting subfield into a fresh field 2026-05-26 22:58:36 +10:00
conrad 1716a6b531 more efficient alias checks 2026-05-26 15:08:10 +10:00
conrad a86cfc932b don't strip const 2026-05-26 12:37:27 +10:00
conrad 8ce3f3aa7d skip alias checks when extracting subview_elem2 into a fresh matrix 2026-05-25 12:49:06 +10:00
conrad 89158f7777 skip alias checks when extracting subview_elem1 into a fresh matrix 2026-05-25 12:29:45 +10:00
conrad cedbd0eb89 simplifications 2026-04-27 10:46:05 +10:00
conrad fd38c47657 better wording 2026-04-27 10:40:02 +10:00
conrad bb5c4469b3 minor fix in error message 2026-04-21 13:50:08 +10:00
conrad 36b0cd37ec patch bump 2026-04-20 00:15:11 +10:00
conrad 59fbefc095 simplifications 2026-04-19 22:59:46 +10:00
conrad b1f3a185bf distinguish between default and user supplied tolerance 2026-04-18 23:48:32 +10:00
conrad adcbf1380a ensure intermediate results are not NaN 2026-04-18 17:45:48 +10:00
conrad 733533f089 ensure intermediate results are not NaN 2026-04-18 17:09:20 +10:00
conrad ae6f216a82 ensure suppled tolerances are not NaN 2026-04-18 17:08:51 +10:00
conrad 417bb37042 ensure default tolerances are not NaN 2026-04-18 16:45:02 +10:00
conrad 95cad27904 ensure default tolerance is finite 2026-04-18 14:13:49 +10:00
conrad 3e66e7b1f0 cleanup 2026-04-16 21:39:49 +10:00
conrad 4a6cc3e9a8 patch bump 2026-04-16 15:14:57 +10:00
conrad 0260b7f1dc fix warning message 2026-04-16 15:09:11 +10:00
conrad 6b180e1943 cleanup 2026-04-16 15:07:09 +10:00
conrad afec1a5f5a use the Proxy only when necessary 2026-04-15 14:10:24 +10:00
conrad 7ab5657470 faster handling of compound vector expressions 2026-04-15 13:42:44 +10:00
conrad fa63e6d717 distinguish between default and user supplied tolerance 2026-04-07 11:33:04 +10:00
conrad bf69c85cb8 show rcond earlier to avoid potential confusion 2026-04-07 10:56:08 +10:00
conrad 5e888a2fc7 simplifications 2026-04-06 21:14:45 +10:00
conrad f0db911a5c handle NaNs when checking ranges 2026-04-06 20:36:34 +10:00
conrad efff7a8f3f simplify warning messages 2026-04-06 19:48:48 +10:00
conrad 7f5569ffba handle NaNs when checking ranges 2026-04-06 19:35:29 +10:00
conrad 7c9ef72802 handle NaNs when checking tolerances 2026-04-05 23:06:49 +10:00
conrad c75af66d72 ensure consistency with subview_row::randu() and subview_row::randn() 2026-04-05 19:40:55 +10:00
conrad ce769c625f handle NaNs when checking tolerances 2026-04-05 02:30:59 +10:00
conrad f1e65e55de handle NaNs when checking conformance 2026-04-05 02:22:30 +10:00
conrad 7e4a956dbd specialisations for randu() and randn() 2026-04-04 19:47:20 +10:00
conrad 43b071020a handle NaNs when checking tolerances 2026-04-02 13:49:58 +10:00
conrad f548057ee7 simplifications 2026-04-02 13:44:30 +10:00
conrad e260407a3e handle NaNs when checking tolerances 2026-04-02 13:09:39 +10:00
conrad f049b04688 simplification: implicit handling of NaNs 2026-04-02 12:33:44 +10:00
conrad 8af4d74bd4 rearrange for consistency with other code 2026-04-01 16:33:36 +10:00
conrad a039d60a47 simplification 2026-03-31 12:42:59 +10:00
conrad a4634e8888 use correct element type 2026-03-31 12:36:05 +10:00
conrad df1eec4fb9 add note on how to enable support for std::int8_t and std::uint8_t 2026-03-30 00:26:09 +10:00
conrad 4524c7580f rearrange ::is_zero() to follow same pattern as arrayops::is_zero() 2026-03-30 00:24:49 +10:00
conrad 536a642b64 add compatibility note 2026-03-28 16:23:34 +10:00
conrad 80e1faa764 shorten temporary suffix and increase its randomness 2026-03-27 11:25:59 +10:00
conrad 4e8e1564e0 simplifications 2026-03-24 12:36:32 +10:00
conrad cd0a21d242 specialisations for .replace() 2026-03-24 12:27:35 +10:00
conrad e43f4f7ef9 fix corner case in is_zero(): explicitly handle nan 2026-03-23 15:23:14 +10:00
conrad f2691c6beb fix corner case in is_zero(): explicitly handle nan 2026-03-23 15:12:22 +10:00
conrad 825dbf7e60 fix corner case in is_zero(): explicitly handle nan 2026-03-23 12:42:46 +10:00
conrad ed078509da fixes for corner cases 2026-03-23 12:17:44 +10:00
conrad 759a36d0b3 fix + specialisations for .is_zero() 2026-03-23 11:59:52 +10:00
conrad e0d2196ae5 faster scalar operations on diagview 2026-03-21 20:06:48 +10:00
conrad 998c7814bc use proper function names in error messages 2026-03-21 11:39:52 +10:00
conrad ebd9209b31 simplify warning messages 2026-03-20 15:34:13 +10:00
conrad 745b02d4d7 simplifications 2026-03-20 14:49:29 +10:00
conrad b28fd1456c update list of changes 2026-03-20 12:54:13 +10:00
conrad 44a7a9cfed add note on arma prefix for span() 2026-03-20 12:38:38 +10:00
conrad ee9e26902f increase randomness of temporary filenames 2026-03-19 14:35:44 +10:00
conrad c14a60deec update year 2026-03-18 11:50:47 +10:00
conrad 33e382b623 simplifications 2026-03-17 12:07:46 +10:00
conrad 7334664999 patch bump 2026-03-15 18:42:19 +10:00
conrad f021766215 speedups for blank sparse submatrices 2026-03-15 17:33:41 +10:00
conrad 5491a20833 simplifications 2026-03-13 12:16:51 +10:00
conrad 1cab3be4df simplifications 2026-03-13 11:52:44 +10:00
conrad 08e1cb5211 specialisation for subview::zeros() 2026-03-13 11:33:39 +10:00
conrad 70c45a2f17 workarounds for ASAN false positives 2026-03-12 18:21:38 +10:00
conrad 2dfed59b94 simplifications 2026-03-12 15:57:37 +10:00
conrad 8bf7834041 simplifications 2026-03-12 15:48:04 +10:00
conrad 1461d33045 simplifications 2026-03-12 15:32:54 +10:00
conrad e05bc82e7b speedups for empty subcubes 2026-03-12 15:30:34 +10:00
conrad 9201e8ddd0 speedups for empty cubes 2026-03-12 15:23:18 +10:00
conrad 30dd62780b speedups for empty cubes 2026-03-12 12:21:15 +10:00
conrad 5dd6c665a5 speedups for empty cubes 2026-03-12 11:55:26 +10:00
conrad 2e6b4ed0a3 speedups for empty cubes 2026-03-11 17:09:31 +10:00
conrad 08c0647e54 speedups for empty matrices 2026-03-11 16:55:26 +10:00
conrad ff7f5d63e6 speedups for empty matrices 2026-03-11 15:12:59 +10:00
conrad 2288ec1497 remove superfluous comments 2026-03-11 15:12:32 +10:00
conrad 1df5fc83b7 speedups for blank sparse matrices 2026-03-10 15:58:00 +10:00
conrad 81df0a1f93 simplifications 2026-03-10 15:51:02 +10:00
conrad bceaf09865 speedups for blank sparse submatrices 2026-03-10 13:14:08 +10:00
conrad 3992546579 speedups for blank sparse submatrices 2026-03-10 12:31:16 +10:00
conrad 602f6217e0 speedups for blank sparse submatrices 2026-03-10 12:01:54 +10:00
conrad 449e6f682f speedups for blank sparse matrices 2026-03-10 11:51:20 +10:00
conrad 03df540096 fix error message 2026-03-09 13:29:19 +10:00
conrad b21700fc85 check if sizes are the same 2026-03-09 13:25:32 +10:00
conrad 02438fff53 speedups for blank sparse submatrices 2026-03-09 13:17:36 +10:00
conrad 451d5d2cec speedups for empty submatrices 2026-03-05 15:50:01 +10:00
conrad 534f135ef5 speedups for empty submatrices 2026-03-04 15:32:54 +10:00
conrad 8bd0d6692a speedups for empty subcubes 2026-03-04 15:24:34 +10:00
conrad ad1bed2686 speedups for empty submatrices 2026-02-28 14:11:47 +10:00
conrad 36e3d67a28 speedups for empty submatrices 2026-02-27 13:35:17 +10:00
conrad e3db651df7 speedup for empty submatrices 2026-02-27 13:07:40 +10:00
conrad fa52e3f5ef speedup for empty subcubes 2026-02-25 13:11:14 +10:00
conrad e6b06b21da speedup for empty matrices 2026-02-23 17:04:55 +10:00
conrad 252708e389 get pointer to first element via dedicated function 2026-02-20 13:17:43 +10:00
conrad 4b468f5009 simplifications 2026-02-20 10:47:28 +10:00
conrad 1244651dda simpler wording 2026-02-11 17:26:57 +10:00
conrad e4b96542b3 improve docs for .col_as_mat() and .row_as_mat() 2026-02-10 12:22:25 +10:00
conrad 5701dd07a8 avoid potentially confusing debug message 2026-02-05 15:21:14 +10:00
conrad bdc89797cd improved wording 2026-02-03 12:15:10 +10:00
conrad 2110b7d82c improved wording and layout 2026-02-03 11:53:05 +10:00
conrad 3bcfde3238 avoid repetition 2026-02-02 16:51:23 +10:00
conrad 3495f87581 better wording 2026-02-02 16:49:09 +10:00
conrad 8a24c0d724 expand fill types 2026-02-02 13:33:39 +10:00
conrad ec75a6107c expand docs for .fill() with notes on element initialisation during construction 2026-01-30 13:29:45 +10:00
conrad 450e1ba8a5 use explicit initialisation 2026-01-29 13:39:36 +10:00
conrad a0dcf97054 use explicit initialisation 2026-01-28 17:11:43 +10:00
conrad cd96c0d9e2 update paper 2026-01-02 12:25:10 +10:00
conrad 5e4ce67bf4 patch bump 2025-12-16 13:25:46 +10:00
conrad 7dbe9fa6c3 add LLM prohibition section 2025-12-16 13:03:19 +10:00
conrad 7da30298dd add RSL section to head 2025-12-15 14:19:05 +10:00
conrad f347a5640e simplification 2025-12-11 19:07:05 +10:00
conrad c7433b6e60 allow memory reuse with size growth 2025-12-11 16:22:29 +10:00
conrad e712b832e8 simplification 2025-12-11 15:14:55 +10:00
conrad 8a736f85a3 reuse memory where possible 2025-12-11 15:09:16 +10:00
conrad 9f8bf056c2 simplification 2025-12-11 14:20:05 +10:00
conrad b79a7e005c use explicit initialisation 2025-12-10 18:57:17 +10:00
conrad cae3a6a4bf optimise .resize() for small vectors that fit within pre-allocated memory 2025-12-10 15:12:17 +10:00
conrad fb6278f692 return early if resized matrix is empty 2025-12-10 15:11:10 +10:00
conrad 8622e81b8a faster repcube() 2025-12-10 12:31:03 +10:00
conrad f788d4032f emit more info on linker config 2025-12-10 12:28:19 +10:00
conrad c2b1eea864 patch bump 2025-11-20 00:09:55 +10:00
conrad 6eb9394e13 prevent bad line breaks 2025-11-17 23:33:52 +10:00
conrad 391a1df2e8 simplification 2025-11-17 23:30:08 +10:00
conrad 7b718b1ae9 sanitise n_threads 2025-11-12 10:43:09 +10:00
conrad bc18db7a51 use ordered clause 2025-11-09 23:42:09 +10:00
conrad 505339b6e5 rename variable 2025-11-09 22:24:17 +10:00
conrad f015fac562 set rng seed for each thread 2025-11-08 19:51:07 +10:00
conrad 502cbca4ba add internal links 2025-10-30 21:44:19 +10:00
conrad 5e5331acd4 cleanup layout 2025-10-30 20:49:25 +10:00
conrad 2dddc1367e add internal link 2025-10-30 20:45:41 +10:00
conrad 5ca720b31f simpler wording 2025-10-30 13:32:01 +10:00
conradsnicta f72922fa68 fix documentation typo 2025-10-30 00:00:52 +00:00
Ryan Curtin c18e7f0aff Fix documentation typo 2025-10-30 00:00:52 +00:00
conrad 0c40604508 patch bump 2025-10-28 12:23:57 +10:00
conrad f16c95c5c5 add internal link 2025-10-26 23:15:57 +10:00
conrad 65c42d01cd faster handling of submatrix rows 2025-10-26 20:07:38 +10:00
conrad 485b705757 version bump 2025-10-20 13:48:12 +10:00
conrad 0b77330a4d cleanup 2025-10-20 13:38:00 +10:00
conrad 4b93b36b3b sync layout with Row 2025-10-20 12:26:39 +10:00
conrad 475b97464d faster handling of row subvectors 2025-10-20 12:21:33 +10:00
conrad 09e213b8ee rename for clarity 2025-10-20 00:51:15 +10:00
conrad 16d8d9184a restore previous handling 2025-10-19 23:31:10 +10:00
conrad db9a72e616 fix 2025-10-19 23:05:54 +10:00
conrad a091e28200 add explanatory notes 2025-10-19 23:01:46 +10:00
conrad f0b85ca5f6 remove redundant increment 2025-10-19 20:20:51 +10:00
conrad df0d597efe speedup 2025-10-19 11:43:13 +10:00
conrad 43175ea30a further simplification 2025-10-19 11:23:57 +10:00
conrad 5c89440ae6 simplifications 2025-10-19 10:45:33 +10:00
conrad 6c9939308c mark as RC2 2025-10-19 01:26:39 +10:00
conrad fd42b70761 use consistent style 2025-10-19 00:46:21 +10:00
conrad edfa27d837 skip alias check if element types differ 2025-10-18 14:29:18 +10:00
conrad 1549c14df7 fiix 2025-10-18 14:15:26 +10:00
conrad 5d312b07c1 add subview_row overload 2025-10-18 14:10:01 +10:00
conrad 91b672bd1a rename variable for clarity 2025-10-18 12:02:52 +10:00
conrad 59707c1ae4 mark as RC1 2025-10-16 19:24:25 +10:00
conrad b2668ee071 remove unused typedef 2025-10-16 15:24:06 +10:00
conrad f447f144fe avoid unnecessary alias checks 2025-10-16 15:20:54 +10:00
conrad ce914cdf47 cleanup 2025-10-16 10:19:30 +10:00
conrad dc613842b1 use plain inline 2025-10-16 10:18:30 +10:00
conrad f290389fbe change to silent deprecation for now 2025-10-16 10:08:12 +10:00
conrad 3a7185c261 better wording 2025-10-16 00:46:43 +10:00
conrad c7861f1fd0 better wording 2025-10-16 00:34:18 +10:00
conrad 63763b6b63 declare functions as constexpr 2025-10-15 18:29:29 +10:00
conrad 8ebb6ac0a2 avoid unnecessary alias checks 2025-10-15 00:59:38 +10:00
conrad 5245bfc6fe avoid unnecessary alias checks 2025-10-14 19:43:14 +10:00
conrad 4f9486699c remove unused typedefs 2025-10-14 16:09:35 +10:00
conrad 9a45f6cb87 avoid unnecessary alias checks 2025-10-14 15:57:15 +10:00
conrad f232dde0e4 fix 2025-10-14 13:58:42 +10:00
conrad db7395173f allow avoiding unnecessary alias checks in Row and Col constructors 2025-10-14 13:54:28 +10:00
conrad ba2af98edf move noop check 2025-10-14 13:51:01 +10:00
conrad 0998f46768 restore previous detection of row vectors 2025-10-14 00:51:30 +10:00
conrad 1816783f33 avoid unnecessary alias checks 2025-10-14 00:44:22 +10:00
conrad c1a8093c81 update list of changes 2025-10-12 20:38:58 +10:00
conrad a50f35ea01 avoid unnecessary alias checks 2025-10-12 18:30:20 +10:00
conrad 3ac6dae148 avoid unnecessary alias checks 2025-10-12 18:25:06 +10:00
conrad 289630982c improve internal detection of vector expressions 2025-10-11 22:23:53 +10:00
conrad d0c03a8854 simplifications 2025-10-11 21:47:23 +10:00
conrad a7d1061a91 simplifications 2025-10-11 18:43:34 +10:00
conrad 51e05c104c use quasi_unwrap instead of Proxy 2025-10-11 18:31:00 +10:00
conrad 6fea1054d4 avoid unnecessary alias checks 2025-10-10 23:48:48 +10:00
conrad 1d5981c084 use quasi_unwrap instead of Proxy 2025-10-10 23:34:19 +10:00
conrad 8d75ca051d remove unused typedef 2025-10-10 23:33:49 +10:00
conrad 3d30c3c98b avoid unnecessary alias checks 2025-10-10 21:35:28 +10:00
conrad 6b9b3ee8ca avoid unnecessary alias checks 2025-10-10 13:09:07 +10:00
conrad 0d53547bd7 avoid unnecessary alias checks 2025-10-10 12:45:46 +10:00
conrad 4dbc73b36d remove unused typedef 2025-10-10 00:29:19 +10:00
conrad 2784d6c912 avoid unnecessary alias checks 2025-10-10 00:23:22 +10:00
conrad 5ea56be3b7 use quasi_unwrap instead of unwrap_check 2025-10-09 20:02:37 +10:00
conrad c33258d10c avoid unnecessary alias checks 2025-10-09 19:54:41 +10:00
conrad db0f9bb7eb avoid unnecessary alias checks 2025-10-09 13:46:36 +10:00
conrad f44ddefe87 avoid unnecessary alias checks 2025-10-09 11:47:00 +10:00
conrad 27f50ccc77 experiment with avoiding unnecessary alias checks 2025-10-09 11:10:33 +10:00
conrad cf989effe6 remove unnecessary forced inline 2025-10-08 12:56:09 +10:00
conrad b18e38ed2b remove mex_interface 2025-10-08 12:18:24 +10:00
conrad 5b8b5813dc remove unnecessary changes 2025-10-02 16:57:59 +10:00
conrad 5bafc30a2a preserve row type information in quasi_unwrap 2025-10-02 16:52:38 +10:00
conrad 7a63aad350 detect more expressions that don't need to go via Proxy 2025-10-02 00:56:31 +10:00
conrad 56b74f982e detect more expressions that don't need to go via Proxy 2025-09-30 14:06:37 +10:00
conrad 05740be686 detect more expressions that don't need to go via Proxy 2025-09-30 14:02:43 +10:00
conrad 7e67ab4d9a improve layout 2025-09-29 21:55:55 +10:00
conrad 0ad1fa65f6 use consistent layout 2025-09-29 12:50:37 +10:00
conrad 7fd68b3333 simplifications 2025-09-29 12:44:14 +10:00
conrad 356be8fdf0 better wording 2025-09-29 12:21:31 +10:00
conrad 2f0b2aaf83 add brief explanation of fill_form for Col and Row 2025-09-29 00:59:43 +10:00
conrad 355cc6adad move docs for circshift() 2025-09-27 20:55:09 +10:00
conrad a189f683c4 update shift() to circshift() 2025-09-27 13:57:14 +10:00
conrad 5b64691308 deprecate shift() 2025-09-25 13:33:51 +10:00
conrad f487d19327 detect more expressions that don't need to go via Proxy 2025-09-21 14:41:00 +10:00
conrad 544afa8b21 detect more expressions that don't need to go via Proxy 2025-09-21 14:30:38 +10:00
conrad ab6d553c18 faster handling of Row::subvec 2025-09-21 14:24:46 +10:00
conrad ec9abaf635 use quasi_unwrap for consistency with Base::print() 2025-09-19 00:34:05 +10:00
conrad d896f56e06 rearrange for consistency 2025-09-16 10:45:47 +10:00
conrad bae404906c rename variables for clarity 2025-09-16 10:40:53 +10:00
conrad 85b987e5c9 simplifications 2025-09-15 21:55:41 +10:00
conrad 0c54c27517 reduce delta 2025-09-15 15:38:34 +10:00
conrad e116139d6d update limits on integer representation of floating point values 2025-09-15 15:22:22 +10:00
conrad f441ee87b7 update limits on integer representation of floating point values 2025-09-15 15:05:15 +10:00
conrad 787654c911 use internal function 2025-09-15 10:14:57 +10:00
conrad 1bb4f5e350 add docs for rande() 2025-09-06 13:43:51 +10:00
conrad 24586267cf initial implementation of rande() 2025-09-05 23:11:30 +10:00
conrad 71142882e9 remove the now redundant stable_sort_index() 2025-09-05 16:00:33 +10:00
conrad c9f960afa9 reduce number of trials 2025-09-05 14:13:15 +10:00
conrad 50ff9c704e handle corner-case 2025-09-05 11:29:22 +10:00
conrad 86d6ae5b4c faster handling of subcubes 2025-09-05 11:27:16 +10:00
conrad 9ace567ad4 faster handling of tubes 2025-09-04 15:23:08 +10:00
conrad cdb7166177 reduce size of matrices 2025-08-30 21:33:41 +10:00
conrad 7e560dadd0 reduce number of trials 2025-08-30 21:14:57 +10:00
conrad 6ba4f99302 speedup via rudimentary openmp parallelisation 2025-08-30 21:10:49 +10:00
conrad 712596cd5e add TODO 2025-08-30 20:37:17 +10:00
conrad 7ee11c94ec add TODO 2025-08-30 20:36:21 +10:00
conrad 8d68fefa48 use threshold size of 30x30 for triggering openmp path 2025-08-30 20:33:38 +10:00
conrad cd1944d9ed simplifications 2025-08-29 16:13:05 +10:00
conrad 877568668d further rework of parallelised matrix mul 2025-08-29 15:48:58 +10:00
conrad 108adbdf97 partial rework on parallelised matrix mul 2025-08-29 14:09:27 +10:00
conrad f76cf14794 separate standard and openmp code paths 2025-08-29 12:30:56 +10:00
conradsnicta c4033d8838 rudimentary openmp based parallelisation 2025-08-29 01:10:48 +00:00
Ryan Curtin ced2325184 rudimentary openmp based parallelisation 2025-08-29 01:10:48 +00:00
conrad fe9a74bf75 mark as unstable 2025-08-26 10:58:20 +10:00
conrad 6ddb55c173 patch bump 2025-08-22 15:56:39 +10:00
conrad c029b2a22f use generic function as omp simd seems to have no effect 2025-08-22 11:59:03 +10:00
conrad 8a9f6482bd use pragma omp simd instead of gcc function attribute 2025-08-22 10:58:31 +10:00
conrad bae84c796b allow repcube() to use matrices 2025-08-21 23:49:45 +10:00
conrad 4b0636d0d8 version bummp 2025-08-21 15:14:18 +10:00
conrad cbbf66efc8 add TODO 2025-08-21 14:51:08 +10:00
conrad 3a23c33fad update list of additions 2025-08-21 14:19:28 +10:00
conrad 7de06ecddf add docs for repcube() 2025-08-21 14:15:33 +10:00
conrad d59269511f initial version of repcube() 2025-08-21 13:57:18 +10:00
conrad 38795499cc expand debugging to print element type 2025-08-21 12:01:35 +10:00
conrad f5ebe93f9f rearrange 2025-08-20 18:09:36 +10:00
conrad 8ffcf5383e add TODOs 2025-08-20 18:05:07 +10:00
conrad fdd94a2c81 update group name 2025-08-20 13:59:13 +10:00
conrad 2ca675d242 rename 2025-08-20 13:27:06 +10:00
conrad 9d5cfe2016 use Proxy for compound expressions 2025-08-20 13:17:57 +10:00
conrad 9e1a000e4b check for aliasing only if element types are the same 2025-08-20 12:34:09 +10:00
conrad e10f142788 expand eps() to handle cubes 2025-08-20 12:33:36 +10:00
conrad 4639edc493 return only real for cx inputs 2025-08-20 00:56:11 +10:00
conrad fcd771fda7 sort out the eps() mess 2025-08-20 00:44:22 +10:00
conrad e22c9e7cff update list of functions with optimisation for symmetric matrices 2025-08-19 15:16:06 +10:00
conrad 69bd3b3693 rearrange order 2025-08-19 13:52:33 +10:00
conrad 75c40c6549 cleanup 2025-08-18 16:56:07 +10:00
conrad d44d24fd97 update list of changes 2025-08-18 16:50:56 +10:00
conrad 534b3ab79c better wording 2025-08-18 16:44:11 +10:00
conrad b247c9618e handle corner cases 2025-08-18 16:26:53 +10:00
conrad 17f02679a9 reduce delta 2025-08-18 15:56:57 +10:00
conrad 88fdc045cd add TODOs 2025-08-18 10:43:28 +10:00
conrad 4d2e63c686 fix 2025-08-18 10:39:14 +10:00
conradsnicta e073e64481 add 'valid' convolution mode 2025-08-18 00:35:45 +00:00
Zachary Ng a7a92724d5 add 'valid' convolution mode 2025-08-18 00:35:45 +00:00
conrad 27a9de7f7d simplification 2025-08-16 16:28:14 +10:00
conrad 2eb4bcb4f3 better layout 2025-08-15 13:57:20 +10:00
conrad f95602aba2 add workaround from upstream catch2 repo 2025-08-15 11:32:37 +10:00
conrad 5b65d1ad2a update list of changes 2025-08-14 20:12:07 +10:00
conrad 6b45328103 layout fixes 2025-08-14 20:08:15 +10:00
conrad 2be7d8c60f expand docs for cond() 2025-08-14 20:03:24 +10:00
conrad e14cc6fac1 add secondary form of cond() 2025-08-14 19:48:24 +10:00
conrad 1ccc7dbd73 fallback to generic method if symmetric/hermitian optimisation failed 2025-08-14 19:43:08 +10:00
conrad f3cc6c475a bump to openmp 4.0 2025-08-14 16:52:23 +10:00
conrad db550a6579 use _OPENMP corresponding to OpenMP 4.0 2025-08-14 15:12:23 +10:00
conrad 5b88b2323a fallback to generic method if symmetric/hermitian optimisation failed 2025-08-14 00:20:59 +10:00
conrad 28ac91cb67 fallback to generic method if symmetric/hermitian optimisation failed 2025-08-14 00:08:33 +10:00
conrad 83452a0627 require OpenMP 4.0 for seq_cst memory order clause 2025-08-13 18:18:33 +10:00
conrad c5cc28a737 change to struct 2025-08-13 18:16:44 +10:00
conrad 9f785eff7e use seq_cst for openmp atomic read/write 2025-08-13 00:19:45 +10:00
conrad cc89707913 update description 2025-08-12 15:34:27 +10:00
conrad 1a46e0e83b update list of changes 2025-08-11 18:58:39 +10:00
conrad 39db5b5095 update docs for wall_clock 2025-08-11 18:52:20 +10:00
conrad efc2bcf316 rearrange 2025-08-11 18:35:11 +10:00
conrad e38cbaab8e handle corner case where tic() is reused 2025-08-11 18:33:09 +10:00
conrad a30ad16ebe rename warm() to unfreeze() 2025-08-11 18:25:11 +10:00
conrad d0da492c26 use type promotion for fp16 version of mat_norm_2() 2025-08-11 17:11:17 +10:00
conrad 3f5d4784fc add freeze() and warm() 2025-08-11 17:03:00 +10:00
conrad 7a15d37a99 simplifications 2025-08-11 14:32:48 +10:00
conrad 1e40f043ff use constexpr 2025-08-11 01:09:38 +10:00
conrad 21f2bf28d2 simplification 2025-08-11 00:51:52 +10:00
conrad 4a5c3d8f27 rearrange 2025-08-11 00:48:59 +10:00
conrad 2b49392e7c remove no longer needed macros 2025-08-09 23:32:25 +10:00
conrad 26dcdbbf0a add explanation 2025-08-09 23:28:59 +10:00
conrad 16b0912a6f use C++14 deprecation attributes directly 2025-08-09 23:22:55 +10:00
conrad 644cc2908a allow testing of cx_fp16 2025-08-08 20:34:29 +10:00
conrad bfdb9b4d1c update to https 2025-08-08 20:26:16 +10:00
conrad b3b260c00c update to https 2025-08-08 20:22:21 +10:00
conrad 6991c9aa25 update to https 2025-08-08 20:20:21 +10:00
conrad e8027c3e14 update to https 2025-08-08 20:17:18 +10:00
conrad 3a719ad581 update to https 2025-08-08 20:14:01 +10:00
conrad 012acbea12 update to https 2025-08-08 20:13:15 +10:00
conrad 8f89982b74 update to https 2025-08-08 20:10:25 +10:00
conrad 3f6aee0ccb update command line example 2025-08-08 20:08:33 +10:00
conrad b2489b2d87 rename variable for overall consistency 2025-08-08 20:05:37 +10:00
conrad 925d5c7318 update to openblas 0.3.30 2025-08-08 14:44:36 +10:00
conrad 3de20fe5cb fix 2025-08-07 22:53:15 +10:00
conrad dd1be88826 use forced optimisation for fp16 dot products 2025-08-07 16:35:02 +10:00
conrad 0c8e97e10e use type promotion only where necessary 2025-08-07 16:02:57 +10:00
conrad fa4b928937 remove no longer needed function 2025-08-07 14:57:44 +10:00
conrad 4001efe359 strip out type promotion 2025-08-07 14:56:29 +10:00
conrad c294a16d84 strip out type promotion 2025-08-07 14:52:13 +10:00
conrad 28670b8854 minor cleanup 2025-08-07 14:18:09 +10:00
conrad c5613778a8 strip out type promotion 2025-08-07 14:17:32 +10:00
conrad d7d3326003 add note on speed issues with the F16C instruction set 2025-08-07 13:19:22 +10:00
conrad 2c60189b8f use namespace prefix 2025-08-06 23:14:19 +10:00
conrad 3cfd3f90b4 rearrange 2025-08-06 23:02:41 +10:00
conrad db49fc5bb5 add handling of cx_fp16 2025-08-06 22:58:17 +10:00
conrad 2eb334e0ab increase accuracy for fp16 2025-08-06 14:29:11 +10:00
conrad 52cd25c365 increase accuracy for fp16 2025-08-06 14:12:15 +10:00
conrad 43786efafe better handling of fp16 via type promotion in vec_norm_1 2025-08-06 13:30:41 +10:00
conrad 624da4833a better handling of fp16 via type promotion in op_norm_dot 2025-08-06 13:01:02 +10:00
conrad 5bf5668272 better handling of fp16 via type promotion in vec_norm_2 2025-08-06 12:41:52 +10:00
conrad c94b17927c use type promotion for fp16 elements 2025-08-06 10:36:07 +10:00
conrad d5e8bae784 implement mat_norm_2() for fp16 via type promoted matrix 2025-08-05 11:30:13 +10:00
conrad 567d6ccd2c rearrange 2025-08-04 23:55:51 +10:00
conrad 7eca200236 add promote variant of direct_mean_robust() 2025-08-04 23:52:48 +10:00
conrad e7b39cf480 add type promotion variant for optimised handling of sum(square(X)) 2025-08-04 21:31:23 +10:00
conrad 51d4f2e898 more efficient row-wise summation with promotion 2025-08-04 20:54:54 +10:00
conrad 8047a5f342 use type promotion for fp16 2025-08-04 17:06:11 +10:00
conrad 600642f829 simplifications 2025-08-04 15:52:34 +10:00
conrad 9d68301372 use promoted type instead of specialising for fp16 2025-08-04 15:19:43 +10:00
conrad 20ca20b31b expand specialised handling of fp16 2025-08-01 13:01:09 +10:00
conrad 972f2f648f simplification 2025-07-30 12:16:24 +10:00
conrad 273b91efab rename op_accu_fp16mat to op_accu_mat_promote 2025-07-30 12:12:45 +10:00
conrad c3b3a42f46 add specialisations for Proxy 2025-07-30 12:09:45 +10:00
conrad 8bf1eb2af8 reduce compiler processing when fp16 is not available 2025-07-30 11:39:36 +10:00
conrad 9072a2f7c8 place-holder implementation of specialised accu() for fp16 2025-07-30 00:19:41 +10:00
conrad 8abea07d35 simplify handling of openmp 2025-07-29 23:28:51 +10:00
conrad 2fe2b5fa36 fix group names 2025-07-29 23:07:37 +10:00
conrad aba91e9610 refactor accu() into op_accu and spop_accu 2025-07-29 22:43:11 +10:00
conrad 72f7db891f simplification 2025-07-28 13:06:21 +10:00
conrad 89e7703875 specialisation for fp16 2025-07-28 12:56:45 +10:00
conrad 276c968a6b use type promotion for op_cdot 2025-07-28 12:12:29 +10:00
conrad 1e3001be06 type promote components instead of just the result 2025-07-28 12:04:22 +10:00
conrad 648710482d use more precise traits 2025-07-28 01:03:30 +10:00
conrad 839f895bbb use semantically more precise traits 2025-07-28 00:27:33 +10:00
conrad 866dcdbd2c use conditional promotion of accumulator type instead of specialised functions 2025-07-27 19:05:39 +10:00
conrad 723676eb7f use at least float for accumulator in dot products involving compound expressions 2025-07-27 18:31:46 +10:00
conrad 6b63c96af1 use dot products specialised for fp16 2025-07-27 17:51:49 +10:00
conrad 35f3394324 enable more tests 2025-07-26 00:58:58 +10:00
conrad 39be977b55 check aliasing only if element types are the same 2025-07-26 00:32:59 +10:00
conrad 95fda0d2e3 combine cond_rel function definitons and bodies into one file 2025-07-26 00:16:37 +10:00
conrad 3f577dc19c use constexpr instead of forced inline 2025-07-26 00:02:39 +10:00
conrad c9d547c862 use constexpr instead of forced inline 2025-07-25 23:39:48 +10:00
conrad 854d470c63 simplifications 2025-07-25 20:53:21 +10:00
conrad 4af55d5abb simplifications 2025-07-25 16:26:29 +10:00
conrad 13e400d50e simplifications 2025-07-25 13:56:47 +10:00
conrad e798206b1a use constexpr instead of forced inline 2025-07-24 00:36:00 +10:00
conrad 9302d2911b don't use divide-and-conquer when matrix size is too large for LAPACK with 32 bit ints 2025-07-23 23:44:43 +10:00
conrad e727967b39 use void_ptr instead of (void*) 2025-07-23 15:51:38 +10:00
conrad 92837026c3 add __has_include guards around headers that may not be present 2025-07-23 15:31:57 +10:00
conrad c28db14b6f note that fp16 is not the same as bfloat16 2025-07-23 13:17:33 +10:00
conrad e218004dbf specify that hardware support for fp16 via F16C is rudimentary 2025-07-23 13:07:13 +10:00
conrad 583efe0eb0 simplification 2025-07-23 12:58:00 +10:00
conrad 59fccc4457 also use __F16C__ to indicate hardware support for fp16 2025-07-23 12:55:25 +10:00
conrad 0bb7d88a3e more informative warnings 2025-07-23 12:00:50 +10:00
conrad 03ee00c429 simplifications 2025-07-22 18:22:46 +10:00
conrad 24dd81d2cc add -march=native to CXXFLAGS 2025-07-22 14:03:01 +10:00
conrad d37ef70517 change 'fp16_' prefix in matrix typedefs to 'h' 2025-07-22 14:00:27 +10:00
conrad 52b563703e fix typo 2025-07-22 00:50:17 +10:00
conrad 08817332b7 rename shift to circshift 2025-07-21 12:56:21 +10:00
conrad 34722ecab1 rename shift to circshift 2025-07-21 12:52:41 +10:00
conrad a3a1372972 add circshift() versions of shift() 2025-07-21 12:47:41 +10:00
conrad 87f74241f7 show sylvester() instead of deprecatated syl() 2025-07-21 11:44:08 +10:00
conrad 9237785486 remove long deprecated options 2025-07-19 21:38:48 +10:00
conrad 4fecf1e97f bump to C++14 2025-07-18 22:36:58 +10:00
conrad 0c9034e3b9 expanded list of changes 2025-07-18 22:25:37 +10:00
conrad b0b031e152 cleanups 2025-07-18 22:23:27 +10:00
conrad 9e084f7dab use forced optimisation when BLAS is not available 2025-07-18 14:20:21 +10:00
conrad cce74c0e49 use direct_dot() instead of direct_dot_generic() since the former can now detect integer types 2025-07-18 14:20:01 +10:00
conrad 0db44c0fa8 use forced optimisation only for fp16 2025-07-18 14:09:27 +10:00
conrad fb2fd4a049 split direct_dot_generic() into direct_dot_generic_short() and direct_dot_generic_long() 2025-07-18 11:44:59 +10:00
conrad 996bb45534 rename direct_dot_arma() to direct_dot_generic() 2025-07-18 11:13:51 +10:00
conrad 0601761cf2 add handling of cx_fp16 2025-07-18 00:11:38 +10:00
conrad 084a695129 add TODO 2025-07-17 18:37:42 +10:00
conrad 344f123ac4 add warning message 2025-07-17 18:33:37 +10:00
conrad deaf5c413a don't use divide-and-conquer when matrix size is too large for LAPACK with 32 bit ints 2025-07-17 18:31:14 +10:00
conrad 9fcd2f3449 add TODOs 2025-07-17 17:06:22 +10:00
conrad 71eeb56cee add TODOs 2025-07-17 17:00:20 +10:00
conrad a135bbcb94 remove no longer used variable 2025-07-17 16:58:19 +10:00
conrad 5f334da813 don't use divide-and-conquer when matrix size is too large for LAPACK with 32 bit ints 2025-07-17 16:54:41 +10:00
conrad ad478221e1 don't use divide-and-conquer when matrix size is too large for LAPACK with 32 bit ints 2025-07-17 14:38:58 +10:00
conrad 7dc07e12b2 partial revert 2025-07-16 17:05:18 +10:00
conrad 8c295b058e use constexpr for 0 2025-07-16 16:58:59 +10:00
conrad 0e117986aa simplification 2025-07-16 16:34:40 +10:00
conrad 9c9a25f7f6 force vectorisation of direct_dot_arma() under GCC 2025-07-16 15:17:48 +10:00
conrad 15e03f9bac remove forced inline 2025-07-16 14:21:52 +10:00
conrad 484acbecd6 simplification 2025-07-16 14:18:28 +10:00
conrad a8200a6bb5 minor spacing fix 2025-07-16 13:00:45 +10:00
conrad 511ce72db2 add docs for ARMA_DONT_OPTIMISE_POWEXPR 2025-07-16 12:59:45 +10:00
conrad 677bdb3bad swap order to ensure consistency with previous version 2025-07-14 14:55:45 +10:00
conrad 79f6b87781 fix 2025-07-14 14:28:15 +10:00
conrad 39b2a52bd0 allow to optionally disable optimised handling of pow() 2025-07-14 14:02:19 +10:00
conrad ac3fcabca8 simplifications 2025-07-14 13:29:53 +10:00
conrad 4aaf66547e compile time note that ARMA_CRIPPLED_LAPACK is not supported 2025-07-14 13:20:12 +10:00
conrad d676e4cfa2 remove handling of ARMA_CRIPPLED_LAPACK 2025-07-14 13:17:56 +10:00
conrad 3b1ac86a9f remove auxlib::crippled_lapack() 2025-07-14 13:07:00 +10:00
conrad 460e13a272 expand handling of fp16 and cx_fp16 2025-07-12 23:44:53 +10:00
conrad ef4c5a7844 ensure blas cx type only 2025-07-12 21:25:29 +10:00
conrad d8f31aa94f prevent shadow warnings 2025-07-12 19:38:34 +10:00
conrad 382b0f02d6 add docs for ARMA_FORCE_USE_FP16 and ARMA_DONT_USE_FP16 2025-07-12 19:27:32 +10:00
conrad 5155b0bb38 add ARMA_DONT_USE_FP16 option 2025-07-12 19:08:58 +10:00
conrad 69d6fc1319 better wording 2025-07-12 18:56:13 +10:00
conrad d9d5098203 rework fp16 related docs 2025-07-12 18:50:22 +10:00
conrad bfb650ea5d fix 2025-07-12 11:21:31 +10:00
conrad 7369ee1086 allow use of fp16 with fft functions 2025-07-12 00:04:15 +10:00
conrad f06c6ab8f8 rename arma_is_blas_type_only to arma_is_real_or_cx_only for consistency 2025-07-11 23:46:23 +10:00
conrad 206606d40d rename arma_fp16_only to arma_fp16_real_only 2025-07-11 23:24:37 +10:00
conrad 1e731455ec fix 2025-07-11 23:21:08 +10:00
conrad c87cf374c4 add support for cx_fp16 2025-07-11 23:14:44 +10:00
conrad bbe5dcf225 add is_blas_cx trait 2025-07-11 20:45:49 +10:00
conrad 6fd1531d80 enable saving/loading sparse fp16 2025-07-11 20:41:59 +10:00
conrad 30ee79ee37 enable fp16 support for SpMat 2025-07-11 16:06:01 +10:00
conrad 9264db2876 fix 2025-07-10 15:34:34 +10:00
conrad 35668ad125 limit to supported blas types only 2025-07-10 15:18:46 +10:00
conrad 4e6392f0c2 replace is_supported_blas_type with is_blas_type 2025-07-10 14:57:30 +10:00
conrad 5f833e68ce explicitly limit is_cx to std::complex<float> and std::complex<double> 2025-07-10 14:53:32 +10:00
conrad 28d1515afa rearrange order of links 2025-07-09 14:23:45 +10:00
conrad 0820f68e69 restrict to blas real types only 2025-07-09 14:05:48 +10:00
conrad c3db1ead03 ensure junk args are const and are explicitly ignored 2025-07-09 13:48:27 +10:00
conrad 7dadab9eb1 add stub mat_norm_2() for fp16 2025-07-09 13:42:00 +10:00
conrad 46de13b363 use std::uniform_real_distribution with promoted type 2025-07-08 23:32:03 +10:00
conrad 98df75f7d7 simplifications 2025-07-07 23:45:27 +10:00
conrad 91065683da minor layout fixes 2025-07-07 23:29:11 +10:00
conrad ee663d08f6 remove outdated comments 2025-07-07 21:37:13 +10:00
conrad d3c2a9ebd0 add option to test fp16 2025-07-07 21:34:58 +10:00
conrad 35610a4944 simplifications 2025-07-07 20:26:34 +10:00
conrad c2175c86ee C++23 required for fp16 support 2025-07-07 20:14:29 +10:00
conrad 8239b26f62 use only std::float16_t as fp16 2025-07-07 20:04:50 +10:00
conrad a32600ae17 fix 2025-07-07 17:06:31 +10:00
conrad 15ffdaf72a fix 2025-07-07 17:06:19 +10:00
conrad edbe0c1ed5 clarifications 2025-07-07 17:04:19 +10:00
conrad 168e9b9e36 extend debug info for fp16 2025-07-07 16:33:46 +10:00
conrad 4ce154033a simplifications 2025-07-07 16:24:07 +10:00
conrad 8155fe8b26 add fp16 extension of arma_isnonfinite() 2025-07-07 15:57:28 +10:00
conrad 2671a1c8d0 various fixes 2025-07-07 15:06:59 +10:00
conrad 7e2378d1a0 better wording 2025-07-07 14:47:05 +10:00
conrad 9dea1a92be fix layout 2025-07-07 14:11:21 +10:00
conradsnicta bfd7c162f3 Merge branch 'add-fp16-bf16' into 'experimental'
Initial FP16 support

See merge request conradsnicta/armadillo-code!141
2025-07-07 04:00:20 +00:00
Ryan Curtin f07af5a111 Initial FP16 support 2025-07-07 04:00:20 +00:00
conrad d53fcc7e9e speedup 2025-07-05 01:51:18 +10:00
conrad 252d43ae35 cleanup 2025-07-04 13:32:01 +10:00
conrad 8e154ddd13 better wording 2025-07-04 13:13:09 +10:00
conrad feb342fcc1 compile time note about no longer supported options 2025-07-04 13:00:42 +10:00
conrad a57df05fd0 use C++14 features by default 2025-07-03 15:55:34 +10:00
conrad 8039076f07 expand deprecation message with refactoring suggestion 2025-07-03 15:50:30 +10:00
conrad 00d75f3962 remove ARMA_IGNORE_DEPRECATED_MARKER option 2025-07-03 12:24:09 +10:00
conrad 9f8a5cba11 fix 2025-07-01 12:37:08 +10:00
conrad 78aeb5401b bump experimental version 2025-06-30 20:11:43 +10:00
conrad f06e5ce249 add changelog block for next version 2025-06-30 19:38:07 +10:00
conrad b1a9f62bc5 cleanup 2025-06-30 19:34:10 +10:00
conrad 25e0945a29 bump min required C++ standard to C++14 2025-06-30 19:28:06 +10:00
conrad 562ea70276 bump experimental version 2025-06-30 19:12:49 +10:00
conrad 5765ef2909 cleanup 2025-06-30 12:31:26 +10:00
conrad fd2b724040 rename accumulator variable for clarity 2025-06-29 23:06:46 +10:00
conrad e7bd7e4e18 return early if there are no non-zero elements 2025-06-29 22:52:33 +10:00
conrad a902935f11 avoid going through SpProxy unless necessary 2025-06-29 00:38:05 +10:00
conrad 1907b8799e fix debug messages 2025-06-29 00:28:42 +10:00
conrad 9782878612 minor optimisation 2025-06-29 00:22:24 +10:00
conrad b94080a168 specialised handling of spop_omit 2025-06-29 00:10:36 +10:00
conrad ada1e18e45 split out handling of spop_square into separate function 2025-06-28 19:16:24 +10:00
conrad bd26d90563 fix example 2025-06-28 15:40:57 +10:00
conrad 447d66758e simplification 2025-06-28 14:21:09 +10:00
conrad d242d1d3d7 add internal link 2025-06-28 14:13:26 +10:00
conrad e7e189c012 add internal links 2025-06-28 13:46:08 +10:00
conrad 256e1d6e88 use consistent wording for infinity 2025-06-28 13:15:49 +10:00
conrad 6952ca11d5 add caveat 2025-06-28 13:09:27 +10:00
conrad 4ec76d5211 simplifications 2025-06-28 13:03:54 +10:00
conrad 05670bfc64 better wording 2025-06-28 12:56:43 +10:00
conrad 29f4f10118 emit warnings when using fast math mode 2025-06-24 18:48:44 +10:00
conrad e5663df8fa specialised handling for op_omit_cube 2025-06-24 18:42:01 +10:00
conrad cefb070832 initial implementation of op_omit_cube 2025-06-24 18:24:26 +10:00
conrad 2f9829c777 better wording 2025-06-24 12:00:48 +10:00
conrad 78dbddf2e9 emit warnings when using fast math mode 2025-06-24 11:05:36 +10:00
conrad 9318a5df61 ensure consistent expression style 2025-06-24 10:55:54 +10:00
conrad 8e65bd7d21 fix wording 2025-06-24 01:02:35 +10:00
conrad 42022c75e3 initial docs for omit_nan() and omit_nonfinite() 2025-06-23 14:18:33 +10:00
conrad 869c46e39b remove elem_opts 2025-06-23 12:59:12 +10:00
conrad 3199376bbf simplify 'arma_isfinite(x) == false' to 'arma_isnonfinite(x)' 2025-06-20 13:03:29 +10:00
conrad a93c67cc34 update deprecation comments 2025-06-19 16:55:03 +10:00
conrad 753e1e23c7 initial implementation of spop_omit 2025-06-19 14:39:25 +10:00
conrad 021403a5c1 specialised handling of op_omit 2025-06-19 13:25:50 +10:00
conrad 402a453065 initial implementation of omit_nan() and omit_nonfinite() 2025-06-17 21:30:58 +10:00
conrad 5b05fb843d initial implementation of omit_nan() and omit_nonfinite() 2025-06-17 21:30:38 +10:00
conrad 772addf5c1 restore previous behaviour 2025-06-12 19:04:38 +10:00
conrad c08e594437 fix 2025-06-12 14:21:14 +10:00
conrad 9797ad1cad simplifications 2025-06-12 14:18:08 +10:00
conrad b260cdaa58 remove detection of NaN from plain versions of median() 2025-06-12 14:12:32 +10:00
conrad e83cb29013 add median() variant to handle elem_opts 2025-06-12 13:55:48 +10:00
conrad 48e19f8e50 fix 2025-06-11 21:45:30 +10:00
conrad 4e02904b18 add stddev() variant to handle elem_opts 2025-06-11 19:44:43 +10:00
conrad bd1bd14831 fix 2025-06-11 19:21:52 +10:00
conrad 74feb70896 simplifications 2025-06-11 19:08:07 +10:00
conrad 48a33a1fc3 use original option name for now 2025-06-11 15:35:14 +10:00
conrad 36a5188083 minor cleanup 2025-06-11 15:22:03 +10:00
conrad 0731de2367 simplifications 2025-06-11 15:04:22 +10:00
conrad 91b5f68bed fix 2025-06-11 13:45:41 +10:00
conrad a290735187 simplifications 2025-06-11 13:32:47 +10:00
conrad 4b4ab0ced8 add var() variant to handle elem_opts 2025-06-11 13:27:22 +10:00
conrad 7faec6fdce simplifications 2025-06-10 19:30:19 +10:00
conrad 696fd719e8 simplify use of podarray 2025-06-10 19:23:56 +10:00
conrad aa0c021737 simplifications 2025-06-10 19:00:27 +10:00
conrad 682790d0bc started on op_var_omit 2025-06-10 11:39:26 +10:00
conrad 47a0e466e7 add TODO 2025-06-10 11:29:23 +10:00
conrad 8842cdc739 directly handle corner cases 2025-06-09 22:14:08 +10:00
conrad 870414aa06 simplifications 2025-06-09 21:48:48 +10:00
conrad 7b03681ce7 simplifications 2025-06-09 20:10:50 +10:00
conrad a80f63501b expand cube versions of accu() and sum() to handle elem_opts 2025-06-08 21:50:29 +10:00
conrad 6556e4ae04 rearrange 2025-06-08 20:45:28 +10:00
conrad 648527eb1b rearrange 2025-06-08 19:27:36 +10:00
conrad 4a848124fa expand sparse versions of accu() and sum() to handle elem_opts 2025-06-08 15:24:39 +10:00
conrad 39d01b483e remove unused typedef 2025-06-08 15:21:03 +10:00
conrad 03e92c43ba expand op_mean_omit to general matrices 2025-06-08 01:23:11 +10:00
conrad bdf448e8f0 fix 2025-06-07 21:20:39 +10:00
conrad d0dfac1a32 simplification 2025-06-07 20:29:29 +10:00
conrad d057c221d8 simplifications + fix handling of inf corner case 2025-06-07 18:10:33 +10:00
conrad 83bb1e7937 add TODOs 2025-06-06 13:23:48 +10:00
conrad bdc82c2c76 initial work on op_mean_omit 2025-06-06 13:09:39 +10:00
conrad 3cfec929f6 use arma_isnonfinite() for semantic simplification 2025-06-06 13:04:45 +10:00
conrad 74720f366d expand sum() with omit_mode 2025-06-05 13:55:41 +10:00
conrad 65012ac724 use more flexible omit_mode 2025-06-05 12:26:31 +10:00
conrad 7b0ce7088e add accu() variant that can omit nan values 2025-06-04 13:18:03 +10:00
conrad d2930a2763 fix 2025-06-04 13:01:05 +10:00
conrad 9ef5f44c53 expand deprecation message with refactoring suggestion 2025-06-03 14:16:25 +10:00
conrad 6b79e17ec3 use batch random generation to avoid locking rng for each random number 2025-06-02 17:02:33 +10:00
conrad eaf7825044 add randu() and randn() 2025-06-02 16:55:59 +10:00
conrad 365eca0c16 use batch random generation to avoid locking rng for each random number 2025-06-02 16:24:06 +10:00
conrad 096591bafb add TODOs 2025-06-02 13:58:56 +10:00
conrad 68e9cf2a01 use batch random generation to avoid locking rng for each random number 2025-06-02 13:34:10 +10:00
conrad 36a2e4eed4 use batch random generation to avoid locking rng for each random number 2025-06-02 13:19:08 +10:00
conrad 7e7fff181b always use stable sort for sorting indices 2025-05-29 20:01:54 +10:00
conrad 91319547c4 use consistent layout 2025-05-29 19:44:12 +10:00
conrad 6288784171 resolve complex number ties 2025-05-29 19:40:55 +10:00
conrad 74eb504435 use stable sort for sort_index() 2025-05-29 18:17:43 +10:00
conrad 7e63c9f48c add docs for standalone replace() 2025-05-28 13:59:28 +10:00
conrad 5560281526 add standalone replace() 2025-05-24 16:23:03 +10:00
conrad 9d04feb8c3 add dual aux constructor 2025-05-24 16:21:17 +10:00
conrad 47d576fc76 add debug info 2025-05-24 15:40:07 +10:00
conrad c0bf9d5262 group docs for find_finite() + find_nonfinite() and find_nan() + find_nonnan() 2025-05-23 12:35:23 +10:00
conradsnicta 8f74c350ce Merge branch 'fn_find_nonnan' into 'experimental'
Add `fn_find_nonnan()`

See merge request conradsnicta/armadillo-code!140
2025-05-23 01:40:16 +00:00
Ryan Curtin c9425f3158 Add fn_find_nonnan() 2025-05-23 01:40:16 +00:00
conrad 4e7a567967 simplifications 2025-05-22 13:29:39 +10:00
conrad 84ec3ddf9f bump minimum gcc version to 8.1 2025-05-22 13:18:10 +10:00
conrad 0138a5b699 similar optimisation as spglue_schur 2025-05-21 10:11:43 +10:00
conrad 623eb2915d take into account possible inf and nan 2025-05-20 22:27:38 +10:00
conrad f845134e58 restore previous attributes due to false positives in gcc 14.2 2025-05-20 13:49:20 +10:00
conrad 014e11aa5b remove no longer needed typedef 2025-05-20 13:20:10 +10:00
conrad 9f9a93e5e8 fix comment 2025-05-20 13:02:04 +10:00
conrad 636b8f8cf0 optimisation for empty matrices 2025-05-20 12:45:16 +10:00
conrad d1f296eaca simplification 2025-05-20 12:26:18 +10:00
conrad fb5ee6fa0b take into account possible inf and nan 2025-05-20 11:13:31 +10:00
conrad 28c3cd7e54 take into account possible inf and nan 2025-05-20 01:26:58 +10:00
conrad 69e7c73b34 take into account inf and nan 2025-05-20 01:03:12 +10:00
conrad 6fd0ff0d0f minor layout fix 2025-05-19 12:49:13 +10:00
conrad 7e88739a41 simplification 2025-05-19 12:30:41 +10:00
conrad 0bc9d1b2d6 add explanatory comments 2025-05-19 12:22:25 +10:00
conrad e8b7efceba fix handling of corner-cases with nan and inf 2025-05-18 23:25:26 +10:00
conrad 7fda8d02b0 add details 2025-05-18 16:23:26 +10:00
conrad fe3c943543 add details on unsuppported option 2025-05-15 13:30:37 +10:00
conrad 72838eb1df better wording 2025-05-14 13:13:41 +10:00
conrad 2bf91c9159 use .is_finite() 2025-05-13 16:21:26 +10:00
conrad c8c64e614e conditionally undefine ARMA_IGNORE_DEPRECATED_MARKER 2025-05-13 00:29:45 +10:00
conrad 5ff113d8b1 add DOI 2025-05-12 23:30:48 +10:00
conrad bebbf30075 deprecated syl() in favour of sylvester() 2025-05-09 10:54:26 +10:00
conrad 5b05448d69 speedup for accu(square(sp_mat.col(i))) 2025-05-09 00:41:28 +10:00
conrad c0ef238433 deprecate stand-alone is_finite() 2025-05-07 12:45:44 +10:00
conrad e662f86944 add TODOs 2025-05-07 12:24:39 +10:00
conrad 57da508cf3 issue compile time warning for unused outputs 2025-05-02 13:46:08 +10:00
conrad 9ac38a895c mark as experimental 2025-04-26 21:46:56 +10:00
conrad ed840ebb2d use std:: prefix 2025-04-26 00:29:25 +10:00
conrad 1c41747d9c update pdf 2025-04-25 23:56:56 +10:00
conrad dd0aeff3f1 remove old papers 2025-04-25 23:51:16 +10:00
conrad 2186acc08f workaround for bugs in clang 20.1 2025-04-24 15:15:37 +10:00
conrad a2aa0f361a rearrange 2025-04-23 16:15:18 +10:00
conrad 756cebff72 embed icon image into html 2025-04-23 14:47:45 +10:00
conrad e767844a07 add compile time warning 2025-04-23 14:11:27 +10:00
conrad 57b7cec007 better wording 2025-04-23 13:28:54 +10:00
conrad f3bf7bc683 add debug statement 2025-04-23 12:34:15 +10:00
conrad a3bd59ddac cleanup 2025-04-23 11:22:38 +10:00
conrad 82e715f2cf clamp exponent 2025-04-23 01:27:10 +10:00
conrad eb8ea83e11 proposed fix 2025-04-23 01:17:26 +10:00
conrad bd912040a5 bump min version of cmake 2025-04-22 15:37:01 +10:00
conrad f696ac0e4b bump min version of cmake 2025-04-22 15:36:37 +10:00
conrad 616b01448f update list of publications 2025-04-22 15:10:11 +10:00
conrad c71edbf5e5 fixes 2025-04-22 12:51:38 +10:00
conrad 82b3972cae add docs for ARMA_SUPERLU_64BIT_INT 2025-04-22 12:47:42 +10:00
conrad 982aaf0993 update list of supported superlu versions 2025-04-22 12:27:00 +10:00
conrad 25ba9a0ca5 state ARMA_BLAS_64BIT_INT 2025-04-22 12:24:03 +10:00
conrad 740601a431 state ARMA_BLAS_64BIT_INT 2025-04-22 12:20:41 +10:00
conrad 45423128a9 more robust handling of trace reduction 2025-04-20 22:21:35 +10:00
conrad acd6552307 add trace reduction 2025-04-20 16:44:53 +10:00
conrad 085731e77c increase number of terms 2025-04-20 16:31:59 +10:00
conrad f3c1248095 allow detection of superlu 5 to 7 2025-04-19 13:33:36 +10:00
conrad 996b226da5 rename 2025-04-19 13:10:34 +10:00
conrad 3c0be74876 refactor to use superlu 7 2025-04-18 16:46:01 +10:00
conrad aec53c9445 simplifications 2025-04-18 14:36:02 +10:00
conrad 3105fb0bd2 change error to warning 2025-04-16 00:23:18 +10:00
conrad c2852a268d simplifications 2025-04-11 11:51:35 +10:00
conrad b0da624def update docs for balance() 2025-04-09 17:22:55 +10:00
conrad 03a3efe988 update docs for balance() 2025-04-09 17:20:07 +10:00
conrad 35ba4266cd rename variables 2025-04-09 17:15:49 +10:00
conrad 45da4eee4f initial docs for balance() 2025-04-09 16:57:20 +10:00
conrad 90a67c55f2 move docs for affmul() 2025-04-08 16:06:36 +10:00
conrad 6346373654 prevent compiler warnings 2025-04-07 15:03:11 +10:00
conrad 7178d9715b more debug statements 2025-04-07 14:52:47 +10:00
conrad 46fe21ae0d improve docs for element access via better ordering 2025-04-07 14:35:49 +10:00
conrad fc412ae23d initial implementation of balance() 2025-04-04 23:06:36 +10:00
conrad bc745128ef add interfaces to xGEBAL 2025-04-04 14:46:49 +10:00
conrad d2c7718e96 document ARMA_BLAS_64BIT_INT 2025-04-01 13:21:33 +10:00
conrad 3a0293e404 stop if both ARMA_BLAS_64BIT_INT and ARMA_USE_WRAPPER are active 2025-04-01 13:21:09 +10:00
conrad 66acb38834 expand history for new version 2025-04-01 12:55:59 +10:00
conrad 0ecd5a4c43 mark as unstable 2025-03-29 15:26:56 +10:00
conrad 0265363058 fix 2025-03-29 15:23:16 +10:00
conrad 0e091bc343 faster handling of inv(mat)*mat for tiny matrices 2025-03-29 13:03:20 +10:00
751 changed files with 19153 additions and 11599 deletions
+18 -15
View File
@@ -1,12 +1,12 @@
# SPDX-License-Identifier: Apache-2.0
#
# Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
# Copyright 2008-2016 Conrad Sanderson (https://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
# https://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,
@@ -16,23 +16,24 @@
# ------------------------------------------------------------------------
## NOTE: This installation script by default generates a runtime wrapper library,
## NOTE: This installation script generates a runtime wrapper library by default,
## NOTE: which links with OpenBLAS, LAPACK, etc.
## NOTE:
## NOTE: If you prefer to link your programs directly with OpenBLAS, LAPACK, etc
## NOTE: there are two options:
## NOTE:
## NOTE: (1) use the HEADER_ONLY option when running this installation script,
## NOTE: or
## NOTE: (2) do not use this installation script, and instead compile your programs
## NOTE: using the include folder directly obtained from the armadillo archive.
## NOTE: (2) do not use this installation script; instead compile your programs
## NOTE: using the include folder directly obtained from the armadillo archive.
## NOTE:
## NOTE: To forcefully disable use of the runtime wrapper library,
## NOTE: compile your programs with ARMA_DONT_USE_WRAPPER enabled.
## NOTE: For example:
## NOTE: Example:
## NOTE: g++ prog.cpp -o prog -O2 -I /home/user/armadillo-14.0.0/include -DARMA_DONT_USE_WRAPPER -lopenblas -llapack
## NOTE:
## NOTE: The above command line assumes that you have unpacked the armadillo archive into /home/user/
## NOTE: This needs to be adjusted for newer versions of Armadillo (ie. change "14.0.0"),
## NOTE: The above assumes that the armadillo archive is unpacked into /home/user/
## NOTE: Adjust for newer versions of Armadillo (change "14.0.0"),
## NOTE: and/or if the armadillo archive has been unpacked into a different folder.
## NOTE:
## NOTE: Replace -lopenblas with -lblas if you don't have OpenBLAS.
@@ -40,7 +41,7 @@
## NOTE: More details: https://arma.sourceforge.net/faq.html
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
cmake_minimum_required(VERSION 3.10 FATAL_ERROR)
if(POLICY CMP0025)
# enable differentiation between vanilla Clang and AppleClang
@@ -73,7 +74,7 @@ set(ARMA_USE_LAPACK false)
set(ARMA_USE_BLAS false)
set(ARMA_USE_ATLAS false)
set(ARMA_USE_ARPACK false)
set(ARMA_USE_SUPERLU false) # Caveat: only SuperLU version 5.x can be used!
set(ARMA_USE_SUPERLU false)
# extract version from sources
@@ -101,13 +102,13 @@ endif()
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 6.1.0))
if(NOT (${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 8.1.0))
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; need at least gcc 6.1")
message(FATAL_ERROR "Compiler too old; need at least gcc 8.1")
endif()
else()
if(NOT (${CMAKE_MAJOR_VERSION} LESS 3))
@@ -380,10 +381,11 @@ else()
set(ARMA_LIBS ${ARMA_LIBS} ${MKL_LIBRARIES})
message(STATUS "")
message(STATUS "*** If the MKL libraries are installed in non-standard locations such as")
message(STATUS "*** If the MKL libraries are installed in a non-standard location 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 specifying the location through a file in /etc/ld.so.conf.d/")
message(STATUS "*** or modifying the LD_LIBRARY_PATH environment variable.")
message(STATUS "")
message(STATUS "*** On systems with SELinux enabled (eg. Fedora, RHEL),")
@@ -418,10 +420,11 @@ else()
endif()
message(STATUS "")
message(STATUS "*** If the OpenBLAS library is installed in")
message(STATUS "*** If the OpenBLAS library is installed in a location such as")
message(STATUS "*** /usr/local/lib or /usr/local/lib64")
message(STATUS "*** make sure the run-time linker can find it.")
message(STATUS "*** On Linux systems this can be done by editing /etc/ld.so.conf")
message(STATUS "*** or specifying the location through a file in /etc/ld.so.conf.d/")
message(STATUS "*** or modifying the LD_LIBRARY_PATH environment variable.")
message(STATUS "")
@@ -469,7 +472,7 @@ if(ARPACK_FOUND)
set(ARMA_LIBS ${ARMA_LIBS} ${ARPACK_LIBRARY})
endif()
include(ARMA_FindSuperLU5)
include(ARMA_FindSuperLU)
message(STATUS "SuperLU_FOUND = ${SuperLU_FOUND}")
if(SuperLU_FOUND)
+2 -2
View File
@@ -1,7 +1,7 @@
Armadillo C++ Linear Algebra Library
Copyright 2008-2025 Conrad Sanderson (https://conradsanderson.id.au)
Copyright 2008-2026 Conrad Sanderson (https://conradsanderson.id.au)
Copyright 2008-2016 National ICT Australia (NICTA)
Copyright 2017-2025 Data61 / CSIRO
Copyright 2017-2026 Data61 / CSIRO
This product includes software developed by Conrad Sanderson (https://conradsanderson.id.au)
This product includes software developed at National ICT Australia (NICTA)
+26 -23
View File
@@ -1,9 +1,9 @@
### Armadillo: C++ Library for Linear Algebra & Scientific Computing
https://arma.sourceforge.net
Copyright 2008-2025 Conrad Sanderson (https://conradsanderson.id.au)
Copyright 2008-2026 Conrad Sanderson (https://conradsanderson.id.au)
Copyright 2008-2016 National ICT Australia (NICTA)
Copyright 2017-2025 Data61 / CSIRO
Copyright 2017-2026 Data61 / CSIRO
---
@@ -30,14 +30,15 @@ Copyright 2017-2025 Data61 / CSIRO
8. [Windows: Compiling and Linking](#8-windows-compiling-and-linking)
9. [Support for OpenBLAS and Intel MKL](#9-support-for-openblas-and-intel-mkl)
10. [Caveat on use of C++11 auto Keyword](#10-caveat-on-use-of-c11-auto-keyword)
11. [Support for OpenMP](#11-support-for-openmp)
10. [Support for OpenMP](#10-support-for-openmp)
11. [Documentation of Functions and Classes](#11-documentation-of-functions-and-classes)
12. [Caveat on use of C++11 auto Keyword](#12-caveat-on-use-of-c11-auto-keyword)
12. [Documentation of Functions and Classes](#12-documentation-of-functions-and-classes)
13. [API Stability and Version Policy](#13-api-stability-and-version-policy)
14. [Bug Reports and Frequently Asked Questions](#14-bug-reports-and-frequently-asked-questions)
15. [MEX Interface to Octave/Matlab](#15-mex-interface-to-octavematlab)
15. [Prohibition on Use of Large Language Models (LLMs)](#15-prohibition-on-use-of-large-language-models-llms)
16. [Related Software Using Armadillo](#16-related-software-using-armadillo)
---
@@ -129,8 +130,8 @@ On Windows systems, the MinGW toolset or Visual Studio C++ 2019 (MSVC) can be us
Caveats on the use of SuperLU:
- SuperLU must be available as a shared library
- Only the following SuperLU versions are supported: 5.2.x, 5.3.x, 6.0.x
- SuperLU 6.0.x must be compiled with default integer size (32 bits)
- Only the following SuperLU versions are supported: 5.2.x, 5.3.x, 6.0.x, 7.0.x
- SuperLU 6.0.x and 7.0.x must be compiled with default integer size (32 bits)
---
@@ -365,27 +366,18 @@ Comment out the line containing:
---
### 10: Caveat on use of C++11 auto Keyword
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 properly handled by `auto`.
---
### 11: Support for OpenMP
### 10: Support for OpenMP
Armadillo can use OpenMP to automatically speed up computationally
expensive element-wise functions such as exp(), log(), cos(), etc.
This requires a C++ compiler with OpenMP 3.1+ support.
This requires a C++ compiler with OpenMP 4.0+ support.
For GCC and Clang compilers, use the following option to enable OpenMP:
`-fopenmp`
---
### 12: Documentation of Functions and Classes
### 11: Documentation of Functions and Classes
The documentation of Armadillo functions and classes is available at:
https://arma.sourceforge.net/docs.html
@@ -395,6 +387,15 @@ Use a web browser to view it.
---
### 12: Caveat on use of C++11 auto Keyword
Use of the C++11 `auto` keyword is not recommended with Armadillo objects and expressions.
Armadillo has a template meta-programming framework which creates short-lived
temporary objects that are not properly handled by `auto`.
---
### 13: API Stability and Version Policy
Each release of Armadillo has its public API (functions, classes, constants)
@@ -451,10 +452,12 @@ https://arma.sourceforge.net/faq.html
---
### 15: MEX Interface to Octave/Matlab
### 15: Prohibition on Use of Large Language Models (LLMs)
The `mex_interface` folder contains examples of how to interface
Octave/Matlab with C++ code that uses Armadillo matrices.
The Armadillo codebase has been developed entirely without the use of LLMs.
We do not accept any code which has been created (directly or indirectly)
with the aid of LLMs. This is due to issues with code provenance and low quality
of LLM generated code.
---
Binary file not shown.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 432 B

Binary file not shown.
Binary file not shown.
Binary file not shown.
+97
View File
@@ -0,0 +1,97 @@
# Try to find suitable version of SuperLU
# Once done, this will define
#
# SuperLU_FOUND - system has SuperLU
# SuperLU_LIBRARY - Link this to use SuperLU
# SuperLU_INCLUDE_DIR - directory of SuperLU headers
find_path(SuperLU_INCLUDE_DIR slu_ddefs.h
PATHS ${CMAKE_SYSTEM_INCLUDE_PATH} /usr/include /usr/local/include /opt/local/include
PATH_SUFFIXES superlu SuperLU ""
)
find_library(SuperLU_LIBRARY
NAMES superlu
PATHS ${CMAKE_SYSTEM_LIBRARY_PATH} /usr/lib64 /usr/lib /usr/local/lib64 /usr/local/lib /opt/local/lib64 /opt/local/lib
)
set(SuperLU_FOUND NO)
if(NOT SuperLU_FIND_QUIETLY)
message(STATUS "Looking for suitable version of SuperLU")
endif()
if(SuperLU_LIBRARY AND SuperLU_INCLUDE_DIR)
# determine if this is a suitable version of SuperLU
if(EXISTS "${SuperLU_INCLUDE_DIR}/slu_ddefs.h")
file(READ "${SuperLU_INCLUDE_DIR}/slu_ddefs.h" _slu_HEADER_CONTENTS)
string(REGEX REPLACE ".*version ([0-9]).*" "\\1" SLU_VERSION_MAJOR "${_slu_HEADER_CONTENTS}")
if("${SLU_VERSION_MAJOR}" EQUAL "7")
set(SuperLU_FOUND YES)
endif()
if("${SLU_VERSION_MAJOR}" EQUAL "6")
set(SuperLU_FOUND YES)
endif()
if("${SLU_VERSION_MAJOR}" EQUAL "5")
set(SuperLU_FOUND YES)
endif()
if("${SLU_VERSION_MAJOR}" EQUAL "4")
# NOTE: SLU_VERSION_MAJOR = 4 is not 100% reliable, as the version string in slu_ddefs.h wasn't updated in SuperLU 5.0, 5.1, 5.2
# NOTE: We need to explicitly check the prototype of dgssvx() to determine whether this is version 4 or 5.
string(FIND "${_slu_HEADER_CONTENTS}" "dgssvx" _slu_dgssvx_start)
if("${_slu_dgssvx_start}" GREATER 0)
string(SUBSTRING "${_slu_HEADER_CONTENTS}" ${_slu_dgssvx_start} -1 _slu_dgssvx_tmp)
string(FIND "${_slu_dgssvx_tmp}" ";" _slu_dgssvx_len)
string(SUBSTRING "${_slu_HEADER_CONTENTS}" ${_slu_dgssvx_start} ${_slu_dgssvx_len} _slu_dgssvx_proto)
string(FIND "${_slu_dgssvx_proto}" "GlobalLU_t" _slu_dgssvx_check)
if("${_slu_dgssvx_check}" EQUAL -1)
# in version 4, dgssvx() doesn't have a GlobalLU_t argument
if(NOT SuperLU_FIND_QUIETLY)
message(STATUS "Found SuperLU 4, which is insufficient")
endif()
else()
set(SuperLU_FOUND YES)
endif()
endif()
endif()
else()
message(STATUS "Could not read ${SuperLU_INCLUDE_DIR}/slu_ddefs.h to verify suitable version")
endif()
endif()
if(SuperLU_LIBRARY AND NOT SuperLU_INCLUDE_DIR)
if(NOT SuperLU_FIND_QUIETLY)
message(STATUS "Incomplete installation of SuperLU: no SuperLU headers found")
endif()
endif()
if(NOT SuperLU_FOUND)
if(NOT SuperLU_FIND_QUIETLY)
message(STATUS "Could not find suitable version of SuperLU")
endif()
else()
message(STATUS "Found SuperLU library: ${SuperLU_LIBRARY}")
endif()
-90
View File
@@ -1,90 +0,0 @@
# Try to find SuperLU 5.x
# Once done, this will define
#
# SuperLU_FOUND - system has SuperLU
# SuperLU_LIBRARY - Link this to use SuperLU
# SuperLU_INCLUDE_DIR - directory of SuperLU headers
find_path(SuperLU_INCLUDE_DIR slu_ddefs.h
PATHS ${CMAKE_SYSTEM_INCLUDE_PATH} /usr/include /usr/local/include /opt/local/include
PATH_SUFFIXES superlu SuperLU ""
)
find_library(SuperLU_LIBRARY
NAMES superlu
PATHS ${CMAKE_SYSTEM_LIBRARY_PATH} /usr/lib64 /usr/lib /usr/local/lib64 /usr/local/lib /opt/local/lib64 /opt/local/lib
)
set(SuperLU_FOUND NO)
if(NOT SuperLU_FIND_QUIETLY)
message(STATUS "Looking for SuperLU version 5")
endif()
if(SuperLU_LIBRARY AND SuperLU_INCLUDE_DIR)
# Now determine if the version is version 5.
# This voodoo is required as SuperLU developers like to keep things messy.
if(EXISTS "${SuperLU_INCLUDE_DIR}/slu_ddefs.h")
file(READ "${SuperLU_INCLUDE_DIR}/slu_ddefs.h" _slu_HEADER_CONTENTS)
string(REGEX REPLACE ".*version ([0-9]).*" "\\1" SLU_VERSION_MAJOR "${_slu_HEADER_CONTENTS}")
if("${SLU_VERSION_MAJOR}" EQUAL "5")
set(SuperLU_FOUND YES)
else()
if("${SLU_VERSION_MAJOR}" EQUAL "4")
# NOTE: SLU_VERSION_MAJOR = 4 is not 100% reliable, as the version string in slu_ddefs.h wasn't updated in SuperLU 5.0, 5.1, 5.2
# NOTE: We need to explicitly check the prototype of dgssvx() to determine whether this is version 4 or 5.
string(FIND "${_slu_HEADER_CONTENTS}" "dgssvx" _slu_dgssvx_start)
if("${_slu_dgssvx_start}" GREATER 0)
string(SUBSTRING "${_slu_HEADER_CONTENTS}" ${_slu_dgssvx_start} -1 _slu_dgssvx_tmp)
string(FIND "${_slu_dgssvx_tmp}" ";" _slu_dgssvx_len)
string(SUBSTRING "${_slu_HEADER_CONTENTS}" ${_slu_dgssvx_start} ${_slu_dgssvx_len} _slu_dgssvx_proto)
string(FIND "${_slu_dgssvx_proto}" "GlobalLU_t" _slu_dgssvx_check)
if("${_slu_dgssvx_check}" EQUAL -1)
# in version 4, dgssvx() doesn't have a GlobalLU_t argument
if(NOT SuperLU_FIND_QUIETLY)
message(STATUS "Found SuperLU, but it doesn't appear to be version 5")
endif()
else()
set(SuperLU_FOUND YES)
endif()
endif()
else()
if(NOT SuperLU_FIND_QUIETLY)
message(STATUS "Found SuperLU version ${SLU_VERSION_MAJOR}, but version 5 is required")
endif()
endif()
endif()
else()
if(NOT SuperLU_FIND_QUIETLY)
message(STATUS "Found SuperLU and headers, but could not verify version 5")
endif()
endif()
endif()
if(SuperLU_LIBRARY AND NOT SuperLU_INCLUDE_DIR)
if(NOT SuperLU_FIND_QUIETLY)
message(STATUS "Incomplete installation of SuperLU: no SuperLU headers found")
endif()
endif()
if(NOT SuperLU_FOUND)
if(NOT SuperLU_FIND_QUIETLY)
message(STATUS "Could not find SuperLU")
endif()
else()
message(STATUS "Found SuperLU: ${SuperLU_LIBRARY}")
endif()
Vendored
+1 -1
View File
@@ -6,7 +6,7 @@ check_cmake()
{
(cmake --version) </dev/null >/dev/null 2>&1 ||
{
echo "error: cmake 3.5+ is required to configure and install Armadillo"
echo "error: cmake 3.10+ is required to configure and install Armadillo"
echo ""
echo "cmake can be installed via your system's package manager,"
echo "or downloaded from https://cmake.org"
+1373 -686
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -7,11 +7,11 @@ If you have installed Armadillo via the CMake installer:
g++ example1.cpp -o example1 -std=c++14 -O2 -larmadillo
Otherwise, if you want to use Armadillo without installation:
g++ example1.cpp -o example1 -std=c++14 -O2 -I /home/user/armadillo-14.0.0/include -DARMA_DONT_USE_WRAPPER -lopenblas
g++ example1.cpp -o example1 -std=c++14 -O2 -I /home/user/armadillo-15.0.0/include -DARMA_DONT_USE_WRAPPER -lopenblas
The above command assumes that the armadillo archive was unpacked into /home/user/
The command needs to be adjusted if the archive was unpacked into a different directory,
and/or for each specific version of Armadillo (ie. "14.0.0" needs to be changed).
and/or for each specific version of Armadillo (ie. "15.0.0" 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
+4 -4
View File
@@ -1,12 +1,12 @@
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.27:
https://github.com/OpenMathLib/OpenBLAS/releases/download/v0.3.27/OpenBLAS-0.3.27-x64.zip
The files were obtained from a pre-compiled release of OpenBLAS 0.3.30:
https://github.com/OpenMathLib/OpenBLAS/releases/download/v0.3.30/OpenBLAS-0.3.30-x64.zip
The compilation was done by a third party. USE AT YOUR OWN RISK.
libopenblas.dll is a copy of OpenBLAS-0.3.27-x64/bin/libopenblas.dll
libopenblas.lib is a copy of OpenBLAS-0.3.27-x64/lib/libopenblas.dll.a
libopenblas.dll is a copy of OpenBLAS-0.3.30-x64/bin/libopenblas.dll
libopenblas.lib is a copy of OpenBLAS-0.3.30-x64/lib/libopenblas.dll.a
OpenBLAS is a high-performance implementation of BLAS and LAPACK.
Binary file not shown.
Binary file not shown.
+43 -13
View File
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
@@ -54,7 +54,16 @@
#include <atomic>
#if defined(ARMA_USE_STD_MUTEX)
#include <mutex>
#if defined(__has_include)
#if __has_include(<mutex>)
#include <mutex>
#else
#undef ARMA_USE_STD_MUTEX
#pragma message ("WARNING: use of std::mutex disabled; mutex header not found")
#endif
#else
#include <mutex>
#endif
#endif
// #if defined(ARMA_HAVE_CXX17)
@@ -62,6 +71,16 @@
// #include <system_error>
// #endif
#if defined(ARMA_HAVE_CXX23)
#if defined(__has_include)
#if __has_include(<stdfloat>)
#include <stdfloat>
#endif
#else
#include <stdfloat>
#endif
#endif
#if ( defined(__unix__) || defined(__unix) || defined(_POSIX_C_SOURCE) || (defined(__APPLE__) && defined(__MACH__)) ) && !defined(_WIN32)
#include <unistd.h>
#endif
@@ -139,6 +158,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/cond_rel.hpp"
#include "armadillo_bits/fill.hpp"
#if defined(ARMA_RNG_ALT)
@@ -171,7 +191,6 @@ namespace arma
#include "armadillo_bits/translate_superlu.hpp"
#include "armadillo_bits/translate_fftw3.hpp"
#include "armadillo_bits/cond_rel_bones.hpp"
#include "armadillo_bits/arrayops_bones.hpp"
#include "armadillo_bits/podarray_bones.hpp"
#include "armadillo_bits/auxlib_bones.hpp"
@@ -275,7 +294,7 @@ namespace arma
#include "armadillo_bits/op_resize_bones.hpp"
#include "armadillo_bits/op_cov_bones.hpp"
#include "armadillo_bits/op_cor_bones.hpp"
#include "armadillo_bits/op_shift_bones.hpp"
#include "armadillo_bits/op_circshift_bones.hpp"
#include "armadillo_bits/op_shuffle_bones.hpp"
#include "armadillo_bits/op_prod_bones.hpp"
#include "armadillo_bits/op_pinv_bones.hpp"
@@ -283,10 +302,11 @@ namespace arma
#include "armadillo_bits/op_flip_bones.hpp"
#include "armadillo_bits/op_reverse_bones.hpp"
#include "armadillo_bits/op_princomp_bones.hpp"
#include "armadillo_bits/op_misc_bones.hpp"
#include "armadillo_bits/op_elem_bones.hpp"
#include "armadillo_bits/op_orth_null_bones.hpp"
#include "armadillo_bits/op_relational_bones.hpp"
#include "armadillo_bits/op_find_bones.hpp"
#include "armadillo_bits/op_find_aux_bones.hpp"
#include "armadillo_bits/op_find_unique_bones.hpp"
#include "armadillo_bits/op_chol_bones.hpp"
#include "armadillo_bits/op_cx_scalar_bones.hpp"
@@ -304,6 +324,7 @@ namespace arma
#include "armadillo_bits/op_clamp_bones.hpp"
#include "armadillo_bits/op_expmat_bones.hpp"
#include "armadillo_bits/op_nonzeros_bones.hpp"
#include "armadillo_bits/op_omit_bones.hpp"
#include "armadillo_bits/op_diff_bones.hpp"
#include "armadillo_bits/op_norm_bones.hpp"
#include "armadillo_bits/op_vecnorm_bones.hpp"
@@ -320,6 +341,7 @@ namespace arma
#include "armadillo_bits/op_rank_bones.hpp"
#include "armadillo_bits/op_row_as_mat_bones.hpp"
#include "armadillo_bits/op_col_as_mat_bones.hpp"
#include "armadillo_bits/op_accu_bones.hpp"
#include "armadillo_bits/op_sp_plus_bones.hpp"
#include "armadillo_bits/op_sp_minus_bones.hpp"
#include "armadillo_bits/op_sp_sum_bones.hpp"
@@ -375,8 +397,10 @@ namespace arma
#include "armadillo_bits/spop_repmat_bones.hpp"
#include "armadillo_bits/spop_vectorise_bones.hpp"
#include "armadillo_bits/spop_norm_bones.hpp"
#include "armadillo_bits/spop_shift_bones.hpp"
#include "armadillo_bits/spop_circshift_bones.hpp"
#include "armadillo_bits/spop_relational_bones.hpp"
#include "armadillo_bits/spop_omit_bones.hpp"
#include "armadillo_bits/spop_accu_bones.hpp"
#include "armadillo_bits/spglue_plus_bones.hpp"
#include "armadillo_bits/spglue_minus_bones.hpp"
@@ -523,10 +547,9 @@ namespace arma
#include "armadillo_bits/fn_resize.hpp"
#include "armadillo_bits/fn_cov.hpp"
#include "armadillo_bits/fn_cor.hpp"
#include "armadillo_bits/fn_shift.hpp"
#include "armadillo_bits/fn_circshift.hpp"
#include "armadillo_bits/fn_shuffle.hpp"
#include "armadillo_bits/fn_prod.hpp"
#include "armadillo_bits/fn_eps.hpp"
#include "armadillo_bits/fn_pinv.hpp"
#include "armadillo_bits/fn_rank.hpp"
#include "armadillo_bits/fn_kron.hpp"
@@ -559,11 +582,13 @@ namespace arma
#include "armadillo_bits/fn_inplace_trans.hpp"
#include "armadillo_bits/fn_randi.hpp"
#include "armadillo_bits/fn_randg.hpp"
#include "armadillo_bits/fn_rande.hpp"
#include "armadillo_bits/fn_cond_rcond.hpp"
#include "armadillo_bits/fn_normalise.hpp"
#include "armadillo_bits/fn_clamp.hpp"
#include "armadillo_bits/fn_expmat.hpp"
#include "armadillo_bits/fn_nonzeros.hpp"
#include "armadillo_bits/fn_omit.hpp"
#include "armadillo_bits/fn_interp1.hpp"
#include "armadillo_bits/fn_interp2.hpp"
#include "armadillo_bits/fn_qz.hpp"
@@ -590,6 +615,7 @@ namespace arma
#include "armadillo_bits/fn_powmat.hpp"
#include "armadillo_bits/fn_powext.hpp"
#include "armadillo_bits/fn_diags_spdiags.hpp"
#include "armadillo_bits/fn_balance.hpp"
#include "armadillo_bits/fn_speye.hpp"
#include "armadillo_bits/fn_spones.hpp"
@@ -658,7 +684,6 @@ namespace arma
#include "armadillo_bits/eop_core_meat.hpp"
#include "armadillo_bits/eglue_core_meat.hpp"
#include "armadillo_bits/cond_rel_meat.hpp"
#include "armadillo_bits/arrayops_meat.hpp"
#include "armadillo_bits/podarray_meat.hpp"
#include "armadillo_bits/auxlib_meat.hpp"
@@ -729,7 +754,7 @@ namespace arma
#include "armadillo_bits/op_resize_meat.hpp"
#include "armadillo_bits/op_cov_meat.hpp"
#include "armadillo_bits/op_cor_meat.hpp"
#include "armadillo_bits/op_shift_meat.hpp"
#include "armadillo_bits/op_circshift_meat.hpp"
#include "armadillo_bits/op_shuffle_meat.hpp"
#include "armadillo_bits/op_prod_meat.hpp"
#include "armadillo_bits/op_pinv_meat.hpp"
@@ -737,10 +762,11 @@ namespace arma
#include "armadillo_bits/op_flip_meat.hpp"
#include "armadillo_bits/op_reverse_meat.hpp"
#include "armadillo_bits/op_princomp_meat.hpp"
#include "armadillo_bits/op_misc_meat.hpp"
#include "armadillo_bits/op_elem_meat.hpp"
#include "armadillo_bits/op_orth_null_meat.hpp"
#include "armadillo_bits/op_relational_meat.hpp"
#include "armadillo_bits/op_find_meat.hpp"
#include "armadillo_bits/op_find_aux_meat.hpp"
#include "armadillo_bits/op_find_unique_meat.hpp"
#include "armadillo_bits/op_chol_meat.hpp"
#include "armadillo_bits/op_cx_scalar_meat.hpp"
@@ -758,6 +784,7 @@ namespace arma
#include "armadillo_bits/op_clamp_meat.hpp"
#include "armadillo_bits/op_expmat_meat.hpp"
#include "armadillo_bits/op_nonzeros_meat.hpp"
#include "armadillo_bits/op_omit_meat.hpp"
#include "armadillo_bits/op_diff_meat.hpp"
#include "armadillo_bits/op_norm_meat.hpp"
#include "armadillo_bits/op_vecnorm_meat.hpp"
@@ -774,6 +801,7 @@ namespace arma
#include "armadillo_bits/op_rank_meat.hpp"
#include "armadillo_bits/op_row_as_mat_meat.hpp"
#include "armadillo_bits/op_col_as_mat_meat.hpp"
#include "armadillo_bits/op_accu_meat.hpp"
#include "armadillo_bits/op_sp_plus_meat.hpp"
#include "armadillo_bits/op_sp_minus_meat.hpp"
#include "armadillo_bits/op_sp_sum_meat.hpp"
@@ -829,8 +857,10 @@ namespace arma
#include "armadillo_bits/spop_repmat_meat.hpp"
#include "armadillo_bits/spop_vectorise_meat.hpp"
#include "armadillo_bits/spop_norm_meat.hpp"
#include "armadillo_bits/spop_shift_meat.hpp"
#include "armadillo_bits/spop_circshift_meat.hpp"
#include "armadillo_bits/spop_relational_meat.hpp"
#include "armadillo_bits/spop_omit_meat.hpp"
#include "armadillo_bits/spop_accu_meat.hpp"
#include "armadillo_bits/spglue_plus_meat.hpp"
#include "armadillo_bits/spglue_minus_meat.hpp"
+2 -2
View File
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
+46 -16
View File
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
@@ -244,9 +244,9 @@ BaseCube<elem_type,derived>::is_zero(const typename get_pod_type<elem_type>::res
typedef typename get_pod_type<elem_type>::result T;
arma_conform_check( (tol < T(0)), "is_zero(): parameter 'tol' must be >= 0" );
arma_conform_check( ((tol >= T(0)) == false), "is_zero(): parameter 'tol' must be >= 0" );
if(ProxyCube<derived>::use_at || is_Cube<typename ProxyCube<derived>::stored_type>::value)
if(is_Cube<typename ProxyCube<derived>::stored_type>::value || ProxyCube<derived>::use_at)
{
const unwrap_cube<derived> U( (*this).get_ref() );
@@ -263,22 +263,52 @@ BaseCube<elem_type,derived>::is_zero(const typename get_pod_type<elem_type>::res
if(is_cx<elem_type>::yes)
{
for(uword i=0; i<n_elem; ++i)
if(tol == T(0))
{
const elem_type val = Pea[i];
const T val_real = access::tmp_real(val);
const T val_imag = access::tmp_imag(val);
if(eop_aux::arma_abs(val_real) > tol) { return false; }
if(eop_aux::arma_abs(val_imag) > tol) { return false; }
for(uword i=0; i < n_elem; ++i)
{
const elem_type val = Pea[i];
const T val_real = access::tmp_real(val);
const T val_imag = access::tmp_imag(val);
if(eop_aux::arma_abs(val_real) != T(0)) { return false; }
if(eop_aux::arma_abs(val_imag) != T(0)) { return false; }
}
}
else
{
for(uword i=0; i < n_elem; ++i)
{
const elem_type val = Pea[i];
const T val_real = access::tmp_real(val);
const T val_imag = access::tmp_imag(val);
if( (eop_aux::arma_abs(val_real) <= tol) == false ) { return false; }
if( (eop_aux::arma_abs(val_imag) <= tol) == false ) { return false; }
}
}
}
else // not complex
{
for(uword i=0; i < n_elem; ++i)
if(tol == T(0))
{
if(eop_aux::arma_abs(Pea[i]) > tol) { return false; }
for(uword i=0; i < n_elem; ++i)
{
const elem_type val = Pea[i];
if(val != elem_type(0)) { return false; }
}
}
else
{
for(uword i=0; i < n_elem; ++i)
{
const elem_type val = Pea[i];
if( (eop_aux::arma_abs(val) <= tol) == false ) { return false; }
}
}
}
@@ -328,7 +358,7 @@ BaseCube<elem_type,derived>::is_finite() const
for(uword c=0; c<n_c; ++c)
for(uword r=0; r<n_r; ++r)
{
if( arma_isfinite(P.at(r,c,s)) == false ) { return false; }
if( arma_isnonfinite(P.at(r,c,s)) ) { return false; }
}
}
@@ -436,7 +466,7 @@ BaseCube<elem_type,derived>::has_nonfinite() const
for(uword c=0; c<n_c; ++c)
for(uword r=0; r<n_r; ++r)
{
if(arma_isfinite(P.at(r,c,s)) == false) { return true; }
if(arma_isnonfinite(P.at(r,c,s))) { return true; }
}
}
+7 -7
View File
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
@@ -109,7 +109,7 @@ struct Base_trans<derived, false> { typedef Base_trans_default<derived> result;
template<typename elem_type, typename derived>
struct Base
: public Base_extra<elem_type, derived, is_supported_blas_type<elem_type>::value>::result
: public Base_extra<elem_type, derived, is_blas_type<elem_type>::value>::result
, public Base_eval<elem_type, derived, is_Mat<derived>::value>::result
, public Base_trans<derived, is_cx<elem_type>::value>::result
{
@@ -127,11 +127,11 @@ struct Base
arma_warn_unused inline elem_type min() const;
arma_warn_unused inline elem_type max() const;
arma_frown("use .index_min() instead") inline elem_type min(uword& index_of_min_val) const;
arma_frown("use .index_max() instead") inline elem_type max(uword& index_of_max_val) const;
[[deprecated("use .index_min() instead")]] inline elem_type min(uword& index_of_min_val) const;
[[deprecated("use .index_max() instead")]] inline elem_type max(uword& index_of_max_val) const;
arma_frown("use .index_min() with ind2sub() instead") inline elem_type min(uword& row_of_min_val, uword& col_of_min_val) const;
arma_frown("use .index_max() with ind2sub() instead") inline elem_type max(uword& row_of_max_val, uword& col_of_max_val) const;
[[deprecated("use .index_min() with ind2sub() instead")]] inline elem_type min(uword& row_of_min_val, uword& col_of_min_val) const;
[[deprecated("use .index_max() with ind2sub() instead")]] inline elem_type max(uword& row_of_max_val, uword& col_of_max_val) const;
arma_warn_unused inline uword index_min() const;
arma_warn_unused inline uword index_max() const;
+65 -25
View File
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
@@ -352,7 +352,7 @@ Base<elem_type,derived>::is_symmetric(const typename get_pod_type<elem_type>::re
if(tol == T(0)) { return (*this).is_symmetric(); }
arma_conform_check( (tol < T(0)), "is_symmetric(): parameter 'tol' must be >= 0" );
arma_conform_check( ((tol >= T(0)) == false), "is_symmetric(): parameter 'tol' must be > 0" );
const quasi_unwrap<derived> U( (*this).get_ref() );
@@ -365,8 +365,12 @@ Base<elem_type,derived>::is_symmetric(const typename get_pod_type<elem_type>::re
if(norm_A == T(0)) { return true; }
if(arma_isnan(norm_A)) { return false; }
const T norm_A_Ast = as_scalar( arma::max(sum(abs(A - A.st()), 1), 0) );
if(arma_isnan(norm_A_Ast)) { return false; }
return ( (norm_A_Ast / norm_A) <= tol );
}
@@ -435,7 +439,7 @@ Base<elem_type,derived>::is_hermitian(const typename get_pod_type<elem_type>::re
if(tol == T(0)) { return (*this).is_hermitian(); }
arma_conform_check( (tol < T(0)), "is_hermitian(): parameter 'tol' must be >= 0" );
arma_conform_check( ((tol >= T(0)) == false), "is_hermitian(): parameter 'tol' must be > 0" );
const quasi_unwrap<derived> U( (*this).get_ref() );
@@ -448,8 +452,12 @@ Base<elem_type,derived>::is_hermitian(const typename get_pod_type<elem_type>::re
if(norm_A == T(0)) { return true; }
if(arma_isnan(norm_A)) { return false; }
const T norm_A_At = as_scalar( arma::max(sum(abs(A - A.t()), 1), 0) );
if(arma_isnan(norm_A_At)) { return false; }
return ( (norm_A_At / norm_A) <= tol );
}
@@ -464,9 +472,9 @@ Base<elem_type,derived>::is_zero(const typename get_pod_type<elem_type>::result
typedef typename get_pod_type<elem_type>::result T;
arma_conform_check( (tol < T(0)), "is_zero(): parameter 'tol' must be >= 0" );
arma_conform_check( ((tol >= T(0)) == false), "is_zero(): parameter 'tol' must be >= 0" );
if(Proxy<derived>::use_at || is_Mat<typename Proxy<derived>::stored_type>::value)
if( (quasi_unwrap<derived>::has_orig_mem) || (is_Mat<typename Proxy<derived>::stored_type>::value) || (Proxy<derived>::use_at) )
{
const quasi_unwrap<derived> U( (*this).get_ref() );
@@ -483,22 +491,52 @@ Base<elem_type,derived>::is_zero(const typename get_pod_type<elem_type>::result
if(is_cx<elem_type>::yes)
{
for(uword i=0; i<n_elem; ++i)
if(tol == T(0))
{
const elem_type val = Pea[i];
const T val_real = access::tmp_real(val);
const T val_imag = access::tmp_imag(val);
if(eop_aux::arma_abs(val_real) > tol) { return false; }
if(eop_aux::arma_abs(val_imag) > tol) { return false; }
for(uword i=0; i < n_elem; ++i)
{
const elem_type val = Pea[i];
const T val_real = access::tmp_real(val);
const T val_imag = access::tmp_imag(val);
if(eop_aux::arma_abs(val_real) != T(0)) { return false; }
if(eop_aux::arma_abs(val_imag) != T(0)) { return false; }
}
}
else
{
for(uword i=0; i < n_elem; ++i)
{
const elem_type val = Pea[i];
const T val_real = access::tmp_real(val);
const T val_imag = access::tmp_imag(val);
if( (eop_aux::arma_abs(val_real) <= tol) == false ) { return false; }
if( (eop_aux::arma_abs(val_imag) <= tol) == false ) { return false; }
}
}
}
else // not complex
{
for(uword i=0; i<n_elem; ++i)
if(tol == T(0))
{
if(eop_aux::arma_abs(Pea[i]) > tol) { return false; }
for(uword i=0; i < n_elem; ++i)
{
const elem_type val = Pea[i];
if(val != elem_type(0)) { return false; }
}
}
else
{
for(uword i=0; i < n_elem; ++i)
{
const elem_type val = Pea[i];
if( (eop_aux::arma_abs(val) <= tol) == false ) { return false; }
}
}
}
@@ -667,7 +705,7 @@ Base<elem_type,derived>::is_finite() const
if(arma_config::fast_math_warn) { arma_warn(1, "is_finite(): detection of non-finite values is not reliable in fast math mode"); }
if(is_Mat<typename Proxy<derived>::stored_type>::value)
if( (quasi_unwrap<derived>::has_orig_mem) || (is_Mat<typename Proxy<derived>::stored_type>::value) )
{
const quasi_unwrap<derived> U( (*this).get_ref() );
@@ -685,7 +723,7 @@ Base<elem_type,derived>::is_finite() const
for(uword i=0; i<n_elem; ++i)
{
if(arma_isfinite(Pea[i]) == false) { return false; }
if(arma_isnonfinite(Pea[i])) { return false; }
}
}
else
@@ -696,7 +734,7 @@ Base<elem_type,derived>::is_finite() const
for(uword col=0; col<n_cols; ++col)
for(uword row=0; row<n_rows; ++row)
{
if(arma_isfinite(P.at(row,col)) == false) { return false; }
if(arma_isnonfinite(P.at(row,col))) { return false; }
}
}
}
@@ -715,7 +753,7 @@ Base<elem_type,derived>::has_inf() const
if(arma_config::fast_math_warn) { arma_warn(1, "has_inf(): detection of non-finite values is not reliable in fast math mode"); }
if(is_Mat<typename Proxy<derived>::stored_type>::value)
if( (quasi_unwrap<derived>::has_orig_mem) || (is_Mat<typename Proxy<derived>::stored_type>::value) )
{
const quasi_unwrap<derived> U( (*this).get_ref() );
@@ -763,7 +801,7 @@ Base<elem_type,derived>::has_nan() const
if(arma_config::fast_math_warn) { arma_warn(1, "has_nan(): detection of non-finite values is not reliable in fast math mode"); }
if(is_Mat<typename Proxy<derived>::stored_type>::value)
if( (quasi_unwrap<derived>::has_orig_mem) || (is_Mat<typename Proxy<derived>::stored_type>::value) )
{
const quasi_unwrap<derived> U( (*this).get_ref() );
@@ -811,7 +849,7 @@ Base<elem_type,derived>::has_nonfinite() const
if(arma_config::fast_math_warn) { arma_warn(1, "has_nonfinite(): detection of non-finite values is not reliable in fast math mode"); }
if(is_Mat<typename Proxy<derived>::stored_type>::value)
if( (quasi_unwrap<derived>::has_orig_mem) || (is_Mat<typename Proxy<derived>::stored_type>::value) )
{
const quasi_unwrap<derived> U( (*this).get_ref() );
@@ -829,7 +867,7 @@ Base<elem_type,derived>::has_nonfinite() const
for(uword i=0; i<n_elem; ++i)
{
if(arma_isfinite(Pea[i]) == false) { return true; }
if(arma_isnonfinite(Pea[i])) { return true; }
}
}
else
@@ -840,7 +878,7 @@ Base<elem_type,derived>::has_nonfinite() const
for(uword col=0; col<n_cols; ++col)
for(uword row=0; row<n_rows; ++row)
{
if(arma_isfinite(P.at(row,col)) == false) { return true; }
if(arma_isnonfinite(P.at(row,col))) { return true; }
}
}
}
@@ -897,6 +935,8 @@ Base_extra_yes<elem_type,derived>::is_sympd() const
// default value for tol
const T tol = T(100) * std::numeric_limits<T>::epsilon() * norm(X, "fro");
if(arma_isnan(tol)) { return false; }
if(X.is_hermitian(tol) == false) { return false; }
if(X.is_empty()) { return false; }
@@ -917,7 +957,7 @@ Base_extra_yes<elem_type,derived>::is_sympd(typename get_pod_type<elem_type>::re
typedef typename get_pod_type<elem_type>::result T;
arma_conform_check( (tol < T(0)), "is_sympd(): parameter 'tol' must be >= 0" );
arma_conform_check( ((tol >= T(0)) == false), "is_sympd(): parameter 'tol' must be >= 0" );
Mat<elem_type> X = static_cast<const derived&>(*this);
+17 -8
View File
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
@@ -33,6 +33,8 @@ class Col : public Mat<eT>
static constexpr bool is_row = false;
static constexpr bool is_xvec = false;
static constexpr bool has_subview = false;
inline Col();
inline Col(const Col<eT>& X);
@@ -67,9 +69,6 @@ class Col : public Mat<eT>
inline Col(Col&& m);
inline Col& operator=(Col&& m);
// inline Col(Mat<eT>&& m);
// inline Col& operator=(Mat<eT>&& m);
inline Col& operator=(const eT val);
inline Col& operator=(const Col& m);
@@ -91,7 +90,7 @@ class Col : public Mat<eT>
inline Col(const subview_cube<eT>& X);
inline Col& operator=(const subview_cube<eT>& X);
arma_frown("use braced initialiser list instead") inline mat_injector<Col> operator<<(const eT val);
[[deprecated("use braced initialiser list instead")]] inline mat_injector<Col> operator<<(const eT val);
arma_warn_unused arma_inline const Op<Col<eT>,op_htrans> t() const;
arma_warn_unused arma_inline const Op<Col<eT>,op_htrans> ht() const;
@@ -141,8 +140,8 @@ class Col : public Mat<eT>
template<typename T1> inline void shed_rows(const Base<uword, T1>& indices);
arma_deprecated inline void insert_rows(const uword row_num, const uword N, const bool set_to_zero);
inline void insert_rows(const uword row_num, const uword N);
[[deprecated]] inline void insert_rows(const uword row_num, const uword N, const bool set_to_zero);
inline void insert_rows(const uword row_num, const uword N);
template<typename T1> inline void insert_rows(const uword row_num, const Base<eT,T1>& X);
@@ -153,6 +152,12 @@ class Col : public Mat<eT>
arma_warn_unused arma_inline eT& at(const uword in_row, const uword in_col);
arma_warn_unused arma_inline const eT& at(const uword in_row, const uword in_col) const;
inline void push_back(const eT val);
inline constexpr bool is_vec() const { return true; }
inline constexpr bool is_rowvec() const { return false; }
inline constexpr bool is_colvec() const { return true; }
typedef eT* row_iterator;
typedef const eT* const_row_iterator;
@@ -205,6 +210,8 @@ class Col<eT>::fixed : public Col<eT>
static constexpr bool is_row = false;
static constexpr bool is_xvec = false;
static constexpr bool has_subview = false;
static const uword n_rows; // value provided below the class definition
static const uword n_cols; // value provided below the class definition
static const uword n_elem; // value provided below the class definition
@@ -260,6 +267,8 @@ class Col<eT>::fixed : public Col<eT>
arma_warn_unused arma_inline eT& operator() (const uword in_row, const uword in_col);
arma_warn_unused arma_inline const eT& operator() (const uword in_row, const uword in_col) const;
inline void push_back(const eT) = delete;
arma_warn_unused arma_inline eT* memptr();
arma_warn_unused arma_inline const eT* memptr() const;
+45 -82
View File
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
@@ -431,64 +431,6 @@ Col<eT>::operator=(Col<eT>&& X)
// template<typename eT>
// inline
// Col<eT>::Col(Mat<eT>&& X)
// : Mat<eT>(arma_vec_indicator(), 1)
// {
// arma_debug_sigprint(arma_str::format("this: %x; X: %x") % this % &X);
//
// if(X.n_cols != 1) { const Mat<eT>& XX = X; Mat<eT>::operator=(XX); return; }
//
// 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) )
// {
// 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_elem) = 0;
// access::rw(X.n_alloc) = 0;
// access::rw(X.mem_state) = 0;
// access::rw(X.mem) = nullptr;
// }
// else // condition: (X.n_alloc <= arma_config::mat_prealloc) || (X.mem_state == 0) || (X.mem_state == 3)
// {
// (*this).init_cold();
//
// arrayops::copy( (*this).memptr(), X.mem, X.n_elem );
//
// if( (X.mem_state == 0) && (X.n_alloc <= arma_config::mat_prealloc) )
// {
// access::rw(X.n_rows) = 0;
// access::rw(X.n_elem) = 0;
// access::rw(X.mem) = nullptr;
// }
// }
// }
//
//
//
// template<typename eT>
// inline
// Col<eT>&
// Col<eT>::operator=(Mat<eT>&& X)
// {
// arma_debug_sigprint(arma_str::format("this: %x; X: %x") % this % &X);
//
// if(X.n_cols != 1) { const Mat<eT>& XX = X; Mat<eT>::operator=(XX); return *this; }
//
// (*this).steal_mem(X, true);
//
// return *this;
// }
template<typename eT>
inline
Col<eT>&
@@ -521,11 +463,9 @@ template<typename eT>
template<typename T1>
inline
Col<eT>::Col(const Base<eT,T1>& X)
: Mat<eT>(arma_vec_indicator(), 1)
: Mat<eT>(X.get_ref(), arma_vec_indicator(), 1)
{
arma_debug_sigprint();
Mat<eT>::operator=(X.get_ref());
arma_debug_sigprint_this(this);
}
@@ -549,11 +489,9 @@ template<typename eT>
template<typename T1>
inline
Col<eT>::Col(const SpBase<eT,T1>& X)
: Mat<eT>(arma_vec_indicator(), 1)
: Mat<eT>(X.get_ref(), arma_vec_indicator(), 1)
{
arma_debug_sigprint_this(this);
Mat<eT>::operator=(X.get_ref());
}
@@ -607,12 +545,9 @@ Col<eT>::Col
const Base<typename Col<eT>::pod_type, T1>& A,
const Base<typename Col<eT>::pod_type, T2>& B
)
: Mat<eT>(A.get_ref(), B.get_ref(), arma_vec_indicator(), 1)
{
arma_debug_sigprint();
access::rw(Mat<eT>::vec_state) = 1;
Mat<eT>::init(A,B);
arma_debug_sigprint_this(this);
}
@@ -621,12 +556,9 @@ template<typename eT>
template<typename T1>
inline
Col<eT>::Col(const BaseCube<eT,T1>& X)
: Mat<eT>(X.get_ref(), arma_vec_indicator(), 1)
{
arma_debug_sigprint();
access::rw(Mat<eT>::vec_state) = 1;
Mat<eT>::operator=(X);
arma_debug_sigprint_this(this);
}
@@ -649,12 +581,9 @@ Col<eT>::operator=(const BaseCube<eT,T1>& X)
template<typename eT>
inline
Col<eT>::Col(const subview_cube<eT>& X)
: Mat<eT>(X, arma_vec_indicator(), 1)
{
arma_debug_sigprint();
access::rw(Mat<eT>::vec_state) = 1;
Mat<eT>::operator=(X);
arma_debug_sigprint_this(this);
}
@@ -1221,6 +1150,25 @@ Col<eT>::at(const uword in_row, const uword) const
template<typename eT>
inline
void
Col<eT>::push_back(const eT val)
{
arma_debug_sigprint();
if(Mat<eT>::mem_state != 0)
{
arma_conform_check(true, "Col::push_back(): unsupported operation as auxiliary memory is in use");
return;
}
Mat<eT>::vec_push_back(val, arma_colvec_indicator());
}
template<typename eT>
inline
typename Col<eT>::row_iterator
@@ -1277,6 +1225,13 @@ Col<eT>::end_row(const uword row_num) const
//
template<typename eT>
template<uword fixed_n_elem>
arma_inline
@@ -1350,6 +1305,10 @@ Col<eT>::fixed<fixed_n_elem>::fixed(const fill::fill_class<fill_type>&)
if(is_same_type<fill_type, fill::fill_eye >::yes) { Mat<eT>::eye(); }
if(is_same_type<fill_type, fill::fill_randu>::yes) { Mat<eT>::randu(); }
if(is_same_type<fill_type, fill::fill_randn>::yes) { Mat<eT>::randn(); }
if(is_same_type<fill_type, fill::fill_nan >::yes) { (*this).fill( priv::Datum_helper::nan <eT>() ); }
if(is_same_type<fill_type, fill::fill_pos_inf>::yes) { (*this).fill( priv::Datum_helper::pos_inf<eT>() ); }
if(is_same_type<fill_type, fill::fill_neg_inf>::yes) { (*this).fill( priv::Datum_helper::neg_inf<eT>() ); }
}
@@ -1872,6 +1831,10 @@ Col<eT>::fixed<fixed_n_elem>::ones()
//
template<typename eT>
inline
Col<eT>::Col(const arma_fixed_indicator&, const uword in_n_elem, const eT* in_mem)
+5 -5
View File
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
@@ -22,10 +22,8 @@
template<typename T1, typename op_type>
class CubeToMatOp : public Base< typename T1::elem_type, CubeToMatOp<T1, op_type> >
struct CubeToMatOp : public Base< typename T1::elem_type, CubeToMatOp<T1, op_type> >
{
public:
typedef typename T1::elem_type elem_type;
typedef typename get_pod_type<elem_type>::result pod_type;
@@ -42,6 +40,8 @@ class CubeToMatOp : public Base< typename T1::elem_type, CubeToMatOp<T1, op_type
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;
static constexpr bool has_subview = T1::has_subview;
};
+2 -2
View File
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
+24 -18
View File
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
@@ -82,6 +82,8 @@ class Cube : public BaseCube< eT, Cube<eT> >
public:
static constexpr bool has_subview = false;
inline ~Cube();
inline Cube();
@@ -218,9 +220,9 @@ class Cube : public BaseCube< eT, Cube<eT> >
template<typename T1> inline void shed_slices(const Base<uword, T1>& indices);
arma_deprecated inline void insert_rows(const uword row_num, const uword N, const bool set_to_zero);
arma_deprecated inline void insert_cols(const uword row_num, const uword N, const bool set_to_zero);
arma_deprecated inline void insert_slices(const uword slice_num, const uword N, const bool set_to_zero);
[[deprecated]] inline void insert_rows(const uword row_num, const uword N, const bool set_to_zero);
[[deprecated]] inline void insert_cols(const uword row_num, const uword N, const bool set_to_zero);
[[deprecated]] inline void insert_slices(const uword slice_num, const uword N, const bool set_to_zero);
inline void insert_rows(const uword row_num, const uword N);
inline void insert_cols(const uword row_num, const uword N);
@@ -360,6 +362,9 @@ class Cube : public BaseCube< eT, Cube<eT> >
inline Cube& fill(const eT val);
template<typename fill_type>
inline Cube& fill(const fill::fill_class<fill_type>& f);
inline Cube& zeros();
inline Cube& zeros(const uword new_n_rows, const uword new_n_cols, const uword new_n_slices);
inline Cube& zeros(const SizeCube& s);
@@ -387,11 +392,11 @@ class Cube : public BaseCube< eT, Cube<eT> >
arma_warn_unused inline eT min() const;
arma_warn_unused inline eT max() const;
arma_frown("use .index_min() instead") inline eT min(uword& index_of_min_val) const;
arma_frown("use .index_max() instead") inline eT max(uword& index_of_max_val) const;
[[deprecated("use .index_min() instead")]] inline eT min(uword& index_of_min_val) const;
[[deprecated("use .index_max() instead")]] inline eT max(uword& index_of_max_val) const;
arma_frown("use .index_min() with ind2sub() instead") inline eT min(uword& row_of_min_val, uword& col_of_min_val, uword& slice_of_min_val) const;
arma_frown("use .index_max() with ind2sub() instead") inline eT max(uword& row_of_max_val, uword& col_of_max_val, uword& slice_of_max_val) const;
[[deprecated("use .index_min() with ind2sub() instead")]] inline eT min(uword& row_of_min_val, uword& col_of_min_val, uword& slice_of_min_val) const;
[[deprecated("use .index_max() with ind2sub() instead")]] inline eT max(uword& row_of_max_val, uword& col_of_max_val, uword& slice_of_max_val) const;
arma_cold inline bool save(const std::string name, const file_type type = arma_binary) const;
arma_cold inline bool save(const hdf5_name& spec, const file_type type = hdf5_binary) const;
@@ -401,13 +406,13 @@ class Cube : public BaseCube< eT, Cube<eT> >
arma_cold inline bool load(const hdf5_name& spec, const file_type type = hdf5_binary);
arma_cold inline bool load( std::istream& is, const file_type type = auto_detect);
arma_deprecated inline bool quiet_save(const std::string name, const file_type type = arma_binary) const;
arma_deprecated inline bool quiet_save(const hdf5_name& spec, const file_type type = hdf5_binary) const;
arma_deprecated inline bool quiet_save( std::ostream& os, const file_type type = arma_binary) const;
[[deprecated("use save() instead")]] inline bool quiet_save(const std::string name, const file_type type = arma_binary) const;
[[deprecated("use save() instead")]] inline bool quiet_save(const hdf5_name& spec, const file_type type = hdf5_binary) const;
[[deprecated("use save() instead")]] inline bool quiet_save( std::ostream& os, const file_type type = arma_binary) const;
arma_deprecated inline bool quiet_load(const std::string name, const file_type type = auto_detect);
arma_deprecated inline bool quiet_load(const hdf5_name& spec, const file_type type = hdf5_binary);
arma_deprecated inline bool quiet_load( std::istream& is, const file_type type = auto_detect);
[[deprecated("use load() instead")]] inline bool quiet_load(const std::string name, const file_type type = auto_detect);
[[deprecated("use load() instead")]] inline bool quiet_load(const hdf5_name& spec, const file_type type = hdf5_binary);
[[deprecated("use load() instead")]] inline bool quiet_load( std::istream& is, const file_type type = auto_detect);
// iterators
@@ -464,11 +469,12 @@ class Cube : public BaseCube< eT, Cube<eT> >
inline Mat<eT>* create_mat_ptr(const uword in_slice) const;
inline Mat<eT>* get_mat_ptr(const uword in_slice) const;
friend class glue_join;
friend class op_reshape;
friend class op_resize;
friend class subview_cube<eT>;
friend struct glue_join;
friend struct op_reshape;
friend struct op_resize;
public:
+106 -68
View File
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
@@ -52,7 +52,7 @@ Cube<eT>::Cube()
, n_elem(0)
, n_alloc(0)
, mem_state(0)
, mem()
, mem(nullptr)
{
arma_debug_sigprint_this(this);
}
@@ -172,7 +172,7 @@ Cube<eT>::Cube(const SizeCube& s, const arma_initmode_indicator<do_zeros>&)
template<typename eT>
template<typename fill_type>
inline
Cube<eT>::Cube(const uword in_n_rows, const uword in_n_cols, const uword in_n_slices, const fill::fill_class<fill_type>&)
Cube<eT>::Cube(const uword in_n_rows, const uword in_n_cols, const uword in_n_slices, const fill::fill_class<fill_type>& f)
: n_rows(in_n_rows)
, n_cols(in_n_cols)
, n_elem_slice(in_n_rows*in_n_cols)
@@ -186,12 +186,7 @@ Cube<eT>::Cube(const uword in_n_rows, const uword in_n_cols, const uword in_n_sl
init_cold();
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_randu>::yes) { (*this).randu(); }
if(is_same_type<fill_type, fill::fill_randn>::yes) { (*this).randn(); }
arma_static_check( (is_same_type<fill_type, fill::fill_eye>::yes), "Cube::Cube(): unsupported fill type" );
(*this).fill(f);
}
@@ -199,7 +194,7 @@ Cube<eT>::Cube(const uword in_n_rows, const uword in_n_cols, const uword in_n_sl
template<typename eT>
template<typename fill_type>
inline
Cube<eT>::Cube(const SizeCube& s, const fill::fill_class<fill_type>&)
Cube<eT>::Cube(const SizeCube& s, const fill::fill_class<fill_type>& f)
: n_rows(s.n_rows)
, n_cols(s.n_cols)
, n_elem_slice(s.n_rows*s.n_cols)
@@ -213,12 +208,7 @@ Cube<eT>::Cube(const SizeCube& s, const fill::fill_class<fill_type>&)
init_cold();
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_randu>::yes) { (*this).randu(); }
if(is_same_type<fill_type, fill::fill_randn>::yes) { (*this).randn(); }
arma_static_check( (is_same_type<fill_type, fill::fill_eye>::yes), "Cube::Cube(): unsupported fill type" );
(*this).fill(f);
}
@@ -615,7 +605,7 @@ Cube<eT>::get_mat_ptr(const uword in_slice) const
#if defined(ARMA_USE_OPENMP)
{
#pragma omp atomic read
#pragma omp atomic read seq_cst
mat_ptr = mat_ptrs[in_slice];
}
#elif defined(ARMA_USE_STD_MUTEX)
@@ -634,12 +624,12 @@ Cube<eT>::get_mat_ptr(const uword in_slice) const
{
#pragma omp critical (arma_Cube_mat_ptrs)
{
#pragma omp atomic read
#pragma omp atomic read seq_cst
mat_ptr = mat_ptrs[in_slice];
if(mat_ptr == nullptr) { mat_ptr = create_mat_ptr(in_slice); }
#pragma omp atomic write
#pragma omp atomic write seq_cst
mat_ptrs[in_slice] = mat_ptr;
}
}
@@ -784,6 +774,10 @@ Cube<eT>::operator=(const Cube<eT>& x)
arrayops::copy( memptr(), x.mem, n_elem );
}
else
{
arma_debug_print("Cube::operator=(): copy omitted");
}
return *this;
}
@@ -813,11 +807,29 @@ Cube<eT>::Cube(eT* aux_mem, const uword aux_n_rows, const uword aux_n_cols, cons
{
init_cold();
arrayops::copy( memptr(), aux_mem, n_elem );
if(aux_mem == nullptr)
{
arrayops::fill_zeros(memptr(), n_elem);
}
else
{
arrayops::copy( memptr(), aux_mem, n_elem );
}
}
else
{
create_mat();
if(aux_mem == nullptr)
{
access::rw(mem_state) = 0;
init_cold();
arrayops::fill_zeros(memptr(), n_elem);
}
else
{
create_mat();
}
}
}
@@ -841,7 +853,14 @@ Cube<eT>::Cube(const eT* aux_mem, const uword aux_n_rows, const uword aux_n_cols
init_cold();
arrayops::copy( memptr(), aux_mem, n_elem );
if(aux_mem == nullptr)
{
arrayops::fill_zeros(memptr(), n_elem);
}
else
{
arrayops::copy( memptr(), aux_mem, n_elem );
}
}
@@ -930,7 +949,7 @@ Cube<eT>::Cube
, n_elem(0)
, n_alloc(0)
, mem_state(0)
, mem()
, mem(nullptr)
{
arma_debug_sigprint_this(this);
@@ -1060,7 +1079,7 @@ Cube<eT>::Cube(const subview_cube_slices<eT,T1>& X)
, n_elem(0)
, n_alloc(0)
, mem_state(0)
, mem()
, mem(nullptr)
{
arma_debug_sigprint_this(this);
@@ -2747,7 +2766,7 @@ Cube<eT>::Cube(const OpCube<T1, op_type>& X)
, n_elem(0)
, n_alloc(0)
, mem_state(0)
, mem()
, mem(nullptr)
{
arma_debug_sigprint_this(this);
@@ -2868,12 +2887,12 @@ Cube<eT>::Cube(const eOpCube<T1, eop_type>& X)
init_cold();
if(is_same_type<eop_type, eop_pow>::value)
if(arma_config::optimise_powexpr && is_same_type<eop_type, eop_pow>::value)
{
constexpr bool eT_non_int = is_non_integral<eT>::value;
constexpr bool eT_ok = is_real_or_cx<eT>::value;
if( X.aux == eT(2) ) { eop_square::apply(*this, reinterpret_cast< const eOpCube<T1, eop_square>& >(X)); return; }
if(eT_non_int && (X.aux == eT(0.5))) { eop_sqrt::apply(*this, reinterpret_cast< const eOpCube<T1, eop_sqrt >& >(X)); return; }
if( X.aux == eT(2) ) { eop_square::apply(*this, reinterpret_cast< const eOpCube<T1, eop_square>& >(X)); return; }
if(eT_ok && (X.aux == eT(0.5))) { eop_sqrt::apply(*this, reinterpret_cast< const eOpCube<T1, eop_sqrt >& >(X)); return; }
}
eop_type::apply(*this, X);
@@ -2898,12 +2917,12 @@ Cube<eT>::operator=(const eOpCube<T1, eop_type>& X)
init_warm(X.get_n_rows(), X.get_n_cols(), X.get_n_slices());
if(is_same_type<eop_type, eop_pow>::value)
if(arma_config::optimise_powexpr && is_same_type<eop_type, eop_pow>::value)
{
constexpr bool eT_non_int = is_non_integral<eT>::value;
constexpr bool eT_ok = is_real_or_cx<eT>::value;
if( X.aux == eT(2) ) { eop_square::apply(*this, reinterpret_cast< const eOpCube<T1, eop_square>& >(X)); return *this; }
if(eT_non_int && (X.aux == eT(0.5))) { eop_sqrt::apply(*this, reinterpret_cast< const eOpCube<T1, eop_sqrt >& >(X)); return *this; }
if( X.aux == eT(2) ) { eop_square::apply(*this, reinterpret_cast< const eOpCube<T1, eop_square>& >(X)); return *this; }
if(eT_ok && (X.aux == eT(0.5))) { eop_sqrt::apply(*this, reinterpret_cast< const eOpCube<T1, eop_sqrt >& >(X)); return *this; }
}
eop_type::apply(*this, X);
@@ -2928,12 +2947,12 @@ Cube<eT>::operator+=(const eOpCube<T1, eop_type>& X)
if(bad_alias) { const Cube<eT> tmp(X); return (*this).operator+=(tmp); }
if(is_same_type<eop_type, eop_pow>::value)
if(arma_config::optimise_powexpr && is_same_type<eop_type, eop_pow>::value)
{
constexpr bool eT_non_int = is_non_integral<eT>::value;
constexpr bool eT_ok = is_real_or_cx<eT>::value;
if( X.aux == eT(2) ) { eop_square::apply_inplace_plus(*this, reinterpret_cast< const eOpCube<T1, eop_square>& >(X)); return *this; }
if(eT_non_int && (X.aux == eT(0.5))) { eop_sqrt::apply_inplace_plus(*this, reinterpret_cast< const eOpCube<T1, eop_sqrt >& >(X)); return *this; }
if( X.aux == eT(2) ) { eop_square::apply_inplace_plus(*this, reinterpret_cast< const eOpCube<T1, eop_square>& >(X)); return *this; }
if(eT_ok && (X.aux == eT(0.5))) { eop_sqrt::apply_inplace_plus(*this, reinterpret_cast< const eOpCube<T1, eop_sqrt >& >(X)); return *this; }
}
eop_type::apply_inplace_plus(*this, X);
@@ -2958,12 +2977,12 @@ Cube<eT>::operator-=(const eOpCube<T1, eop_type>& X)
if(bad_alias) { const Cube<eT> tmp(X); return (*this).operator-=(tmp); }
if(is_same_type<eop_type, eop_pow>::value)
if(arma_config::optimise_powexpr && is_same_type<eop_type, eop_pow>::value)
{
constexpr bool eT_non_int = is_non_integral<eT>::value;
constexpr bool eT_ok = is_real_or_cx<eT>::value;
if( X.aux == eT(2) ) { eop_square::apply_inplace_minus(*this, reinterpret_cast< const eOpCube<T1, eop_square>& >(X)); return *this; }
if(eT_non_int && (X.aux == eT(0.5))) { eop_sqrt::apply_inplace_minus(*this, reinterpret_cast< const eOpCube<T1, eop_sqrt >& >(X)); return *this; }
if( X.aux == eT(2) ) { eop_square::apply_inplace_minus(*this, reinterpret_cast< const eOpCube<T1, eop_square>& >(X)); return *this; }
if(eT_ok && (X.aux == eT(0.5))) { eop_sqrt::apply_inplace_minus(*this, reinterpret_cast< const eOpCube<T1, eop_sqrt >& >(X)); return *this; }
}
eop_type::apply_inplace_minus(*this, X);
@@ -2988,12 +3007,12 @@ Cube<eT>::operator%=(const eOpCube<T1, eop_type>& X)
if(bad_alias) { const Cube<eT> tmp(X); return (*this).operator%=(tmp); }
if(is_same_type<eop_type, eop_pow>::value)
if(arma_config::optimise_powexpr && is_same_type<eop_type, eop_pow>::value)
{
constexpr bool eT_non_int = is_non_integral<eT>::value;
constexpr bool eT_ok = is_real_or_cx<eT>::value;
if( X.aux == eT(2) ) { eop_square::apply_inplace_schur(*this, reinterpret_cast< const eOpCube<T1, eop_square>& >(X)); return *this; }
if(eT_non_int && (X.aux == eT(0.5))) { eop_sqrt::apply_inplace_schur(*this, reinterpret_cast< const eOpCube<T1, eop_sqrt >& >(X)); return *this; }
if( X.aux == eT(2) ) { eop_square::apply_inplace_schur(*this, reinterpret_cast< const eOpCube<T1, eop_square>& >(X)); return *this; }
if(eT_ok && (X.aux == eT(0.5))) { eop_sqrt::apply_inplace_schur(*this, reinterpret_cast< const eOpCube<T1, eop_sqrt >& >(X)); return *this; }
}
eop_type::apply_inplace_schur(*this, X);
@@ -3018,12 +3037,12 @@ Cube<eT>::operator/=(const eOpCube<T1, eop_type>& X)
if(bad_alias) { const Cube<eT> tmp(X); return (*this).operator/=(tmp); }
if(is_same_type<eop_type, eop_pow>::value)
if(arma_config::optimise_powexpr && is_same_type<eop_type, eop_pow>::value)
{
constexpr bool eT_non_int = is_non_integral<eT>::value;
constexpr bool eT_ok = is_real_or_cx<eT>::value;
if( X.aux == eT(2) ) { eop_square::apply_inplace_div(*this, reinterpret_cast< const eOpCube<T1, eop_square>& >(X)); return *this; }
if(eT_non_int && (X.aux == eT(0.5))) { eop_sqrt::apply_inplace_div(*this, reinterpret_cast< const eOpCube<T1, eop_sqrt >& >(X)); return *this; }
if( X.aux == eT(2) ) { eop_square::apply_inplace_div(*this, reinterpret_cast< const eOpCube<T1, eop_square>& >(X)); return *this; }
if(eT_ok && (X.aux == eT(0.5))) { eop_sqrt::apply_inplace_div(*this, reinterpret_cast< const eOpCube<T1, eop_sqrt >& >(X)); return *this; }
}
eop_type::apply_inplace_div(*this, X);
@@ -3044,7 +3063,7 @@ Cube<eT>::Cube(const mtOpCube<eT, T1, op_type>& X)
, n_elem(0)
, n_alloc(0)
, mem_state(0)
, mem()
, mem(nullptr)
{
arma_debug_sigprint_this(this);
@@ -3140,11 +3159,11 @@ Cube<eT>::Cube(const GlueCube<T1, T2, glue_type>& X)
, n_elem(0)
, n_alloc(0)
, mem_state(0)
, mem()
, mem(nullptr)
{
arma_debug_sigprint_this(this);
this->operator=(X);
(*this).operator=(X);
}
@@ -3397,7 +3416,7 @@ Cube<eT>::Cube(const mtGlueCube<eT, T1, T2, glue_type>& X)
, n_elem(0)
, n_alloc(0)
, mem_state(0)
, mem()
, mem(nullptr)
{
arma_debug_sigprint_this(this);
@@ -3883,7 +3902,7 @@ arma_inline
eT*
Cube<eT>::slice_memptr(const uword uslice)
{
return const_cast<eT*>( &mem[ uslice*n_elem_slice ] );
return access::rwp( mem + (uslice*n_elem_slice) );
}
@@ -3894,7 +3913,7 @@ arma_inline
const eT*
Cube<eT>::slice_memptr(const uword uslice) const
{
return &mem[ uslice*n_elem_slice ];
return mem + (uslice*n_elem_slice);
}
@@ -3905,7 +3924,7 @@ arma_inline
eT*
Cube<eT>::slice_colptr(const uword uslice, const uword col)
{
return const_cast<eT*>( &mem[ uslice*n_elem_slice + col*n_rows] );
return access::rwp( mem + (uslice*n_elem_slice + col*n_rows) );
}
@@ -3916,7 +3935,7 @@ arma_inline
const eT*
Cube<eT>::slice_colptr(const uword uslice, const uword col) const
{
return &mem[ uslice*n_elem_slice + col*n_rows ];
return mem + (uslice*n_elem_slice + col*n_rows);
}
@@ -4193,12 +4212,12 @@ Cube<eT>::clamp(const eT min_val, const eT max_val)
if(is_cx<eT>::no)
{
arma_conform_check( (access::tmp_real(min_val) > access::tmp_real(max_val)), "Cube::clamp(): min_val must be less than max_val" );
arma_conform_check( ((access::tmp_real(min_val) <= access::tmp_real(max_val)) == false), "Cube::clamp(): min_val must be less than max_val" );
}
else
{
arma_conform_check( (access::tmp_real(min_val) > access::tmp_real(max_val)), "Cube::clamp(): real(min_val) must be less than real(max_val)" );
arma_conform_check( (access::tmp_imag(min_val) > access::tmp_imag(max_val)), "Cube::clamp(): imag(min_val) must be less than imag(max_val)" );
arma_conform_check( ((access::tmp_real(min_val) <= access::tmp_real(max_val)) == false), "Cube::clamp(): real(min_val) must be less than real(max_val)" );
arma_conform_check( ((access::tmp_imag(min_val) <= access::tmp_imag(max_val)) == false), "Cube::clamp(): imag(min_val) must be less than imag(max_val)" );
}
arrayops::clamp(memptr(), n_elem, min_val, max_val);
@@ -4223,6 +4242,30 @@ Cube<eT>::fill(const eT val)
template<typename eT>
template<typename fill_type>
inline
Cube<eT>&
Cube<eT>::fill(const fill::fill_class<fill_type>&)
{
arma_debug_sigprint();
arma_static_check( (is_same_type<fill_type, fill::fill_eye>::yes), "Cube::fill(): unsupported fill type" );
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_randu>::yes) { (*this).randu(); }
if(is_same_type<fill_type, fill::fill_randn>::yes) { (*this).randn(); }
if(is_same_type<fill_type, fill::fill_nan >::yes) { (*this).fill( priv::Datum_helper::nan <eT>() ); }
if(is_same_type<fill_type, fill::fill_pos_inf>::yes) { (*this).fill( priv::Datum_helper::pos_inf<eT>() ); }
if(is_same_type<fill_type, fill::fill_neg_inf>::yes) { (*this).fill( priv::Datum_helper::neg_inf<eT>() ); }
return *this;
}
template<typename eT>
inline
Cube<eT>&
@@ -5454,18 +5497,13 @@ template<typename eT>
template<uword fixed_n_rows, uword fixed_n_cols, uword fixed_n_slices>
template<typename fill_type>
inline
Cube<eT>::fixed<fixed_n_rows, fixed_n_cols, fixed_n_slices>::fixed(const fill::fill_class<fill_type>&)
Cube<eT>::fixed<fixed_n_rows, fixed_n_cols, fixed_n_slices>::fixed(const fill::fill_class<fill_type>& f)
{
arma_debug_sigprint_this(this);
mem_setup();
if(is_same_type<fill_type, fill::fill_zeros>::yes) { Cube<eT>::zeros(); }
if(is_same_type<fill_type, fill::fill_ones >::yes) { Cube<eT>::ones(); }
if(is_same_type<fill_type, fill::fill_randu>::yes) { Cube<eT>::randu(); }
if(is_same_type<fill_type, fill::fill_randn>::yes) { Cube<eT>::randn(); }
arma_static_check( (is_same_type<fill_type, fill::fill_eye>::yes), "Cube::fixed::fixed(): unsupported fill type" );
(*this).fill(f);
}
+6 -7
View File
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
@@ -22,16 +22,15 @@
//! support class for generator functions (zeros, ones)
template<typename eT, typename gen_type>
class GenCube
struct GenCube
: public BaseCube< eT, GenCube<eT, gen_type> >
{
public:
typedef eT elem_type;
typedef typename get_pod_type<elem_type>::result pod_type;
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);
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);
static constexpr bool has_subview = false;
const uword n_rows;
const uword n_cols;
+2 -2
View File
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
+5 -5
View File
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
@@ -22,11 +22,9 @@
//! support class for generator functions (zeros, ones, eye)
template<typename T1, typename gen_type>
class Gen
struct Gen
: public Base< typename T1::elem_type, Gen<T1, gen_type> >
{
public:
typedef typename T1::elem_type elem_type;
typedef typename get_pod_type<elem_type>::result pod_type;
@@ -37,6 +35,8 @@ class Gen
static constexpr bool is_col = T1::is_col;
static constexpr bool is_xvec = T1::is_xvec;
static constexpr bool has_subview = false;
const uword n_rows;
const uword n_cols;
+2 -2
View File
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
+5 -5
View File
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
@@ -23,13 +23,13 @@
//! 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> >
struct 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;
static constexpr bool has_subview = T1::has_subview || T2::has_subview;
inline GlueCube(const BaseCube<typename T1::elem_type, T1>& in_A, const BaseCube<typename T1::elem_type, T2>& in_B);
inline ~GlueCube();
+2 -2
View File
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
+5 -5
View File
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
@@ -43,15 +43,15 @@ struct Glue_traits<T1, T2, glue_type, false>
template<typename T1, typename T2, typename glue_type>
class Glue
struct 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:
typedef typename T1::elem_type elem_type;
typedef typename get_pod_type<elem_type>::result pod_type;
static constexpr bool has_subview = T1::has_subview || T2::has_subview;
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();
+2 -2
View File
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
+2 -2
View File
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
+39 -52
View File
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
@@ -106,7 +106,12 @@ MapMat<eT>::operator=(const MapMat<eT>& x)
{
arma_debug_sigprint();
if(this == &x) { return; }
if(this == &x)
{
arma_debug_print("MapMat::operator=(): copy omitted");
return;
}
access::rw(n_rows) = x.n_rows;
access::rw(n_cols) = x.n_cols;
@@ -970,18 +975,17 @@ MapMat_val<eT>::operator*=(const eT in_val)
if(it != it_end)
{
if(in_val != eT(0))
{
eT& val = (*it).second;
val *= in_val;
if(val == eT(0)) { map_ref.erase(it); }
}
else
{
map_ref.erase(it);
}
eT& val = (*it).second;
val *= in_val;
if(val == eT(0)) { map_ref.erase(it); }
}
else
{
const eT val = eT(0) * in_val; // in case in_val is inf or nan
if(val != eT(0)) { parent.set_val(index, val); }
}
}
@@ -1009,9 +1013,7 @@ MapMat_val<eT>::operator/=(const eT in_val)
}
else
{
// silly operation, but included for completeness
const eT val = eT(0) / in_val;
const eT val = eT(0) / in_val; // in case in_val is zero or nan
if(val != eT(0)) { parent.set_val(index, val); }
}
@@ -1481,18 +1483,11 @@ SpMat_MapMat_val<eT>::mul(const eT in_val)
if(it != it_end)
{
if(in_val != eT(0))
{
eT& val = (*it).second;
val *= in_val;
if(val == eT(0)) { map_ref.erase(it); }
}
else
{
map_ref.erase(it);
}
eT& val = (*it).second;
val *= in_val;
if(val == eT(0)) { map_ref.erase(it); }
s_parent.sync_state = 1;
@@ -1500,19 +1495,15 @@ SpMat_MapMat_val<eT>::mul(const eT in_val)
}
else
{
// element not found, ie. it's zero; zero multiplied by anything is zero, except for nan and inf
if(arma_isfinite(in_val) == false)
const eT result = eT(0) * in_val; // in case in_val is inf or nan
if(result != eT(0))
{
const eT result = eT(0) * in_val;
m_parent.set_val(index, result);
if(result != eT(0)) // paranoia, in case compiling with -ffast-math
{
m_parent.set_val(index, result);
s_parent.sync_state = 1;
access::rw(s_parent.n_nonzero) = m_parent.get_n_nonzero();
}
s_parent.sync_state = 1;
access::rw(s_parent.n_nonzero) = m_parent.get_n_nonzero();
}
}
}
@@ -1554,19 +1545,15 @@ SpMat_MapMat_val<eT>::div(const eT in_val)
}
else
{
// element not found, ie. it's zero; zero divided by anything is zero, except for zero and nan
if( (in_val == eT(0)) || (arma_isnan(in_val)) )
const eT result = eT(0) / in_val; // in case in_val is zero or nan
if(result != eT(0))
{
const eT result = eT(0) / in_val;
m_parent.set_val(index, result);
if(result != eT(0)) // paranoia, in case compiling with -ffast-math
{
m_parent.set_val(index, result);
s_parent.sync_state = 1;
access::rw(s_parent.n_nonzero) = m_parent.get_n_nonzero();
}
s_parent.sync_state = 1;
access::rw(s_parent.n_nonzero) = m_parent.get_n_nonzero();
}
}
}
+66 -30
View File
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
@@ -57,6 +57,8 @@ class Mat : public Base< eT, Mat<eT> >
static constexpr bool is_row = false;
static constexpr bool is_xvec = false;
static constexpr bool has_subview = false;
inline ~Mat();
inline Mat();
@@ -99,6 +101,7 @@ class Mat : public Base< eT, Mat<eT> >
inline Mat& operator*=(const eT val);
inline Mat& operator/=(const eT val);
inline Mat(const Mat& m, const arma_vec_indicator&, const uhword in_vec_state);
inline Mat(const Mat& m);
inline Mat& operator= (const Mat& m);
inline Mat& operator+=(const Mat& m);
@@ -107,6 +110,7 @@ class Mat : public Base< eT, Mat<eT> >
inline Mat& operator%=(const Mat& m);
inline Mat& operator/=(const Mat& m);
template<typename T1> inline Mat(const BaseCube<eT,T1>& X, const arma_vec_indicator&, const uhword in_vec_state);
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);
@@ -115,11 +119,12 @@ class Mat : public Base< eT, Mat<eT> >
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, typename T2>
inline explicit Mat(const Base<pod_type,T1>& A, const Base<pod_type,T2>& B);
template<typename T1, typename T2> inline explicit Mat(const Base<pod_type,T1>& A, const Base<pod_type,T2>& B, const arma_vec_indicator&, const uhword in_vec_state);
template<typename T1, typename T2> inline explicit Mat(const Base<pod_type,T1>& A, const Base<pod_type,T2>& B);
inline explicit Mat(const subview<eT>& X, const bool use_colmem); // only to be used by the quasi_unwrap class
inline explicit Mat(const subview<eT>& X, const bool reuse_mem); // only to be used by quasi_unwrap and partial_unwrap
inline Mat(const subview<eT>& X, const arma_vec_indicator&, const uhword in_vec_state);
inline Mat(const subview<eT>& X);
inline Mat& operator= (const subview<eT>& X);
inline Mat& operator+=(const subview<eT>& X);
@@ -135,6 +140,7 @@ class Mat : public Base< eT, Mat<eT> >
template<bool do_conj>
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, const arma_vec_indicator&, const uhword in_vec_state);
inline Mat(const subview_cube<eT>& X);
inline Mat& operator= (const subview_cube<eT>& X);
inline Mat& operator+=(const subview_cube<eT>& X);
@@ -143,6 +149,7 @@ class Mat : public Base< eT, Mat<eT> >
inline Mat& operator%=(const subview_cube<eT>& X);
inline Mat& operator/=(const subview_cube<eT>& X);
inline Mat(const diagview<eT>& X, const arma_vec_indicator&, const uhword in_vec_state);
inline Mat(const diagview<eT>& X);
inline Mat& operator= (const diagview<eT>& X);
inline Mat& operator+=(const diagview<eT>& X);
@@ -151,6 +158,7 @@ class Mat : public Base< eT, Mat<eT> >
inline Mat& operator%=(const diagview<eT>& X);
inline Mat& operator/=(const diagview<eT>& X);
template<typename T1> inline Mat(const subview_elem1<eT,T1>& X, const arma_vec_indicator&, const uhword in_vec_state);
template<typename T1> inline Mat(const subview_elem1<eT,T1>& X);
template<typename T1> inline Mat& operator= (const subview_elem1<eT,T1>& X);
template<typename T1> inline Mat& operator+=(const subview_elem1<eT,T1>& X);
@@ -159,6 +167,7 @@ class Mat : public Base< eT, Mat<eT> >
template<typename T1> inline Mat& operator%=(const subview_elem1<eT,T1>& X);
template<typename T1> inline Mat& operator/=(const subview_elem1<eT,T1>& X);
template<typename T1, typename T2> inline Mat(const subview_elem2<eT,T1,T2>& X, const arma_vec_indicator&, const uhword in_vec_state);
template<typename T1, typename T2> inline Mat(const subview_elem2<eT,T1,T2>& X);
template<typename T1, typename T2> inline Mat& operator= (const subview_elem2<eT,T1,T2>& X);
template<typename T1, typename T2> inline Mat& operator+=(const subview_elem2<eT,T1,T2>& X);
@@ -168,6 +177,7 @@ class Mat : public Base< eT, Mat<eT> >
template<typename T1, typename T2> inline Mat& operator/=(const subview_elem2<eT,T1,T2>& X);
// Operators on sparse matrices (and subviews)
template<typename T1> inline explicit Mat(const SpBase<eT, T1>& m, const arma_vec_indicator&, const uhword in_vec_state);
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);
@@ -176,11 +186,13 @@ class Mat : public Base< eT, Mat<eT> >
template<typename T1> inline Mat& operator%=(const SpBase<eT, T1>& m);
template<typename T1> inline Mat& operator/=(const SpBase<eT, T1>& m);
inline explicit Mat(const SpSubview<eT>& X, const arma_vec_indicator&, const uhword in_vec_state);
inline explicit Mat(const SpSubview<eT>& X);
inline Mat& operator= (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, const arma_vec_indicator&, const uhword in_vec_state);
inline explicit Mat(const spdiagview<eT>& X);
inline Mat& operator= (const spdiagview<eT>& X);
inline Mat& operator+=(const spdiagview<eT>& X);
@@ -190,8 +202,8 @@ class Mat : public Base< eT, Mat<eT> >
inline Mat& operator/=(const spdiagview<eT>& X);
arma_frown("use braced initialiser list instead") inline mat_injector<Mat> operator<<(const eT val);
arma_frown("use braced initialiser list instead") inline mat_injector<Mat> operator<<(const injector_end_of_row<>& x);
[[deprecated("use braced initialiser list instead")]] inline mat_injector<Mat> operator<<(const eT val);
[[deprecated("use braced initialiser list instead")]] inline mat_injector<Mat> operator<<(const injector_end_of_row<>& x);
arma_inline subview_row<eT> row(const uword row_num);
@@ -310,8 +322,8 @@ class Mat : public Base< eT, Mat<eT> >
template<typename T1> inline void shed_rows(const Base<uword, T1>& indices);
template<typename T1> inline void shed_cols(const Base<uword, T1>& indices);
arma_frown("use insert_rows(row_num, N) instead") inline void insert_rows(const uword row_num, const uword N, const bool set_to_zero);
arma_frown("use insert_cols(col_num, N) instead") inline void insert_cols(const uword col_num, const uword N, const bool set_to_zero);
[[deprecated("use insert_rows(row_num, N) instead")]] inline void insert_rows(const uword row_num, const uword N, const bool set_to_zero);
[[deprecated("use insert_cols(col_num, N) instead")]] inline void insert_cols(const uword col_num, const uword N, const bool set_to_zero);
inline void insert_rows(const uword row_num, const uword N);
inline void insert_cols(const uword col_num, const uword N);
@@ -320,6 +332,7 @@ class Mat : public Base< eT, Mat<eT> >
template<typename T1> inline void insert_cols(const uword col_num, const Base<eT,T1>& X);
template<typename T1, typename gen_type> inline Mat(const Gen<T1, gen_type>& X, const arma_vec_indicator&, const uhword in_vec_state);
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);
@@ -328,6 +341,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 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, const arma_vec_indicator&, const uhword in_vec_state);
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);
@@ -336,6 +350,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 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, const arma_vec_indicator&, const uhword in_vec_state);
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);
@@ -344,6 +359,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 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, const arma_vec_indicator&, const uhword in_vec_state);
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);
@@ -352,6 +368,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& operator/=(const mtOp<eT, T1, op_type>& X);
template<typename T1, typename op_type> inline Mat(const CubeToMatOp<T1, op_type>& X, const arma_vec_indicator&, const uhword in_vec_state);
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);
@@ -360,6 +377,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& operator/=(const CubeToMatOp<T1, op_type>& X);
template<typename T1, typename op_type> inline Mat(const SpToDOp<T1, op_type>& X, const arma_vec_indicator&, const uhword in_vec_state);
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);
@@ -368,6 +386,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 op_type> inline Mat& operator/=(const SpToDOp<T1, op_type>& X);
template<typename T1, typename op_type> inline explicit Mat(const mtSpReduceOp<eT, T1, op_type>& X, const arma_vec_indicator&, const uhword in_vec_state);
template<typename T1, typename op_type> inline explicit Mat(const mtSpReduceOp<eT, T1, op_type>& X);
template<typename T1, typename op_type> inline Mat& operator= (const mtSpReduceOp<eT, T1, op_type>& X);
template<typename T1, typename op_type> inline Mat& operator+=(const mtSpReduceOp<eT, T1, op_type>& X);
@@ -376,6 +395,7 @@ class Mat : public Base< eT, Mat<eT> >
template<typename T1, typename op_type> inline Mat& operator%=(const mtSpReduceOp<eT, T1, op_type>& X);
template<typename T1, typename op_type> inline Mat& operator/=(const mtSpReduceOp<eT, T1, op_type>& X);
template<typename T1, typename T2, typename glue_type> inline Mat(const Glue<T1, T2, glue_type>& X, const arma_vec_indicator&, const uhword in_vec_state);
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);
@@ -387,6 +407,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> 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, const arma_vec_indicator&, const uhword in_vec_state);
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);
@@ -395,6 +416,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 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, const arma_vec_indicator&, const uhword in_vec_state);
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);
@@ -403,6 +425,7 @@ class Mat : public Base< eT, Mat<eT> >
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(const SpToDGlue<T1, T2, glue_type>& X, const arma_vec_indicator&, const uhword in_vec_state);
template<typename T1, typename T2, typename glue_type> inline Mat(const SpToDGlue<T1, T2, glue_type>& X);
template<typename T1, typename T2, typename glue_type> inline Mat& operator= (const SpToDGlue<T1, T2, glue_type>& X);
template<typename T1, typename T2, typename glue_type> inline Mat& operator+=(const SpToDGlue<T1, T2, glue_type>& X);
@@ -431,6 +454,8 @@ class Mat : public Base< eT, Mat<eT> >
arma_warn_unused arma_inline eT& operator() (const uword in_row, const uword in_col);
arma_warn_unused arma_inline const eT& operator() (const uword in_row, const uword in_col) const;
inline void push_back(const eT val);
arma_inline const Mat& operator++();
arma_inline void operator++(int);
@@ -485,7 +510,7 @@ class Mat : public Base< eT, Mat<eT> >
inline Mat& reshape(const uword new_n_rows, const uword new_n_cols);
inline Mat& reshape(const SizeMat& s);
arma_frown("use reshape(n_rows, n_cols) instead") 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
[[deprecated("use reshape(n_rows, n_cols) instead")]] 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 Mat& for_each(functor F);
@@ -541,11 +566,11 @@ class Mat : public Base< eT, Mat<eT> >
arma_warn_unused inline eT min() const;
arma_warn_unused inline eT max() const;
arma_frown("use .index_min() instead") inline eT min(uword& index_of_min_val) const;
arma_frown("use .index_max() instead") inline eT max(uword& index_of_max_val) const;
[[deprecated("use .index_min() instead")]] inline eT min(uword& index_of_min_val) const;
[[deprecated("use .index_max() instead")]] inline eT max(uword& index_of_max_val) const;
arma_frown("use .index_min() with ind2sub() instead") inline eT min(uword& row_of_min_val, uword& col_of_min_val) const;
arma_frown("use .index_max() with ind2sub() instead") inline eT max(uword& row_of_max_val, uword& col_of_max_val) const;
[[deprecated("use .index_min() with ind2sub() instead")]] inline eT min(uword& row_of_min_val, uword& col_of_min_val) const;
[[deprecated("use .index_max() with ind2sub() instead")]] inline eT max(uword& row_of_max_val, uword& col_of_max_val) const;
arma_cold inline bool save(const std::string name, const file_type type = arma_binary) const;
@@ -558,15 +583,15 @@ class Mat : public Base< eT, Mat<eT> >
arma_cold inline bool load(const csv_name& spec, const file_type type = csv_ascii);
arma_cold inline bool load( std::istream& is, const file_type type = auto_detect);
arma_frown("use save() instead") inline bool quiet_save(const std::string name, const file_type type = arma_binary) const;
arma_frown("use save() instead") inline bool quiet_save(const hdf5_name& spec, const file_type type = hdf5_binary) const;
arma_frown("use save() instead") inline bool quiet_save(const csv_name& spec, const file_type type = csv_ascii) const;
arma_frown("use save() instead") inline bool quiet_save( std::ostream& os, const file_type type = arma_binary) const;
[[deprecated("use save() instead")]] inline bool quiet_save(const std::string name, const file_type type = arma_binary) const;
[[deprecated("use save() instead")]] inline bool quiet_save(const hdf5_name& spec, const file_type type = hdf5_binary) const;
[[deprecated("use save() instead")]] inline bool quiet_save(const csv_name& spec, const file_type type = csv_ascii) const;
[[deprecated("use save() instead")]] inline bool quiet_save( std::ostream& os, const file_type type = arma_binary) const;
arma_frown("use load() instead") inline bool quiet_load(const std::string name, const file_type type = auto_detect);
arma_frown("use load() instead") inline bool quiet_load(const hdf5_name& spec, const file_type type = hdf5_binary);
arma_frown("use load() instead") inline bool quiet_load(const csv_name& spec, const file_type type = csv_ascii);
arma_frown("use load() instead") inline bool quiet_load( std::istream& is, const file_type type = auto_detect);
[[deprecated("use load() instead")]] inline bool quiet_load(const std::string name, const file_type type = auto_detect);
[[deprecated("use load() instead")]] inline bool quiet_load(const hdf5_name& spec, const file_type type = hdf5_binary);
[[deprecated("use load() instead")]] inline bool quiet_load(const csv_name& spec, const file_type type = csv_ascii);
[[deprecated("use load() instead")]] inline bool quiet_load( std::istream& is, const file_type type = auto_detect);
// for container-like functionality
@@ -798,17 +823,20 @@ class Mat : public Base< eT, Mat<eT> >
inline Mat(const arma_fixed_indicator&, const uword in_n_rows, const uword in_n_cols, const uhword in_vec_state, const eT* in_mem);
template<int vec_mode> inline void vec_push_back(const eT val, const arma_vec_mode_indicator<vec_mode>&);
friend class Cube<eT>;
friend class subview_cube<eT>;
friend class glue_join;
friend class op_strans;
friend class op_htrans;
friend class op_resize;
friend class op_mean;
friend class op_max;
friend class op_min;
friend struct glue_join;
friend struct op_strans;
friend struct op_htrans;
friend struct op_resize;
friend struct op_mean;
friend struct op_max;
friend struct op_min;
public:
@@ -844,6 +872,8 @@ class Mat<eT>::fixed : public Mat<eT>
static constexpr bool is_row = (fixed_n_rows == 1);
static constexpr bool is_xvec = false;
static constexpr bool has_subview = false;
static const uword n_rows; // value provided below the class definition
static const uword n_cols; // value provided below the class definition
static const uword n_elem; // value provided below the class definition
@@ -900,6 +930,8 @@ class Mat<eT>::fixed : public Mat<eT>
arma_warn_unused arma_inline eT& operator() (const uword in_row, const uword in_col);
arma_warn_unused arma_inline const eT& operator() (const uword in_row, const uword in_col) const;
inline void push_back(const eT) = delete;
arma_warn_unused arma_inline eT* colptr(const uword in_col);
arma_warn_unused arma_inline const eT* colptr(const uword in_col) const;
@@ -957,4 +989,8 @@ class Mat_aux
template<typename eT> class Mat_noalias : public Mat<eT> {};
//! @}
File diff suppressed because it is too large Load Diff
+5 -5
View File
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
@@ -21,13 +21,13 @@
template<typename T1, typename op_type>
class OpCube : public BaseCube< typename T1::elem_type, OpCube<T1, op_type> >
struct OpCube : public BaseCube< typename T1::elem_type, OpCube<T1, op_type> >
{
public:
typedef typename T1::elem_type elem_type;
typedef typename get_pod_type<elem_type>::result pod_type;
static constexpr bool has_subview = T1::has_subview;
inline explicit OpCube(const BaseCube<typename T1::elem_type, T1>& in_m);
inline OpCube(const BaseCube<typename T1::elem_type, T1>& in_m, const elem_type in_aux);
inline OpCube(const BaseCube<typename T1::elem_type, T1>& in_m, const elem_type in_aux, const uword in_aux_uword_a, const uword in_aux_uword_b, const uword in_aux_uword_c);
+2 -2
View File
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
+5 -5
View File
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
@@ -43,15 +43,15 @@ struct Op_traits<T1, op_type, false>
template<typename T1, typename op_type>
class Op
struct 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:
typedef typename T1::elem_type elem_type;
typedef typename get_pod_type<elem_type>::result pod_type;
static constexpr bool has_subview = T1::has_subview;
inline explicit Op(const T1& in_m);
inline Op(const T1& in_m, const elem_type in_aux);
inline Op(const T1& in_m, const elem_type in_aux, const uword in_aux_uword_a, const uword in_aux_uword_b);
+2 -2
View File
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
+10 -10
View File
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
@@ -20,7 +20,7 @@
//! @{
// within each specialisation of the Proxy class:
// within each specialisation of the Proxy struct:
//
// elem_type = type of the elements obtained from object Q
// pod_type = underlying type of elements if elem_type is std::complex
@@ -1523,7 +1523,7 @@ struct Proxy_xtrans_default< Op<T1, op_htrans> >
static constexpr bool is_col = false;
static constexpr bool is_xvec = false;
const unwrap<T1> U;
const plain_unwrap<T1> U;
const xtrans_mat<elem_type,true> Q;
inline explicit Proxy_xtrans_default(const Op<T1, op_htrans>& A)
@@ -1537,7 +1537,7 @@ struct Proxy_xtrans_default< Op<T1, op_htrans> >
arma_inline aligned_ea_type get_aligned_ea() const { return Q; }
template<typename eT2>
arma_inline bool is_alias(const Mat<eT2>& X) const { return void_ptr(&(U.M)) == void_ptr(&X); }
arma_inline bool is_alias(const Mat<eT2>& X) const { return U.is_alias(X); }
template<typename eT2>
arma_inline bool has_overlap(const subview<eT2>& X) const { return is_alias(X.m); }
@@ -1564,7 +1564,7 @@ struct Proxy_xtrans_default< Op<T1, op_strans> >
static constexpr bool is_col = false;
static constexpr bool is_xvec = false;
const unwrap<T1> U;
const plain_unwrap<T1> U;
const xtrans_mat<elem_type,false> Q;
inline explicit Proxy_xtrans_default(const Op<T1, op_strans>& A)
@@ -1578,7 +1578,7 @@ struct Proxy_xtrans_default< Op<T1, op_strans> >
arma_inline aligned_ea_type get_aligned_ea() const { return Q; }
template<typename eT2>
arma_inline bool is_alias(const Mat<eT2>& X) const { return void_ptr(&(U.M)) == void_ptr(&X); }
arma_inline bool is_alias(const Mat<eT2>& X) const { return U.is_alias(X); }
template<typename eT2>
arma_inline bool has_overlap(const subview<eT2>& X) const { return is_alias(X.m); }
@@ -2419,8 +2419,8 @@ struct Proxy_vectorise_col_mat< Op<T1, op_vectorise_col> >
static constexpr bool is_col = true;
static constexpr bool is_xvec = false;
const unwrap<T1> U;
const Mat<elem_type> Q;
const plain_unwrap<T1> U;
const Mat<elem_type> Q;
inline explicit Proxy_vectorise_col_mat(const Op<T1, op_vectorise_col>& A)
: U(A.m)
@@ -2441,7 +2441,7 @@ struct Proxy_vectorise_col_mat< Op<T1, op_vectorise_col> >
arma_inline aligned_ea_type get_aligned_ea() const { return Q; }
template<typename eT2>
arma_inline bool is_alias(const Mat<eT2>& X) const { return ( void_ptr(&X) == void_ptr(&(U.M)) ); }
arma_inline bool is_alias(const Mat<eT2>& X) const { return U.is_alias(X); }
template<typename eT2>
arma_inline bool has_overlap(const subview<eT2>& X) const { return is_alias(X.m); }
+2 -2
View File
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
+20 -8
View File
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
@@ -33,6 +33,8 @@ class Row : public Mat<eT>
static constexpr bool is_row = true;
static constexpr bool is_xvec = false;
static constexpr bool has_subview = false;
inline Row();
inline Row(const Row<eT>& X);
@@ -67,9 +69,6 @@ class Row : public Mat<eT>
inline Row(Row&& m);
inline Row& operator=(Row&& m);
// inline Row(Mat<eT>&& m);
// inline Row& operator=(Mat<eT>&& m);
inline Row& operator=(const eT val);
inline Row& operator=(const Row& X);
@@ -91,7 +90,7 @@ class Row : public Mat<eT>
inline Row(const subview_cube<eT>& X);
inline Row& operator=(const subview_cube<eT>& X);
arma_frown("use braced initialiser list instead") inline mat_injector<Row> operator<<(const eT val);
[[deprecated("use braced initialiser list instead")]] inline mat_injector<Row> operator<<(const eT val);
arma_warn_unused arma_inline const Op<Row<eT>,op_htrans> t() const;
arma_warn_unused arma_inline const Op<Row<eT>,op_htrans> ht() const;
@@ -141,8 +140,8 @@ class Row : public Mat<eT>
template<typename T1> inline void shed_cols(const Base<uword, T1>& indices);
arma_deprecated inline void insert_cols(const uword col_num, const uword N, const bool set_to_zero);
inline void insert_cols(const uword col_num, const uword N);
[[deprecated]] inline void insert_cols(const uword col_num, const uword N, const bool set_to_zero);
inline void insert_cols(const uword col_num, const uword N);
template<typename T1> inline void insert_cols(const uword col_num, const Base<eT,T1>& X);
@@ -153,6 +152,12 @@ class Row : public Mat<eT>
arma_warn_unused arma_inline eT& at(const uword in_row, const uword in_col);
arma_warn_unused arma_inline const eT& at(const uword in_row, const uword in_col) const;
inline void push_back(const eT val);
inline constexpr bool is_vec() const { return true; }
inline constexpr bool is_rowvec() const { return true; }
inline constexpr bool is_colvec() const { return false; }
typedef eT* row_iterator;
typedef const eT* const_row_iterator;
@@ -164,6 +169,9 @@ class Row : public Mat<eT>
inline const_row_iterator end_row (const uword row_num) const;
inline explicit Row(const subview<eT>& X, const bool reuse_mem); // only to be used by the partial_unwrap class
template<uword fixed_n_elem> class fixed;
@@ -205,6 +213,8 @@ class Row<eT>::fixed : public Row<eT>
static constexpr bool is_row = true;
static constexpr bool is_xvec = false;
static constexpr bool has_subview = false;
static const uword n_rows; // value provided below the class definition
static const uword n_cols; // value provided below the class definition
static const uword n_elem; // value provided below the class definition
@@ -260,6 +270,8 @@ class Row<eT>::fixed : public Row<eT>
arma_warn_unused arma_inline eT& operator() (const uword in_row, const uword in_col);
arma_warn_unused arma_inline const eT& operator() (const uword in_row, const uword in_col) const;
inline void push_back(const eT) = delete;
arma_warn_unused arma_inline eT* memptr();
arma_warn_unused arma_inline const eT* memptr() const;
+53 -83
View File
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
@@ -431,64 +431,6 @@ Row<eT>::operator=(Row<eT>&& X)
// template<typename eT>
// inline
// Row<eT>::Row(Mat<eT>&& X)
// : Mat<eT>(arma_vec_indicator(), 2)
// {
// arma_debug_sigprint(arma_str::format("this: %x; X: %x") % this % &X);
//
// if(X.n_rows != 1) { const Mat<eT>& XX = X; Mat<eT>::operator=(XX); return; }
//
// 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) )
// {
// access::rw(Mat<eT>::mem_state) = X.mem_state;
// access::rw(Mat<eT>::mem) = X.mem;
//
// 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;
// }
// else // condition: (X.n_alloc <= arma_config::mat_prealloc) || (X.mem_state == 0) || (X.mem_state == 3)
// {
// (*this).init_cold();
//
// arrayops::copy( (*this).memptr(), X.mem, X.n_elem );
//
// if( (X.mem_state == 0) && (X.n_alloc <= arma_config::mat_prealloc) )
// {
// 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=(Mat<eT>&& X)
// {
// arma_debug_sigprint(arma_str::format("this: %x; X: %x") % this % &X);
//
// if(X.n_rows != 1) { const Mat<eT>& XX = X; Mat<eT>::operator=(XX); return *this; }
//
// (*this).steal_mem(X, true);
//
// return *this;
// }
template<typename eT>
inline
Row<eT>&
@@ -521,11 +463,9 @@ template<typename eT>
template<typename T1>
inline
Row<eT>::Row(const Base<eT,T1>& X)
: Mat<eT>(arma_vec_indicator(), 2)
: Mat<eT>(X.get_ref(), arma_vec_indicator(), 2)
{
arma_debug_sigprint();
Mat<eT>::operator=(X.get_ref());
arma_debug_sigprint_this(this);
}
@@ -549,11 +489,9 @@ template<typename eT>
template<typename T1>
inline
Row<eT>::Row(const SpBase<eT,T1>& X)
: Mat<eT>(arma_vec_indicator(), 2)
: Mat<eT>(X.get_ref(), arma_vec_indicator(), 2)
{
arma_debug_sigprint();
Mat<eT>::operator=(X.get_ref());
arma_debug_sigprint_this(this);
}
@@ -607,12 +545,9 @@ Row<eT>::Row
const Base<typename Row<eT>::pod_type, T1>& A,
const Base<typename Row<eT>::pod_type, T2>& B
)
: Mat<eT>(A.get_ref(), B.get_ref(), arma_vec_indicator(), 2)
{
arma_debug_sigprint();
access::rw(Mat<eT>::vec_state) = 2;
Mat<eT>::init(A,B);
arma_debug_sigprint_this(this);
}
@@ -621,12 +556,9 @@ template<typename eT>
template<typename T1>
inline
Row<eT>::Row(const BaseCube<eT,T1>& X)
: Mat<eT>(X.get_ref(), arma_vec_indicator(), 2)
{
arma_debug_sigprint();
access::rw(Mat<eT>::vec_state) = 2;
Mat<eT>::operator=(X);
arma_debug_sigprint_this(this);
}
@@ -649,12 +581,9 @@ Row<eT>::operator=(const BaseCube<eT,T1>& X)
template<typename eT>
inline
Row<eT>::Row(const subview_cube<eT>& X)
: Mat<eT>(X, arma_vec_indicator(), 2)
{
arma_debug_sigprint();
access::rw(Mat<eT>::vec_state) = 2;
Mat<eT>::operator=(X);
arma_debug_sigprint_this(this);
}
@@ -1221,6 +1150,25 @@ Row<eT>::at(const uword, const uword in_col) const
template<typename eT>
inline
void
Row<eT>::push_back(const eT val)
{
arma_debug_sigprint();
if(Mat<eT>::mem_state != 0)
{
arma_conform_check(true, "Row::push_back(): unsupported operation as auxiliary memory is in use");
return;
}
Mat<eT>::vec_push_back(val, arma_rowvec_indicator());
}
template<typename eT>
inline
typename Row<eT>::row_iterator
@@ -1277,6 +1225,20 @@ Row<eT>::end_row(const uword row_num) const
template<typename eT>
inline
Row<eT>::Row(const subview<eT>& X, const bool reuse_mem)
: Mat<eT>(X, reuse_mem)
{
arma_debug_sigprint_this(this);
}
//
template<typename eT>
template<uword fixed_n_elem>
arma_inline
@@ -1350,6 +1312,10 @@ Row<eT>::fixed<fixed_n_elem>::fixed(const fill::fill_class<fill_type>&)
if(is_same_type<fill_type, fill::fill_eye >::yes) { Mat<eT>::eye(); }
if(is_same_type<fill_type, fill::fill_randu>::yes) { Mat<eT>::randu(); }
if(is_same_type<fill_type, fill::fill_randn>::yes) { Mat<eT>::randn(); }
if(is_same_type<fill_type, fill::fill_nan >::yes) { (*this).fill( priv::Datum_helper::nan <eT>() ); }
if(is_same_type<fill_type, fill::fill_pos_inf>::yes) { (*this).fill( priv::Datum_helper::pos_inf<eT>() ); }
if(is_same_type<fill_type, fill::fill_neg_inf>::yes) { (*this).fill( priv::Datum_helper::neg_inf<eT>() ); }
}
@@ -1872,6 +1838,10 @@ Row<eT>::fixed<fixed_n_elem>::ones()
//
template<typename eT>
inline
Row<eT>::Row(const arma_fixed_indicator&, const uword in_n_elem, const eT* in_mem)
+3 -5
View File
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
@@ -21,10 +21,8 @@
class SizeCube
struct SizeCube
{
public:
const uword n_rows;
const uword n_cols;
const uword n_slices;
+2 -2
View File
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
+3 -5
View File
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
@@ -21,10 +21,8 @@
class SizeMat
struct SizeMat
{
public:
const uword n_rows;
const uword n_cols;
+2 -2
View File
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
+6 -6
View File
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
@@ -76,11 +76,11 @@ struct SpBase
arma_warn_unused inline elem_type min() const;
arma_warn_unused inline elem_type max() const;
arma_frown("use .index_min() instead") inline elem_type min(uword& index_of_min_val) const;
arma_frown("use .index_max() instead") inline elem_type max(uword& index_of_max_val) const;
[[deprecated("use .index_min() instead")]] inline elem_type min(uword& index_of_min_val) const;
[[deprecated("use .index_max() instead")]] inline elem_type max(uword& index_of_max_val) const;
arma_frown("use .index_min() with ind2sub() instead") inline elem_type min(uword& row_of_min_val, uword& col_of_min_val) const;
arma_frown("use .index_max() with ind2sub() instead") inline elem_type max(uword& row_of_max_val, uword& col_of_max_val) const;
[[deprecated("use .index_min() with ind2sub() instead")]] inline elem_type min(uword& row_of_min_val, uword& col_of_min_val) const;
[[deprecated("use .index_max() with ind2sub() instead")]] inline elem_type max(uword& row_of_max_val, uword& col_of_max_val) const;
arma_warn_unused inline uword index_min() const;
arma_warn_unused inline uword index_max() const;
+8 -8
View File
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
@@ -527,7 +527,7 @@ SpBase<elem_type,derived>::is_zero(const typename get_pod_type<elem_type>::resul
typedef typename get_pod_type<elem_type>::result T;
arma_conform_check( (tol < T(0)), "is_zero(): parameter 'tol' must be >= 0" );
arma_conform_check( ((tol >= T(0)) == false), "is_zero(): parameter 'tol' must be >= 0" );
const SpProxy<derived> P( (*this).get_ref() );
@@ -554,8 +554,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(eop_aux::arma_abs(val_real) > tol) { return false; }
if(eop_aux::arma_abs(val_imag) > tol) { return false; }
if( (eop_aux::arma_abs(val_real) <= tol) == false ) { return false; }
if( (eop_aux::arma_abs(val_imag) <= tol) == false ) { return false; }
++it;
}
@@ -564,7 +564,7 @@ SpBase<elem_type,derived>::is_zero(const typename get_pod_type<elem_type>::resul
{
while(it != it_end)
{
if(eop_aux::arma_abs(*it) > tol) { return false; }
if( (eop_aux::arma_abs(*it) <= tol) == false ) { return false; }
++it;
}
@@ -748,7 +748,7 @@ SpBase<elem_type,derived>::is_finite() const
while(it != it_end)
{
if(arma_isfinite(*it) == false) { return false; }
if(arma_isnonfinite(*it)) { return false; }
++it;
}
}
@@ -850,7 +850,7 @@ SpBase<elem_type,derived>::has_nonfinite() const
while(it != it_end)
{
if(arma_isfinite(*it) == false) { return true; }
if(arma_isnonfinite(*it)) { return true; }
++it;
}
}
+2 -2
View File
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
+2 -2
View File
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
+5 -5
View File
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
@@ -22,10 +22,8 @@
template<typename T1, typename T2, typename spglue_type>
class SpGlue : public SpBase< typename T1::elem_type, SpGlue<T1, T2, spglue_type> >
struct 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;
@@ -33,6 +31,8 @@ class SpGlue : public SpBase< typename T1::elem_type, SpGlue<T1, T2, spglue_type
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;
static constexpr bool has_subview = T1::has_subview || T2::has_subview;
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);
inline ~SpGlue();
+2 -2
View File
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
+12 -6
View File
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
@@ -33,6 +33,8 @@ class SpMat : public SpBase< eT, SpMat<eT> >
static constexpr bool is_col = false;
static constexpr bool is_xvec = false;
static constexpr bool has_subview = false;
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)
@@ -399,11 +401,11 @@ class SpMat : public SpBase< eT, SpMat<eT> >
arma_cold inline bool load(const csv_name& spec, const file_type type = csv_ascii);
arma_cold inline bool load( std::istream& is, const file_type type = arma_binary);
arma_frown("use save() instead") inline bool quiet_save(const std::string name, const file_type type = arma_binary) const;
arma_frown("use save() instead") inline bool quiet_save( std::ostream& os, const file_type type = arma_binary) const;
[[deprecated("use save() instead")]] inline bool quiet_save(const std::string name, const file_type type = arma_binary) const;
[[deprecated("use save() instead")]] inline bool quiet_save( std::ostream& os, const file_type type = arma_binary) const;
arma_frown("use load() instead") inline bool quiet_load(const std::string name, const file_type type = arma_binary);
arma_frown("use load() instead") inline bool quiet_load( std::istream& is, const file_type type = arma_binary);
[[deprecated("use load() instead")]] inline bool quiet_load(const std::string name, const file_type type = arma_binary);
[[deprecated("use load() instead")]] inline bool quiet_load( std::istream& is, const file_type type = arma_binary);
@@ -741,6 +743,10 @@ class SpMat_aux
template<typename eT> class SpMat_noalias : public SpMat<eT> {};
#define ARMA_HAS_SPMAT
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
+165 -111
View File
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
@@ -612,33 +612,26 @@ SpMat<eT>::operator*=(const eT val)
{
arma_debug_sigprint();
if(val != eT(0))
sync_csc();
invalidate_cache();
const uword n_nz = n_nonzero;
eT* vals = access::rwp(values);
bool has_zero = false;
for(uword i=0; i<n_nz; ++i)
{
sync_csc();
invalidate_cache();
eT& vals_i = vals[i];
const uword n_nz = n_nonzero;
vals_i *= val;
eT* vals = access::rwp(values);
bool has_zero = false;
for(uword i=0; i<n_nz; ++i)
{
eT& vals_i = vals[i];
vals_i *= val;
if(vals_i == eT(0)) { has_zero = true; }
}
if(has_zero) { remove_zeros(); }
}
else
{
(*this).zeros();
if(vals_i == eT(0)) { has_zero = true; }
}
if(has_zero) { remove_zeros(); }
return *this;
}
@@ -695,15 +688,22 @@ SpMat<eT>::operator=(const SpMat<eT>& x)
template<typename eT>
inline
SpMat<eT>&
SpMat<eT>::operator+=(const SpMat<eT>& x)
SpMat<eT>::operator+=(const SpMat<eT>& X)
{
arma_debug_sigprint();
sync_csc();
SpMat<eT> out = (*this) + x;
steal_mem(out);
if(X.n_nonzero == 0)
{
arma_conform_assert_same_size(n_rows, n_cols, X.n_rows, X.n_cols, "addition");
}
else
{
SpMat<eT> tmp = (*this) + X;
steal_mem(tmp);
}
return *this;
}
@@ -713,15 +713,22 @@ SpMat<eT>::operator+=(const SpMat<eT>& x)
template<typename eT>
inline
SpMat<eT>&
SpMat<eT>::operator-=(const SpMat<eT>& x)
SpMat<eT>::operator-=(const SpMat<eT>& X)
{
arma_debug_sigprint();
sync_csc();
SpMat<eT> out = (*this) - x;
steal_mem(out);
if(X.n_nonzero == 0)
{
arma_conform_assert_same_size(n_rows, n_cols, X.n_rows, X.n_cols, "subtraction");
}
else
{
SpMat<eT> tmp = (*this) - X;
steal_mem(tmp);
}
return *this;
}
@@ -731,15 +738,15 @@ SpMat<eT>::operator-=(const SpMat<eT>& x)
template<typename eT>
inline
SpMat<eT>&
SpMat<eT>::operator*=(const SpMat<eT>& y)
SpMat<eT>::operator*=(const SpMat<eT>& X)
{
arma_debug_sigprint();
sync_csc();
SpMat<eT> z = (*this) * y;
SpMat<eT> tmp = (*this) * X;
steal_mem(z);
steal_mem(tmp);
return *this;
}
@@ -750,15 +757,24 @@ SpMat<eT>::operator*=(const SpMat<eT>& y)
template<typename eT>
inline
SpMat<eT>&
SpMat<eT>::operator%=(const SpMat<eT>& y)
SpMat<eT>::operator%=(const SpMat<eT>& X)
{
arma_debug_sigprint();
sync_csc();
SpMat<eT> z = (*this) % y;
steal_mem(z);
if(X.n_nonzero == 0)
{
arma_conform_assert_same_size(n_rows, n_cols, X.n_rows, X.n_cols, "element-wise multiplication");
(*this).zeros();
}
else
{
SpMat<eT> tmp = (*this) % X;
steal_mem(tmp);
}
return *this;
}
@@ -1345,9 +1361,16 @@ SpMat<eT>::operator+=(const SpSubview<eT>& X)
sync_csc();
SpMat<eT> tmp = (*this) + X;
steal_mem(tmp);
if(X.n_nonzero == 0)
{
arma_conform_assert_same_size(n_rows, n_cols, X.n_rows, X.n_cols, "addition");
}
else
{
SpMat<eT> tmp = (*this) + X;
steal_mem(tmp);
}
return *this;
}
@@ -1363,64 +1386,82 @@ SpMat<eT>::operator-=(const SpSubview<eT>& X)
sync_csc();
SpMat<eT> tmp = (*this) - X;
steal_mem(tmp);
return *this;
}
template<typename eT>
inline
SpMat<eT>&
SpMat<eT>::operator*=(const SpSubview<eT>& y)
{
arma_debug_sigprint();
sync_csc();
SpMat<eT> z = (*this) * y;
steal_mem(z);
return *this;
}
template<typename eT>
inline
SpMat<eT>&
SpMat<eT>::operator%=(const SpSubview<eT>& x)
{
arma_debug_sigprint();
sync_csc();
SpMat<eT> tmp = (*this) % x;
steal_mem(tmp);
return *this;
}
template<typename eT>
inline
SpMat<eT>&
SpMat<eT>::operator/=(const SpSubview<eT>& x)
{
arma_debug_sigprint();
arma_conform_assert_same_size(n_rows, n_cols, x.n_rows, x.n_cols, "element-wise division");
// There is no pretty way to do this.
for(uword elem = 0; elem < n_elem; elem++)
if(X.n_nonzero == 0)
{
at(elem) /= x(elem);
arma_conform_assert_same_size(n_rows, n_cols, X.n_rows, X.n_cols, "subtraction");
}
else
{
SpMat<eT> tmp = (*this) - X;
steal_mem(tmp);
}
return *this;
}
template<typename eT>
inline
SpMat<eT>&
SpMat<eT>::operator*=(const SpSubview<eT>& X)
{
arma_debug_sigprint();
sync_csc();
SpMat<eT> tmp = (*this) * X;
steal_mem(tmp);
return *this;
}
template<typename eT>
inline
SpMat<eT>&
SpMat<eT>::operator%=(const SpSubview<eT>& X)
{
arma_debug_sigprint();
sync_csc();
if(X.n_nonzero == 0)
{
arma_conform_assert_same_size(n_rows, n_cols, X.n_rows, X.n_cols, "element-wise multiplication");
(*this).zeros();
}
else
{
SpMat<eT> tmp = (*this) % X;
steal_mem(tmp);
}
return *this;
}
template<typename eT>
inline
SpMat<eT>&
SpMat<eT>::operator/=(const SpSubview<eT>& X)
{
arma_debug_sigprint();
// NOTE: use of this function is not advised; it is implemented only for completeness
arma_conform_assert_same_size(n_rows, n_cols, X.n_rows, X.n_cols, "element-wise division");
for(uword c = 0; c < n_cols; ++c)
for(uword r = 0; r < n_rows; ++r)
{
at(r, c) /= X.at(r, c);
}
return *this;
@@ -1514,9 +1555,9 @@ SpMat<eT>::operator*=(const SpSubview_col_list<eT,T1>& X)
sync_csc();
SpMat<eT> z = (*this) * X;
SpMat<eT> tmp = (*this) * X;
steal_mem(z);
steal_mem(tmp);
return *this;
}
@@ -1673,7 +1714,7 @@ SpMat<eT>::SpMat(const SpOp<T1, spop_type>& X)
arma_type_check(( is_same_type< eT, typename T1::elem_type >::no ));
spop_type::apply(*this, X);
spop_type::apply(static_cast< SpMat_noalias<eT>& >(*this), X);
sync_csc(); // in case apply() used element accessors
invalidate_cache(); // in case apply() modified the CSC representation
@@ -1813,7 +1854,7 @@ SpMat<eT>::SpMat(const SpGlue<T1, T2, spglue_type>& X)
arma_type_check(( is_same_type< eT, typename T1::elem_type >::no ));
spglue_type::apply(*this, X);
spglue_type::apply(static_cast< SpMat_noalias<eT>& >(*this), X);
sync_csc(); // in case apply() used element accessors
invalidate_cache(); // in case apply() modified the CSC representation
@@ -3524,7 +3565,7 @@ SpMat<eT>::is_symmetric(const typename get_pod_type<elem_type>::result tol) cons
if(tol == T(0)) { return (*this).is_symmetric(); }
arma_conform_check( (tol < T(0)), "is_symmetric(): parameter 'tol' must be >= 0" );
arma_conform_check( ((tol >= T(0)) == false), "is_symmetric(): parameter 'tol' must be > 0" );
const SpMat<eT>& A = (*this);
@@ -3534,8 +3575,12 @@ SpMat<eT>::is_symmetric(const typename get_pod_type<elem_type>::result tol) cons
if(norm_A == T(0)) { return true; }
if(arma_isnan(norm_A)) { return false; }
const T norm_A_Ast = as_scalar( arma::max(sum(abs(A - A.st()), 1), 0) );
if(arma_isnan(norm_A_Ast)) { return false; }
return ( (norm_A_Ast / norm_A) <= tol );
}
@@ -3570,7 +3615,7 @@ SpMat<eT>::is_hermitian(const typename get_pod_type<elem_type>::result tol) cons
if(tol == T(0)) { return (*this).is_hermitian(); }
arma_conform_check( (tol < T(0)), "is_hermitian(): parameter 'tol' must be >= 0" );
arma_conform_check( ((tol >= T(0)) == false), "is_hermitian(): parameter 'tol' must be > 0" );
const SpMat<eT>& A = (*this);
@@ -3580,8 +3625,12 @@ SpMat<eT>::is_hermitian(const typename get_pod_type<elem_type>::result tol) cons
if(norm_A == T(0)) { return true; }
if(arma_isnan(norm_A)) { return false; }
const T norm_A_At = as_scalar( arma::max(sum(abs(A - A.t()), 1), 0) );
if(arma_isnan(norm_A_At)) { return false; }
return ( (norm_A_At / norm_A) <= tol );
}
@@ -4163,12 +4212,12 @@ SpMat<eT>::clamp(const eT min_val, const eT max_val)
if(is_cx<eT>::no)
{
arma_conform_check( (access::tmp_real(min_val) > access::tmp_real(max_val)), "SpMat::clamp(): min_val must be less than max_val" );
arma_conform_check( ((access::tmp_real(min_val) <= access::tmp_real(max_val)) == false), "SpMat::clamp(): min_val must be less than max_val" );
}
else
{
arma_conform_check( (access::tmp_real(min_val) > access::tmp_real(max_val)), "SpMat::clamp(): real(min_val) must be less than real(max_val)" );
arma_conform_check( (access::tmp_imag(min_val) > access::tmp_imag(max_val)), "SpMat::clamp(): imag(min_val) must be less than imag(max_val)" );
arma_conform_check( ((access::tmp_real(min_val) <= access::tmp_real(max_val)) == false), "SpMat::clamp(): real(min_val) must be less than real(max_val)" );
arma_conform_check( ((access::tmp_imag(min_val) <= access::tmp_imag(max_val)) == false), "SpMat::clamp(): imag(min_val) must be less than imag(max_val)" );
}
if(n_nonzero == 0) { return *this; }
@@ -4348,7 +4397,7 @@ SpMat<eT>::sprandu(const uword in_rows, const uword in_cols, const double densit
{
arma_debug_sigprint();
arma_conform_check( ( (density < double(0)) || (density > double(1)) ), "sprandu(): density must be in the [0,1] interval" );
arma_conform_check( ( ((density >= double(0)) == false) || ((density <= double(1)) == false) ), "sprandu(): density must be in the [0,1] interval" );
const uword new_n_nonzero = uword(density * double(in_rows) * double(in_cols) + 0.5);
@@ -4425,7 +4474,7 @@ SpMat<eT>::sprandn(const uword in_rows, const uword in_cols, const double densit
{
arma_debug_sigprint();
arma_conform_check( ( (density < double(0)) || (density > double(1)) ), "sprandn(): density must be in the [0,1] interval" );
arma_conform_check( ( ((density >= double(0)) == false) || ((density <= double(1)) == false) ), "sprandn(): density must be in the [0,1] interval" );
const uword new_n_nonzero = uword(density * double(in_rows) * double(in_cols) + 0.5);
@@ -5131,7 +5180,12 @@ SpMat<eT>::init(const SpMat<eT>& x)
{
arma_debug_sigprint();
if(this == &x) { return; }
if(this == &x)
{
arma_debug_print("SpMat::init(): copy omitted");
return;
}
bool init_done = false;
+5 -5
View File
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
@@ -22,10 +22,8 @@
template<typename T1, typename op_type>
class SpOp : public SpBase< typename T1::elem_type, SpOp<T1, op_type> >
struct 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;
@@ -33,6 +31,8 @@ class SpOp : public SpBase< typename T1::elem_type, SpOp<T1, op_type> >
static constexpr bool is_col = op_type::template traits<T1>::is_col;
static constexpr bool is_xvec = op_type::template traits<T1>::is_xvec;
static constexpr bool has_subview = T1::has_subview;
inline explicit SpOp(const T1& in_m);
inline SpOp(const T1& in_m, const elem_type in_aux);
inline SpOp(const T1& in_m, const uword in_aux_uword_a, const uword in_aux_uword_b);
+2 -2
View File
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
+3 -3
View File
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
@@ -23,7 +23,7 @@
// TODO: clarify and check which variables and functions are valid when 'use_iterator' is either true or false
// within each specialisation of the Proxy class:
// within each specialisation of the SpProxy struct:
//
// elem_type = type of the elements obtained from object Q
// pod_type = underlying type of elements if elem_type is std::complex
+2 -2
View File
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
+2 -2
View File
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
+8 -2
View File
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
@@ -34,6 +34,8 @@ class SpSubview : public SpBase< eT, SpSubview<eT> >
static constexpr bool is_col = false;
static constexpr bool is_xvec = false;
static constexpr bool has_subview = true;
const uword aux_row1;
const uword aux_col1;
const uword n_rows;
@@ -351,6 +353,8 @@ class SpSubview_col : public SpSubview<eT>
static constexpr bool is_col = true;
static constexpr bool is_xvec = false;
static constexpr bool has_subview = true;
inline void operator= (const SpSubview<eT>& x);
inline void operator= (const SpSubview_col& x);
@@ -391,6 +395,8 @@ class SpSubview_row : public SpSubview<eT>
static constexpr bool is_col = false;
static constexpr bool is_xvec = false;
static constexpr bool has_subview = true;
inline void operator= (const SpSubview<eT>& x);
inline void operator= (const SpSubview_row& x);
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
@@ -33,6 +33,8 @@ class SpSubview_col_list : public SpBase< eT, SpSubview_col_list<eT,T1> >
static constexpr bool is_col = false;
static constexpr bool is_xvec = false;
static constexpr bool has_subview = true;
const SpMat<eT>& m;
const quasi_unwrap<T1> U_ci;
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
@@ -253,8 +253,6 @@ SpSubview_col_list<eT,T1>::operator*= (const eT val)
{
arma_debug_sigprint();
if(val == eT(0)) { (*this).zeros(); return; }
SpMat<eT>& m_local = const_cast< SpMat<eT>& >(m);
const umat& ci = U_ci.M;
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
+46 -7
View File
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
@@ -44,6 +44,8 @@ SpSubview<eT>::SpSubview(const SpMat<eT>& in_m, const uword in_row1, const uword
m.sync_csc();
if( (n_elem == 0) || (m.n_nonzero == 0) ) { return; } // (*this).n_nonzero already set to zero
// count the number of non-zeros in the subview
uword count = 0;
@@ -127,6 +129,8 @@ SpSubview<eT>::operator+=(const eT val)
tmp.fill(val);
if(n_nonzero == 0) { return (*this).operator=(tmp); }
return (*this).operator=( (*this) + tmp );
}
@@ -157,8 +161,6 @@ SpSubview<eT>::operator*=(const eT val)
{
arma_debug_sigprint();
if(val == eT(0)) { (*this).zeros(); return *this; }
if((n_elem == 0) || (n_nonzero == 0)) { return *this; }
m.sync_csc();
@@ -321,6 +323,15 @@ SpSubview<eT>::operator+=(const Base<eT, T1>& x)
{
arma_debug_sigprint();
if(n_nonzero == 0)
{
const quasi_unwrap<T1> U(x.get_ref());
arma_conform_assert_same_size(n_rows, n_cols, U.M.n_rows, U.M.n_cols, "addition");
return (*this).operator=(U.M);
}
return (*this).operator=( (*this) + x.get_ref() );
}
@@ -371,6 +382,8 @@ SpSubview<eT>::operator%=(const Base<eT, T1>& x)
arma_conform_assert_same_size(sv.n_rows, sv.n_cols, B.n_rows, B.n_cols, "element-wise multiplication");
if(n_nonzero == 0) { return *this; }
SpMat<eT>& sv_m = access::rw(sv.m);
sv_m.sync_csc();
@@ -557,6 +570,15 @@ SpSubview<eT>::operator+=(const SpBase<eT, T1>& x)
{
arma_debug_sigprint();
if(n_nonzero == 0)
{
const unwrap_spmat<T1> U(x.get_ref());
arma_conform_assert_same_size(n_rows, n_cols, U.M.n_rows, U.M.n_cols, "addition");
return (*this).operator_equ_common(U.M);
}
// TODO: implement dedicated machinery
return (*this).operator=( (*this) + x.get_ref() );
}
@@ -598,6 +620,15 @@ SpSubview<eT>::operator%=(const SpBase<eT, T1>& x)
{
arma_debug_sigprint();
if(n_nonzero == 0)
{
const SpProxy<T1> P(x.get_ref());
arma_conform_assert_same_size(n_rows, n_cols, P.get_n_rows(), P.get_n_cols(), "element-wise multiplication");
return *this;
}
// TODO: implement dedicated machinery
return (*this).operator=( (*this) % x.get_ref() );
}
@@ -650,6 +681,8 @@ SpSubview<eT>::for_each(functor F)
m.sync_csc();
m.invalidate_cache();
if(n_nonzero == 0) { return; }
const uword lstart_row = aux_row1;
const uword lend_row = aux_row1 + n_rows;
@@ -706,6 +739,8 @@ SpSubview<eT>::for_each(functor F) const
m.sync_csc();
if(n_nonzero == 0) { return; }
const uword lstart_row = aux_row1;
const uword lend_row = aux_row1 + n_rows;
@@ -745,6 +780,8 @@ SpSubview<eT>::transform(functor F)
m.sync_csc();
m.invalidate_cache();
if(n_nonzero == 0) { return; }
const uword lstart_row = aux_row1;
const uword lend_row = aux_row1 + n_rows;
@@ -815,6 +852,8 @@ SpSubview<eT>::replace(const eT old_val, const eT new_val)
m.sync_csc();
m.invalidate_cache();
if(n_nonzero == 0) { return; }
const uword lstart_row = aux_row1;
const uword lend_row = aux_row1 + n_rows;
@@ -907,12 +946,12 @@ SpSubview<eT>::clamp(const eT min_val, const eT max_val)
if(is_cx<eT>::no)
{
arma_conform_check( (access::tmp_real(min_val) > access::tmp_real(max_val)), "SpSubview::clamp(): min_val must be less than max_val" );
arma_conform_check( ((access::tmp_real(min_val) <= access::tmp_real(max_val)) == false), "SpSubview::clamp(): min_val must be less than max_val" );
}
else
{
arma_conform_check( (access::tmp_real(min_val) > access::tmp_real(max_val)), "SpSubview::clamp(): real(min_val) must be less than real(max_val)" );
arma_conform_check( (access::tmp_imag(min_val) > access::tmp_imag(max_val)), "SpSubview::clamp(): imag(min_val) must be less than imag(max_val)" );
arma_conform_check( ((access::tmp_real(min_val) <= access::tmp_real(max_val)) == false), "SpSubview::clamp(): real(min_val) must be less than real(max_val)" );
arma_conform_check( ((access::tmp_imag(min_val) <= access::tmp_imag(max_val)) == false), "SpSubview::clamp(): imag(min_val) must be less than imag(max_val)" );
}
if((n_elem == 0) || (n_nonzero == 0)) { return; }
+5 -5
View File
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
@@ -22,10 +22,8 @@
template<typename T1, typename T2, typename glue_type>
class SpToDGlue : public Base< typename T1::elem_type, SpToDGlue<T1, T2, glue_type> >
struct SpToDGlue : public Base< typename T1::elem_type, SpToDGlue<T1, T2, glue_type> >
{
public:
typedef typename T1::elem_type elem_type;
typedef typename get_pod_type<elem_type>::result pod_type;
@@ -33,6 +31,8 @@ class SpToDGlue : public Base< typename T1::elem_type, SpToDGlue<T1, T2, glue_ty
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;
static constexpr bool has_subview = T1::has_subview || T2::has_subview;
inline explicit SpToDGlue(const T1& in_A, const T2& in_B);
inline ~SpToDGlue();
+2 -2
View File
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
+5 -5
View File
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
@@ -23,10 +23,8 @@
// NOTE: SpToDOp is dedicated for unary operations on sparse matrices that result in dense matrices.
template<typename T1, typename op_type>
class SpToDOp : public Base< typename T1::elem_type, SpToDOp<T1, op_type> >
struct 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;
@@ -34,6 +32,8 @@ class SpToDOp : public Base< typename T1::elem_type, SpToDOp<T1, op_type> >
static constexpr bool is_col = op_type::template traits<T1>::is_col;
static constexpr bool is_xvec = op_type::template traits<T1>::is_xvec;
static constexpr bool has_subview = T1::has_subview;
inline explicit SpToDOp(const T1& in_m);
inline SpToDOp(const T1& in_m, const elem_type in_aux);
inline SpToDOp(const T1& in_m, const uword in_aux_uword_a, const uword in_aux_uword_b);
+2 -2
View File
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
+4 -4
View File
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
@@ -73,8 +73,8 @@ class SpValProxy
// 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;
arma_aligned const uword col;
const uword row;
const uword col;
arma_aligned eT* val_ptr;
+16 -43
View File
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
@@ -148,24 +148,17 @@ inline
SpValProxy<T1>&
SpValProxy<T1>::operator*=(const eT rhs)
{
if(rhs != eT(0))
if(val_ptr)
{
if(val_ptr)
{
// The value already exists and merely needs to be updated.
*val_ptr *= rhs;
parent.invalidate_cache();
check_zero();
}
*val_ptr *= rhs;
parent.invalidate_cache();
check_zero();
}
else
{
if(val_ptr)
{
// Since we are multiplying by zero, the value can be deleted.
parent.delete_element(row, col);
val_ptr = nullptr;
}
const eT val = eT(0) * rhs; // in case rhs is inf or nan
if(val != eT(0)) { val_ptr = &parent.insert_element(row, col, val); }
}
return *this;
@@ -178,37 +171,17 @@ inline
SpValProxy<T1>&
SpValProxy<T1>::operator/=(const eT rhs)
{
if(rhs != eT(0)) // I hope this is true!
if(val_ptr)
{
if(val_ptr)
{
*val_ptr /= rhs;
parent.invalidate_cache();
check_zero();
}
*val_ptr /= rhs;
parent.invalidate_cache();
check_zero();
}
else
{
if(val_ptr)
{
*val_ptr /= rhs; // That is where it gets ugly.
// Now check if it's 0.
if(*val_ptr == eT(0))
{
parent.delete_element(row, col);
val_ptr = nullptr;
}
}
else
{
eT val = eT(0) / rhs; // This may vary depending on type and implementation.
if(val != eT(0))
{
// Ok, now we have to insert it.
val_ptr = &parent.insert_element(row, col, val);
}
}
const eT val = eT(0) / rhs; // in case rhs is zero or nan
if(val != eT(0)) { val_ptr = &parent.insert_element(row, col, val); }
}
return *this;
+10 -12
View File
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
@@ -20,24 +20,22 @@
//! @{
class access
struct access
{
public:
//! internal function to allow modification of data declared as read-only (use with caution)
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); }
template<typename T1> static constexpr T1& rw (const T1& x) { return const_cast<T1& >(x); }
template<typename T1> static constexpr 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> 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(); }
template<typename eT> static constexpr const eT& tmp_real(const eT& X) { return X; }
template<typename T> static constexpr 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> 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(); }
template<typename eT> static constexpr const eT tmp_imag(const eT ) { return eT(0); }
template<typename T> static constexpr const T tmp_imag(const std::complex<T>& X) { return X.imag(); }
//! internal function to work around braindead compilers
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> static constexpr 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); }
};
+159 -5
View File
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
@@ -65,6 +65,48 @@ arma_isfinite(const std::complex<T>& x)
}
//
template<typename eT>
inline
bool
arma_isnonfinite(eT)
{
return false;
}
template<>
inline
bool
arma_isnonfinite(float x)
{
return (std::isfinite(x) == false);
}
template<>
inline
bool
arma_isnonfinite(double x)
{
return (std::isfinite(x) == false);
}
template<typename T>
inline
bool
arma_isnonfinite(const std::complex<T>& x)
{
return ( (std::isfinite(x.real()) == false) || (std::isfinite(x.imag()) == false) );
}
//
// wrappers for isinf
@@ -156,6 +198,21 @@ arma_isnan(const std::complex<T>& x)
//
// wrapper for pow; see also the associated FP16 specialisation
template<typename eT, typename exponent_eT>
inline
eT
arma_pow(eT base, exponent_eT pow)
{
return std::pow(base, pow);
}
//
// implementation of arma_sign()
@@ -165,7 +222,9 @@ constexpr
typename arma_unsigned_integral_only<eT>::result
arma_sign(const eT x)
{
return (x > eT(0)) ? eT(+1) : eT(0);
constexpr eT eT_zero = eT(0);
return (x > eT_zero) ? eT(+1) : eT_zero;
}
@@ -175,7 +234,9 @@ constexpr
typename arma_signed_integral_only<eT>::result
arma_sign(const eT x)
{
return (x > eT(0)) ? eT(+1) : ( (x < eT(0)) ? eT(-1) : eT(0) );
constexpr eT eT_zero = eT(0);
return (x > eT_zero) ? eT(+1) : ( (x < eT_zero) ? eT(-1) : eT_zero );
}
@@ -185,7 +246,9 @@ constexpr
typename arma_real_only<eT>::result
arma_sign(const eT x)
{
return (x > eT(0)) ? eT(+1) : ( (x < eT(0)) ? eT(-1) : ((x == eT(0)) ? eT(0) : x) );
constexpr eT eT_zero = eT(0);
return (x > eT_zero) ? eT(+1) : ( (x < eT_zero) ? eT(-1) : ((x == eT_zero) ? eT_zero : x) );
}
@@ -375,4 +438,95 @@ struct arma_arg< std::complex<double> >
//
// extensions for half-precision fp16
#if defined(ARMA_HAVE_FP16)
template<>
inline
bool
arma_isfinite(fp16 x)
{
return std::isfinite(x);
}
template<>
inline
bool
arma_isnonfinite(fp16 x)
{
return (std::isfinite(x) == false);
}
template<>
inline
bool
arma_isinf(fp16 x)
{
return std::isinf(x);
}
template<>
inline
bool
arma_isnan(fp16 x)
{
return std::isnan(x);
}
template<typename exponent_eT>
inline
fp16
arma_pow(fp16 base, exponent_eT pow)
{
return std::pow(base, fp16(pow));
}
template<>
inline
fp16
arma_hypot(const fp16 x, const fp16 y)
{
return std::hypot(x, y);
}
template<>
inline
fp16
arma_sinc(const fp16 x)
{
return arma_sinc_generic(x);
}
template<>
struct arma_arg<fp16>
{
static
inline
fp16
eval(const fp16 x)
{
return std::arg(x);
}
};
#endif
//! @}
+23 -9
View File
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
@@ -65,6 +65,13 @@ struct arma_config
#endif
#if defined(ARMA_OPTIMISE_POWEXPR)
static constexpr bool optimise_powexpr = true;
#else
static constexpr bool optimise_powexpr = false;
#endif
#if defined(ARMA_CHECK_CONFORMANCE)
static constexpr bool check_conform = true;
#else
@@ -153,13 +160,6 @@ struct arma_config
#endif
#if defined(ARMA_HAVE_CXX14)
static constexpr bool cxx14 = true;
#else
static constexpr bool cxx14 = false;
#endif
#if defined(ARMA_HAVE_CXX17)
static constexpr bool cxx17 = true;
#else
@@ -237,6 +237,20 @@ struct arma_config
#endif
#if defined(ARMA_HAVE_FP16)
static constexpr bool have_fp16 = true;
#else
static constexpr bool have_fp16 = false;
#endif
#if defined(ARMA_GOOD_FP16)
static constexpr bool good_fp16 = true;
#else
static constexpr bool good_fp16 = false;
#endif
static constexpr uword warn_level = (sword(ARMA_WARN_LEVEL) > 0) ? uword(ARMA_WARN_LEVEL) : 0;
};
+116 -104
View File
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
@@ -29,11 +29,10 @@ template<typename eT> class Mat;
template<typename eT> class Col;
template<typename eT> class Row;
template<typename eT> class Cube;
template<typename eT> class xvec_htrans;
template<typename oT> class field;
template<typename eT, bool do_conj> class xtrans_mat;
template<typename eT> struct xvec_htrans;
template<typename eT, bool do_conj> struct xtrans_mat;
template<typename eT> class subview;
template<typename eT> class subview_col;
@@ -73,92 +72,97 @@ template<typename eT, typename T1> class subview_cube_slices;
template<typename eT, typename T1> class SpSubview_col_list;
class SizeMat;
class SizeCube;
template<typename eT> class Mat_noalias;
template<typename eT> class SpMat_noalias;
class arma_empty_class {};
class diskio;
struct SizeMat;
struct SizeCube;
class op_strans;
class op_htrans;
class op_htrans2;
class op_inv_gen_default;
class op_inv_spd_default;
class op_inv_gen_full;
class op_inv_spd_full;
class op_diagmat;
class op_trimat;
class op_vectorise_row;
class op_vectorise_col;
class op_symmatu;
class op_symmatl;
struct arma_empty_class {};
class op_row_as_mat;
class op_col_as_mat;
struct diskio;
class glue_times;
class glue_times_diag;
struct op_strans;
struct op_htrans;
struct op_htrans2;
struct op_inv_gen_default;
struct op_inv_spd_default;
struct op_inv_gen_full;
struct op_inv_spd_full;
struct op_diagmat;
struct op_trimat;
struct op_vectorise_row;
struct op_vectorise_col;
struct op_symmatu;
struct op_symmatl;
struct op_omit;
class glue_rel_lt;
class glue_rel_gt;
class glue_rel_lteq;
class glue_rel_gteq;
class glue_rel_eq;
class glue_rel_noteq;
class glue_rel_and;
class glue_rel_or;
struct op_row_as_mat;
struct op_col_as_mat;
class op_rel_lt_pre;
class op_rel_lt_post;
class op_rel_gt_pre;
class op_rel_gt_post;
class op_rel_lteq_pre;
class op_rel_lteq_post;
class op_rel_gteq_pre;
class op_rel_gteq_post;
class op_rel_eq;
class op_rel_noteq;
struct glue_times;
struct glue_times_diag;
class gen_eye;
class gen_ones;
class gen_zeros;
struct glue_rel_lt;
struct glue_rel_gt;
struct glue_rel_lteq;
struct glue_rel_gteq;
struct glue_rel_eq;
struct glue_rel_noteq;
struct glue_rel_and;
struct glue_rel_or;
struct op_rel_lt_pre;
struct op_rel_lt_post;
struct op_rel_gt_pre;
struct op_rel_gt_post;
struct op_rel_lteq_pre;
struct op_rel_lteq_post;
struct op_rel_gteq_pre;
struct op_rel_gteq_post;
struct op_rel_eq;
struct op_rel_noteq;
struct gen_eye;
struct gen_ones;
struct gen_zeros;
class spop_strans;
class spop_htrans;
class spop_vectorise_row;
class spop_vectorise_col;
class spop_square;
struct spop_strans;
struct spop_htrans;
struct spop_vectorise_row;
struct spop_vectorise_col;
struct spop_square;
class spop_rel_lt_pre;
class spop_rel_lt_post;
class spop_rel_gt_pre;
class spop_rel_gt_post;
class spop_rel_lteq_pre;
class spop_rel_lteq_post;
class spop_rel_gteq_pre;
class spop_rel_gteq_post;
class spop_rel_eq;
class spop_rel_noteq;
struct spop_rel_lt_pre;
struct spop_rel_lt_post;
struct spop_rel_gt_pre;
struct spop_rel_gt_post;
struct spop_rel_lteq_pre;
struct spop_rel_lteq_post;
struct spop_rel_gteq_pre;
struct spop_rel_gteq_post;
struct spop_rel_eq;
struct spop_rel_noteq;
class spglue_plus;
class spglue_minus;
class spglue_schur;
class spglue_times;
class spglue_max;
class spglue_min;
class spglue_rel_lt;
class spglue_rel_gt;
struct spglue_plus;
struct spglue_minus;
struct spglue_schur;
struct spglue_times;
struct spglue_max;
struct spglue_min;
struct spglue_rel_lt;
struct spglue_rel_gt;
class op_sp_as_dense;
struct op_sp_as_dense;
class op_internal_equ;
class op_internal_plus;
class op_internal_minus;
class op_internal_schur;
class op_internal_div;
struct op_internal_equ;
struct op_internal_plus;
struct op_internal_minus;
struct op_internal_schur;
struct op_internal_div;
@@ -247,43 +251,44 @@ struct traits_glue_or
template<const bool, const bool, const bool, const bool> class gemm;
template<const bool, const bool, const bool> class gemv;
template<const bool, const bool, const bool, const bool> struct gemm;
template<const bool, const bool, const bool> struct gemv;
template< typename eT, typename gen_type> class Gen;
template< typename eT, typename gen_type> struct Gen;
template< typename T1, typename op_type> class Op;
template< typename T1, typename eop_type> class eOp;
template< typename T1, typename op_type> class SpToDOp;
template< typename T1, typename op_type> class CubeToMatOp;
template<typename out_eT, typename T1, typename op_type> class mtOp;
template< typename T1, typename op_type> struct Op;
template< typename T1, typename eop_type> struct eOp;
template< typename T1, typename op_type> struct SpToDOp;
template< typename T1, typename op_type> struct CubeToMatOp;
template<typename out_eT, typename T1, typename op_type> struct mtOp;
template< typename T1, typename T2, typename glue_type> class Glue;
template< typename T1, typename T2, typename eglue_type> class eGlue;
template< typename T1, typename T2, typename glue_type> class SpToDGlue;
template<typename out_eT, typename T1, typename T2, typename glue_type> class mtGlue;
template< typename T1, typename T2, typename glue_type> struct Glue;
template< typename T1, typename T2, typename eglue_type> struct eGlue;
template< typename T1, typename T2, typename glue_type> struct SpToDGlue;
template<typename out_eT, typename T1, typename T2, typename glue_type> struct mtGlue;
template< typename eT, typename gen_type> class GenCube;
template< typename eT, typename gen_type> struct GenCube;
template< typename T1, typename op_type> class OpCube;
template< typename T1, typename eop_type> class eOpCube;
template<typename out_eT, typename T1, typename op_type> class mtOpCube;
template< typename T1, typename op_type> struct OpCube;
template< typename T1, typename eop_type> struct eOpCube;
template<typename out_eT, typename T1, typename op_type> struct mtOpCube;
template< typename T1, typename T2, typename glue_type> class GlueCube;
template< typename T1, typename T2, typename eglue_type> class eGlueCube;
template<typename out_eT, typename T1, typename T2, typename glue_type> class mtGlueCube;
template< typename T1, typename T2, typename glue_type> struct GlueCube;
template< typename T1, typename T2, typename eglue_type> struct eGlueCube;
template<typename out_eT, typename T1, typename T2, typename glue_type> struct mtGlueCube;
template<typename T1> struct Proxy;
template<typename T1> struct ProxyCube;
template<typename T1> class diagmat_proxy;
template<typename T1> struct diagmat_proxy;
template<typename T1> struct unwrap;
template<typename T1> struct plain_unwrap;
template<typename T1> struct quasi_unwrap;
template<typename T1> struct unwrap_cube;
template<typename T1> struct unwrap_spmat;
@@ -311,7 +316,7 @@ struct state_type
int out;
#if defined(ARMA_USE_OPENMP)
#pragma omp atomic read
#pragma omp atomic read seq_cst
out = state;
#elif defined(ARMA_USE_STD_MUTEX)
out = state.load();
@@ -327,7 +332,7 @@ struct state_type
operator= (const int in_state)
{
#if defined(ARMA_USE_OPENMP)
#pragma omp atomic write
#pragma omp atomic write seq_cst
state = in_state;
#elif defined(ARMA_USE_STD_MUTEX)
state.store(in_state);
@@ -338,12 +343,12 @@ struct state_type
};
template< typename T1, typename spop_type> class SpOp;
template<typename out_eT, typename T1, typename spop_type> class mtSpOp;
template<typename out_eT, typename T1, typename op_type> class mtSpReduceOp;
template< typename T1, typename spop_type> struct SpOp;
template<typename out_eT, typename T1, typename spop_type> struct mtSpOp;
template<typename out_eT, typename T1, typename op_type> struct mtSpReduceOp;
template< typename T1, typename T2, typename spglue_type> class SpGlue;
template<typename out_eT, typename T1, typename T2, typename spglue_type> class mtSpGlue;
template< typename T1, typename T2, typename spglue_type> struct SpGlue;
template<typename out_eT, typename T1, typename T2, typename spglue_type> struct mtSpGlue;
template<typename T1> struct SpProxy;
@@ -361,6 +366,13 @@ struct arma_zeros_indicator : public arma_initmode_indicator<true > {};
struct arma_nozeros_indicator : public arma_initmode_indicator<false> {};
template<int vec_mode> struct arma_vec_mode_indicator {};
struct arma_colvec_indicator : public arma_vec_mode_indicator<1> {};
struct arma_rowvec_indicator : public arma_vec_mode_indicator<2> {};
//! \addtogroup injector
//! @{
+4 -11
View File
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
@@ -21,18 +21,13 @@
class arma_ostream_state
struct 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;
@@ -40,10 +35,8 @@ class arma_ostream_state
class arma_ostream
struct arma_ostream
{
public:
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 = nullptr);
+15 -13
View File
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
@@ -70,7 +70,7 @@ arma_ostream::modify_stream(std::ostream& o, const eT* data, const uword n_elem)
{
const eT val = data[i];
if(arma_isfinite(val) == false) { continue; }
if(arma_isnonfinite(val)) { continue; }
if(
( cond_rel< (sizeof(eT) > 4) && (is_same_type<uword,eT>::yes || is_same_type<sword,eT>::yes) >::geq(val, eT(+10000000000)) )
@@ -86,22 +86,22 @@ arma_ostream::modify_stream(std::ostream& o, const eT* data, const uword n_elem)
( val >= eT(+100) )
||
//( (is_signed<eT>::value) && (val <= eT(-100)) ) ||
//( (is_non_integral<eT>::value) && (val > eT(0)) && (val <= eT(+1e-4)) ) ||
//( (is_non_integral<eT>::value) && (is_signed<eT>::value) && (val < eT(0)) && (val >= eT(-1e-4)) )
//( (is_real<eT>::value) && (val > eT(0)) && (val <= eT(+1e-4)) ) ||
//( (is_real<eT>::value) && (is_signed<eT>::value) && (val < eT(0)) && (val >= eT(-1e-4)) )
(
cond_rel< is_signed<eT>::value >::leq(val, eT(-100))
)
||
(
cond_rel< is_non_integral<eT>::value >::gt(val, eT(0))
cond_rel< is_real<eT>::value >::gt(val, eT(0))
&&
cond_rel< is_non_integral<eT>::value >::leq(val, eT(+1e-4))
cond_rel< is_real<eT>::value >::leq(val, eT(+1e-4))
)
||
(
cond_rel< is_non_integral<eT>::value && is_signed<eT>::value >::lt(val, eT(0))
cond_rel< is_real<eT>::value && is_signed<eT>::value >::lt(val, eT(0))
&&
cond_rel< is_non_integral<eT>::value && is_signed<eT>::value >::geq(val, eT(-1e-4))
cond_rel< is_real<eT>::value && is_signed<eT>::value >::geq(val, eT(-1e-4))
)
)
{
@@ -208,13 +208,13 @@ arma_ostream::modify_stream(std::ostream& o, typename SpMat<eT>::const_iterator
{
const eT val = (*it);
if(arma_isfinite(val) == false) { continue; }
if(arma_isnonfinite(val)) { continue; }
if(
val >= eT(+100) ||
( (is_signed<eT>::value) && (val <= eT(-100)) ) ||
( (is_non_integral<eT>::value) && (val > eT(0)) && (val <= eT(+1e-4)) ) ||
( (is_non_integral<eT>::value) && (is_signed<eT>::value) && (val < eT(0)) && (val >= eT(-1e-4)) )
( ( is_real<eT>::value) && (val > eT(0)) && (val <= eT(+1e-4)) ) ||
( ( is_real<eT>::value) && (is_signed<eT>::value) && (val < eT(0)) && (val >= eT(-1e-4)) )
)
{
use_layout_C = true;
@@ -368,7 +368,9 @@ inline
void
arma_ostream::print_elem(std::ostream& o, const std::complex<T>& x, const bool modify)
{
if( (x.real() == T(0)) && (x.imag() == T(0)) && (modify) )
constexpr T T_zero = T(0);
if( (x.real() == T_zero) && (x.imag() == T_zero) && (modify) )
{
o << "(0,0)";
}
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
@@ -24,7 +24,7 @@
template<typename eT>
struct arma_lt_comparator
{
arma_inline bool operator() (const eT a, const eT b) const { return (a < b); }
constexpr bool operator() (const eT a, const eT b) const { return (a < b); }
};
@@ -32,7 +32,7 @@ struct arma_lt_comparator
template<typename eT>
struct arma_gt_comparator
{
arma_inline bool operator() (const eT a, const eT b) const { return (a > b); }
constexpr bool operator() (const eT a, const eT b) const { return (a > b); }
};
@@ -40,7 +40,7 @@ struct arma_gt_comparator
template<typename eT>
struct arma_leq_comparator
{
arma_inline bool operator() (const eT a, const eT b) const { return (a <= b); }
constexpr bool operator() (const eT a, const eT b) const { return (a <= b); }
};
@@ -48,7 +48,7 @@ struct arma_leq_comparator
template<typename eT>
struct arma_geq_comparator
{
arma_inline bool operator() (const eT a, const eT b) const { return (a >= b); }
constexpr bool operator() (const eT a, const eT b) const { return (a >= b); }
};
+118 -17
View File
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
@@ -26,6 +26,9 @@
#undef ARMA_USE_THREAD_LOCAL
#define ARMA_USE_THREAD_LOCAL
#undef ARMA_USE_THREAD_UNIQUE_RNG_SEED
#define ARMA_USE_THREAD_UNIQUE_RNG_SEED
#if (defined(ARMA_RNG_ALT) || defined(ARMA_DONT_USE_CXX11_RNG))
#undef ARMA_USE_CXX11_RNG
#endif
@@ -34,6 +37,10 @@
#undef ARMA_USE_THREAD_LOCAL
#endif
#if defined(ARMA_DONT_USE_THREAD_UNIQUE_RNG_SEED)
#undef ARMA_USE_THREAD_UNIQUE_RNG_SEED
#endif
// NOTE: ARMA_WARMUP_PRODUCER enables a workaround
// NOTE: for thread_local issue on macOS 11 and/or AppleClang 12.0
@@ -79,10 +86,8 @@
#endif
class arma_rng
struct arma_rng
{
public:
#if defined(ARMA_RNG_ALT)
typedef arma_rng_alt::seed_type seed_type;
#elif defined(ARMA_USE_CXX11_RNG)
@@ -118,6 +123,7 @@ class arma_rng
template<typename eT> struct randu;
template<typename eT> struct randn;
template<typename eT> struct randg;
template<typename eT> struct rande;
};
@@ -130,24 +136,42 @@ arma_rng::get_producer()
{
#if defined(ARMA_USE_THREAD_LOCAL)
// use a thread-safe RNG, with each thread having its own unique starting seed
// thread-safe RNG
static std::atomic<std::size_t> mt19937_64_producer_counter(0);
static thread_local std::mt19937_64 mt19937_64_producer( std::mt19937_64::default_seed + mt19937_64_producer_counter++ );
arma_rng::warmup_producer(mt19937_64_producer);
#if defined(ARMA_USE_THREAD_UNIQUE_RNG_SEED)
// each thread has unique starting seed
#if defined(ARMA_USE_OPENMP)
static thread_local std::mt19937_64 mt19937_64_producer( std::mt19937_64::default_seed + arma_rng::seed_type(omp_get_thread_num()) );
#else
static std::atomic<std::size_t> mt19937_64_producer_counter(0);
static thread_local std::mt19937_64 mt19937_64_producer( std::mt19937_64::default_seed + mt19937_64_producer_counter++ );
#endif
#else
// each thread has the same starting seed
static thread_local std::mt19937_64 mt19937_64_producer( std::mt19937_64::default_seed );
#endif
#else
// use a plain RNG in case we don't have thread_local
// plain RNG in case we don't have thread_local
static std::mt19937_64 mt19937_64_producer( std::mt19937_64::default_seed );
arma_rng::warmup_producer(mt19937_64_producer);
#endif
arma_rng::warmup_producer(mt19937_64_producer);
return mt19937_64_producer;
}
@@ -227,9 +251,45 @@ arma_rng::set_seed(const arma_rng::seed_type val)
}
#elif defined(ARMA_USE_CXX11_RNG)
{
arma_rng::lock_producer();
arma_rng::get_producer().seed(val);
arma_rng::unlock_producer();
#if defined(ARMA_USE_OPENMP) && defined(ARMA_USE_THREAD_LOCAL)
{
arma_rng::lock_producer();
#if defined(ARMA_USE_THREAD_UNIQUE_RNG_SEED)
constexpr bool thread_unique_rng_seed = true;
#else
constexpr bool thread_unique_rng_seed = false;
#endif
// if we're already in a parallel region, assume the user is setting the seed for each thread
if( (thread_unique_rng_seed == false) || bool(omp_in_parallel()) )
{
arma_rng::get_producer().seed(val);
}
else
{
const int n_threads = int( (std::max)( int(1), int(omp_get_max_threads()) ) );
#pragma omp parallel for ordered schedule(static) num_threads(n_threads)
for(int t=0; t < n_threads; ++t)
{
#pragma omp ordered
{
arma_rng::get_producer().seed(val + arma_rng::seed_type(omp_get_thread_num()));
}
}
}
arma_rng::unlock_producer();
}
#else
{
arma_rng::lock_producer();
arma_rng::get_producer().seed(val);
arma_rng::unlock_producer();
}
#endif
}
#else
{
@@ -1031,4 +1091,45 @@ struct arma_rng::randg
//
template<typename eT>
struct arma_rng::rande
{
inline
static
void
fill(eT* mem, const uword N, const double lambda)
{
#if defined(ARMA_USE_CXX11_RNG)
{
std::exponential_distribution<double> local_e_distr(lambda);
std::mt19937_64& producer = arma_rng::get_producer();
arma_rng::lock_producer();
for(uword i=0; i<N; ++i) { mem[i] = eT(local_e_distr(producer)); }
arma_rng::unlock_producer();
}
#else
{
typedef typename std::mt19937_64::result_type local_seed_type;
std::mt19937_64 local_engine;
std::exponential_distribution<double> local_e_distr(lambda);
local_engine.seed( local_seed_type(arma_rng::randi<local_seed_type>()) );
for(uword i=0; i<N; ++i) { mem[i] = eT(local_e_distr(local_engine)); }
}
#endif
}
};
//! @}
+3 -5
View File
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
@@ -21,10 +21,8 @@
class arma_rng_cxx03
struct arma_rng_cxx03
{
public:
typedef unsigned int seed_type;
inline static void set_seed(const seed_type val);
+2 -2
View File
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
+2 -2
View File
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
+5 -5
View File
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
@@ -21,10 +21,10 @@
#define ARMA_VERSION_MAJOR 14
#define ARMA_VERSION_MAJOR 15
#define ARMA_VERSION_MINOR 4
#define ARMA_VERSION_PATCH 1
#define ARMA_VERSION_NAME "Filtered Espresso"
#define ARMA_VERSION_PATCH 0
#define ARMA_VERSION_NAME "Medium Roast Agave"
+3 -5
View File
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
@@ -20,10 +20,8 @@
//! @{
class arrayops
struct arrayops
{
public:
template<typename eT>
arma_inline static void
copy(eT* dest, const eT* src, const uword n_elem);
+8 -8
View File
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
@@ -994,7 +994,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(eop_aux::arma_abs(mem[i]) > abs_limit) { return false; }
if( (eop_aux::arma_abs(mem[i]) <= abs_limit) == false ) { return false; }
}
}
@@ -1028,8 +1028,8 @@ arrayops::is_zero(const std::complex<T>* mem, const uword n_elem, const T abs_li
{
const eT& val = mem[i];
if(std::abs(std::real(val)) > abs_limit) { return false; }
if(std::abs(std::imag(val)) > abs_limit) { return false; }
if( (std::abs(std::real(val)) <= abs_limit) == false ) { return false; }
if( (std::abs(std::imag(val)) <= abs_limit) == false ) { return false; }
}
}
@@ -1050,13 +1050,13 @@ arrayops::is_finite(const eT* src, const uword n_elem)
const eT val_i = (*src); src++;
const eT val_j = (*src); src++;
if(arma_isfinite(val_i) == false) { return false; }
if(arma_isfinite(val_j) == false) { return false; }
if(arma_isnonfinite(val_i)) { return false; }
if(arma_isnonfinite(val_j)) { return false; }
}
if((j-1) < n_elem)
{
if(arma_isfinite(*src) == false) { return false; }
if(arma_isnonfinite(*src)) { return false; }
}
return true;
+14 -39
View File
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
@@ -21,10 +21,8 @@
//! low-level interface functions for accessing LAPACK
class auxlib
struct auxlib
{
public:
//
// inv
@@ -188,12 +186,6 @@ class auxlib
template<typename eT>
inline static bool chol_band(Mat<eT>& X, const uword KD, const uword layout);
template<typename T>
inline static bool chol_band(Mat< std::complex<T> >& X, const uword KD, const uword layout);
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);
@@ -298,9 +290,6 @@ class auxlib
template<typename T1>
inline static bool solve_sympd_fast(Mat<typename T1::elem_type>& out, Mat<typename T1::elem_type>& A, const Base<typename T1::elem_type,T1>& B_expr);
template<typename T1>
inline static bool solve_sympd_fast_common(Mat<typename T1::elem_type>& out, Mat<typename T1::elem_type>& A, const Base<typename T1::elem_type,T1>& B_expr);
template<typename T1>
inline static bool solve_sympd_rcond(Mat<typename T1::pod_type>& out, bool& out_sympd_state, typename T1::pod_type& out_rcond, Mat<typename T1::pod_type>& A, const Base<typename T1::pod_type,T1>& B_expr);
@@ -340,22 +329,10 @@ class auxlib
//
template<typename T1>
inline static bool solve_band_fast(Mat<typename T1::pod_type>& out, Mat<typename T1::pod_type>& A, const uword KL, const uword KU, const Base<typename T1::pod_type,T1>& B_expr);
inline static bool solve_band_fast(Mat<typename T1::elem_type>& out, const Mat<typename T1::elem_type>& A, const uword KL, const uword KU, const Base<typename T1::elem_type,T1>& B_expr);
template<typename T1>
inline static bool solve_band_fast(Mat< std::complex<typename T1::pod_type> >& out, Mat< std::complex<typename T1::pod_type> >& A, const uword KL, const uword KU, const Base< std::complex<typename T1::pod_type>,T1>& B_expr);
template<typename T1>
inline static bool solve_band_fast_common(Mat<typename T1::elem_type>& out, const Mat<typename T1::elem_type>& A, const uword KL, const uword KU, const Base<typename T1::elem_type,T1>& B_expr);
template<typename T1>
inline static bool solve_band_rcond(Mat<typename T1::pod_type>& out, typename T1::pod_type& out_rcond, Mat<typename T1::pod_type>& A, const uword KL, const uword KU, const Base<typename T1::pod_type,T1>& B_expr);
template<typename T1>
inline static bool solve_band_rcond(Mat< std::complex<typename T1::pod_type> >& out, typename T1::pod_type& out_rcond, Mat< std::complex<typename T1::pod_type> >& A, const uword KL, const uword KU, const Base< std::complex<typename T1::pod_type>,T1>& B_expr);
template<typename T1>
inline static bool solve_band_rcond_common(Mat<typename T1::elem_type>& out, typename T1::pod_type& out_rcond, const Mat<typename T1::elem_type>& A, const uword KL, const uword KU, const Base<typename T1::elem_type,T1>& B_expr);
inline static bool solve_band_rcond(Mat<typename T1::elem_type>& out, typename T1::pod_type& out_rcond, const Mat<typename T1::elem_type>& A, const uword KL, const uword KU, const Base<typename T1::elem_type,T1>& B_expr);
template<typename T1>
inline static bool solve_band_refine(Mat<typename T1::pod_type>& out, typename T1::pod_type& out_rcond, Mat<typename T1::pod_type>& A, const uword KL, const uword KU, const Base<typename T1::pod_type,T1>& B_expr, const bool equilibrate);
@@ -366,13 +343,7 @@ class auxlib
//
template<typename T1>
inline static bool solve_tridiag_fast(Mat<typename T1::pod_type>& out, Mat<typename T1::pod_type>& A, const Base<typename T1::pod_type,T1>& B_expr);
template<typename T1>
inline static bool solve_tridiag_fast(Mat< std::complex<typename T1::pod_type> >& out, Mat< std::complex<typename T1::pod_type> >& A, const Base< std::complex<typename T1::pod_type>,T1>& B_expr);
template<typename T1>
inline static bool solve_tridiag_fast_common(Mat<typename T1::elem_type>& out, const Mat<typename T1::elem_type>& A, const Base<typename T1::elem_type,T1>& B_expr);
inline static bool solve_tridiag_fast(Mat<typename T1::elem_type>& out, const Mat<typename T1::elem_type>& A, const Base<typename T1::elem_type,T1>& B_expr);
//
@@ -391,7 +362,7 @@ class auxlib
// 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);
inline static bool sylvester(Mat<eT>& X, const Mat<eT>& A, const Mat<eT>& B, const Mat<eT>& C);
//
@@ -404,6 +375,13 @@ class auxlib
inline static bool qz(Mat< std::complex<T> >& A, Mat< std::complex<T> >& B, Mat< std::complex<T> >& vsl, Mat< std::complex<T> >& vsr, const Base< std::complex<T>, T1 >& X_expr, const Base< std::complex<T>, T2 >& Y_expr, const char mode);
//
// matrix balance
template<typename eT>
inline static bool balance(Col<typename get_pod_type<eT>::result>& S, Col<uword>& P, Mat<eT>& A, const bool calc_SP, const bool do_scal, const bool do_perm);
//
// rcond
@@ -451,9 +429,6 @@ class auxlib
//
// misc
template<typename T1>
inline static bool crippled_lapack(const Base<typename T1::elem_type, T1>&);
template<typename eT>
inline static bool rudimentary_sym_check(const Mat<eT>& X);
+108 -321
View File
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
@@ -320,13 +320,7 @@ auxlib::inv_sym(Mat< std::complex<T> >& A)
if(A.is_empty()) { return true; }
#if defined(ARMA_CRIPPLED_LAPACK)
{
arma_debug_print("auxlib::inv_sym(): redirecting to auxlib::inv() due to crippled LAPACK");
return auxlib::inv(A);
}
#elif defined(ARMA_USE_LAPACK)
#if defined(ARMA_USE_LAPACK)
{
typedef typename std::complex<T> eT;
@@ -477,13 +471,7 @@ auxlib::inv_sym_rcond(Mat< std::complex<T> >& A, T& out_rcond)
if(A.is_empty()) { return true; }
#if defined(ARMA_CRIPPLED_LAPACK)
{
arma_debug_print("auxlib::inv_sym_rcond(): redirecting to auxlib::inv_rcond() due to crippled LAPACK");
return auxlib::inv_rcond(A, out_rcond);
}
#elif defined(ARMA_USE_LAPACK)
#if defined(ARMA_USE_LAPACK)
{
typedef typename std::complex<T> eT;
@@ -686,13 +674,7 @@ auxlib::inv_sympd_rcond(Mat< std::complex<T> >& A, T& out_rcond)
if(A.is_empty()) { return true; }
#if defined(ARMA_CRIPPLED_LAPACK)
{
arma_ignore(A);
arma_ignore(out_rcond);
return false;
}
#elif defined(ARMA_USE_LAPACK)
#if defined(ARMA_USE_LAPACK)
{
arma_conform_assert_blas_size(A);
@@ -1393,13 +1375,7 @@ auxlib::eig_gen_balance
{
arma_debug_sigprint();
#if defined(ARMA_CRIPPLED_LAPACK)
{
arma_debug_print("auxlib::eig_gen_balance(): redirecting to auxlib::eig_gen() due to crippled LAPACK");
return auxlib::eig_gen(vals, vecs, vecs_on, expr);
}
#elif defined(ARMA_USE_LAPACK)
#if defined(ARMA_USE_LAPACK)
{
typedef typename T1::pod_type T;
typedef typename std::complex<T> eT;
@@ -1751,13 +1727,7 @@ auxlib::eig_gen_twosided_balance
{
arma_debug_sigprint();
#if defined(ARMA_CRIPPLED_LAPACK)
{
arma_debug_print("auxlib::eig_gen_twosided_balance(): redirecting to auxlib::eig_gen() due to crippled LAPACK");
return auxlib::eig_gen(vals, lvecs, rvecs, expr);
}
#elif defined(ARMA_USE_LAPACK)
#if defined(ARMA_USE_LAPACK)
{
typedef typename T1::pod_type T;
typedef typename std::complex<T> eT;
@@ -2716,42 +2686,6 @@ auxlib::chol_band(Mat<eT>& X, const uword KD, const uword layout)
{
arma_debug_sigprint();
return auxlib::chol_band_common(X, KD, layout);
}
template<typename T>
inline
bool
auxlib::chol_band(Mat< std::complex<T> >& X, const uword KD, const uword layout)
{
arma_debug_sigprint();
#if defined(ARMA_CRIPPLED_LAPACK)
{
arma_debug_print("auxlib::chol_band(): redirecting to auxlib::chol() due to crippled LAPACK");
arma_ignore(KD);
return auxlib::chol(X, layout);
}
#else
{
return auxlib::chol_band_common(X, KD, layout);
}
#endif
}
template<typename eT>
inline
bool
auxlib::chol_band_common(Mat<eT>& X, const uword KD, const uword layout)
{
arma_debug_sigprint();
#if defined(ARMA_USE_LAPACK)
{
const uword N = X.n_rows;
@@ -2998,8 +2932,8 @@ auxlib::qr_econ(Mat<eT>& Q, Mat<eT>& R, const Base<eT,T1>& X)
{
if(is_Mat<T1>::value)
{
const unwrap<T1> tmp(X.get_ref());
const Mat<eT>& M = tmp.M;
const plain_unwrap<T1> tmp(X.get_ref());
const Mat<eT>& M = tmp.M;
if(M.n_rows < M.n_cols) { return auxlib::qr(Q, R, X); }
}
@@ -3954,9 +3888,7 @@ auxlib::svd_dc(Mat<eT>& U, Col<eT>& S, Mat<eT>& V, Mat<eT>& A)
blas_int lda = blas_int(A.n_rows);
blas_int ldu = blas_int(U.n_rows);
blas_int ldvt = blas_int(V.n_rows);
blas_int lwork1 = 3*min_mn*min_mn + (std::max)(max_mn, 4*min_mn*min_mn + 4*min_mn); // as per LAPACK 3.2 docs
blas_int lwork2 = 4*min_mn*min_mn + 6*min_mn + max_mn; // as per LAPACK 3.8 docs; consistent with LAPACK 3.4 docs
blas_int lwork_min = (std::max)(lwork1, lwork2); // due to differences between LAPACK 3.2 and 3.8
blas_int lwork_min = 4*min_mn*min_mn + 6*min_mn + max_mn; // as per LAPACK 3.8 and 3.12 docs; consistent with LAPACK 3.4 docs
blas_int info = 0;
S.set_size( static_cast<uword>(min_mn) );
@@ -4034,8 +3966,8 @@ auxlib::svd_dc(Mat< std::complex<T> >& U, Col<T>& S, Mat< std::complex<T> >& V,
blas_int lda = blas_int(A.n_rows);
blas_int ldu = blas_int(U.n_rows);
blas_int ldvt = blas_int(V.n_rows);
blas_int lwork_min = min_mn*min_mn + 2*min_mn + max_mn; // as per LAPACK 3.2, 3.4, 3.8 docs
blas_int lrwork = min_mn * ((std::max)(5*min_mn+7, 2*max_mn + 2*min_mn+1)); // as per LAPACK 3.4 docs; LAPACK 3.8 uses 5*min_mn+5 instead of 5*min_mn+7
blas_int lwork_min = min_mn*min_mn + 2*min_mn + max_mn; // as per LAPACK 3.2, 3.4, 3.8, 3.12 docs
blas_int lrwork = min_mn * ((std::max)(5*min_mn+5, 2*max_mn + 2*min_mn+1)); // as per LAPACK 3.8 and 3.12 docs
blas_int info = 0;
S.set_size( static_cast<uword>(min_mn) );
@@ -4103,13 +4035,10 @@ auxlib::svd_dc_econ(Mat<eT>& U, Col<eT>& S, Mat<eT>& V, Mat<eT>& A)
blas_int m = blas_int(A.n_rows);
blas_int n = blas_int(A.n_cols);
blas_int min_mn = (std::min)(m,n);
blas_int max_mn = (std::max)(m,n);
blas_int lda = blas_int(A.n_rows);
blas_int ldu = m;
blas_int ldvt = min_mn;
blas_int lwork1 = 3*min_mn*min_mn + (std::max)( max_mn, 4*min_mn*min_mn + 4*min_mn ); // as per LAPACK 3.2 docs
blas_int lwork2 = 4*min_mn*min_mn + 6*min_mn + max_mn; // as per LAPACK 3.4 docs; LAPACK 3.8 requires 4*min_mn*min_mn + 7*min_mn
blas_int lwork_min = (std::max)(lwork1, lwork2); // due to differences between LAPACK 3.2 and 3.4
blas_int lwork_min = 4*min_mn*min_mn + 7*min_mn; // as per LAPACK 3.8 and 3.12 docs
blas_int info = 0;
if(A.is_empty())
@@ -4194,8 +4123,8 @@ auxlib::svd_dc_econ(Mat< std::complex<T> >& U, Col<T>& S, Mat< std::complex<T> >
blas_int lda = blas_int(A.n_rows);
blas_int ldu = m;
blas_int ldvt = min_mn;
blas_int lwork_min = min_mn*min_mn + 2*min_mn + max_mn; // as per LAPACK 3.2 docs
blas_int lrwork = min_mn * ((std::max)(5*min_mn+7, 2*max_mn + 2*min_mn+1)); // LAPACK 3.8 uses 5*min_mn+5 instead of 5*min_mn+7
blas_int lwork_min = min_mn*min_mn + 3*min_mn; // as per LAPACK 3.12 docs
blas_int lrwork = min_mn * ((std::max)(5*min_mn+5, 2*max_mn + 2*min_mn+1)); // as per LAPACK 3.8 and 3.12 docs
blas_int info = 0;
if(A.is_empty())
@@ -4650,13 +4579,7 @@ auxlib::solve_sym_fast(Mat< std::complex<typename T1::pod_type> >& out, Mat< std
if(A.is_empty() || out.is_empty()) { out.zeros(A.n_cols, B_n_cols); return true; }
#if defined(ARMA_CRIPPLED_LAPACK)
{
arma_debug_print("auxlib::solve_sym_fast(): redirecting to auxlib::solve_square_fast() due to crippled LAPACK");
return auxlib::solve_square_fast(out, A, B_expr);
}
#elif defined(ARMA_USE_LAPACK)
#if defined(ARMA_USE_LAPACK)
{
typedef typename T1::pod_type T;
typedef std::complex<T> eT;
@@ -4726,13 +4649,7 @@ auxlib::solve_sym_rcond(Mat<typename T1::pod_type>& out, typename T1::pod_type&
if(A.is_empty() || out.is_empty()) { out.zeros(A.n_cols, B_n_cols); return true; }
#if defined(ARMA_CRIPPLED_LAPACK)
{
arma_debug_print("auxlib::solve_sym_rcond(): redirecting to auxlib::solve_square_rcond() due to crippled LAPACK");
return auxlib::solve_square_rcond(out, out_rcond, A, B_expr);
}
#elif defined(ARMA_USE_LAPACK)
#if defined(ARMA_USE_LAPACK)
{
typedef typename T1::pod_type eT;
@@ -4894,28 +4811,6 @@ auxlib::solve_sympd_fast(Mat<typename T1::elem_type>& out, Mat<typename T1::elem
{
arma_debug_sigprint();
#if defined(ARMA_CRIPPLED_LAPACK)
{
arma_debug_print("auxlib::solve_sympd_fast(): redirecting to auxlib::solve_square_fast() due to crippled LAPACK");
return auxlib::solve_square_fast(out, A, B_expr);
}
#else
{
return auxlib::solve_sympd_fast_common(out, A, B_expr);
}
#endif
}
template<typename T1>
inline
bool
auxlib::solve_sympd_fast_common(Mat<typename T1::elem_type>& out, Mat<typename T1::elem_type>& A, const Base<typename T1::elem_type,T1>& B_expr)
{
arma_debug_sigprint();
out = B_expr.get_ref();
const uword B_n_rows = out.n_rows;
@@ -5034,15 +4929,7 @@ auxlib::solve_sympd_rcond(Mat< std::complex<typename T1::pod_type> >& out, bool&
{
arma_debug_sigprint();
#if defined(ARMA_CRIPPLED_LAPACK)
{
arma_debug_print("auxlib::solve_sympd_rcond(): redirecting to auxlib::solve_square_rcond() due to crippled LAPACK");
out_sympd_state = false;
return auxlib::solve_square_rcond(out, out_rcond, A, B_expr);
}
#elif defined(ARMA_USE_LAPACK)
#if defined(ARMA_USE_LAPACK)
{
typedef typename T1::pod_type T;
typedef typename std::complex<T> eT;
@@ -5190,13 +5077,7 @@ auxlib::solve_sympd_refine(Mat< std::complex<typename T1::pod_type> >& out, type
{
arma_debug_sigprint();
#if defined(ARMA_CRIPPLED_LAPACK)
{
arma_debug_print("auxlib::solve_sympd_refine(): redirecting to auxlib::solve_square_refine() due to crippled LAPACK");
return auxlib::solve_square_refine(out, out_rcond, A, B_expr, equilibrate);
}
#elif defined(ARMA_USE_LAPACK)
#if defined(ARMA_USE_LAPACK)
{
typedef typename T1::pod_type T;
typedef typename std::complex<T> eT;
@@ -5279,8 +5160,8 @@ auxlib::solve_rect_fast(Mat<typename T1::elem_type>& out, Mat<typename T1::elem_
{
typedef typename T1::elem_type eT;
const unwrap<T1> U(B_expr.get_ref());
const Mat<eT>& B = U.M;
const plain_unwrap<T1> U(B_expr.get_ref());
const Mat<eT>& B = U.M;
arma_conform_check( (A.n_rows != B.n_rows), "solve(): number of rows in given matrices must be the same" );
@@ -5373,8 +5254,8 @@ auxlib::solve_rect_rcond(Mat<typename T1::elem_type>& out, typename T1::pod_type
out_rcond = T(0);
const unwrap<T1> U(B_expr.get_ref());
const Mat<eT>& B = U.M;
const plain_unwrap<T1> U(B_expr.get_ref());
const Mat<eT>& B = U.M;
arma_conform_check( (A.n_rows != B.n_rows), "solve(): number of rows in given matrices must be the same" );
@@ -5506,8 +5387,8 @@ auxlib::solve_approx_svd(Mat<typename T1::pod_type>& out, Mat<typename T1::pod_t
{
typedef typename T1::pod_type eT;
const unwrap<T1> U(B_expr.get_ref());
const Mat<eT>& B = U.M;
const plain_unwrap<T1> U(B_expr.get_ref());
const Mat<eT>& B = U.M;
arma_conform_check( (A.n_rows != B.n_rows), "solve(): number of rows in given matrices must be the same" );
@@ -5628,8 +5509,8 @@ auxlib::solve_approx_svd(Mat< std::complex<typename T1::pod_type> >& out, Mat< s
typedef typename T1::pod_type T;
typedef typename std::complex<T> eT;
const unwrap<T1> U(B_expr.get_ref());
const Mat<eT>& B = U.M;
const plain_unwrap<T1> U(B_expr.get_ref());
const Mat<eT>& B = U.M;
arma_conform_check( (A.n_rows != B.n_rows), "solve(): number of rows in given matrices must be the same" );
@@ -5849,50 +5730,11 @@ auxlib::solve_trimat_rcond(Mat<typename T1::elem_type>& out, typename T1::pod_ty
//! solve a system of linear equations via LU decomposition (real band matrix)
template<typename T1>
inline
bool
auxlib::solve_band_fast(Mat<typename T1::pod_type>& out, Mat<typename T1::pod_type>& A, const uword KL, const uword KU, const Base<typename T1::pod_type,T1>& B_expr)
{
arma_debug_sigprint();
return auxlib::solve_band_fast_common(out, A, KL, KU, B_expr);
}
//! solve a system of linear equations via LU decomposition (complex band matrix)
template<typename T1>
inline
bool
auxlib::solve_band_fast(Mat< std::complex<typename T1::pod_type> >& out, Mat< std::complex<typename T1::pod_type> >& A, const uword KL, const uword KU, const Base< std::complex<typename T1::pod_type>,T1>& B_expr)
{
arma_debug_sigprint();
#if defined(ARMA_CRIPPLED_LAPACK)
{
arma_debug_print("auxlib::solve_band_fast(): redirecting to auxlib::solve_square_fast() due to crippled LAPACK");
arma_ignore(KL);
arma_ignore(KU);
return auxlib::solve_square_fast(out, A, B_expr);
}
#else
{
return auxlib::solve_band_fast_common(out, A, KL, KU, B_expr);
}
#endif
}
//! solve a system of linear equations via LU decomposition (band matrix)
template<typename T1>
inline
bool
auxlib::solve_band_fast_common(Mat<typename T1::elem_type>& out, const Mat<typename T1::elem_type>& A, const uword KL, const uword KU, const Base<typename T1::elem_type,T1>& B_expr)
auxlib::solve_band_fast(Mat<typename T1::elem_type>& out, const Mat<typename T1::elem_type>& A, const uword KL, const uword KU, const Base<typename T1::elem_type,T1>& B_expr)
{
arma_debug_sigprint();
@@ -5950,50 +5792,11 @@ auxlib::solve_band_fast_common(Mat<typename T1::elem_type>& out, const Mat<typen
//! solve a system of linear equations via LU decomposition (real band matrix)
template<typename T1>
inline
bool
auxlib::solve_band_rcond(Mat<typename T1::pod_type>& out, typename T1::pod_type& out_rcond, Mat<typename T1::pod_type>& A, const uword KL, const uword KU, const Base<typename T1::pod_type,T1>& B_expr)
{
arma_debug_sigprint();
return auxlib::solve_band_rcond_common(out, out_rcond, A, KL, KU, B_expr);
}
//! solve a system of linear equations via LU decomposition (complex band matrix)
template<typename T1>
inline
bool
auxlib::solve_band_rcond(Mat< std::complex<typename T1::pod_type> >& out, typename T1::pod_type& out_rcond, Mat< std::complex<typename T1::pod_type> >& A, const uword KL, const uword KU, const Base< std::complex<typename T1::pod_type>,T1>& B_expr)
{
arma_debug_sigprint();
#if defined(ARMA_CRIPPLED_LAPACK)
{
arma_debug_print("auxlib::solve_band_rcond(): redirecting to auxlib::solve_square_rcond() due to crippled LAPACK");
arma_ignore(KL);
arma_ignore(KU);
return auxlib::solve_square_rcond(out, out_rcond, A, B_expr);
}
#else
{
return auxlib::solve_band_rcond_common(out, out_rcond, A, KL, KU, B_expr);
}
#endif
}
//! solve a system of linear equations via LU decomposition (band matrix)
template<typename T1>
inline
bool
auxlib::solve_band_rcond_common(Mat<typename T1::elem_type>& out, typename T1::pod_type& out_rcond, const Mat<typename T1::elem_type>& A, const uword KL, const uword KU, const Base<typename T1::elem_type,T1>& B_expr)
auxlib::solve_band_rcond(Mat<typename T1::elem_type>& out, typename T1::pod_type& out_rcond, const Mat<typename T1::elem_type>& A, const uword KL, const uword KU, const Base<typename T1::elem_type,T1>& B_expr)
{
arma_debug_sigprint();
@@ -6174,16 +5977,7 @@ auxlib::solve_band_refine(Mat< std::complex<typename T1::pod_type> >& out, typen
{
arma_debug_sigprint();
#if defined(ARMA_CRIPPLED_LAPACK)
{
arma_debug_print("auxlib::solve_band_refine(): redirecting to auxlib::solve_square_refine() due to crippled LAPACK");
arma_ignore(KL);
arma_ignore(KU);
return auxlib::solve_square_refine(out, out_rcond, A, B_expr, equilibrate);
}
#elif defined(ARMA_USE_LAPACK)
#if defined(ARMA_USE_LAPACK)
{
typedef typename T1::pod_type T;
typedef typename std::complex<T> eT;
@@ -6270,47 +6064,11 @@ auxlib::solve_band_refine(Mat< std::complex<typename T1::pod_type> >& out, typen
//! solve a system of linear equations via Gaussian elimination with partial pivoting (real tridiagonal band matrix)
template<typename T1>
inline
bool
auxlib::solve_tridiag_fast(Mat<typename T1::pod_type>& out, Mat<typename T1::pod_type>& A, const Base<typename T1::pod_type,T1>& B_expr)
{
arma_debug_sigprint();
return auxlib::solve_tridiag_fast_common(out, A, B_expr);
}
//! solve a system of linear equations via Gaussian elimination with partial pivoting (complex tridiagonal band matrix)
template<typename T1>
inline
bool
auxlib::solve_tridiag_fast(Mat< std::complex<typename T1::pod_type> >& out, Mat< std::complex<typename T1::pod_type> >& A, const Base< std::complex<typename T1::pod_type>,T1>& B_expr)
{
arma_debug_sigprint();
#if defined(ARMA_CRIPPLED_LAPACK)
{
arma_debug_print("auxlib::solve_tridiag_fast(): redirecting to auxlib::solve_square_fast() due to crippled LAPACK");
return auxlib::solve_square_fast(out, A, B_expr);
}
#else
{
return auxlib::solve_tridiag_fast_common(out, A, B_expr);
}
#endif
}
//! solve a system of linear equations via Gaussian elimination with partial pivoting (tridiagonal band matrix)
template<typename T1>
inline
bool
auxlib::solve_tridiag_fast_common(Mat<typename T1::elem_type>& out, const Mat<typename T1::elem_type>& A, const Base<typename T1::elem_type,T1>& B_expr)
auxlib::solve_tridiag_fast(Mat<typename T1::elem_type>& out, const Mat<typename T1::elem_type>& A, const Base<typename T1::elem_type,T1>& B_expr)
{
arma_debug_sigprint();
@@ -6486,15 +6244,15 @@ auxlib::schur(Mat< std::complex<T> >& U, Mat< std::complex<T> >& S, const bool c
template<typename eT>
inline
bool
auxlib::syl(Mat<eT>& X, const Mat<eT>& A, const Mat<eT>& B, const Mat<eT>& C)
auxlib::sylvester(Mat<eT>& X, const Mat<eT>& A, const Mat<eT>& B, const Mat<eT>& C)
{
arma_debug_sigprint();
#if defined(ARMA_USE_LAPACK)
{
arma_conform_check( (A.is_square() == false) || (B.is_square() == false), "syl(): given matrices must be square sized" );
arma_conform_check( (A.is_square() == false) || (B.is_square() == false), "sylvester(): given matrices must be square sized" );
arma_conform_check( (C.n_rows != A.n_rows) || (C.n_cols != B.n_cols), "syl(): matrices are not conformant" );
arma_conform_check( (C.n_rows != A.n_rows) || (C.n_cols != B.n_cols), "sylvester(): matrices are not conformant" );
if(A.is_empty() || B.is_empty() || C.is_empty()) { X.reset(); return true; }
@@ -6534,7 +6292,7 @@ auxlib::syl(Mat<eT>& X, const Mat<eT>& A, const Mat<eT>& B, const Mat<eT>& C)
arma_ignore(A);
arma_ignore(B);
arma_ignore(C);
arma_stop_logic_error("syl(): use of LAPACK must be enabled");
arma_stop_logic_error("sylvester(): use of LAPACK must be enabled");
return false;
}
#endif
@@ -6714,6 +6472,76 @@ auxlib::qz(Mat< std::complex<T> >& A, Mat< std::complex<T> >& B, Mat< std::compl
template<typename eT>
inline
bool
auxlib::balance(Col<typename get_pod_type<eT>::result>& S, Col<uword>& P, Mat<eT>& A, const bool calc_SP, const bool do_scal, const bool do_perm)
{
arma_debug_sigprint();
#if defined(ARMA_USE_LAPACK)
{
typedef typename get_pod_type<eT>::result T;
// assuming given matrix is square-sized
if(A.n_elem == 0) { S.reset(); P.reset(); return true; }
const char job = (do_scal && do_perm) ? 'B' : ((do_scal) ? 'S' : ((do_perm) ? 'P' : 'N'));
blas_int n = blas_int(A.n_rows);
blas_int lda = blas_int(A.n_rows);
blas_int ilo = blas_int(0);
blas_int ihi = blas_int(0);
blas_int info = blas_int(0);
podarray<T> scale(A.n_rows); scale.zeros();
arma_debug_print("lapack::gebal()");
lapack::gebal(&job, &n, A.memptr(), &lda, &ilo, &ihi, scale.memptr(), &info);
if(info != blas_int(0)) { return false; }
if(calc_SP == false) { return true; }
const uword N = A.n_rows;
// sanity check
if( (ilo < 1) || (uword(ihi) > N) ) { arma_debug_print("ilo and/or ihi out of bounds"); return false; }
S.zeros(N);
P.zeros(N);
T* S_mem = S.memptr();
uword* P_mem = P.memptr();
const T* scale_mem = scale.memptr();
for(uword i = 0; i < uword(ilo)-1; ++i) { S_mem[i] = T(1); }
for(uword i = uword(ilo)-1; i < uword(ihi); ++i) { S_mem[i] = scale_mem[i]; }
for(uword i = uword(ihi); i < N; ++i) { S_mem[i] = T(1); }
for(uword i=0; i < N; ++i) { P_mem[i] = i; }
for(uword i=N-1; i >= uword(ihi) ; --i) { const uword j = uword(scale_mem[i]) - 1; std::swap(P_mem[i], P_mem[j]); }
for(uword i=0; i < uword(ilo)-1; ++i) { const uword j = uword(scale_mem[i]) - 1; std::swap(P_mem[i], P_mem[j]); }
return true;
}
#else
{
arma_ignore(S);
arma_ignore(P);
arma_ignore(A);
arma_ignore(do_scal);
arma_ignore(do_perm);
return false;
}
#endif
}
template<typename eT>
inline
eT
@@ -6882,13 +6710,7 @@ auxlib::rcond_sym(Mat< std::complex<T> >& A)
{
// NOTE: the function name is required for overloading, but is a misnomer: it processes complex hermitian matrices
#if defined(ARMA_CRIPPLED_LAPACK)
{
arma_debug_print("auxlib::rcond_sym(): redirecting to auxlib::rcond() due to crippled LAPACK");
return auxlib::rcond(A);
}
#elif defined(ARMA_USE_LAPACK)
#if defined(ARMA_USE_LAPACK)
{
typedef typename std::complex<T> eT;
@@ -7135,13 +6957,7 @@ inline
T
auxlib::lu_rcond_sympd(const Mat< std::complex<T> >& A, const T norm_val)
{
#if defined(ARMA_CRIPPLED_LAPACK)
{
arma_ignore(A);
arma_ignore(norm_val);
return T(0);
}
#elif defined(ARMA_USE_LAPACK)
#if defined(ARMA_USE_LAPACK)
{
typedef typename std::complex<T> eT;
@@ -7217,16 +7033,7 @@ inline
T
auxlib::lu_rcond_band(const Mat< std::complex<T> >& AB, const uword KL, const uword KU, const podarray<blas_int>& ipiv, const T norm_val)
{
#if defined(ARMA_CRIPPLED_LAPACK)
{
arma_ignore(AB);
arma_ignore(KL);
arma_ignore(KU);
arma_ignore(ipiv);
arma_ignore(norm_val);
return T(0);
}
#elif defined(ARMA_USE_LAPACK)
#if defined(ARMA_USE_LAPACK)
{
typedef typename std::complex<T> eT;
@@ -7264,26 +7071,6 @@ auxlib::lu_rcond_band(const Mat< std::complex<T> >& AB, const uword KL, const uw
template<typename T1>
inline
bool
auxlib::crippled_lapack(const Base<typename T1::elem_type, T1>&)
{
#if defined(ARMA_CRIPPLED_LAPACK)
{
arma_debug_print("auxlib::crippled_lapack(): true");
return (is_cx<typename T1::elem_type>::yes);
}
#else
{
return false;
}
#endif
}
template<typename eT>
inline
bool
+2 -2
View File
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
+4 -9
View File
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
@@ -78,13 +78,8 @@
#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
#if (!defined(ARMA_HAVE_CXX14)) && (!defined(ARMA_IGNORE_DEPRECATED_MARKER))
#pragma message ("INFO: support for C++11 is deprecated; minimum recommended standard is C++14")
#if !defined(ARMA_HAVE_CXX14)
#error "*** C++14 compiler required; enable C++14 mode in your compiler, or use an earlier version of Armadillo"
#endif
+12 -63
View File
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
@@ -22,8 +22,6 @@
#undef arma_aligned
#undef arma_align_mem
#undef arma_warn_unused
#undef arma_deprecated
#undef arma_frown
#undef arma_malloc
#undef arma_inline
#undef arma_noinline
@@ -34,8 +32,6 @@
#define arma_aligned
#define arma_align_mem
#define arma_warn_unused
#define arma_deprecated
#define arma_frown(msg)
#define arma_malloc
#define arma_inline inline
#define arma_noinline
@@ -102,6 +98,7 @@
#define ARMA_SIMPLE_LOOPS
#undef ARMA_GOOD_COMPILER
#undef ARMA_REAL_GCC
// posix_memalign() is part of IEEE standard 1003.1
// http://pubs.opengroup.org/onlinepubs/009696899/functions/posix_memalign.html
@@ -158,29 +155,18 @@
// #pragma message ("using GCC extensions")
#undef ARMA_GCC_VERSION
#define ARMA_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
#if (ARMA_GCC_VERSION < 60100)
#error "*** newer compiler required; need gcc 6.1 or newer ***"
#endif
// gcc 6.1 has proper C++14 support and fixes an OpenMP related bug:
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57580
#if (ARMA_GCC_VERSION < 80100)
#pragma message("INFO: support for GCC versions older than 8.1 is deprecated"
#if (__GNUC__ < 8)
#error "*** newer compiler required; need at least gcc 8.1 ***"
#endif
#define ARMA_GOOD_COMPILER
#define ARMA_REAL_GCC
#undef arma_hot
#undef arma_cold
#undef arma_aligned
#undef arma_align_mem
#undef arma_warn_unused
#undef arma_deprecated
#undef arma_frown
#undef arma_malloc
#undef arma_inline
#undef arma_noinline
@@ -190,8 +176,6 @@
#define arma_aligned __attribute__((__aligned__))
#define arma_align_mem __attribute__((__aligned__(16)))
#define arma_warn_unused __attribute__((__warn_unused_result__))
#define arma_deprecated __attribute__((__deprecated__))
#define arma_frown(msg) __attribute__((__deprecated__(msg)))
#define arma_malloc __attribute__((__malloc__))
#define arma_inline __attribute__((__always_inline__)) inline
#define arma_noinline __attribute__((__noinline__))
@@ -251,16 +235,6 @@
#define arma_warn_unused __attribute__((__warn_unused_result__))
#endif
#if __has_attribute(__deprecated__)
#undef arma_deprecated
#define arma_deprecated __attribute__((__deprecated__))
#endif
#if __has_attribute(__deprecated__)
#undef arma_frown
#define arma_frown(msg) __attribute__((__deprecated__(msg)))
#endif
#if __has_attribute(__malloc__)
#undef arma_malloc
#define arma_malloc __attribute__((__malloc__))
@@ -318,9 +292,6 @@
#error "*** newer compiler required ***"
#endif
#undef arma_deprecated
#define arma_deprecated __declspec(deprecated)
#undef arma_noinline
#define arma_noinline __declspec(noinline)
@@ -378,15 +349,6 @@
#endif
#if defined(ARMA_HAVE_CXX14)
#undef arma_deprecated
#define arma_deprecated [[deprecated]]
#undef arma_frown
#define arma_frown(msg) [[deprecated(msg)]]
#endif
#if defined(ARMA_HAVE_CXX17)
#undef arma_warn_unused
#define arma_warn_unused [[nodiscard]]
@@ -394,16 +356,17 @@
#if !defined(ARMA_DONT_USE_OPENMP)
#if (defined(_OPENMP) && (_OPENMP >= 201107))
#if (defined(_OPENMP) && (_OPENMP >= 201307))
#undef ARMA_USE_OPENMP
#define ARMA_USE_OPENMP
#endif
#endif
#if ( defined(ARMA_USE_OPENMP) && (!defined(_OPENMP) || (defined(_OPENMP) && (_OPENMP < 201107))) )
#if ( defined(ARMA_USE_OPENMP) && (!defined(_OPENMP) || (defined(_OPENMP) && (_OPENMP < 201307))) )
// OpenMP 3.0 required for parallelisation of loops with unsigned integers
// OpenMP 3.1 required for atomic read and atomic write
// OpenMP 3.1 required for atomic read/write
// OpenMP 4.0 required for seq_cst memory order clause in atomic read/write
#undef ARMA_USE_OPENMP
#undef ARMA_PRINT_OPENMP_WARNING
#define ARMA_PRINT_OPENMP_WARNING
@@ -411,11 +374,10 @@
#if defined(ARMA_PRINT_OPENMP_WARNING) && !defined(ARMA_DONT_PRINT_OPENMP_WARNING)
#pragma message ("WARNING: use of OpenMP disabled; compiler support for OpenMP 3.1+ not detected")
#pragma message ("WARNING: use of OpenMP disabled; compiler support for OpenMP 4.0+ not detected")
#if (defined(_OPENMP) && (_OPENMP < 201107))
#if (defined(_OPENMP) && (_OPENMP < 201307))
#pragma message ("NOTE: your compiler has an outdated version of OpenMP")
#pragma message ("NOTE: consider upgrading to a better compiler")
#endif
#endif
@@ -449,7 +411,6 @@
#undef ARMA_DETECTED_FAKE_GCC
#undef ARMA_DETECTED_FAKE_CLANG
#undef ARMA_GCC_VERSION
#undef ARMA_PRINT_OPENMP_WARNING
@@ -475,15 +436,3 @@
// https://sourceware.org/bugzilla/show_bug.cgi?id=19239
#undef minor
#undef major
// WARNING: option 'ARMA_IGNORE_DEPRECATED_MARKER' will be removed;
// WARNING: disabling deprecation messages is counter-productive
#if defined(ARMA_IGNORE_DEPRECATED_MARKER)
#undef arma_deprecated
#define arma_deprecated
#undef arma_frown
#define arma_frown(msg)
#endif
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
@@ -20,10 +20,26 @@
//! @{
//
// for preventing pedantic compiler warnings
template<bool do_eval>
struct cond_rel
{
template<typename eT> static constexpr bool lt(const eT A, const eT B);
template<typename eT> static constexpr bool gt(const eT A, const eT B);
template<typename eT> static constexpr bool leq(const eT A, const eT B);
template<typename eT> static constexpr bool geq(const eT A, const eT B);
template<typename eT> static constexpr eT make_neg(const eT val);
};
template<>
template<typename eT>
arma_inline
constexpr
bool
cond_rel<true>::lt(const eT A, const eT B)
{
@@ -34,7 +50,7 @@ cond_rel<true>::lt(const eT A, const eT B)
template<>
template<typename eT>
arma_inline
constexpr
bool
cond_rel<false>::lt(const eT, const eT)
{
@@ -45,7 +61,7 @@ cond_rel<false>::lt(const eT, const eT)
template<>
template<typename eT>
arma_inline
constexpr
bool
cond_rel<true>::gt(const eT A, const eT B)
{
@@ -56,7 +72,7 @@ cond_rel<true>::gt(const eT A, const eT B)
template<>
template<typename eT>
arma_inline
constexpr
bool
cond_rel<false>::gt(const eT, const eT)
{
@@ -67,7 +83,7 @@ cond_rel<false>::gt(const eT, const eT)
template<>
template<typename eT>
arma_inline
constexpr
bool
cond_rel<true>::leq(const eT A, const eT B)
{
@@ -78,7 +94,7 @@ cond_rel<true>::leq(const eT A, const eT B)
template<>
template<typename eT>
arma_inline
constexpr
bool
cond_rel<false>::leq(const eT, const eT)
{
@@ -89,7 +105,7 @@ cond_rel<false>::leq(const eT, const eT)
template<>
template<typename eT>
arma_inline
constexpr
bool
cond_rel<true>::geq(const eT A, const eT B)
{
@@ -100,7 +116,7 @@ cond_rel<true>::geq(const eT A, const eT B)
template<>
template<typename eT>
arma_inline
constexpr
bool
cond_rel<false>::geq(const eT, const eT)
{
@@ -111,7 +127,7 @@ cond_rel<false>::geq(const eT, const eT)
template<>
template<typename eT>
arma_inline
constexpr
eT
cond_rel<true>::make_neg(const eT val)
{
@@ -122,7 +138,7 @@ cond_rel<true>::make_neg(const eT val)
template<>
template<typename eT>
arma_inline
constexpr
eT
cond_rel<false>::make_neg(const eT)
{
+51 -53
View File
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
@@ -147,6 +147,12 @@
//// Note that ARMA_64BIT_WORD is automatically enabled when std::size_t has 64 bits and ARMA_32BIT_WORD is not defined.
#endif
#if !defined(ARMA_FORCE_USE_FP16)
// #define ARMA_FORCE_USE_FP16
//// Uncomment the above line to force the use of fp16 and cx_fp16 element types even if hardware support is not detected.
//// NOTE: C++23 is also required for fp16 and cx_fp16.
#endif
#if !defined(ARMA_OPTIMISE_BAND)
#define ARMA_OPTIMISE_BAND
//// Comment out the above line to disable optimised handling
@@ -157,7 +163,7 @@
#define ARMA_OPTIMISE_SYM
//// Comment out the above line to disable optimised handling
//// of symmetric/hermitian matrices by various functions:
//// solve(), inv(), pinv(), expmat(), logmat(), sqrtmat(), rcond(), rank()
//// solve(), inv(), pinv(), expmat(), logmat(), sqrtmat(), powmat(), rank(), cond(), rcond()
#endif
#if !defined(ARMA_OPTIMISE_INVEXPR)
@@ -166,6 +172,11 @@
//// of inv() and inv_sympd() within compound expressions
#endif
#if !defined(ARMA_OPTIMISE_POWEXPR)
#define ARMA_OPTIMISE_POWEXPR
//// Comment out the above line to disable optimised handling of pow()
#endif
#if !defined(ARMA_CHECK_CONFORMANCE)
#define ARMA_CHECK_CONFORMANCE
//// Comment out the above line to disable conformance checks for bounds and size.
@@ -209,32 +220,14 @@
#define ARMA_DEBUG
#endif
#if defined(ARMA_DEFAULT_OSTREAM)
#pragma message ("WARNING: support for ARMA_DEFAULT_OSTREAM is deprecated and will be removed;")
#pragma message ("WARNING: use ARMA_COUT_STREAM and ARMA_CERR_STREAM instead")
#endif
#if !defined(ARMA_COUT_STREAM)
#if defined(ARMA_DEFAULT_OSTREAM)
// for compatibility with earlier versions of Armadillo
#define ARMA_COUT_STREAM ARMA_DEFAULT_OSTREAM
#else
#define ARMA_COUT_STREAM std::cout
#endif
#define ARMA_COUT_STREAM std::cout
#endif
#if !defined(ARMA_CERR_STREAM)
#if defined(ARMA_DEFAULT_OSTREAM)
// for compatibility with earlier versions of Armadillo
#define ARMA_CERR_STREAM ARMA_DEFAULT_OSTREAM
#else
#define ARMA_CERR_STREAM std::cerr
#endif
#define ARMA_CERR_STREAM std::cerr
#endif
#if !defined(ARMA_PRINT_EXCEPTIONS)
// #define ARMA_PRINT_EXCEPTIONS
#if defined(ARMA_PRINT_EXCEPTIONS_INTERNAL)
@@ -288,13 +281,6 @@
#undef ARMA_USE_STD_MUTEX
#endif
// for compatibility with earlier versions of Armadillo
#if defined(ARMA_DONT_USE_CXX11_MUTEX)
#pragma message ("WARNING: support for ARMA_DONT_USE_CXX11_MUTEX is deprecated and will be removed;")
#pragma message ("WARNING: use ARMA_DONT_USE_STD_MUTEX instead")
#undef ARMA_USE_STD_MUTEX
#endif
#if defined(ARMA_DONT_USE_OPENMP)
#undef ARMA_USE_OPENMP
#endif
@@ -303,10 +289,29 @@
#undef ARMA_64BIT_WORD
#endif
#if defined(ARMA_DONT_USE_FP16)
#undef ARMA_FORCE_USE_FP16
#endif
#if (defined(ARMA_BLAS_LONG_LONG) && defined(ARMA_USE_WRAPPER))
#pragma message ("WARNING: use of ARMA_BLAS_LONG_LONG in conjunction with ARMA_USE_WRAPPER is not supported")
#endif
#if (defined(ARMA_BLAS_64BIT_INT) && defined(ARMA_USE_WRAPPER))
#pragma message ("WARNING: use of ARMA_BLAS_64BIT_INT in conjunction with ARMA_USE_WRAPPER is not supported")
#endif
#if (defined(ARMA_SUPERLU_64BIT_INT) && defined(ARMA_USE_WRAPPER))
#pragma message ("WARNING: use of ARMA_SUPERLU_64BIT_INT in conjunction with ARMA_USE_WRAPPER is not supported")
#endif
// for compatibility with earlier versions of Armadillo
#if defined(ARMA_BLAS_LONG) || defined(ARMA_BLAS_LONG_LONG)
#undef ARMA_BLAS_64BIT_INT
#define ARMA_BLAS_64BIT_INT
// #pragma message ("options ARMA_BLAS_LONG and ARMA_BLAS_LONG_LONG are deprecated;")
// #pragma message ("use ARMA_BLAS_64BIT_INT instead")
#endif
#if defined(ARMA_DONT_OPTIMISE_BAND) || defined(ARMA_DONT_OPTIMISE_SOLVE_BAND)
@@ -321,20 +326,8 @@
#undef ARMA_OPTIMISE_INVEXPR
#endif
#if defined(ARMA_DONT_CHECK_CONFORMANCE)
#if defined(ARMA_CHECK_CONFORMANCE) && (ARMA_WARN_LEVEL >= 2)
#pragma message ("WARNING: conformance checks disabled")
#endif
#undef ARMA_CHECK_CONFORMANCE
#endif
#if defined(ARMA_DONT_CHECK_NONFINITE)
#undef ARMA_CHECK_NONFINITE
#endif
#if defined(ARMA_DONT_IGNORE_DEPRECATED_MARKER)
#undef ARMA_IGNORE_DEPRECATED_MARKER
#if defined(ARMA_DONT_OPTIMISE_POWEXPR)
#undef ARMA_OPTIMISE_POWEXPR
#endif
#if defined(ARMA_NO_DEBUG)
@@ -354,25 +347,30 @@
#undef ARMA_WARN_LEVEL
#define ARMA_WARN_LEVEL 3
#endif
#if defined(ARMA_DONT_CHECK_CONFORMANCE)
#if defined(ARMA_CHECK_CONFORMANCE) && (ARMA_WARN_LEVEL >= 2)
#pragma message ("WARNING: conformance checks disabled")
#endif
#undef ARMA_IGNORE_DEPRECATED_MARKER
#undef ARMA_CHECK_CONFORMANCE
#endif
#if defined(ARMA_DONT_CHECK_NONFINITE)
#undef ARMA_CHECK_NONFINITE
#endif
#if defined(ARMA_DONT_PRINT_EXCEPTIONS)
#undef ARMA_PRINT_EXCEPTIONS
#endif
#if defined(ARMA_NO_CRIPPLED_LAPACK)
#undef ARMA_CRIPPLED_LAPACK
#if defined(ARMA_IGNORE_DEPRECATED_MARKER)
#pragma message ("NOTE: option ARMA_IGNORE_DEPRECATED_MARKER is not supported")
#endif
// WARNING: option ARMA_IGNORE_DEPRECATED_MARKER will be removed
// WARNING: option ARMA_CRIPPLED_LAPACK will be removed
#if defined(ARMA_CRIPPLED_LAPACK)
#if (!defined(ARMA_IGNORE_DEPRECATED_MARKER))
#pragma message ("option ARMA_CRIPPLED_LAPACK is deprecated and will be removed")
#endif
#pragma message ("NOTE: option ARMA_CRIPPLED_LAPACK is not supported")
#endif
+51 -53
View File
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
@@ -147,6 +147,12 @@
//// Note that ARMA_64BIT_WORD is automatically enabled when std::size_t has 64 bits and ARMA_32BIT_WORD is not defined.
#endif
#if !defined(ARMA_FORCE_USE_FP16)
// #define ARMA_FORCE_USE_FP16
//// Uncomment the above line to force the use of fp16 and cx_fp16 element types even if hardware support is not detected.
//// NOTE: C++23 is also required for fp16 and cx_fp16.
#endif
#if !defined(ARMA_OPTIMISE_BAND)
#define ARMA_OPTIMISE_BAND
//// Comment out the above line to disable optimised handling
@@ -157,7 +163,7 @@
#define ARMA_OPTIMISE_SYM
//// Comment out the above line to disable optimised handling
//// of symmetric/hermitian matrices by various functions:
//// solve(), inv(), pinv(), expmat(), logmat(), sqrtmat(), rcond(), rank()
//// solve(), inv(), pinv(), expmat(), logmat(), sqrtmat(), powmat(), rank(), cond(), rcond()
#endif
#if !defined(ARMA_OPTIMISE_INVEXPR)
@@ -166,6 +172,11 @@
//// of inv() and inv_sympd() within compound expressions
#endif
#if !defined(ARMA_OPTIMISE_POWEXPR)
#define ARMA_OPTIMISE_POWEXPR
//// Comment out the above line to disable optimised handling of pow()
#endif
#if !defined(ARMA_CHECK_CONFORMANCE)
#define ARMA_CHECK_CONFORMANCE
//// Comment out the above line to disable conformance checks for bounds and size.
@@ -209,32 +220,14 @@
#define ARMA_DEBUG
#endif
#if defined(ARMA_DEFAULT_OSTREAM)
#pragma message ("WARNING: support for ARMA_DEFAULT_OSTREAM is deprecated and will be removed;")
#pragma message ("WARNING: use ARMA_COUT_STREAM and ARMA_CERR_STREAM instead")
#endif
#if !defined(ARMA_COUT_STREAM)
#if defined(ARMA_DEFAULT_OSTREAM)
// for compatibility with earlier versions of Armadillo
#define ARMA_COUT_STREAM ARMA_DEFAULT_OSTREAM
#else
#define ARMA_COUT_STREAM std::cout
#endif
#define ARMA_COUT_STREAM std::cout
#endif
#if !defined(ARMA_CERR_STREAM)
#if defined(ARMA_DEFAULT_OSTREAM)
// for compatibility with earlier versions of Armadillo
#define ARMA_CERR_STREAM ARMA_DEFAULT_OSTREAM
#else
#define ARMA_CERR_STREAM std::cerr
#endif
#define ARMA_CERR_STREAM std::cerr
#endif
#if !defined(ARMA_PRINT_EXCEPTIONS)
// #define ARMA_PRINT_EXCEPTIONS
#if defined(ARMA_PRINT_EXCEPTIONS_INTERNAL)
@@ -288,13 +281,6 @@
#undef ARMA_USE_STD_MUTEX
#endif
// for compatibility with earlier versions of Armadillo
#if defined(ARMA_DONT_USE_CXX11_MUTEX)
#pragma message ("WARNING: support for ARMA_DONT_USE_CXX11_MUTEX is deprecated and will be removed;")
#pragma message ("WARNING: use ARMA_DONT_USE_STD_MUTEX instead")
#undef ARMA_USE_STD_MUTEX
#endif
#if defined(ARMA_DONT_USE_OPENMP)
#undef ARMA_USE_OPENMP
#endif
@@ -303,10 +289,29 @@
#undef ARMA_64BIT_WORD
#endif
#if defined(ARMA_DONT_USE_FP16)
#undef ARMA_FORCE_USE_FP16
#endif
#if (defined(ARMA_BLAS_LONG_LONG) && defined(ARMA_USE_WRAPPER))
#pragma message ("WARNING: use of ARMA_BLAS_LONG_LONG in conjunction with ARMA_USE_WRAPPER is not supported")
#endif
#if (defined(ARMA_BLAS_64BIT_INT) && defined(ARMA_USE_WRAPPER))
#pragma message ("WARNING: use of ARMA_BLAS_64BIT_INT in conjunction with ARMA_USE_WRAPPER is not supported")
#endif
#if (defined(ARMA_SUPERLU_64BIT_INT) && defined(ARMA_USE_WRAPPER))
#pragma message ("WARNING: use of ARMA_SUPERLU_64BIT_INT in conjunction with ARMA_USE_WRAPPER is not supported")
#endif
// for compatibility with earlier versions of Armadillo
#if defined(ARMA_BLAS_LONG) || defined(ARMA_BLAS_LONG_LONG)
#undef ARMA_BLAS_64BIT_INT
#define ARMA_BLAS_64BIT_INT
// #pragma message ("options ARMA_BLAS_LONG and ARMA_BLAS_LONG_LONG are deprecated;")
// #pragma message ("use ARMA_BLAS_64BIT_INT instead")
#endif
#if defined(ARMA_DONT_OPTIMISE_BAND) || defined(ARMA_DONT_OPTIMISE_SOLVE_BAND)
@@ -321,20 +326,8 @@
#undef ARMA_OPTIMISE_INVEXPR
#endif
#if defined(ARMA_DONT_CHECK_CONFORMANCE)
#if defined(ARMA_CHECK_CONFORMANCE) && (ARMA_WARN_LEVEL >= 2)
#pragma message ("WARNING: conformance checks disabled")
#endif
#undef ARMA_CHECK_CONFORMANCE
#endif
#if defined(ARMA_DONT_CHECK_NONFINITE)
#undef ARMA_CHECK_NONFINITE
#endif
#if defined(ARMA_DONT_IGNORE_DEPRECATED_MARKER)
#undef ARMA_IGNORE_DEPRECATED_MARKER
#if defined(ARMA_DONT_OPTIMISE_POWEXPR)
#undef ARMA_OPTIMISE_POWEXPR
#endif
#if defined(ARMA_NO_DEBUG)
@@ -354,25 +347,30 @@
#undef ARMA_WARN_LEVEL
#define ARMA_WARN_LEVEL 3
#endif
#if defined(ARMA_DONT_CHECK_CONFORMANCE)
#if defined(ARMA_CHECK_CONFORMANCE) && (ARMA_WARN_LEVEL >= 2)
#pragma message ("WARNING: conformance checks disabled")
#endif
#undef ARMA_IGNORE_DEPRECATED_MARKER
#undef ARMA_CHECK_CONFORMANCE
#endif
#if defined(ARMA_DONT_CHECK_NONFINITE)
#undef ARMA_CHECK_NONFINITE
#endif
#if defined(ARMA_DONT_PRINT_EXCEPTIONS)
#undef ARMA_PRINT_EXCEPTIONS
#endif
#if defined(ARMA_NO_CRIPPLED_LAPACK)
#undef ARMA_CRIPPLED_LAPACK
#if defined(ARMA_IGNORE_DEPRECATED_MARKER)
#pragma message ("NOTE: option ARMA_IGNORE_DEPRECATED_MARKER is not supported")
#endif
// WARNING: option ARMA_IGNORE_DEPRECATED_MARKER will be removed
// WARNING: option ARMA_CRIPPLED_LAPACK will be removed
#if defined(ARMA_CRIPPLED_LAPACK)
#if (!defined(ARMA_IGNORE_DEPRECATED_MARKER))
#pragma message ("option ARMA_CRIPPLED_LAPACK is deprecated and will be removed")
#endif
#pragma message ("NOTE: option ARMA_CRIPPLED_LAPACK is not supported")
#endif
+65 -14
View File
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
//
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
// Copyright 2008-2016 Conrad Sanderson (https://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
// https://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,
@@ -22,12 +22,11 @@
namespace priv
{
class Datum_helper
struct Datum_helper
{
public:
template<typename eT>
static
constexpr
typename arma_real_only<eT>::result
nan(typename arma_real_only<eT>::result* junk = nullptr)
{
@@ -39,6 +38,7 @@ namespace priv
template<typename eT>
static
constexpr
typename arma_cx_only<eT>::result
nan(typename arma_cx_only<eT>::result* junk = nullptr)
{
@@ -52,6 +52,7 @@ namespace priv
template<typename eT>
static
constexpr
typename arma_integral_only<eT>::result
nan(typename arma_integral_only<eT>::result* junk = nullptr)
{
@@ -61,10 +62,14 @@ namespace priv
}
//
template<typename eT>
static
constexpr
typename arma_real_only<eT>::result
inf(typename arma_real_only<eT>::result* junk = nullptr)
pos_inf(typename arma_real_only<eT>::result* junk = nullptr)
{
arma_ignore(junk);
@@ -74,26 +79,70 @@ namespace priv
template<typename eT>
static
constexpr
typename arma_cx_only<eT>::result
inf(typename arma_cx_only<eT>::result* junk = nullptr)
pos_inf(typename arma_cx_only<eT>::result* junk = nullptr)
{
arma_ignore(junk);
typedef typename get_pod_type<eT>::result T;
return eT( Datum_helper::inf<T>(), Datum_helper::inf<T>() );
return eT( Datum_helper::pos_inf<T>(), Datum_helper::pos_inf<T>() );
}
template<typename eT>
static
constexpr
typename arma_integral_only<eT>::result
inf(typename arma_integral_only<eT>::result* junk = nullptr)
pos_inf(typename arma_integral_only<eT>::result* junk = nullptr)
{
arma_ignore(junk);
return std::numeric_limits<eT>::max();
}
//
template<typename eT>
static
constexpr
typename arma_real_only<eT>::result
neg_inf(typename arma_real_only<eT>::result* junk = nullptr)
{
arma_ignore(junk);
return (std::numeric_limits<eT>::has_infinity) ? eT(-std::numeric_limits<eT>::infinity()) : eT(std::numeric_limits<eT>::lowest());
}
template<typename eT>
static
constexpr
typename arma_cx_only<eT>::result
neg_inf(typename arma_cx_only<eT>::result* junk = nullptr)
{
arma_ignore(junk);
typedef typename get_pod_type<eT>::result T;
return eT( Datum_helper::neg_inf<T>(), Datum_helper::neg_inf<T>() );
}
template<typename eT>
static
constexpr
typename arma_integral_only<eT>::result
neg_inf(typename arma_integral_only<eT>::result* junk = nullptr)
{
arma_ignore(junk);
return std::numeric_limits<eT>::lowest();
}
};
}
@@ -107,10 +156,8 @@ namespace priv
template<typename eT>
class Datum
struct Datum
{
public:
static const eT pi; //!< ratio of any circle's circumference to its diameter
static const eT tau; //!< ratio of any circle's circumference to its radius (replacement of 2*pi)
static const eT e; //!< base of the natural logarithm
@@ -123,7 +170,9 @@ class Datum
static const eT log_min; //!< log of the minimum representable value
static const eT log_max; //!< log of the maximum representable value
static const eT nan; //!< "not a number"
static const eT inf; //!< infinity
static const eT inf; //!< positive infinity
static const eT pos_inf; //!< positive infinity
static const eT neg_inf; //!< negative infinity
//
@@ -174,7 +223,9 @@ template<typename eT> const eT Datum<eT>::eps = std::numeric_limits<eT>:
template<typename eT> const eT Datum<eT>::log_min = std::log(std::numeric_limits<eT>::min());
template<typename eT> const eT Datum<eT>::log_max = std::log(std::numeric_limits<eT>::max());
template<typename eT> const eT Datum<eT>::nan = priv::Datum_helper::nan<eT>();
template<typename eT> const eT Datum<eT>::inf = priv::Datum_helper::inf<eT>();
template<typename eT> const eT Datum<eT>::inf = priv::Datum_helper::pos_inf<eT>();
template<typename eT> const eT Datum<eT>::pos_inf = priv::Datum_helper::pos_inf<eT>();
template<typename eT> const eT Datum<eT>::neg_inf = priv::Datum_helper::neg_inf<eT>();
template<typename eT> const eT Datum<eT>::m_u = eT(1.66053906892e-27);
template<typename eT> const eT Datum<eT>::N_A = eT(6.02214076e23);

Some files were not shown because too many files have changed in this diff Show More