Skip to content

Commit

Permalink
Armadillo 12.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
eddelbuettel committed Feb 6, 2024
1 parent da81db1 commit 3f920db
Show file tree
Hide file tree
Showing 21 changed files with 669 additions and 97 deletions.
2 changes: 2 additions & 0 deletions inst/include/armadillo
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,7 @@ namespace arma
#include "armadillo_bits/spop_vectorise_bones.hpp"
#include "armadillo_bits/spop_norm_bones.hpp"
#include "armadillo_bits/spop_vecnorm_bones.hpp"
#include "armadillo_bits/spop_shift_bones.hpp"

#include "armadillo_bits/spglue_plus_bones.hpp"
#include "armadillo_bits/spglue_minus_bones.hpp"
Expand Down Expand Up @@ -816,6 +817,7 @@ namespace arma
#include "armadillo_bits/spop_vectorise_meat.hpp"
#include "armadillo_bits/spop_norm_meat.hpp"
#include "armadillo_bits/spop_vecnorm_meat.hpp"
#include "armadillo_bits/spop_shift_meat.hpp"

#include "armadillo_bits/spglue_plus_meat.hpp"
#include "armadillo_bits/spglue_minus_meat.hpp"
Expand Down
7 changes: 7 additions & 0 deletions inst/include/armadillo_bits/arma_config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,13 @@ struct arma_config
#endif


#if defined(ARMA_HAVE_CXX23)
static constexpr bool cxx23 = true;
#else
static constexpr bool cxx23 = false;
#endif


#if (!defined(ARMA_DONT_USE_STD_MUTEX))
static constexpr bool std_mutex = true;
#else
Expand Down
6 changes: 3 additions & 3 deletions inst/include/armadillo_bits/arma_version.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@


#define ARMA_VERSION_MAJOR 12
#define ARMA_VERSION_MINOR 6
#define ARMA_VERSION_PATCH 7
#define ARMA_VERSION_NAME "Cortisol Retox"
#define ARMA_VERSION_MINOR 8
#define ARMA_VERSION_PATCH 0
#define ARMA_VERSION_NAME "Cortisol Injector"



Expand Down
10 changes: 10 additions & 0 deletions inst/include/armadillo_bits/compiler_check.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand All @@ -59,6 +64,11 @@
#define ARMA_HAVE_CXX20
#endif

#if (_MSVC_LANG >= 202302L)
#undef ARMA_HAVE_CXX23
#define ARMA_HAVE_CXX23
#endif

#endif


Expand Down
4 changes: 2 additions & 2 deletions inst/include/armadillo_bits/debug.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,7 @@ 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)
inline
Expand Down Expand Up @@ -1424,6 +1423,7 @@ arma_assert_atlas_size(const T1& A, const T2& B)
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::cxx23 = " << arma_config::cxx23 << '\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';
Expand Down
116 changes: 95 additions & 21 deletions inst/include/armadillo_bits/diskio_meat.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -915,11 +915,18 @@ diskio::save_csv_ascii(const Mat<eT>& x, std::ostream& f, const char separator)
uword x_n_rows = x.n_rows;
uword x_n_cols = x.n_cols;

const eT eT_int_lowest = eT(std::numeric_limits<int>::lowest());
const eT eT_int_max = eT(std::numeric_limits<int>::max());

for(uword row=0; row < x_n_rows; ++row)
{
for(uword col=0; col < x_n_cols; ++col)
{
arma_ostream::raw_print_elem(f, x.at(row,col));
const eT val = x.at(row,col);

const bool is_real_int = (is_real<eT>::yes) && arma_isfinite(val) && (val > eT_int_lowest) && (val < eT_int_max) && (eT(int(val)) == val);

(is_real_int) ? arma_ostream::raw_print_elem(f, int(val)) : arma_ostream::raw_print_elem(f, val);

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

diskio::prepare_stream<eT>(f);

const T T_int_lowest = T(std::numeric_limits<int>::lowest());
const T T_int_max = T(std::numeric_limits<int>::max());

uword x_n_rows = x.n_rows;
uword x_n_cols = x.n_cols;

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

const T tmp_r = std::real(val);
const T tmp_i = std::imag(val);
const T tmp_i_abs = (tmp_i < T(0)) ? T(-tmp_i) : T(tmp_i);
const char tmp_sign = (tmp_i < T(0)) ? char('-') : char('+');
const T val_r = std::real(val);
const T val_i = std::imag(val);
const T abs_i = (val_i < T(0)) ? T(-val_i) : T(val_i);
const char sgn_i = (val_i < T(0)) ? char('-') : char('+');

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);
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);

(val_r_is_real_int) ? arma_ostream::raw_print_elem(f, int(val_r)) : arma_ostream::raw_print_elem(f, val_r);

f.put(sgn_i);

(abs_i_is_real_int) ? arma_ostream::raw_print_elem(f, int(abs_i)) : arma_ostream::raw_print_elem(f, abs_i);

arma_ostream::raw_print_elem(f, tmp_r );
f.put(tmp_sign);
arma_ostream::raw_print_elem(f, tmp_i_abs);
f.put('i');

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

