Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
40d2d9fb9c | ||
|
|
e529e8fadb | ||
|
|
cdf9a0519d | ||
|
|
acdc6b8670 | ||
|
|
251f964c1b | ||
|
|
9937cdafd5 | ||
|
|
e31354d8da | ||
|
|
6279cb3774 | ||
|
|
fa72e7e3e0 | ||
|
|
f72efd7c61 | ||
|
|
3d4daafeb8 | ||
|
|
a99ef05d41 | ||
|
|
a7d906019a | ||
|
|
f3fe8d04c7 | ||
|
|
508ebe3deb | ||
|
|
6e6657e2f0 | ||
|
|
935a500e75 | ||
|
|
64a125b35b | ||
|
|
6754eadb00 | ||
|
|
4a93a1a5d2 | ||
|
|
cc2a33560f | ||
|
|
708897f906 | ||
|
|
5dfa91793f | ||
|
|
f20d1bf7fe | ||
|
|
e0a6e50981 | ||
|
|
11b009ccdc | ||
|
|
d4ac8e535e | ||
|
|
982e8b12ae | ||
|
|
558c04cfd6 | ||
|
|
c693c5f020 | ||
|
|
a7ae8eed4a | ||
|
|
5f74ef8e5d | ||
|
|
7c732dc236 | ||
|
|
b84b7aa997 | ||
|
|
1780c70a98 | ||
|
|
02aab8d3c3 | ||
|
|
744f33aab2 | ||
|
|
c51b6ce8ba | ||
|
|
e0bf67a29f | ||
|
|
b176edcc1b | ||
|
|
09b350febc | ||
|
|
4541b44fab | ||
|
|
17132590fc | ||
|
|
11740aead0 | ||
|
|
f2a82196d4 | ||
|
|
2854685624 | ||
|
|
401c06184e | ||
|
|
d7064ebacf | ||
|
|
580758af9d | ||
|
|
441d0e503b | ||
|
|
5015fb007b | ||
|
|
81b339e987 | ||
|
|
6b6a820a49 | ||
|
|
a865abfe6a | ||
|
|
80797be245 | ||
|
|
3259865a42 | ||
|
|
5edd9e07ec | ||
|
|
d37c42e046 | ||
|
|
d8dceed843 | ||
|
|
0606be415c | ||
|
|
f5b004028a | ||
|
|
76d9aaea28 | ||
|
|
4257990df9 | ||
|
|
a48c256233 | ||
|
|
044977f0a1 | ||
|
|
c32a3b915e | ||
|
|
419cc25c17 | ||
|
|
118ae2140f | ||
|
|
4b72ceda11 | ||
|
|
caa5012e25 | ||
|
|
f37a509c14 | ||
|
|
8dafcf8d30 | ||
|
|
d4e25ce9cf | ||
|
|
9ee144d98d | ||
|
|
e6b9babc12 | ||
|
|
2ddbf3653c | ||
|
|
fb9994ce6f | ||
|
|
840795fc47 | ||
|
|
b5824c72e3 | ||
|
|
39a8ff7c31 | ||
|
|
031e790ec3 | ||
|
|
054506ac91 | ||
|
|
50c8b16a6c | ||
|
|
554c499ce0 | ||
|
|
9aa59809f0 | ||
|
|
f66226695b | ||
|
|
c9cc6e5554 | ||
|
|
181a6af544 | ||
|
|
de118814c3 | ||
|
|
1aa720e759 | ||
|
|
f0eaff90e9 | ||
|
|
21b905e643 | ||
|
|
791fe513c9 | ||
|
|
3d82983dba | ||
|
|
6ee89edb8c | ||
|
|
a7823175a2 | ||
|
|
5caefce03d | ||
|
|
a99f363d69 | ||
|
|
627794a311 | ||
|
|
66135eef6b | ||
|
|
03d351a858 | ||
|
|
607a68a0b4 | ||
|
|
36ab0da6b1 | ||
|
|
cf880d4fff | ||
|
|
057039611e | ||
|
|
530542b112 | ||
|
|
4643ddfff8 | ||
|
|
f54cc6d0bb | ||
|
|
414793c796 | ||
|
|
f0c1211b68 | ||
|
|
fa0c5a5ce2 | ||
|
|
8f5e35d9e4 | ||
|
|
4a4807e4ee | ||
|
|
03eb6e6ece | ||
|
|
f66d795010 | ||
|
|
f01dae8534 | ||
|
|
0cc9f762d3 | ||
|
|
52ccb38b6c | ||
|
|
23c49e6008 | ||
|
|
f4f8f0c28f | ||
|
|
54314571c4 | ||
|
|
b416244930 | ||
|
|
3928bee750 | ||
|
|
17d96107e3 | ||
|
|
e014995291 | ||
|
|
e03265b706 | ||
|
|
940594bfe7 | ||
|
|
bcf4400e27 | ||
|
|
4f62a5ddf8 | ||
|
|
66515d3ec9 | ||
|
|
365c332120 | ||
|
|
facf580a9c | ||
|
|
b0ca8599f8 | ||
|
|
f7e522a83b | ||
|
|
8d6818e40a | ||
|
|
19b7ff026f | ||
|
|
bd56f524b2 | ||
|
|
5cbd10b9e3 | ||
|
|
19f8a401e8 | ||
|
|
478809ca0d | ||
|
|
0a671235ed | ||
|
|
1393134914 | ||
|
|
7c8c10ea20 | ||
|
|
aa28f54c0b | ||
|
|
762e98c2cc | ||
|
|
98bfa65de7 | ||
|
|
81e760e0eb | ||
|
|
140e07bd77 | ||
|
|
bc57da6679 | ||
|
|
0138c02fb7 | ||
|
|
5ca8f67990 | ||
|
|
72d7892432 | ||
|
|
8b8a56104d | ||
|
|
30b45e8c2e | ||
|
|
5260835556 | ||
|
|
cc61283eb6 | ||
|
|
35d70bd7c9 | ||
|
|
8b3f33287a | ||
|
|
4d26e7f4dd | ||
|
|
909a3a3ac1 | ||
|
|
bca546a381 | ||
|
|
7a078fcf8c | ||
|
|
da52eb154b | ||
|
|
03fd9d04c3 | ||
|
|
8ad6cc595d | ||
|
|
a454237c13 | ||
|
|
89277f2deb | ||
|
|
880267f348 | ||
|
|
0e7f1c5089 | ||
|
|
fd780c7a82 | ||
|
|
5f12dfb83d | ||
|
|
e9a14aea9a | ||
|
|
6b47d564d1 | ||
|
|
2d60476b55 | ||
|
|
ad6ce0e46f | ||
|
|
499cf72d6a | ||
|
|
b12eefdae8 | ||
|
|
b955116e1f | ||
|
|
67ea132b50 | ||
|
|
f97f3edcb3 | ||
|
|
a91f7a77fe | ||
|
|
f88801c619 | ||
|
|
afa23649f8 | ||
|
|
2e1a9d70da | ||
|
|
20a9302ff3 | ||
|
|
dbcbc65a00 | ||
|
|
2ee2b572ba | ||
|
|
653996b1c2 | ||
|
|
176da337a0 | ||
|
|
485d16e9a3 | ||
|
|
5c63044568 | ||
|
|
60c63be02a | ||
|
|
e8b08f83e8 | ||
|
|
a4bdfd034b | ||
|
|
95adb74219 | ||
|
|
60915d66dc | ||
|
|
8675f3868a | ||
|
|
14650daa03 | ||
|
|
b57929cefb | ||
|
|
51a8ba3e09 | ||
|
|
44e1a04bab | ||
|
|
87c2b2d870 | ||
|
|
ba443e4bdc | ||
|
|
78836248b4 | ||
|
|
bfc736cbb2 | ||
|
|
e0551c4aa1 | ||
|
|
02a706c60b | ||
|
|
5e57e49667 | ||
|
|
cfbc227f30 | ||
|
|
2556f64d9b | ||
|
|
4d6a92ed65 | ||
|
|
140adf0cb4 | ||
|
|
918759c610 | ||
|
|
9cd668413d | ||
|
|
8b59d1e22d | ||
|
|
7b2f7cbad8 | ||
|
|
cf2b051b54 | ||
|
|
f709a17fd3 | ||
|
|
38682265fc | ||
|
|
88f1a75146 | ||
|
|
ca8da8bdab | ||
|
|
54c62da09b | ||
|
|
ba6a007ff1 | ||
|
|
2bff19fb56 | ||
|
|
2454e055fe | ||
|
|
13dded6a6d | ||
|
|
45316d0249 | ||
|
|
611d0e8c24 | ||
|
|
885324d6a2 | ||
|
|
d84f3cdf77 | ||
|
|
43498a5c72 | ||
|
|
7b0adcf517 | ||
|
|
b61e026dd4 | ||
|
|
0006014c9e | ||
|
|
74c2d461c6 | ||
|
|
eef2a2706c | ||
|
|
9680a3b1d4 | ||
|
|
83e6264e81 | ||
|
|
963a262aea | ||
|
|
a2e5ba7dfe | ||
|
|
ca7f21d837 | ||
|
|
3ba9389fac | ||
|
|
f652f45584 | ||
|
|
a527b6d066 | ||
|
|
551f262824 | ||
|
|
53875af0c4 | ||
|
|
a93f6e8116 | ||
|
|
663d9cc36e | ||
|
|
461db5a1ea | ||
|
|
efcd328e19 | ||
|
|
614f2a9c68 | ||
|
|
ef4736878b | ||
|
|
7c61b1cef1 | ||
|
|
9b632bc3c2 | ||
|
|
8b9e754277 | ||
|
|
2178fe261c | ||
|
|
addfc9f74d | ||
|
|
7a76074adb | ||
|
|
882880e242 | ||
|
|
2cbda35457 | ||
|
|
e7072ce2fb | ||
|
|
c17ba7750c | ||
|
|
5a5e902709 | ||
|
|
b6e810f2d3 | ||
|
|
761dbbf8d5 | ||
|
|
fd375c3b7d | ||
|
|
1ec8ff7464 | ||
|
|
a6e1189470 | ||
|
|
2ce71407f5 | ||
|
|
886b2750ce | ||
|
|
24c9c0defd | ||
|
|
5862589c94 | ||
|
|
c56fe40ac8 | ||
|
|
6aa346b59a | ||
|
|
91884dbdbd | ||
|
|
f82a749b4b | ||
|
|
9c71a7a46a | ||
|
|
b4b2ec816f | ||
|
|
04c1988dc2 | ||
|
|
9c512d59b0 | ||
|
|
4807346e76 | ||
|
|
5282ab98d1 | ||
|
|
8babcd5a2b | ||
|
|
9cda7ea2d6 | ||
|
|
ee84563034 | ||
|
|
4373c99517 | ||
|
|
3c30c6a155 | ||
|
|
752e5817f0 | ||
|
|
a8d7628cbe | ||
|
|
c2e9009ea4 | ||
|
|
63cc0eb854 | ||
|
|
6f41964887 | ||
|
|
cf869ce067 | ||
|
|
b5bfd4b1ae | ||
|
|
b0deff09d4 | ||
|
|
e8b8d28b82 | ||
|
|
ab9d61b20c | ||
|
|
0263404474 | ||
|
|
a44e7fddc5 | ||
|
|
22e5e903aa | ||
|
|
91dbb8c2ea | ||
|
|
d99781e74b | ||
|
|
204eac2382 | ||
|
|
046b168abb | ||
|
|
32b218ce31 | ||
|
|
d36d447130 | ||
|
|
c5bb97c7f0 | ||
|
|
5d0633e214 | ||
|
|
6cada35124 | ||
|
|
6dd578e293 | ||
|
|
a27560bb8f | ||
|
|
344e69abf4 | ||
|
|
f602343234 | ||
|
|
e7df419244 | ||
|
|
504503d012 | ||
|
|
50f7e06903 | ||
|
|
ccce514377 | ||
|
|
fd5df9e61d | ||
|
|
14fcd1dc73 | ||
|
|
d05a247c7f | ||
|
|
ee89179212 | ||
|
|
d11d452a93 | ||
|
|
5912c445e5 | ||
|
|
075bb095c0 | ||
|
|
71587103d7 | ||
|
|
102a354e0c | ||
|
|
e4c567542d | ||
|
|
06f8e59026 | ||
|
|
114c9b4be8 | ||
|
|
e6dfff7108 | ||
|
|
4391cb4b19 | ||
|
|
cb4056ba1a | ||
|
|
76b8241161 | ||
|
|
523e55bbdc | ||
|
|
b66232ee28 | ||
|
|
f8f4c82e1f | ||
|
|
20db1e4eea | ||
|
|
125858f7f2 | ||
|
|
faa23558cd | ||
|
|
80e22ec476 | ||
|
|
2d7652c5b8 | ||
|
|
142f5585bf | ||
|
|
94a6ce3c8b | ||
|
|
55f0fcb393 | ||
|
|
2bfe79c0fe | ||
|
|
a8c5f01c47 | ||
|
|
758033748a | ||
|
|
1deec467f4 | ||
|
|
7094b4490e | ||
|
|
1e5908fff0 | ||
|
|
85ddc3b874 | ||
|
|
046be2a0e9 | ||
|
|
f4efd94326 | ||
|
|
4003fbab9f | ||
|
|
d758e1e0b6 | ||
|
|
1846669392 | ||
|
|
6120003e9f | ||
|
|
1c4c2a4401 | ||
|
|
216ad3f4fb | ||
|
|
c9010fcb38 | ||
|
|
b17a37e7c8 | ||
|
|
ad7a92d61f | ||
|
|
ef5b2fd6e7 | ||
|
|
2870e98da4 | ||
|
|
c6084eb6a9 | ||
|
|
cf6fa0ea3b | ||
|
|
e5b85a6926 | ||
|
|
21fa7ac873 | ||
|
|
91e46cebec | ||
|
|
209e0c535e | ||
|
|
b9baa99431 | ||
|
|
317502291d | ||
|
|
bae95ce2ff | ||
|
|
fc907485df | ||
|
|
51e005f0ca | ||
|
|
d10deb5634 | ||
|
|
0cf3702148 | ||
|
|
6f7fbb41b6 | ||
|
|
644a4ca863 | ||
|
|
8bb7800848 | ||
|
|
faa6cbf895 | ||
|
|
43c13bd4d3 | ||
|
|
814135a022 | ||
|
|
16201bce8e | ||
|
|
dbe1ceec39 | ||
|
|
91cd1cb553 | ||
|
|
58b3161f05 | ||
|
|
19f01127b7 | ||
|
|
e4829d474c | ||
|
|
f7a6836ef6 | ||
|
|
adcb8d4d84 | ||
|
|
3a173f6d9e | ||
|
|
aebe3d8755 | ||
|
|
6abf926e48 | ||
|
|
6a2ea37166 | ||
|
|
437cf4816e | ||
|
|
3c293c486a | ||
|
|
f1cd3eaa0a | ||
|
|
8825605d51 | ||
|
|
96a2b134f3 | ||
|
|
09faca962f | ||
|
|
1476998305 | ||
|
|
cbf67a1453 | ||
|
|
b9b88897de | ||
|
|
6e580c5993 | ||
|
|
4c86458e2f | ||
|
|
4e6528ace1 | ||
|
|
2ba7443357 | ||
|
|
f98ed7ef9a | ||
|
|
56a05b3222 | ||
|
|
dded4c90de | ||
|
|
bc6190f687 | ||
|
|
ffdc6c0cea | ||
|
|
e232e905a7 | ||
|
|
767bf00802 | ||
|
|
f758c349c1 | ||
|
|
7eab297358 | ||
|
|
83bf100bb2 | ||
|
|
3f02dc034c | ||
|
|
9cc1964fce | ||
|
|
c02c4e0d9c | ||
|
|
9546012ec1 | ||
|
|
5ed40a1c33 | ||
|
|
b59c144bd2 |
+2
-2
@@ -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> (online copy)</li>
|
||||
<li><a href="docs.html#changelog">docs.html#changelog</a> (local copy)</li>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+150
-104
@@ -16,52 +16,67 @@
|
||||
# ------------------------------------------------------------------------
|
||||
|
||||
|
||||
## 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/blah/armadillo-7.200.3/include -DARMA_DONT_USE_WRAPPER -lopenblas -llapack
|
||||
## NOTE: The above command line assumes that you have unpacked the armadillo archive into /home/blah/
|
||||
## NOTE: You will need to adjust this for newer versions of Armadillo (ie. change the 7.200.3 part)
|
||||
## NOTE: and/or if you have unpacked the armadillo archive into a different directory.
|
||||
## NOTE: This installation script by default generates a runtime wrapper library,
|
||||
## 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: (1) use the HEADER_ONLY option when running this installation script,
|
||||
## NOTE: or
|
||||
## NOTE: (2) do not use this installation script, and instead compile your programs
|
||||
## NOTE: using the include folder directly obtained from the armadillo archive.
|
||||
## NOTE:
|
||||
## NOTE: To forcefully disable use of the runtime wrapper library,
|
||||
## NOTE: compile your programs with ARMA_DONT_USE_WRAPPER enabled.
|
||||
## NOTE: For example:
|
||||
## NOTE: g++ prog.cpp -o prog -O2 -I /home/user/armadillo-14.0.0/include -DARMA_DONT_USE_WRAPPER -lopenblas -llapack
|
||||
## NOTE:
|
||||
## NOTE: The above command line assumes that you have unpacked the armadillo archive into /home/user/
|
||||
## NOTE: This needs to be adjusted for newer versions of Armadillo (ie. change "14.0.0"),
|
||||
## NOTE: 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: http://arma.sourceforge.net/faq.html
|
||||
## NOTE: More details: https://arma.sourceforge.net/faq.html
|
||||
|
||||
|
||||
cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)
|
||||
cmake_minimum_required(VERSION 3.5 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) # Caveat: only SuperLU version 5.x can be used!
|
||||
|
||||
|
||||
## extract version from sources
|
||||
# extract version from sources
|
||||
|
||||
set(ARMA_VERSION_FILE_NAME "${PROJECT_SOURCE_DIR}/include/armadillo_bits/arma_version.hpp")
|
||||
|
||||
@@ -84,33 +99,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 6.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 6.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 +123,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 +136,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,6 +143,7 @@ message(STATUS "ARMA_USE_EXTERN_RNG = ${ARMA_USE_EXTERN_RNG}")
|
||||
|
||||
if(NOT APPLE)
|
||||
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
||||
message(STATUS "")
|
||||
message(STATUS "*** CMAKE_INSTALL_PREFIX was initalised 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)
|
||||
@@ -188,11 +183,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 +225,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}" )
|
||||
@@ -488,23 +500,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 +563,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 +602,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 +613,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 suported 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 suported 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 +659,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 +696,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
@@ -1,7 +1,7 @@
|
||||
Armadillo C++ Linear Algebra Library
|
||||
Copyright 2008-2023 Conrad Sanderson (https://conradsanderson.id.au)
|
||||
Copyright 2008-2024 Conrad Sanderson (https://conradsanderson.id.au)
|
||||
Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
Copyright 2017-2023 Data61 / CSIRO
|
||||
Copyright 2017-2024 Data61 / CSIRO
|
||||
|
||||
This product includes software developed by Conrad Sanderson (https://conradsanderson.id.au)
|
||||
This product includes software developed at National ICT Australia (NICTA)
|
||||
|
||||
@@ -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-2024 Conrad Sanderson (https://conradsanderson.id.au)
|
||||
Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
Copyright 2017-2023 Data61 / CSIRO
|
||||
Copyright 2017-2024 Data61 / CSIRO
|
||||
|
||||
---
|
||||
|
||||
@@ -82,8 +82,8 @@ Citations are useful for the continued development and maintenance of the librar
|
||||
Journal of Open Source Software, Vol. 1, No. 2, pp. 26, 2016.
|
||||
|
||||
* 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.
|
||||
|
||||
---
|
||||
|
||||
@@ -114,9 +114,8 @@ Use of OpenBLAS (instead of standard BLAS) is strongly recommended on all system
|
||||
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.
|
||||
Caveat: only SuperLU versions 5.2.x and 5.3.x can be used; SuperLU must be available as a shared library.
|
||||
|
||||
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.
|
||||
@@ -128,12 +127,18 @@ and then running the following command in a terminal window:
|
||||
|
||||
On Windows systems, the MinGW toolset or Visual Studio C++ 2019 (MSVC) can be used.
|
||||
|
||||
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)
|
||||
|
||||
---
|
||||
|
||||
### 5: Linux and macOS: Installation
|
||||
|
||||
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.
|
||||
@@ -149,8 +154,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:
|
||||
@@ -203,7 +207,7 @@ Manual installation involves simply copying the `include/armadillo` header
|
||||
**and** the associated `include/armadillo_bits` directory to a location
|
||||
such as `/usr/include/` which is searched by your C++ compiler.
|
||||
If you don't have sudo access or don't have write access to `/usr/include/`,
|
||||
use a directory within your own home directory (eg. `/home/blah/include/`).
|
||||
use a directory within your own home directory (eg. `/home/user/include/`).
|
||||
|
||||
If required, modify `include/armadillo_bits/config.hpp`
|
||||
to indicate which libraries are currently available on your system.
|
||||
@@ -226,25 +230,25 @@ 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/blah/include/`, you will need to make sure
|
||||
that your C++ compiler searches `/home/blah/include/`
|
||||
such as `/home/user/include/`, you will need to make sure
|
||||
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/blah/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/blah/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`
|
||||
@@ -304,15 +308,16 @@ defined in `include/armadillo_bits/config.hpp`, may need to be either enabled or
|
||||
|
||||
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/
|
||||
|
||||
---
|
||||
|
||||
@@ -398,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.
|
||||
|
||||
@@ -423,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.
|
||||
|
||||
---
|
||||
@@ -457,18 +461,15 @@ Octave/Matlab with C++ code that uses Armadillo matrices.
|
||||
|
||||
### 16: Related Software Using Armadillo
|
||||
|
||||
* ensmallen: fast and flexible library for numerical optimisation
|
||||
* ensmallen: C++ library for non-linear numerical optimisation (L-BFGS, SGD, CMA-ES, etc)
|
||||
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
|
||||
|
||||
* RcppArmadillo: integration of Armadillo with the R system and environment
|
||||
* 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.
@@ -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.5+ 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 $@ .
|
||||
|
||||
|
||||
+5
-5
@@ -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/blah/armadillo-7.200.3/include -DARMA_DONT_USE_WRAPPER -lopenblas
|
||||
g++ example1.cpp -o example1 -std=c++14 -O2 -I /home/user/armadillo-14.0.0/include -DARMA_DONT_USE_WRAPPER -lopenblas
|
||||
|
||||
The above command assumes that the armadillo archive was unpacked into /home/blah/
|
||||
The command needs to be adjusted if the archive was unpacked into a different directory
|
||||
and/or for each specific version of Armadillo (ie. "7.200.3" needs to be changed)
|
||||
The above command assumes that the armadillo archive was unpacked into /home/user/
|
||||
The command needs to be adjusted if the archive was unpacked into a different directory,
|
||||
and/or for each specific version of Armadillo (ie. "14.0.0" needs to be changed).
|
||||
|
||||
If you don't have OpenBLAS, on Linux change -lopenblas to -lblas -llapack
|
||||
and on macOS change -lopenblas to -framework Accelerate
|
||||
|
||||
@@ -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.27:
|
||||
https://github.com/OpenMathLib/OpenBLAS/releases/download/v0.3.27/OpenBLAS-0.3.27-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.27-x64/bin/libopenblas.dll
|
||||
libopenblas.lib is a copy of OpenBLAS-0.3.27-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.
+50
-19
@@ -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,10 @@
|
||||
#include <random>
|
||||
#include <functional>
|
||||
#include <chrono>
|
||||
#include <atomic>
|
||||
|
||||
#if !defined(ARMA_DONT_USE_STD_MUTEX)
|
||||
#if defined(ARMA_USE_STD_MUTEX)
|
||||
#include <mutex>
|
||||
#include <atomic>
|
||||
#endif
|
||||
|
||||
// #if defined(ARMA_HAVE_CXX17)
|
||||
@@ -221,6 +222,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 +236,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"
|
||||
@@ -303,6 +306,8 @@ namespace arma
|
||||
#include "armadillo_bits/op_nonzeros_bones.hpp"
|
||||
#include "armadillo_bits/op_diff_bones.hpp"
|
||||
#include "armadillo_bits/op_norm_bones.hpp"
|
||||
#include "armadillo_bits/op_vecnorm_bones.hpp"
|
||||
#include "armadillo_bits/op_norm2est_bones.hpp"
|
||||
#include "armadillo_bits/op_sqrtmat_bones.hpp"
|
||||
#include "armadillo_bits/op_logmat_bones.hpp"
|
||||
#include "armadillo_bits/op_range_bones.hpp"
|
||||
@@ -311,14 +316,25 @@ 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_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"
|
||||
@@ -348,15 +364,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"
|
||||
@@ -364,6 +375,8 @@ namespace arma
|
||||
#include "armadillo_bits/spop_repmat_bones.hpp"
|
||||
#include "armadillo_bits/spop_vectorise_bones.hpp"
|
||||
#include "armadillo_bits/spop_norm_bones.hpp"
|
||||
#include "armadillo_bits/spop_shift_bones.hpp"
|
||||
#include "armadillo_bits/spop_relational_bones.hpp"
|
||||
|
||||
#include "armadillo_bits/spglue_plus_bones.hpp"
|
||||
#include "armadillo_bits/spglue_minus_bones.hpp"
|
||||
@@ -376,6 +389,8 @@ namespace arma
|
||||
#include "armadillo_bits/spglue_merge_bones.hpp"
|
||||
#include "armadillo_bits/spglue_relational_bones.hpp"
|
||||
|
||||
#include "armadillo_bits/spsolve_factoriser_bones.hpp"
|
||||
|
||||
#if defined(ARMA_USE_NEWARP)
|
||||
#include "armadillo_bits/newarp_EigsSelect.hpp"
|
||||
#include "armadillo_bits/newarp_DenseGenMatProd_bones.hpp"
|
||||
@@ -485,6 +500,7 @@ namespace arma
|
||||
#include "armadillo_bits/fn_elem.hpp"
|
||||
#include "armadillo_bits/fn_approx_equal.hpp"
|
||||
#include "armadillo_bits/fn_norm.hpp"
|
||||
#include "armadillo_bits/fn_vecnorm.hpp"
|
||||
#include "armadillo_bits/fn_dot.hpp"
|
||||
#include "armadillo_bits/fn_randu.hpp"
|
||||
#include "armadillo_bits/fn_randn.hpp"
|
||||
@@ -573,6 +589,7 @@ 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_speye.hpp"
|
||||
#include "armadillo_bits/fn_spones.hpp"
|
||||
@@ -614,11 +631,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"
|
||||
@@ -741,6 +760,8 @@ namespace arma
|
||||
#include "armadillo_bits/op_nonzeros_meat.hpp"
|
||||
#include "armadillo_bits/op_diff_meat.hpp"
|
||||
#include "armadillo_bits/op_norm_meat.hpp"
|
||||
#include "armadillo_bits/op_vecnorm_meat.hpp"
|
||||
#include "armadillo_bits/op_norm2est_meat.hpp"
|
||||
#include "armadillo_bits/op_sqrtmat_meat.hpp"
|
||||
#include "armadillo_bits/op_logmat_meat.hpp"
|
||||
#include "armadillo_bits/op_range_meat.hpp"
|
||||
@@ -749,14 +770,25 @@ 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_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"
|
||||
@@ -786,15 +818,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"
|
||||
@@ -802,6 +829,8 @@ namespace arma
|
||||
#include "armadillo_bits/spop_repmat_meat.hpp"
|
||||
#include "armadillo_bits/spop_vectorise_meat.hpp"
|
||||
#include "armadillo_bits/spop_norm_meat.hpp"
|
||||
#include "armadillo_bits/spop_shift_meat.hpp"
|
||||
#include "armadillo_bits/spop_relational_meat.hpp"
|
||||
|
||||
#include "armadillo_bits/spglue_plus_meat.hpp"
|
||||
#include "armadillo_bits/spglue_minus_meat.hpp"
|
||||
@@ -814,6 +843,8 @@ namespace arma
|
||||
#include "armadillo_bits/spglue_merge_meat.hpp"
|
||||
#include "armadillo_bits/spglue_relational_meat.hpp"
|
||||
|
||||
#include "armadillo_bits/spsolve_factoriser_meat.hpp"
|
||||
|
||||
#if defined(ARMA_USE_NEWARP)
|
||||
#include "armadillo_bits/newarp_cx_attrib.hpp"
|
||||
#include "armadillo_bits/newarp_SortEigenvalue.hpp"
|
||||
|
||||
@@ -72,8 +72,10 @@ struct BaseCube
|
||||
|
||||
arma_warn_unused inline bool is_empty() const;
|
||||
arma_warn_unused inline bool is_finite() const;
|
||||
arma_warn_unused inline bool has_inf() const;
|
||||
arma_warn_unused inline bool has_nan() const;
|
||||
|
||||
arma_warn_unused inline bool has_inf() const;
|
||||
arma_warn_unused inline bool has_nan() const;
|
||||
arma_warn_unused inline bool has_nonfinite() const;
|
||||
|
||||
arma_warn_unused inline const CubeToMatOp<derived, op_row_as_mat> row_as_mat(const uword in_row) const;
|
||||
arma_warn_unused inline const CubeToMatOp<derived, op_col_as_mat> col_as_mat(const uword in_col) const;
|
||||
|
||||
@@ -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,26 +306,30 @@ inline
|
||||
bool
|
||||
BaseCube<elem_type,derived>::is_finite() const
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
const ProxyCube<derived> P( (*this).get_ref() );
|
||||
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)
|
||||
{
|
||||
const unwrap_cube<typename ProxyCube<derived>::stored_type> U(P.Q);
|
||||
const unwrap_cube<derived> U( (*this).get_ref() );
|
||||
|
||||
return arrayops::is_finite( U.M.memptr(), U.M.n_elem );
|
||||
}
|
||||
|
||||
const uword n_r = P.get_n_rows();
|
||||
const uword n_c = P.get_n_cols();
|
||||
const uword n_s = P.get_n_slices();
|
||||
|
||||
for(uword s=0; s<n_s; ++s)
|
||||
for(uword c=0; c<n_c; ++c)
|
||||
for(uword r=0; r<n_r; ++r)
|
||||
else
|
||||
{
|
||||
if( arma_isfinite(P.at(r,c,s)) == false ) { return false; }
|
||||
const ProxyCube<derived> P( (*this).get_ref() );
|
||||
|
||||
const uword n_r = P.get_n_rows();
|
||||
const uword n_c = P.get_n_cols();
|
||||
const uword n_s = P.get_n_slices();
|
||||
|
||||
for(uword s=0; s<n_s; ++s)
|
||||
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; }
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -338,26 +342,30 @@ inline
|
||||
bool
|
||||
BaseCube<elem_type,derived>::has_inf() const
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
const ProxyCube<derived> P( (*this).get_ref() );
|
||||
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)
|
||||
{
|
||||
const unwrap_cube<typename ProxyCube<derived>::stored_type> U(P.Q);
|
||||
const unwrap_cube<derived> U( (*this).get_ref() );
|
||||
|
||||
return arrayops::has_inf( U.M.memptr(), U.M.n_elem );
|
||||
}
|
||||
|
||||
const uword n_r = P.get_n_rows();
|
||||
const uword n_c = P.get_n_cols();
|
||||
const uword n_s = P.get_n_slices();
|
||||
|
||||
for(uword s=0; s<n_s; ++s)
|
||||
for(uword c=0; c<n_c; ++c)
|
||||
for(uword r=0; r<n_r; ++r)
|
||||
else
|
||||
{
|
||||
if(arma_isinf(P.at(r,c,s))) { return true; }
|
||||
const ProxyCube<derived> P( (*this).get_ref() );
|
||||
|
||||
const uword n_r = P.get_n_rows();
|
||||
const uword n_c = P.get_n_cols();
|
||||
const uword n_s = P.get_n_slices();
|
||||
|
||||
for(uword s=0; s<n_s; ++s)
|
||||
for(uword c=0; c<n_c; ++c)
|
||||
for(uword r=0; r<n_r; ++r)
|
||||
{
|
||||
if(arma_isinf(P.at(r,c,s))) { return true; }
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -370,26 +378,66 @@ inline
|
||||
bool
|
||||
BaseCube<elem_type,derived>::has_nan() const
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
const ProxyCube<derived> P( (*this).get_ref() );
|
||||
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)
|
||||
{
|
||||
const unwrap_cube<typename ProxyCube<derived>::stored_type> U(P.Q);
|
||||
const unwrap_cube<derived> U( (*this).get_ref() );
|
||||
|
||||
return arrayops::has_nan( U.M.memptr(), U.M.n_elem );
|
||||
}
|
||||
|
||||
const uword n_r = P.get_n_rows();
|
||||
const uword n_c = P.get_n_cols();
|
||||
const uword n_s = P.get_n_slices();
|
||||
|
||||
for(uword s=0; s<n_s; ++s)
|
||||
for(uword c=0; c<n_c; ++c)
|
||||
for(uword r=0; r<n_r; ++r)
|
||||
else
|
||||
{
|
||||
if(arma_isnan(P.at(r,c,s))) { return true; }
|
||||
const ProxyCube<derived> P( (*this).get_ref() );
|
||||
|
||||
const uword n_r = P.get_n_rows();
|
||||
const uword n_c = P.get_n_cols();
|
||||
const uword n_s = P.get_n_slices();
|
||||
|
||||
for(uword s=0; s<n_s; ++s)
|
||||
for(uword c=0; c<n_c; ++c)
|
||||
for(uword r=0; r<n_r; ++r)
|
||||
{
|
||||
if(arma_isnan(P.at(r,c,s))) { return true; }
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename elem_type, typename derived>
|
||||
inline
|
||||
bool
|
||||
BaseCube<elem_type,derived>::has_nonfinite() const
|
||||
{
|
||||
arma_debug_sigprint();
|
||||
|
||||
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)
|
||||
{
|
||||
const unwrap_cube<derived> U( (*this).get_ref() );
|
||||
|
||||
return (arrayops::is_finite( U.M.memptr(), U.M.n_elem ) == false);
|
||||
}
|
||||
else
|
||||
{
|
||||
const ProxyCube<derived> P( (*this).get_ref() );
|
||||
|
||||
const uword n_r = P.get_n_rows();
|
||||
const uword n_c = P.get_n_cols();
|
||||
const uword n_s = P.get_n_slices();
|
||||
|
||||
for(uword s=0; s<n_s; ++s)
|
||||
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; }
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -425,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);
|
||||
}
|
||||
@@ -440,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) );
|
||||
}
|
||||
|
||||
@@ -153,8 +153,10 @@ struct Base
|
||||
arma_warn_unused inline bool is_colvec() const;
|
||||
arma_warn_unused inline bool is_rowvec() const;
|
||||
arma_warn_unused inline bool is_finite() const;
|
||||
arma_warn_unused inline bool has_inf() const;
|
||||
arma_warn_unused inline bool has_nan() const;
|
||||
|
||||
arma_warn_unused inline bool has_inf() const;
|
||||
arma_warn_unused inline bool has_nan() const;
|
||||
arma_warn_unused inline bool has_nonfinite() const;
|
||||
|
||||
arma_warn_unused inline const Op<derived,op_vectorise_col> as_col() const;
|
||||
arma_warn_unused inline const Op<derived,op_vectorise_row> as_row() const;
|
||||
|
||||
@@ -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,37 +663,41 @@ inline
|
||||
bool
|
||||
Base<elem_type,derived>::is_finite() const
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
const Proxy<derived> P( (*this).get_ref() );
|
||||
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)
|
||||
{
|
||||
const quasi_unwrap<typename Proxy<derived>::stored_type> U(P.Q);
|
||||
const quasi_unwrap<derived> U( (*this).get_ref() );
|
||||
|
||||
return arrayops::is_finite( U.M.memptr(), U.M.n_elem );
|
||||
}
|
||||
|
||||
if(Proxy<derived>::use_at == false)
|
||||
{
|
||||
const typename Proxy<derived>::ea_type Pea = P.get_ea();
|
||||
|
||||
const uword n_elem = P.get_n_elem();
|
||||
|
||||
for(uword i=0; i<n_elem; ++i)
|
||||
{
|
||||
if(arma_isfinite(Pea[i]) == false) { return false; }
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
const uword n_rows = P.get_n_rows();
|
||||
const uword n_cols = P.get_n_cols();
|
||||
const Proxy<derived> P( (*this).get_ref() );
|
||||
|
||||
for(uword col=0; col<n_cols; ++col)
|
||||
for(uword row=0; row<n_rows; ++row)
|
||||
if(Proxy<derived>::use_at == false)
|
||||
{
|
||||
if(arma_isfinite(P.at(row,col)) == false) { return false; }
|
||||
const typename Proxy<derived>::ea_type Pea = P.get_ea();
|
||||
|
||||
const uword n_elem = P.get_n_elem();
|
||||
|
||||
for(uword i=0; i<n_elem; ++i)
|
||||
{
|
||||
if(arma_isfinite(Pea[i]) == false) { return false; }
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
const uword n_rows = P.get_n_rows();
|
||||
const uword n_cols = P.get_n_cols();
|
||||
|
||||
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; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -707,37 +711,41 @@ inline
|
||||
bool
|
||||
Base<elem_type,derived>::has_inf() const
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
const Proxy<derived> P( (*this).get_ref() );
|
||||
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)
|
||||
{
|
||||
const quasi_unwrap<typename Proxy<derived>::stored_type> U(P.Q);
|
||||
const quasi_unwrap<derived> U( (*this).get_ref() );
|
||||
|
||||
return arrayops::has_inf( U.M.memptr(), U.M.n_elem );
|
||||
}
|
||||
|
||||
if(Proxy<derived>::use_at == false)
|
||||
{
|
||||
const typename Proxy<derived>::ea_type Pea = P.get_ea();
|
||||
|
||||
const uword n_elem = P.get_n_elem();
|
||||
|
||||
for(uword i=0; i<n_elem; ++i)
|
||||
{
|
||||
if(arma_isinf(Pea[i])) { return true; }
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
const uword n_rows = P.get_n_rows();
|
||||
const uword n_cols = P.get_n_cols();
|
||||
const Proxy<derived> P( (*this).get_ref() );
|
||||
|
||||
for(uword col=0; col<n_cols; ++col)
|
||||
for(uword row=0; row<n_rows; ++row)
|
||||
if(Proxy<derived>::use_at == false)
|
||||
{
|
||||
if(arma_isinf(P.at(row,col))) { return true; }
|
||||
const typename Proxy<derived>::ea_type Pea = P.get_ea();
|
||||
|
||||
const uword n_elem = P.get_n_elem();
|
||||
|
||||
for(uword i=0; i<n_elem; ++i)
|
||||
{
|
||||
if(arma_isinf(Pea[i])) { return true; }
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
const uword n_rows = P.get_n_rows();
|
||||
const uword n_cols = P.get_n_cols();
|
||||
|
||||
for(uword col=0; col<n_cols; ++col)
|
||||
for(uword row=0; row<n_rows; ++row)
|
||||
{
|
||||
if(arma_isinf(P.at(row,col))) { return true; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -751,37 +759,89 @@ inline
|
||||
bool
|
||||
Base<elem_type,derived>::has_nan() const
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
const Proxy<derived> P( (*this).get_ref() );
|
||||
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)
|
||||
{
|
||||
const quasi_unwrap<typename Proxy<derived>::stored_type> U(P.Q);
|
||||
const quasi_unwrap<derived> U( (*this).get_ref() );
|
||||
|
||||
return arrayops::has_nan( U.M.memptr(), U.M.n_elem );
|
||||
}
|
||||
|
||||
if(Proxy<derived>::use_at == false)
|
||||
else
|
||||
{
|
||||
const typename Proxy<derived>::ea_type Pea = P.get_ea();
|
||||
const Proxy<derived> P( (*this).get_ref() );
|
||||
|
||||
const uword n_elem = P.get_n_elem();
|
||||
|
||||
for(uword i=0; i<n_elem; ++i)
|
||||
if(Proxy<derived>::use_at == false)
|
||||
{
|
||||
if(arma_isnan(Pea[i])) { return true; }
|
||||
const typename Proxy<derived>::ea_type Pea = P.get_ea();
|
||||
|
||||
const uword n_elem = P.get_n_elem();
|
||||
|
||||
for(uword i=0; i<n_elem; ++i)
|
||||
{
|
||||
if(arma_isnan(Pea[i])) { return true; }
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
const uword n_rows = P.get_n_rows();
|
||||
const uword n_cols = P.get_n_cols();
|
||||
|
||||
for(uword col=0; col<n_cols; ++col)
|
||||
for(uword row=0; row<n_rows; ++row)
|
||||
{
|
||||
if(arma_isnan(P.at(row,col))) { return true; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename elem_type, typename derived>
|
||||
inline
|
||||
bool
|
||||
Base<elem_type,derived>::has_nonfinite() const
|
||||
{
|
||||
arma_debug_sigprint();
|
||||
|
||||
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)
|
||||
{
|
||||
const quasi_unwrap<derived> U( (*this).get_ref() );
|
||||
|
||||
return (arrayops::is_finite( U.M.memptr(), U.M.n_elem ) == false);
|
||||
}
|
||||
else
|
||||
{
|
||||
const uword n_rows = P.get_n_rows();
|
||||
const uword n_cols = P.get_n_cols();
|
||||
const Proxy<derived> P( (*this).get_ref() );
|
||||
|
||||
for(uword col=0; col<n_cols; ++col)
|
||||
for(uword row=0; row<n_rows; ++row)
|
||||
if(Proxy<derived>::use_at == false)
|
||||
{
|
||||
if(arma_isnan(P.at(row,col))) { return true; }
|
||||
const typename Proxy<derived>::ea_type Pea = P.get_ea();
|
||||
|
||||
const uword n_elem = P.get_n_elem();
|
||||
|
||||
for(uword i=0; i<n_elem; ++i)
|
||||
{
|
||||
if(arma_isfinite(Pea[i]) == false) { return true; }
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
const uword n_rows = P.get_n_rows();
|
||||
const uword n_cols = P.get_n_cols();
|
||||
|
||||
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; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -828,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;
|
||||
|
||||
@@ -853,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);
|
||||
|
||||
@@ -880,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);
|
||||
}
|
||||
@@ -895,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) );
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -258,9 +261,9 @@ class Col<eT>::fixed : public Col<eT>
|
||||
arma_warn_unused arma_inline eT* memptr();
|
||||
arma_warn_unused arma_inline const eT* memptr() const;
|
||||
|
||||
arma_hot inline const Col<eT>& fill(const eT val);
|
||||
arma_hot inline const Col<eT>& zeros();
|
||||
arma_hot inline const Col<eT>& ones();
|
||||
inline const Col<eT>& fill(const eT val);
|
||||
inline const Col<eT>& zeros();
|
||||
inline const Col<eT>& ones();
|
||||
};
|
||||
|
||||
|
||||
|
||||
+214
-153
File diff suppressed because it is too large
Load Diff
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -310,12 +310,12 @@ class Cube : public BaseCube< eT, Cube<eT> >
|
||||
arma_inline const Cube& operator--();
|
||||
arma_inline void operator--(int);
|
||||
|
||||
arma_warn_unused inline bool is_finite() const;
|
||||
arma_warn_unused arma_inline bool is_empty() const;
|
||||
|
||||
arma_warn_unused inline bool has_inf() const;
|
||||
arma_warn_unused inline bool has_nan() const;
|
||||
arma_warn_unused inline bool has_nonfinite() const;
|
||||
arma_warn_unused inline bool internal_is_finite() const;
|
||||
arma_warn_unused inline bool internal_has_inf() const;
|
||||
arma_warn_unused inline bool internal_has_nan() const;
|
||||
arma_warn_unused inline bool internal_has_nonfinite() const;
|
||||
|
||||
arma_warn_unused arma_inline bool in_range(const uword i) const;
|
||||
arma_warn_unused arma_inline bool in_range(const span& x) const;
|
||||
@@ -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();
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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,7 +86,7 @@ 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=()
|
||||
@@ -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=()
|
||||
|
||||
@@ -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,7 +88,7 @@ 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=()
|
||||
@@ -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=()
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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,7 @@ template<typename T1, typename T2, typename glue_type>
|
||||
inline
|
||||
Glue<T1,T2,glue_type>::~Glue()
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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,7 +104,7 @@ inline
|
||||
void
|
||||
MapMat<eT>::operator=(const MapMat<eT>& x)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
if(this == &x) { return; }
|
||||
|
||||
@@ -125,7 +125,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 +139,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 +181,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 +196,7 @@ inline
|
||||
void
|
||||
MapMat<eT>::operator=(MapMat<eT>&& x)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
if(this == &x) { return; }
|
||||
|
||||
@@ -222,7 +222,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 +238,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 +250,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 +262,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 +274,7 @@ inline
|
||||
void
|
||||
MapMat<eT>::zeros()
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
(*map_ptr).clear();
|
||||
}
|
||||
@@ -286,7 +286,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 +300,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 +314,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 +328,7 @@ inline
|
||||
void
|
||||
MapMat<eT>::eye()
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
(*this).eye(n_rows, n_cols);
|
||||
}
|
||||
@@ -340,7 +340,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 +363,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 +375,7 @@ inline
|
||||
void
|
||||
MapMat<eT>::speye()
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
(*this).eye();
|
||||
}
|
||||
@@ -387,7 +387,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 +399,7 @@ inline
|
||||
void
|
||||
MapMat<eT>::speye(const SizeMat& s)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
(*this).eye(s);
|
||||
}
|
||||
@@ -436,7 +436,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 +448,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 +494,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 +508,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 +579,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 +610,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 +662,7 @@ inline
|
||||
uword
|
||||
MapMat<eT>::get_n_nonzero() const
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
return uword((*map_ptr).size());
|
||||
}
|
||||
@@ -674,7 +674,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 +715,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 +725,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 +747,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 +759,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 +785,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 +813,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 +838,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 +847,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 +861,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 +877,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 +893,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 +907,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 +919,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 +940,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 +961,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);
|
||||
|
||||
@@ -992,7 +992,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);
|
||||
|
||||
@@ -1024,7 +1024,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 +1042,7 @@ arma_inline
|
||||
void
|
||||
MapMat_val<eT>::operator++(int)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
(*this).operator++();
|
||||
}
|
||||
@@ -1054,7 +1054,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 +1072,7 @@ arma_inline
|
||||
void
|
||||
MapMat_val<eT>::operator--(int)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
(*this).operator--();
|
||||
}
|
||||
@@ -1093,7 +1093,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 +1102,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 +1116,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 +1132,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 +1148,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 +1162,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 +1171,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 +1193,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 +1204,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 +1226,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 +1237,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 +1259,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 +1268,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 +1290,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 +1299,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 +1321,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 +1333,7 @@ inline
|
||||
eT
|
||||
SpMat_MapMat_val<eT>::operator++(int)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
const eT old_val = eT(*this);
|
||||
|
||||
@@ -1349,7 +1349,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 +1361,7 @@ inline
|
||||
eT
|
||||
SpMat_MapMat_val<eT>::operator--(int)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
const eT old_val = eT(*this);
|
||||
|
||||
@@ -1377,7 +1377,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 +1402,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 +1433,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 +1464,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;
|
||||
|
||||
@@ -1525,7 +1525,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;
|
||||
|
||||
@@ -1585,7 +1585,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 +1595,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 +1609,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 +1628,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 +1647,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 +1666,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 +1685,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 +1704,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 +1723,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 +1742,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 +1761,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;
|
||||
|
||||
|
||||
@@ -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);
|
||||
@@ -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);
|
||||
arma_frown("use insert_rows(row_num, N) instead") inline void insert_rows(const uword row_num, const uword N, const bool set_to_zero);
|
||||
arma_frown("use insert_cols(col_num, N) instead") inline void insert_cols(const uword col_num, const uword N, const bool set_to_zero);
|
||||
|
||||
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;
|
||||
|
||||
@@ -424,11 +442,11 @@ class Mat : public Base< eT, Mat<eT> >
|
||||
arma_warn_unused arma_inline bool is_rowvec() const;
|
||||
arma_warn_unused arma_inline bool is_colvec() const;
|
||||
arma_warn_unused arma_inline bool is_square() const;
|
||||
arma_warn_unused inline bool is_finite() const;
|
||||
|
||||
arma_warn_unused inline bool has_inf() const;
|
||||
arma_warn_unused inline bool has_nan() const;
|
||||
arma_warn_unused inline bool has_nonfinite() const;
|
||||
arma_warn_unused inline bool internal_is_finite() const;
|
||||
arma_warn_unused inline bool internal_has_inf() const;
|
||||
arma_warn_unused inline bool internal_has_nan() const;
|
||||
arma_warn_unused inline bool internal_has_nonfinite() const;
|
||||
|
||||
arma_warn_unused inline bool is_sorted(const char* direction = "ascend") const;
|
||||
arma_warn_unused inline bool is_sorted(const char* direction, const uword dim) 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
|
||||
arma_frown("use reshape(n_rows, n_cols) instead") inline void reshape(const uword new_n_rows, const uword new_n_cols, const uword dim); //!< NOTE: don't use this form: it will be removed
|
||||
|
||||
|
||||
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();
|
||||
@@ -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;
|
||||
arma_frown("use save() instead") inline bool quiet_save(const std::string name, const file_type type = arma_binary) const;
|
||||
arma_frown("use save() instead") inline bool quiet_save(const hdf5_name& spec, const file_type type = hdf5_binary) const;
|
||||
arma_frown("use save() instead") inline bool quiet_save(const csv_name& spec, const file_type type = csv_ascii) const;
|
||||
arma_frown("use save() instead") inline bool quiet_save( std::ostream& os, const file_type type = arma_binary) const;
|
||||
|
||||
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);
|
||||
arma_frown("use load() instead") inline bool quiet_load(const std::string name, const file_type type = auto_detect);
|
||||
arma_frown("use load() instead") inline bool quiet_load(const hdf5_name& spec, const file_type type = hdf5_binary);
|
||||
arma_frown("use load() instead") inline bool quiet_load(const csv_name& spec, const file_type type = csv_ascii);
|
||||
arma_frown("use load() instead") inline bool quiet_load( std::istream& is, const file_type type = auto_detect);
|
||||
|
||||
|
||||
// for container-like functionality
|
||||
|
||||
+1070
-717
File diff suppressed because it is too large
Load Diff
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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,7 @@ template<typename T1, typename op_type>
|
||||
inline
|
||||
Op<T1, op_type>::~Op()
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -22,36 +22,36 @@
|
||||
|
||||
// within each specialisation of the Proxy class:
|
||||
//
|
||||
// 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)
|
||||
@@ -173,7 +173,7 @@ struct Proxy< Mat<eT> >
|
||||
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; }
|
||||
@@ -220,7 +220,7 @@ struct Proxy< Col<eT> >
|
||||
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; }
|
||||
@@ -267,7 +267,7 @@ struct Proxy< Row<eT> >
|
||||
inline explicit Proxy(const Row<eT>& A)
|
||||
: Q(A)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
}
|
||||
|
||||
constexpr uword get_n_rows() const { return 1; }
|
||||
@@ -314,7 +314,7 @@ struct Proxy< Gen<T1, gen_type> >
|
||||
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); }
|
||||
@@ -361,7 +361,7 @@ struct Proxy< eOp<T1, eop_type> >
|
||||
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(); }
|
||||
@@ -408,7 +408,7 @@ struct Proxy< eGlue<T1, T2, eglue_type> >
|
||||
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(); }
|
||||
@@ -455,7 +455,7 @@ struct Proxy< Op<T1, op_type> >
|
||||
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; }
|
||||
@@ -502,7 +502,7 @@ struct Proxy< Glue<T1, T2, glue_type> >
|
||||
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; }
|
||||
@@ -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(); }
|
||||
@@ -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(); }
|
||||
@@ -665,7 +665,7 @@ struct Proxy< mtOp<out_eT, T1, op_type> >
|
||||
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; }
|
||||
@@ -712,7 +712,7 @@ struct Proxy< mtGlue<out_eT, T1, T2, glue_type> >
|
||||
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; }
|
||||
@@ -759,7 +759,7 @@ struct Proxy< CubeToMatOp<T1, op_type> >
|
||||
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,7 +795,7 @@ 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;
|
||||
@@ -808,7 +808,7 @@ struct Proxy< CubeToMatOp<T1, op_vectorise_cube_col> >
|
||||
: 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; }
|
||||
@@ -855,7 +855,7 @@ struct Proxy< SpToDOp<T1, op_type> >
|
||||
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;
|
||||
|
||||
arma_aligned const SpMat<elem_type>& R;
|
||||
arma_aligned 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;
|
||||
arma_aligned 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; }
|
||||
@@ -951,7 +998,7 @@ struct Proxy< subview<eT> >
|
||||
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; }
|
||||
@@ -998,7 +1045,7 @@ struct Proxy< subview_col<eT> >
|
||||
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; }
|
||||
@@ -1047,7 +1094,7 @@ struct Proxy< subview_cols<eT> >
|
||||
: 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; }
|
||||
@@ -1094,7 +1141,7 @@ struct Proxy< subview_row<eT> >
|
||||
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; }
|
||||
@@ -1143,21 +1190,21 @@ struct Proxy< subview_elem1<eT,T1> >
|
||||
: 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); }
|
||||
@@ -1195,7 +1242,7 @@ struct Proxy< subview_elem2<eT,T1,T2> >
|
||||
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; }
|
||||
@@ -1242,7 +1289,7 @@ struct Proxy< diagview<eT> >
|
||||
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; }
|
||||
@@ -1298,7 +1345,7 @@ struct Proxy_diagvec_mat< Op<T1, op_diagvec> >
|
||||
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; }
|
||||
@@ -1353,7 +1400,7 @@ struct Proxy_diagvec_expr< Op<T1, op_diagvec> >
|
||||
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();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1426,7 +1473,7 @@ struct Proxy< Op<T1, op_diagvec2> >
|
||||
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; }
|
||||
@@ -1574,7 +1621,7 @@ struct Proxy_xtrans_vector< Op<T1, op_htrans> >
|
||||
: 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(); }
|
||||
@@ -1616,7 +1663,7 @@ struct Proxy_xtrans_vector< Op<T1, op_strans> >
|
||||
: 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; }
|
||||
@@ -1790,7 +1837,7 @@ struct Proxy_subview_row_htrans_cx
|
||||
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>
|
||||
@@ -1824,7 +1871,7 @@ struct Proxy_subview_row_htrans_non_cx
|
||||
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; }
|
||||
@@ -1931,7 +1978,7 @@ struct Proxy< Op<subview_row<eT>, op_strans> >
|
||||
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; }
|
||||
@@ -2134,7 +2181,7 @@ struct Proxy< Op<T1, op_htrans2> >
|
||||
: 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(); }
|
||||
@@ -2181,7 +2228,7 @@ struct Proxy< subview_row_strans<eT> >
|
||||
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; }
|
||||
@@ -2228,7 +2275,7 @@ struct Proxy< subview_row_htrans<eT> >
|
||||
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; }
|
||||
@@ -2275,7 +2322,7 @@ struct Proxy< xtrans_mat<eT, do_conj> >
|
||||
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; }
|
||||
@@ -2322,7 +2369,7 @@ struct Proxy< xvec_htrans<eT> >
|
||||
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; }
|
||||
@@ -2379,7 +2426,7 @@ struct Proxy_vectorise_col_mat< Op<T1, op_vectorise_col> >
|
||||
: 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; }
|
||||
@@ -2436,7 +2483,7 @@ struct Proxy_vectorise_col_expr< Op<T1, op_vectorise_col> >
|
||||
: 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();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ struct ProxyCube< Cube<eT> >
|
||||
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; }
|
||||
@@ -98,7 +98,7 @@ struct ProxyCube< GenCube<eT, gen_type> >
|
||||
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; }
|
||||
@@ -143,7 +143,7 @@ struct ProxyCube< OpCube<T1, op_type> >
|
||||
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; }
|
||||
@@ -188,7 +188,7 @@ struct ProxyCube< GlueCube<T1, T2, glue_type> >
|
||||
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; }
|
||||
@@ -233,7 +233,7 @@ struct ProxyCube< subview_cube<eT> >
|
||||
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; }
|
||||
@@ -278,7 +278,7 @@ struct ProxyCube< subview_cube_slices<eT,T1> >
|
||||
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; }
|
||||
@@ -323,7 +323,7 @@ struct ProxyCube< eOpCube<T1, eop_type > >
|
||||
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(); }
|
||||
@@ -368,7 +368,7 @@ struct ProxyCube< eGlueCube<T1, T2, eglue_type > >
|
||||
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(); }
|
||||
@@ -413,7 +413,7 @@ struct ProxyCube< mtOpCube<out_eT, T1, op_type> >
|
||||
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; }
|
||||
@@ -458,7 +458,7 @@ struct ProxyCube< mtGlueCube<out_eT, T1, T2, glue_type > >
|
||||
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; }
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -258,9 +261,9 @@ class Row<eT>::fixed : public Row<eT>
|
||||
arma_warn_unused arma_inline eT* memptr();
|
||||
arma_warn_unused arma_inline const eT* memptr() const;
|
||||
|
||||
arma_hot inline const Row<eT>& fill(const eT val);
|
||||
arma_hot inline const Row<eT>& zeros();
|
||||
arma_hot inline const Row<eT>& ones();
|
||||
inline const Row<eT>& fill(const eT val);
|
||||
inline const Row<eT>& zeros();
|
||||
inline const Row<eT>& ones();
|
||||
};
|
||||
|
||||
|
||||
|
||||
+214
-153
File diff suppressed because it is too large
Load Diff
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -102,11 +102,15 @@ struct SpBase
|
||||
arma_warn_unused inline bool is_colvec() const;
|
||||
arma_warn_unused inline bool is_rowvec() const;
|
||||
arma_warn_unused inline bool is_finite() const;
|
||||
arma_warn_unused inline bool has_inf() const;
|
||||
arma_warn_unused inline bool has_nan() const;
|
||||
|
||||
arma_warn_unused inline bool has_inf() const;
|
||||
arma_warn_unused inline bool has_nan() const;
|
||||
arma_warn_unused inline bool has_nonfinite() const;
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -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,18 +729,20 @@ inline
|
||||
bool
|
||||
SpBase<elem_type,derived>::is_finite() const
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
const SpProxy<derived> P( (*this).get_ref() );
|
||||
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)
|
||||
{
|
||||
const unwrap_spmat<typename SpProxy<derived>::stored_type> U(P.Q);
|
||||
const unwrap_spmat<derived> U( (*this).get_ref() );
|
||||
|
||||
return U.M.is_finite();
|
||||
return U.M.internal_is_finite();
|
||||
}
|
||||
else
|
||||
{
|
||||
const SpProxy<derived> P( (*this).get_ref() );
|
||||
|
||||
typename SpProxy<derived>::const_iterator_type it = P.begin();
|
||||
typename SpProxy<derived>::const_iterator_type it_end = P.end();
|
||||
|
||||
@@ -761,18 +763,20 @@ inline
|
||||
bool
|
||||
SpBase<elem_type,derived>::has_inf() const
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
const SpProxy<derived> P( (*this).get_ref() );
|
||||
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)
|
||||
{
|
||||
const unwrap_spmat<typename SpProxy<derived>::stored_type> U(P.Q);
|
||||
const unwrap_spmat<derived> U( (*this).get_ref() );
|
||||
|
||||
return U.M.has_inf();
|
||||
return U.M.internal_has_inf();
|
||||
}
|
||||
else
|
||||
{
|
||||
const SpProxy<derived> P( (*this).get_ref() );
|
||||
|
||||
typename SpProxy<derived>::const_iterator_type it = P.begin();
|
||||
typename SpProxy<derived>::const_iterator_type it_end = P.end();
|
||||
|
||||
@@ -793,18 +797,20 @@ inline
|
||||
bool
|
||||
SpBase<elem_type,derived>::has_nan() const
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
const SpProxy<derived> P( (*this).get_ref() );
|
||||
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)
|
||||
{
|
||||
const unwrap_spmat<typename SpProxy<derived>::stored_type> U(P.Q);
|
||||
const unwrap_spmat<derived> U( (*this).get_ref() );
|
||||
|
||||
return U.M.has_nan();
|
||||
return U.M.internal_has_nan();
|
||||
}
|
||||
else
|
||||
{
|
||||
const SpProxy<derived> P( (*this).get_ref() );
|
||||
|
||||
typename SpProxy<derived>::const_iterator_type it = P.begin();
|
||||
typename SpProxy<derived>::const_iterator_type it_end = P.end();
|
||||
|
||||
@@ -820,6 +826,40 @@ SpBase<elem_type,derived>::has_nan() const
|
||||
|
||||
|
||||
|
||||
template<typename elem_type, typename derived>
|
||||
inline
|
||||
bool
|
||||
SpBase<elem_type,derived>::has_nonfinite() const
|
||||
{
|
||||
arma_debug_sigprint();
|
||||
|
||||
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)
|
||||
{
|
||||
const unwrap_spmat<derived> U( (*this).get_ref() );
|
||||
|
||||
return U.M.internal_has_nonfinite();
|
||||
}
|
||||
else
|
||||
{
|
||||
const SpProxy<derived> P( (*this).get_ref() );
|
||||
|
||||
typename SpProxy<derived>::const_iterator_type it = P.begin();
|
||||
typename SpProxy<derived>::const_iterator_type it_end = P.end();
|
||||
|
||||
while(it != it_end)
|
||||
{
|
||||
if(arma_isfinite(*it) == false) { return true; }
|
||||
++it;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename elem_type, typename derived>
|
||||
inline
|
||||
const SpOp<derived,spop_vectorise_col>
|
||||
@@ -840,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() );
|
||||
}
|
||||
|
||||
|
||||
|
||||
//! @}
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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;
|
||||
@@ -301,7 +302,6 @@ class SpMat : public SpBase< eT, SpMat<eT> >
|
||||
arma_warn_unused arma_inline bool is_rowvec() const;
|
||||
arma_warn_unused arma_inline bool is_colvec() const;
|
||||
arma_warn_unused arma_inline bool is_square() const;
|
||||
arma_warn_unused inline bool is_finite() const;
|
||||
|
||||
arma_warn_unused inline bool is_symmetric() const;
|
||||
arma_warn_unused inline bool is_symmetric(const typename get_pod_type<eT>::result tol) const;
|
||||
@@ -309,9 +309,10 @@ class SpMat : public SpBase< eT, SpMat<eT> >
|
||||
arma_warn_unused inline bool is_hermitian() const;
|
||||
arma_warn_unused inline bool is_hermitian(const typename get_pod_type<eT>::result tol) const;
|
||||
|
||||
arma_warn_unused inline bool has_inf() const;
|
||||
arma_warn_unused inline bool has_nan() const;
|
||||
arma_warn_unused inline bool has_nonfinite() const;
|
||||
arma_warn_unused inline bool internal_is_finite() const;
|
||||
arma_warn_unused inline bool internal_has_inf() const;
|
||||
arma_warn_unused inline bool internal_has_nan() const;
|
||||
arma_warn_unused inline bool internal_has_nonfinite() const;
|
||||
|
||||
arma_warn_unused arma_inline bool in_range(const uword i) const;
|
||||
arma_warn_unused arma_inline bool in_range(const span& x) 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;
|
||||
arma_frown("use save() instead") inline bool quiet_save(const std::string name, const file_type type = arma_binary) const;
|
||||
arma_frown("use save() instead") inline bool quiet_save( std::ostream& os, const file_type type = arma_binary) const;
|
||||
|
||||
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);
|
||||
arma_frown("use load() instead") inline bool quiet_load(const std::string name, const file_type type = arma_binary);
|
||||
arma_frown("use load() instead") inline bool quiet_load( std::istream& is, const file_type type = arma_binary);
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -25,43 +25,43 @@
|
||||
|
||||
// within each specialisation of the Proxy class:
|
||||
//
|
||||
// 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
|
||||
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@ struct SpProxy< SpMat<eT> >
|
||||
inline explicit SpProxy(const SpMat<eT>& A)
|
||||
: Q(A)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
Q.sync();
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ struct SpProxy< SpMat<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)); }
|
||||
};
|
||||
|
||||
|
||||
@@ -139,7 +139,7 @@ struct SpProxy< SpCol<eT> >
|
||||
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)); }
|
||||
};
|
||||
|
||||
|
||||
@@ -191,7 +191,7 @@ struct SpProxy< SpRow<eT> >
|
||||
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)); }
|
||||
};
|
||||
|
||||
|
||||
@@ -243,7 +243,7 @@ struct SpProxy< SpSubview<eT> >
|
||||
inline explicit SpProxy(const SpSubview<eT>& A)
|
||||
: Q(A)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
Q.m.sync();
|
||||
}
|
||||
|
||||
@@ -268,7 +268,7 @@ struct SpProxy< SpSubview<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)); }
|
||||
};
|
||||
|
||||
|
||||
@@ -295,7 +295,7 @@ struct SpProxy< SpSubview_col<eT> >
|
||||
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)); }
|
||||
};
|
||||
|
||||
|
||||
@@ -347,7 +347,7 @@ struct SpProxy< SpSubview_col_list<eT,T1> >
|
||||
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; }
|
||||
@@ -398,7 +398,7 @@ struct SpProxy< SpSubview_row<eT> >
|
||||
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)); }
|
||||
};
|
||||
|
||||
|
||||
@@ -450,7 +450,7 @@ struct SpProxy< spdiagview<eT> >
|
||||
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; }
|
||||
@@ -502,7 +502,7 @@ struct SpProxy< SpOp<T1, spop_type> >
|
||||
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; }
|
||||
@@ -554,7 +554,7 @@ struct SpProxy< SpGlue<T1, T2, spglue_type> >
|
||||
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; }
|
||||
@@ -605,7 +605,7 @@ struct SpProxy< mtSpOp<out_eT, T1, spop_type> >
|
||||
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; }
|
||||
@@ -656,7 +656,58 @@ struct SpProxy< mtSpGlue<out_eT, T1, T2, spglue_type> >
|
||||
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;
|
||||
|
||||
arma_aligned 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; }
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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:
|
||||
|
||||
|
||||
@@ -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,7 +251,7 @@ inline
|
||||
void
|
||||
SpSubview_col_list<eT,T1>::operator*= (const eT val)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
if(val == eT(0)) { (*this).zeros(); return; }
|
||||
|
||||
@@ -296,7 +296,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 +315,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 +326,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 +378,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 +393,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 +408,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 +423,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 +437,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 +452,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 +467,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 +487,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 +531,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 +546,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 +561,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 +576,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 +597,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 +665,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 +679,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 +693,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 +707,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);
|
||||
|
||||
|
||||
@@ -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,7 +155,7 @@ inline
|
||||
const SpSubview<eT>&
|
||||
SpSubview<eT>::operator*=(const eT val)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
if(val == eT(0)) { (*this).zeros(); return *this; }
|
||||
|
||||
@@ -207,9 +217,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 +278,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 +295,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 +304,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 +319,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 +332,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 +345,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,9 +362,62 @@ 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() );
|
||||
SpSubview<eT>& sv = (*this);
|
||||
|
||||
const quasi_unwrap<T1> U(x.get_ref());
|
||||
const Mat<eT>& B = U.M;
|
||||
|
||||
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);
|
||||
|
||||
sv_m.sync_csc();
|
||||
sv_m.invalidate_cache();
|
||||
|
||||
const uword m_row_start = sv.aux_row1;
|
||||
const uword m_row_end = sv.aux_row1 + sv.n_rows - 1;
|
||||
|
||||
const uword m_col_start = sv.aux_col1;
|
||||
const uword m_col_end = sv.aux_col1 + sv.n_cols - 1;
|
||||
|
||||
constexpr eT zero = eT(0);
|
||||
|
||||
bool has_zero = false;
|
||||
uword count = 0;
|
||||
|
||||
for(uword m_col = m_col_start; m_col <= m_col_end; ++m_col)
|
||||
{
|
||||
const uword sv_col = m_col - m_col_start;
|
||||
|
||||
const uword index_start = sv_m.col_ptrs[m_col ];
|
||||
const uword index_end = sv_m.col_ptrs[m_col + 1];
|
||||
|
||||
for(uword i=index_start; i < index_end; ++i)
|
||||
{
|
||||
const uword m_row = sv_m.row_indices[i];
|
||||
|
||||
if(m_row < m_row_start) { continue; }
|
||||
if(m_row > m_row_end ) { break; }
|
||||
|
||||
const uword sv_row = m_row - m_row_start;
|
||||
|
||||
eT& m_val = access::rw(sv_m.values[i]);
|
||||
|
||||
const eT result = m_val * B.at(sv_row, sv_col);
|
||||
|
||||
m_val = result;
|
||||
|
||||
if(result == zero) { has_zero = true; } else { ++count; }
|
||||
}
|
||||
}
|
||||
|
||||
if(has_zero) { sv_m.remove_zeros(); }
|
||||
|
||||
access::rw(sv.n_nonzero) = count;
|
||||
|
||||
return (*this);
|
||||
}
|
||||
|
||||
|
||||
@@ -365,9 +428,70 @@ 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() );
|
||||
const SpSubview<eT>& A = (*this);
|
||||
|
||||
const quasi_unwrap<T1> U(x.get_ref());
|
||||
const Mat<eT>& B = U.M;
|
||||
|
||||
arma_conform_assert_same_size(A.n_rows, A.n_cols, B.n_rows, B.n_cols, "element-wise division");
|
||||
|
||||
bool result_ok = true;
|
||||
|
||||
constexpr eT zero = eT(0);
|
||||
|
||||
const uword B_n_rows = B.n_rows;
|
||||
const uword B_n_cols = B.n_cols;
|
||||
|
||||
for(uword c=0; c < B_n_cols; ++c)
|
||||
{
|
||||
for(uword r=0; r < B_n_rows; ++r)
|
||||
{
|
||||
// a zero in B and A at the same location implies the division result is NaN;
|
||||
// hence a zero in A (not stored) needs to be changed into a non-zero
|
||||
|
||||
// for efficiency, an element in B is checked before checking the corresponding element in A
|
||||
|
||||
if((B.at(r,c) == zero) && (A.at(r,c) == zero)) { result_ok = false; break; }
|
||||
}
|
||||
|
||||
if(result_ok == false) { break; }
|
||||
}
|
||||
|
||||
if(result_ok)
|
||||
{
|
||||
const_iterator cit = A.begin();
|
||||
const_iterator cit_end = A.end();
|
||||
|
||||
while(cit != cit_end)
|
||||
{
|
||||
const eT tmp = (*cit) / B.at(cit.row(), cit.col());
|
||||
|
||||
if(tmp == zero) { result_ok = false; break; }
|
||||
|
||||
++cit;
|
||||
}
|
||||
}
|
||||
|
||||
if(result_ok)
|
||||
{
|
||||
iterator it = (*this).begin();
|
||||
iterator it_end = (*this).end();
|
||||
|
||||
while(it != it_end)
|
||||
{
|
||||
(*it) /= B.at(it.row(), it.col());
|
||||
|
||||
++it;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
(*this).operator=( (*this) / B );
|
||||
}
|
||||
|
||||
return (*this);
|
||||
}
|
||||
|
||||
|
||||
@@ -377,7 +501,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);
|
||||
}
|
||||
@@ -390,7 +514,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() );
|
||||
}
|
||||
@@ -403,11 +527,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))
|
||||
{
|
||||
@@ -431,7 +555,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() );
|
||||
@@ -445,7 +569,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() );
|
||||
@@ -459,7 +583,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() );
|
||||
}
|
||||
@@ -472,7 +596,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() );
|
||||
@@ -486,13 +610,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)
|
||||
{
|
||||
@@ -521,7 +645,7 @@ inline
|
||||
void
|
||||
SpSubview<eT>::for_each(functor F)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
m.sync_csc();
|
||||
m.invalidate_cache();
|
||||
@@ -578,7 +702,7 @@ inline
|
||||
void
|
||||
SpSubview<eT>::for_each(functor F) const
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
m.sync_csc();
|
||||
|
||||
@@ -616,7 +740,7 @@ inline
|
||||
void
|
||||
SpSubview<eT>::transform(functor F)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
m.sync_csc();
|
||||
m.invalidate_cache();
|
||||
@@ -672,7 +796,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))
|
||||
{
|
||||
@@ -751,7 +875,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; }
|
||||
|
||||
@@ -779,16 +903,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; }
|
||||
@@ -809,7 +933,7 @@ inline
|
||||
void
|
||||
SpSubview<eT>::fill(const eT val)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
if(val != eT(0))
|
||||
{
|
||||
@@ -832,7 +956,7 @@ inline
|
||||
void
|
||||
SpSubview<eT>::zeros()
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
if((n_elem == 0) || (n_nonzero == 0)) { return; }
|
||||
|
||||
@@ -889,7 +1013,7 @@ inline
|
||||
void
|
||||
SpSubview<eT>::ones()
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
(*this).fill(eT(1));
|
||||
}
|
||||
@@ -901,7 +1025,7 @@ inline
|
||||
void
|
||||
SpSubview<eT>::eye()
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
SpMat<eT> tmp;
|
||||
|
||||
@@ -917,7 +1041,7 @@ inline
|
||||
void
|
||||
SpSubview<eT>::randu()
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
Mat<eT> tmp( (*this).n_rows, (*this).n_cols, fill::randu );
|
||||
|
||||
@@ -931,7 +1055,7 @@ inline
|
||||
void
|
||||
SpSubview<eT>::randn()
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
Mat<eT> tmp( (*this).n_rows, (*this).n_cols, fill::randn );
|
||||
|
||||
@@ -971,7 +1095,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;
|
||||
@@ -986,7 +1110,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;
|
||||
@@ -1001,7 +1125,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);
|
||||
}
|
||||
@@ -1013,7 +1137,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);
|
||||
}
|
||||
@@ -1122,9 +1246,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);
|
||||
}
|
||||
@@ -1136,9 +1260,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);
|
||||
}
|
||||
@@ -1150,9 +1274,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);
|
||||
}
|
||||
@@ -1164,9 +1288,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);
|
||||
}
|
||||
@@ -1178,9 +1302,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"
|
||||
@@ -1196,9 +1320,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"
|
||||
@@ -1214,9 +1338,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"
|
||||
@@ -1232,9 +1356,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"
|
||||
@@ -1250,9 +1374,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"
|
||||
@@ -1268,9 +1392,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"
|
||||
@@ -1286,7 +1410,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;
|
||||
@@ -1297,7 +1421,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)))
|
||||
||
|
||||
@@ -1315,7 +1439,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;
|
||||
@@ -1326,7 +1450,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)))
|
||||
||
|
||||
@@ -1344,7 +1468,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);
|
||||
}
|
||||
@@ -1356,7 +1480,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);
|
||||
}
|
||||
@@ -1368,7 +1492,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));
|
||||
}
|
||||
@@ -1380,7 +1504,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));
|
||||
}
|
||||
@@ -1392,7 +1516,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);
|
||||
}
|
||||
@@ -1404,7 +1528,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);
|
||||
}
|
||||
@@ -1416,9 +1540,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;
|
||||
@@ -1438,9 +1562,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;
|
||||
@@ -1637,7 +1761,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;
|
||||
@@ -1655,7 +1779,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;
|
||||
@@ -1670,7 +1794,7 @@ inline
|
||||
void
|
||||
SpSubview<eT>::invalidate_cache() const
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
m.invalidate_cache();
|
||||
}
|
||||
@@ -1688,7 +1812,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();
|
||||
}
|
||||
|
||||
|
||||
@@ -1698,7 +1822,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();
|
||||
}
|
||||
|
||||
|
||||
@@ -1708,7 +1832,7 @@ inline
|
||||
void
|
||||
SpSubview_col<eT>::operator=(const SpSubview<eT>& x)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
SpSubview<eT>::operator=(x);
|
||||
}
|
||||
@@ -1720,7 +1844,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'
|
||||
}
|
||||
@@ -1733,7 +1857,7 @@ inline
|
||||
void
|
||||
SpSubview_col<eT>::operator=(const SpBase<eT,T1>& x)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
SpSubview<eT>::operator=(x);
|
||||
}
|
||||
@@ -1746,7 +1870,7 @@ inline
|
||||
void
|
||||
SpSubview_col<eT>::operator=(const Base<eT,T1>& x)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
SpSubview<eT>::operator=(x);
|
||||
}
|
||||
@@ -1783,6 +1907,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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
@@ -1794,7 +1928,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();
|
||||
}
|
||||
|
||||
|
||||
@@ -1804,7 +1938,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();
|
||||
}
|
||||
|
||||
|
||||
@@ -1814,7 +1948,7 @@ inline
|
||||
void
|
||||
SpSubview_row<eT>::operator=(const SpSubview<eT>& x)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
SpSubview<eT>::operator=(x);
|
||||
}
|
||||
@@ -1826,7 +1960,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'
|
||||
}
|
||||
@@ -1839,7 +1973,7 @@ inline
|
||||
void
|
||||
SpSubview_row<eT>::operator=(const SpBase<eT,T1>& x)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
SpSubview<eT>::operator=(x);
|
||||
}
|
||||
@@ -1852,7 +1986,7 @@ inline
|
||||
void
|
||||
SpSubview_row<eT>::operator=(const Base<eT,T1>& x)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
SpSubview<eT>::operator=(x);
|
||||
}
|
||||
@@ -1889,4 +2023,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,45 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
// Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
|
||||
//! \addtogroup SpToDGlue
|
||||
//! @{
|
||||
|
||||
|
||||
|
||||
template<typename T1, typename T2, typename glue_type>
|
||||
class SpToDGlue : public Base< typename T1::elem_type, SpToDGlue<T1, T2, glue_type> >
|
||||
{
|
||||
public:
|
||||
|
||||
typedef typename T1::elem_type elem_type;
|
||||
typedef typename get_pod_type<elem_type>::result pod_type;
|
||||
|
||||
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();
|
||||
|
||||
const T1& A; //!< first operand; must be derived from Base or SpBase
|
||||
const T2& B; //!< second operand; must be derived from Base or SpBase
|
||||
};
|
||||
|
||||
|
||||
|
||||
//! @}
|
||||
@@ -0,0 +1,44 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
// Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
|
||||
//! \addtogroup 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();
|
||||
}
|
||||
|
||||
|
||||
|
||||
//! @}
|
||||
@@ -20,17 +20,7 @@
|
||||
//! @{
|
||||
|
||||
|
||||
|
||||
//! Class for storing data required for delayed unary operations on a sparse
|
||||
//! matrix that produce a dense matrix; the data for storage may include
|
||||
//! the operand (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> >
|
||||
@@ -40,16 +30,19 @@ class SpToDOp : public Base< typename T1::elem_type, SpToDOp<T1, op_type> >
|
||||
typedef typename T1::elem_type elem_type;
|
||||
typedef typename get_pod_type<elem_type>::result pod_type;
|
||||
|
||||
static constexpr bool is_row = op_type::template traits<T1>::is_row;
|
||||
static constexpr bool is_col = op_type::template traits<T1>::is_col;
|
||||
static constexpr bool is_xvec = op_type::template traits<T1>::is_xvec;
|
||||
|
||||
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();
|
||||
|
||||
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;
|
||||
arma_aligned uword aux_uword_a; //!< auxiliary data, uword format
|
||||
arma_aligned uword aux_uword_b; //!< auxiliary data, uword format
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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,20 +137,19 @@ 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)
|
||||
{
|
||||
// The value already exists and merely needs to be updated.
|
||||
@@ -163,44 +157,38 @@ SpValProxy<T1>::operator*=(const eT 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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
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)
|
||||
{
|
||||
*val_ptr /= rhs;
|
||||
parent.invalidate_cache();
|
||||
check_zero();
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if(val_ptr)
|
||||
{
|
||||
*val_ptr /= rhs; // That is where it gets ugly.
|
||||
@@ -211,27 +199,25 @@ SpValProxy<T1>::operator/=(const eT rhs)
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename T1>
|
||||
arma_inline
|
||||
inline
|
||||
SpValProxy<T1>&
|
||||
SpValProxy<T1>::operator++()
|
||||
{
|
||||
@@ -241,19 +227,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 +248,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 +269,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 +287,7 @@ SpValProxy<T1>::operator++(const int)
|
||||
|
||||
|
||||
template<typename T1>
|
||||
arma_inline
|
||||
inline
|
||||
typename T1::elem_type
|
||||
SpValProxy<T1>::operator--(const int)
|
||||
{
|
||||
@@ -314,12 +297,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);
|
||||
|
||||
@@ -65,6 +65,13 @@ struct arma_config
|
||||
#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 +128,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
|
||||
@@ -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,10 +216,24 @@ struct arma_config
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(ARMA_DONT_ZERO_INIT)
|
||||
static constexpr bool zero_init = false;
|
||||
#if defined(ARMA_FAST_MATH)
|
||||
static constexpr bool fast_math = true;
|
||||
#else
|
||||
static constexpr bool zero_init = true;
|
||||
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
|
||||
|
||||
|
||||
|
||||
@@ -129,6 +129,17 @@ class spop_htrans;
|
||||
class spop_vectorise_row;
|
||||
class spop_vectorise_col;
|
||||
|
||||
class spop_rel_lt_pre;
|
||||
class spop_rel_lt_post;
|
||||
class spop_rel_gt_pre;
|
||||
class spop_rel_gt_post;
|
||||
class spop_rel_lteq_pre;
|
||||
class spop_rel_lteq_post;
|
||||
class spop_rel_gteq_pre;
|
||||
class spop_rel_gteq_post;
|
||||
class spop_rel_eq;
|
||||
class spop_rel_noteq;
|
||||
|
||||
class spglue_plus;
|
||||
class spglue_minus;
|
||||
class spglue_schur;
|
||||
@@ -138,7 +149,7 @@ class spglue_min;
|
||||
class spglue_rel_lt;
|
||||
class spglue_rel_gt;
|
||||
|
||||
|
||||
class op_sp_as_dense;
|
||||
|
||||
class op_internal_equ;
|
||||
class op_internal_plus;
|
||||
@@ -245,9 +256,10 @@ 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 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> class Glue;
|
||||
template< typename T1, typename T2, typename eglue_type> class eGlue;
|
||||
template< typename T1, typename T2, typename glue_type> class SpToDGlue;
|
||||
template<typename out_eT, typename T1, typename T2, typename glue_type> class mtGlue;
|
||||
|
||||
|
||||
|
||||
@@ -279,7 +291,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;
|
||||
@@ -298,7 +310,7 @@ struct state_type
|
||||
#if defined(ARMA_USE_OPENMP)
|
||||
#pragma omp atomic read
|
||||
out = state;
|
||||
#elif (!defined(ARMA_DONT_USE_STD_MUTEX))
|
||||
#elif defined(ARMA_USE_STD_MUTEX)
|
||||
out = state.load();
|
||||
#else
|
||||
out = state;
|
||||
@@ -314,7 +326,7 @@ struct state_type
|
||||
#if defined(ARMA_USE_OPENMP)
|
||||
#pragma omp atomic write
|
||||
state = in_state;
|
||||
#elif (!defined(ARMA_DONT_USE_STD_MUTEX))
|
||||
#elif defined(ARMA_USE_STD_MUTEX)
|
||||
state.store(in_state);
|
||||
#else
|
||||
state = in_state;
|
||||
@@ -325,6 +337,7 @@ struct state_type
|
||||
|
||||
template< typename T1, typename spop_type> class SpOp;
|
||||
template<typename out_eT, typename T1, typename spop_type> class mtSpOp;
|
||||
template<typename out_eT, typename T1, typename op_type> class mtSpReduceOp;
|
||||
|
||||
template< typename T1, typename T2, typename spglue_type> class SpGlue;
|
||||
template<typename out_eT, typename T1, typename T2, typename spglue_type> class mtSpGlue;
|
||||
|
||||
@@ -49,8 +49,7 @@ class arma_ostream
|
||||
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);
|
||||
|
||||
@@ -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);
|
||||
@@ -429,7 +429,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 +498,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 +540,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 +613,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 +683,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 +765,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 +867,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 +888,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 +910,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 +1068,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 +1125,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; }
|
||||
|
||||
|
||||
@@ -20,55 +20,63 @@
|
||||
//! @{
|
||||
|
||||
|
||||
#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(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
|
||||
#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
|
||||
|
||||
|
||||
class arma_rng
|
||||
@@ -77,7 +85,7 @@ class arma_rng
|
||||
|
||||
#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 +93,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 +122,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 +225,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 +258,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(...) {}
|
||||
|
||||
@@ -162,12 +279,9 @@ arma_rng::set_seed_random()
|
||||
|
||||
if(f.good()) { f.read((char*)(&(tmp.b[0])), sizeof(seed_type)); }
|
||||
|
||||
if(f.good())
|
||||
{
|
||||
seed2 = tmp.a;
|
||||
if(f.good()) { seed2 = tmp.a; }
|
||||
|
||||
if(seed2 != seed_type(0)) { have_seed = true; }
|
||||
}
|
||||
have_seed = (seed2 != seed_type(0));
|
||||
}
|
||||
catch(...) {}
|
||||
}
|
||||
@@ -199,7 +313,7 @@ arma_rng::set_seed_random()
|
||||
}
|
||||
}
|
||||
|
||||
arma_rng::set_seed( seed1 + seed2 + seed3 + seed4 );
|
||||
arma_rng::set_seed(seed1 + seed2 + seed3 + seed4);
|
||||
}
|
||||
|
||||
|
||||
@@ -218,11 +332,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 +361,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 +382,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 +427,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 +456,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 +496,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 +540,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 +581,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 +647,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 +714,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 +743,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 +779,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 +837,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 +927,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 +1010,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
|
||||
{
|
||||
|
||||
+119
-204
@@ -22,24 +22,57 @@
|
||||
|
||||
namespace arma_str
|
||||
{
|
||||
class char_buffer
|
||||
{
|
||||
public:
|
||||
|
||||
static constexpr uword n_chars_prealloc = 1024;
|
||||
|
||||
char* mem = nullptr;
|
||||
uword n_chars = 0;
|
||||
|
||||
char local_mem[n_chars_prealloc];
|
||||
|
||||
inline
|
||||
~char_buffer()
|
||||
{
|
||||
if(n_chars > n_chars_prealloc) { std::free(mem); }
|
||||
|
||||
mem = nullptr;
|
||||
n_chars = 0;
|
||||
}
|
||||
|
||||
inline
|
||||
char_buffer()
|
||||
{
|
||||
mem = &(local_mem[0]);
|
||||
n_chars = n_chars_prealloc;
|
||||
|
||||
if(n_chars > 0) { mem[0] = char(0); }
|
||||
}
|
||||
|
||||
inline
|
||||
void
|
||||
set_size(const uword new_n_chars)
|
||||
{
|
||||
if(n_chars > n_chars_prealloc) { std::free(mem); }
|
||||
|
||||
mem = (new_n_chars <= n_chars_prealloc) ? &(local_mem[0]) : (char*)std::malloc(new_n_chars);
|
||||
n_chars = (new_n_chars <= n_chars_prealloc) ? n_chars_prealloc : new_n_chars;
|
||||
|
||||
if(n_chars > 0) { mem[0] = char(0); }
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class format
|
||||
{
|
||||
public:
|
||||
|
||||
format(const char* in_fmt)
|
||||
: A(in_fmt)
|
||||
{
|
||||
}
|
||||
const std::string fmt;
|
||||
|
||||
format(const std::string& in_fmt)
|
||||
: A(in_fmt)
|
||||
{
|
||||
}
|
||||
|
||||
// TODO: constructor to handle std::string&& ?
|
||||
|
||||
const std::string A;
|
||||
inline format(const char* in_fmt) : fmt(in_fmt) { }
|
||||
inline format(const std::string& in_fmt) : fmt(in_fmt) { }
|
||||
|
||||
private:
|
||||
format();
|
||||
@@ -52,15 +85,11 @@ namespace arma_str
|
||||
{
|
||||
public:
|
||||
|
||||
basic_format(const T1& in_A, const T2& in_B)
|
||||
: A(in_A)
|
||||
, B(in_B)
|
||||
{
|
||||
}
|
||||
|
||||
const T1& A;
|
||||
const T2& B;
|
||||
|
||||
inline basic_format(const T1& in_A, const T2& in_B) : A(in_A) , B(in_B) { }
|
||||
|
||||
private:
|
||||
basic_format();
|
||||
};
|
||||
@@ -92,49 +121,30 @@ namespace arma_str
|
||||
std::string
|
||||
str(const basic_format< format, T2>& X)
|
||||
{
|
||||
char local_buffer[1024];
|
||||
char* buffer = local_buffer;
|
||||
|
||||
int buffer_size = 1024;
|
||||
int required_size = buffer_size;
|
||||
|
||||
bool using_local_buffer = true;
|
||||
|
||||
std::string out;
|
||||
char_buffer buf;
|
||||
|
||||
do
|
||||
bool status = false;
|
||||
|
||||
while(status == false)
|
||||
{
|
||||
if(using_local_buffer == false)
|
||||
{
|
||||
buffer = new char[size_t(buffer_size)];
|
||||
}
|
||||
|
||||
required_size = std::snprintf(buffer, size_t(buffer_size), X.A.A.c_str(), X.B);
|
||||
int required_size = (std::snprintf)(buf.mem, size_t(buf.n_chars), X.A.fmt.c_str(), X.B);
|
||||
|
||||
if(required_size < 0) { break; }
|
||||
|
||||
if(required_size < buffer_size)
|
||||
if(uword(required_size) >= buf.n_chars)
|
||||
{
|
||||
if(required_size > 0)
|
||||
{
|
||||
out = buffer;
|
||||
}
|
||||
if(buf.n_chars > char_buffer::n_chars_prealloc) { break; }
|
||||
|
||||
buf.set_size(1 + uword(required_size));
|
||||
}
|
||||
else
|
||||
{
|
||||
buffer_size *= 2;
|
||||
status = true;
|
||||
}
|
||||
|
||||
if(using_local_buffer)
|
||||
{
|
||||
using_local_buffer = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
delete[] buffer;
|
||||
}
|
||||
|
||||
} while( (required_size >= buffer_size) );
|
||||
if(status) { out = buf.mem; }
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
@@ -146,49 +156,30 @@ namespace arma_str
|
||||
std::string
|
||||
str(const basic_format< basic_format< format, T2>, T3>& X)
|
||||
{
|
||||
char local_buffer[1024];
|
||||
char* buffer = local_buffer;
|
||||
|
||||
int buffer_size = 1024;
|
||||
int required_size = buffer_size;
|
||||
|
||||
bool using_local_buffer = true;
|
||||
|
||||
char_buffer buf;
|
||||
std::string out;
|
||||
|
||||
do
|
||||
bool status = false;
|
||||
|
||||
while(status == false)
|
||||
{
|
||||
if(using_local_buffer == false)
|
||||
{
|
||||
buffer = new char[size_t(buffer_size)];
|
||||
}
|
||||
|
||||
required_size = std::snprintf(buffer, size_t(buffer_size), X.A.A.A.c_str(), X.A.B, X.B);
|
||||
int required_size = (std::snprintf)(buf.mem, size_t(buf.n_chars), X.A.A.fmt.c_str(), X.A.B, X.B);
|
||||
|
||||
if(required_size < 0) { break; }
|
||||
|
||||
if(required_size < buffer_size)
|
||||
if(uword(required_size) >= buf.n_chars)
|
||||
{
|
||||
if(required_size > 0)
|
||||
{
|
||||
out = buffer;
|
||||
}
|
||||
if(buf.n_chars > char_buffer::n_chars_prealloc) { break; }
|
||||
|
||||
buf.set_size(1 + uword(required_size));
|
||||
}
|
||||
else
|
||||
{
|
||||
buffer_size *= 2;
|
||||
status = true;
|
||||
}
|
||||
|
||||
if(using_local_buffer)
|
||||
{
|
||||
using_local_buffer = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
delete[] buffer;
|
||||
}
|
||||
|
||||
} while( (required_size >= buffer_size) );
|
||||
if(status) { out = buf.mem; }
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
@@ -200,49 +191,30 @@ namespace arma_str
|
||||
std::string
|
||||
str(const basic_format< basic_format< basic_format< format, T2>, T3>, T4>& X)
|
||||
{
|
||||
char local_buffer[1024];
|
||||
char* buffer = local_buffer;
|
||||
|
||||
int buffer_size = 1024;
|
||||
int required_size = buffer_size;
|
||||
|
||||
bool using_local_buffer = true;
|
||||
|
||||
char_buffer buf;
|
||||
std::string out;
|
||||
|
||||
do
|
||||
bool status = false;
|
||||
|
||||
while(status == false)
|
||||
{
|
||||
if(using_local_buffer == false)
|
||||
{
|
||||
buffer = new char[size_t(buffer_size)];
|
||||
}
|
||||
|
||||
required_size = std::snprintf(buffer, size_t(buffer_size), X.A.A.A.A.c_str(), X.A.A.B, X.A.B, X.B);
|
||||
int required_size = (std::snprintf)(buf.mem, size_t(buf.n_chars), X.A.A.A.fmt.c_str(), X.A.A.B, X.A.B, X.B);
|
||||
|
||||
if(required_size < 0) { break; }
|
||||
|
||||
if(required_size < buffer_size)
|
||||
if(uword(required_size) >= buf.n_chars)
|
||||
{
|
||||
if(required_size > 0)
|
||||
{
|
||||
out = buffer;
|
||||
}
|
||||
if(buf.n_chars > char_buffer::n_chars_prealloc) { break; }
|
||||
|
||||
buf.set_size(1 + uword(required_size));
|
||||
}
|
||||
else
|
||||
{
|
||||
buffer_size *= 2;
|
||||
status = true;
|
||||
}
|
||||
|
||||
if(using_local_buffer)
|
||||
{
|
||||
using_local_buffer = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
delete[] buffer;
|
||||
}
|
||||
|
||||
} while( (required_size >= buffer_size) );
|
||||
if(status) { out = buf.mem; }
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
@@ -254,49 +226,30 @@ namespace arma_str
|
||||
std::string
|
||||
str(const basic_format< basic_format< basic_format< basic_format< format, T2>, T3>, T4>, T5>& X)
|
||||
{
|
||||
char local_buffer[1024];
|
||||
char* buffer = local_buffer;
|
||||
|
||||
int buffer_size = 1024;
|
||||
int required_size = buffer_size;
|
||||
|
||||
bool using_local_buffer = true;
|
||||
|
||||
char_buffer buf;
|
||||
std::string out;
|
||||
|
||||
do
|
||||
bool status = false;
|
||||
|
||||
while(status == false)
|
||||
{
|
||||
if(using_local_buffer == false)
|
||||
{
|
||||
buffer = new char[size_t(buffer_size)];
|
||||
}
|
||||
|
||||
required_size = std::snprintf(buffer, size_t(buffer_size), X.A.A.A.A.A.c_str(), X.A.A.A.B, X.A.A.B, X.A.B, X.B);
|
||||
int required_size = (std::snprintf)(buf.mem, size_t(buf.n_chars), X.A.A.A.A.fmt.c_str(), X.A.A.A.B, X.A.A.B, X.A.B, X.B);
|
||||
|
||||
if(required_size < 0) { break; }
|
||||
|
||||
if(required_size < buffer_size)
|
||||
if(uword(required_size) >= buf.n_chars)
|
||||
{
|
||||
if(required_size > 0)
|
||||
{
|
||||
out = buffer;
|
||||
}
|
||||
if(buf.n_chars > char_buffer::n_chars_prealloc) { break; }
|
||||
|
||||
buf.set_size(1 + uword(required_size));
|
||||
}
|
||||
else
|
||||
{
|
||||
buffer_size *= 2;
|
||||
status = true;
|
||||
}
|
||||
|
||||
if(using_local_buffer)
|
||||
{
|
||||
using_local_buffer = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
delete[] buffer;
|
||||
}
|
||||
|
||||
} while( (required_size >= buffer_size) );
|
||||
if(status) { out = buf.mem; }
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
@@ -308,49 +261,30 @@ namespace arma_str
|
||||
std::string
|
||||
str(const basic_format< basic_format< basic_format< basic_format< basic_format< format, T2>, T3>, T4>, T5>, T6>& X)
|
||||
{
|
||||
char local_buffer[1024];
|
||||
char* buffer = local_buffer;
|
||||
|
||||
int buffer_size = 1024;
|
||||
int required_size = buffer_size;
|
||||
|
||||
bool using_local_buffer = true;
|
||||
|
||||
char_buffer buf;
|
||||
std::string out;
|
||||
|
||||
do
|
||||
bool status = false;
|
||||
|
||||
while(status == false)
|
||||
{
|
||||
if(using_local_buffer == false)
|
||||
{
|
||||
buffer = new char[size_t(buffer_size)];
|
||||
}
|
||||
|
||||
required_size = std::snprintf(buffer, size_t(buffer_size), X.A.A.A.A.A.A.c_str(), X.A.A.A.A.B, X.A.A.A.B, X.A.A.B, X.A.B, X.B);
|
||||
int required_size = (std::snprintf)(buf.mem, size_t(buf.n_chars), X.A.A.A.A.A.fmt.c_str(), X.A.A.A.A.B, X.A.A.A.B, X.A.A.B, X.A.B, X.B);
|
||||
|
||||
if(required_size < 0) { break; }
|
||||
|
||||
if(required_size < buffer_size)
|
||||
if(uword(required_size) >= buf.n_chars)
|
||||
{
|
||||
if(required_size > 0)
|
||||
{
|
||||
out = buffer;
|
||||
}
|
||||
if(buf.n_chars > char_buffer::n_chars_prealloc) { break; }
|
||||
|
||||
buf.set_size(1 + uword(required_size));
|
||||
}
|
||||
else
|
||||
{
|
||||
buffer_size *= 2;
|
||||
status = true;
|
||||
}
|
||||
|
||||
if(using_local_buffer)
|
||||
{
|
||||
using_local_buffer = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
delete[] buffer;
|
||||
}
|
||||
|
||||
} while( (required_size >= buffer_size) );
|
||||
if(status) { out = buf.mem; }
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
@@ -362,49 +296,30 @@ namespace arma_str
|
||||
std::string
|
||||
str(const basic_format< basic_format< basic_format< basic_format< basic_format< basic_format< format, T2>, T3>, T4>, T5>, T6>, T7>& X)
|
||||
{
|
||||
char local_buffer[1024];
|
||||
char* buffer = local_buffer;
|
||||
|
||||
int buffer_size = 1024;
|
||||
int required_size = buffer_size;
|
||||
|
||||
bool using_local_buffer = true;
|
||||
|
||||
char_buffer buf;
|
||||
std::string out;
|
||||
|
||||
do
|
||||
bool status = false;
|
||||
|
||||
while(status == false)
|
||||
{
|
||||
if(using_local_buffer == false)
|
||||
{
|
||||
buffer = new char[size_t(buffer_size)];
|
||||
}
|
||||
|
||||
required_size = std::snprintf(buffer, size_t(buffer_size), X.A.A.A.A.A.A.A.c_str(), X.A.A.A.A.A.B, X.A.A.A.A.B, X.A.A.A.B, X.A.A.B, X.A.B, X.B);
|
||||
int required_size = (std::snprintf)(buf.mem, size_t(buf.n_chars), X.A.A.A.A.A.A.fmt.c_str(), X.A.A.A.A.A.B, X.A.A.A.A.B, X.A.A.A.B, X.A.A.B, X.A.B, X.B);
|
||||
|
||||
if(required_size < 0) { break; }
|
||||
|
||||
if(required_size < buffer_size)
|
||||
if(uword(required_size) >= buf.n_chars)
|
||||
{
|
||||
if(required_size > 0)
|
||||
{
|
||||
out = buffer;
|
||||
}
|
||||
if(buf.n_chars > char_buffer::n_chars_prealloc) { break; }
|
||||
|
||||
buf.set_size(1 + uword(required_size));
|
||||
}
|
||||
else
|
||||
{
|
||||
buffer_size *= 2;
|
||||
status = true;
|
||||
}
|
||||
|
||||
if(using_local_buffer)
|
||||
{
|
||||
using_local_buffer = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
delete[] buffer;
|
||||
}
|
||||
|
||||
} while( (required_size >= buffer_size) );
|
||||
if(status) { out = buf.mem; }
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
@@ -21,10 +21,10 @@
|
||||
|
||||
|
||||
|
||||
#define ARMA_VERSION_MAJOR 12
|
||||
#define ARMA_VERSION_MAJOR 14
|
||||
#define ARMA_VERSION_MINOR 0
|
||||
#define ARMA_VERSION_PATCH 1
|
||||
#define ARMA_VERSION_NAME "Cortisol Profusion"
|
||||
#define ARMA_VERSION_PATCH 2
|
||||
#define ARMA_VERSION_NAME "Stochastic Parrot"
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -898,7 +898,7 @@ inline
|
||||
eT
|
||||
arrayops::accumulate(const eT* src, const uword n_elem)
|
||||
{
|
||||
#if defined(__FINITE_MATH_ONLY__) && (__FINITE_MATH_ONLY__ > 0)
|
||||
#if defined(__FAST_MATH__)
|
||||
{
|
||||
eT acc = eT(0);
|
||||
|
||||
|
||||
@@ -433,6 +433,15 @@ class auxlib
|
||||
|
||||
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
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -73,6 +83,13 @@
|
||||
#endif
|
||||
|
||||
|
||||
#if (!defined(ARMA_HAVE_CXX14))
|
||||
#if (!defined(ARMA_IGNORE_DEPRECATED_MARKER)) || defined(ARMA_DONT_IGNORE_DEPRECATED_MARKER) || defined(ARMA_DEBUG)
|
||||
#pragma message ("INFO: support for C++11 is deprecated")
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
// for compatibility with earlier versions of Armadillo
|
||||
#undef ARMA_USE_CXX11
|
||||
#define ARMA_USE_CXX11
|
||||
|
||||
@@ -114,8 +114,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)
|
||||
@@ -159,13 +161,12 @@
|
||||
#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 (ARMA_GCC_VERSION < 60100)
|
||||
#error "*** newer compiler required; need gcc 6.1 or newer ***"
|
||||
#endif
|
||||
|
||||
// #if (ARMA_GCC_VERSION < 60100)
|
||||
// #pragma message ("WARNING: support for gcc versions older than 6.1 is deprecated")
|
||||
// #endif
|
||||
// gcc 6.1 has proper C++14 support and fixes an OpenMP related bug:
|
||||
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57580
|
||||
|
||||
#define ARMA_GOOD_COMPILER
|
||||
|
||||
@@ -298,13 +299,11 @@
|
||||
#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
|
||||
|
||||
@@ -317,12 +316,15 @@
|
||||
|
||||
#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 +344,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,18 +374,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]]
|
||||
@@ -428,14 +416,16 @@
|
||||
#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
|
||||
|
||||
|
||||
@@ -475,8 +465,7 @@
|
||||
#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
|
||||
@@ -488,7 +477,7 @@
|
||||
// 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))
|
||||
#if defined(ARMA_IGNORE_DEPRECATED_MARKER) && (!defined(ARMA_DONT_IGNORE_DEPRECATED_MARKER)) && (!defined(ARMA_DEBUG))
|
||||
#undef arma_deprecated
|
||||
#define arma_deprecated
|
||||
|
||||
|
||||
@@ -139,6 +139,11 @@
|
||||
//// Note that ARMA_USE_OPENMP is automatically enabled when a compiler supporting OpenMP 3.1 is detected.
|
||||
#endif
|
||||
|
||||
#if !defined(ARMA_USE_STD_MUTEX)
|
||||
#define ARMA_USE_STD_MUTEX
|
||||
//// Comment out the above line to disable use of std::mutex
|
||||
#endif
|
||||
|
||||
#if !defined(ARMA_64BIT_WORD)
|
||||
// #define ARMA_64BIT_WORD
|
||||
//// Uncomment the above line if you require matrices/vectors capable of holding more than 4 billion elements.
|
||||
@@ -164,6 +169,14 @@
|
||||
//// of inv() and inv_sympd() within compound expressions
|
||||
#endif
|
||||
|
||||
#if !defined(ARMA_CHECK_CONFORMANCE)
|
||||
#define ARMA_CHECK_CONFORMANCE
|
||||
//// Comment out the above line to disable conformance checks for bounds and size.
|
||||
//// This is NOT RECOMMENDED.
|
||||
//// It is strongly recommended that conformance checks are enabled during development,
|
||||
//// as this greatly aids in finding mistakes in your code.
|
||||
#endif
|
||||
|
||||
#if !defined(ARMA_CHECK_NONFINITE)
|
||||
#define ARMA_CHECK_NONFINITE
|
||||
//// Comment out the above line to disable checking for nonfinite matrices
|
||||
@@ -189,20 +202,14 @@
|
||||
//// The maximum number of threads to use for OpenMP based parallelisation;
|
||||
//// it must be an integer that is at least 1.
|
||||
|
||||
// #define ARMA_NO_DEBUG
|
||||
//// Uncomment the above line to disable all run-time checks. NOT RECOMMENDED.
|
||||
//// It is strongly recommended that run-time checks are enabled during development,
|
||||
//// as this greatly aids in finding mistakes in your code.
|
||||
|
||||
// #define ARMA_EXTRA_DEBUG
|
||||
// #define ARMA_DEBUG
|
||||
//// Uncomment the above line to see the function traces of how Armadillo evaluates expressions.
|
||||
//// This is mainly useful for debugging of the library.
|
||||
|
||||
|
||||
#if defined(ARMA_EXTRA_DEBUG)
|
||||
#undef ARMA_NO_DEBUG
|
||||
#undef ARMA_WARN_LEVEL
|
||||
#define ARMA_WARN_LEVEL 3
|
||||
// for compatibility with earlier versions of Armadillo
|
||||
#undef ARMA_DEBUG
|
||||
#define ARMA_DEBUG
|
||||
#endif
|
||||
|
||||
|
||||
@@ -280,40 +287,21 @@
|
||||
#undef ARMA_USE_FORTRAN_HIDDEN_ARGS
|
||||
#endif
|
||||
|
||||
#if !defined(ARMA_DONT_USE_STD_MUTEX)
|
||||
// #define ARMA_DONT_USE_STD_MUTEX
|
||||
//// Uncomment the above line to disable use of std::mutex
|
||||
#if defined(ARMA_DONT_USE_STD_MUTEX)
|
||||
#undef ARMA_USE_STD_MUTEX
|
||||
#endif
|
||||
|
||||
// for compatibility with earlier versions of Armadillo
|
||||
#if defined(ARMA_DONT_USE_CXX11_MUTEX)
|
||||
#pragma message ("WARNING: support for ARMA_DONT_USE_CXX11_MUTEX is deprecated and will be removed;")
|
||||
#pragma message ("WARNING: use ARMA_DONT_USE_STD_MUTEX instead")
|
||||
#undef ARMA_DONT_USE_STD_MUTEX
|
||||
#define ARMA_DONT_USE_STD_MUTEX
|
||||
#undef ARMA_USE_STD_MUTEX
|
||||
#endif
|
||||
|
||||
#if defined(ARMA_DONT_USE_OPENMP)
|
||||
#undef ARMA_USE_OPENMP
|
||||
#endif
|
||||
|
||||
#if defined(ARMA_USE_WRAPPER)
|
||||
#if !defined(ARMA_USE_EXTERN_RNG)
|
||||
// #define ARMA_USE_EXTERN_RNG
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(ARMA_DONT_USE_EXTERN_RNG)
|
||||
#undef ARMA_USE_EXTERN_RNG
|
||||
#endif
|
||||
|
||||
// for compatibility with earlier versions of Armadillo
|
||||
#if defined(ARMA_DONT_USE_EXTERN_CXX11_RNG)
|
||||
#pragma message ("WARNING: support for ARMA_DONT_USE_EXTERN_CXX11_RNG is deprecated and will be removed;")
|
||||
#pragma message ("WARNING: use ARMA_DONT_USE_EXTERN_RNG instead")
|
||||
#undef ARMA_USE_EXTERN_RNG
|
||||
#endif
|
||||
|
||||
#if defined(ARMA_32BIT_WORD)
|
||||
#undef ARMA_64BIT_WORD
|
||||
#endif
|
||||
@@ -330,31 +318,41 @@
|
||||
#undef ARMA_OPTIMISE_INVEXPR
|
||||
#endif
|
||||
|
||||
#if defined(ARMA_DONT_CHECK_CONFORMANCE)
|
||||
#if defined(ARMA_CHECK_CONFORMANCE) && (ARMA_WARN_LEVEL >= 2)
|
||||
#pragma message ("WARNING: conformance checks disabled")
|
||||
#endif
|
||||
|
||||
#undef ARMA_CHECK_CONFORMANCE
|
||||
#endif
|
||||
|
||||
#if defined(ARMA_DONT_CHECK_NONFINITE)
|
||||
#undef ARMA_CHECK_NONFINITE
|
||||
#endif
|
||||
|
||||
#if defined(ARMA_DONT_PRINT_ERRORS)
|
||||
#pragma message ("INFO: support for ARMA_DONT_PRINT_ERRORS option has been removed")
|
||||
#if defined(ARMA_NO_DEBUG)
|
||||
#undef ARMA_DEBUG
|
||||
#undef ARMA_EXTRA_DEBUG
|
||||
#endif
|
||||
|
||||
#if defined(ARMA_DEBUG)
|
||||
#undef ARMA_DONT_CHECK_CONFORMANCE
|
||||
#undef ARMA_DONT_CHECK_NONFINITE
|
||||
|
||||
#if defined(ARMA_PRINT_EXCEPTIONS)
|
||||
#pragma message ("INFO: suggest to use ARMA_WARN_LEVEL and ARMA_DONT_PRINT_EXCEPTIONS options instead")
|
||||
#else
|
||||
#pragma message ("INFO: suggest to use ARMA_WARN_LEVEL option instead")
|
||||
#endif
|
||||
#undef ARMA_CHECK_CONFORMANCE
|
||||
#define ARMA_CHECK_CONFORMANCE
|
||||
|
||||
#pragma message ("INFO: see the documentation for details")
|
||||
#undef ARMA_CHECK_NONFINITE
|
||||
#define ARMA_CHECK_NONFINITE
|
||||
|
||||
#undef ARMA_WARN_LEVEL
|
||||
#define ARMA_WARN_LEVEL 3
|
||||
#endif
|
||||
|
||||
#if defined(ARMA_DONT_PRINT_EXCEPTIONS)
|
||||
#undef ARMA_PRINT_EXCEPTIONS
|
||||
#endif
|
||||
|
||||
#if !defined(ARMA_DONT_ZERO_INIT)
|
||||
// #define ARMA_DONT_ZERO_INIT
|
||||
//// Uncomment the above line to disable initialising elements to zero during construction of dense matrices and cubes
|
||||
#endif
|
||||
|
||||
#if defined(ARMA_NO_CRIPPLED_LAPACK)
|
||||
#undef ARMA_CRIPPLED_LAPACK
|
||||
#endif
|
||||
|
||||
@@ -139,6 +139,11 @@
|
||||
//// Note that ARMA_USE_OPENMP is automatically enabled when a compiler supporting OpenMP 3.1 is detected.
|
||||
#endif
|
||||
|
||||
#if !defined(ARMA_USE_STD_MUTEX)
|
||||
#define ARMA_USE_STD_MUTEX
|
||||
//// Comment out the above line to disable use of std::mutex
|
||||
#endif
|
||||
|
||||
#if !defined(ARMA_64BIT_WORD)
|
||||
// #define ARMA_64BIT_WORD
|
||||
//// Uncomment the above line if you require matrices/vectors capable of holding more than 4 billion elements.
|
||||
@@ -164,6 +169,14 @@
|
||||
//// of inv() and inv_sympd() within compound expressions
|
||||
#endif
|
||||
|
||||
#if !defined(ARMA_CHECK_CONFORMANCE)
|
||||
#define ARMA_CHECK_CONFORMANCE
|
||||
//// Comment out the above line to disable conformance checks for bounds and size.
|
||||
//// This is NOT RECOMMENDED.
|
||||
//// It is strongly recommended that conformance checks are enabled during development,
|
||||
//// as this greatly aids in finding mistakes in your code.
|
||||
#endif
|
||||
|
||||
#if !defined(ARMA_CHECK_NONFINITE)
|
||||
#define ARMA_CHECK_NONFINITE
|
||||
//// Comment out the above line to disable checking for nonfinite matrices
|
||||
@@ -189,20 +202,14 @@
|
||||
//// The maximum number of threads to use for OpenMP based parallelisation;
|
||||
//// it must be an integer that is at least 1.
|
||||
|
||||
// #define ARMA_NO_DEBUG
|
||||
//// Uncomment the above line to disable all run-time checks. NOT RECOMMENDED.
|
||||
//// It is strongly recommended that run-time checks are enabled during development,
|
||||
//// as this greatly aids in finding mistakes in your code.
|
||||
|
||||
// #define ARMA_EXTRA_DEBUG
|
||||
// #define ARMA_DEBUG
|
||||
//// Uncomment the above line to see the function traces of how Armadillo evaluates expressions.
|
||||
//// This is mainly useful for debugging of the library.
|
||||
|
||||
|
||||
#if defined(ARMA_EXTRA_DEBUG)
|
||||
#undef ARMA_NO_DEBUG
|
||||
#undef ARMA_WARN_LEVEL
|
||||
#define ARMA_WARN_LEVEL 3
|
||||
// for compatibility with earlier versions of Armadillo
|
||||
#undef ARMA_DEBUG
|
||||
#define ARMA_DEBUG
|
||||
#endif
|
||||
|
||||
|
||||
@@ -280,40 +287,21 @@
|
||||
#undef ARMA_USE_FORTRAN_HIDDEN_ARGS
|
||||
#endif
|
||||
|
||||
#if !defined(ARMA_DONT_USE_STD_MUTEX)
|
||||
// #define ARMA_DONT_USE_STD_MUTEX
|
||||
//// Uncomment the above line to disable use of std::mutex
|
||||
#if defined(ARMA_DONT_USE_STD_MUTEX)
|
||||
#undef ARMA_USE_STD_MUTEX
|
||||
#endif
|
||||
|
||||
// for compatibility with earlier versions of Armadillo
|
||||
#if defined(ARMA_DONT_USE_CXX11_MUTEX)
|
||||
#pragma message ("WARNING: support for ARMA_DONT_USE_CXX11_MUTEX is deprecated and will be removed;")
|
||||
#pragma message ("WARNING: use ARMA_DONT_USE_STD_MUTEX instead")
|
||||
#undef ARMA_DONT_USE_STD_MUTEX
|
||||
#define ARMA_DONT_USE_STD_MUTEX
|
||||
#undef ARMA_USE_STD_MUTEX
|
||||
#endif
|
||||
|
||||
#if defined(ARMA_DONT_USE_OPENMP)
|
||||
#undef ARMA_USE_OPENMP
|
||||
#endif
|
||||
|
||||
#if defined(ARMA_USE_WRAPPER)
|
||||
#if !defined(ARMA_USE_EXTERN_RNG)
|
||||
#cmakedefine ARMA_USE_EXTERN_RNG
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(ARMA_DONT_USE_EXTERN_RNG)
|
||||
#undef ARMA_USE_EXTERN_RNG
|
||||
#endif
|
||||
|
||||
// for compatibility with earlier versions of Armadillo
|
||||
#if defined(ARMA_DONT_USE_EXTERN_CXX11_RNG)
|
||||
#pragma message ("WARNING: support for ARMA_DONT_USE_EXTERN_CXX11_RNG is deprecated and will be removed;")
|
||||
#pragma message ("WARNING: use ARMA_DONT_USE_EXTERN_RNG instead")
|
||||
#undef ARMA_USE_EXTERN_RNG
|
||||
#endif
|
||||
|
||||
#if defined(ARMA_32BIT_WORD)
|
||||
#undef ARMA_64BIT_WORD
|
||||
#endif
|
||||
@@ -330,31 +318,41 @@
|
||||
#undef ARMA_OPTIMISE_INVEXPR
|
||||
#endif
|
||||
|
||||
#if defined(ARMA_DONT_CHECK_CONFORMANCE)
|
||||
#if defined(ARMA_CHECK_CONFORMANCE) && (ARMA_WARN_LEVEL >= 2)
|
||||
#pragma message ("WARNING: conformance checks disabled")
|
||||
#endif
|
||||
|
||||
#undef ARMA_CHECK_CONFORMANCE
|
||||
#endif
|
||||
|
||||
#if defined(ARMA_DONT_CHECK_NONFINITE)
|
||||
#undef ARMA_CHECK_NONFINITE
|
||||
#endif
|
||||
|
||||
#if defined(ARMA_DONT_PRINT_ERRORS)
|
||||
#pragma message ("INFO: support for ARMA_DONT_PRINT_ERRORS option has been removed")
|
||||
#if defined(ARMA_NO_DEBUG)
|
||||
#undef ARMA_DEBUG
|
||||
#undef ARMA_EXTRA_DEBUG
|
||||
#endif
|
||||
|
||||
#if defined(ARMA_DEBUG)
|
||||
#undef ARMA_DONT_CHECK_CONFORMANCE
|
||||
#undef ARMA_DONT_CHECK_NONFINITE
|
||||
|
||||
#if defined(ARMA_PRINT_EXCEPTIONS)
|
||||
#pragma message ("INFO: suggest to use ARMA_WARN_LEVEL and ARMA_DONT_PRINT_EXCEPTIONS options instead")
|
||||
#else
|
||||
#pragma message ("INFO: suggest to use ARMA_WARN_LEVEL option instead")
|
||||
#endif
|
||||
#undef ARMA_CHECK_CONFORMANCE
|
||||
#define ARMA_CHECK_CONFORMANCE
|
||||
|
||||
#pragma message ("INFO: see the documentation for details")
|
||||
#undef ARMA_CHECK_NONFINITE
|
||||
#define ARMA_CHECK_NONFINITE
|
||||
|
||||
#undef ARMA_WARN_LEVEL
|
||||
#define ARMA_WARN_LEVEL 3
|
||||
#endif
|
||||
|
||||
#if defined(ARMA_DONT_PRINT_EXCEPTIONS)
|
||||
#undef ARMA_PRINT_EXCEPTIONS
|
||||
#endif
|
||||
|
||||
#if !defined(ARMA_DONT_ZERO_INIT)
|
||||
// #define ARMA_DONT_ZERO_INIT
|
||||
//// Uncomment the above line to disable initialising elements to zero during construction of dense matrices and cubes
|
||||
#endif
|
||||
|
||||
#if defined(ARMA_NO_CRIPPLED_LAPACK)
|
||||
#undef ARMA_CRIPPLED_LAPACK
|
||||
#endif
|
||||
|
||||
@@ -176,22 +176,22 @@ template<typename eT> const eT Datum<eT>::log_max = std::log(std::numeric_li
|
||||
template<typename eT> const eT Datum<eT>::nan = priv::Datum_helper::nan<eT>();
|
||||
template<typename eT> const eT Datum<eT>::inf = priv::Datum_helper::inf<eT>();
|
||||
|
||||
template<typename eT> const eT Datum<eT>::m_u = eT(1.66053906660e-27);
|
||||
template<typename eT> const eT Datum<eT>::m_u = eT(1.66053906892e-27);
|
||||
template<typename eT> const eT Datum<eT>::N_A = eT(6.02214076e23);
|
||||
template<typename eT> const eT Datum<eT>::k = eT(1.380649e-23);
|
||||
template<typename eT> const eT Datum<eT>::k_evk = eT(8.617333262e-5);
|
||||
template<typename eT> const eT Datum<eT>::a_0 = eT(5.29177210903e-11);
|
||||
template<typename eT> const eT Datum<eT>::mu_B = eT(9.2740100783e-24);
|
||||
template<typename eT> const eT Datum<eT>::Z_0 = eT(376.730313668);
|
||||
template<typename eT> const eT Datum<eT>::a_0 = eT(5.29177210544e-11);
|
||||
template<typename eT> const eT Datum<eT>::mu_B = eT(9.2740100657e-24);
|
||||
template<typename eT> const eT Datum<eT>::Z_0 = eT(376.730313412);
|
||||
template<typename eT> const eT Datum<eT>::G_0 = eT(7.748091729e-5);
|
||||
template<typename eT> const eT Datum<eT>::k_e = eT(8.9875517923e9);
|
||||
template<typename eT> const eT Datum<eT>::eps_0 = eT(8.8541878128e-12);
|
||||
template<typename eT> const eT Datum<eT>::m_e = eT(9.1093837015e-31);
|
||||
template<typename eT> const eT Datum<eT>::m_e = eT(9.1093837139e-31);
|
||||
template<typename eT> const eT Datum<eT>::eV = eT(1.602176634e-19);
|
||||
template<typename eT> const eT Datum<eT>::ec = eT(1.602176634e-19);
|
||||
template<typename eT> const eT Datum<eT>::F = eT(96485.33212);
|
||||
template<typename eT> const eT Datum<eT>::alpha = eT(7.2973525693e-3);
|
||||
template<typename eT> const eT Datum<eT>::alpha_inv = eT(137.035999084);
|
||||
template<typename eT> const eT Datum<eT>::alpha = eT(7.2973525643e-3);
|
||||
template<typename eT> const eT Datum<eT>::alpha_inv = eT(137.035999177);
|
||||
template<typename eT> const eT Datum<eT>::K_J = eT(483597.8484e9);
|
||||
template<typename eT> const eT Datum<eT>::mu_0 = eT(1.25663706212e-6);
|
||||
template<typename eT> const eT Datum<eT>::phi_0 = eT(2.067833848e-15);
|
||||
@@ -199,8 +199,8 @@ template<typename eT> const eT Datum<eT>::R = eT(8.314462618);
|
||||
template<typename eT> const eT Datum<eT>::G = eT(6.67430e-11);
|
||||
template<typename eT> const eT Datum<eT>::h = eT(6.62607015e-34);
|
||||
template<typename eT> const eT Datum<eT>::h_bar = eT(1.054571817e-34);
|
||||
template<typename eT> const eT Datum<eT>::m_p = eT(1.67262192369e-27);
|
||||
template<typename eT> const eT Datum<eT>::R_inf = eT(10973731.568160);
|
||||
template<typename eT> const eT Datum<eT>::m_p = eT(1.67262192595e-27);
|
||||
template<typename eT> const eT Datum<eT>::R_inf = eT(10973731.568157);
|
||||
template<typename eT> const eT Datum<eT>::c_0 = eT(299792458.0);
|
||||
template<typename eT> const eT Datum<eT>::sigma = eT(5.670374419e-8);
|
||||
template<typename eT> const eT Datum<eT>::R_k = eT(25812.80745);
|
||||
|
||||
@@ -147,7 +147,7 @@ arma_stop_logic_error(const char* x, const char* y)
|
||||
|
||||
|
||||
|
||||
//! print a message to get_cerr_stream() and throw logic_error exception
|
||||
//! print a message to get_cerr_stream() and throw out_of_range exception
|
||||
template<typename T1>
|
||||
arma_cold
|
||||
arma_noinline
|
||||
@@ -263,10 +263,9 @@ arma_print(const T1& x, const T2& y, const T3& z)
|
||||
//
|
||||
// arma_sigprint
|
||||
|
||||
//! print a message to the log stream with a preceding @ character.
|
||||
//! by default the log stream is cout.
|
||||
//! print a message to the cerr stream with a preceding @ character.
|
||||
//! used for printing the signature of a function
|
||||
//! (see the arma_extra_debug_sigprint macro)
|
||||
//! (see the arma_debug_sigprint macro)
|
||||
inline
|
||||
void
|
||||
arma_sigprint(const char* x)
|
||||
@@ -318,13 +317,13 @@ inline
|
||||
void
|
||||
arma_thisprint(const void* this_ptr)
|
||||
{
|
||||
get_cerr_stream() << " [this = " << this_ptr << ']' << std::endl;
|
||||
get_cerr_stream() << " [this: " << this_ptr << ']' << std::endl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// arma_warn
|
||||
// arma_plain_warn
|
||||
|
||||
|
||||
//! print a message to the warn stream
|
||||
@@ -333,7 +332,7 @@ arma_cold
|
||||
arma_noinline
|
||||
static
|
||||
void
|
||||
arma_warn(const T1& arg1)
|
||||
arma_plain_warn(const T1& arg1)
|
||||
{
|
||||
get_cerr_stream() << "\nwarning: " << arg1 << std::endl;
|
||||
}
|
||||
@@ -344,7 +343,7 @@ arma_cold
|
||||
arma_noinline
|
||||
static
|
||||
void
|
||||
arma_warn(const T1& arg1, const T2& arg2)
|
||||
arma_plain_warn(const T1& arg1, const T2& arg2)
|
||||
{
|
||||
get_cerr_stream() << "\nwarning: " << arg1 << arg2 << std::endl;
|
||||
}
|
||||
@@ -355,7 +354,7 @@ arma_cold
|
||||
arma_noinline
|
||||
static
|
||||
void
|
||||
arma_warn(const T1& arg1, const T2& arg2, const T3& arg3)
|
||||
arma_plain_warn(const T1& arg1, const T2& arg2, const T3& arg3)
|
||||
{
|
||||
get_cerr_stream() << "\nwarning: " << arg1 << arg2 << arg3 << std::endl;
|
||||
}
|
||||
@@ -366,7 +365,7 @@ arma_cold
|
||||
arma_noinline
|
||||
static
|
||||
void
|
||||
arma_warn(const T1& arg1, const T2& arg2, const T3& arg3, const T4& arg4)
|
||||
arma_plain_warn(const T1& arg1, const T2& arg2, const T3& arg3, const T4& arg4)
|
||||
{
|
||||
get_cerr_stream() << "\nwarning: " << arg1 << arg2 << arg3 << arg4 << std::endl;
|
||||
}
|
||||
@@ -374,50 +373,50 @@ arma_warn(const T1& arg1, const T2& arg2, const T3& arg3, const T4& arg4)
|
||||
|
||||
|
||||
//
|
||||
// arma_warn_level
|
||||
// arma_warn
|
||||
|
||||
|
||||
template<typename T1>
|
||||
inline
|
||||
void
|
||||
arma_warn_level(const uword level, const T1& arg1)
|
||||
arma_warn(const uword level, const T1& arg1)
|
||||
{
|
||||
constexpr uword config_level = (sword(ARMA_WARN_LEVEL) > 0) ? uword(ARMA_WARN_LEVEL) : uword(0);
|
||||
|
||||
if((config_level > 0) && (level <= config_level)) { arma_warn(arg1); }
|
||||
if((config_level > 0) && (level <= config_level)) { arma_plain_warn(arg1); }
|
||||
}
|
||||
|
||||
|
||||
template<typename T1, typename T2>
|
||||
inline
|
||||
void
|
||||
arma_warn_level(const uword level, const T1& arg1, const T2& arg2)
|
||||
arma_warn(const uword level, const T1& arg1, const T2& arg2)
|
||||
{
|
||||
constexpr uword config_level = (sword(ARMA_WARN_LEVEL) > 0) ? uword(ARMA_WARN_LEVEL) : uword(0);
|
||||
|
||||
if((config_level > 0) && (level <= config_level)) { arma_warn(arg1,arg2); }
|
||||
if((config_level > 0) && (level <= config_level)) { arma_plain_warn(arg1,arg2); }
|
||||
}
|
||||
|
||||
|
||||
template<typename T1, typename T2, typename T3>
|
||||
inline
|
||||
void
|
||||
arma_warn_level(const uword level, const T1& arg1, const T2& arg2, const T3& arg3)
|
||||
arma_warn(const uword level, const T1& arg1, const T2& arg2, const T3& arg3)
|
||||
{
|
||||
constexpr uword config_level = (sword(ARMA_WARN_LEVEL) > 0) ? uword(ARMA_WARN_LEVEL) : uword(0);
|
||||
|
||||
if((config_level > 0) && (level <= config_level)) { arma_warn(arg1,arg2,arg3); }
|
||||
if((config_level > 0) && (level <= config_level)) { arma_plain_warn(arg1,arg2,arg3); }
|
||||
}
|
||||
|
||||
|
||||
template<typename T1, typename T2, typename T3, typename T4>
|
||||
inline
|
||||
void
|
||||
arma_warn_level(const uword level, const T1& arg1, const T2& arg2, const T3& arg3, const T4& arg4)
|
||||
arma_warn(const uword level, const T1& arg1, const T2& arg2, const T3& arg3, const T4& arg4)
|
||||
{
|
||||
constexpr uword config_level = (sword(ARMA_WARN_LEVEL) > 0) ? uword(ARMA_WARN_LEVEL) : uword(0);
|
||||
|
||||
if((config_level > 0) && (level <= config_level)) { arma_warn(arg1,arg2,arg3,arg4); }
|
||||
if((config_level > 0) && (level <= config_level)) { arma_plain_warn(arg1,arg2,arg3,arg4); }
|
||||
}
|
||||
|
||||
|
||||
@@ -580,7 +579,7 @@ arma_assert_same_size(const uword A_n_rows, const uword A_n_cols, const uword B_
|
||||
|
||||
|
||||
|
||||
//! stop if given matrices have different sizes
|
||||
//! stop if given matrices do not have the same size
|
||||
template<typename eT1, typename eT2>
|
||||
arma_hot
|
||||
inline
|
||||
@@ -601,7 +600,7 @@ arma_assert_same_size(const Mat<eT1>& A, const Mat<eT2>& B, const char* x)
|
||||
|
||||
|
||||
|
||||
//! stop if given proxies have different sizes
|
||||
//! stop if given proxies do not have the same size
|
||||
template<typename eT1, typename eT2>
|
||||
arma_hot
|
||||
inline
|
||||
@@ -805,7 +804,7 @@ arma_assert_same_size(const uword A_n_rows, const uword A_n_cols, const uword A_
|
||||
|
||||
|
||||
|
||||
//! stop if given cubes have different sizes
|
||||
//! stop if given cubes do not have the same size
|
||||
template<typename eT1, typename eT2>
|
||||
arma_hot
|
||||
inline
|
||||
@@ -884,7 +883,7 @@ arma_assert_same_size(const subview_cube<eT>& A, const ProxyCube<T1>& B, const c
|
||||
|
||||
|
||||
|
||||
//! stop if given cube proxies have different sizes
|
||||
//! stop if given cube proxies do not have the same size
|
||||
template<typename eT1, typename eT2>
|
||||
arma_hot
|
||||
inline
|
||||
@@ -1340,48 +1339,52 @@ arma_assert_atlas_size(const T1& A, const T2& B)
|
||||
// #define ARMA_FILELINE __FILE__ ": " ARMA_STRING2(__LINE__)
|
||||
|
||||
|
||||
#if defined(ARMA_NO_DEBUG)
|
||||
#if defined(ARMA_CHECK_CONFORMANCE)
|
||||
|
||||
#define arma_debug_print true ? (void)0 : arma_print
|
||||
#define arma_debug_warn true ? (void)0 : arma_warn
|
||||
#define arma_debug_warn_level true ? (void)0 : arma_warn_level
|
||||
#define arma_debug_check true ? (void)0 : arma_check
|
||||
#define arma_debug_check_bounds true ? (void)0 : arma_check_bounds
|
||||
#define arma_debug_set_error true ? (void)0 : arma_set_error
|
||||
#define arma_debug_assert_same_size true ? (void)0 : arma_assert_same_size
|
||||
#define arma_debug_assert_mul_size true ? (void)0 : arma_assert_mul_size
|
||||
#define arma_debug_assert_trans_mul_size true ? (void)0 : arma_assert_trans_mul_size
|
||||
#define arma_debug_assert_cube_as_mat true ? (void)0 : arma_assert_cube_as_mat
|
||||
#define arma_debug_assert_blas_size true ? (void)0 : arma_assert_blas_size
|
||||
#define arma_debug_assert_atlas_size true ? (void)0 : arma_assert_atlas_size
|
||||
#define arma_conform_check arma_check
|
||||
#define arma_conform_check_bounds arma_check_bounds
|
||||
#define arma_conform_set_error arma_set_error
|
||||
#define arma_conform_assert_same_size arma_assert_same_size
|
||||
#define arma_conform_assert_mul_size arma_assert_mul_size
|
||||
#define arma_conform_assert_trans_mul_size arma_assert_trans_mul_size
|
||||
#define arma_conform_assert_cube_as_mat arma_assert_cube_as_mat
|
||||
#define arma_conform_assert_blas_size arma_assert_blas_size
|
||||
#define arma_conform_assert_atlas_size arma_assert_atlas_size
|
||||
|
||||
#else
|
||||
|
||||
#define arma_debug_print arma_print
|
||||
#define arma_debug_warn arma_warn
|
||||
#define arma_debug_warn_level arma_warn_level
|
||||
#define arma_debug_check arma_check
|
||||
#define arma_debug_check_bounds arma_check_bounds
|
||||
#define arma_debug_set_error arma_set_error
|
||||
#define arma_debug_assert_same_size arma_assert_same_size
|
||||
#define arma_debug_assert_mul_size arma_assert_mul_size
|
||||
#define arma_debug_assert_trans_mul_size arma_assert_trans_mul_size
|
||||
#define arma_debug_assert_cube_as_mat arma_assert_cube_as_mat
|
||||
#define arma_debug_assert_blas_size arma_assert_blas_size
|
||||
#define arma_debug_assert_atlas_size arma_assert_atlas_size
|
||||
#define arma_conform_check true ? (void)0 : arma_check
|
||||
#define arma_conform_check_bounds true ? (void)0 : arma_check_bounds
|
||||
#define arma_conform_set_error true ? (void)0 : arma_set_error
|
||||
#define arma_conform_assert_same_size true ? (void)0 : arma_assert_same_size
|
||||
#define arma_conform_assert_mul_size true ? (void)0 : arma_assert_mul_size
|
||||
#define arma_conform_assert_trans_mul_size true ? (void)0 : arma_assert_trans_mul_size
|
||||
#define arma_conform_assert_cube_as_mat true ? (void)0 : arma_assert_cube_as_mat
|
||||
#define arma_conform_assert_blas_size true ? (void)0 : arma_assert_blas_size
|
||||
#define arma_conform_assert_atlas_size true ? (void)0 : arma_assert_atlas_size
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#if defined(ARMA_EXTRA_DEBUG)
|
||||
#if defined(ARMA_DEBUG)
|
||||
|
||||
#define arma_debug_sigprint arma_sigprint(ARMA_FNSIG); arma_bktprint
|
||||
#define arma_debug_sigprint_this arma_sigprint(ARMA_FNSIG); arma_thisprint
|
||||
#define arma_debug_print arma_print
|
||||
|
||||
// for compatibility with earlier versions of Armadillo
|
||||
#define arma_extra_debug_sigprint arma_sigprint(ARMA_FNSIG); arma_bktprint
|
||||
#define arma_extra_debug_sigprint_this arma_sigprint(ARMA_FNSIG); arma_thisprint
|
||||
#define arma_extra_debug_print arma_print
|
||||
|
||||
#else
|
||||
|
||||
#define arma_debug_sigprint true ? (void)0 : arma_bktprint
|
||||
#define arma_debug_sigprint_this true ? (void)0 : arma_thisprint
|
||||
#define arma_debug_print true ? (void)0 : arma_print
|
||||
|
||||
// for compatibility with earlier versions of Armadillo
|
||||
#define arma_extra_debug_sigprint true ? (void)0 : arma_bktprint
|
||||
#define arma_extra_debug_sigprint_this true ? (void)0 : arma_thisprint
|
||||
#define arma_extra_debug_print true ? (void)0 : arma_print
|
||||
@@ -1389,74 +1392,68 @@ arma_assert_atlas_size(const T1& A, const T2& B)
|
||||
#endif
|
||||
|
||||
|
||||
// for compatibility with earlier versions of Armadillo
|
||||
arma_frown("use arma_conform_check() instead")
|
||||
inline void arma_debug_check(bool state, const char* msg) { arma_conform_check(state, msg); }
|
||||
|
||||
|
||||
#if defined(ARMA_EXTRA_DEBUG)
|
||||
#if defined(ARMA_DEBUG)
|
||||
|
||||
namespace junk
|
||||
{
|
||||
class arma_first_extra_debug_message
|
||||
class arma_first_debug_message
|
||||
{
|
||||
public:
|
||||
|
||||
inline
|
||||
arma_first_extra_debug_message()
|
||||
arma_first_debug_message()
|
||||
{
|
||||
union
|
||||
{
|
||||
unsigned short a;
|
||||
unsigned char b[sizeof(unsigned short)];
|
||||
} endian_test;
|
||||
|
||||
endian_test.a = 1;
|
||||
|
||||
const bool little_endian = (endian_test.b[0] == 1);
|
||||
const char* nickname = ARMA_VERSION_NAME;
|
||||
const char* nickname = ARMA_VERSION_NAME;
|
||||
|
||||
std::ostream& out = get_cerr_stream();
|
||||
|
||||
out << "@ ---" << '\n';
|
||||
out << "@ Armadillo "
|
||||
<< arma_version::major << '.' << arma_version::minor << '.' << arma_version::patch
|
||||
<< " (" << nickname << ")\n";
|
||||
<< " (" << nickname << ')';
|
||||
|
||||
out << "@ arma_config::wrapper = " << arma_config::wrapper << '\n';
|
||||
out << "@ arma_config::cxx14 = " << arma_config::cxx14 << '\n';
|
||||
out << "@ arma_config::cxx17 = " << arma_config::cxx17 << '\n';
|
||||
out << "@ arma_config::cxx20 = " << arma_config::cxx20 << '\n';
|
||||
out << "@ arma_config::std_mutex = " << arma_config::std_mutex << '\n';
|
||||
out << "@ arma_config::posix = " << arma_config::posix << '\n';
|
||||
out << "@ arma_config::openmp = " << arma_config::openmp << '\n';
|
||||
out << "@ arma_config::lapack = " << arma_config::lapack << '\n';
|
||||
out << "@ arma_config::blas = " << arma_config::blas << '\n';
|
||||
out << "@ arma_config::newarp = " << arma_config::newarp << '\n';
|
||||
out << "@ arma_config::arpack = " << arma_config::arpack << '\n';
|
||||
out << "@ arma_config::superlu = " << arma_config::superlu << '\n';
|
||||
out << "@ arma_config::atlas = " << arma_config::atlas << '\n';
|
||||
out << "@ arma_config::hdf5 = " << arma_config::hdf5 << '\n';
|
||||
out << "@ arma_config::good_comp = " << arma_config::good_comp << '\n';
|
||||
out << "@ arma_config::extra_code = " << arma_config::extra_code << '\n';
|
||||
out << "@ arma_config::hidden_args = " << arma_config::hidden_args << '\n';
|
||||
out << "@ arma_config::mat_prealloc = " << arma_config::mat_prealloc << '\n';
|
||||
out << "@ arma_config::mp_threshold = " << arma_config::mp_threshold << '\n';
|
||||
out << "@ arma_config::mp_threads = " << arma_config::mp_threads << '\n';
|
||||
out << "@ arma_config::optimise_band = " << arma_config::optimise_band << '\n';
|
||||
out << "@ arma_config::optimise_sym = " << arma_config::optimise_sym << '\n';
|
||||
out << "@ arma_config::optimise_invexpr = " << arma_config::optimise_invexpr << '\n';
|
||||
out << "@ arma_config::check_nonfinite = " << arma_config::check_nonfinite << '\n';
|
||||
out << "@ arma_config::zero_init = " << arma_config::zero_init << '\n';
|
||||
out << "@ sizeof(void*) = " << sizeof(void*) << '\n';
|
||||
out << "@ sizeof(int) = " << sizeof(int) << '\n';
|
||||
out << "@ sizeof(long) = " << sizeof(long) << '\n';
|
||||
out << "@ sizeof(uword) = " << sizeof(uword) << '\n';
|
||||
out << "@ sizeof(blas_int) = " << sizeof(blas_int) << '\n';
|
||||
out << "@ little_endian = " << little_endian << '\n';
|
||||
out << "@ ---" << std::endl;
|
||||
out << "\n@ arma_config::wrapper = " << arma_config::wrapper;
|
||||
out << "\n@ arma_config::cxx14 = " << arma_config::cxx14;
|
||||
out << "\n@ arma_config::cxx17 = " << arma_config::cxx17;
|
||||
out << "\n@ arma_config::cxx20 = " << arma_config::cxx20;
|
||||
out << "\n@ arma_config::cxx23 = " << arma_config::cxx23;
|
||||
out << "\n@ arma_config::std_mutex = " << arma_config::std_mutex;
|
||||
out << "\n@ arma_config::posix = " << arma_config::posix;
|
||||
out << "\n@ arma_config::openmp = " << arma_config::openmp;
|
||||
out << "\n@ arma_config::lapack = " << arma_config::lapack;
|
||||
out << "\n@ arma_config::blas = " << arma_config::blas;
|
||||
out << "\n@ arma_config::newarp = " << arma_config::newarp;
|
||||
out << "\n@ arma_config::arpack = " << arma_config::arpack;
|
||||
out << "\n@ arma_config::superlu = " << arma_config::superlu;
|
||||
out << "\n@ arma_config::atlas = " << arma_config::atlas;
|
||||
out << "\n@ arma_config::hdf5 = " << arma_config::hdf5;
|
||||
out << "\n@ arma_config::good_comp = " << arma_config::good_comp;
|
||||
out << "\n@ arma_config::extra_code = " << arma_config::extra_code;
|
||||
out << "\n@ arma_config::hidden_args = " << arma_config::hidden_args;
|
||||
out << "\n@ arma_config::mat_prealloc = " << arma_config::mat_prealloc;
|
||||
out << "\n@ arma_config::mp_threshold = " << arma_config::mp_threshold;
|
||||
out << "\n@ arma_config::mp_threads = " << arma_config::mp_threads;
|
||||
out << "\n@ arma_config::optimise_band = " << arma_config::optimise_band;
|
||||
out << "\n@ arma_config::optimise_sym = " << arma_config::optimise_sym;
|
||||
out << "\n@ arma_config::optimise_invexpr = " << arma_config::optimise_invexpr;
|
||||
out << "\n@ arma_config::check_conform = " << arma_config::check_conform;
|
||||
out << "\n@ arma_config::check_nonfinite = " << arma_config::check_nonfinite;
|
||||
out << "\n@ arma_config::fast_math = " << arma_config::fast_math;
|
||||
out << "\n@ sizeof(void*) = " << sizeof(void*);
|
||||
out << "\n@ sizeof(int) = " << sizeof(int);
|
||||
out << "\n@ sizeof(long) = " << sizeof(long);
|
||||
out << "\n@ sizeof(uword) = " << sizeof(uword);
|
||||
out << "\n@ sizeof(blas_int) = " << sizeof(blas_int);
|
||||
out << "\n@ ---" << std::endl;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
static arma_first_extra_debug_message arma_first_extra_debug_message_run;
|
||||
static arma_first_debug_message arma_first_debug_message_run;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -16,31 +16,38 @@
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
|
||||
#if defined(ARMA_USE_FFTW3)
|
||||
#if defined(ARMA_USE_FFTW3) && !defined(FFTW3_H)
|
||||
|
||||
|
||||
// prefix for single precision: fftwf_
|
||||
// prefix for double precision: fftw_
|
||||
|
||||
|
||||
typedef void fftwf_complex;
|
||||
typedef void fftw_complex;
|
||||
|
||||
typedef void_ptr fftwf_plan;
|
||||
typedef void_ptr fftw_plan;
|
||||
|
||||
|
||||
extern "C"
|
||||
{
|
||||
// function prefix for single precision: fftwf_
|
||||
// function prefix for double precision: fftw_
|
||||
|
||||
|
||||
// single precision (float)
|
||||
|
||||
void_ptr fftwf_plan_dft_1d(int N, void* input, void* output, int fftw3_sign, unsigned int fftw3_flags);
|
||||
fftwf_plan fftwf_plan_dft_1d(int N, fftwf_complex* input, fftwf_complex* output, int fftw3_sign, unsigned int fftw3_flags);
|
||||
|
||||
void fftwf_execute(void_ptr plan);
|
||||
void fftwf_destroy_plan(void_ptr plan);
|
||||
void fftwf_execute(fftwf_plan plan);
|
||||
void fftwf_destroy_plan(fftwf_plan plan);
|
||||
|
||||
void fftwf_cleanup();
|
||||
|
||||
|
||||
// double precision (double)
|
||||
|
||||
void_ptr fftw_plan_dft_1d(int N, void* input, void* output, int fftw3_sign, unsigned int fftw3_flags);
|
||||
fftw_plan fftw_plan_dft_1d(int N, fftw_complex* input, fftw_complex* output, int fftw3_sign, unsigned int fftw3_flags);
|
||||
|
||||
void fftw_execute(void_ptr plan);
|
||||
void fftw_destroy_plan(void_ptr plan);
|
||||
void fftw_execute(fftw_plan plan);
|
||||
void fftw_destroy_plan(fftw_plan plan);
|
||||
|
||||
void fftw_cleanup();
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ class diagmat_proxy_default
|
||||
, n_rows ( P_is_vec ? P.get_n_elem() : P.get_n_rows() )
|
||||
, n_cols ( P_is_vec ? P.get_n_elem() : P.get_n_cols() )
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
}
|
||||
|
||||
|
||||
@@ -115,7 +115,7 @@ class diagmat_proxy_fixed
|
||||
diagmat_proxy_fixed(const T1& X)
|
||||
: P(X)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
}
|
||||
|
||||
|
||||
@@ -195,7 +195,7 @@ class diagmat_proxy< Mat<eT> >
|
||||
, n_rows ( P_is_vec ? X.n_elem : X.n_rows )
|
||||
, n_cols ( P_is_vec ? X.n_elem : X.n_cols )
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
}
|
||||
|
||||
arma_inline elem_type operator[] (const uword i) const { return P_is_vec ? P[i] : P.at(i,i); }
|
||||
@@ -226,7 +226,7 @@ class diagmat_proxy< Row<eT> >
|
||||
, n_rows(X.n_elem)
|
||||
, n_cols(X.n_elem)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
}
|
||||
|
||||
arma_inline elem_type operator[] (const uword i) const { return P[i]; }
|
||||
@@ -258,7 +258,7 @@ class diagmat_proxy< Col<eT> >
|
||||
, n_rows(X.n_elem)
|
||||
, n_cols(X.n_elem)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
}
|
||||
|
||||
arma_inline elem_type operator[] (const uword i) const { return P[i]; }
|
||||
@@ -290,7 +290,7 @@ class diagmat_proxy< subview_row<eT> >
|
||||
, n_rows(X.n_elem)
|
||||
, n_cols(X.n_elem)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
}
|
||||
|
||||
arma_inline elem_type operator[] (const uword i) const { return P[i]; }
|
||||
@@ -322,7 +322,7 @@ class diagmat_proxy< subview_col<eT> >
|
||||
, n_rows(X.n_elem)
|
||||
, n_cols(X.n_elem)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
}
|
||||
|
||||
arma_inline elem_type operator[] (const uword i) const { return P[i]; }
|
||||
@@ -355,7 +355,7 @@ class diagmat_proxy< Glue<T1,T2,glue_times> >
|
||||
n_rows = P.n_rows;
|
||||
n_cols = P.n_cols;
|
||||
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
}
|
||||
|
||||
arma_inline elem_type operator[] (const uword i) const { return P.at(i,i); }
|
||||
|
||||
@@ -24,7 +24,7 @@ template<typename eT>
|
||||
inline
|
||||
diagview<eT>::~diagview()
|
||||
{
|
||||
arma_extra_debug_sigprint_this(this);
|
||||
arma_debug_sigprint_this(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ diagview<eT>::diagview(const Mat<eT>& in_m, const uword in_row_offset, const uwo
|
||||
, n_rows (in_len )
|
||||
, n_elem (in_len )
|
||||
{
|
||||
arma_extra_debug_sigprint_this(this);
|
||||
arma_debug_sigprint_this(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ diagview<eT>::diagview(const diagview<eT>& in)
|
||||
, n_rows (in.n_rows )
|
||||
, n_elem (in.n_elem )
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ diagview<eT>::diagview(diagview<eT>&& in)
|
||||
, n_rows (in.n_rows )
|
||||
, n_elem (in.n_elem )
|
||||
{
|
||||
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
|
||||
|
||||
@@ -84,11 +84,11 @@ inline
|
||||
void
|
||||
diagview<eT>::operator= (const diagview<eT>& x)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
diagview<eT>& d = *this;
|
||||
|
||||
arma_debug_check( (d.n_elem != x.n_elem), "diagview: diagonals have incompatible lengths" );
|
||||
arma_conform_check( (d.n_elem != x.n_elem), "diagview: diagonals have incompatible lengths" );
|
||||
|
||||
Mat<eT>& d_m = const_cast< Mat<eT>& >(d.m);
|
||||
const Mat<eT>& x_m = x.m;
|
||||
@@ -132,7 +132,7 @@ inline
|
||||
void
|
||||
diagview<eT>::operator+=(const eT val)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
Mat<eT>& t_m = const_cast< Mat<eT>& >(m);
|
||||
|
||||
@@ -153,7 +153,7 @@ inline
|
||||
void
|
||||
diagview<eT>::operator-=(const eT val)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
Mat<eT>& t_m = const_cast< Mat<eT>& >(m);
|
||||
|
||||
@@ -174,7 +174,7 @@ inline
|
||||
void
|
||||
diagview<eT>::operator*=(const eT val)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
Mat<eT>& t_m = const_cast< Mat<eT>& >(m);
|
||||
|
||||
@@ -195,7 +195,7 @@ inline
|
||||
void
|
||||
diagview<eT>::operator/=(const eT val)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
Mat<eT>& t_m = const_cast< Mat<eT>& >(m);
|
||||
|
||||
@@ -218,7 +218,7 @@ inline
|
||||
void
|
||||
diagview<eT>::operator= (const Base<eT,T1>& o)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
diagview<eT>& d = *this;
|
||||
|
||||
@@ -230,7 +230,7 @@ diagview<eT>::operator= (const Base<eT,T1>& o)
|
||||
|
||||
const Proxy<T1> P( o.get_ref() );
|
||||
|
||||
arma_debug_check
|
||||
arma_conform_check
|
||||
(
|
||||
( (d_n_elem != P.get_n_elem()) || ((P.get_n_rows() != 1) && (P.get_n_cols() != 1)) ),
|
||||
"diagview: given object has incompatible size"
|
||||
@@ -238,7 +238,7 @@ diagview<eT>::operator= (const Base<eT,T1>& o)
|
||||
|
||||
const bool is_alias = P.is_alias(d_m);
|
||||
|
||||
if(is_alias) { arma_extra_debug_print("aliasing detected"); }
|
||||
if(is_alias) { arma_debug_print("aliasing detected"); }
|
||||
|
||||
if( (is_Mat<typename Proxy<T1>::stored_type>::value) || (Proxy<T1>::use_at) || (is_alias) )
|
||||
{
|
||||
@@ -291,7 +291,7 @@ inline
|
||||
void
|
||||
diagview<eT>::operator+=(const Base<eT,T1>& o)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
diagview<eT>& d = *this;
|
||||
|
||||
@@ -303,7 +303,7 @@ diagview<eT>::operator+=(const Base<eT,T1>& o)
|
||||
|
||||
const Proxy<T1> P( o.get_ref() );
|
||||
|
||||
arma_debug_check
|
||||
arma_conform_check
|
||||
(
|
||||
( (d_n_elem != P.get_n_elem()) || ((P.get_n_rows() != 1) && (P.get_n_cols() != 1)) ),
|
||||
"diagview: given object has incompatible size"
|
||||
@@ -311,7 +311,7 @@ diagview<eT>::operator+=(const Base<eT,T1>& o)
|
||||
|
||||
const bool is_alias = P.is_alias(d_m);
|
||||
|
||||
if(is_alias) { arma_extra_debug_print("aliasing detected"); }
|
||||
if(is_alias) { arma_debug_print("aliasing detected"); }
|
||||
|
||||
if( (is_Mat<typename Proxy<T1>::stored_type>::value) || (Proxy<T1>::use_at) || (is_alias) )
|
||||
{
|
||||
@@ -364,7 +364,7 @@ inline
|
||||
void
|
||||
diagview<eT>::operator-=(const Base<eT,T1>& o)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
diagview<eT>& d = *this;
|
||||
|
||||
@@ -376,7 +376,7 @@ diagview<eT>::operator-=(const Base<eT,T1>& o)
|
||||
|
||||
const Proxy<T1> P( o.get_ref() );
|
||||
|
||||
arma_debug_check
|
||||
arma_conform_check
|
||||
(
|
||||
( (d_n_elem != P.get_n_elem()) || ((P.get_n_rows() != 1) && (P.get_n_cols() != 1)) ),
|
||||
"diagview: given object has incompatible size"
|
||||
@@ -384,7 +384,7 @@ diagview<eT>::operator-=(const Base<eT,T1>& o)
|
||||
|
||||
const bool is_alias = P.is_alias(d_m);
|
||||
|
||||
if(is_alias) { arma_extra_debug_print("aliasing detected"); }
|
||||
if(is_alias) { arma_debug_print("aliasing detected"); }
|
||||
|
||||
if( (is_Mat<typename Proxy<T1>::stored_type>::value) || (Proxy<T1>::use_at) || (is_alias) )
|
||||
{
|
||||
@@ -437,7 +437,7 @@ inline
|
||||
void
|
||||
diagview<eT>::operator%=(const Base<eT,T1>& o)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
diagview<eT>& d = *this;
|
||||
|
||||
@@ -449,7 +449,7 @@ diagview<eT>::operator%=(const Base<eT,T1>& o)
|
||||
|
||||
const Proxy<T1> P( o.get_ref() );
|
||||
|
||||
arma_debug_check
|
||||
arma_conform_check
|
||||
(
|
||||
( (d_n_elem != P.get_n_elem()) || ((P.get_n_rows() != 1) && (P.get_n_cols() != 1)) ),
|
||||
"diagview: given object has incompatible size"
|
||||
@@ -457,7 +457,7 @@ diagview<eT>::operator%=(const Base<eT,T1>& o)
|
||||
|
||||
const bool is_alias = P.is_alias(d_m);
|
||||
|
||||
if(is_alias) { arma_extra_debug_print("aliasing detected"); }
|
||||
if(is_alias) { arma_debug_print("aliasing detected"); }
|
||||
|
||||
if( (is_Mat<typename Proxy<T1>::stored_type>::value) || (Proxy<T1>::use_at) || (is_alias) )
|
||||
{
|
||||
@@ -510,7 +510,7 @@ inline
|
||||
void
|
||||
diagview<eT>::operator/=(const Base<eT,T1>& o)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
diagview<eT>& d = *this;
|
||||
|
||||
@@ -522,7 +522,7 @@ diagview<eT>::operator/=(const Base<eT,T1>& o)
|
||||
|
||||
const Proxy<T1> P( o.get_ref() );
|
||||
|
||||
arma_debug_check
|
||||
arma_conform_check
|
||||
(
|
||||
( (d_n_elem != P.get_n_elem()) || ((P.get_n_rows() != 1) && (P.get_n_cols() != 1)) ),
|
||||
"diagview: given object has incompatible size"
|
||||
@@ -530,7 +530,7 @@ diagview<eT>::operator/=(const Base<eT,T1>& o)
|
||||
|
||||
const bool is_alias = P.is_alias(d_m);
|
||||
|
||||
if(is_alias) { arma_extra_debug_print("aliasing detected"); }
|
||||
if(is_alias) { arma_debug_print("aliasing detected"); }
|
||||
|
||||
if( (is_Mat<typename Proxy<T1>::stored_type>::value) || (Proxy<T1>::use_at) || (is_alias) )
|
||||
{
|
||||
@@ -583,7 +583,7 @@ inline
|
||||
void
|
||||
diagview<eT>::extract(Mat<eT>& out, const diagview<eT>& in)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
// NOTE: we're assuming that the matrix has already been set to the correct size and there is no aliasing;
|
||||
// size setting and alias checking is done by either the Mat contructor or operator=()
|
||||
@@ -620,9 +620,9 @@ inline
|
||||
void
|
||||
diagview<eT>::plus_inplace(Mat<eT>& out, const diagview<eT>& in)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
arma_debug_assert_same_size(out.n_rows, out.n_cols, in.n_rows, in.n_cols, "addition");
|
||||
arma_conform_assert_same_size(out.n_rows, out.n_cols, in.n_rows, in.n_cols, "addition");
|
||||
|
||||
const Mat<eT>& in_m = in.m;
|
||||
|
||||
@@ -656,9 +656,9 @@ inline
|
||||
void
|
||||
diagview<eT>::minus_inplace(Mat<eT>& out, const diagview<eT>& in)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
arma_debug_assert_same_size(out.n_rows, out.n_cols, in.n_rows, in.n_cols, "subtraction");
|
||||
arma_conform_assert_same_size(out.n_rows, out.n_cols, in.n_rows, in.n_cols, "subtraction");
|
||||
|
||||
const Mat<eT>& in_m = in.m;
|
||||
|
||||
@@ -692,9 +692,9 @@ inline
|
||||
void
|
||||
diagview<eT>::schur_inplace(Mat<eT>& out, const diagview<eT>& in)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
arma_debug_assert_same_size(out.n_rows, out.n_cols, in.n_rows, in.n_cols, "element-wise multiplication");
|
||||
arma_conform_assert_same_size(out.n_rows, out.n_cols, in.n_rows, in.n_cols, "element-wise multiplication");
|
||||
|
||||
const Mat<eT>& in_m = in.m;
|
||||
|
||||
@@ -728,9 +728,9 @@ inline
|
||||
void
|
||||
diagview<eT>::div_inplace(Mat<eT>& out, const diagview<eT>& in)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
arma_debug_assert_same_size(out.n_rows, out.n_cols, in.n_rows, in.n_cols, "element-wise division");
|
||||
arma_conform_assert_same_size(out.n_rows, out.n_cols, in.n_rows, in.n_cols, "element-wise division");
|
||||
|
||||
const Mat<eT>& in_m = in.m;
|
||||
|
||||
@@ -813,7 +813,7 @@ arma_inline
|
||||
eT&
|
||||
diagview<eT>::operator()(const uword ii)
|
||||
{
|
||||
arma_debug_check_bounds( (ii >= n_elem), "diagview::operator(): out of bounds" );
|
||||
arma_conform_check_bounds( (ii >= n_elem), "diagview::operator(): out of bounds" );
|
||||
|
||||
return (const_cast< Mat<eT>& >(m)).at(ii+row_offset, ii+col_offset);
|
||||
}
|
||||
@@ -825,7 +825,7 @@ arma_inline
|
||||
eT
|
||||
diagview<eT>::operator()(const uword ii) const
|
||||
{
|
||||
arma_debug_check_bounds( (ii >= n_elem), "diagview::operator(): out of bounds" );
|
||||
arma_conform_check_bounds( (ii >= n_elem), "diagview::operator(): out of bounds" );
|
||||
|
||||
return m.at(ii+row_offset, ii+col_offset);
|
||||
}
|
||||
@@ -857,7 +857,7 @@ arma_inline
|
||||
eT&
|
||||
diagview<eT>::operator()(const uword row, const uword col)
|
||||
{
|
||||
arma_debug_check_bounds( ((row >= n_elem) || (col > 0)), "diagview::operator(): out of bounds" );
|
||||
arma_conform_check_bounds( ((row >= n_elem) || (col > 0)), "diagview::operator(): out of bounds" );
|
||||
|
||||
return (const_cast< Mat<eT>& >(m)).at(row+row_offset, row+col_offset);
|
||||
}
|
||||
@@ -869,7 +869,7 @@ arma_inline
|
||||
eT
|
||||
diagview<eT>::operator()(const uword row, const uword col) const
|
||||
{
|
||||
arma_debug_check_bounds( ((row >= n_elem) || (col > 0)), "diagview::operator(): out of bounds" );
|
||||
arma_conform_check_bounds( ((row >= n_elem) || (col > 0)), "diagview::operator(): out of bounds" );
|
||||
|
||||
return m.at(row+row_offset, row+col_offset);
|
||||
}
|
||||
@@ -881,7 +881,7 @@ inline
|
||||
void
|
||||
diagview<eT>::replace(const eT old_val, const eT new_val)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
Mat<eT>& x = const_cast< Mat<eT>& >(m);
|
||||
|
||||
@@ -914,7 +914,7 @@ inline
|
||||
void
|
||||
diagview<eT>::clean(const typename get_pod_type<eT>::result threshold)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
Mat<eT> tmp(*this);
|
||||
|
||||
@@ -930,7 +930,7 @@ inline
|
||||
void
|
||||
diagview<eT>::clamp(const eT min_val, const eT max_val)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
Mat<eT> tmp(*this);
|
||||
|
||||
@@ -946,7 +946,7 @@ inline
|
||||
void
|
||||
diagview<eT>::fill(const eT val)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
Mat<eT>& x = const_cast< Mat<eT>& >(m);
|
||||
|
||||
@@ -965,7 +965,7 @@ inline
|
||||
void
|
||||
diagview<eT>::zeros()
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
(*this).fill(eT(0));
|
||||
}
|
||||
@@ -977,7 +977,7 @@ inline
|
||||
void
|
||||
diagview<eT>::ones()
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
(*this).fill(eT(1));
|
||||
}
|
||||
@@ -989,7 +989,7 @@ inline
|
||||
void
|
||||
diagview<eT>::randu()
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
Mat<eT>& x = const_cast< Mat<eT>& >(m);
|
||||
|
||||
@@ -1008,7 +1008,7 @@ inline
|
||||
void
|
||||
diagview<eT>::randn()
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
Mat<eT>& x = const_cast< Mat<eT>& >(m);
|
||||
|
||||
|
||||
@@ -56,6 +56,8 @@ class diskio
|
||||
|
||||
arma_cold inline static bool is_readable(const std::string& name);
|
||||
|
||||
arma_cold inline static void sanitise_token(std::string& token);
|
||||
|
||||
template<typename eT> inline static bool convert_token(eT& val, const std::string& token);
|
||||
template<typename T> inline static bool convert_token(std::complex<T>& val, const std::string& token);
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -25,7 +25,7 @@ template<typename T1, typename T2, typename eglue_type>
|
||||
arma_inline
|
||||
eGlueCube<T1,T2,eglue_type>::~eGlueCube()
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
}
|
||||
|
||||
|
||||
@@ -36,9 +36,9 @@ eGlueCube<T1,T2,eglue_type>::eGlueCube(const T1& in_A, const T2& in_B)
|
||||
: P1(in_A)
|
||||
, P2(in_B)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
arma_debug_assert_same_size
|
||||
arma_conform_assert_same_size
|
||||
(
|
||||
P1.get_n_rows(), P1.get_n_cols(), P1.get_n_slices(),
|
||||
P2.get_n_rows(), P2.get_n_cols(), P2.get_n_slices(),
|
||||
|
||||
@@ -25,7 +25,7 @@ template<typename T1, typename T2, typename eglue_type>
|
||||
arma_inline
|
||||
eGlue<T1,T2,eglue_type>::~eGlue()
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
}
|
||||
|
||||
|
||||
@@ -36,10 +36,10 @@ eGlue<T1,T2,eglue_type>::eGlue(const T1& in_A, const T2& in_B)
|
||||
: P1(in_A)
|
||||
, P2(in_B)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
// arma_debug_assert_same_size( P1, P2, eglue_type::text() );
|
||||
arma_debug_assert_same_size
|
||||
// arma_conform_assert_same_size( P1, P2, eglue_type::text() );
|
||||
arma_conform_assert_same_size
|
||||
(
|
||||
P1.get_n_rows(), P1.get_n_cols(),
|
||||
P2.get_n_rows(), P2.get_n_cols(),
|
||||
|
||||
@@ -26,7 +26,7 @@ inline
|
||||
eOpCube<T1, eop_type>::eOpCube(const BaseCube<typename T1::elem_type, T1>& in_m)
|
||||
: P (in_m.get_ref())
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ eOpCube<T1, eop_type>::eOpCube(const BaseCube<typename T1::elem_type, T1>& in_m,
|
||||
: P (in_m.get_ref())
|
||||
, aux (in_aux)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ eOpCube<T1, eop_type>::eOpCube(const BaseCube<typename T1::elem_type, T1>& in_m,
|
||||
, 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 @@ eOpCube<T1, eop_type>::eOpCube(const BaseCube<typename T1::elem_type, T1>& in_m,
|
||||
, aux_uword_b (in_aux_uword_b)
|
||||
, aux_uword_c (in_aux_uword_c)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
}
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ eOpCube<T1, eop_type>::eOpCube(const BaseCube<typename T1::elem_type, T1>& in_m,
|
||||
, aux_uword_b (in_aux_uword_b)
|
||||
, aux_uword_c (in_aux_uword_c)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
}
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ template<typename T1, typename eop_type>
|
||||
inline
|
||||
eOpCube<T1, eop_type>::~eOpCube()
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ inline
|
||||
eOp<T1, eop_type>::eOp(const T1& in_m)
|
||||
: P(in_m)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ eOp<T1, eop_type>::eOp(const T1& in_m, const typename T1::elem_type in_aux)
|
||||
: P(in_m)
|
||||
, aux(in_aux)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ eOp<T1, eop_type>::eOp(const T1& in_m, const uword in_aux_uword_a, const uword i
|
||||
, 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 @@ eOp<T1, eop_type>::eOp(const T1& in_m, const typename T1::elem_type in_aux, cons
|
||||
, 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 @@ template<typename T1, typename eop_type>
|
||||
inline
|
||||
eOp<T1, eop_type>::~eOp()
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -259,7 +259,7 @@ inline
|
||||
void
|
||||
eglue_core<eglue_type>::apply(outT& out, const eGlue<T1, T2, eglue_type>& x)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
typedef typename T1::elem_type eT;
|
||||
|
||||
@@ -358,12 +358,12 @@ inline
|
||||
void
|
||||
eglue_core<eglue_type>::apply_inplace_plus(Mat<typename T1::elem_type>& out, const eGlue<T1, T2, eglue_type>& x)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
const uword n_rows = x.get_n_rows();
|
||||
const uword n_cols = x.get_n_cols();
|
||||
|
||||
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;
|
||||
|
||||
@@ -455,12 +455,12 @@ inline
|
||||
void
|
||||
eglue_core<eglue_type>::apply_inplace_minus(Mat<typename T1::elem_type>& out, const eGlue<T1, T2, eglue_type>& x)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
const uword n_rows = x.get_n_rows();
|
||||
const uword n_cols = x.get_n_cols();
|
||||
|
||||
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;
|
||||
|
||||
@@ -552,12 +552,12 @@ inline
|
||||
void
|
||||
eglue_core<eglue_type>::apply_inplace_schur(Mat<typename T1::elem_type>& out, const eGlue<T1, T2, eglue_type>& x)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
const uword n_rows = x.get_n_rows();
|
||||
const uword n_cols = x.get_n_cols();
|
||||
|
||||
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;
|
||||
|
||||
@@ -649,12 +649,12 @@ inline
|
||||
void
|
||||
eglue_core<eglue_type>::apply_inplace_div(Mat<typename T1::elem_type>& out, const eGlue<T1, T2, eglue_type>& x)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
const uword n_rows = x.get_n_rows();
|
||||
const uword n_cols = x.get_n_cols();
|
||||
|
||||
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;
|
||||
|
||||
@@ -751,7 +751,7 @@ inline
|
||||
void
|
||||
eglue_core<eglue_type>::apply(Cube<typename T1::elem_type>& out, const eGlueCube<T1, T2, eglue_type>& x)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
typedef typename T1::elem_type eT;
|
||||
|
||||
@@ -851,13 +851,13 @@ inline
|
||||
void
|
||||
eglue_core<eglue_type>::apply_inplace_plus(Cube<typename T1::elem_type>& out, const eGlueCube<T1, T2, eglue_type>& x)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
const uword n_rows = x.get_n_rows();
|
||||
const uword n_cols = x.get_n_cols();
|
||||
const uword n_slices = x.get_n_slices();
|
||||
|
||||
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");
|
||||
|
||||
typedef typename T1::elem_type eT;
|
||||
|
||||
@@ -949,13 +949,13 @@ inline
|
||||
void
|
||||
eglue_core<eglue_type>::apply_inplace_minus(Cube<typename T1::elem_type>& out, const eGlueCube<T1, T2, eglue_type>& x)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
const uword n_rows = x.get_n_rows();
|
||||
const uword n_cols = x.get_n_cols();
|
||||
const uword n_slices = x.get_n_slices();
|
||||
|
||||
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");
|
||||
|
||||
typedef typename T1::elem_type eT;
|
||||
|
||||
@@ -1047,13 +1047,13 @@ inline
|
||||
void
|
||||
eglue_core<eglue_type>::apply_inplace_schur(Cube<typename T1::elem_type>& out, const eGlueCube<T1, T2, eglue_type>& x)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
const uword n_rows = x.get_n_rows();
|
||||
const uword n_cols = x.get_n_cols();
|
||||
const uword n_slices = x.get_n_slices();
|
||||
|
||||
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");
|
||||
|
||||
typedef typename T1::elem_type eT;
|
||||
|
||||
@@ -1145,13 +1145,13 @@ inline
|
||||
void
|
||||
eglue_core<eglue_type>::apply_inplace_div(Cube<typename T1::elem_type>& out, const eGlueCube<T1, T2, eglue_type>& x)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
const uword n_rows = x.get_n_rows();
|
||||
const uword n_cols = x.get_n_cols();
|
||||
const uword n_slices = x.get_n_slices();
|
||||
|
||||
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");
|
||||
|
||||
typedef typename T1::elem_type eT;
|
||||
|
||||
|
||||
@@ -73,8 +73,8 @@ class eop_aux
|
||||
template<typename eT> arma_inline static typename arma_real_or_cx_only<eT>::result sinh (const eT x) { return std::sinh (x); }
|
||||
template<typename eT> arma_inline static typename arma_real_or_cx_only<eT>::result tanh (const eT x) { return std::tanh (x); }
|
||||
|
||||
template<typename eT> arma_inline static typename arma_unsigned_integral_only<eT>::result neg (const eT x) { return x; }
|
||||
template<typename eT> arma_inline static typename arma_signed_only<eT>::result neg (const eT x) { return -x; }
|
||||
template<typename eT> arma_inline static typename arma_unsigned_integral_only<eT>::result neg (const eT x) { return static_cast<eT>(-1 * x); } // TODO: not sure how to best handle this
|
||||
template<typename eT> arma_inline static typename arma_signed_only<eT>::result neg (const eT x) { return -x; }
|
||||
|
||||
template<typename eT> arma_inline static typename arma_integral_only<eT>::result floor (const eT x) { return x; }
|
||||
template<typename eT> arma_inline static typename arma_real_only<eT>::result floor (const eT x) { return std::floor(x); }
|
||||
@@ -84,13 +84,13 @@ class eop_aux
|
||||
template<typename eT> arma_inline static typename arma_real_only<eT>::result ceil (const eT x) { return std::ceil(x); }
|
||||
template<typename eT> arma_inline static typename arma_cx_only<eT>::result ceil (const eT& x) { return eT( std::ceil(x.real()), std::ceil(x.imag()) ); }
|
||||
|
||||
template<typename eT> arma_inline static typename arma_integral_only<eT>::result round (const eT x) { return x; }
|
||||
template<typename eT> arma_inline static typename arma_real_only<eT>::result round (const eT x) { return std::round(x); }
|
||||
template<typename eT> arma_inline static typename arma_cx_only<eT>::result round (const eT& x) { return eT( std::round(x.real()), std::round(x.imag()) ); }
|
||||
template<typename eT> arma_inline static typename arma_integral_only<eT>::result round (const eT x) { return x; }
|
||||
template<typename eT> arma_inline static typename arma_real_only<eT>::result round (const eT x) { return std::round(x); }
|
||||
template<typename eT> arma_inline static typename arma_cx_only<eT>::result round (const eT& x) { return eT( std::round(x.real()), std::round(x.imag()) ); }
|
||||
|
||||
template<typename eT> arma_inline static typename arma_integral_only<eT>::result trunc (const eT x) { return x; }
|
||||
template<typename eT> arma_inline static typename arma_real_only<eT>::result trunc (const eT x) { return std::trunc(x); }
|
||||
template<typename eT> arma_inline static typename arma_cx_only<eT>::result trunc (const eT& x) { return eT( std::trunc(x.real()), std::trunc(x.imag()) ); }
|
||||
template<typename eT> arma_inline static typename arma_integral_only<eT>::result trunc (const eT x) { return x; }
|
||||
template<typename eT> arma_inline static typename arma_real_only<eT>::result trunc (const eT x) { return std::trunc(x); }
|
||||
template<typename eT> arma_inline static typename arma_cx_only<eT>::result trunc (const eT& x) { return eT( std::trunc(x.real()), std::trunc(x.imag()) ); }
|
||||
|
||||
template<typename eT> arma_inline static typename arma_integral_only<eT>::result log2 (const eT x) { return eT( std::log2(double(x)) ); }
|
||||
template<typename eT> arma_inline static typename arma_real_only<eT>::result log2 (const eT x) { return std::log2(x); }
|
||||
@@ -116,6 +116,10 @@ class eop_aux
|
||||
template<typename eT> arma_inline static typename arma_real_only<eT>::result arma_abs (const eT x) { return std::abs(x); }
|
||||
template<typename T> arma_inline static typename arma_real_only< T>::result arma_abs (const std::complex<T>& x) { return std::abs(x); }
|
||||
|
||||
template<typename eT> arma_inline static typename arma_integral_only<eT>::result cbrt (const eT x) { return eT( std::cbrt(double(x)) ); }
|
||||
template<typename eT> arma_inline static typename arma_real_only<eT>::result cbrt (const eT x) { return std::cbrt(x); }
|
||||
template<typename eT> arma_inline static typename arma_cx_only<eT>::result cbrt (const eT& x) { arma_ignore(x); return eT(0); }
|
||||
|
||||
template<typename eT> arma_inline static typename arma_integral_only<eT>::result erf (const eT x) { return eT( std::erf(double(x)) ); }
|
||||
template<typename eT> arma_inline static typename arma_real_only<eT>::result erf (const eT x) { return std::erf(x); }
|
||||
template<typename eT> arma_inline static typename arma_cx_only<eT>::result erf (const eT& x) { arma_ignore(x); return eT(0); }
|
||||
@@ -152,7 +156,7 @@ class eop_aux
|
||||
typename arma_real_only<eT>::result
|
||||
direct_eps(const eT x)
|
||||
{
|
||||
//arma_extra_debug_sigprint();
|
||||
//arma_debug_sigprint();
|
||||
|
||||
// acording to IEEE Standard for Floating-Point Arithmetic (IEEE 754)
|
||||
// the mantissa length for double is 53 bits = std::numeric_limits<double>::digits
|
||||
@@ -174,7 +178,7 @@ class eop_aux
|
||||
typename arma_real_only<T>::result
|
||||
direct_eps(const std::complex<T>& x)
|
||||
{
|
||||
//arma_extra_debug_sigprint();
|
||||
//arma_debug_sigprint();
|
||||
|
||||
//return std::pow( std::numeric_limits<T>::radix, (std::floor(std::log10(std::abs(x))/std::log10(std::numeric_limits<T>::radix))-(std::numeric_limits<T>::digits-1)) );
|
||||
|
||||
|
||||
@@ -98,6 +98,7 @@ class eop_ceil : public eop_core<eop_ceil> , public eo
|
||||
class eop_round : public eop_core<eop_round> , public eop_use_mp_false {};
|
||||
class eop_trunc : public eop_core<eop_trunc> , public eop_use_mp_false {};
|
||||
class eop_sign : public eop_core<eop_sign> , public eop_use_mp_false {};
|
||||
class eop_cbrt : public eop_core<eop_cbrt> , public eop_use_mp_true {};
|
||||
class eop_erf : public eop_core<eop_erf> , public eop_use_mp_true {};
|
||||
class eop_erfc : public eop_core<eop_erfc> , public eop_use_mp_true {};
|
||||
class eop_lgamma : public eop_core<eop_lgamma> , public eop_use_mp_true {};
|
||||
|
||||
@@ -245,7 +245,7 @@ inline
|
||||
void
|
||||
eop_core<eop_type>::apply(outT& out, const eOp<T1, eop_type>& x)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
typedef typename T1::elem_type eT;
|
||||
|
||||
@@ -320,14 +320,14 @@ inline
|
||||
void
|
||||
eop_core<eop_type>::apply_inplace_plus(Mat<typename T1::elem_type>& out, const eOp<T1, eop_type>& x)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
typedef typename T1::elem_type eT;
|
||||
|
||||
const uword n_rows = x.get_n_rows();
|
||||
const uword n_cols = x.get_n_cols();
|
||||
|
||||
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");
|
||||
|
||||
const eT k = x.aux;
|
||||
eT* out_mem = out.memptr();
|
||||
@@ -390,19 +390,18 @@ eop_core<eop_type>::apply_inplace_plus(Mat<typename T1::elem_type>& out, const e
|
||||
|
||||
template<typename eop_type>
|
||||
template<typename T1>
|
||||
|
||||
inline
|
||||
void
|
||||
eop_core<eop_type>::apply_inplace_minus(Mat<typename T1::elem_type>& out, const eOp<T1, eop_type>& x)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
typedef typename T1::elem_type eT;
|
||||
|
||||
const uword n_rows = x.get_n_rows();
|
||||
const uword n_cols = x.get_n_cols();
|
||||
|
||||
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");
|
||||
|
||||
const eT k = x.aux;
|
||||
eT* out_mem = out.memptr();
|
||||
@@ -465,19 +464,18 @@ eop_core<eop_type>::apply_inplace_minus(Mat<typename T1::elem_type>& out, const
|
||||
|
||||
template<typename eop_type>
|
||||
template<typename T1>
|
||||
|
||||
inline
|
||||
void
|
||||
eop_core<eop_type>::apply_inplace_schur(Mat<typename T1::elem_type>& out, const eOp<T1, eop_type>& x)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
typedef typename T1::elem_type eT;
|
||||
|
||||
const uword n_rows = x.get_n_rows();
|
||||
const uword n_cols = x.get_n_cols();
|
||||
|
||||
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");
|
||||
|
||||
const eT k = x.aux;
|
||||
eT* out_mem = out.memptr();
|
||||
@@ -540,19 +538,18 @@ eop_core<eop_type>::apply_inplace_schur(Mat<typename T1::elem_type>& out, const
|
||||
|
||||
template<typename eop_type>
|
||||
template<typename T1>
|
||||
|
||||
inline
|
||||
void
|
||||
eop_core<eop_type>::apply_inplace_div(Mat<typename T1::elem_type>& out, const eOp<T1, eop_type>& x)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
typedef typename T1::elem_type eT;
|
||||
|
||||
const uword n_rows = x.get_n_rows();
|
||||
const uword n_cols = x.get_n_cols();
|
||||
|
||||
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");
|
||||
|
||||
const eT k = x.aux;
|
||||
eT* out_mem = out.memptr();
|
||||
@@ -620,12 +617,11 @@ eop_core<eop_type>::apply_inplace_div(Mat<typename T1::elem_type>& out, const eO
|
||||
|
||||
template<typename eop_type>
|
||||
template<typename T1>
|
||||
|
||||
inline
|
||||
void
|
||||
eop_core<eop_type>::apply(Cube<typename T1::elem_type>& out, const eOpCube<T1, eop_type>& x)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
typedef typename T1::elem_type eT;
|
||||
|
||||
@@ -697,12 +693,11 @@ eop_core<eop_type>::apply(Cube<typename T1::elem_type>& out, const eOpCube<T1, e
|
||||
|
||||
template<typename eop_type>
|
||||
template<typename T1>
|
||||
|
||||
inline
|
||||
void
|
||||
eop_core<eop_type>::apply_inplace_plus(Cube<typename T1::elem_type>& out, const eOpCube<T1, eop_type>& x)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
typedef typename T1::elem_type eT;
|
||||
|
||||
@@ -710,7 +705,7 @@ eop_core<eop_type>::apply_inplace_plus(Cube<typename T1::elem_type>& out, const
|
||||
const uword n_cols = x.get_n_cols();
|
||||
const uword n_slices = x.get_n_slices();
|
||||
|
||||
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");
|
||||
|
||||
const eT k = x.aux;
|
||||
eT* out_mem = out.memptr();
|
||||
@@ -773,12 +768,11 @@ eop_core<eop_type>::apply_inplace_plus(Cube<typename T1::elem_type>& out, const
|
||||
|
||||
template<typename eop_type>
|
||||
template<typename T1>
|
||||
|
||||
inline
|
||||
void
|
||||
eop_core<eop_type>::apply_inplace_minus(Cube<typename T1::elem_type>& out, const eOpCube<T1, eop_type>& x)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
typedef typename T1::elem_type eT;
|
||||
|
||||
@@ -786,7 +780,7 @@ eop_core<eop_type>::apply_inplace_minus(Cube<typename T1::elem_type>& out, const
|
||||
const uword n_cols = x.get_n_cols();
|
||||
const uword n_slices = x.get_n_slices();
|
||||
|
||||
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");
|
||||
|
||||
const eT k = x.aux;
|
||||
eT* out_mem = out.memptr();
|
||||
@@ -849,12 +843,11 @@ eop_core<eop_type>::apply_inplace_minus(Cube<typename T1::elem_type>& out, const
|
||||
|
||||
template<typename eop_type>
|
||||
template<typename T1>
|
||||
|
||||
inline
|
||||
void
|
||||
eop_core<eop_type>::apply_inplace_schur(Cube<typename T1::elem_type>& out, const eOpCube<T1, eop_type>& x)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
typedef typename T1::elem_type eT;
|
||||
|
||||
@@ -862,7 +855,7 @@ eop_core<eop_type>::apply_inplace_schur(Cube<typename T1::elem_type>& out, const
|
||||
const uword n_cols = x.get_n_cols();
|
||||
const uword n_slices = x.get_n_slices();
|
||||
|
||||
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");
|
||||
|
||||
const eT k = x.aux;
|
||||
eT* out_mem = out.memptr();
|
||||
@@ -925,12 +918,11 @@ eop_core<eop_type>::apply_inplace_schur(Cube<typename T1::elem_type>& out, const
|
||||
|
||||
template<typename eop_type>
|
||||
template<typename T1>
|
||||
|
||||
inline
|
||||
void
|
||||
eop_core<eop_type>::apply_inplace_div(Cube<typename T1::elem_type>& out, const eOpCube<T1, eop_type>& x)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
typedef typename T1::elem_type eT;
|
||||
|
||||
@@ -938,7 +930,7 @@ eop_core<eop_type>::apply_inplace_div(Cube<typename T1::elem_type>& out, const e
|
||||
const uword n_cols = x.get_n_cols();
|
||||
const uword n_slices = x.get_n_slices();
|
||||
|
||||
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");
|
||||
|
||||
const eT k = x.aux;
|
||||
eT* out_mem = out.memptr();
|
||||
@@ -1142,6 +1134,9 @@ eop_core<eop_trunc >::process(const eT val, const eT ) { return eop_
|
||||
template<> template<typename eT> arma_inline eT
|
||||
eop_core<eop_sign >::process(const eT val, const eT ) { return arma_sign(val); }
|
||||
|
||||
template<> template<typename eT> arma_inline eT
|
||||
eop_core<eop_cbrt >::process(const eT val, const eT ) { return eop_aux::cbrt(val); }
|
||||
|
||||
template<> template<typename eT> arma_inline eT
|
||||
eop_core<eop_erf >::process(const eT val, const eT ) { return eop_aux::erf(val); }
|
||||
|
||||
|
||||
@@ -23,6 +23,13 @@
|
||||
|
||||
#if defined(ARMA_USE_FFTW3)
|
||||
|
||||
struct fft_engine_fftw3_aux
|
||||
{
|
||||
#if defined(ARMA_USE_STD_MUTEX)
|
||||
static inline std::mutex& get_plan_mutex() { static std::mutex plan_mutex; return plan_mutex; }
|
||||
#endif
|
||||
};
|
||||
|
||||
template<typename cx_type, bool inverse>
|
||||
class fft_engine_fftw3
|
||||
{
|
||||
@@ -45,7 +52,7 @@ class fft_engine_fftw3
|
||||
inline
|
||||
~fft_engine_fftw3()
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
if(fftw3_plan != nullptr) { fftw3::destroy_plan<cx_type>(fftw3_plan); }
|
||||
|
||||
@@ -57,41 +64,66 @@ class fft_engine_fftw3
|
||||
: N (in_N )
|
||||
, fftw3_plan(nullptr)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
if(N == 0) { return; }
|
||||
|
||||
if(N > uword(std::numeric_limits<int>::max()))
|
||||
{
|
||||
arma_stop_runtime_error("integer overflow: FFT size too large for integer type used by FFTW3");
|
||||
}
|
||||
|
||||
arma_extra_debug_print("fft_engine_fftw3::constructor: allocating work arrays");
|
||||
arma_debug_print("fft_engine_fftw3::constructor: allocating work arrays");
|
||||
X_work.set_size(N);
|
||||
Y_work.set_size(N);
|
||||
|
||||
const int fftw3_sign = (inverse) ? fftw3_sign_backward : fftw3_sign_forward;
|
||||
const int fftw3_flags = fftw3_flag_destroy | fftw3_flag_estimate;
|
||||
|
||||
arma_extra_debug_print("fft_engine_fftw3::constructor: generating 1D plan");
|
||||
fftw3_plan = fftw3::plan_dft_1d<cx_type>(N, X_work.memptr(), Y_work.memptr(), fftw3_sign, fftw3_flags);
|
||||
arma_debug_print("fft_engine_fftw3::constructor: generating 1D plan");
|
||||
|
||||
if(fftw3_plan == nullptr) { arma_stop_runtime_error("fft_engine_fftw3::constructor: couldn't create plan"); }
|
||||
// only fftw3::execute() is thread safe, as per FFTW docs:
|
||||
// https://www.fftw.org/fftw3_doc/Thread-safety.html
|
||||
|
||||
#if defined(ARMA_USE_OPENMP)
|
||||
{
|
||||
#pragma omp critical (arma_fft_engine_fftw3)
|
||||
{
|
||||
fftw3_plan = fftw3::plan_dft_1d<cx_type>(N, X_work.memptr(), Y_work.memptr(), fftw3_sign, fftw3_flags);
|
||||
}
|
||||
}
|
||||
#elif defined(ARMA_USE_STD_MUTEX)
|
||||
{
|
||||
std::mutex& plan_mutex = fft_engine_fftw3_aux::get_plan_mutex();
|
||||
|
||||
const std::lock_guard<std::mutex> lock(plan_mutex);
|
||||
|
||||
fftw3_plan = fftw3::plan_dft_1d<cx_type>(N, X_work.memptr(), Y_work.memptr(), fftw3_sign, fftw3_flags);
|
||||
}
|
||||
#else
|
||||
{
|
||||
fftw3_plan = fftw3::plan_dft_1d<cx_type>(N, X_work.memptr(), Y_work.memptr(), fftw3_sign, fftw3_flags);
|
||||
}
|
||||
#endif
|
||||
|
||||
if(fftw3_plan == nullptr) { arma_stop_runtime_error("fft_engine_fftw3::constructor: failed to create plan"); }
|
||||
}
|
||||
|
||||
inline
|
||||
void
|
||||
run(cx_type* Y, const cx_type* X)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
if(fftw3_plan == nullptr) { return; }
|
||||
|
||||
arma_extra_debug_print("fft_engine_fftw3::run(): copying input array");
|
||||
arma_debug_print("fft_engine_fftw3::run(): copying input array");
|
||||
arrayops::copy(X_work.memptr(), X, N);
|
||||
|
||||
arma_extra_debug_print("fft_engine_fftw3::run(): executing plan");
|
||||
arma_debug_print("fft_engine_fftw3::run(): executing plan");
|
||||
fftw3::execute<cx_type>(fftw3_plan);
|
||||
|
||||
arma_extra_debug_print("fft_engine_fftw3::run(): copying output array");
|
||||
arma_debug_print("fft_engine_fftw3::run(): copying output array");
|
||||
arrayops::copy(Y, Y_work.memptr(), N);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -110,7 +110,7 @@ class fft_engine_kissfft
|
||||
fft_engine_kissfft(const uword in_N)
|
||||
: N(in_N)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
const uword len = calc_radix<false>();
|
||||
|
||||
@@ -138,7 +138,7 @@ class fft_engine_kissfft
|
||||
void
|
||||
butterfly_2(cx_type* Y, const uword stride, const uword m) const
|
||||
{
|
||||
// arma_extra_debug_sigprint();
|
||||
// arma_debug_sigprint();
|
||||
|
||||
const cx_type* coeffs = coeffs_array.memptr();
|
||||
|
||||
@@ -158,7 +158,7 @@ class fft_engine_kissfft
|
||||
void
|
||||
butterfly_3(cx_type* Y, const uword stride, const uword m) const
|
||||
{
|
||||
// arma_extra_debug_sigprint();
|
||||
// arma_debug_sigprint();
|
||||
|
||||
arma_aligned cx_type tmp[5];
|
||||
|
||||
@@ -204,7 +204,7 @@ class fft_engine_kissfft
|
||||
void
|
||||
butterfly_4(cx_type* Y, const uword stride, const uword m) const
|
||||
{
|
||||
// arma_extra_debug_sigprint();
|
||||
// arma_debug_sigprint();
|
||||
|
||||
arma_aligned cx_type tmp[7];
|
||||
|
||||
@@ -247,7 +247,7 @@ class fft_engine_kissfft
|
||||
void
|
||||
butterfly_5(cx_type* Y, const uword stride, const uword m) const
|
||||
{
|
||||
// arma_extra_debug_sigprint();
|
||||
// arma_debug_sigprint();
|
||||
|
||||
arma_aligned cx_type tmp[13];
|
||||
|
||||
@@ -311,7 +311,7 @@ class fft_engine_kissfft
|
||||
void
|
||||
butterfly_N(cx_type* Y, const uword stride, const uword m, const uword r)
|
||||
{
|
||||
// arma_extra_debug_sigprint();
|
||||
// arma_debug_sigprint();
|
||||
|
||||
const cx_type* coeffs = coeffs_array.memptr();
|
||||
|
||||
@@ -356,7 +356,7 @@ class fft_engine_kissfft
|
||||
void
|
||||
run(cx_type* Y, const cx_type* X, const uword stage = 0, const uword stride = 1)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
const uword m = residue[stage];
|
||||
const uword r = radix[stage];
|
||||
|
||||
@@ -67,11 +67,11 @@ class field
|
||||
inline explicit field(const SizeMat& s);
|
||||
inline explicit field(const SizeCube& s);
|
||||
|
||||
inline void set_size(const uword n_obj_in);
|
||||
inline void set_size(const uword n_rows_in, const uword n_cols_in);
|
||||
inline void set_size(const uword n_rows_in, const uword n_cols_in, const uword n_slices_in);
|
||||
inline void set_size(const SizeMat& s);
|
||||
inline void set_size(const SizeCube& s);
|
||||
inline field& set_size(const uword n_obj_in);
|
||||
inline field& set_size(const uword n_rows_in, const uword n_cols_in);
|
||||
inline field& set_size(const uword n_rows_in, const uword n_cols_in, const uword n_slices_in);
|
||||
inline field& set_size(const SizeMat& s);
|
||||
inline field& set_size(const SizeCube& s);
|
||||
|
||||
inline field(const std::vector<oT>& x);
|
||||
inline field& operator=(const std::vector<oT>& x);
|
||||
@@ -86,7 +86,7 @@ class field
|
||||
inline field& operator=(field&& X);
|
||||
|
||||
template<typename oT2>
|
||||
inline void copy_size(const field<oT2>& x);
|
||||
inline field& copy_size(const field<oT2>& x);
|
||||
|
||||
arma_warn_unused arma_inline oT& operator[](const uword i);
|
||||
arma_warn_unused arma_inline const oT& operator[](const uword i) const;
|
||||
@@ -183,15 +183,15 @@ class field
|
||||
arma_cold inline void print( const std::string extra_text = "") const;
|
||||
arma_cold inline void print(std::ostream& user_stream, const std::string extra_text = "") const;
|
||||
|
||||
inline const field& for_each(const std::function< void( oT&) >& F);
|
||||
inline field& for_each(const std::function< void( oT&) >& F);
|
||||
inline const field& for_each(const std::function< void(const oT&) >& F) const;
|
||||
|
||||
inline const field& fill(const oT& x);
|
||||
inline field& fill(const oT& x);
|
||||
|
||||
inline void reset();
|
||||
inline void reset_objects();
|
||||
|
||||
arma_inline bool is_empty() const;
|
||||
arma_warn_unused arma_inline bool is_empty() const;
|
||||
|
||||
|
||||
arma_warn_unused arma_inline bool in_range(const uword i) const;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -27,7 +27,7 @@ inline
|
||||
typename T1::elem_type
|
||||
accu_proxy_linear(const Proxy<T1>& P)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
typedef typename T1::elem_type eT;
|
||||
|
||||
@@ -70,7 +70,7 @@ accu_proxy_linear(const Proxy<T1>& P)
|
||||
}
|
||||
else
|
||||
{
|
||||
#if defined(__FINITE_MATH_ONLY__) && (__FINITE_MATH_ONLY__ > 0)
|
||||
#if defined(__FAST_MATH__)
|
||||
{
|
||||
if(P.is_aligned())
|
||||
{
|
||||
@@ -109,7 +109,7 @@ inline
|
||||
typename T1::elem_type
|
||||
accu_proxy_at_mp(const Proxy<T1>& P)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
typedef typename T1::elem_type eT;
|
||||
|
||||
@@ -209,7 +209,7 @@ inline
|
||||
typename T1::elem_type
|
||||
accu_proxy_at(const Proxy<T1>& P)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
typedef typename T1::elem_type eT;
|
||||
|
||||
@@ -256,7 +256,7 @@ inline
|
||||
typename enable_if2< is_arma_type<T1>::value, typename T1::elem_type >::result
|
||||
accu(const T1& X)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
const Proxy<T1> P(X);
|
||||
|
||||
@@ -279,18 +279,49 @@ inline
|
||||
typename T1::elem_type
|
||||
accu(const eGlue<T1,T2,eglue_schur>& expr)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
typedef eGlue<T1,T2,eglue_schur> expr_type;
|
||||
|
||||
typedef typename expr_type::proxy1_type::stored_type P1_stored_type;
|
||||
typedef typename expr_type::proxy2_type::stored_type P2_stored_type;
|
||||
|
||||
const bool have_direct_mem_1 = (is_Mat<P1_stored_type>::value) || (is_subview_col<P1_stored_type>::value);
|
||||
const bool have_direct_mem_2 = (is_Mat<P2_stored_type>::value) || (is_subview_col<P2_stored_type>::value);
|
||||
constexpr bool is_sv = (is_subview<P1_stored_type>::value) || (is_subview<P2_stored_type>::value);
|
||||
|
||||
if( (is_sv) && (expr.get_n_rows() >= 4) )
|
||||
{
|
||||
arma_debug_print("accu(): eglue_schur subview optimisation");
|
||||
|
||||
typedef typename T1::elem_type eT;
|
||||
|
||||
const sv_keep_unwrap<P1_stored_type>& UA(expr.P1.Q);
|
||||
const sv_keep_unwrap<P2_stored_type>& UB(expr.P2.Q);
|
||||
|
||||
typedef typename sv_keep_unwrap<T1>::stored_type UA_M_type;
|
||||
typedef typename sv_keep_unwrap<T2>::stored_type UB_M_type;
|
||||
|
||||
const UA_M_type& A = UA.M;
|
||||
const UB_M_type& B = UB.M;
|
||||
|
||||
// A and B have the same size (checked by the eGlue constructor)
|
||||
|
||||
const uword A_n_rows = A.n_rows;
|
||||
const uword A_n_cols = A.n_cols;
|
||||
|
||||
eT acc = eT(0);
|
||||
|
||||
for(uword c=0; c < A_n_cols; ++c) { acc += op_dot::direct_dot(A_n_rows, A.colptr(c), B.colptr(c)); }
|
||||
|
||||
return acc;
|
||||
}
|
||||
|
||||
constexpr bool have_direct_mem_1 = (is_Mat<P1_stored_type>::value) || (is_subview_col<P1_stored_type>::value);
|
||||
constexpr bool have_direct_mem_2 = (is_Mat<P2_stored_type>::value) || (is_subview_col<P2_stored_type>::value);
|
||||
|
||||
if(have_direct_mem_1 && have_direct_mem_2)
|
||||
{
|
||||
arma_debug_print("accu(): eglue_schur direct_mem optimisation");
|
||||
|
||||
const quasi_unwrap<P1_stored_type> tmp1(expr.P1.Q);
|
||||
const quasi_unwrap<P2_stored_type> tmp2(expr.P2.Q);
|
||||
|
||||
@@ -304,22 +335,23 @@ accu(const eGlue<T1,T2,eglue_schur>& expr)
|
||||
|
||||
|
||||
|
||||
//! explicit handling of Hamming norm (also known as zero norm)
|
||||
template<typename T1>
|
||||
template<typename T1, typename op_type>
|
||||
arma_warn_unused
|
||||
inline
|
||||
uword
|
||||
accu(const mtOp<uword,T1,op_rel_noteq>& X)
|
||||
accu(const mtOp<uword,T1,op_type>& X, const typename arma_op_rel_only<op_type>::result* junk1 = nullptr, const typename arma_not_cx<typename T1::elem_type>::result* junk2 = nullptr)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
arma_ignore(junk1);
|
||||
arma_ignore(junk2);
|
||||
|
||||
typedef typename T1::elem_type eT;
|
||||
|
||||
const eT val = X.aux;
|
||||
const eT k = X.aux;
|
||||
|
||||
const Proxy<T1> P(X.m);
|
||||
|
||||
uword n_nonzero = 0;
|
||||
uword count = 0;
|
||||
|
||||
if(Proxy<T1>::use_at == false)
|
||||
{
|
||||
@@ -330,7 +362,23 @@ accu(const mtOp<uword,T1,op_rel_noteq>& X)
|
||||
|
||||
for(uword i=0; i<n_elem; ++i)
|
||||
{
|
||||
n_nonzero += (A[i] != val) ? uword(1) : uword(0);
|
||||
const eT val = A[i];
|
||||
|
||||
bool condition;
|
||||
|
||||
if(is_same_type<op_type, op_rel_eq >::yes) { condition = (val == k ); }
|
||||
else if(is_same_type<op_type, op_rel_noteq >::yes) { condition = (val != k ); }
|
||||
else if(is_same_type<op_type, op_rel_lt_pre >::yes) { condition = (k < val); }
|
||||
else if(is_same_type<op_type, op_rel_lt_post >::yes) { condition = (val < k ); }
|
||||
else if(is_same_type<op_type, op_rel_gt_pre >::yes) { condition = (k > val); }
|
||||
else if(is_same_type<op_type, op_rel_gt_post >::yes) { condition = (val > k ); }
|
||||
else if(is_same_type<op_type, op_rel_lteq_pre >::yes) { condition = (k <= val); }
|
||||
else if(is_same_type<op_type, op_rel_lteq_post>::yes) { condition = (val <= k ); }
|
||||
else if(is_same_type<op_type, op_rel_gteq_pre >::yes) { condition = (k >= val); }
|
||||
else if(is_same_type<op_type, op_rel_gteq_post>::yes) { condition = (val >= k ); }
|
||||
else { condition = false; }
|
||||
|
||||
count += (condition) ? uword(1) : uword(0);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -338,43 +386,51 @@ accu(const mtOp<uword,T1,op_rel_noteq>& X)
|
||||
const uword P_n_cols = P.get_n_cols();
|
||||
const uword P_n_rows = P.get_n_rows();
|
||||
|
||||
if(P_n_rows == 1)
|
||||
for(uword col=0; col < P_n_cols; ++col)
|
||||
for(uword row=0; row < P_n_rows; ++row)
|
||||
{
|
||||
for(uword col=0; col < P_n_cols; ++col)
|
||||
{
|
||||
n_nonzero += (P.at(0,col) != val) ? uword(1) : uword(0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for(uword col=0; col < P_n_cols; ++col)
|
||||
for(uword row=0; row < P_n_rows; ++row)
|
||||
{
|
||||
n_nonzero += (P.at(row,col) != val) ? uword(1) : uword(0);
|
||||
}
|
||||
const eT val = P.at(row,col);
|
||||
|
||||
bool condition;
|
||||
|
||||
if(is_same_type<op_type, op_rel_eq >::yes) { condition = (val == k ); }
|
||||
else if(is_same_type<op_type, op_rel_noteq >::yes) { condition = (val != k ); }
|
||||
else if(is_same_type<op_type, op_rel_lt_pre >::yes) { condition = (k < val); }
|
||||
else if(is_same_type<op_type, op_rel_lt_post >::yes) { condition = (val < k ); }
|
||||
else if(is_same_type<op_type, op_rel_gt_pre >::yes) { condition = (k > val); }
|
||||
else if(is_same_type<op_type, op_rel_gt_post >::yes) { condition = (val > k ); }
|
||||
else if(is_same_type<op_type, op_rel_lteq_pre >::yes) { condition = (k <= val); }
|
||||
else if(is_same_type<op_type, op_rel_lteq_post>::yes) { condition = (val <= k ); }
|
||||
else if(is_same_type<op_type, op_rel_gteq_pre >::yes) { condition = (k >= val); }
|
||||
else if(is_same_type<op_type, op_rel_gteq_post>::yes) { condition = (val >= k ); }
|
||||
else { condition = false; }
|
||||
|
||||
count += (condition) ? uword(1) : uword(0);
|
||||
}
|
||||
}
|
||||
|
||||
return n_nonzero;
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename T1>
|
||||
template<typename T1, typename op_type>
|
||||
arma_warn_unused
|
||||
inline
|
||||
uword
|
||||
accu(const mtOp<uword,T1,op_rel_eq>& X)
|
||||
accu(const mtOp<uword,T1,op_type>& X, const typename arma_op_rel_only<op_type>::result* junk1 = nullptr, const typename arma_cx_only<typename T1::elem_type>::result* junk2 = nullptr)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
arma_ignore(junk1);
|
||||
arma_ignore(junk2);
|
||||
|
||||
typedef typename T1::elem_type eT;
|
||||
|
||||
const eT val = X.aux;
|
||||
const eT k = X.aux;
|
||||
|
||||
const Proxy<T1> P(X.m);
|
||||
|
||||
uword n_nonzero = 0;
|
||||
uword count = 0;
|
||||
|
||||
if(Proxy<T1>::use_at == false)
|
||||
{
|
||||
@@ -385,7 +441,15 @@ accu(const mtOp<uword,T1,op_rel_eq>& X)
|
||||
|
||||
for(uword i=0; i<n_elem; ++i)
|
||||
{
|
||||
n_nonzero += (A[i] == val) ? uword(1) : uword(0);
|
||||
const eT val = A[i];
|
||||
|
||||
bool condition;
|
||||
|
||||
if(is_same_type<op_type, op_rel_eq >::yes) { condition = (val == k); }
|
||||
else if(is_same_type<op_type, op_rel_noteq>::yes) { condition = (val != k); }
|
||||
else { condition = false; }
|
||||
|
||||
count += (condition) ? uword(1) : uword(0);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -393,24 +457,22 @@ accu(const mtOp<uword,T1,op_rel_eq>& X)
|
||||
const uword P_n_cols = P.get_n_cols();
|
||||
const uword P_n_rows = P.get_n_rows();
|
||||
|
||||
if(P_n_rows == 1)
|
||||
for(uword col=0; col < P_n_cols; ++col)
|
||||
for(uword row=0; row < P_n_rows; ++row)
|
||||
{
|
||||
for(uword col=0; col < P_n_cols; ++col)
|
||||
{
|
||||
n_nonzero += (P.at(0,col) == val) ? uword(1) : uword(0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for(uword col=0; col < P_n_cols; ++col)
|
||||
for(uword row=0; row < P_n_rows; ++row)
|
||||
{
|
||||
n_nonzero += (P.at(row,col) == val) ? uword(1) : uword(0);
|
||||
}
|
||||
const eT val = P.at(row,col);
|
||||
|
||||
bool condition;
|
||||
|
||||
if(is_same_type<op_type, op_rel_eq >::yes) { condition = (val == k); }
|
||||
else if(is_same_type<op_type, op_rel_noteq>::yes) { condition = (val != k); }
|
||||
else { condition = false; }
|
||||
|
||||
count += (condition) ? uword(1) : uword(0);
|
||||
}
|
||||
}
|
||||
|
||||
return n_nonzero;
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
@@ -421,12 +483,12 @@ inline
|
||||
uword
|
||||
accu(const mtGlue<uword,T1,T2,glue_rel_noteq>& X)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
const Proxy<T1> PA(X.A);
|
||||
const Proxy<T2> PB(X.B);
|
||||
|
||||
arma_debug_assert_same_size(PA, PB, "operator!=");
|
||||
arma_conform_assert_same_size(PA, PB, "operator!=");
|
||||
|
||||
uword n_nonzero = 0;
|
||||
|
||||
@@ -477,12 +539,12 @@ inline
|
||||
uword
|
||||
accu(const mtGlue<uword,T1,T2,glue_rel_eq>& X)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
const Proxy<T1> PA(X.A);
|
||||
const Proxy<T2> PB(X.B);
|
||||
|
||||
arma_debug_assert_same_size(PA, PB, "operator==");
|
||||
arma_conform_assert_same_size(PA, PB, "operator==");
|
||||
|
||||
uword n_nonzero = 0;
|
||||
|
||||
@@ -535,7 +597,7 @@ inline
|
||||
eT
|
||||
accu(const subview<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;
|
||||
@@ -583,7 +645,7 @@ inline
|
||||
eT
|
||||
accu(const subview_col<eT>& X)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
return arrayops::accumulate( X.colmem, X.n_rows );
|
||||
}
|
||||
@@ -600,7 +662,7 @@ inline
|
||||
typename T1::elem_type
|
||||
accu_cube_proxy_linear(const ProxyCube<T1>& P)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
typedef typename T1::elem_type eT;
|
||||
|
||||
@@ -643,7 +705,7 @@ accu_cube_proxy_linear(const ProxyCube<T1>& P)
|
||||
}
|
||||
else
|
||||
{
|
||||
#if defined(__FINITE_MATH_ONLY__) && (__FINITE_MATH_ONLY__ > 0)
|
||||
#if defined(__FAST_MATH__)
|
||||
{
|
||||
if(P.is_aligned())
|
||||
{
|
||||
@@ -682,7 +744,7 @@ inline
|
||||
typename T1::elem_type
|
||||
accu_cube_proxy_at_mp(const ProxyCube<T1>& P)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
typedef typename T1::elem_type eT;
|
||||
|
||||
@@ -734,7 +796,7 @@ inline
|
||||
typename T1::elem_type
|
||||
accu_cube_proxy_at(const ProxyCube<T1>& P)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
typedef typename T1::elem_type eT;
|
||||
|
||||
@@ -772,7 +834,7 @@ inline
|
||||
typename T1::elem_type
|
||||
accu(const BaseCube<typename T1::elem_type,T1>& X)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
const ProxyCube<T1> P(X.get_ref());
|
||||
|
||||
@@ -795,7 +857,7 @@ inline
|
||||
typename T1::elem_type
|
||||
accu(const eGlueCube<T1,T2,eglue_schur>& expr)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
typedef eGlueCube<T1,T2,eglue_schur> expr_type;
|
||||
|
||||
@@ -839,7 +901,7 @@ inline
|
||||
typename T1::elem_type
|
||||
accu(const SpBase<typename T1::elem_type,T1>& expr)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
typedef typename T1::elem_type eT;
|
||||
|
||||
@@ -886,12 +948,12 @@ inline
|
||||
typename T1::elem_type
|
||||
accu(const SpGlue<T1,T2,spglue_plus>& expr)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
const unwrap_spmat<T1> UA(expr.A);
|
||||
const unwrap_spmat<T2> UB(expr.B);
|
||||
|
||||
arma_debug_assert_same_size(UA.M.n_rows, UA.M.n_cols, UB.M.n_rows, UB.M.n_cols, "addition");
|
||||
arma_conform_assert_same_size(UA.M.n_rows, UA.M.n_cols, UB.M.n_rows, UB.M.n_cols, "addition");
|
||||
|
||||
return (accu(UA.M) + accu(UB.M));
|
||||
}
|
||||
@@ -905,12 +967,12 @@ inline
|
||||
typename T1::elem_type
|
||||
accu(const SpGlue<T1,T2,spglue_minus>& expr)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
const unwrap_spmat<T1> UA(expr.A);
|
||||
const unwrap_spmat<T2> UB(expr.B);
|
||||
|
||||
arma_debug_assert_same_size(UA.M.n_rows, UA.M.n_cols, UB.M.n_rows, UB.M.n_cols, "subtraction");
|
||||
arma_conform_assert_same_size(UA.M.n_rows, UA.M.n_cols, UB.M.n_rows, UB.M.n_cols, "subtraction");
|
||||
|
||||
return (accu(UA.M) - accu(UB.M));
|
||||
}
|
||||
@@ -924,7 +986,7 @@ inline
|
||||
typename T1::elem_type
|
||||
accu(const SpGlue<T1,T2,spglue_schur>& expr)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
typedef typename T1::elem_type eT;
|
||||
|
||||
@@ -978,19 +1040,16 @@ inline
|
||||
typename T1::elem_type
|
||||
accu(const SpOp<T1, spop_type>& expr)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
typedef typename T1::elem_type eT;
|
||||
|
||||
const bool is_vectorise = \
|
||||
constexpr bool is_vectorise = \
|
||||
(is_same_type<spop_type, spop_vectorise_row>::yes)
|
||||
|| (is_same_type<spop_type, spop_vectorise_col>::yes)
|
||||
|| (is_same_type<spop_type, spop_vectorise_all>::yes);
|
||||
|
||||
if(is_vectorise)
|
||||
{
|
||||
return accu(expr.m);
|
||||
}
|
||||
if(is_vectorise) { return accu(expr.m); }
|
||||
|
||||
const SpMat<eT> tmp = expr;
|
||||
|
||||
@@ -999,4 +1058,136 @@ accu(const SpOp<T1, spop_type>& expr)
|
||||
|
||||
|
||||
|
||||
template<typename T1, typename spop_type>
|
||||
arma_warn_unused
|
||||
inline
|
||||
uword
|
||||
accu(const mtSpOp<uword,T1,spop_type>& X, const typename arma_spop_rel_only<spop_type>::result* junk1 = nullptr, const typename arma_not_cx<typename T1::elem_type>::result* junk2 = nullptr)
|
||||
{
|
||||
arma_debug_sigprint();
|
||||
arma_ignore(junk1);
|
||||
arma_ignore(junk2);
|
||||
|
||||
typedef typename T1::elem_type eT;
|
||||
|
||||
const eT k = X.aux;
|
||||
|
||||
const SpProxy<T1> P(X.m);
|
||||
|
||||
const uword n_zeros = P.get_n_elem() - P.get_n_nonzero();
|
||||
|
||||
const eT zero = eT(0);
|
||||
|
||||
// shortcuts
|
||||
|
||||
if( (is_same_type<spop_type, spop_rel_eq >::yes) && (k == zero) ) { return n_zeros; }
|
||||
if( (is_same_type<spop_type, spop_rel_noteq>::yes) && (k == zero) ) { return P.get_n_nonzero(); }
|
||||
|
||||
// take into account all implicit zeros
|
||||
|
||||
bool use_n_zeros;
|
||||
|
||||
if(is_same_type<spop_type, spop_rel_eq >::yes) { use_n_zeros = (zero == k ); }
|
||||
else if(is_same_type<spop_type, spop_rel_noteq >::yes) { use_n_zeros = (zero != k ); }
|
||||
else if(is_same_type<spop_type, spop_rel_lt_pre >::yes) { use_n_zeros = (k < zero); }
|
||||
else if(is_same_type<spop_type, spop_rel_lt_post >::yes) { use_n_zeros = (zero < k ); }
|
||||
else if(is_same_type<spop_type, spop_rel_gt_pre >::yes) { use_n_zeros = (k > zero); }
|
||||
else if(is_same_type<spop_type, spop_rel_gt_post >::yes) { use_n_zeros = (zero > k ); }
|
||||
else if(is_same_type<spop_type, spop_rel_lteq_pre >::yes) { use_n_zeros = (k <= zero); }
|
||||
else if(is_same_type<spop_type, spop_rel_lteq_post>::yes) { use_n_zeros = (zero <= k ); }
|
||||
else if(is_same_type<spop_type, spop_rel_gteq_pre >::yes) { use_n_zeros = (k >= zero); }
|
||||
else if(is_same_type<spop_type, spop_rel_gteq_post>::yes) { use_n_zeros = (zero >= k ); }
|
||||
else { use_n_zeros = false; }
|
||||
|
||||
uword count = (use_n_zeros) ? n_zeros : 0;
|
||||
|
||||
typename SpProxy<T1>::const_iterator_type it = P.begin();
|
||||
typename SpProxy<T1>::const_iterator_type it_end = P.end();
|
||||
|
||||
// take into account all non-zero elements
|
||||
|
||||
for(; it != it_end; ++it)
|
||||
{
|
||||
const eT val = (*it);
|
||||
|
||||
bool condition;
|
||||
|
||||
if(is_same_type<spop_type, spop_rel_eq >::yes) { condition = (val == k ); }
|
||||
else if(is_same_type<spop_type, spop_rel_noteq >::yes) { condition = (val != k ); }
|
||||
else if(is_same_type<spop_type, spop_rel_lt_pre >::yes) { condition = (k < val); }
|
||||
else if(is_same_type<spop_type, spop_rel_lt_post >::yes) { condition = (val < k ); }
|
||||
else if(is_same_type<spop_type, spop_rel_gt_pre >::yes) { condition = (k > val); }
|
||||
else if(is_same_type<spop_type, spop_rel_gt_post >::yes) { condition = (val > k ); }
|
||||
else if(is_same_type<spop_type, spop_rel_lteq_pre >::yes) { condition = (k <= val); }
|
||||
else if(is_same_type<spop_type, spop_rel_lteq_post>::yes) { condition = (val <= k ); }
|
||||
else if(is_same_type<spop_type, spop_rel_gteq_pre >::yes) { condition = (k >= val); }
|
||||
else if(is_same_type<spop_type, spop_rel_gteq_post>::yes) { condition = (val >= k ); }
|
||||
else { condition = false; }
|
||||
|
||||
count += (condition) ? uword(1) : uword(0);
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename T1, typename spop_type>
|
||||
arma_warn_unused
|
||||
inline
|
||||
uword
|
||||
accu(const mtSpOp<uword,T1,spop_type>& X, const typename arma_spop_rel_only<spop_type>::result* junk1 = nullptr, const typename arma_cx_only<typename T1::elem_type>::result* junk2 = nullptr)
|
||||
{
|
||||
arma_debug_sigprint();
|
||||
arma_ignore(junk1);
|
||||
arma_ignore(junk2);
|
||||
|
||||
typedef typename T1::elem_type eT;
|
||||
|
||||
const eT k = X.aux;
|
||||
|
||||
const SpProxy<T1> P(X.m);
|
||||
|
||||
const uword n_zeros = P.get_n_elem() - P.get_n_nonzero();
|
||||
|
||||
const eT zero = eT(0);
|
||||
|
||||
// shortcuts
|
||||
|
||||
if( (is_same_type<spop_type, spop_rel_eq >::yes) && (k == zero) ) { return n_zeros; }
|
||||
if( (is_same_type<spop_type, spop_rel_noteq>::yes) && (k == zero) ) { return P.get_n_nonzero(); }
|
||||
|
||||
// take into account all implicit zeros
|
||||
|
||||
bool use_n_zeros;
|
||||
|
||||
if(is_same_type<spop_type, spop_rel_eq >::yes) { use_n_zeros = (zero == k); }
|
||||
else if(is_same_type<spop_type, spop_rel_noteq>::yes) { use_n_zeros = (zero != k); }
|
||||
else { use_n_zeros = false; }
|
||||
|
||||
uword count = (use_n_zeros) ? n_zeros : 0;
|
||||
|
||||
typename SpProxy<T1>::const_iterator_type it = P.begin();
|
||||
typename SpProxy<T1>::const_iterator_type it_end = P.end();
|
||||
|
||||
// take into account all non-zero elements
|
||||
|
||||
for(; it != it_end; ++it)
|
||||
{
|
||||
const eT val = (*it);
|
||||
|
||||
bool condition;
|
||||
|
||||
if(is_same_type<spop_type, spop_rel_eq >::yes) { condition = (val == k); }
|
||||
else if(is_same_type<spop_type, spop_rel_noteq>::yes) { condition = (val != k); }
|
||||
else { condition = false; }
|
||||
|
||||
count += (condition) ? uword(1) : uword(0);
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//! @}
|
||||
|
||||
@@ -32,7 +32,7 @@ enable_if2
|
||||
>::result
|
||||
all(const T1& X)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
return op_all::all_vec(X);
|
||||
}
|
||||
@@ -50,7 +50,7 @@ enable_if2
|
||||
>::result
|
||||
all(const T1& X)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
return mtOp<uword, T1, op_all>(X, 0, 0);
|
||||
}
|
||||
@@ -68,7 +68,7 @@ enable_if2
|
||||
>::result
|
||||
all(const T1& X, const uword dim)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
return mtOp<uword, T1, op_all>(X, dim, 0);
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ enable_if2
|
||||
>::result
|
||||
any(const T1& X)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
return op_any::any_vec(X);
|
||||
}
|
||||
@@ -50,7 +50,7 @@ enable_if2
|
||||
>::result
|
||||
any(const T1& X)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
return mtOp<uword, T1, op_any>(X, 0, 0);
|
||||
}
|
||||
@@ -68,7 +68,7 @@ enable_if2
|
||||
>::result
|
||||
any(const T1& X, const uword dim)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
return mtOp<uword, T1, op_any>(X, dim, 0);
|
||||
}
|
||||
|
||||
@@ -103,15 +103,15 @@ internal_approx_equal_worker
|
||||
const typename T1::pod_type rel_tol
|
||||
)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
typedef typename T1::elem_type eT;
|
||||
typedef typename T1::pod_type T;
|
||||
|
||||
arma_debug_check( ((use_abs_diff == false) && (use_rel_diff == false)), "internal_approx_equal_worker(): both 'use_abs_diff' and 'use_rel_diff' are false" );
|
||||
arma_conform_check( ((use_abs_diff == false) && (use_rel_diff == false)), "internal_approx_equal_worker(): both 'use_abs_diff' and 'use_rel_diff' are false" );
|
||||
|
||||
if(use_abs_diff) { arma_debug_check( cond_rel< is_signed<T>::value >::lt(abs_tol, T(0)), "approx_equal(): argument 'abs_tol' must be >= 0" ); }
|
||||
if(use_rel_diff) { arma_debug_check( cond_rel< is_signed<T>::value >::lt(rel_tol, T(0)), "approx_equal(): argument 'rel_tol' must be >= 0" ); }
|
||||
if(use_abs_diff) { arma_conform_check( cond_rel< is_signed<T>::value >::lt(abs_tol, T(0)), "approx_equal(): argument 'abs_tol' must be >= 0" ); }
|
||||
if(use_rel_diff) { arma_conform_check( cond_rel< is_signed<T>::value >::lt(rel_tol, T(0)), "approx_equal(): argument 'rel_tol' must be >= 0" ); }
|
||||
|
||||
const Proxy<T1> PA(A.get_ref());
|
||||
const Proxy<T2> PB(B.get_ref());
|
||||
@@ -196,15 +196,15 @@ internal_approx_equal_worker
|
||||
const typename T1::pod_type rel_tol
|
||||
)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
typedef typename T1::elem_type eT;
|
||||
typedef typename T1::pod_type T;
|
||||
|
||||
arma_debug_check( ((use_abs_diff == false) && (use_rel_diff == false)), "internal_approx_equal_worker(): both 'use_abs_diff' and 'use_rel_diff' are false" );
|
||||
arma_conform_check( ((use_abs_diff == false) && (use_rel_diff == false)), "internal_approx_equal_worker(): both 'use_abs_diff' and 'use_rel_diff' are false" );
|
||||
|
||||
if(use_abs_diff) { arma_debug_check( cond_rel< is_signed<T>::value >::lt(abs_tol, T(0)), "approx_equal(): argument 'abs_tol' must be >= 0" ); }
|
||||
if(use_rel_diff) { arma_debug_check( cond_rel< is_signed<T>::value >::lt(rel_tol, T(0)), "approx_equal(): argument 'rel_tol' must be >= 0" ); }
|
||||
if(use_abs_diff) { arma_conform_check( cond_rel< is_signed<T>::value >::lt(abs_tol, T(0)), "approx_equal(): argument 'abs_tol' must be >= 0" ); }
|
||||
if(use_rel_diff) { arma_conform_check( cond_rel< is_signed<T>::value >::lt(rel_tol, T(0)), "approx_equal(): argument 'rel_tol' must be >= 0" ); }
|
||||
|
||||
const ProxyCube<T1> PA(A.get_ref());
|
||||
const ProxyCube<T2> PB(B.get_ref());
|
||||
@@ -285,13 +285,13 @@ inline
|
||||
bool
|
||||
internal_approx_equal_handler(const T1& A, const T2& B, const char* method, const typename T1::pod_type abs_tol, const typename T1::pod_type rel_tol)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
typedef typename T1::pod_type T;
|
||||
|
||||
const char sig = (method != nullptr) ? method[0] : char(0);
|
||||
|
||||
arma_debug_check( ((sig != 'a') && (sig != 'r') && (sig != 'b')), "approx_equal(): argument 'method' must be \"absdiff\" or \"reldiff\" or \"both\"" );
|
||||
arma_conform_check( ((sig != 'a') && (sig != 'r') && (sig != 'b')), "approx_equal(): argument 'method' must be \"absdiff\" or \"reldiff\" or \"both\"" );
|
||||
|
||||
bool status = false;
|
||||
|
||||
@@ -320,15 +320,15 @@ inline
|
||||
bool
|
||||
internal_approx_equal_handler(const T1& A, const T2& B, const char* method, const typename T1::pod_type tol)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
typedef typename T1::pod_type T;
|
||||
|
||||
const char sig = (method != nullptr) ? method[0] : char(0);
|
||||
|
||||
arma_debug_check( ((sig != 'a') && (sig != 'r') && (sig != 'b')), "approx_equal(): argument 'method' must be \"absdiff\" or \"reldiff\" or \"both\"" );
|
||||
arma_conform_check( ((sig != 'a') && (sig != 'r') && (sig != 'b')), "approx_equal(): argument 'method' must be \"absdiff\" or \"reldiff\" or \"both\"" );
|
||||
|
||||
arma_debug_check( (sig == 'b'), "approx_equal(): argument 'method' is \"both\", but only one 'tol' argument has been given" );
|
||||
arma_conform_check( (sig == 'b'), "approx_equal(): argument 'method' is \"both\", but only one 'tol' argument has been given" );
|
||||
|
||||
bool status = false;
|
||||
|
||||
@@ -353,7 +353,7 @@ inline
|
||||
bool
|
||||
approx_equal(const Base<typename T1::elem_type,T1>& A, const Base<typename T1::elem_type,T2>& B, const char* method, const typename T1::pod_type tol)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
return internal_approx_equal_handler(A.get_ref(), B.get_ref(), method, tol);
|
||||
}
|
||||
@@ -366,7 +366,7 @@ inline
|
||||
bool
|
||||
approx_equal(const BaseCube<typename T1::elem_type,T1>& A, const BaseCube<typename T1::elem_type,T2>& B, const char* method, const typename T1::pod_type tol)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
return internal_approx_equal_handler(A.get_ref(), B.get_ref(), method, tol);
|
||||
}
|
||||
@@ -379,7 +379,7 @@ inline
|
||||
bool
|
||||
approx_equal(const Base<typename T1::elem_type,T1>& A, const Base<typename T1::elem_type,T2>& B, const char* method, const typename T1::pod_type abs_tol, const typename T1::pod_type rel_tol)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
return internal_approx_equal_handler(A.get_ref(), B.get_ref(), method, abs_tol, rel_tol);
|
||||
}
|
||||
@@ -392,7 +392,7 @@ inline
|
||||
bool
|
||||
approx_equal(const BaseCube<typename T1::elem_type,T1>& A, const BaseCube<typename T1::elem_type,T2>& B, const char* method, const typename T1::pod_type abs_tol, const typename T1::pod_type rel_tol)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
return internal_approx_equal_handler(A.get_ref(), B.get_ref(), method, abs_tol, rel_tol);
|
||||
}
|
||||
@@ -405,20 +405,20 @@ inline
|
||||
bool
|
||||
approx_equal(const SpBase<typename T1::elem_type,T1>& A, const SpBase<typename T1::elem_type,T2>& B, const char* method, const typename T1::pod_type tol)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
typedef typename T1::elem_type eT;
|
||||
typedef typename T1::pod_type T;
|
||||
|
||||
const char sig = (method != nullptr) ? method[0] : char(0);
|
||||
|
||||
arma_debug_check( ((sig != 'a') && (sig != 'r') && (sig != 'b')), "approx_equal(): argument 'method' must be \"absdiff\" or \"reldiff\" or \"both\"" );
|
||||
arma_conform_check( ((sig != 'a') && (sig != 'r') && (sig != 'b')), "approx_equal(): argument 'method' must be \"absdiff\" or \"reldiff\" or \"both\"" );
|
||||
|
||||
arma_debug_check( (sig == 'b'), "approx_equal(): argument 'method' is \"both\", but only one 'tol' argument has been given" );
|
||||
arma_conform_check( (sig == 'b'), "approx_equal(): argument 'method' is \"both\", but only one 'tol' argument has been given" );
|
||||
|
||||
arma_debug_check( (sig == 'r'), "approx_equal(): only the \"absdiff\" method is currently implemented for sparse matrices" );
|
||||
arma_conform_check( (sig == 'r'), "approx_equal(): only the \"absdiff\" method is currently implemented for sparse matrices" );
|
||||
|
||||
arma_debug_check( cond_rel< is_signed<T>::value >::lt(tol, T(0)), "approx_equal(): argument 'tol' must be >= 0" );
|
||||
arma_conform_check( cond_rel< is_signed<T>::value >::lt(tol, T(0)), "approx_equal(): argument 'tol' must be >= 0" );
|
||||
|
||||
const unwrap_spmat<T1> UA(A.get_ref());
|
||||
const unwrap_spmat<T2> UB(B.get_ref());
|
||||
@@ -450,18 +450,18 @@ inline
|
||||
bool
|
||||
approx_equal(const SpBase<typename T1::elem_type,T1>& A, const SpBase<typename T1::elem_type,T2>& B, const char* method, const typename T1::pod_type abs_tol, const typename T1::pod_type rel_tol)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
typedef typename T1::pod_type T;
|
||||
|
||||
const char sig = (method != nullptr) ? method[0] : char(0);
|
||||
|
||||
arma_debug_check( ((sig != 'a') && (sig != 'r') && (sig != 'b')), "approx_equal(): argument 'method' must be \"absdiff\" or \"reldiff\" or \"both\"" );
|
||||
arma_conform_check( ((sig != 'a') && (sig != 'r') && (sig != 'b')), "approx_equal(): argument 'method' must be \"absdiff\" or \"reldiff\" or \"both\"" );
|
||||
|
||||
arma_debug_check( ((sig == 'r') || (sig == 'b')), "approx_equal(): only the \"absdiff\" method is currently implemented for sparse matrices" );
|
||||
arma_conform_check( ((sig == 'r') || (sig == 'b')), "approx_equal(): only the \"absdiff\" method is currently implemented for sparse matrices" );
|
||||
|
||||
arma_debug_check( cond_rel< is_signed<T>::value >::lt(abs_tol, T(0)), "approx_equal(): argument 'abs_tol' must be >= 0" );
|
||||
arma_debug_check( cond_rel< is_signed<T>::value >::lt(rel_tol, T(0)), "approx_equal(): argument 'rel_tol' must be >= 0" );
|
||||
arma_conform_check( cond_rel< is_signed<T>::value >::lt(abs_tol, T(0)), "approx_equal(): argument 'abs_tol' must be >= 0" );
|
||||
arma_conform_check( cond_rel< is_signed<T>::value >::lt(rel_tol, T(0)), "approx_equal(): argument 'rel_tol' must be >= 0" );
|
||||
|
||||
return approx_equal(A.get_ref(), B.get_ref(), "abs", abs_tol);
|
||||
}
|
||||
|
||||
@@ -21,6 +21,37 @@
|
||||
|
||||
|
||||
|
||||
struct as_scalar_errmsg
|
||||
{
|
||||
arma_cold
|
||||
arma_noinline
|
||||
static
|
||||
std::string
|
||||
incompat_size_string(const uword n_rows, const uword n_cols)
|
||||
{
|
||||
std::ostringstream tmp;
|
||||
|
||||
tmp << "as_scalar(): expected 1x1 matrix; got " << n_rows << 'x' << n_cols;
|
||||
|
||||
return tmp.str();
|
||||
}
|
||||
|
||||
arma_cold
|
||||
arma_noinline
|
||||
static
|
||||
std::string
|
||||
incompat_size_string(const uword n_rows, const uword n_cols, const uword n_slices)
|
||||
{
|
||||
std::ostringstream tmp;
|
||||
|
||||
tmp << "as_scalar(): expected 1x1x1 cube; got " << n_rows << 'x' << n_cols << 'x' << n_slices;
|
||||
|
||||
return tmp.str();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
template<uword N>
|
||||
struct as_scalar_redirect
|
||||
{
|
||||
@@ -35,6 +66,8 @@ struct as_scalar_redirect<2>
|
||||
{
|
||||
template<typename T1, typename T2>
|
||||
inline static typename T1::elem_type apply(const Glue<T1,T2,glue_times>& X);
|
||||
|
||||
inline static void check_size(const uword A_n_rows, const uword A_n_cols, const uword B_n_rows, const uword B_n_cols);
|
||||
};
|
||||
|
||||
|
||||
@@ -53,11 +86,14 @@ inline
|
||||
typename T1::elem_type
|
||||
as_scalar_redirect<N>::apply(const T1& X)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
const Proxy<T1> P(X);
|
||||
|
||||
arma_debug_check( (P.get_n_elem() != 1), "as_scalar(): expression must evaluate to exactly one element" );
|
||||
if( (arma_config::check_conform) && (P.get_n_elem() != 1) )
|
||||
{
|
||||
arma_conform_check_bounds( true, as_scalar_errmsg::incompat_size_string(P.get_n_rows(), P.get_n_cols()) );
|
||||
}
|
||||
|
||||
return (Proxy<T1>::use_at) ? P.at(0,0) : P[0];
|
||||
}
|
||||
@@ -69,20 +105,21 @@ inline
|
||||
typename T1::elem_type
|
||||
as_scalar_redirect<2>::apply(const Glue<T1, T2, glue_times>& X)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
typedef typename T1::elem_type eT;
|
||||
|
||||
// T1 must result in a matrix with one row
|
||||
// T2 must result in a matrix with one column
|
||||
// element type must non-complex
|
||||
|
||||
const bool has_all_mat = (is_Mat<T1>::value || is_Mat_trans<T1>::value) && (is_Mat<T2>::value || is_Mat_trans<T2>::value);
|
||||
constexpr bool proxy_is_mat = (is_Mat<typename Proxy<T1>::stored_type>::value && is_Mat<typename Proxy<T2>::stored_type>::value);
|
||||
|
||||
const bool use_at = (Proxy<T1>::use_at || Proxy<T2>::use_at);
|
||||
constexpr bool use_at = (Proxy<T1>::use_at) || (Proxy<T2>::use_at);
|
||||
|
||||
const bool do_partial_unwrap = (has_all_mat || use_at);
|
||||
constexpr bool fast_unwrap = (partial_unwrap<T1>::is_fast && partial_unwrap<T2>::is_fast);
|
||||
|
||||
if(do_partial_unwrap)
|
||||
if(proxy_is_mat || use_at || fast_unwrap)
|
||||
{
|
||||
const partial_unwrap<T1> tmp1(X.A);
|
||||
const partial_unwrap<T2> tmp2(X.B);
|
||||
@@ -99,7 +136,10 @@ as_scalar_redirect<2>::apply(const Glue<T1, T2, glue_times>& X)
|
||||
const uword B_n_rows = (tmp2.do_trans == false) ? (TB::is_row ? 1 : B.n_rows) : (TB::is_col ? 1 : B.n_cols);
|
||||
const uword B_n_cols = (tmp2.do_trans == false) ? (TB::is_col ? 1 : B.n_cols) : (TB::is_row ? 1 : B.n_rows);
|
||||
|
||||
arma_debug_check( (A_n_rows != 1) || (B_n_cols != 1) || (A_n_cols != B_n_rows), "as_scalar(): incompatible dimensions" );
|
||||
if( (arma_config::check_conform) && ((A_n_rows != 1) || (B_n_cols != 1) || (A_n_cols != B_n_rows)) )
|
||||
{
|
||||
as_scalar_redirect<2>::check_size(A_n_rows, A_n_cols, B_n_rows, B_n_cols);
|
||||
}
|
||||
|
||||
const eT val = op_dot::direct_dot(A.n_elem, A.memptr(), B.memptr());
|
||||
|
||||
@@ -110,29 +150,46 @@ as_scalar_redirect<2>::apply(const Glue<T1, T2, glue_times>& X)
|
||||
const Proxy<T1> PA(X.A);
|
||||
const Proxy<T2> PB(X.B);
|
||||
|
||||
arma_debug_check
|
||||
(
|
||||
(PA.get_n_rows() != 1) || (PB.get_n_cols() != 1) || (PA.get_n_cols() != PB.get_n_rows()),
|
||||
"as_scalar(): incompatible dimensions"
|
||||
);
|
||||
const uword A_n_rows = PA.get_n_rows();
|
||||
const uword A_n_cols = PA.get_n_cols();
|
||||
|
||||
return op_dot::apply_proxy(PA,PB);
|
||||
const uword B_n_rows = PB.get_n_rows();
|
||||
const uword B_n_cols = PB.get_n_cols();
|
||||
|
||||
if( (arma_config::check_conform) && ((A_n_rows != 1) || (B_n_cols != 1) || (A_n_cols != B_n_rows)) )
|
||||
{
|
||||
as_scalar_redirect<2>::check_size(A_n_rows, A_n_cols, B_n_rows, B_n_cols);
|
||||
}
|
||||
|
||||
return op_dot::apply_proxy_linear(PA,PB);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
inline
|
||||
void
|
||||
as_scalar_redirect<2>::check_size(const uword A_n_rows, const uword A_n_cols, const uword B_n_rows, const uword B_n_cols)
|
||||
{
|
||||
arma_conform_assert_mul_size(A_n_rows, A_n_cols, B_n_rows, B_n_cols, "matrix multiplication");
|
||||
|
||||
arma_conform_check_bounds( ((A_n_rows != 1) || (B_n_cols != 1)), as_scalar_errmsg::incompat_size_string(A_n_rows, B_n_cols) );
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename T1, typename T2, typename T3>
|
||||
inline
|
||||
typename T1::elem_type
|
||||
as_scalar_redirect<3>::apply(const Glue< Glue<T1, T2, glue_times>, T3, glue_times >& X)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
typedef typename T1::elem_type eT;
|
||||
|
||||
// T1 * T2 must result in a matrix with one row
|
||||
// T3 must result in a matrix with one column
|
||||
// element type must non-complex
|
||||
|
||||
typedef typename strip_inv <T2 >::stored_type T2_stripped_1;
|
||||
typedef typename strip_diagmat<T2_stripped_1>::stored_type T2_stripped_2;
|
||||
@@ -140,14 +197,17 @@ as_scalar_redirect<3>::apply(const Glue< Glue<T1, T2, glue_times>, T3, glue_time
|
||||
const strip_inv <T2> strip1(X.A.B);
|
||||
const strip_diagmat<T2_stripped_1> strip2(strip1.M);
|
||||
|
||||
const bool tmp2_do_inv_gen = strip1.do_inv_gen && arma_config::optimise_invexpr;
|
||||
const bool tmp2_do_diagmat = strip2.do_diagmat;
|
||||
constexpr bool tmp2_do_inv_gen = strip1.do_inv_gen && arma_config::optimise_invexpr;
|
||||
constexpr bool tmp2_do_diagmat = strip2.do_diagmat;
|
||||
|
||||
if(tmp2_do_diagmat == false)
|
||||
{
|
||||
const Mat<eT> tmp(X);
|
||||
|
||||
arma_debug_check( (tmp.n_elem != 1), "as_scalar(): expression must evaluate to exactly one element" );
|
||||
if( (arma_config::check_conform) && (tmp.n_elem != 1) )
|
||||
{
|
||||
arma_conform_check_bounds(true, as_scalar_errmsg::incompat_size_string(tmp.n_rows, tmp.n_cols) );
|
||||
}
|
||||
|
||||
return tmp[0];
|
||||
}
|
||||
@@ -174,14 +234,14 @@ as_scalar_redirect<3>::apply(const Glue< Glue<T1, T2, glue_times>, T3, glue_time
|
||||
|
||||
const eT val = tmp1.get_val() * tmp2.get_val() * tmp3.get_val();
|
||||
|
||||
arma_debug_check
|
||||
arma_conform_check_bounds
|
||||
(
|
||||
(A_n_rows != 1) ||
|
||||
(C_n_cols != 1) ||
|
||||
(A_n_cols != B_n_rows) ||
|
||||
(B_n_cols != C_n_rows)
|
||||
,
|
||||
"as_scalar(): incompatible dimensions"
|
||||
"as_scalar(): expected 1x1 matrix"
|
||||
);
|
||||
|
||||
|
||||
@@ -217,14 +277,14 @@ inline
|
||||
typename T1::elem_type
|
||||
as_scalar_diag(const Base<typename T1::elem_type,T1>& X)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
typedef typename T1::elem_type eT;
|
||||
|
||||
const unwrap<T1> tmp(X.get_ref());
|
||||
const Mat<eT>& A = tmp.M;
|
||||
|
||||
arma_debug_check( (A.n_elem != 1), "as_scalar(): expression must evaluate to exactly one element" );
|
||||
arma_conform_check_bounds( (A.n_elem != 1), "as_scalar(): expected 1x1 matrix" );
|
||||
|
||||
return A.mem[0];
|
||||
}
|
||||
@@ -236,7 +296,7 @@ inline
|
||||
typename T1::elem_type
|
||||
as_scalar_diag(const Glue< Glue<T1, T2, glue_times_diag>, T3, glue_times >& X)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
typedef typename T1::elem_type eT;
|
||||
|
||||
@@ -269,14 +329,14 @@ as_scalar_diag(const Glue< Glue<T1, T2, glue_times_diag>, T3, glue_times >& X)
|
||||
|
||||
const eT val = tmp1.get_val() * tmp2.get_val() * tmp3.get_val();
|
||||
|
||||
arma_debug_check
|
||||
arma_conform_check_bounds
|
||||
(
|
||||
(A_n_rows != 1) ||
|
||||
(C_n_cols != 1) ||
|
||||
(A_n_cols != B_n_rows) ||
|
||||
(B_n_cols != C_n_rows)
|
||||
,
|
||||
"as_scalar(): incompatible dimensions"
|
||||
"as_scalar(): expected 1x1 matrix"
|
||||
);
|
||||
|
||||
|
||||
@@ -298,14 +358,14 @@ inline
|
||||
typename T1::elem_type
|
||||
as_scalar(const Glue<T1, T2, glue_times>& X, const typename arma_not_cx<typename T1::elem_type>::result* junk = nullptr)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
arma_ignore(junk);
|
||||
|
||||
if(is_glue_times_diag<T1>::value) { return as_scalar_diag(X); }
|
||||
|
||||
constexpr uword N_mat = 1 + depth_lhs< glue_times, Glue<T1,T2,glue_times> >::num;
|
||||
|
||||
arma_extra_debug_print(arma_str::format("N_mat = %u") % N_mat);
|
||||
arma_debug_print(arma_str::format("N_mat: %u") % N_mat);
|
||||
|
||||
return as_scalar_redirect<N_mat>::apply(X);
|
||||
}
|
||||
@@ -318,11 +378,14 @@ inline
|
||||
typename T1::elem_type
|
||||
as_scalar(const Base<typename T1::elem_type,T1>& X)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
const Proxy<T1> P(X.get_ref());
|
||||
|
||||
arma_debug_check( (P.get_n_elem() != 1), "as_scalar(): expression must evaluate to exactly one element" );
|
||||
if( (arma_config::check_conform) && (P.get_n_elem() != 1) )
|
||||
{
|
||||
arma_conform_check_bounds( true, as_scalar_errmsg::incompat_size_string(P.get_n_rows(), P.get_n_cols()) );
|
||||
}
|
||||
|
||||
return (Proxy<T1>::use_at) ? P.at(0,0) : P[0];
|
||||
}
|
||||
@@ -334,11 +397,14 @@ inline
|
||||
typename T1::elem_type
|
||||
as_scalar(const BaseCube<typename T1::elem_type,T1>& X)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
const ProxyCube<T1> P(X.get_ref());
|
||||
|
||||
arma_debug_check( (P.get_n_elem() != 1), "as_scalar(): expression must evaluate to exactly one element" );
|
||||
if( (arma_config::check_conform) && (P.get_n_elem() != 1) )
|
||||
{
|
||||
arma_conform_check_bounds( true, as_scalar_errmsg::incompat_size_string(P.get_n_rows(), P.get_n_cols(), P.get_n_slices()) );
|
||||
}
|
||||
|
||||
return (ProxyCube<T1>::use_at) ? P.at(0,0,0) : P[0];
|
||||
}
|
||||
@@ -362,12 +428,17 @@ inline
|
||||
typename T1::elem_type
|
||||
as_scalar(const SpBase<typename T1::elem_type, T1>& X)
|
||||
{
|
||||
arma_debug_sigprint();
|
||||
|
||||
typedef typename T1::elem_type eT;
|
||||
|
||||
const unwrap_spmat<T1> tmp(X.get_ref());
|
||||
const SpMat<eT>& A = tmp.M;
|
||||
|
||||
arma_debug_check( (A.n_elem != 1), "as_scalar(): expression must evaluate to exactly one element" );
|
||||
if( (arma_config::check_conform) && (A.n_elem != 1) )
|
||||
{
|
||||
arma_conform_check_bounds(true, as_scalar_errmsg::incompat_size_string(A.n_rows, A.n_cols) );
|
||||
}
|
||||
|
||||
return A.at(0,0);
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ inline
|
||||
double
|
||||
chi2rnd(const double df)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
op_chi2rnd_varying_df<double> generator;
|
||||
|
||||
@@ -41,7 +41,7 @@ inline
|
||||
typename arma_real_only<eT>::result
|
||||
chi2rnd(const eT df)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
op_chi2rnd_varying_df<eT> generator;
|
||||
|
||||
@@ -61,7 +61,7 @@ enable_if2
|
||||
>::result
|
||||
chi2rnd(const T1& expr)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
return Op<T1, op_chi2rnd>(expr);
|
||||
}
|
||||
@@ -79,16 +79,16 @@ enable_if2
|
||||
>::result
|
||||
chi2rnd(const typename obj_type::elem_type df, const uword n_rows, const uword n_cols)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
if(is_Col<obj_type>::value)
|
||||
{
|
||||
arma_debug_check( (n_cols != 1), "chi2rnd(): incompatible size" );
|
||||
arma_conform_check( (n_cols != 1), "chi2rnd(): incompatible size" );
|
||||
}
|
||||
else
|
||||
if(is_Row<obj_type>::value)
|
||||
{
|
||||
arma_debug_check( (n_rows != 1), "chi2rnd(): incompatible size" );
|
||||
arma_conform_check( (n_rows != 1), "chi2rnd(): incompatible size" );
|
||||
}
|
||||
|
||||
obj_type out(n_rows, n_cols, arma_nozeros_indicator());
|
||||
@@ -111,7 +111,7 @@ enable_if2
|
||||
>::result
|
||||
chi2rnd(const typename obj_type::elem_type df, const SizeMat& s)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
return chi2rnd<obj_type>(df, s.n_rows, s.n_cols);
|
||||
}
|
||||
@@ -129,7 +129,7 @@ enable_if2
|
||||
>::result
|
||||
chi2rnd(const typename obj_type::elem_type df, const uword n_elem)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
if(is_Row<obj_type>::value)
|
||||
{
|
||||
@@ -148,7 +148,7 @@ inline
|
||||
mat
|
||||
chi2rnd(const double df, const uword n_rows, const uword n_cols)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
return chi2rnd<mat>(df, n_rows, n_cols);
|
||||
}
|
||||
@@ -160,7 +160,7 @@ inline
|
||||
mat
|
||||
chi2rnd(const double df, const SizeMat& s)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
return chi2rnd<mat>(df, s.n_rows, s.n_cols);
|
||||
}
|
||||
@@ -172,7 +172,7 @@ inline
|
||||
vec
|
||||
chi2rnd(const double df, const uword n_elem)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
return chi2rnd<vec>(df, n_elem, 1);
|
||||
}
|
||||
|
||||
@@ -31,11 +31,11 @@ chol
|
||||
const char* layout = "upper"
|
||||
)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
const char sig = (layout != nullptr) ? layout[0] : char(0);
|
||||
|
||||
arma_debug_check( ((sig != 'u') && (sig != 'l')), "chol(): layout must be \"upper\" or \"lower\"" );
|
||||
arma_conform_check( ((sig != 'u') && (sig != 'l')), "chol(): layout must be \"upper\" or \"lower\"" );
|
||||
|
||||
return Op<T1, op_chol>(X.get_ref(), ((sig == 'u') ? 0 : 1), 0 );
|
||||
}
|
||||
@@ -52,18 +52,18 @@ chol
|
||||
const char* layout = "upper"
|
||||
)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
const char sig = (layout != nullptr) ? layout[0] : char(0);
|
||||
|
||||
arma_debug_check( ((sig != 'u') && (sig != 'l')), "chol(): layout must be \"upper\" or \"lower\"" );
|
||||
arma_conform_check( ((sig != 'u') && (sig != 'l')), "chol(): layout must be \"upper\" or \"lower\"" );
|
||||
|
||||
const bool status = op_chol::apply_direct(out, X.get_ref(), ((sig == 'u') ? 0 : 1));
|
||||
|
||||
if(status == false)
|
||||
{
|
||||
out.soft_reset();
|
||||
arma_debug_warn_level(3, "chol(): decomposition failed");
|
||||
arma_warn(3, "chol(): decomposition failed");
|
||||
}
|
||||
|
||||
return status;
|
||||
@@ -83,19 +83,19 @@ chol
|
||||
const char* P_mode = "matrix"
|
||||
)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
typedef typename T1::elem_type eT;
|
||||
|
||||
const char sig_layout = (layout != nullptr) ? layout[0] : char(0);
|
||||
const char sig_P_mode = (P_mode != nullptr) ? P_mode[0] : char(0);
|
||||
|
||||
arma_debug_check( ((sig_layout != 'u') && (sig_layout != 'l')), "chol(): argument 'layout' must be \"upper\" or \"lower\"" );
|
||||
arma_debug_check( ((sig_P_mode != 'm') && (sig_P_mode != 'v')), "chol(): argument 'P_mode' must be \"vector\" or \"matrix\"" );
|
||||
arma_conform_check( ((sig_layout != 'u') && (sig_layout != 'l')), "chol(): argument 'layout' must be \"upper\" or \"lower\"" );
|
||||
arma_conform_check( ((sig_P_mode != 'm') && (sig_P_mode != 'v')), "chol(): argument 'P_mode' must be \"vector\" or \"matrix\"" );
|
||||
|
||||
out = X.get_ref();
|
||||
|
||||
arma_debug_check( (out.is_square() == false), "chol(): given matrix must be square sized", [&](){ out.soft_reset(); } );
|
||||
arma_conform_check( (out.is_square() == false), "chol(): given matrix must be square sized", [&](){ out.soft_reset(); } );
|
||||
|
||||
if(out.is_empty())
|
||||
{
|
||||
@@ -103,10 +103,10 @@ chol
|
||||
return true;
|
||||
}
|
||||
|
||||
if((arma_config::debug) && (auxlib::rudimentary_sym_check(out) == false))
|
||||
if((arma_config::check_conform) && (auxlib::rudimentary_sym_check(out) == false))
|
||||
{
|
||||
if(is_cx<eT>::no ) { arma_debug_warn_level(1, "chol(): given matrix is not symmetric"); }
|
||||
if(is_cx<eT>::yes) { arma_debug_warn_level(1, "chol(): given matrix is not hermitian"); }
|
||||
if(is_cx<eT>::no ) { arma_warn(1, "chol(): given matrix is not symmetric"); }
|
||||
if(is_cx<eT>::yes) { arma_warn(1, "chol(): given matrix is not hermitian"); }
|
||||
}
|
||||
|
||||
bool status = false;
|
||||
@@ -138,7 +138,7 @@ chol
|
||||
{
|
||||
out.soft_reset();
|
||||
P.soft_reset();
|
||||
arma_debug_warn_level(3, "chol(): decomposition failed");
|
||||
arma_warn(3, "chol(): decomposition failed");
|
||||
}
|
||||
|
||||
return status;
|
||||
|
||||
@@ -32,7 +32,7 @@ enable_if2
|
||||
>::result
|
||||
clamp(const T1& X, const typename T1::elem_type min_val, const typename T1::elem_type max_val)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
return mtOp<typename T1::elem_type, T1, op_clamp>(mtOp_dual_aux_indicator(), X, min_val, max_val);
|
||||
}
|
||||
@@ -50,7 +50,7 @@ enable_if2
|
||||
>::result
|
||||
clamp(const T1& X, const typename T1::elem_type min_val, const typename T1::elem_type max_val)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
return mtOp<typename T1::elem_type, T1, op_clamp_cx>(mtOp_dual_aux_indicator(), X, min_val, max_val);
|
||||
}
|
||||
@@ -63,7 +63,7 @@ inline
|
||||
const mtOpCube<typename T1::elem_type, T1, op_clamp>
|
||||
clamp(const BaseCube<typename T1::elem_type,T1>& X, const typename T1::elem_type min_val, const typename T1::elem_type max_val, typename arma_not_cx<typename T1::elem_type>::result* junk = nullptr)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
arma_ignore(junk);
|
||||
|
||||
return mtOpCube<typename T1::elem_type, T1, op_clamp>(mtOpCube_dual_aux_indicator(), X.get_ref(), min_val, max_val);
|
||||
@@ -77,7 +77,7 @@ inline
|
||||
const mtOpCube<typename T1::elem_type, T1, op_clamp_cx>
|
||||
clamp(const BaseCube<typename T1::elem_type,T1>& X, const typename T1::elem_type min_val, const typename T1::elem_type max_val, typename arma_cx_only<typename T1::elem_type>::result* junk = nullptr)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
arma_ignore(junk);
|
||||
|
||||
return mtOpCube<typename T1::elem_type, T1, op_clamp_cx>(mtOpCube_dual_aux_indicator(), X.get_ref(), min_val, max_val);
|
||||
@@ -91,18 +91,18 @@ inline
|
||||
SpMat<typename T1::elem_type>
|
||||
clamp(const SpBase<typename T1::elem_type,T1>& X, const typename T1::elem_type min_val, const typename T1::elem_type max_val)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
typedef typename T1::elem_type eT;
|
||||
|
||||
if(is_cx<eT>::no)
|
||||
{
|
||||
arma_debug_check( (access::tmp_real(min_val) > access::tmp_real(max_val)), "clamp(): min_val must be less than max_val" );
|
||||
arma_conform_check( (access::tmp_real(min_val) > access::tmp_real(max_val)), "clamp(): min_val must be less than max_val" );
|
||||
}
|
||||
else
|
||||
{
|
||||
arma_debug_check( (access::tmp_real(min_val) > access::tmp_real(max_val)), "clamp(): real(min_val) must be less than real(max_val)" );
|
||||
arma_debug_check( (access::tmp_imag(min_val) > access::tmp_imag(max_val)), "clamp(): imag(min_val) must be less than imag(max_val)" );
|
||||
arma_conform_check( (access::tmp_real(min_val) > access::tmp_real(max_val)), "clamp(): real(min_val) must be less than real(max_val)" );
|
||||
arma_conform_check( (access::tmp_imag(min_val) > access::tmp_imag(max_val)), "clamp(): imag(min_val) must be less than imag(max_val)" );
|
||||
}
|
||||
|
||||
SpMat<eT> out = X.get_ref();
|
||||
|
||||
@@ -27,7 +27,7 @@ inline
|
||||
typename enable_if2<is_supported_blas_type<typename T1::elem_type>::value, typename T1::pod_type>::result
|
||||
cond(const Base<typename T1::elem_type, T1>& X)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
return op_cond::apply(X.get_ref());
|
||||
}
|
||||
@@ -40,7 +40,7 @@ inline
|
||||
typename enable_if2<is_supported_blas_type<typename T1::elem_type>::value, typename T1::pod_type>::result
|
||||
rcond(const Base<typename T1::elem_type, T1>& X)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
return op_rcond::apply(X.get_ref());
|
||||
}
|
||||
@@ -53,7 +53,7 @@ rcond(const Base<typename T1::elem_type, T1>& X)
|
||||
// typename enable_if2<is_supported_blas_type<typename T1::elem_type>::value, typename T1::pod_type>::result
|
||||
// rcond(const SpBase<typename T1::elem_type, T1>& X)
|
||||
// {
|
||||
// arma_extra_debug_sigprint();
|
||||
// arma_debug_sigprint();
|
||||
//
|
||||
// return sp_auxlib::rcond(X.get_ref());
|
||||
// }
|
||||
|
||||
@@ -34,11 +34,11 @@ enable_if2
|
||||
>::result
|
||||
conv(const T1& A, const T2& B, const char* shape = "full")
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
const char sig = (shape != nullptr) ? shape[0] : char(0);
|
||||
|
||||
arma_debug_check( ((sig != 'f') && (sig != 's')), "conv(): unsupported value of 'shape' parameter" );
|
||||
arma_conform_check( ((sig != 'f') && (sig != 's')), "conv(): unsupported value of 'shape' parameter" );
|
||||
|
||||
const uword mode = (sig == 's') ? uword(1) : uword(0);
|
||||
|
||||
@@ -58,11 +58,11 @@ enable_if2
|
||||
>::result
|
||||
conv2(const T1& A, const T2& B, const char* shape = "full")
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
arma_debug_sigprint();
|
||||
|
||||
const char sig = (shape != nullptr) ? shape[0] : char(0);
|
||||
|
||||
arma_debug_check( ((sig != 'f') && (sig != 's')), "conv2(): unsupported value of 'shape' parameter" );
|
||||
arma_conform_check( ((sig != 'f') && (sig != 's')), "conv2(): unsupported value of 'shape' parameter" );
|
||||
|
||||
const uword mode = (sig == 's') ? uword(1) : uword(0);
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user