Skip to content

Commit b364986

Browse files
committed
Sync with Armadillo 14.6.1
1 parent 5f59280 commit b364986

File tree

12 files changed

+49
-48
lines changed

12 files changed

+49
-48
lines changed

inst/include/armadillo_bits/Cube_meat.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2872,7 +2872,7 @@ Cube<eT>::Cube(const eOpCube<T1, eop_type>& X)
28722872

28732873
init_cold();
28742874

2875-
if(is_same_type<eop_type, eop_pow>::value)
2875+
if(arma_config::optimise_powexpr && is_same_type<eop_type, eop_pow>::value)
28762876
{
28772877
constexpr bool eT_non_int = is_non_integral<eT>::value;
28782878

@@ -2902,7 +2902,7 @@ Cube<eT>::operator=(const eOpCube<T1, eop_type>& X)
29022902

29032903
init_warm(X.get_n_rows(), X.get_n_cols(), X.get_n_slices());
29042904

2905-
if(is_same_type<eop_type, eop_pow>::value)
2905+
if(arma_config::optimise_powexpr && is_same_type<eop_type, eop_pow>::value)
29062906
{
29072907
constexpr bool eT_non_int = is_non_integral<eT>::value;
29082908

@@ -2932,7 +2932,7 @@ Cube<eT>::operator+=(const eOpCube<T1, eop_type>& X)
29322932

29332933
if(bad_alias) { const Cube<eT> tmp(X); return (*this).operator+=(tmp); }
29342934

2935-
if(is_same_type<eop_type, eop_pow>::value)
2935+
if(arma_config::optimise_powexpr && is_same_type<eop_type, eop_pow>::value)
29362936
{
29372937
constexpr bool eT_non_int = is_non_integral<eT>::value;
29382938

@@ -2962,7 +2962,7 @@ Cube<eT>::operator-=(const eOpCube<T1, eop_type>& X)
29622962

29632963
if(bad_alias) { const Cube<eT> tmp(X); return (*this).operator-=(tmp); }
29642964

2965-
if(is_same_type<eop_type, eop_pow>::value)
2965+
if(arma_config::optimise_powexpr && is_same_type<eop_type, eop_pow>::value)
29662966
{
29672967
constexpr bool eT_non_int = is_non_integral<eT>::value;
29682968

@@ -2992,7 +2992,7 @@ Cube<eT>::operator%=(const eOpCube<T1, eop_type>& X)
29922992

29932993
if(bad_alias) { const Cube<eT> tmp(X); return (*this).operator%=(tmp); }
29942994

2995-
if(is_same_type<eop_type, eop_pow>::value)
2995+
if(arma_config::optimise_powexpr && is_same_type<eop_type, eop_pow>::value)
29962996
{
29972997
constexpr bool eT_non_int = is_non_integral<eT>::value;
29982998

@@ -3022,7 +3022,7 @@ Cube<eT>::operator/=(const eOpCube<T1, eop_type>& X)
30223022

30233023
if(bad_alias) { const Cube<eT> tmp(X); return (*this).operator/=(tmp); }
30243024

3025-
if(is_same_type<eop_type, eop_pow>::value)
3025+
if(arma_config::optimise_powexpr && is_same_type<eop_type, eop_pow>::value)
30263026
{
30273027
constexpr bool eT_non_int = is_non_integral<eT>::value;
30283028

inst/include/armadillo_bits/Mat_meat.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5201,7 +5201,7 @@ Mat<eT>::Mat(const eOp<T1, eop_type>& X)
52015201

52025202
init_cold();
52035203

5204-
if(is_same_type<eop_type, eop_pow>::value)
5204+
if(arma_config::optimise_powexpr && is_same_type<eop_type, eop_pow>::value)
52055205
{
52065206
constexpr bool eT_non_int = is_non_integral<eT>::value;
52075207

@@ -5231,7 +5231,7 @@ Mat<eT>::operator=(const eOp<T1, eop_type>& X)
52315231

52325232
init_warm(X.get_n_rows(), X.get_n_cols());
52335233

5234-
if(is_same_type<eop_type, eop_pow>::value)
5234+
if(arma_config::optimise_powexpr && is_same_type<eop_type, eop_pow>::value)
52355235
{
52365236
constexpr bool eT_non_int = is_non_integral<eT>::value;
52375237

@@ -5260,7 +5260,7 @@ Mat<eT>::operator+=(const eOp<T1, eop_type>& X)
52605260

52615261
if(bad_alias) { const Mat<eT> tmp(X); return (*this).operator+=(tmp); }
52625262

5263-
if(is_same_type<eop_type, eop_pow>::value)
5263+
if(arma_config::optimise_powexpr && is_same_type<eop_type, eop_pow>::value)
52645264
{
52655265
constexpr bool eT_non_int = is_non_integral<eT>::value;
52665266

@@ -5289,7 +5289,7 @@ Mat<eT>::operator-=(const eOp<T1, eop_type>& X)
52895289

52905290
if(bad_alias) { const Mat<eT> tmp(X); return (*this).operator-=(tmp); }
52915291

5292-
if(is_same_type<eop_type, eop_pow>::value)
5292+
if(arma_config::optimise_powexpr && is_same_type<eop_type, eop_pow>::value)
52935293
{
52945294
constexpr bool eT_non_int = is_non_integral<eT>::value;
52955295

@@ -5335,7 +5335,7 @@ Mat<eT>::operator%=(const eOp<T1, eop_type>& X)
53355335

53365336
if(bad_alias) { const Mat<eT> tmp(X); return (*this).operator%=(tmp); }
53375337

5338-
if(is_same_type<eop_type, eop_pow>::value)
5338+
if(arma_config::optimise_powexpr && is_same_type<eop_type, eop_pow>::value)
53395339
{
53405340
constexpr bool eT_non_int = is_non_integral<eT>::value;
53415341

@@ -5364,7 +5364,7 @@ Mat<eT>::operator/=(const eOp<T1, eop_type>& X)
53645364

53655365
if(bad_alias) { const Mat<eT> tmp(X); return (*this).operator/=(tmp); }
53665366

5367-
if(is_same_type<eop_type, eop_pow>::value)
5367+
if(arma_config::optimise_powexpr && is_same_type<eop_type, eop_pow>::value)
53685368
{
53695369
constexpr bool eT_non_int = is_non_integral<eT>::value;
53705370

inst/include/armadillo_bits/arma_config.hpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,13 @@ struct arma_config
6565
#endif
6666

6767

68+
#if defined(ARMA_OPTIMISE_POWEXPR)
69+
static constexpr bool optimise_powexpr = true;
70+
#else
71+
static constexpr bool optimise_powexpr = false;
72+
#endif
73+
74+
6875
#if defined(ARMA_CHECK_CONFORMANCE)
6976
static constexpr bool check_conform = true;
7077
#else

inst/include/armadillo_bits/arma_version.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
#define ARMA_VERSION_MAJOR 14
2525
#define ARMA_VERSION_MINOR 6
26-
#define ARMA_VERSION_PATCH 0
26+
#define ARMA_VERSION_PATCH 1
2727
#define ARMA_VERSION_NAME "Caffe Mocha"
2828

2929

inst/include/armadillo_bits/compiler_setup.hpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,6 @@
172172
#pragma message("INFO: support for GCC versions older than 8.1 is deprecated")
173173
#endif
174174

175-
#if (ARMA_GCC_VERSION >= 170000)
176-
#undef ARMA_IGNORE_DEPRECATED_MARKER
177-
#endif
178-
179175
#define ARMA_GOOD_COMPILER
180176

181177
#undef arma_hot
@@ -233,12 +229,6 @@
233229

234230
// #pragma message ("using Clang extensions")
235231

236-
#if defined(__clang_major__) && !defined(__apple_build_version__)
237-
#if (__clang_major__ >= 24)
238-
#undef ARMA_IGNORE_DEPRECATED_MARKER
239-
#endif
240-
#endif
241-
242232
#define ARMA_GOOD_COMPILER
243233

244234
#if !defined(__has_attribute)
@@ -487,9 +477,6 @@
487477
#undef major
488478

489479

490-
// WARNING: option 'ARMA_IGNORE_DEPRECATED_MARKER' is not supported when compiling with gcc 17+ or clang 24+
491-
// WARNING: disabling deprecation messages is counter-productive
492-
493480
#if defined(ARMA_IGNORE_DEPRECATED_MARKER)
494481
#undef arma_deprecated
495482
#define arma_deprecated

inst/include/armadillo_bits/config.hpp

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,11 @@
166166
//// of inv() and inv_sympd() within compound expressions
167167
#endif
168168

169+
#if !defined(ARMA_OPTIMISE_POWEXPR)
170+
#define ARMA_OPTIMISE_POWEXPR
171+
//// Comment out the above line to disable optimised handling of pow()
172+
#endif
173+
169174
#if !defined(ARMA_CHECK_CONFORMANCE)
170175
#define ARMA_CHECK_CONFORMANCE
171176
//// Comment out the above line to disable conformance checks for bounds and size.
@@ -211,7 +216,7 @@
211216

212217

213218
#if defined(ARMA_DEFAULT_OSTREAM)
214-
#pragma message ("WARNING: support for ARMA_DEFAULT_OSTREAM is deprecated and will be removed;")
219+
#pragma message ("WARNING: option ARMA_DEFAULT_OSTREAM is deprecated and will be removed;")
215220
#pragma message ("WARNING: use ARMA_COUT_STREAM and ARMA_CERR_STREAM instead")
216221
#endif
217222

@@ -290,7 +295,7 @@
290295

291296
// for compatibility with earlier versions of Armadillo
292297
#if defined(ARMA_DONT_USE_CXX11_MUTEX)
293-
#pragma message ("WARNING: support for ARMA_DONT_USE_CXX11_MUTEX is deprecated and will be removed;")
298+
#pragma message ("WARNING: option ARMA_DONT_USE_CXX11_MUTEX is deprecated and will be removed;")
294299
#pragma message ("WARNING: use ARMA_DONT_USE_STD_MUTEX instead")
295300
#undef ARMA_USE_STD_MUTEX
296301
#endif
@@ -333,6 +338,10 @@
333338
#undef ARMA_OPTIMISE_INVEXPR
334339
#endif
335340

341+
#if defined(ARMA_DONT_OPTIMISE_POWEXPR)
342+
#undef ARMA_OPTIMISE_POWEXPR
343+
#endif
344+
336345
#if defined(ARMA_DONT_CHECK_CONFORMANCE)
337346
#if defined(ARMA_CHECK_CONFORMANCE) && (ARMA_WARN_LEVEL >= 2)
338347
#pragma message ("WARNING: conformance checks disabled")
@@ -378,12 +387,12 @@
378387
#undef ARMA_CRIPPLED_LAPACK
379388
#endif
380389

381-
// WARNING: option ARMA_IGNORE_DEPRECATED_MARKER will be removed
382-
// WARNING: option ARMA_CRIPPLED_LAPACK will be removed
390+
// WARNING: option ARMA_IGNORE_DEPRECATED_MARKER is deprecated and will be removed
391+
// WARNING: option ARMA_CRIPPLED_LAPACK is deprecated and will be removed
383392

384393
#if defined(ARMA_CRIPPLED_LAPACK)
385394
#if (!defined(ARMA_IGNORE_DEPRECATED_MARKER))
386-
#pragma message ("option ARMA_CRIPPLED_LAPACK is deprecated and will be removed")
395+
#pragma message ("WARNING: option ARMA_CRIPPLED_LAPACK is deprecated and will be removed")
387396
#endif
388397
#endif
389398

inst/include/armadillo_bits/debug.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1441,6 +1441,7 @@ inline void arma_debug_check(bool state, const char* msg) { arma_conform_check(
14411441
out << "\n@ arma_config::optimise_band = " << arma_config::optimise_band;
14421442
out << "\n@ arma_config::optimise_sym = " << arma_config::optimise_sym;
14431443
out << "\n@ arma_config::optimise_invexpr = " << arma_config::optimise_invexpr;
1444+
out << "\n@ arma_config::optimise_powexpr = " << arma_config::optimise_powexpr;
14441445
out << "\n@ arma_config::check_conform = " << arma_config::check_conform;
14451446
out << "\n@ arma_config::check_nonfinite = " << arma_config::check_nonfinite;
14461447
out << "\n@ arma_config::fast_math = " << arma_config::fast_math;

inst/include/armadillo_bits/fn_accu.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -407,14 +407,14 @@ accu(const eOp<T1,eop_pow>& expr)
407407

408408
typedef eOp<T1,eop_pow> expr_type;
409409

410-
if(expr.aux == eT(2))
410+
if(arma_config::optimise_powexpr && (expr.aux == eT(2)))
411411
{
412412
typedef eOp<T1,eop_square> modified_expr_type;
413413

414414
return accu( reinterpret_cast< const modified_expr_type& >(expr) );
415415
}
416416

417-
if((expr.aux == eT(0.5)) && is_non_integral<eT>::value)
417+
if(arma_config::optimise_powexpr && (expr.aux == eT(0.5)) && is_non_integral<eT>::value)
418418
{
419419
typedef eOp<T1,eop_sqrt> modified_expr_type;
420420

@@ -1048,14 +1048,14 @@ accu(const eOpCube<T1,eop_pow>& expr)
10481048

10491049
typedef eOpCube<T1,eop_pow> expr_type;
10501050

1051-
if(expr.aux == eT(2))
1051+
if(arma_config::optimise_powexpr && (expr.aux == eT(2)))
10521052
{
10531053
typedef eOpCube<T1,eop_square> modified_expr_type;
10541054

10551055
return accu( reinterpret_cast< const modified_expr_type& >(expr) );
10561056
}
10571057

1058-
if((expr.aux == eT(0.5)) && is_non_integral<eT>::value)
1058+
if(arma_config::optimise_powexpr && (expr.aux == eT(0.5)) && is_non_integral<eT>::value)
10591059
{
10601060
typedef eOpCube<T1,eop_sqrt> modified_expr_type;
10611061

inst/include/armadillo_bits/fn_conv_to.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,19 @@ class conv_to
2929
public:
3030

3131
template<typename in_eT>
32-
arma_frown("use as_scalar() instead") inline static out_eT from(const in_eT& in, const typename arma_scalar_only<in_eT>::result* junk = nullptr);
32+
arma_frown("replace conv_to<...>::from(X) with as_scalar(X)") inline static out_eT from(const in_eT& in, const typename arma_scalar_only<in_eT>::result* junk = nullptr);
3333

3434
template<typename in_eT, typename T1>
35-
arma_frown("use as_scalar() instead") inline static out_eT from(const Base<in_eT, T1>& in, const typename arma_not_cx<in_eT>::result* junk = nullptr);
35+
arma_frown("replace conv_to<...>::from(X) with as_scalar(X)") inline static out_eT from(const Base<in_eT, T1>& in, const typename arma_not_cx<in_eT>::result* junk = nullptr);
3636

3737
template<typename in_eT, typename T1>
38-
arma_frown("use as_scalar() instead") inline static out_eT from(const Base<in_eT, T1>& in, const typename arma_cx_only<in_eT>::result* junk = nullptr);
38+
arma_frown("replace conv_to<...>::from(X) with as_scalar(X)") inline static out_eT from(const Base<in_eT, T1>& in, const typename arma_cx_only<in_eT>::result* junk = nullptr);
3939

4040
template<typename in_eT, typename T1>
41-
arma_frown("use as_scalar() instead") inline static out_eT from(const BaseCube<in_eT, T1>& in, const typename arma_not_cx<in_eT>::result* junk = nullptr);
41+
arma_frown("replace conv_to<...>::from(X) with as_scalar(X)") inline static out_eT from(const BaseCube<in_eT, T1>& in, const typename arma_not_cx<in_eT>::result* junk = nullptr);
4242

4343
template<typename in_eT, typename T1>
44-
arma_frown("use as_scalar() instead") inline static out_eT from(const BaseCube<in_eT, T1>& in, const typename arma_cx_only<in_eT>::result* junk = nullptr);
44+
arma_frown("replace conv_to<...>::from(X) with as_scalar(X)") inline static out_eT from(const BaseCube<in_eT, T1>& in, const typename arma_cx_only<in_eT>::result* junk = nullptr);
4545
};
4646

4747

inst/include/armadillo_bits/op_mean_meat.hpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,7 @@ op_mean::apply_noalias(Mat<eT>& out, const Mat<eT>& X, const uword dim)
8888

8989
for(uword col=0; col < X_n_cols; ++col)
9090
{
91-
const eT* col_mem = X.colptr(col);
92-
93-
for(uword row=0; row < X_n_rows; ++row) { out_mem[row] += col_mem[row]; }
91+
arrayops::inplace_plus(out_mem, X.colptr(col), X_n_rows);
9492
}
9593

9694
out /= T(X_n_cols);
@@ -193,9 +191,7 @@ op_mean::apply_noalias(Cube<eT>& out, const Cube<eT>& X, const uword dim)
193191

194192
for(uword col=0; col < X_n_cols; ++col)
195193
{
196-
const eT* col_mem = X.slice_colptr(slice,col);
197-
198-
for(uword row=0; row < X_n_rows; ++row) { out_mem[row] += col_mem[row]; }
194+
arrayops::inplace_plus(out_mem, X.slice_colptr(slice,col), X_n_rows);
199195
}
200196

201197
for(uword row=0; row < X_n_rows; ++row) { out_mem[row] /= T(X_n_cols); }

0 commit comments

Comments
 (0)