Skip to content

Commit 3f920db

Browse files
committed
Armadillo 12.8.0
1 parent da81db1 commit 3f920db

21 files changed

+669
-97
lines changed

inst/include/armadillo

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,7 @@ namespace arma
369369
#include "armadillo_bits/spop_vectorise_bones.hpp"
370370
#include "armadillo_bits/spop_norm_bones.hpp"
371371
#include "armadillo_bits/spop_vecnorm_bones.hpp"
372+
#include "armadillo_bits/spop_shift_bones.hpp"
372373

373374
#include "armadillo_bits/spglue_plus_bones.hpp"
374375
#include "armadillo_bits/spglue_minus_bones.hpp"
@@ -816,6 +817,7 @@ namespace arma
816817
#include "armadillo_bits/spop_vectorise_meat.hpp"
817818
#include "armadillo_bits/spop_norm_meat.hpp"
818819
#include "armadillo_bits/spop_vecnorm_meat.hpp"
820+
#include "armadillo_bits/spop_shift_meat.hpp"
819821

820822
#include "armadillo_bits/spglue_plus_meat.hpp"
821823
#include "armadillo_bits/spglue_minus_meat.hpp"

inst/include/armadillo_bits/arma_config.hpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,13 @@ struct arma_config
181181
#endif
182182

183183

184+
#if defined(ARMA_HAVE_CXX23)
185+
static constexpr bool cxx23 = true;
186+
#else
187+
static constexpr bool cxx23 = false;
188+
#endif
189+
190+
184191
#if (!defined(ARMA_DONT_USE_STD_MUTEX))
185192
static constexpr bool std_mutex = true;
186193
#else

inst/include/armadillo_bits/arma_version.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@
2222

2323

2424
#define ARMA_VERSION_MAJOR 12
25-
#define ARMA_VERSION_MINOR 6
26-
#define ARMA_VERSION_PATCH 7
27-
#define ARMA_VERSION_NAME "Cortisol Retox"
25+
#define ARMA_VERSION_MINOR 8
26+
#define ARMA_VERSION_PATCH 0
27+
#define ARMA_VERSION_NAME "Cortisol Injector"
2828

2929

3030

inst/include/armadillo_bits/compiler_check.hpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#undef ARMA_HAVE_CXX14
2121
#undef ARMA_HAVE_CXX17
2222
#undef ARMA_HAVE_CXX20
23+
#undef ARMA_HAVE_CXX23
2324

2425
#if (__cplusplus >= 201103L)
2526
#define ARMA_HAVE_CXX11
@@ -37,6 +38,10 @@
3738
#define ARMA_HAVE_CXX20
3839
#endif
3940

41+
#if (__cplusplus >= 202302L)
42+
#define ARMA_HAVE_CXX23
43+
#endif
44+
4045

4146
// MS really can't get its proverbial shit together
4247
#if defined(_MSVC_LANG)
@@ -59,6 +64,11 @@
5964
#define ARMA_HAVE_CXX20
6065
#endif
6166

67+
#if (_MSVC_LANG >= 202302L)
68+
#undef ARMA_HAVE_CXX23
69+
#define ARMA_HAVE_CXX23
70+
#endif
71+
6272
#endif
6373

6474

inst/include/armadillo_bits/debug.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,8 +263,7 @@ arma_print(const T1& x, const T2& y, const T3& z)
263263
//
264264
// arma_sigprint
265265

266-
//! print a message to the log stream with a preceding @ character.
267-
//! by default the log stream is cout.
266+
//! print a message to the cerr stream with a preceding @ character.
268267
//! used for printing the signature of a function
269268
//! (see the arma_extra_debug_sigprint macro)
270269
inline
@@ -1424,6 +1423,7 @@ arma_assert_atlas_size(const T1& A, const T2& B)
14241423
out << "@ arma_config::cxx14 = " << arma_config::cxx14 << '\n';
14251424
out << "@ arma_config::cxx17 = " << arma_config::cxx17 << '\n';
14261425
out << "@ arma_config::cxx20 = " << arma_config::cxx20 << '\n';
1426+
out << "@ arma_config::cxx23 = " << arma_config::cxx23 << '\n';
14271427
out << "@ arma_config::std_mutex = " << arma_config::std_mutex << '\n';
14281428
out << "@ arma_config::posix = " << arma_config::posix << '\n';
14291429
out << "@ arma_config::openmp = " << arma_config::openmp << '\n';

inst/include/armadillo_bits/diskio_meat.hpp

Lines changed: 95 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -915,11 +915,18 @@ diskio::save_csv_ascii(const Mat<eT>& x, std::ostream& f, const char separator)
915915
uword x_n_rows = x.n_rows;
916916
uword x_n_cols = x.n_cols;
917917

