Compare commits

...
993 Commits
Author SHA1 Message Date
conrad bb8bdf3458 patch bump 2025-09-08 13:41:04 +10:00
conrad 3edd07b103 remove docs for redundant stable_sort_index() 2025-09-07 23:20:29 +10:00
conrad 962f1385b1 reduce number of trials 2025-09-05 14:12:33 +10:00
conrad d449a8d6a0 handle corner-case 2025-09-05 11:30:42 +10:00
conrad 4c66933553 faster handling of tubes 2025-09-05 00:29:53 +10:00
conrad 4424452a27 openmp parallelisation for matrix mul with non-BLAS element types 2025-09-02 10:50:01 +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
conrad 2456f676ec various spelling fixes 2025-03-25 23:17:48 +10:00
conrad 55560bbdf5 spelling fixes 2025-03-25 21:02:03 +10:00
conrad 6e880d8174 patch bump 2025-03-25 16:31:24 +10:00
conrad 0945718ee7 update pdf 2025-03-25 16:27:19 +10:00
conrad cc20c82f81 rename pdf 2025-03-25 16:26:39 +10:00
conrad 12259d14c4 add mutex around fftw plan teardown 2025-03-20 22:54:43 +08:00
conrad 993fe423df better wording 2025-03-19 23:52:25 +10:00
conrad 91970b89ff better wording 2025-03-19 14:14:06 +10:00
conrad 5bcbfc2494 improve docs for vecnorm() 2025-03-19 14:03:51 +10:00
conrad 64204ba71e minor simplifications 2025-03-18 19:58:20 +10:00
conrad efbb9ed899 update citation details 2025-03-17 15:31:46 +10:00
conrad 79d8be32a4 update citation details 2025-03-10 15:31:46 +10:00
conrad e5e59aad06 better wording 2025-03-10 12:49:05 +10:00
conrad 18836f6f54 minor fixes 2025-02-26 17:16:27 +10:00
conrad 12134220c6 add debug statements 2025-02-20 11:38:58 +10:00
conrad 54c8a6bce9 minor version bump 2025-02-17 14:23:00 +10:00
conrad 597779ad8e remove commented out code 2025-02-17 14:03:24 +10:00
conrad c7e0735820 mark as RC2 2025-02-15 15:20:49 +10:00
conrad 0a175fb070 comment out problematic workarounds 2025-02-15 11:56:07 +10:00
conrad 1ee1a6ea2d remove problematic workaround 2025-02-15 11:49:54 +10:00
conrad cb5686067d minor speedup 2025-02-14 14:47:06 +10:00
conrad 5d92b91916 faster handling of sum(square(X)) 2025-02-14 14:40:31 +10:00
conrad dca21aa5f1 optimisation for spglue_schur 2025-02-14 14:32:11 +10:00
conrad fce2e450b8 allow use of blas::dot() 2025-02-14 14:12:24 +10:00
conrad 28139a6da3 mark as RC1 2025-02-13 23:29:27 +10:00
conrad 5c45d78bba workaroudns for old user code 2025-02-13 22:45:47 +10:00
conrad 0446d2eed8 minor layout fix 2025-02-13 22:45:12 +10:00
conrad 3f0e62abfa workaround for old user code 2025-02-12 11:14:43 +10:00
conrad da80bc561f fix types 2025-02-12 10:04:02 +10:00
conrad 5a845df84b fix type 2025-02-12 09:46:43 +10:00
conrad c6219667df link to local PDF 2025-02-12 09:46:18 +10:00
conrad 90b529091f add arxiv pre-print 2025-02-11 13:08:36 +10:00
conrad dc1ede314e update citation 2025-02-10 15:34:37 +10:00
conrad fcd466d213 update copyright year 2025-02-10 15:29:46 +10:00
conrad 8ac6a694f0 update list of changes 2025-02-10 15:00:36 +10:00
conrad 9e6bda097d pre-calculate abs(cx) for faster sorting of complex matrices 2025-02-10 14:44:19 +10:00
conrad 0bea1b2f4d simplify comment 2025-02-10 12:03:26 +10:00
conrad 08a15ab6d2 simplifications 2025-02-07 15:44:24 +10:00
conrad 8f76c2f5a7 use temporary matrix to explicitly avoid aliasing 2025-02-07 15:32:51 +10:00
conrad eea1835183 specialised handling for pow(x,0.5) 2025-02-07 12:07:38 +10:00
conrad 8e02066f52 better wording 2025-02-07 11:51:28 +10:00
conrad cc5d113370 reinterpret pow(x,0.5) as sqrt(x) 2025-02-07 11:32:05 +10:00
conrad 8903fd84a5 restore selective use_mp for pow() 2025-02-07 11:15:52 +10:00
conrad 08d3312192 reinterpret pow(x,0.5) as sqrt(x) 2025-02-07 11:06:51 +10:00
conrad 9944415e12 minor fix 2025-02-06 14:44:15 +10:00
conrad beb4ee0e39 remove unused variable 2025-02-06 14:44:00 +10:00
conrad 4ab6a53ab5 minor layout fix 2025-02-06 14:40:31 +10:00
conrad 99b11428df use std:: prefix 2025-02-05 16:34:40 +10:00
conrad 955abfeeab refactor to avoid using union 2025-02-05 16:24:14 +10:00
conrad e5b1d0bd70 replace weird typedefs with C++11 type aliases 2025-02-05 13:01:33 +10:00
conrad b70e88d8ad minor fix 2025-02-04 13:40:24 +10:00
conrad e7ecee425f remove checking for matrix mul chains 2025-02-03 14:55:59 +10:00
conrad 7004caa4b4 handle more corner cases 2025-02-03 14:41:16 +10:00
conrad 22bbf2ad79 better debug message 2025-02-03 14:10:20 +10:00
conrad 73294812c3 rename unwrap variables 2025-02-03 13:22:42 +10:00
conrad 52b372f7f0 remove partial_unwrap_check 2025-02-03 13:15:07 +10:00
conrad 1f61355864 refactor to use partial_unwrap 2025-02-03 13:11:24 +10:00
conrad 95ac9ebde7 refactor to use partial_unwrap 2025-02-03 12:56:34 +10:00
conrad b244199997 print internal flags 2025-02-03 11:23:40 +10:00
conrad c689776db2 preserve more type information 2025-02-02 23:52:17 +10:00
conrad 37ca4fe05c update list of changes 2025-02-02 11:22:44 +10:00
conrad 4a299aa8ec update list of changes 2025-01-28 14:28:05 +10:00
conrad e0162f0a84 take into account use_mp flag 2025-01-28 14:24:53 +10:00
conrad cb9c78a9e3 faster handling of square() and pow(x,2) 2025-01-28 12:25:17 +10:00
conrad de479975af simplifications 2025-01-28 11:05:11 +10:00
conrad d57ad2a29a optimisation for spop_square 2025-01-27 22:47:34 +10:00
conrad 42a35f8cc3 optimisation for eop_square 2025-01-27 20:36:51 +10:00
conrad a75737fef7 use quasi_unwrap earlier 2025-01-27 00:10:13 +10:00
conrad 426ce1372a directly avoid Proxy if possible 2025-01-25 22:29:44 +10:00
conrad bce19ebcbd directly avoid Proxy if possible 2025-01-25 22:00:08 +10:00
conrad 59477c0dbc restore previous version 2025-01-24 13:08:05 +10:00
conrad bec851861b harmonise to use proxy_type 2025-01-24 11:43:39 +10:00
conrad 4e2f157604 reinterpret pow(x,2) as square(x) 2025-01-24 10:56:07 +10:00
conrad 2b513d3136 add TODO 2025-01-23 18:09:05 +10:00
conrad efac5b3148 reinterpret pow(x,2) as square(x) 2025-01-23 17:11:42 +10:00
conrad daa5deedf3 explicitly handle another corner case 2025-01-22 23:50:27 +10:00
conrad e658f0db17 restore old option for now 2025-01-22 23:23:02 +10:00
conrad bcee6924b7 update list of changes 2025-01-20 14:14:37 +10:00
conrad 089d2b965d unwrap if openmp can be used 2025-01-20 00:15:23 +10:00
conrad ee9f42faff simplifications 2025-01-19 23:41:41 +10:00
conrad 92f4bd5a24 simplifications 2025-01-19 23:01:35 +10:00
conrad 25383133c8 avoid using the proxy if we have direct memory access 2025-01-19 22:47:16 +10:00
conrad bde6942425 update list of changes 2025-01-19 00:17:26 +10:00
conrad b9461be144 faster handling of single submatirx columns 2025-01-18 23:58:31 +10:00
conrad c83caaa0da more efficient handling of expressions 2025-01-18 23:56:57 +10:00
conrad 0ec6b425e6 avoid using the proxy if we have direct memory access 2025-01-18 23:16:11 +10:00
conrad 785bfcb086 avoid using the proxy if we have direct memory access 2025-01-18 23:03:49 +10:00
conrad bb515b8a1f simplifications 2025-01-17 21:33:16 +10:00
conrad cb57dc3815 generate zeros quickly for non-complex inputs 2025-01-17 21:24:45 +10:00
conrad f474274d92 preserve type information 2025-01-17 21:19:04 +10:00
conrad 1629b41828 add warning 2025-01-17 14:08:13 +10:00
conrad 20afeff672 fix 2025-01-17 14:07:55 +10:00
conrad 78694113e3 cleanup 2025-01-17 13:41:00 +10:00
conrad acd2a5fcad optimisations for common cases 2025-01-17 13:37:58 +10:00
conrad 32fd3716fe optimisations for common cases 2025-01-17 13:33:13 +10:00
conrad 64de62450d exploit known dimensions 2025-01-17 13:13:12 +10:00
conrad 81e7d78488 don't fill with zeros as the memory will be immediately overwritten 2025-01-17 13:05:54 +10:00
conrad b8c402b663 avoid copying memory if possible 2025-01-17 13:01:07 +10:00
conrad 328f0fe573 exploit known dimensions 2025-01-17 12:51:38 +10:00
conrad 27db1972be fix for cornercase interaction with .slice() 2025-01-17 12:32:21 +10:00
conrad b0fe0d3cff simplifications 2025-01-17 12:23:08 +10:00
conrad 522cfdce58 fix 2025-01-16 16:34:06 +10:00
conrad dbf64f011c explicitly check for allowed transformations instead of implicit via n_elem 2025-01-16 16:29:13 +10:00
conrad f90249082c simplification 2025-01-16 16:14:14 +10:00
conrad 3b5fb76081 update list of changes 2025-01-16 16:04:47 +10:00
conrad af912a6177 fix 2025-01-16 15:59:42 +10:00
conrad 803c589b17 expand field class with initial implementations of .reshape() and .resize() 2025-01-16 15:50:59 +10:00
conrad 5eb6b5b5fc fix comments 2025-01-12 23:13:12 +10:00
conrad db71a4affb simplifications 2025-01-12 22:57:53 +10:00
conrad 0936110fbc update list of changes 2025-01-09 14:54:02 +10:00
conrad f905ee4b4a reinterpret pow(x,2) as square(x) 2025-01-09 14:39:11 +10:00
conrad 7ff62d22b0 simplifications 2025-01-09 14:30:55 +10:00
conrad c004318b0f fix 2025-01-09 14:25:20 +10:00
conrad 3632831126 reinterpret pow(x,2) as square(x) 2025-01-09 14:24:14 +10:00
conrad ebc6f94fcb simplification 2025-01-09 14:18:42 +10:00
conrad b4ede23c5c reinterpret pow(x,2) as square(x) 2025-01-09 14:17:15 +10:00
conrad feca3eae7f fix 2025-01-09 12:50:41 +10:00
conrad 0a76ab431b remove support for ARMA_IGNORE_DEPRECATED_MARKER 2025-01-02 15:09:00 +10:00
conrad 24b059344e new section for list of changes 2025-01-02 13:11:14 +10:00
conrad ceaa020a33 better layout for sinc() 2025-01-02 13:07:25 +10:00
conrad f9e308b2fd improve docs for toeplitz() 2025-01-02 00:02:21 +10:00
conrad 153c1363ea simplify docs for toeplitz() 2025-01-01 23:28:01 +10:00
conrad 316c7e4abf simplification; alias checks not required 2024-12-25 00:22:08 +10:00
conrad 469cb91a74 reduce stack usage by reducing unnecessary alignment markers 2024-12-18 14:08:42 +10:00
conrad 77cc3e9287 fix prototypes for xSYCON and xHECON 2024-12-17 12:17:02 +10:00
conrad e037bd9a5e reduce bloat 2024-12-16 13:58:00 +10:00
conrad 7138865c14 add note 2024-12-10 12:05:52 +10:00
conrad 8f94af0afb explicitly qualify inherited variables and functions 2024-12-04 12:24:44 +10:00
conrad dfdbae2570 explicitly qualify inherited variables and functions 2024-12-04 12:16:50 +10:00
conrad 11e69548f2 preserve vector type information 2024-12-03 16:25:38 +10:00
conrad 6f6cc83862 fix 2024-12-03 16:19:52 +10:00
conrad 0d2c5de574 preserve vector type information 2024-12-02 22:44:30 +10:00
conrad 07e5b6d1d6 avoid clashes with C++20 std::span 2024-12-02 16:23:54 +10:00
conrad df8741c86b explicitly qualify inherited variables and functions 2024-12-02 16:13:48 +10:00
conrad ffb9ef3c52 more selective detection of symmetric/hermitian matrices 2024-11-28 16:15:56 +11:00
conrad b87cc838a3 more selective detection of symmetric/hermitian matrices 2024-11-27 11:56:43 +11:00
conrad 9273614f58 fix 2024-11-24 17:12:41 +10:00
conrad cdedada64a revert 2024-11-23 16:40:29 +10:00
conrad b7cf2fd503 remove functions from Mat that are present in Base 2024-11-23 13:49:04 +10:00
conrad b3329329a7 expand deprecation warnings with messages 2024-11-23 00:42:36 +10:00
conrad 20bb9d8bcb ensure the first index of extremum value is found 2024-11-22 12:17:20 +10:00
conrad 6ecbed3813 remove unused code 2024-11-20 17:41:01 +10:00
conrad 123dd0108d use partial_unwrap instead of partial_unwrap_check 2024-11-20 17:26:49 +10:00
conrad 79793a7a97 mark as unstable 2024-11-20 12:27:28 +10:00
conrad a2c8b74a35 add TODOs 2024-11-20 11:45:56 +10:00
conrad a313b4fd0c version bump 2024-11-16 15:22:53 +10:00
conrad 85233ddbe7 better wording 2024-11-16 12:46:05 +10:00
conrad b6e9484b31 skip conformance check if given expression resolves to a vector 2024-11-15 11:46:29 +10:00
conrad a18a68289b better wording 2024-11-15 00:44:06 +10:00
conrad b3f4e55604 check for aliasing only when the element types match 2024-11-14 19:25:01 +10:00
conrad 702eb6c68b mark as RC1 2024-11-14 12:30:46 +10:00
conrad 0bdd169d38 simplifications 2024-11-14 12:06:57 +10:00
conrad 79f57ff784 update list of changes 2024-11-13 16:57:26 +10:00
conrad a3bc2bc599 ensure consisten handling of symmetric expressions by various forms of inv() 2024-11-13 16:48:20 +10:00
conrad 2cdd3feebb ensure all matrices are checked 2024-11-13 16:14:42 +10:00
conrad ca70fdfba3 more debug statements 2024-11-13 15:08:32 +10:00
conrad 9608d14058 avoid shadowing 2024-11-13 15:02:52 +10:00
conrad 112861df8b add dedicated function for alias detection 2024-11-13 14:55:09 +10:00
conrad 15232980d3 better wording 2024-11-13 14:08:13 +10:00
conrad 6058b46519 adapt to use .index_min() and .index_max() 2024-11-13 12:10:53 +10:00
conrad 0b07572a24 more tests 2024-11-13 12:04:39 +10:00
conrad bb819ee649 update to .index_max() 2024-11-13 12:01:56 +10:00
conrad ee965fc4b7 fix 2024-11-13 11:43:12 +10:00
conrad a7c16f40df update to .index_min() [continued] 2024-11-13 11:40:32 +10:00
conrad e83cea1b48 update to .index_min() 2024-11-12 17:07:20 +10:00
conrad dbca4d6631 wrappers for sytrs and hetrs 2024-11-11 20:05:17 +10:00
conrad 8cdca5cbe9 add redirects for crippled lapack 2024-11-11 19:11:09 +10:00
conrad 121b0a744a extend solve() to detect symmetric expressions 2024-11-11 19:01:04 +10:00
conrad 4ec712dcc6 expand detection of symmetric expressions 2024-11-11 16:21:51 +10:00
conrad e6bfb6941d for unimplemented options, change errors to warnings 2024-11-11 15:39:24 +10:00
conrad d2bdd90982 prevent compiler warnings 2024-11-11 15:29:28 +10:00
conrad 59a24f45f2 use threshold to avoid speed regressions under openblas 2024-11-11 15:21:18 +10:00
conrad ef011e704b minor layout fix 2024-11-11 14:51:32 +10:00
conrad 943fe56b61 fix 2024-11-11 14:48:44 +10:00
conrad 670ca673f8 check for conflicting options 2024-11-11 14:44:22 +10:00
conrad 265e66f43e document solve_opts::force_sym 2024-11-11 14:36:27 +10:00
conrad baf9ab7970 add solve_opts::force_sym option 2024-11-11 14:14:41 +10:00
conrad dd5e73ae20 add solve_sym_rcond 2024-11-11 14:14:20 +10:00
conrad 5d1ceb6aa9 revert 2024-11-11 11:22:16 +10:00
conrad acc8680aa8 restore previous wording 2024-11-11 11:08:27 +10:00
conrad 8cb75d0ac5 ensure consistent handling of symmetric matrices by expressions with inv() 2024-11-09 17:19:01 +10:00
conrad 77fccf7db1 use threshold 2024-11-09 16:21:43 +10:00
conrad 18a2a42061 add fast mode symmetric solver 2024-11-09 14:50:52 +10:00
conrad b2f8023392 simplify docs for solve() 2024-11-08 15:39:41 +10:00
conrad bcc950cb9e minor corrections 2024-11-08 15:21:00 +10:00
conrad 5c313e8a6d definitions for sytrs and hetrs 2024-11-08 15:15:25 +10:00
conrad d13194f8e8 expand MKL search paths 2024-11-07 13:10:31 +10:00
conrad 437c7299b9 remove mentions of ARMA_BLAS_LONG 2024-11-07 12:22:41 +10:00
conrad b744b74533 ensure consistency with documentation 2024-11-07 12:17:54 +10:00
conrad f22d60c74f qualify lapack function names in comment 2024-11-07 12:14:32 +10:00
conrad 44e1beabce update list of changes 2024-11-06 17:24:52 +10:00
conrad f003381651 minor cleanup 2024-11-06 17:24:29 +10:00
conrad 538ae305bf optimisation when all eigenvalues are positive 2024-11-06 17:15:41 +10:00
conrad d00fc06c06 fix 2024-11-06 13:23:30 +10:00
conrad 8650784ac7 detect sym matrices instead of sympd 2024-11-06 12:34:03 +10:00
conrad f0acfbbf63 update debug messages 2024-11-06 12:20:18 +10:00
conrad da8ea7ea20 add note 2024-11-05 18:53:25 +10:00
conrad d484a3d7ad check diagonal for nonfinite values 2024-11-05 16:39:45 +10:00
conrad 978d7d6e76 rearrange 2024-11-04 12:51:43 +10:00
conrad 65eefbfce6 formally deprecate undocumented forms of .min() and .max() 2024-11-03 15:33:19 +10:00
conrad 6e469f1d38 cleanup 2024-11-01 11:46:04 +10:00
conrad 3280fd41ae ensure rcond results are consistent with rcond version of inv() 2024-11-01 11:43:50 +10:00
conrad 97f85611c1 stronger checks for diagonal elements of hermitian matrices 2024-11-01 11:11:19 +10:00
conrad 7b38cfca6e add sanity checks 2024-10-31 16:09:34 +10:00
conrad 30122e7adf simplification 2024-10-31 16:00:43 +10:00
conrad 0481314430 update docs 2024-10-31 13:44:00 +10:00
conrad ef7fec1385 deprecate ARMA_CRIPPLED_LAPACK option 2024-10-31 13:34:51 +10:00
conrad 42623aff06 minor cleanups 2024-10-31 13:21:39 +10:00
conrad 3165f618ed remove unused code 2024-10-31 13:13:34 +10:00
conrad 93a652c50c simplifications 2024-10-31 13:06:52 +10:00
conrad f506e86466 detect hermitian matrices 2024-10-31 11:02:51 +10:00
conrad c7053e8c23 redirect in case of crippled lapack 2024-10-31 10:27:37 +10:00
conrad 95a8229587 more workarounds 2024-10-31 10:14:48 +10:00
conrad 4b3fdadd7f workarounds for crippled implementations of lapack 2024-10-31 10:06:24 +10:00
conrad 7ce8e17e99 simplifications 2024-10-30 16:15:51 +10:00
conrad 25d5285cbd prevent compiler warnings 2024-10-30 15:59:49 +10:00
conrad 53806daa3f replace hard coded constant 2024-10-30 15:58:59 +10:00
conrad bcca9da94d add wrappers 2024-10-30 15:39:21 +10:00
conrad 6da76d1019 update docs 2024-10-30 13:36:36 +10:00
conrad cb73277ec7 add threshold due to inconsistent speedups on OpenBLAS 0.3.26 2024-10-30 13:23:26 +10:00
conrad 6d15ecca58 fix layout 2024-10-30 12:51:47 +10:00
conrad e701de5738 replace rcond_sympd with rcond_sym 2024-10-29 15:49:18 +10:00
conrad b4e2b8de7c more debug statements 2024-10-29 15:30:28 +10:00
conrad b0ff7506b0 update docs 2024-10-29 15:10:16 +10:00
conrad 1bf38c114d fix 2024-10-29 10:34:44 +10:00
conrad 96e98edec9 inv rcond optimisation for sym matrices 2024-10-29 00:10:14 +10:00
conrad 6e838ef11c defintions for sycon and hecon 2024-10-28 16:00:02 +10:00
conrad 55059a4e30 refactor inv_sym() to handle complex hermitian matrices 2024-10-28 15:44:25 +10:00
conrad 98c7800566 add TODOs 2024-10-28 15:12:48 +10:00
conrad 0e5978f981 partial rework of inv() to optimise for symmetric matrices 2024-10-28 14:23:24 +10:00
conrad b52dae4657 mark as unstable 2024-10-14 14:07:18 +10:00
conrad 1b037556da simpler wording 2024-10-05 19:08:45 +10:00
conrad 6a1c5d7ff3 remove handling of rare expressions 2024-10-05 18:59:22 +10:00
conrad ce4d54c82b bump min compiler version 2024-10-05 16:54:40 +10:00
conrad bca1545ae3 deprecate support for gcc < 8.1 2024-10-05 16:48:37 +10:00
conrad b908470f3b change http to https 2024-10-04 11:44:27 +10:00
conrad 7c75e9e594 deprecate ill-designed forms of pow() 2024-10-03 13:57:48 +10:00
conrad 55c30cbc73 restore doc for previous option 2024-10-03 13:15:41 +10:00
conrad d56115ef45 simplifications 2024-10-03 11:35:02 +10:00
conrad c7f1711d6c restore original implementation; subview_each et al are not derived from Base 2024-10-03 11:12:17 +10:00
conrad e280d25c9a add explanatory notes 2024-10-03 11:03:52 +10:00
conrad 27f4297396 more refactoring 2024-10-03 10:56:14 +10:00
conrad 5eabafe2b3 partial rewrite of powext 2024-10-02 14:46:00 +10:00
conrad ed1ec45817 remove deprecated forms 2024-10-02 13:14:41 +10:00
conrad 901c5c3d0c add notes 2024-10-02 13:10:02 +10:00
conrad 19292dff3a rearrange deprecated forms 2024-10-02 12:59:34 +10:00
conrad 53f8e0664f deprecate seldom used forms of pow() 2024-10-02 12:47:46 +10:00
conrad d66e799b5c simplification: remove docs for seldom used forms of pow() 2024-10-02 12:43:12 +10:00
conrad 053d5a5787 stats_fns: clarify caveat and add example for integer vector 2024-09-25 11:07:26 +10:00
conrad cb3203f130 add ARMA_BLAS_64BIT_INT config option 2024-09-04 15:12:07 +10:00
conrad 44411aadee explicitly deprecate old log_add_exp() 2024-09-04 12:36:46 +10:00
conrad c953e836e7 clarify that 'long long' is 64 bit integer 2024-08-21 20:31:10 +10:00
conrad 40d2d9fb9c patch bump 2024-08-06 13:06:20 +10:00
conrad e529e8fadb ensure format is consistent 2024-08-02 13:04:55 +10:00
conrad cdf9a0519d fix links 2024-08-01 13:20:38 +10:00
conrad acdc6b8670 fix layout 2024-08-01 12:32:32 +10:00
conrad 251f964c1b check for presence of ARMA_USE_STD_MUTEX instead of absence of ARMA_DONT_USE_STD_MUTEX 2024-07-31 11:52:50 +10:00
conrad 9937cdafd5 prefer __builtin_assume_aligned() over std::assume_aligned() to reduce risk 2024-07-31 11:44:49 +10:00
conrad e31354d8da use std::assume_aligned() if available 2024-07-31 11:39:51 +10:00
conrad 6279cb3774 more details for TODO 2024-07-31 11:28:14 +10:00
conrad fa72e7e3e0 remove seldom used optimisation to increase maintainability 2024-07-24 12:26:56 +10:00
conrad f72efd7c61 more graceful handling of unsupported data types 2024-07-20 17:16:45 +10:00
conrad 3d4daafeb8 better wording 2024-07-20 16:53:09 +10:00
conrad a99ef05d41 patch bump 2024-07-07 23:01:27 +10:00
conrad a7d906019a comment out docs for disabling run-time checks 2024-07-01 11:16:35 +10:00
conrad f3fe8d04c7 ensure consistent markers in quasi_unwrap and Proxy 2024-06-30 14:29:21 +10:00
conrad 508ebe3deb avoid unwrapping delayed expressions potentially captured by the Proxy 2024-06-30 14:26:40 +10:00
conrad 6e6657e2f0 skip aliasing checks where not necessary 2024-06-30 13:05:02 +10:00
conrad 935a500e75 simplify debug messages 2024-06-27 13:20:51 +10:00
conrad 64a125b35b remove warning about long-removed option 2024-06-27 11:52:28 +10:00
conrad 6754eadb00 minor comment fix 2024-06-26 14:14:29 +10:00
conrad 4a93a1a5d2 version bump 2024-06-25 14:24:38 +10:00
conrad cc2a33560f simpler wording 2024-06-25 13:26:55 +10:00
conrad 708897f906 better wording 2024-06-25 13:16:21 +10:00
conrad 5dfa91793f simplify wording 2024-06-25 13:08:03 +10:00
conrad f20d1bf7fe fix 2024-06-24 23:10:25 +10:00
conrad e0a6e50981 fix 2024-06-24 23:09:12 +10:00
conrad 11b009ccdc emit warning if conformance checks are disabled 2024-06-24 12:11:27 +10:00
conrad d4ac8e535e catch size errors early 2024-06-24 00:18:10 +10:00
conrad 982e8b12ae more debug statements 2024-06-23 13:23:47 +10:00
conradsnicta 558c04cfd6 Merge branch 'more_spop_rel_tests' into '14.0.x'
Add some tests for accu() optimisation for sparse relational operations

See merge request conradsnicta/armadillo-code!138
2024-06-22 03:30:32 +00:00
Ryan Curtin c693c5f020 Add some tests for accu() optimisation for sparse relational operations 2024-06-22 03:30:32 +00:00
conrad a7ae8eed4a minor wording fix 2024-06-22 13:16:51 +10:00
conrad 5f74ef8e5d mark as RC1 2024-06-22 12:47:35 +10:00
conrad 7c732dc236 remove dev markers 2024-06-22 12:45:29 +10:00
conrad b84b7aa997 add caveat 2024-06-21 20:34:17 +10:00
conrad 1780c70a98 add internal link 2024-06-21 20:29:18 +10:00
conrad 02aab8d3c3 fix 2024-06-21 20:29:03 +10:00
conrad 744f33aab2 update list of changes 2024-06-21 15:04:43 +10:00
conrad c51b6ce8ba remove setting warning level 2024-06-21 14:40:05 +10:00
conrad e0bf67a29f clarifications 2024-06-21 14:39:22 +10:00
conrad b176edcc1b adapt Ryan's approach 2024-06-21 14:31:45 +10:00
conrad 09b350febc simplifications 2024-06-21 11:58:18 +10:00
conrad 4541b44fab another workaround for negative unsigned integers 2024-06-21 11:41:49 +10:00
conrad 17132590fc disable more warnings 2024-06-21 11:34:17 +10:00
conrad 11740aead0 prevent zeros 2024-06-21 01:44:45 +10:00
conrad f2a82196d4 fix 2024-06-20 23:20:15 +10:00
conrad 2854685624 workarounds for handling negatives of unsigned integers 2024-06-20 23:18:32 +10:00
conrad 401c06184e fix 2024-06-20 20:07:19 +10:00
conrad d7064ebacf optimisations 2024-06-20 19:44:08 +10:00
conrad 580758af9d add TODOs 2024-06-20 17:05:43 +10:00
conrad 441d0e503b rename variables for consistency across functions 2024-06-20 16:54:12 +10:00
conrad 5015fb007b handle all conditions in one function 2024-06-20 16:40:00 +10:00
conrad 81b339e987 specialisations for relational comparisons 2024-06-20 15:01:16 +10:00
conrad 6b6a820a49 set warning level to 1 2024-06-20 12:09:20 +10:00
conrad a865abfe6a disentangle direct link between conformance checks and emission of warnings 2024-06-20 12:01:51 +10:00
conrad 80797be245 tests for direct sparse relational operations 2024-06-20 10:51:56 +10:00
conrad 3259865a42 expand accu() to handle sparse relational operations 2024-06-20 10:19:44 +10:00
conrad 5edd9e07ec skip alias checks if element types differ 2024-06-19 12:44:03 +10:00
conrad d37c42e046 skip alias checks if element types differ 2024-06-19 12:21:34 +10:00
conrad d8dceed843 simplify list 2024-06-19 01:14:38 +10:00
conrad 0606be415c update precompiled OpenBLAS 2024-06-18 14:35:21 +10:00
conrad f5b004028a increase accuracy 2024-06-17 20:18:04 +10:00
conrad 76d9aaea28 simplify language 2024-06-17 20:11:38 +10:00
conrad 4257990df9 faster sprandu() and sprandn() 2024-06-17 11:10:03 +10:00
conrad a48c256233 add .as_dense() 2024-06-16 19:45:56 +10:00
conrad 044977f0a1 add internal link 2024-06-16 19:41:20 +10:00
conrad c32a3b915e cleanup 2024-06-16 19:07:00 +10:00
conrad 419cc25c17 update list of changes 2024-06-16 19:03:15 +10:00
conrad 118ae2140f add docs for .as_dense() 2024-06-16 18:54:19 +10:00
conrad 4b72ceda11 add .as_dense() 2024-06-16 18:20:21 +10:00
conrad caa5012e25 expand compiler flags 2024-06-15 19:24:44 +10:00
conrad f37a509c14 update list of changes 2024-06-15 19:16:05 +10:00
conrad 8dafcf8d30 faster handling of sparse submatrix views 2024-06-15 19:05:39 +10:00
conrad d4e25ce9cf simplify handling to SpToDOp and mtSpReduceOp 2024-06-15 18:46:05 +10:00
conrad 9ee144d98d add explanatory notes 2024-06-15 17:26:44 +10:00
conrad e6b9babc12 mark sparse conversion constructor as explicit 2024-06-15 00:44:58 +10:00
conrad 2ddbf3653c mark dense to sparse conversion as explicit 2024-06-15 00:17:19 +10:00
conrad fb9994ce6f rename mtSpReductionOp to mtSpReduceOp 2024-06-15 00:14:48 +10:00
conrad 840795fc47 rework sparse reduction operations 2024-06-14 23:58:39 +10:00
conrad b5824c72e3 add SpReductionOp and mtSpReductionOp frameworks 2024-06-14 14:37:00 +10:00
conrad 39a8ff7c31 cleanup 2024-06-14 11:21:54 +10:00
conrad 031e790ec3 restore previous pre-alloc size 2024-06-14 10:05:49 +10:00
conrad 054506ac91 simplifications 2024-06-14 01:51:51 +10:00
conrad 50c8b16a6c restore explicit marker 2024-06-13 22:39:39 +10:00
conrad 554c499ce0 minor cleanup 2024-06-13 22:39:19 +10:00
conrad 9aa59809f0 use error message functions 2024-06-13 22:28:01 +10:00
conrad f66226695b further support for arma_noinline 2024-06-13 22:01:47 +10:00
conrad c9cc6e5554 rework op_nonzeros_spmat into op_sp_nonzeros 2024-06-13 18:46:38 +10:00
conrad 181a6af544 more details in deprecation messages 2024-06-13 16:23:05 +10:00
conrad de118814c3 rework detection of expressions that can implicitly converted from dense to sparse 2024-06-13 15:46:42 +10:00
conrad 1aa720e759 detect transpose operations of originally sparse expressions 2024-06-13 14:20:14 +10:00
conrad f0eaff90e9 more workarounds 2024-06-13 13:56:53 +10:00
conrad 21b905e643 add explanatory note 2024-06-13 13:41:07 +10:00
conrad 791fe513c9 restrict automatic conversions from dense to sparse 2024-06-13 12:45:54 +10:00
conrad 3d82983dba restrict automatic conversions from dense to sparse 2024-06-13 12:21:10 +10:00
conrad 6ee89edb8c more informative error messages 2024-06-12 20:21:34 +10:00
conrad a7823175a2 fix 2024-06-12 20:18:04 +10:00
conrad 5caefce03d more informative error messages 2024-06-12 19:16:41 +10:00
conrad a99f363d69 decrease default size of buffer 2024-06-12 18:04:07 +10:00
conrad 627794a311 use shorter form 2024-06-12 15:45:04 +10:00
conrad 66135eef6b fix 2024-06-12 13:42:14 +10:00
conrad 03d351a858 simplifications 2024-06-12 13:37:45 +10:00
conrad 607a68a0b4 clarifications 2024-06-12 13:32:41 +10:00
conrad 36ab0da6b1 various fixes 2024-06-12 12:58:42 +10:00
conrad cf880d4fff add HEADER_ONLY option 2024-06-12 12:54:03 +10:00
conrad 057039611e move C+11 deprecation warning 2024-06-12 00:51:18 +10:00
conrad 530542b112 restore support for C++11 in deprecated form 2024-06-12 00:38:22 +10:00
conrad 4643ddfff8 rename op_dot::apply_proxy() to op_dot::apply_proxy_linear() 2024-06-11 12:26:10 +10:00
conrad f54cc6d0bb clarifications 2024-06-11 12:17:11 +10:00
conrad 414793c796 subview optimisations for dot products 2024-06-11 12:13:32 +10:00
conrad f0c1211b68 add debug messages 2024-06-10 23:54:00 +10:00
conrad fa0c5a5ce2 add notes 2024-06-10 20:03:51 +10:00
conrad 8f5e35d9e4 add note 2024-06-10 19:51:41 +10:00
conrad 4a4807e4ee fix 2024-06-10 19:48:55 +10:00
conrad 03eb6e6ece fix 2024-06-10 19:47:56 +10:00
conrad f66d795010 update version 2024-06-10 17:08:40 +10:00
conrad f01dae8534 include Alma and Rocky 2024-06-10 17:06:31 +10:00
conrad 0cc9f762d3 allow implicit conversion of dense expressions to avoid breaking user code 2024-06-10 14:39:58 +10:00
conrad 52ccb38b6c simplifications 2024-06-10 14:35:46 +10:00
conrad 23c49e6008 make sure element types match 2024-06-10 14:33:37 +10:00
conrad f4f8f0c28f allow implicit conversion of spdiagview for consistency with sparse version of diagvec() 2024-06-10 14:25:38 +10:00
conrad 54314571c4 update list of changes 2024-06-10 01:03:37 +10:00
conrad b416244930 2022 CODATA adjustment for physical constants 2024-06-10 00:59:02 +10:00
conrad 3928bee750 use 'constexpr bool' where possible 2024-06-10 00:27:15 +10:00
conrad 17d96107e3 fix layout 2024-06-09 23:39:11 +10:00
conrad e014995291 bump min version for intel compiler 2024-06-09 18:06:31 +10:00
conrad e03265b706 remove superfluous redefinitions 2024-06-09 17:50:07 +10:00
conrad 940594bfe7 verify liwork and lrwork via query 2024-06-09 01:58:43 +10:00
conrad bcf4400e27 re-allow ignoring deprecation messages 2024-06-08 23:34:28 +10:00
conrad 4f62a5ddf8 minor cleanup 2024-06-08 18:53:25 +10:00
conrad 66515d3ec9 fix 2024-06-08 18:24:59 +10:00
conrad 365c332120 remove shadow typedef 2024-06-08 17:48:46 +10:00
conrad facf580a9c add tests for sparse stddev() 2024-06-08 17:43:34 +10:00
conrad b0ca8599f8 update list of changes 2024-06-08 17:38:25 +10:00
conrad f7e522a83b speedup 2024-06-08 17:30:11 +10:00
conrad 8d6818e40a faster handling of sparse submatrix views 2024-06-08 17:26:34 +10:00
conrad 19b7ff026f allow op_diagmat to have implicit conversion 2024-06-08 17:15:50 +10:00
conrad bd56f524b2 convert sparse diagvec to use SpToDOp framework 2024-06-08 16:57:40 +10:00
conrad 5cbd10b9e3 register mtSpToDOp as dense arma type 2024-06-08 16:55:56 +10:00
conrad 19f8a401e8 generate set of random numbers in one hit 2024-06-08 16:46:06 +10:00
conrad 478809ca0d simplifications 2024-06-08 16:26:55 +10:00
conrad 0a671235ed simplifications 2024-06-07 23:18:12 +10:00
conrad 1393134914 specialisation for inplace transpose of vectors 2024-06-07 23:11:19 +10:00
conrad 7c8c10ea20 rework sparse vecnorm() to use mtSpToDOp 2024-06-07 23:02:38 +10:00
conrad aa28f54c0b fix 2024-06-07 15:46:33 +10:00
conrad 762e98c2cc check for zero length vectors 2024-06-07 15:44:56 +10:00
conrad 98bfa65de7 fix layout 2024-06-07 15:30:37 +10:00
conrad 81e760e0eb check for zero length vectors 2024-06-07 15:29:01 +10:00
conrad 140e07bd77 add TODOs 2024-06-07 14:53:08 +10:00
conrad bc57da6679 simplifications 2024-06-07 14:13:15 +10:00
conrad 0138c02fb7 simplifications 2024-06-07 14:05:45 +10:00
conrad 5ca8f67990 rework sparse mean() to use SpToDOp 2024-06-07 13:40:33 +10:00
conrad 72d7892432 update list of changes 2024-06-07 01:23:57 +10:00
conrad 8b8a56104d add sparse stddev() 2024-06-07 01:18:37 +10:00
conrad 30b45e8c2e refactor sparse var() to use mtSpToDOp framework 2024-06-07 00:43:24 +10:00
conrad 5260835556 cleanup 2024-06-06 23:23:27 +10:00
conrad cc61283eb6 rearrange 2024-06-06 23:11:16 +10:00
conrad 35d70bd7c9 cleanup 2024-06-06 22:50:21 +10:00
conrad 8b3f33287a update docs for config options 2024-06-05 12:22:31 +10:00
conrad 4d26e7f4dd update list of changes 2024-06-05 12:15:37 +10:00
conrad 909a3a3ac1 move targeted optimisations to front 2024-06-05 12:01:44 +10:00
conrad bca546a381 simplification 2024-06-05 01:18:35 +10:00
conrad 7a078fcf8c dot product optimisation 2024-06-05 00:47:16 +10:00
conrad da52eb154b further speedups 2024-06-05 00:26:54 +10:00
conrad 03fd9d04c3 simplifications 2024-06-05 00:25:20 +10:00
conrad 8ad6cc595d handle more expressions 2024-06-04 18:37:37 +10:00
conrad a454237c13 remove no longer needed trait 2024-06-04 16:29:06 +10:00
conrad 89277f2deb better handling of compound expressions 2024-06-04 16:28:32 +10:00
conrad 880267f348 handle expressions with scalar mul 2024-06-04 15:00:36 +10:00
conrad 0e7f1c5089 explicit handling of dot product expressed as matrix multiplication 2024-06-04 13:14:11 +10:00
conrad fd780c7a82 add tests for SpSubview n_nonzero 2024-05-30 12:02:03 +10:00
conrad 5f12dfb83d sync to handle corner cases 2024-05-29 13:09:12 +10:00
conrad e9a14aea9a fix 2024-05-29 13:01:37 +10:00
conrad 6b47d564d1 speedup via specialisation 2024-05-29 12:59:17 +10:00
conrad 2d60476b55 start new block for list of changes 2024-05-28 14:21:17 +10:00
conrad ad6ce0e46f extend speedup to general submatrices that span all rows 2024-05-27 11:25:42 +10:00
conrad 499cf72d6a cleanup 2024-05-23 19:23:29 +10:00
conrad b12eefdae8 faster handling of sparse matrix views with one column 2024-05-22 14:49:53 +10:00
conrad b955116e1f simplify warning 2024-05-21 14:40:45 +10:00
conrad 67ea132b50 use 'constexpr bool' where possible 2024-05-21 14:37:31 +10:00
conrad f97f3edcb3 fix 2024-05-13 12:11:22 +10:00
conrad a91f7a77fe beef up warning 2024-05-08 13:45:28 +10:00
conradsnicta f88801c619 Merge branch 'test-resiliency' into '14.0.x'
Allow specifying random seed for tests, and fix often-failing tests

See merge request conradsnicta/armadillo-code!134
2024-05-06 23:56:01 +00:00
Ryan Curtin afa23649f8 Allow specifying random seed for tests, and fix often-failing tests 2024-05-06 23:56:01 +00:00
conrad 2e1a9d70da simplification 2024-05-06 22:23:49 +10:00
conrad 20a9302ff3 add explanatory note 2024-05-05 15:28:37 +10:00
conrad dbcbc65a00 change !ARMA_DONT_USE_STD_MUTEX to ARMA_USE_STD_MUTEX 2024-05-03 14:42:42 +10:00
conrad 2ee2b572ba fix 2024-05-03 14:21:25 +10:00
conrad 653996b1c2 add mutex around generating FFTW3 plans 2024-05-03 13:57:21 +10:00
conrad 176da337a0 extend debug monitor with state of check_conformance 2024-04-28 15:57:24 +10:00
conrad 485d16e9a3 forward superseded function to new function 2024-04-28 15:47:20 +10:00
conrad 5c63044568 rework declaration of superseded function 2024-04-28 15:17:54 +10:00
conrad 60c63be02a add old macros for compatibility with earlier versions of armadillo 2024-04-26 23:31:31 +10:00
conrad e8b08f83e8 reorder processing to ensure consistency 2024-04-26 13:01:34 +10:00
conrad a4bdfd034b more compact debug messages 2024-04-26 12:57:33 +10:00
conrad 95adb74219 rename debugging macros and functions 2024-04-26 12:28:42 +10:00
conrad 60915d66dc rework ARMA_NO_DEBUG to ARMA_DONT_CHECK_CONFORMANCE 2024-04-26 12:03:05 +10:00
conrad 8675f3868a remove ARMA_DONT_ZERO_INIT option 2024-04-25 12:39:11 +10:00
conrad 14650daa03 better layout of debug messages 2024-04-25 11:56:42 +10:00
conrad b57929cefb emit warning to use as_scalar() for conversion to scalars 2024-04-13 12:36:50 +10:00
conrad 51a8ba3e09 rework min(sp_mat) and max(sp_mat) to produce dense vectors by default 2024-04-09 13:53:38 +10:00
conrad 44e1a04bab restore doc markers 2024-04-09 13:42:11 +10:00
conrad 87c2b2d870 rework sum(sp_mat) to produce dense vectors by default 2024-04-09 13:37:13 +10:00
conrad ba443e4bdc bump to C++14 standard 2024-04-09 11:56:04 +10:00
conrad 78836248b4 mark as unstable 2024-04-09 11:39:00 +10:00
conrad bfc736cbb2 patch bump 2024-04-03 13:06:43 +10:00
conrad e0551c4aa1 minor cleanup 2024-04-03 13:03:19 +10:00
conrad 02a706c60b workaround for fftw3 header clash 2024-04-02 13:05:00 +10:00
conrad 5e57e49667 upstream workaround for issue under macOS 2024-03-23 16:18:14 +10:00
conrad cfbc227f30 simplification 2024-03-18 19:10:57 +10:00
conrad 2556f64d9b add caveat 2024-03-18 12:43:59 +10:00
conrad 4d6a92ed65 simplifications 2024-03-18 12:27:17 +10:00
conrad 140adf0cb4 mention link between chol() and inv_sympd() 2024-03-18 12:21:12 +10:00
conrad 918759c610 simplifications 2024-03-14 13:22:01 +10:00
conrad 9cd668413d warmup for more accurate time measurement 2024-03-08 15:38:09 +10:00
conrad 8b59d1e22d simplify init loop 2024-03-06 20:43:50 +10:00
conrad 7b2f7cbad8 rearrange 2024-03-04 13:30:18 +10:00
conrad cf2b051b54 simplify wording 2024-03-04 13:29:32 +10:00
conrad f709a17fd3 patch bump 2024-03-01 15:12:33 +10:00
conrad 38682265fc revert 2024-02-27 10:14:23 +10:00
conrad 88f1a75146 explicitly cast return type 2024-02-26 23:15:18 +10:00
conrad ca8da8bdab clear output arrays before use 2024-02-26 23:11:39 +10:00
conrad 54c62da09b move checks 2024-02-26 22:19:06 +10:00
conrad ba6a007ff1 ensure norm is >= 0 2024-02-26 16:07:33 +10:00
conrad 2bff19fb56 add note on how complex random numbers are generated 2024-02-26 15:54:13 +10:00
conrad 2454e055fe workaround possible BLAS bug under macOS 2024-02-26 15:12:18 +10:00
conrad 13dded6a6d rudimentary sanity checks 2024-02-26 13:43:24 +10:00
conrad 45316d0249 don't use wrapper functions on primitive platforms 2024-02-26 12:19:12 +10:00
conrad 611d0e8c24 version bump 2024-02-07 00:25:32 +10:00
conrad 885324d6a2 further cleanup 2024-02-07 00:06:07 +10:00
conrad d84f3cdf77 cleanup 2024-02-06 17:04:41 +10:00
conrad 43498a5c72 remove doxygen config 2024-02-06 15:04:28 +10:00
conrad 7b0adcf517 cleanup 2024-02-06 15:01:56 +10:00
conrad b61e026dd4 update year 2024-02-06 13:26:03 +10:00
conrad 0006014c9e more tests for conv_to 2024-02-06 11:42:44 +10:00
conrad 74c2d461c6 update ref for sparse matrix paper 2024-02-06 11:41:26 +10:00
conrad eef2a2706c minor optimisation 2024-02-06 11:35:20 +10:00
conrad 9680a3b1d4 update list of changes 2024-02-06 11:34:26 +10:00
conrad 83e6264e81 faster detection of sym expressions 2024-02-06 11:32:34 +10:00
conrad 963a262aea update list of changes 2024-02-06 11:30:30 +10:00
conrad a2e5ba7dfe more compact representation of integers 2024-02-06 11:30:11 +10:00
conrad ca7f21d837 update list of changes 2024-02-06 11:23:49 +10:00
conrad 3ba9389fac add sparse shift() 2024-02-06 11:21:46 +10:00
conrad f652f45584 docs for cbrt() 2024-02-06 11:17:27 +10:00
conrad a527b6d066 add cbrt() 2024-02-06 11:15:32 +10:00
conrad 551f262824 start new block for changes 2024-02-06 11:08:53 +10:00
conrad 53875af0c4 more flexible conversions between SpMat and Mat 2024-02-06 11:05:34 +10:00
conrad a93f6e8116 mark as unstable 2024-02-06 10:40:56 +10:00
conrad 663d9cc36e unsure consistency with op_pinv 2024-02-05 11:19:43 +10:00
conrad 461db5a1ea rearrange 2024-02-05 10:50:59 +10:00
conrad efcd328e19 detect c++23 2024-02-02 13:52:19 +10:00
conrad 614f2a9c68 rework docs for kmeans, gmm_diag, gmm_full 2024-01-29 15:17:42 +10:00
conrad ef4736878b patch bump 2023-12-18 23:38:55 +10:00
conrad 7c61b1cef1 faster handling of 0 valued tokens 2023-12-18 15:19:07 +10:00
conrad 9b632bc3c2 fix wording 2023-12-09 14:38:03 +10:00
conrad 8b9e754277 cleanups 2023-12-09 14:37:46 +10:00
conrad 2178fe261c explicitly write zeros to increase compatibility 2023-12-05 13:35:51 +10:00
conrad addfc9f74d Fix misspelling (same as !131) 2023-11-29 12:23:27 +10:00
conrad 7a76074adb replace 2π with τ 2023-11-12 17:57:02 +10:00
conrad 882880e242 patch bump 2023-10-31 16:19:58 +10:00
conrad 2cbda35457 use deterministic starting point for eigs_sym() and eigs_gen() in ARPACK mode 2023-10-24 14:27:01 +10:00
conrad e7072ce2fb add TODOs 2023-10-23 13:13:40 +10:00
conrad c17ba7750c patch bump 2023-10-14 14:43:28 +10:00
conrad 5a5e902709 more precise wording 2023-10-12 17:10:56 +10:00
conrad b6e810f2d3 invalidate cache instead of checking sync state 2023-10-10 13:47:07 +10:00
conrad 761dbbf8d5 ensure sparse matrix arrays are valid 2023-10-10 13:25:29 +10:00
conrad fd375c3b7d minor optimisation 2023-10-06 13:53:16 +10:00
conrad 1ec8ff7464 minor optimisation 2023-10-06 13:19:22 +10:00
conrad a6e1189470 minor optimisation 2023-10-05 14:41:40 +10:00
conrad 2ce71407f5 better wording 2023-10-01 19:10:07 +10:00
conrad 886b2750ce more details 2023-09-29 13:31:28 +10:00
conrad 24c9c0defd refactor docs for .diag(), diagvec(), diagmat() 2023-09-29 13:26:22 +10:00
conrad 5862589c94 refactor docs for .each_col(), each_row(), .each_slice() 2023-09-29 13:00:45 +10:00
conrad c56fe40ac8 fix wording 2023-09-28 14:10:01 +10:00
conrad 6aa346b59a add caveats to differentiate between wishrnd() and iwishrnd() 2023-09-27 12:56:31 +10:00
conrad 91884dbdbd expand blurb 2023-09-13 15:25:51 +10:00
conrad f82a749b4b more descriptive wording 2023-09-08 13:49:17 +10:00
conrad 9c71a7a46a update blurbs 2023-09-07 12:45:57 +10:00
conrad b4b2ec816f patch bump 2023-09-06 16:06:47 +10:00
conrad 04c1988dc2 simplifications 2023-09-06 16:05:43 +10:00
conrad 9c512d59b0 comment out no longer used variable 2023-09-06 15:08:41 +10:00
conrad 4807346e76 workaround for lapack::langb() and lapack::gbtrf() using incompatible storage formats 2023-09-06 14:40:20 +10:00
conrad 5282ab98d1 improved wording 2023-09-06 12:10:35 +10:00
conrad 8babcd5a2b improve docs for .brief_print() 2023-09-05 23:17:17 +10:00
conrad 9cda7ea2d6 rearrange to reduce delta 2023-09-05 13:48:15 +10:00
conrad ee84563034 add inv_opts::fast option for forward compatibility 2023-09-05 13:29:12 +10:00
conrad 4373c99517 remove expensive optimisations 2023-09-05 12:54:14 +10:00
conrad 3c30c6a155 workarounds for bugs in apple accelerate framework 2023-09-05 12:33:57 +10:00
conrad 752e5817f0 patch bump 2023-08-28 13:55:53 +10:00
conrad a8d7628cbe use binary mode by default for handling text and CSV files 2023-08-28 13:38:43 +10:00
conrad c2e9009ea4 emit compile-time warning for unused element access 2023-08-25 16:26:13 +10:00
conrad 63cc0eb854 fix 2023-08-25 16:05:09 +10:00
conrad 6f41964887 more compact wording 2023-08-25 10:05:31 +10:00
conrad cf869ce067 emit compile-time warning for unused results 2023-08-24 23:50:23 +10:00
conrad b5bfd4b1ae simplification 2023-08-14 12:39:29 +10:00
conrad b0deff09d4 better wording 2023-08-11 11:49:25 +10:00
conrad e8b8d28b82 simplification 2023-08-11 11:28:39 +10:00
conrad ab9d61b20c more precise version check for gcc 2023-08-11 01:27:36 +10:00
conrad 0263404474 patch bump 2023-08-08 11:01:26 +10:00
conrad a44e7fddc5 fixes 2023-08-07 22:59:37 +10:00
conrad 22e5e903aa add docs for arma_rng 2023-08-07 10:08:03 +10:00
conrad 91dbb8c2ea rework arna_rng to use thread-safe mersenne twister as default; ensure unique seeds for each thread 2023-08-07 10:07:46 +10:00
conrad d99781e74b reduce bloat 2023-07-31 11:32:25 +10:00
conrad 204eac2382 better wording 2023-07-28 12:32:21 +10:00
conrad 046b168abb update list of changes 2023-07-28 11:43:45 +10:00
conrad 32b218ce31 add note 2023-07-28 11:31:12 +10:00
conrad d36d447130 fix link 2023-07-28 11:28:56 +10:00
conrad c5bb97c7f0 fix link 2023-07-28 11:17:57 +10:00
conrad 5d0633e214 better wording 2023-07-28 11:04:54 +10:00
conrad 6cada35124 mention limitation of integer element types 2023-07-27 21:58:24 +10:00
conrad 6dd578e293 clarifications 2023-07-27 21:48:38 +10:00
conrad a27560bb8f add linebreak 2023-07-25 19:18:48 +10:00
conrad 344e69abf4 patch bump 2023-07-25 19:17:11 +10:00
conrad f602343234 fix layout 2023-07-25 19:14:09 +10:00
conrad e7df419244 refactor to use specialised functions for dot products 2023-07-25 19:11:18 +10:00
conrad 504503d012 fix: ensure output memory is cleared 2023-07-25 12:15:36 +10:00
conrad 50f7e06903 add notes 2023-07-25 10:02:01 +10:00
conrad ccce514377 rearrange 2023-07-24 14:04:50 +10:00
conrad fd5df9e61d comment out (for now) matrix move constructors in vector classes 2023-07-23 23:04:54 +10:00
conrad 14fcd1dc73 move typedefs to avoid compiler warnings 2023-07-23 01:30:18 +10:00
conrad d05a247c7f version bump 2023-07-22 00:04:45 +10:00
conrad ee89179212 add debug statements 2023-07-21 19:55:53 +10:00
conrad d11d452a93 fix 2023-07-21 16:01:54 +10:00
conrad 5912c445e5 mark as 12.6-RC2 2023-07-21 15:52:39 +10:00
conrad 075bb095c0 fix 2023-07-21 15:51:24 +10:00
conrad 71587103d7 simplifications 2023-07-21 15:48:58 +10:00
conrad 102a354e0c fix for aliasing corner case 2023-07-21 01:12:55 +10:00
conrad e4c567542d mark as 12.6-RC1 2023-07-20 15:48:38 +10:00
conrad 06f8e59026 add link to bandicoot 2023-07-20 15:47:31 +10:00
conrad 114c9b4be8 update documentation 2023-07-20 15:45:56 +10:00
conrad e6dfff7108 allow chained calls to member functions 2023-07-20 15:44:27 +10:00
conrad 4391cb4b19 more compact layout 2023-07-20 15:36:42 +10:00
conrad cb4056ba1a speedup via openmp 2023-07-20 15:27:14 +10:00
conrad 76b8241161 directly generate single random value instead of going through a temporary vector 2023-07-20 15:22:35 +10:00
conrad 523e55bbdc overload vector move constructors to accept Mat inputs 2023-07-20 15:20:13 +10:00
conrad b66232ee28 add diags() and spdiags() 2023-07-20 15:16:11 +10:00
conrad f8f4c82e1f speedup by transpose based multiplication 2023-07-20 15:10:21 +10:00
conrad 20db1e4eea speedup by transpose based multiplication 2023-07-20 15:06:58 +10:00
conrad 125858f7f2 minor optimisation: call SpMat::mem_resize() only if necessary 2023-07-20 15:02:04 +10:00
conrad faa23558cd move 'sparse * dense' and 'dense * sparse' to use SpToDGlue; speedups for multiplication by vectors 2023-07-20 15:00:03 +10:00
conrad 80e22ec476 SpToDGlue handling 2023-07-20 14:46:09 +10:00
conrad 2d7652c5b8 add SpToDGlue for sparse glue operations that result in dense matrices 2023-07-20 14:44:18 +10:00
conrad 142f5585bf remove superfluous prototype 2023-07-20 14:34:48 +10:00
conrad 94a6ce3c8b fix comment 2023-07-20 14:33:08 +10:00
conrad 55f0fcb393 add debug statement 2023-07-20 14:32:15 +10:00
conrad 2bfe79c0fe change fast math warnings to critical level + allow manual disabling of fast math warnings 2023-07-20 14:30:21 +10:00
754 changed files with 32635 additions and 21220 deletions
+2 -2
View File
@@ -3,8 +3,8 @@
<br>
The list of changes is part of the documentation:
<ul>
<li><a href="http://arma.sourceforge.net/docs.html#changelog">docs.html#changelog</a> (online copy)</li>
<li><a href="docs.html#changelog">docs.html#changelog</a> (local copy)</li>
<li><a href="https://arma.sourceforge.net/docs.html#changelog">docs.html#changelog</a> &nbsp; (online copy)</li>
<li><a href="docs.html#changelog">docs.html#changelog</a> &nbsp; (local copy)</li>
</ul>
</body>
</html>
+154 -107
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,52 +16,68 @@
# ------------------------------------------------------------------------
## NOTE: If you prefer to link your programs _directly_ with OpenBLAS, BLAS or LAPACK,
## NOTE: do not use this installer.
## NOTE: To use Armadillo without installation, compile your programs along these lines:
## NOTE: g++ prog.cpp -o prog -O2 -I /home/user/armadillo-12.2.0/include -DARMA_DONT_USE_WRAPPER -lopenblas -llapack
## NOTE: The above command line assumes that you have unpacked the armadillo archive into /home/user/
## NOTE: You will need to adjust this for newer versions of Armadillo (ie. "12.2.0" needs to be changed),
## NOTE: and/or if you have unpacked the armadillo archive into a different directory.
## 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; 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: 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 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.
## NOTE: On macOS, replace -lblas -llapack with -framework Accelerate
## NOTE: More details: https://arma.sourceforge.net/faq.html
cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)
cmake_minimum_required(VERSION 3.10 FATAL_ERROR)
if(NOT (${CMAKE_MAJOR_VERSION} LESS 3))
if(POLICY CMP0025)
# enable differentiation between vanilla Clang and AppleClang
cmake_policy(SET CMP0025 NEW)
message(STATUS "*** set cmake policy CMP0025 to NEW")
endif()
if(POLICY CMP0025)
# enable differentiation between vanilla Clang and AppleClang
cmake_policy(SET CMP0025 NEW)
message(STATUS "*** set cmake policy CMP0025 to NEW")
endif()
if(NOT (CMAKE_VERSION VERSION_LESS "3.1"))
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
message(STATUS "CMAKE_CXX_STANDARD = ${CMAKE_CXX_STANDARD}")
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
message(STATUS "CMAKE_CXX_STANDARD = ${CMAKE_CXX_STANDARD}")
if(WIN32)
message(STATUS "")
message(STATUS "*** WARNING: installation via cmake is not supported on this platform.")
message(STATUS "*** WARNING: suggest to use manual installation instead;")
message(STATUS "*** WARNING: see README for details")
message(STATUS "")
endif()
project(armadillo CXX C)
include(CheckIncludeFileCXX)
include(CheckLibraryExists)
set(ARMA_USE_WRAPPER true)
# the settings below will be automatically configured by the rest of this script
set(ARMA_USE_LAPACK false)
set(ARMA_USE_BLAS false)
set(ARMA_USE_ATLAS false)
set(ARMA_USE_ARPACK false)
set(ARMA_USE_EXTERN_RNG false)
set(ARMA_USE_SUPERLU false) # Caveat: only SuperLU version 5.x can be used!
set(ARMA_USE_WRAPPER false)
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)
## extract version from sources
# extract version from sources
set(ARMA_VERSION_FILE_NAME "${PROJECT_SOURCE_DIR}/include/armadillo_bits/arma_version.hpp")
@@ -84,33 +100,20 @@ if(NOT CXX_FLAGS_EMPTY)
endif()
# NOTE: ARMA_USE_EXTERN_RNG requires compiler support for thread_local and C++11
# NOTE: for Linux, this is available with gcc 4.8.3 onwards
# NOTE: for macOS, thread_local is supoported in Xcode 8 (mid 2016 onwards) in C++11 mode
# NOTE: thread_local appears broken again on macOS 11 (Big Sur) and/or AppleClang 12.0
# NOTE: see comments in include/armadillo_bits/arma_rng.hpp
if(DEFINED CMAKE_CXX_COMPILER_ID AND DEFINED CMAKE_CXX_COMPILER_VERSION)
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
if(NOT (${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 4.8.3))
set(ARMA_USE_EXTERN_RNG true)
message(STATUS "Detected gcc 4.8.3 or newer")
if(${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 6.1.0)
message(STATUS "*** WARNING: support for gcc versions older than 6.1 is deprecated")
endif()
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++11")
message(STATUS "Added '-std=c++11' to compiler flags")
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")
message(FATAL_ERROR "Compiler too old; need at least gcc 8.1")
endif()
else()
if(NOT (${CMAKE_MAJOR_VERSION} LESS 3))
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
if(NOT ${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 6.0)
set(ARMA_USE_EXTERN_RNG true)
message(STATUS "Detected Clang 6.0 or newer")
if(NOT DEFINED CMAKE_CXX_STANDARD)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
@@ -121,7 +124,6 @@ if(DEFINED CMAKE_CXX_COMPILER_ID AND DEFINED CMAKE_CXX_COMPILER_VERSION)
endif()
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
if(NOT ${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 8.0)
set(ARMA_USE_EXTERN_RNG true)
message(STATUS "Detected AppleClang 8.0 or newer")
if(NOT DEFINED CMAKE_CXX_STANDARD)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
@@ -135,13 +137,6 @@ if(DEFINED CMAKE_CXX_COMPILER_ID AND DEFINED CMAKE_CXX_COMPILER_VERSION)
endif()
endif()
if(MINGW OR MSYS OR CYGWIN OR MSVC)
# MinGW doesn't correctly handle thread_local
set(ARMA_USE_EXTERN_RNG false)
endif()
message(STATUS "ARMA_USE_EXTERN_RNG = ${ARMA_USE_EXTERN_RNG}")
# As Red Hat Enterprise Linux (and related systems such as Fedora)
# does not search /usr/local/lib by default, we need to place the
@@ -149,7 +144,8 @@ message(STATUS "ARMA_USE_EXTERN_RNG = ${ARMA_USE_EXTERN_RNG}")
if(NOT APPLE)
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
message(STATUS "*** CMAKE_INSTALL_PREFIX was initalised by cmake to the default value of ${CMAKE_INSTALL_PREFIX}")
message(STATUS "")
message(STATUS "*** CMAKE_INSTALL_PREFIX was initialised by cmake to the default value of ${CMAKE_INSTALL_PREFIX}")
message(STATUS "*** CMAKE_INSTALL_PREFIX changed to /usr")
set(CMAKE_INSTALL_PREFIX "/usr" CACHE PATH "Standard install prefix" FORCE)
endif()
@@ -188,11 +184,18 @@ if(INSTALL_BIN_DIR)
endif()
option(HEADER_ONLY "Do not generate the wrapper library" OFF)
## Example use on the command line:
## cmake -D HEADER_ONLY=true .
if(MSVC)
option(BUILD_SHARED_LIBS "build shared library" OFF)
option(STATIC_LIB "Generate static library instead of shared library" ON)
else()
option(BUILD_SHARED_LIBS "build shared library" ON)
option(STATIC_LIB "Generate static library instead of shared library" OFF)
endif()
## Example use on the command line:
## cmake -D STATIC_LIB=true .
option(OPENBLAS_PROVIDES_LAPACK "Assume that OpenBLAS provides LAPACK functions" OFF)
## Example use on the command line:
@@ -223,30 +226,40 @@ option(BUILD_SMOKE_TEST "Build the smoke test" ON)
## ctest
if(WIN32)
message(STATUS "")
message(STATUS "*** WARNING: automatic installation is experimental for this platform.")
message(STATUS "*** WARNING: if anything breaks, you get to keep all the pieces.")
message(STATUS "*** WARNING: manual installation is described in the README file.")
message(STATUS "")
if(MSVC)
if(NOT STATIC_LIB)
message(STATUS "")
message(STATUS "*** WARNING: building shared library with MSVC is not supported." )
message(STATUS "*** WARNING: use manual installation instead; see README for details")
message(STATUS "")
set(STATIC_LIB ON)
endif()
endif()
if(MSVC AND BUILD_SHARED_LIBS)
message(STATUS "")
message(STATUS "*** WARNING: building shared library with MSVC is not supported." )
message(STATUS "*** WARNING: if anything breaks, you get to keep all the pieces.")
message(STATUS "")
if(HEADER_ONLY)
set(BUILD_WRAPPER false)
else()
set(BUILD_WRAPPER true)
endif()
if(BUILD_WRAPPER)
set(ARMA_USE_WRAPPER true)
else()
set(ARMA_USE_WRAPPER false)
endif()
message(STATUS "")
message(STATUS "CMAKE_SYSTEM_NAME = ${CMAKE_SYSTEM_NAME}" )
message(STATUS "CMAKE_CXX_COMPILER_ID = ${CMAKE_CXX_COMPILER_ID}" )
message(STATUS "CMAKE_CXX_COMPILER_VERSION = ${CMAKE_CXX_COMPILER_VERSION}")
message(STATUS "CMAKE_COMPILER_IS_GNUCXX = ${CMAKE_COMPILER_IS_GNUCXX}" )
message(STATUS "")
message(STATUS "*** Options:" )
message(STATUS "BUILD_SHARED_LIBS = ${BUILD_SHARED_LIBS}" )
message(STATUS "*** options:" )
message(STATUS "HEADER_ONLY = ${HEADER_ONLY}" )
message(STATUS "STATIC_LIB = ${STATIC_LIB}" )
message(STATUS "OPENBLAS_PROVIDES_LAPACK = ${OPENBLAS_PROVIDES_LAPACK}")
message(STATUS "ALLOW_FLEXIBLAS_LINUX = ${ALLOW_FLEXIBLAS_LINUX}" )
message(STATUS "ALLOW_OPENBLAS_MACOS = ${ALLOW_OPENBLAS_MACOS}" )
@@ -457,7 +470,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)
@@ -488,23 +501,30 @@ endif()
message(STATUS "")
message(STATUS "*** Result of configuration:")
message(STATUS "*** ARMA_USE_WRAPPER = ${ARMA_USE_WRAPPER}")
message(STATUS "*** ARMA_USE_LAPACK = ${ARMA_USE_LAPACK}")
message(STATUS "*** ARMA_USE_BLAS = ${ARMA_USE_BLAS}")
message(STATUS "*** ARMA_USE_ATLAS = ${ARMA_USE_ATLAS}")
message(STATUS "*** ARMA_USE_ARPACK = ${ARMA_USE_ARPACK}")
message(STATUS "*** ARMA_USE_EXTERN_RNG = ${ARMA_USE_EXTERN_RNG}")
message(STATUS "*** ARMA_USE_SUPERLU = ${ARMA_USE_SUPERLU}")
message(STATUS "")
message(STATUS "*** Armadillo wrapper library will use the following libraries:")
message(STATUS "*** ARMA_LIBS = ${ARMA_LIBS}")
message(STATUS "")
message(STATUS "*** ARMA_USE_WRAPPER = ${ARMA_USE_WRAPPER}")
message(STATUS "*** ARMA_USE_LAPACK = ${ARMA_USE_LAPACK}")
message(STATUS "*** ARMA_USE_BLAS = ${ARMA_USE_BLAS}")
message(STATUS "*** ARMA_USE_ATLAS = ${ARMA_USE_ATLAS}")
message(STATUS "*** ARMA_USE_ARPACK = ${ARMA_USE_ARPACK}")
message(STATUS "*** ARMA_USE_SUPERLU = ${ARMA_USE_SUPERLU}")
if(BUILD_WRAPPER)
message(STATUS "")
message(STATUS "*** Armadillo wrapper library links with these libraries:")
message(STATUS "*** ARMA_LIBS = ${ARMA_LIBS}")
else()
message(STATUS "")
message(STATUS "*** Armadillo programs must be manually linked with:")
message(STATUS "*** ARMA_LIBS = ${ARMA_LIBS}")
endif()
message(STATUS "")
message(STATUS "Copying ${PROJECT_SOURCE_DIR}/include/ to ${PROJECT_BINARY_DIR}/tmp/include/")
file(COPY ${PROJECT_SOURCE_DIR}/include/ DESTINATION ${PROJECT_BINARY_DIR}/tmp/include/)
message(STATUS "Generating ${PROJECT_BINARY_DIR}/tmp/include/config.hpp")
message(STATUS "Generating ${PROJECT_BINARY_DIR}/tmp/include/armadillo_bits/config.hpp")
configure_file(${PROJECT_BINARY_DIR}/tmp/include/armadillo_bits/config.hpp.cmake ${PROJECT_BINARY_DIR}/tmp/include/armadillo_bits/config.hpp)
@@ -544,13 +564,25 @@ else()
endif()
message(STATUS "")
message(STATUS "CMAKE_CXX_FLAGS = ${CMAKE_CXX_FLAGS}" )
message(STATUS "CMAKE_SHARED_LINKER_FLAGS = ${CMAKE_SHARED_LINKER_FLAGS}")
message(STATUS "CMAKE_REQUIRED_INCLUDES = ${CMAKE_REQUIRED_INCLUDES}" )
add_library( armadillo ${PROJECT_SOURCE_DIR}/src/wrapper1.cpp ${PROJECT_SOURCE_DIR}/src/wrapper2.cpp )
target_link_libraries( armadillo ${ARMA_LIBS} )
if(BUILD_WRAPPER)
if(STATIC_LIB)
set(BUILD_SHARED_LIBS OFF)
else()
set(BUILD_SHARED_LIBS ON)
endif()
add_library( armadillo ${PROJECT_SOURCE_DIR}/src/wrapper1.cpp ${PROJECT_SOURCE_DIR}/src/wrapper2.cpp )
target_link_libraries( armadillo ${ARMA_LIBS} )
else()
add_library( armadillo INTERFACE )
endif()
# target_include_directories(armadillo INTERFACE $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include> $<INSTALL_INTERFACE:include>)
target_include_directories(armadillo INTERFACE $<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/tmp/include> $<INSTALL_INTERFACE:include>)
set_target_properties(armadillo PROPERTIES VERSION ${ARMA_VERSION_MAJOR}.${ARMA_VERSION_MINOR_ALT}.${ARMA_VERSION_PATCH} SOVERSION ${ARMA_VERSION_MAJOR})
@@ -571,7 +603,7 @@ message(STATUS "CMAKE_INSTALL_BINDIR = ${CMAKE_INSTALL_BINDIR}" )
# Note that the trailing / character in "include/" is critical
install(DIRECTORY ${PROJECT_BINARY_DIR}/tmp/include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
PATTERN ".svn" EXCLUDE
PATTERN ".git" EXCLUDE
PATTERN "*.cmake" EXCLUDE
PATTERN "*~" EXCLUDE
PATTERN "*orig" EXCLUDE
@@ -582,6 +614,42 @@ install(TARGETS armadillo EXPORT ArmadilloLibraryDepends
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
## smoke test
if(BUILD_SMOKE_TEST)
if(HEADER_ONLY)
## TODO: update to link smoke_test with ARMA_LIBS when HEADER_ONLY option is enabled
message(STATUS "*** building smoke_test not supported when HEADER_ONLY enabled")
else()
message(STATUS "*** configuring smoke_test")
enable_testing()
add_subdirectory(tests1)
endif()
endif()
## pkgconfig related
## TODO: this currently doesn't handle the required SuperLU include dir
## TODO: update armadillo.pc.in to link with ARMA_LIBS when HEADER_ONLY option is enabled
if(HEADER_ONLY)
message(STATUS "*** generating pkgconfig files not supported when HEADER_ONLY enabled")
else()
message(STATUS "*** copying ${PROJECT_SOURCE_DIR}/misc/ to ${PROJECT_BINARY_DIR}/tmp/misc/")
file(COPY ${PROJECT_SOURCE_DIR}/misc/ DESTINATION ${PROJECT_BINARY_DIR}/tmp/misc/)
message(STATUS "*** generating '${PROJECT_BINARY_DIR}/tmp/misc/armadillo.pc'")
configure_file(${PROJECT_BINARY_DIR}/tmp/misc/armadillo.pc.in "${PROJECT_BINARY_DIR}/tmp/misc/armadillo.pc" @ONLY)
install(FILES "${PROJECT_BINARY_DIR}/tmp/misc/armadillo.pc" DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
endif()
if(HEADER_ONLY)
message(STATUS "")
message(STATUS "*** HEADER_ONLY mode is enabled; skipping rest of configuration script")
return()
endif()
# Export the package for use from the build-tree
# (this registers the build-tree with a global CMake-registry)
export(PACKAGE armadillo)
@@ -592,7 +660,6 @@ set(ARMADILLO_INCLUDE_DIRS "${PROJECT_BINARY_DIR}/tmp/include")
set(ARMADILLO_LIB_DIR "${PROJECT_BINARY_DIR}")
set(ARMADILLO_CMAKE_DIR "${PROJECT_BINARY_DIR}")
message(STATUS "Generating '${PROJECT_BINARY_DIR}/ArmadilloConfig.cmake'")
# copy/change config and configVersion file (modify only the @xyz@ variables)
configure_file(${PROJECT_SOURCE_DIR}/cmake_aux/InstallFiles/ArmadilloConfig.cmake.in
@@ -630,23 +697,3 @@ install(FILES
"${PROJECT_BINARY_DIR}/InstallFiles/ArmadilloConfig.cmake"
"${PROJECT_BINARY_DIR}/InstallFiles/ArmadilloConfigVersion.cmake"
DESTINATION "${ARMADILLO_CMAKE_DIR}" COMPONENT dev)
# pkgconfig related
message(STATUS "Copying ${PROJECT_SOURCE_DIR}/misc/ to ${PROJECT_BINARY_DIR}/tmp/misc/")
file(COPY ${PROJECT_SOURCE_DIR}/misc/ DESTINATION ${PROJECT_BINARY_DIR}/tmp/misc/)
message(STATUS "Generating '${PROJECT_BINARY_DIR}/tmp/misc/armadillo.pc'")
configure_file(${PROJECT_BINARY_DIR}/tmp/misc/armadillo.pc.in "${PROJECT_BINARY_DIR}/tmp/misc/armadillo.pc" @ONLY)
install(FILES "${PROJECT_BINARY_DIR}/tmp/misc/armadillo.pc" DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
# smoke test
if(BUILD_SMOKE_TEST)
message(STATUS "*** configuring smoke_test")
enable_testing()
add_subdirectory(tests1)
endif()
+2 -2
View File
@@ -1,7 +1,7 @@
Armadillo C++ Linear Algebra Library
Copyright 2008-2023 Conrad Sanderson (https://conradsanderson.id.au)
Copyright 2008-2025 Conrad Sanderson (https://conradsanderson.id.au)
Copyright 2008-2016 National ICT Australia (NICTA)
Copyright 2017-2023 Data61 / CSIRO
Copyright 2017-2025 Data61 / CSIRO
This product includes software developed by Conrad Sanderson (https://conradsanderson.id.au)
This product includes software developed at National ICT Australia (NICTA)
+60 -63
View File
@@ -1,9 +1,9 @@
### Armadillo: C++ Library for Linear Algebra & Scientific Computing
https://arma.sourceforge.net
Copyright 2008-2023 Conrad Sanderson (https://conradsanderson.id.au)
Copyright 2008-2025 Conrad Sanderson (https://conradsanderson.id.au)
Copyright 2008-2016 National ICT Australia (NICTA)
Copyright 2017-2023 Data61 / CSIRO
Copyright 2017-2025 Data61 / CSIRO
---
@@ -30,10 +30,11 @@ Copyright 2017-2023 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)
@@ -78,12 +79,12 @@ Please cite the following papers if you use Armadillo in your research and/or so
Citations are useful for the continued development and maintenance of the library.
* Conrad Sanderson and Ryan Curtin.
Armadillo: a template-based C++ library for linear algebra.
Journal of Open Source Software, Vol. 1, No. 2, pp. 26, 2016.
Armadillo: An Efficient Framework for Numerical Linear Algebra.
International Conference on Computer and Automation Engineering, 2025.
* Conrad Sanderson and Ryan Curtin.
A User-Friendly Hybrid Sparse Matrix Class in C++.
Lecture Notes in Computer Science (LNCS), Vol. 10931, pp. 422-430, 2018.
Practical Sparse Matrices in C++ with Hybrid Storage and Template-Based Expression Optimisation.
Mathematical and Computational Applications, Vol.24, No.3, 2019.
---
@@ -115,7 +116,7 @@ On macOS, the Accelerate framework can be used for BLAS and LAPACK functions.
If sparse matrices are not needed, ARPACK and SuperLU are not required.
Armadillo requires a C++ compiler that supports at least the C++11 standard.
Armadillo requires a C++ compiler that supports at least the C++14 standard.
On Linux-based systems, install the GCC C++ compiler, which is available as a pre-built package.
The package name might be `g++` or `gcc-c++` depending on your system.
@@ -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)
---
@@ -138,6 +139,7 @@ Caveats on the use of SuperLU:
Armadillo can be installed in several ways: either manually or via cmake, with or without root access.
The cmake based installation is preferred.
The cmake tool can be downloaded from https://www.cmake.org
or (preferably) installed using the package manager on your system;
on macOS systems, cmake can be installed through MacPorts or Homebrew.
@@ -153,8 +155,7 @@ The cmake based installer detects which relevant libraries
are installed on your system (eg. OpenBLAS, LAPACK, SuperLU, ARPACK, etc)
and correspondingly modifies Armadillo's configuration.
The installer also generates the Armadillo runtime library,
which is a wrapper for all the detected libraries,
and provides a thread-safe random number generator.
which is a wrapper for all the detected libraries.
Change into the directory that was created by unpacking the armadillo archive
(eg. `cd armadillo-10.6.1`) and then run cmake using:
@@ -230,12 +231,12 @@ and hence you will need to link your programs directly with OpenBLAS, LAPACK, et
If you have installed Armadillo via the cmake installer,
use the following command to compile your programs:
g++ prog.cpp -o prog -O2 -std=c++11 -larmadillo
g++ prog.cpp -o prog -O2 -std=c++14 -larmadillo
If you have installed Armadillo manually, link with OpenBLAS and LAPACK
instead of the Armadillo runtime library:
g++ prog.cpp -o prog -O2 -std=c++11 -lopenblas -llapack
g++ prog.cpp -o prog -O2 -std=c++14 -lopenblas -llapack
If you have manually installed Armadillo in a non-standard location,
such as `/home/user/include/`, you will need to make sure
@@ -243,12 +244,12 @@ that your C++ compiler searches `/home/user/include/`
by explicitly specifying the directory as an argument/option.
For example, using the `-I` switch in GCC and Clang:
g++ prog.cpp -o prog -O2 -std=c++11 -I /home/user/include/ -lopenblas -llapack
g++ prog.cpp -o prog -O2 -std=c++14 -I /home/user/include/ -lopenblas -llapack
If you're getting linking issues (unresolved symbols),
enable the `ARMA_DONT_USE_WRAPPER` option:
g++ prog.cpp -o prog -O2 -std=c++11 -I /home/user/include/ -DARMA_DONT_USE_WRAPPER -lopenblas -llapack
g++ prog.cpp -o prog -O2 -std=c++14 -I /home/user/include/ -DARMA_DONT_USE_WRAPPER -lopenblas -llapack
If you don't have OpenBLAS, on Linux change `-lopenblas` to `-lblas`;
on macOS change `-lopenblas -llapack` to `-framework Accelerate`
@@ -303,20 +304,21 @@ the active solution platform must be set to x64, instead of win32.
The MSVC project was tested on Windows 10 (64 bit) with Visual Studio C++ 2019.
Adaptations may be required for 32 bit systems, later versions of Windows and/or the compiler.
For example, options such as `ARMA_BLAS_LONG` and `ARMA_BLAS_UNDERSCORE`,
For example, options such as `ARMA_BLAS_LONG_LONG` and `ARMA_BLAS_UNDERSCORE`,
defined in `include/armadillo_bits/config.hpp`, may need to be either enabled or disabled.
The folder `examples/lib_win64` contains a copy of lib and dll files
obtained from a pre-compiled release of OpenBLAS:
https://github.com/xianyi/OpenBLAS/releases/
https://github.com/OpenMathLib/OpenBLAS/releases
The compilation was done by a third party. USE AT YOUR OWN RISK.
**Caveat:**
for any high performance scientific/engineering workloads,
we strongly recommend using a Linux-based operating system, such as:
* Fedora https://fedoraproject.org/
* Ubuntu https://www.ubuntu.com/
* CentOS https://centos.org/
* Fedora https://fedoraproject.org/
* Ubuntu https://www.ubuntu.com/
* Alma Linux https://almalinux.org/
* Rocky Linux https://rockylinux.org/
---
@@ -332,29 +334,28 @@ as used by the replacement libraries. Specifically, the following defines
may need to be enabled or disabled:
ARMA_USE_WRAPPER
ARMA_BLAS_CAPITALS
ARMA_BLAS_UNDERSCORE
ARMA_BLAS_LONG
ARMA_BLAS_LONG_LONG
ARMA_DONT_USE_FORTRAN_HIDDEN_ARGS
ARMA_BLAS_UNDERSCORE
ARMA_BLAS_CAPITALS
See the documentation for more information on the above defines.
On Linux-based systems, MKL might be installed in a non-standard location such as `/opt`
which can cause problems during linking.
Before installing Armadillo, the system should know where the MKL libraries are located.
For example, `/opt/intel/mkl/lib/intel64/`.
This can be achieved by setting the `LD_LIBRARY_PATH` environment variable,
or for a more permanent solution, adding the directory locations to `/etc/ld.so.conf`.
It may also be possible to store a text file with the locations
in the `/etc/ld.so.conf.d` directory. For example, `/etc/ld.so.conf.d/mkl.conf`.
If `/etc/ld.so.conf` is modified or `/etc/ld.so.conf.d/mkl.conf` is created,
`/sbin/ldconfig` must be run afterwards.
Examples: `/opt/intel/oneapi/mkl/latest/lib`, `/opt/intel/mkl/lib/intel64/`.
Below is an example of `/etc/ld.so.conf.d/mkl.conf`
where Intel MKL is installed in `/opt/intel`
Before installing Armadillo, the system must know where the MKL libraries are located.
This can be achieved via several ways:
/opt/intel/lib/intel64
/opt/intel/mkl/lib/intel64
1. By setting the `LD_LIBRARY_PATH` environment variable.
2. By adding the MKL library directory locations to the `/etc/ld.so.conf` text file,
followed by running `/sbin/ldconfig`.
3. By creating a text file named `/etc/ld.so.conf.d/mkl.conf`
which contains the MKL library directory locations,
followed by running `/sbin/ldconfig`.
If MKL is installed and it is persistently giving problems during linking,
Support for MKL can be disabled by editing the CMakeLists.txt file,
@@ -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 temporaries
that are not properly handled by `auto`.
---
### 13: API Stability and Version Policy
Each release of Armadillo has its public API (functions, classes, constants)
@@ -402,16 +403,15 @@ described in the accompanying API documentation (docs.html) specific
to that release.
Each release of Armadillo has its full version specified as A.B.C,
where A is a major version number, B is a minor version number,
and C is a patch level (indicating bug fixes).
The version specification has explicit meaning,
similar to [Semantic Versioning](https://semver.org/), as follows:
where A is a major version number, B is a minor version number, and C is a patch level.
The version specification has explicit meaning
(similar to [Semantic Versioning](https://semver.org/)), as follows:
* Within a major version (eg. 10), each minor version has a public API that
strongly strives to be backwards compatible (at the source level) with the
public API of preceding minor versions. For example, user code written for
version 10.0 should work with version 10.1, 10.2, etc.
However, later minor versions may have more features (API additions and extensions)
However, subsequent minor versions may have more features (API additions and extensions)
than preceding minor versions. As such, user code _specifically_
written for version 10.2 may not work with 10.1.
@@ -427,7 +427,7 @@ similar to [Semantic Versioning](https://semver.org/), as follows:
**CAVEAT:**
the above policy applies only to the public API described in the documentation.
Any functionality within Armadillo which is _not explicitly_ described
in the public API documentation is considered as internal implementation details,
in the public API documentation is considered as internal implementation detail,
and may be changed or removed without notice.
---
@@ -461,18 +461,15 @@ Octave/Matlab with C++ code that uses Armadillo matrices.
### 16: Related Software Using Armadillo
* ensmallen: fast library for non-linear numerical optimisation
https://ensmallen.org/
* MLPACK: extensive library of machine learning algorithms
https://mlpack.org
* CARMA: bidirectional interface between Python and Armadillo
https://github.com/RUrlus/carma
* ensmallen: C++ library for numerical optimisation (L-BFGS, SGD, CMA-ES, etc)
https://ensmallen.org/
* RcppArmadillo: integration of Armadillo with R
https://dirk.eddelbuettel.com/code/rcpp.armadillo.html
* PyArmadillo: streamlined linear algebra library for Python
https://pyarma.sourceforge.io
* CARMA: interface between Armadillo and Python / NumPy
https://github.com/RUrlus/carma
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.
Binary file not shown.
+3
View File
@@ -115,6 +115,9 @@ foreach (MKL_NAME ${MKL_NAMES})
/usr/local/mkl/*/lib/em64t
/usr/local/mkl/*/lib/lib64
/usr/local/mkl/*/lib/32
/usr/local/intel/oneapi/mkl/latest/lib
/opt/intel/oneapi/mkl/latest/lib
/opt/intel/oneapi/mkl/*/lib
)
set(TMP_LIBRARY ${${MKL_NAME}_LIBRARY})
+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
+3 -4
View File
@@ -6,10 +6,10 @@ check_cmake()
{
(cmake --version) </dev/null >/dev/null 2>&1 ||
{
echo "error: cmake (version 2.8 or newer) must be present to configure and install Armadillo"
echo "error: cmake 3.10+ is required to configure and install Armadillo"
echo ""
echo "cmake might be available as a package for your system,"
echo "or can be downloaded from http://cmake.org"
echo "cmake can be installed via your system's package manager,"
echo "or downloaded from https://cmake.org"
ABORT=yes
}
}
@@ -20,4 +20,3 @@ test "$ABORT" = yes && exit -1
rm -f CMakeCache.txt
cmake $@ .
+1602 -762
View File
File diff suppressed because it is too large Load Diff
+3 -3
View File
@@ -4,14 +4,14 @@ How to compile example1.cpp
** Linux and macOS **
If you have installed Armadillo via the CMake installer:
g++ example1.cpp -o example1 -std=c++11 -O2 -larmadillo
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++11 -O2 -I /home/user/armadillo-12.2.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. "12.2.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
+3 -1
View File
@@ -1,7 +1,9 @@
#include <iostream>
#include <armadillo>
using namespace std;
using std::cout;
using std::endl;
using namespace arma;
// Armadillo documentation is available at:
+9 -8
View File
@@ -1,18 +1,19 @@
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.20:
https://github.com/xianyi/OpenBLAS/releases/download/v0.3.20/OpenBLAS-0.3.20-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.20-x64/bin/libopenblas.dll
libopenblas.lib is a copy of OpenBLAS-0.3.20-x64/lib/libopenblas.dll.a
The original sources for OpenBLAS are at:
https://github.com/xianyi/OpenBLAS/
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.
The original sources for standard BLAS and LAPACK are at:
The source code for OpenBLAS is available at:
https://github.com/OpenMathLib/OpenBLAS
The sources for standard BLAS and LAPACK are at:
http://www.netlib.org/blas/
http://www.netlib.org/lapack/
Binary file not shown.
Binary file not shown.
+79 -32
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,
@@ -19,9 +19,9 @@
#ifndef ARMA_INCLUDES
#define ARMA_INCLUDES
// NOTE: functions that are designed to be user accessible are described in the documentation (docs.html).
// NOTE: all other functions and classes (ie. not explicitly described in the documentation)
// NOTE: are considered as internal implementation details, and may be changed or removed without notice.
// WARNING: the documentation (docs.html) describes the public API (functions, classes, constants);
// WARNING: any functionality which is _not explicitly_ described in the documentation
// WARNING: is considered as internal implementation detail, and may be changed or removed without notice.
#include "armadillo_bits/config.hpp"
#include "armadillo_bits/compiler_check.hpp"
@@ -35,6 +35,7 @@
#include <cmath>
#include <ctime>
#include <memory>
#include <iostream>
#include <fstream>
#include <sstream>
@@ -50,10 +51,19 @@
#include <random>
#include <functional>
#include <chrono>
#include <atomic>
#if !defined(ARMA_DONT_USE_STD_MUTEX)
#include <mutex>
#include <atomic>
#if defined(ARMA_USE_STD_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)
@@ -61,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
@@ -138,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)
@@ -170,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"
@@ -221,6 +241,7 @@ namespace arma
#include "armadillo_bits/OpCube_bones.hpp"
#include "armadillo_bits/SpOp_bones.hpp"
#include "armadillo_bits/SpToDOp_bones.hpp"
#include "armadillo_bits/mtSpReduceOp_bones.hpp"
#include "armadillo_bits/eOp_bones.hpp"
#include "armadillo_bits/eOpCube_bones.hpp"
@@ -234,6 +255,7 @@ namespace arma
#include "armadillo_bits/mtGlue_bones.hpp"
#include "armadillo_bits/SpGlue_bones.hpp"
#include "armadillo_bits/mtSpGlue_bones.hpp"
#include "armadillo_bits/SpToDGlue_bones.hpp"
#include "armadillo_bits/GlueCube_bones.hpp"
#include "armadillo_bits/eGlueCube_bones.hpp"
@@ -272,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"
@@ -280,7 +302,7 @@ 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"
@@ -301,6 +323,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"
@@ -313,14 +336,26 @@ namespace arma
#include "armadillo_bits/op_roots_bones.hpp"
#include "armadillo_bits/op_cond_bones.hpp"
#include "armadillo_bits/op_rcond_bones.hpp"
#include "armadillo_bits/op_sp_plus_bones.hpp"
#include "armadillo_bits/op_sp_minus_bones.hpp"
#include "armadillo_bits/op_powmat_bones.hpp"
#include "armadillo_bits/op_rank_bones.hpp"
#include "armadillo_bits/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"
#include "armadillo_bits/op_sp_max_bones.hpp"
#include "armadillo_bits/op_sp_min_bones.hpp"
#include "armadillo_bits/op_sp_mean_bones.hpp"
#include "armadillo_bits/op_sp_var_bones.hpp"
#include "armadillo_bits/op_sp_stddev_bones.hpp"
#include "armadillo_bits/op_sp_vecnorm_bones.hpp"
#include "armadillo_bits/op_sp_diagvec_bones.hpp"
#include "armadillo_bits/op_sp_nonzeros_bones.hpp"
#include "armadillo_bits/op_sp_as_dense_bones.hpp"
#include "armadillo_bits/glue_times_bones.hpp"
#include "armadillo_bits/glue_times_misc_bones.hpp"
#include "armadillo_bits/glue_mixed_bones.hpp"
#include "armadillo_bits/glue_cov_bones.hpp"
#include "armadillo_bits/glue_cor_bones.hpp"
@@ -350,15 +385,10 @@ namespace arma
#include "armadillo_bits/gmm_diag_bones.hpp"
#include "armadillo_bits/gmm_full_bones.hpp"
#include "armadillo_bits/spop_max_bones.hpp"
#include "armadillo_bits/spop_min_bones.hpp"
#include "armadillo_bits/spop_sum_bones.hpp"
#include "armadillo_bits/spop_strans_bones.hpp"
#include "armadillo_bits/spop_htrans_bones.hpp"
#include "armadillo_bits/spop_misc_bones.hpp"
#include "armadillo_bits/spop_diagmat_bones.hpp"
#include "armadillo_bits/spop_mean_bones.hpp"
#include "armadillo_bits/spop_var_bones.hpp"
#include "armadillo_bits/spop_trimat_bones.hpp"
#include "armadillo_bits/spop_symmat_bones.hpp"
#include "armadillo_bits/spop_normalise_bones.hpp"
@@ -366,7 +396,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_vecnorm_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"
@@ -513,10 +546,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"
@@ -554,6 +586,7 @@ namespace arma
#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"
@@ -579,6 +612,8 @@ namespace arma
#include "armadillo_bits/fn_quantile.hpp"
#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"
@@ -620,11 +655,13 @@ namespace arma
#include "armadillo_bits/mtOp_meat.hpp"
#include "armadillo_bits/mtOpCube_meat.hpp"
#include "armadillo_bits/mtSpOp_meat.hpp"
#include "armadillo_bits/mtSpReduceOp_meat.hpp"
#include "armadillo_bits/Glue_meat.hpp"
#include "armadillo_bits/GlueCube_meat.hpp"
#include "armadillo_bits/SpGlue_meat.hpp"
#include "armadillo_bits/mtSpGlue_meat.hpp"
#include "armadillo_bits/SpToDGlue_meat.hpp"
#include "armadillo_bits/eOp_meat.hpp"
#include "armadillo_bits/eOpCube_meat.hpp"
@@ -645,7 +682,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"
@@ -716,7 +752,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"
@@ -724,7 +760,7 @@ 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"
@@ -745,6 +781,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"
@@ -757,14 +794,26 @@ namespace arma
#include "armadillo_bits/op_roots_meat.hpp"
#include "armadillo_bits/op_cond_meat.hpp"
#include "armadillo_bits/op_rcond_meat.hpp"
#include "armadillo_bits/op_sp_plus_meat.hpp"
#include "armadillo_bits/op_sp_minus_meat.hpp"
#include "armadillo_bits/op_powmat_meat.hpp"
#include "armadillo_bits/op_rank_meat.hpp"
#include "armadillo_bits/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"
#include "armadillo_bits/op_sp_max_meat.hpp"
#include "armadillo_bits/op_sp_min_meat.hpp"
#include "armadillo_bits/op_sp_mean_meat.hpp"
#include "armadillo_bits/op_sp_var_meat.hpp"
#include "armadillo_bits/op_sp_stddev_meat.hpp"
#include "armadillo_bits/op_sp_vecnorm_meat.hpp"
#include "armadillo_bits/op_sp_diagvec_meat.hpp"
#include "armadillo_bits/op_sp_nonzeros_meat.hpp"
#include "armadillo_bits/op_sp_as_dense_meat.hpp"
#include "armadillo_bits/glue_times_meat.hpp"
#include "armadillo_bits/glue_times_misc_meat.hpp"
#include "armadillo_bits/glue_mixed_meat.hpp"
#include "armadillo_bits/glue_cov_meat.hpp"
#include "armadillo_bits/glue_cor_meat.hpp"
@@ -794,15 +843,10 @@ namespace arma
#include "armadillo_bits/gmm_diag_meat.hpp"
#include "armadillo_bits/gmm_full_meat.hpp"
#include "armadillo_bits/spop_max_meat.hpp"
#include "armadillo_bits/spop_min_meat.hpp"
#include "armadillo_bits/spop_sum_meat.hpp"
#include "armadillo_bits/spop_strans_meat.hpp"
#include "armadillo_bits/spop_htrans_meat.hpp"
#include "armadillo_bits/spop_misc_meat.hpp"
#include "armadillo_bits/spop_diagmat_meat.hpp"
#include "armadillo_bits/spop_mean_meat.hpp"
#include "armadillo_bits/spop_var_meat.hpp"
#include "armadillo_bits/spop_trimat_meat.hpp"
#include "armadillo_bits/spop_symmat_meat.hpp"
#include "armadillo_bits/spop_normalise_meat.hpp"
@@ -810,7 +854,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_vecnorm_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,
+25 -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,
@@ -36,7 +36,7 @@ inline
void
BaseCube<elem_type,derived>::print(const std::string extra_text) const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const unwrap_cube<derived> tmp( (*this).get_ref() );
@@ -59,7 +59,7 @@ inline
void
BaseCube<elem_type,derived>::print(std::ostream& user_stream, const std::string extra_text) const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const unwrap_cube<derived> tmp( (*this).get_ref() );
@@ -82,7 +82,7 @@ inline
void
BaseCube<elem_type,derived>::raw_print(const std::string extra_text) const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const unwrap_cube<derived> tmp( (*this).get_ref() );
@@ -105,7 +105,7 @@ inline
void
BaseCube<elem_type,derived>::raw_print(std::ostream& user_stream, const std::string extra_text) const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const unwrap_cube<derived> tmp( (*this).get_ref() );
@@ -128,7 +128,7 @@ inline
void
BaseCube<elem_type,derived>::brief_print(const std::string extra_text) const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const unwrap_cube<derived> tmp( (*this).get_ref() );
@@ -151,7 +151,7 @@ inline
void
BaseCube<elem_type,derived>::brief_print(std::ostream& user_stream, const std::string extra_text) const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const unwrap_cube<derived> tmp( (*this).get_ref() );
@@ -200,7 +200,7 @@ BaseCube<elem_type,derived>::index_min() const
if(P.get_n_elem() == 0)
{
arma_debug_check(true, "index_min(): object has no elements");
arma_conform_check(true, "index_min(): object has no elements");
}
else
{
@@ -223,7 +223,7 @@ BaseCube<elem_type,derived>::index_max() const
if(P.get_n_elem() == 0)
{
arma_debug_check(true, "index_max(): object has no elements");
arma_conform_check(true, "index_max(): object has no elements");
}
else
{
@@ -240,11 +240,11 @@ inline
bool
BaseCube<elem_type,derived>::is_zero(const typename get_pod_type<elem_type>::result tol) const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
typedef typename get_pod_type<elem_type>::result T;
arma_debug_check( (tol < T(0)), "is_zero(): parameter 'tol' must be >= 0" );
arma_conform_check( (tol < T(0)), "is_zero(): parameter 'tol' must be >= 0" );
if(ProxyCube<derived>::use_at || is_Cube<typename ProxyCube<derived>::stored_type>::value)
{
@@ -292,7 +292,7 @@ inline
bool
BaseCube<elem_type,derived>::is_empty() const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const ProxyCube<derived> P( (*this).get_ref() );
@@ -306,9 +306,9 @@ inline
bool
BaseCube<elem_type,derived>::is_finite() const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
if(arma_config::fast_math) { arma_debug_warn_level(2, "is_finite(): detection of non-finite values is not reliable in fast math mode"); }
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_Cube<typename ProxyCube<derived>::stored_type>::value)
{
@@ -328,7 +328,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; }
}
}
@@ -342,9 +342,9 @@ inline
bool
BaseCube<elem_type,derived>::has_inf() const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
if(arma_config::fast_math) { arma_debug_warn_level(2, "has_inf(): detection of non-finite values is not reliable in fast math mode"); }
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_Cube<typename ProxyCube<derived>::stored_type>::value)
{
@@ -378,9 +378,9 @@ inline
bool
BaseCube<elem_type,derived>::has_nan() const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
if(arma_config::fast_math) { arma_debug_warn_level(2, "has_nan(): detection of non-finite values is not reliable in fast math mode"); }
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_Cube<typename ProxyCube<derived>::stored_type>::value)
{
@@ -414,9 +414,9 @@ inline
bool
BaseCube<elem_type,derived>::has_nonfinite() const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
if(arma_config::fast_math) { arma_debug_warn_level(2, "has_nonfinite(): detection of non-finite values is not reliable in fast math mode"); }
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_Cube<typename ProxyCube<derived>::stored_type>::value)
{
@@ -436,7 +436,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; }
}
}
@@ -473,7 +473,7 @@ arma_inline
const derived&
BaseCube_eval_Cube<elem_type, derived>::eval() const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
return static_cast<const derived&>(*this);
}
@@ -488,7 +488,7 @@ inline
Cube<elem_type>
BaseCube_eval_expr<elem_type, derived>::eval() const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
return Cube<elem_type>( static_cast<const derived&>(*this) );
}
+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;
inline elem_type min(uword& index_of_min_val) const;
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;
inline elem_type min(uword& row_of_min_val, uword& col_of_min_val) const;
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;
+43 -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,
@@ -36,7 +36,7 @@ inline
void
Base<elem_type,derived>::print(const std::string extra_text) const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const quasi_unwrap<derived> tmp( (*this).get_ref() );
@@ -59,7 +59,7 @@ inline
void
Base<elem_type,derived>::print(std::ostream& user_stream, const std::string extra_text) const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const quasi_unwrap<derived> tmp( (*this).get_ref() );
@@ -82,7 +82,7 @@ inline
void
Base<elem_type,derived>::raw_print(const std::string extra_text) const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const quasi_unwrap<derived> tmp( (*this).get_ref() );
@@ -105,7 +105,7 @@ inline
void
Base<elem_type,derived>::raw_print(std::ostream& user_stream, const std::string extra_text) const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const quasi_unwrap<derived> tmp( (*this).get_ref() );
@@ -128,7 +128,7 @@ inline
void
Base<elem_type,derived>::brief_print(const std::string extra_text) const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const quasi_unwrap<derived> tmp( (*this).get_ref() );
@@ -151,7 +151,7 @@ inline
void
Base<elem_type,derived>::brief_print(std::ostream& user_stream, const std::string extra_text) const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const quasi_unwrap<derived> tmp( (*this).get_ref() );
@@ -266,7 +266,7 @@ Base<elem_type,derived>::index_min() const
if(P.get_n_elem() == 0)
{
arma_debug_check(true, "index_min(): object has no elements");
arma_conform_check(true, "index_min(): object has no elements");
}
else
{
@@ -289,7 +289,7 @@ Base<elem_type,derived>::index_max() const
if(P.get_n_elem() == 0)
{
arma_debug_check(true, "index_max(): object has no elements");
arma_conform_check(true, "index_max(): object has no elements");
}
else
{
@@ -306,7 +306,7 @@ inline
bool
Base<elem_type,derived>::is_symmetric() const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const quasi_unwrap<derived> U( (*this).get_ref() );
@@ -346,13 +346,13 @@ inline
bool
Base<elem_type,derived>::is_symmetric(const typename get_pod_type<elem_type>::result tol) const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
typedef typename get_pod_type<elem_type>::result T;
if(tol == T(0)) { return (*this).is_symmetric(); }
arma_debug_check( (tol < T(0)), "is_symmetric(): parameter 'tol' must be >= 0" );
arma_conform_check( (tol < T(0)), "is_symmetric(): parameter 'tol' must be >= 0" );
const quasi_unwrap<derived> U( (*this).get_ref() );
@@ -377,7 +377,7 @@ inline
bool
Base<elem_type,derived>::is_hermitian() const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
typedef typename get_pod_type<elem_type>::result T;
@@ -429,13 +429,13 @@ inline
bool
Base<elem_type,derived>::is_hermitian(const typename get_pod_type<elem_type>::result tol) const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
typedef typename get_pod_type<elem_type>::result T;
if(tol == T(0)) { return (*this).is_hermitian(); }
arma_debug_check( (tol < T(0)), "is_hermitian(): parameter 'tol' must be >= 0" );
arma_conform_check( (tol < T(0)), "is_hermitian(): parameter 'tol' must be >= 0" );
const quasi_unwrap<derived> U( (*this).get_ref() );
@@ -460,11 +460,11 @@ inline
bool
Base<elem_type,derived>::is_zero(const typename get_pod_type<elem_type>::result tol) const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
typedef typename get_pod_type<elem_type>::result T;
arma_debug_check( (tol < T(0)), "is_zero(): parameter 'tol' must be >= 0" );
arma_conform_check( (tol < T(0)), "is_zero(): parameter 'tol' must be >= 0" );
if(Proxy<derived>::use_at || is_Mat<typename Proxy<derived>::stored_type>::value)
{
@@ -512,7 +512,7 @@ inline
bool
Base<elem_type,derived>::is_trimatu() const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const quasi_unwrap<derived> U( (*this).get_ref() );
@@ -530,7 +530,7 @@ inline
bool
Base<elem_type,derived>::is_trimatl() const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const quasi_unwrap<derived> U( (*this).get_ref() );
@@ -548,7 +548,7 @@ inline
bool
Base<elem_type,derived>::is_diagmat() const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const quasi_unwrap<derived> U( (*this).get_ref() );
@@ -587,7 +587,7 @@ inline
bool
Base<elem_type,derived>::is_empty() const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const Proxy<derived> P( (*this).get_ref() );
@@ -601,7 +601,7 @@ inline
bool
Base<elem_type,derived>::is_square() const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const Proxy<derived> P( (*this).get_ref() );
@@ -615,7 +615,7 @@ inline
bool
Base<elem_type,derived>::is_vec() const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
if( (Proxy<derived>::is_row) || (Proxy<derived>::is_col) || (Proxy<derived>::is_xvec) ) { return true; }
@@ -631,7 +631,7 @@ inline
bool
Base<elem_type,derived>::is_colvec() const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
if(Proxy<derived>::is_col) { return true; }
@@ -647,7 +647,7 @@ inline
bool
Base<elem_type,derived>::is_rowvec() const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
if(Proxy<derived>::is_row) { return true; }
@@ -663,9 +663,9 @@ inline
bool
Base<elem_type,derived>::is_finite() const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
if(arma_config::fast_math) { arma_debug_warn_level(2, "is_finite(): detection of non-finite values is not reliable in fast math mode"); }
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)
{
@@ -685,7 +685,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 +696,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; }
}
}
}
@@ -711,9 +711,9 @@ inline
bool
Base<elem_type,derived>::has_inf() const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
if(arma_config::fast_math) { arma_debug_warn_level(2, "has_inf(): detection of non-finite values is not reliable in fast math mode"); }
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)
{
@@ -759,9 +759,9 @@ inline
bool
Base<elem_type,derived>::has_nan() const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
if(arma_config::fast_math) { arma_debug_warn_level(2, "has_nan(): detection of non-finite values is not reliable in fast math mode"); }
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)
{
@@ -807,9 +807,9 @@ inline
bool
Base<elem_type,derived>::has_nonfinite() const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
if(arma_config::fast_math) { arma_debug_warn_level(2, "has_nonfinite(): detection of non-finite values is not reliable in fast math mode"); }
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)
{
@@ -829,7 +829,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 +840,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; }
}
}
}
@@ -888,7 +888,7 @@ inline
bool
Base_extra_yes<elem_type,derived>::is_sympd() const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
typedef typename get_pod_type<elem_type>::result T;
@@ -913,11 +913,11 @@ inline
bool
Base_extra_yes<elem_type,derived>::is_sympd(typename get_pod_type<elem_type>::result tol) const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
typedef typename get_pod_type<elem_type>::result T;
arma_debug_check( (tol < T(0)), "is_sympd(): parameter 'tol' must be >= 0" );
arma_conform_check( (tol < T(0)), "is_sympd(): parameter 'tol' must be >= 0" );
Mat<elem_type> X = static_cast<const derived&>(*this);
@@ -940,7 +940,7 @@ arma_inline
const derived&
Base_eval_Mat<elem_type, derived>::eval() const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
return static_cast<const derived&>(*this);
}
@@ -955,7 +955,7 @@ inline
Mat<elem_type>
Base_eval_expr<elem_type, derived>::eval() const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
return Mat<elem_type>( static_cast<const derived&>(*this) );
}
+9 -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,
@@ -67,6 +67,9 @@ 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);
@@ -88,7 +91,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;
@@ -138,7 +141,7 @@ 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);
[[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);
@@ -184,6 +187,8 @@ class Col<eT>::fixed : public Col<eT>
{
private:
using Mat<eT>::mem_local;
static constexpr bool use_extra = (fixed_n_elem > arma_config::mat_prealloc);
arma_align_mem eT mem_local_extra[ (use_extra) ? fixed_n_elem : 1 ];
File diff suppressed because it is too large Load Diff
+8 -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,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;
@@ -33,8 +31,11 @@ class CubeToMatOp : public Base< typename T1::elem_type, CubeToMatOp<T1, op_type
inline CubeToMatOp(const T1& in_m, const uword in_aux_uword);
inline ~CubeToMatOp();
arma_aligned const T1& m; //!< the operand; must be derived from BaseCube
arma_aligned uword aux_uword; //!< auxiliary data, uword format
const T1& m; //!< the operand; must be derived from BaseCube
uword aux_uword; //!< auxiliary data, uword format
template<typename eT2>
constexpr bool is_alias(const Mat<eT2>&) const { return false; }
static constexpr bool is_row = op_type::template traits<T1>::is_row;
static constexpr bool is_col = op_type::template traits<T1>::is_col;
+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,
@@ -26,7 +26,7 @@ inline
CubeToMatOp<T1, op_type>::CubeToMatOp(const T1& in_m)
: m(in_m)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
@@ -37,7 +37,7 @@ CubeToMatOp<T1, op_type>::CubeToMatOp(const T1& in_m, const uword in_aux_uword)
: m(in_m)
, aux_uword(in_aux_uword)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
@@ -46,7 +46,7 @@ template<typename T1, typename op_type>
inline
CubeToMatOp<T1, op_type>::~CubeToMatOp()
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
+52 -49
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,
@@ -62,7 +62,7 @@ class Cube : public BaseCube< eT, Cube<eT> >
#if defined(ARMA_USE_OPENMP)
using raw_mat_ptr_type = mat_type*;
using atomic_mat_ptr_type = mat_type*;
#elif (!defined(ARMA_DONT_USE_STD_MUTEX))
#elif defined(ARMA_USE_STD_MUTEX)
using raw_mat_ptr_type = mat_type*;
using atomic_mat_ptr_type = std::atomic<mat_type*>;
#else
@@ -72,7 +72,7 @@ class Cube : public BaseCube< eT, Cube<eT> >
atomic_mat_ptr_type* mat_ptrs = nullptr;
#if (!defined(ARMA_DONT_USE_STD_MUTEX))
#if defined(ARMA_USE_STD_MUTEX)
mutable std::mutex mat_mutex; // required for slice()
#endif
@@ -197,10 +197,10 @@ class Cube : public BaseCube< eT, Cube<eT> >
template<typename T1> inline subview_cube_each2<eT, T1> each_slice(const Base<uword, T1>& indices);
template<typename T1> inline const subview_cube_each2<eT, T1> each_slice(const Base<uword, T1>& indices) const;
inline const Cube& each_slice(const std::function< void( Mat<eT>&) >& F);
inline Cube& each_slice(const std::function< void( Mat<eT>&) >& F);
inline const Cube& each_slice(const std::function< void(const Mat<eT>&) >& F) const;
inline const Cube& each_slice(const std::function< void( Mat<eT>&) >& F, const bool use_mp);
inline Cube& each_slice(const std::function< void( Mat<eT>&) >& F, const bool use_mp);
inline const Cube& each_slice(const std::function< void(const Mat<eT>&) >& F, const bool use_mp) const;
@@ -218,9 +218,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);
@@ -334,47 +334,47 @@ class Cube : public BaseCube< eT, Cube<eT> >
arma_warn_unused arma_inline eT* slice_colptr(const uword in_slice, const uword in_col);
arma_warn_unused arma_inline const eT* slice_colptr(const uword in_slice, const uword in_col) const;
inline void set_size(const uword new_n_rows, const uword new_n_cols, const uword new_n_slices);
inline void set_size(const SizeCube& s);
inline Cube& set_size(const uword new_n_rows, const uword new_n_cols, const uword new_n_slices);
inline Cube& set_size(const SizeCube& s);
inline void reshape(const uword new_n_rows, const uword new_n_cols, const uword new_n_slices);
inline void reshape(const SizeCube& s);
inline Cube& reshape(const uword new_n_rows, const uword new_n_cols, const uword new_n_slices);
inline Cube& reshape(const SizeCube& s);
inline void resize(const uword new_n_rows, const uword new_n_cols, const uword new_n_slices);
inline void resize(const SizeCube& s);
inline Cube& resize(const uword new_n_rows, const uword new_n_cols, const uword new_n_slices);
inline Cube& resize(const SizeCube& s);
template<typename eT2> inline void copy_size(const Cube<eT2>& m);
template<typename eT2> inline Cube& copy_size(const Cube<eT2>& m);
template<typename functor> inline const Cube& for_each(functor F);
template<typename functor> inline Cube& for_each(functor F);
template<typename functor> inline const Cube& for_each(functor F) const;
template<typename functor> inline const Cube& transform(functor F);
template<typename functor> inline const Cube& imbue(functor F);
template<typename functor> inline Cube& transform(functor F);
template<typename functor> inline Cube& imbue(functor F);
inline const Cube& replace(const eT old_val, const eT new_val);
inline Cube& replace(const eT old_val, const eT new_val);
inline const Cube& clean(const pod_type threshold);
inline Cube& clean(const pod_type threshold);
inline const Cube& clamp(const eT min_val, const eT max_val);
inline Cube& clamp(const eT min_val, const eT max_val);
inline const Cube& fill(const eT val);
inline Cube& fill(const eT val);
inline const Cube& zeros();
inline const Cube& zeros(const uword new_n_rows, const uword new_n_cols, const uword new_n_slices);
inline const Cube& zeros(const SizeCube& s);
inline 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);
inline const Cube& ones();
inline const Cube& ones(const uword new_n_rows, const uword new_n_cols, const uword new_n_slices);
inline const Cube& ones(const SizeCube& s);
inline Cube& ones();
inline Cube& ones(const uword new_n_rows, const uword new_n_cols, const uword new_n_slices);
inline Cube& ones(const SizeCube& s);
inline const Cube& randu();
inline const Cube& randu(const uword new_n_rows, const uword new_n_cols, const uword new_n_slices);
inline const Cube& randu(const SizeCube& s);
inline Cube& randu();
inline Cube& randu(const uword new_n_rows, const uword new_n_cols, const uword new_n_slices);
inline Cube& randu(const SizeCube& s);
inline const Cube& randn();
inline const Cube& randn(const uword new_n_rows, const uword new_n_cols, const uword new_n_slices);
inline const Cube& randn(const SizeCube& s);
inline Cube& randn();
inline Cube& randn(const uword new_n_rows, const uword new_n_cols, const uword new_n_slices);
inline Cube& randn(const SizeCube& s);
inline void reset();
inline void soft_reset();
@@ -387,12 +387,11 @@ class Cube : public BaseCube< eT, Cube<eT> >
arma_warn_unused inline eT min() const;
arma_warn_unused inline eT max() const;
inline eT min(uword& index_of_min_val) const;
inline eT max(uword& index_of_max_val) const;
inline eT min(uword& row_of_min_val, uword& col_of_min_val, uword& slice_of_min_val) const;
inline eT max(uword& row_of_max_val, uword& col_of_max_val, uword& slice_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;
[[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;
@@ -402,13 +401,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
@@ -465,11 +464,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:
@@ -486,6 +486,9 @@ class Cube<eT>::fixed : public Cube<eT>
{
private:
using Cube<eT>::mat_ptrs_local;
using Cube<eT>::mem_local;
static constexpr uword fixed_n_elem = fixed_n_rows * fixed_n_cols * fixed_n_slices;
static constexpr uword fixed_n_elem_slice = fixed_n_rows * fixed_n_cols;
File diff suppressed because it is too large Load Diff
+6 -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,
@@ -22,20 +22,18 @@
//! 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);
arma_aligned const uword n_rows;
arma_aligned const uword n_cols;
arma_aligned const uword n_slices;
const uword n_rows;
const uword n_cols;
const uword n_slices;
arma_inline GenCube(const uword in_n_rows, const uword in_n_cols, const uword in_n_slices);
arma_inline ~GenCube();
+15 -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,
@@ -28,7 +28,7 @@ GenCube<eT, gen_type>::GenCube(const uword in_n_rows, const uword in_n_cols, con
, n_cols (in_n_cols )
, n_slices(in_n_slices)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
@@ -37,7 +37,7 @@ template<typename eT, typename gen_type>
arma_inline
GenCube<eT, gen_type>::~GenCube()
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
@@ -86,10 +86,10 @@ inline
void
GenCube<eT, gen_type>::apply(Cube<eT>& out) const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
// NOTE: we're assuming that the cube has already been set to the correct size;
// this is done by either the Cube contructor or operator=()
// this is done by either the Cube constructor or operator=()
if(is_same_type<gen_type, gen_zeros>::yes) { out.zeros(); }
else if(is_same_type<gen_type, gen_ones >::yes) { out.ones(); }
@@ -102,9 +102,9 @@ inline
void
GenCube<eT, gen_type>::apply_inplace_plus(Cube<eT>& out) const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
arma_debug_assert_same_size(out.n_rows, out.n_cols, out.n_slices, n_rows, n_cols, n_slices, "addition");
arma_conform_assert_same_size(out.n_rows, out.n_cols, out.n_slices, n_rows, n_cols, n_slices, "addition");
if(is_same_type<gen_type, gen_ones>::yes)
{
@@ -120,9 +120,9 @@ inline
void
GenCube<eT, gen_type>::apply_inplace_minus(Cube<eT>& out) const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
arma_debug_assert_same_size(out.n_rows, out.n_cols, out.n_slices, n_rows, n_cols, n_slices, "subtraction");
arma_conform_assert_same_size(out.n_rows, out.n_cols, out.n_slices, n_rows, n_cols, n_slices, "subtraction");
if(is_same_type<gen_type, gen_ones>::yes)
{
@@ -138,9 +138,9 @@ inline
void
GenCube<eT, gen_type>::apply_inplace_schur(Cube<eT>& out) const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
arma_debug_assert_same_size(out.n_rows, out.n_cols, out.n_slices, n_rows, n_cols, n_slices, "element-wise multiplication");
arma_conform_assert_same_size(out.n_rows, out.n_cols, out.n_slices, n_rows, n_cols, n_slices, "element-wise multiplication");
if(is_same_type<gen_type, gen_zeros>::yes)
{
@@ -157,9 +157,9 @@ inline
void
GenCube<eT, gen_type>::apply_inplace_div(Cube<eT>& out) const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
arma_debug_assert_same_size(out.n_rows, out.n_cols, out.n_slices, n_rows, n_cols, n_slices, "element-wise division");
arma_conform_assert_same_size(out.n_rows, out.n_cols, out.n_slices, n_rows, n_cols, n_slices, "element-wise division");
if(is_same_type<gen_type, gen_zeros>::yes)
{
@@ -174,7 +174,7 @@ inline
void
GenCube<eT, gen_type>::apply(subview_cube<eT>& out) const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
// NOTE: we're assuming that the subcube has the same dimensions as the GenCube object
// this is checked by subview_cube::operator=()
+8 -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,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,8 +35,8 @@ class Gen
static constexpr bool is_col = T1::is_col;
static constexpr bool is_xvec = T1::is_xvec;
arma_aligned const uword n_rows;
arma_aligned const uword n_cols;
const uword n_rows;
const uword n_cols;
arma_inline Gen(const uword in_n_rows, const uword in_n_cols);
arma_inline ~Gen();
@@ -54,6 +52,9 @@ class Gen
inline void apply_inplace_div (Mat<elem_type>& out) const;
inline void apply(subview<elem_type>& out) const;
template<typename eT2>
constexpr bool is_alias(const Mat<eT2>&) const { return false; }
};
+15 -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,
@@ -27,7 +27,7 @@ Gen<T1, gen_type>::Gen(const uword in_n_rows, const uword in_n_cols)
: n_rows(in_n_rows)
, n_cols(in_n_cols)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
@@ -36,7 +36,7 @@ template<typename T1, typename gen_type>
arma_inline
Gen<T1, gen_type>::~Gen()
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
@@ -88,10 +88,10 @@ inline
void
Gen<T1, gen_type>::apply(Mat<typename T1::elem_type>& out) const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
// NOTE: we're assuming that the matrix has already been set to the correct size;
// this is done by either the Mat contructor or operator=()
// this is done by either the Mat constructor or operator=()
if(is_same_type<gen_type, gen_zeros>::yes) { out.zeros(); }
else if(is_same_type<gen_type, gen_ones >::yes) { out.ones(); }
@@ -105,9 +105,9 @@ inline
void
Gen<T1, gen_type>::apply_inplace_plus(Mat<typename T1::elem_type>& out) const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
arma_debug_assert_same_size(out.n_rows, out.n_cols, n_rows, n_cols, "addition");
arma_conform_assert_same_size(out.n_rows, out.n_cols, n_rows, n_cols, "addition");
typedef typename T1::elem_type eT;
@@ -132,9 +132,9 @@ inline
void
Gen<T1, gen_type>::apply_inplace_minus(Mat<typename T1::elem_type>& out) const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
arma_debug_assert_same_size(out.n_rows, out.n_cols, n_rows, n_cols, "subtraction");
arma_conform_assert_same_size(out.n_rows, out.n_cols, n_rows, n_cols, "subtraction");
typedef typename T1::elem_type eT;
@@ -159,9 +159,9 @@ inline
void
Gen<T1, gen_type>::apply_inplace_schur(Mat<typename T1::elem_type>& out) const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
arma_debug_assert_same_size(out.n_rows, out.n_cols, n_rows, n_cols, "element-wise multiplication");
arma_conform_assert_same_size(out.n_rows, out.n_cols, n_rows, n_cols, "element-wise multiplication");
typedef typename T1::elem_type eT;
@@ -189,9 +189,9 @@ inline
void
Gen<T1, gen_type>::apply_inplace_div(Mat<typename T1::elem_type>& out) const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
arma_debug_assert_same_size(out.n_rows, out.n_cols, n_rows, n_cols, "element-wise division");
arma_conform_assert_same_size(out.n_rows, out.n_cols, n_rows, n_cols, "element-wise division");
typedef typename T1::elem_type eT;
@@ -217,7 +217,7 @@ inline
void
Gen<T1, gen_type>::apply(subview<typename T1::elem_type>& out) const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
// NOTE: we're assuming that the submatrix has the same dimensions as the Gen object
// this is checked by subview::operator=()
+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,
@@ -23,10 +23,8 @@
//! 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;
+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,
@@ -27,7 +27,7 @@ GlueCube<T1,T2,glue_type>::GlueCube(const BaseCube<typename T1::elem_type, T1>&
: A(in_A.get_ref())
, B(in_B.get_ref())
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
@@ -36,7 +36,7 @@ template<typename T1, typename T2, typename glue_type>
inline
GlueCube<T1,T2,glue_type>::~GlueCube()
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
+6 -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,12 +43,10 @@ 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;
@@ -56,6 +54,9 @@ class Glue
inline Glue(const T1& in_A, const T2& in_B, const uword in_aux_uword);
inline ~Glue();
template<typename eT2>
inline bool is_alias(const Mat<eT2>& X) const;
const T1& A; //!< first operand; must be derived from Base
const T2& B; //!< second operand; must be derived from Base
uword aux_uword; //!< storage of auxiliary data, uword format
+18 -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,
@@ -27,7 +27,7 @@ Glue<T1,T2,glue_type>::Glue(const T1& in_A, const T2& in_B)
: A(in_A)
, B(in_B)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
@@ -39,7 +39,7 @@ Glue<T1,T2,glue_type>::Glue(const T1& in_A, const T2& in_B, const uword in_aux_u
, B(in_B)
, aux_uword(in_aux_uword)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
@@ -48,7 +48,20 @@ template<typename T1, typename T2, typename glue_type>
inline
Glue<T1,T2,glue_type>::~Glue()
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
template<typename T1, typename T2, typename glue_type>
template<typename eT2>
inline
bool
Glue<T1,T2,glue_type>::is_alias(const Mat<eT2>& X) const
{
arma_debug_sigprint();
return (A.is_alias(X) || B.is_alias(X));
}
+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,
+127 -140
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,
@@ -25,12 +25,12 @@ template<typename eT>
inline
MapMat<eT>::~MapMat()
{
arma_extra_debug_sigprint_this(this);
arma_debug_sigprint_this(this);
if(map_ptr) { (*map_ptr).clear(); delete map_ptr; }
// try to expose buggy user code that accesses deleted objects
if(arma_config::debug) { map_ptr = nullptr; }
map_ptr = nullptr;
arma_type_check(( is_supported_elem_type<eT>::value == false ));
}
@@ -45,7 +45,7 @@ MapMat<eT>::MapMat()
, n_elem (0)
, map_ptr(nullptr)
{
arma_extra_debug_sigprint_this(this);
arma_debug_sigprint_this(this);
init_cold();
}
@@ -60,7 +60,7 @@ MapMat<eT>::MapMat(const uword in_n_rows, const uword in_n_cols)
, n_elem (in_n_rows * in_n_cols)
, map_ptr(nullptr)
{
arma_extra_debug_sigprint_this(this);
arma_debug_sigprint_this(this);
init_cold();
}
@@ -75,7 +75,7 @@ MapMat<eT>::MapMat(const SizeMat& s)
, n_elem (s.n_rows * s.n_cols)
, map_ptr(nullptr)
{
arma_extra_debug_sigprint_this(this);
arma_debug_sigprint_this(this);
init_cold();
}
@@ -90,7 +90,7 @@ MapMat<eT>::MapMat(const MapMat<eT>& x)
, n_elem (0)
, map_ptr(nullptr)
{
arma_extra_debug_sigprint_this(this);
arma_debug_sigprint_this(this);
init_cold();
@@ -104,9 +104,14 @@ inline
void
MapMat<eT>::operator=(const MapMat<eT>& x)
{
arma_extra_debug_sigprint();
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;
@@ -125,7 +130,7 @@ MapMat<eT>::MapMat(const SpMat<eT>& x)
, n_elem (0)
, map_ptr(nullptr)
{
arma_extra_debug_sigprint_this(this);
arma_debug_sigprint_this(this);
init_cold();
@@ -139,7 +144,7 @@ inline
void
MapMat<eT>::operator=(const SpMat<eT>& x)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const uword x_n_rows = x.n_rows;
const uword x_n_cols = x.n_cols;
@@ -181,7 +186,7 @@ MapMat<eT>::MapMat(MapMat<eT>&& x)
, n_elem (x.n_elem )
, map_ptr(x.map_ptr)
{
arma_extra_debug_sigprint_this(this);
arma_debug_sigprint_this(this);
access::rw(x.n_rows) = 0;
access::rw(x.n_cols) = 0;
@@ -196,7 +201,7 @@ inline
void
MapMat<eT>::operator=(MapMat<eT>&& x)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
if(this == &x) { return; }
@@ -222,7 +227,7 @@ inline
void
MapMat<eT>::reset()
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
access::rw(n_rows) = 0;
access::rw(n_cols) = 0;
@@ -238,7 +243,7 @@ inline
void
MapMat<eT>::set_size(const uword in_n_rows)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
init_warm(in_n_rows, 1);
}
@@ -250,7 +255,7 @@ inline
void
MapMat<eT>::set_size(const uword in_n_rows, const uword in_n_cols)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
init_warm(in_n_rows, in_n_cols);
}
@@ -262,7 +267,7 @@ inline
void
MapMat<eT>::set_size(const SizeMat& s)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
init_warm(s.n_rows, s.n_cols);
}
@@ -274,7 +279,7 @@ inline
void
MapMat<eT>::zeros()
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
(*map_ptr).clear();
}
@@ -286,7 +291,7 @@ inline
void
MapMat<eT>::zeros(const uword in_n_rows)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
init_warm(in_n_rows, 1);
@@ -300,7 +305,7 @@ inline
void
MapMat<eT>::zeros(const uword in_n_rows, const uword in_n_cols)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
init_warm(in_n_rows, in_n_cols);
@@ -314,7 +319,7 @@ inline
void
MapMat<eT>::zeros(const SizeMat& s)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
init_warm(s.n_rows, s.n_cols);
@@ -328,7 +333,7 @@ inline
void
MapMat<eT>::eye()
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
(*this).eye(n_rows, n_cols);
}
@@ -340,7 +345,7 @@ inline
void
MapMat<eT>::eye(const uword in_n_rows, const uword in_n_cols)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
zeros(in_n_rows, in_n_cols);
@@ -363,7 +368,7 @@ inline
void
MapMat<eT>::eye(const SizeMat& s)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
(*this).eye(s.n_rows, s.n_cols);
}
@@ -375,7 +380,7 @@ inline
void
MapMat<eT>::speye()
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
(*this).eye();
}
@@ -387,7 +392,7 @@ inline
void
MapMat<eT>::speye(const uword in_n_rows, const uword in_n_cols)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
(*this).eye(in_n_rows, in_n_cols);
}
@@ -399,7 +404,7 @@ inline
void
MapMat<eT>::speye(const SizeMat& s)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
(*this).eye(s);
}
@@ -436,7 +441,7 @@ arma_inline
MapMat_val<eT>
MapMat<eT>::operator()(const uword index)
{
arma_debug_check_bounds( (index >= n_elem), "MapMat::operator(): index out of bounds" );
arma_conform_check_bounds( (index >= n_elem), "MapMat::operator(): index out of bounds" );
return MapMat_val<eT>(*this, index);
}
@@ -448,7 +453,7 @@ inline
eT
MapMat<eT>::operator()(const uword index) const
{
arma_debug_check_bounds( (index >= n_elem), "MapMat::operator(): index out of bounds" );
arma_conform_check_bounds( (index >= n_elem), "MapMat::operator(): index out of bounds" );
map_type& map_ref = (*map_ptr);
@@ -494,7 +499,7 @@ arma_inline
MapMat_val<eT>
MapMat<eT>::operator()(const uword in_row, const uword in_col)
{
arma_debug_check_bounds( ((in_row >= n_rows) || (in_col >= n_cols)), "MapMat::operator(): index out of bounds" );
arma_conform_check_bounds( ((in_row >= n_rows) || (in_col >= n_cols)), "MapMat::operator(): index out of bounds" );
const uword index = (n_rows * in_col) + in_row;
@@ -508,7 +513,7 @@ inline
eT
MapMat<eT>::operator()(const uword in_row, const uword in_col) const
{
arma_debug_check_bounds( ((in_row >= n_rows) || (in_col >= n_cols)), "MapMat::operator(): index out of bounds" );
arma_conform_check_bounds( ((in_row >= n_rows) || (in_col >= n_cols)), "MapMat::operator(): index out of bounds" );
const uword index = (n_rows * in_col) + in_row;
@@ -579,7 +584,7 @@ inline
void
MapMat<eT>::sprandu(const uword in_n_rows, const uword in_n_cols, const double density)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
zeros(in_n_rows, in_n_cols);
@@ -610,7 +615,7 @@ inline
void
MapMat<eT>::print(const std::string& extra_text) const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
if(extra_text.length() != 0)
{
@@ -662,7 +667,7 @@ inline
uword
MapMat<eT>::get_n_nonzero() const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
return uword((*map_ptr).size());
}
@@ -674,7 +679,7 @@ inline
void
MapMat<eT>::get_locval_format(umat& locs, Col<eT>& vals) const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
map_type& map_ref = (*map_ptr);
@@ -715,7 +720,7 @@ inline
void
MapMat<eT>::init_cold()
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
// ensure that n_elem can hold the result of (n_rows * n_cols)
@@ -725,7 +730,7 @@ MapMat<eT>::init_cold()
const char* error_message = "MapMat(): requested size is too large; suggest to enable ARMA_64BIT_WORD";
#endif
arma_debug_check
arma_conform_check
(
(
( (n_rows > ARMA_MAX_UHWORD) || (n_cols > ARMA_MAX_UHWORD) )
@@ -747,7 +752,7 @@ inline
void
MapMat<eT>::init_warm(const uword in_n_rows, const uword in_n_cols)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
if( (n_rows == in_n_rows) && (n_cols == in_n_cols)) { return; }
@@ -759,7 +764,7 @@ MapMat<eT>::init_warm(const uword in_n_rows, const uword in_n_cols)
const char* error_message = "MapMat(): requested size is too large; suggest to enable ARMA_64BIT_WORD";
#endif
arma_debug_check
arma_conform_check
(
(
( (in_n_rows > ARMA_MAX_UHWORD) || (in_n_cols > ARMA_MAX_UHWORD) )
@@ -785,7 +790,7 @@ arma_inline
void
MapMat<eT>::set_val(const uword index, const eT& in_val)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
if(in_val != eT(0))
{
@@ -813,7 +818,7 @@ inline
void
MapMat<eT>::erase_val(const uword index)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
map_type& map_ref = (*map_ptr);
@@ -838,7 +843,7 @@ MapMat_val<eT>::MapMat_val(MapMat<eT>& in_parent, const uword in_index)
: parent(in_parent)
, index (in_index )
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
@@ -847,7 +852,7 @@ template<typename eT>
arma_inline
MapMat_val<eT>::operator eT() const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const MapMat<eT>& const_parent = parent;
@@ -861,7 +866,7 @@ arma_inline
typename get_pod_type<eT>::result
MapMat_val<eT>::real() const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
typedef typename get_pod_type<eT>::result T;
@@ -877,7 +882,7 @@ arma_inline
typename get_pod_type<eT>::result
MapMat_val<eT>::imag() const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
typedef typename get_pod_type<eT>::result T;
@@ -893,7 +898,7 @@ arma_inline
void
MapMat_val<eT>::operator=(const MapMat_val<eT>& x)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const eT in_val = eT(x);
@@ -907,7 +912,7 @@ arma_inline
void
MapMat_val<eT>::operator=(const eT in_val)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
parent.set_val(index, in_val);
}
@@ -919,7 +924,7 @@ arma_inline
void
MapMat_val<eT>::operator+=(const eT in_val)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
typename MapMat<eT>::map_type& map_ref = *(parent.map_ptr);
@@ -940,7 +945,7 @@ arma_inline
void
MapMat_val<eT>::operator-=(const eT in_val)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
typename MapMat<eT>::map_type& map_ref = *(parent.map_ptr);
@@ -961,7 +966,7 @@ arma_inline
void
MapMat_val<eT>::operator*=(const eT in_val)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
typename MapMat<eT>::map_type& map_ref = *(parent.map_ptr);
@@ -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); }
}
}
@@ -992,7 +996,7 @@ arma_inline
void
MapMat_val<eT>::operator/=(const eT in_val)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
typename MapMat<eT>::map_type& map_ref = *(parent.map_ptr);
@@ -1009,9 +1013,7 @@ MapMat_val<eT>::operator/=(const eT in_val)
}
else
{
// silly operation, but included for completness
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); }
}
@@ -1024,7 +1026,7 @@ arma_inline
void
MapMat_val<eT>::operator++()
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
typename MapMat<eT>::map_type& map_ref = *(parent.map_ptr);
@@ -1042,7 +1044,7 @@ arma_inline
void
MapMat_val<eT>::operator++(int)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
(*this).operator++();
}
@@ -1054,7 +1056,7 @@ arma_inline
void
MapMat_val<eT>::operator--()
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
typename MapMat<eT>::map_type& map_ref = *(parent.map_ptr);
@@ -1072,7 +1074,7 @@ arma_inline
void
MapMat_val<eT>::operator--(int)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
(*this).operator--();
}
@@ -1093,7 +1095,7 @@ SpMat_MapMat_val<eT>::SpMat_MapMat_val(SpMat<eT>& in_s_parent, MapMat<eT>& in_m_
, row (in_row )
, col (in_col )
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
@@ -1102,7 +1104,7 @@ template<typename eT>
inline
SpMat_MapMat_val<eT>::operator eT() const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const SpMat<eT>& const_s_parent = s_parent; // declare as const for clarity of intent
@@ -1116,7 +1118,7 @@ inline
typename get_pod_type<eT>::result
SpMat_MapMat_val<eT>::real() const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
typedef typename get_pod_type<eT>::result T;
@@ -1132,7 +1134,7 @@ inline
typename get_pod_type<eT>::result
SpMat_MapMat_val<eT>::imag() const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
typedef typename get_pod_type<eT>::result T;
@@ -1148,7 +1150,7 @@ inline
SpMat_MapMat_val<eT>&
SpMat_MapMat_val<eT>::operator=(const SpMat_MapMat_val<eT>& x)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const eT in_val = eT(x);
@@ -1162,7 +1164,7 @@ inline
SpMat_MapMat_val<eT>&
SpMat_MapMat_val<eT>::operator=(const eT in_val)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
#if defined(ARMA_USE_OPENMP)
{
@@ -1171,7 +1173,7 @@ SpMat_MapMat_val<eT>::operator=(const eT in_val)
(*this).set(in_val);
}
}
#elif (!defined(ARMA_DONT_USE_STD_MUTEX))
#elif defined(ARMA_USE_STD_MUTEX)
{
const std::lock_guard<std::mutex> lock(s_parent.cache_mutex);
@@ -1193,7 +1195,7 @@ inline
SpMat_MapMat_val<eT>&
SpMat_MapMat_val<eT>::operator+=(const eT in_val)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
if(in_val == eT(0)) { return *this; }
@@ -1204,7 +1206,7 @@ SpMat_MapMat_val<eT>::operator+=(const eT in_val)
(*this).add(in_val);
}
}
#elif (!defined(ARMA_DONT_USE_STD_MUTEX))
#elif defined(ARMA_USE_STD_MUTEX)
{
const std::lock_guard<std::mutex> lock(s_parent.cache_mutex);
@@ -1226,7 +1228,7 @@ inline
SpMat_MapMat_val<eT>&
SpMat_MapMat_val<eT>::operator-=(const eT in_val)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
if(in_val == eT(0)) { return *this; }
@@ -1237,7 +1239,7 @@ SpMat_MapMat_val<eT>::operator-=(const eT in_val)
(*this).sub(in_val);
}
}
#elif (!defined(ARMA_DONT_USE_STD_MUTEX))
#elif defined(ARMA_USE_STD_MUTEX)
{
const std::lock_guard<std::mutex> lock(s_parent.cache_mutex);
@@ -1259,7 +1261,7 @@ inline
SpMat_MapMat_val<eT>&
SpMat_MapMat_val<eT>::operator*=(const eT in_val)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
#if defined(ARMA_USE_OPENMP)
{
@@ -1268,7 +1270,7 @@ SpMat_MapMat_val<eT>::operator*=(const eT in_val)
(*this).mul(in_val);
}
}
#elif (!defined(ARMA_DONT_USE_STD_MUTEX))
#elif defined(ARMA_USE_STD_MUTEX)
{
const std::lock_guard<std::mutex> lock(s_parent.cache_mutex);
@@ -1290,7 +1292,7 @@ inline
SpMat_MapMat_val<eT>&
SpMat_MapMat_val<eT>::operator/=(const eT in_val)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
#if defined(ARMA_USE_OPENMP)
{
@@ -1299,7 +1301,7 @@ SpMat_MapMat_val<eT>::operator/=(const eT in_val)
(*this).div(in_val);
}
}
#elif (!defined(ARMA_DONT_USE_STD_MUTEX))
#elif defined(ARMA_USE_STD_MUTEX)
{
const std::lock_guard<std::mutex> lock(s_parent.cache_mutex);
@@ -1321,7 +1323,7 @@ inline
SpMat_MapMat_val<eT>&
SpMat_MapMat_val<eT>::operator++()
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
return (*this).operator+=( eT(1) );
}
@@ -1333,7 +1335,7 @@ inline
eT
SpMat_MapMat_val<eT>::operator++(int)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const eT old_val = eT(*this);
@@ -1349,7 +1351,7 @@ inline
SpMat_MapMat_val<eT>&
SpMat_MapMat_val<eT>::operator--()
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
return (*this).operator-=( eT(1) );
}
@@ -1361,7 +1363,7 @@ inline
eT
SpMat_MapMat_val<eT>::operator--(int)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const eT old_val = eT(*this);
@@ -1377,7 +1379,7 @@ inline
void
SpMat_MapMat_val<eT>::set(const eT in_val)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const bool done = (s_parent.sync_state == 0) ? s_parent.try_set_value_csc(row, col, in_val) : false;
@@ -1402,7 +1404,7 @@ inline
void
SpMat_MapMat_val<eT>::add(const eT in_val)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const bool done = (s_parent.sync_state == 0) ? s_parent.try_add_value_csc(row, col, in_val) : false;
@@ -1433,7 +1435,7 @@ inline
void
SpMat_MapMat_val<eT>::sub(const eT in_val)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const bool done = (s_parent.sync_state == 0) ? s_parent.try_sub_value_csc(row, col, in_val) : false;
@@ -1464,7 +1466,7 @@ inline
void
SpMat_MapMat_val<eT>::mul(const eT in_val)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const bool done = (s_parent.sync_state == 0) ? s_parent.try_mul_value_csc(row, col, in_val) : false;
@@ -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();
}
}
}
@@ -1525,7 +1516,7 @@ inline
void
SpMat_MapMat_val<eT>::div(const eT in_val)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const bool done = (s_parent.sync_state == 0) ? s_parent.try_div_value_csc(row, col, in_val) : false;
@@ -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();
}
}
}
@@ -1585,7 +1572,7 @@ SpSubview_MapMat_val<eT>::SpSubview_MapMat_val(SpSubview<eT>& in_sv_parent, MapM
: SpMat_MapMat_val<eT>(access::rw(in_sv_parent.m), in_m_parent, in_row, in_col)
, sv_parent(in_sv_parent)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
@@ -1595,7 +1582,7 @@ inline
SpSubview_MapMat_val<eT>&
SpSubview_MapMat_val<eT>::operator=(const SpSubview_MapMat_val<eT>& x)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const eT in_val = eT(x);
@@ -1609,7 +1596,7 @@ inline
SpSubview_MapMat_val<eT>&
SpSubview_MapMat_val<eT>::operator=(const eT in_val)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const uword old_n_nonzero = sv_parent.m.n_nonzero;
@@ -1628,7 +1615,7 @@ inline
SpSubview_MapMat_val<eT>&
SpSubview_MapMat_val<eT>::operator+=(const eT in_val)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const uword old_n_nonzero = sv_parent.m.n_nonzero;
@@ -1647,7 +1634,7 @@ inline
SpSubview_MapMat_val<eT>&
SpSubview_MapMat_val<eT>::operator-=(const eT in_val)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const uword old_n_nonzero = sv_parent.m.n_nonzero;
@@ -1666,7 +1653,7 @@ inline
SpSubview_MapMat_val<eT>&
SpSubview_MapMat_val<eT>::operator*=(const eT in_val)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const uword old_n_nonzero = sv_parent.m.n_nonzero;
@@ -1685,7 +1672,7 @@ inline
SpSubview_MapMat_val<eT>&
SpSubview_MapMat_val<eT>::operator/=(const eT in_val)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const uword old_n_nonzero = sv_parent.m.n_nonzero;
@@ -1704,7 +1691,7 @@ inline
SpSubview_MapMat_val<eT>&
SpSubview_MapMat_val<eT>::operator++()
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const uword old_n_nonzero = sv_parent.m.n_nonzero;
@@ -1723,7 +1710,7 @@ inline
eT
SpSubview_MapMat_val<eT>::operator++(int)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const uword old_n_nonzero = sv_parent.m.n_nonzero;
@@ -1742,7 +1729,7 @@ inline
SpSubview_MapMat_val<eT>&
SpSubview_MapMat_val<eT>::operator--()
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const uword old_n_nonzero = sv_parent.m.n_nonzero;
@@ -1761,7 +1748,7 @@ inline
eT
SpSubview_MapMat_val<eT>::operator--(int)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const uword old_n_nonzero = sv_parent.m.n_nonzero;
+89 -65
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,
@@ -118,7 +118,7 @@ class Mat : public Base< eT, Mat<eT> >
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 use_colmem); // only to be used by the quasi_unwrap class
inline Mat(const subview<eT>& X);
inline Mat& operator= (const subview<eT>& X);
@@ -178,6 +178,8 @@ class Mat : public Base< eT, Mat<eT> >
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);
inline Mat& operator= (const spdiagview<eT>& X);
@@ -188,8 +190,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);
@@ -285,10 +287,10 @@ class Mat : public Base< eT, Mat<eT> >
template<typename T1> inline const subview_each2< Mat<eT>, 0, T1 > each_col(const Base<uword, T1>& indices) const;
template<typename T1> inline const subview_each2< Mat<eT>, 1, T1 > each_row(const Base<uword, T1>& indices) const;
inline const Mat& each_col(const std::function< void( Col<eT>&) >& F);
inline Mat& each_col(const std::function< void( Col<eT>&) >& F);
inline const Mat& each_col(const std::function< void(const Col<eT>&) >& F) const;
inline const Mat& each_row(const std::function< void( Row<eT>&) >& F);
inline Mat& each_row(const std::function< void( Row<eT>&) >& F);
inline const Mat& each_row(const std::function< void(const Row<eT>&) >& F) const;
@@ -308,8 +310,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_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 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);
@@ -366,6 +368,14 @@ 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);
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 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 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);
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);
@@ -393,6 +403,14 @@ 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);
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);
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);
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);
arma_warn_unused arma_inline const eT& at_alt (const uword ii) const;
@@ -454,63 +472,63 @@ class Mat : public Base< eT, Mat<eT> >
template<typename eT2, typename expr>
inline void copy_size(const Base<eT2,expr>& X);
inline Mat& copy_size(const Base<eT2,expr>& X);
inline void set_size(const uword new_n_elem);
inline void set_size(const uword new_n_rows, const uword new_n_cols);
inline void set_size(const SizeMat& s);
inline Mat& set_size(const uword new_n_elem);
inline Mat& set_size(const uword new_n_rows, const uword new_n_cols);
inline Mat& set_size(const SizeMat& s);
inline void resize(const uword new_n_elem);
inline void resize(const uword new_n_rows, const uword new_n_cols);
inline void resize(const SizeMat& s);
inline Mat& resize(const uword new_n_elem);
inline Mat& resize(const uword new_n_rows, const uword new_n_cols);
inline Mat& resize(const SizeMat& s);
inline void reshape(const uword new_n_rows, const uword new_n_cols);
inline void reshape(const SizeMat& s);
inline Mat& reshape(const uword new_n_rows, const uword new_n_cols);
inline Mat& reshape(const SizeMat& s);
arma_deprecated inline void reshape(const uword new_n_rows, const uword new_n_cols, const uword dim); //!< NOTE: don't use this form: it will be removed
[[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 const Mat& for_each(functor F);
template<typename functor> inline Mat& for_each(functor F);
template<typename functor> inline const Mat& for_each(functor F) const;
template<typename functor> inline const Mat& transform(functor F);
template<typename functor> inline const Mat& imbue(functor F);
template<typename functor> inline Mat& transform(functor F);
template<typename functor> inline Mat& imbue(functor F);
inline const Mat& replace(const eT old_val, const eT new_val);
inline Mat& replace(const eT old_val, const eT new_val);
inline const Mat& clean(const pod_type threshold);
inline Mat& clean(const pod_type threshold);
inline const Mat& clamp(const eT min_val, const eT max_val);
inline Mat& clamp(const eT min_val, const eT max_val);
inline const Mat& fill(const eT val);
inline Mat& fill(const eT val);
template<typename fill_type>
inline const Mat& fill(const fill::fill_class<fill_type>& f);
inline Mat& fill(const fill::fill_class<fill_type>& f);
inline const Mat& zeros();
inline const Mat& zeros(const uword new_n_elem);
inline const Mat& zeros(const uword new_n_rows, const uword new_n_cols);
inline const Mat& zeros(const SizeMat& s);
inline Mat& zeros();
inline Mat& zeros(const uword new_n_elem);
inline Mat& zeros(const uword new_n_rows, const uword new_n_cols);
inline Mat& zeros(const SizeMat& s);
inline const Mat& ones();
inline const Mat& ones(const uword new_n_elem);
inline const Mat& ones(const uword new_n_rows, const uword new_n_cols);
inline const Mat& ones(const SizeMat& s);
inline Mat& ones();
inline Mat& ones(const uword new_n_elem);
inline Mat& ones(const uword new_n_rows, const uword new_n_cols);
inline Mat& ones(const SizeMat& s);
inline const Mat& randu();
inline const Mat& randu(const uword new_n_elem);
inline const Mat& randu(const uword new_n_rows, const uword new_n_cols);
inline const Mat& randu(const SizeMat& s);
inline Mat& randu();
inline Mat& randu(const uword new_n_elem);
inline Mat& randu(const uword new_n_rows, const uword new_n_cols);
inline Mat& randu(const SizeMat& s);
inline const Mat& randn();
inline const Mat& randn(const uword new_n_elem);
inline const Mat& randn(const uword new_n_rows, const uword new_n_cols);
inline const Mat& randn(const SizeMat& s);
inline Mat& randn();
inline Mat& randn(const uword new_n_elem);
inline Mat& randn(const uword new_n_rows, const uword new_n_cols);
inline Mat& randn(const SizeMat& s);
inline const Mat& eye();
inline const Mat& eye(const uword new_n_rows, const uword new_n_cols);
inline const Mat& eye(const SizeMat& s);
inline Mat& eye();
inline Mat& eye(const uword new_n_rows, const uword new_n_cols);
inline Mat& eye(const SizeMat& s);
arma_cold inline void reset();
arma_cold inline void soft_reset();
@@ -523,11 +541,11 @@ class Mat : public Base< eT, Mat<eT> >
arma_warn_unused inline eT min() const;
arma_warn_unused inline eT max() const;
inline eT min(uword& index_of_min_val) const;
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;
inline eT min(uword& row_of_min_val, uword& col_of_min_val) const;
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;
@@ -540,15 +558,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_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(const csv_name& spec, const file_type type = csv_ascii) 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(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_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(const csv_name& spec, const file_type type = csv_ascii);
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(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
@@ -753,6 +771,9 @@ class Mat : public Base< eT, Mat<eT> >
inline void steal_mem_col(Mat& X, const uword max_n_rows);
template<typename eT2>
arma_inline bool is_alias(const Mat<eT2>& X) const; //!< don't use this unless you're writing code internal to Armadillo
template<uword fixed_n_rows, uword fixed_n_cols> class fixed;
@@ -780,13 +801,14 @@ class Mat : public Base< eT, Mat<eT> >
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:
@@ -804,6 +826,8 @@ class Mat<eT>::fixed : public Mat<eT>
{
private:
using Mat<eT>::mem_local;
static constexpr uword fixed_n_elem = fixed_n_rows * fixed_n_cols;
static constexpr bool use_extra = (fixed_n_elem > arma_config::mat_prealloc);
File diff suppressed because it is too large Load Diff
+8 -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,
@@ -21,10 +21,8 @@
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;
@@ -35,11 +33,11 @@ class OpCube : public BaseCube< typename T1::elem_type, OpCube<T1, op_type> >
inline OpCube(const BaseCube<typename T1::elem_type, T1>& in_m, const uword in_aux_uword_a, const uword in_aux_uword_b, const uword in_aux_uword_c);
inline ~OpCube();
arma_aligned const T1& m; //!< the operand; must be derived from BaseCube
arma_aligned elem_type aux; //!< auxiliary data, using the element type as used by T1
arma_aligned uword aux_uword_a; //!< auxiliary data, uword format
arma_aligned uword aux_uword_b; //!< auxiliary data, uword format
arma_aligned uword aux_uword_c; //!< auxiliary data, uword format
const T1& m; //!< the operand; must be derived from BaseCube
elem_type aux; //!< auxiliary data, using the element type as used by T1
uword aux_uword_a; //!< auxiliary data, uword format
uword aux_uword_b; //!< auxiliary data, uword format
uword aux_uword_c; //!< auxiliary data, uword format
};
+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,
@@ -25,7 +25,7 @@ template<typename T1, typename op_type>
OpCube<T1, op_type>::OpCube(const BaseCube<typename T1::elem_type, T1>& in_m)
: m(in_m.get_ref())
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
@@ -35,7 +35,7 @@ OpCube<T1, op_type>::OpCube(const BaseCube<typename T1::elem_type, T1>& in_m, co
: m(in_m.get_ref())
, aux(in_aux)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
@@ -47,7 +47,7 @@ OpCube<T1, op_type>::OpCube(const BaseCube<typename T1::elem_type, T1>& in_m, co
, aux_uword_b(in_aux_uword_b)
, aux_uword_c(in_aux_uword_c)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
@@ -59,7 +59,7 @@ OpCube<T1, op_type>::OpCube(const BaseCube<typename T1::elem_type, T1>& in_m, co
, aux_uword_a(in_aux_uword_a)
, aux_uword_b(in_aux_uword_b)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
@@ -71,7 +71,7 @@ OpCube<T1, op_type>::OpCube(const BaseCube<typename T1::elem_type, T1>& in_m, co
, aux_uword_b(in_aux_uword_b)
, aux_uword_c(in_aux_uword_c)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
@@ -79,7 +79,7 @@ OpCube<T1, op_type>::OpCube(const BaseCube<typename T1::elem_type, T1>& in_m, co
template<typename T1, typename op_type>
OpCube<T1, op_type>::~OpCube()
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
+10 -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,
@@ -43,12 +43,10 @@ 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;
@@ -58,10 +56,13 @@ class Op
inline Op(const T1& in_m, const uword in_aux_uword_a, const uword in_aux_uword_b);
inline ~Op();
arma_aligned const T1& m; //!< the operand; must be derived from Base
arma_aligned elem_type aux; //!< auxiliary data, using the element type as used by T1
arma_aligned uword aux_uword_a; //!< auxiliary data, uword format
arma_aligned uword aux_uword_b; //!< auxiliary data, uword format
template<typename eT2>
inline bool is_alias(const Mat<eT2>& X) const;
const T1& m; //!< the operand; must be derived from Base
elem_type aux; //!< auxiliary data, using the element type as used by T1
uword aux_uword_a; //!< auxiliary data, uword format
uword aux_uword_b; //!< auxiliary data, uword format
};
+20 -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,
@@ -26,7 +26,7 @@ inline
Op<T1, op_type>::Op(const T1& in_m)
: m(in_m)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
@@ -37,7 +37,7 @@ Op<T1, op_type>::Op(const T1& in_m, const typename T1::elem_type in_aux)
: m(in_m)
, aux(in_aux)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
@@ -50,7 +50,7 @@ Op<T1, op_type>::Op(const T1& in_m, const typename T1::elem_type in_aux, const u
, aux_uword_a(in_aux_uword_a)
, aux_uword_b(in_aux_uword_b)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
@@ -62,7 +62,7 @@ Op<T1, op_type>::Op(const T1& in_m, const uword in_aux_uword_a, const uword in_a
, aux_uword_a(in_aux_uword_a)
, aux_uword_b(in_aux_uword_b)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
@@ -71,7 +71,20 @@ template<typename T1, typename op_type>
inline
Op<T1, op_type>::~Op()
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
template<typename T1, typename op_type>
template<typename eT2>
inline
bool
Op<T1, op_type>::is_alias(const Mat<eT2>& X) const
{
arma_debug_sigprint();
return m.is_alias(X);
}
+204 -157
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,38 +20,38 @@
//! @{
// within each specialisation of the Proxy class:
// within each specialisation of the Proxy struct:
//
// elem_type = the type of the elements obtained from object Q
// pod_type = the underlying type of elements if elem_type is std::complex
// stored_type = the type of the Q object
// ea_type = the type of the object that provides access to elements via operator[i]
// aligned_ea_type = the type of the object that provides access to elements via at_alt(i)
// elem_type = type of the elements obtained from object Q
// pod_type = underlying type of elements if elem_type is std::complex
// stored_type = type of Q object
// ea_type = type of object that provides access to elements via operator[i]
// aligned_ea_type = type of object that provides access to elements via at_alt(i)
//
// use_at = boolean indicating whether at(row,col) must be used to get elements
// use_mp = boolean indicating whether OpenMP can be used while processing elements
// has_subview = boolean indicating whether the Q object has a subview
// use_at = boolean to indicate at(row,col) must be used to get elements
// use_mp = boolean to indicate OpenMP can be used while processing elements
// has_subview = boolean to indicate Q object has a subview
//
// is_row = boolean indicating whether the Q object can be treated a row vector
// is_col = boolean indicating whether the Q object can be treated a column vector
// is_xvec = boolean indicating whether the Q object is a vector with unknown orientation
// is_row = boolean to indicate Q object can be treated a row vector
// is_col = boolean to indicate Q object can be treated a column vector
// is_xvec = boolean to indicate Q object is a vector with unknown orientation
//
// Q = object that can be unwrapped via the unwrap family of classes (ie. Q must be convertible to Mat)
// Q = object that can be unwrapped via unwrap family of classes (ie. Q must be convertible to Mat)
//
// get_n_rows() = return the number of rows in Q
// get_n_cols() = return the number of columns in Q
// get_n_elem() = return the number of elements in Q
// get_n_rows() = return number of rows in Q
// get_n_cols() = return number of columns in Q
// get_n_elem() = return number of elements in Q
//
// operator[i] = linear element accessor; valid only if the 'use_at' boolean is false
// at(row,col) = access elements via (row,col); valid only if the 'use_at' boolean is true
// at_alt(i) = aligned linear element accessor; valid only if the 'use_at' boolean is false and is_aligned() returns true
// operator[i] = linear element accessor; valid only if 'use_at' boolean is false
// at(row,col) = access elements via (row,col); valid only if 'use_at' boolean is true
// at_alt(i) = aligned linear element accessor; valid only if 'use_at' boolean is false and is_aligned() returns true
//
// get_ea() = return the object that provides linear access to elements via operator[i]
// get_aligned_ea() = return the object that provides linear access to elements via at_alt(i); valid only if is_aligned() returns true
// get_ea() = return object that provides linear access to elements via operator[i]
// get_aligned_ea() = return object that provides linear access to elements via at_alt(i); valid only if is_aligned() returns true
//
// is_alias(X) = return true/false indicating whether the Q object aliases matrix X
// has_overlap(X) = return true/false indicating whether the Q object has overlap with subview X
// is_aligned() = return true/false indicating whether the Q object has aligned memory
// is_alias(X) = return true/false to indicate Q object aliases matrix X
// has_overlap(X) = return true/false to indicate Q object has overlap with subview X
// is_aligned() = return true/false to indicate Q object has aligned memory
@@ -88,7 +88,7 @@ struct Proxy_fixed
inline explicit Proxy_fixed(const T1& A)
: Q(A)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
//// this may require T1::n_elem etc to be declared as static constexpr inline variables (C++17)
@@ -168,12 +168,12 @@ struct Proxy< Mat<eT> >
static constexpr bool is_col = false;
static constexpr bool is_xvec = false;
arma_aligned const Mat<eT>& Q;
const Mat<eT>& Q;
inline explicit Proxy(const Mat<eT>& A)
: Q(A)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
arma_inline uword get_n_rows() const { return Q.n_rows; }
@@ -188,7 +188,7 @@ struct Proxy< Mat<eT> >
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 (is_same_type<eT,eT2>::value) ? (void_ptr(&Q) == void_ptr(&X)) : false; }
arma_inline bool is_alias(const Mat<eT2>& X) const { return (is_same_type<eT,eT2>::yes) && (void_ptr(&Q) == void_ptr(&X)); }
template<typename eT2>
arma_inline bool has_overlap(const subview<eT2>& X) const { return is_alias(X.m); }
@@ -215,12 +215,12 @@ struct Proxy< Col<eT> >
static constexpr bool is_col = true;
static constexpr bool is_xvec = false;
arma_aligned const Col<eT>& Q;
const Col<eT>& Q;
inline explicit Proxy(const Col<eT>& A)
: Q(A)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
arma_inline uword get_n_rows() const { return Q.n_rows; }
@@ -235,7 +235,7 @@ struct Proxy< Col<eT> >
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 (is_same_type<eT,eT2>::value) ? (void_ptr(&Q) == void_ptr(&X)) : false; }
arma_inline bool is_alias(const Mat<eT2>& X) const { return (is_same_type<eT,eT2>::yes) && (void_ptr(&Q) == void_ptr(&X)); }
template<typename eT2>
arma_inline bool has_overlap(const subview<eT2>& X) const { return is_alias(X.m); }
@@ -262,12 +262,12 @@ struct Proxy< Row<eT> >
static constexpr bool is_col = false;
static constexpr bool is_xvec = false;
arma_aligned const Row<eT>& Q;
const Row<eT>& Q;
inline explicit Proxy(const Row<eT>& A)
: Q(A)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
constexpr uword get_n_rows() const { return 1; }
@@ -282,7 +282,7 @@ struct Proxy< Row<eT> >
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 (is_same_type<eT,eT2>::value) ? (void_ptr(&Q) == void_ptr(&X)) : false; }
arma_inline bool is_alias(const Mat<eT2>& X) const { return (is_same_type<eT,eT2>::yes) && (void_ptr(&Q) == void_ptr(&X)); }
template<typename eT2>
arma_inline bool has_overlap(const subview<eT2>& X) const { return is_alias(X.m); }
@@ -309,12 +309,12 @@ struct Proxy< Gen<T1, gen_type> >
static constexpr bool is_col = Gen<T1, gen_type>::is_col;
static constexpr bool is_xvec = Gen<T1, gen_type>::is_xvec;
arma_aligned const Gen<T1, gen_type>& Q;
const Gen<T1, gen_type>& Q;
inline explicit Proxy(const Gen<T1, gen_type>& A)
: Q(A)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
arma_inline uword get_n_rows() const { return (is_row ? 1 : Q.n_rows); }
@@ -356,12 +356,12 @@ struct Proxy< eOp<T1, eop_type> >
static constexpr bool is_col = eOp<T1, eop_type>::is_col;
static constexpr bool is_xvec = eOp<T1, eop_type>::is_xvec;
arma_aligned const eOp<T1, eop_type>& Q;
const eOp<T1, eop_type>& Q;
inline explicit Proxy(const eOp<T1, eop_type>& A)
: Q(A)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
arma_inline uword get_n_rows() const { return is_row ? 1 : Q.get_n_rows(); }
@@ -403,12 +403,12 @@ struct Proxy< eGlue<T1, T2, eglue_type> >
static constexpr bool is_col = eGlue<T1, T2, eglue_type>::is_col;
static constexpr bool is_xvec = eGlue<T1, T2, eglue_type>::is_xvec;
arma_aligned const eGlue<T1, T2, eglue_type>& Q;
const eGlue<T1, T2, eglue_type>& Q;
inline explicit Proxy(const eGlue<T1, T2, eglue_type>& A)
: Q(A)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
arma_inline uword get_n_rows() const { return is_row ? 1 : Q.get_n_rows(); }
@@ -450,12 +450,12 @@ struct Proxy< Op<T1, op_type> >
static constexpr bool is_col = Op<T1, op_type>::is_col;
static constexpr bool is_xvec = Op<T1, op_type>::is_xvec;
arma_aligned const Mat<elem_type> Q;
const Mat<elem_type> Q;
inline explicit Proxy(const Op<T1, op_type>& A)
: Q(A)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
arma_inline uword get_n_rows() const { return is_row ? 1 : Q.n_rows; }
@@ -497,12 +497,12 @@ struct Proxy< Glue<T1, T2, glue_type> >
static constexpr bool is_col = Glue<T1, T2, glue_type>::is_col;
static constexpr bool is_xvec = Glue<T1, T2, glue_type>::is_xvec;
arma_aligned const Mat<elem_type> Q;
const Mat<elem_type> Q;
inline explicit Proxy(const Glue<T1, T2, glue_type>& A)
: Q(A)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
arma_inline uword get_n_rows() const { return is_row ? 1 : Q.n_rows; }
@@ -547,9 +547,9 @@ struct Proxy< Glue<T1, T2, glue_min> >
static constexpr bool is_col = this_Glue_type::is_col;
static constexpr bool is_xvec = this_Glue_type::is_xvec;
arma_aligned const this_Glue_type& Q;
arma_aligned const Proxy<T1> P1;
arma_aligned const Proxy<T2> P2;
const this_Glue_type& Q;
const Proxy<T1> P1;
const Proxy<T2> P2;
arma_lt_comparator<elem_type> comparator;
@@ -558,9 +558,9 @@ struct Proxy< Glue<T1, T2, glue_min> >
, P1(X.A)
, P2(X.B)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
arma_debug_assert_same_size(P1, P2, "element-wise min()");
arma_conform_assert_same_size(P1, P2, "element-wise min()");
}
arma_inline uword get_n_rows() const { return is_row ? 1 : P1.get_n_rows(); }
@@ -605,9 +605,9 @@ struct Proxy< Glue<T1, T2, glue_max> >
static constexpr bool is_col = this_Glue_type::is_col;
static constexpr bool is_xvec = this_Glue_type::is_xvec;
arma_aligned const this_Glue_type& Q;
arma_aligned const Proxy<T1> P1;
arma_aligned const Proxy<T2> P2;
const this_Glue_type& Q;
const Proxy<T1> P1;
const Proxy<T2> P2;
arma_gt_comparator<elem_type> comparator;
@@ -616,9 +616,9 @@ struct Proxy< Glue<T1, T2, glue_max> >
, P1(X.A)
, P2(X.B)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
arma_debug_assert_same_size(P1, P2, "element-wise max()");
arma_conform_assert_same_size(P1, P2, "element-wise max()");
}
arma_inline uword get_n_rows() const { return is_row ? 1 : P1.get_n_rows(); }
@@ -660,12 +660,12 @@ struct Proxy< mtOp<out_eT, T1, op_type> >
static constexpr bool is_col = mtOp<out_eT, T1, op_type>::is_col;
static constexpr bool is_xvec = mtOp<out_eT, T1, op_type>::is_xvec;
arma_aligned const Mat<out_eT> Q;
const Mat<out_eT> Q;
inline explicit Proxy(const mtOp<out_eT, T1, op_type>& A)
: Q(A)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
arma_inline uword get_n_rows() const { return is_row ? 1 : Q.n_rows; }
@@ -707,12 +707,12 @@ struct Proxy< mtGlue<out_eT, T1, T2, glue_type> >
static constexpr bool is_col = mtGlue<out_eT, T1, T2, glue_type>::is_col;
static constexpr bool is_xvec = mtGlue<out_eT, T1, T2, glue_type>::is_xvec;
arma_aligned const Mat<out_eT> Q;
const Mat<out_eT> Q;
inline explicit Proxy(const mtGlue<out_eT, T1, T2, glue_type>& A)
: Q(A)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
arma_inline uword get_n_rows() const { return is_row ? 1 : Q.n_rows; }
@@ -754,12 +754,12 @@ struct Proxy< CubeToMatOp<T1, op_type> >
static constexpr bool is_col = CubeToMatOp<T1, op_type>::is_col;
static constexpr bool is_xvec = CubeToMatOp<T1, op_type>::is_xvec;
arma_aligned const Mat<elem_type> Q;
const Mat<elem_type> Q;
inline explicit Proxy(const CubeToMatOp<T1, op_type>& A)
: Q(A)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
arma_inline uword get_n_rows() const { return is_row ? 1 : Q.n_rows; }
@@ -795,20 +795,20 @@ struct Proxy< CubeToMatOp<T1, op_vectorise_cube_col> >
static constexpr bool use_at = false;
static constexpr bool use_mp = false;
static constexpr bool has_subview = false;
static constexpr bool has_subview = true;
static constexpr bool is_row = false;
static constexpr bool is_col = true;
static constexpr bool is_xvec = false;
arma_aligned const unwrap_cube<T1> U;
arma_aligned const Mat<elem_type> Q;
const unwrap_cube<T1> U;
const Mat<elem_type> Q;
inline explicit Proxy(const CubeToMatOp<T1, op_vectorise_cube_col>& A)
: U(A.m)
, Q(const_cast<elem_type*>(U.M.memptr()), U.M.n_elem, 1, false, true)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
arma_inline uword get_n_rows() const { return Q.n_rows; }
@@ -850,12 +850,12 @@ struct Proxy< SpToDOp<T1, op_type> >
static constexpr bool is_col = SpToDOp<T1, op_type>::is_col;
static constexpr bool is_xvec = SpToDOp<T1, op_type>::is_xvec;
arma_aligned const Mat<elem_type> Q;
const Mat<elem_type> Q;
inline explicit Proxy(const SpToDOp<T1, op_type>& A)
: Q(A)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
arma_inline uword get_n_rows() const { return is_row ? 1 : Q.n_rows; }
@@ -880,8 +880,57 @@ struct Proxy< SpToDOp<T1, op_type> >
template<typename T1>
struct Proxy< SpToDOp<T1, op_nonzeros_spmat> >
template<typename eT>
struct Proxy< SpToDOp<SpMat<eT>, op_sp_nonzeros> >
{
typedef eT elem_type;
typedef typename get_pod_type<elem_type>::result pod_type;
typedef Mat<elem_type> stored_type;
typedef const elem_type* ea_type;
typedef const Mat<elem_type>& aligned_ea_type;
static constexpr bool use_at = false;
static constexpr bool use_mp = false;
static constexpr bool has_subview = true;
static constexpr bool is_row = false;
static constexpr bool is_col = true;
static constexpr bool is_xvec = false;
const SpMat<elem_type>& R;
const Mat<elem_type> Q;
inline explicit Proxy(const SpToDOp<SpMat<eT>, op_sp_nonzeros>& A)
: R(A.m)
, Q(const_cast<elem_type*>(R.values), R.n_nonzero, 1, false, true)
{
arma_debug_sigprint();
}
arma_inline uword get_n_rows() const { return Q.n_rows; }
constexpr uword get_n_cols() const { return 1; }
arma_inline uword get_n_elem() const { return Q.n_elem; }
arma_inline elem_type operator[] (const uword i) const { return Q[i]; }
arma_inline elem_type at (const uword r, const uword) const { return Q[r]; }
arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); }
arma_inline ea_type get_ea() const { return Q.memptr(); }
arma_inline aligned_ea_type get_aligned_ea() const { return Q; }
template<typename eT2>
constexpr bool is_alias(const Mat<eT2>&) const { return false; }
template<typename eT2>
constexpr bool has_overlap(const subview<eT2>&) const { return false; }
arma_inline bool is_aligned() const { return memory::is_aligned(Q.memptr()); }
};
template<typename T1, typename T2, typename glue_type>
struct Proxy< SpToDGlue<T1, T2, glue_type> >
{
typedef typename T1::elem_type elem_type;
typedef typename get_pod_type<elem_type>::result pod_type;
@@ -893,27 +942,25 @@ struct Proxy< SpToDOp<T1, op_nonzeros_spmat> >
static constexpr bool use_mp = false;
static constexpr bool has_subview = false;
static constexpr bool is_row = false;
static constexpr bool is_col = true;
static constexpr bool is_xvec = false;
static constexpr bool is_row = SpToDGlue<T1, T2, glue_type>::is_row;
static constexpr bool is_col = SpToDGlue<T1, T2, glue_type>::is_col;
static constexpr bool is_xvec = SpToDGlue<T1, T2, glue_type>::is_xvec;
arma_aligned const unwrap_spmat<T1> U;
arma_aligned const Mat<elem_type> Q;
const Mat<elem_type> Q;
inline explicit Proxy(const SpToDOp<T1, op_nonzeros_spmat>& A)
: U(A.m)
, Q(const_cast<elem_type*>(U.M.values), U.M.n_nonzero, 1, false, true)
inline explicit Proxy(const SpToDGlue<T1, T2, glue_type>& A)
: Q(A)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
arma_inline uword get_n_rows() const { return is_row ? 1 : Q.n_rows; }
arma_inline uword get_n_cols() const { return is_col ? 1 : Q.n_cols; }
arma_inline uword get_n_elem() const { return Q.n_elem; }
arma_inline uword get_n_rows() const { return Q.n_rows; }
constexpr uword get_n_cols() const { return 1; }
arma_inline uword get_n_elem() const { return Q.n_elem; }
arma_inline elem_type operator[] (const uword i) const { return Q[i]; }
arma_inline elem_type at (const uword r, const uword) const { return Q[r]; }
arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); }
arma_inline elem_type operator[] (const uword i) const { return Q[i]; }
arma_inline elem_type at (const uword r, const uword c) const { return Q.at(r, c); }
arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); }
arma_inline ea_type get_ea() const { return Q.memptr(); }
arma_inline aligned_ea_type get_aligned_ea() const { return Q; }
@@ -946,12 +993,12 @@ struct Proxy< subview<eT> >
static constexpr bool is_col = false;
static constexpr bool is_xvec = false;
arma_aligned const subview<eT>& Q;
const subview<eT>& Q;
inline explicit Proxy(const subview<eT>& A)
: Q(A)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
arma_inline uword get_n_rows() const { return Q.n_rows; }
@@ -966,7 +1013,7 @@ struct Proxy< subview<eT> >
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 (is_same_type<eT,eT2>::value) ? (void_ptr(&(Q.m)) == void_ptr(&X)) : false; }
arma_inline bool is_alias(const Mat<eT2>& X) const { return (is_same_type<eT,eT2>::yes) && (void_ptr(&(Q.m)) == void_ptr(&X)); }
template<typename eT2>
arma_inline bool has_overlap(const subview<eT2>& X) const { return Q.check_overlap(X); }
@@ -993,12 +1040,12 @@ struct Proxy< subview_col<eT> >
static constexpr bool is_col = true;
static constexpr bool is_xvec = false;
arma_aligned const subview_col<eT>& Q;
const subview_col<eT>& Q;
inline explicit Proxy(const subview_col<eT>& A)
: Q(A)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
arma_inline uword get_n_rows() const { return Q.n_rows; }
@@ -1013,7 +1060,7 @@ struct Proxy< subview_col<eT> >
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 (is_same_type<eT,eT2>::value) ? (void_ptr(&(Q.m)) == void_ptr(&X)) : false; }
arma_inline bool is_alias(const Mat<eT2>& X) const { return (is_same_type<eT,eT2>::yes) && (void_ptr(&(Q.m)) == void_ptr(&X)); }
template<typename eT2>
arma_inline bool has_overlap(const subview<eT2>& X) const { return Q.check_overlap(X); }
@@ -1040,14 +1087,14 @@ struct Proxy< subview_cols<eT> >
static constexpr bool is_col = false;
static constexpr bool is_xvec = false;
arma_aligned const subview_cols<eT>& sv;
arma_aligned const Mat<eT> Q;
const subview_cols<eT>& sv;
const Mat<eT> Q;
inline explicit Proxy(const subview_cols<eT>& A)
: sv(A)
, Q ( const_cast<eT*>( A.colptr(0) ), A.n_rows, A.n_cols, false, false )
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
arma_inline uword get_n_rows() const { return Q.n_rows; }
@@ -1062,7 +1109,7 @@ struct Proxy< subview_cols<eT> >
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 (is_same_type<eT,eT2>::value) ? (void_ptr(&(sv.m)) == void_ptr(&X)) : false; }
arma_inline bool is_alias(const Mat<eT2>& X) const { return (is_same_type<eT,eT2>::yes) && (void_ptr(&(sv.m)) == void_ptr(&X)); }
template<typename eT2>
arma_inline bool has_overlap(const subview<eT2>& X) const { return sv.check_overlap(X); }
@@ -1089,12 +1136,12 @@ struct Proxy< subview_row<eT> >
static constexpr bool is_col = false;
static constexpr bool is_xvec = false;
arma_aligned const subview_row<eT>& Q;
const subview_row<eT>& Q;
inline explicit Proxy(const subview_row<eT>& A)
: Q(A)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
constexpr uword get_n_rows() const { return 1; }
@@ -1109,7 +1156,7 @@ struct Proxy< subview_row<eT> >
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 (is_same_type<eT,eT2>::value) ? (void_ptr(&(Q.m)) == void_ptr(&X)) : false; }
arma_inline bool is_alias(const Mat<eT2>& X) const { return (is_same_type<eT,eT2>::yes) && (void_ptr(&(Q.m)) == void_ptr(&X)); }
template<typename eT2>
arma_inline bool has_overlap(const subview<eT2>& X) const { return Q.check_overlap(X); }
@@ -1136,28 +1183,28 @@ struct Proxy< subview_elem1<eT,T1> >
static constexpr bool is_col = true;
static constexpr bool is_xvec = false;
arma_aligned const subview_elem1<eT,T1>& Q;
arma_aligned const Proxy<T1> R;
const subview_elem1<eT,T1>& Q;
const Proxy<T1> R;
inline explicit Proxy(const subview_elem1<eT,T1>& A)
: Q(A)
, R(A.a.get_ref())
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const bool R_is_vec = ((R.get_n_rows() == 1) || (R.get_n_cols() == 1));
const bool R_is_empty = (R.get_n_elem() == 0);
arma_debug_check( ((R_is_vec == false) && (R_is_empty == false)), "Mat::elem(): given object must be a vector" );
arma_conform_check( ((R_is_vec == false) && (R_is_empty == false)), "Mat::elem(): given object must be a vector" );
}
arma_inline uword get_n_rows() const { return R.get_n_elem(); }
constexpr uword get_n_cols() const { return 1; }
arma_inline uword get_n_elem() const { return R.get_n_elem(); }
arma_inline elem_type operator[] (const uword i) const { const uword ii = (Proxy<T1>::use_at) ? R.at(i,0) : R[i]; arma_debug_check_bounds( (ii >= Q.m.n_elem), "Mat::elem(): index out of bounds" ); return Q.m[ii]; }
arma_inline elem_type at (const uword r, const uword) const { const uword ii = (Proxy<T1>::use_at) ? R.at(r,0) : R[r]; arma_debug_check_bounds( (ii >= Q.m.n_elem), "Mat::elem(): index out of bounds" ); return Q.m[ii]; }
arma_inline elem_type at_alt (const uword i) const { const uword ii = (Proxy<T1>::use_at) ? R.at(i,0) : R[i]; arma_debug_check_bounds( (ii >= Q.m.n_elem), "Mat::elem(): index out of bounds" ); return Q.m[ii]; }
arma_inline elem_type operator[] (const uword i) const { const uword ii = (Proxy<T1>::use_at) ? R.at(i,0) : R[i]; arma_conform_check_bounds( (ii >= Q.m.n_elem), "Mat::elem(): index out of bounds" ); return Q.m[ii]; }
arma_inline elem_type at (const uword r, const uword) const { const uword ii = (Proxy<T1>::use_at) ? R.at(r,0) : R[r]; arma_conform_check_bounds( (ii >= Q.m.n_elem), "Mat::elem(): index out of bounds" ); return Q.m[ii]; }
arma_inline elem_type at_alt (const uword i) const { const uword ii = (Proxy<T1>::use_at) ? R.at(i,0) : R[i]; arma_conform_check_bounds( (ii >= Q.m.n_elem), "Mat::elem(): index out of bounds" ); return Q.m[ii]; }
arma_inline ea_type get_ea() const { return (*this); }
arma_inline aligned_ea_type get_aligned_ea() const { return (*this); }
@@ -1190,12 +1237,12 @@ struct Proxy< subview_elem2<eT,T1,T2> >
static constexpr bool is_col = false;
static constexpr bool is_xvec = false;
arma_aligned const Mat<eT> Q;
const Mat<eT> Q;
inline explicit Proxy(const subview_elem2<eT,T1,T2>& A)
: Q(A)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
arma_inline uword get_n_rows() const { return Q.n_rows; }
@@ -1237,12 +1284,12 @@ struct Proxy< diagview<eT> >
static constexpr bool is_col = true;
static constexpr bool is_xvec = false;
arma_aligned const diagview<eT>& Q;
const diagview<eT>& Q;
inline explicit Proxy(const diagview<eT>& A)
: Q(A)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
arma_inline uword get_n_rows() const { return Q.n_rows; }
@@ -1257,7 +1304,7 @@ struct Proxy< diagview<eT> >
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 (is_same_type<eT,eT2>::value) ? (void_ptr(&(Q.m)) == void_ptr(&X)) : false; }
arma_inline bool is_alias(const Mat<eT2>& X) const { return (is_same_type<eT,eT2>::yes) && (void_ptr(&(Q.m)) == void_ptr(&X)); }
template<typename eT2>
arma_inline bool has_overlap(const subview<eT2>& X) const { return is_alias(X.m); }
@@ -1292,13 +1339,13 @@ struct Proxy_diagvec_mat< Op<T1, op_diagvec> >
static constexpr bool is_col = true;
static constexpr bool is_xvec = false;
arma_aligned const Mat<elem_type>& R;
arma_aligned const diagview<elem_type> Q;
const Mat<elem_type>& R;
const diagview<elem_type> Q;
inline explicit Proxy_diagvec_mat(const Op<T1, op_diagvec>& A)
: R(A.m), Q( R.diag() )
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
arma_inline uword get_n_rows() const { return Q.n_rows; }
@@ -1348,12 +1395,12 @@ struct Proxy_diagvec_expr< Op<T1, op_diagvec> >
static constexpr bool is_col = true;
static constexpr bool is_xvec = false;
arma_aligned const Mat<elem_type> Q;
const Mat<elem_type> Q;
inline explicit Proxy_diagvec_expr(const Op<T1, op_diagvec>& A)
: Q(A)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
arma_inline uword get_n_rows() const { return Q.n_rows; }
@@ -1398,7 +1445,7 @@ struct Proxy< Op<T1, op_diagvec> >
inline explicit Proxy(const Op<T1, op_diagvec>& A)
: Proxy_diagvec(A)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
};
@@ -1421,12 +1468,12 @@ struct Proxy< Op<T1, op_diagvec2> >
static constexpr bool is_col = true;
static constexpr bool is_xvec = false;
arma_aligned const Mat<elem_type> Q;
const Mat<elem_type> Q;
inline explicit Proxy(const Op<T1, op_diagvec2>& A)
: Q(A)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
arma_inline uword get_n_rows() const { return Q.n_rows; }
@@ -1483,7 +1530,7 @@ struct Proxy_xtrans_default< Op<T1, op_htrans> >
: U(A.m)
, Q(U.M)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
arma_inline ea_type get_ea() const { return Q; }
@@ -1524,7 +1571,7 @@ struct Proxy_xtrans_default< Op<T1, op_strans> >
: U(A.m)
, Q(U.M)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
arma_inline ea_type get_ea() const { return Q; }
@@ -1567,14 +1614,14 @@ struct Proxy_xtrans_vector< Op<T1, op_htrans> >
static constexpr bool is_col = Op<T1, op_htrans>::is_col;
static constexpr bool is_xvec = Op<T1, op_htrans>::is_xvec;
arma_aligned const quasi_unwrap<T1> U; // avoid copy if T1 is a Row, Col or subview_col
arma_aligned const Mat<elem_type> Q;
const quasi_unwrap<T1> U; // avoid copy if T1 is a Row, Col or subview_col
const Mat<elem_type> Q;
inline Proxy_xtrans_vector(const Op<T1, op_htrans>& A)
: U(A.m)
, Q(const_cast<elem_type*>(U.M.memptr()), U.M.n_cols, U.M.n_rows, false, false)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
arma_inline ea_type get_ea() const { return Q.memptr(); }
@@ -1609,14 +1656,14 @@ struct Proxy_xtrans_vector< Op<T1, op_strans> >
static constexpr bool is_col = Op<T1, op_strans>::is_col;
static constexpr bool is_xvec = Op<T1, op_strans>::is_xvec;
arma_aligned const quasi_unwrap<T1> U; // avoid copy if T1 is a Row, Col or subview_col
arma_aligned const Mat<elem_type> Q;
const quasi_unwrap<T1> U; // avoid copy if T1 is a Row, Col or subview_col
const Mat<elem_type> Q;
inline Proxy_xtrans_vector(const Op<T1, op_strans>& A)
: U(A.m)
, Q(const_cast<elem_type*>(U.M.memptr()), U.M.n_cols, U.M.n_rows, false, false)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
arma_inline ea_type get_ea() const { return Q.memptr(); }
@@ -1681,7 +1728,7 @@ struct Proxy< Op<T1, op_htrans> >
inline explicit Proxy(const Op<T1, op_htrans>& A)
: Proxy_xtrans(A)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
arma_inline uword get_n_rows() const { return is_row ? 1 : Q.n_rows; }
@@ -1743,7 +1790,7 @@ struct Proxy< Op<T1, op_strans> >
inline explicit Proxy(const Op<T1, op_strans>& A)
: Proxy_xtrans(A)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
arma_inline uword get_n_rows() const { return is_row ? 1 : Q.n_rows; }
@@ -1785,12 +1832,12 @@ struct Proxy_subview_row_htrans_cx
static constexpr bool is_col = true;
static constexpr bool is_xvec = false;
arma_aligned const subview_row_htrans<eT> Q;
const subview_row_htrans<eT> Q;
inline explicit Proxy_subview_row_htrans_cx(const Op<subview_row<eT>, op_htrans>& A)
: Q(A.m)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
template<typename eT2>
@@ -1819,12 +1866,12 @@ struct Proxy_subview_row_htrans_non_cx
static constexpr bool is_col = true;
static constexpr bool is_xvec = false;
arma_aligned const subview_row_strans<eT> Q;
const subview_row_strans<eT> Q;
inline explicit Proxy_subview_row_htrans_non_cx(const Op<subview_row<eT>, op_htrans>& A)
: Q(A.m)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
template<typename eT2>
@@ -1884,7 +1931,7 @@ struct Proxy< Op<subview_row<eT>, op_htrans> >
inline explicit Proxy(const Op<subview_row<eT>, op_htrans>& A)
: Proxy_sv_row_ht(A)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
arma_inline uword get_n_rows() const { return Q.n_rows; }
@@ -1926,12 +1973,12 @@ struct Proxy< Op<subview_row<eT>, op_strans> >
static constexpr bool is_col = true;
static constexpr bool is_xvec = false;
arma_aligned const subview_row_strans<eT> Q;
const subview_row_strans<eT> Q;
inline explicit Proxy(const Op<subview_row<eT>, op_strans>& A)
: Q(A.m)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
arma_inline uword get_n_rows() const { return Q.n_rows; }
@@ -1982,7 +2029,7 @@ struct Proxy< Op< Row< std::complex<T> >, op_htrans> >
: Q (A.m.memptr(), A.m.n_rows, A.m.n_cols)
, src(A.m)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
arma_inline uword get_n_rows() const { return Q.n_rows; }
@@ -2033,7 +2080,7 @@ struct Proxy< Op< Col< std::complex<T> >, op_htrans> >
: Q (A.m.memptr(), A.m.n_rows, A.m.n_cols)
, src(A.m)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
constexpr uword get_n_rows() const { return 1; }
@@ -2084,7 +2131,7 @@ struct Proxy< Op< subview_col< std::complex<T> >, op_htrans> >
: Q (A.m.colptr(0), A.m.n_rows, A.m.n_cols)
, src(A.m)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
constexpr uword get_n_rows() const { return 1; }
@@ -2127,14 +2174,14 @@ struct Proxy< Op<T1, op_htrans2> >
static constexpr bool is_col = eOp< Op<T1, op_htrans>, eop_scalar_times>::is_col;
static constexpr bool is_xvec = eOp< Op<T1, op_htrans>, eop_scalar_times>::is_xvec;
arma_aligned const Op<T1, op_htrans> R;
arma_aligned const eOp< Op<T1, op_htrans>, eop_scalar_times > Q;
const Op<T1, op_htrans> R;
const eOp< Op<T1, op_htrans>, eop_scalar_times > Q;
inline explicit Proxy(const Op<T1, op_htrans2>& A)
: R(A.m)
, Q(R, A.aux)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
arma_inline uword get_n_rows() const { return is_row ? 1 : Q.get_n_rows(); }
@@ -2176,12 +2223,12 @@ struct Proxy< subview_row_strans<eT> >
static constexpr bool is_col = true;
static constexpr bool is_xvec = false;
arma_aligned const subview_row_strans<eT>& Q;
const subview_row_strans<eT>& Q;
inline explicit Proxy(const subview_row_strans<eT>& A)
: Q(A)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
arma_inline uword get_n_rows() const { return Q.n_rows; }
@@ -2223,12 +2270,12 @@ struct Proxy< subview_row_htrans<eT> >
static constexpr bool is_col = true;
static constexpr bool is_xvec = false;
arma_aligned const subview_row_htrans<eT>& Q;
const subview_row_htrans<eT>& Q;
inline explicit Proxy(const subview_row_htrans<eT>& A)
: Q(A)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
arma_inline uword get_n_rows() const { return Q.n_rows; }
@@ -2270,12 +2317,12 @@ struct Proxy< xtrans_mat<eT, do_conj> >
static constexpr bool is_col = false;
static constexpr bool is_xvec = false;
arma_aligned const Mat<eT> Q;
const Mat<eT> Q;
inline explicit Proxy(const xtrans_mat<eT, do_conj>& A)
: Q(A)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
arma_inline uword get_n_rows() const { return Q.n_rows; }
@@ -2317,12 +2364,12 @@ struct Proxy< xvec_htrans<eT> >
static constexpr bool is_col = false;
static constexpr bool is_xvec = true;
arma_aligned const Mat<eT> Q;
const Mat<eT> Q;
inline explicit Proxy(const xvec_htrans<eT>& A)
: Q(A)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
arma_inline uword get_n_rows() const { return Q.n_rows; }
@@ -2372,14 +2419,14 @@ struct Proxy_vectorise_col_mat< Op<T1, op_vectorise_col> >
static constexpr bool is_col = true;
static constexpr bool is_xvec = false;
arma_aligned const unwrap<T1> U;
arma_aligned const Mat<elem_type> Q;
const unwrap<T1> U;
const Mat<elem_type> Q;
inline explicit Proxy_vectorise_col_mat(const Op<T1, op_vectorise_col>& A)
: U(A.m)
, Q(const_cast<elem_type*>(U.M.memptr()), U.M.n_elem, 1, false, false)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
arma_inline uword get_n_rows() const { return Q.n_rows; }
@@ -2429,14 +2476,14 @@ struct Proxy_vectorise_col_expr< Op<T1, op_vectorise_col> >
static constexpr bool is_col = true;
static constexpr bool is_xvec = false;
arma_aligned const Op<T1, op_vectorise_col>& Q;
arma_aligned const Proxy<T1> R;
const Op<T1, op_vectorise_col>& Q;
const Proxy<T1> R;
inline explicit Proxy_vectorise_col_expr(const Op<T1, op_vectorise_col>& A)
: Q(A)
, R(A.m)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
arma_inline uword get_n_rows() const { return R.get_n_elem(); }
@@ -2481,7 +2528,7 @@ struct Proxy< Op<T1, op_vectorise_col> >
inline explicit Proxy(const Op<T1, op_vectorise_col>& A)
: Proxy_vectorise_col(A)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
};
+22 -22
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,
@@ -48,12 +48,12 @@ struct ProxyCube< Cube<eT> >
static constexpr bool use_mp = false;
static constexpr bool has_subview = false;
arma_aligned const Cube<eT>& Q;
const Cube<eT>& Q;
inline explicit ProxyCube(const Cube<eT>& A)
: Q(A)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
arma_inline uword get_n_rows() const { return Q.n_rows; }
@@ -93,12 +93,12 @@ struct ProxyCube< GenCube<eT, gen_type> >
static constexpr bool use_mp = false;
static constexpr bool has_subview = false;
arma_aligned const GenCube<eT, gen_type>& Q;
const GenCube<eT, gen_type>& Q;
inline explicit ProxyCube(const GenCube<eT, gen_type>& A)
: Q(A)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
arma_inline uword get_n_rows() const { return Q.n_rows; }
@@ -138,12 +138,12 @@ struct ProxyCube< OpCube<T1, op_type> >
static constexpr bool use_mp = false;
static constexpr bool has_subview = false;
arma_aligned const Cube<elem_type> Q;
const Cube<elem_type> Q;
inline explicit ProxyCube(const OpCube<T1, op_type>& A)
: Q(A)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
arma_inline uword get_n_rows() const { return Q.n_rows; }
@@ -183,12 +183,12 @@ struct ProxyCube< GlueCube<T1, T2, glue_type> >
static constexpr bool use_mp = false;
static constexpr bool has_subview = false;
arma_aligned const Cube<elem_type> Q;
const Cube<elem_type> Q;
inline explicit ProxyCube(const GlueCube<T1, T2, glue_type>& A)
: Q(A)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
arma_inline uword get_n_rows() const { return Q.n_rows; }
@@ -228,12 +228,12 @@ struct ProxyCube< subview_cube<eT> >
static constexpr bool use_mp = false;
static constexpr bool has_subview = true;
arma_aligned const subview_cube<eT>& Q;
const subview_cube<eT>& Q;
inline explicit ProxyCube(const subview_cube<eT>& A)
: Q(A)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
arma_inline uword get_n_rows() const { return Q.n_rows; }
@@ -273,12 +273,12 @@ struct ProxyCube< subview_cube_slices<eT,T1> >
static constexpr bool use_mp = false;
static constexpr bool has_subview = false;
arma_aligned const Cube<eT> Q;
const Cube<eT> Q;
inline explicit ProxyCube(const subview_cube_slices<eT,T1>& A)
: Q(A)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
arma_inline uword get_n_rows() const { return Q.n_rows; }
@@ -318,12 +318,12 @@ struct ProxyCube< eOpCube<T1, eop_type > >
static constexpr bool use_mp = eOpCube<T1, eop_type>::use_mp;
static constexpr bool has_subview = eOpCube<T1, eop_type>::has_subview;
arma_aligned const eOpCube<T1, eop_type>& Q;
const eOpCube<T1, eop_type>& Q;
inline explicit ProxyCube(const eOpCube<T1, eop_type>& A)
: Q(A)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
arma_inline uword get_n_rows() const { return Q.get_n_rows(); }
@@ -363,12 +363,12 @@ struct ProxyCube< eGlueCube<T1, T2, eglue_type > >
static constexpr bool use_mp = eGlueCube<T1, T2, eglue_type>::use_mp;
static constexpr bool has_subview = eGlueCube<T1, T2, eglue_type>::has_subview;
arma_aligned const eGlueCube<T1, T2, eglue_type>& Q;
const eGlueCube<T1, T2, eglue_type>& Q;
inline explicit ProxyCube(const eGlueCube<T1, T2, eglue_type>& A)
: Q(A)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
arma_inline uword get_n_rows() const { return Q.get_n_rows(); }
@@ -408,12 +408,12 @@ struct ProxyCube< mtOpCube<out_eT, T1, op_type> >
static constexpr bool use_mp = false;
static constexpr bool has_subview = false;
arma_aligned const Cube<out_eT> Q;
const Cube<out_eT> Q;
inline explicit ProxyCube(const mtOpCube<out_eT, T1, op_type>& A)
: Q(A)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
arma_inline uword get_n_rows() const { return Q.n_rows; }
@@ -453,12 +453,12 @@ struct ProxyCube< mtGlueCube<out_eT, T1, T2, glue_type > >
static constexpr bool use_mp = false;
static constexpr bool has_subview = false;
arma_aligned const Cube<out_eT> Q;
const Cube<out_eT> Q;
inline explicit ProxyCube(const mtGlueCube<out_eT, T1, T2, glue_type>& A)
: Q(A)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
arma_inline uword get_n_rows() const { return Q.n_rows; }
+9 -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,
@@ -67,6 +67,9 @@ 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);
@@ -88,7 +91,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;
@@ -138,7 +141,7 @@ 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);
[[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);
@@ -184,6 +187,8 @@ class Row<eT>::fixed : public Row<eT>
{
private:
using Mat<eT>::mem_local;
static constexpr bool use_extra = (fixed_n_elem > arma_config::mat_prealloc);
arma_align_mem eT mem_local_extra[ (use_extra) ? fixed_n_elem : 1 ];
File diff suppressed because it is too large Load Diff
+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;
+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,
@@ -27,7 +27,7 @@ SizeCube::SizeCube(const uword in_n_rows, const uword in_n_cols, const uword in_
, n_cols (in_n_cols )
, n_slices(in_n_slices)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
@@ -53,7 +53,7 @@ SizeCube::operator()(const uword dim) const
if(dim == 1) { return n_cols; }
if(dim == 2) { return n_slices; }
arma_debug_check_bounds(true, "size(): index out of bounds");
arma_conform_check_bounds(true, "size(): index out of bounds");
return uword(1);
}
+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;
+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,
@@ -26,7 +26,7 @@ SizeMat::SizeMat(const uword in_n_rows, const uword in_n_cols)
: n_rows(in_n_rows)
, n_cols(in_n_cols)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
@@ -50,7 +50,7 @@ SizeMat::operator()(const uword dim) const
if(dim == 0) { return n_rows; }
if(dim == 1) { return n_cols; }
arma_debug_check_bounds(true, "size(): index out of bounds");
arma_conform_check_bounds(true, "size(): index out of bounds");
return uword(1);
}
+8 -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;
inline elem_type min(uword& index_of_min_val) const;
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;
inline elem_type min(uword& row_of_min_val, uword& col_of_min_val) const;
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;
@@ -109,6 +109,8 @@ struct SpBase
arma_warn_unused inline const SpOp<derived,spop_vectorise_col> as_col() const;
arma_warn_unused inline const SpOp<derived,spop_vectorise_row> as_row() const;
arma_warn_unused inline const SpToDOp<derived,op_sp_as_dense> as_dense() const;
};
+58 -48
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,
@@ -75,7 +75,7 @@ inline
void
SpBase<elem_type,derived>::print(const std::string extra_text) const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const unwrap_spmat<derived> tmp( (*this).get_ref() );
@@ -98,7 +98,7 @@ inline
void
SpBase<elem_type,derived>::print(std::ostream& user_stream, const std::string extra_text) const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const unwrap_spmat<derived> tmp( (*this).get_ref() );
@@ -121,7 +121,7 @@ inline
void
SpBase<elem_type,derived>::raw_print(const std::string extra_text) const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const unwrap_spmat<derived> tmp( (*this).get_ref() );
@@ -144,7 +144,7 @@ inline
void
SpBase<elem_type,derived>::raw_print(std::ostream& user_stream, const std::string extra_text) const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const unwrap_spmat<derived> tmp( (*this).get_ref() );
@@ -167,7 +167,7 @@ inline
void
SpBase<elem_type, derived>::print_dense(const std::string extra_text) const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const unwrap_spmat<derived> tmp( (*this).get_ref() );
@@ -190,7 +190,7 @@ inline
void
SpBase<elem_type, derived>::print_dense(std::ostream& user_stream, const std::string extra_text) const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const unwrap_spmat<derived> tmp( (*this).get_ref() );
@@ -213,7 +213,7 @@ inline
void
SpBase<elem_type, derived>::raw_print_dense(const std::string extra_text) const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const unwrap_spmat<derived> tmp( (*this).get_ref() );
@@ -236,7 +236,7 @@ inline
void
SpBase<elem_type, derived>::raw_print_dense(std::ostream& user_stream, const std::string extra_text) const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const unwrap_spmat<derived> tmp( (*this).get_ref() );
@@ -259,7 +259,7 @@ inline
void
SpBase<elem_type,derived>::brief_print(const std::string extra_text) const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const unwrap_spmat<derived> tmp( (*this).get_ref() );
@@ -282,7 +282,7 @@ inline
void
SpBase<elem_type,derived>::brief_print(std::ostream& user_stream, const std::string extra_text) const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const unwrap_spmat<derived> tmp( (*this).get_ref() );
@@ -308,7 +308,7 @@ inline
const derived&
SpBase_eval_SpMat<elem_type, derived>::eval() const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
return static_cast<const derived&>(*this);
}
@@ -323,7 +323,7 @@ inline
SpMat<elem_type>
SpBase_eval_expr<elem_type, derived>::eval() const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
return SpMat<elem_type>( static_cast<const derived&>(*this) );
}
@@ -335,7 +335,7 @@ inline
elem_type
SpBase<elem_type, derived>::min() const
{
return spop_min::min( (*this).get_ref() );
return op_sp_min::min( (*this).get_ref() );
}
@@ -345,7 +345,7 @@ inline
elem_type
SpBase<elem_type, derived>::max() const
{
return spop_max::max( (*this).get_ref() );
return op_sp_max::max( (*this).get_ref() );
}
@@ -357,7 +357,7 @@ SpBase<elem_type, derived>::min(uword& index_of_min_val) const
{
const SpProxy<derived> P( (*this).get_ref() );
return spop_min::min_with_index(P, index_of_min_val);
return op_sp_min::min_with_index(P, index_of_min_val);
}
@@ -369,7 +369,7 @@ SpBase<elem_type, derived>::max(uword& index_of_max_val) const
{
const SpProxy<derived> P( (*this).get_ref() );
return spop_max::max_with_index(P, index_of_max_val);
return op_sp_max::max_with_index(P, index_of_max_val);
}
@@ -383,7 +383,7 @@ SpBase<elem_type, derived>::min(uword& row_of_min_val, uword& col_of_min_val) co
uword index = 0;
const elem_type val = spop_min::min_with_index(P, index);
const elem_type val = op_sp_min::min_with_index(P, index);
const uword local_n_rows = P.get_n_rows();
@@ -404,7 +404,7 @@ SpBase<elem_type, derived>::max(uword& row_of_max_val, uword& col_of_max_val) co
uword index = 0;
const elem_type val = spop_max::max_with_index(P, index);
const elem_type val = op_sp_max::max_with_index(P, index);
const uword local_n_rows = P.get_n_rows();
@@ -427,11 +427,11 @@ SpBase<elem_type,derived>::index_min() const
if(P.get_n_elem() == 0)
{
arma_debug_check(true, "index_min(): object has no elements");
arma_conform_check(true, "index_min(): object has no elements");
}
else
{
spop_min::min_with_index(P, index);
op_sp_min::min_with_index(P, index);
}
return index;
@@ -450,11 +450,11 @@ SpBase<elem_type,derived>::index_max() const
if(P.get_n_elem() == 0)
{
arma_debug_check(true, "index_max(): object has no elements");
arma_conform_check(true, "index_max(): object has no elements");
}
else
{
spop_max::max_with_index(P, index);
op_sp_max::max_with_index(P, index);
}
return index;
@@ -467,7 +467,7 @@ inline
bool
SpBase<elem_type,derived>::is_symmetric() const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const unwrap_spmat<derived> tmp( (*this).get_ref() );
@@ -481,7 +481,7 @@ inline
bool
SpBase<elem_type,derived>::is_symmetric(const typename get_pod_type<elem_type>::result tol) const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const unwrap_spmat<derived> tmp( (*this).get_ref() );
@@ -495,7 +495,7 @@ inline
bool
SpBase<elem_type,derived>::is_hermitian() const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const unwrap_spmat<derived> tmp( (*this).get_ref() );
@@ -509,7 +509,7 @@ inline
bool
SpBase<elem_type,derived>::is_hermitian(const typename get_pod_type<elem_type>::result tol) const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const unwrap_spmat<derived> tmp( (*this).get_ref() );
@@ -523,11 +523,11 @@ inline
bool
SpBase<elem_type,derived>::is_zero(const typename get_pod_type<elem_type>::result tol) const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
typedef typename get_pod_type<elem_type>::result T;
arma_debug_check( (tol < T(0)), "is_zero(): parameter 'tol' must be >= 0" );
arma_conform_check( (tol < T(0)), "is_zero(): parameter 'tol' must be >= 0" );
const SpProxy<derived> P( (*this).get_ref() );
@@ -580,7 +580,7 @@ inline
bool
SpBase<elem_type,derived>::is_trimatu() const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const SpProxy<derived> P( (*this).get_ref() );
@@ -605,7 +605,7 @@ inline
bool
SpBase<elem_type,derived>::is_trimatl() const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const SpProxy<derived> P( (*this).get_ref() );
@@ -630,7 +630,7 @@ inline
bool
SpBase<elem_type,derived>::is_diagmat() const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const SpProxy<derived> P( (*this).get_ref() );
@@ -653,7 +653,7 @@ inline
bool
SpBase<elem_type,derived>::is_empty() const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const SpProxy<derived> P( (*this).get_ref() );
@@ -667,7 +667,7 @@ inline
bool
SpBase<elem_type,derived>::is_square() const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const SpProxy<derived> P( (*this).get_ref() );
@@ -681,7 +681,7 @@ inline
bool
SpBase<elem_type,derived>::is_vec() const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
if( (SpProxy<derived>::is_row) || (SpProxy<derived>::is_col) || (SpProxy<derived>::is_xvec) ) { return true; }
@@ -697,7 +697,7 @@ inline
bool
SpBase<elem_type,derived>::is_colvec() const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
if(SpProxy<derived>::is_col) { return true; }
@@ -713,7 +713,7 @@ inline
bool
SpBase<elem_type,derived>::is_rowvec() const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
if(SpProxy<derived>::is_row) { return true; }
@@ -729,9 +729,9 @@ inline
bool
SpBase<elem_type,derived>::is_finite() const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
if(arma_config::fast_math) { arma_debug_warn_level(2, "is_finite(): detection of non-finite values is not reliable in fast math mode"); }
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_SpMat<typename SpProxy<derived>::stored_type>::value)
{
@@ -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;
}
}
@@ -763,9 +763,9 @@ inline
bool
SpBase<elem_type,derived>::has_inf() const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
if(arma_config::fast_math) { arma_debug_warn_level(2, "has_inf(): detection of non-finite values is not reliable in fast math mode"); }
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_SpMat<typename SpProxy<derived>::stored_type>::value)
{
@@ -797,9 +797,9 @@ inline
bool
SpBase<elem_type,derived>::has_nan() const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
if(arma_config::fast_math) { arma_debug_warn_level(2, "has_nan(): detection of non-finite values is not reliable in fast math mode"); }
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_SpMat<typename SpProxy<derived>::stored_type>::value)
{
@@ -831,9 +831,9 @@ inline
bool
SpBase<elem_type,derived>::has_nonfinite() const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
if(arma_config::fast_math) { arma_debug_warn_level(2, "has_nonfinite(): detection of non-finite values is not reliable in fast math mode"); }
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_SpMat<typename SpProxy<derived>::stored_type>::value)
{
@@ -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;
}
}
@@ -880,4 +880,14 @@ SpBase<elem_type, derived>::as_row() const
template<typename elem_type, typename derived>
inline
const SpToDOp<derived,op_sp_as_dense>
SpBase<elem_type, derived>::as_dense() const
{
return SpToDOp<derived,op_sp_as_dense>( (*this).get_ref() );
}
//! @}
+7 -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,
@@ -47,7 +47,9 @@ class SpCol : public SpMat<eT>
inline SpCol& operator=(const eT val);
template<typename T1> inline SpCol(const Base<eT,T1>& X);
inline SpCol(const Col<eT>& X); // for backwards compatibility
template<typename T1> inline explicit SpCol(const Base<eT,T1>& X);
template<typename T1> inline SpCol& operator=(const Base<eT,T1>& X);
template<typename T1> inline SpCol(const SpBase<eT,T1>& X);
@@ -60,6 +62,8 @@ class SpCol : public SpMat<eT>
arma_warn_unused inline const SpOp<SpCol<eT>,spop_htrans> ht() const;
arma_warn_unused inline const SpOp<SpCol<eT>,spop_strans> st() const;
arma_warn_unused inline const SpToDOp<SpCol<eT>,op_sp_as_dense> as_dense() const;
inline void shed_row (const uword row_num);
inline void shed_rows(const uword in_row1, const uword in_row2);
+53 -31
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,7 +26,7 @@ inline
SpCol<eT>::SpCol()
: SpMat<eT>(arma_vec_indicator(), 1)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
@@ -36,7 +36,7 @@ inline
SpCol<eT>::SpCol(const uword in_n_elem)
: SpMat<eT>(arma_vec_indicator(), in_n_elem, 1, 1)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
@@ -46,7 +46,7 @@ inline
SpCol<eT>::SpCol(const uword in_n_rows, const uword in_n_cols)
: SpMat<eT>(arma_vec_indicator(), in_n_rows, in_n_cols, 1)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
@@ -56,7 +56,7 @@ inline
SpCol<eT>::SpCol(const SizeMat& s)
: SpMat<eT>(arma_vec_indicator(), 0, 0, 1)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
SpMat<eT>::init(s.n_rows, s.n_cols);
}
@@ -68,7 +68,7 @@ inline
SpCol<eT>::SpCol(const char* text)
: SpMat<eT>(arma_vec_indicator(), 1)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
SpMat<eT>::init(std::string(text));
}
@@ -80,7 +80,7 @@ inline
SpCol<eT>&
SpCol<eT>::operator=(const char* text)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
SpMat<eT>::init(std::string(text));
@@ -94,7 +94,7 @@ inline
SpCol<eT>::SpCol(const std::string& text)
: SpMat<eT>(arma_vec_indicator(), 1)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
SpMat<eT>::init(text);
}
@@ -106,7 +106,7 @@ inline
SpCol<eT>&
SpCol<eT>::operator=(const std::string& text)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
SpMat<eT>::init(text);
@@ -120,7 +120,7 @@ inline
SpCol<eT>&
SpCol<eT>::operator=(const eT val)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
SpMat<eT>::operator=(val);
@@ -135,20 +135,32 @@ inline
SpCol<eT>::SpCol(const Base<eT,T1>& X)
: SpMat<eT>(arma_vec_indicator(), 1)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
SpMat<eT>::operator=(X.get_ref());
}
template<typename eT>
inline
SpCol<eT>::SpCol(const Col<eT>& X)
: SpMat<eT>(arma_vec_indicator(), 1)
{
arma_debug_sigprint();
SpMat<eT>::operator=(X);
}
template<typename eT>
template<typename T1>
inline
SpCol<eT>&
SpCol<eT>::operator=(const Base<eT,T1>& X)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
SpMat<eT>::operator=(X.get_ref());
@@ -163,7 +175,7 @@ inline
SpCol<eT>::SpCol(const SpBase<eT,T1>& X)
: SpMat<eT>(arma_vec_indicator(), 1)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
SpMat<eT>::operator=(X.get_ref());
}
@@ -176,7 +188,7 @@ inline
SpCol<eT>&
SpCol<eT>::operator=(const SpBase<eT,T1>& X)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
SpMat<eT>::operator=(X.get_ref());
@@ -195,7 +207,7 @@ SpCol<eT>::SpCol
)
: SpMat<eT>(arma_vec_indicator(), 1)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
SpMat<eT>::init(A,B);
}
@@ -232,15 +244,25 @@ SpCol<eT>::st() const
template<typename eT>
inline
const SpToDOp<SpCol<eT>,op_sp_as_dense>
SpCol<eT>::as_dense() const
{
return SpToDOp<SpCol<eT>,op_sp_as_dense>(*this);
}
//! remove specified row
template<typename eT>
inline
void
SpCol<eT>::shed_row(const uword row_num)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
arma_debug_check_bounds( row_num >= SpMat<eT>::n_rows, "SpCol::shed_row(): out of bounds" );
arma_conform_check_bounds( row_num >= SpMat<eT>::n_rows, "SpCol::shed_row(): out of bounds" );
shed_rows(row_num, row_num);
}
@@ -253,9 +275,9 @@ inline
void
SpCol<eT>::shed_rows(const uword in_row1, const uword in_row2)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
arma_debug_check_bounds
arma_conform_check_bounds
(
(in_row1 > in_row2) || (in_row2 >= SpMat<eT>::n_rows),
"SpCol::shed_rows(): indices out of bounds or incorrectly used"
@@ -339,11 +361,11 @@ SpCol<eT>::shed_rows(const uword in_row1, const uword in_row2)
// void
// SpCol<eT>::insert_rows(const uword row_num, const uword N, const bool set_to_zero)
// {
// arma_extra_debug_sigprint();
// arma_debug_sigprint();
//
// arma_debug_check(set_to_zero == false, "SpCol::insert_rows(): cannot set nonzero values");
// arma_conform_check(set_to_zero == false, "SpCol::insert_rows(): cannot set nonzero values");
//
// arma_debug_check_bounds((row_num > SpMat<eT>::n_rows), "SpCol::insert_rows(): out of bounds");
// arma_conform_check_bounds((row_num > SpMat<eT>::n_rows), "SpCol::insert_rows(): out of bounds");
//
// for(uword row = 0; row < SpMat<eT>::n_rows; ++row)
// {
@@ -364,9 +386,9 @@ inline
typename SpCol<eT>::row_iterator
SpCol<eT>::begin_row(const uword row_num)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
arma_debug_check_bounds( (row_num >= SpMat<eT>::n_rows), "SpCol::begin_row(): index out of bounds" );
arma_conform_check_bounds( (row_num >= SpMat<eT>::n_rows), "SpCol::begin_row(): index out of bounds" );
SpMat<eT>::sync_csc();
@@ -380,9 +402,9 @@ inline
typename SpCol<eT>::const_row_iterator
SpCol<eT>::begin_row(const uword row_num) const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
arma_debug_check_bounds( (row_num >= SpMat<eT>::n_rows), "SpCol::begin_row(): index out of bounds" );
arma_conform_check_bounds( (row_num >= SpMat<eT>::n_rows), "SpCol::begin_row(): index out of bounds" );
SpMat<eT>::sync_csc();
@@ -396,9 +418,9 @@ inline
typename SpCol<eT>::row_iterator
SpCol<eT>::end_row(const uword row_num)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
arma_debug_check_bounds( (row_num >= SpMat<eT>::n_rows), "SpCol::end_row(): index out of bounds" );
arma_conform_check_bounds( (row_num >= SpMat<eT>::n_rows), "SpCol::end_row(): index out of bounds" );
SpMat<eT>::sync_csc();
@@ -412,9 +434,9 @@ inline
typename SpCol<eT>::const_row_iterator
SpCol<eT>::end_row(const uword row_num) const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
arma_debug_check_bounds( (row_num >= SpMat<eT>::n_rows), "SpCol::end_row(): index out of bounds" );
arma_conform_check_bounds( (row_num >= SpMat<eT>::n_rows), "SpCol::end_row(): index out of bounds" );
SpMat<eT>::sync_csc();
+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,
@@ -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;
+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,
@@ -27,7 +27,7 @@ SpGlue<T1,T2,spglue_type>::SpGlue(const T1& in_A, const T2& in_B)
: A(in_A)
, B(in_B)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
@@ -39,7 +39,7 @@ SpGlue<T1,T2,spglue_type>::SpGlue(const T1& in_A, const T2& in_B, const typename
, B(in_B)
, aux(in_aux)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
@@ -48,7 +48,7 @@ template<typename T1, typename T2, typename spglue_type>
inline
SpGlue<T1,T2,spglue_type>::~SpGlue()
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
+43 -42
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,
@@ -139,9 +139,6 @@ class SpMat : public SpBase< eT, SpMat<eT> >
template<typename T1> inline SpMat& operator*=(const Op<T1, op_diagmat>& expr);
template<typename T1> inline SpMat& operator/=(const Op<T1, op_diagmat>& expr);
template<typename T1> inline SpMat& operator%=(const Op<T1, op_diagmat>& expr);
//! explicit specification of sparse +/- scalar
template<typename T1, typename op_type> inline explicit SpMat(const SpToDOp<T1, op_type>& expr);
//! construction of complex matrix out of two non-complex matrices
template<typename T1, typename T2>
@@ -171,7 +168,6 @@ class SpMat : public SpBase< eT, SpMat<eT> >
inline SpMat& operator%=(const spdiagview<eT>& X);
inline SpMat& operator/=(const spdiagview<eT>& X);
// delayed unary ops
template<typename T1, typename spop_type> inline SpMat(const SpOp<T1, spop_type>& X);
template<typename T1, typename spop_type> inline SpMat& operator= (const SpOp<T1, spop_type>& X);
template<typename T1, typename spop_type> inline SpMat& operator+=(const SpOp<T1, spop_type>& X);
@@ -180,7 +176,6 @@ class SpMat : public SpBase< eT, SpMat<eT> >
template<typename T1, typename spop_type> inline SpMat& operator%=(const SpOp<T1, spop_type>& X);
template<typename T1, typename spop_type> inline SpMat& operator/=(const SpOp<T1, spop_type>& X);
// delayed binary ops
template<typename T1, typename T2, typename spglue_type> inline SpMat(const SpGlue<T1, T2, spglue_type>& X);
template<typename T1, typename T2, typename spglue_type> inline SpMat& operator= (const SpGlue<T1, T2, spglue_type>& X);
template<typename T1, typename T2, typename spglue_type> inline SpMat& operator+=(const SpGlue<T1, T2, spglue_type>& X);
@@ -189,7 +184,6 @@ class SpMat : public SpBase< eT, SpMat<eT> >
template<typename T1, typename T2, typename spglue_type> inline SpMat& operator%=(const SpGlue<T1, T2, spglue_type>& X);
template<typename T1, typename T2, typename spglue_type> inline SpMat& operator/=(const SpGlue<T1, T2, spglue_type>& X);
// delayed mixed-type unary ops
template<typename T1, typename spop_type> inline SpMat(const mtSpOp<eT, T1, spop_type>& X);
template<typename T1, typename spop_type> inline SpMat& operator= (const mtSpOp<eT, T1, spop_type>& X);
template<typename T1, typename spop_type> inline SpMat& operator+=(const mtSpOp<eT, T1, spop_type>& X);
@@ -198,7 +192,6 @@ class SpMat : public SpBase< eT, SpMat<eT> >
template<typename T1, typename spop_type> inline SpMat& operator%=(const mtSpOp<eT, T1, spop_type>& X);
template<typename T1, typename spop_type> inline SpMat& operator/=(const mtSpOp<eT, T1, spop_type>& X);
// delayed mixed-type binary ops
template<typename T1, typename T2, typename spglue_type> inline SpMat(const mtSpGlue<eT, T1, T2, spglue_type>& X);
template<typename T1, typename T2, typename spglue_type> inline SpMat& operator= (const mtSpGlue<eT, T1, T2, spglue_type>& X);
template<typename T1, typename T2, typename spglue_type> inline SpMat& operator+=(const mtSpGlue<eT, T1, T2, spglue_type>& X);
@@ -207,6 +200,14 @@ class SpMat : public SpBase< eT, SpMat<eT> >
template<typename T1, typename T2, typename spglue_type> inline SpMat& operator%=(const mtSpGlue<eT, T1, T2, spglue_type>& X);
template<typename T1, typename T2, typename spglue_type> inline SpMat& operator/=(const mtSpGlue<eT, T1, T2, spglue_type>& X);
template<typename T1, typename op_type> inline SpMat(const mtSpReduceOp<eT, T1, op_type>& X);
template<typename T1, typename op_type> inline SpMat& operator= (const mtSpReduceOp<eT, T1, op_type>& X);
template<typename T1, typename op_type> inline SpMat& operator+=(const mtSpReduceOp<eT, T1, op_type>& X);
template<typename T1, typename op_type> inline SpMat& operator-=(const mtSpReduceOp<eT, T1, op_type>& X);
template<typename T1, typename op_type> inline SpMat& operator*=(const mtSpReduceOp<eT, T1, op_type>& X);
template<typename T1, typename op_type> inline SpMat& operator%=(const mtSpReduceOp<eT, T1, op_type>& X);
template<typename T1, typename op_type> inline SpMat& operator/=(const mtSpReduceOp<eT, T1, op_type>& X);
arma_inline SpSubview_row<eT> row(const uword row_num);
arma_inline const SpSubview_row<eT> row(const uword row_num) const;
@@ -324,51 +325,51 @@ class SpMat : public SpBase< eT, SpMat<eT> >
arma_warn_unused arma_inline bool in_range(const uword in_row, const uword in_col, const SizeMat& s) const;
template<typename eT2> inline void copy_size(const SpMat<eT2>& m);
template<typename eT2> inline void copy_size(const Mat<eT2>& m);
template<typename eT2> inline SpMat& copy_size(const SpMat<eT2>& m);
template<typename eT2> inline SpMat& copy_size(const Mat<eT2>& m);
inline void set_size(const uword in_elem);
inline void set_size(const uword in_rows, const uword in_cols);
inline void set_size(const SizeMat& s);
inline SpMat& set_size(const uword in_elem);
inline SpMat& set_size(const uword in_rows, const uword in_cols);
inline SpMat& set_size(const SizeMat& s);
inline void resize(const uword in_rows, const uword in_cols);
inline void resize(const SizeMat& s);
inline SpMat& resize(const uword in_rows, const uword in_cols);
inline SpMat& resize(const SizeMat& s);
inline void reshape(const uword in_rows, const uword in_cols);
inline void reshape(const SizeMat& s);
inline SpMat& reshape(const uword in_rows, const uword in_cols);
inline SpMat& reshape(const SizeMat& s);
inline void reshape_helper_generic(const uword in_rows, const uword in_cols); //! internal use only
inline void reshape_helper_intovec(); //! internal use only
template<typename functor> inline const SpMat& for_each(functor F);
template<typename functor> inline SpMat& for_each(functor F);
template<typename functor> inline const SpMat& for_each(functor F) const;
template<typename functor> inline const SpMat& transform(functor F);
template<typename functor> inline SpMat& transform(functor F);
inline const SpMat& replace(const eT old_val, const eT new_val);
inline SpMat& replace(const eT old_val, const eT new_val);
inline const SpMat& clean(const pod_type threshold);
inline SpMat& clean(const pod_type threshold);
inline const SpMat& clamp(const eT min_val, const eT max_val);
inline SpMat& clamp(const eT min_val, const eT max_val);
inline const SpMat& zeros();
inline const SpMat& zeros(const uword in_elem);
inline const SpMat& zeros(const uword in_rows, const uword in_cols);
inline const SpMat& zeros(const SizeMat& s);
inline SpMat& zeros();
inline SpMat& zeros(const uword in_elem);
inline SpMat& zeros(const uword in_rows, const uword in_cols);
inline SpMat& zeros(const SizeMat& s);
inline const SpMat& eye();
inline const SpMat& eye(const uword in_rows, const uword in_cols);
inline const SpMat& eye(const SizeMat& s);
inline SpMat& eye();
inline SpMat& eye(const uword in_rows, const uword in_cols);
inline SpMat& eye(const SizeMat& s);
inline const SpMat& speye();
inline const SpMat& speye(const uword in_rows, const uword in_cols);
inline const SpMat& speye(const SizeMat& s);
inline SpMat& speye();
inline SpMat& speye(const uword in_rows, const uword in_cols);
inline SpMat& speye(const SizeMat& s);
inline const SpMat& sprandu(const uword in_rows, const uword in_cols, const double density);
inline const SpMat& sprandu(const SizeMat& s, const double density);
inline SpMat& sprandu(const uword in_rows, const uword in_cols, const double density);
inline SpMat& sprandu(const SizeMat& s, const double density);
inline const SpMat& sprandn(const uword in_rows, const uword in_cols, const double density);
inline const SpMat& sprandn(const SizeMat& s, const double density);
inline SpMat& sprandn(const uword in_rows, const uword in_cols, const double density);
inline SpMat& sprandn(const SizeMat& s, const double density);
inline void reset();
inline void reset_cache();
@@ -398,11 +399,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_deprecated inline bool quiet_save(const std::string name, const file_type type = arma_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( std::ostream& os, const file_type type = arma_binary) const;
arma_deprecated inline bool quiet_load(const std::string name, const file_type type = arma_binary);
arma_deprecated 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);
@@ -695,7 +696,7 @@ class SpMat : public SpBase< eT, SpMat<eT> >
// 1: CSC needs to be updated from cache (ie. cache has more recent data)
// 2: no update required (ie. CSC and cache contain the same data)
#if (!defined(ARMA_DONT_USE_STD_MUTEX))
#if defined(ARMA_USE_STD_MUTEX)
arma_aligned mutable std::mutex cache_mutex;
#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,
File diff suppressed because it is too large Load Diff
+7 -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,
@@ -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;
@@ -40,10 +38,10 @@ class SpOp : public SpBase< typename T1::elem_type, SpOp<T1, op_type> >
arma_inline bool is_alias(const SpMat<elem_type>& X) const;
arma_aligned const T1& m; //!< the operand; must be derived from SpBase
arma_aligned elem_type aux; //!< auxiliary data, using the element type as used by T1
arma_aligned uword aux_uword_a; //!< auxiliary data, uword format
arma_aligned uword aux_uword_b; //!< auxiliary data, uword format
const T1& m; //!< the operand; must be derived from SpBase
elem_type aux; //!< auxiliary data, using the element type as used by T1
uword aux_uword_a; //!< auxiliary data, uword format
uword aux_uword_b; //!< auxiliary data, uword format
};
+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,
@@ -26,7 +26,7 @@ inline
SpOp<T1, op_type>::SpOp(const T1& in_m)
: m(in_m)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
@@ -37,7 +37,7 @@ SpOp<T1, op_type>::SpOp(const T1& in_m, const typename T1::elem_type in_aux)
: m(in_m)
, aux(in_aux)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
@@ -49,7 +49,7 @@ SpOp<T1, op_type>::SpOp(const T1& in_m, const uword in_aux_uword_a, const uword
, aux_uword_a(in_aux_uword_a)
, aux_uword_b(in_aux_uword_b)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
@@ -58,7 +58,7 @@ template<typename T1, typename op_type>
inline
SpOp<T1, op_type>::~SpOp()
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
+130 -79
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,45 +23,45 @@
// 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 = the type of the elements obtained from object Q
// pod_type = the underlying type of elements if elem_type is std::complex
// stored_type = the type of the Q object
// elem_type = type of the elements obtained from object Q
// pod_type = underlying type of elements if elem_type is std::complex
// stored_type = type of Q object
//
// const_iterator_type = the type of iterator provided by begin() and begin_col()
// const_row_iterator_type = the type of iterator provided by begin_row()
// const_iterator_type = type of iterator provided by begin() and begin_col()
// const_row_iterator_type = type of iterator provided by begin_row()
//
// use_iterator = boolean indicating that the provided iterators must be used for accessing elements
// Q_is_generated = boolean indicating that the Q object was generated by SpProxy
// use_iterator = boolean to indicate that provided iterators must be used for accessing elements
// Q_is_generated = boolean to indicate Q object was generated by SpProxy
//
// is_row = boolean indicating whether the Q object can be treated a row vector
// is_col = boolean indicating whether the Q object can be treated a column vector
// is_xvec = boolean indicating whether the Q object is a vector with unknown orientation
// is_row = boolean to indicate Q object can be treated a row vector
// is_col = boolean to indicate Q object can be treated a column vector
// is_xvec = boolean to indicate Q object is a vector with unknown orientation
//
// Q = object that can be unwrapped via the unwrap_spmat family of classes (ie. Q must be convertible to SpMat)
// Q = object that can be unwrapped via unwrap_spmat family of classes (ie. Q must be convertible to SpMat)
//
// get_n_rows() = return the number of rows in Q
// get_n_cols() = return the number of columns in Q
// get_n_elem() = return the number of elements in Q
// get_n_nonzero() = return the number of non-zero elements in Q
// get_n_rows() = return number of rows in Q
// get_n_cols() = return number of columns in Q
// get_n_elem() = return number of elements in Q
// get_n_nonzero() = return number of non-zero elements in Q
//
// operator[i] = linear element accessor; valid only if the 'use_iterator' boolean is false
// at(row,col) = access elements via (row,col); valid only if the 'use_iterator' boolean is false
//
// get_values() = return pointer to the CSC values array in Q; valid only if the 'use_iterator' boolean is false
// get_row_indices() = return pointer to the CSC row indices array in Q; valid only if the 'use_iterator' boolean is false
// get_col_ptrs() = return pointer to the CSC column pointers array in Q; valid only if the 'use_iterator' boolean is false
// get_values() = return pointer to CSC values array in Q; valid only if the 'use_iterator' boolean is false
// get_row_indices() = return pointer to CSC row indices array in Q; valid only if the 'use_iterator' boolean is false
// get_col_ptrs() = return pointer to CSC column pointers array in Q; valid only if the 'use_iterator' boolean is false
//
// begin() = column-wise iterator indicating the first element in Q
// begin_col(col_num) = column-wise iterator indicating the first element in column 'col_num' in Q
// begin_row(row_num = 0) = row-wise iterator indicating the first element in row 'row_num' in Q
// begin() = column-wise iterator indicating first element in Q
// begin_col(col_num) = column-wise iterator indicating first element in column 'col_num' in Q
// begin_row(row_num = 0) = row-wise iterator indicating first element in row 'row_num' in Q
//
// end() = column-wise iterator indicating the "one-past-end" element in Q
// end_row() = row-wise iterator indicating the "one-past-end" element in Q
// end_row(row_num) = row-wise iterator indicating the "one-past-end" element in row 'row_num' in Q
// end() = column-wise iterator indicating "one-past-end" element in Q
// end_row() = row-wise iterator indicating "one-past-end" element in Q
// end_row(row_num) = row-wise iterator indicating "one-past-end" element in row 'row_num' in Q
//
// is_alias(X) = return true/false indicating whether the Q object aliases matrix X
// is_alias(X) = return true/false to indicate Q object aliases matrix X
@@ -71,48 +71,48 @@ struct SpProxy< SpMat<eT> >
typedef eT elem_type;
typedef typename get_pod_type<elem_type>::result pod_type;
typedef SpMat<eT> stored_type;
typedef typename SpMat<eT>::const_iterator const_iterator_type;
typedef typename SpMat<eT>::const_row_iterator const_row_iterator_type;
static constexpr bool use_iterator = false;
static constexpr bool Q_is_generated = false;
static constexpr bool is_row = false;
static constexpr bool is_col = false;
static constexpr bool is_xvec = false;
arma_aligned const SpMat<eT>& Q;
const SpMat<eT>& Q;
inline explicit SpProxy(const SpMat<eT>& A)
: Q(A)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
Q.sync();
}
arma_inline uword get_n_rows() const { return Q.n_rows; }
arma_inline uword get_n_cols() const { return Q.n_cols; }
arma_inline uword get_n_elem() const { return Q.n_elem; }
arma_inline uword get_n_nonzero() const { return Q.n_nonzero; }
arma_inline elem_type operator[](const uword i) const { return Q[i]; }
arma_inline elem_type at (const uword row, const uword col) const { return Q.at(row, col); }
arma_inline const eT* get_values() const { return Q.values; }
arma_inline const uword* get_row_indices() const { return Q.row_indices; }
arma_inline const uword* get_col_ptrs() const { return Q.col_ptrs; }
arma_inline const_iterator_type begin() const { return Q.begin(); }
arma_inline const_iterator_type begin_col(const uword col_num) const { return Q.begin_col(col_num); }
arma_inline const_row_iterator_type begin_row(const uword row_num = 0) const { return Q.begin_row(row_num); }
arma_inline const_iterator_type end() const { return Q.end(); }
arma_inline const_row_iterator_type end_row() const { return Q.end_row(); }
arma_inline const_row_iterator_type end_row(const uword row_num) const { return Q.end_row(row_num); }
template<typename eT2>
arma_inline bool is_alias(const SpMat<eT2>& X) const { return (void_ptr(&Q) == void_ptr(&X)); }
arma_inline bool is_alias(const SpMat<eT2>& X) const { return (is_same_type<eT,eT2>::yes) && (void_ptr(&Q) == void_ptr(&X)); }
};
@@ -134,12 +134,12 @@ struct SpProxy< SpCol<eT> >
static constexpr bool is_col = true;
static constexpr bool is_xvec = false;
arma_aligned const SpCol<eT>& Q;
const SpCol<eT>& Q;
inline explicit SpProxy(const SpCol<eT>& A)
: Q(A)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
Q.sync();
}
@@ -164,7 +164,7 @@ struct SpProxy< SpCol<eT> >
arma_inline const_row_iterator_type end_row(const uword row_num) const { return Q.end_row(row_num); }
template<typename eT2>
arma_inline bool is_alias(const SpMat<eT2>& X) const { return (void_ptr(&Q) == void_ptr(&X)); }
arma_inline bool is_alias(const SpMat<eT2>& X) const { return (is_same_type<eT,eT2>::yes) && (void_ptr(&Q) == void_ptr(&X)); }
};
@@ -186,12 +186,12 @@ struct SpProxy< SpRow<eT> >
static constexpr bool is_col = false;
static constexpr bool is_xvec = false;
arma_aligned const SpRow<eT>& Q;
const SpRow<eT>& Q;
inline explicit SpProxy(const SpRow<eT>& A)
: Q(A)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
Q.sync();
}
@@ -216,7 +216,7 @@ struct SpProxy< SpRow<eT> >
arma_inline const_row_iterator_type end_row(const uword row_num) const { return Q.end_row(row_num); }
template<typename eT2>
arma_inline bool is_alias(const SpMat<eT2>& X) const { return (void_ptr(&Q) == void_ptr(&X)); }
arma_inline bool is_alias(const SpMat<eT2>& X) const { return (is_same_type<eT,eT2>::yes) && (void_ptr(&Q) == void_ptr(&X)); }
};
@@ -227,48 +227,48 @@ struct SpProxy< SpSubview<eT> >
typedef eT elem_type;
typedef typename get_pod_type<elem_type>::result pod_type;
typedef SpSubview<eT> stored_type;
typedef typename SpSubview<eT>::const_iterator const_iterator_type;
typedef typename SpSubview<eT>::const_row_iterator const_row_iterator_type;
static constexpr bool use_iterator = true;
static constexpr bool Q_is_generated = false;
static constexpr bool is_row = false;
static constexpr bool is_col = false;
static constexpr bool is_xvec = false;
arma_aligned const SpSubview<eT>& Q;
const SpSubview<eT>& Q;
inline explicit SpProxy(const SpSubview<eT>& A)
: Q(A)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
Q.m.sync();
}
arma_inline uword get_n_rows() const { return Q.n_rows; }
arma_inline uword get_n_cols() const { return Q.n_cols; }
arma_inline uword get_n_elem() const { return Q.n_elem; }
arma_inline uword get_n_nonzero() const { return Q.n_nonzero; }
arma_inline elem_type operator[](const uword i) const { return Q[i]; }
arma_inline elem_type at (const uword row, const uword col) const { return Q.at(row, col); }
arma_inline const eT* get_values() const { return Q.m.values; }
arma_inline const uword* get_row_indices() const { return Q.m.row_indices; }
arma_inline const uword* get_col_ptrs() const { return Q.m.col_ptrs; }
arma_inline const_iterator_type begin() const { return Q.begin(); }
arma_inline const_iterator_type begin_col(const uword col_num) const { return Q.begin_col(col_num); }
arma_inline const_row_iterator_type begin_row(const uword row_num = 0) const { return Q.begin_row(row_num); }
arma_inline const_iterator_type end() const { return Q.end(); }
arma_inline const_row_iterator_type end_row() const { return Q.end_row(); }
arma_inline const_row_iterator_type end_row(const uword row_num) const { return Q.end_row(row_num); }
template<typename eT2>
arma_inline bool is_alias(const SpMat<eT2>& X) const { return (void_ptr(&Q.m) == void_ptr(&X)); }
arma_inline bool is_alias(const SpMat<eT2>& X) const { return (is_same_type<eT,eT2>::yes) && (void_ptr(&Q.m) == void_ptr(&X)); }
};
@@ -290,12 +290,12 @@ struct SpProxy< SpSubview_col<eT> >
static constexpr bool is_col = true;
static constexpr bool is_xvec = false;
arma_aligned const SpSubview_col<eT>& Q;
const SpSubview_col<eT>& Q;
inline explicit SpProxy(const SpSubview_col<eT>& A)
: Q(A)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
Q.m.sync();
}
@@ -320,7 +320,7 @@ struct SpProxy< SpSubview_col<eT> >
arma_inline const_row_iterator_type end_row(const uword row_num) const { return Q.end_row(row_num); }
template<typename eT2>
arma_inline bool is_alias(const SpMat<eT2>& X) const { return (void_ptr(&Q.m) == void_ptr(&X)); }
arma_inline bool is_alias(const SpMat<eT2>& X) const { return (is_same_type<eT,eT2>::yes) && (void_ptr(&Q.m) == void_ptr(&X)); }
};
@@ -342,12 +342,12 @@ struct SpProxy< SpSubview_col_list<eT,T1> >
static constexpr bool is_col = false;
static constexpr bool is_xvec = false;
arma_aligned const SpMat<eT> Q;
const SpMat<eT> Q;
inline explicit SpProxy(const SpSubview_col_list<eT,T1>& A)
: Q(A)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
arma_inline uword get_n_rows() const { return Q.n_rows; }
@@ -385,7 +385,7 @@ struct SpProxy< SpSubview_row<eT> >
typedef typename SpSubview<eT>::const_iterator const_iterator_type;
typedef typename SpSubview<eT>::const_row_iterator const_row_iterator_type;
static constexpr bool use_iterator = true;
static constexpr bool Q_is_generated = false;
@@ -393,12 +393,12 @@ struct SpProxy< SpSubview_row<eT> >
static constexpr bool is_col = false;
static constexpr bool is_xvec = false;
arma_aligned const SpSubview_row<eT>& Q;
const SpSubview_row<eT>& Q;
inline explicit SpProxy(const SpSubview_row<eT>& A)
: Q(A)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
Q.m.sync();
}
@@ -423,7 +423,7 @@ struct SpProxy< SpSubview_row<eT> >
arma_inline const_row_iterator_type end_row(const uword row_num) const { return Q.end_row(row_num); }
template<typename eT2>
arma_inline bool is_alias(const SpMat<eT2>& X) const { return (void_ptr(&Q.m) == void_ptr(&X)); }
arma_inline bool is_alias(const SpMat<eT2>& X) const { return (is_same_type<eT,eT2>::yes) && (void_ptr(&Q.m) == void_ptr(&X)); }
};
@@ -445,12 +445,12 @@ struct SpProxy< spdiagview<eT> >
static constexpr bool is_col = true;
static constexpr bool is_xvec = false;
arma_aligned const SpMat<eT> Q;
const SpMat<eT> Q;
inline explicit SpProxy(const spdiagview<eT>& A)
: Q(A)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
arma_inline uword get_n_rows() const { return Q.n_rows; }
@@ -497,12 +497,12 @@ struct SpProxy< SpOp<T1, spop_type> >
static constexpr bool is_col = SpOp<T1, spop_type>::is_col;
static constexpr bool is_xvec = SpOp<T1, spop_type>::is_xvec;
arma_aligned const SpMat<eT> Q;
const SpMat<eT> Q;
inline explicit SpProxy(const SpOp<T1, spop_type>& A)
: Q(A)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
arma_inline uword get_n_rows() const { return is_row ? 1 : Q.n_rows; }
@@ -549,12 +549,12 @@ struct SpProxy< SpGlue<T1, T2, spglue_type> >
static constexpr bool is_col = SpGlue<T1, T2, spglue_type>::is_col;
static constexpr bool is_xvec = SpGlue<T1, T2, spglue_type>::is_xvec;
arma_aligned const SpMat<eT> Q;
const SpMat<eT> Q;
inline explicit SpProxy(const SpGlue<T1, T2, spglue_type>& A)
: Q(A)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
arma_inline uword get_n_rows() const { return is_row ? 1 : Q.n_rows; }
@@ -600,12 +600,12 @@ struct SpProxy< mtSpOp<out_eT, T1, spop_type> >
static constexpr bool is_col = mtSpOp<out_eT, T1, spop_type>::is_col;
static constexpr bool is_xvec = mtSpOp<out_eT, T1, spop_type>::is_xvec;
arma_aligned const SpMat<out_eT> Q;
const SpMat<out_eT> Q;
inline explicit SpProxy(const mtSpOp<out_eT, T1, spop_type>& A)
: Q(A)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
arma_inline uword get_n_rows() const { return is_row ? 1 : Q.n_rows; }
@@ -651,12 +651,63 @@ struct SpProxy< mtSpGlue<out_eT, T1, T2, spglue_type> >
static constexpr bool is_col = mtSpGlue<out_eT, T1, T2, spglue_type>::is_col;
static constexpr bool is_xvec = mtSpGlue<out_eT, T1, T2, spglue_type>::is_xvec;
arma_aligned const SpMat<out_eT> Q;
const SpMat<out_eT> Q;
inline explicit SpProxy(const mtSpGlue<out_eT, T1, T2, spglue_type>& A)
: Q(A)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
arma_inline uword get_n_rows() const { return is_row ? 1 : Q.n_rows; }
arma_inline uword get_n_cols() const { return is_col ? 1 : Q.n_cols; }
arma_inline uword get_n_elem() const { return Q.n_elem; }
arma_inline uword get_n_nonzero() const { return Q.n_nonzero; }
arma_inline elem_type operator[](const uword i) const { return Q[i]; }
arma_inline elem_type at (const uword row, const uword col) const { return Q.at(row, col); }
arma_inline const out_eT* get_values() const { return Q.values; }
arma_inline const uword* get_row_indices() const { return Q.row_indices; }
arma_inline const uword* get_col_ptrs() const { return Q.col_ptrs; }
arma_inline const_iterator_type begin() const { return Q.begin(); }
arma_inline const_iterator_type begin_col(const uword col_num) const { return Q.begin_col(col_num); }
arma_inline const_row_iterator_type begin_row(const uword row_num = 0) const { return Q.begin_row(row_num); }
arma_inline const_iterator_type end() const { return Q.end(); }
arma_inline const_row_iterator_type end_row() const { return Q.end_row(); }
arma_inline const_row_iterator_type end_row(const uword row_num) const { return Q.end_row(row_num); }
template<typename eT2>
constexpr bool is_alias(const SpMat<eT2>&) const { return false; }
};
template<typename out_eT, typename T1, typename op_type>
struct SpProxy< mtSpReduceOp<out_eT, T1, op_type> >
{
typedef out_eT elem_type;
typedef typename get_pod_type<elem_type>::result pod_type;
typedef SpMat<out_eT> stored_type;
typedef typename SpMat<out_eT>::const_iterator const_iterator_type;
typedef typename SpMat<out_eT>::const_row_iterator const_row_iterator_type;
static constexpr bool use_iterator = false;
static constexpr bool Q_is_generated = true;
static constexpr bool is_row = mtSpReduceOp<out_eT, T1, op_type>::is_row;
static constexpr bool is_col = mtSpReduceOp<out_eT, T1, op_type>::is_col;
static constexpr bool is_xvec = mtSpReduceOp<out_eT, T1, op_type>::is_xvec;
const SpMat<out_eT> Q;
inline explicit SpProxy(const mtSpReduceOp<out_eT, T1, op_type>& A)
: Q(A)
{
arma_debug_sigprint();
}
arma_inline uword get_n_rows() const { return is_row ? 1 : Q.n_rows; }
+8 -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,
@@ -25,7 +25,7 @@ template<typename eT>
class SpRow : public SpMat<eT>
{
public:
typedef eT elem_type;
typedef typename get_pod_type<eT>::result pod_type;
@@ -47,7 +47,9 @@ class SpRow : public SpMat<eT>
inline SpRow& operator=(const eT val);
template<typename T1> inline SpRow(const Base<eT,T1>& X);
inline SpRow(const Row<eT>& X); // for backwards compatibility
template<typename T1> inline explicit SpRow(const Base<eT,T1>& X);
template<typename T1> inline SpRow& operator=(const Base<eT,T1>& X);
template<typename T1> inline SpRow(const SpBase<eT,T1>& X);
@@ -60,6 +62,8 @@ class SpRow : public SpMat<eT>
arma_warn_unused inline const SpOp<SpRow<eT>,spop_htrans> ht() const;
arma_warn_unused inline const SpOp<SpRow<eT>,spop_strans> st() const;
arma_warn_unused inline const SpToDOp<SpRow<eT>,op_sp_as_dense> as_dense() const;
inline void shed_col (const uword col_num);
inline void shed_cols(const uword in_col1, const uword in_col2);
+55 -31
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,7 +26,7 @@ inline
SpRow<eT>::SpRow()
: SpMat<eT>(arma_vec_indicator(), 2)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
@@ -36,7 +36,7 @@ inline
SpRow<eT>::SpRow(const uword in_n_elem)
: SpMat<eT>(arma_vec_indicator(), 1, in_n_elem, 2)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
@@ -46,7 +46,7 @@ inline
SpRow<eT>::SpRow(const uword in_n_rows, const uword in_n_cols)
: SpMat<eT>(arma_vec_indicator(), in_n_rows, in_n_cols, 2)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
@@ -56,7 +56,7 @@ inline
SpRow<eT>::SpRow(const SizeMat& s)
: SpMat<eT>(arma_vec_indicator(), 0, 0, 2)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
SpMat<eT>::init(s.n_rows, s.n_cols);
}
@@ -68,7 +68,7 @@ inline
SpRow<eT>::SpRow(const char* text)
: SpMat<eT>(arma_vec_indicator(), 2)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
SpMat<eT>::init(std::string(text));
}
@@ -80,7 +80,7 @@ inline
SpRow<eT>&
SpRow<eT>::operator=(const char* text)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
SpMat<eT>::init(std::string(text));
@@ -94,7 +94,7 @@ inline
SpRow<eT>::SpRow(const std::string& text)
: SpMat<eT>(arma_vec_indicator(), 2)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
SpMat<eT>::init(text);
}
@@ -106,7 +106,7 @@ inline
SpRow<eT>&
SpRow<eT>::operator=(const std::string& text)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
SpMat<eT>::init(text);
@@ -120,7 +120,7 @@ inline
SpRow<eT>&
SpRow<eT>::operator=(const eT val)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
SpMat<eT>::operator=(val);
@@ -135,20 +135,34 @@ inline
SpRow<eT>::SpRow(const Base<eT,T1>& X)
: SpMat<eT>(arma_vec_indicator(), 2)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
SpMat<eT>::operator=(X.get_ref());
}
template<typename eT>
inline
SpRow<eT>::SpRow(const Row<eT>& X)
: SpMat<eT>(arma_vec_indicator(), 2)
{
arma_debug_sigprint();
SpMat<eT>::operator=(X);
}
template<typename eT>
template<typename T1>
inline
SpRow<eT>&
SpRow<eT>::operator=(const Base<eT,T1>& X)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
SpMat<eT>::operator=(X.get_ref());
@@ -163,7 +177,7 @@ inline
SpRow<eT>::SpRow(const SpBase<eT,T1>& X)
: SpMat<eT>(arma_vec_indicator(), 2)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
SpMat<eT>::operator=(X.get_ref());
}
@@ -176,7 +190,7 @@ inline
SpRow<eT>&
SpRow<eT>::operator=(const SpBase<eT,T1>& X)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
SpMat<eT>::operator=(X.get_ref());
@@ -195,7 +209,7 @@ SpRow<eT>::SpRow
)
: SpMat<eT>(arma_vec_indicator(), 2)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
SpMat<eT>::init(A,B);
}
@@ -232,15 +246,25 @@ SpRow<eT>::st() const
template<typename eT>
inline
const SpToDOp<SpRow<eT>,op_sp_as_dense>
SpRow<eT>::as_dense() const
{
return SpToDOp<SpRow<eT>,op_sp_as_dense>(*this);
}
//! remove specified columns
template<typename eT>
inline
void
SpRow<eT>::shed_col(const uword col_num)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
arma_debug_check_bounds( col_num >= SpMat<eT>::n_cols, "SpRow::shed_col(): out of bounds" );
arma_conform_check_bounds( col_num >= SpMat<eT>::n_cols, "SpRow::shed_col(): out of bounds" );
shed_cols(col_num, col_num);
}
@@ -253,9 +277,9 @@ inline
void
SpRow<eT>::shed_cols(const uword in_col1, const uword in_col2)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
arma_debug_check_bounds
arma_conform_check_bounds
(
(in_col1 > in_col2) || (in_col2 >= SpMat<eT>::n_cols),
"SpRow::shed_cols(): indices out of bounds or incorrectly used"
@@ -335,12 +359,12 @@ SpRow<eT>::shed_cols(const uword in_col1, const uword in_col2)
// void
// SpRow<eT>::insert_cols(const uword col_num, const uword N, const bool set_to_zero)
// {
// arma_extra_debug_sigprint();
// arma_debug_sigprint();
//
// // insertion at col_num == n_cols is in effect an append operation
// arma_debug_check_bounds( (col_num > SpMat<eT>::n_cols), "SpRow::insert_cols(): out of bounds" );
// arma_conform_check_bounds( (col_num > SpMat<eT>::n_cols), "SpRow::insert_cols(): out of bounds" );
//
// arma_debug_check( (set_to_zero == false), "SpRow::insert_cols(): cannot set elements to nonzero values" );
// arma_conform_check( (set_to_zero == false), "SpRow::insert_cols(): cannot set elements to nonzero values" );
//
// uword newVal = (col_num == 0) ? 0 : SpMat<eT>::col_ptrs[col_num];
// SpMat<eT>::col_ptrs.insert(col_num, N, newVal);
@@ -364,11 +388,11 @@ inline
typename SpRow<eT>::row_iterator
SpRow<eT>::begin_row(const uword row_num)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
// Since this is a row, row_num can only be 0. But the option is provided for
// compatibility.
arma_debug_check_bounds((row_num >= 1), "SpRow::begin_row(): index out of bounds");
arma_conform_check_bounds((row_num >= 1), "SpRow::begin_row(): index out of bounds");
return SpMat<eT>::begin();
}
@@ -380,11 +404,11 @@ inline
typename SpRow<eT>::const_row_iterator
SpRow<eT>::begin_row(const uword row_num) const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
// Since this is a row, row_num can only be 0. But the option is provided for
// compatibility.
arma_debug_check_bounds((row_num >= 1), "SpRow::begin_row(): index out of bounds");
arma_conform_check_bounds((row_num >= 1), "SpRow::begin_row(): index out of bounds");
return SpMat<eT>::begin();
}
@@ -396,11 +420,11 @@ inline
typename SpRow<eT>::row_iterator
SpRow<eT>::end_row(const uword row_num)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
// Since this is a row, row_num can only be 0. But the option is provided for
// compatibility.
arma_debug_check_bounds((row_num >= 1), "SpRow::end_row(): index out of bounds");
arma_conform_check_bounds((row_num >= 1), "SpRow::end_row(): index out of bounds");
return SpMat<eT>::end();
}
@@ -412,11 +436,11 @@ inline
typename SpRow<eT>::const_row_iterator
SpRow<eT>::end_row(const uword row_num) const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
// Since this is a row, row_num can only be 0. But the option is provided for
// compatibility.
arma_debug_check_bounds((row_num >= 1), "SpRow::end_row(): index out of bounds");
arma_conform_check_bounds((row_num >= 1), "SpRow::end_row(): index out of bounds");
return SpMat<eT>::end();
}
+17 -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,
@@ -104,24 +104,24 @@ class SpSubview : public SpBase< eT, SpSubview<eT> >
inline void randn();
arma_hot inline SpSubview_MapMat_val<eT> operator[](const uword i);
arma_hot inline eT operator[](const uword i) const;
arma_warn_unused inline SpSubview_MapMat_val<eT> operator[](const uword i);
arma_warn_unused inline eT operator[](const uword i) const;
arma_hot inline SpSubview_MapMat_val<eT> operator()(const uword i);
arma_hot inline eT operator()(const uword i) const;
arma_warn_unused inline SpSubview_MapMat_val<eT> operator()(const uword i);
arma_warn_unused inline eT operator()(const uword i) const;
arma_hot inline SpSubview_MapMat_val<eT> operator()(const uword in_row, const uword in_col);
arma_hot inline eT operator()(const uword in_row, const uword in_col) const;
arma_warn_unused inline SpSubview_MapMat_val<eT> operator()(const uword in_row, const uword in_col);
arma_warn_unused inline eT operator()(const uword in_row, const uword in_col) const;
arma_hot inline SpSubview_MapMat_val<eT> at(const uword i);
arma_hot inline eT at(const uword i) const;
arma_warn_unused inline SpSubview_MapMat_val<eT> at(const uword i);
arma_warn_unused inline eT at(const uword i) const;
arma_hot inline SpSubview_MapMat_val<eT> at(const uword in_row, const uword in_col);
arma_hot inline eT at(const uword in_row, const uword in_col) const;
arma_warn_unused inline SpSubview_MapMat_val<eT> at(const uword in_row, const uword in_col);
arma_warn_unused inline eT at(const uword in_row, const uword in_col) const;
inline bool check_overlap(const SpSubview& x) const;
inline bool is_vec() const;
arma_warn_unused inline bool is_vec() const;
inline SpSubview_row<eT> row(const uword row_num);
inline const SpSubview_row<eT> row(const uword row_num) const;
@@ -361,6 +361,8 @@ class SpSubview_col : public SpSubview<eT>
arma_warn_unused inline const SpOp<SpSubview_col<eT>,spop_htrans> ht() const;
arma_warn_unused inline const SpOp<SpSubview_col<eT>,spop_strans> st() const;
arma_warn_unused inline const SpToDOp<SpSubview_col<eT>,op_sp_as_dense> as_dense() const;
protected:
@@ -399,6 +401,8 @@ class SpSubview_row : public SpSubview<eT>
arma_warn_unused inline const SpOp<SpSubview_row<eT>,spop_htrans> ht() const;
arma_warn_unused inline const SpOp<SpSubview_row<eT>,spop_strans> st() const;
arma_warn_unused inline const SpToDOp<SpSubview_row<eT>,op_sp_as_dense> as_dense() const;
protected:
@@ -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,
@@ -25,7 +25,7 @@ template<typename eT, typename T1>
inline
SpSubview_col_list<eT,T1>::~SpSubview_col_list()
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
@@ -40,13 +40,13 @@ SpSubview_col_list<eT,T1>::SpSubview_col_list
: m (in_m )
, U_ci(in_ci.get_ref())
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const umat& ci = U_ci.M;
const uword* ci_mem = ci.memptr();
const uword ci_n_elem = ci.n_elem;
arma_debug_check
arma_conform_check
(
( (ci.is_vec() == false) && (ci.is_empty() == false) ),
"SpMat::cols(): given object must be a vector"
@@ -56,7 +56,7 @@ SpSubview_col_list<eT,T1>::SpSubview_col_list
{
const uword i = ci_mem[ci_count];
arma_debug_check_bounds( (i >= in_m.n_cols), "SpMat::cols(): index out of bounds" );
arma_conform_check_bounds( (i >= in_m.n_cols), "SpMat::cols(): index out of bounds" );
}
}
@@ -69,7 +69,7 @@ inline
void
SpSubview_col_list<eT,T1>::for_each(functor F)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
SpMat<eT> tmp(*this);
@@ -86,7 +86,7 @@ inline
void
SpSubview_col_list<eT,T1>::for_each(functor F) const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const SpMat<eT> tmp(*this);
@@ -102,7 +102,7 @@ inline
void
SpSubview_col_list<eT,T1>::transform(functor F)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
SpMat<eT> tmp(*this);
@@ -118,7 +118,7 @@ inline
void
SpSubview_col_list<eT,T1>::replace(const eT old_val, const eT new_val)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
SpMat<eT> tmp(*this);
@@ -134,7 +134,7 @@ inline
void
SpSubview_col_list<eT,T1>::clean(const typename get_pod_type<eT>::result threshold)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
SpMat<eT> tmp(*this);
@@ -150,7 +150,7 @@ inline
void
SpSubview_col_list<eT,T1>::fill(const eT val)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
Mat<eT> tmp(m.n_rows, U_ci.M.n_elem, arma_nozeros_indicator()); tmp.fill(val);
@@ -164,7 +164,7 @@ inline
void
SpSubview_col_list<eT,T1>::zeros()
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
SpMat<eT>& m_local = const_cast< SpMat<eT>& >(m);
@@ -201,7 +201,7 @@ inline
void
SpSubview_col_list<eT,T1>::ones()
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const Mat<eT> tmp(m.n_rows, U_ci.M.n_elem, fill::ones);
@@ -215,7 +215,7 @@ inline
void
SpSubview_col_list<eT,T1>::operator+= (const eT val)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const SpMat<eT> tmp1(*this);
@@ -233,7 +233,7 @@ inline
void
SpSubview_col_list<eT,T1>::operator-= (const eT val)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const SpMat<eT> tmp1(*this);
@@ -251,9 +251,7 @@ inline
void
SpSubview_col_list<eT,T1>::operator*= (const eT val)
{
arma_extra_debug_sigprint();
if(val == eT(0)) { (*this).zeros(); return; }
arma_debug_sigprint();
SpMat<eT>& m_local = const_cast< SpMat<eT>& >(m);
@@ -296,7 +294,7 @@ inline
void
SpSubview_col_list<eT,T1>::operator/= (const eT val)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const SpMat<eT> tmp1(*this);
@@ -315,7 +313,7 @@ inline
void
SpSubview_col_list<eT,T1>::operator= (const Base<eT,expr>& x)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const quasi_unwrap<expr> U(x.get_ref());
const Mat<eT>& X = U.M;
@@ -326,7 +324,7 @@ SpSubview_col_list<eT,T1>::operator= (const Base<eT,expr>& x)
const uword* ci_mem = ci.memptr();
const uword ci_n_elem = ci.n_elem;
arma_debug_assert_same_size( m_local.n_rows, ci_n_elem, X.n_rows, X.n_cols, "SpMat::cols()" );
arma_conform_assert_same_size( m_local.n_rows, ci_n_elem, X.n_rows, X.n_cols, "SpMat::cols()" );
const uword X_n_elem = X.n_elem;
const eT* X_mem = X.memptr();
@@ -378,7 +376,7 @@ inline
void
SpSubview_col_list<eT,T1>::operator+= (const Base<eT,expr>& x)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const Mat<eT> tmp = SpMat<eT>(*this) + x.get_ref();
@@ -393,7 +391,7 @@ inline
void
SpSubview_col_list<eT,T1>::operator-= (const Base<eT,expr>& x)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const Mat<eT> tmp = SpMat<eT>(*this) - x.get_ref();
@@ -408,7 +406,7 @@ inline
void
SpSubview_col_list<eT,T1>::operator%= (const Base<eT,expr>& x)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const SpMat<eT> tmp = SpMat<eT>(*this) % x.get_ref();
@@ -423,7 +421,7 @@ inline
void
SpSubview_col_list<eT,T1>::operator/= (const Base<eT,expr>& x)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const SpMat<eT> tmp = SpMat<eT>(*this) / x.get_ref();
@@ -437,7 +435,7 @@ inline
void
SpSubview_col_list<eT,T1>::operator= (const SpSubview_col_list<eT,T1>& x)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const SpMat<eT> tmp(x);
@@ -452,7 +450,7 @@ inline
void
SpSubview_col_list<eT,T1>::operator= (const SpSubview_col_list<eT,T2>& x)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const SpMat<eT> tmp(x);
@@ -467,7 +465,7 @@ inline
void
SpSubview_col_list<eT,T1>::operator= (const SpBase<eT,expr>& x)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const unwrap_spmat<expr> U(x.get_ref());
const SpMat<eT>& X = U.M;
@@ -487,7 +485,7 @@ SpSubview_col_list<eT,T1>::operator= (const SpBase<eT,expr>& x)
const uword* ci_mem = ci.memptr();
const uword ci_n_elem = ci.n_elem;
arma_debug_assert_same_size( m_local.n_rows, ci_n_elem, X.n_rows, X.n_cols, "SpMat::cols()" );
arma_conform_assert_same_size( m_local.n_rows, ci_n_elem, X.n_rows, X.n_cols, "SpMat::cols()" );
SpMat<eT> Y(arma_reserve_indicator(), X.n_rows, m_local.n_cols, X.n_nonzero);
@@ -531,7 +529,7 @@ inline
void
SpSubview_col_list<eT,T1>::operator+= (const SpBase<eT,expr>& x)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const SpMat<eT> tmp = SpMat<eT>(*this) + x.get_ref();
@@ -546,7 +544,7 @@ inline
void
SpSubview_col_list<eT,T1>::operator-= (const SpBase<eT,expr>& x)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const SpMat<eT> tmp = SpMat<eT>(*this) - x.get_ref();
@@ -561,7 +559,7 @@ inline
void
SpSubview_col_list<eT,T1>::operator%= (const SpBase<eT,expr>& x)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const SpMat<eT> tmp = SpMat<eT>(*this) % x.get_ref();
@@ -576,7 +574,7 @@ inline
void
SpSubview_col_list<eT,T1>::operator/= (const SpBase<eT,expr>& x)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
SpMat<eT> tmp(*this);
@@ -597,7 +595,7 @@ inline
void
SpSubview_col_list<eT,T1>::extract(SpMat<eT>& out, const SpSubview_col_list<eT,T1>& in)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
// NOTE: aliasing is handled by SpMat<eT>::operator=(const SpSubview_col_list<eT,T1>& in)
@@ -665,7 +663,7 @@ inline
void
SpSubview_col_list<eT,T1>::plus_inplace(SpMat<eT>& out, const SpSubview_col_list& in)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const SpMat<eT> tmp(in);
@@ -679,7 +677,7 @@ inline
void
SpSubview_col_list<eT,T1>::minus_inplace(SpMat<eT>& out, const SpSubview_col_list& in)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const SpMat<eT> tmp(in);
@@ -693,7 +691,7 @@ inline
void
SpSubview_col_list<eT,T1>::schur_inplace(SpMat<eT>& out, const SpSubview_col_list& in)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const SpMat<eT> tmp(in);
@@ -707,7 +705,7 @@ inline
void
SpSubview_col_list<eT,T1>::div_inplace(SpMat<eT>& out, const SpSubview_col_list& in)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const SpMat<eT> tmp(in);
@@ -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,
@@ -816,7 +816,7 @@ SpSubview<eT>::const_row_iterator::operator++()
else if((*pos_ptr) == next_min_row + aux_row && col < next_min_col && (*pos_ptr) < aux_row + iterator_base::M->n_rows)
{
// The first element in this column is in a subsequent row that we
// already have another elemnt for, but the column index is less so
// already have another element for, but the column index is less so
// this element will come first.
next_min_col = col;
next_actual_pos = col_offset + (pos_ptr - start_ptr);
+138 -110
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,7 +24,7 @@ template<typename eT>
inline
SpSubview<eT>::~SpSubview()
{
arma_extra_debug_sigprint_this(this);
arma_debug_sigprint_this(this);
}
@@ -40,22 +40,32 @@ SpSubview<eT>::SpSubview(const SpMat<eT>& in_m, const uword in_row1, const uword
, n_elem(in_n_rows * in_n_cols)
, n_nonzero(0)
{
arma_extra_debug_sigprint_this(this);
arma_debug_sigprint_this(this);
m.sync_csc();
// There must be a O(1) way to do this
uword lend = m.col_ptrs[in_col1 + in_n_cols];
uword lend_row = in_row1 + in_n_rows;
uword count = 0;
// count the number of non-zeros in the subview
uword count = 0;
for(uword i = m.col_ptrs[in_col1]; i < lend; ++i)
if(n_rows == m.n_rows)
{
const uword m_row_indices_i = m.row_indices[i];
count = m.col_ptrs[aux_col1 + n_cols] - m.col_ptrs[aux_col1];
}
else
{
arma_debug_print("counting non-zeros in sparse subview");
const bool condition = (m_row_indices_i >= in_row1) && (m_row_indices_i < lend_row);
uword lend = m.col_ptrs[in_col1 + in_n_cols];
uword lend_row = in_row1 + in_n_rows;
count += condition ? uword(1) : uword(0);
for(uword i = m.col_ptrs[in_col1]; i < lend; ++i)
{
const uword m_row_indices_i = m.row_indices[i];
const bool condition = (m_row_indices_i >= in_row1) && (m_row_indices_i < lend_row);
count += condition ? uword(1) : uword(0);
}
}
access::rw(n_nonzero) = count;
@@ -74,7 +84,7 @@ SpSubview<eT>::SpSubview(const SpSubview<eT>& in)
, n_elem (in.n_elem )
, n_nonzero(in.n_nonzero)
{
arma_extra_debug_sigprint(arma_str::format("this = %x in = %x") % this % &in);
arma_debug_sigprint(arma_str::format("this: %x; in: %x") % this % &in);
}
@@ -90,7 +100,7 @@ SpSubview<eT>::SpSubview(SpSubview<eT>&& in)
, n_elem (in.n_elem )
, n_nonzero(in.n_nonzero)
{
arma_extra_debug_sigprint(arma_str::format("this = %x in = %x") % this % &in);
arma_debug_sigprint(arma_str::format("this: %x; in: %x") % this % &in);
// for paranoia
@@ -109,7 +119,7 @@ inline
const SpSubview<eT>&
SpSubview<eT>::operator+=(const eT val)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
if(val == eT(0)) { return *this; }
@@ -127,7 +137,7 @@ inline
const SpSubview<eT>&
SpSubview<eT>::operator-=(const eT val)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
if(val == eT(0)) { return *this; }
@@ -145,9 +155,7 @@ inline
const SpSubview<eT>&
SpSubview<eT>::operator*=(const eT val)
{
arma_extra_debug_sigprint();
if(val == eT(0)) { (*this).zeros(); return *this; }
arma_debug_sigprint();
if((n_elem == 0) || (n_nonzero == 0)) { return *this; }
@@ -207,9 +215,9 @@ inline
const SpSubview<eT>&
SpSubview<eT>::operator/=(const eT val)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
arma_debug_check( (val == eT(0)), "element-wise division: division by zero" );
arma_conform_check( (val == eT(0)), "element-wise division: division by zero" );
m.sync_csc();
m.invalidate_cache();
@@ -268,13 +276,13 @@ inline
const SpSubview<eT>&
SpSubview<eT>::operator=(const Base<eT, T1>& in)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
if(is_same_type< T1, Gen<Mat<eT>, gen_zeros> >::yes)
{
const Proxy<T1> P(in.get_ref());
arma_debug_assert_same_size(n_rows, n_cols, P.get_n_rows(), P.get_n_cols(), "insertion into sparse submatrix");
arma_conform_assert_same_size(n_rows, n_cols, P.get_n_rows(), P.get_n_cols(), "insertion into sparse submatrix");
(*this).zeros();
@@ -285,7 +293,7 @@ SpSubview<eT>::operator=(const Base<eT, T1>& in)
{
const Proxy<T1> P(in.get_ref());
arma_debug_assert_same_size(n_rows, n_cols, P.get_n_rows(), P.get_n_cols(), "insertion into sparse submatrix");
arma_conform_assert_same_size(n_rows, n_cols, P.get_n_rows(), P.get_n_cols(), "insertion into sparse submatrix");
(*this).eye();
@@ -294,7 +302,7 @@ SpSubview<eT>::operator=(const Base<eT, T1>& in)
const quasi_unwrap<T1> U(in.get_ref());
arma_debug_assert_same_size(n_rows, n_cols, U.M.n_rows, U.M.n_cols, "insertion into sparse submatrix");
arma_conform_assert_same_size(n_rows, n_cols, U.M.n_rows, U.M.n_cols, "insertion into sparse submatrix");
spglue_merge::subview_merge(*this, U.M);
@@ -309,7 +317,7 @@ inline
const SpSubview<eT>&
SpSubview<eT>::operator+=(const Base<eT, T1>& x)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
return (*this).operator=( (*this) + x.get_ref() );
}
@@ -322,7 +330,7 @@ inline
const SpSubview<eT>&
SpSubview<eT>::operator-=(const Base<eT, T1>& x)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
return (*this).operator=( (*this) - x.get_ref() );
}
@@ -335,7 +343,7 @@ inline
const SpSubview<eT>&
SpSubview<eT>::operator*=(const Base<eT, T1>& x)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
SpMat<eT> tmp(*this);
@@ -352,14 +360,14 @@ inline
const SpSubview<eT>&
SpSubview<eT>::operator%=(const Base<eT, T1>& x)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
SpSubview<eT>& sv = (*this);
const quasi_unwrap<T1> U(x.get_ref());
const Mat<eT>& B = U.M;
arma_debug_assert_same_size(sv.n_rows, sv.n_cols, B.n_rows, B.n_cols, "element-wise multiplication");
arma_conform_assert_same_size(sv.n_rows, sv.n_cols, B.n_rows, B.n_cols, "element-wise multiplication");
SpMat<eT>& sv_m = access::rw(sv.m);
@@ -418,14 +426,14 @@ inline
const SpSubview<eT>&
SpSubview<eT>::operator/=(const Base<eT, T1>& x)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const SpSubview<eT>& A = (*this);
const quasi_unwrap<T1> U(x.get_ref());
const Mat<eT>& B = U.M;
arma_debug_assert_same_size(A.n_rows, A.n_cols, B.n_rows, B.n_cols, "element-wise division");
arma_conform_assert_same_size(A.n_rows, A.n_cols, B.n_rows, B.n_cols, "element-wise division");
bool result_ok = true;
@@ -491,7 +499,7 @@ inline
const SpSubview<eT>&
SpSubview<eT>::operator=(const SpSubview<eT>& x)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
return (*this).operator_equ_common(x);
}
@@ -504,7 +512,7 @@ inline
const SpSubview<eT>&
SpSubview<eT>::operator=(const SpBase<eT, T1>& x)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
return (*this).operator_equ_common( x.get_ref() );
}
@@ -517,11 +525,11 @@ inline
const SpSubview<eT>&
SpSubview<eT>::operator_equ_common(const SpBase<eT, T1>& in)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const unwrap_spmat<T1> U(in.get_ref());
arma_debug_assert_same_size(n_rows, n_cols, U.M.n_rows, U.M.n_cols, "insertion into sparse submatrix");
arma_conform_assert_same_size(n_rows, n_cols, U.M.n_rows, U.M.n_cols, "insertion into sparse submatrix");
if(U.is_alias(m))
{
@@ -545,7 +553,7 @@ inline
const SpSubview<eT>&
SpSubview<eT>::operator+=(const SpBase<eT, T1>& x)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
// TODO: implement dedicated machinery
return (*this).operator=( (*this) + x.get_ref() );
@@ -559,7 +567,7 @@ inline
const SpSubview<eT>&
SpSubview<eT>::operator-=(const SpBase<eT, T1>& x)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
// TODO: implement dedicated machinery
return (*this).operator=( (*this) - x.get_ref() );
@@ -573,7 +581,7 @@ inline
const SpSubview<eT>&
SpSubview<eT>::operator*=(const SpBase<eT, T1>& x)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
return (*this).operator=( (*this) * x.get_ref() );
}
@@ -586,7 +594,7 @@ inline
const SpSubview<eT>&
SpSubview<eT>::operator%=(const SpBase<eT, T1>& x)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
// TODO: implement dedicated machinery
return (*this).operator=( (*this) % x.get_ref() );
@@ -600,13 +608,13 @@ inline
const SpSubview<eT>&
SpSubview<eT>::operator/=(const SpBase<eT, T1>& x)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
// NOTE: use of this function is not advised; it is implemented only for completeness
SpProxy<T1> p(x.get_ref());
arma_debug_assert_same_size(n_rows, n_cols, p.get_n_rows(), p.get_n_cols(), "element-wise division");
arma_conform_assert_same_size(n_rows, n_cols, p.get_n_rows(), p.get_n_cols(), "element-wise division");
if(p.is_alias(m) == false)
{
@@ -635,7 +643,7 @@ inline
void
SpSubview<eT>::for_each(functor F)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
m.sync_csc();
m.invalidate_cache();
@@ -692,7 +700,7 @@ inline
void
SpSubview<eT>::for_each(functor F) const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
m.sync_csc();
@@ -730,7 +738,7 @@ inline
void
SpSubview<eT>::transform(functor F)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
m.sync_csc();
m.invalidate_cache();
@@ -786,7 +794,7 @@ inline
void
SpSubview<eT>::replace(const eT old_val, const eT new_val)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
if(old_val == eT(0))
{
@@ -865,7 +873,7 @@ inline
void
SpSubview<eT>::clean(const typename get_pod_type<eT>::result threshold)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
if((n_elem == 0) || (n_nonzero == 0)) { return; }
@@ -893,16 +901,16 @@ inline
void
SpSubview<eT>::clamp(const eT min_val, const eT max_val)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
if(is_cx<eT>::no)
{
arma_debug_check( (access::tmp_real(min_val) > access::tmp_real(max_val)), "SpSubview::clamp(): min_val must be less than max_val" );
arma_conform_check( (access::tmp_real(min_val) > access::tmp_real(max_val)), "SpSubview::clamp(): min_val must be less than max_val" );
}
else
{
arma_debug_check( (access::tmp_real(min_val) > access::tmp_real(max_val)), "SpSubview::clamp(): real(min_val) must be less than real(max_val)" );
arma_debug_check( (access::tmp_imag(min_val) > access::tmp_imag(max_val)), "SpSubview::clamp(): imag(min_val) must be less than imag(max_val)" );
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)" );
}
if((n_elem == 0) || (n_nonzero == 0)) { return; }
@@ -923,7 +931,7 @@ inline
void
SpSubview<eT>::fill(const eT val)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
if(val != eT(0))
{
@@ -946,7 +954,7 @@ inline
void
SpSubview<eT>::zeros()
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
if((n_elem == 0) || (n_nonzero == 0)) { return; }
@@ -1003,7 +1011,7 @@ inline
void
SpSubview<eT>::ones()
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
(*this).fill(eT(1));
}
@@ -1015,7 +1023,7 @@ inline
void
SpSubview<eT>::eye()
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
SpMat<eT> tmp;
@@ -1031,7 +1039,7 @@ inline
void
SpSubview<eT>::randu()
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
Mat<eT> tmp( (*this).n_rows, (*this).n_cols, fill::randu );
@@ -1045,7 +1053,7 @@ inline
void
SpSubview<eT>::randn()
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
Mat<eT> tmp( (*this).n_rows, (*this).n_cols, fill::randn );
@@ -1085,7 +1093,7 @@ inline
SpSubview_MapMat_val<eT>
SpSubview<eT>::operator()(const uword i)
{
arma_debug_check_bounds( (i >= n_elem), "SpSubview::operator(): index out of bounds" );
arma_conform_check_bounds( (i >= n_elem), "SpSubview::operator(): index out of bounds" );
const uword lrow = i % n_rows;
const uword lcol = i / n_rows;
@@ -1100,7 +1108,7 @@ inline
eT
SpSubview<eT>::operator()(const uword i) const
{
arma_debug_check_bounds( (i >= n_elem), "SpSubview::operator(): index out of bounds" );
arma_conform_check_bounds( (i >= n_elem), "SpSubview::operator(): index out of bounds" );
const uword lrow = i % n_rows;
const uword lcol = i / n_rows;
@@ -1115,7 +1123,7 @@ inline
SpSubview_MapMat_val<eT>
SpSubview<eT>::operator()(const uword in_row, const uword in_col)
{
arma_debug_check_bounds( (in_row >= n_rows) || (in_col >= n_cols), "SpSubview::operator(): index out of bounds" );
arma_conform_check_bounds( (in_row >= n_rows) || (in_col >= n_cols), "SpSubview::operator(): index out of bounds" );
return (*this).at(in_row, in_col);
}
@@ -1127,7 +1135,7 @@ inline
eT
SpSubview<eT>::operator()(const uword in_row, const uword in_col) const
{
arma_debug_check_bounds( (in_row >= n_rows) || (in_col >= n_cols), "SpSubview::operator(): index out of bounds" );
arma_conform_check_bounds( (in_row >= n_rows) || (in_col >= n_cols), "SpSubview::operator(): index out of bounds" );
return (*this).at(in_row, in_col);
}
@@ -1236,9 +1244,9 @@ inline
SpSubview_row<eT>
SpSubview<eT>::row(const uword row_num)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
arma_debug_check_bounds(row_num >= n_rows, "SpSubview::row(): out of bounds");
arma_conform_check_bounds(row_num >= n_rows, "SpSubview::row(): out of bounds");
return SpSubview_row<eT>(const_cast< SpMat<eT>& >(m), row_num + aux_row1, aux_col1, n_cols);
}
@@ -1250,9 +1258,9 @@ inline
const SpSubview_row<eT>
SpSubview<eT>::row(const uword row_num) const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
arma_debug_check_bounds(row_num >= n_rows, "SpSubview::row(): out of bounds");
arma_conform_check_bounds(row_num >= n_rows, "SpSubview::row(): out of bounds");
return SpSubview_row<eT>(m, row_num + aux_row1, aux_col1, n_cols);
}
@@ -1264,9 +1272,9 @@ inline
SpSubview_col<eT>
SpSubview<eT>::col(const uword col_num)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
arma_debug_check_bounds(col_num >= n_cols, "SpSubview::col(): out of bounds");
arma_conform_check_bounds(col_num >= n_cols, "SpSubview::col(): out of bounds");
return SpSubview_col<eT>(const_cast< SpMat<eT>& >(m), col_num + aux_col1, aux_row1, n_rows);
}
@@ -1278,9 +1286,9 @@ inline
const SpSubview_col<eT>
SpSubview<eT>::col(const uword col_num) const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
arma_debug_check_bounds(col_num >= n_cols, "SpSubview::col(): out of bounds");
arma_conform_check_bounds(col_num >= n_cols, "SpSubview::col(): out of bounds");
return SpSubview_col<eT>(m, col_num + aux_col1, aux_row1, n_rows);
}
@@ -1292,9 +1300,9 @@ inline
SpSubview<eT>
SpSubview<eT>::rows(const uword in_row1, const uword in_row2)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
arma_debug_check_bounds
arma_conform_check_bounds
(
(in_row1 > in_row2) || (in_row2 >= n_rows),
"SpSubview::rows(): indices out of bounds or incorrectly used"
@@ -1310,9 +1318,9 @@ inline
const SpSubview<eT>
SpSubview<eT>::rows(const uword in_row1, const uword in_row2) const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
arma_debug_check_bounds
arma_conform_check_bounds
(
(in_row1 > in_row2) || (in_row2 >= n_rows),
"SpSubview::rows(): indices out of bounds or incorrectly used"
@@ -1328,9 +1336,9 @@ inline
SpSubview<eT>
SpSubview<eT>::cols(const uword in_col1, const uword in_col2)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
arma_debug_check_bounds
arma_conform_check_bounds
(
(in_col1 > in_col2) || (in_col2 >= n_cols),
"SpSubview::cols(): indices out of bounds or incorrectly used"
@@ -1346,9 +1354,9 @@ inline
const SpSubview<eT>
SpSubview<eT>::cols(const uword in_col1, const uword in_col2) const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
arma_debug_check_bounds
arma_conform_check_bounds
(
(in_col1 > in_col2) || (in_col2 >= n_cols),
"SpSubview::cols(): indices out of bounds or incorrectly used"
@@ -1364,9 +1372,9 @@ inline
SpSubview<eT>
SpSubview<eT>::submat(const uword in_row1, const uword in_col1, const uword in_row2, const uword in_col2)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
arma_debug_check_bounds
arma_conform_check_bounds
(
(in_row1 > in_row2) || (in_col1 > in_col2) || (in_row2 >= n_rows) || (in_col2 >= n_cols),
"SpSubview::submat(): indices out of bounds or incorrectly used"
@@ -1382,9 +1390,9 @@ inline
const SpSubview<eT>
SpSubview<eT>::submat(const uword in_row1, const uword in_col1, const uword in_row2, const uword in_col2) const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
arma_debug_check_bounds
arma_conform_check_bounds
(
(in_row1 > in_row2) || (in_col1 > in_col2) || (in_row2 >= n_rows) || (in_col2 >= n_cols),
"SpSubview::submat(): indices out of bounds or incorrectly used"
@@ -1400,7 +1408,7 @@ inline
SpSubview<eT>
SpSubview<eT>::submat(const span& row_span, const span& col_span)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const bool row_all = row_span.whole;
const bool col_all = row_span.whole;
@@ -1411,7 +1419,7 @@ SpSubview<eT>::submat(const span& row_span, const span& col_span)
const uword in_col1 = col_all ? 0 : col_span.a;
const uword in_col2 = col_all ? n_cols : col_span.b;
arma_debug_check_bounds
arma_conform_check_bounds
(
( row_all ? false : ((in_row1 > in_row2) || (in_row2 >= n_rows)))
||
@@ -1429,7 +1437,7 @@ inline
const SpSubview<eT>
SpSubview<eT>::submat(const span& row_span, const span& col_span) const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const bool row_all = row_span.whole;
const bool col_all = row_span.whole;
@@ -1440,7 +1448,7 @@ SpSubview<eT>::submat(const span& row_span, const span& col_span) const
const uword in_col1 = col_all ? 0 : col_span.a;
const uword in_col2 = col_all ? n_cols - 1 : col_span.b;
arma_debug_check_bounds
arma_conform_check_bounds
(
( row_all ? false : ((in_row1 > in_row2) || (in_row2 >= n_rows)))
||
@@ -1458,7 +1466,7 @@ inline
SpSubview<eT>
SpSubview<eT>::operator()(const uword row_num, const span& col_span)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
return submat(span(row_num, row_num), col_span);
}
@@ -1470,7 +1478,7 @@ inline
const SpSubview<eT>
SpSubview<eT>::operator()(const uword row_num, const span& col_span) const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
return submat(span(row_num, row_num), col_span);
}
@@ -1482,7 +1490,7 @@ inline
SpSubview<eT>
SpSubview<eT>::operator()(const span& row_span, const uword col_num)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
return submat(row_span, span(col_num, col_num));
}
@@ -1494,7 +1502,7 @@ inline
const SpSubview<eT>
SpSubview<eT>::operator()(const span& row_span, const uword col_num) const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
return submat(row_span, span(col_num, col_num));
}
@@ -1506,7 +1514,7 @@ inline
SpSubview<eT>
SpSubview<eT>::operator()(const span& row_span, const span& col_span)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
return submat(row_span, col_span);
}
@@ -1518,7 +1526,7 @@ inline
const SpSubview<eT>
SpSubview<eT>::operator()(const span& row_span, const span& col_span) const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
return submat(row_span, col_span);
}
@@ -1530,9 +1538,9 @@ inline
void
SpSubview<eT>::swap_rows(const uword in_row1, const uword in_row2)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
arma_debug_check((in_row1 >= n_rows) || (in_row2 >= n_rows), "SpSubview::swap_rows(): invalid row index");
arma_conform_check((in_row1 >= n_rows) || (in_row2 >= n_rows), "SpSubview::swap_rows(): invalid row index");
const uword lstart_col = aux_col1;
const uword lend_col = aux_col1 + n_cols;
@@ -1552,9 +1560,9 @@ inline
void
SpSubview<eT>::swap_cols(const uword in_col1, const uword in_col2)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
arma_debug_check((in_col1 >= n_cols) || (in_col2 >= n_cols), "SpSubview::swap_cols(): invalid column index");
arma_conform_check((in_col1 >= n_cols) || (in_col2 >= n_cols), "SpSubview::swap_cols(): invalid column index");
const uword lstart_row = aux_row1;
const uword lend_row = aux_row1 + n_rows;
@@ -1751,7 +1759,7 @@ inline
eT&
SpSubview<eT>::insert_element(const uword in_row, const uword in_col, const eT in_val)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
// This may not actually insert an element.
const uword old_n_nonzero = m.n_nonzero;
@@ -1769,7 +1777,7 @@ inline
void
SpSubview<eT>::delete_element(const uword in_row, const uword in_col)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
// This may not actually delete an element.
const uword old_n_nonzero = m.n_nonzero;
@@ -1784,7 +1792,7 @@ inline
void
SpSubview<eT>::invalidate_cache() const
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
m.invalidate_cache();
}
@@ -1802,7 +1810,7 @@ inline
SpSubview_col<eT>::SpSubview_col(const SpMat<eT>& in_m, const uword in_col)
: SpSubview<eT>(in_m, 0, in_col, in_m.n_rows, 1)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
@@ -1812,7 +1820,7 @@ inline
SpSubview_col<eT>::SpSubview_col(const SpMat<eT>& in_m, const uword in_col, const uword in_row1, const uword in_n_rows)
: SpSubview<eT>(in_m, in_row1, in_col, in_n_rows, 1)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
@@ -1822,7 +1830,7 @@ inline
void
SpSubview_col<eT>::operator=(const SpSubview<eT>& x)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
SpSubview<eT>::operator=(x);
}
@@ -1834,7 +1842,7 @@ inline
void
SpSubview_col<eT>::operator=(const SpSubview_col<eT>& x)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
SpSubview<eT>::operator=(x); // interprets 'SpSubview_col' as 'SpSubview'
}
@@ -1847,7 +1855,7 @@ inline
void
SpSubview_col<eT>::operator=(const SpBase<eT,T1>& x)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
SpSubview<eT>::operator=(x);
}
@@ -1860,7 +1868,7 @@ inline
void
SpSubview_col<eT>::operator=(const Base<eT,T1>& x)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
SpSubview<eT>::operator=(x);
}
@@ -1897,6 +1905,16 @@ SpSubview_col<eT>::st() const
template<typename eT>
inline
const SpToDOp<SpSubview_col<eT>,op_sp_as_dense>
SpSubview_col<eT>::as_dense() const
{
return SpToDOp<SpSubview_col<eT>,op_sp_as_dense>(*this);
}
//
//
//
@@ -1908,7 +1926,7 @@ inline
SpSubview_row<eT>::SpSubview_row(const SpMat<eT>& in_m, const uword in_row)
: SpSubview<eT>(in_m, in_row, 0, 1, in_m.n_cols)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
@@ -1918,7 +1936,7 @@ inline
SpSubview_row<eT>::SpSubview_row(const SpMat<eT>& in_m, const uword in_row, const uword in_col1, const uword in_n_cols)
: SpSubview<eT>(in_m, in_row, in_col1, 1, in_n_cols)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
@@ -1928,7 +1946,7 @@ inline
void
SpSubview_row<eT>::operator=(const SpSubview<eT>& x)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
SpSubview<eT>::operator=(x);
}
@@ -1940,7 +1958,7 @@ inline
void
SpSubview_row<eT>::operator=(const SpSubview_row<eT>& x)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
SpSubview<eT>::operator=(x); // interprets 'SpSubview_row' as 'SpSubview'
}
@@ -1953,7 +1971,7 @@ inline
void
SpSubview_row<eT>::operator=(const SpBase<eT,T1>& x)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
SpSubview<eT>::operator=(x);
}
@@ -1966,7 +1984,7 @@ inline
void
SpSubview_row<eT>::operator=(const Base<eT,T1>& x)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
SpSubview<eT>::operator=(x);
}
@@ -2003,4 +2021,14 @@ SpSubview_row<eT>::st() const
template<typename eT>
inline
const SpToDOp<SpSubview_row<eT>,op_sp_as_dense>
SpSubview_row<eT>::as_dense() const
{
return SpToDOp<SpSubview_row<eT>,op_sp_as_dense>(*this);
}
//! @}
@@ -0,0 +1,46 @@
// SPDX-License-Identifier: Apache-2.0
//
// 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
// 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,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ------------------------------------------------------------------------
//! \addtogroup SpToDGlue
//! @{
template<typename T1, typename T2, typename glue_type>
struct SpToDGlue : public Base< typename T1::elem_type, SpToDGlue<T1, T2, glue_type> >
{
typedef typename T1::elem_type elem_type;
typedef typename get_pod_type<elem_type>::result pod_type;
static constexpr bool is_row = glue_type::template traits<T1,T2>::is_row;
static constexpr bool is_col = glue_type::template traits<T1,T2>::is_col;
static constexpr bool is_xvec = glue_type::template traits<T1,T2>::is_xvec;
inline explicit SpToDGlue(const T1& in_A, const T2& in_B);
inline ~SpToDGlue();
template<typename eT2>
constexpr bool is_alias(const Mat<eT2>&) const { return false; }
const T1& A; //!< first operand; must be derived from Base or SpBase
const T2& B; //!< second operand; must be derived from Base or SpBase
};
//! @}
+44
View File
@@ -0,0 +1,44 @@
// SPDX-License-Identifier: Apache-2.0
//
// 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
// 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,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ------------------------------------------------------------------------
//! \addtogroup SpToDGlue
//! @{
template<typename T1, typename T2, typename glue_type>
inline
SpToDGlue<T1,T2,glue_type>::SpToDGlue(const T1& in_A, const T2& in_B)
: A(in_A)
, B(in_B)
{
arma_debug_sigprint();
}
template<typename T1, typename T2, typename glue_type>
inline
SpToDGlue<T1,T2,glue_type>::~SpToDGlue()
{
arma_debug_sigprint();
}
//! @}
+17 -23
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,36 +20,30 @@
//! @{
//! Class for storing data required for delayed unary operations on a sparse
//! matrix that produce a dense matrix; the data for storage may include
//! the operand (eg. the matrix to which the operation is to be applied) and the unary operator (eg. inverse).
//! The operand is stored as a reference (which can be optimised away),
//! while the operator is "stored" through the template definition (op_type).
//! The operands can be 'SpMat', 'SpRow', 'SpCol', 'SpOp', and 'SpGlue'.
//! Note that as 'SpGlue' can be one of the operands, more than one matrix can be stored.
//!
//! For example, we could have:
//! SpToDOp< SpGlue< SpMat, SpMat, sp_glue_times >, op_sp_plus >
// 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;
inline explicit SpToDOp(const T1& in_m);
inline SpToDOp(const T1& in_m, const elem_type in_aux);
inline ~SpToDOp();
arma_aligned const T1& m; //!< the operand; must be derived from SpBase
arma_aligned elem_type aux; //!< auxiliary data, using the element type as used by T1
static constexpr bool is_row = op_type::template traits<T1>::is_row;
static constexpr bool is_col = op_type::template traits<T1>::is_col;
static constexpr bool is_xvec = op_type::template traits<T1>::is_xvec;
inline explicit 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);
inline ~SpToDOp();
template<typename eT2>
constexpr bool is_alias(const Mat<eT2>&) const { return false; }
const T1& m; //!< the operand; must be derived from SpBase
elem_type aux; //!< auxiliary data, using the element type as used by T1
uword aux_uword_a; //!< auxiliary data, uword format
uword aux_uword_b; //!< auxiliary data, uword format
};
+17 -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,
@@ -26,7 +26,7 @@ inline
SpToDOp<T1, op_type>::SpToDOp(const T1& in_m)
: m(in_m)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
@@ -37,7 +37,19 @@ SpToDOp<T1, op_type>::SpToDOp(const T1& in_m, const typename T1::elem_type in_au
: m(in_m)
, aux(in_aux)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
template<typename T1, typename op_type>
inline
SpToDOp<T1, op_type>::SpToDOp(const T1& in_m, const uword in_aux_uword_a, const uword in_aux_uword_b)
: m(in_m)
, aux_uword_a(in_aux_uword_a)
, aux_uword_b(in_aux_uword_b)
{
arma_debug_sigprint();
}
@@ -46,7 +58,7 @@ template<typename T1, typename op_type>
inline
SpToDOp<T1, op_type>::~SpToDOp()
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
}
+16 -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,
@@ -28,9 +28,9 @@ template<typename T1>
class SpValProxy
{
public:
typedef typename T1::elem_type eT; // Convenience typedef
friend class SpMat<eT>;
friend class SpSubview<eT>;
@@ -49,16 +49,17 @@ class SpValProxy
//! Overload all of the potential operators.
//! First, the ones that could modify a value.
arma_inline SpValProxy& operator=(const eT rhs);
arma_inline SpValProxy& operator+=(const eT rhs);
arma_inline SpValProxy& operator-=(const eT rhs);
arma_inline SpValProxy& operator*=(const eT rhs);
arma_inline SpValProxy& operator/=(const eT rhs);
inline SpValProxy& operator= (const eT rhs);
inline SpValProxy& operator+=(const eT rhs);
inline SpValProxy& operator-=(const eT rhs);
inline SpValProxy& operator*=(const eT rhs);
inline SpValProxy& operator/=(const eT rhs);
arma_inline SpValProxy& operator++();
arma_inline SpValProxy& operator--();
arma_inline eT operator++(const int);
arma_inline eT operator--(const int);
inline SpValProxy& operator++();
inline SpValProxy& operator--();
inline eT operator++(const int);
inline eT operator--(const int);
//! This will work for any other operations that do not modify a value.
arma_inline operator eT() const;
@@ -72,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;
+34 -79
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,
@@ -56,48 +56,43 @@ SpValProxy<T1>::operator=(const SpValProxy<T2>& rhs)
template<typename T1>
arma_inline
inline
SpValProxy<T1>&
SpValProxy<T1>::operator=(const eT rhs)
{
if(rhs != eT(0)) // A nonzero element is being assigned.
{
if(val_ptr)
{
// The value exists and merely needs to be updated.
*val_ptr = rhs;
parent.invalidate_cache();
}
else
{
// The value is nonzero and must be inserted.
val_ptr = &parent.insert_element(row, col, rhs);
}
}
else // A zero is being assigned.~
{
if(val_ptr)
{
// The element exists, but we need to remove it, because it is being set to 0.
parent.delete_element(row, col);
val_ptr = nullptr;
}
// If the element does not exist, we do not need to do anything at all.
}
return *this;
}
template<typename T1>
arma_inline
inline
SpValProxy<T1>&
SpValProxy<T1>::operator+=(const eT rhs)
{
@@ -123,7 +118,7 @@ SpValProxy<T1>::operator+=(const eT rhs)
template<typename T1>
arma_inline
inline
SpValProxy<T1>&
SpValProxy<T1>::operator-=(const eT rhs)
{
@@ -142,96 +137,60 @@ SpValProxy<T1>::operator-=(const eT rhs)
val_ptr = &parent.insert_element(row, col, -rhs);
}
}
return *this;
}
template<typename T1>
arma_inline
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;
}
template<typename T1>
arma_inline
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;
}
template<typename T1>
arma_inline
inline
SpValProxy<T1>&
SpValProxy<T1>::operator++()
{
@@ -241,19 +200,18 @@ SpValProxy<T1>::operator++()
parent.invalidate_cache();
check_zero();
}
else
{
val_ptr = &parent.insert_element(row, col, eT(1));
}
return *this;
}
template<typename T1>
arma_inline
inline
SpValProxy<T1>&
SpValProxy<T1>::operator--()
{
@@ -263,19 +221,18 @@ SpValProxy<T1>::operator--()
parent.invalidate_cache();
check_zero();
}
else
{
val_ptr = &parent.insert_element(row, col, eT(-1));
}
return *this;
}
template<typename T1>
arma_inline
inline
typename T1::elem_type
SpValProxy<T1>::operator++(const int)
{
@@ -285,12 +242,11 @@ SpValProxy<T1>::operator++(const int)
parent.invalidate_cache();
check_zero();
}
else
{
val_ptr = &parent.insert_element(row, col, eT(1));
}
if(val_ptr) // It may have changed to now be 0.
{
return *(val_ptr) - eT(1);
@@ -304,7 +260,7 @@ SpValProxy<T1>::operator++(const int)
template<typename T1>
arma_inline
inline
typename T1::elem_type
SpValProxy<T1>::operator--(const int)
{
@@ -314,12 +270,11 @@ SpValProxy<T1>::operator--(const int)
parent.invalidate_cache();
check_zero();
}
else
{
val_ptr = &parent.insert_element(row, col, eT(-1));
}
if(val_ptr) // It may have changed to now be 0.
{
return *(val_ptr) + eT(1);
+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
//! @}
+53 -32
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,20 @@ 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
static constexpr bool check_conform = false;
#endif
#if defined(ARMA_CHECK_NONFINITE)
static constexpr bool check_nonfinite = true;
#else
@@ -121,20 +135,6 @@ struct arma_config
#endif
#if defined(ARMA_NO_DEBUG)
static constexpr bool debug = false;
#else
static constexpr bool debug = true;
#endif
#if defined(ARMA_EXTRA_DEBUG)
static constexpr bool extra_debug = true;
#else
static constexpr bool extra_debug = false;
#endif
#if defined(ARMA_GOOD_COMPILER)
static constexpr bool good_comp = true;
#else
@@ -160,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
@@ -181,7 +174,14 @@ struct arma_config
#endif
#if (!defined(ARMA_DONT_USE_STD_MUTEX))
#if defined(ARMA_HAVE_CXX23)
static constexpr bool cxx23 = true;
#else
static constexpr bool cxx23 = false;
#endif
#if defined(ARMA_USE_STD_MUTEX)
static constexpr bool std_mutex = true;
#else
static constexpr bool std_mutex = false;
@@ -216,20 +216,41 @@ struct arma_config
#endif
#if defined(ARMA_DONT_ZERO_INIT)
static constexpr bool zero_init = false;
#else
static constexpr bool zero_init = true;
#endif
#if (defined(__FAST_MATH__) || (defined(__FINITE_MATH_ONLY__) && (__FINITE_MATH_ONLY__ > 0)) || defined(_M_FP_FAST))
#if defined(ARMA_FAST_MATH)
static constexpr bool fast_math = true;
#else
static constexpr bool fast_math = false;
#endif
#if defined(ARMA_FAST_MATH) && !defined(ARMA_DONT_PRINT_FAST_MATH_WARNING)
static constexpr bool fast_math_warn = true;
#else
static constexpr bool fast_math_warn = false;
#endif
#if (!defined(ARMA_DONT_TREAT_TEXT_AS_BINARY))
static constexpr bool text_as_binary = true;
#else
static constexpr bool text_as_binary = false;
#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;
};
+107 -90
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,78 +72,93 @@ template<typename eT, typename T1> class subview_cube_slices;
template<typename eT, typename T1> class SpSubview_col_list;
class SizeMat;
class SizeCube;
struct SizeMat;
struct SizeCube;
class arma_empty_class {};
struct arma_empty_class {};
class diskio;
struct diskio;
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;
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 op_row_as_mat;
class op_col_as_mat;
struct op_row_as_mat;
struct op_col_as_mat;
class glue_times;
class glue_times_diag;
struct glue_times;
struct glue_times_diag;
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 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;
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 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;
class gen_eye;
class gen_ones;
class gen_zeros;
struct gen_eye;
struct gen_ones;
struct gen_zeros;
class spop_strans;
class spop_htrans;
class spop_vectorise_row;
class spop_vectorise_col;
struct spop_strans;
struct spop_htrans;
struct spop_vectorise_row;
struct spop_vectorise_col;
struct spop_square;
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 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;
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;
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;
@@ -233,39 +247,40 @@ 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 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 quasi_unwrap;
@@ -279,7 +294,7 @@ struct state_type
{
#if defined(ARMA_USE_OPENMP)
int state;
#elif (!defined(ARMA_DONT_USE_STD_MUTEX))
#elif defined(ARMA_USE_STD_MUTEX)
std::atomic<int> state;
#else
int state;
@@ -296,9 +311,9 @@ 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_DONT_USE_STD_MUTEX))
#elif defined(ARMA_USE_STD_MUTEX)
out = state.load();
#else
out = state;
@@ -312,9 +327,9 @@ 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_DONT_USE_STD_MUTEX))
#elif defined(ARMA_USE_STD_MUTEX)
state.store(in_state);
#else
state = in_state;
@@ -323,11 +338,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 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;
@@ -345,6 +361,7 @@ struct arma_zeros_indicator : public arma_initmode_indicator<true > {};
struct arma_nozeros_indicator : public arma_initmode_indicator<false> {};
//! \addtogroup injector
//! @{
+5 -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,
@@ -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,17 +35,14 @@ 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);
template<typename eT> inline static std::streamsize modify_stream(std::ostream& o, typename SpMat<eT>::const_iterator begin, const uword n_elem, const typename arma_cx_only<eT>::result* junk = nullptr);
template<typename eT> inline static void print_elem_zero(std::ostream& o, const bool modify);
template<typename eT> inline static void raw_print_elem_zero(std::ostream& o);
template<typename eT> inline static void print_elem_zero(std::ostream& o, const bool modify);
template<typename eT> inline static void print_elem(std::ostream& o, const eT& x, const bool modify);
template<typename eT> inline static void raw_print_elem(std::ostream& o, const eT& x);
+27 -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,
@@ -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))
)
)
{
@@ -190,7 +190,7 @@ inline
std::streamsize
arma_ostream::modify_stream(std::ostream& o, typename SpMat<eT>::const_iterator begin, const uword n_elem, const typename arma_not_cx<eT>::result* junk)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
arma_ignore(junk);
o.unsetf(ios::showbase);
@@ -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)";
}
@@ -429,7 +431,7 @@ inline
void
arma_ostream::print(std::ostream& o, const Mat<eT>& m, const bool modify)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const arma_ostream_state stream_state(o);
@@ -498,7 +500,7 @@ inline
void
arma_ostream::print(std::ostream& o, const Cube<eT>& x, const bool modify)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const arma_ostream_state stream_state(o);
@@ -540,7 +542,7 @@ inline
void
arma_ostream::print(std::ostream& o, const field<oT>& x)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const arma_ostream_state stream_state(o);
@@ -613,7 +615,7 @@ inline
void
arma_ostream::print(std::ostream& o, const subview_field<oT>& x)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const arma_ostream_state stream_state(o);
@@ -683,7 +685,7 @@ inline
void
arma_ostream::print_dense(std::ostream& o, const SpMat<eT>& m, const bool modify)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const arma_ostream_state stream_state(o);
@@ -765,7 +767,7 @@ inline
void
arma_ostream::print(std::ostream& o, const SpMat<eT>& m, const bool modify)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const arma_ostream_state stream_state(o);
@@ -867,7 +869,7 @@ inline
void
arma_ostream::print(std::ostream& o, const SizeMat& S)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const arma_ostream_state stream_state(o);
@@ -888,7 +890,7 @@ inline
void
arma_ostream::print(std::ostream& o, const SizeCube& S)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const arma_ostream_state stream_state(o);
@@ -910,7 +912,7 @@ inline
void
arma_ostream::brief_print(std::ostream& o, const Mat<eT>& m, const bool print_size)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const arma_ostream_state stream_state(o);
@@ -1068,7 +1070,7 @@ inline
void
arma_ostream::brief_print(std::ostream& o, const Cube<eT>& x)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const arma_ostream_state stream_state(o);
@@ -1125,7 +1127,7 @@ inline
void
arma_ostream::brief_print(std::ostream& o, const SpMat<eT>& m)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
if(m.n_nonzero <= 10) { arma_ostream::print(o, m, true); return; }
@@ -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); }
};
+291 -103
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,64 +20,70 @@
//! @{
#if defined(ARMA_RNG_ALT)
#undef ARMA_USE_EXTERN_RNG
#undef ARMA_USE_CXX11_RNG
#define ARMA_USE_CXX11_RNG
#undef ARMA_USE_THREAD_LOCAL
#define ARMA_USE_THREAD_LOCAL
#if (defined(ARMA_RNG_ALT) || defined(ARMA_DONT_USE_CXX11_RNG))
#undef ARMA_USE_CXX11_RNG
#endif
#if defined(ARMA_DONT_USE_THREAD_LOCAL)
#undef ARMA_USE_THREAD_LOCAL
#endif
// NOTE: mt19937_64_instance_warmup is used as a workaround
// NOTE: ARMA_WARMUP_PRODUCER enables a workaround
// NOTE: for thread_local issue on macOS 11 and/or AppleClang 12.0
// NOTE: see https://gitlab.com/conradsnicta/armadillo-code/-/issues/173
// NOTE: if this workaround causes problems, please report it and
// NOTE: disable the workaround by uncommenting the code block below:
// NOTE: disable the workaround by commenting out the code block below:
// #if defined(__APPLE__) || defined(__apple_build_version__)
// #if !defined(ARMA_DONT_DISABLE_EXTERN_RNG)
// #undef ARMA_USE_EXTERN_RNG
// #endif
// #endif
#if defined(__APPLE__) || defined(__apple_build_version__)
#undef ARMA_WARMUP_PRODUCER
#define ARMA_WARMUP_PRODUCER
#endif
#if defined(ARMA_DONT_WARMUP_PRODUCER)
#undef ARMA_WARMUP_PRODUCER
#endif
// NOTE: workaround for another thread_local issue on macOS
// NOTE: where GCC (not Clang) may not have support for thread_local
#if (defined(__APPLE__) && defined(__GNUG__) && !defined(__clang__))
#if !defined(ARMA_DONT_DISABLE_EXTERN_RNG)
#undef ARMA_USE_EXTERN_RNG
#endif
#undef ARMA_USE_THREAD_LOCAL
#endif
// NOTE: disable use of thread_local on MinGW et al;
// NOTE: i don't have the patience to keep looking into these broken platforms
#if (defined(__MINGW32__) || defined(__MINGW64__) || defined(__CYGWIN__) || defined(__MSYS__) || defined(__MSYS2__))
#undef ARMA_USE_THREAD_LOCAL
#endif
#if defined(ARMA_FORCE_USE_THREAD_LOCAL)
#undef ARMA_USE_THREAD_LOCAL
#define ARMA_USE_THREAD_LOCAL
#endif
#if (!defined(ARMA_USE_THREAD_LOCAL))
#undef ARMA_GUARD_PRODUCER
#define ARMA_GUARD_PRODUCER
#endif
#if (defined(ARMA_DONT_GUARD_PRODUCER) || (!defined(ARMA_USE_STD_MUTEX)))
#undef ARMA_GUARD_PRODUCER
#endif
#if defined(ARMA_USE_EXTERN_RNG)
extern thread_local std::mt19937_64 mt19937_64_instance;
#if defined(__APPLE__) || defined(__apple_build_version__)
namespace
{
struct mt19937_64_instance_warmup
{
inline mt19937_64_instance_warmup()
{
typename std::mt19937_64::result_type junk = mt19937_64_instance();
arma_ignore(junk);
}
};
static mt19937_64_instance_warmup mt19937_64_instance_warmup_run;
}
#endif
#endif
class arma_rng
struct arma_rng
{
public:
#if defined(ARMA_RNG_ALT)
typedef arma_rng_alt::seed_type seed_type;
#elif defined(ARMA_USE_EXTERN_RNG)
#elif defined(ARMA_USE_CXX11_RNG)
typedef std::mt19937_64::result_type seed_type;
#else
typedef arma_rng_cxx03::seed_type seed_type;
@@ -85,12 +91,24 @@ class arma_rng
#if defined(ARMA_RNG_ALT)
static constexpr int rng_method = 2;
#elif defined(ARMA_USE_EXTERN_RNG)
#elif defined(ARMA_USE_CXX11_RNG)
static constexpr int rng_method = 1;
#else
static constexpr int rng_method = 0;
#endif
#if defined(ARMA_USE_CXX11_RNG)
inline static std::mt19937_64& get_producer();
inline static void warmup_producer(std::mt19937_64& producer);
inline static void lock_producer();
inline static void unlock_producer();
#if defined(ARMA_GUARD_PRODUCER)
inline static std::mutex& get_producer_mutex();
#endif
#endif
inline static void set_seed(const seed_type val);
inline static void set_seed_random();
@@ -102,6 +120,101 @@ class arma_rng
#if defined(ARMA_USE_CXX11_RNG)
inline
std::mt19937_64&
arma_rng::get_producer()
{
#if defined(ARMA_USE_THREAD_LOCAL)
// use a thread-safe RNG, with each thread having its own unique starting seed
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);
#else
// use a 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
return mt19937_64_producer;
}
inline
void
arma_rng::warmup_producer(std::mt19937_64& producer)
{
#if defined(ARMA_WARMUP_PRODUCER)
static std::atomic_flag warmup_done = ATOMIC_FLAG_INIT; // init to false
if(warmup_done.test_and_set() == false)
{
typename std::mt19937_64::result_type junk = producer();
arma_ignore(junk);
}
#else
arma_ignore(producer);
#endif
}
inline
void
arma_rng::lock_producer()
{
#if defined(ARMA_GUARD_PRODUCER)
std::mutex& producer_mutex = arma_rng::get_producer_mutex();
producer_mutex.lock();
#endif
}
inline
void
arma_rng::unlock_producer()
{
#if defined(ARMA_GUARD_PRODUCER)
std::mutex& producer_mutex = arma_rng::get_producer_mutex();
producer_mutex.unlock();
#endif
}
#if defined(ARMA_GUARD_PRODUCER)
inline
std::mutex&
arma_rng::get_producer_mutex()
{
static std::mutex producer_mutex;
return producer_mutex;
}
#endif
#endif
inline
void
arma_rng::set_seed(const arma_rng::seed_type val)
@@ -110,9 +223,11 @@ arma_rng::set_seed(const arma_rng::seed_type val)
{
arma_rng_alt::set_seed(val);
}
#elif defined(ARMA_USE_EXTERN_RNG)
#elif defined(ARMA_USE_CXX11_RNG)
{
mt19937_64_instance.seed(val);
arma_rng::lock_producer();
arma_rng::get_producer().seed(val);
arma_rng::unlock_producer();
}
#else
{
@@ -141,7 +256,7 @@ arma_rng::set_seed_random()
if(rd.entropy() > double(0)) { seed1 = static_cast<seed_type>( rd() ); }
if(seed1 != seed_type(0)) { have_seed = true; }
have_seed = (seed1 != seed_type(0));
}
catch(...) {}
@@ -150,24 +265,15 @@ arma_rng::set_seed_random()
{
try
{
union
{
seed_type a;
unsigned char b[sizeof(seed_type)];
} tmp;
tmp.a = seed_type(0);
char tmp[sizeof(seed_type)] = {};
std::ifstream f("/dev/urandom", std::ifstream::binary);
if(f.good()) { f.read((char*)(&(tmp.b[0])), sizeof(seed_type)); }
if(f.good()) { f.read(&(tmp[0]), sizeof(seed_type)); }
if(f.good())
{
seed2 = tmp.a;
if(seed2 != seed_type(0)) { have_seed = true; }
}
if(f.good()) { std::memcpy(&seed2, &(tmp[0]), sizeof(seed_type)); }
have_seed = (seed2 != seed_type(0));
}
catch(...) {}
}
@@ -183,23 +289,21 @@ arma_rng::set_seed_random()
seed3 = static_cast<seed_type>( since_epoch_usec & 0xFFFF );
union
{
uword* a;
unsigned char b[sizeof(uword*)];
} tmp;
unsigned char* a = (unsigned char*)std::malloc(std::size_t(4096));
tmp.a = (uword*)malloc(sizeof(uword));
unsigned char b[sizeof(unsigned char*)] = {};
if(tmp.a != nullptr)
if(a != nullptr)
{
for(size_t i=0; i<sizeof(uword*); ++i) { seed4 += seed_type(tmp.b[i]); }
std::memcpy(&(b[0]), &a, sizeof(unsigned char*));
free(tmp.a);
for(size_t i=0; i<sizeof(unsigned char*); ++i) { seed4 += seed_type(b[i]); }
std::free(a);
}
}
arma_rng::set_seed( seed1 + seed2 + seed3 + seed4 );
arma_rng::set_seed(seed1 + seed2 + seed3 + seed4);
}
@@ -218,11 +322,17 @@ struct arma_rng::randi
{
return eT( arma_rng_alt::randi_val() );
}
#elif defined(ARMA_USE_EXTERN_RNG)
#elif defined(ARMA_USE_CXX11_RNG)
{
constexpr double scale = double(std::numeric_limits<int>::max()) / double(std::mt19937_64::max());
return eT( double(mt19937_64_instance()) * scale );
arma_rng::lock_producer();
const eT out = eT(double(arma_rng::get_producer()()) * scale);
arma_rng::unlock_producer();
return out;
}
#else
{
@@ -241,7 +351,7 @@ struct arma_rng::randi
{
return arma_rng_alt::randi_max_val();
}
#elif defined(ARMA_USE_EXTERN_RNG)
#elif defined(ARMA_USE_CXX11_RNG)
{
return std::numeric_limits<int>::max();
}
@@ -262,11 +372,17 @@ struct arma_rng::randi
{
arma_rng_alt::randi_fill(mem, N, a, b);
}
#elif defined(ARMA_USE_EXTERN_RNG)
#elif defined(ARMA_USE_CXX11_RNG)
{
std::uniform_int_distribution<int> local_i_distr(a, b);
for(uword i=0; i<N; ++i) { mem[i] = eT(local_i_distr(mt19937_64_instance)); }
std::mt19937_64& producer = arma_rng::get_producer();
arma_rng::lock_producer();
for(uword i=0; i<N; ++i) { mem[i] = eT(local_i_distr(producer)); }
arma_rng::unlock_producer();
}
#else
{
@@ -301,11 +417,17 @@ struct arma_rng::randu
{
return eT( arma_rng_alt::randu_val() );
}
#elif defined(ARMA_USE_EXTERN_RNG)
#elif defined(ARMA_USE_CXX11_RNG)
{
constexpr double scale = double(1.0) / double(std::mt19937_64::max());
return eT( double(mt19937_64_instance()) * scale );
arma_rng::lock_producer();
const eT out = eT( double(arma_rng::get_producer()()) * scale );
arma_rng::unlock_producer();
return out;
}
#else
{
@@ -324,11 +446,17 @@ struct arma_rng::randu
{
for(uword i=0; i < N; ++i) { mem[i] = eT( arma_rng_alt::randu_val() ); }
}
#elif defined(ARMA_USE_EXTERN_RNG)
#elif defined(ARMA_USE_CXX11_RNG)
{
std::uniform_real_distribution<double> local_u_distr;
for(uword i=0; i < N; ++i) { mem[i] = eT( local_u_distr(mt19937_64_instance) ); }
std::mt19937_64& producer = arma_rng::get_producer();
arma_rng::lock_producer();
for(uword i=0; i < N; ++i) { mem[i] = eT( local_u_distr(producer) ); }
arma_rng::unlock_producer();
}
#else
{
@@ -358,11 +486,17 @@ struct arma_rng::randu
for(uword i=0; i < N; ++i) { mem[i] = eT( arma_rng_alt::randu_val() * r + a ); }
}
#elif defined(ARMA_USE_EXTERN_RNG)
#elif defined(ARMA_USE_CXX11_RNG)
{
std::uniform_real_distribution<double> local_u_distr(a,b);
for(uword i=0; i < N; ++i) { mem[i] = eT( local_u_distr(mt19937_64_instance) ); }
std::mt19937_64& producer = arma_rng::get_producer();
arma_rng::lock_producer();
for(uword i=0; i < N; ++i) { mem[i] = eT( local_u_distr(producer) ); }
arma_rng::unlock_producer();
}
#else
{
@@ -396,12 +530,18 @@ struct arma_rng::randu< std::complex<T> >
return std::complex<T>(a, b);
}
#elif defined(ARMA_USE_EXTERN_RNG)
#elif defined(ARMA_USE_CXX11_RNG)
{
std::uniform_real_distribution<double> local_u_distr;
const T a = T( local_u_distr(mt19937_64_instance) );
const T b = T( local_u_distr(mt19937_64_instance) );
std::mt19937_64& producer = arma_rng::get_producer();
arma_rng::lock_producer();
const T a = T( local_u_distr(producer) );
const T b = T( local_u_distr(producer) );
arma_rng::unlock_producer();
return std::complex<T>(a, b);
}
@@ -431,17 +571,23 @@ struct arma_rng::randu< std::complex<T> >
mem[i] = std::complex<T>(a, b);
}
}
#elif defined(ARMA_USE_EXTERN_RNG)
#elif defined(ARMA_USE_CXX11_RNG)
{
std::uniform_real_distribution<double> local_u_distr;
std::mt19937_64& producer = arma_rng::get_producer();
arma_rng::lock_producer();
for(uword i=0; i < N; ++i)
{
const T a = T( local_u_distr(mt19937_64_instance) );
const T b = T( local_u_distr(mt19937_64_instance) );
const T a = T( local_u_distr(producer) );
const T b = T( local_u_distr(producer) );
mem[i] = std::complex<T>(a, b);
}
arma_rng::unlock_producer();
}
#else
{
@@ -491,17 +637,23 @@ struct arma_rng::randu< std::complex<T> >
mem[i] = std::complex<T>(tmp1, tmp2);
}
}
#elif defined(ARMA_USE_EXTERN_RNG)
#elif defined(ARMA_USE_CXX11_RNG)
{
std::uniform_real_distribution<double> local_u_distr(a,b);
std::mt19937_64& producer = arma_rng::get_producer();
arma_rng::lock_producer();
for(uword i=0; i < N; ++i)
{
const T tmp1 = T( local_u_distr(mt19937_64_instance) );
const T tmp2 = T( local_u_distr(mt19937_64_instance) );
const T tmp1 = T( local_u_distr(producer) );
const T tmp2 = T( local_u_distr(producer) );
mem[i] = std::complex<T>(tmp1, tmp2);
}
arma_rng::unlock_producer();
}
#else
{
@@ -552,11 +704,17 @@ struct arma_rng::randn
{
return eT( arma_rng_alt::randn_val() );
}
#elif defined(ARMA_USE_EXTERN_RNG)
#elif defined(ARMA_USE_CXX11_RNG)
{
std::normal_distribution<double> local_n_distr;
return eT( local_n_distr(mt19937_64_instance) );
arma_rng::lock_producer();
const eT out = eT( local_n_distr(arma_rng::get_producer()) );
arma_rng::unlock_producer();
return out;
}
#else
{
@@ -575,12 +733,18 @@ struct arma_rng::randn
{
arma_rng_alt::randn_dual_val(out1, out2);
}
#elif defined(ARMA_USE_EXTERN_RNG)
#elif defined(ARMA_USE_CXX11_RNG)
{
std::normal_distribution<double> local_n_distr;
out1 = eT( local_n_distr(mt19937_64_instance) );
out2 = eT( local_n_distr(mt19937_64_instance) );
std::mt19937_64& producer = arma_rng::get_producer();
arma_rng::lock_producer();
out1 = eT( local_n_distr(producer) );
out2 = eT( local_n_distr(producer) );
arma_rng::unlock_producer();
}
#else
{
@@ -605,11 +769,17 @@ struct arma_rng::randn
if(i < N) { mem[i] = eT( arma_rng_alt::randn_val() ); }
}
#elif defined(ARMA_USE_EXTERN_RNG)
#elif defined(ARMA_USE_CXX11_RNG)
{
std::normal_distribution<double> local_n_distr;
for(uword i=0; i < N; ++i) { mem[i] = eT( local_n_distr(mt19937_64_instance) ); }
std::mt19937_64& producer = arma_rng::get_producer();
arma_rng::lock_producer();
for(uword i=0; i < N; ++i) { mem[i] = eT( local_n_distr(producer) ); }
arma_rng::unlock_producer();
}
#else
{
@@ -657,11 +827,17 @@ struct arma_rng::randn
mem[i] = (val_i * sd) + mu;
}
}
#elif defined(ARMA_USE_EXTERN_RNG)
#elif defined(ARMA_USE_CXX11_RNG)
{
std::normal_distribution<double> local_n_distr(mu, sd);
for(uword i=0; i < N; ++i) { mem[i] = eT( local_n_distr(mt19937_64_instance) ); }
std::mt19937_64& producer = arma_rng::get_producer();
arma_rng::lock_producer();
for(uword i=0; i < N; ++i) { mem[i] = eT( local_n_distr(producer) ); }
arma_rng::unlock_producer();
}
#else
{
@@ -741,17 +917,23 @@ struct arma_rng::randn< std::complex<T> >
{
for(uword i=0; i < N; ++i) { mem[i] = std::complex<T>( arma_rng::randn< std::complex<T> >() ); }
}
#elif defined(ARMA_USE_EXTERN_RNG)
#elif defined(ARMA_USE_CXX11_RNG)
{
std::normal_distribution<double> local_n_distr;
std::mt19937_64& producer = arma_rng::get_producer();
arma_rng::lock_producer();
for(uword i=0; i < N; ++i)
{
const T a = T( local_n_distr(mt19937_64_instance) );
const T b = T( local_n_distr(mt19937_64_instance) );
const T a = T( local_n_distr(producer) );
const T b = T( local_n_distr(producer) );
mem[i] = std::complex<T>(a,b);
}
arma_rng::unlock_producer();
}
#else
{
@@ -818,11 +1000,17 @@ struct arma_rng::randg
void
fill(eT* mem, const uword N, const double a, const double b)
{
#if defined(ARMA_USE_EXTERN_RNG)
#if defined(ARMA_USE_CXX11_RNG)
{
std::gamma_distribution<double> local_g_distr(a,b);
for(uword i=0; i<N; ++i) { mem[i] = eT(local_g_distr(mt19937_64_instance)); }
std::mt19937_64& producer = arma_rng::get_producer();
arma_rng::lock_producer();
for(uword i=0; i<N; ++i) { mem[i] = eT(local_g_distr(producer)); }
arma_rng::unlock_producer();
}
#else
{
+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,
+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,
@@ -21,10 +21,10 @@
#define ARMA_VERSION_MAJOR 12
#define ARMA_VERSION_MINOR 4
#define ARMA_VERSION_PATCH 1
#define ARMA_VERSION_NAME "Cortisol Profusion Redux"
#define ARMA_VERSION_MAJOR 15
#define ARMA_VERSION_MINOR 0
#define ARMA_VERSION_PATCH 2
#define ARMA_VERSION_NAME "Medium Roast"
+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);
+15 -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,
@@ -239,7 +239,7 @@ arrayops::convert(out_eT* dest, const in_eT* src, const uword n_elem)
{
const out_eT* src2 = (const out_eT*)src;
if(dest != src2) { arrayops::copy(dest, src2, n_elem); }
arrayops::copy(dest, src2, n_elem);
return;
}
@@ -304,6 +304,15 @@ inline
void
arrayops::convert_cx(out_eT* dest, const in_eT* src, const uword n_elem)
{
if(is_same_type<out_eT,in_eT>::value)
{
const out_eT* src2 = (const out_eT*)src;
arrayops::copy(dest, src2, n_elem);
return;
}
uword j;
for(j=1; j<n_elem; j+=2)
@@ -1041,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;
+53 -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,
@@ -21,10 +21,8 @@
//! low-level interface functions for accessing LAPACK
class auxlib
struct auxlib
{
public:
//
// inv
@@ -43,6 +41,18 @@ class auxlib
template<typename eT>
inline static bool inv_tr_rcond(Mat<eT>& A, typename get_pod_type<eT>::result& out_rcond, const uword layout);
template<typename eT>
inline static bool inv_sym(Mat<eT>& A);
template<typename T>
inline static bool inv_sym(Mat< std::complex<T> >& A);
template<typename eT>
inline static bool inv_sym_rcond(Mat<eT>& A, eT& out_rcond);
template<typename T>
inline static bool inv_sym_rcond(Mat< std::complex<T> >& A, T& out_rcond);
template<typename eT>
inline static bool inv_sympd(Mat<eT>& A, bool& out_sympd_state);
@@ -50,10 +60,10 @@ class auxlib
inline static bool inv_sympd(Mat<eT>& out, const Mat<eT>& X);
template<typename eT>
inline static bool inv_sympd_rcond(Mat<eT>& A, bool& out_sympd_state, eT& out_rcond);
inline static bool inv_sympd_rcond(Mat<eT>& A, eT& out_rcond);
template<typename T>
inline static bool inv_sympd_rcond(Mat< std::complex<T> >& A, bool& out_sympd_state, T& out_rcond);
inline static bool inv_sympd_rcond(Mat< std::complex<T> >& A, T& out_rcond);
//
@@ -176,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);
@@ -270,10 +274,21 @@ 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);
inline static bool solve_sym_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_sympd_fast_common(Mat<typename T1::elem_type>& out, Mat<typename T1::elem_type>& A, const Base<typename T1::elem_type,T1>& B_expr);
inline static bool solve_sym_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_sym_rcond(Mat<typename T1::pod_type>& out, typename T1::pod_type& out_rcond, Mat<typename T1::pod_type>& A, const Base<typename T1::pod_type,T1>& B_expr);
template<typename T1>
inline static bool solve_sym_rcond(Mat< std::complex<typename T1::pod_type> >& out, typename T1::pod_type& out_rcond, 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_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_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);
@@ -314,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);
@@ -340,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);
//
@@ -365,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);
//
@@ -378,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
@@ -388,10 +392,10 @@ class auxlib
inline static T rcond(Mat< std::complex<T> >& A);
template<typename eT>
inline static eT rcond_sympd(Mat<eT>& A, bool& calc_ok);
inline static eT rcond_sym(Mat<eT>& A);
template<typename T>
inline static T rcond_sympd(Mat< std::complex<T> >& A, bool& calc_ok);
template<typename T>
inline static T rcond_sym(Mat< std::complex<T> >& A);
template<typename eT>
inline static eT rcond_trimat(const Mat<eT>& A, const uword layout);
@@ -425,14 +429,20 @@ 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);
template<typename T>
inline static bool rudimentary_sym_check(const Mat< std::complex<T> >& X);
template<typename eT>
inline static typename get_pod_type<eT>::result norm1_gen(const Mat<eT>& A);
template<typename eT>
inline static typename get_pod_type<eT>::result norm1_sym(const Mat<eT>& A);
template<typename eT>
inline static typename get_pod_type<eT>::result norm1_band(const Mat<eT>& A, const uword KL, const uword KU);
};
File diff suppressed because it is too large Load Diff
+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,
@@ -30,7 +30,7 @@ inline
bool
is_band(uword& out_KL, uword& out_KU, const Mat<eT>& A, const uword N_min)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
// NOTE: assuming that A has a square size
// NOTE: assuming that N_min is >= 4
@@ -108,7 +108,7 @@ inline
bool
is_band_lower(uword& out_KD, const Mat<eT>& A, const uword N_min)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
// NOTE: assuming that A has a square size
// NOTE: assuming that N_min is >= 4
@@ -171,7 +171,7 @@ inline
bool
is_band_upper(uword& out_KD, const Mat<eT>& A, const uword N_min)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
// NOTE: assuming that A has a square size
// NOTE: assuming that N_min is >= 4
@@ -234,7 +234,7 @@ inline
void
compress(Mat<eT>& AB, const Mat<eT>& A, const uword KL, const uword KU, const bool use_offset)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
// NOTE: assuming that A has a square size
@@ -242,7 +242,7 @@ compress(Mat<eT>& AB, const Mat<eT>& A, const uword KL, const uword KU, const bo
// http://www.netlib.org/lapack/lug/node124.html
// for ?gbsv, matrix AB size: 2*KL+KU+1 x N; band representation of A stored in rows KL+1 to 2*KL+KU+1 (note: fortran counts from 1)
// for ?gbsvx, matrix AB size: KL+KU+1 x N; band representaiton of A stored in rows 1 to KL+KU+1 (note: fortran counts from 1)
// for ?gbsvx, matrix AB size: KL+KU+1 x N; band representation of A stored in rows 1 to KL+KU+1 (note: fortran counts from 1)
//
// the +1 in the above formulas is to take into account the main diagonal
@@ -287,12 +287,12 @@ inline
void
uncompress(Mat<eT>& A, const Mat<eT>& AB, const uword KL, const uword KU, const bool use_offset)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
const uword AB_n_rows = AB.n_rows;
const uword N = AB.n_cols;
arma_debug_check( (AB_n_rows != ((use_offset) ? uword(2*KL + KU + 1) : uword(KL + KU + 1))), "band_helper::uncompress(): detected inconsistency" );
arma_conform_check( (AB_n_rows != ((use_offset) ? uword(2*KL + KU + 1) : uword(KL + KU + 1))), "band_helper::uncompress(): detected inconsistency" );
A.zeros(N,N); // assuming there is no aliasing between A and AB
@@ -328,7 +328,7 @@ inline
void
extract_tridiag(Mat<eT>& out, const Mat<eT>& A)
{
arma_extra_debug_sigprint();
arma_debug_sigprint();
// NOTE: assuming that A has a square size and is at least 2x2
+14 -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,
@@ -20,6 +20,7 @@
#undef ARMA_HAVE_CXX14
#undef ARMA_HAVE_CXX17
#undef ARMA_HAVE_CXX20
#undef ARMA_HAVE_CXX23
#if (__cplusplus >= 201103L)
#define ARMA_HAVE_CXX11
@@ -37,6 +38,10 @@
#define ARMA_HAVE_CXX20
#endif
#if (__cplusplus >= 202302L)
#define ARMA_HAVE_CXX23
#endif
// MS really can't get its proverbial shit together
#if defined(_MSVC_LANG)
@@ -59,6 +64,11 @@
#define ARMA_HAVE_CXX20
#endif
#if (_MSVC_LANG >= 202302L)
#undef ARMA_HAVE_CXX23
#define ARMA_HAVE_CXX23
#endif
#endif
@@ -68,8 +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"
#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
+33 -92
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
@@ -114,8 +111,10 @@
#if defined(__APPLE__) || defined(__apple_build_version__)
#undef ARMA_BLAS_SDOT_BUG
#define ARMA_BLAS_SDOT_BUG
// NOTE: Apple accelerate framework has broken implementations of functions that return a float value,
// NOTE: such as sdot(), slange(), clange(), slansy(), clanhe(), slangb(), snrm2(), sasum()
#undef ARMA_BLAS_FLOAT_BUG
#define ARMA_BLAS_FLOAT_BUG
// #undef ARMA_HAVE_POSIX_MEMALIGN
// NOTE: posix_memalign() is available since macOS 10.6 (late 2009 onwards)
@@ -156,26 +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 < 40800)
#error "*** newer compiler required; need gcc 4.8 or later ***"
#if (__GNUC__ < 8)
#error "*** newer compiler required; need at least gcc 8.1 ***"
#endif
// #if (ARMA_GCC_VERSION < 60100)
// #pragma message ("WARNING: support for gcc versions older than 6.1 is deprecated")
// #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
@@ -185,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__))
@@ -246,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__))
@@ -298,31 +277,29 @@
#error "*** newer compiler required ***"
#endif
#if (__INTEL_COMPILER < 1500)
#if (__INTEL_COMPILER < 1600)
#error "*** newer compiler required ***"
#endif
#undef ARMA_HAVE_GCC_ASSUME_ALIGNED
#undef ARMA_HAVE_ICC_ASSUME_ALIGNED
#define ARMA_HAVE_ICC_ASSUME_ALIGNED
#endif
#if defined(_MSC_VER)
#if (_MSC_VER < 1900)
#if (_MSC_VER < 1910)
#error "*** newer compiler required ***"
#endif
#undef arma_deprecated
#define arma_deprecated __declspec(deprecated)
// #undef arma_inline
// #define arma_inline __forceinline inline
#undef arma_noinline
#define arma_noinline __declspec(noinline)
#pragma warning(push)
#pragma warning(disable: 4127) // conditional expression is constant
#pragma warning(disable: 4146) // unary minus operator applied to unsigned type, result still unsigned
#pragma warning(disable: 4180) // qualifier has no meaning
#pragma warning(disable: 4244) // possible loss of data when converting types (see also 4305)
#pragma warning(disable: 4510) // default constructor could not be generated
@@ -342,8 +319,6 @@
#pragma warning(disable: 4714) // __forceinline can't be inlined
#pragma warning(disable: 4800) // value forced to bool
// NOTE: also possible to disable 4146 (unary minus operator applied to unsigned type, result still unsigned)
#if defined(ARMA_HAVE_CXX17)
#pragma warning(disable: 26812) // unscoped enum
#pragma warning(disable: 26819) // unannotated fallthrough
@@ -374,27 +349,6 @@
#endif
#if defined(__SUNPRO_CC)
// http://www.oracle.com/technetwork/server-storage/solarisstudio/training/index-jsp-141991.html
// http://www.oracle.com/technetwork/server-storage/solarisstudio/documentation/cplusplus-faq-355066.html
#if (__SUNPRO_CC < 0x5140)
#error "*** newer compiler required ***"
#endif
#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]]
@@ -402,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
@@ -419,23 +374,24 @@
#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
#if defined(ARMA_USE_OPENMP)
#if (defined(ARMA_GCC_VERSION) && (ARMA_GCC_VERSION < 50400))
// due to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57580
#undef ARMA_USE_OPENMP
#if !defined(ARMA_DONT_PRINT_OPENMP_WARNING)
#pragma message ("WARNING: use of OpenMP disabled due to compiler bug in gcc <= 5.3")
#endif
#endif
#if (defined(__FAST_MATH__) || (defined(__FINITE_MATH_ONLY__) && (__FINITE_MATH_ONLY__ > 0)) || defined(_M_FP_FAST))
#undef ARMA_FAST_MATH
#define ARMA_FAST_MATH
#endif
#if defined(ARMA_FAST_MATH) && !defined(ARMA_DONT_PRINT_FAST_MATH_WARNING)
#pragma message ("WARNING: compiler is in fast math mode; some functions may be unreliable.")
#pragma message ("WARNING: to suppress this warning and related warnings,")
#pragma message ("WARNING: #define ARMA_DONT_PRINT_FAST_MATH_WARNING before #include <armadillo>")
#endif
@@ -455,7 +411,6 @@
#undef ARMA_DETECTED_FAKE_GCC
#undef ARMA_DETECTED_FAKE_CLANG
#undef ARMA_GCC_VERSION
#undef ARMA_PRINT_OPENMP_WARNING
@@ -475,23 +430,9 @@
#if defined(min) || defined(max)
#undef min
#undef max
#pragma message ("WARNING: undefined conflicting 'min' and/or 'max' macros;")
#pragma message ("WARNING: suggest to define NOMINMAX before including any windows header")
#pragma message ("WARNING: undefined conflicting 'min' and/or 'max' macros")
#endif
// https://sourceware.org/bugzilla/show_bug.cgi?id=19239
#undef minor
#undef major
// optionally allow disabling of compile-time deprecation messages (not recommended)
// NOTE: option 'ARMA_IGNORE_DEPRECATED_MARKER' will be removed
// NOTE: disabling deprecation messages is counter-productive
#if defined(ARMA_IGNORE_DEPRECATED_MARKER) && (!defined(ARMA_DONT_IGNORE_DEPRECATED_MARKER)) && (!defined(ARMA_EXTRA_DEBUG))
#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,

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