Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
2025-08-08 Dirk Eddelbuettel <edd@debian.org>

* inst/include/armadillo_bits/: Armadillo 14.6.2

2025-07-22 Dirk Eddelbuettel <edd@debian.org>

* .github/workflows/ci.yaml: Comment-out coverage
Expand Down
2 changes: 1 addition & 1 deletion inst/include/armadillo_bits/arma_version.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

#define ARMA_VERSION_MAJOR 14
#define ARMA_VERSION_MINOR 6
#define ARMA_VERSION_PATCH 1
#define ARMA_VERSION_PATCH 2
#define ARMA_VERSION_NAME "Caffe Mocha"


Expand Down
4 changes: 2 additions & 2 deletions inst/include/armadillo_bits/op_omit_meat.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ op_omit::apply(Mat<typename T1::elem_type>& out, const T1& X, functor is_omitted

typedef typename T1::elem_type eT;

if(is_Mat<T1>::value || is_subview_col<T1>::value || is_Mat<typename Proxy<T1>::stored_type>::value || Proxy<T1>::use_mp)
if(is_Mat<T1>::value || is_subview_col<T1>::value || is_Mat<typename Proxy<T1>::stored_type>::value || (arma_config::openmp && Proxy<T1>::use_mp))
{
const quasi_unwrap<T1> U(X);

Expand Down Expand Up @@ -160,7 +160,7 @@ op_omit_cube::apply(Mat<typename T1::elem_type>& out, const T1& X, functor is_om

typedef typename T1::elem_type eT;

if(is_Cube<T1>::value || is_Cube<typename ProxyCube<T1>::stored_type>::value || ProxyCube<T1>::use_mp)
if(is_Cube<T1>::value || is_Cube<typename ProxyCube<T1>::stored_type>::value || (arma_config::openmp && ProxyCube<T1>::use_mp))
{
const unwrap_cube<T1> U(X);

Expand Down
7 changes: 5 additions & 2 deletions inst/include/armadillo_bits/op_sum_bones.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,13 @@ class op_sum

template<typename T1>
inline static void apply(Mat<typename T1::elem_type>& out, const Op< eOp<T1,eop_square>, op_sum >& in);

template<typename T1>
inline static void apply(Mat<typename T1::elem_type>& out, const Op< eOp<T1,eop_pow >, op_sum >& in);


template<typename T1>
inline static void apply_generic(Mat<typename T1::elem_type>& out, const Op<T1,op_sum>& in);

template<typename eT>
inline static void apply_mat_noalias(Mat<eT>& out, const Mat<eT>& X, const uword dim);

Expand Down
106 changes: 23 additions & 83 deletions inst/include/armadillo_bits/op_sum_meat.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,46 +28,7 @@ op_sum::apply(Mat<typename T1::elem_type>& out, const Op<T1,op_sum>& in)
{
arma_debug_sigprint();

typedef typename T1::elem_type eT;

const uword dim = in.aux_uword_a;

arma_conform_check( (dim > 1), "sum(): parameter 'dim' must be 0 or 1" );

if((is_Mat<T1>::value) || (is_Mat<typename Proxy<T1>::stored_type>::value) || (arma_config::openmp && Proxy<T1>::use_mp))
{
const quasi_unwrap<T1> U(in.m);

if(U.is_alias(out))
{
Mat<eT> tmp;

op_sum::apply_mat_noalias(tmp, U.M, dim);

out.steal_mem(tmp);
}
else
{
op_sum::apply_mat_noalias(out, U.M, dim);
}
}
else
{
const Proxy<T1> P(in.m);

if(P.is_alias(out))
{
Mat<eT> tmp;

op_sum::apply_proxy_noalias(tmp, P, dim);

out.steal_mem(tmp);
}
else
{
op_sum::apply_proxy_noalias(out, P, dim);
}
}
op_sum::apply_generic(out, in);
}


Expand All @@ -85,12 +46,12 @@ op_sum::apply(Mat<typename T1::elem_type>& out, const Op< eOp<T1,eop_square>, op

typedef typename inner_expr_type::proxy_type::stored_type inner_expr_P_stored_type;

const uword dim = in.aux_uword_a;

arma_conform_check( (dim > 1), "sum(): parameter 'dim' must be 0 or 1" );

if(is_Mat<inner_expr_P_stored_type>::value)
{
const uword dim = in.aux_uword_a;

arma_conform_check( (dim > 1), "sum(): parameter 'dim' must be 0 or 1" );

const quasi_unwrap<inner_expr_P_stored_type> U(in.m.P.Q);

if(U.is_alias(out))
Expand All @@ -105,42 +66,11 @@ op_sum::apply(Mat<typename T1::elem_type>& out, const Op< eOp<T1,eop_square>, op
{
op_sum::apply_mat_square_noalias(out, U.M, dim);
}
}
else
if(arma_config::openmp && Proxy<inner_expr_type>::use_mp)
{
const quasi_unwrap<inner_expr_type> U(in.m); // force evaluation of compound inner expression

if(U.is_alias(out))
{
Mat<eT> tmp;

op_sum::apply_mat_noalias(tmp, U.M, dim);

out.steal_mem(tmp);
}
else
{
op_sum::apply_mat_noalias(out, U.M, dim);
}
}
else
{
const Proxy<inner_expr_type> P(in.m);

if(P.is_alias(out))
{
Mat<eT> tmp;

op_sum::apply_proxy_noalias(tmp, P, dim);

out.steal_mem(tmp);
}
else
{
op_sum::apply_proxy_noalias(out, P, dim);
}
return;
}

op_sum::apply_generic(out, in);
Copy link

Copilot AI Aug 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The early return statement at line 70 creates an asymmetric control flow. Consider restructuring this as an if-else block to make the logic clearer and maintain consistent structure with the refactored generic approach.

Copilot uses AI. Check for mistakes.
}


Expand Down Expand Up @@ -172,17 +102,27 @@ op_sum::apply(Mat<typename T1::elem_type>& out, const Op< eOp<T1,eop_pow>, op_su
return;
}

typedef eOp<T1,eop_pow> inner_expr_type;
op_sum::apply_generic(out, in);
}



template<typename T1>
inline
void
op_sum::apply_generic(Mat<typename T1::elem_type>& out, const Op<T1,op_sum>& in)
{
arma_debug_sigprint();

typedef typename inner_expr_type::proxy_type::stored_type inner_expr_P_stored_type;
typedef typename T1::elem_type eT;

const uword dim = in.aux_uword_a;

arma_conform_check( (dim > 1), "sum(): parameter 'dim' must be 0 or 1" );

if( (is_Mat<inner_expr_P_stored_type>::value) || (arma_config::openmp && Proxy<inner_expr_type>::use_mp) )
if((is_Mat<T1>::value) || (is_Mat<typename Proxy<T1>::stored_type>::value) || (arma_config::openmp && Proxy<T1>::use_mp))
{
const quasi_unwrap<inner_expr_type> U(in.m); // force evaluation of eop_pow
const quasi_unwrap<T1> U(in.m);

if(U.is_alias(out))
{
Expand All @@ -199,7 +139,7 @@ op_sum::apply(Mat<typename T1::elem_type>& out, const Op< eOp<T1,eop_pow>, op_su
}
else
{
const Proxy<inner_expr_type> P(in.m);
const Proxy<T1> P(in.m);

if(P.is_alias(out))
{
Expand Down