From 71a9c18e14b737fdba021dcaead5924dda3afe33 Mon Sep 17 00:00:00 2001 From: Dirk Eddelbuettel Date: Thu, 16 Oct 2025 09:09:15 -0500 Subject: [PATCH 1/2] Sync with Armadillo 15.2-rc1 --- inst/include/current/armadillo | 1 + .../current/armadillo_bits/Base_meat.hpp | 8 +- .../current/armadillo_bits/Col_bones.hpp | 7 +- .../current/armadillo_bits/Col_meat.hpp | 33 +- .../current/armadillo_bits/Mat_bones.hpp | 29 +- .../current/armadillo_bits/Mat_meat.hpp | 495 +++++++++++++++++- .../current/armadillo_bits/Row_bones.hpp | 9 +- .../current/armadillo_bits/Row_meat.hpp | 41 +- .../current/armadillo_bits/SpMat_bones.hpp | 4 + .../current/armadillo_bits/SpMat_meat.hpp | 4 +- .../current/armadillo_bits/arma_forward.hpp | 4 + .../current/armadillo_bits/arma_rng.hpp | 42 ++ .../current/armadillo_bits/arma_version.hpp | 6 +- .../current/armadillo_bits/constants.hpp | 6 + .../current/armadillo_bits/distr_param.hpp | 20 + .../include/current/armadillo_bits/fn_all.hpp | 6 +- .../include/current/armadillo_bits/fn_any.hpp | 6 +- .../current/armadillo_bits/fn_circshift.hpp | 18 +- .../current/armadillo_bits/fn_cumprod.hpp | 8 +- .../current/armadillo_bits/fn_cumsum.hpp | 8 +- .../include/current/armadillo_bits/fn_det.hpp | 2 +- .../current/armadillo_bits/fn_diagmat.hpp | 4 +- .../current/armadillo_bits/fn_diagvec.hpp | 6 +- .../current/armadillo_bits/fn_diff.hpp | 6 +- .../current/armadillo_bits/fn_expmat.hpp | 2 +- .../current/armadillo_bits/fn_flip.hpp | 8 +- .../current/armadillo_bits/fn_hist.hpp | 6 +- .../current/armadillo_bits/fn_histc.hpp | 4 +- .../current/armadillo_bits/fn_index_max.hpp | 6 +- .../current/armadillo_bits/fn_index_min.hpp | 6 +- .../current/armadillo_bits/fn_kron.hpp | 4 +- .../current/armadillo_bits/fn_logmat.hpp | 6 +- .../include/current/armadillo_bits/fn_max.hpp | 12 +- .../current/armadillo_bits/fn_mean.hpp | 8 +- .../current/armadillo_bits/fn_median.hpp | 6 +- .../include/current/armadillo_bits/fn_min.hpp | 12 +- .../current/armadillo_bits/fn_normalise.hpp | 2 +- .../current/armadillo_bits/fn_orth_null.hpp | 4 +- .../current/armadillo_bits/fn_prod.hpp | 13 +- .../current/armadillo_bits/fn_quantile.hpp | 4 +- .../current/armadillo_bits/fn_rande.hpp | 241 +++++++++ .../current/armadillo_bits/fn_range.hpp | 4 +- .../current/armadillo_bits/fn_repelem.hpp | 4 +- .../current/armadillo_bits/fn_shuffle.hpp | 6 +- .../current/armadillo_bits/fn_sort.hpp | 4 +- .../current/armadillo_bits/fn_sort_index.hpp | 4 +- .../current/armadillo_bits/fn_sqrtmat.hpp | 6 +- .../current/armadillo_bits/fn_symmat.hpp | 16 +- .../armadillo_bits/glue_join_bones.hpp | 10 +- .../current/armadillo_bits/glue_join_meat.hpp | 118 +++-- .../armadillo_bits/glue_kron_bones.hpp | 4 +- .../current/armadillo_bits/glue_kron_meat.hpp | 25 +- .../armadillo_bits/glue_polyfit_bones.hpp | 4 + .../armadillo_bits/glue_polyfit_meat.hpp | 61 ++- .../armadillo_bits/glue_polyval_bones.hpp | 3 +- .../armadillo_bits/glue_polyval_meat.hpp | 36 +- .../armadillo_bits/glue_quantile_bones.hpp | 6 + .../armadillo_bits/glue_quantile_meat.hpp | 44 ++ .../armadillo_bits/glue_times_bones.hpp | 29 +- .../armadillo_bits/glue_times_meat.hpp | 82 ++- .../armadillo_bits/glue_trapz_bones.hpp | 4 + .../armadillo_bits/glue_trapz_meat.hpp | 37 ++ .../current/armadillo_bits/op_accu_bones.hpp | 3 + .../current/armadillo_bits/op_accu_meat.hpp | 56 +- .../current/armadillo_bits/op_all_meat.hpp | 2 +- .../current/armadillo_bits/op_any_meat.hpp | 2 +- .../armadillo_bits/op_circshift_bones.hpp | 2 + .../armadillo_bits/op_circshift_meat.hpp | 23 + .../current/armadillo_bits/op_clamp_bones.hpp | 4 +- .../current/armadillo_bits/op_clamp_meat.hpp | 65 ++- .../armadillo_bits/op_cumprod_bones.hpp | 6 + .../armadillo_bits/op_cumprod_meat.hpp | 39 +- .../armadillo_bits/op_cumsum_bones.hpp | 6 + .../current/armadillo_bits/op_cumsum_meat.hpp | 39 +- .../current/armadillo_bits/op_diff_bones.hpp | 6 + .../current/armadillo_bits/op_diff_meat.hpp | 48 +- .../current/armadillo_bits/op_flip_bones.hpp | 19 +- .../current/armadillo_bits/op_flip_meat.hpp | 280 ++++------ .../armadillo_bits/op_htrans_bones.hpp | 6 + .../current/armadillo_bits/op_htrans_meat.hpp | 37 ++ .../current/armadillo_bits/op_max_bones.hpp | 3 + .../current/armadillo_bits/op_max_meat.hpp | 24 +- .../current/armadillo_bits/op_mean_bones.hpp | 3 + .../current/armadillo_bits/op_mean_meat.hpp | 18 + .../armadillo_bits/op_median_bones.hpp | 3 + .../current/armadillo_bits/op_median_meat.hpp | 19 + .../current/armadillo_bits/op_min_bones.hpp | 3 + .../current/armadillo_bits/op_min_meat.hpp | 24 +- .../armadillo_bits/op_nonzeros_bones.hpp | 3 + .../armadillo_bits/op_nonzeros_meat.hpp | 16 + .../armadillo_bits/op_repmat_bones.hpp | 2 + .../current/armadillo_bits/op_repmat_meat.hpp | 17 + .../armadillo_bits/op_reshape_bones.hpp | 2 + .../armadillo_bits/op_reshape_meat.hpp | 28 +- .../armadillo_bits/op_reverse_bones.hpp | 6 + .../armadillo_bits/op_reverse_meat.hpp | 142 +++-- .../current/armadillo_bits/op_sort_bones.hpp | 3 + .../current/armadillo_bits/op_sort_meat.hpp | 25 +- .../armadillo_bits/op_stddev_bones.hpp | 3 + .../current/armadillo_bits/op_stddev_meat.hpp | 20 + .../armadillo_bits/op_strans_bones.hpp | 6 + .../current/armadillo_bits/op_strans_meat.hpp | 35 ++ .../current/armadillo_bits/op_sum_bones.hpp | 12 + .../current/armadillo_bits/op_sum_meat.hpp | 102 +++- .../armadillo_bits/op_trimat_bones.hpp | 3 + .../current/armadillo_bits/op_trimat_meat.hpp | 25 + .../current/armadillo_bits/op_var_bones.hpp | 3 + .../current/armadillo_bits/op_var_meat.hpp | 20 + .../armadillo_bits/op_vectorise_bones.hpp | 4 + .../armadillo_bits/op_vectorise_meat.hpp | 48 +- .../armadillo_bits/spglue_join_bones.hpp | 6 + .../armadillo_bits/spglue_join_meat.hpp | 34 ++ .../armadillo_bits/spglue_kron_bones.hpp | 3 + .../armadillo_bits/spglue_kron_meat.hpp | 15 + .../armadillo_bits/spglue_minus_bones.hpp | 3 + .../armadillo_bits/spglue_minus_meat.hpp | 15 + .../armadillo_bits/spglue_plus_bones.hpp | 3 + .../armadillo_bits/spglue_plus_meat.hpp | 15 + .../armadillo_bits/spglue_schur_bones.hpp | 3 + .../armadillo_bits/spglue_schur_meat.hpp | 15 + .../armadillo_bits/spglue_times_bones.hpp | 6 + .../armadillo_bits/spglue_times_meat.hpp | 32 ++ .../armadillo_bits/spop_htrans_bones.hpp | 6 + .../armadillo_bits/spop_htrans_meat.hpp | 37 ++ .../armadillo_bits/spop_repmat_bones.hpp | 3 + .../armadillo_bits/spop_repmat_meat.hpp | 14 + .../armadillo_bits/spop_strans_bones.hpp | 6 + .../armadillo_bits/spop_strans_meat.hpp | 29 + .../armadillo_bits/spop_trimat_bones.hpp | 3 + .../armadillo_bits/spop_trimat_meat.hpp | 18 + .../include/current/armadillo_bits/unwrap.hpp | 26 +- 131 files changed, 2597 insertions(+), 584 deletions(-) create mode 100644 inst/include/current/armadillo_bits/fn_rande.hpp diff --git a/inst/include/current/armadillo b/inst/include/current/armadillo index a5776ee2..db139188 100644 --- a/inst/include/current/armadillo +++ b/inst/include/current/armadillo @@ -581,6 +581,7 @@ namespace arma #include "armadillo_bits/fn_inplace_trans.hpp" #include "armadillo_bits/fn_randi.hpp" #include "armadillo_bits/fn_randg.hpp" + #include "armadillo_bits/fn_rande.hpp" #include "armadillo_bits/fn_cond_rcond.hpp" #include "armadillo_bits/fn_normalise.hpp" #include "armadillo_bits/fn_clamp.hpp" diff --git a/inst/include/current/armadillo_bits/Base_meat.hpp b/inst/include/current/armadillo_bits/Base_meat.hpp index 9c76004b..ab2a3f60 100644 --- a/inst/include/current/armadillo_bits/Base_meat.hpp +++ b/inst/include/current/armadillo_bits/Base_meat.hpp @@ -667,7 +667,7 @@ Base::is_finite() const 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::stored_type>::value) + if( (quasi_unwrap::has_orig_mem) || (is_Mat::stored_type>::value) ) { const quasi_unwrap U( (*this).get_ref() ); @@ -715,7 +715,7 @@ Base::has_inf() const 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::stored_type>::value) + if( (quasi_unwrap::has_orig_mem) || (is_Mat::stored_type>::value) ) { const quasi_unwrap U( (*this).get_ref() ); @@ -763,7 +763,7 @@ Base::has_nan() const 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::stored_type>::value) + if( (quasi_unwrap::has_orig_mem) || (is_Mat::stored_type>::value) ) { const quasi_unwrap U( (*this).get_ref() ); @@ -811,7 +811,7 @@ Base::has_nonfinite() const 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::stored_type>::value) + if( (quasi_unwrap::has_orig_mem) || (is_Mat::stored_type>::value) ) { const quasi_unwrap U( (*this).get_ref() ); diff --git a/inst/include/current/armadillo_bits/Col_bones.hpp b/inst/include/current/armadillo_bits/Col_bones.hpp index 848a7c63..32dd67f0 100644 --- a/inst/include/current/armadillo_bits/Col_bones.hpp +++ b/inst/include/current/armadillo_bits/Col_bones.hpp @@ -142,7 +142,7 @@ class Col : public Mat template inline void shed_rows(const Base& indices); [[deprecated]] inline void insert_rows(const uword row_num, const uword N, const bool set_to_zero); - inline void insert_rows(const uword row_num, const uword N); + inline void insert_rows(const uword row_num, const uword N); template inline void insert_rows(const uword row_num, const Base& X); @@ -154,6 +154,11 @@ class Col : public Mat arma_warn_unused arma_inline const eT& at(const uword in_row, const uword in_col) const; + inline constexpr bool is_vec() const { return true; } + inline constexpr bool is_rowvec() const { return false; } + inline constexpr bool is_colvec() const { return true; } + + typedef eT* row_iterator; typedef const eT* const_row_iterator; diff --git a/inst/include/current/armadillo_bits/Col_meat.hpp b/inst/include/current/armadillo_bits/Col_meat.hpp index 942541a0..6b318c00 100644 --- a/inst/include/current/armadillo_bits/Col_meat.hpp +++ b/inst/include/current/armadillo_bits/Col_meat.hpp @@ -483,7 +483,7 @@ Col::operator=(Col&& X) // if(X.n_cols != 1) { const Mat& XX = X; Mat::operator=(XX); return *this; } // // (*this).steal_mem(X, true); -// +// // return *this; // } @@ -521,11 +521,9 @@ template template inline Col::Col(const Base& X) - : Mat(arma_vec_indicator(), 1) + : Mat(X.get_ref(), arma_vec_indicator(), 1) { - arma_debug_sigprint(); - - Mat::operator=(X.get_ref()); + arma_debug_sigprint_this(this); } @@ -549,11 +547,9 @@ template template inline Col::Col(const SpBase& X) - : Mat(arma_vec_indicator(), 1) + : Mat(X.get_ref(), arma_vec_indicator(), 1) { arma_debug_sigprint_this(this); - - Mat::operator=(X.get_ref()); } @@ -607,12 +603,9 @@ Col::Col const Base::pod_type, T1>& A, const Base::pod_type, T2>& B ) + : Mat(A.get_ref(), B.get_ref(), arma_vec_indicator(), 1) { - arma_debug_sigprint(); - - access::rw(Mat::vec_state) = 1; - - Mat::init(A,B); + arma_debug_sigprint_this(this); } @@ -621,12 +614,9 @@ template template inline Col::Col(const BaseCube& X) + : Mat(X.get_ref(), arma_vec_indicator(), 1) { - arma_debug_sigprint(); - - access::rw(Mat::vec_state) = 1; - - Mat::operator=(X); + arma_debug_sigprint_this(this); } @@ -649,12 +639,9 @@ Col::operator=(const BaseCube& X) template inline Col::Col(const subview_cube& X) + : Mat(X, arma_vec_indicator(), 1) { - arma_debug_sigprint(); - - access::rw(Mat::vec_state) = 1; - - Mat::operator=(X); + arma_debug_sigprint_this(this); } diff --git a/inst/include/current/armadillo_bits/Mat_bones.hpp b/inst/include/current/armadillo_bits/Mat_bones.hpp index b8997272..a0e71c9f 100644 --- a/inst/include/current/armadillo_bits/Mat_bones.hpp +++ b/inst/include/current/armadillo_bits/Mat_bones.hpp @@ -99,6 +99,7 @@ class Mat : public Base< eT, Mat > inline Mat& operator*=(const eT val); inline Mat& operator/=(const eT val); + inline Mat(const Mat& m, const arma_vec_indicator&, const uhword in_vec_state); inline Mat(const Mat& m); inline Mat& operator= (const Mat& m); inline Mat& operator+=(const Mat& m); @@ -107,6 +108,7 @@ class Mat : public Base< eT, Mat > inline Mat& operator%=(const Mat& m); inline Mat& operator/=(const Mat& m); + template inline Mat(const BaseCube& X, const arma_vec_indicator&, const uhword in_vec_state); template inline Mat(const BaseCube& X); template inline Mat& operator= (const BaseCube& X); template inline Mat& operator+=(const BaseCube& X); @@ -115,11 +117,12 @@ class Mat : public Base< eT, Mat > template inline Mat& operator%=(const BaseCube& X); template inline Mat& operator/=(const BaseCube& X); - template - inline explicit Mat(const Base& A, const Base& B); + template inline explicit Mat(const Base& A, const Base& B, const arma_vec_indicator&, const uhword in_vec_state); + template inline explicit Mat(const Base& A, const Base& B); inline explicit Mat(const subview& X, const bool use_colmem); // only to be used by the quasi_unwrap class + inline Mat(const subview& X, const arma_vec_indicator&, const uhword in_vec_state); inline Mat(const subview& X); inline Mat& operator= (const subview& X); inline Mat& operator+=(const subview& X); @@ -135,6 +138,7 @@ class Mat : public Base< eT, Mat > template inline Mat(const xtrans_mat& X); // xtrans_mat can only be generated by the Proxy class + inline Mat(const subview_cube& X, const arma_vec_indicator&, const uhword in_vec_state); inline Mat(const subview_cube& X); inline Mat& operator= (const subview_cube& X); inline Mat& operator+=(const subview_cube& X); @@ -143,6 +147,7 @@ class Mat : public Base< eT, Mat > inline Mat& operator%=(const subview_cube& X); inline Mat& operator/=(const subview_cube& X); + inline Mat(const diagview& X, const arma_vec_indicator&, const uhword in_vec_state); inline Mat(const diagview& X); inline Mat& operator= (const diagview& X); inline Mat& operator+=(const diagview& X); @@ -151,6 +156,7 @@ class Mat : public Base< eT, Mat > inline Mat& operator%=(const diagview& X); inline Mat& operator/=(const diagview& X); + template inline Mat(const subview_elem1& X, const arma_vec_indicator&, const uhword in_vec_state); template inline Mat(const subview_elem1& X); template inline Mat& operator= (const subview_elem1& X); template inline Mat& operator+=(const subview_elem1& X); @@ -159,6 +165,7 @@ class Mat : public Base< eT, Mat > template inline Mat& operator%=(const subview_elem1& X); template inline Mat& operator/=(const subview_elem1& X); + template inline Mat(const subview_elem2& X, const arma_vec_indicator&, const uhword in_vec_state); template inline Mat(const subview_elem2& X); template inline Mat& operator= (const subview_elem2& X); template inline Mat& operator+=(const subview_elem2& X); @@ -168,6 +175,7 @@ class Mat : public Base< eT, Mat > template inline Mat& operator/=(const subview_elem2& X); // Operators on sparse matrices (and subviews) + template inline explicit Mat(const SpBase& m, const arma_vec_indicator&, const uhword in_vec_state); template inline explicit Mat(const SpBase& m); template inline Mat& operator= (const SpBase& m); template inline Mat& operator+=(const SpBase& m); @@ -176,11 +184,13 @@ class Mat : public Base< eT, Mat > template inline Mat& operator%=(const SpBase& m); template inline Mat& operator/=(const SpBase& m); + inline explicit Mat(const SpSubview& X, const arma_vec_indicator&, const uhword in_vec_state); inline explicit Mat(const SpSubview& X); inline Mat& operator= (const SpSubview& X); inline Mat& operator+=(const SpSubview& X); inline Mat& operator-=(const SpSubview& X); + inline explicit Mat(const spdiagview& X, const arma_vec_indicator&, const uhword in_vec_state); inline explicit Mat(const spdiagview& X); inline Mat& operator= (const spdiagview& X); inline Mat& operator+=(const spdiagview& X); @@ -320,6 +330,7 @@ class Mat : public Base< eT, Mat > template inline void insert_cols(const uword col_num, const Base& X); + template inline Mat(const Gen& X, const arma_vec_indicator&, const uhword in_vec_state); template inline Mat(const Gen& X); template inline Mat& operator= (const Gen& X); template inline Mat& operator+=(const Gen& X); @@ -328,6 +339,7 @@ class Mat : public Base< eT, Mat > template inline Mat& operator%=(const Gen& X); template inline Mat& operator/=(const Gen& X); + template inline Mat(const Op& X, const arma_vec_indicator&, const uhword in_vec_state); template inline Mat(const Op& X); template inline Mat& operator= (const Op& X); template inline Mat& operator+=(const Op& X); @@ -336,6 +348,7 @@ class Mat : public Base< eT, Mat > template inline Mat& operator%=(const Op& X); template inline Mat& operator/=(const Op& X); + template inline Mat(const eOp& X, const arma_vec_indicator&, const uhword in_vec_state); template inline Mat(const eOp& X); template inline Mat& operator= (const eOp& X); template inline Mat& operator+=(const eOp& X); @@ -344,6 +357,7 @@ class Mat : public Base< eT, Mat > template inline Mat& operator%=(const eOp& X); template inline Mat& operator/=(const eOp& X); + template inline Mat(const mtOp& X, const arma_vec_indicator&, const uhword in_vec_state); template inline Mat(const mtOp& X); template inline Mat& operator= (const mtOp& X); template inline Mat& operator+=(const mtOp& X); @@ -352,6 +366,7 @@ class Mat : public Base< eT, Mat > template inline Mat& operator%=(const mtOp& X); template inline Mat& operator/=(const mtOp& X); + template inline Mat(const CubeToMatOp& X, const arma_vec_indicator&, const uhword in_vec_state); template inline Mat(const CubeToMatOp& X); template inline Mat& operator= (const CubeToMatOp& X); template inline Mat& operator+=(const CubeToMatOp& X); @@ -360,6 +375,7 @@ class Mat : public Base< eT, Mat > template inline Mat& operator%=(const CubeToMatOp& X); template inline Mat& operator/=(const CubeToMatOp& X); + template inline Mat(const SpToDOp& X, const arma_vec_indicator&, const uhword in_vec_state); template inline Mat(const SpToDOp& X); template inline Mat& operator= (const SpToDOp& X); template inline Mat& operator+=(const SpToDOp& X); @@ -368,6 +384,7 @@ class Mat : public Base< eT, Mat > template inline Mat& operator%=(const SpToDOp& X); template inline Mat& operator/=(const SpToDOp& X); + template inline explicit Mat(const mtSpReduceOp& X, const arma_vec_indicator&, const uhword in_vec_state); template inline explicit Mat(const mtSpReduceOp& X); template inline Mat& operator= (const mtSpReduceOp& X); template inline Mat& operator+=(const mtSpReduceOp& X); @@ -376,6 +393,7 @@ class Mat : public Base< eT, Mat > template inline Mat& operator%=(const mtSpReduceOp& X); template inline Mat& operator/=(const mtSpReduceOp& X); + template inline Mat(const Glue& X, const arma_vec_indicator&, const uhword in_vec_state); template inline Mat(const Glue& X); template inline Mat& operator= (const Glue& X); template inline Mat& operator+=(const Glue& X); @@ -387,6 +405,7 @@ class Mat : public Base< eT, Mat > template inline Mat& operator+=(const Glue& X); template inline Mat& operator-=(const Glue& X); + template inline Mat(const eGlue& X, const arma_vec_indicator&, const uhword in_vec_state); template inline Mat(const eGlue& X); template inline Mat& operator= (const eGlue& X); template inline Mat& operator+=(const eGlue& X); @@ -395,6 +414,7 @@ class Mat : public Base< eT, Mat > template inline Mat& operator%=(const eGlue& X); template inline Mat& operator/=(const eGlue& X); + template inline Mat(const mtGlue& X, const arma_vec_indicator&, const uhword in_vec_state); template inline Mat(const mtGlue& X); template inline Mat& operator= (const mtGlue& X); template inline Mat& operator+=(const mtGlue& X); @@ -403,6 +423,7 @@ class Mat : public Base< eT, Mat > template inline Mat& operator%=(const mtGlue& X); template inline Mat& operator/=(const mtGlue& X); + template inline Mat(const SpToDGlue& X, const arma_vec_indicator&, const uhword in_vec_state); template inline Mat(const SpToDGlue& X); template inline Mat& operator= (const SpToDGlue& X); template inline Mat& operator+=(const SpToDGlue& X); @@ -958,4 +979,8 @@ class Mat_aux +template class Mat_noalias : public Mat {}; + + + //! @} diff --git a/inst/include/current/armadillo_bits/Mat_meat.hpp b/inst/include/current/armadillo_bits/Mat_meat.hpp index 3bb32ade..354eaf70 100644 --- a/inst/include/current/armadillo_bits/Mat_meat.hpp +++ b/inst/include/current/armadillo_bits/Mat_meat.hpp @@ -880,7 +880,26 @@ Mat::operator/=(const eT val) -//! construct a matrix from a given matrix +template +inline +Mat::Mat(const Mat& in_mat, const arma_vec_indicator&, const uhword in_vec_state) + : n_rows( (in_vec_state == 2) ? 1 : 0 ) + , n_cols( (in_vec_state == 1) ? 1 : 0 ) + , n_elem(0) + , n_alloc(0) + , vec_state(in_vec_state) + , mem_state(0) + , mem() + { + arma_debug_sigprint(arma_str::format("this: %x; in_mat: %x") % this % &in_mat); + + init_warm(in_mat.n_rows, in_mat.n_cols); + + arrayops::copy( memptr(), in_mat.mem, in_mat.n_elem ); + } + + + template inline Mat::Mat(const Mat& in_mat) @@ -901,7 +920,6 @@ Mat::Mat(const Mat& in_mat) -//! construct a matrix from a given matrix template inline Mat& @@ -1496,6 +1514,25 @@ Mat::operator/=(const Mat& m) +template +template +inline +Mat::Mat(const BaseCube& X, const arma_vec_indicator&, const uhword in_vec_state) + : n_rows( (in_vec_state == 2) ? 1 : 0 ) + , n_cols( (in_vec_state == 1) ? 1 : 0 ) + , n_elem(0) + , n_alloc(0) + , vec_state(in_vec_state) + , mem_state(0) + , mem() + { + arma_debug_sigprint_this(this); + + (*this).operator=(X); + } + + + template template inline @@ -1943,15 +1980,30 @@ Mat::operator/=(const BaseCube& X) +template +template +inline +Mat::Mat(const Base::pod_type,T1>& A, const Base::pod_type,T2>& B, const arma_vec_indicator&, const uhword in_vec_state) + : n_rows( (in_vec_state == 2) ? 1 : 0 ) + , n_cols( (in_vec_state == 1) ? 1 : 0 ) + , n_elem(0) + , n_alloc(0) + , vec_state(in_vec_state) + , mem_state(0) + , mem() + { + arma_debug_sigprint_this(this); + + init(A,B); + } + + + //! for constructing a complex matrix out of two non-complex matrices template template inline -Mat::Mat - ( - const Base::pod_type,T1>& A, - const Base::pod_type,T2>& B - ) +Mat::Mat(const Base::pod_type,T1>& A, const Base::pod_type,T2>& B) : n_rows(0) , n_cols(0) , n_elem(0) @@ -1994,6 +2046,26 @@ Mat::Mat(const subview& X, const bool use_colmem) +template +inline +Mat::Mat(const subview& X, const arma_vec_indicator&, const uhword in_vec_state) + : n_rows( (in_vec_state == 2) ? 1 : 0 ) + , n_cols( (in_vec_state == 1) ? 1 : 0 ) + , n_elem(0) + , n_alloc(0) + , vec_state(in_vec_state) + , mem_state(0) + , mem() + { + arma_debug_sigprint_this(this); + + init_warm(X.n_rows, X.n_cols); + + subview::extract(*this, X); + } + + + //! construct a matrix from subview (eg. construct a matrix from a delayed submatrix operation) template inline @@ -2197,6 +2269,24 @@ Mat::Mat(const xtrans_mat& X) +template +inline +Mat::Mat(const subview_cube& x, const arma_vec_indicator&, const uhword in_vec_state) + : n_rows( (in_vec_state == 2) ? 1 : 0 ) + , n_cols( (in_vec_state == 1) ? 1 : 0 ) + , n_elem(0) + , n_alloc(0) + , vec_state(in_vec_state) + , mem_state(0) + , mem() + { + arma_debug_sigprint_this(this); + + (*this).operator=(x); + } + + + //! construct a matrix from a subview_cube instance template inline @@ -2211,7 +2301,7 @@ Mat::Mat(const subview_cube& x) { arma_debug_sigprint_this(this); - this->operator=(x); + (*this).operator=(x); } @@ -2308,6 +2398,26 @@ Mat::operator/=(const subview_cube& X) +template +inline +Mat::Mat(const diagview& X, const arma_vec_indicator&, const uhword in_vec_state) + : n_rows( (in_vec_state == 2) ? 1 : 0 ) + , n_cols( (in_vec_state == 1) ? 1 : 0 ) + , n_elem(0) + , n_alloc(0) + , vec_state(in_vec_state) + , mem_state(0) + , mem() + { + arma_debug_sigprint_this(this); + + init_warm(X.n_rows, X.n_cols); + + diagview::extract(*this, X); + } + + + //! construct a matrix from diagview (eg. construct a matrix from a delayed diag operation) template inline @@ -2432,6 +2542,25 @@ Mat::operator/=(const diagview& X) +template +template +inline +Mat::Mat(const subview_elem1& X, const arma_vec_indicator&, const uhword in_vec_state) + : n_rows( (in_vec_state == 2) ? 1 : 0 ) + , n_cols( (in_vec_state == 1) ? 1 : 0 ) + , n_elem(0) + , n_alloc(0) + , vec_state(in_vec_state) + , mem_state(0) + , mem() + { + arma_debug_sigprint_this(this); + + (*this).operator=(X); + } + + + template template inline @@ -2446,7 +2575,7 @@ Mat::Mat(const subview_elem1& X) { arma_debug_sigprint_this(this); - this->operator=(X); + (*this).operator=(X); } @@ -2541,6 +2670,25 @@ Mat::operator/=(const subview_elem1& X) +template +template +inline +Mat::Mat(const subview_elem2& X, const arma_vec_indicator&, const uhword in_vec_state) + : n_rows( (in_vec_state == 2) ? 1 : 0 ) + , n_cols( (in_vec_state == 1) ? 1 : 0 ) + , n_elem(0) + , n_alloc(0) + , vec_state(in_vec_state) + , mem_state(0) + , mem() + { + arma_debug_sigprint_this(this); + + (*this).operator=(X); + } + + + template template inline @@ -2555,7 +2703,7 @@ Mat::Mat(const subview_elem2& X) { arma_debug_sigprint_this(this); - this->operator=(X); + (*this).operator=(X); } @@ -2650,6 +2798,25 @@ Mat::operator/=(const subview_elem2& X) +template +template +inline +Mat::Mat(const SpBase& m, const arma_vec_indicator&, const uhword in_vec_state) + : n_rows( (in_vec_state == 2) ? 1 : 0 ) + , n_cols( (in_vec_state == 1) ? 1 : 0 ) + , n_elem(0) + , n_alloc(0) + , vec_state(in_vec_state) + , mem_state(0) + , mem() + { + arma_debug_sigprint_this(this); + + (*this).operator=(m); + } + + + template template inline @@ -2835,6 +3002,24 @@ Mat::operator/=(const SpBase& m) +template +inline +Mat::Mat(const SpSubview& X, const arma_vec_indicator&, const uhword in_vec_state) + : n_rows( (in_vec_state == 2) ? 1 : 0 ) + , n_cols( (in_vec_state == 1) ? 1 : 0 ) + , n_elem(0) + , n_alloc(0) + , vec_state(in_vec_state) + , mem_state(0) + , mem() + { + arma_debug_sigprint_this(this); + + (*this).operator=(X); + } + + + template inline Mat::Mat(const SpSubview& X) @@ -3018,6 +3203,26 @@ Mat::operator-=(const SpSubview& X) +template +inline +Mat::Mat(const spdiagview& X, const arma_vec_indicator&, const uhword in_vec_state) + : n_rows( (in_vec_state == 2) ? 1 : 0 ) + , n_cols( (in_vec_state == 1) ? 1 : 0 ) + , n_elem(0) + , n_alloc(0) + , vec_state(in_vec_state) + , mem_state(0) + , mem() + { + arma_debug_sigprint_this(this); + + init_warm(X.n_rows, X.n_cols); + + spdiagview::extract(*this, X); + } + + + template inline Mat::Mat(const spdiagview& X) @@ -4925,6 +5130,29 @@ Mat::insert_cols(const uword col_num, const Base& X) +template +template +inline +Mat::Mat(const Gen& X, const arma_vec_indicator&, const uhword in_vec_state) + : n_rows( (in_vec_state == 2) ? 1 : 0 ) + , n_cols( (in_vec_state == 1) ? 1 : 0 ) + , n_elem(0) + , n_alloc(0) + , vec_state(in_vec_state) + , mem_state(0) + , mem() + { + arma_debug_sigprint_this(this); + + arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); + + init_warm(X.n_rows, X.n_cols); + + X.apply(*this); + } + + + template template inline @@ -5052,6 +5280,27 @@ Mat::operator/=(const Gen& X) +template +template +inline +Mat::Mat(const Op& X, const arma_vec_indicator&, const uhword in_vec_state) + : n_rows( (in_vec_state == 2) ? 1 : 0 ) + , n_cols( (in_vec_state == 1) ? 1 : 0 ) + , n_elem(0) + , n_alloc(0) + , vec_state(in_vec_state) + , mem_state(0) + , mem() + { + arma_debug_sigprint_this(this); + + arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); + + op_type::apply(static_cast< Mat_noalias& >(*this), X); + } + + + //! create a matrix from Op, ie. run the previously delayed unary operations template template @@ -5066,10 +5315,10 @@ Mat::Mat(const Op& X) , mem() { arma_debug_sigprint_this(this); - + arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); - op_type::apply(*this, X); + op_type::apply(static_cast< Mat_noalias& >(*this), X); } @@ -5082,7 +5331,7 @@ Mat& Mat::operator=(const Op& X) { arma_debug_sigprint(); - + arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); op_type::apply(*this, X); @@ -5182,6 +5431,37 @@ Mat::operator/=(const Op& X) +template +template +inline +Mat::Mat(const eOp& X, const arma_vec_indicator&, const uhword in_vec_state) + : n_rows( (in_vec_state == 2) ? 1 : 0 ) + , n_cols( (in_vec_state == 1) ? 1 : 0 ) + , n_elem(0) + , n_alloc(0) + , vec_state(in_vec_state) + , mem_state(0) + , mem() + { + arma_debug_sigprint_this(this); + + arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); + + init_warm(X.get_n_rows(), X.get_n_cols()); + + if(arma_config::optimise_powexpr && is_same_type::value) + { + constexpr bool eT_ok = is_real_or_cx::value; + + if( X.aux == eT(2) ) { eop_square::apply(*this, reinterpret_cast< const eOp& >(X)); return; } + if(eT_ok && (X.aux == eT(0.5))) { eop_sqrt::apply(*this, reinterpret_cast< const eOp& >(X)); return; } + } + + eop_type::apply(*this, X); + } + + + //! create a matrix from eOp, ie. run the previously delayed unary operations template template @@ -5379,6 +5659,25 @@ Mat::operator/=(const eOp& X) +template +template +inline +Mat::Mat(const mtOp& X, const arma_vec_indicator&, const uhword in_vec_state) + : n_rows( (in_vec_state == 2) ? 1 : 0 ) + , n_cols( (in_vec_state == 1) ? 1 : 0 ) + , n_elem(0) + , n_alloc(0) + , vec_state(in_vec_state) + , mem_state(0) + , mem() + { + arma_debug_sigprint_this(this); + + op_type::apply(static_cast< Mat_noalias& >(*this), X); + } + + + template template inline @@ -5393,7 +5692,7 @@ Mat::Mat(const mtOp& X) { arma_debug_sigprint_this(this); - op_type::apply(*this, X); + op_type::apply(static_cast< Mat_noalias& >(*this), X); } @@ -5488,6 +5787,27 @@ Mat::operator/=(const mtOp& X) +template +template +inline +Mat::Mat(const CubeToMatOp& X, const arma_vec_indicator&, const uhword in_vec_state) + : n_rows( (in_vec_state == 2) ? 1 : 0 ) + , n_cols( (in_vec_state == 1) ? 1 : 0 ) + , n_elem(0) + , n_alloc(0) + , vec_state(in_vec_state) + , mem_state(0) + , mem() + { + arma_debug_sigprint_this(this); + + arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); + + op_type::apply(*this, X); + } + + + template template inline @@ -5501,9 +5821,9 @@ Mat::Mat(const CubeToMatOp& X) , mem() { arma_debug_sigprint_this(this); - + arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); - + op_type::apply(*this, X); } @@ -5516,7 +5836,7 @@ Mat& Mat::operator=(const CubeToMatOp& X) { arma_debug_sigprint(); - + arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); op_type::apply(*this, X); @@ -5611,6 +5931,27 @@ Mat::operator/=(const CubeToMatOp& X) +template +template +inline +Mat::Mat(const SpToDOp& X, const arma_vec_indicator&, const uhword in_vec_state) + : n_rows( (in_vec_state == 2) ? 1 : 0 ) + , n_cols( (in_vec_state == 1) ? 1 : 0 ) + , n_elem(0) + , n_alloc(0) + , vec_state(in_vec_state) + , mem_state(0) + , mem() + { + arma_debug_sigprint_this(this); + + arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); + + op_type::apply(*this, X); + } + + + template template inline @@ -5624,9 +5965,9 @@ Mat::Mat(const SpToDOp& X) , mem() { arma_debug_sigprint_this(this); - + arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); - + op_type::apply(*this, X); } @@ -5640,7 +5981,7 @@ Mat& Mat::operator=(const SpToDOp& X) { arma_debug_sigprint(); - + arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); op_type::apply(*this, X); @@ -5740,6 +6081,25 @@ Mat::operator/=(const SpToDOp& X) +template +template +inline +Mat::Mat(const mtSpReduceOp& X, const arma_vec_indicator&, const uhword in_vec_state) + : n_rows( (in_vec_state == 2) ? 1 : 0 ) + , n_cols( (in_vec_state == 1) ? 1 : 0 ) + , n_elem(0) + , n_alloc(0) + , vec_state(in_vec_state) + , mem_state(0) + , mem() + { + arma_debug_sigprint_this(this); + + op_type::apply(*this, X); + } + + + template template inline @@ -5753,7 +6113,7 @@ Mat::Mat(const mtSpReduceOp& X) , mem() { arma_debug_sigprint_this(this); - + op_type::apply(*this, X); } @@ -5766,7 +6126,7 @@ Mat& Mat::operator=(const mtSpReduceOp& X) { arma_debug_sigprint(); - + op_type::apply(*this, X); return *this; @@ -5849,6 +6209,28 @@ Mat::operator/=(const mtSpReduceOp& X) +template +template +inline +Mat::Mat(const Glue& X, const arma_vec_indicator&, const uhword in_vec_state) + : n_rows( (in_vec_state == 2) ? 1 : 0 ) + , n_cols( (in_vec_state == 1) ? 1 : 0 ) + , n_elem(0) + , n_alloc(0) + , vec_state(in_vec_state) + , mem_state(0) + , mem() + { + arma_debug_sigprint_this(this); + + arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); + arma_type_check(( is_same_type< eT, typename T2::elem_type >::no )); + + glue_type::apply(static_cast< Mat_noalias& >(*this), X); + } + + + //! create a matrix from Glue, ie. run the previously delayed binary operations template template @@ -5867,7 +6249,7 @@ Mat::Mat(const Glue& X) arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); arma_type_check(( is_same_type< eT, typename T2::elem_type >::no )); - glue_type::apply(*this, X); + glue_type::apply(static_cast< Mat_noalias& >(*this), X); } @@ -6016,6 +6398,30 @@ Mat::operator-=(const Glue& X) +template +template +inline +Mat::Mat(const eGlue& X, const arma_vec_indicator&, const uhword in_vec_state) + : n_rows( (in_vec_state == 2) ? 1 : 0 ) + , n_cols( (in_vec_state == 1) ? 1 : 0 ) + , n_elem(0) + , n_alloc(0) + , vec_state(in_vec_state) + , mem_state(0) + , mem() + { + arma_debug_sigprint_this(this); + + arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); + arma_type_check(( is_same_type< eT, typename T2::elem_type >::no )); + + init_warm(X.get_n_rows(), X.get_n_cols()); + + eglue_type::apply(*this, X); + } + + + //! create a matrix from eGlue, ie. run the previously delayed binary operations template template @@ -6199,6 +6605,25 @@ Mat::operator/=(const eGlue& X) +template +template +inline +Mat::Mat(const mtGlue& X, const arma_vec_indicator&, const uhword in_vec_state) + : n_rows( (in_vec_state == 2) ? 1 : 0 ) + , n_cols( (in_vec_state == 1) ? 1 : 0 ) + , n_elem(0) + , n_alloc(0) + , vec_state(in_vec_state) + , mem_state(0) + , mem() + { + arma_debug_sigprint_this(this); + + glue_type::apply(static_cast< Mat_noalias& >(*this), X); + } + + + template template inline @@ -6213,7 +6638,7 @@ Mat::Mat(const mtGlue& X) { arma_debug_sigprint_this(this); - glue_type::apply(*this, X); + glue_type::apply(static_cast< Mat_noalias& >(*this), X); } @@ -6310,6 +6735,28 @@ Mat::operator/=(const mtGlue& X) +template +template +inline +Mat::Mat(const SpToDGlue& X, const arma_vec_indicator&, const uhword in_vec_state) + : n_rows( (in_vec_state == 2) ? 1 : 0 ) + , n_cols( (in_vec_state == 1) ? 1 : 0 ) + , n_elem(0) + , n_alloc(0) + , vec_state(in_vec_state) + , mem_state(0) + , mem() + { + arma_debug_sigprint_this(this); + + arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); + arma_type_check(( is_same_type< eT, typename T2::elem_type >::no )); + + glue_type::apply(*this, X); + } + + + template template inline diff --git a/inst/include/current/armadillo_bits/Row_bones.hpp b/inst/include/current/armadillo_bits/Row_bones.hpp index e1aa146d..908e196c 100644 --- a/inst/include/current/armadillo_bits/Row_bones.hpp +++ b/inst/include/current/armadillo_bits/Row_bones.hpp @@ -85,6 +85,8 @@ class Row : public Mat template inline explicit Row(const Base& A, const Base& B); + inline explicit Row(const subview& X, const bool use_colmem); // only to be used by the quasi_unwrap class + template inline Row(const BaseCube& X); template inline Row& operator=(const BaseCube& X); @@ -142,7 +144,7 @@ class Row : public Mat template inline void shed_cols(const Base& indices); [[deprecated]] inline void insert_cols(const uword col_num, const uword N, const bool set_to_zero); - inline void insert_cols(const uword col_num, const uword N); + inline void insert_cols(const uword col_num, const uword N); template inline void insert_cols(const uword col_num, const Base& X); @@ -154,6 +156,11 @@ class Row : public Mat arma_warn_unused arma_inline const eT& at(const uword in_row, const uword in_col) const; + inline constexpr bool is_vec() const { return true; } + inline constexpr bool is_rowvec() const { return true; } + inline constexpr bool is_colvec() const { return false; } + + typedef eT* row_iterator; typedef const eT* const_row_iterator; diff --git a/inst/include/current/armadillo_bits/Row_meat.hpp b/inst/include/current/armadillo_bits/Row_meat.hpp index 8623579a..012d85ef 100644 --- a/inst/include/current/armadillo_bits/Row_meat.hpp +++ b/inst/include/current/armadillo_bits/Row_meat.hpp @@ -521,11 +521,9 @@ template template inline Row::Row(const Base& X) - : Mat(arma_vec_indicator(), 2) + : Mat(X.get_ref(), arma_vec_indicator(), 2) { - arma_debug_sigprint(); - - Mat::operator=(X.get_ref()); + arma_debug_sigprint_this(this); } @@ -549,11 +547,9 @@ template template inline Row::Row(const SpBase& X) - : Mat(arma_vec_indicator(), 2) + : Mat(X.get_ref(), arma_vec_indicator(), 2) { - arma_debug_sigprint(); - - Mat::operator=(X.get_ref()); + arma_debug_sigprint_this(this); } @@ -607,12 +603,19 @@ Row::Row const Base::pod_type, T1>& A, const Base::pod_type, T2>& B ) + : Mat(A.get_ref(), B.get_ref(), arma_vec_indicator(), 2) + { + arma_debug_sigprint_this(this); + } + + + +template +inline +Row::Row(const subview& X, const bool use_colmem) + : Mat(X, use_colmem) { arma_debug_sigprint(); - - access::rw(Mat::vec_state) = 2; - - Mat::init(A,B); } @@ -621,12 +624,9 @@ template template inline Row::Row(const BaseCube& X) + : Mat(X.get_ref(), arma_vec_indicator(), 2) { - arma_debug_sigprint(); - - access::rw(Mat::vec_state) = 2; - - Mat::operator=(X); + arma_debug_sigprint_this(this); } @@ -649,12 +649,9 @@ Row::operator=(const BaseCube& X) template inline Row::Row(const subview_cube& X) + : Mat(X, arma_vec_indicator(), 2) { - arma_debug_sigprint(); - - access::rw(Mat::vec_state) = 2; - - Mat::operator=(X); + arma_debug_sigprint_this(this); } diff --git a/inst/include/current/armadillo_bits/SpMat_bones.hpp b/inst/include/current/armadillo_bits/SpMat_bones.hpp index 2b73cc3a..f28b8c2e 100644 --- a/inst/include/current/armadillo_bits/SpMat_bones.hpp +++ b/inst/include/current/armadillo_bits/SpMat_bones.hpp @@ -741,6 +741,10 @@ class SpMat_aux +template class SpMat_noalias : public SpMat {}; + + + #define ARMA_HAS_SPMAT diff --git a/inst/include/current/armadillo_bits/SpMat_meat.hpp b/inst/include/current/armadillo_bits/SpMat_meat.hpp index 51fa1c2c..266f6d95 100644 --- a/inst/include/current/armadillo_bits/SpMat_meat.hpp +++ b/inst/include/current/armadillo_bits/SpMat_meat.hpp @@ -1666,7 +1666,7 @@ SpMat::SpMat(const SpOp& X) arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); - spop_type::apply(*this, X); + spop_type::apply(static_cast< SpMat_noalias& >(*this), X); sync_csc(); // in case apply() used element accessors invalidate_cache(); // in case apply() modified the CSC representation @@ -1806,7 +1806,7 @@ SpMat::SpMat(const SpGlue& X) arma_type_check(( is_same_type< eT, typename T1::elem_type >::no )); - spglue_type::apply(*this, X); + spglue_type::apply(static_cast< SpMat_noalias& >(*this), X); sync_csc(); // in case apply() used element accessors invalidate_cache(); // in case apply() modified the CSC representation diff --git a/inst/include/current/armadillo_bits/arma_forward.hpp b/inst/include/current/armadillo_bits/arma_forward.hpp index 981776ad..a71cc4cb 100644 --- a/inst/include/current/armadillo_bits/arma_forward.hpp +++ b/inst/include/current/armadillo_bits/arma_forward.hpp @@ -72,6 +72,10 @@ template class subview_cube_slices; template class SpSubview_col_list; +template class Mat_noalias; +template class SpMat_noalias; + + struct SizeMat; struct SizeCube; diff --git a/inst/include/current/armadillo_bits/arma_rng.hpp b/inst/include/current/armadillo_bits/arma_rng.hpp index 1363cf58..8a2c3fc0 100644 --- a/inst/include/current/armadillo_bits/arma_rng.hpp +++ b/inst/include/current/armadillo_bits/arma_rng.hpp @@ -116,6 +116,7 @@ struct arma_rng template struct randu; template struct randn; template struct randg; + template struct rande; }; @@ -1029,4 +1030,45 @@ struct arma_rng::randg +// + + + +template +struct arma_rng::rande + { + inline + static + void + fill(eT* mem, const uword N, const double lambda) + { + #if defined(ARMA_USE_CXX11_RNG) + { + std::exponential_distribution local_e_distr(lambda); + + std::mt19937_64& producer = arma_rng::get_producer(); + + arma_rng::lock_producer(); + + for(uword i=0; i local_e_distr(lambda); + + local_engine.seed( local_seed_type(arma_rng::randi()) ); + + for(uword i=0; i static + constexpr typename arma_real_only::result nan(typename arma_real_only::result* junk = nullptr) { @@ -37,6 +38,7 @@ namespace priv template static + constexpr typename arma_cx_only::result nan(typename arma_cx_only::result* junk = nullptr) { @@ -50,6 +52,7 @@ namespace priv template static + constexpr typename arma_integral_only::result nan(typename arma_integral_only::result* junk = nullptr) { @@ -61,6 +64,7 @@ namespace priv template static + constexpr typename arma_real_only::result inf(typename arma_real_only::result* junk = nullptr) { @@ -72,6 +76,7 @@ namespace priv template static + constexpr typename arma_cx_only::result inf(typename arma_cx_only::result* junk = nullptr) { @@ -85,6 +90,7 @@ namespace priv template static + constexpr typename arma_integral_only::result inf(typename arma_integral_only::result* junk = nullptr) { diff --git a/inst/include/current/armadillo_bits/distr_param.hpp b/inst/include/current/armadillo_bits/distr_param.hpp index c4d9bad5..edd68c08 100644 --- a/inst/include/current/armadillo_bits/distr_param.hpp +++ b/inst/include/current/armadillo_bits/distr_param.hpp @@ -48,6 +48,26 @@ class distr_param } + inline explicit distr_param(const int a) + : state (1) + , a_int (a) + , b_int (0) + , a_double(double(a)) + , b_double(double(0)) + { + } + + + inline explicit distr_param(const double a) + : state (2) + , a_int (int(a)) + , b_int (int(0)) + , a_double(a) + , b_double(0) + { + } + + inline explicit distr_param(const int a, const int b) : state (1) , a_int (a) diff --git a/inst/include/current/armadillo_bits/fn_all.hpp b/inst/include/current/armadillo_bits/fn_all.hpp index 07e7002f..35ea4803 100644 --- a/inst/include/current/armadillo_bits/fn_all.hpp +++ b/inst/include/current/armadillo_bits/fn_all.hpp @@ -41,7 +41,7 @@ all(const T1& X) template arma_warn_unused -arma_inline +inline typename enable_if2 < @@ -59,7 +59,7 @@ all(const T1& X) template arma_warn_unused -arma_inline +inline typename enable_if2 < @@ -78,7 +78,7 @@ all(const T1& X, const uword dim) //! for compatibility purposes: allows compiling user code designed for earlier versions of Armadillo template arma_warn_unused -arma_inline +inline typename enable_if2 < diff --git a/inst/include/current/armadillo_bits/fn_any.hpp b/inst/include/current/armadillo_bits/fn_any.hpp index 6de03874..ca619632 100644 --- a/inst/include/current/armadillo_bits/fn_any.hpp +++ b/inst/include/current/armadillo_bits/fn_any.hpp @@ -41,7 +41,7 @@ any(const T1& X) template arma_warn_unused -arma_inline +inline typename enable_if2 < @@ -59,7 +59,7 @@ any(const T1& X) template arma_warn_unused -arma_inline +inline typename enable_if2 < @@ -78,7 +78,7 @@ any(const T1& X, const uword dim) //! for compatibility purposes: allows compiling user code designed for earlier versions of Armadillo template arma_warn_unused -arma_inline +inline typename enable_if2 < diff --git a/inst/include/current/armadillo_bits/fn_circshift.hpp b/inst/include/current/armadillo_bits/fn_circshift.hpp index b2092b06..28b8f47c 100644 --- a/inst/include/current/armadillo_bits/fn_circshift.hpp +++ b/inst/include/current/armadillo_bits/fn_circshift.hpp @@ -17,15 +17,14 @@ -//! \addtogroup fn_shift +//! \addtogroup fn_circshift //! @{ -// TODO: deprecate in favour of circshift() template -arma_warn_unused -arma_inline +// [[deprecated("use circshift() instead")]] +inline typename enable_if2 < @@ -50,7 +49,7 @@ shift template arma_warn_unused -arma_inline +inline typename enable_if2 < @@ -73,9 +72,8 @@ circshift -// TODO: deprecate in favour of circshift() template -arma_warn_unused +// [[deprecated("use circshift() instead")]] inline typename enable_if2 @@ -140,9 +138,8 @@ circshift -// TODO: deprecate in favour of circshift() template -arma_warn_unused +// [[deprecated("use circshift() instead")]] inline typename enable_if2 @@ -217,9 +214,8 @@ circshift -// TODO: deprecate in favour of circshift() template -arma_warn_unused +// [[deprecated("use circshift() instead")]] inline SpMat shift diff --git a/inst/include/current/armadillo_bits/fn_cumprod.hpp b/inst/include/current/armadillo_bits/fn_cumprod.hpp index 4eb9ef16..3221cabb 100644 --- a/inst/include/current/armadillo_bits/fn_cumprod.hpp +++ b/inst/include/current/armadillo_bits/fn_cumprod.hpp @@ -23,7 +23,7 @@ template arma_warn_unused -arma_inline +inline typename enable_if2 < @@ -41,7 +41,7 @@ cumprod(const T1& X) template arma_warn_unused -arma_inline +inline typename enable_if2 < @@ -59,7 +59,7 @@ cumprod(const T1& X) template arma_warn_unused -arma_inline +inline typename enable_if2 < @@ -77,7 +77,7 @@ cumprod(const T1& X, const uword dim) template arma_warn_unused -arma_inline +inline typename arma_scalar_only::result cumprod(const T& x) { diff --git a/inst/include/current/armadillo_bits/fn_cumsum.hpp b/inst/include/current/armadillo_bits/fn_cumsum.hpp index 6c6ea8da..1ef52621 100644 --- a/inst/include/current/armadillo_bits/fn_cumsum.hpp +++ b/inst/include/current/armadillo_bits/fn_cumsum.hpp @@ -23,7 +23,7 @@ template arma_warn_unused -arma_inline +inline typename enable_if2 < @@ -41,7 +41,7 @@ cumsum(const T1& X) template arma_warn_unused -arma_inline +inline typename enable_if2 < @@ -59,7 +59,7 @@ cumsum(const T1& X) template arma_warn_unused -arma_inline +inline typename enable_if2 < @@ -77,7 +77,7 @@ cumsum(const T1& X, const uword dim) template arma_warn_unused -arma_inline +inline typename arma_scalar_only::result cumsum(const T& x) { diff --git a/inst/include/current/armadillo_bits/fn_det.hpp b/inst/include/current/armadillo_bits/fn_det.hpp index d2e85e0a..28a602be 100644 --- a/inst/include/current/armadillo_bits/fn_det.hpp +++ b/inst/include/current/armadillo_bits/fn_det.hpp @@ -70,7 +70,7 @@ det(typename T1::elem_type& out_val, const Base& X) template arma_warn_unused -arma_inline +inline typename arma_scalar_only::result det(const T& x) { diff --git a/inst/include/current/armadillo_bits/fn_diagmat.hpp b/inst/include/current/armadillo_bits/fn_diagmat.hpp index ef5c8abb..a02be1ff 100644 --- a/inst/include/current/armadillo_bits/fn_diagmat.hpp +++ b/inst/include/current/armadillo_bits/fn_diagmat.hpp @@ -23,7 +23,7 @@ //! interpret a matrix or a vector as a diagonal matrix (ie. off-diagonal entries are zero) template arma_warn_unused -arma_inline +inline typename enable_if2 < @@ -42,7 +42,7 @@ diagmat(const T1& X) //! create a matrix with the k-th diagonal set to the given vector template arma_warn_unused -arma_inline +inline typename enable_if2 < diff --git a/inst/include/current/armadillo_bits/fn_diagvec.hpp b/inst/include/current/armadillo_bits/fn_diagvec.hpp index 1dc8a1e9..c2021190 100644 --- a/inst/include/current/armadillo_bits/fn_diagvec.hpp +++ b/inst/include/current/armadillo_bits/fn_diagvec.hpp @@ -23,7 +23,7 @@ //! extract main diagonal from matrix template arma_warn_unused -arma_inline +inline const Op diagvec(const Base& X) { @@ -37,7 +37,7 @@ diagvec(const Base& X) //! extract arbitrary diagonal from matrix template arma_warn_unused -arma_inline +inline const Op diagvec(const Base& X, const sword diag_id) { @@ -50,7 +50,7 @@ diagvec(const Base& X, const sword diag_id) template arma_warn_unused -arma_inline +inline const mtSpReduceOp diagvec(const SpBase& X, const sword diag_id = 0) { diff --git a/inst/include/current/armadillo_bits/fn_diff.hpp b/inst/include/current/armadillo_bits/fn_diff.hpp index 04fac147..a8bb8bf2 100644 --- a/inst/include/current/armadillo_bits/fn_diff.hpp +++ b/inst/include/current/armadillo_bits/fn_diff.hpp @@ -23,7 +23,7 @@ template arma_warn_unused -arma_inline +inline typename enable_if2 < @@ -45,7 +45,7 @@ diff template arma_warn_unused -arma_inline +inline typename enable_if2 < @@ -67,7 +67,7 @@ diff template arma_warn_unused -arma_inline +inline typename enable_if2 < diff --git a/inst/include/current/armadillo_bits/fn_expmat.hpp b/inst/include/current/armadillo_bits/fn_expmat.hpp index 29117f7f..6faf4c00 100644 --- a/inst/include/current/armadillo_bits/fn_expmat.hpp +++ b/inst/include/current/armadillo_bits/fn_expmat.hpp @@ -69,7 +69,7 @@ expmat(Mat& B, const Base& A) template arma_warn_unused -arma_inline +inline typename enable_if2< is_blas_type::value, const Op >::result expmat_sym(const Base& X) { diff --git a/inst/include/current/armadillo_bits/fn_flip.hpp b/inst/include/current/armadillo_bits/fn_flip.hpp index 24cfa298..9f8b55d5 100644 --- a/inst/include/current/armadillo_bits/fn_flip.hpp +++ b/inst/include/current/armadillo_bits/fn_flip.hpp @@ -23,7 +23,7 @@ template arma_warn_unused -arma_inline +inline typename enable_if2< is_arma_type::value, const Op >::result flipud(const T1& X) { @@ -36,7 +36,7 @@ flipud(const T1& X) template arma_warn_unused -arma_inline +inline typename enable_if2< is_arma_type::value, const Op >::result fliplr(const T1& X) { @@ -49,7 +49,7 @@ fliplr(const T1& X) template arma_warn_unused -arma_inline +inline const SpOp flipud(const SpBase& X) { @@ -62,7 +62,7 @@ flipud(const SpBase& X) template arma_warn_unused -arma_inline +inline const SpOp fliplr(const SpBase& X) { diff --git a/inst/include/current/armadillo_bits/fn_hist.hpp b/inst/include/current/armadillo_bits/fn_hist.hpp index 4e03f91d..46b851dc 100644 --- a/inst/include/current/armadillo_bits/fn_hist.hpp +++ b/inst/include/current/armadillo_bits/fn_hist.hpp @@ -22,7 +22,7 @@ template arma_warn_unused -arma_inline +inline typename enable_if2 < @@ -40,7 +40,7 @@ hist(const T1& A, const uword n_bins = 10) template arma_warn_unused -arma_inline +inline typename enable_if2 < @@ -58,7 +58,7 @@ hist(const T1& X, const T2& Y) template arma_warn_unused -arma_inline +inline typename enable_if2 < diff --git a/inst/include/current/armadillo_bits/fn_histc.hpp b/inst/include/current/armadillo_bits/fn_histc.hpp index 887b6888..ef991834 100644 --- a/inst/include/current/armadillo_bits/fn_histc.hpp +++ b/inst/include/current/armadillo_bits/fn_histc.hpp @@ -22,7 +22,7 @@ template arma_warn_unused -arma_inline +inline typename enable_if2 < @@ -40,7 +40,7 @@ histc(const T1& X, const T2& Y) template arma_warn_unused -arma_inline +inline typename enable_if2 < diff --git a/inst/include/current/armadillo_bits/fn_index_max.hpp b/inst/include/current/armadillo_bits/fn_index_max.hpp index 23184d99..f1418429 100644 --- a/inst/include/current/armadillo_bits/fn_index_max.hpp +++ b/inst/include/current/armadillo_bits/fn_index_max.hpp @@ -35,7 +35,7 @@ index_max(const T1& X) template arma_warn_unused -arma_inline +inline typename enable_if2< is_arma_type::value && resolves_to_vector::no, const mtOp >::result index_max(const T1& X) { @@ -48,7 +48,7 @@ index_max(const T1& X) template arma_warn_unused -arma_inline +inline typename enable_if2< is_arma_type::value, const mtOp >::result index_max(const T1& X, const uword dim) { @@ -61,7 +61,7 @@ index_max(const T1& X, const uword dim) template arma_warn_unused -arma_inline +inline const mtOpCube index_max ( diff --git a/inst/include/current/armadillo_bits/fn_index_min.hpp b/inst/include/current/armadillo_bits/fn_index_min.hpp index 42b44102..247eeecf 100644 --- a/inst/include/current/armadillo_bits/fn_index_min.hpp +++ b/inst/include/current/armadillo_bits/fn_index_min.hpp @@ -35,7 +35,7 @@ index_min(const T1& X) template arma_warn_unused -arma_inline +inline typename enable_if2< is_arma_type::value && resolves_to_vector::no, const mtOp >::result index_min(const T1& X) { @@ -48,7 +48,7 @@ index_min(const T1& X) template arma_warn_unused -arma_inline +inline typename enable_if2< is_arma_type::value, const mtOp >::result index_min(const T1& X, const uword dim) { @@ -61,7 +61,7 @@ index_min(const T1& X, const uword dim) template arma_warn_unused -arma_inline +inline const mtOpCube index_min ( diff --git a/inst/include/current/armadillo_bits/fn_kron.hpp b/inst/include/current/armadillo_bits/fn_kron.hpp index 238eab7a..20190f27 100644 --- a/inst/include/current/armadillo_bits/fn_kron.hpp +++ b/inst/include/current/armadillo_bits/fn_kron.hpp @@ -23,7 +23,7 @@ template arma_warn_unused -arma_inline +inline const Glue kron(const Base& A, const Base& B) { @@ -90,7 +90,7 @@ kron(const Base& X, const Base,T2>& Y) template arma_warn_unused -arma_inline +inline const SpGlue kron(const SpBase& A, const SpBase& B) { diff --git a/inst/include/current/armadillo_bits/fn_logmat.hpp b/inst/include/current/armadillo_bits/fn_logmat.hpp index 8c06f0cc..37d49dc4 100644 --- a/inst/include/current/armadillo_bits/fn_logmat.hpp +++ b/inst/include/current/armadillo_bits/fn_logmat.hpp @@ -23,7 +23,7 @@ template arma_warn_unused -arma_inline +inline typename enable_if2< (is_blas_type::value && is_cx::no), const mtOp, T1, op_logmat> >::result logmat(const Base& X, const uword n_iters = 100u) { @@ -36,7 +36,7 @@ logmat(const Base& X, const uword n_iters = 100u) template arma_warn_unused -arma_inline +inline typename enable_if2< (is_blas_type::value && is_cx::yes), const Op >::result logmat(const Base& X, const uword n_iters = 100u) { @@ -93,7 +93,7 @@ logmat(Mat& Y, const Base& X, template arma_warn_unused -arma_inline +inline typename enable_if2< is_blas_type::value, const Op >::result logmat_sympd(const Base& X) { diff --git a/inst/include/current/armadillo_bits/fn_max.hpp b/inst/include/current/armadillo_bits/fn_max.hpp index ed706a06..438ef5b4 100644 --- a/inst/include/current/armadillo_bits/fn_max.hpp +++ b/inst/include/current/armadillo_bits/fn_max.hpp @@ -35,7 +35,7 @@ max(const T1& X) template arma_warn_unused -arma_inline +inline typename enable_if2< is_arma_type::value && resolves_to_vector::no, const Op >::result max(const T1& X) { @@ -48,7 +48,7 @@ max(const T1& X) template arma_warn_unused -arma_inline +inline typename enable_if2< is_arma_type::value, const Op >::result max(const T1& X, const uword dim) { @@ -61,7 +61,7 @@ max(const T1& X, const uword dim) template arma_warn_unused -arma_inline +inline typename arma_scalar_only::result max(const T& x) { @@ -73,7 +73,7 @@ max(const T& x) //! element-wise maximum template arma_warn_unused -arma_inline +inline typename enable_if2 < @@ -95,7 +95,7 @@ max template arma_warn_unused -arma_inline +inline const OpCube max ( @@ -112,7 +112,7 @@ max template arma_warn_unused -arma_inline +inline const GlueCube max ( diff --git a/inst/include/current/armadillo_bits/fn_mean.hpp b/inst/include/current/armadillo_bits/fn_mean.hpp index 87c698b7..3d36f2b6 100644 --- a/inst/include/current/armadillo_bits/fn_mean.hpp +++ b/inst/include/current/armadillo_bits/fn_mean.hpp @@ -36,7 +36,7 @@ mean(const T1& X) template arma_warn_unused -arma_inline +inline typename enable_if2< is_arma_type::value && resolves_to_vector::no, const Op >::result mean(const T1& X) { @@ -49,7 +49,7 @@ mean(const T1& X) template arma_warn_unused -arma_inline +inline typename enable_if2< is_arma_type::value, const Op >::result mean(const T1& X, const uword dim) { @@ -62,7 +62,7 @@ mean(const T1& X, const uword dim) template arma_warn_unused -arma_inline +inline typename arma_scalar_only::result mean(const T& x) { @@ -73,7 +73,7 @@ mean(const T& x) template arma_warn_unused -arma_inline +inline const OpCube mean ( diff --git a/inst/include/current/armadillo_bits/fn_median.hpp b/inst/include/current/armadillo_bits/fn_median.hpp index 29919cf8..359f00a6 100644 --- a/inst/include/current/armadillo_bits/fn_median.hpp +++ b/inst/include/current/armadillo_bits/fn_median.hpp @@ -35,7 +35,7 @@ median(const T1& X) template arma_warn_unused -arma_inline +inline typename enable_if2< is_arma_type::value && resolves_to_vector::no, const Op >::result median(const T1& X) { @@ -48,7 +48,7 @@ median(const T1& X) template arma_warn_unused -arma_inline +inline typename enable_if2< is_arma_type::value, const Op >::result median(const T1& X, const uword dim) { @@ -61,7 +61,7 @@ median(const T1& X, const uword dim) template arma_warn_unused -arma_inline +inline typename arma_scalar_only::result median(const T& x) { diff --git a/inst/include/current/armadillo_bits/fn_min.hpp b/inst/include/current/armadillo_bits/fn_min.hpp index 8f8515fe..4ab65ec3 100644 --- a/inst/include/current/armadillo_bits/fn_min.hpp +++ b/inst/include/current/armadillo_bits/fn_min.hpp @@ -35,7 +35,7 @@ min(const T1& X) template arma_warn_unused -arma_inline +inline typename enable_if2< is_arma_type::value && resolves_to_vector::no, const Op >::result min(const T1& X) { @@ -48,7 +48,7 @@ min(const T1& X) template arma_warn_unused -arma_inline +inline typename enable_if2< is_arma_type::value, const Op >::result min(const T1& X, const uword dim) { @@ -61,7 +61,7 @@ min(const T1& X, const uword dim) template arma_warn_unused -arma_inline +inline typename arma_scalar_only::result min(const T& x) { @@ -73,7 +73,7 @@ min(const T& x) //! element-wise minimum template arma_warn_unused -arma_inline +inline typename enable_if2 < @@ -95,7 +95,7 @@ min template arma_warn_unused -arma_inline +inline const OpCube min ( @@ -112,7 +112,7 @@ min template arma_warn_unused -arma_inline +inline const GlueCube min ( diff --git a/inst/include/current/armadillo_bits/fn_normalise.hpp b/inst/include/current/armadillo_bits/fn_normalise.hpp index b9199927..bbe51d6a 100644 --- a/inst/include/current/armadillo_bits/fn_normalise.hpp +++ b/inst/include/current/armadillo_bits/fn_normalise.hpp @@ -95,7 +95,7 @@ normalise //! for compatibility purposes: allows compiling user code designed for earlier versions of Armadillo template arma_warn_unused -arma_inline +inline typename enable_if2 < diff --git a/inst/include/current/armadillo_bits/fn_orth_null.hpp b/inst/include/current/armadillo_bits/fn_orth_null.hpp index eacf7214..38baf9c4 100644 --- a/inst/include/current/armadillo_bits/fn_orth_null.hpp +++ b/inst/include/current/armadillo_bits/fn_orth_null.hpp @@ -23,7 +23,7 @@ template arma_warn_unused -arma_inline +inline typename enable_if2< is_blas_real::value, const Op >::result orth(const Base& X, const typename T1::pod_type tol = 0.0) { @@ -62,7 +62,7 @@ orth(Mat& out, const Base& X template arma_warn_unused -arma_inline +inline typename enable_if2< is_blas_real::value, const Op >::result null(const Base& X, const typename T1::pod_type tol = 0.0) { diff --git a/inst/include/current/armadillo_bits/fn_prod.hpp b/inst/include/current/armadillo_bits/fn_prod.hpp index b2e3480c..47ecef63 100644 --- a/inst/include/current/armadillo_bits/fn_prod.hpp +++ b/inst/include/current/armadillo_bits/fn_prod.hpp @@ -20,13 +20,6 @@ //! @{ -//! \brief -//! Delayed product of elements of a matrix along a specified dimension (either rows or columns). -//! The result is stored in a dense matrix that has either one column or one row. -//! For dim = 0, find the sum of each column (ie. traverse across rows) -//! For dim = 1, find the sum of each row (ie. traverse across columns) -//! The default is dim = 0. -//! NOTE: this function works differently than in Matlab/Octave. template arma_warn_unused @@ -43,7 +36,7 @@ prod(const T1& X) template arma_warn_unused -arma_inline +inline typename enable_if2< is_arma_type::value && resolves_to_vector::no, const Op >::result prod(const T1& X) { @@ -56,7 +49,7 @@ prod(const T1& X) template arma_warn_unused -arma_inline +inline typename enable_if2< is_arma_type::value, const Op >::result prod(const T1& X, const uword dim) { @@ -69,7 +62,7 @@ prod(const T1& X, const uword dim) template arma_warn_unused -arma_inline +inline typename arma_scalar_only::result prod(const T& x) { diff --git a/inst/include/current/armadillo_bits/fn_quantile.hpp b/inst/include/current/armadillo_bits/fn_quantile.hpp index 27f19cf6..2f8a520b 100644 --- a/inst/include/current/armadillo_bits/fn_quantile.hpp +++ b/inst/include/current/armadillo_bits/fn_quantile.hpp @@ -22,7 +22,7 @@ template arma_warn_unused -arma_inline +inline typename enable_if2 < @@ -40,7 +40,7 @@ quantile(const T1& X, const Base& P) template arma_warn_unused -arma_inline +inline typename enable_if2 < diff --git a/inst/include/current/armadillo_bits/fn_rande.hpp b/inst/include/current/armadillo_bits/fn_rande.hpp new file mode 100644 index 00000000..d7c655f4 --- /dev/null +++ b/inst/include/current/armadillo_bits/fn_rande.hpp @@ -0,0 +1,241 @@ +// SPDX-License-Identifier: Apache-2.0 +// +// Copyright 2008-2016 Conrad Sanderson (https://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 +// https://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 fn_rande +//! @{ + + + +template +arma_warn_unused +inline +obj_type +rande(const uword n_rows, const uword n_cols, const distr_param& param = distr_param(), const typename arma_Mat_Col_Row_only::result* junk = nullptr) + { + arma_debug_sigprint(); + arma_ignore(junk); + + typedef typename obj_type::elem_type eT; + + if(is_Col::value) + { + arma_conform_check( (n_cols != 1), "rande(): incompatible size" ); + } + else + if(is_Row::value) + { + arma_conform_check( (n_rows != 1), "rande(): incompatible size" ); + } + + double lambda = double(1); + double unused = double(0); + + param.get_double_vals(lambda, unused); + + arma_conform_check( (lambda <= double(0)), "rande(): incorrect distribution parameters; lambda must be greater than zero" ); + + obj_type out(n_rows, n_cols, arma_nozeros_indicator()); + + arma_rng::rande::fill(out.memptr(), out.n_elem, lambda); + + return out; + } + + + +template +arma_warn_unused +inline +obj_type +rande(const SizeMat& s, const distr_param& param = distr_param(), const typename arma_Mat_Col_Row_only::result* junk = nullptr) + { + arma_debug_sigprint(); + arma_ignore(junk); + + return rande(s.n_rows, s.n_cols, param); + } + + + +template +arma_warn_unused +inline +obj_type +rande(const uword n_elem, const distr_param& param = distr_param(), const arma_empty_class junk1 = arma_empty_class(), const typename arma_Mat_Col_Row_only::result* junk2 = nullptr) + { + arma_debug_sigprint(); + arma_ignore(junk1); + arma_ignore(junk2); + + const uword n_rows = (is_Row::value) ? uword(1) : n_elem; + const uword n_cols = (is_Row::value) ? n_elem : uword(1); + + return rande(n_rows, n_cols, param); + } + + + +arma_warn_unused +inline +mat +rande(const uword n_rows, const uword n_cols, const distr_param& param = distr_param()) + { + arma_debug_sigprint(); + + return rande(n_rows, n_cols, param); + } + + + +arma_warn_unused +inline +mat +rande(const SizeMat& s, const distr_param& param = distr_param()) + { + arma_debug_sigprint(); + + return rande(s.n_rows, s.n_cols, param); + } + + + +arma_warn_unused +inline +vec +rande(const uword n_elem, const distr_param& param = distr_param()) + { + arma_debug_sigprint(); + + return rande(n_elem, uword(1), param); + } + + + +arma_warn_unused +inline +double +rande(const distr_param& param = distr_param()) + { + arma_debug_sigprint(); + + double lambda = double(1); + double unused = double(0); + + param.get_double_vals(lambda, unused); + + arma_conform_check( (lambda <= double(0)), "rande(): incorrect distribution parameters; lambda must be greater than zero" ); + + double out_val = double(0); + + arma_rng::rande::fill(&out_val, uword(1), lambda); + + return out_val; + } + + + +template +arma_warn_unused +inline +typename arma_real_or_cx_only::result +rande(const distr_param& param = distr_param()) + { + arma_debug_sigprint(); + + double lambda = double(1); + double unused = double(0); + + param.get_double_vals(lambda, unused); + + arma_conform_check( (lambda <= double(0)), "rande(): incorrect distribution parameters; lambda must be greater than zero" ); + + eT out_val = eT(0); + + arma_rng::rande::fill(&out_val, uword(1), lambda); + + return out_val; + } + + + +template +arma_warn_unused +inline +cube_type +rande(const uword n_rows, const uword n_cols, const uword n_slices, const distr_param& param = distr_param(), const typename arma_Cube_only::result* junk = nullptr) + { + arma_debug_sigprint(); + arma_ignore(junk); + + typedef typename cube_type::elem_type eT; + + double lambda = double(1); + double unused = double(0); + + param.get_double_vals(lambda, unused); + + arma_conform_check( (lambda <= double(0)), "rande(): incorrect distribution parameters; lambda must be greater than zero" ); + + cube_type out(n_rows, n_cols, n_slices, arma_nozeros_indicator()); + + arma_rng::rande::fill(out.memptr(), out.n_elem, lambda); + + return out; + } + + + +template +arma_warn_unused +inline +cube_type +rande(const SizeCube& s, const distr_param& param = distr_param(), const typename arma_Cube_only::result* junk = nullptr) + { + arma_debug_sigprint(); + arma_ignore(junk); + + return rande(s.n_rows, s.n_cols, s.n_slices, param); + } + + + +arma_warn_unused +inline +cube +rande(const uword n_rows, const uword n_cols, const uword n_slices, const distr_param& param = distr_param()) + { + arma_debug_sigprint(); + + return rande(n_rows, n_cols, n_slices, param); + } + + + +arma_warn_unused +inline +cube +rande(const SizeCube& s, const distr_param& param = distr_param()) + { + arma_debug_sigprint(); + + return rande(s.n_rows, s.n_cols, s.n_slices, param); + } + + + +//! @} diff --git a/inst/include/current/armadillo_bits/fn_range.hpp b/inst/include/current/armadillo_bits/fn_range.hpp index 19495038..c7808c90 100644 --- a/inst/include/current/armadillo_bits/fn_range.hpp +++ b/inst/include/current/armadillo_bits/fn_range.hpp @@ -35,7 +35,7 @@ range(const T1& X) template arma_warn_unused -arma_inline +inline typename enable_if2< is_arma_type::value && resolves_to_vector::no, const Op >::result range(const T1& X) { @@ -48,7 +48,7 @@ range(const T1& X) template arma_warn_unused -arma_inline +inline typename enable_if2< is_arma_type::value, const Op >::result range(const T1& X, const uword dim) { diff --git a/inst/include/current/armadillo_bits/fn_repelem.hpp b/inst/include/current/armadillo_bits/fn_repelem.hpp index 038feb6f..00bb11df 100644 --- a/inst/include/current/armadillo_bits/fn_repelem.hpp +++ b/inst/include/current/armadillo_bits/fn_repelem.hpp @@ -23,7 +23,7 @@ template arma_warn_unused -arma_inline +inline typename enable_if2 < @@ -41,7 +41,7 @@ repelem(const T1& A, const uword r, const uword c) template arma_warn_unused -arma_inline +inline const SpOp repelem(const SpBase& A, const uword r, const uword c) { diff --git a/inst/include/current/armadillo_bits/fn_shuffle.hpp b/inst/include/current/armadillo_bits/fn_shuffle.hpp index 743a84b9..b76ab221 100644 --- a/inst/include/current/armadillo_bits/fn_shuffle.hpp +++ b/inst/include/current/armadillo_bits/fn_shuffle.hpp @@ -23,7 +23,7 @@ template arma_warn_unused -arma_inline +inline typename enable_if2 < @@ -44,7 +44,7 @@ shuffle template arma_warn_unused -arma_inline +inline typename enable_if2 < @@ -65,7 +65,7 @@ shuffle template arma_warn_unused -arma_inline +inline typename enable_if2 < diff --git a/inst/include/current/armadillo_bits/fn_sort.hpp b/inst/include/current/armadillo_bits/fn_sort.hpp index 3feadd81..77e129ab 100644 --- a/inst/include/current/armadillo_bits/fn_sort.hpp +++ b/inst/include/current/armadillo_bits/fn_sort.hpp @@ -23,7 +23,7 @@ template arma_warn_unused -arma_inline +inline typename enable_if2 < @@ -44,7 +44,7 @@ sort template arma_warn_unused -arma_inline +inline typename enable_if2 < diff --git a/inst/include/current/armadillo_bits/fn_sort_index.hpp b/inst/include/current/armadillo_bits/fn_sort_index.hpp index fd6c4838..c7babd99 100644 --- a/inst/include/current/armadillo_bits/fn_sort_index.hpp +++ b/inst/include/current/armadillo_bits/fn_sort_index.hpp @@ -23,7 +23,7 @@ template arma_warn_unused -arma_inline +inline const mtOp sort_index ( @@ -70,7 +70,7 @@ sort_index // DO NOT USE: kept only for compatibility with old user code template arma_warn_unused -arma_inline +inline const mtOp stable_sort_index ( diff --git a/inst/include/current/armadillo_bits/fn_sqrtmat.hpp b/inst/include/current/armadillo_bits/fn_sqrtmat.hpp index 697c30d6..4aa1a93a 100644 --- a/inst/include/current/armadillo_bits/fn_sqrtmat.hpp +++ b/inst/include/current/armadillo_bits/fn_sqrtmat.hpp @@ -23,7 +23,7 @@ template arma_warn_unused -arma_inline +inline typename enable_if2< (is_blas_type::value && is_cx::no), const mtOp, T1, op_sqrtmat> >::result sqrtmat(const Base& X) { @@ -36,7 +36,7 @@ sqrtmat(const Base& X) template arma_warn_unused -arma_inline +inline typename enable_if2< (is_blas_type::value && is_cx::yes), const Op >::result sqrtmat(const Base& X) { @@ -91,7 +91,7 @@ sqrtmat(Mat& Y, const Base& X template arma_warn_unused -arma_inline +inline typename enable_if2< is_blas_type::value, const Op >::result sqrtmat_sympd(const Base& X) { diff --git a/inst/include/current/armadillo_bits/fn_symmat.hpp b/inst/include/current/armadillo_bits/fn_symmat.hpp index b6b4fa53..1a8295ad 100644 --- a/inst/include/current/armadillo_bits/fn_symmat.hpp +++ b/inst/include/current/armadillo_bits/fn_symmat.hpp @@ -22,7 +22,7 @@ template arma_warn_unused -arma_inline +inline typename enable_if2< is_cx::no, const Op >::result symmatu(const Base& X, const bool do_conj = false) { @@ -36,7 +36,7 @@ symmatu(const Base& X, const bool do_conj = false) template arma_warn_unused -arma_inline +inline typename enable_if2< is_cx::no, const Op >::result symmatl(const Base& X, const bool do_conj = false) { @@ -50,7 +50,7 @@ symmatl(const Base& X, const bool do_conj = false) template arma_warn_unused -arma_inline +inline typename enable_if2< is_cx::yes, const Op >::result symmatu(const Base& X, const bool do_conj = true) { @@ -63,7 +63,7 @@ symmatu(const Base& X, const bool do_conj = true) template arma_warn_unused -arma_inline +inline typename enable_if2< is_cx::yes, const Op >::result symmatl(const Base& X, const bool do_conj = true) { @@ -80,7 +80,7 @@ symmatl(const Base& X, const bool do_conj = true) template arma_warn_unused -arma_inline +inline typename enable_if2< is_cx::no, const SpOp >::result symmatu(const SpBase& X, const bool do_conj = false) { @@ -94,7 +94,7 @@ symmatu(const SpBase& X, const bool do_conj = false) template arma_warn_unused -arma_inline +inline typename enable_if2< is_cx::no, const SpOp >::result symmatl(const SpBase& X, const bool do_conj = false) { @@ -108,7 +108,7 @@ symmatl(const SpBase& X, const bool do_conj = false) template arma_warn_unused -arma_inline +inline typename enable_if2< is_cx::yes, const SpOp >::result symmatu(const SpBase& X, const bool do_conj = true) { @@ -121,7 +121,7 @@ symmatu(const SpBase& X, const bool do_conj = true) template arma_warn_unused -arma_inline +inline typename enable_if2< is_cx::yes, const SpOp >::result symmatl(const SpBase& X, const bool do_conj = true) { diff --git a/inst/include/current/armadillo_bits/glue_join_bones.hpp b/inst/include/current/armadillo_bits/glue_join_bones.hpp index 2b595e51..d5910d57 100644 --- a/inst/include/current/armadillo_bits/glue_join_bones.hpp +++ b/inst/include/current/armadillo_bits/glue_join_bones.hpp @@ -36,7 +36,10 @@ struct glue_join_cols inline static void apply(Mat& out, const Glue& X); template - inline static void apply_noalias(Mat& out, const Proxy& A, const Proxy& B); + inline static void apply(Mat_noalias& out, const Glue& X); + + template + inline static void apply_noalias(Mat& out, const Mat& A, const Mat& B); template inline static void apply(Mat& out, const Base& A, const Base& B, const Base& C); @@ -61,7 +64,10 @@ struct glue_join_rows inline static void apply(Mat& out, const Glue& X); template - inline static void apply_noalias(Mat& out, const Proxy& A, const Proxy& B); + inline static void apply(Mat_noalias& out, const Glue& X); + + template + inline static void apply_noalias(Mat& out, const Mat& A, const Mat& B); template inline static void apply(Mat& out, const Base& A, const Base& B, const Base& C); diff --git a/inst/include/current/armadillo_bits/glue_join_meat.hpp b/inst/include/current/armadillo_bits/glue_join_meat.hpp index 58ae5f62..3af809c7 100644 --- a/inst/include/current/armadillo_bits/glue_join_meat.hpp +++ b/inst/include/current/armadillo_bits/glue_join_meat.hpp @@ -21,44 +21,38 @@ -template +template inline void -glue_join_cols::apply_noalias(Mat& out, const Proxy& A, const Proxy& B) +glue_join_cols::apply_noalias(Mat& out, const Mat& A, const Mat& B) { arma_debug_sigprint(); - const uword A_n_rows = A.get_n_rows(); - const uword A_n_cols = A.get_n_cols(); - - const uword B_n_rows = B.get_n_rows(); - const uword B_n_cols = B.get_n_cols(); - arma_conform_check ( - ( (A_n_cols != B_n_cols) && ( (A_n_rows > 0) || (A_n_cols > 0) ) && ( (B_n_rows > 0) || (B_n_cols > 0) ) ), + ( (A.n_cols != B.n_cols) && ( (A.n_rows > 0) || (A.n_cols > 0) ) && ( (B.n_rows > 0) || (B.n_cols > 0) ) ), "join_cols() / join_vert(): number of columns must be the same" ); - out.set_size( A_n_rows + B_n_rows, (std::max)(A_n_cols, B_n_cols) ); + out.set_size( A.n_rows + B.n_rows, (std::max)(A.n_cols, B.n_cols) ); if( out.n_elem > 0 ) { - if(A.get_n_elem() > 0) + if(A.n_elem> 0) { - out.submat(0, 0, A_n_rows-1, out.n_cols-1) = A.Q; + out.submat(0, 0, A.n_rows-1, out.n_cols-1) = A; } - if(B.get_n_elem() > 0) + if(B.n_elem > 0) { - out.submat(A_n_rows, 0, out.n_rows-1, out.n_cols-1) = B.Q; + out.submat(A.n_rows, 0, out.n_rows-1, out.n_cols-1) = B; } } } - - - - + + + + template inline void @@ -68,18 +62,18 @@ glue_join_cols::apply(Mat& out, const Glue A(X.A); - const Proxy B(X.B); + const quasi_unwrap UA(X.A); + const quasi_unwrap UB(X.B); - if( (A.is_alias(out) == false) && (B.is_alias(out) == false) ) + if( (UA.is_alias(out) == false) && (UB.is_alias(out) == false) ) { - glue_join_cols::apply_noalias(out, A, B); + glue_join_cols::apply_noalias(out, UA.M, UB.M); } else { Mat tmp; - glue_join_cols::apply_noalias(tmp, A, B); + glue_join_cols::apply_noalias(tmp, UA.M, UB.M); out.steal_mem(tmp); } @@ -87,6 +81,21 @@ glue_join_cols::apply(Mat& out, const Glue +inline +void +glue_join_cols::apply(Mat_noalias& out, const Glue& X) + { + arma_debug_sigprint(); + + const quasi_unwrap UA(X.A); + const quasi_unwrap UB(X.B); + + glue_join_cols::apply_noalias(out, UA.M, UB.M); + } + + + template inline void @@ -178,44 +187,42 @@ glue_join_cols::apply(Mat& out, const Base& A_expr, const Base -template +// + + + +template inline void -glue_join_rows::apply_noalias(Mat& out, const Proxy& A, const Proxy& B) +glue_join_rows::apply_noalias(Mat& out, const Mat& A, const Mat& B) { arma_debug_sigprint(); - const uword A_n_rows = A.get_n_rows(); - const uword A_n_cols = A.get_n_cols(); - - const uword B_n_rows = B.get_n_rows(); - const uword B_n_cols = B.get_n_cols(); - arma_conform_check ( - ( (A_n_rows != B_n_rows) && ( (A_n_rows > 0) || (A_n_cols > 0) ) && ( (B_n_rows > 0) || (B_n_cols > 0) ) ), + ( (A.n_rows != B.n_rows) && ( (A.n_rows > 0) || (A.n_cols > 0) ) && ( (B.n_rows > 0) || (B.n_cols > 0) ) ), "join_rows() / join_horiz(): number of rows must be the same" ); - out.set_size( (std::max)(A_n_rows, B_n_rows), A_n_cols + B_n_cols ); + out.set_size( (std::max)(A.n_rows, B.n_rows), A.n_cols + B.n_cols ); if( out.n_elem > 0 ) { - if(A.get_n_elem() > 0) + if(A.n_elem > 0) { - out.submat(0, 0, out.n_rows-1, A_n_cols-1) = A.Q; + out.submat(0, 0, out.n_rows-1, A.n_cols-1) = A; } - if(B.get_n_elem() > 0) + if(B.n_elem > 0) { - out.submat(0, A_n_cols, out.n_rows-1, out.n_cols-1) = B.Q; + out.submat(0, A.n_cols, out.n_rows-1, out.n_cols-1) = B; } } } - - - - + + + + template inline void @@ -225,18 +232,18 @@ glue_join_rows::apply(Mat& out, const Glue A(X.A); - const Proxy B(X.B); + const quasi_unwrap UA(X.A); + const quasi_unwrap UB(X.B); - if( (A.is_alias(out) == false) && (B.is_alias(out) == false) ) + if( (UA.is_alias(out) == false) && (UB.is_alias(out) == false) ) { - glue_join_rows::apply_noalias(out, A, B); + glue_join_rows::apply_noalias(out, UA.M, UB.M); } else { Mat tmp; - glue_join_rows::apply_noalias(tmp, A, B); + glue_join_rows::apply_noalias(tmp, UA.M, UB.M); out.steal_mem(tmp); } @@ -244,6 +251,21 @@ glue_join_rows::apply(Mat& out, const Glue +inline +void +glue_join_rows::apply(Mat_noalias& out, const Glue& X) + { + arma_debug_sigprint(); + + const quasi_unwrap UA(X.A); + const quasi_unwrap UB(X.B); + + glue_join_rows::apply_noalias(out, UA.M, UB.M); + } + + + template inline void @@ -335,6 +357,10 @@ glue_join_rows::apply(Mat& out, const Base& A_expr, const Base +// + + + template inline void diff --git a/inst/include/current/armadillo_bits/glue_kron_bones.hpp b/inst/include/current/armadillo_bits/glue_kron_bones.hpp index 2fa12ff1..56dfbaf1 100644 --- a/inst/include/current/armadillo_bits/glue_kron_bones.hpp +++ b/inst/include/current/armadillo_bits/glue_kron_bones.hpp @@ -36,7 +36,9 @@ struct glue_kron template inline static void direct_kron(Mat< std::complex >& out, const Mat< std::complex >& A, const Mat& B); template inline static void direct_kron(Mat< std::complex >& out, const Mat& A, const Mat< std::complex >& B); - template inline static void apply(Mat& out, const Glue& X); + template inline static void apply(Mat& out, const Glue& X); + + template inline static void apply(Mat_noalias& out, const Glue& X); }; diff --git a/inst/include/current/armadillo_bits/glue_kron_meat.hpp b/inst/include/current/armadillo_bits/glue_kron_meat.hpp index c2f74d65..34b89910 100644 --- a/inst/include/current/armadillo_bits/glue_kron_meat.hpp +++ b/inst/include/current/armadillo_bits/glue_kron_meat.hpp @@ -21,8 +21,6 @@ -//! \brief -//! both input matrices have the same element type template inline void @@ -50,9 +48,6 @@ glue_kron::direct_kron(Mat& out, const Mat& A, const Mat& B) -//! \brief -//! different types of input matrices -//! A -> complex, B -> basic element type template inline void @@ -84,9 +79,6 @@ glue_kron::direct_kron(Mat< std::complex >& out, const Mat< std::complex > -//! \brief -//! different types of input matrices -//! A -> basic element type, B -> complex template inline void @@ -114,8 +106,6 @@ glue_kron::direct_kron(Mat< std::complex >& out, const Mat& A, const Mat< -//! \brief -//! apply Kronecker product for two objects with same element type template inline void @@ -144,4 +134,19 @@ glue_kron::apply(Mat& out, const Glue& +template +inline +void +glue_kron::apply(Mat_noalias& out, const Glue& X) + { + arma_debug_sigprint(); + + const quasi_unwrap UA(X.A); + const quasi_unwrap UB(X.B); + + glue_kron::direct_kron(out, UA.M, UB.M); + } + + + //! @} diff --git a/inst/include/current/armadillo_bits/glue_polyfit_bones.hpp b/inst/include/current/armadillo_bits/glue_polyfit_bones.hpp index f0aed4a6..70f64c02 100644 --- a/inst/include/current/armadillo_bits/glue_polyfit_bones.hpp +++ b/inst/include/current/armadillo_bits/glue_polyfit_bones.hpp @@ -36,7 +36,11 @@ struct glue_polyfit template inline static bool apply_direct(Mat& out, const Base& X_expr, const Base& Y_expr, const uword N); + template inline static bool apply_direct(Mat_noalias& out, const Base& X_expr, const Base& Y_expr, const uword N); + template inline static void apply(Mat& out, const Glue& expr); + + template inline static void apply(Mat_noalias& out, const Glue& expr); }; diff --git a/inst/include/current/armadillo_bits/glue_polyfit_meat.hpp b/inst/include/current/armadillo_bits/glue_polyfit_meat.hpp index a5e618f9..3fe7fa83 100644 --- a/inst/include/current/armadillo_bits/glue_polyfit_meat.hpp +++ b/inst/include/current/armadillo_bits/glue_polyfit_meat.hpp @@ -83,11 +83,7 @@ glue_polyfit::apply_direct(Mat& out, const Base= X.n_elem), "polyfit(): N must be less than the number of elements in X" ); @@ -99,7 +95,9 @@ glue_polyfit::apply_direct(Mat& out, const Base tmp; + status = glue_polyfit::apply_noalias(tmp, X_as_colvec, Y_as_colvec, N); + out.steal_mem(tmp); } else @@ -112,6 +110,41 @@ glue_polyfit::apply_direct(Mat& out, const Base +inline +bool +glue_polyfit::apply_direct(Mat_noalias& out, const Base& X_expr, const Base& Y_expr, const uword N) + { + arma_debug_sigprint(); + + typedef typename T1::elem_type eT; + + const quasi_unwrap UX(X_expr.get_ref()); + const quasi_unwrap UY(Y_expr.get_ref()); + + const Mat& X = UX.M; + const Mat& Y = UY.M; + + arma_conform_check + ( + ( ((X.is_vec() == false) && (X.is_empty() == false)) || ((Y.is_vec() == false) && (Y.is_empty() == false)) ), + "polyfit(): given object must be a vector" + ); + + arma_conform_check( (X.n_elem != Y.n_elem), "polyfit(): given vectors must have the same number of elements" ); + + if(X.n_elem == 0) { out.reset(); return true; } + + arma_conform_check( (N >= X.n_elem), "polyfit(): N must be less than the number of elements in X" ); + + const Col X_as_colvec( const_cast(X.memptr()), X.n_elem, false, false); + const Col Y_as_colvec( const_cast(Y.memptr()), Y.n_elem, false, false); + + return glue_polyfit::apply_noalias(out, X_as_colvec, Y_as_colvec, N); + } + + + template inline void @@ -130,4 +163,22 @@ glue_polyfit::apply(Mat& out, const Glue +inline +void +glue_polyfit::apply(Mat_noalias& out, const Glue& expr) + { + arma_debug_sigprint(); + + const bool status = glue_polyfit::apply_direct(out, expr.A, expr.B, expr.aux_uword); + + if(status == false) + { + out.soft_reset(); + arma_stop_runtime_error("polyfit(): failed"); + } + } + + + //! @} diff --git a/inst/include/current/armadillo_bits/glue_polyval_bones.hpp b/inst/include/current/armadillo_bits/glue_polyval_bones.hpp index 21d0d7e3..ae8d70ca 100644 --- a/inst/include/current/armadillo_bits/glue_polyval_bones.hpp +++ b/inst/include/current/armadillo_bits/glue_polyval_bones.hpp @@ -35,9 +35,10 @@ struct glue_polyval template inline static void apply_noalias(Mat& out, const Mat& P, const Mat& X); template inline static void apply(Mat& out, const Glue& expr); + + template inline static void apply(Mat_noalias& out, const Glue& expr); }; //! @} - diff --git a/inst/include/current/armadillo_bits/glue_polyval_meat.hpp b/inst/include/current/armadillo_bits/glue_polyval_meat.hpp index 18fed37e..5ebbb3fe 100644 --- a/inst/include/current/armadillo_bits/glue_polyval_meat.hpp +++ b/inst/include/current/armadillo_bits/glue_polyval_meat.hpp @@ -55,29 +55,43 @@ glue_polyval::apply(Mat& out, const Glue UP(expr.A); const quasi_unwrap UX(expr.B); - const Mat& P = UP.M; - const Mat& X = UX.M; + arma_conform_check( ((UP.M.is_vec() == false) && (UP.M.is_empty() == false)), "polyval(): argument P must be a vector" ); - arma_conform_check( ((P.is_vec() == false) && (P.is_empty() == false)), "polyval(): argument P must be a vector" ); - - if(P.is_empty() || X.is_empty()) - { - out.zeros(X.n_rows, X.n_cols); - return; - } + if(UP.M.is_empty() || UX.M.is_empty()) { out.zeros(UX.M.n_rows, UX.M.n_cols); return; } if(UP.is_alias(out) || UX.is_alias(out)) { Mat tmp; - glue_polyval::apply_noalias(tmp, P, X); + + glue_polyval::apply_noalias(tmp, UP.M, UX.M); + out.steal_mem(tmp); } else { - glue_polyval::apply_noalias(out, P, X); + glue_polyval::apply_noalias(out, UP.M, UX.M); } } +template +inline +void +glue_polyval::apply(Mat_noalias& out, const Glue& expr) + { + arma_debug_sigprint(); + + const quasi_unwrap UP(expr.A); + const quasi_unwrap UX(expr.B); + + arma_conform_check( ((UP.M.is_vec() == false) && (UP.M.is_empty() == false)), "polyval(): argument P must be a vector" ); + + if(UP.M.is_empty() || UX.M.is_empty()) { out.zeros(UX.M.n_rows, UX.M.n_cols); return; } + + glue_polyval::apply_noalias(out, UP.M, UX.M); + } + + + //! @} diff --git a/inst/include/current/armadillo_bits/glue_quantile_bones.hpp b/inst/include/current/armadillo_bits/glue_quantile_bones.hpp index dd182360..499b28ae 100644 --- a/inst/include/current/armadillo_bits/glue_quantile_bones.hpp +++ b/inst/include/current/armadillo_bits/glue_quantile_bones.hpp @@ -32,6 +32,9 @@ struct glue_quantile template inline static void apply(Mat& out, const mtGlue& expr); + + template + inline static void apply(Mat_noalias& out, const mtGlue& expr); }; @@ -48,6 +51,9 @@ struct glue_quantile_default template inline static void apply(Mat& out, const mtGlue& expr); + + template + inline static void apply(Mat_noalias& out, const mtGlue& expr); }; diff --git a/inst/include/current/armadillo_bits/glue_quantile_meat.hpp b/inst/include/current/armadillo_bits/glue_quantile_meat.hpp index 044cf5cc..14a9898d 100644 --- a/inst/include/current/armadillo_bits/glue_quantile_meat.hpp +++ b/inst/include/current/armadillo_bits/glue_quantile_meat.hpp @@ -196,6 +196,31 @@ glue_quantile::apply(Mat& out, const mtGlue +inline +void +glue_quantile::apply(Mat_noalias& out, const mtGlue& expr) + { + arma_debug_sigprint(); + + const uword dim = expr.aux_uword; + + arma_conform_check( (dim > 1), "quantile(): parameter 'dim' must be 0 or 1" ); + + const quasi_unwrap UA(expr.A); + const quasi_unwrap UB(expr.B); + + arma_conform_check((UA.M.internal_has_nan() || UB.M.internal_has_nan()), "quantile(): detected NaN"); + + glue_quantile::apply_noalias(out, UA.M, UB.M, dim); + } + + + +// + + + template inline void @@ -227,4 +252,23 @@ glue_quantile_default::apply(Mat& out, const mtGlue +inline +void +glue_quantile_default::apply(Mat_noalias& out, const mtGlue& expr) + { + arma_debug_sigprint(); + + const quasi_unwrap UA(expr.A); + const quasi_unwrap UB(expr.B); + + const uword dim = (T1::is_xvec) ? uword(UA.M.is_rowvec() ? 1 : 0) : uword((T1::is_row) ? 1 : 0); + + arma_conform_check((UA.M.internal_has_nan() || UB.M.internal_has_nan()), "quantile(): detected NaN"); + + glue_quantile::apply_noalias(out, UA.M, UB.M, dim); + } + + //! @} diff --git a/inst/include/current/armadillo_bits/glue_times_bones.hpp b/inst/include/current/armadillo_bits/glue_times_bones.hpp index 6443033e..a3dfb7e9 100644 --- a/inst/include/current/armadillo_bits/glue_times_bones.hpp +++ b/inst/include/current/armadillo_bits/glue_times_bones.hpp @@ -40,7 +40,7 @@ struct depth_lhs< glue_type, Glue > -template +template struct glue_times_redirect2_helper { template @@ -48,8 +48,8 @@ struct glue_times_redirect2_helper }; -template<> -struct glue_times_redirect2_helper +template +struct glue_times_redirect2_helper { template arma_hot inline static void apply(Mat& out, const Glue& X); @@ -57,7 +57,7 @@ struct glue_times_redirect2_helper -template +template struct glue_times_redirect3_helper { template @@ -65,8 +65,8 @@ struct glue_times_redirect3_helper }; -template<> -struct glue_times_redirect3_helper +template +struct glue_times_redirect3_helper { template arma_hot inline static void apply(Mat& out, const Glue< Glue,T3,glue_times>& X); @@ -74,7 +74,7 @@ struct glue_times_redirect3_helper -template +template struct glue_times_redirect { template @@ -82,24 +82,24 @@ struct glue_times_redirect }; -template<> -struct glue_times_redirect<2> +template +struct glue_times_redirect<2, check_alias> { template arma_hot inline static void apply(Mat& out, const Glue& X); }; -template<> -struct glue_times_redirect<3> +template +struct glue_times_redirect<3, check_alias> { template arma_hot inline static void apply(Mat& out, const Glue< Glue,T3,glue_times>& X); }; -template<> -struct glue_times_redirect<4> +template +struct glue_times_redirect<4, check_alias> { template arma_hot inline static void apply(Mat& out, const Glue< Glue< Glue, T3, glue_times>, T4, glue_times>& X); @@ -121,6 +121,9 @@ struct glue_times template arma_hot inline static void apply(Mat& out, const Glue& X); + template + arma_hot inline static void apply(Mat_noalias& out, const Glue& X); + template arma_hot inline static void apply_inplace(Mat& out, const T1& X); diff --git a/inst/include/current/armadillo_bits/glue_times_meat.hpp b/inst/include/current/armadillo_bits/glue_times_meat.hpp index 53f78238..ac5534ec 100644 --- a/inst/include/current/armadillo_bits/glue_times_meat.hpp +++ b/inst/include/current/armadillo_bits/glue_times_meat.hpp @@ -21,11 +21,11 @@ -template +template template inline void -glue_times_redirect2_helper::apply(Mat& out, const Glue& X) +glue_times_redirect2_helper::apply(Mat& out, const Glue& X) { arma_debug_sigprint(); @@ -55,7 +55,7 @@ glue_times_redirect2_helper::apply(Mat& o return; } - const bool alias = U1.is_alias(out) || U2.is_alias(out); + const bool alias = (check_alias) && (U1.is_alias(out) || U2.is_alias(out)); if(alias == false) { @@ -87,10 +87,11 @@ glue_times_redirect2_helper::apply(Mat& o +template template inline void -glue_times_redirect2_helper::apply(Mat& out, const Glue& X) +glue_times_redirect2_helper::apply(Mat& out, const Glue& X) { arma_debug_sigprint(); @@ -148,14 +149,27 @@ glue_times_redirect2_helper::apply(Mat& out, const if(is_cx::yes) { arma_warn(1, "inv_sympd(): given matrix is not hermitian"); } } - const unwrap_check B_tmp(X.B, out); - const Mat& B = B_tmp.M; + const quasi_unwrap UB(X.B); + const Mat& B = UB.M; arma_conform_assert_mul_size(A, B, "matrix multiplication"); const bool is_sym = (strip_inv::do_inv_spd) ? false : ( arma_config::optimise_sym && (is_sym_expr::eval(X.A) || sym_helper::is_approx_sym(A, uword(100))) ); - const bool status = (strip_inv::do_inv_spd) ? auxlib::solve_sympd_fast(out, A, B) : ( (is_sym) ? auxlib::solve_sym_fast(out, A, B) : auxlib::solve_square_fast(out, A, B) ); + bool status = false; + + if( (check_alias) && UB.is_alias(out) ) + { + Mat tmp; + + status = (strip_inv::do_inv_spd) ? auxlib::solve_sympd_fast(tmp, A, B) : ( (is_sym) ? auxlib::solve_sym_fast(tmp, A, B) : auxlib::solve_square_fast(tmp, A, B) ); + + out.steal_mem(tmp); + } + else + { + status = (strip_inv::do_inv_spd) ? auxlib::solve_sympd_fast(out, A, B) : ( (is_sym) ? auxlib::solve_sym_fast(out, A, B) : auxlib::solve_square_fast(out, A, B) ); + } if(status == false) { @@ -202,16 +216,16 @@ glue_times_redirect2_helper::apply(Mat& out, const return; } - glue_times_redirect2_helper::apply(out, X); + glue_times_redirect2_helper::apply(out, X); } -template +template template inline void -glue_times_redirect3_helper::apply(Mat& out, const Glue< Glue, T3, glue_times>& X) +glue_times_redirect3_helper::apply(Mat& out, const Glue< Glue, T3, glue_times>& X) { arma_debug_sigprint(); @@ -231,7 +245,7 @@ glue_times_redirect3_helper::apply(Mat& o constexpr bool use_alpha = partial_unwrap::do_times || partial_unwrap::do_times || partial_unwrap::do_times; const eT alpha = use_alpha ? (U1.get_val() * U2.get_val() * U3.get_val()) : eT(0); - const bool alias = U1.is_alias(out) || U2.is_alias(out) || U3.is_alias(out); + const bool alias = (check_alias) && (U1.is_alias(out) || U2.is_alias(out) || U3.is_alias(out)); if(alias == false) { @@ -265,10 +279,11 @@ glue_times_redirect3_helper::apply(Mat& o +template template inline void -glue_times_redirect3_helper::apply(Mat& out, const Glue< Glue, T3, glue_times>& X) +glue_times_redirect3_helper::apply(Mat& out, const Glue< Glue, T3, glue_times>& X) { arma_debug_sigprint(); @@ -371,7 +386,7 @@ glue_times_redirect3_helper::apply(Mat& out, const constexpr bool use_alpha = partial_unwrap::do_times; const eT alpha = use_alpha ? U1.get_val() : eT(0); - if(U1.is_alias(out)) + if( (check_alias) && U1.is_alias(out) ) { Mat tmp; @@ -388,16 +403,16 @@ glue_times_redirect3_helper::apply(Mat& out, const } - glue_times_redirect3_helper::apply(out, X); + glue_times_redirect3_helper::apply(out, X); } -template +template template inline void -glue_times_redirect::apply(Mat& out, const Glue& X) +glue_times_redirect::apply(Mat& out, const Glue& X) { arma_debug_sigprint(); @@ -412,7 +427,7 @@ glue_times_redirect::apply(Mat& out, const Glue::do_times || partial_unwrap::do_times; const eT alpha = use_alpha ? (U1.get_val() * U2.get_val()) : eT(0); - const bool alias = U1.is_alias(out) || U2.is_alias(out); + const bool alias = (check_alias) && (U1.is_alias(out) || U2.is_alias(out)); if(alias == false) { @@ -444,38 +459,41 @@ glue_times_redirect::apply(Mat& out, const Glue template inline void -glue_times_redirect<2>::apply(Mat& out, const Glue& X) +glue_times_redirect<2, check_alias>::apply(Mat& out, const Glue& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; - glue_times_redirect2_helper< is_blas_type::value >::apply(out, X); + glue_times_redirect2_helper< is_blas_type::value, check_alias >::apply(out, X); } +template template inline void -glue_times_redirect<3>::apply(Mat& out, const Glue< Glue, T3, glue_times>& X) +glue_times_redirect<3, check_alias>::apply(Mat& out, const Glue< Glue, T3, glue_times>& X) { arma_debug_sigprint(); typedef typename T1::elem_type eT; - glue_times_redirect3_helper< is_blas_type::value >::apply(out, X); + glue_times_redirect3_helper< is_blas_type::value, check_alias >::apply(out, X); } +template template inline void -glue_times_redirect<4>::apply(Mat& out, const Glue< Glue< Glue, T3, glue_times>, T4, glue_times>& X) +glue_times_redirect<4, check_alias>::apply(Mat& out, const Glue< Glue< Glue, T3, glue_times>, T4, glue_times>& X) { arma_debug_sigprint(); @@ -497,7 +515,7 @@ glue_times_redirect<4>::apply(Mat& out, const Glue< Glue constexpr bool use_alpha = partial_unwrap::do_times || partial_unwrap::do_times || partial_unwrap::do_times || partial_unwrap::do_times; const eT alpha = use_alpha ? (U1.get_val() * U2.get_val() * U3.get_val() * U4.get_val()) : eT(0); - const bool alias = U1.is_alias(out) || U2.is_alias(out) || U3.is_alias(out) || U4.is_alias(out); + const bool alias = (check_alias) && (U1.is_alias(out) || U2.is_alias(out) || U3.is_alias(out) || U4.is_alias(out)); if(alias == false) { @@ -544,7 +562,23 @@ glue_times::apply(Mat& out, const Glue arma_debug_print(arma_str::format("glue_times::apply(): N_mat: %u") % N_mat); - glue_times_redirect::apply(out, X); + glue_times_redirect::apply(out, X); + } + + + +template +inline +void +glue_times::apply(Mat_noalias& out, const Glue& X) + { + arma_debug_sigprint(); + + constexpr uword N_mat = 1 + depth_lhs< glue_times, Glue >::num; + + arma_debug_print(arma_str::format("glue_times::apply(): N_mat: %u") % N_mat); + + glue_times_redirect::apply(out, X); } diff --git a/inst/include/current/armadillo_bits/glue_trapz_bones.hpp b/inst/include/current/armadillo_bits/glue_trapz_bones.hpp index f63a6463..2c9ffc3f 100644 --- a/inst/include/current/armadillo_bits/glue_trapz_bones.hpp +++ b/inst/include/current/armadillo_bits/glue_trapz_bones.hpp @@ -34,6 +34,8 @@ struct glue_trapz template inline static void apply(Mat& out, const Glue& in); + template inline static void apply(Mat_noalias& out, const Glue& in); + template inline static void apply_noalias(Mat& out, const Mat& X, const Mat& Y, const uword dim); }; @@ -44,6 +46,8 @@ struct op_trapz { template inline static void apply(Mat& out, const Op& in); + template inline static void apply(Mat_noalias& out, const Op& in); + template inline static void apply_noalias(Mat& out, const Mat& Y, const uword dim); }; diff --git a/inst/include/current/armadillo_bits/glue_trapz_meat.hpp b/inst/include/current/armadillo_bits/glue_trapz_meat.hpp index 70eb39ea..54d3135f 100644 --- a/inst/include/current/armadillo_bits/glue_trapz_meat.hpp +++ b/inst/include/current/armadillo_bits/glue_trapz_meat.hpp @@ -51,6 +51,23 @@ glue_trapz::apply(Mat& out, const Glue +template +inline +void +glue_trapz::apply(Mat_noalias& out, const Glue& in) + { + arma_debug_sigprint(); + + const uword dim = in.aux_uword; + + const quasi_unwrap UX(in.A); + const quasi_unwrap UY(in.B); + + glue_trapz::apply_noalias(out, UX.M, UY.M, dim); + } + + + template inline void @@ -101,6 +118,10 @@ glue_trapz::apply_noalias(Mat& out, const Mat& X, const Mat& Y, cons +// + + + template inline void @@ -130,6 +151,22 @@ op_trapz::apply(Mat& out, const Op& in) +template +inline +void +op_trapz::apply(Mat_noalias& out, const Op& in) + { + arma_debug_sigprint(); + + const uword dim = in.aux_uword_a; + + const quasi_unwrap UY(in.m); + + op_trapz::apply_noalias(out, UY.M, dim); + } + + + template inline void diff --git a/inst/include/current/armadillo_bits/op_accu_bones.hpp b/inst/include/current/armadillo_bits/op_accu_bones.hpp index 348c1714..ad99826b 100644 --- a/inst/include/current/armadillo_bits/op_accu_bones.hpp +++ b/inst/include/current/armadillo_bits/op_accu_bones.hpp @@ -95,6 +95,9 @@ struct op_accu_cube template static inline typename T1::elem_type apply(const CubeToMatOp& in); + + template + static inline eT apply(const subview_cube& sv); }; diff --git a/inst/include/current/armadillo_bits/op_accu_meat.hpp b/inst/include/current/armadillo_bits/op_accu_meat.hpp index 38fdb97f..e3559170 100644 --- a/inst/include/current/armadillo_bits/op_accu_meat.hpp +++ b/inst/include/current/armadillo_bits/op_accu_meat.hpp @@ -114,13 +114,27 @@ op_accu_mat::apply(const T1& X) { arma_debug_sigprint(); - if( (is_Mat::value) || (is_subview_col::value) || (is_Mat::stored_type>::value) || (arma_config::openmp && Proxy::use_mp) ) + if( (quasi_unwrap::has_orig_mem) || (is_Mat::stored_type>::value) || (arma_config::openmp && Proxy::use_mp) ) { const quasi_unwrap U(X); return arrayops::accumulate(U.M.memptr(), U.M.n_elem); } + if(is_subview_row::value) + { + typedef typename T1::elem_type eT; + + const subview_row& sv = reinterpret_cast< const subview_row& >(X); + + if(sv.m.n_rows == 1) + { + const eT* sv_mem = &(sv.m.at(sv.aux_col1)); + + return arrayops::accumulate(sv_mem, sv.n_elem); + } + } + const Proxy P(X); return (Proxy::use_at) ? op_accu_mat::apply_proxy_at(P) : op_accu_mat::apply_proxy_linear(P); @@ -926,4 +940,44 @@ op_accu_cube::apply(const CubeToMatOp& in) +template +inline +eT +op_accu_cube::apply(const subview_cube& sv) + { + arma_debug_sigprint(); + + if(sv.n_elem == 0) { return eT(0); } + + const uword sv_nr = sv.n_rows; + const uword sv_nc = sv.n_cols; + const uword sv_ns = sv.n_slices; + + eT acc = eT(0); + + if( (sv_nr == 1) && (sv_nc == 1) && (sv.aux_slice1 == 0) ) + { + const uword sv_m_n_elem_slice = sv.m.n_elem_slice; + + const eT* sv_m_ptr = &( sv.m.at(sv.aux_row1, sv.aux_col1, 0) ); + + for(uword s=0; s < sv_ns; ++s) + { + acc += (*sv_m_ptr); sv_m_ptr += sv_m_n_elem_slice; + } + } + else + { + for(uword s=0; s < sv_ns; ++s) + for(uword c=0; c < sv_nc; ++c) + { + acc += arrayops::accumulate(sv.slice_colptr(s,c), sv_nr); + } + } + + return acc; + } + + + //! @} diff --git a/inst/include/current/armadillo_bits/op_all_meat.hpp b/inst/include/current/armadillo_bits/op_all_meat.hpp index ee6d9e4b..dd325f54 100644 --- a/inst/include/current/armadillo_bits/op_all_meat.hpp +++ b/inst/include/current/armadillo_bits/op_all_meat.hpp @@ -404,7 +404,7 @@ op_all::apply(Mat& out, const mtOp& X) const uword dim = X.aux_uword_a; - if( (is_Mat::value) || (is_Mat::stored_type>::value) || (arma_config::openmp && Proxy::use_mp) ) + if( (quasi_unwrap::has_orig_mem) || (is_Mat::stored_type>::value) || (arma_config::openmp && Proxy::use_mp) ) { const quasi_unwrap U(X.m); diff --git a/inst/include/current/armadillo_bits/op_any_meat.hpp b/inst/include/current/armadillo_bits/op_any_meat.hpp index 5387c839..5764846b 100644 --- a/inst/include/current/armadillo_bits/op_any_meat.hpp +++ b/inst/include/current/armadillo_bits/op_any_meat.hpp @@ -368,7 +368,7 @@ op_any::apply(Mat& out, const mtOp& X) const uword dim = X.aux_uword_a; - if( (is_Mat::value) || (is_Mat::stored_type>::value) || (arma_config::openmp && Proxy::use_mp) ) + if( (quasi_unwrap::has_orig_mem) || (is_Mat::stored_type>::value) || (arma_config::openmp && Proxy::use_mp) ) { const quasi_unwrap U(X.m); diff --git a/inst/include/current/armadillo_bits/op_circshift_bones.hpp b/inst/include/current/armadillo_bits/op_circshift_bones.hpp index 58084fde..d18a42bf 100644 --- a/inst/include/current/armadillo_bits/op_circshift_bones.hpp +++ b/inst/include/current/armadillo_bits/op_circshift_bones.hpp @@ -26,6 +26,8 @@ struct op_circshift_vec : public traits_op_passthru { template inline static void apply(Mat& out, const Op& in); + + template inline static void apply(Mat_noalias& out, const Op& in); }; diff --git a/inst/include/current/armadillo_bits/op_circshift_meat.hpp b/inst/include/current/armadillo_bits/op_circshift_meat.hpp index b3c091cc..6654e3d3 100644 --- a/inst/include/current/armadillo_bits/op_circshift_meat.hpp +++ b/inst/include/current/armadillo_bits/op_circshift_meat.hpp @@ -54,6 +54,29 @@ op_circshift_vec::apply(Mat& out, const Op +inline +void +op_circshift_vec::apply(Mat_noalias& out, const Op& in) + { + arma_debug_sigprint(); + + const quasi_unwrap U(in.m); + + const uword len = in.aux_uword_a; + const uword neg = in.aux_uword_b; + + const uword dim = (T1::is_xvec) ? uword(U.M.is_rowvec() ? 1 : 0) : uword((T1::is_row) ? 1 : 0); + + op_circshift::apply_noalias(out, U.M, len, neg, dim); + } + + + +// + + + template inline void diff --git a/inst/include/current/armadillo_bits/op_clamp_bones.hpp b/inst/include/current/armadillo_bits/op_clamp_bones.hpp index 6a47b7b9..ebe37d8d 100644 --- a/inst/include/current/armadillo_bits/op_clamp_bones.hpp +++ b/inst/include/current/armadillo_bits/op_clamp_bones.hpp @@ -29,7 +29,9 @@ struct op_clamp template inline static void apply(Mat& out, const mtOp& in); - template inline static void apply_direct(Mat& out, const Mat& X, const eT min_val, const eT max_val); + template inline static void apply(Mat_noalias& out, const mtOp& in); + + template inline static void apply_mat_noalias(Mat& out, const Mat& X, const eT min_val, const eT max_val); template inline static void apply_proxy_noalias(Mat& out, const Proxy& P, const typename T1::elem_type min_val, const typename T1::elem_type max_val); diff --git a/inst/include/current/armadillo_bits/op_clamp_meat.hpp b/inst/include/current/armadillo_bits/op_clamp_meat.hpp index f36ea4dc..2dbf6f80 100644 --- a/inst/include/current/armadillo_bits/op_clamp_meat.hpp +++ b/inst/include/current/armadillo_bits/op_clamp_meat.hpp @@ -40,7 +40,15 @@ op_clamp::apply(Mat& out, const mtOp U(in.m); - op_clamp::apply_direct(out, U.M, min_val, max_val); + // detect in-place operation + if(&out == &(U.M)) + { + arrayops::clamp(out.memptr(), out.n_elem, min_val, max_val); + } + else + { + op_clamp::apply_mat_noalias(out, U.M, min_val, max_val); + } } else { @@ -63,34 +71,55 @@ op_clamp::apply(Mat& out, const mtOp +template inline void -op_clamp::apply_direct(Mat& out, const Mat& X, const eT min_val, const eT max_val) +op_clamp::apply(Mat_noalias& out, const mtOp& in) { arma_debug_sigprint(); - if(&out != &X) + typedef typename T1::elem_type eT; + + const eT min_val = in.aux; + const eT max_val = in.aux_out_eT; + + arma_conform_check( (min_val > max_val), "clamp(): min_val must be less than max_val" ); + + if((quasi_unwrap::has_orig_mem) || (is_Mat::stored_type>::value) || (arma_config::openmp && Proxy::use_mp)) { - out.set_size(X.n_rows, X.n_cols); - - const uword N = out.n_elem; - - const eT* X_mem = X.memptr(); - eT* out_mem = out.memptr(); + const quasi_unwrap U(in.m); - for(uword i=0; i max_val) ? max_val : val); - } + op_clamp::apply_mat_noalias(out, U.M, min_val, max_val); } else { - arma_debug_print("op_clamp::apply_direct(): inplace operation"); + const Proxy P(in.m); - arrayops::clamp(out.memptr(), out.n_elem, min_val, max_val); + op_clamp::apply_proxy_noalias(out, P, min_val, max_val); + } + } + + + +template +inline +void +op_clamp::apply_mat_noalias(Mat& out, const Mat& X, const eT min_val, const eT max_val) + { + arma_debug_sigprint(); + + out.set_size(X.n_rows, X.n_cols); + + const uword N = out.n_elem; + + const eT* X_mem = X.memptr(); + eT* out_mem = out.memptr(); + + for(uword i=0; i max_val) ? max_val : val); } } diff --git a/inst/include/current/armadillo_bits/op_cumprod_bones.hpp b/inst/include/current/armadillo_bits/op_cumprod_bones.hpp index ddf94c14..f4707b35 100644 --- a/inst/include/current/armadillo_bits/op_cumprod_bones.hpp +++ b/inst/include/current/armadillo_bits/op_cumprod_bones.hpp @@ -29,6 +29,9 @@ struct op_cumprod template inline static void apply(Mat& out, const Op& in); + + template + inline static void apply(Mat_noalias& out, const Op& in); }; @@ -38,6 +41,9 @@ struct op_cumprod_vec { template inline static void apply(Mat& out, const Op& in); + + template + inline static void apply(Mat_noalias& out, const Op& in); }; diff --git a/inst/include/current/armadillo_bits/op_cumprod_meat.hpp b/inst/include/current/armadillo_bits/op_cumprod_meat.hpp index 0071afce..99013ded 100644 --- a/inst/include/current/armadillo_bits/op_cumprod_meat.hpp +++ b/inst/include/current/armadillo_bits/op_cumprod_meat.hpp @@ -141,6 +141,28 @@ op_cumprod::apply(Mat& out, const Op& in) +template +inline +void +op_cumprod::apply(Mat_noalias& out, const Op& in) + { + arma_debug_sigprint(); + + const uword dim = in.aux_uword_a; + + arma_conform_check( (dim > 1), "cumprod(): parameter 'dim' must be 0 or 1" ); + + const quasi_unwrap U(in.m); + + op_cumprod::apply_noalias(out, U.M, dim); + } + + + +// + + + template inline void @@ -170,5 +192,20 @@ op_cumprod_vec::apply(Mat& out, const Op +inline +void +op_cumprod_vec::apply(Mat_noalias& out, const Op& in) + { + arma_debug_sigprint(); + + const quasi_unwrap U(in.m); + + const uword dim = (T1::is_xvec) ? uword(U.M.is_rowvec() ? 1 : 0) : uword((T1::is_row) ? 1 : 0); + + op_cumprod::apply_noalias(out, U.M, dim); + } + + +//! @} diff --git a/inst/include/current/armadillo_bits/op_cumsum_bones.hpp b/inst/include/current/armadillo_bits/op_cumsum_bones.hpp index f98fc59d..2109a060 100644 --- a/inst/include/current/armadillo_bits/op_cumsum_bones.hpp +++ b/inst/include/current/armadillo_bits/op_cumsum_bones.hpp @@ -29,6 +29,9 @@ struct op_cumsum template inline static void apply(Mat& out, const Op& in); + + template + inline static void apply(Mat_noalias& out, const Op& in); }; @@ -38,6 +41,9 @@ struct op_cumsum_vec { template inline static void apply(Mat& out, const Op& in); + + template + inline static void apply(Mat_noalias& out, const Op& in); }; diff --git a/inst/include/current/armadillo_bits/op_cumsum_meat.hpp b/inst/include/current/armadillo_bits/op_cumsum_meat.hpp index 71ca2f7f..c11f82ab 100644 --- a/inst/include/current/armadillo_bits/op_cumsum_meat.hpp +++ b/inst/include/current/armadillo_bits/op_cumsum_meat.hpp @@ -141,6 +141,28 @@ op_cumsum::apply(Mat& out, const Op& in) +template +inline +void +op_cumsum::apply(Mat_noalias& out, const Op& in) + { + arma_debug_sigprint(); + + const uword dim = in.aux_uword_a; + + arma_conform_check( (dim > 1), "cumsum(): parameter 'dim' must be 0 or 1" ); + + const quasi_unwrap U(in.m); + + op_cumsum::apply_noalias(out, U.M, dim); + } + + + +// + + + template inline void @@ -170,5 +192,20 @@ op_cumsum_vec::apply(Mat& out, const Op +inline +void +op_cumsum_vec::apply(Mat_noalias& out, const Op& in) + { + arma_debug_sigprint(); + + const quasi_unwrap U(in.m); + + const uword dim = (T1::is_xvec) ? uword(U.M.is_rowvec() ? 1 : 0) : uword((T1::is_row) ? 1 : 0); + + op_cumsum::apply_noalias(out, U.M, dim); + } + + +//! @} diff --git a/inst/include/current/armadillo_bits/op_diff_bones.hpp b/inst/include/current/armadillo_bits/op_diff_bones.hpp index 7d7684aa..a20136a3 100644 --- a/inst/include/current/armadillo_bits/op_diff_bones.hpp +++ b/inst/include/current/armadillo_bits/op_diff_bones.hpp @@ -29,6 +29,9 @@ struct op_diff template inline static void apply(Mat& out, const Op& in); + + template + inline static void apply(Mat_noalias& out, const Op& in); }; @@ -38,6 +41,9 @@ struct op_diff_vec { template inline static void apply(Mat& out, const Op& in); + + template + inline static void apply(Mat_noalias& out, const Op& in); }; diff --git a/inst/include/current/armadillo_bits/op_diff_meat.hpp b/inst/include/current/armadillo_bits/op_diff_meat.hpp index 6dc6993a..976a646e 100644 --- a/inst/include/current/armadillo_bits/op_diff_meat.hpp +++ b/inst/include/current/armadillo_bits/op_diff_meat.hpp @@ -27,6 +27,8 @@ op_diff::apply_noalias(Mat& out, const Mat& X, const uword k, const uwor { arma_debug_sigprint(); + if(k == 0) { out = X; return; } + uword n_rows = X.n_rows; uword n_cols = X.n_cols; @@ -167,8 +169,6 @@ op_diff::apply(Mat& out, const Op& in) arma_conform_check( (dim > 1), "diff(): parameter 'dim' must be 0 or 1" ); - if(k == 0) { out = in.m; return; } - const quasi_unwrap U(in.m); if(U.is_alias(out)) @@ -187,6 +187,29 @@ op_diff::apply(Mat& out, const Op& in) +template +inline +void +op_diff::apply(Mat_noalias& out, const Op& in) + { + arma_debug_sigprint(); + + const uword k = in.aux_uword_a; + const uword dim = in.aux_uword_b; + + arma_conform_check( (dim > 1), "diff(): parameter 'dim' must be 0 or 1" ); + + const quasi_unwrap U(in.m); + + op_diff::apply_noalias(out, U.M, k, dim); + } + + + +// + + + template inline void @@ -198,8 +221,6 @@ op_diff_vec::apply(Mat& out, const Op& i const uword k = in.aux_uword_a; - if(k == 0) { out = in.m; return; } - const quasi_unwrap U(in.m); const uword dim = (T1::is_xvec) ? uword(U.M.is_rowvec() ? 1 : 0) : uword((T1::is_row) ? 1 : 0); @@ -220,5 +241,22 @@ op_diff_vec::apply(Mat& out, const Op& i -//! @} +template +inline +void +op_diff_vec::apply(Mat_noalias& out, const Op& in) + { + arma_debug_sigprint(); + + const uword k = in.aux_uword_a; + + const quasi_unwrap U(in.m); + + const uword dim = (T1::is_xvec) ? uword(U.M.is_rowvec() ? 1 : 0) : uword((T1::is_row) ? 1 : 0); + + op_diff::apply_noalias(out, U.M, k, dim); + } + + +//! @} diff --git a/inst/include/current/armadillo_bits/op_flip_bones.hpp b/inst/include/current/armadillo_bits/op_flip_bones.hpp index c33dd4c3..050a17c5 100644 --- a/inst/include/current/armadillo_bits/op_flip_bones.hpp +++ b/inst/include/current/armadillo_bits/op_flip_bones.hpp @@ -27,27 +27,32 @@ struct op_flipud template inline static void apply(Mat& out, const Op& in); + template + inline static void apply(Mat_noalias& out, const Op& in); + template - inline static void apply_direct(Mat& out, const Mat& X); + inline static void apply_mat_inplace(Mat& X); - template - inline static void apply_proxy_noalias(Mat& out, const Proxy& P); + template + inline static void apply_mat_noalias(Mat& out, const Mat& X); }; - struct op_fliplr : public traits_op_passthru { template inline static void apply(Mat& out, const Op& in); + template + inline static void apply(Mat_noalias& out, const Op& in); + template - inline static void apply_direct(Mat& out, const Mat& X); + inline static void apply_mat_inplace(Mat& X); - template - inline static void apply_proxy_noalias(Mat& out, const Proxy& P); + template + inline static void apply_mat_noalias(Mat& out, const Mat& X); }; diff --git a/inst/include/current/armadillo_bits/op_flip_meat.hpp b/inst/include/current/armadillo_bits/op_flip_meat.hpp index ddd25a8c..636da944 100644 --- a/inst/include/current/armadillo_bits/op_flip_meat.hpp +++ b/inst/include/current/armadillo_bits/op_flip_meat.hpp @@ -32,37 +32,49 @@ op_flipud::apply(Mat& out, const Op& in) if(is_Mat::value) { - // allow detection of in-place operation - const unwrap U(in.m); - op_flipud::apply_direct(out, U.M); + if(&out == &(U.M)) { op_flipud::apply_mat_inplace(out); return; } + + // fallthrough if operation is not inplace } - else + + const quasi_unwrap U(in.m); + + if(U.is_alias(out)) { - const Proxy P(in.m); + Mat tmp; - if(P.is_alias(out)) - { - Mat tmp; - - op_flipud::apply_proxy_noalias(tmp, P); - - out.steal_mem(tmp); - } - else - { - op_flipud::apply_proxy_noalias(out, P); - } + op_flipud::apply_mat_noalias(tmp, U.M); + + out.steal_mem(tmp); + } + else + { + op_flipud::apply_mat_noalias(out, U.M); } } +template +inline +void +op_flipud::apply(Mat_noalias& out, const Op& in) + { + arma_debug_sigprint(); + + const quasi_unwrap U(in.m); + + op_flipud::apply_mat_noalias(out, U.M); + } + + + template inline void -op_flipud::apply_direct(Mat& out, const Mat& X) +op_flipud::apply_mat_inplace(Mat& X) { arma_debug_sigprint(); @@ -71,57 +83,26 @@ op_flipud::apply_direct(Mat& out, const Mat& X) const uword X_n_rows_m1 = X_n_rows - 1; - if(&out != &X) + const uword N = X_n_rows / 2; + + if(X_n_cols == 1) { - out.set_size(X_n_rows, X_n_cols); + eT* X_mem = X.memptr(); - if(X_n_cols == 1) - { - const eT* X_mem = X.memptr(); - eT* out_mem = out.memptr(); - - for(uword row=0; row < X_n_rows; ++row) - { - out_mem[X_n_rows_m1 - row] = X_mem[row]; - } - } - else + for(uword row=0; row < N; ++row) { - for(uword col=0; col < X_n_cols; ++col) - { - const eT* X_colmem = X.colptr(col); - eT* out_colmem = out.colptr(col); - - for(uword row=0; row < X_n_rows; ++row) - { - out_colmem[X_n_rows_m1 - row] = X_colmem[row]; - } - } + std::swap(X_mem[X_n_rows_m1 - row], X_mem[row]); } } - else // in-place operation + else { - const uword N = X_n_rows / 2; - - if(X_n_cols == 1) + for(uword col=0; col < X_n_cols; ++col) { - eT* out_mem = out.memptr(); + eT* X_colmem = X.colptr(col); for(uword row=0; row < N; ++row) { - std::swap(out_mem[X_n_rows_m1 - row], out_mem[row]); - } - } - else - { - for(uword col=0; col < X_n_cols; ++col) - { - eT* out_colmem = out.colptr(col); - - for(uword row=0; row < N; ++row) - { - std::swap(out_colmem[X_n_rows_m1 - row], out_colmem[row]); - } + std::swap(X_colmem[X_n_rows_m1 - row], X_colmem[row]); } } } @@ -129,53 +110,40 @@ op_flipud::apply_direct(Mat& out, const Mat& X) -template +template inline void -op_flipud::apply_proxy_noalias(Mat& out, const Proxy& P) +op_flipud::apply_mat_noalias(Mat& out, const Mat& X) { arma_debug_sigprint(); - typedef typename T1::elem_type eT; - - typedef typename Proxy::stored_type P_stored_type; - - if(is_Mat::value) - { - const unwrap U(P.Q); - - op_flipud::apply_direct(out, U.M); - - return; - } - - const uword P_n_rows = P.get_n_rows(); - const uword P_n_cols = P.get_n_cols(); + const uword X_n_rows = X.n_rows; + const uword X_n_cols = X.n_cols; - const uword P_n_rows_m1 = P_n_rows - 1; + const uword X_n_rows_m1 = X_n_rows - 1; - out.set_size(P_n_rows, P_n_cols); + out.set_size(X_n_rows, X_n_cols); - if( ((T1::is_col) || (P_n_cols == 1)) && (Proxy::use_at == false) ) + if(X_n_cols == 1) { - eT* out_mem = out.memptr(); - - const typename Proxy::ea_type P_ea = P.get_ea(); + const eT* X_mem = X.memptr(); + eT* out_mem = out.memptr(); - for(uword row=0; row < P_n_rows; ++row) + for(uword row=0; row < X_n_rows; ++row) { - out_mem[P_n_rows_m1 - row] = P_ea[row]; + out_mem[X_n_rows_m1 - row] = X_mem[row]; } } else { - for(uword col=0; col < P_n_cols; ++col) + for(uword col=0; col < X_n_cols; ++col) { - eT* out_colmem = out.colptr(col); + const eT* X_colmem = X.colptr(col); + eT* out_colmem = out.colptr(col); - for(uword row=0; row < P_n_rows; ++row) + for(uword row=0; row < X_n_rows; ++row) { - out_colmem[P_n_rows_m1 - row] = P.at(row, col); + out_colmem[X_n_rows_m1 - row] = X_colmem[row]; } } } @@ -198,37 +166,49 @@ op_fliplr::apply(Mat& out, const Op& in) if(is_Mat::value) { - // allow detection of in-place operation - const unwrap U(in.m); - op_fliplr::apply_direct(out, U.M); + if(&out == &(U.M)) { op_fliplr::apply_mat_inplace(out); return; } + + // fallthrough if operation is not inplace } - else + + const quasi_unwrap U(in.m); + + if(U.is_alias(out)) { - const Proxy P(in.m); + Mat tmp; - if(P.is_alias(out)) - { - Mat tmp; - - op_fliplr::apply_proxy_noalias(tmp, P); - - out.steal_mem(tmp); - } - else - { - op_fliplr::apply_proxy_noalias(out, P); - } + op_fliplr::apply_mat_noalias(tmp, U.M); + + out.steal_mem(tmp); + } + else + { + op_fliplr::apply_mat_noalias(out, U.M); } } +template +inline +void +op_fliplr::apply(Mat_noalias& out, const Op& in) + { + arma_debug_sigprint(); + + const quasi_unwrap U(in.m); + + op_fliplr::apply_mat_noalias(out, U.M); + } + + + template inline void -op_fliplr::apply_direct(Mat& out, const Mat& X) +op_fliplr::apply_mat_inplace(Mat& X) { arma_debug_sigprint(); @@ -237,101 +217,57 @@ op_fliplr::apply_direct(Mat& out, const Mat& X) const uword X_n_cols_m1 = X_n_cols - 1; - if(&out != &X) + const uword N = X_n_cols / 2; + + if(X_n_rows == 1) { - out.set_size(X_n_rows, X_n_cols); + eT* X_mem = X.memptr(); - if(X_n_rows == 1) - { - const eT* X_mem = X.memptr(); - eT* out_mem = out.memptr(); - - for(uword col=0; col < X_n_cols; ++col) - { - out_mem[X_n_cols_m1 - col] = X_mem[col]; - } - } - else + for(uword col=0; col < N; ++col) { - for(uword col=0; col < X_n_cols; ++col) - { - out.col(X_n_cols_m1 - col) = X.col(col); - } + std::swap(X_mem[X_n_cols_m1 - col], X_mem[col]); } } - else // in-place operation + else { - const uword N = X_n_cols / 2; - - if(X_n_rows == 1) + for(uword col=0; col < N; ++col) { - eT* out_mem = out.memptr(); - - for(uword col=0; col < N; ++col) - { - std::swap(out_mem[X_n_cols_m1 - col], out_mem[col]); - } - } - else - { - for(uword col=0; col < N; ++col) - { - out.swap_cols(X_n_cols_m1 - col, col); - } + X.swap_cols(X_n_cols_m1 - col, col); } } } -template +template inline void -op_fliplr::apply_proxy_noalias(Mat& out, const Proxy& P) +op_fliplr::apply_mat_noalias(Mat& out, const Mat& X) { arma_debug_sigprint(); - typedef typename T1::elem_type eT; - - typedef typename Proxy::stored_type P_stored_type; - - if(is_Mat::value) - { - const unwrap U(P.Q); - - op_fliplr::apply_direct(out, U.M); - - return; - } - - const uword P_n_rows = P.get_n_rows(); - const uword P_n_cols = P.get_n_cols(); + const uword X_n_rows = X.n_rows; + const uword X_n_cols = X.n_cols; - const uword P_n_cols_m1 = P_n_cols - 1; + const uword X_n_cols_m1 = X_n_cols - 1; - out.set_size(P_n_rows, P_n_cols); + out.set_size(X_n_rows, X_n_cols); - if( ((T1::is_row) || (P_n_rows == 1)) && (Proxy::use_at == false) ) + if(X_n_rows == 1) { - eT* out_mem = out.memptr(); - - const typename Proxy::ea_type P_ea = P.get_ea(); + const eT* X_mem = X.memptr(); + eT* out_mem = out.memptr(); - for(uword col=0; col < P_n_cols; ++col) + for(uword col=0; col < X_n_cols; ++col) { - out_mem[P_n_cols_m1 - col] = P_ea[col]; + out_mem[X_n_cols_m1 - col] = X_mem[col]; } } else { - for(uword col=0; col < P_n_cols; ++col) + for(uword col=0; col < X_n_cols; ++col) { - eT* out_colmem = out.colptr(P_n_cols_m1 - col); - - for(uword row=0; row < P_n_rows; ++row) - { - out_colmem[row] = P.at(row,col); - } + out.col(X_n_cols_m1 - col) = X.col(col); } } } diff --git a/inst/include/current/armadillo_bits/op_htrans_bones.hpp b/inst/include/current/armadillo_bits/op_htrans_bones.hpp index 0d86f275..c4293d46 100644 --- a/inst/include/current/armadillo_bits/op_htrans_bones.hpp +++ b/inst/include/current/armadillo_bits/op_htrans_bones.hpp @@ -77,6 +77,12 @@ struct op_htrans template inline static void apply(Mat& out, const Op& in, const typename arma_cx_only::result* junk = nullptr); + + template + inline static void apply(Mat_noalias& out, const Op& in, const typename arma_not_cx::result* junk = nullptr); + + template + inline static void apply(Mat_noalias& out, const Op& in, const typename arma_cx_only::result* junk = nullptr); }; diff --git a/inst/include/current/armadillo_bits/op_htrans_meat.hpp b/inst/include/current/armadillo_bits/op_htrans_meat.hpp index 964c885e..99b86ace 100644 --- a/inst/include/current/armadillo_bits/op_htrans_meat.hpp +++ b/inst/include/current/armadillo_bits/op_htrans_meat.hpp @@ -377,6 +377,43 @@ op_htrans::apply(Mat& out, const Op& in, c +template +inline +void +op_htrans::apply(Mat_noalias& out, const Op& in, const typename arma_not_cx::result* junk) + { + arma_debug_sigprint(); + arma_ignore(junk); + + op_strans::apply_direct(out, in.m); + } + + + +template +inline +void +op_htrans::apply(Mat_noalias& out, const Op& in, const typename arma_cx_only::result* junk) + { + arma_debug_sigprint(); + arma_ignore(junk); + + if((is_Mat::stored_type>::value) || (arma_config::openmp && Proxy::use_mp)) + { + const quasi_unwrap U(in.m); + + op_htrans::apply_mat_noalias(out, U.M); + } + else + { + const Proxy P(in.m); + + op_htrans::apply_proxy(out, P); + } + } + + + // // op_htrans2 diff --git a/inst/include/current/armadillo_bits/op_max_bones.hpp b/inst/include/current/armadillo_bits/op_max_bones.hpp index d24e4aae..af4c4964 100644 --- a/inst/include/current/armadillo_bits/op_max_bones.hpp +++ b/inst/include/current/armadillo_bits/op_max_bones.hpp @@ -29,6 +29,9 @@ struct op_max template inline static void apply(Mat& out, const Op& in); + template + inline static void apply(Mat_noalias& out, const Op& in); + template inline static void apply_noalias(Mat& out, const Mat& X, const uword dim, const typename arma_not_cx::result* junk = nullptr); diff --git a/inst/include/current/armadillo_bits/op_max_meat.hpp b/inst/include/current/armadillo_bits/op_max_meat.hpp index 7b0826e8..62cac1a5 100644 --- a/inst/include/current/armadillo_bits/op_max_meat.hpp +++ b/inst/include/current/armadillo_bits/op_max_meat.hpp @@ -31,20 +31,20 @@ op_max::apply(Mat& out, const Op& in) typedef typename T1::elem_type eT; const uword dim = in.aux_uword_a; + arma_conform_check( (dim > 1), "max(): parameter 'dim' must be 0 or 1" ); const quasi_unwrap U(in.m); - const Mat& X = U.M; if(U.is_alias(out) == false) { - op_max::apply_noalias(out, X, dim); + op_max::apply_noalias(out, U.M, dim); } else { Mat tmp; - op_max::apply_noalias(tmp, X, dim); + op_max::apply_noalias(tmp, U.M, dim); out.steal_mem(tmp); } @@ -52,6 +52,24 @@ op_max::apply(Mat& out, const Op& in) +template +inline +void +op_max::apply(Mat_noalias& out, const Op& in) + { + arma_debug_sigprint(); + + const uword dim = in.aux_uword_a; + + arma_conform_check( (dim > 1), "max(): parameter 'dim' must be 0 or 1" ); + + const quasi_unwrap U(in.m); + + op_max::apply_noalias(out, U.M, dim); + } + + + template inline void diff --git a/inst/include/current/armadillo_bits/op_mean_bones.hpp b/inst/include/current/armadillo_bits/op_mean_bones.hpp index 33d50e47..e30de199 100644 --- a/inst/include/current/armadillo_bits/op_mean_bones.hpp +++ b/inst/include/current/armadillo_bits/op_mean_bones.hpp @@ -29,6 +29,9 @@ struct op_mean template inline static void apply(Mat& out, const Op& in); + template + inline static void apply(Mat_noalias& out, const Op& in); + template inline static void apply_noalias(Mat& out, const Mat& X, const uword dim); diff --git a/inst/include/current/armadillo_bits/op_mean_meat.hpp b/inst/include/current/armadillo_bits/op_mean_meat.hpp index 39a6904f..4760e2e0 100644 --- a/inst/include/current/armadillo_bits/op_mean_meat.hpp +++ b/inst/include/current/armadillo_bits/op_mean_meat.hpp @@ -52,6 +52,24 @@ op_mean::apply(Mat& out, const Op& in) +template +inline +void +op_mean::apply(Mat_noalias& out, const Op& in) + { + arma_debug_sigprint(); + + const uword dim = in.aux_uword_a; + + arma_conform_check( (dim > 1), "mean(): parameter 'dim' must be 0 or 1" ); + + const quasi_unwrap U(in.m); + + op_mean::apply_noalias(out, U.M, dim); + } + + + template inline void diff --git a/inst/include/current/armadillo_bits/op_median_bones.hpp b/inst/include/current/armadillo_bits/op_median_bones.hpp index 5dfbf147..99ec53c1 100644 --- a/inst/include/current/armadillo_bits/op_median_bones.hpp +++ b/inst/include/current/armadillo_bits/op_median_bones.hpp @@ -45,6 +45,9 @@ struct op_median template inline static void apply(Mat& out, const Op& expr); + template + inline static void apply(Mat_noalias& out, const Op& expr); + template inline static void apply_noalias(Mat& out, const Mat& X, const uword dim, const typename arma_not_cx::result* junk = nullptr); diff --git a/inst/include/current/armadillo_bits/op_median_meat.hpp b/inst/include/current/armadillo_bits/op_median_meat.hpp index 2f075778..efed6ebe 100644 --- a/inst/include/current/armadillo_bits/op_median_meat.hpp +++ b/inst/include/current/armadillo_bits/op_median_meat.hpp @@ -53,6 +53,25 @@ op_median::apply(Mat& out, const Op& expr) +template +inline +void +op_median::apply(Mat_noalias& out, const Op& expr) + { + arma_debug_sigprint(); + + const quasi_unwrap U(expr.m); + + const uword dim = expr.aux_uword_a; + + arma_conform_check( U.M.internal_has_nan(), "median(): detected NaN" ); + arma_conform_check( (dim > 1), "median(): parameter 'dim' must be 0 or 1" ); + + op_median::apply_noalias(out, U.M, dim); + } + + + template inline void diff --git a/inst/include/current/armadillo_bits/op_min_bones.hpp b/inst/include/current/armadillo_bits/op_min_bones.hpp index cc094371..a30f25b7 100644 --- a/inst/include/current/armadillo_bits/op_min_bones.hpp +++ b/inst/include/current/armadillo_bits/op_min_bones.hpp @@ -29,6 +29,9 @@ struct op_min template inline static void apply(Mat& out, const Op& in); + template + inline static void apply(Mat_noalias& out, const Op& in); + template inline static void apply_noalias(Mat& out, const Mat& X, const uword dim, const typename arma_not_cx::result* junk = nullptr); diff --git a/inst/include/current/armadillo_bits/op_min_meat.hpp b/inst/include/current/armadillo_bits/op_min_meat.hpp index 64cc60d0..36d0f3ac 100644 --- a/inst/include/current/armadillo_bits/op_min_meat.hpp +++ b/inst/include/current/armadillo_bits/op_min_meat.hpp @@ -31,20 +31,20 @@ op_min::apply(Mat& out, const Op& in) typedef typename T1::elem_type eT; const uword dim = in.aux_uword_a; + arma_conform_check( (dim > 1), "min(): parameter 'dim' must be 0 or 1" ); const quasi_unwrap U(in.m); - const Mat& X = U.M; if(U.is_alias(out) == false) { - op_min::apply_noalias(out, X, dim); + op_min::apply_noalias(out, U.M, dim); } else { Mat tmp; - op_min::apply_noalias(tmp, X, dim); + op_min::apply_noalias(tmp, U.M, dim); out.steal_mem(tmp); } @@ -52,6 +52,24 @@ op_min::apply(Mat& out, const Op& in) +template +inline +void +op_min::apply(Mat_noalias& out, const Op& in) + { + arma_debug_sigprint(); + + const uword dim = in.aux_uword_a; + + arma_conform_check( (dim > 1), "min(): parameter 'dim' must be 0 or 1" ); + + const quasi_unwrap U(in.m); + + op_min::apply_noalias(out, U.M, dim); + } + + + template inline void diff --git a/inst/include/current/armadillo_bits/op_nonzeros_bones.hpp b/inst/include/current/armadillo_bits/op_nonzeros_bones.hpp index db5616fb..36722088 100644 --- a/inst/include/current/armadillo_bits/op_nonzeros_bones.hpp +++ b/inst/include/current/armadillo_bits/op_nonzeros_bones.hpp @@ -32,6 +32,9 @@ struct op_nonzeros template static inline void apply(Mat& out, const Op& X); + + template + static inline void apply(Mat_noalias& out, const Op& X); }; diff --git a/inst/include/current/armadillo_bits/op_nonzeros_meat.hpp b/inst/include/current/armadillo_bits/op_nonzeros_meat.hpp index bb4deeea..3360ad2e 100644 --- a/inst/include/current/armadillo_bits/op_nonzeros_meat.hpp +++ b/inst/include/current/armadillo_bits/op_nonzeros_meat.hpp @@ -100,4 +100,20 @@ op_nonzeros::apply(Mat& out, const Op& +template +inline +void +op_nonzeros::apply(Mat_noalias& out, const Op& X) + { + arma_debug_sigprint(); + + const Proxy P(X.m); + + if(P.get_n_elem() == 0) { out.set_size(0,1); return; } + + op_nonzeros::apply_noalias(out, P); + } + + + //! @} diff --git a/inst/include/current/armadillo_bits/op_repmat_bones.hpp b/inst/include/current/armadillo_bits/op_repmat_bones.hpp index 782dadfd..706096c1 100644 --- a/inst/include/current/armadillo_bits/op_repmat_bones.hpp +++ b/inst/include/current/armadillo_bits/op_repmat_bones.hpp @@ -28,6 +28,8 @@ struct op_repmat template inline static void apply_noalias(Mat& out, const obj& X, const uword copies_per_row, const uword copies_per_col); template inline static void apply(Mat& out, const Op& in); + + template inline static void apply(Mat_noalias& out, const Op& in); }; diff --git a/inst/include/current/armadillo_bits/op_repmat_meat.hpp b/inst/include/current/armadillo_bits/op_repmat_meat.hpp index e8e23cd0..4f63de82 100644 --- a/inst/include/current/armadillo_bits/op_repmat_meat.hpp +++ b/inst/include/current/armadillo_bits/op_repmat_meat.hpp @@ -121,6 +121,23 @@ op_repmat::apply(Mat& out, const Op& in) +template +inline +void +op_repmat::apply(Mat_noalias& out, const Op& in) + { + arma_debug_sigprint(); + + const uword copies_per_row = in.aux_uword_a; + const uword copies_per_col = in.aux_uword_b; + + const quasi_unwrap U(in.m); + + op_repmat::apply_noalias(out, U.M, copies_per_row, copies_per_col); + } + + + // diff --git a/inst/include/current/armadillo_bits/op_reshape_bones.hpp b/inst/include/current/armadillo_bits/op_reshape_bones.hpp index b9a4a8b3..0e0f3bcf 100644 --- a/inst/include/current/armadillo_bits/op_reshape_bones.hpp +++ b/inst/include/current/armadillo_bits/op_reshape_bones.hpp @@ -27,6 +27,8 @@ struct op_reshape { template inline static void apply(Mat& out, const Op& in); + template inline static void apply(Mat_noalias& out, const Op& in); + template inline static void apply_mat_inplace(Mat& A, const uword new_n_rows, const uword new_n_cols); template inline static void apply_mat_noalias(Mat& out, const Mat& A, const uword new_n_rows, const uword new_n_cols); diff --git a/inst/include/current/armadillo_bits/op_reshape_meat.hpp b/inst/include/current/armadillo_bits/op_reshape_meat.hpp index 31fed267..e7879a12 100644 --- a/inst/include/current/armadillo_bits/op_reshape_meat.hpp +++ b/inst/include/current/armadillo_bits/op_reshape_meat.hpp @@ -49,7 +49,7 @@ op_reshape::apply(Mat& out, const Op& in) } } else - if((is_Mat::stored_type>::value) || (arma_config::openmp && Proxy::use_mp)) + if( (quasi_unwrap::has_orig_mem) || (is_Mat::stored_type>::value) || (arma_config::openmp && Proxy::use_mp) ) { const quasi_unwrap U(in.m); @@ -87,6 +87,32 @@ op_reshape::apply(Mat& out, const Op& in) +template +inline +void +op_reshape::apply(Mat_noalias& out, const Op& in) + { + arma_debug_sigprint(); + + const uword new_n_rows = in.aux_uword_a; + const uword new_n_cols = in.aux_uword_b; + + if( (quasi_unwrap::has_orig_mem) || (is_Mat::stored_type>::value) || (arma_config::openmp && Proxy::use_mp) ) + { + const quasi_unwrap U(in.m); + + op_reshape::apply_mat_noalias(out, U.M, new_n_rows, new_n_cols); + } + else + { + const Proxy P(in.m); + + op_reshape::apply_proxy_noalias(out, P, new_n_rows, new_n_cols); + } + } + + + template inline void diff --git a/inst/include/current/armadillo_bits/op_reverse_bones.hpp b/inst/include/current/armadillo_bits/op_reverse_bones.hpp index d2afc049..f1a4cec5 100644 --- a/inst/include/current/armadillo_bits/op_reverse_bones.hpp +++ b/inst/include/current/armadillo_bits/op_reverse_bones.hpp @@ -26,6 +26,9 @@ struct op_reverse { template inline static void apply(Mat& out, const Op& in); + + template + inline static void apply(Mat_noalias& out, const Op& in); }; @@ -35,6 +38,9 @@ struct op_reverse_vec { template inline static void apply(Mat& out, const Op& in); + + template + inline static void apply(Mat_noalias& out, const Op& in); }; diff --git a/inst/include/current/armadillo_bits/op_reverse_meat.hpp b/inst/include/current/armadillo_bits/op_reverse_meat.hpp index 93bb3b39..e0a9acd0 100644 --- a/inst/include/current/armadillo_bits/op_reverse_meat.hpp +++ b/inst/include/current/armadillo_bits/op_reverse_meat.hpp @@ -36,36 +36,60 @@ op_reverse::apply(Mat& out, const Op& in) if(is_Mat::value) { - // allow detection of in-place operation - const unwrap U(in.m); - if(dim == 0) { op_flipud::apply_direct(out, U.M); } - if(dim == 1) { op_fliplr::apply_direct(out, U.M); } + if(&out == &(U.M)) + { + if(dim == 0) { op_flipud::apply_mat_inplace(out); return; } + if(dim == 1) { op_fliplr::apply_mat_inplace(out); return; } + } + + // fallthrough if operation is not in-place } - else + + const quasi_unwrap U(in.m); + + if(U.is_alias(out)) { - const Proxy P(in.m); + Mat tmp; - if(P.is_alias(out)) - { - Mat tmp; - - if(dim == 0) { op_flipud::apply_proxy_noalias(tmp, P); } - if(dim == 1) { op_fliplr::apply_proxy_noalias(tmp, P); } - - out.steal_mem(tmp); - } - else - { - if(dim == 0) { op_flipud::apply_proxy_noalias(out, P); } - if(dim == 1) { op_fliplr::apply_proxy_noalias(out, P); } - } + if(dim == 0) { op_flipud::apply_mat_noalias(tmp, U.M); } + if(dim == 1) { op_fliplr::apply_mat_noalias(tmp, U.M); } + + out.steal_mem(tmp); + } + else + { + if(dim == 0) { op_flipud::apply_mat_noalias(out, U.M); } + if(dim == 1) { op_fliplr::apply_mat_noalias(out, U.M); } } } +template +inline +void +op_reverse::apply(Mat_noalias& out, const Op& in) + { + arma_debug_sigprint(); + + const uword dim = in.aux_uword_a; + + arma_conform_check( (dim > 1), "reverse(): parameter 'dim' must be 0 or 1" ); + + const quasi_unwrap U(in.m); + + if(dim == 0) { op_flipud::apply_mat_noalias(out, U.M); } + if(dim == 1) { op_fliplr::apply_mat_noalias(out, U.M); } + } + + + +// + + + template inline void @@ -77,52 +101,76 @@ op_reverse_vec::apply(Mat& out, const Op::value) { - // allow detection of in-place operation - const unwrap U(in.m); + if(&out == &(U.M)) + { + if((T1::is_xvec) ? bool(U.M.is_rowvec()) : bool(T1::is_row)) + { + op_fliplr::apply_mat_inplace(out); + } + else + { + op_flipud::apply_mat_inplace(out); + } + + return; + } + + // fallthrough if operation is not in-place + } + + const quasi_unwrap U(in.m); + + if(U.is_alias(out)) + { + Mat tmp; + if((T1::is_xvec) ? bool(U.M.is_rowvec()) : bool(T1::is_row)) { - op_fliplr::apply_direct(out, U.M); + op_fliplr::apply_mat_noalias(tmp, U.M); } else { - op_flipud::apply_direct(out, U.M); + op_flipud::apply_mat_noalias(tmp, U.M); } + + out.steal_mem(tmp); } else { - const Proxy P(in.m); - - if(P.is_alias(out)) + if((T1::is_xvec) ? bool(U.M.is_rowvec()) : bool(T1::is_row)) { - Mat tmp; - - if((T1::is_xvec) ? bool(P.get_n_rows() == 1) : bool(T1::is_row)) - { - op_fliplr::apply_proxy_noalias(tmp, P); - } - else - { - op_flipud::apply_proxy_noalias(tmp, P); - } - - out.steal_mem(tmp); + op_fliplr::apply_mat_noalias(out, U.M); } else { - if((T1::is_xvec) ? bool(P.get_n_rows() == 1) : bool(T1::is_row)) - { - op_fliplr::apply_proxy_noalias(out, P); - } - else - { - op_flipud::apply_proxy_noalias(out, P); - } + op_flipud::apply_mat_noalias(out, U.M); } } } +template +inline +void +op_reverse_vec::apply(Mat_noalias& out, const Op& in) + { + arma_debug_sigprint(); + + const quasi_unwrap U(in.m); + + if((T1::is_xvec) ? bool(U.M.is_rowvec()) : bool(T1::is_row)) + { + op_fliplr::apply_mat_noalias(out, U.M); + } + else + { + op_flipud::apply_mat_noalias(out, U.M); + } + } + + + //! @} diff --git a/inst/include/current/armadillo_bits/op_sort_bones.hpp b/inst/include/current/armadillo_bits/op_sort_bones.hpp index 31e0d344..1e879366 100644 --- a/inst/include/current/armadillo_bits/op_sort_bones.hpp +++ b/inst/include/current/armadillo_bits/op_sort_bones.hpp @@ -35,6 +35,9 @@ struct op_sort template inline static void apply(Mat& out, const Op& in); + + template + inline static void apply(Mat_noalias& out, const Op& in); }; diff --git a/inst/include/current/armadillo_bits/op_sort_meat.hpp b/inst/include/current/armadillo_bits/op_sort_meat.hpp index 22cae8a5..067da347 100644 --- a/inst/include/current/armadillo_bits/op_sort_meat.hpp +++ b/inst/include/current/armadillo_bits/op_sort_meat.hpp @@ -212,7 +212,6 @@ op_sort::apply(Mat& out, const Op& in) typedef typename T1::elem_type eT; const quasi_unwrap U(in.m); - const Mat& X = U.M; const uword sort_mode = in.aux_uword_a; const uword dim = in.aux_uword_b; @@ -224,18 +223,38 @@ op_sort::apply(Mat& out, const Op& in) { Mat tmp; - op_sort::apply_noalias(tmp, X, sort_mode, dim); + op_sort::apply_noalias(tmp, U.M, sort_mode, dim); out.steal_mem(tmp); } else { - op_sort::apply_noalias(out, X, sort_mode, dim); + op_sort::apply_noalias(out, U.M, sort_mode, dim); } } +template +inline +void +op_sort::apply(Mat_noalias& out, const Op& in) + { + arma_debug_sigprint(); + + const quasi_unwrap U(in.m); + + const uword sort_mode = in.aux_uword_a; + const uword dim = in.aux_uword_b; + + arma_conform_check( (sort_mode > 1), "sort(): parameter 'sort_mode' must be 0 or 1" ); + arma_conform_check( (dim > 1), "sort(): parameter 'dim' must be 0 or 1" ); + + op_sort::apply_noalias(out, U.M, sort_mode, dim); + } + + + template inline void diff --git a/inst/include/current/armadillo_bits/op_stddev_bones.hpp b/inst/include/current/armadillo_bits/op_stddev_bones.hpp index 9f7bc28a..9e2cb161 100644 --- a/inst/include/current/armadillo_bits/op_stddev_bones.hpp +++ b/inst/include/current/armadillo_bits/op_stddev_bones.hpp @@ -27,6 +27,9 @@ struct op_stddev template inline static void apply(Mat& out, const mtOp& in); + template + inline static void apply(Mat_noalias& out, const mtOp& in); + template inline static void apply_noalias(Mat::result>& out, const Mat& X, const uword norm_type, const uword dim); diff --git a/inst/include/current/armadillo_bits/op_stddev_meat.hpp b/inst/include/current/armadillo_bits/op_stddev_meat.hpp index fe540e35..2361983c 100644 --- a/inst/include/current/armadillo_bits/op_stddev_meat.hpp +++ b/inst/include/current/armadillo_bits/op_stddev_meat.hpp @@ -54,6 +54,26 @@ op_stddev::apply(Mat& out, const mtOp +inline +void +op_stddev::apply(Mat_noalias& out, const mtOp& in) + { + arma_debug_sigprint(); + + const uword norm_type = in.aux_uword_a; + const uword dim = in.aux_uword_b; + + arma_conform_check( (norm_type > 1), "stddev(): parameter 'norm_type' must be 0 or 1" ); + arma_conform_check( (dim > 1), "stddev(): parameter 'dim' must be 0 or 1" ); + + const quasi_unwrap U(in.m); + + op_stddev::apply_noalias(out, U.M, norm_type, dim); + } + + + template inline void diff --git a/inst/include/current/armadillo_bits/op_strans_bones.hpp b/inst/include/current/armadillo_bits/op_strans_bones.hpp index ad800bcf..546da70e 100644 --- a/inst/include/current/armadillo_bits/op_strans_bones.hpp +++ b/inst/include/current/armadillo_bits/op_strans_bones.hpp @@ -64,8 +64,14 @@ struct op_strans template inline static void apply_direct(Mat& out, const T1& X); + template + inline static void apply_direct(Mat_noalias& out, const T1& X); + template inline static void apply(Mat& out, const Op& in); + + template + inline static void apply(Mat_noalias& out, const Op& in); }; diff --git a/inst/include/current/armadillo_bits/op_strans_meat.hpp b/inst/include/current/armadillo_bits/op_strans_meat.hpp index 025fc023..4e3458ea 100644 --- a/inst/include/current/armadillo_bits/op_strans_meat.hpp +++ b/inst/include/current/armadillo_bits/op_strans_meat.hpp @@ -431,6 +431,29 @@ op_strans::apply_direct(Mat& out, const T1& X) +template +inline +void +op_strans::apply_direct(Mat_noalias& out, const T1& X) + { + arma_debug_sigprint(); + + if((is_Mat::stored_type>::value) || (is_subview_col::value) || (arma_config::openmp && Proxy::use_mp)) + { + const quasi_unwrap U(X); + + op_strans::apply_mat_noalias(out, U.M); + } + else + { + const Proxy P(X); + + op_strans::apply_proxy(out, P); + } + } + + + template inline void @@ -443,6 +466,18 @@ op_strans::apply(Mat& out, const Op& in) +template +inline +void +op_strans::apply(Mat_noalias& out, const Op& in) + { + arma_debug_sigprint(); + + op_strans::apply_direct(out, in.m); + } + + + // // // diff --git a/inst/include/current/armadillo_bits/op_sum_bones.hpp b/inst/include/current/armadillo_bits/op_sum_bones.hpp index 5a1a0e34..209248bb 100644 --- a/inst/include/current/armadillo_bits/op_sum_bones.hpp +++ b/inst/include/current/armadillo_bits/op_sum_bones.hpp @@ -34,9 +34,21 @@ struct op_sum template inline static void apply(Mat& out, const Op< eOp, op_sum >& in); + template + inline static void apply(Mat_noalias& out, const Op< T1, op_sum >& in); + + template + inline static void apply(Mat_noalias& out, const Op< eOp, op_sum >& in); + + template + inline static void apply(Mat_noalias& out, const Op< eOp, op_sum >& in); + template inline static void apply_generic(Mat& out, const Op& in); + template + inline static void apply_generic(Mat_noalias& out, const Op& in); + template inline static void apply_mat_noalias(Mat& out, const Mat& X, const uword dim); diff --git a/inst/include/current/armadillo_bits/op_sum_meat.hpp b/inst/include/current/armadillo_bits/op_sum_meat.hpp index 9d15a34b..91a4c9aa 100644 --- a/inst/include/current/armadillo_bits/op_sum_meat.hpp +++ b/inst/include/current/armadillo_bits/op_sum_meat.hpp @@ -120,7 +120,7 @@ op_sum::apply_generic(Mat& out, const Op& in) arma_conform_check( (dim > 1), "sum(): parameter 'dim' must be 0 or 1" ); - if((is_Mat::value) || (is_Mat::stored_type>::value) || (arma_config::openmp && Proxy::use_mp)) + if((quasi_unwrap::has_orig_mem) || (is_Mat::stored_type>::value) || (arma_config::openmp && Proxy::use_mp)) { const quasi_unwrap U(in.m); @@ -158,6 +158,106 @@ op_sum::apply_generic(Mat& out, const Op& in) +template +inline +void +op_sum::apply(Mat_noalias& out, const Op& in) + { + arma_debug_sigprint(); + + op_sum::apply_generic(out, in); + } + + + +template +inline +void +op_sum::apply(Mat_noalias& out, const Op< eOp, op_sum >& in) + { + arma_debug_sigprint(); + + typedef eOp inner_expr_type; + + typedef typename inner_expr_type::proxy_type::stored_type inner_expr_P_stored_type; + + if(is_Mat::value) + { + const uword dim = in.aux_uword_a; + + arma_conform_check( (dim > 1), "sum(): parameter 'dim' must be 0 or 1" ); + + const quasi_unwrap U(in.m.P.Q); + + op_sum::apply_mat_square_noalias(out, U.M, dim); + + return; + } + + op_sum::apply_generic(out, in); + } + + + +template +inline +void +op_sum::apply(Mat_noalias& out, const Op< eOp, op_sum >& in) + { + arma_debug_sigprint(); + + typedef typename T1::elem_type eT; + + if(arma_config::optimise_powexpr && (in.m.aux == eT(2))) + { + typedef Op< eOp, op_sum > modified_whole_expr_type; + + op_sum::apply(out, reinterpret_cast(in) ); + + return; + } + + if(arma_config::optimise_powexpr && (in.m.aux == eT(0.5)) && is_real_or_cx::value) + { + typedef Op< eOp, op_sum > modified_whole_expr_type; + + op_sum::apply(out, reinterpret_cast(in) ); + + return; + } + + op_sum::apply_generic(out, in); + } + + + +template +inline +void +op_sum::apply_generic(Mat_noalias& out, const Op& in) + { + arma_debug_sigprint(); + + const uword dim = in.aux_uword_a; + + arma_conform_check( (dim > 1), "sum(): parameter 'dim' must be 0 or 1" ); + + if((quasi_unwrap::has_orig_mem) || (is_Mat::stored_type>::value) || (arma_config::openmp && Proxy::use_mp)) + { + const quasi_unwrap U(in.m); + + op_sum::apply_mat_noalias(out, U.M, dim); + } + else + { + const Proxy P(in.m); + + op_sum::apply_proxy_noalias(out, P, dim); + } + } + + + template inline void diff --git a/inst/include/current/armadillo_bits/op_trimat_bones.hpp b/inst/include/current/armadillo_bits/op_trimat_bones.hpp index e77f5527..9422fe42 100644 --- a/inst/include/current/armadillo_bits/op_trimat_bones.hpp +++ b/inst/include/current/armadillo_bits/op_trimat_bones.hpp @@ -34,6 +34,9 @@ struct op_trimat template inline static void apply(Mat& out, const Op& in); + template + inline static void apply(Mat_noalias& out, const Op& in); + template inline static void apply_mat_noalias(Mat& out, const Mat& A, const bool upper); diff --git a/inst/include/current/armadillo_bits/op_trimat_meat.hpp b/inst/include/current/armadillo_bits/op_trimat_meat.hpp index de5f6014..d7d09bf3 100644 --- a/inst/include/current/armadillo_bits/op_trimat_meat.hpp +++ b/inst/include/current/armadillo_bits/op_trimat_meat.hpp @@ -122,6 +122,31 @@ op_trimat::apply(Mat& out, const Op& in) +template +inline +void +op_trimat::apply(Mat_noalias& out, const Op& in) + { + arma_debug_sigprint(); + + const bool upper = (in.aux_uword_a == 0); + + if( (is_Mat::value) || (is_Mat::stored_type>::value) || (arma_config::openmp && Proxy::use_mp) ) + { + const quasi_unwrap U(in.m); + + op_trimat::apply_mat_noalias(out, U.M, upper); + } + else + { + const Proxy P(in.m); + + op_trimat::apply_proxy_noalias(out, P, upper); + } + } + + + template inline void diff --git a/inst/include/current/armadillo_bits/op_var_bones.hpp b/inst/include/current/armadillo_bits/op_var_bones.hpp index d6a9d893..2425a908 100644 --- a/inst/include/current/armadillo_bits/op_var_bones.hpp +++ b/inst/include/current/armadillo_bits/op_var_bones.hpp @@ -27,6 +27,9 @@ struct op_var template inline static void apply(Mat& out, const mtOp& in); + template + inline static void apply(Mat_noalias& out, const mtOp& in); + template inline static void apply_noalias(Mat::result>& out, const Mat& X, const uword norm_type, const uword dim); diff --git a/inst/include/current/armadillo_bits/op_var_meat.hpp b/inst/include/current/armadillo_bits/op_var_meat.hpp index 0147d1b1..273742e8 100644 --- a/inst/include/current/armadillo_bits/op_var_meat.hpp +++ b/inst/include/current/armadillo_bits/op_var_meat.hpp @@ -54,6 +54,26 @@ op_var::apply(Mat& out, const mtOp +inline +void +op_var::apply(Mat_noalias& out, const mtOp& in) + { + arma_debug_sigprint(); + + const uword norm_type = in.aux_uword_a; + const uword dim = in.aux_uword_b; + + arma_conform_check( (norm_type > 1), "var(): parameter 'norm_type' must be 0 or 1" ); + arma_conform_check( (dim > 1), "var(): parameter 'dim' must be 0 or 1" ); + + const quasi_unwrap U(in.m); + + op_var::apply_noalias(out, U.M, norm_type, dim); + } + + + template inline void diff --git a/inst/include/current/armadillo_bits/op_vectorise_bones.hpp b/inst/include/current/armadillo_bits/op_vectorise_bones.hpp index 52485de3..eabe2eed 100644 --- a/inst/include/current/armadillo_bits/op_vectorise_bones.hpp +++ b/inst/include/current/armadillo_bits/op_vectorise_bones.hpp @@ -29,6 +29,10 @@ struct op_vectorise_col template inline static void apply_direct(Mat& out, const T1& expr); + template inline static void apply(Mat_noalias& out, const Op& in); + + template inline static void apply_direct(Mat_noalias& out, const T1& expr); + template inline static void apply_subview(Mat& out, const subview& sv); template inline static void apply_proxy(Mat& out, const Proxy& P); diff --git a/inst/include/current/armadillo_bits/op_vectorise_meat.hpp b/inst/include/current/armadillo_bits/op_vectorise_meat.hpp index 4ad335a0..724ce50c 100644 --- a/inst/include/current/armadillo_bits/op_vectorise_meat.hpp +++ b/inst/include/current/armadillo_bits/op_vectorise_meat.hpp @@ -80,7 +80,7 @@ op_vectorise_col::apply_direct(Mat& out, const T1& expr) } } else - if((is_Mat::stored_type>::value) || (arma_config::openmp && Proxy::use_mp)) + if( (quasi_unwrap::has_orig_mem) || (is_Mat::stored_type>::value) || (arma_config::openmp && Proxy::use_mp) ) { const quasi_unwrap U(expr); @@ -118,6 +118,52 @@ op_vectorise_col::apply_direct(Mat& out, const T1& expr) +template +inline +void +op_vectorise_col::apply(Mat_noalias& out, const Op& in) + { + arma_debug_sigprint(); + + op_vectorise_col::apply_direct(out, in.m); + } + + + +template +inline +void +op_vectorise_col::apply_direct(Mat_noalias& out, const T1& expr) + { + arma_debug_sigprint(); + + typedef typename T1::elem_type eT; + + if(is_subview::value) + { + const subview& sv = reinterpret_cast< const subview& >(expr); + + op_vectorise_col::apply_subview(out, sv); + } + else + if( (quasi_unwrap::has_orig_mem) || (is_Mat::stored_type>::value) || (arma_config::openmp && Proxy::use_mp) ) + { + const quasi_unwrap U(expr); + + out.set_size(U.M.n_elem, 1); + + arrayops::copy(out.memptr(), U.M.memptr(), U.M.n_elem); + } + else + { + const Proxy P(expr); + + op_vectorise_col::apply_proxy(out, P); + } + } + + + template inline void diff --git a/inst/include/current/armadillo_bits/spglue_join_bones.hpp b/inst/include/current/armadillo_bits/spglue_join_bones.hpp index ab3e961a..2dec57a2 100644 --- a/inst/include/current/armadillo_bits/spglue_join_bones.hpp +++ b/inst/include/current/armadillo_bits/spglue_join_bones.hpp @@ -34,6 +34,9 @@ struct spglue_join_cols template inline static void apply(SpMat& out, const SpGlue& X); + template + inline static void apply(SpMat_noalias& out, const SpGlue& X); + template inline static void apply_noalias(SpMat& out, const SpMat& A, const SpMat& B); @@ -59,6 +62,9 @@ struct spglue_join_rows template inline static void apply(SpMat& out, const SpGlue& X); + template + inline static void apply(SpMat_noalias& out, const SpGlue& X); + template inline static void apply_noalias(SpMat& out, const SpMat& A, const SpMat& B); diff --git a/inst/include/current/armadillo_bits/spglue_join_meat.hpp b/inst/include/current/armadillo_bits/spglue_join_meat.hpp index 31808eb7..f30bbdf7 100644 --- a/inst/include/current/armadillo_bits/spglue_join_meat.hpp +++ b/inst/include/current/armadillo_bits/spglue_join_meat.hpp @@ -49,6 +49,21 @@ spglue_join_cols::apply(SpMat& out, const SpGlue +inline +void +spglue_join_cols::apply(SpMat_noalias& out, const SpGlue& X) + { + arma_debug_sigprint(); + + const unwrap_spmat UA(X.A); + const unwrap_spmat UB(X.B); + + spglue_join_cols::apply_noalias(out, UA.M, UB.M); + } + + + template inline void @@ -177,6 +192,10 @@ spglue_join_cols::apply(SpMat& out, const SpBase& A_expr, const SpBas +// + + + template inline void @@ -205,6 +224,21 @@ spglue_join_rows::apply(SpMat& out, const SpGlue +inline +void +spglue_join_rows::apply(SpMat_noalias& out, const SpGlue& X) + { + arma_debug_sigprint(); + + const unwrap_spmat UA(X.A); + const unwrap_spmat UB(X.B); + + spglue_join_rows::apply_noalias(out, UA.M, UB.M); + } + + + template inline void diff --git a/inst/include/current/armadillo_bits/spglue_kron_bones.hpp b/inst/include/current/armadillo_bits/spglue_kron_bones.hpp index 54404290..2e455bdf 100644 --- a/inst/include/current/armadillo_bits/spglue_kron_bones.hpp +++ b/inst/include/current/armadillo_bits/spglue_kron_bones.hpp @@ -34,6 +34,9 @@ struct spglue_kron template inline static void apply(SpMat& out, const SpGlue& X); + template + inline static void apply(SpMat_noalias& out, const SpGlue& X); + template inline static void apply_noalias(SpMat& out, const SpMat& A, const SpMat& B); }; diff --git a/inst/include/current/armadillo_bits/spglue_kron_meat.hpp b/inst/include/current/armadillo_bits/spglue_kron_meat.hpp index e8c68b8d..3dfb5d04 100644 --- a/inst/include/current/armadillo_bits/spglue_kron_meat.hpp +++ b/inst/include/current/armadillo_bits/spglue_kron_meat.hpp @@ -49,6 +49,21 @@ spglue_kron::apply(SpMat& out, const SpGlue +inline +void +spglue_kron::apply(SpMat_noalias& out, const SpGlue& X) + { + arma_debug_sigprint(); + + const unwrap_spmat UA(X.A); + const unwrap_spmat UB(X.B); + + spglue_kron::apply_noalias(out, UA.M, UB.M); + } + + + template inline void diff --git a/inst/include/current/armadillo_bits/spglue_minus_bones.hpp b/inst/include/current/armadillo_bits/spglue_minus_bones.hpp index 0dec724c..27b7e2ea 100644 --- a/inst/include/current/armadillo_bits/spglue_minus_bones.hpp +++ b/inst/include/current/armadillo_bits/spglue_minus_bones.hpp @@ -27,6 +27,9 @@ struct spglue_minus template inline static void apply(SpMat& out, const SpGlue& X); + template + inline static void apply(SpMat_noalias& out, const SpGlue& X); + template inline static void apply_noalias(SpMat& result, const SpProxy& pa, const SpProxy& pb); diff --git a/inst/include/current/armadillo_bits/spglue_minus_meat.hpp b/inst/include/current/armadillo_bits/spglue_minus_meat.hpp index 6527137d..71c68c6d 100644 --- a/inst/include/current/armadillo_bits/spglue_minus_meat.hpp +++ b/inst/include/current/armadillo_bits/spglue_minus_meat.hpp @@ -51,6 +51,21 @@ spglue_minus::apply(SpMat& out, const SpGlue +inline +void +spglue_minus::apply(SpMat_noalias& out, const SpGlue& X) + { + arma_debug_sigprint(); + + const SpProxy pa(X.A); + const SpProxy pb(X.B); + + spglue_minus::apply_noalias(out, pa, pb); + } + + + template inline void diff --git a/inst/include/current/armadillo_bits/spglue_plus_bones.hpp b/inst/include/current/armadillo_bits/spglue_plus_bones.hpp index e9ca17be..55d39a7f 100644 --- a/inst/include/current/armadillo_bits/spglue_plus_bones.hpp +++ b/inst/include/current/armadillo_bits/spglue_plus_bones.hpp @@ -27,6 +27,9 @@ struct spglue_plus template inline static void apply(SpMat& out, const SpGlue& X); + template + inline static void apply(SpMat_noalias& out, const SpGlue& X); + template inline static void apply_noalias(SpMat& out, const SpProxy& pa, const SpProxy& pb); diff --git a/inst/include/current/armadillo_bits/spglue_plus_meat.hpp b/inst/include/current/armadillo_bits/spglue_plus_meat.hpp index 78021396..a594da44 100644 --- a/inst/include/current/armadillo_bits/spglue_plus_meat.hpp +++ b/inst/include/current/armadillo_bits/spglue_plus_meat.hpp @@ -51,6 +51,21 @@ spglue_plus::apply(SpMat& out, const SpGlue +inline +void +spglue_plus::apply(SpMat_noalias& out, const SpGlue& X) + { + arma_debug_sigprint(); + + const SpProxy pa(X.A); + const SpProxy pb(X.B); + + spglue_plus::apply_noalias(out, pa, pb); + } + + + template inline void diff --git a/inst/include/current/armadillo_bits/spglue_schur_bones.hpp b/inst/include/current/armadillo_bits/spglue_schur_bones.hpp index f32a5880..0f532f0e 100644 --- a/inst/include/current/armadillo_bits/spglue_schur_bones.hpp +++ b/inst/include/current/armadillo_bits/spglue_schur_bones.hpp @@ -27,6 +27,9 @@ struct spglue_schur template inline static void apply(SpMat& out, const SpGlue& X); + template + inline static void apply(SpMat_noalias& out, const SpGlue& X); + template inline static void apply_noalias(SpMat& out, const SpProxy& pa, const SpProxy& pb); diff --git a/inst/include/current/armadillo_bits/spglue_schur_meat.hpp b/inst/include/current/armadillo_bits/spglue_schur_meat.hpp index f9ad2725..29a24667 100644 --- a/inst/include/current/armadillo_bits/spglue_schur_meat.hpp +++ b/inst/include/current/armadillo_bits/spglue_schur_meat.hpp @@ -51,6 +51,21 @@ spglue_schur::apply(SpMat& out, const SpGlue +inline +void +spglue_schur::apply(SpMat_noalias& out, const SpGlue& X) + { + arma_debug_sigprint(); + + const SpProxy pa(X.A); + const SpProxy pb(X.B); + + spglue_schur::apply_noalias(out, pa, pb); + } + + + template inline void diff --git a/inst/include/current/armadillo_bits/spglue_times_bones.hpp b/inst/include/current/armadillo_bits/spglue_times_bones.hpp index e55b7855..c068026f 100644 --- a/inst/include/current/armadillo_bits/spglue_times_bones.hpp +++ b/inst/include/current/armadillo_bits/spglue_times_bones.hpp @@ -37,6 +37,12 @@ struct spglue_times template inline static void apply(SpMat& out, const SpGlue,T2,spglue_times>& X); + template + inline static void apply(SpMat_noalias& out, const SpGlue& X); + + template + inline static void apply(SpMat_noalias& out, const SpGlue,T2,spglue_times>& X); + template inline static void apply_noalias(SpMat& c, const SpMat& x, const SpMat& y); }; diff --git a/inst/include/current/armadillo_bits/spglue_times_meat.hpp b/inst/include/current/armadillo_bits/spglue_times_meat.hpp index 41ead933..7ef77e6c 100644 --- a/inst/include/current/armadillo_bits/spglue_times_meat.hpp +++ b/inst/include/current/armadillo_bits/spglue_times_meat.hpp @@ -83,6 +83,38 @@ spglue_times::apply(SpMat& out, const SpGlue +inline +void +spglue_times::apply(SpMat_noalias& out, const SpGlue& X) + { + arma_debug_sigprint(); + + const unwrap_spmat UA(X.A); + const unwrap_spmat UB(X.B); + + spglue_times::apply_noalias(out, UA.M, UB.M); + } + + + +template +inline +void +spglue_times::apply(SpMat_noalias& out, const SpGlue,T2,spglue_times>& X) + { + arma_debug_sigprint(); + + const unwrap_spmat UA(X.A.m); + const unwrap_spmat UB(X.B); + + spglue_times::apply_noalias(out, UA.M, UB.M); + + out *= X.A.aux; + } + + + template inline void diff --git a/inst/include/current/armadillo_bits/spop_htrans_bones.hpp b/inst/include/current/armadillo_bits/spop_htrans_bones.hpp index d1fff649..83797750 100644 --- a/inst/include/current/armadillo_bits/spop_htrans_bones.hpp +++ b/inst/include/current/armadillo_bits/spop_htrans_bones.hpp @@ -37,6 +37,12 @@ struct spop_htrans template inline static void apply(SpMat& out, const SpOp& in, const typename arma_cx_only::result* junk = nullptr); + + template + inline static void apply(SpMat_noalias& out, const SpOp& in, const typename arma_not_cx::result* junk = nullptr); + + template + inline static void apply(SpMat_noalias& out, const SpOp& in, const typename arma_cx_only::result* junk = nullptr); }; diff --git a/inst/include/current/armadillo_bits/spop_htrans_meat.hpp b/inst/include/current/armadillo_bits/spop_htrans_meat.hpp index 08416b89..db8cbd94 100644 --- a/inst/include/current/armadillo_bits/spop_htrans_meat.hpp +++ b/inst/include/current/armadillo_bits/spop_htrans_meat.hpp @@ -58,4 +58,41 @@ spop_htrans::apply(SpMat& out, const SpOp +inline +void +spop_htrans::apply(SpMat_noalias& out, const SpOp& in, const typename arma_not_cx::result* junk) + { + arma_debug_sigprint(); + arma_ignore(junk); + + spop_strans::apply(out, in); + } + + + +template +inline +void +spop_htrans::apply(SpMat_noalias& out, const SpOp& in, const typename arma_cx_only::result* junk) + { + arma_debug_sigprint(); + arma_ignore(junk); + + typedef typename T1::elem_type eT; + + spop_strans::apply(out, in); + + const uword N = out.n_nonzero; + + for(uword i=0; i inline static void apply(SpMat& out, const SpOp& X); + template + inline static void apply(SpMat_noalias& out, const SpOp& X); + template inline static void apply_noalias(SpMat& out, const uword A_n_rows, const uword A_n_cols, const SpMat& B); }; diff --git a/inst/include/current/armadillo_bits/spop_repmat_meat.hpp b/inst/include/current/armadillo_bits/spop_repmat_meat.hpp index 9411eac7..5cef71ac 100644 --- a/inst/include/current/armadillo_bits/spop_repmat_meat.hpp +++ b/inst/include/current/armadillo_bits/spop_repmat_meat.hpp @@ -48,6 +48,20 @@ spop_repmat::apply(SpMat& out, const SpOp +inline +void +spop_repmat::apply(SpMat_noalias& out, const SpOp& X) + { + arma_debug_sigprint(); + + const unwrap_spmat U(X.m); + + spop_repmat::apply_noalias(out, X.aux_uword_a, X.aux_uword_b, U.M); + } + + + template inline void diff --git a/inst/include/current/armadillo_bits/spop_strans_bones.hpp b/inst/include/current/armadillo_bits/spop_strans_bones.hpp index 5bf1eda6..cf18e6af 100644 --- a/inst/include/current/armadillo_bits/spop_strans_bones.hpp +++ b/inst/include/current/armadillo_bits/spop_strans_bones.hpp @@ -40,6 +40,12 @@ struct spop_strans template inline static void apply(SpMat& out, const SpOp& in); + + template + inline static void apply(SpMat_noalias& out, const SpOp& in); + + template + inline static void apply(SpMat_noalias& out, const SpOp& in); }; diff --git a/inst/include/current/armadillo_bits/spop_strans_meat.hpp b/inst/include/current/armadillo_bits/spop_strans_meat.hpp index 28e77fe6..461af988 100644 --- a/inst/include/current/armadillo_bits/spop_strans_meat.hpp +++ b/inst/include/current/armadillo_bits/spop_strans_meat.hpp @@ -149,4 +149,33 @@ spop_strans::apply(SpMat& out, const SpOp +inline +void +spop_strans::apply(SpMat_noalias& out, const SpOp& in) + { + arma_debug_sigprint(); + + const unwrap_spmat U(in.m); + + spop_strans::apply_noalias(out, U.M); + } + + + +//! for transpose of non-complex matrices, redirected from spop_htrans::apply() +template +inline +void +spop_strans::apply(SpMat_noalias& out, const SpOp& in) + { + arma_debug_sigprint(); + + const unwrap_spmat U(in.m); + + spop_strans::apply_noalias(out, U.M); + } + + + //! @} diff --git a/inst/include/current/armadillo_bits/spop_trimat_bones.hpp b/inst/include/current/armadillo_bits/spop_trimat_bones.hpp index 2575b565..d9472920 100644 --- a/inst/include/current/armadillo_bits/spop_trimat_bones.hpp +++ b/inst/include/current/armadillo_bits/spop_trimat_bones.hpp @@ -29,6 +29,9 @@ struct spop_trimat template inline static void apply(SpMat& out, const SpOp& in); + + template + inline static void apply(SpMat_noalias& out, const SpOp& in); }; diff --git a/inst/include/current/armadillo_bits/spop_trimat_meat.hpp b/inst/include/current/armadillo_bits/spop_trimat_meat.hpp index 0812bfcf..ea05034b 100644 --- a/inst/include/current/armadillo_bits/spop_trimat_meat.hpp +++ b/inst/include/current/armadillo_bits/spop_trimat_meat.hpp @@ -141,6 +141,24 @@ spop_trimat::apply(SpMat& out, const SpOp +inline +void +spop_trimat::apply(SpMat_noalias& out, const SpOp& in) + { + arma_debug_sigprint(); + + const SpProxy P(in.m); + + arma_conform_check( (P.get_n_rows() != P.get_n_cols()), "trimatu()/trimatl(): given matrix must be square sized" ); + + const bool upper = (in.aux_uword_a == 0); + + spop_trimat::apply_noalias(out, P, upper); + } + + + // diff --git a/inst/include/current/armadillo_bits/unwrap.hpp b/inst/include/current/armadillo_bits/unwrap.hpp index 07d581c0..0026afd0 100644 --- a/inst/include/current/armadillo_bits/unwrap.hpp +++ b/inst/include/current/armadillo_bits/unwrap.hpp @@ -382,19 +382,21 @@ struct quasi_unwrap< subview_row > { inline quasi_unwrap(const subview_row& A) - : M(A) + : sv( A ) + , M ( A, (A.m.n_rows == 1) ) { arma_debug_sigprint(); } - Row M; + const subview_row& sv; + const Row M; - static constexpr bool is_const = false; - static constexpr bool has_subview = false; - static constexpr bool has_orig_mem = false; + static constexpr bool is_const = true; + static constexpr bool has_subview = true; + static constexpr bool has_orig_mem = false; // NOTE: set to false as this is the general case; original memory is only used when the subview is a contiguous chunk template - constexpr bool is_alias(const Mat&) const { return false; } + arma_inline bool is_alias(const Mat& X) const { return (sv.m.n_rows == 1) ? (void_ptr(&X) == void_ptr(&(sv.m))) : false; } }; @@ -1426,11 +1428,12 @@ struct partial_unwrap< subview_cols > template struct partial_unwrap< subview_row > { - typedef Row stored_type; + typedef Mat stored_type; inline partial_unwrap(const subview_row& A) - : M(A) + : sv( A ) + , M ( A, (A.m.n_rows == 1) ) { arma_debug_sigprint(); } @@ -1438,13 +1441,14 @@ struct partial_unwrap< subview_row > constexpr eT get_val() const { return eT(1); } template - constexpr bool is_alias(const Mat&) const { return false; } + arma_inline bool is_alias(const Mat& X) const { return (sv.m.n_rows == 1) ? (void_ptr(&X) == void_ptr(&(sv.m))) : false; } static constexpr bool do_trans = false; static constexpr bool do_times = false; - static constexpr bool is_fast = false; + static constexpr bool is_fast = true; - const Row M; + const subview_row& sv; + const Mat M; }; From ddf80438731fcadbb2a231f45eb2e0783d8c82d8 Mon Sep 17 00:00:00 2001 From: Dirk Eddelbuettel Date: Thu, 16 Oct 2025 09:15:44 -0500 Subject: [PATCH 2/2] Micro-release (GitHub-only) 15.1.99-1 --- ChangeLog | 9 +++++++++ DESCRIPTION | 4 ++-- configure | 18 +++++++++--------- configure.ac | 2 +- inst/NEWS.Rd | 6 ++++++ 5 files changed, 27 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index a7ebdf32..b1f147b3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2025-10-16 Dirk Eddelbuettel + + * DESCRIPTION (Version, Date): RcppArmadillo 15.1.99-1 + * inst/NEWS.Rd: Idem + * configure.ac: Idem + * configure: Idem + + * inst/include/current/: Sync with Armadillo 15.2-rc1 + 2025-09-21 Dirk Eddelbuettel * inst/include/current/: Sync with Armadillo 15.0.3 diff --git a/DESCRIPTION b/DESCRIPTION index d53b0afa..0263224d 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Package: RcppArmadillo Type: Package Title: 'Rcpp' Integration for the 'Armadillo' Templated Linear Algebra Library -Version: 15.0.2-2 -Date: 2025-09-18 +Version: 15.1.99-1 +Date: 2025-10-16 Authors@R: c(person("Dirk", "Eddelbuettel", role = c("aut", "cre"), email = "edd@debian.org", comment = c(ORCID = "0000-0001-6419-907X")), person("Romain", "Francois", role = "aut", diff --git a/configure b/configure index b58ee67a..706b82c9 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.72 for RcppArmadillo 15.0.2-2. +# Generated by GNU Autoconf 2.72 for RcppArmadillo 15.1.99-1. # # Report bugs to . # @@ -603,8 +603,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='RcppArmadillo' PACKAGE_TARNAME='rcpparmadillo' -PACKAGE_VERSION='15.0.2-2' -PACKAGE_STRING='RcppArmadillo 15.0.2-2' +PACKAGE_VERSION='15.1.99-1' +PACKAGE_STRING='RcppArmadillo 15.1.99-1' PACKAGE_BUGREPORT='edd@debian.org' PACKAGE_URL='' @@ -1221,7 +1221,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -'configure' configures RcppArmadillo 15.0.2-2 to adapt to many kinds of systems. +'configure' configures RcppArmadillo 15.1.99-1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1283,7 +1283,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of RcppArmadillo 15.0.2-2:";; + short | recursive ) echo "Configuration of RcppArmadillo 15.1.99-1:";; esac cat <<\_ACEOF @@ -1364,7 +1364,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -RcppArmadillo configure 15.0.2-2 +RcppArmadillo configure 15.1.99-1 generated by GNU Autoconf 2.72 Copyright (C) 2023 Free Software Foundation, Inc. @@ -1480,7 +1480,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by RcppArmadillo $as_me 15.0.2-2, which was +It was created by RcppArmadillo $as_me 15.1.99-1, which was generated by GNU Autoconf 2.72. Invocation command line was $ $0$ac_configure_args_raw @@ -3977,7 +3977,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by RcppArmadillo $as_me 15.0.2-2, which was +This file was extended by RcppArmadillo $as_me 15.1.99-1, which was generated by GNU Autoconf 2.72. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4032,7 +4032,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config='$ac_cs_config_escaped' ac_cs_version="\\ -RcppArmadillo config.status 15.0.2-2 +RcppArmadillo config.status 15.1.99-1 configured by $0, generated by GNU Autoconf 2.72, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index ff6b924b..91357046 100644 --- a/configure.ac +++ b/configure.ac @@ -11,7 +11,7 @@ AC_PREREQ([2.69]) ## Process this file with autoconf to produce a configure script. -AC_INIT([RcppArmadillo],[15.0.2-2],[edd@debian.org]) +AC_INIT([RcppArmadillo],[15.1.99-1],[edd@debian.org]) ## Set R_HOME, respecting an environment variable if one is set : ${R_HOME=$(R RHOME)} diff --git a/inst/NEWS.Rd b/inst/NEWS.Rd index 7083a960..0301b2ac 100644 --- a/inst/NEWS.Rd +++ b/inst/NEWS.Rd @@ -3,6 +3,12 @@ \newcommand{\ghpr}{\href{https://github.com/RcppCore/RcppArmadillo/pull/#1}{##1}} \newcommand{\ghit}{\href{https://github.com/RcppCore/RcppArmadillo/issues/#1}{##1}} +\section{Changes in RcppArmadillo version 15.1.99-1 (2025-10-16) (GitHub Only)}{ + \itemize{ + \item Upgraded to Armadillo release 15.2.0 (RC1 right now) + } +} + \section{Changes in RcppArmadillo version 15.0.2-2 (2025-09-18)}{ \itemize{ \item Minor update to skeleton \code{Makevars},\code{Makevars.win}