diskio::prepare_stream<eT>(f);

const eT eT_zero = eT(0);
const eT eT_int_lowest = eT(std::numeric_limits<int>::lowest());
const eT eT_int_max = eT(std::numeric_limits<int>::max());

for(uword col=0; col < x.n_cols; ++col)
for(uword row=0; row < x.n_rows; ++row)
{
const eT val = x.at(row,col);

if(val != eT(0))
{
f << row << ' ' << col << ' ' << val << '\n';
}
if(val == eT_zero) { continue; }

f << row; f.put(' ');
f << col; f.put(' ');

const bool is_real_int = (is_real<eT>::yes) && arma_isfinite(val) && (val > eT_int_lowest) && (val < eT_int_max) && (eT(int(val)) == val);

(is_real_int) ? arma_ostream::raw_print_elem(f, int(val)) : arma_ostream::raw_print_elem(f, val);

f.put('\n');
}

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

diskio::prepare_stream<eT>(f);

const eT eT_zero = eT(0);
const eT eT_zero = eT(0);
const T T_int_lowest = T(std::numeric_limits<int>::lowest());
const T T_int_max = T(std::numeric_limits<int>::max());

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

if(val != eT_zero)
{
f << row << ' ' << col << ' ' << val.real() << ' ' << val.imag() << '\n';
}
if(val == eT_zero) { continue; }

f << row; f.put(' ');
f << col; f.put(' ');

const T val_r = std::real(val);
const T val_i = std::imag(val);

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);
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);

(val_r_is_real_int) ? arma_ostream::raw_print_elem(f, int(val_r)) : arma_ostream::raw_print_elem(f, val_r);

f.put(' ');

(val_i_is_real_int) ? arma_ostream::raw_print_elem(f, int(val_i)) : arma_ostream::raw_print_elem(f, val_i);

f.put('\n');
}

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

const eT eT_zero = eT(0);
const eT eT_zero = eT(0);
const eT eT_int_lowest = eT(std::numeric_limits<int>::lowest());
const eT eT_int_max = eT(std::numeric_limits<int>::max());

for(uword row=0; row < x_n_rows; ++row)
{
Expand All @@ -2918,7 +2962,9 @@ diskio::save_csv_ascii(const SpMat<eT>& x, std::ostream& f, const char separator
}
else
{
arma_ostream::raw_print_elem(f, val);
const bool is_real_int = (is_real<eT>::yes) && arma_isfinite(val) && (val > eT_int_lowest) && (val < eT_int_max) && (eT(int(val)) == val);

(is_real_int) ? arma_ostream::raw_print_elem(f, int(val)) : arma_ostream::raw_print_elem(f, val);
}

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

diskio::prepare_stream<eT>(f);

const eT eT_int_lowest = eT(std::numeric_limits<int>::lowest());
const eT eT_int_max = eT(std::numeric_limits<int>::max());

typename SpMat<eT>::const_iterator iter = x.begin();
typename SpMat<eT>::const_iterator iter_end = x.end();

for(; iter != iter_end; ++iter)
{
f << iter.row(); f.put(' ');
f << iter.col(); f.put(' ');

const eT val = (*iter);

f << iter.row() << ' ' << iter.col() << ' ' << val << '\n';
const bool is_real_int = (is_real<eT>::yes) && arma_isfinite(val) && (val > eT_int_lowest) && (val < eT_int_max) && (eT(int(val)) == val);

(is_real_int) ? arma_ostream::raw_print_elem(f, int(val)) : arma_ostream::raw_print_elem(f, val);

f.put('\n');
}


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

diskio::prepare_stream<eT>(f);

const T T_int_lowest = T(std::numeric_limits<int>::lowest());
const T T_int_max = T(std::numeric_limits<int>::max());

typename SpMat<eT>::const_iterator iter = x.begin();
typename SpMat<eT>::const_iterator iter_end = x.end();

for(; iter != iter_end; ++iter)
{
f << iter.row(); f.put(' ');
f << iter.col(); f.put(' ');

const eT val = (*iter);

f << iter.row() << ' ' << iter.col() << ' ' << val.real() << ' ' << val.imag() << '\n';
const T val_r = std::real(val);
const T val_i = std::imag(val);

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);
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);

(val_r_is_real_int) ? arma_ostream::raw_print_elem(f, int(val_r)) : arma_ostream::raw_print_elem(f, val_r);

f.put(' ');

(val_i_is_real_int) ? arma_ostream::raw_print_elem(f, int(val_i)) : arma_ostream::raw_print_elem(f, val_i);

f.put('\n');
}

// make sure it's possible to figure out the matrix size later
Expand Down
4 changes: 4 additions & 0 deletions inst/include/armadillo_bits/eop_aux.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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); }
Expand Down
1 change: 1 addition & 0 deletions inst/include/armadillo_bits/eop_core_bones.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {};
Expand Down
3 changes: 3 additions & 0 deletions inst/include/armadillo_bits/eop_core_meat.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1142,6 +1142,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); }

Expand Down
Loading

0 comments on commit 3f920db

Please sign in to comment.