918+
const eT eT_int_lowest = eT(std::numeric_limits<int>::lowest());
919+
const eT eT_int_max = eT(std::numeric_limits<int>::max());
920+
918921
for(uword row=0; row < x_n_rows; ++row)
919922
{
920923
for(uword col=0; col < x_n_cols; ++col)
921924
{
922-
arma_ostream::raw_print_elem(f, x.at(row,col));
925+
const eT val = x.at(row,col);
926+
927+
const bool is_real_int = (is_real<eT>::yes) && arma_isfinite(val) && (val > eT_int_lowest) && (val < eT_int_max) && (eT(int(val)) == val);
928+
929+
(is_real_int) ? arma_ostream::raw_print_elem(f, int(val)) : arma_ostream::raw_print_elem(f, val);
923930

924931
if( col < (x_n_cols-1) ) { f.put(separator); }
925932
}
@@ -950,6 +957,9 @@ diskio::save_csv_ascii(const Mat< std::complex<T> >& x, std::ostream& f, const c
950957

951958
diskio::prepare_stream<eT>(f);
952959

960+
const T T_int_lowest = T(std::numeric_limits<int>::lowest());
961+
const T T_int_max = T(std::numeric_limits<int>::max());
962+
953963
uword x_n_rows = x.n_rows;
954964
uword x_n_cols = x.n_cols;
955965

@@ -959,14 +969,20 @@ diskio::save_csv_ascii(const Mat< std::complex<T> >& x, std::ostream& f, const c
959969
{
960970
const eT& val = x.at(row,col);
961971

962-
const T tmp_r = std::real(val);
963-
const T tmp_i = std::imag(val);
964-
const T tmp_i_abs = (tmp_i < T(0)) ? T(-tmp_i) : T(tmp_i);
965-
const char tmp_sign = (tmp_i < T(0)) ? char('-') : char('+');
972+
const T val_r = std::real(val);
973+
const T val_i = std::imag(val);
974+
const T abs_i = (val_i < T(0)) ? T(-val_i) : T(val_i);
975+
const char sgn_i = (val_i < T(0)) ? char('-') : char('+');
976+
977+
const bool val_r_is_real_int = (is_real<T>::yes) && arma_isfinite(val_r) && (val_r > T_int_lowest) && (val_r < T_int_max) && (T(int(val_r)) == val_r);
978+
const bool abs_i_is_real_int = (is_real<T>::yes) && arma_isfinite(abs_i) && (abs_i < T_int_max) && (T(int(abs_i)) == abs_i);
979+
980+
(val_r_is_real_int) ? arma_ostream::raw_print_elem(f, int(val_r)) : arma_ostream::raw_print_elem(f, val_r);
981+
982+
f.put(sgn_i);
983+
984+
(abs_i_is_real_int) ? arma_ostream::raw_print_elem(f, int(abs_i)) : arma_ostream::raw_print_elem(f, abs_i);
966985

967-
arma_ostream::raw_print_elem(f, tmp_r );
968-
f.put(tmp_sign);
969-
arma_ostream::raw_print_elem(f, tmp_i_abs);
970986
f.put('i');
971987

972988
if( col < (x_n_cols-1) ) { f.put(separator); }
@@ -1025,15 +1041,25 @@ diskio::save_coord_ascii(const Mat<eT>& x, std::ostream& f)
10251041

10261042
diskio::prepare_stream<eT>(f);
10271043

1044+
const eT eT_zero = eT(0);
1045+
const eT eT_int_lowest = eT(std::numeric_limits<int>::lowest());
1046+
const eT eT_int_max = eT(std::numeric_limits<int>::max());
1047+
10281048
for(uword col=0; col < x.n_cols; ++col)
10291049
for(uword row=0; row < x.n_rows; ++row)
10301050
{
10311051
const eT val = x.at(row,col);
10321052

1033-
if(val != eT(0))
1034-
{
1035-
f << row << ' ' << col << ' ' << val << '\n';
1036-
}
1053+
if(val == eT_zero) { continue; }
1054+
1055+
f << row; f.put(' ');
1056+
f << col; f.put(' ');
1057+
1058+
const bool is_real_int = (is_real<eT>::yes) && arma_isfinite(val) && (val > eT_int_lowest) && (val < eT_int_max) && (eT(int(val)) == val);
1059+
1060+
(is_real_int) ? arma_ostream::raw_print_elem(f, int(val)) : arma_ostream::raw_print_elem(f, val);
1061+
1062+
f.put('\n');
10371063
}
10381064

10391065
// make sure it's possible to figure out the matrix size later
@@ -1070,17 +1096,33 @@ diskio::save_coord_ascii(const Mat< std::complex<T> >& x, std::ostream& f)
10701096

10711097
diskio::prepare_stream<eT>(f);
10721098

1073-
const eT eT_zero = eT(0);
1099+
const eT eT_zero = eT(0);
1100+
const T T_int_lowest = T(std::numeric_limits<int>::lowest());
1101+
const T T_int_max = T(std::numeric_limits<int>::max());
10741102

10751103
for(uword col=0; col < x.n_cols; ++col)
10761104
for(uword row=0; row < x.n_rows; ++row)
10771105
{
10781106
const eT& val = x.at(row,col);
10791107

1080-
if(val != eT_zero)
1081-
{
1082-
f << row << ' ' << col << ' ' << val.real() << ' ' << val.imag() << '\n';
1083-
}
1108+
if(val == eT_zero) { continue; }
1109+
1110+
f << row; f.put(' ');
1111+
f << col; f.put(' ');
1112+
1113+
const T val_r = std::real(val);
1114+
const T val_i = std::imag(val);
1115+
1116+
const bool val_r_is_real_int = (is_real<T>::yes) && arma_isfinite(val_r) && (val_r > T_int_lowest) && (val_r < T_int_max) && (T(int(val_r)) == val_r);
1117+
const bool val_i_is_real_int = (is_real<T>::yes) && arma_isfinite(val_i) && (val_i > T_int_lowest) && (val_i < T_int_max) && (T(int(val_i)) == val_i);
1118+
1119+
(val_r_is_real_int) ? arma_ostream::raw_print_elem(f, int(val_r)) : arma_ostream::raw_print_elem(f, val_r);
1120+
1121+
f.put(' ');
1122+
1123+
(val_i_is_real_int) ? arma_ostream::raw_print_elem(f, int(val_i)) : arma_ostream::raw_print_elem(f, val_i);
1124+
1125+
f.put('\n');
10841126
}
10851127

10861128
// make sure it's possible to figure out the matrix size later
@@ -2904,7 +2946,9 @@ diskio::save_csv_ascii(const SpMat<eT>& x, std::ostream& f, const char separator
29042946
uword x_n_rows = x.n_rows;
29052947
uword x_n_cols = x.n_cols;
29062948

2907-
const eT eT_zero = eT(0);
2949+
const eT eT_zero = eT(0);
2950+
const eT eT_int_lowest = eT(std::numeric_limits<int>::lowest());
2951+
const eT eT_int_max = eT(std::numeric_limits<int>::max());
29082952

29092953
for(uword row=0; row < x_n_rows; ++row)
29102954
{
@@ -2918,7 +2962,9 @@ diskio::save_csv_ascii(const SpMat<eT>& x, std::ostream& f, const char separator
29182962
}
29192963
else
29202964
{
2921-
arma_ostream::raw_print_elem(f, val);
2965+
const bool is_real_int = (is_real<eT>::yes) && arma_isfinite(val) && (val > eT_int_lowest) && (val < eT_int_max) && (eT(int(val)) == val);
2966+
2967+
(is_real_int) ? arma_ostream::raw_print_elem(f, int(val)) : arma_ostream::raw_print_elem(f, val);
29222968
}
29232969

29242970
if( col < (x_n_cols-1) ) { f.put(separator); }
@@ -2998,14 +3044,24 @@ diskio::save_coord_ascii(const SpMat<eT>& x, std::ostream& f)
29983044

29993045
diskio::prepare_stream<eT>(f);
30003046

3047+
const eT eT_int_lowest = eT(std::numeric_limits<int>::lowest());
3048+
const eT eT_int_max = eT(std::numeric_limits<int>::max());
3049+
30013050
typename SpMat<eT>::const_iterator iter = x.begin();
30023051
typename SpMat<eT>::const_iterator iter_end = x.end();
30033052

30043053
for(; iter != iter_end; ++iter)
30053054
{
3055+
f << iter.row(); f.put(' ');
3056+
f << iter.col(); f.put(' ');
3057+
30063058
const eT val = (*iter);
30073059

3008-
f << iter.row() << ' ' << iter.col() << ' ' << val << '\n';
3060+
const bool is_real_int = (is_real<eT>::yes) && arma_isfinite(val) && (val > eT_int_lowest) && (val < eT_int_max) && (eT(int(val)) == val);
3061+
3062+
(is_real_int) ? arma_ostream::raw_print_elem(f, int(val)) : arma_ostream::raw_print_elem(f, val);
3063+
3064+
f.put('\n');
30093065
}
30103066

30113067

@@ -3044,14 +3100,32 @@ diskio::save_coord_ascii(const SpMat< std::complex<T> >& x, std::ostream& f)
30443100

30453101
diskio::prepare_stream<eT>(f);
30463102

3103+
const T T_int_lowest = T(std::numeric_limits<int>::lowest());
3104+
const T T_int_max = T(std::numeric_limits<int>::max());
3105+
30473106
typename SpMat<eT>::const_iterator iter = x.begin();
30483107
typename SpMat<eT>::const_iterator iter_end = x.end();
30493108

30503109
for(; iter != iter_end; ++iter)
30513110
{
3111+
f << iter.row(); f.put(' ');
3112+
f << iter.col(); f.put(' ');
3113+
30523114
const eT val = (*iter);
30533115

3054-
f << iter.row() << ' ' << iter.col() << ' ' << val.real() << ' ' << val.imag() << '\n';
3116+
const T val_r = std::real(val);
3117+
const T val_i = std::imag(val);
3118+
3119+
const bool val_r_is_real_int = (is_real<T>::yes) && arma_isfinite(val_r) && (val_r > T_int_lowest) && (val_r < T_int_max) && (T(int(val_r)) == val_r);
3120+
const bool val_i_is_real_int = (is_real<T>::yes) && arma_isfinite(val_i) && (val_i > T_int_lowest) && (val_i < T_int_max) && (T(int(val_i)) == val_i);
3121+
3122+
(val_r_is_real_int) ? arma_ostream::raw_print_elem(f, int(val_r)) : arma_ostream::raw_print_elem(f, val_r);
3123+
3124+
f.put(' ');
3125+
3126+
(val_i_is_real_int) ? arma_ostream::raw_print_elem(f, int(val_i)) : arma_ostream::raw_print_elem(f, val_i);
3127+
3128+
f.put('\n');
30553129
}
30563130

30573131
// make sure it's possible to figure out the matrix size later

inst/include/armadillo_bits/eop_aux.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,10 @@ class eop_aux
116116
template<typename eT> arma_inline static typename arma_real_only<eT>::result arma_abs (const eT x) { return std::abs(x); }
117117
template<typename T> arma_inline static typename arma_real_only< T>::result arma_abs (const std::complex<T>& x) { return std::abs(x); }
118118

119+
template<typename eT> arma_inline static typename arma_integral_only<eT>::result cbrt (const eT x) { return eT( std::cbrt(double(x)) ); }
120+
template<typename eT> arma_inline static typename arma_real_only<eT>::result cbrt (const eT x) { return std::cbrt(x); }
121+
template<typename eT> arma_inline static typename arma_cx_only<eT>::result cbrt (const eT& x) { arma_ignore(x); return eT(0); }
122+
119123
template<typename eT> arma_inline static typename arma_integral_only<eT>::result erf (const eT x) { return eT( std::erf(double(x)) ); }
120124
template<typename eT> arma_inline static typename arma_real_only<eT>::result erf (const eT x) { return std::erf(x); }
121125
template<typename eT> arma_inline static typename arma_cx_only<eT>::result erf (const eT& x) { arma_ignore(x); return eT(0); }

inst/include/armadillo_bits/eop_core_bones.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ class eop_ceil : public eop_core<eop_ceil> , public eo
9898
class eop_round : public eop_core<eop_round> , public eop_use_mp_false {};
9999
class eop_trunc : public eop_core<eop_trunc> , public eop_use_mp_false {};
100100
class eop_sign : public eop_core<eop_sign> , public eop_use_mp_false {};
101+
class eop_cbrt : public eop_core<eop_cbrt> , public eop_use_mp_true {};
101102
class eop_erf : public eop_core<eop_erf> , public eop_use_mp_true {};
102103
class eop_erfc : public eop_core<eop_erfc> , public eop_use_mp_true {};
103104
class eop_lgamma : public eop_core<eop_lgamma> , public eop_use_mp_true {};

inst/include/armadillo_bits/eop_core_meat.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1142,6 +1142,9 @@ eop_core<eop_trunc >::process(const eT val, const eT ) { return eop_
11421142
template<> template<typename eT> arma_inline eT
11431143
eop_core<eop_sign >::process(const eT val, const eT ) { return arma_sign(val); }
11441144

1145+
template<> template<typename eT> arma_inline eT
1146+
eop_core<eop_cbrt >::process(const eT val, const eT ) { return eop_aux::cbrt(val); }
1147+
11451148
template<> template<typename eT> arma_inline eT
11461149
eop_core<eop_erf >::process(const eT val, const eT ) { return eop_aux::erf(val); }
11471150

0 commit comments

Comments
 (0)