Skip to content

Commit 305fe0d

Browse files
committed
Armadillo 15.2
1 parent 554e7c1 commit 305fe0d

File tree

12 files changed

+85
-55
lines changed

12 files changed

+85
-55
lines changed

inst/include/current/armadillo_bits/Col_meat.hpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1264,6 +1264,13 @@ Col<eT>::end_row(const uword row_num) const
12641264

12651265

12661266

1267+
1268+
1269+
1270+
//
1271+
1272+
1273+
12671274
template<typename eT>
12681275
template<uword fixed_n_elem>
12691276
arma_inline
@@ -1859,6 +1866,10 @@ Col<eT>::fixed<fixed_n_elem>::ones()
18591866

18601867

18611868

1869+
//
1870+
1871+
1872+
18621873
template<typename eT>
18631874
inline
18641875
Col<eT>::Col(const arma_fixed_indicator&, const uword in_n_elem, const eT* in_mem)

inst/include/current/armadillo_bits/Cube_meat.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3148,7 +3148,7 @@ Cube<eT>::Cube(const GlueCube<T1, T2, glue_type>& X)
31483148
{
31493149
arma_debug_sigprint_this(this);
31503150

3151-
this->operator=(X);
3151+
(*this).operator=(X);
31523152
}
31533153

31543154

inst/include/current/armadillo_bits/Mat_bones.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ class Mat : public Base< eT, Mat<eT> >
120120
template<typename T1, typename T2> inline explicit Mat(const Base<pod_type,T1>& A, const Base<pod_type,T2>& B, const arma_vec_indicator&, const uhword in_vec_state);
121121
template<typename T1, typename T2> inline explicit Mat(const Base<pod_type,T1>& A, const Base<pod_type,T2>& B);
122122

123-
inline explicit Mat(const subview<eT>& X, const bool use_colmem); // only to be used by the quasi_unwrap class
123+
inline explicit Mat(const subview<eT>& X, const bool reuse_mem); // only to be used by quasi_unwrap and partial_unwrap
124124

125125
inline Mat(const subview<eT>& X, const arma_vec_indicator&, const uhword in_vec_state);
126126
inline Mat(const subview<eT>& X);

inst/include/current/armadillo_bits/Mat_meat.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2021,18 +2021,18 @@ Mat<eT>::Mat(const Base<typename Mat<eT>::pod_type,T1>& A, const Base<typename M
20212021

20222022
template<typename eT>
20232023
inline
2024-
Mat<eT>::Mat(const subview<eT>& X, const bool use_colmem)
2024+
Mat<eT>::Mat(const subview<eT>& X, const bool reuse_mem)
20252025
: n_rows(X.n_rows)
20262026
, n_cols(X.n_cols)
20272027
, n_elem(X.n_elem)
20282028
, n_alloc(0)
20292029
, vec_state(0)
2030-
, mem_state(use_colmem ? 3 : 0)
2031-
, mem (use_colmem ? X.colptr(0) : nullptr)
2030+
, mem_state(reuse_mem ? 3 : 0 )
2031+
, mem (reuse_mem ? X.colptr(0) : nullptr)
20322032
{
20332033
arma_debug_sigprint_this(this);
20342034

2035-
if(use_colmem)
2035+
if(reuse_mem)
20362036
{
20372037
arma_debug_print("Mat::Mat(): using existing memory in a submatrix");
20382038
}

inst/include/current/armadillo_bits/Row_bones.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,6 @@ class Row : public Mat<eT>
8585
template<typename T1, typename T2>
8686
inline explicit Row(const Base<pod_type,T1>& A, const Base<pod_type,T2>& B);
8787

88-
inline explicit Row(const subview<eT>& X, const bool use_colmem); // only to be used by the quasi_unwrap class
89-
9088
template<typename T1> inline Row(const BaseCube<eT,T1>& X);
9189
template<typename T1> inline Row& operator=(const BaseCube<eT,T1>& X);
9290

@@ -171,6 +169,9 @@ class Row : public Mat<eT>
171169
inline const_row_iterator end_row (const uword row_num) const;
172170

173171

172+
inline explicit Row(const subview<eT>& X, const bool reuse_mem); // only to be used by the partial_unwrap class
173+
174+
174175
template<uword fixed_n_elem> class fixed;
175176

176177

inst/include/current/armadillo_bits/Row_meat.hpp

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -610,16 +610,6 @@ Row<eT>::Row
610610

611611

612612

613-
template<typename eT>
614-
inline
615-
Row<eT>::Row(const subview<eT>& X, const bool use_colmem)
616-
: Mat<eT>(X, use_colmem)
617-
{
618-
arma_debug_sigprint();
619-
}
620-
621-
622-
623613
template<typename eT>
624614
template<typename T1>
625615
inline
@@ -1274,6 +1264,20 @@ Row<eT>::end_row(const uword row_num) const
12741264

12751265

12761266

1267+
template<typename eT>
1268+
inline
1269+
Row<eT>::Row(const subview<eT>& X, const bool reuse_mem)
1270+
: Mat<eT>(X, reuse_mem)
1271+
{
1272+
arma_debug_sigprint_this(this);
1273+
}
1274+
1275+
1276+
1277+
//
1278+
1279+
1280+
12771281
template<typename eT>
12781282
template<uword fixed_n_elem>
12791283
arma_inline
@@ -1869,6 +1873,10 @@ Row<eT>::fixed<fixed_n_elem>::ones()
18691873

18701874

18711875

1876+
//
1877+
1878+
1879+
18721880
template<typename eT>
18731881
inline
18741882
Row<eT>::Row(const arma_fixed_indicator&, const uword in_n_elem, const eT* in_mem)

inst/include/current/armadillo_bits/arma_version.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@
2222

2323

2424
#define ARMA_VERSION_MAJOR 15
25-
#define ARMA_VERSION_MINOR 1
26-
#define ARMA_VERSION_PATCH 91
27-
#define ARMA_VERSION_NAME "15.2-RC1"
25+
#define ARMA_VERSION_MINOR 2
26+
#define ARMA_VERSION_PATCH 0
27+
#define ARMA_VERSION_NAME "Medium Roast Deluxe"
2828

2929

3030

inst/include/current/armadillo_bits/field_meat.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ field<oT>::field(const subview_field<oT>& X)
9494
{
9595
arma_debug_sigprint_this(this);
9696

97-
this->operator=(X);
97+
(*this).operator=(X);
9898
}
9999

100100

inst/include/current/armadillo_bits/op_accu_bones.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ struct op_accu_mat
6565

6666
template<typename eT>
6767
static inline eT apply(const subview_col<eT>& X);
68+
69+
template<typename eT>
70+
static inline eT apply(const subview_row<eT>& X);
6871
};
6972

7073

inst/include/current/armadillo_bits/op_accu_meat.hpp

Lines changed: 34 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -121,20 +121,6 @@ op_accu_mat::apply(const T1& X)
121121
return arrayops::accumulate(U.M.memptr(), U.M.n_elem);
122122
}
123123

