From 840795fc4752be422ba5ceb56c1e01d047a2dee7 Mon Sep 17 00:00:00 2001 From: conrad Date: Fri, 14 Jun 2024 23:58:39 +1000 Subject: [PATCH] rework sparse reduction operations --- include/armadillo | 6 +- include/armadillo_bits/Col_bones.hpp | 2 - include/armadillo_bits/CubeToMatOp_bones.hpp | 1 - include/armadillo_bits/Gen_bones.hpp | 1 - include/armadillo_bits/Glue_bones.hpp | 2 - include/armadillo_bits/MapMat_bones.hpp | 1 - include/armadillo_bits/Mat_bones.hpp | 16 +- include/armadillo_bits/Mat_meat.hpp | 14 +- include/armadillo_bits/Op_bones.hpp | 2 - include/armadillo_bits/Proxy.hpp | 97 ------------ include/armadillo_bits/Row_bones.hpp | 2 - include/armadillo_bits/SpCol_bones.hpp | 5 +- include/armadillo_bits/SpCol_meat.hpp | 32 +--- include/armadillo_bits/SpGlue_bones.hpp | 1 - include/armadillo_bits/SpMat_bones.hpp | 16 +- include/armadillo_bits/SpMat_meat.hpp | 138 ++++++++++++++---- include/armadillo_bits/SpOp_bones.hpp | 1 - include/armadillo_bits/SpProxy.hpp | 63 ++++++-- .../armadillo_bits/SpReductionOp_bones.hpp | 49 ------- include/armadillo_bits/SpReductionOp_meat.hpp | 66 --------- include/armadillo_bits/SpRow_bones.hpp | 7 +- include/armadillo_bits/SpRow_meat.hpp | 32 +--- include/armadillo_bits/SpSubview_bones.hpp | 3 - .../SpSubview_col_list_bones.hpp | 1 - include/armadillo_bits/SpToDGlue_bones.hpp | 1 - include/armadillo_bits/SpToDOp_bones.hpp | 1 - include/armadillo_bits/arma_forward.hpp | 12 +- include/armadillo_bits/diagview_bones.hpp | 1 - include/armadillo_bits/eGlue_bones.hpp | 1 - include/armadillo_bits/eOp_bones.hpp | 1 - include/armadillo_bits/fn_diagvec.hpp | 4 +- include/armadillo_bits/fn_max.hpp | 8 +- include/armadillo_bits/fn_mean.hpp | 8 +- include/armadillo_bits/fn_min.hpp | 8 +- include/armadillo_bits/fn_stddev.hpp | 8 +- include/armadillo_bits/fn_sum.hpp | 8 +- include/armadillo_bits/fn_var.hpp | 8 +- include/armadillo_bits/fn_vecnorm.hpp | 16 +- include/armadillo_bits/glue_affmul_bones.hpp | 1 - include/armadillo_bits/glue_conv_bones.hpp | 1 - include/armadillo_bits/glue_cor_bones.hpp | 1 - include/armadillo_bits/glue_cov_bones.hpp | 1 - include/armadillo_bits/glue_cross_bones.hpp | 1 - include/armadillo_bits/glue_hist_bones.hpp | 1 - include/armadillo_bits/glue_histc_bones.hpp | 1 - .../armadillo_bits/glue_intersect_bones.hpp | 1 - include/armadillo_bits/glue_join_bones.hpp | 2 - include/armadillo_bits/glue_kron_bones.hpp | 1 - include/armadillo_bits/glue_mixed_bones.hpp | 1 - include/armadillo_bits/glue_mvnrnd_bones.hpp | 1 - include/armadillo_bits/glue_polyfit_bones.hpp | 1 - include/armadillo_bits/glue_polyval_bones.hpp | 1 - .../armadillo_bits/glue_quantile_bones.hpp | 1 - include/armadillo_bits/glue_solve_bones.hpp | 4 - include/armadillo_bits/glue_times_bones.hpp | 2 - .../armadillo_bits/glue_times_misc_bones.hpp | 2 - include/armadillo_bits/glue_trapz_bones.hpp | 1 - include/armadillo_bits/mtGlue_bones.hpp | 1 - include/armadillo_bits/mtOp_bones.hpp | 1 - include/armadillo_bits/mtSpGlue_bones.hpp | 1 - include/armadillo_bits/mtSpOp_bones.hpp | 1 - include/armadillo_bits/mtSpToDOp_bones.hpp | 50 ------- include/armadillo_bits/mtSpToDOp_meat.hpp | 55 ------- include/armadillo_bits/op_htrans_bones.hpp | 2 - .../armadillo_bits/op_sp_diagvec_bones.hpp | 3 +- include/armadillo_bits/op_sp_diagvec_meat.hpp | 2 +- include/armadillo_bits/op_sp_max_bones.hpp | 3 +- include/armadillo_bits/op_sp_max_meat.hpp | 2 +- include/armadillo_bits/op_sp_mean_bones.hpp | 3 +- include/armadillo_bits/op_sp_mean_meat.hpp | 2 +- include/armadillo_bits/op_sp_min_bones.hpp | 3 +- include/armadillo_bits/op_sp_min_meat.hpp | 2 +- include/armadillo_bits/op_sp_minus_bones.hpp | 2 - include/armadillo_bits/op_sp_plus_bones.hpp | 1 - include/armadillo_bits/op_sp_stddev_bones.hpp | 3 +- include/armadillo_bits/op_sp_stddev_meat.hpp | 2 +- include/armadillo_bits/op_sp_sum_bones.hpp | 3 +- include/armadillo_bits/op_sp_sum_meat.hpp | 2 +- include/armadillo_bits/op_sp_var_bones.hpp | 3 +- include/armadillo_bits/op_sp_var_meat.hpp | 2 +- .../armadillo_bits/op_sp_vecnorm_bones.hpp | 6 +- include/armadillo_bits/op_sp_vecnorm_meat.hpp | 4 +- include/armadillo_bits/op_strans_bones.hpp | 1 - include/armadillo_bits/spdiagview_bones.hpp | 1 - include/armadillo_bits/spglue_join_bones.hpp | 2 - include/armadillo_bits/spglue_kron_bones.hpp | 1 - include/armadillo_bits/spglue_times_bones.hpp | 2 - include/armadillo_bits/spop_htrans_bones.hpp | 1 - include/armadillo_bits/spop_strans_bones.hpp | 1 - include/armadillo_bits/subview_bones.hpp | 6 - .../armadillo_bits/subview_elem1_bones.hpp | 1 - .../armadillo_bits/subview_elem2_bones.hpp | 1 - include/armadillo_bits/traits.hpp | 44 ++---- include/armadillo_bits/unwrap_spmat.hpp | 20 +++ include/armadillo_bits/xtrans_mat_bones.hpp | 1 - include/armadillo_bits/xvec_htrans_bones.hpp | 1 - 96 files changed, 276 insertions(+), 634 deletions(-) delete mode 100644 include/armadillo_bits/SpReductionOp_bones.hpp delete mode 100644 include/armadillo_bits/SpReductionOp_meat.hpp delete mode 100644 include/armadillo_bits/mtSpToDOp_bones.hpp delete mode 100644 include/armadillo_bits/mtSpToDOp_meat.hpp diff --git a/include/armadillo b/include/armadillo index 3804e23f..6be4e325 100644 --- a/include/armadillo +++ b/include/armadillo @@ -220,9 +220,7 @@ namespace arma #include "armadillo_bits/CubeToMatOp_bones.hpp" #include "armadillo_bits/OpCube_bones.hpp" #include "armadillo_bits/SpOp_bones.hpp" - #include "armadillo_bits/SpReductionOp_bones.hpp" #include "armadillo_bits/SpToDOp_bones.hpp" - #include "armadillo_bits/mtSpToDOp_bones.hpp" #include "armadillo_bits/mtSpReductionOp_bones.hpp" #include "armadillo_bits/eOp_bones.hpp" @@ -625,14 +623,12 @@ namespace arma #include "armadillo_bits/CubeToMatOp_meat.hpp" #include "armadillo_bits/OpCube_meat.hpp" #include "armadillo_bits/SpOp_meat.hpp" - #include "armadillo_bits/SpReductionOp_meat.hpp" #include "armadillo_bits/SpToDOp_meat.hpp" - #include "armadillo_bits/mtSpToDOp_meat.hpp" - #include "armadillo_bits/mtSpReductionOp_meat.hpp" #include "armadillo_bits/mtOp_meat.hpp" #include "armadillo_bits/mtOpCube_meat.hpp" #include "armadillo_bits/mtSpOp_meat.hpp" + #include "armadillo_bits/mtSpReductionOp_meat.hpp" #include "armadillo_bits/Glue_meat.hpp" #include "armadillo_bits/GlueCube_meat.hpp" diff --git a/include/armadillo_bits/Col_bones.hpp b/include/armadillo_bits/Col_bones.hpp index 02d99aa4..b3f0ab68 100644 --- a/include/armadillo_bits/Col_bones.hpp +++ b/include/armadillo_bits/Col_bones.hpp @@ -32,7 +32,6 @@ class Col : public Mat static constexpr bool is_col = true; static constexpr bool is_row = false; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; inline Col(); inline Col(const Col& X); @@ -203,7 +202,6 @@ class Col::fixed : public Col static constexpr bool is_col = true; static constexpr bool is_row = false; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; static const uword n_rows; // value provided below the class definition static const uword n_cols; // value provided below the class definition diff --git a/include/armadillo_bits/CubeToMatOp_bones.hpp b/include/armadillo_bits/CubeToMatOp_bones.hpp index 9f568bdf..cd2ba599 100644 --- a/include/armadillo_bits/CubeToMatOp_bones.hpp +++ b/include/armadillo_bits/CubeToMatOp_bones.hpp @@ -39,7 +39,6 @@ class CubeToMatOp : public Base< typename T1::elem_type, CubeToMatOp::is_row; static constexpr bool is_col = op_type::template traits::is_col; static constexpr bool is_xvec = op_type::template traits::is_xvec; - static constexpr bool is_d2sp = false; }; diff --git a/include/armadillo_bits/Gen_bones.hpp b/include/armadillo_bits/Gen_bones.hpp index 90e75183..172e5b9c 100644 --- a/include/armadillo_bits/Gen_bones.hpp +++ b/include/armadillo_bits/Gen_bones.hpp @@ -36,7 +36,6 @@ class Gen static constexpr bool is_row = T1::is_row; static constexpr bool is_col = T1::is_col; static constexpr bool is_xvec = T1::is_xvec; - static constexpr bool is_d2sp = false; arma_aligned const uword n_rows; arma_aligned const uword n_cols; diff --git a/include/armadillo_bits/Glue_bones.hpp b/include/armadillo_bits/Glue_bones.hpp index b68bbd99..197ae746 100644 --- a/include/armadillo_bits/Glue_bones.hpp +++ b/include/armadillo_bits/Glue_bones.hpp @@ -31,7 +31,6 @@ struct Glue_traits static constexpr bool is_row = glue_type::template traits::is_row; static constexpr bool is_col = glue_type::template traits::is_col; static constexpr bool is_xvec = glue_type::template traits::is_xvec; - static constexpr bool is_d2sp = false; }; template @@ -40,7 +39,6 @@ struct Glue_traits static constexpr bool is_row = false; static constexpr bool is_col = false; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; }; diff --git a/include/armadillo_bits/MapMat_bones.hpp b/include/armadillo_bits/MapMat_bones.hpp index be5cdcb8..7ab46b06 100644 --- a/include/armadillo_bits/MapMat_bones.hpp +++ b/include/armadillo_bits/MapMat_bones.hpp @@ -33,7 +33,6 @@ class MapMat static constexpr bool is_row = false; static constexpr bool is_col = false; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; const uword n_rows; //!< number of rows (read-only) const uword n_cols; //!< number of columns (read-only) diff --git a/include/armadillo_bits/Mat_bones.hpp b/include/armadillo_bits/Mat_bones.hpp index c97c957b..95a58856 100644 --- a/include/armadillo_bits/Mat_bones.hpp +++ b/include/armadillo_bits/Mat_bones.hpp @@ -56,7 +56,6 @@ class Mat : public Base< eT, Mat > static constexpr bool is_col = false; static constexpr bool is_row = false; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; inline ~Mat(); inline Mat(); @@ -369,13 +368,13 @@ class Mat : public Base< eT, Mat > template inline Mat& operator%=(const SpToDOp& X); template inline Mat& operator/=(const SpToDOp& X); - template inline Mat(const mtSpToDOp& X); - template inline Mat& operator= (const mtSpToDOp& X); - template inline Mat& operator+=(const mtSpToDOp& X); - template inline Mat& operator-=(const mtSpToDOp& X); - template inline Mat& operator*=(const mtSpToDOp& X); - template inline Mat& operator%=(const mtSpToDOp& X); - template inline Mat& operator/=(const mtSpToDOp& X); + template inline explicit Mat(const mtSpReductionOp& X); + template inline Mat& operator= (const mtSpReductionOp& X); + template inline Mat& operator+=(const mtSpReductionOp& X); + template inline Mat& operator-=(const mtSpReductionOp& X); + template inline Mat& operator*=(const mtSpReductionOp& X); + template inline Mat& operator%=(const mtSpReductionOp& X); + template inline Mat& operator/=(const mtSpReductionOp& X); template inline Mat(const Glue& X); template inline Mat& operator= (const Glue& X); @@ -839,7 +838,6 @@ class Mat::fixed : public Mat static constexpr bool is_col = (fixed_n_cols == 1); static constexpr bool is_row = (fixed_n_rows == 1); static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; static const uword n_rows; // value provided below the class definition static const uword n_cols; // value provided below the class definition diff --git a/include/armadillo_bits/Mat_meat.hpp b/include/armadillo_bits/Mat_meat.hpp index 5bd890df..af00497d 100644 --- a/include/armadillo_bits/Mat_meat.hpp +++ b/include/armadillo_bits/Mat_meat.hpp @@ -5658,7 +5658,7 @@ Mat::operator/=(const SpToDOp& X) template template inline -Mat::Mat(const mtSpToDOp& X) +Mat::Mat(const mtSpReductionOp& X) : n_rows(0) , n_cols(0) , n_elem(0) @@ -5678,7 +5678,7 @@ template template inline Mat& -Mat::operator=(const mtSpToDOp& X) +Mat::operator=(const mtSpReductionOp& X) { arma_debug_sigprint(); @@ -5693,7 +5693,7 @@ template template inline Mat& -Mat::operator+=(const mtSpToDOp& X) +Mat::operator+=(const mtSpReductionOp& X) { arma_debug_sigprint(); @@ -5708,7 +5708,7 @@ template template inline Mat& -Mat::operator-=(const mtSpToDOp& X) +Mat::operator-=(const mtSpReductionOp& X) { arma_debug_sigprint(); @@ -5723,7 +5723,7 @@ template template inline Mat& -Mat::operator*=(const mtSpToDOp& X) +Mat::operator*=(const mtSpReductionOp& X) { arma_debug_sigprint(); @@ -5738,7 +5738,7 @@ template template inline Mat& -Mat::operator%=(const mtSpToDOp& X) +Mat::operator%=(const mtSpReductionOp& X) { arma_debug_sigprint(); @@ -5753,7 +5753,7 @@ template template inline Mat& -Mat::operator/=(const mtSpToDOp& X) +Mat::operator/=(const mtSpReductionOp& X) { arma_debug_sigprint(); diff --git a/include/armadillo_bits/Op_bones.hpp b/include/armadillo_bits/Op_bones.hpp index fc2e4b8d..fa8c3efd 100644 --- a/include/armadillo_bits/Op_bones.hpp +++ b/include/armadillo_bits/Op_bones.hpp @@ -31,7 +31,6 @@ struct Op_traits static constexpr bool is_row = op_type::template traits::is_row; static constexpr bool is_col = op_type::template traits::is_col; static constexpr bool is_xvec = op_type::template traits::is_xvec; - static constexpr bool is_d2sp = op_type::template traits::is_d2sp; }; template @@ -40,7 +39,6 @@ struct Op_traits static constexpr bool is_row = false; static constexpr bool is_col = false; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; }; diff --git a/include/armadillo_bits/Proxy.hpp b/include/armadillo_bits/Proxy.hpp index 64b9cbb9..ffa3de21 100644 --- a/include/armadillo_bits/Proxy.hpp +++ b/include/armadillo_bits/Proxy.hpp @@ -35,7 +35,6 @@ // is_row = boolean to indicate Q object can be treated a row vector // is_col = boolean to indicate Q object can be treated a column vector // is_xvec = boolean to indicate Q object is a vector with unknown orientation -// is_d2sp = boolean to indicate Q object can be implicitly converted from dense to sparse (for backwards compatibility) // // Q = object that can be unwrapped via the unwrap family of classes (ie. Q must be convertible to Mat) // @@ -83,7 +82,6 @@ struct Proxy_fixed static constexpr bool is_row = T1::is_row; static constexpr bool is_col = T1::is_col; static constexpr bool is_xvec = T1::is_xvec; - static constexpr bool is_d2sp = false; arma_aligned const T1& Q; @@ -169,7 +167,6 @@ struct Proxy< Mat > static constexpr bool is_row = false; static constexpr bool is_col = false; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; arma_aligned const Mat& Q; @@ -217,7 +214,6 @@ struct Proxy< Col > static constexpr bool is_row = false; static constexpr bool is_col = true; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; arma_aligned const Col& Q; @@ -265,7 +261,6 @@ struct Proxy< Row > static constexpr bool is_row = true; static constexpr bool is_col = false; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; arma_aligned const Row& Q; @@ -313,7 +308,6 @@ struct Proxy< Gen > static constexpr bool is_row = Gen::is_row; static constexpr bool is_col = Gen::is_col; static constexpr bool is_xvec = Gen::is_xvec; - static constexpr bool is_d2sp = false; arma_aligned const Gen& Q; @@ -361,7 +355,6 @@ struct Proxy< eOp > static constexpr bool is_row = eOp::is_row; static constexpr bool is_col = eOp::is_col; static constexpr bool is_xvec = eOp::is_xvec; - static constexpr bool is_d2sp = eOp::is_d2sp; arma_aligned const eOp& Q; @@ -409,7 +402,6 @@ struct Proxy< eGlue > static constexpr bool is_row = eGlue::is_row; static constexpr bool is_col = eGlue::is_col; static constexpr bool is_xvec = eGlue::is_xvec; - static constexpr bool is_d2sp = eGlue::is_d2sp; arma_aligned const eGlue& Q; @@ -457,7 +449,6 @@ struct Proxy< Op > static constexpr bool is_row = Op::is_row; static constexpr bool is_col = Op::is_col; static constexpr bool is_xvec = Op::is_xvec; - static constexpr bool is_d2sp = Op::is_d2sp; arma_aligned const Mat Q; @@ -505,7 +496,6 @@ struct Proxy< Glue > static constexpr bool is_row = Glue::is_row; static constexpr bool is_col = Glue::is_col; static constexpr bool is_xvec = Glue::is_xvec; - static constexpr bool is_d2sp = false; arma_aligned const Mat Q; @@ -556,7 +546,6 @@ struct Proxy< Glue > static constexpr bool is_row = this_Glue_type::is_row; static constexpr bool is_col = this_Glue_type::is_col; static constexpr bool is_xvec = this_Glue_type::is_xvec; - static constexpr bool is_d2sp = false; arma_aligned const this_Glue_type& Q; arma_aligned const Proxy P1; @@ -615,7 +604,6 @@ struct Proxy< Glue > static constexpr bool is_row = this_Glue_type::is_row; static constexpr bool is_col = this_Glue_type::is_col; static constexpr bool is_xvec = this_Glue_type::is_xvec; - static constexpr bool is_d2sp = false; arma_aligned const this_Glue_type& Q; arma_aligned const Proxy P1; @@ -671,7 +659,6 @@ struct Proxy< mtOp > static constexpr bool is_row = mtOp::is_row; static constexpr bool is_col = mtOp::is_col; static constexpr bool is_xvec = mtOp::is_xvec; - static constexpr bool is_d2sp = false; arma_aligned const Mat Q; @@ -719,7 +706,6 @@ struct Proxy< mtGlue > static constexpr bool is_row = mtGlue::is_row; static constexpr bool is_col = mtGlue::is_col; static constexpr bool is_xvec = mtGlue::is_xvec; - static constexpr bool is_d2sp = false; arma_aligned const Mat Q; @@ -767,7 +753,6 @@ struct Proxy< CubeToMatOp > static constexpr bool is_row = CubeToMatOp::is_row; static constexpr bool is_col = CubeToMatOp::is_col; static constexpr bool is_xvec = CubeToMatOp::is_xvec; - static constexpr bool is_d2sp = false; arma_aligned const Mat Q; @@ -815,7 +800,6 @@ struct Proxy< CubeToMatOp > static constexpr bool is_row = false; static constexpr bool is_col = true; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; arma_aligned const unwrap_cube U; arma_aligned const Mat Q; @@ -865,7 +849,6 @@ struct Proxy< SpToDOp > static constexpr bool is_row = SpToDOp::is_row; static constexpr bool is_col = SpToDOp::is_col; static constexpr bool is_xvec = SpToDOp::is_xvec; - static constexpr bool is_d2sp = SpToDOp::is_d2sp; arma_aligned const Mat Q; @@ -913,7 +896,6 @@ struct Proxy< SpToDOp, op_sp_nonzeros> > static constexpr bool is_row = false; static constexpr bool is_col = true; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; arma_aligned const SpMat& R; arma_aligned const Mat Q; @@ -947,54 +929,6 @@ struct Proxy< SpToDOp, op_sp_nonzeros> > -template -struct Proxy< mtSpToDOp > - { - typedef out_eT elem_type; - typedef typename get_pod_type::result pod_type; - typedef Mat stored_type; - typedef const elem_type* ea_type; - typedef const Mat& aligned_ea_type; - - static constexpr bool use_at = false; - static constexpr bool use_mp = false; - static constexpr bool has_subview = false; - - static constexpr bool is_row = mtSpToDOp::is_row; - static constexpr bool is_col = mtSpToDOp::is_col; - static constexpr bool is_xvec = mtSpToDOp::is_xvec; - static constexpr bool is_d2sp = mtSpToDOp::is_d2sp; - - arma_aligned const Mat Q; - - inline explicit Proxy(const mtSpToDOp& A) - : Q(A) - { - arma_debug_sigprint(); - } - - arma_inline uword get_n_rows() const { return is_row ? 1 : Q.n_rows; } - arma_inline uword get_n_cols() const { return is_col ? 1 : Q.n_cols; } - arma_inline uword get_n_elem() const { return Q.n_elem; } - - arma_inline elem_type operator[] (const uword i) const { return Q[i]; } - arma_inline elem_type at (const uword r, const uword c) const { return Q.at(r, c); } - arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); } - - arma_inline ea_type get_ea() const { return Q.memptr(); } - arma_inline aligned_ea_type get_aligned_ea() const { return Q; } - - template - constexpr bool is_alias(const Mat&) const { return false; } - - template - constexpr bool has_overlap(const subview&) const { return false; } - - arma_inline bool is_aligned() const { return memory::is_aligned(Q.memptr()); } - }; - - - template struct Proxy< SpToDGlue > { @@ -1011,7 +945,6 @@ struct Proxy< SpToDGlue > static constexpr bool is_row = SpToDGlue::is_row; static constexpr bool is_col = SpToDGlue::is_col; static constexpr bool is_xvec = SpToDGlue::is_xvec; - static constexpr bool is_d2sp = false; arma_aligned const Mat Q; @@ -1059,7 +992,6 @@ struct Proxy< subview > static constexpr bool is_row = false; static constexpr bool is_col = false; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; arma_aligned const subview& Q; @@ -1107,7 +1039,6 @@ struct Proxy< subview_col > static constexpr bool is_row = false; static constexpr bool is_col = true; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; arma_aligned const subview_col& Q; @@ -1155,7 +1086,6 @@ struct Proxy< subview_cols > static constexpr bool is_row = false; static constexpr bool is_col = false; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; arma_aligned const subview_cols& sv; arma_aligned const Mat Q; @@ -1205,7 +1135,6 @@ struct Proxy< subview_row > static constexpr bool is_row = true; static constexpr bool is_col = false; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; arma_aligned const subview_row& Q; @@ -1253,7 +1182,6 @@ struct Proxy< subview_elem1 > static constexpr bool is_row = false; static constexpr bool is_col = true; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; arma_aligned const subview_elem1& Q; arma_aligned const Proxy R; @@ -1308,7 +1236,6 @@ struct Proxy< subview_elem2 > static constexpr bool is_row = false; static constexpr bool is_col = false; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; arma_aligned const Mat Q; @@ -1356,7 +1283,6 @@ struct Proxy< diagview > static constexpr bool is_row = false; static constexpr bool is_col = true; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; arma_aligned const diagview& Q; @@ -1412,7 +1338,6 @@ struct Proxy_diagvec_mat< Op > static constexpr bool is_row = false; static constexpr bool is_col = true; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; arma_aligned const Mat& R; arma_aligned const diagview Q; @@ -1469,7 +1394,6 @@ struct Proxy_diagvec_expr< Op > static constexpr bool is_row = false; static constexpr bool is_col = true; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; arma_aligned const Mat Q; @@ -1543,7 +1467,6 @@ struct Proxy< Op > static constexpr bool is_row = false; static constexpr bool is_col = true; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; arma_aligned const Mat Q; @@ -1599,7 +1522,6 @@ struct Proxy_xtrans_default< Op > static constexpr bool is_row = false; static constexpr bool is_col = false; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = T1::is_d2sp; const unwrap U; const xtrans_mat Q; @@ -1641,7 +1563,6 @@ struct Proxy_xtrans_default< Op > static constexpr bool is_row = false; static constexpr bool is_col = false; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = T1::is_d2sp; const unwrap U; const xtrans_mat Q; @@ -1692,7 +1613,6 @@ struct Proxy_xtrans_vector< Op > static constexpr bool is_row = Op::is_row; static constexpr bool is_col = Op::is_col; static constexpr bool is_xvec = Op::is_xvec; - static constexpr bool is_d2sp = Op::is_d2sp; arma_aligned const quasi_unwrap U; // avoid copy if T1 is a Row, Col or subview_col arma_aligned const Mat Q; @@ -1735,7 +1655,6 @@ struct Proxy_xtrans_vector< Op > static constexpr bool is_row = Op::is_row; static constexpr bool is_col = Op::is_col; static constexpr bool is_xvec = Op::is_xvec; - static constexpr bool is_d2sp = Op::is_d2sp; arma_aligned const quasi_unwrap U; // avoid copy if T1 is a Row, Col or subview_col arma_aligned const Mat Q; @@ -1803,7 +1722,6 @@ struct Proxy< Op > static constexpr bool is_row = Proxy_xtrans::is_row; static constexpr bool is_col = Proxy_xtrans::is_col; static constexpr bool is_xvec = Proxy_xtrans::is_xvec; - static constexpr bool is_d2sp = Proxy_xtrans::is_d2sp; using Proxy_xtrans::Q; @@ -1866,7 +1784,6 @@ struct Proxy< Op > static constexpr bool is_row = Proxy_xtrans::is_row; static constexpr bool is_col = Proxy_xtrans::is_col; static constexpr bool is_xvec = Proxy_xtrans::is_xvec; - static constexpr bool is_d2sp = Proxy_xtrans::is_d2sp; using Proxy_xtrans::Q; @@ -1914,7 +1831,6 @@ struct Proxy_subview_row_htrans_cx static constexpr bool is_row = false; static constexpr bool is_col = true; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; arma_aligned const subview_row_htrans Q; @@ -1949,7 +1865,6 @@ struct Proxy_subview_row_htrans_non_cx static constexpr bool is_row = false; static constexpr bool is_col = true; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; arma_aligned const subview_row_strans Q; @@ -2010,7 +1925,6 @@ struct Proxy< Op, op_htrans> > static constexpr bool is_row = false; static constexpr bool is_col = true; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; using Proxy_sv_row_ht::Q; @@ -2058,7 +1972,6 @@ struct Proxy< Op, op_strans> > static constexpr bool is_row = false; static constexpr bool is_col = true; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; arma_aligned const subview_row_strans Q; @@ -2108,7 +2021,6 @@ struct Proxy< Op< Row< std::complex >, op_htrans> > static constexpr bool is_row = false; static constexpr bool is_col = true; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; const xvec_htrans Q; const Row& src; @@ -2160,7 +2072,6 @@ struct Proxy< Op< Col< std::complex >, op_htrans> > static constexpr bool is_row = true; static constexpr bool is_col = false; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; const xvec_htrans Q; const Col& src; @@ -2212,7 +2123,6 @@ struct Proxy< Op< subview_col< std::complex >, op_htrans> > static constexpr bool is_row = true; static constexpr bool is_col = false; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; const xvec_htrans Q; const subview_col& src; @@ -2263,7 +2173,6 @@ struct Proxy< Op > static constexpr bool is_row = eOp< Op, eop_scalar_times>::is_row; static constexpr bool is_col = eOp< Op, eop_scalar_times>::is_col; static constexpr bool is_xvec = eOp< Op, eop_scalar_times>::is_xvec; - static constexpr bool is_d2sp = eOp< Op, eop_scalar_times>::is_d2sp; arma_aligned const Op R; arma_aligned const eOp< Op, eop_scalar_times > Q; @@ -2313,7 +2222,6 @@ struct Proxy< subview_row_strans > static constexpr bool is_row = false; static constexpr bool is_col = true; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; arma_aligned const subview_row_strans& Q; @@ -2361,7 +2269,6 @@ struct Proxy< subview_row_htrans > static constexpr bool is_row = false; static constexpr bool is_col = true; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; arma_aligned const subview_row_htrans& Q; @@ -2409,7 +2316,6 @@ struct Proxy< xtrans_mat > static constexpr bool is_row = false; static constexpr bool is_col = false; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; arma_aligned const Mat Q; @@ -2457,7 +2363,6 @@ struct Proxy< xvec_htrans > static constexpr bool is_row = false; static constexpr bool is_col = false; static constexpr bool is_xvec = true; - static constexpr bool is_d2sp = false; arma_aligned const Mat Q; @@ -2513,7 +2418,6 @@ struct Proxy_vectorise_col_mat< Op > static constexpr bool is_row = false; static constexpr bool is_col = true; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; arma_aligned const unwrap U; arma_aligned const Mat Q; @@ -2571,7 +2475,6 @@ struct Proxy_vectorise_col_expr< Op > static constexpr bool is_row = false; static constexpr bool is_col = true; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; arma_aligned const Op& Q; arma_aligned const Proxy R; diff --git a/include/armadillo_bits/Row_bones.hpp b/include/armadillo_bits/Row_bones.hpp index 168684b2..96dff225 100644 --- a/include/armadillo_bits/Row_bones.hpp +++ b/include/armadillo_bits/Row_bones.hpp @@ -32,7 +32,6 @@ class Row : public Mat static constexpr bool is_col = false; static constexpr bool is_row = true; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; inline Row(); inline Row(const Row& X); @@ -203,7 +202,6 @@ class Row::fixed : public Row static constexpr bool is_col = false; static constexpr bool is_row = true; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; static const uword n_rows; // value provided below the class definition static const uword n_cols; // value provided below the class definition diff --git a/include/armadillo_bits/SpCol_bones.hpp b/include/armadillo_bits/SpCol_bones.hpp index 9215ee5b..a70112d6 100644 --- a/include/armadillo_bits/SpCol_bones.hpp +++ b/include/armadillo_bits/SpCol_bones.hpp @@ -32,7 +32,6 @@ class SpCol : public SpMat static constexpr bool is_row = false; static constexpr bool is_col = true; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; inline SpCol(); @@ -50,9 +49,7 @@ class SpCol : public SpMat inline SpCol(const Col& X); // for backwards compatibility - // template inline SpCol(const Base& X); - template inline explicit SpCol(const Base& X, typename enable_if< T1::is_d2sp == false >::result* junk = nullptr); - template inline SpCol(const Base& X, typename enable_if< T1::is_d2sp == true >::result* junk = nullptr); // for backwards compatibility + template inline SpCol(const Base& X); template inline SpCol& operator=(const Base& X); template inline SpCol(const SpBase& X); diff --git a/include/armadillo_bits/SpCol_meat.hpp b/include/armadillo_bits/SpCol_meat.hpp index 3f0b02c6..f43d8a3c 100644 --- a/include/armadillo_bits/SpCol_meat.hpp +++ b/include/armadillo_bits/SpCol_meat.hpp @@ -129,43 +129,13 @@ SpCol::operator=(const eT val) -// template -// template -// inline -// SpCol::SpCol(const Base& X) -// : SpMat(arma_vec_indicator(), 1) -// { -// arma_debug_sigprint(); -// -// SpMat::operator=(X.get_ref()); -// } - - - -// marked as explicit template template inline -SpCol::SpCol(const Base& X, typename enable_if< T1::is_d2sp == false >::result* junk) +SpCol::SpCol(const Base& X) : SpMat(arma_vec_indicator(), 1) { arma_debug_sigprint(); - arma_ignore(junk); - - SpMat::operator=(X.get_ref()); - } - - - -// not marked as explicit -template -template -inline -SpCol::SpCol(const Base& X, typename enable_if< T1::is_d2sp == true >::result* junk) - : SpMat(arma_vec_indicator(), 1) - { - arma_debug_sigprint(); - arma_ignore(junk); SpMat::operator=(X.get_ref()); } diff --git a/include/armadillo_bits/SpGlue_bones.hpp b/include/armadillo_bits/SpGlue_bones.hpp index 9743d646..3c5432d8 100644 --- a/include/armadillo_bits/SpGlue_bones.hpp +++ b/include/armadillo_bits/SpGlue_bones.hpp @@ -32,7 +32,6 @@ class SpGlue : public SpBase< typename T1::elem_type, SpGlue::is_row; static constexpr bool is_col = spglue_type::template traits::is_col; static constexpr bool is_xvec = spglue_type::template traits::is_xvec; - static constexpr bool is_d2sp = false; inline SpGlue(const T1& in_A, const T2& in_B); inline SpGlue(const T1& in_A, const T2& in_B, const elem_type in_aux); diff --git a/include/armadillo_bits/SpMat_bones.hpp b/include/armadillo_bits/SpMat_bones.hpp index b0246c40..2d64a3bb 100644 --- a/include/armadillo_bits/SpMat_bones.hpp +++ b/include/armadillo_bits/SpMat_bones.hpp @@ -32,7 +32,6 @@ class SpMat : public SpBase< eT, SpMat > static constexpr bool is_row = false; static constexpr bool is_col = false; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; const uword n_rows; //!< number of rows (read-only) const uword n_cols; //!< number of columns (read-only) @@ -125,8 +124,7 @@ class SpMat : public SpBase< eT, SpMat > inline SpMat& operator%=(const SpMat& m); inline SpMat& operator/=(const SpMat& m); - template inline explicit SpMat(const Base& m, typename enable_if< T1::is_d2sp == false >::result* junk = nullptr); - template inline SpMat(const Base& m, typename enable_if< T1::is_d2sp == true >::result* junk = nullptr); // for backwards compatibility + template inline explicit SpMat(const Base& m); template inline SpMat& operator= (const Base& m); template inline SpMat& operator+=(const Base& m); template inline SpMat& operator-=(const Base& m); @@ -170,7 +168,6 @@ class SpMat : public SpBase< eT, SpMat > inline SpMat& operator%=(const spdiagview& X); inline SpMat& operator/=(const spdiagview& X); - // delayed unary ops template inline SpMat(const SpOp& X); template inline SpMat& operator= (const SpOp& X); template inline SpMat& operator+=(const SpOp& X); @@ -179,7 +176,6 @@ class SpMat : public SpBase< eT, SpMat > template inline SpMat& operator%=(const SpOp& X); template inline SpMat& operator/=(const SpOp& X); - // delayed binary ops template inline SpMat(const SpGlue& X); template inline SpMat& operator= (const SpGlue& X); template inline SpMat& operator+=(const SpGlue& X); @@ -188,7 +184,6 @@ class SpMat : public SpBase< eT, SpMat > template inline SpMat& operator%=(const SpGlue& X); template inline SpMat& operator/=(const SpGlue& X); - // delayed mixed-type unary ops template inline SpMat(const mtSpOp& X); template inline SpMat& operator= (const mtSpOp& X); template inline SpMat& operator+=(const mtSpOp& X); @@ -197,7 +192,6 @@ class SpMat : public SpBase< eT, SpMat > template inline SpMat& operator%=(const mtSpOp& X); template inline SpMat& operator/=(const mtSpOp& X); - // delayed mixed-type binary ops template inline SpMat(const mtSpGlue& X); template inline SpMat& operator= (const mtSpGlue& X); template inline SpMat& operator+=(const mtSpGlue& X); @@ -206,6 +200,14 @@ class SpMat : public SpBase< eT, SpMat > template inline SpMat& operator%=(const mtSpGlue& X); template inline SpMat& operator/=(const mtSpGlue& X); + template inline SpMat(const mtSpReductionOp& X); + template inline SpMat& operator= (const mtSpReductionOp& X); + template inline SpMat& operator+=(const mtSpReductionOp& X); + template inline SpMat& operator-=(const mtSpReductionOp& X); + template inline SpMat& operator*=(const mtSpReductionOp& X); + template inline SpMat& operator%=(const mtSpReductionOp& X); + template inline SpMat& operator/=(const mtSpReductionOp& X); + arma_inline SpSubview_row row(const uword row_num); arma_inline const SpSubview_row row(const uword row_num) const; diff --git a/include/armadillo_bits/SpMat_meat.hpp b/include/armadillo_bits/SpMat_meat.hpp index 1d782744..b869ea89 100644 --- a/include/armadillo_bits/SpMat_meat.hpp +++ b/include/armadillo_bits/SpMat_meat.hpp @@ -883,11 +883,10 @@ SpMat::SpMat -// marked as explicit template template inline -SpMat::SpMat(const Base& x, typename enable_if< T1::is_d2sp == false >::result* junk) +SpMat::SpMat(const Base& x) : n_rows(0) , n_cols(0) , n_elem(0) @@ -898,29 +897,6 @@ SpMat::SpMat(const Base& x, typename enable_if< T1::is_d2sp == false , col_ptrs(nullptr) { arma_debug_sigprint_this(this); - arma_ignore(junk); - - (*this).operator=(x); - } - - - -// not marked as explicit -template -template -inline -SpMat::SpMat(const Base& x, typename enable_if< T1::is_d2sp == true >::result* junk) - : n_rows(0) - , n_cols(0) - , n_elem(0) - , n_nonzero(0) - , vec_state(0) - , values(nullptr) - , row_indices(nullptr) - , col_ptrs(nullptr) - { - arma_debug_sigprint_this(this); - arma_ignore(junk); (*this).operator=(x); } @@ -2212,6 +2188,118 @@ SpMat::operator/=(const mtSpGlue& X) +template +template +inline +SpMat::SpMat(const mtSpReductionOp& X) + : n_rows(0) + , n_cols(0) + , n_elem(0) + , n_nonzero(0) + , vec_state(0) + , values(nullptr) + , row_indices(nullptr) + , col_ptrs(nullptr) + { + arma_debug_sigprint_this(this); + + const Mat tmp(X); + + (*this).operator=(tmp); + } + + + +template +template +inline +SpMat& +SpMat::operator=(const mtSpReductionOp& X) + { + arma_debug_sigprint(); + + const Mat tmp(X); + + return (*this).operator=(tmp); + } + + + +template +template +inline +SpMat& +SpMat::operator+=(const mtSpReductionOp& X) + { + arma_debug_sigprint(); + + const Mat tmp(X); + + return (*this).operator+=(tmp); + } + + + +template +template +inline +SpMat& +SpMat::operator-=(const mtSpReductionOp& X) + { + arma_debug_sigprint(); + + const Mat tmp(X); + + return (*this).operator-=(tmp); + } + + + +template +template +inline +SpMat& +SpMat::operator*=(const mtSpReductionOp& X) + { + arma_debug_sigprint(); + + const Mat tmp(X); + + return (*this).operator*=(tmp); + } + + + +template +template +inline +SpMat& +SpMat::operator%=(const mtSpReductionOp& X) + { + arma_debug_sigprint(); + + const Mat tmp(X); + + return (*this).operator%=(tmp); + } + + + +template +template +inline +SpMat& +SpMat::operator/=(const mtSpReductionOp& X) + { + arma_debug_sigprint(); + + const Mat tmp(X); + + return (*this).operator/=(tmp); + } + + + template arma_inline SpSubview_row diff --git a/include/armadillo_bits/SpOp_bones.hpp b/include/armadillo_bits/SpOp_bones.hpp index ff8dc9e9..af8a229b 100644 --- a/include/armadillo_bits/SpOp_bones.hpp +++ b/include/armadillo_bits/SpOp_bones.hpp @@ -32,7 +32,6 @@ class SpOp : public SpBase< typename T1::elem_type, SpOp > static constexpr bool is_row = op_type::template traits::is_row; static constexpr bool is_col = op_type::template traits::is_col; static constexpr bool is_xvec = op_type::template traits::is_xvec; - static constexpr bool is_d2sp = false; inline explicit SpOp(const T1& in_m); inline SpOp(const T1& in_m, const elem_type in_aux); diff --git a/include/armadillo_bits/SpProxy.hpp b/include/armadillo_bits/SpProxy.hpp index 965e5e9d..df2a3cd8 100644 --- a/include/armadillo_bits/SpProxy.hpp +++ b/include/armadillo_bits/SpProxy.hpp @@ -81,7 +81,6 @@ struct SpProxy< SpMat > static constexpr bool is_row = false; static constexpr bool is_col = false; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; arma_aligned const SpMat& Q; @@ -134,7 +133,6 @@ struct SpProxy< SpCol > static constexpr bool is_row = false; static constexpr bool is_col = true; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; arma_aligned const SpCol& Q; @@ -187,7 +185,6 @@ struct SpProxy< SpRow > static constexpr bool is_row = true; static constexpr bool is_col = false; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; arma_aligned const SpRow& Q; @@ -240,7 +237,6 @@ struct SpProxy< SpSubview > static constexpr bool is_row = false; static constexpr bool is_col = false; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; arma_aligned const SpSubview& Q; @@ -293,7 +289,6 @@ struct SpProxy< SpSubview_col > static constexpr bool is_row = false; static constexpr bool is_col = true; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; arma_aligned const SpSubview_col& Q; @@ -346,7 +341,6 @@ struct SpProxy< SpSubview_col_list > static constexpr bool is_row = false; static constexpr bool is_col = false; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; arma_aligned const SpMat Q; @@ -398,7 +392,6 @@ struct SpProxy< SpSubview_row > static constexpr bool is_row = true; static constexpr bool is_col = false; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; arma_aligned const SpSubview_row& Q; @@ -451,7 +444,6 @@ struct SpProxy< spdiagview > static constexpr bool is_row = false; static constexpr bool is_col = true; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; arma_aligned const SpMat Q; @@ -504,7 +496,6 @@ struct SpProxy< SpOp > static constexpr bool is_row = SpOp::is_row; static constexpr bool is_col = SpOp::is_col; static constexpr bool is_xvec = SpOp::is_xvec; - static constexpr bool is_d2sp = false; arma_aligned const SpMat Q; @@ -557,7 +548,6 @@ struct SpProxy< SpGlue > static constexpr bool is_row = SpGlue::is_row; static constexpr bool is_col = SpGlue::is_col; static constexpr bool is_xvec = SpGlue::is_xvec; - static constexpr bool is_d2sp = false; arma_aligned const SpMat Q; @@ -609,7 +599,6 @@ struct SpProxy< mtSpOp > static constexpr bool is_row = mtSpOp::is_row; static constexpr bool is_col = mtSpOp::is_col; static constexpr bool is_xvec = mtSpOp::is_xvec; - static constexpr bool is_d2sp = false; arma_aligned const SpMat Q; @@ -661,7 +650,6 @@ struct SpProxy< mtSpGlue > static constexpr bool is_row = mtSpGlue::is_row; static constexpr bool is_col = mtSpGlue::is_col; static constexpr bool is_xvec = mtSpGlue::is_xvec; - static constexpr bool is_d2sp = false; arma_aligned const SpMat Q; @@ -697,4 +685,55 @@ struct SpProxy< mtSpGlue > +template +struct SpProxy< mtSpReductionOp > + { + typedef out_eT elem_type; + typedef typename get_pod_type::result pod_type; + typedef SpMat stored_type; + + typedef typename SpMat::const_iterator const_iterator_type; + typedef typename SpMat::const_row_iterator const_row_iterator_type; + + static constexpr bool use_iterator = false; + static constexpr bool Q_is_generated = true; + + static constexpr bool is_row = mtSpReductionOp::is_row; + static constexpr bool is_col = mtSpReductionOp::is_col; + static constexpr bool is_xvec = mtSpReductionOp::is_xvec; + + arma_aligned const SpMat Q; + + inline explicit SpProxy(const mtSpReductionOp& A) + : Q(A) + { + arma_debug_sigprint(); + } + + arma_inline uword get_n_rows() const { return is_row ? 1 : Q.n_rows; } + arma_inline uword get_n_cols() const { return is_col ? 1 : Q.n_cols; } + arma_inline uword get_n_elem() const { return Q.n_elem; } + arma_inline uword get_n_nonzero() const { return Q.n_nonzero; } + + arma_inline elem_type operator[](const uword i) const { return Q[i]; } + arma_inline elem_type at (const uword row, const uword col) const { return Q.at(row, col); } + + arma_inline const out_eT* get_values() const { return Q.values; } + arma_inline const uword* get_row_indices() const { return Q.row_indices; } + arma_inline const uword* get_col_ptrs() const { return Q.col_ptrs; } + + arma_inline const_iterator_type begin() const { return Q.begin(); } + arma_inline const_iterator_type begin_col(const uword col_num) const { return Q.begin_col(col_num); } + arma_inline const_row_iterator_type begin_row(const uword row_num = 0) const { return Q.begin_row(row_num); } + + arma_inline const_iterator_type end() const { return Q.end(); } + arma_inline const_row_iterator_type end_row() const { return Q.end_row(); } + arma_inline const_row_iterator_type end_row(const uword row_num) const { return Q.end_row(row_num); } + + template + constexpr bool is_alias(const SpMat&) const { return false; } + }; + + + //! @} diff --git a/include/armadillo_bits/SpReductionOp_bones.hpp b/include/armadillo_bits/SpReductionOp_bones.hpp deleted file mode 100644 index 1e16b2a3..00000000 --- a/include/armadillo_bits/SpReductionOp_bones.hpp +++ /dev/null @@ -1,49 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// -// Copyright 2008-2016 Conrad Sanderson (http://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 -// http://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 SpReductionOp -//! @{ - - - -template -class SpReductionOp : public SpBase< typename T1::elem_type, SpReductionOp > - { - public: - - typedef typename T1::elem_type elem_type; - typedef typename get_pod_type::result pod_type; - - static constexpr bool is_row = op_type::template traits::is_row; - static constexpr bool is_col = op_type::template traits::is_col; - static constexpr bool is_xvec = op_type::template traits::is_xvec; - - inline explicit SpReductionOp(const T1& in_m); - inline SpReductionOp(const T1& in_m, const elem_type in_aux); - inline SpReductionOp(const T1& in_m, const uword in_aux_uword_a, const uword in_aux_uword_b); - inline ~SpReductionOp(); - - arma_aligned const T1& m; //!< the operand; must be derived from SpBase - arma_aligned elem_type aux; //!< auxiliary data, using the element type as used by T1 - arma_aligned uword aux_uword_a; //!< auxiliary data, uword format - arma_aligned uword aux_uword_b; //!< auxiliary data, uword format - }; - - - -//! @} diff --git a/include/armadillo_bits/SpReductionOp_meat.hpp b/include/armadillo_bits/SpReductionOp_meat.hpp deleted file mode 100644 index f91b9897..00000000 --- a/include/armadillo_bits/SpReductionOp_meat.hpp +++ /dev/null @@ -1,66 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// -// Copyright 2008-2016 Conrad Sanderson (http://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 -// http://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 SpReductionOp -//! @{ - - - -template -inline -SpReductionOp::SpReductionOp(const T1& in_m) - : m(in_m) - { - arma_debug_sigprint(); - } - - - -template -inline -SpReductionOp::SpReductionOp(const T1& in_m, const typename T1::elem_type in_aux) - : m(in_m) - , aux(in_aux) - { - arma_debug_sigprint(); - } - - - -template -inline -SpReductionOp::SpReductionOp(const T1& in_m, const uword in_aux_uword_a, const uword in_aux_uword_b) - : m(in_m) - , aux_uword_a(in_aux_uword_a) - , aux_uword_b(in_aux_uword_b) - { - arma_debug_sigprint(); - } - - - -template -inline -SpReductionOp::~SpReductionOp() - { - arma_debug_sigprint(); - } - - - -//! @} diff --git a/include/armadillo_bits/SpRow_bones.hpp b/include/armadillo_bits/SpRow_bones.hpp index c97bff66..b976b578 100644 --- a/include/armadillo_bits/SpRow_bones.hpp +++ b/include/armadillo_bits/SpRow_bones.hpp @@ -25,14 +25,13 @@ template class SpRow : public SpMat { public: - + typedef eT elem_type; typedef typename get_pod_type::result pod_type; static constexpr bool is_row = true; static constexpr bool is_col = false; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; inline SpRow(); @@ -50,9 +49,7 @@ class SpRow : public SpMat inline SpRow(const Row& X); // for backwards compatibility - // template inline SpRow(const Base& X); - template inline explicit SpRow(const Base& X, typename enable_if< T1::is_d2sp == false >::result* junk = nullptr); - template inline SpRow(const Base& X, typename enable_if< T1::is_d2sp == true >::result* junk = nullptr); // for backwards compatibility + template inline SpRow(const Base& X); template inline SpRow& operator=(const Base& X); template inline SpRow(const SpBase& X); diff --git a/include/armadillo_bits/SpRow_meat.hpp b/include/armadillo_bits/SpRow_meat.hpp index 07c5d68e..596b016d 100644 --- a/include/armadillo_bits/SpRow_meat.hpp +++ b/include/armadillo_bits/SpRow_meat.hpp @@ -129,49 +129,19 @@ SpRow::operator=(const eT val) -// template -// template -// inline -// SpRow::SpRow(const Base& X) -// : SpMat(arma_vec_indicator(), 2) -// { -// arma_debug_sigprint(); -// -// SpMat::operator=(X.get_ref()); -// } - - - - -// marked as explicit template template inline -SpRow::SpRow(const Base& X, typename enable_if< T1::is_d2sp == false >::result* junk) +SpRow::SpRow(const Base& X) : SpMat(arma_vec_indicator(), 2) { arma_debug_sigprint(); - arma_ignore(junk); SpMat::operator=(X.get_ref()); } -// not marked as explicit -template -template -inline -SpRow::SpRow(const Base& X, typename enable_if< T1::is_d2sp == true >::result* junk) - : SpMat(arma_vec_indicator(), 2) - { - arma_debug_sigprint(); - arma_ignore(junk); - - SpMat::operator=(X.get_ref()); - } - - template inline diff --git a/include/armadillo_bits/SpSubview_bones.hpp b/include/armadillo_bits/SpSubview_bones.hpp index 896d6d27..6be50b3a 100644 --- a/include/armadillo_bits/SpSubview_bones.hpp +++ b/include/armadillo_bits/SpSubview_bones.hpp @@ -33,7 +33,6 @@ class SpSubview : public SpBase< eT, SpSubview > static constexpr bool is_row = false; static constexpr bool is_col = false; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; const uword aux_row1; const uword aux_col1; @@ -351,7 +350,6 @@ class SpSubview_col : public SpSubview static constexpr bool is_row = false; static constexpr bool is_col = true; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; inline void operator= (const SpSubview& x); inline void operator= (const SpSubview_col& x); @@ -390,7 +388,6 @@ class SpSubview_row : public SpSubview static constexpr bool is_row = true; static constexpr bool is_col = false; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; inline void operator= (const SpSubview& x); inline void operator= (const SpSubview_row& x); diff --git a/include/armadillo_bits/SpSubview_col_list_bones.hpp b/include/armadillo_bits/SpSubview_col_list_bones.hpp index 295758e1..85012913 100644 --- a/include/armadillo_bits/SpSubview_col_list_bones.hpp +++ b/include/armadillo_bits/SpSubview_col_list_bones.hpp @@ -32,7 +32,6 @@ class SpSubview_col_list : public SpBase< eT, SpSubview_col_list > static constexpr bool is_row = false; static constexpr bool is_col = false; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; const SpMat& m; const quasi_unwrap U_ci; diff --git a/include/armadillo_bits/SpToDGlue_bones.hpp b/include/armadillo_bits/SpToDGlue_bones.hpp index dd1d5100..158dd6b8 100644 --- a/include/armadillo_bits/SpToDGlue_bones.hpp +++ b/include/armadillo_bits/SpToDGlue_bones.hpp @@ -32,7 +32,6 @@ class SpToDGlue : public Base< typename T1::elem_type, SpToDGlue::is_row; static constexpr bool is_col = glue_type::template traits::is_col; static constexpr bool is_xvec = glue_type::template traits::is_xvec; - static constexpr bool is_d2sp = false; inline explicit SpToDGlue(const T1& in_A, const T2& in_B); inline ~SpToDGlue(); diff --git a/include/armadillo_bits/SpToDOp_bones.hpp b/include/armadillo_bits/SpToDOp_bones.hpp index e1f3c147..4a49028b 100644 --- a/include/armadillo_bits/SpToDOp_bones.hpp +++ b/include/armadillo_bits/SpToDOp_bones.hpp @@ -32,7 +32,6 @@ class SpToDOp : public Base< typename T1::elem_type, SpToDOp > static constexpr bool is_row = op_type::template traits::is_row; static constexpr bool is_col = op_type::template traits::is_col; static constexpr bool is_xvec = op_type::template traits::is_xvec; - static constexpr bool is_d2sp = op_type::template traits::is_d2sp; inline explicit SpToDOp(const T1& in_m); inline SpToDOp(const T1& in_m, const elem_type in_aux); diff --git a/include/armadillo_bits/arma_forward.hpp b/include/armadillo_bits/arma_forward.hpp index b19affd3..7b02bb9d 100644 --- a/include/armadillo_bits/arma_forward.hpp +++ b/include/armadillo_bits/arma_forward.hpp @@ -156,7 +156,6 @@ struct traits_op_default static constexpr bool is_row = false; static constexpr bool is_col = false; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; }; }; @@ -169,7 +168,6 @@ struct traits_op_xvec static constexpr bool is_row = false; static constexpr bool is_col = false; static constexpr bool is_xvec = true; - static constexpr bool is_d2sp = false; }; }; @@ -182,7 +180,6 @@ struct traits_op_col static constexpr bool is_row = false; static constexpr bool is_col = true; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; }; }; @@ -195,7 +192,6 @@ struct traits_op_row static constexpr bool is_row = true; static constexpr bool is_col = false; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; }; }; @@ -208,7 +204,6 @@ struct traits_op_passthru static constexpr bool is_row = T1::is_row; static constexpr bool is_col = T1::is_col; static constexpr bool is_xvec = T1::is_xvec; - static constexpr bool is_d2sp = false; }; }; @@ -221,7 +216,6 @@ struct traits_glue_default static constexpr bool is_row = false; static constexpr bool is_col = false; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; }; }; @@ -234,7 +228,6 @@ struct traits_glue_or static constexpr bool is_row = (T1::is_row || T2::is_row ); static constexpr bool is_col = (T1::is_col || T2::is_col ); static constexpr bool is_xvec = (T1::is_xvec || T2::is_xvec); - static constexpr bool is_d2sp = false; }; }; @@ -251,7 +244,6 @@ template< typename T1, typename eop_type> class eOp; template< typename T1, typename op_type> class SpToDOp; template< typename T1, typename op_type> class CubeToMatOp; template class mtOp; -template class mtSpToDOp; template< typename T1, typename T2, typename glue_type> class Glue; template< typename T1, typename T2, typename eglue_type> class eGlue; @@ -334,9 +326,7 @@ struct state_type template< typename T1, typename spop_type> class SpOp; template class mtSpOp; - -template< typename T1, typename spop_type> class SpReductionOp; -template class mtSpReductionOp; +template class mtSpReductionOp; template< typename T1, typename T2, typename spglue_type> class SpGlue; template class mtSpGlue; diff --git a/include/armadillo_bits/diagview_bones.hpp b/include/armadillo_bits/diagview_bones.hpp index b2aa0cf6..5aa4bcee 100644 --- a/include/armadillo_bits/diagview_bones.hpp +++ b/include/armadillo_bits/diagview_bones.hpp @@ -34,7 +34,6 @@ class diagview : public Base< eT, diagview > static constexpr bool is_row = false; static constexpr bool is_col = true; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; const uword row_offset; const uword col_offset; diff --git a/include/armadillo_bits/eGlue_bones.hpp b/include/armadillo_bits/eGlue_bones.hpp index afac6756..097dc6cb 100644 --- a/include/armadillo_bits/eGlue_bones.hpp +++ b/include/armadillo_bits/eGlue_bones.hpp @@ -37,7 +37,6 @@ class eGlue : public Base< typename T1::elem_type, eGlue > static constexpr bool is_col = (Proxy::is_col || Proxy::is_col ); static constexpr bool is_row = (Proxy::is_row || Proxy::is_row ); static constexpr bool is_xvec = (Proxy::is_xvec || Proxy::is_xvec); - static constexpr bool is_d2sp = (Proxy::is_d2sp || Proxy::is_d2sp); arma_aligned const Proxy P1; arma_aligned const Proxy P2; diff --git a/include/armadillo_bits/eOp_bones.hpp b/include/armadillo_bits/eOp_bones.hpp index 0a5ec8fa..d32abddb 100644 --- a/include/armadillo_bits/eOp_bones.hpp +++ b/include/armadillo_bits/eOp_bones.hpp @@ -37,7 +37,6 @@ class eOp : public Base< typename T1::elem_type, eOp > static constexpr bool is_row = Proxy::is_row; static constexpr bool is_col = Proxy::is_col; static constexpr bool is_xvec = Proxy::is_xvec; - static constexpr bool is_d2sp = Proxy::is_d2sp; arma_aligned const Proxy P; diff --git a/include/armadillo_bits/fn_diagvec.hpp b/include/armadillo_bits/fn_diagvec.hpp index a96a8200..8fc2b6dc 100644 --- a/include/armadillo_bits/fn_diagvec.hpp +++ b/include/armadillo_bits/fn_diagvec.hpp @@ -51,12 +51,12 @@ diagvec(const Base& X, const sword diag_id) template arma_warn_unused arma_inline -const SpToDOp +const mtSpReductionOp diagvec(const SpBase& X, const sword diag_id = 0) { arma_debug_sigprint(); - return SpToDOp(X.get_ref(), ((diag_id < 0) ? -diag_id : diag_id), ((diag_id < 0) ? 1 : 0) ); + return mtSpReductionOp(X.get_ref(), ((diag_id < 0) ? -diag_id : diag_id), ((diag_id < 0) ? 1 : 0) ); } diff --git a/include/armadillo_bits/fn_max.hpp b/include/armadillo_bits/fn_max.hpp index a6f28752..a0d5a5ea 100644 --- a/include/armadillo_bits/fn_max.hpp +++ b/include/armadillo_bits/fn_max.hpp @@ -152,13 +152,13 @@ typename enable_if2 < is_arma_sparse_type::value && resolves_to_sparse_vector::no, - const SpToDOp + const mtSpReductionOp >::result max(const T1& X) { arma_debug_sigprint(); - return SpToDOp(X, 0, 0); + return mtSpReductionOp(X, 0, 0); } @@ -170,13 +170,13 @@ typename enable_if2 < is_arma_sparse_type::value, - const SpToDOp + const mtSpReductionOp >::result max(const T1& X, const uword dim) { arma_debug_sigprint(); - return SpToDOp(X, dim, 0); + return mtSpReductionOp(X, dim, 0); } diff --git a/include/armadillo_bits/fn_mean.hpp b/include/armadillo_bits/fn_mean.hpp index 26515ca2..509c4826 100644 --- a/include/armadillo_bits/fn_mean.hpp +++ b/include/armadillo_bits/fn_mean.hpp @@ -113,13 +113,13 @@ typename enable_if2 < is_arma_sparse_type::value && resolves_to_sparse_vector::no, - const SpToDOp + const mtSpReductionOp >::result mean(const T1& x) { arma_debug_sigprint(); - return SpToDOp(x, 0, 0); + return mtSpReductionOp(x, 0, 0); } @@ -131,13 +131,13 @@ typename enable_if2 < is_arma_sparse_type::value, - const SpToDOp + const mtSpReductionOp >::result mean(const T1& x, const uword dim) { arma_debug_sigprint(); - return SpToDOp(x, dim, 0); + return mtSpReductionOp(x, dim, 0); } diff --git a/include/armadillo_bits/fn_min.hpp b/include/armadillo_bits/fn_min.hpp index 433da86d..0835d6f6 100644 --- a/include/armadillo_bits/fn_min.hpp +++ b/include/armadillo_bits/fn_min.hpp @@ -152,13 +152,13 @@ typename enable_if2 < is_arma_sparse_type::value && resolves_to_sparse_vector::no, - const SpToDOp + const mtSpReductionOp >::result min(const T1& X) { arma_debug_sigprint(); - return SpToDOp(X, 0, 0); + return mtSpReductionOp(X, 0, 0); } @@ -170,13 +170,13 @@ typename enable_if2 < is_arma_sparse_type::value, - const SpToDOp + const mtSpReductionOp >::result min(const T1& X, const uword dim) { arma_debug_sigprint(); - return SpToDOp(X, dim, 0); + return mtSpReductionOp(X, dim, 0); } diff --git a/include/armadillo_bits/fn_stddev.hpp b/include/armadillo_bits/fn_stddev.hpp index fe60a2f8..1f106631 100644 --- a/include/armadillo_bits/fn_stddev.hpp +++ b/include/armadillo_bits/fn_stddev.hpp @@ -111,13 +111,13 @@ typename enable_if2 < is_arma_sparse_type::value && resolves_to_sparse_vector::no, - const mtSpToDOp + const mtSpReductionOp >::result stddev(const T1& X, const uword norm_type = 0) { arma_debug_sigprint(); - return mtSpToDOp(X, norm_type, 0); + return mtSpReductionOp(X, norm_type, 0); } @@ -129,13 +129,13 @@ typename enable_if2 < is_arma_sparse_type::value, - const mtSpToDOp + const mtSpReductionOp >::result stddev(const T1& X, const uword norm_type, const uword dim) { arma_debug_sigprint(); - return mtSpToDOp(X, norm_type, dim); + return mtSpReductionOp(X, norm_type, dim); } diff --git a/include/armadillo_bits/fn_sum.hpp b/include/armadillo_bits/fn_sum.hpp index 2ae47d24..02f673ff 100644 --- a/include/armadillo_bits/fn_sum.hpp +++ b/include/armadillo_bits/fn_sum.hpp @@ -115,13 +115,13 @@ typename enable_if2 < is_arma_sparse_type::value && resolves_to_sparse_vector::no, - const SpToDOp + const mtSpReductionOp >::result sum(const T1& x) { arma_debug_sigprint(); - return SpToDOp(x, 0, 0); + return mtSpReductionOp(x, 0, 0); } @@ -133,13 +133,13 @@ typename enable_if2 < is_arma_sparse_type::value, - const SpToDOp + const mtSpReductionOp >::result sum(const T1& x, const uword dim) { arma_debug_sigprint(); - return SpToDOp(x, dim, 0); + return mtSpReductionOp(x, dim, 0); } diff --git a/include/armadillo_bits/fn_var.hpp b/include/armadillo_bits/fn_var.hpp index 0ec5b8fd..f998884f 100644 --- a/include/armadillo_bits/fn_var.hpp +++ b/include/armadillo_bits/fn_var.hpp @@ -111,13 +111,13 @@ typename enable_if2 < is_arma_sparse_type::value && resolves_to_sparse_vector::no, - const mtSpToDOp + const mtSpReductionOp >::result var(const T1& X, const uword norm_type = 0) { arma_debug_sigprint(); - return mtSpToDOp(X, norm_type, 0); + return mtSpReductionOp(X, norm_type, 0); } @@ -129,13 +129,13 @@ typename enable_if2 < is_arma_sparse_type::value, - const mtSpToDOp + const mtSpReductionOp >::result var(const T1& X, const uword norm_type, const uword dim) { arma_debug_sigprint(); - return mtSpToDOp(X, norm_type, dim); + return mtSpReductionOp(X, norm_type, dim); } diff --git a/include/armadillo_bits/fn_vecnorm.hpp b/include/armadillo_bits/fn_vecnorm.hpp index ff0c5635..61f80e5e 100644 --- a/include/armadillo_bits/fn_vecnorm.hpp +++ b/include/armadillo_bits/fn_vecnorm.hpp @@ -249,7 +249,7 @@ typename enable_if2 < is_arma_sparse_type::value && resolves_to_sparse_vector::no, - const mtSpToDOp + const mtSpReductionOp >::result vecnorm ( @@ -265,7 +265,7 @@ vecnorm const uword dim = 0; - return mtSpToDOp(X, k, dim); + return mtSpReductionOp(X, k, dim); } @@ -273,7 +273,7 @@ vecnorm template arma_warn_unused inline -const mtSpToDOp +const mtSpReductionOp vecnorm ( const SpBase& X, @@ -285,7 +285,7 @@ vecnorm arma_debug_sigprint(); arma_ignore(junk); - return mtSpToDOp(X.get_ref(), k, dim); + return mtSpReductionOp(X.get_ref(), k, dim); } @@ -327,7 +327,7 @@ typename enable_if2 < is_arma_sparse_type::value && resolves_to_sparse_vector::no, - const mtSpToDOp + const mtSpReductionOp >::result vecnorm ( @@ -350,7 +350,7 @@ vecnorm const uword dim = 0; - return mtSpToDOp(X, method_id, dim); + return mtSpReductionOp(X, method_id, dim); } @@ -358,7 +358,7 @@ vecnorm template arma_warn_unused inline -const mtSpToDOp +const mtSpReductionOp vecnorm ( const SpBase& X, @@ -377,7 +377,7 @@ vecnorm if( (sig == 'i') || (sig == 'I') || (sig == '+') ) { method_id = 1; } if( (sig == '-') ) { method_id = 2; } - return mtSpToDOp(X.get_ref(), method_id, dim); + return mtSpReductionOp(X.get_ref(), method_id, dim); } diff --git a/include/armadillo_bits/glue_affmul_bones.hpp b/include/armadillo_bits/glue_affmul_bones.hpp index cb4975b1..5284b6cc 100644 --- a/include/armadillo_bits/glue_affmul_bones.hpp +++ b/include/armadillo_bits/glue_affmul_bones.hpp @@ -31,7 +31,6 @@ class glue_affmul static constexpr bool is_row = T1::is_row; static constexpr bool is_col = T2::is_col; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; }; template diff --git a/include/armadillo_bits/glue_conv_bones.hpp b/include/armadillo_bits/glue_conv_bones.hpp index 377482c5..5382f84c 100644 --- a/include/armadillo_bits/glue_conv_bones.hpp +++ b/include/armadillo_bits/glue_conv_bones.hpp @@ -32,7 +32,6 @@ class glue_conv static constexpr bool is_row = T1::is_row; static constexpr bool is_col = T1::is_col; static constexpr bool is_xvec = T1::is_xvec; - static constexpr bool is_d2sp = false; }; template inline static void apply(Mat& out, const Mat& A, const Mat& B, const bool A_is_col); diff --git a/include/armadillo_bits/glue_cor_bones.hpp b/include/armadillo_bits/glue_cor_bones.hpp index c2bbed4b..eabb8977 100644 --- a/include/armadillo_bits/glue_cor_bones.hpp +++ b/include/armadillo_bits/glue_cor_bones.hpp @@ -32,7 +32,6 @@ class glue_cor static constexpr bool is_row = false; // T1::is_col; // TODO: check static constexpr bool is_col = false; // T2::is_col; // TODO: check static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; }; template inline static void apply(Mat& out, const Glue& X); diff --git a/include/armadillo_bits/glue_cov_bones.hpp b/include/armadillo_bits/glue_cov_bones.hpp index 13f70b33..385dd7a0 100644 --- a/include/armadillo_bits/glue_cov_bones.hpp +++ b/include/armadillo_bits/glue_cov_bones.hpp @@ -32,7 +32,6 @@ class glue_cov static constexpr bool is_row = false; // T1::is_col; // TODO: check static constexpr bool is_col = false; // T2::is_col; // TODO: check static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; }; template inline static void apply(Mat& out, const Glue& X); diff --git a/include/armadillo_bits/glue_cross_bones.hpp b/include/armadillo_bits/glue_cross_bones.hpp index 37261e77..469e2e7c 100644 --- a/include/armadillo_bits/glue_cross_bones.hpp +++ b/include/armadillo_bits/glue_cross_bones.hpp @@ -32,7 +32,6 @@ class glue_cross static constexpr bool is_row = T1::is_row; static constexpr bool is_col = T1::is_col; static constexpr bool is_xvec = true; - static constexpr bool is_d2sp = false; }; template inline static void apply(Mat& out, const Glue& X); diff --git a/include/armadillo_bits/glue_hist_bones.hpp b/include/armadillo_bits/glue_hist_bones.hpp index cda089a5..2d053588 100644 --- a/include/armadillo_bits/glue_hist_bones.hpp +++ b/include/armadillo_bits/glue_hist_bones.hpp @@ -44,7 +44,6 @@ class glue_hist_default static constexpr bool is_row = T1::is_row; static constexpr bool is_col = T1::is_col; static constexpr bool is_xvec = T1::is_xvec; - static constexpr bool is_d2sp = false; }; template diff --git a/include/armadillo_bits/glue_histc_bones.hpp b/include/armadillo_bits/glue_histc_bones.hpp index d4fdf4e6..c1cc6875 100644 --- a/include/armadillo_bits/glue_histc_bones.hpp +++ b/include/armadillo_bits/glue_histc_bones.hpp @@ -44,7 +44,6 @@ class glue_histc_default static constexpr bool is_row = T1::is_row; static constexpr bool is_col = T1::is_col; static constexpr bool is_xvec = T1::is_xvec; - static constexpr bool is_d2sp = false; }; template diff --git a/include/armadillo_bits/glue_intersect_bones.hpp b/include/armadillo_bits/glue_intersect_bones.hpp index d433b249..6a3bcad9 100644 --- a/include/armadillo_bits/glue_intersect_bones.hpp +++ b/include/armadillo_bits/glue_intersect_bones.hpp @@ -31,7 +31,6 @@ class glue_intersect static constexpr bool is_row = (T1::is_row && T2::is_row); static constexpr bool is_col = (T1::is_col || T2::is_col); static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; }; template diff --git a/include/armadillo_bits/glue_join_bones.hpp b/include/armadillo_bits/glue_join_bones.hpp index b55b1f13..b84116a0 100644 --- a/include/armadillo_bits/glue_join_bones.hpp +++ b/include/armadillo_bits/glue_join_bones.hpp @@ -32,7 +32,6 @@ class glue_join_cols static constexpr bool is_row = false; static constexpr bool is_col = (T1::is_col && T2::is_col); static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; }; template @@ -60,7 +59,6 @@ class glue_join_rows static constexpr bool is_row = (T1::is_row && T2::is_row); static constexpr bool is_col = false; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; }; template diff --git a/include/armadillo_bits/glue_kron_bones.hpp b/include/armadillo_bits/glue_kron_bones.hpp index f2dad1c5..84c93476 100644 --- a/include/armadillo_bits/glue_kron_bones.hpp +++ b/include/armadillo_bits/glue_kron_bones.hpp @@ -32,7 +32,6 @@ class glue_kron static constexpr bool is_row = (T1::is_row && T2::is_row); static constexpr bool is_col = (T1::is_col && T2::is_col); static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; }; template inline static void direct_kron(Mat& out, const Mat& A, const Mat& B); diff --git a/include/armadillo_bits/glue_mixed_bones.hpp b/include/armadillo_bits/glue_mixed_bones.hpp index dcf7f8c9..bdc3806d 100644 --- a/include/armadillo_bits/glue_mixed_bones.hpp +++ b/include/armadillo_bits/glue_mixed_bones.hpp @@ -31,7 +31,6 @@ class glue_mixed_times static constexpr bool is_row = T1::is_row; static constexpr bool is_col = T2::is_col; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; }; template diff --git a/include/armadillo_bits/glue_mvnrnd_bones.hpp b/include/armadillo_bits/glue_mvnrnd_bones.hpp index 47cb4edd..ab1c437a 100644 --- a/include/armadillo_bits/glue_mvnrnd_bones.hpp +++ b/include/armadillo_bits/glue_mvnrnd_bones.hpp @@ -30,7 +30,6 @@ class glue_mvnrnd_vec static constexpr bool is_row = false; static constexpr bool is_col = true; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; }; template diff --git a/include/armadillo_bits/glue_polyfit_bones.hpp b/include/armadillo_bits/glue_polyfit_bones.hpp index 89ab6eb3..8e771dc9 100644 --- a/include/armadillo_bits/glue_polyfit_bones.hpp +++ b/include/armadillo_bits/glue_polyfit_bones.hpp @@ -32,7 +32,6 @@ class glue_polyfit static constexpr bool is_row = false; static constexpr bool is_col = true; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; }; template inline static bool apply_noalias(Mat& out, const Col& X, const Col& Y, const uword N); diff --git a/include/armadillo_bits/glue_polyval_bones.hpp b/include/armadillo_bits/glue_polyval_bones.hpp index df025413..f937bd51 100644 --- a/include/armadillo_bits/glue_polyval_bones.hpp +++ b/include/armadillo_bits/glue_polyval_bones.hpp @@ -32,7 +32,6 @@ class glue_polyval static constexpr bool is_row = T2::is_row; static constexpr bool is_col = T2::is_col; static constexpr bool is_xvec = T2::is_xvec; - static constexpr bool is_d2sp = false; }; template inline static void apply_noalias(Mat& out, const Mat& P, const Mat& X); diff --git a/include/armadillo_bits/glue_quantile_bones.hpp b/include/armadillo_bits/glue_quantile_bones.hpp index 6b89610a..cd7fcf12 100644 --- a/include/armadillo_bits/glue_quantile_bones.hpp +++ b/include/armadillo_bits/glue_quantile_bones.hpp @@ -48,7 +48,6 @@ class glue_quantile_default static constexpr bool is_row = T1::is_row; static constexpr bool is_col = T1::is_col; static constexpr bool is_xvec = T1::is_xvec; - static constexpr bool is_d2sp = false; }; template diff --git a/include/armadillo_bits/glue_solve_bones.hpp b/include/armadillo_bits/glue_solve_bones.hpp index 98c3bb4b..20c01659 100644 --- a/include/armadillo_bits/glue_solve_bones.hpp +++ b/include/armadillo_bits/glue_solve_bones.hpp @@ -32,7 +32,6 @@ class glue_solve_gen_default static constexpr bool is_row = false; static constexpr bool is_col = T2::is_col; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; }; template inline static void apply(Mat& out, const Glue& X); @@ -52,7 +51,6 @@ class glue_solve_gen_full static constexpr bool is_row = false; static constexpr bool is_col = T2::is_col; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; }; template inline static void apply(Mat& out, const Glue& X); @@ -72,7 +70,6 @@ class glue_solve_tri_default static constexpr bool is_row = false; static constexpr bool is_col = T2::is_col; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; }; template inline static void apply(Mat& out, const Glue& X); @@ -92,7 +89,6 @@ class glue_solve_tri_full static constexpr bool is_row = false; static constexpr bool is_col = T2::is_col; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; }; template inline static void apply(Mat& out, const Glue& X); diff --git a/include/armadillo_bits/glue_times_bones.hpp b/include/armadillo_bits/glue_times_bones.hpp index 5ad23e20..5792e4ec 100644 --- a/include/armadillo_bits/glue_times_bones.hpp +++ b/include/armadillo_bits/glue_times_bones.hpp @@ -118,7 +118,6 @@ class glue_times static constexpr bool is_row = T1::is_row; static constexpr bool is_col = T2::is_col; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; }; template @@ -158,7 +157,6 @@ class glue_times_diag static constexpr bool is_row = T1::is_row; static constexpr bool is_col = T2::is_col; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; }; template diff --git a/include/armadillo_bits/glue_times_misc_bones.hpp b/include/armadillo_bits/glue_times_misc_bones.hpp index 3319ca53..ca01a1ca 100644 --- a/include/armadillo_bits/glue_times_misc_bones.hpp +++ b/include/armadillo_bits/glue_times_misc_bones.hpp @@ -44,7 +44,6 @@ class glue_times_dense_sparse static constexpr bool is_row = T1::is_row; static constexpr bool is_col = T2::is_col; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; }; template @@ -69,7 +68,6 @@ class glue_times_sparse_dense static constexpr bool is_row = T1::is_row; static constexpr bool is_col = T2::is_col; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; }; template diff --git a/include/armadillo_bits/glue_trapz_bones.hpp b/include/armadillo_bits/glue_trapz_bones.hpp index d0d03be6..8b3019a1 100644 --- a/include/armadillo_bits/glue_trapz_bones.hpp +++ b/include/armadillo_bits/glue_trapz_bones.hpp @@ -32,7 +32,6 @@ class glue_trapz static constexpr bool is_row = false; static constexpr bool is_col = false; static constexpr bool is_xvec = true; - static constexpr bool is_d2sp = false; }; template inline static void apply(Mat& out, const Glue& in); diff --git a/include/armadillo_bits/mtGlue_bones.hpp b/include/armadillo_bits/mtGlue_bones.hpp index 8bd7ce10..5937d89f 100644 --- a/include/armadillo_bits/mtGlue_bones.hpp +++ b/include/armadillo_bits/mtGlue_bones.hpp @@ -32,7 +32,6 @@ class mtGlue : public Base< out_eT, mtGlue > static constexpr bool is_row = glue_type::template traits::is_row; static constexpr bool is_col = glue_type::template traits::is_col; static constexpr bool is_xvec = glue_type::template traits::is_xvec; - static constexpr bool is_d2sp = false; arma_inline mtGlue(const T1& in_A, const T2& in_B); arma_inline mtGlue(const T1& in_A, const T2& in_B, const uword in_aux_uword); diff --git a/include/armadillo_bits/mtOp_bones.hpp b/include/armadillo_bits/mtOp_bones.hpp index a7f6bff7..ff0e4c38 100644 --- a/include/armadillo_bits/mtOp_bones.hpp +++ b/include/armadillo_bits/mtOp_bones.hpp @@ -36,7 +36,6 @@ class mtOp : public Base< out_eT, mtOp > static constexpr bool is_row = op_type::template traits::is_row; static constexpr bool is_col = op_type::template traits::is_col; static constexpr bool is_xvec = op_type::template traits::is_xvec; - static constexpr bool is_d2sp = false; inline explicit mtOp(const T1& in_m); inline mtOp(const T1& in_m, const in_eT in_aux); diff --git a/include/armadillo_bits/mtSpGlue_bones.hpp b/include/armadillo_bits/mtSpGlue_bones.hpp index d376633f..3690914e 100644 --- a/include/armadillo_bits/mtSpGlue_bones.hpp +++ b/include/armadillo_bits/mtSpGlue_bones.hpp @@ -32,7 +32,6 @@ class mtSpGlue : public SpBase< out_eT, mtSpGlue > static constexpr bool is_row = spglue_type::template traits::is_row; static constexpr bool is_col = spglue_type::template traits::is_col; static constexpr bool is_xvec = spglue_type::template traits::is_xvec; - static constexpr bool is_d2sp = false; inline mtSpGlue(const T1& in_A, const T2& in_B); inline ~mtSpGlue(); diff --git a/include/armadillo_bits/mtSpOp_bones.hpp b/include/armadillo_bits/mtSpOp_bones.hpp index 3319c14b..8a07d176 100644 --- a/include/armadillo_bits/mtSpOp_bones.hpp +++ b/include/armadillo_bits/mtSpOp_bones.hpp @@ -34,7 +34,6 @@ class mtSpOp : public SpBase< out_eT, mtSpOp > static constexpr bool is_row = spop_type::template traits::is_row; static constexpr bool is_col = spop_type::template traits::is_col; static constexpr bool is_xvec = spop_type::template traits::is_xvec; - static constexpr bool is_d2sp = false; inline explicit mtSpOp(const T1& in_m); inline mtSpOp(const T1& in_m, const uword aux_uword_a, const uword aux_uword_b); diff --git a/include/armadillo_bits/mtSpToDOp_bones.hpp b/include/armadillo_bits/mtSpToDOp_bones.hpp deleted file mode 100644 index 67b4bd12..00000000 --- a/include/armadillo_bits/mtSpToDOp_bones.hpp +++ /dev/null @@ -1,50 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// -// Copyright 2008-2016 Conrad Sanderson (http://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 -// http://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 mtSpToDOp -//! @{ - - - -template -class mtSpToDOp : public Base< out_eT, mtSpToDOp > - { - public: - - typedef out_eT elem_type; - typedef typename get_pod_type::result pod_type; - - typedef typename T1::elem_type in_eT; - - static constexpr bool is_row = op_type::template traits::is_row; - static constexpr bool is_col = op_type::template traits::is_col; - static constexpr bool is_xvec = op_type::template traits::is_xvec; - static constexpr bool is_d2sp = op_type::template traits::is_d2sp; - - inline explicit mtSpToDOp(const T1& in_m); - inline mtSpToDOp(const T1& in_m, const uword in_aux_uword_a, const uword in_aux_uword_b); - inline ~mtSpToDOp(); - - arma_aligned const T1& m; //!< the operand; must be derived from SpBase - arma_aligned uword aux_uword_a; //!< auxiliary data, uword format - arma_aligned uword aux_uword_b; //!< auxiliary data, uword format - }; - - - -//! @} diff --git a/include/armadillo_bits/mtSpToDOp_meat.hpp b/include/armadillo_bits/mtSpToDOp_meat.hpp deleted file mode 100644 index 7065490d..00000000 --- a/include/armadillo_bits/mtSpToDOp_meat.hpp +++ /dev/null @@ -1,55 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// -// Copyright 2008-2016 Conrad Sanderson (http://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 -// http://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 mtSpToDOp -//! @{ - - - -template -inline -mtSpToDOp::mtSpToDOp(const T1& in_m) - : m(in_m) - { - arma_debug_sigprint(); - } - - - -template -inline -mtSpToDOp::mtSpToDOp(const T1& in_m, const uword in_aux_uword_a, const uword in_aux_uword_b) - : m(in_m) - , aux_uword_a(in_aux_uword_a) - , aux_uword_b(in_aux_uword_b) - { - arma_debug_sigprint(); - } - - - -template -inline -mtSpToDOp::~mtSpToDOp() - { - arma_debug_sigprint(); - } - - - -//! @} diff --git a/include/armadillo_bits/op_htrans_bones.hpp b/include/armadillo_bits/op_htrans_bones.hpp index ad95674d..c10f624f 100644 --- a/include/armadillo_bits/op_htrans_bones.hpp +++ b/include/armadillo_bits/op_htrans_bones.hpp @@ -32,7 +32,6 @@ class op_htrans static constexpr bool is_row = T1::is_col; // deliberately swapped static constexpr bool is_col = T1::is_row; static constexpr bool is_xvec = T1::is_xvec; - static constexpr bool is_d2sp = T1::is_d2sp; }; template @@ -94,7 +93,6 @@ class op_htrans2 static constexpr bool is_row = T1::is_col; // deliberately swapped static constexpr bool is_col = T1::is_row; static constexpr bool is_xvec = T1::is_xvec; - static constexpr bool is_d2sp = T1::is_d2sp; }; template diff --git a/include/armadillo_bits/op_sp_diagvec_bones.hpp b/include/armadillo_bits/op_sp_diagvec_bones.hpp index 9b5918bb..7c9e8776 100644 --- a/include/armadillo_bits/op_sp_diagvec_bones.hpp +++ b/include/armadillo_bits/op_sp_diagvec_bones.hpp @@ -31,11 +31,10 @@ class op_sp_diagvec static constexpr bool is_row = false; static constexpr bool is_col = true; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = true; }; template - inline static void apply(Mat& out, const SpToDOp& in); + inline static void apply(Mat& out, const mtSpReductionOp& in); }; diff --git a/include/armadillo_bits/op_sp_diagvec_meat.hpp b/include/armadillo_bits/op_sp_diagvec_meat.hpp index f83d1bb3..a869c117 100644 --- a/include/armadillo_bits/op_sp_diagvec_meat.hpp +++ b/include/armadillo_bits/op_sp_diagvec_meat.hpp @@ -24,7 +24,7 @@ template inline void -op_sp_diagvec::apply(Mat& out, const SpToDOp& in) +op_sp_diagvec::apply(Mat& out, const mtSpReductionOp& in) { arma_debug_sigprint(); diff --git a/include/armadillo_bits/op_sp_max_bones.hpp b/include/armadillo_bits/op_sp_max_bones.hpp index 9e0f3414..884f9208 100644 --- a/include/armadillo_bits/op_sp_max_bones.hpp +++ b/include/armadillo_bits/op_sp_max_bones.hpp @@ -29,11 +29,10 @@ class op_sp_max static constexpr bool is_row = false; static constexpr bool is_col = false; static constexpr bool is_xvec = true; - static constexpr bool is_d2sp = true; }; template - inline static void apply(Mat& out, const SpToDOp& in); + inline static void apply(Mat& out, const mtSpReductionOp& in); // diff --git a/include/armadillo_bits/op_sp_max_meat.hpp b/include/armadillo_bits/op_sp_max_meat.hpp index d09750de..b748f0bc 100644 --- a/include/armadillo_bits/op_sp_max_meat.hpp +++ b/include/armadillo_bits/op_sp_max_meat.hpp @@ -24,7 +24,7 @@ template inline void -op_sp_max::apply(Mat& out, const SpToDOp& in) +op_sp_max::apply(Mat& out, const mtSpReductionOp& in) { arma_debug_sigprint(); diff --git a/include/armadillo_bits/op_sp_mean_bones.hpp b/include/armadillo_bits/op_sp_mean_bones.hpp index 84908f8f..2f908ccd 100644 --- a/include/armadillo_bits/op_sp_mean_bones.hpp +++ b/include/armadillo_bits/op_sp_mean_bones.hpp @@ -31,12 +31,11 @@ class op_sp_mean static constexpr bool is_row = false; static constexpr bool is_col = false; static constexpr bool is_xvec = true; - static constexpr bool is_d2sp = true; }; // Apply mean into an output sparse matrix (or vector). template - inline static void apply(Mat& out, const SpToDOp& in); + inline static void apply(Mat& out, const mtSpReductionOp& in); template inline static void apply_fast(Mat& out, const SpProxy& p, const uword dim); diff --git a/include/armadillo_bits/op_sp_mean_meat.hpp b/include/armadillo_bits/op_sp_mean_meat.hpp index 62d8dd57..34b57e6d 100644 --- a/include/armadillo_bits/op_sp_mean_meat.hpp +++ b/include/armadillo_bits/op_sp_mean_meat.hpp @@ -24,7 +24,7 @@ template inline void -op_sp_mean::apply(Mat& out, const SpToDOp& in) +op_sp_mean::apply(Mat& out, const mtSpReductionOp& in) { arma_debug_sigprint(); diff --git a/include/armadillo_bits/op_sp_min_bones.hpp b/include/armadillo_bits/op_sp_min_bones.hpp index e401919d..119a26e4 100644 --- a/include/armadillo_bits/op_sp_min_bones.hpp +++ b/include/armadillo_bits/op_sp_min_bones.hpp @@ -29,11 +29,10 @@ class op_sp_min static constexpr bool is_row = false; static constexpr bool is_col = false; static constexpr bool is_xvec = true; - static constexpr bool is_d2sp = true; }; template - inline static void apply(Mat& out, const SpToDOp& in); + inline static void apply(Mat& out, const mtSpReductionOp& in); // diff --git a/include/armadillo_bits/op_sp_min_meat.hpp b/include/armadillo_bits/op_sp_min_meat.hpp index 7c53aa5d..ce0e8d9b 100644 --- a/include/armadillo_bits/op_sp_min_meat.hpp +++ b/include/armadillo_bits/op_sp_min_meat.hpp @@ -24,7 +24,7 @@ template inline void -op_sp_min::apply(Mat& out, const SpToDOp& in) +op_sp_min::apply(Mat& out, const mtSpReductionOp& in) { arma_debug_sigprint(); diff --git a/include/armadillo_bits/op_sp_minus_bones.hpp b/include/armadillo_bits/op_sp_minus_bones.hpp index af12d6a3..fe52fcea 100644 --- a/include/armadillo_bits/op_sp_minus_bones.hpp +++ b/include/armadillo_bits/op_sp_minus_bones.hpp @@ -32,7 +32,6 @@ class op_sp_minus_pre static constexpr bool is_row = T1::is_row; static constexpr bool is_col = T1::is_col; static constexpr bool is_xvec = T1::is_xvec; - static constexpr bool is_d2sp = false; }; template @@ -64,7 +63,6 @@ class op_sp_minus_post static constexpr bool is_row = T1::is_row; static constexpr bool is_col = T1::is_col; static constexpr bool is_xvec = T1::is_xvec; - static constexpr bool is_d2sp = false; }; template diff --git a/include/armadillo_bits/op_sp_plus_bones.hpp b/include/armadillo_bits/op_sp_plus_bones.hpp index fa7c1fb1..e7e1b8a7 100644 --- a/include/armadillo_bits/op_sp_plus_bones.hpp +++ b/include/armadillo_bits/op_sp_plus_bones.hpp @@ -32,7 +32,6 @@ class op_sp_plus static constexpr bool is_row = T1::is_row; static constexpr bool is_col = T1::is_col; static constexpr bool is_xvec = T1::is_xvec; - static constexpr bool is_d2sp = false; }; template diff --git a/include/armadillo_bits/op_sp_stddev_bones.hpp b/include/armadillo_bits/op_sp_stddev_bones.hpp index 8a8dbc1c..43e522e8 100644 --- a/include/armadillo_bits/op_sp_stddev_bones.hpp +++ b/include/armadillo_bits/op_sp_stddev_bones.hpp @@ -31,11 +31,10 @@ class op_sp_stddev static constexpr bool is_row = false; static constexpr bool is_col = false; static constexpr bool is_xvec = true; - static constexpr bool is_d2sp = true; }; template - inline static void apply(Mat& out, const mtSpToDOp& in); + inline static void apply(Mat& out, const mtSpReductionOp& in); template inline static void apply_slow(Mat& out, const SpProxy& p, const uword norm_type, const uword dim); diff --git a/include/armadillo_bits/op_sp_stddev_meat.hpp b/include/armadillo_bits/op_sp_stddev_meat.hpp index 52b3d313..584f93d9 100644 --- a/include/armadillo_bits/op_sp_stddev_meat.hpp +++ b/include/armadillo_bits/op_sp_stddev_meat.hpp @@ -24,7 +24,7 @@ template inline void -op_sp_stddev::apply(Mat& out, const mtSpToDOp& in) +op_sp_stddev::apply(Mat& out, const mtSpReductionOp& in) { arma_debug_sigprint(); diff --git a/include/armadillo_bits/op_sp_sum_bones.hpp b/include/armadillo_bits/op_sp_sum_bones.hpp index 60ebc43a..bea50745 100644 --- a/include/armadillo_bits/op_sp_sum_bones.hpp +++ b/include/armadillo_bits/op_sp_sum_bones.hpp @@ -30,11 +30,10 @@ class op_sp_sum static constexpr bool is_row = false; static constexpr bool is_col = false; static constexpr bool is_xvec = true; - static constexpr bool is_d2sp = true; }; template - inline static void apply(Mat& out, const SpToDOp& in); + inline static void apply(Mat& out, const mtSpReductionOp& in); }; diff --git a/include/armadillo_bits/op_sp_sum_meat.hpp b/include/armadillo_bits/op_sp_sum_meat.hpp index f60879d3..73f34940 100644 --- a/include/armadillo_bits/op_sp_sum_meat.hpp +++ b/include/armadillo_bits/op_sp_sum_meat.hpp @@ -24,7 +24,7 @@ template inline void -op_sp_sum::apply(Mat& out, const SpToDOp& in) +op_sp_sum::apply(Mat& out, const mtSpReductionOp& in) { arma_debug_sigprint(); diff --git a/include/armadillo_bits/op_sp_var_bones.hpp b/include/armadillo_bits/op_sp_var_bones.hpp index a3eaa503..3344180b 100644 --- a/include/armadillo_bits/op_sp_var_bones.hpp +++ b/include/armadillo_bits/op_sp_var_bones.hpp @@ -32,11 +32,10 @@ class op_sp_var static constexpr bool is_row = false; static constexpr bool is_col = false; static constexpr bool is_xvec = true; - static constexpr bool is_d2sp = true; }; template - inline static void apply(Mat& out, const mtSpToDOp& in); + inline static void apply(Mat& out, const mtSpReductionOp& in); template inline static void apply_slow(Mat& out, const SpProxy& p, const uword norm_type, const uword dim); diff --git a/include/armadillo_bits/op_sp_var_meat.hpp b/include/armadillo_bits/op_sp_var_meat.hpp index 68f1dd94..a3fef170 100644 --- a/include/armadillo_bits/op_sp_var_meat.hpp +++ b/include/armadillo_bits/op_sp_var_meat.hpp @@ -24,7 +24,7 @@ template inline void -op_sp_var::apply(Mat& out, const mtSpToDOp& in) +op_sp_var::apply(Mat& out, const mtSpReductionOp& in) { arma_debug_sigprint(); diff --git a/include/armadillo_bits/op_sp_vecnorm_bones.hpp b/include/armadillo_bits/op_sp_vecnorm_bones.hpp index f5e91687..8d70ad0d 100644 --- a/include/armadillo_bits/op_sp_vecnorm_bones.hpp +++ b/include/armadillo_bits/op_sp_vecnorm_bones.hpp @@ -30,11 +30,10 @@ class op_sp_vecnorm static constexpr bool is_row = false; static constexpr bool is_col = false; static constexpr bool is_xvec = true; - static constexpr bool is_d2sp = true; }; template - inline static void apply(Mat& out, const mtSpToDOp& expr); + inline static void apply(Mat& out, const mtSpReductionOp& expr); template inline static void apply_direct(Mat< typename get_pod_type::result >& out, const SpMat& X, const uword k); @@ -54,11 +53,10 @@ class op_sp_vecnorm_ext static constexpr bool is_row = false; static constexpr bool is_col = false; static constexpr bool is_xvec = true; - static constexpr bool is_d2sp = true; }; template - inline static void apply(Mat& out, const mtSpToDOp& expr); + inline static void apply(Mat& out, const mtSpReductionOp& expr); template inline static void apply_direct(Mat< typename get_pod_type::result >& out, const SpMat& X, const uword method_id); diff --git a/include/armadillo_bits/op_sp_vecnorm_meat.hpp b/include/armadillo_bits/op_sp_vecnorm_meat.hpp index 43e121c9..3e5ae46b 100644 --- a/include/armadillo_bits/op_sp_vecnorm_meat.hpp +++ b/include/armadillo_bits/op_sp_vecnorm_meat.hpp @@ -24,7 +24,7 @@ template inline void -op_sp_vecnorm::apply(Mat& out, const mtSpToDOp& expr) +op_sp_vecnorm::apply(Mat& out, const mtSpReductionOp& expr) { arma_debug_sigprint(); @@ -110,7 +110,7 @@ op_sp_vecnorm::apply_direct(Mat< typename get_pod_type::result >& out, const template inline void -op_sp_vecnorm_ext::apply(Mat& out, const mtSpToDOp& expr) +op_sp_vecnorm_ext::apply(Mat& out, const mtSpReductionOp& expr) { arma_debug_sigprint(); diff --git a/include/armadillo_bits/op_strans_bones.hpp b/include/armadillo_bits/op_strans_bones.hpp index fd5b9b58..42534bfe 100644 --- a/include/armadillo_bits/op_strans_bones.hpp +++ b/include/armadillo_bits/op_strans_bones.hpp @@ -32,7 +32,6 @@ class op_strans static constexpr bool is_row = T1::is_col; // deliberately swapped static constexpr bool is_col = T1::is_row; static constexpr bool is_xvec = T1::is_xvec; - static constexpr bool is_d2sp = T1::is_d2sp; }; template diff --git a/include/armadillo_bits/spdiagview_bones.hpp b/include/armadillo_bits/spdiagview_bones.hpp index 40fb7146..238e8a38 100644 --- a/include/armadillo_bits/spdiagview_bones.hpp +++ b/include/armadillo_bits/spdiagview_bones.hpp @@ -34,7 +34,6 @@ class spdiagview : public SpBase< eT, spdiagview > static constexpr bool is_row = false; static constexpr bool is_col = true; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; const uword row_offset; const uword col_offset; diff --git a/include/armadillo_bits/spglue_join_bones.hpp b/include/armadillo_bits/spglue_join_bones.hpp index 6195a073..93829b70 100644 --- a/include/armadillo_bits/spglue_join_bones.hpp +++ b/include/armadillo_bits/spglue_join_bones.hpp @@ -31,7 +31,6 @@ class spglue_join_cols static constexpr bool is_row = false; static constexpr bool is_col = (T1::is_col && T2::is_col); static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; }; template @@ -59,7 +58,6 @@ class spglue_join_rows static constexpr bool is_row = (T1::is_row && T2::is_row); static constexpr bool is_col = false; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; }; template diff --git a/include/armadillo_bits/spglue_kron_bones.hpp b/include/armadillo_bits/spglue_kron_bones.hpp index 476d0725..e0d33b20 100644 --- a/include/armadillo_bits/spglue_kron_bones.hpp +++ b/include/armadillo_bits/spglue_kron_bones.hpp @@ -31,7 +31,6 @@ class spglue_kron static constexpr bool is_row = (T1::is_row && T2::is_row); static constexpr bool is_col = (T1::is_col && T2::is_col); static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; }; template diff --git a/include/armadillo_bits/spglue_times_bones.hpp b/include/armadillo_bits/spglue_times_bones.hpp index 7f1ba1da..63c21b3d 100644 --- a/include/armadillo_bits/spglue_times_bones.hpp +++ b/include/armadillo_bits/spglue_times_bones.hpp @@ -31,7 +31,6 @@ class spglue_times static constexpr bool is_row = T1::is_row; static constexpr bool is_col = T2::is_col; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; }; template @@ -56,7 +55,6 @@ class spglue_times_mixed static constexpr bool is_row = T1::is_row; static constexpr bool is_col = T2::is_col; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; }; template diff --git a/include/armadillo_bits/spop_htrans_bones.hpp b/include/armadillo_bits/spop_htrans_bones.hpp index 28eaa75e..609c64b5 100644 --- a/include/armadillo_bits/spop_htrans_bones.hpp +++ b/include/armadillo_bits/spop_htrans_bones.hpp @@ -32,7 +32,6 @@ class spop_htrans static constexpr bool is_row = T1::is_col; // deliberately swapped static constexpr bool is_col = T1::is_row; static constexpr bool is_xvec = T1::is_xvec; - static constexpr bool is_d2sp = false; }; template diff --git a/include/armadillo_bits/spop_strans_bones.hpp b/include/armadillo_bits/spop_strans_bones.hpp index a058ef82..7d52ccae 100644 --- a/include/armadillo_bits/spop_strans_bones.hpp +++ b/include/armadillo_bits/spop_strans_bones.hpp @@ -32,7 +32,6 @@ class spop_strans static constexpr bool is_row = T1::is_col; // deliberately swapped static constexpr bool is_col = T1::is_row; static constexpr bool is_xvec = T1::is_xvec; - static constexpr bool is_d2sp = false; }; template diff --git a/include/armadillo_bits/subview_bones.hpp b/include/armadillo_bits/subview_bones.hpp index 829394f8..95553a10 100644 --- a/include/armadillo_bits/subview_bones.hpp +++ b/include/armadillo_bits/subview_bones.hpp @@ -35,7 +35,6 @@ class subview : public Base< eT, subview > static constexpr bool is_row = false; static constexpr bool is_col = false; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; const uword aux_row1; const uword aux_col1; @@ -370,7 +369,6 @@ class subview_col : public subview static constexpr bool is_row = false; static constexpr bool is_col = true; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; const eT* colmem; @@ -465,7 +463,6 @@ class subview_cols : public subview static constexpr bool is_row = false; static constexpr bool is_col = false; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; inline subview_cols(const subview_cols& in); inline subview_cols( subview_cols&& in); @@ -527,7 +524,6 @@ class subview_row : public subview static constexpr bool is_row = true; static constexpr bool is_col = false; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; inline void operator= (const subview& x); inline void operator= (const subview_row& x); @@ -615,7 +611,6 @@ class subview_row_strans : public Base< eT, subview_row_strans > static constexpr bool is_row = false; static constexpr bool is_col = true; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; arma_aligned const subview_row& sv_row; @@ -651,7 +646,6 @@ class subview_row_htrans : public Base< eT, subview_row_htrans > static constexpr bool is_row = false; static constexpr bool is_col = true; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; arma_aligned const subview_row& sv_row; diff --git a/include/armadillo_bits/subview_elem1_bones.hpp b/include/armadillo_bits/subview_elem1_bones.hpp index a8e11c15..2ac3cdad 100644 --- a/include/armadillo_bits/subview_elem1_bones.hpp +++ b/include/armadillo_bits/subview_elem1_bones.hpp @@ -32,7 +32,6 @@ class subview_elem1 : public Base< eT, subview_elem1 > static constexpr bool is_row = false; static constexpr bool is_col = true; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; arma_aligned const Mat fake_m; arma_aligned const Mat& m; diff --git a/include/armadillo_bits/subview_elem2_bones.hpp b/include/armadillo_bits/subview_elem2_bones.hpp index 2eb5dfd2..d4c4cbe6 100644 --- a/include/armadillo_bits/subview_elem2_bones.hpp +++ b/include/armadillo_bits/subview_elem2_bones.hpp @@ -32,7 +32,6 @@ class subview_elem2 : public Base< eT, subview_elem2 > static constexpr bool is_row = false; static constexpr bool is_col = false; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; arma_aligned const Mat& m; diff --git a/include/armadillo_bits/traits.hpp b/include/armadillo_bits/traits.hpp index a5790559..3274b6d5 100644 --- a/include/armadillo_bits/traits.hpp +++ b/include/armadillo_bits/traits.hpp @@ -342,19 +342,6 @@ struct is_SpToDOp< const SpToDOp > { static constexpr bool value = true; }; -template -struct is_mtSpToDOp - { static constexpr bool value = false; }; - -template -struct is_mtSpToDOp< mtSpToDOp > - { static constexpr bool value = true; }; - -template -struct is_mtSpToDOp< const mtSpToDOp > - { static constexpr bool value = true; }; - - template struct is_SpToDGlue { static constexpr bool value = false; }; @@ -570,7 +557,6 @@ struct is_arma_type2 || is_CubeToMatOp::value || is_SpToDOp::value || is_SpToDGlue::value - || is_mtSpToDOp::value ; }; @@ -704,15 +690,6 @@ struct is_SpOp< SpOp > { static constexpr bool value = true; }; -template -struct is_SpReductionOp - { static constexpr bool value = false; }; - -template -struct is_SpReductionOp< SpReductionOp > - { static constexpr bool value = true; }; - - template struct is_SpGlue { static constexpr bool value = false; }; @@ -731,15 +708,6 @@ struct is_mtSpOp< mtSpOp > { static constexpr bool value = true; }; -template -struct is_mtSpReductionOp - { static constexpr bool value = false; }; - -template -struct is_mtSpReductionOp< mtSpReductionOp > - { static constexpr bool value = true; }; - - template struct is_mtSpGlue { static constexpr bool value = false; }; @@ -749,6 +717,15 @@ struct is_mtSpGlue< mtSpGlue > { static constexpr bool value = true; }; +template +struct is_mtSpReductionOp + { static constexpr bool value = false; }; + +template +struct is_mtSpReductionOp< mtSpReductionOp > + { static constexpr bool value = true; }; + + template struct is_arma_sparse_type @@ -761,11 +738,10 @@ struct is_arma_sparse_type || is_SpSubview_row::value || is_spdiagview::value || is_SpOp::value - || is_SpReductionOp::value || is_SpGlue::value || is_mtSpOp::value - || is_mtSpReductionOp::value || is_mtSpGlue::value + || is_mtSpReductionOp::value ; }; diff --git a/include/armadillo_bits/unwrap_spmat.hpp b/include/armadillo_bits/unwrap_spmat.hpp index 2290bd9d..fba6b89e 100644 --- a/include/armadillo_bits/unwrap_spmat.hpp +++ b/include/armadillo_bits/unwrap_spmat.hpp @@ -193,4 +193,24 @@ struct unwrap_spmat< mtSpGlue > +template +struct unwrap_spmat< mtSpReductionOp > + { + typedef SpMat stored_type; + + inline + unwrap_spmat(const mtSpReductionOp& A) + : M(A) + { + arma_debug_sigprint(); + } + + const SpMat M; + + template + constexpr bool is_alias(const SpMat&) const { return false; } + }; + + + //! @} diff --git a/include/armadillo_bits/xtrans_mat_bones.hpp b/include/armadillo_bits/xtrans_mat_bones.hpp index bc4f0086..58756662 100644 --- a/include/armadillo_bits/xtrans_mat_bones.hpp +++ b/include/armadillo_bits/xtrans_mat_bones.hpp @@ -31,7 +31,6 @@ class xtrans_mat : public Base< eT, xtrans_mat > static constexpr bool is_row = false; static constexpr bool is_col = false; static constexpr bool is_xvec = false; - static constexpr bool is_d2sp = false; static constexpr bool really_do_conj = (do_conj && is_cx::yes); diff --git a/include/armadillo_bits/xvec_htrans_bones.hpp b/include/armadillo_bits/xvec_htrans_bones.hpp index e3ce8b7f..6eab7101 100644 --- a/include/armadillo_bits/xvec_htrans_bones.hpp +++ b/include/armadillo_bits/xvec_htrans_bones.hpp @@ -31,7 +31,6 @@ class xvec_htrans : public Base< eT, xvec_htrans > static constexpr bool is_row = false; static constexpr bool is_col = false; static constexpr bool is_xvec = true; - static constexpr bool is_d2sp = false; arma_aligned const eT* const mem;