124-
if(is_subview_row<T1>::value)
125-
{
126-
typedef typename T1::elem_type eT;
127-
128-
const subview_row<eT>& sv = reinterpret_cast< const subview_row<eT>& >(X);
129-
130-
if(sv.m.n_rows == 1)
131-
{
132-
const eT* sv_mem = &(sv.m.at(sv.aux_col1));
133-
134-
return arrayops::accumulate(sv_mem, sv.n_elem);
135-
}
136-
}
137-
138124
const Proxy<T1> P(X);
139125

140126
return (Proxy<T1>::use_at) ? op_accu_mat::apply_proxy_at(P) : op_accu_mat::apply_proxy_linear(P);
@@ -616,19 +602,7 @@ op_accu_mat::apply(const subview<eT>& X)
616602
const uword X_n_rows = X.n_rows;
617603
const uword X_n_cols = X.n_cols;
618604

619-
if(X_n_rows == 1)
620-
{
621-
const Mat<eT>& m = X.m;
622-
623-
const uword col_offset = X.aux_col1;
624-
const uword row_offset = X.aux_row1;
625-
626-
eT val = eT(0);
627-
628-
for(uword i=0; i < X_n_cols; ++i) { val += m.at(row_offset, col_offset + i); }
629-
630-
return val;
631-
}
605+
if(X_n_rows == 1) { return op_accu_mat::apply( static_cast< const subview_row<eT>& >(X) ); }
632606

633607
if(X_n_cols == 1) { return arrayops::accumulate( X.colptr(0), X_n_rows ); }
634608

@@ -656,6 +630,39 @@ op_accu_mat::apply(const subview_col<eT>& X)
656630

657631

658632

633+
template<typename eT>
634+
inline
635+
eT
636+
op_accu_mat::apply(const subview_row<eT>& X)
637+
{
638+
arma_debug_sigprint();
639+
640+
const uword X_m_n_rows = X.m.n_rows;
641+
const uword X_n_cols = X.n_cols;
642+
643+
const eT* row_mem = &(X.m.at(X.aux_row1,X.aux_col1));
644+
645+
eT val1 = eT(0);
646+
eT val2 = eT(0);
647+
648+
uword j;
649+
650+
for(j=1; j < X_n_cols; j+=2)
651+
{
652+
val1 += (*row_mem); row_mem += X_m_n_rows;
653+
val2 += (*row_mem); row_mem += X_m_n_rows;
654+
}
655+
656+
if((j-1) < X_n_cols)
657+
{
658+
val1 += (*row_mem);
659+
}
660+
661+
return val1 + val2;
662+
}
663+
664+
665+
659666
//
660667

661668

0 commit comments

Comments
 (0)