Col_bones.hpp | Col_bones.hpp | |||
---|---|---|---|---|
skipping to change at line 63 | skipping to change at line 63 | |||
arma_inline eT& row(const u32 row_num); | arma_inline eT& row(const u32 row_num); | |||
arma_inline eT row(const u32 row_num) const; | arma_inline eT row(const u32 row_num) const; | |||
arma_inline subview_col<eT> rows(const u32 in_row1, const u32 in_ro w2); | arma_inline subview_col<eT> rows(const u32 in_row1, const u32 in_ro w2); | |||
arma_inline const subview_col<eT> rows(const u32 in_row1, const u32 in_ro w2) const; | arma_inline const subview_col<eT> rows(const u32 in_row1, const u32 in_ro w2) const; | |||
arma_inline subview_col<eT> subvec(const u32 in_row1, const u32 in_ row2); | arma_inline subview_col<eT> subvec(const u32 in_row1, const u32 in_ row2); | |||
arma_inline const subview_col<eT> subvec(const u32 in_row1, const u32 in_ row2) const; | arma_inline const subview_col<eT> subvec(const u32 in_row1, const u32 in_ row2) const; | |||
arma_inline subview_col<eT> subvec(const span& row_span); | ||||
arma_inline const subview_col<eT> subvec(const span& row_span) const; | ||||
//arma_inline subview_col<eT> operator()(const span& row_span); | ||||
//arma_inline const subview_col<eT> operator()(const span& row_span) cons | ||||
t; | ||||
inline void shed_row (const u32 row_num); | inline void shed_row (const u32 row_num); | |||
inline void shed_rows(const u32 in_row1, const u32 in_row2); | inline void shed_rows(const u32 in_row1, const u32 in_row2); | |||
inline void insert_rows(const u32 row_num, const u3 2 N, const bool set_to_zero = true); | inline void insert_rows(const u32 row_num, const u3 2 N, const bool set_to_zero = true); | |||
template<typename T1> inline void insert_rows(const u32 row_num, const Ba se<eT,T1>& X); | template<typename T1> inline void insert_rows(const u32 row_num, const Ba se<eT,T1>& X); | |||
typedef eT* row_iterator; | typedef eT* row_iterator; | |||
typedef const eT* const_row_iterator; | typedef const eT* const_row_iterator; | |||
inline row_iterator begin_row(const u32 row_num); | inline row_iterator begin_row(const u32 row_num); | |||
End of changes. 1 change blocks. | ||||
0 lines changed or deleted | 7 lines changed or added | |||
Col_meat.hpp | Col_meat.hpp | |||
---|---|---|---|---|
skipping to change at line 327 | skipping to change at line 327 | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
arma_debug_check( ( (in_row1 > in_row2) || (in_row2 >= Mat<eT>::n_rows) ) , "Col::subvec(): indices out of bounds or incorrectly used"); | arma_debug_check( ( (in_row1 > in_row2) || (in_row2 >= Mat<eT>::n_rows) ) , "Col::subvec(): indices out of bounds or incorrectly used"); | |||
const u32 subview_n_rows = in_row2 - in_row1 + 1; | const u32 subview_n_rows = in_row2 - in_row1 + 1; | |||
return subview_col<eT>(*this, 0, in_row1, subview_n_rows); | return subview_col<eT>(*this, 0, in_row1, subview_n_rows); | |||
} | } | |||
template<typename eT> | ||||
arma_inline | ||||
subview_col<eT> | ||||
Col<eT>::subvec(const span& row_span) | ||||
{ | ||||
arma_extra_debug_sigprint(); | ||||
const bool row_all = row_span.whole; | ||||
const u32 local_n_rows = Mat<eT>::n_rows; | ||||
const u32 in_row1 = row_all ? 0 : row_span.a; | ||||
const u32 in_row2 = row_span.b; | ||||
const u32 subvec_n_rows = row_all ? local_n_rows : in_row2 - in_row1 + 1; | ||||
arma_debug_check( ( row_all ? false : ((in_row1 > in_row2) || (in_row2 >= | ||||
local_n_rows)) ), "Col::subvec(): indices out of bounds or incorrectly use | ||||
d"); | ||||
return subview_col<eT>(*this, 0, in_row1, subvec_n_rows); | ||||
} | ||||
template<typename eT> | ||||
arma_inline | ||||
const subview_col<eT> | ||||
Col<eT>::subvec(const span& row_span) const | ||||
{ | ||||
arma_extra_debug_sigprint(); | ||||
const bool row_all = row_span.whole; | ||||
const u32 local_n_rows = Mat<eT>::n_rows; | ||||
const u32 in_row1 = row_all ? 0 : row_span.a; | ||||
const u32 in_row2 = row_span.b; | ||||
const u32 subvec_n_rows = row_all ? local_n_rows : in_row2 - in_row1 + 1; | ||||
arma_debug_check( ( row_all ? false : ((in_row1 > in_row2) || (in_row2 >= | ||||
local_n_rows)) ), "Col::subvec(): indices out of bounds or incorrectly use | ||||
d"); | ||||
return subview_col<eT>(*this, 0, in_row1, subvec_n_rows); | ||||
} | ||||
// template<typename eT> | ||||
// arma_inline | ||||
// subview_col<eT> | ||||
// Col<eT>::operator()(const span& row_span) | ||||
// { | ||||
// arma_extra_debug_sigprint(); | ||||
// | ||||
// return subvec(row_span); | ||||
// } | ||||
// | ||||
// | ||||
// | ||||
// template<typename eT> | ||||
// arma_inline | ||||
// const subview_col<eT> | ||||
// Col<eT>::operator()(const span& row_span) const | ||||
// { | ||||
// arma_extra_debug_sigprint(); | ||||
// | ||||
// return subvec(row_span); | ||||
// } | ||||
//! remove specified row | //! remove specified row | |||
template<typename eT> | template<typename eT> | |||
inline | inline | |||
void | void | |||
Col<eT>::shed_row(const u32 row_num) | Col<eT>::shed_row(const u32 row_num) | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
arma_debug_check( row_num >= Mat<eT>::n_rows, "Col::shed_row(): out of bo unds"); | arma_debug_check( row_num >= Mat<eT>::n_rows, "Col::shed_row(): out of bo unds"); | |||
skipping to change at line 372 | skipping to change at line 434 | |||
if(n_keep_front > 0) | if(n_keep_front > 0) | |||
{ | { | |||
arrayops::copy( X_mem, t_mem, n_keep_front ); | arrayops::copy( X_mem, t_mem, n_keep_front ); | |||
} | } | |||
if(n_keep_back > 0) | if(n_keep_back > 0) | |||
{ | { | |||
arrayops::copy( &(X_mem[n_keep_front]), &(t_mem[in_row2+1]), n_keep_bac k); | arrayops::copy( &(X_mem[n_keep_front]), &(t_mem[in_row2+1]), n_keep_bac k); | |||
} | } | |||
steal_mem(X); | Mat<eT>::steal_mem(X); | |||
} | } | |||
//! insert N rows at the specified row position, | //! insert N rows at the specified row position, | |||
//! optionally setting the elements of the inserted rows to zero | //! optionally setting the elements of the inserted rows to zero | |||
template<typename eT> | template<typename eT> | |||
inline | inline | |||
void | void | |||
Col<eT>::insert_rows(const u32 row_num, const u32 N, const bool set_to_zero ) | Col<eT>::insert_rows(const u32 row_num, const u32 N, const bool set_to_zero ) | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
skipping to change at line 414 | skipping to change at line 476 | |||
if(B_n_rows > 0) | if(B_n_rows > 0) | |||
{ | { | |||
arrayops::copy( &(out_mem[row_num + N]), &(t_mem[row_num]), B_n_rows ); | arrayops::copy( &(out_mem[row_num + N]), &(t_mem[row_num]), B_n_rows ); | |||
} | } | |||
if(set_to_zero == true) | if(set_to_zero == true) | |||
{ | { | |||
arrayops::inplace_set( &(out_mem[row_num]), eT(0), N ); | arrayops::inplace_set( &(out_mem[row_num]), eT(0), N ); | |||
} | } | |||
steal_mem(out); | Mat<eT>::steal_mem(out); | |||
} | } | |||
} | } | |||
//! insert the given object at the specified row position; | //! insert the given object at the specified row position; | |||
//! the given object must have one column | //! the given object must have one column | |||
template<typename eT> | template<typename eT> | |||
template<typename T1> | template<typename T1> | |||
inline | inline | |||
void | void | |||
Col<eT>::insert_rows(const u32 row_num, const Base<eT,T1>& X) | Col<eT>::insert_rows(const u32 row_num, const Base<eT,T1>& X) | |||
End of changes. 3 change blocks. | ||||
2 lines changed or deleted | 68 lines changed or added | |||
Mat_bones.hpp | Mat_bones.hpp | |||
---|---|---|---|---|
skipping to change at line 403 | skipping to change at line 403 | |||
inline col_iterator end_col (const u32 col_num); | inline col_iterator end_col (const u32 col_num); | |||
inline const_col_iterator end_col (const u32 col_num) const; | inline const_col_iterator end_col (const u32 col_num) const; | |||
inline row_iterator begin_row(const u32 row_num); | inline row_iterator begin_row(const u32 row_num); | |||
inline const_row_iterator begin_row(const u32 row_num) const; | inline const_row_iterator begin_row(const u32 row_num) const; | |||
inline row_iterator end_row (const u32 row_num); | inline row_iterator end_row (const u32 row_num); | |||
inline const_row_iterator end_row (const u32 row_num) const; | inline const_row_iterator end_row (const u32 row_num) const; | |||
// inline void clear(); | inline void clear(); | |||
// inline void resize(const u32 in_n_elem); | inline bool empty() const; | |||
// arma_inline bool empty() const; | inline u32 size() const; | |||
// arma_inline u32 size() const; | ||||
template<u32 fixed_n_rows, u32 fixed_n_cols> | template<u32 fixed_n_rows, u32 fixed_n_cols> | |||
class fixed : public Mat<eT> | class fixed : public Mat<eT> | |||
{ | { | |||
private: | private: | |||
static const u32 fixed_n_elem = fixed_n_rows * fixed_n_cols; | static const u32 fixed_n_elem = fixed_n_rows * fixed_n_cols; | |||
static const bool use_extra = (fixed_n_elem > arma_config::mat_preal loc); | static const bool use_extra = (fixed_n_elem > arma_config::mat_preal loc); | |||
arma_aligned eT mem_local_extra[ (use_extra) ? fixed_n_elem : 1 ]; | arma_aligned eT mem_local_extra[ (use_extra) ? fixed_n_elem : 1 ]; | |||
End of changes. 1 change blocks. | ||||
4 lines changed or deleted | 3 lines changed or added | |||
Mat_meat.hpp | Mat_meat.hpp | |||
---|---|---|---|---|
skipping to change at line 529 | skipping to change at line 529 | |||
if( (t_vec_state == 2) && ( x_n_rows == 1) ) | if( (t_vec_state == 2) && ( x_n_rows == 1) ) | |||
{ | { | |||
layout_ok = true; | layout_ok = true; | |||
} | } | |||
} | } | |||
if( (x_mem_state == 0) && (x_n_elem > arma_config::mat_prealloc) && (la yout_ok == true) ) | if( (x_mem_state == 0) && (x_n_elem > arma_config::mat_prealloc) && (la yout_ok == true) ) | |||
{ | { | |||
reset(); | reset(); | |||
// note: calling reset() also prevents fixed size matrices from chang ing size or using non-local memory | ||||
access::rw(n_rows) = x_n_rows; | access::rw(n_rows) = x_n_rows; | |||
access::rw(n_cols) = x_n_cols; | access::rw(n_cols) = x_n_cols; | |||
access::rw(n_elem) = x_n_elem; | access::rw(n_elem) = x_n_elem; | |||
access::rw(mem) = x.mem; | access::rw(mem) = x.mem; | |||
access::rw(x.n_rows) = 0; | access::rw(x.n_rows) = 0; | |||
access::rw(x.n_cols) = 0; | access::rw(x.n_cols) = 0; | |||
access::rw(x.n_elem) = 0; | access::rw(x.n_elem) = 0; | |||
access::rw(x.mem) = 0; | access::rw(x.mem) = 0; | |||
skipping to change at line 4528 | skipping to change at line 4529 | |||
typename Mat<eT>::const_row_iterator | typename Mat<eT>::const_row_iterator | |||
Mat<eT>::end_row(const u32 row_num) const | Mat<eT>::end_row(const u32 row_num) const | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
arma_debug_check( (row_num >= n_rows), "Mat::end_row(): index out of boun ds" ); | arma_debug_check( (row_num >= n_rows), "Mat::end_row(): index out of boun ds" ); | |||
return typename Mat<eT>::const_row_iterator(*this, row_num + 1); | return typename Mat<eT>::const_row_iterator(*this, row_num + 1); | |||
} | } | |||
//! resets this matrix to an empty matrix | ||||
template<typename eT> | ||||
inline | ||||
void | ||||
Mat<eT>::clear() | ||||
{ | ||||
reset(); | ||||
} | ||||
//! returns true if the matrix has no elements | ||||
template<typename eT> | ||||
inline | ||||
bool | ||||
Mat<eT>::empty() const | ||||
{ | ||||
return (n_elem == 0); | ||||
} | ||||
//! returns the number of elements in this matrix | ||||
template<typename eT> | ||||
inline | ||||
u32 | ||||
Mat<eT>::size() const | ||||
{ | ||||
return n_elem; | ||||
} | ||||
template<typename eT> | template<typename eT> | |||
template<u32 fixed_n_rows, u32 fixed_n_cols> | template<u32 fixed_n_rows, u32 fixed_n_cols> | |||
arma_inline | arma_inline | |||
void | void | |||
Mat<eT>::fixed<fixed_n_rows, fixed_n_cols>::mem_setup() | Mat<eT>::fixed<fixed_n_rows, fixed_n_cols>::mem_setup() | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
access::rw(Mat<eT>::n_rows) = fixed_n_rows; | access::rw(Mat<eT>::n_rows) = fixed_n_rows; | |||
access::rw(Mat<eT>::n_cols) = fixed_n_cols; | access::rw(Mat<eT>::n_cols) = fixed_n_cols; | |||
End of changes. 2 change blocks. | ||||
0 lines changed or deleted | 28 lines changed or added | |||
Row_bones.hpp | Row_bones.hpp | |||
---|---|---|---|---|
skipping to change at line 63 | skipping to change at line 63 | |||
arma_inline eT& col(const u32 col_num); | arma_inline eT& col(const u32 col_num); | |||
arma_inline eT col(const u32 col_num) const; | arma_inline eT col(const u32 col_num) const; | |||
arma_inline subview_row<eT> cols(const u32 in_col1, const u32 in_co l2); | arma_inline subview_row<eT> cols(const u32 in_col1, const u32 in_co l2); | |||
arma_inline const subview_row<eT> cols(const u32 in_col1, const u32 in_co l2) const; | arma_inline const subview_row<eT> cols(const u32 in_col1, const u32 in_co l2) const; | |||
arma_inline subview_row<eT> subvec(const u32 in_col1, const u32 in_ col2); | arma_inline subview_row<eT> subvec(const u32 in_col1, const u32 in_ col2); | |||
arma_inline const subview_row<eT> subvec(const u32 in_col1, const u32 in_ col2) const; | arma_inline const subview_row<eT> subvec(const u32 in_col1, const u32 in_ col2) const; | |||
arma_inline subview_row<eT> subvec(const span& col_span); | ||||
arma_inline const subview_row<eT> subvec(const span& col_span) const; | ||||
// arma_inline subview_row<eT> operator()(const span& col_span); | ||||
// arma_inline const subview_row<eT> operator()(const span& col_span) con | ||||
st; | ||||
inline void shed_col (const u32 col_num); | inline void shed_col (const u32 col_num); | |||
inline void shed_cols(const u32 in_col1, const u32 in_col2); | inline void shed_cols(const u32 in_col1, const u32 in_col2); | |||
inline void insert_cols(const u32 col_num, const u3 2 N, const bool set_to_zero = true); | inline void insert_cols(const u32 col_num, const u3 2 N, const bool set_to_zero = true); | |||
template<typename T1> inline void insert_cols(const u32 col_num, const Ba se<eT,T1>& X); | template<typename T1> inline void insert_cols(const u32 col_num, const Ba se<eT,T1>& X); | |||
typedef eT* row_iterator; | typedef eT* row_iterator; | |||
typedef const eT* const_row_iterator; | typedef const eT* const_row_iterator; | |||
inline row_iterator begin_row(const u32 row_num); | inline row_iterator begin_row(const u32 row_num); | |||
End of changes. 1 change blocks. | ||||
0 lines changed or deleted | 7 lines changed or added | |||
Row_meat.hpp | Row_meat.hpp | |||
---|---|---|---|---|
skipping to change at line 301 | skipping to change at line 301 | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
arma_debug_check( ( (in_col1 > in_col2) || (in_col2 >= Mat<eT>::n_cols) ) , "Row::subvec(): indices out of bounds or incorrectly used"); | arma_debug_check( ( (in_col1 > in_col2) || (in_col2 >= Mat<eT>::n_cols) ) , "Row::subvec(): indices out of bounds or incorrectly used"); | |||
const u32 subview_n_cols = in_col2 - in_col1 + 1; | const u32 subview_n_cols = in_col2 - in_col1 + 1; | |||
return subview_row<eT>(*this, 0, in_col1, subview_n_cols); | return subview_row<eT>(*this, 0, in_col1, subview_n_cols); | |||
} | } | |||
template<typename eT> | ||||
arma_inline | ||||
subview_row<eT> | ||||
Row<eT>::subvec(const span& col_span) | ||||
{ | ||||
arma_extra_debug_sigprint(); | ||||
const bool col_all = col_span.whole; | ||||
const u32 local_n_cols = Mat<eT>::n_cols; | ||||
const u32 in_col1 = col_all ? 0 : col_span.a; | ||||
const u32 in_col2 = col_span.b; | ||||
const u32 subvec_n_cols = col_all ? local_n_cols : in_col2 - in_col1 + 1; | ||||
arma_debug_check( ( col_all ? false : ((in_col1 > in_col2) || (in_col2 >= | ||||
local_n_cols)) ), "Row::subvec(): indices out of bounds or incorrectly use | ||||
d"); | ||||
return subview_row<eT>(*this, 0, in_col1, subvec_n_cols); | ||||
} | ||||
template<typename eT> | ||||
arma_inline | ||||
const subview_row<eT> | ||||
Row<eT>::subvec(const span& col_span) const | ||||
{ | ||||
arma_extra_debug_sigprint(); | ||||
const bool col_all = col_span.whole; | ||||
const u32 local_n_cols = Mat<eT>::n_cols; | ||||
const u32 in_col1 = col_all ? 0 : col_span.a; | ||||
const u32 in_col2 = col_span.b; | ||||
const u32 subvec_n_cols = col_all ? local_n_cols : in_col2 - in_col1 + 1; | ||||
arma_debug_check( ( col_all ? false : ((in_col1 > in_col2) || (in_col2 >= | ||||
local_n_cols)) ), "Row::subvec(): indices out of bounds or incorrectly use | ||||
d"); | ||||
return subview_row<eT>(*this, 0, in_col1, subvec_n_cols); | ||||
} | ||||
// template<typename eT> | ||||
// arma_inline | ||||
// subview_row<eT> | ||||
// Row<eT>::operator()(const span& col_span) | ||||
// { | ||||
// arma_extra_debug_sigprint(); | ||||
// | ||||
// return subvec(col_span); | ||||
// } | ||||
// | ||||
// | ||||
// | ||||
// template<typename eT> | ||||
// arma_inline | ||||
// const subview_row<eT> | ||||
// Row<eT>::operator()(const span& col_span) const | ||||
// { | ||||
// arma_extra_debug_sigprint(); | ||||
// | ||||
// return subvec(col_span); | ||||
// } | ||||
//! remove specified columns | //! remove specified columns | |||
template<typename eT> | template<typename eT> | |||
inline | inline | |||
void | void | |||
Row<eT>::shed_col(const u32 col_num) | Row<eT>::shed_col(const u32 col_num) | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
arma_debug_check( col_num >= Mat<eT>::n_cols, "Row::shed_col(): out of bo unds"); | arma_debug_check( col_num >= Mat<eT>::n_cols, "Row::shed_col(): out of bo unds"); | |||
skipping to change at line 346 | skipping to change at line 408 | |||
if(n_keep_front > 0) | if(n_keep_front > 0) | |||
{ | { | |||
arrayops::copy( X_mem, t_mem, n_keep_front ); | arrayops::copy( X_mem, t_mem, n_keep_front ); | |||
} | } | |||
if(n_keep_back > 0) | if(n_keep_back > 0) | |||
{ | { | |||
arrayops::copy( &(X_mem[n_keep_front]), &(t_mem[in_col2+1]), n_keep_bac k); | arrayops::copy( &(X_mem[n_keep_front]), &(t_mem[in_col2+1]), n_keep_bac k); | |||
} | } | |||
steal_mem(X); | Mat<eT>::steal_mem(X); | |||
} | } | |||
//! insert N cols at the specified col position, | //! insert N cols at the specified col position, | |||
//! optionally setting the elements of the inserted cols to zero | //! optionally setting the elements of the inserted cols to zero | |||
template<typename eT> | template<typename eT> | |||
inline | inline | |||
void | void | |||
Row<eT>::insert_cols(const u32 col_num, const u32 N, const bool set_to_zero ) | Row<eT>::insert_cols(const u32 col_num, const u32 N, const bool set_to_zero ) | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
skipping to change at line 388 | skipping to change at line 450 | |||
if(B_n_cols > 0) | if(B_n_cols > 0) | |||
{ | { | |||
arrayops::copy( &(out_mem[col_num + N]), &(t_mem[col_num]), B_n_cols ); | arrayops::copy( &(out_mem[col_num + N]), &(t_mem[col_num]), B_n_cols ); | |||
} | } | |||
if(set_to_zero == true) | if(set_to_zero == true) | |||
{ | { | |||
arrayops::inplace_set( &(out_mem[col_num]), eT(0), N ); | arrayops::inplace_set( &(out_mem[col_num]), eT(0), N ); | |||
} | } | |||
steal_mem(out); | Mat<eT>::steal_mem(out); | |||
} | } | |||
} | } | |||
//! insert the given object at the specified col position; | //! insert the given object at the specified col position; | |||
//! the given object must have one row | //! the given object must have one row | |||
template<typename eT> | template<typename eT> | |||
template<typename T1> | template<typename T1> | |||
inline | inline | |||
void | void | |||
Row<eT>::insert_cols(const u32 col_num, const Base<eT,T1>& X) | Row<eT>::insert_cols(const u32 col_num, const Base<eT,T1>& X) | |||
End of changes. 3 change blocks. | ||||
2 lines changed or deleted | 68 lines changed or added | |||
arma_static_assert.hpp | arma_static_assert.hpp | |||
---|---|---|---|---|
skipping to change at line 17 | skipping to change at line 17 | |||
// and/or modify it under the terms of the GNU | // and/or modify it under the terms of the GNU | |||
// Lesser General Public License (LGPL) as published | // Lesser General Public License (LGPL) as published | |||
// by the Free Software Foundation, either version 3 | // by the Free Software Foundation, either version 3 | |||
// of the License or (at your option) any later version. | // of the License or (at your option) any later version. | |||
// (see http://www.opensource.org/licenses for more info) | // (see http://www.opensource.org/licenses for more info) | |||
//! \addtogroup arma_static_assert | //! \addtogroup arma_static_assert | |||
//! @{ | //! @{ | |||
//! Classes for primitive compile time assertions and checks (until the nex t version of C++) | //! Classes for primitive compile time assertions and checks (until the nex t version of C++) | |||
template<bool> struct arma_static_assert; | template<bool x> | |||
template<> struct arma_static_assert<true> {}; | struct arma_static_assert | |||
{ | ||||
static const char | ||||
static_error[ x ? +1 : -1 ]; | ||||
}; | ||||
template<bool> struct arma_static_check; | template<bool x> | |||
template<> struct arma_static_check<false> {}; | struct arma_static_check | |||
{ | ||||
static const char | ||||
static_error[ x ? -1 : +1 ]; | ||||
}; | ||||
template<bool val> | template<bool val> | |||
struct arma_type_check | struct arma_type_check | |||
{ | { | |||
arma_inline | arma_inline | |||
static | static | |||
void | void | |||
apply() | apply() | |||
{ | { | |||
arma_static_check<val> ERROR___INCORRECT_TYPE; | arma_static_check<val> ERROR___INCORRECT_TYPE; | |||
End of changes. 2 change blocks. | ||||
4 lines changed or deleted | 12 lines changed or added | |||
arma_version.hpp | arma_version.hpp | |||
---|---|---|---|---|
skipping to change at line 17 | skipping to change at line 17 | |||
// and/or modify it under the terms of the GNU | // and/or modify it under the terms of the GNU | |||
// Lesser General Public License (LGPL) as published | // Lesser General Public License (LGPL) as published | |||
// by the Free Software Foundation, either version 3 | // by the Free Software Foundation, either version 3 | |||
// of the License or (at your option) any later version. | // of the License or (at your option) any later version. | |||
// (see http://www.opensource.org/licenses for more info) | // (see http://www.opensource.org/licenses for more info) | |||
//! \addtogroup arma_version | //! \addtogroup arma_version | |||
//! @{ | //! @{ | |||
#define ARMA_VERSION_MAJOR 2 | #define ARMA_VERSION_MAJOR 2 | |||
#define ARMA_VERSION_MINOR 0 | #define ARMA_VERSION_MINOR 1 | |||
#define ARMA_VERSION_PATCH 4 | #define ARMA_VERSION_PATCH 91 | |||
#define ARMA_VERSION_NAME "Carnivorous Sugar Glider" | #define ARMA_VERSION_NAME "2.2 beta 1" | |||
// http://en.wikipedia.org/wiki/Sugar_glider | ||||
struct arma_version | struct arma_version | |||
{ | { | |||
static const unsigned int major = ARMA_VERSION_MAJOR; | static const unsigned int major = ARMA_VERSION_MAJOR; | |||
static const unsigned int minor = ARMA_VERSION_MINOR; | static const unsigned int minor = ARMA_VERSION_MINOR; | |||
static const unsigned int patch = ARMA_VERSION_PATCH; | static const unsigned int patch = ARMA_VERSION_PATCH; | |||
static | static | |||
inline | inline | |||
std::string | std::string | |||
End of changes. 1 change blocks. | ||||
4 lines changed or deleted | 3 lines changed or added | |||
auxlib_bones.hpp | auxlib_bones.hpp | |||
---|---|---|---|---|
skipping to change at line 151 | skipping to change at line 151 | |||
template<typename T, typename T1> | template<typename T, typename T1> | |||
inline static bool svd(Col<T>& S, const Base<std::complex<T>, T1>& X); | inline static bool svd(Col<T>& S, const Base<std::complex<T>, T1>& X); | |||
template<typename eT, typename T1> | template<typename eT, typename T1> | |||
inline static bool svd(Mat<eT>& U, Col<eT>& S, Mat<eT>& V, const Base<eT, T1>& X); | inline static bool svd(Mat<eT>& U, Col<eT>& S, Mat<eT>& V, const Base<eT, T1>& X); | |||
template<typename T, typename T1> | template<typename T, typename T1> | |||
inline static bool svd(Mat< std::complex<T> >& U, Col<T>& S, Mat< std::co mplex<T> >& V, const Base< std::complex<T>, T1>& X); | inline static bool svd(Mat< std::complex<T> >& U, Col<T>& S, Mat< std::co mplex<T> >& V, const Base< std::complex<T>, T1>& X); | |||
template<typename eT, typename T1> | ||||
inline static bool svd_thin(Mat<eT>& U, Col<eT>& S, Mat<eT>& V, const Bas | ||||
e<eT,T1>& X, const char mode); | ||||
template<typename T, typename T1> | ||||
inline static bool svd_thin(Mat< std::complex<T> >& U, Col<T>& S, Mat< st | ||||
d::complex<T> >& V, const Base< std::complex<T>, T1>& X, const char mode); | ||||
// | // | |||
// solve | // solve | |||
template<typename eT> | template<typename eT> | |||
inline static bool solve (Mat<eT>& out, Mat<eT>& A, const Mat<eT>& B, c onst bool slow = false); | inline static bool solve (Mat<eT>& out, Mat<eT>& A, const Mat<eT>& B, c onst bool slow = false); | |||
template<typename eT> | template<typename eT> | |||
inline static bool solve_od(Mat<eT>& out, Mat<eT>& A, const Mat<eT>& B); | inline static bool solve_od(Mat<eT>& out, Mat<eT>& A, const Mat<eT>& B); | |||
template<typename eT> | template<typename eT> | |||
End of changes. 1 change blocks. | ||||
0 lines changed or deleted | 8 lines changed or added | |||
auxlib_meat.hpp | auxlib_meat.hpp | |||
---|---|---|---|---|
skipping to change at line 2047 | skipping to change at line 2047 | |||
arma_ignore(S); | arma_ignore(S); | |||
arma_ignore(V); | arma_ignore(V); | |||
arma_ignore(X); | arma_ignore(X); | |||
arma_stop("svd(): use of LAPACK needs to be enabled"); | arma_stop("svd(): use of LAPACK needs to be enabled"); | |||
return false; | return false; | |||
} | } | |||
#endif | #endif | |||
} | } | |||
template<typename eT, typename T1> | ||||
inline | ||||
bool | ||||
auxlib::svd_thin(Mat<eT>& U, Col<eT>& S, Mat<eT>& V, const Base<eT,T1>& X, | ||||
const char mode) | ||||
{ | ||||
arma_extra_debug_sigprint(); | ||||
#if defined(ARMA_USE_LAPACK) | ||||
{ | ||||
Mat<eT> A(X.get_ref()); | ||||
blas_int m = A.n_rows; | ||||
blas_int n = A.n_cols; | ||||
blas_int lda = A.n_rows; | ||||
S.set_size( static_cast<u32>((std::min)(m,n)) ); | ||||
blas_int ldu = 0; | ||||
blas_int ldvt = 0; | ||||
char jobu; | ||||
char jobvt; | ||||
switch(mode) | ||||
{ | ||||
case 'l': | ||||
jobu = 'S'; | ||||
jobvt = 'N'; | ||||
ldu = m; | ||||
ldvt = 1; | ||||
U.set_size( static_cast<u32>(ldu), static_cast<u32>((std::min)(m,n) | ||||
) ); | ||||
V.reset(); | ||||
break; | ||||
case 'r': | ||||
jobu = 'N'; | ||||
jobvt = 'S'; | ||||
ldu = 1; | ||||
ldvt = (std::min)(m,n); | ||||
U.reset(); | ||||
V.set_size( static_cast<u32>(ldvt), static_cast<u32>(n) ); | ||||
break; | ||||
case 'b': | ||||
jobu = 'S'; | ||||
jobvt = 'S'; | ||||
ldu = m; | ||||
ldvt = (std::min)(m,n); | ||||
U.set_size( static_cast<u32>(ldu), static_cast<u32>((std::min)(m,n | ||||
)) ); | ||||
V.set_size( static_cast<u32>(ldvt), static_cast<u32>(n) | ||||
); | ||||
break; | ||||
default: | ||||
U.reset(); | ||||
S.reset(); | ||||
V.reset(); | ||||
return false; | ||||
} | ||||
if(A.is_empty()) | ||||
{ | ||||
U.eye(); | ||||
S.reset(); | ||||
V.eye(); | ||||
return true; | ||||
} | ||||
blas_int lwork = 2 * (std::max)(blas_int(1), (std::max)( (3*(std::min)( | ||||
m,n) + (std::max)(m,n)), 5*(std::min)(m,n) ) ); | ||||
blas_int info = 0; | ||||
podarray<eT> work( static_cast<u32>(lwork) ); | ||||
// let gesvd_() calculate the optimum size of the workspace | ||||
blas_int lwork_tmp = -1; | ||||
lapack::gesvd<eT> | ||||
( | ||||
&jobu, &jobvt, | ||||
&m, &n, | ||||
A.memptr(), &lda, | ||||
S.memptr(), | ||||
U.memptr(), &ldu, | ||||
V.memptr(), &ldvt, | ||||
work.memptr(), &lwork_tmp, | ||||
&info | ||||
); | ||||
if(info == 0) | ||||
{ | ||||
blas_int proposed_lwork = static_cast<blas_int>(work[0]); | ||||
if(proposed_lwork > lwork) | ||||
{ | ||||
lwork = proposed_lwork; | ||||
work.set_size( static_cast<u32>(lwork) ); | ||||
} | ||||
lapack::gesvd<eT> | ||||
( | ||||
&jobu, &jobvt, | ||||
&m, &n, | ||||
A.memptr(), &lda, | ||||
S.memptr(), | ||||
U.memptr(), &ldu, | ||||
V.memptr(), &ldvt, | ||||
work.memptr(), &lwork, | ||||
&info | ||||
); | ||||
op_strans::apply(V,V); // op_strans will work out that an in-place t | ||||
ranspose can be done | ||||
} | ||||
return (info == 0); | ||||
} | ||||
#else | ||||
{ | ||||
arma_ignore(U); | ||||
arma_ignore(S); | ||||
arma_ignore(V); | ||||
arma_ignore(X); | ||||
arma_ignore(mode); | ||||
arma_stop("svd(): use of LAPACK needs to be enabled"); | ||||
return false; | ||||
} | ||||
#endif | ||||
} | ||||
template<typename T, typename T1> | ||||
inline | ||||
bool | ||||
auxlib::svd_thin(Mat< std::complex<T> >& U, Col<T>& S, Mat< std::complex<T> | ||||
>& V, const Base< std::complex<T>, T1>& X, const char mode) | ||||
{ | ||||
arma_extra_debug_sigprint(); | ||||
typedef std::complex<T> eT; | ||||
#if defined(ARMA_USE_LAPACK) | ||||
{ | ||||
Mat<eT> A(X.get_ref()); | ||||
blas_int m = A.n_rows; | ||||
blas_int n = A.n_cols; | ||||
blas_int lda = A.n_rows; | ||||
S.set_size( static_cast<u32>((std::min)(m,n)) ); | ||||
blas_int ldu = 0; | ||||
blas_int ldvt = 0; | ||||
char jobu; | ||||
char jobvt; | ||||
switch(mode) | ||||
{ | ||||
case 'l': | ||||
jobu = 'S'; | ||||
jobvt = 'N'; | ||||
ldu = m; | ||||
ldvt = 1; | ||||
U.set_size( static_cast<u32>(ldu), static_cast<u32>((std::min)(m,n) | ||||
) ); | ||||
V.reset(); | ||||
break; | ||||
case 'r': | ||||
jobu = 'N'; | ||||
jobvt = 'S'; | ||||
ldu = 1; | ||||
ldvt = (std::min)(m,n); | ||||
U.reset(); | ||||
V.set_size( static_cast<u32>(ldvt), static_cast<u32>(n) ); | ||||
break; | ||||
case 'b': | ||||
jobu = 'S'; | ||||
jobvt = 'S'; | ||||
ldu = m; | ||||
ldvt = (std::min)(m,n); | ||||
U.set_size( static_cast<u32>(ldu), static_cast<u32>((std::min)(m,n | ||||
)) ); | ||||
V.set_size( static_cast<u32>(ldvt), static_cast<u32>(n) | ||||
); | ||||
break; | ||||
default: | ||||
U.reset(); | ||||
S.reset(); | ||||
V.reset(); | ||||
return false; | ||||
} | ||||
if(A.is_empty()) | ||||
{ | ||||
U.eye(); | ||||
S.reset(); | ||||
V.eye(); | ||||
return true; | ||||
} | ||||
blas_int lwork = 2 * (std::max)(blas_int(1), (std::max)( (3*(std::min)( | ||||
m,n) + (std::max)(m,n)), 5*(std::min)(m,n) ) ); | ||||
blas_int info = 0; | ||||
podarray<eT> work( static_cast<u32>(lwork) ); | ||||
podarray<T> rwork( static_cast<u32>(5*(std::min)(m,n)) ); | ||||
// let gesvd_() calculate the optimum size of the workspace | ||||
blas_int lwork_tmp = -1; | ||||
lapack::cx_gesvd<T> | ||||
( | ||||
&jobu, &jobvt, | ||||
&m, &n, | ||||
A.memptr(), &lda, | ||||
S.memptr(), | ||||
U.memptr(), &ldu, | ||||
V.memptr(), &ldvt, | ||||
work.memptr(), &lwork_tmp, | ||||
rwork.memptr(), | ||||
&info | ||||
); | ||||
if(info == 0) | ||||
{ | ||||
blas_int proposed_lwork = static_cast<blas_int>(real(work[0])); | ||||
if(proposed_lwork > lwork) | ||||
{ | ||||
lwork = proposed_lwork; | ||||
work.set_size( static_cast<u32>(lwork) ); | ||||
} | ||||
lapack::cx_gesvd<T> | ||||
( | ||||
&jobu, &jobvt, | ||||
&m, &n, | ||||
A.memptr(), &lda, | ||||
S.memptr(), | ||||
U.memptr(), &ldu, | ||||
V.memptr(), &ldvt, | ||||
work.memptr(), &lwork, | ||||
rwork.memptr(), | ||||
&info | ||||
); | ||||
op_htrans::apply(V,V); // op_strans will work out that an in-place t | ||||
ranspose can be done | ||||
} | ||||
return (info == 0); | ||||
} | ||||
#else | ||||
{ | ||||
arma_ignore(U); | ||||
arma_ignore(S); | ||||
arma_ignore(V); | ||||
arma_ignore(X); | ||||
arma_ignore(mode); | ||||
arma_stop("svd(): use of LAPACK needs to be enabled"); | ||||
return false; | ||||
} | ||||
#endif | ||||
} | ||||
//! Solve a system of linear equations. | //! Solve a system of linear equations. | |||
//! Assumes that A.n_rows = A.n_cols and B.n_rows = A.n_rows | //! Assumes that A.n_rows = A.n_cols and B.n_rows = A.n_rows | |||
template<typename eT> | template<typename eT> | |||
inline | inline | |||
bool | bool | |||
auxlib::solve(Mat<eT>& out, Mat<eT>& A, const Mat<eT>& B, const bool slow) | auxlib::solve(Mat<eT>& out, Mat<eT>& A, const Mat<eT>& B, const bool slow) | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
if(A.is_empty() || B.is_empty()) | if(A.is_empty() || B.is_empty()) | |||
End of changes. 1 change blocks. | ||||
0 lines changed or deleted | 287 lines changed or added | |||
config.hpp | config.hpp | |||
---|---|---|---|---|
skipping to change at line 76 | skipping to change at line 76 | |||
#define ARMA_HAVE_LOG1P | #define ARMA_HAVE_LOG1P | |||
#define ARMA_HAVE_GETTIMEOFDAY | #define ARMA_HAVE_GETTIMEOFDAY | |||
// #define ARMA_EXTRA_DEBUG | // #define ARMA_EXTRA_DEBUG | |||
// #define ARMA_NO_DEBUG | // #define ARMA_NO_DEBUG | |||
#if defined(ARMA_DONT_USE_ATLAS) | #if defined(ARMA_DONT_USE_ATLAS) | |||
#undef ARMA_USE_ATLAS | #undef ARMA_USE_ATLAS | |||
#undef ARMA_ATLAS_INCLUDE_DIR | #undef ARMA_ATLAS_INCLUDE_DIR | |||
#endif | #endif | |||
#if defined(ARMA_DONT_USE_LAPACK) | ||||
#undef ARMA_USE_LAPACK | ||||
#endif | ||||
#if defined(ARMA_DONT_USE_BLAS) | ||||
#undef ARMA_USE_BLAS | ||||
#endif | ||||
#if defined(ARMA_DONT_PRINT_LOGIC_ERRORS) | ||||
#undef ARMA_PRINT_LOGIC_ERRORS | ||||
#endif | ||||
#if defined(ARMA_DONT_PRINT_RUNTIME_ERRORS) | ||||
#undef ARMA_PRINT_RUNTIME_ERRORS | ||||
#endif | ||||
End of changes. 1 change blocks. | ||||
0 lines changed or deleted | 0 lines changed or added | |||
diskio_meat.hpp | diskio_meat.hpp | |||
---|---|---|---|---|
skipping to change at line 1598 | skipping to change at line 1598 | |||
case raw_ascii: | case raw_ascii: | |||
return load_raw_ascii(x, f, err_msg); | return load_raw_ascii(x, f, err_msg); | |||
break; | break; | |||
default: | default: | |||
err_msg = "unknown data in "; | err_msg = "unknown data in "; | |||
return false; | return false; | |||
} | } | |||
} | } | |||
return false; | ||||
} | } | |||
// cubes | // cubes | |||
//! Save a cube as raw text (no header, human readable). | //! Save a cube as raw text (no header, human readable). | |||
template<typename eT> | template<typename eT> | |||
inline | inline | |||
bool | bool | |||
diskio::save_raw_ascii(const Cube<eT>& x, const std::string& final_name) | diskio::save_raw_ascii(const Cube<eT>& x, const std::string& final_name) | |||
{ | { | |||
skipping to change at line 2172 | skipping to change at line 2174 | |||
case raw_ascii: | case raw_ascii: | |||
return load_raw_ascii(x, f, err_msg); | return load_raw_ascii(x, f, err_msg); | |||
break; | break; | |||
default: | default: | |||
err_msg = "unknown data in "; | err_msg = "unknown data in "; | |||
return false; | return false; | |||
} | } | |||
} | } | |||
return false; | ||||
} | } | |||
// fields | // fields | |||
template<typename T1> | template<typename T1> | |||
inline | inline | |||
bool | bool | |||
diskio::save_arma_binary(const field<T1>& x, const std::string& final_name) | diskio::save_arma_binary(const field<T1>& x, const std::string& final_name) | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
End of changes. 2 change blocks. | ||||
0 lines changed or deleted | 4 lines changed or added | |||
fn_as_scalar.hpp | fn_as_scalar.hpp | |||
---|---|---|---|---|
skipping to change at line 79 | skipping to change at line 79 | |||
const Mat<eT>& A = tmp1.M; | const Mat<eT>& A = tmp1.M; | |||
const Mat<eT>& B = tmp2.M; | const Mat<eT>& B = tmp2.M; | |||
const u32 A_n_rows = (tmp1.do_trans == false) ? A.n_rows : A.n_cols; | const u32 A_n_rows = (tmp1.do_trans == false) ? A.n_rows : A.n_cols; | |||
const u32 A_n_cols = (tmp1.do_trans == false) ? A.n_cols : A.n_rows; | const u32 A_n_cols = (tmp1.do_trans == false) ? A.n_cols : A.n_rows; | |||
const u32 B_n_rows = (tmp2.do_trans == false) ? B.n_rows : B.n_cols; | const u32 B_n_rows = (tmp2.do_trans == false) ? B.n_rows : B.n_cols; | |||
const u32 B_n_cols = (tmp2.do_trans == false) ? B.n_cols : B.n_rows; | const u32 B_n_cols = (tmp2.do_trans == false) ? B.n_cols : B.n_rows; | |||
const eT val = tmp1.val * tmp2.val; | const eT val = tmp1.get_val() * tmp2.get_val(); | |||
arma_debug_check( (A_n_rows != 1) || (B_n_cols != 1) || (A_n_cols != B_n_ rows), "as_scalar(): incompatible dimensions" ); | arma_debug_check( (A_n_rows != 1) || (B_n_cols != 1) || (A_n_cols != B_n_ rows), "as_scalar(): incompatible dimensions" ); | |||
return val * op_dot::direct_dot(A.n_elem, A.mem, B.mem); | return val * op_dot::direct_dot(A.n_elem, A.mem, B.mem); | |||
} | } | |||
template<typename T1, typename T2, typename T3> | template<typename T1, typename T2, typename T3> | |||
inline | inline | |||
typename T1::elem_type | typename T1::elem_type | |||
as_scalar_redirect<3>::apply(const Glue< Glue<T1, T2, glue_times>, T3, glue _times >& X) | as_scalar_redirect<3>::apply(const Glue< Glue<T1, T2, glue_times>, T3, glue _times >& X) | |||
skipping to change at line 126 | skipping to change at line 126 | |||
{ | { | |||
const u32 A_n_rows = (tmp1.do_trans == false) ? A.n_rows : A.n_cols; | const u32 A_n_rows = (tmp1.do_trans == false) ? A.n_rows : A.n_cols; | |||
const u32 A_n_cols = (tmp1.do_trans == false) ? A.n_cols : A.n_rows; | const u32 A_n_cols = (tmp1.do_trans == false) ? A.n_cols : A.n_rows; | |||
const u32 B_n_rows = (tmp2.do_trans == false) ? B.n_rows : B.n_cols; | const u32 B_n_rows = (tmp2.do_trans == false) ? B.n_rows : B.n_cols; | |||
const u32 B_n_cols = (tmp2.do_trans == false) ? B.n_cols : B.n_rows; | const u32 B_n_cols = (tmp2.do_trans == false) ? B.n_cols : B.n_rows; | |||
const u32 C_n_rows = (tmp3.do_trans == false) ? C.n_rows : C.n_cols; | const u32 C_n_rows = (tmp3.do_trans == false) ? C.n_rows : C.n_cols; | |||
const u32 C_n_cols = (tmp3.do_trans == false) ? C.n_cols : C.n_rows; | const u32 C_n_cols = (tmp3.do_trans == false) ? C.n_cols : C.n_rows; | |||
const eT val = tmp1.val * tmp2.val * tmp3.val; | const eT val = tmp1.get_val() * tmp2.get_val() * tmp3.get_val(); | |||
arma_debug_check | arma_debug_check | |||
( | ( | |||
(A_n_rows != 1) || | (A_n_rows != 1) || | |||
(C_n_cols != 1) || | (C_n_cols != 1) || | |||
(A_n_cols != B_n_rows) || | (A_n_cols != B_n_rows) || | |||
(B_n_cols != C_n_rows) | (B_n_cols != C_n_rows) | |||
, | , | |||
"as_scalar(): incompatible dimensions" | "as_scalar(): incompatible dimensions" | |||
); | ); | |||
skipping to change at line 181 | skipping to change at line 181 | |||
const u32 A_n_cols = (tmp1.do_trans == false) ? A.n_cols : A.n_rows; | const u32 A_n_cols = (tmp1.do_trans == false) ? A.n_cols : A.n_rows; | |||
const bool B_is_vec = B.is_vec(); | const bool B_is_vec = B.is_vec(); | |||
const u32 B_n_rows = (B_is_vec == true) ? B.n_elem : ( (tmp2.do_trans = = false) ? B.n_rows : B.n_cols ); | const u32 B_n_rows = (B_is_vec == true) ? B.n_elem : ( (tmp2.do_trans = = false) ? B.n_rows : B.n_cols ); | |||
const u32 B_n_cols = (B_is_vec == true) ? B.n_elem : ( (tmp2.do_trans = = false) ? B.n_cols : B.n_rows ); | const u32 B_n_cols = (B_is_vec == true) ? B.n_elem : ( (tmp2.do_trans = = false) ? B.n_cols : B.n_rows ); | |||
const u32 C_n_rows = (tmp3.do_trans == false) ? C.n_rows : C.n_cols; | const u32 C_n_rows = (tmp3.do_trans == false) ? C.n_rows : C.n_cols; | |||
const u32 C_n_cols = (tmp3.do_trans == false) ? C.n_cols : C.n_rows; | const u32 C_n_cols = (tmp3.do_trans == false) ? C.n_cols : C.n_rows; | |||
const eT val = tmp1.val * tmp2.val * tmp3.val; | const eT val = tmp1.get_val() * tmp2.get_val() * tmp3.get_val(); | |||
arma_debug_check | arma_debug_check | |||
( | ( | |||
(A_n_rows != 1) || | (A_n_rows != 1) || | |||
(C_n_cols != 1) || | (C_n_cols != 1) || | |||
(A_n_cols != B_n_rows) || | (A_n_cols != B_n_rows) || | |||
(B_n_cols != C_n_rows) | (B_n_cols != C_n_rows) | |||
, | , | |||
"as_scalar(): incompatible dimensions" | "as_scalar(): incompatible dimensions" | |||
); | ); | |||
skipping to change at line 270 | skipping to change at line 270 | |||
const u32 A_n_cols = (tmp1.do_trans == false) ? A.n_cols : A.n_rows; | const u32 A_n_cols = (tmp1.do_trans == false) ? A.n_cols : A.n_rows; | |||
const bool B_is_vec = B.is_vec(); | const bool B_is_vec = B.is_vec(); | |||
const u32 B_n_rows = (B_is_vec == true) ? B.n_elem : ( (tmp2.do_trans == false) ? B.n_rows : B.n_cols ); | const u32 B_n_rows = (B_is_vec == true) ? B.n_elem : ( (tmp2.do_trans == false) ? B.n_rows : B.n_cols ); | |||
const u32 B_n_cols = (B_is_vec == true) ? B.n_elem : ( (tmp2.do_trans == false) ? B.n_cols : B.n_rows ); | const u32 B_n_cols = (B_is_vec == true) ? B.n_elem : ( (tmp2.do_trans == false) ? B.n_cols : B.n_rows ); | |||
const u32 C_n_rows = (tmp3.do_trans == false) ? C.n_rows : C.n_cols; | const u32 C_n_rows = (tmp3.do_trans == false) ? C.n_rows : C.n_cols; | |||
const u32 C_n_cols = (tmp3.do_trans == false) ? C.n_cols : C.n_rows; | const u32 C_n_cols = (tmp3.do_trans == false) ? C.n_cols : C.n_rows; | |||
const eT val = tmp1.val * tmp2.val * tmp3.val; | const eT val = tmp1.get_val() * tmp2.get_val() * tmp3.get_val(); | |||
arma_debug_check | arma_debug_check | |||
( | ( | |||
(A_n_rows != 1) || | (A_n_rows != 1) || | |||
(C_n_cols != 1) || | (C_n_cols != 1) || | |||
(A_n_cols != B_n_rows) || | (A_n_cols != B_n_rows) || | |||
(B_n_cols != C_n_rows) | (B_n_cols != C_n_rows) | |||
, | , | |||
"as_scalar(): incompatible dimensions" | "as_scalar(): incompatible dimensions" | |||
); | ); | |||
End of changes. 4 change blocks. | ||||
4 lines changed or deleted | 4 lines changed or added | |||
fn_det.hpp | fn_det.hpp | |||
---|---|---|---|---|
skipping to change at line 97 | skipping to change at line 97 | |||
//! determinant of trans(A) | //! determinant of trans(A) | |||
template<typename T1> | template<typename T1> | |||
inline | inline | |||
arma_warn_unused | arma_warn_unused | |||
typename T1::elem_type | typename T1::elem_type | |||
det | det | |||
( | ( | |||
const Op<T1,op_htrans>& in, | const Op<T1,op_htrans>& in, | |||
const bool slow = false, | const bool slow = false, | |||
const typename arma_blas_type_only<typename T1::elem_type>::result* junk1 | const typename arma_blas_type_only<typename T1::elem_type>::result* junk | |||
= 0, | = 0) | |||
const typename arma_not_cx<typename T1::elem_type>::result* junk2 | ||||
= 0 | ||||
) | ||||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
arma_ignore(junk1); | arma_ignore(junk); | |||
arma_ignore(junk2); | ||||
typedef typename T1::elem_type eT; | typedef typename T1::elem_type eT; | |||
const unwrap<T1> tmp(in.m); | const unwrap<T1> tmp(in.m); | |||
const Mat<eT>& X = tmp.M; | const Mat<eT>& X = tmp.M; | |||
return det(X, slow); | return det(X, slow); | |||
} | } | |||
//! @} | //! @} | |||
End of changes. 2 change blocks. | ||||
7 lines changed or deleted | 3 lines changed or added | |||
fn_norm.hpp | fn_norm.hpp | |||
---|---|---|---|---|
skipping to change at line 25 | skipping to change at line 25 | |||
template<typename T1> | template<typename T1> | |||
arma_hot | arma_hot | |||
inline | inline | |||
typename T1::pod_type | typename T1::pod_type | |||
arma_vec_norm_1(const Proxy<T1>& A) | arma_vec_norm_1(const Proxy<T1>& A) | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
typedef typename T1::pod_type T; | typedef typename T1::pod_type T; | |||
typedef typename Proxy<T1>::ea_type ea_type; | ||||
T acc = T(0); | T acc = T(0); | |||
ea_type P = A.get_ea(); | if(Proxy<T1>::prefer_at_accessor == false) | |||
const u32 N = A.get_n_elem(); | { | |||
typename Proxy<T1>::ea_type P = A.get_ea(); | ||||
u32 i,j; | const u32 N = A.get_n_elem(); | |||
for(i=0, j=1; j<N; i+=2, j+=2) | u32 i,j; | |||
{ | ||||
acc += std::abs(P[i]); | for(i=0, j=1; j<N; i+=2, j+=2) | |||
acc += std::abs(P[j]); | { | |||
} | acc += std::abs(P[i]); | |||
acc += std::abs(P[j]); | ||||
} | ||||
if(i < N) | if(i < N) | |||
{ | ||||
acc += std::abs(P[i]); | ||||
} | ||||
} | ||||
else | ||||
{ | { | |||
acc += std::abs(P[i]); | const u32 n_rows = A.get_n_rows(); | |||
const u32 n_cols = A.get_n_cols(); | ||||
for(u32 col=0; col<n_cols; ++col) | ||||
{ | ||||
u32 i,j; | ||||
for(i=0, j=1; j<n_rows; i+=2, j+=2) | ||||
{ | ||||
acc += std::abs(A.at(i,col)); | ||||
acc += std::abs(A.at(j,col)); | ||||
} | ||||
if(i < n_rows) | ||||
{ | ||||
acc += std::abs(A.at(i,col)); | ||||
} | ||||
} | ||||
} | } | |||
return acc; | return acc; | |||
} | } | |||
template<typename T1> | template<typename T1> | |||
arma_hot | arma_hot | |||
inline | inline | |||
typename T1::pod_type | typename T1::pod_type | |||
arma_vec_norm_2(const Proxy<T1>& A, const typename arma_not_cx<typename T1: :elem_type>::result* junk = 0) | arma_vec_norm_2(const Proxy<T1>& A, const typename arma_not_cx<typename T1: :elem_type>::result* junk = 0) | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
arma_ignore(junk); | arma_ignore(junk); | |||
typedef typename T1::pod_type T; | typedef typename T1::pod_type T; | |||
typedef typename Proxy<T1>::ea_type ea_type; | ||||
T acc = T(0); | T acc = T(0); | |||
ea_type P = A.get_ea(); | if(Proxy<T1>::prefer_at_accessor == false) | |||
const u32 N = A.get_n_elem(); | { | |||
typename Proxy<T1>::ea_type P = A.get_ea(); | ||||
u32 i,j; | const u32 N = A.get_n_elem(); | |||
for(i=0, j=1; j<N; i+=2, j+=2) | u32 i,j; | |||
{ | ||||
const T tmp_i = P[i]; | ||||
const T tmp_j = P[j]; | ||||
acc += tmp_i * tmp_i; | for(i=0, j=1; j<N; i+=2, j+=2) | |||
acc += tmp_j * tmp_j; | { | |||
} | const T tmp_i = P[i]; | |||
const T tmp_j = P[j]; | ||||
if(i < N) | acc += tmp_i * tmp_i; | |||
acc += tmp_j * tmp_j; | ||||
} | ||||
if(i < N) | ||||
{ | ||||
const T tmp_i = P[i]; | ||||
acc += tmp_i * tmp_i; | ||||
} | ||||
} | ||||
else | ||||
{ | { | |||
const T tmp_i = P[i]; | const u32 n_rows = A.get_n_rows(); | |||
const u32 n_cols = A.get_n_cols(); | ||||
for(u32 col=0; col<n_cols; ++col) | ||||
{ | ||||
u32 i,j; | ||||
acc += tmp_i * tmp_i; | for(i=0, j=1; j<n_rows; i+=2, j+=2) | |||
{ | ||||
const T tmp_i = A.at(i,col); | ||||
const T tmp_j = A.at(j,col); | ||||
acc += tmp_i * tmp_i; | ||||
acc += tmp_j * tmp_j; | ||||
} | ||||
if(i < n_rows) | ||||
{ | ||||
const T tmp_i = A.at(i,col); | ||||
acc += tmp_i * tmp_i; | ||||
} | ||||
} | ||||
} | } | |||
return std::sqrt(acc); | return std::sqrt(acc); | |||
} | } | |||
template<typename T1> | template<typename T1> | |||
arma_hot | arma_hot | |||
inline | inline | |||
typename T1::pod_type | typename T1::pod_type | |||
arma_vec_norm_2(const Proxy<T1>& A, const typename arma_cx_only<typename T1 ::elem_type>::result* junk = 0) | arma_vec_norm_2(const Proxy<T1>& A, const typename arma_cx_only<typename T1 ::elem_type>::result* junk = 0) | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
arma_ignore(junk); | arma_ignore(junk); | |||
typedef typename T1::pod_type T; | typedef typename T1::pod_type T; | |||
typedef typename Proxy<T1>::ea_type ea_type; | ||||
T acc = T(0); | T acc = T(0); | |||
ea_type P = A.get_ea(); | if(Proxy<T1>::prefer_at_accessor == false) | |||
const u32 N = A.get_n_elem(); | { | |||
typename Proxy<T1>::ea_type P = A.get_ea(); | ||||
const u32 N = A.get_n_elem(); | ||||
for(u32 i=0; i<N; ++i) | for(u32 i=0; i<N; ++i) | |||
{ | ||||
const T tmp = std::abs(P[i]); | ||||
acc += tmp*tmp; | ||||
} | ||||
} | ||||
else | ||||
{ | { | |||
const T tmp = std::abs(P[i]); | const u32 n_rows = A.get_n_rows(); | |||
acc += tmp*tmp; | const u32 n_cols = A.get_n_cols(); | |||
for(u32 col=0; col<n_cols; ++col) | ||||
for(u32 row=0; row<n_rows; ++row) | ||||
{ | ||||
const T tmp = std::abs(A.at(row,col)); | ||||
acc += tmp*tmp; | ||||
} | ||||
} | } | |||
return std::sqrt(acc); | return std::sqrt(acc); | |||
} | } | |||
template<typename T1> | template<typename T1> | |||
arma_hot | arma_hot | |||
inline | inline | |||
typename T1::pod_type | typename T1::pod_type | |||
arma_vec_norm_k(const Proxy<T1>& A, const int k) | arma_vec_norm_k(const Proxy<T1>& A, const int k) | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
typedef typename T1::pod_type T; | typedef typename T1::pod_type T; | |||
typedef typename Proxy<T1>::ea_type ea_type; | ||||
T acc = T(0); | T acc = T(0); | |||
ea_type P = A.get_ea(); | if(Proxy<T1>::prefer_at_accessor == false) | |||
const u32 N = A.get_n_elem(); | { | |||
typename Proxy<T1>::ea_type P = A.get_ea(); | ||||
u32 i,j; | const u32 N = A.get_n_elem(); | |||
for(i=0, j=1; j<N; i+=2, j+=2) | u32 i,j; | |||
{ | ||||
acc += std::pow(std::abs(P[i]), k); | ||||
acc += std::pow(std::abs(P[j]), k); | ||||
} | ||||
if(i < N) | for(i=0, j=1; j<N; i+=2, j+=2) | |||
{ | ||||
acc += std::pow(std::abs(P[i]), k); | ||||
acc += std::pow(std::abs(P[j]), k); | ||||
} | ||||
if(i < N) | ||||
{ | ||||
acc += std::pow(std::abs(P[i]), k); | ||||
} | ||||
} | ||||
else | ||||
{ | { | |||
acc += std::pow(std::abs(P[i]), k); | const u32 n_rows = A.get_n_rows(); | |||
const u32 n_cols = A.get_n_cols(); | ||||
for(u32 col=0; col<n_cols; ++col) | ||||
for(u32 row=0; row<n_rows; ++row) | ||||
{ | ||||
acc += std::pow(std::abs(A.at(row,col)), k); | ||||
} | ||||
} | } | |||
return std::pow(acc, T(1)/T(k)); | return std::pow(acc, T(1)/T(k)); | |||
} | } | |||
template<typename T1> | template<typename T1> | |||
arma_hot | arma_hot | |||
inline | inline | |||
typename T1::pod_type | typename T1::pod_type | |||
arma_vec_norm_max(const Proxy<T1>& A) | arma_vec_norm_max(const Proxy<T1>& A) | |||
End of changes. 24 change blocks. | ||||
45 lines changed or deleted | 127 lines changed or added | |||
fn_svd.hpp | fn_svd.hpp | |||
---|---|---|---|---|
skipping to change at line 104 | skipping to change at line 104 | |||
{ | { | |||
U.reset(); | U.reset(); | |||
S.reset(); | S.reset(); | |||
V.reset(); | V.reset(); | |||
arma_bad("svd(): failed to converge", false); | arma_bad("svd(): failed to converge", false); | |||
} | } | |||
return status; | return status; | |||
} | } | |||
template<typename T1> | ||||
inline | ||||
bool | ||||
svd_thin | ||||
( | ||||
Mat<typename T1::elem_type>& U, | ||||
Col<typename T1::pod_type >& S, | ||||
Mat<typename T1::elem_type>& V, | ||||
const Base<typename T1::elem_type,T1>& X, | ||||
const char mode = 'b', | ||||
const typename arma_blas_type_only<typename T1::elem_type>::result* junk | ||||
= 0 | ||||
) | ||||
{ | ||||
arma_extra_debug_sigprint(); | ||||
arma_ignore(junk); | ||||
typedef typename T1::elem_type eT; | ||||
arma_debug_check | ||||
( | ||||
( ((void*)(&U) == (void*)(&S)) || (&U == &V) || ((void*)(&S) == (void*) | ||||
(&V)) ), | ||||
"svd_thin(): two or more output objects are the same object" | ||||
); | ||||
arma_debug_check | ||||
( | ||||
( (mode != 'l') && (mode != 'r') && (mode != 'b') ), | ||||
"svd_thin(): parameter 'mode' is incorrect" | ||||
); | ||||
// auxlib::svd_thin() makes an internal copy of X | ||||
const bool status = auxlib::svd_thin(U, S, V, X, mode); | ||||
if(status == false) | ||||
{ | ||||
U.reset(); | ||||
S.reset(); | ||||
V.reset(); | ||||
arma_bad("svd_thin(): failed to converge", false); | ||||
} | ||||
return status; | ||||
} | ||||
//! @} | //! @} | |||
End of changes. 1 change blocks. | ||||
0 lines changed or deleted | 46 lines changed or added | |||
fn_toeplitz.hpp | fn_toeplitz.hpp | |||
---|---|---|---|---|
// Copyright (C) 2010 NICTA (www.nicta.com.au) | // Copyright (C) 2010-2011 NICTA (www.nicta.com.au) | |||
// Copyright (C) 2010 Conrad Sanderson | // Copyright (C) 2010-2011 Conrad Sanderson | |||
// Copyright (C) 2011 Alcatel Lucent | ||||
// Copyright (C) 2011 Gerhard Schreiber | ||||
// | // | |||
// This file is part of the Armadillo C++ library. | // This file is part of the Armadillo C++ library. | |||
// It is provided without any warranty of fitness | // It is provided without any warranty of fitness | |||
// for any purpose. You can redistribute this file | // for any purpose. You can redistribute this file | |||
// and/or modify it under the terms of the GNU | // and/or modify it under the terms of the GNU | |||
// Lesser General Public License (LGPL) as published | // Lesser General Public License (LGPL) as published | |||
// by the Free Software Foundation, either version 3 | // by the Free Software Foundation, either version 3 | |||
// of the License or (at your option) any later version. | // of the License or (at your option) any later version. | |||
// (see http://www.opensource.org/licenses for more info) | // (see http://www.opensource.org/licenses for more info) | |||
skipping to change at line 36 | skipping to change at line 38 | |||
template<typename T1, typename T2> | template<typename T1, typename T2> | |||
inline | inline | |||
Glue<T1, T2, glue_toeplitz> | Glue<T1, T2, glue_toeplitz> | |||
toeplitz(const Base<typename T1::elem_type,T1>& X, const Base<typename T1:: elem_type,T2>& Y) | toeplitz(const Base<typename T1::elem_type,T1>& X, const Base<typename T1:: elem_type,T2>& Y) | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
return Glue<T1, T2, glue_toeplitz>( X.get_ref(), Y.get_ref() ); | return Glue<T1, T2, glue_toeplitz>( X.get_ref(), Y.get_ref() ); | |||
} | } | |||
template<typename T1> | ||||
inline | ||||
Glue<T1, T1, glue_toeplitz_circ> | ||||
circ_toeplitz(const Base<typename T1::elem_type,T1>& X) | ||||
{ | ||||
arma_extra_debug_sigprint(); | ||||
return Glue<T1, T1, glue_toeplitz_circ>( X.get_ref(), X.get_ref() ); | ||||
} | ||||
//! @} | //! @} | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 14 lines changed or added | |||
glue_cor_meat.hpp | glue_cor_meat.hpp | |||
---|---|---|---|---|
skipping to change at line 138 | skipping to change at line 138 | |||
out /= conv_to< Mat<eT> >::from( stddev_A * stddev_B ); | out /= conv_to< Mat<eT> >::from( stddev_A * stddev_B ); | |||
} | } | |||
else | else | |||
{ | { | |||
arma_debug_assert_same_size(A, B, "cor()"); | arma_debug_assert_same_size(A, B, "cor()"); | |||
const u32 N = A.n_rows; | const u32 N = A.n_rows; | |||
const eT norm_val = (norm_type == 0) ? ( (N > 1) ? eT(N-1) : eT(1) ) : eT(N); | const eT norm_val = (norm_type == 0) ? ( (N > 1) ? eT(N-1) : eT(1) ) : eT(N); | |||
out = trans(A) * B; // out = strans(conj(A)) * B; | out = trans(conj(A)) * B; | |||
out -= (trans(sum(A)) * sum(B))/eT(N); // out -= (strans(conj(sum(A))) | out -= (trans(conj(sum(A))) * sum(B))/eT(N); | |||
* sum(B))/eT(N); | ||||
out /= norm_val; | out /= norm_val; | |||
out /= conv_to< Mat<eT> >::from( trans(stddev(A)) * stddev(B) ); | out /= conv_to< Mat<eT> >::from( trans(stddev(A)) * stddev(B) ); | |||
} | } | |||
} | } | |||
template<typename T1, typename T2> | template<typename T1, typename T2> | |||
inline | inline | |||
void | void | |||
glue_cor::apply(Mat<typename T1::elem_type>& out, const Glue<T1,T2,glue_cor >& X) | glue_cor::apply(Mat<typename T1::elem_type>& out, const Glue<T1,T2,glue_cor >& X) | |||
{ | { | |||
End of changes. 1 change blocks. | ||||
3 lines changed or deleted | 2 lines changed or added | |||
glue_cov_meat.hpp | glue_cov_meat.hpp | |||
---|---|---|---|---|
// Copyright (C) 2009-2011 NICTA (www.nicta.com.au) | // Copyright (C) 2009-2010 NICTA (www.nicta.com.au) | |||
// Copyright (C) 2009-2011 Conrad Sanderson | // Copyright (C) 2009-2010 Conrad Sanderson | |||
// Copyright (C) 2009-2010 Dimitrios Bouzas | // Copyright (C) 2009-2010 Dimitrios Bouzas | |||
// | // | |||
// This file is part of the Armadillo C++ library. | // This file is part of the Armadillo C++ library. | |||
// It is provided without any warranty of fitness | // It is provided without any warranty of fitness | |||
// for any purpose. You can redistribute this file | // for any purpose. You can redistribute this file | |||
// and/or modify it under the terms of the GNU | // and/or modify it under the terms of the GNU | |||
// Lesser General Public License (LGPL) as published | // Lesser General Public License (LGPL) as published | |||
// by the Free Software Foundation, either version 3 | // by the Free Software Foundation, either version 3 | |||
// of the License or (at your option) any later version. | // of the License or (at your option) any later version. | |||
// (see http://www.opensource.org/licenses for more info) | // (see http://www.opensource.org/licenses for more info) | |||
skipping to change at line 115 | skipping to change at line 115 | |||
out.set_size(1,1); | out.set_size(1,1); | |||
out[0] = out_acc/norm_val; | out[0] = out_acc/norm_val; | |||
} | } | |||
else | else | |||
{ | { | |||
arma_debug_assert_same_size(A, B, "cov()"); | arma_debug_assert_same_size(A, B, "cov()"); | |||
const u32 N = A.n_rows; | const u32 N = A.n_rows; | |||
const eT norm_val = (norm_type == 0) ? ( (N > 1) ? eT(N-1) : eT(1) ) : eT(N); | const eT norm_val = (norm_type == 0) ? ( (N > 1) ? eT(N-1) : eT(1) ) : eT(N); | |||
out = trans(A) * B; // out = strans(conj(A)) * B; | out = trans(conj(A)) * B; | |||
out -= (trans(sum(A)) * sum(B))/eT(N); // out -= (strans(conj(sum(A))) | out -= (trans(conj(sum(A))) * sum(B))/eT(N); | |||
* sum(B))/eT(N); | ||||
out /= norm_val; | out /= norm_val; | |||
} | } | |||
} | } | |||
template<typename T1, typename T2> | template<typename T1, typename T2> | |||
inline | inline | |||
void | void | |||
glue_cov::apply(Mat<typename T1::elem_type>& out, const Glue<T1,T2,glue_cov >& X) | glue_cov::apply(Mat<typename T1::elem_type>& out, const Glue<T1,T2,glue_cov >& X) | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
End of changes. 2 change blocks. | ||||
5 lines changed or deleted | 4 lines changed or added | |||
glue_relational_meat.hpp | glue_relational_meat.hpp | |||
---|---|---|---|---|
// Copyright (C) 2009-2010 NICTA (www.nicta.com.au) | // Copyright (C) 2009-2011 NICTA (www.nicta.com.au) | |||
// Copyright (C) 2009-2010 Conrad Sanderson | // Copyright (C) 2009-2011 Conrad Sanderson | |||
// | // | |||
// This file is part of the Armadillo C++ library. | // This file is part of the Armadillo C++ library. | |||
// It is provided without any warranty of fitness | // It is provided without any warranty of fitness | |||
// for any purpose. You can redistribute this file | // for any purpose. You can redistribute this file | |||
// and/or modify it under the terms of the GNU | // and/or modify it under the terms of the GNU | |||
// Lesser General Public License (LGPL) as published | // Lesser General Public License (LGPL) as published | |||
// by the Free Software Foundation, either version 3 | // by the Free Software Foundation, either version 3 | |||
// of the License or (at your option) any later version. | // of the License or (at your option) any later version. | |||
// (see http://www.opensource.org/licenses for more info) | // (see http://www.opensource.org/licenses for more info) | |||
//! \addtogroup glue_relational | //! \addtogroup glue_relational | |||
//! @{ | //! @{ | |||
#undef operator_rel | ||||
#undef operator_str | ||||
#undef arma_applier_mat | ||||
#undef arma_applier_cube | ||||
#define arma_applier_mat(operator_rel, operator_str) \ | ||||
{\ | ||||
const Proxy<T1> P1(X.A);\ | ||||
const Proxy<T2> P2(X.B);\ | ||||
\ | ||||
arma_debug_assert_same_size(P1, P2, operator_str);\ | ||||
\ | ||||
const u32 n_rows = P1.get_n_rows();\ | ||||
const u32 n_cols = P1.get_n_cols();\ | ||||
\ | ||||
out.set_size(n_rows, n_cols);\ | ||||
\ | ||||
u32* out_mem = out.memptr();\ | ||||
\ | ||||
const bool prefer_at_accessor = (Proxy<T1>::prefer_at_accessor || Proxy<T | ||||
2>::prefer_at_accessor);\ | ||||
\ | ||||
if(prefer_at_accessor == false)\ | ||||
{\ | ||||
typename Proxy<T1>::ea_type A = P1.get_ea();\ | ||||
typename Proxy<T2>::ea_type B = P2.get_ea();\ | ||||
\ | ||||
const u32 n_elem = out.n_elem;\ | ||||
\ | ||||
for(u32 i=0; i<n_elem; ++i)\ | ||||
{\ | ||||
out_mem[i] = (A[i] operator_rel B[i]) ? u32(1) : u32(0);\ | ||||
}\ | ||||
}\ | ||||
else\ | ||||
{\ | ||||
u32 count = 0;\ | ||||
\ | ||||
for(u32 col=0; col<n_cols; ++col)\ | ||||
{\ | ||||
for(u32 row=0; row<n_rows; ++row, ++count)\ | ||||
{\ | ||||
out_mem[count] = (P1.at(row,col) operator_rel P2.at(row,col)) ? u32 | ||||
(1) : u32(0);\ | ||||
}\ | ||||
}\ | ||||
}\ | ||||
} | ||||
#define arma_applier_cube(operator_rel, operator_str) \ | ||||
{\ | ||||
const ProxyCube<T1> P1(X.A);\ | ||||
const ProxyCube<T2> P2(X.B);\ | ||||
\ | ||||
arma_debug_assert_same_size(P1, P2, operator_str);\ | ||||
\ | ||||
const u32 n_rows = P1.get_n_rows();\ | ||||
const u32 n_cols = P1.get_n_cols();\ | ||||
const u32 n_slices = P1.get_n_slices();\ | ||||
\ | ||||
out.set_size(n_rows, n_cols, n_slices);\ | ||||
\ | ||||
u32* out_mem = out.memptr();\ | ||||
\ | ||||
const bool prefer_at_accessor = (ProxyCube<T1>::prefer_at_accessor || Pro | ||||
xyCube<T2>::prefer_at_accessor);\ | ||||
\ | ||||
if(prefer_at_accessor == false)\ | ||||
{\ | ||||
typename ProxyCube<T1>::ea_type A = P1.get_ea();\ | ||||
typename ProxyCube<T2>::ea_type B = P2.get_ea();\ | ||||
\ | ||||
const u32 n_elem = out.n_elem;\ | ||||
\ | ||||
for(u32 i=0; i<n_elem; ++i)\ | ||||
{\ | ||||
out_mem[i] = (A[i] operator_rel B[i]) ? u32(1) : u32(0);\ | ||||
}\ | ||||
}\ | ||||
else\ | ||||
{\ | ||||
u32 count = 0;\ | ||||
\ | ||||
for(u32 slice = 0; slice < n_slices; ++slice)\ | ||||
for(u32 col = 0; col < n_cols; ++col)\ | ||||
for(u32 row = 0; row < n_rows; ++row, ++count)\ | ||||
{\ | ||||
out_mem[count] = (P1.at(row,col,slice) operator_rel P2.at(row,col,sli | ||||
ce)) ? u32(1) : u32(0);\ | ||||
}\ | ||||
}\ | ||||
} | ||||
template<typename T1, typename T2> | template<typename T1, typename T2> | |||
inline | inline | |||
void | void | |||
glue_rel_lt::apply | glue_rel_lt::apply | |||
( | ( | |||
Mat <u32>& out, | Mat <u32>& out, | |||
const mtGlue<u32, T1, T2, glue_rel_lt>& X | const mtGlue<u32, T1, T2, glue_rel_lt>& X | |||
) | ) | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
typedef typename Proxy<T1>::ea_type ea_type1; | arma_applier_mat(<, "operator<"); | |||
typedef typename Proxy<T2>::ea_type ea_type2; | ||||
const Proxy<T1> P1(X.A); | ||||
const Proxy<T2> P2(X.B); | ||||
arma_debug_assert_same_size(P1, P2, "operator<"); | ||||
out.set_size(P1.get_n_rows(), P1.get_n_cols()); | ||||
const u32 n_elem = out.n_elem; | ||||
u32* out_mem = out.memptr(); | ||||
ea_type1 A = P1.get_ea(); | ||||
ea_type2 B = P2.get_ea(); | ||||
for(u32 i=0; i<n_elem; ++i) | ||||
{ | ||||
out_mem[i] = (A[i] < B[i]) ? u32(1) : u32(0); | ||||
} | ||||
} | } | |||
template<typename T1, typename T2> | template<typename T1, typename T2> | |||
inline | inline | |||
void | void | |||
glue_rel_gt::apply | glue_rel_gt::apply | |||
( | ( | |||
Mat <u32>& out, | Mat <u32>& out, | |||
const mtGlue<u32, T1, T2, glue_rel_gt>& X | const mtGlue<u32, T1, T2, glue_rel_gt>& X | |||
) | ) | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
typedef typename Proxy<T1>::ea_type ea_type1; | arma_applier_mat(>, "operator>"); | |||
typedef typename Proxy<T2>::ea_type ea_type2; | ||||
const Proxy<T1> P1(X.A); | ||||
const Proxy<T2> P2(X.B); | ||||
arma_debug_assert_same_size(P1, P2, "operator>"); | ||||
out.set_size(P1.get_n_rows(), P1.get_n_cols()); | ||||
const u32 n_elem = out.n_elem; | ||||
u32* out_mem = out.memptr(); | ||||
ea_type1 A = P1.get_ea(); | ||||
ea_type2 B = P2.get_ea(); | ||||
for(u32 i=0; i<n_elem; ++i) | ||||
{ | ||||
out_mem[i] = (A[i] > B[i]) ? u32(1) : u32(0); | ||||
} | ||||
} | } | |||
template<typename T1, typename T2> | template<typename T1, typename T2> | |||
inline | inline | |||
void | void | |||
glue_rel_lteq::apply | glue_rel_lteq::apply | |||
( | ( | |||
Mat <u32>& out, | Mat <u32>& out, | |||
const mtGlue<u32, T1, T2, glue_rel_lteq>& X | const mtGlue<u32, T1, T2, glue_rel_lteq>& X | |||
) | ) | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
typedef typename Proxy<T1>::ea_type ea_type1; | arma_applier_mat(<=, "operator<="); | |||
typedef typename Proxy<T2>::ea_type ea_type2; | ||||
const Proxy<T1> P1(X.A); | ||||
const Proxy<T2> P2(X.B); | ||||
arma_debug_assert_same_size(P1, P2, "operator<="); | ||||
out.set_size(P1.get_n_rows(), P1.get_n_cols()); | ||||
const u32 n_elem = out.n_elem; | ||||
u32* out_mem = out.memptr(); | ||||
ea_type1 A = P1.get_ea(); | ||||
ea_type2 B = P2.get_ea(); | ||||
for(u32 i=0; i<n_elem; ++i) | ||||
{ | ||||
out_mem[i] = (A[i] <= B[i]) ? u32(1) : u32(0); | ||||
} | ||||
} | } | |||
template<typename T1, typename T2> | template<typename T1, typename T2> | |||
inline | inline | |||
void | void | |||
glue_rel_gteq::apply | glue_rel_gteq::apply | |||
( | ( | |||
Mat <u32>& out, | Mat <u32>& out, | |||
const mtGlue<u32, T1, T2, glue_rel_gteq>& X | const mtGlue<u32, T1, T2, glue_rel_gteq>& X | |||
) | ) | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
typedef typename Proxy<T1>::ea_type ea_type1; | arma_applier_mat(>=, "operator>="); | |||
typedef typename Proxy<T2>::ea_type ea_type2; | ||||
const Proxy<T1> P1(X.A); | ||||
const Proxy<T2> P2(X.B); | ||||
arma_debug_assert_same_size(P1, P2, "operator>="); | ||||
out.set_size(P1.get_n_rows(), P1.get_n_cols()); | ||||
const u32 n_elem = out.n_elem; | ||||
u32* out_mem = out.memptr(); | ||||
ea_type1 A = P1.get_ea(); | ||||
ea_type2 B = P2.get_ea(); | ||||
for(u32 i=0; i<n_elem; ++i) | ||||
{ | ||||
out_mem[i] = (A[i] >= B[i]) ? u32(1) : u32(0); | ||||
} | ||||
} | } | |||
template<typename T1, typename T2> | template<typename T1, typename T2> | |||
inline | inline | |||
void | void | |||
glue_rel_eq::apply | glue_rel_eq::apply | |||
( | ( | |||
Mat <u32>& out, | Mat <u32>& out, | |||
const mtGlue<u32, T1, T2, glue_rel_eq>& X | const mtGlue<u32, T1, T2, glue_rel_eq>& X | |||
) | ) | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
typedef typename Proxy<T1>::ea_type ea_type1; | arma_applier_mat(==, "operator=="); | |||
typedef typename Proxy<T2>::ea_type ea_type2; | ||||
const Proxy<T1> P1(X.A); | ||||
const Proxy<T2> P2(X.B); | ||||
arma_debug_assert_same_size(P1, P2, "operator=="); | ||||
out.set_size(P1.get_n_rows(), P1.get_n_cols()); | ||||
const u32 n_elem = out.n_elem; | ||||
u32* out_mem = out.memptr(); | ||||
ea_type1 A = P1.get_ea(); | ||||
ea_type2 B = P2.get_ea(); | ||||
for(u32 i=0; i<n_elem; ++i) | ||||
{ | ||||
out_mem[i] = (A[i] == B[i]) ? u32(1) : u32(0); | ||||
} | ||||
} | } | |||
template<typename T1, typename T2> | template<typename T1, typename T2> | |||
inline | inline | |||
void | void | |||
glue_rel_noteq::apply | glue_rel_noteq::apply | |||
( | ( | |||
Mat <u32>& out, | Mat <u32>& out, | |||
const mtGlue<u32, T1, T2, glue_rel_noteq>& X | const mtGlue<u32, T1, T2, glue_rel_noteq>& X | |||
) | ) | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
typedef typename Proxy<T1>::ea_type ea_type1; | arma_applier_mat(!=, "operator!="); | |||
typedef typename Proxy<T2>::ea_type ea_type2; | ||||
const Proxy<T1> P1(X.A); | ||||
const Proxy<T2> P2(X.B); | ||||
arma_debug_assert_same_size(P1, P2, "operator!="); | ||||
out.set_size(P1.get_n_rows(), P1.get_n_cols()); | ||||
const u32 n_elem = out.n_elem; | ||||
u32* out_mem = out.memptr(); | ||||
ea_type1 A = P1.get_ea(); | ||||
ea_type2 B = P2.get_ea(); | ||||
for(u32 i=0; i<n_elem; ++i) | ||||
{ | ||||
out_mem[i] = (A[i] != B[i]) ? u32(1) : u32(0); | ||||
} | ||||
} | } | |||
// | // | |||
// | // | |||
// | // | |||
template<typename T1, typename T2> | template<typename T1, typename T2> | |||
inline | inline | |||
void | void | |||
glue_rel_lt::apply | glue_rel_lt::apply | |||
( | ( | |||
Cube <u32>& out, | Cube <u32>& out, | |||
const mtGlueCube<u32, T1, T2, glue_rel_lt>& X | const mtGlueCube<u32, T1, T2, glue_rel_lt>& X | |||
) | ) | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
typedef typename ProxyCube<T1>::ea_type ea_type1; | arma_applier_cube(<, "operator<"); | |||
typedef typename ProxyCube<T2>::ea_type ea_type2; | ||||
const ProxyCube<T1> P1(X.A); | ||||
const ProxyCube<T2> P2(X.B); | ||||
arma_debug_assert_same_size(P1, P2, "operator<"); | ||||
out.set_size(P1.get_n_rows(), P1.get_n_cols(), P1.get_n_slices()); | ||||
const u32 n_elem = out.n_elem; | ||||
u32* out_mem = out.memptr(); | ||||
ea_type1 A = P1.get_ea(); | ||||
ea_type2 B = P2.get_ea(); | ||||
for(u32 i=0; i<n_elem; ++i) | ||||
{ | ||||
out_mem[i] = (A[i] < B[i]) ? u32(1) : u32(0); | ||||
} | ||||
} | } | |||
template<typename T1, typename T2> | template<typename T1, typename T2> | |||
inline | inline | |||
void | void | |||
glue_rel_gt::apply | glue_rel_gt::apply | |||
( | ( | |||
Cube <u32>& out, | Cube <u32>& out, | |||
const mtGlueCube<u32, T1, T2, glue_rel_gt>& X | const mtGlueCube<u32, T1, T2, glue_rel_gt>& X | |||
) | ) | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
typedef typename ProxyCube<T1>::ea_type ea_type1; | arma_applier_cube(>, "operator>"); | |||
typedef typename ProxyCube<T2>::ea_type ea_type2; | ||||
const ProxyCube<T1> P1(X.A); | ||||
const ProxyCube<T2> P2(X.B); | ||||
arma_debug_assert_same_size(P1, P2, "operator>"); | ||||
out.set_size(P1.get_n_rows(), P1.get_n_cols(), P1.get_n_slices()); | ||||
const u32 n_elem = out.n_elem; | ||||
u32* out_mem = out.memptr(); | ||||
ea_type1 A = P1.get_ea(); | ||||
ea_type2 B = P2.get_ea(); | ||||
for(u32 i=0; i<n_elem; ++i) | ||||
{ | ||||
out_mem[i] = (A[i] > B[i]) ? u32(1) : u32(0); | ||||
} | ||||
} | } | |||
template<typename T1, typename T2> | template<typename T1, typename T2> | |||
inline | inline | |||
void | void | |||
glue_rel_lteq::apply | glue_rel_lteq::apply | |||
( | ( | |||
Cube <u32>& out, | Cube <u32>& out, | |||
const mtGlueCube<u32, T1, T2, glue_rel_lteq>& X | const mtGlueCube<u32, T1, T2, glue_rel_lteq>& X | |||
) | ) | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
typedef typename ProxyCube<T1>::ea_type ea_type1; | arma_applier_cube(<=, "operator<="); | |||
typedef typename ProxyCube<T2>::ea_type ea_type2; | ||||
const ProxyCube<T1> P1(X.A); | ||||
const ProxyCube<T2> P2(X.B); | ||||
arma_debug_assert_same_size(P1, P2, "operator<="); | ||||
out.set_size(P1.get_n_rows(), P1.get_n_cols(), P1.get_n_slices()); | ||||
const u32 n_elem = out.n_elem; | ||||
u32* out_mem = out.memptr(); | ||||
ea_type1 A = P1.get_ea(); | ||||
ea_type2 B = P2.get_ea(); | ||||
for(u32 i=0; i<n_elem; ++i) | ||||
{ | ||||
out_mem[i] = (A[i] <= B[i]) ? u32(1) : u32(0); | ||||
} | ||||
} | } | |||
template<typename T1, typename T2> | template<typename T1, typename T2> | |||
inline | inline | |||
void | void | |||
glue_rel_gteq::apply | glue_rel_gteq::apply | |||
( | ( | |||
Cube <u32>& out, | Cube <u32>& out, | |||
const mtGlueCube<u32, T1, T2, glue_rel_gteq>& X | const mtGlueCube<u32, T1, T2, glue_rel_gteq>& X | |||
) | ) | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
typedef typename ProxyCube<T1>::ea_type ea_type1; | arma_applier_cube(>=, "operator>="); | |||
typedef typename ProxyCube<T2>::ea_type ea_type2; | ||||
const ProxyCube<T1> P1(X.A); | ||||
const ProxyCube<T2> P2(X.B); | ||||
arma_debug_assert_same_size(P1, P2, "operator>="); | ||||
out.set_size(P1.get_n_rows(), P1.get_n_cols(), P1.get_n_slices()); | ||||
const u32 n_elem = out.n_elem; | ||||
u32* out_mem = out.memptr(); | ||||
ea_type1 A = P1.get_ea(); | ||||
ea_type2 B = P2.get_ea(); | ||||
for(u32 i=0; i<n_elem; ++i) | ||||
{ | ||||
out_mem[i] = (A[i] >= B[i]) ? u32(1) : u32(0); | ||||
} | ||||
} | } | |||
template<typename T1, typename T2> | template<typename T1, typename T2> | |||
inline | inline | |||
void | void | |||
glue_rel_eq::apply | glue_rel_eq::apply | |||
( | ( | |||
Cube <u32>& out, | Cube <u32>& out, | |||
const mtGlueCube<u32, T1, T2, glue_rel_eq>& X | const mtGlueCube<u32, T1, T2, glue_rel_eq>& X | |||
) | ) | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
typedef typename ProxyCube<T1>::ea_type ea_type1; | arma_applier_cube(==, "operator=="); | |||
typedef typename ProxyCube<T2>::ea_type ea_type2; | ||||
const ProxyCube<T1> P1(X.A); | ||||
const ProxyCube<T2> P2(X.B); | ||||
arma_debug_assert_same_size(P1, P2, "operator=="); | ||||
out.set_size(P1.get_n_rows(), P1.get_n_cols(), P1.get_n_slices()); | ||||
const u32 n_elem = out.n_elem; | ||||
u32* out_mem = out.memptr(); | ||||
ea_type1 A = P1.get_ea(); | ||||
ea_type2 B = P2.get_ea(); | ||||
for(u32 i=0; i<n_elem; ++i) | ||||
{ | ||||
out_mem[i] = (A[i] == B[i]) ? u32(1) : u32(0); | ||||
} | ||||
} | } | |||
template<typename T1, typename T2> | template<typename T1, typename T2> | |||
inline | inline | |||
void | void | |||
glue_rel_noteq::apply | glue_rel_noteq::apply | |||
( | ( | |||
Cube <u32>& out, | Cube <u32>& out, | |||
const mtGlueCube<u32, T1, T2, glue_rel_noteq>& X | const mtGlueCube<u32, T1, T2, glue_rel_noteq>& X | |||
) | ) | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
typedef typename ProxyCube<T1>::ea_type ea_type1; | arma_applier_cube(!=, "operator!="); | |||
typedef typename ProxyCube<T2>::ea_type ea_type2; | ||||
const ProxyCube<T1> P1(X.A); | ||||
const ProxyCube<T2> P2(X.B); | ||||
arma_debug_assert_same_size(P1, P2, "operator!="); | ||||
out.set_size(P1.get_n_rows(), P1.get_n_cols(), P1.get_n_slices()); | ||||
const u32 n_elem = out.n_elem; | ||||
u32* out_mem = out.memptr(); | ||||
ea_type1 A = P1.get_ea(); | ||||
ea_type2 B = P2.get_ea(); | ||||
for(u32 i=0; i<n_elem; ++i) | ||||
{ | ||||
out_mem[i] = (A[i] != B[i]) ? u32(1) : u32(0); | ||||
} | ||||
} | } | |||
#undef arma_applier_mat | ||||
#undef arma_applier_cube | ||||
//! @} | //! @} | |||
End of changes. 15 change blocks. | ||||
230 lines changed or deleted | 111 lines changed or added | |||
glue_times_meat.hpp | glue_times_meat.hpp | |||
---|---|---|---|---|
skipping to change at line 36 | skipping to change at line 36 | |||
const partial_unwrap_check<T1> tmp1(X.A, out); | const partial_unwrap_check<T1> tmp1(X.A, out); | |||
const partial_unwrap_check<T2> tmp2(X.B, out); | const partial_unwrap_check<T2> tmp2(X.B, out); | |||
const Mat<eT>& A = tmp1.M; | const Mat<eT>& A = tmp1.M; | |||
const Mat<eT>& B = tmp2.M; | const Mat<eT>& B = tmp2.M; | |||
const bool do_trans_A = tmp1.do_trans; | const bool do_trans_A = tmp1.do_trans; | |||
const bool do_trans_B = tmp2.do_trans; | const bool do_trans_B = tmp2.do_trans; | |||
const bool use_alpha = tmp1.do_times || tmp2.do_times; | const bool use_alpha = tmp1.do_times || tmp2.do_times; | |||
const eT alpha = use_alpha ? (tmp1.val * tmp2.val) : eT(0); | const eT alpha = use_alpha ? (tmp1.get_val() * tmp2.get_val()) : eT (0); | |||
glue_times::apply(out, A, B, alpha, do_trans_A, do_trans_B, use_alpha); | glue_times::apply(out, A, B, alpha, do_trans_A, do_trans_B, use_alpha); | |||
} | } | |||
template<typename T1, typename T2, typename T3> | template<typename T1, typename T2, typename T3> | |||
inline | inline | |||
void | void | |||
glue_times_redirect<3>::apply(Mat<typename T1::elem_type>& out, const Glue< Glue<T1,T2,glue_times>, T3, glue_times>& X) | glue_times_redirect<3>::apply(Mat<typename T1::elem_type>& out, const Glue< Glue<T1,T2,glue_times>, T3, glue_times>& X) | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
skipping to change at line 66 | skipping to change at line 66 | |||
const Mat<eT>& A = tmp1.M; | const Mat<eT>& A = tmp1.M; | |||
const Mat<eT>& B = tmp2.M; | const Mat<eT>& B = tmp2.M; | |||
const Mat<eT>& C = tmp3.M; | const Mat<eT>& C = tmp3.M; | |||
const bool do_trans_A = tmp1.do_trans; | const bool do_trans_A = tmp1.do_trans; | |||
const bool do_trans_B = tmp2.do_trans; | const bool do_trans_B = tmp2.do_trans; | |||
const bool do_trans_C = tmp3.do_trans; | const bool do_trans_C = tmp3.do_trans; | |||
const bool use_alpha = tmp1.do_times || tmp2.do_times || tmp3.do_times; | const bool use_alpha = tmp1.do_times || tmp2.do_times || tmp3.do_times; | |||
const eT alpha = use_alpha ? (tmp1.val * tmp2.val * tmp3.val) : eT( 0); | const eT alpha = use_alpha ? (tmp1.get_val() * tmp2.get_val() * tmp 3.get_val()) : eT(0); | |||
glue_times::apply(out, A, B, C, alpha, do_trans_A, do_trans_B, do_trans_C , use_alpha); | glue_times::apply(out, A, B, C, alpha, do_trans_A, do_trans_B, do_trans_C , use_alpha); | |||
} | } | |||
template<typename T1, typename T2, typename T3, typename T4> | template<typename T1, typename T2, typename T3, typename T4> | |||
inline | inline | |||
void | void | |||
glue_times_redirect<4>::apply(Mat<typename T1::elem_type>& out, const Glue< Glue< Glue<T1,T2,glue_times>, T3, glue_times>, T4, glue_times>& X) | glue_times_redirect<4>::apply(Mat<typename T1::elem_type>& out, const Glue< Glue< Glue<T1,T2,glue_times>, T3, glue_times>, T4, glue_times>& X) | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
skipping to change at line 99 | skipping to change at line 99 | |||
const Mat<eT>& B = tmp2.M; | const Mat<eT>& B = tmp2.M; | |||
const Mat<eT>& C = tmp3.M; | const Mat<eT>& C = tmp3.M; | |||
const Mat<eT>& D = tmp4.M; | const Mat<eT>& D = tmp4.M; | |||
const bool do_trans_A = tmp1.do_trans; | const bool do_trans_A = tmp1.do_trans; | |||
const bool do_trans_B = tmp2.do_trans; | const bool do_trans_B = tmp2.do_trans; | |||
const bool do_trans_C = tmp3.do_trans; | const bool do_trans_C = tmp3.do_trans; | |||
const bool do_trans_D = tmp4.do_trans; | const bool do_trans_D = tmp4.do_trans; | |||
const bool use_alpha = tmp1.do_times || tmp2.do_times || tmp3.do_times || tmp4.do_times; | const bool use_alpha = tmp1.do_times || tmp2.do_times || tmp3.do_times || tmp4.do_times; | |||
const eT alpha = use_alpha ? (tmp1.val * tmp2.val * tmp3.val * tmp4 .val) : eT(0); | const eT alpha = use_alpha ? (tmp1.get_val() * tmp2.get_val() * tmp 3.get_val() * tmp4.get_val()) : eT(0); | |||
glue_times::apply(out, A, B, C, D, alpha, do_trans_A, do_trans_B, do_tran s_C, do_trans_D, use_alpha); | glue_times::apply(out, A, B, C, D, alpha, do_trans_A, do_trans_B, do_tran s_C, do_trans_D, use_alpha); | |||
} | } | |||
template<typename T1, typename T2> | template<typename T1, typename T2> | |||
inline | inline | |||
void | void | |||
glue_times::apply(Mat<typename T1::elem_type>& out, const Glue<T1,T2,glue_t imes>& X) | glue_times::apply(Mat<typename T1::elem_type>& out, const Glue<T1,T2,glue_t imes>& X) | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
skipping to change at line 179 | skipping to change at line 179 | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
typedef typename T1::elem_type eT; | typedef typename T1::elem_type eT; | |||
const partial_unwrap_check<T1> tmp1(X.A, out); | const partial_unwrap_check<T1> tmp1(X.A, out); | |||
const partial_unwrap_check<T2> tmp2(X.B, out); | const partial_unwrap_check<T2> tmp2(X.B, out); | |||
const Mat<eT>& A = tmp1.M; | const Mat<eT>& A = tmp1.M; | |||
const Mat<eT>& B = tmp2.M; | const Mat<eT>& B = tmp2.M; | |||
const eT alpha = tmp1.val * tmp2.val * ( (sign > s32(0)) ? eT(1) : eT(-1) ); | const eT alpha = tmp1.get_val() * tmp2.get_val() * ( (sign > s32(0) ) ? eT(1) : eT(-1) ); | |||
const bool do_trans_A = tmp1.do_trans; | const bool do_trans_A = tmp1.do_trans; | |||
const bool do_trans_B = tmp2.do_trans; | const bool do_trans_B = tmp2.do_trans; | |||
const bool use_alpha = tmp1.do_times || tmp2.do_times || (sign < s32(0)) ; | const bool use_alpha = tmp1.do_times || tmp2.do_times || (sign < s32(0)) ; | |||
arma_debug_assert_mul_size(A, B, do_trans_A, do_trans_B, "matrix multipli cation"); | arma_debug_assert_mul_size(A, B, do_trans_A, do_trans_B, "matrix multipli cation"); | |||
const u32 result_n_rows = (do_trans_A == false) ? A.n_rows : A.n_cols; | const u32 result_n_rows = (do_trans_A == false) ? A.n_rows : A.n_cols; | |||
const u32 result_n_cols = (do_trans_B == false) ? B.n_cols : B.n_rows; | const u32 result_n_cols = (do_trans_B == false) ? B.n_cols : B.n_rows; | |||
End of changes. 4 change blocks. | ||||
4 lines changed or deleted | 4 lines changed or added | |||
glue_toeplitz_bones.hpp | glue_toeplitz_bones.hpp | |||
---|---|---|---|---|
// Copyright (C) 2010 NICTA (www.nicta.com.au) | // Copyright (C) 2010-2011 NICTA (www.nicta.com.au) | |||
// Copyright (C) 2010 Conrad Sanderson | // Copyright (C) 2010-2011 Conrad Sanderson | |||
// Copyright (C) 2011 Alcatel Lucent | ||||
// Copyright (C) 2011 Gerhard Schreiber | ||||
// | // | |||
// This file is part of the Armadillo C++ library. | // This file is part of the Armadillo C++ library. | |||
// It is provided without any warranty of fitness | // It is provided without any warranty of fitness | |||
// for any purpose. You can redistribute this file | // for any purpose. You can redistribute this file | |||
// and/or modify it under the terms of the GNU | // and/or modify it under the terms of the GNU | |||
// Lesser General Public License (LGPL) as published | // Lesser General Public License (LGPL) as published | |||
// by the Free Software Foundation, either version 3 | // by the Free Software Foundation, either version 3 | |||
// of the License or (at your option) any later version. | // of the License or (at your option) any later version. | |||
// (see http://www.opensource.org/licenses for more info) | // (see http://www.opensource.org/licenses for more info) | |||
//! \addtogroup glue_toeplitz | //! \addtogroup glue_toeplitz | |||
//! @{ | //! @{ | |||
class glue_toeplitz | class glue_toeplitz | |||
{ | { | |||
public: | public: | |||
template<typename T1, typename T2> inline static void apply(Mat<typename T1::elem_type>& out, const Glue<T1, T2, glue_toeplitz>& in); | template<typename T1, typename T2> inline static void apply(Mat<typename T1::elem_type>& out, const Glue<T1, T2, glue_toeplitz>& in); | |||
}; | }; | |||
class glue_toeplitz_circ | ||||
{ | ||||
public: | ||||
template<typename T1, typename T2> inline static void apply(Mat<typename | ||||
T1::elem_type>& out, const Glue<T1, T2, glue_toeplitz_circ>& in); | ||||
}; | ||||
//! @} | //! @} | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 12 lines changed or added | |||
glue_toeplitz_meat.hpp | glue_toeplitz_meat.hpp | |||
---|---|---|---|---|
// Copyright (C) 2010 NICTA (www.nicta.com.au) | // Copyright (C) 2010-2011 NICTA (www.nicta.com.au) | |||
// Copyright (C) 2010 Conrad Sanderson | // Copyright (C) 2010-2011 Conrad Sanderson | |||
// Copyright (C) 2011 Alcatel Lucent | ||||
// Copyright (C) 2011 Gerhard Schreiber | ||||
// | // | |||
// This file is part of the Armadillo C++ library. | // This file is part of the Armadillo C++ library. | |||
// It is provided without any warranty of fitness | // It is provided without any warranty of fitness | |||
// for any purpose. You can redistribute this file | // for any purpose. You can redistribute this file | |||
// and/or modify it under the terms of the GNU | // and/or modify it under the terms of the GNU | |||
// Lesser General Public License (LGPL) as published | // Lesser General Public License (LGPL) as published | |||
// by the Free Software Foundation, either version 3 | // by the Free Software Foundation, either version 3 | |||
// of the License or (at your option) any later version. | // of the License or (at your option) any later version. | |||
// (see http://www.opensource.org/licenses for more info) | // (see http://www.opensource.org/licenses for more info) | |||
skipping to change at line 107 | skipping to change at line 109 | |||
for(u32 col=(row+1); col<B_N; ++col, ++i) | for(u32 col=(row+1); col<B_N; ++col, ++i) | |||
{ | { | |||
out.at(row,col) = B_mem[i]; | out.at(row,col) = B_mem[i]; | |||
} | } | |||
} | } | |||
} | } | |||
} | } | |||
template<typename T1, typename T2> | ||||
inline | ||||
void | ||||
glue_toeplitz_circ::apply(Mat<typename T1::elem_type>& out, const Glue<T1, | ||||
T2, glue_toeplitz_circ>& in) | ||||
{ | ||||
arma_extra_debug_sigprint(); | ||||
typedef typename T1::elem_type eT; | ||||
if( ((void*)(&in.A)) == ((void*)(&in.B)) ) | ||||
{ | ||||
arma_extra_debug_print("glue_toeplitz_circ::apply(): one argument versi | ||||
on"); | ||||
const unwrap_check<T1> tmp(in.A, out); | ||||
const Mat<eT>& A = tmp.M; | ||||
arma_debug_check( (A.is_vec() == false), "toeplitz(): input argument mu | ||||
st be a vector" ); | ||||
const u32 N = A.n_elem; | ||||
const eT* A_mem = A.memptr(); | ||||
out.set_size(N,N); | ||||
if(A.is_colvec()) | ||||
{ | ||||
// A is interpreted as colvec | ||||
for(u32 col=0; col<N; ++col) | ||||
{ | ||||
eT* col_mem = out.colptr(col); | ||||
u32 i = col; | ||||
for(u32 row=0; row<col; ++row, --i) | ||||
{ | ||||
col_mem[row] = A_mem[N-i]; | ||||
} | ||||
i = 0; | ||||
for(u32 row=col; row<N; ++row, ++i) | ||||
{ | ||||
col_mem[row] = A_mem[i]; | ||||
} | ||||
} | ||||
} | ||||
else | ||||
{ | ||||
// A is interpreted as rowvec - probably not the computationally most | ||||
efficient way to do this ;-) | ||||
for(u32 row=0; row<N; ++row) | ||||
{ | ||||
u32 i = row; | ||||
for(u32 col=0; col<row; ++col, --i) | ||||
{ | ||||
out.at(row,col) = A_mem[N-i]; | ||||
} | ||||
i = 0; | ||||
for(u32 col=row; col<N; ++col, ++i) | ||||
{ | ||||
out.at(row,col) = A_mem[i]; | ||||
} | ||||
} | ||||
} | ||||
} | ||||
} | ||||
//! @} | //! @} | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 79 lines changed or added | |||
op_cor_meat.hpp | op_cor_meat.hpp | |||
---|---|---|---|---|
// Copyright (C) 2009-2011 NICTA (www.nicta.com.au) | // Copyright (C) 2009-2010 NICTA (www.nicta.com.au) | |||
// Copyright (C) 2009-2011 Conrad Sanderson | // Copyright (C) 2009-2010 Conrad Sanderson | |||
// Copyright (C) 2009-2010 Dimitrios Bouzas | // Copyright (C) 2009-2010 Dimitrios Bouzas | |||
// | // | |||
// This file is part of the Armadillo C++ library. | // This file is part of the Armadillo C++ library. | |||
// It is provided without any warranty of fitness | // It is provided without any warranty of fitness | |||
// for any purpose. You can redistribute this file | // for any purpose. You can redistribute this file | |||
// and/or modify it under the terms of the GNU | // and/or modify it under the terms of the GNU | |||
// Lesser General Public License (LGPL) as published | // Lesser General Public License (LGPL) as published | |||
// by the Free Software Foundation, either version 3 | // by the Free Software Foundation, either version 3 | |||
// of the License or (at your option) any later version. | // of the License or (at your option) any later version. | |||
// (see http://www.opensource.org/licenses for more info) | // (see http://www.opensource.org/licenses for more info) | |||
skipping to change at line 78 | skipping to change at line 78 | |||
out[0] = eT(1); | out[0] = eT(1); | |||
} | } | |||
else | else | |||
{ | { | |||
const u32 N = A.n_rows; | const u32 N = A.n_rows; | |||
const eT norm_val = (norm_type == 0) ? ( (N > 1) ? eT(N-1) : eT(1) ) : eT(N); | const eT norm_val = (norm_type == 0) ? ( (N > 1) ? eT(N-1) : eT(1) ) : eT(N); | |||
const Row<eT> acc = sum(A); | const Row<eT> acc = sum(A); | |||
const Row<T> sd = stddev(A); | const Row<T> sd = stddev(A); | |||
out = trans(A) * A; // out = strans(conj(A)) * A; | out = trans(conj(A)) * A; | |||
out -= (trans(acc) * acc)/eT(N); // out -= (strans(conj(acc)) * acc)/e | out -= (trans(conj(acc)) * acc)/eT(N); | |||
T(N); | ||||
out /= norm_val; | out /= norm_val; | |||
//out = out / (trans(sd) * sd); | //out = out / (trans(sd) * sd); | |||
out /= conv_to< Mat<eT> >::from(trans(sd) * sd); | out /= conv_to< Mat<eT> >::from(trans(sd) * sd); | |||
} | } | |||
} | } | |||
template<typename T1> | template<typename T1> | |||
inline | inline | |||
void | void | |||
End of changes. 2 change blocks. | ||||
5 lines changed or deleted | 4 lines changed or added | |||
op_cov_meat.hpp | op_cov_meat.hpp | |||
---|---|---|---|---|
// Copyright (C) 2009-2011 NICTA (www.nicta.com.au) | // Copyright (C) 2009-2010 NICTA (www.nicta.com.au) | |||
// Copyright (C) 2009-2011 Conrad Sanderson | // Copyright (C) 2009-2010 Conrad Sanderson | |||
// Copyright (C) 2009-2010 Dimitrios Bouzas | // Copyright (C) 2009-2010 Dimitrios Bouzas | |||
// | // | |||
// This file is part of the Armadillo C++ library. | // This file is part of the Armadillo C++ library. | |||
// It is provided without any warranty of fitness | // It is provided without any warranty of fitness | |||
// for any purpose. You can redistribute this file | // for any purpose. You can redistribute this file | |||
// and/or modify it under the terms of the GNU | // and/or modify it under the terms of the GNU | |||
// Lesser General Public License (LGPL) as published | // Lesser General Public License (LGPL) as published | |||
// by the Free Software Foundation, either version 3 | // by the Free Software Foundation, either version 3 | |||
// of the License or (at your option) any later version. | // of the License or (at your option) any later version. | |||
// (see http://www.opensource.org/licenses for more info) | // (see http://www.opensource.org/licenses for more info) | |||
skipping to change at line 79 | skipping to change at line 79 | |||
out[0] = tmp_mat[0]; | out[0] = tmp_mat[0]; | |||
} | } | |||
} | } | |||
else | else | |||
{ | { | |||
const u32 N = A.n_rows; | const u32 N = A.n_rows; | |||
const eT norm_val = (norm_type == 0) ? ( (N > 1) ? eT(N-1) : eT(1) ) : eT(N); | const eT norm_val = (norm_type == 0) ? ( (N > 1) ? eT(N-1) : eT(1) ) : eT(N); | |||
const Row<eT> acc = sum(A); | const Row<eT> acc = sum(A); | |||
out = trans(A) * A; // out = strans(conj(A)) * A; | out = trans(conj(A)) * A; | |||
out -= (trans(acc) * acc)/eT(N); // out -= (strans(conj(acc)) * acc)/e | out -= (trans(conj(acc)) * acc)/eT(N); | |||
T(N); | ||||
out /= norm_val; | out /= norm_val; | |||
} | } | |||
} | } | |||
template<typename T1> | template<typename T1> | |||
inline | inline | |||
void | void | |||
op_cov::apply(Mat<typename T1::elem_type>& out, const Op<T1,op_cov>& in) | op_cov::apply(Mat<typename T1::elem_type>& out, const Op<T1,op_cov>& in) | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
End of changes. 2 change blocks. | ||||
5 lines changed or deleted | 4 lines changed or added | |||
op_strans_meat.hpp | op_strans_meat.hpp | |||
---|---|---|---|---|
skipping to change at line 114 | skipping to change at line 114 | |||
arrayops::copy( out.memptr(), A.mem, A.n_elem ); | arrayops::copy( out.memptr(), A.mem, A.n_elem ); | |||
} | } | |||
else | else | |||
{ | { | |||
if( (A_n_rows <= 4) && (A_n_rows == A_n_cols) ) | if( (A_n_rows <= 4) && (A_n_rows == A_n_cols) ) | |||
{ | { | |||
op_strans::apply_noalias_tinysq(out, A); | op_strans::apply_noalias_tinysq(out, A); | |||
} | } | |||
else | else | |||
{ | { | |||
for(u32 in_row = 0; in_row<A_n_rows; ++in_row) | for(u32 k=0; k < A_n_cols; ++k) | |||
{ | { | |||
const u32 out_col = in_row; | u32 i, j; | |||
for(u32 in_col = 0; in_col<A_n_cols; ++in_col) | const eT* colptr = A.colptr(k); | |||
for(i=0, j=1; j < A_n_rows; i+=2, j+=2) | ||||
{ | ||||
const eT tmp_i = colptr[i]; | ||||
const eT tmp_j = colptr[j]; | ||||
out.at(k, i) = tmp_i; | ||||
out.at(k, j) = tmp_j; | ||||
} | ||||
if(i < A_n_rows) | ||||
{ | { | |||
const u32 out_row = in_col; | out.at(k, i) = colptr[i]; | |||
out.at(out_row, out_col) = A.at(in_row, in_col); | ||||
} | } | |||
} | } | |||
} | } | |||
} | } | |||
} | } | |||
template<typename eT> | template<typename eT> | |||
inline | inline | |||
void | void | |||
op_strans::apply(Mat<eT>& out, const Mat<eT>& A) | op_strans::apply(Mat<eT>& out, const Mat<eT>& A) | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
if(&out != &A) | if(&out != &A) | |||
{ | { | |||
op_strans::apply_noalias(out, A); | op_strans::apply_noalias(out, A); | |||
} | } | |||
else | else | |||
{ | { | |||
if(out.n_rows == out.n_cols) | const u32 n_rows = out.n_rows; | |||
const u32 n_cols = out.n_cols; | ||||
if(n_rows == n_cols) | ||||
{ | { | |||
arma_extra_debug_print("op_strans::apply(): doing in-place transpose of a square matrix"); | arma_extra_debug_print("op_strans::apply(): doing in-place transpose of a square matrix"); | |||
const u32 n_rows = out.n_rows; | const u32 N = n_rows; | |||
const u32 n_cols = out.n_cols; | ||||
for(u32 col=0; col<n_cols; ++col) | for(u32 k=0; k < N; ++k) | |||
{ | { | |||
eT* coldata = out.colptr(col); | eT* colptr = out.colptr(k); | |||
u32 i,j; | ||||
for(i=(k+1), j=(k+2); j < N; i+=2, j+=2) | ||||
{ | ||||
std::swap(out.at(k,i), colptr[i]); | ||||
std::swap(out.at(k,j), colptr[j]); | ||||
} | ||||
for(u32 row=(col+1); row<n_rows; ++row) | if(i < N) | |||
{ | { | |||
std::swap( out.at(col,row), coldata[row] ); | std::swap(out.at(k,i), colptr[i]); | |||
} | } | |||
} | } | |||
} | } | |||
else | else | |||
{ | { | |||
const Mat<eT> AA = A; | const Mat<eT> AA = A; | |||
op_strans::apply_noalias(out, AA); | op_strans::apply_noalias(out, AA); | |||
} | } | |||
} | } | |||
} | } | |||
End of changes. 10 change blocks. | ||||
12 lines changed or deleted | 32 lines changed or added | |||
promote_type.hpp | promote_type.hpp | |||
---|---|---|---|---|
skipping to change at line 17 | skipping to change at line 17 | |||
// and/or modify it under the terms of the GNU | // and/or modify it under the terms of the GNU | |||
// Lesser General Public License (LGPL) as published | // Lesser General Public License (LGPL) as published | |||
// by the Free Software Foundation, either version 3 | // by the Free Software Foundation, either version 3 | |||
// of the License or (at your option) any later version. | // of the License or (at your option) any later version. | |||
// (see http://www.opensource.org/licenses for more info) | // (see http://www.opensource.org/licenses for more info) | |||
//! \addtogroup promote_type | //! \addtogroup promote_type | |||
//! @{ | //! @{ | |||
template<typename T1, typename T2> | template<typename T1, typename T2> | |||
struct promote_type | struct is_promotable | |||
{ | { | |||
inline static void check() | static const bool value = false; | |||
{ | ||||
arma_static_assert<false> ERROR___UNSUPPORTED_MIXTURE_OF_TYPES; | ||||
ERROR___UNSUPPORTED_MIXTURE_OF_TYPES = ERROR___UNSUPPORTED_MIXTURE_OF_T | ||||
YPES; | ||||
} | ||||
typedef T1 result; | typedef T1 result; | |||
}; | }; | |||
struct promote_type_ok | struct is_promotable_ok | |||
{ | { | |||
arma_inline static void check() {} | static const bool value = true; | |||
}; | }; | |||
template<typename T> struct promote_type<T, T> : public promo | template<typename T> struct is_promotable<T, T> : public is_p | |||
te_type_ok { typedef T result; }; | romotable_ok { typedef T result; }; | |||
template<typename T> struct promote_type<std::complex<T>, T> : public promo | template<typename T> struct is_promotable<std::complex<T>, T> : public is_p | |||
te_type_ok { typedef std::complex<T> result; }; | romotable_ok { typedef std::complex<T> result; }; | |||
template<> struct promote_type<std::complex<double>, std::complex<float> > | template<> struct is_promotable<std::complex<double>, std::complex<float> > | |||
: public promote_type_ok { typedef std::complex<double> result; }; | : public is_promotable_ok { typedef std::complex<double> result; }; | |||
template<> struct promote_type<std::complex<double>, float> | template<> struct is_promotable<std::complex<double>, float> | |||
: public promote_type_ok { typedef std::complex<double> result; }; | : public is_promotable_ok { typedef std::complex<double> result; }; | |||
template<> struct promote_type<std::complex<float>, double> | template<> struct is_promotable<std::complex<float>, double> | |||
: public promote_type_ok { typedef std::complex<double> result; }; | : public is_promotable_ok { typedef std::complex<double> result; }; | |||
// template<typename T> struct promote_type<std::complex<T>, u64> : public | // template<typename T> struct is_promotable<std::complex<T>, u64> : public | |||
promote_type_ok { typedef std::complex<T> result; }; | is_promotable_ok { typedef std::complex<T> result; }; | |||
template<typename T> struct promote_type<std::complex<T>, s32> : public pro | template<typename T> struct is_promotable<std::complex<T>, s32> : public is | |||
mote_type_ok { typedef std::complex<T> result; }; | _promotable_ok { typedef std::complex<T> result; }; | |||
template<typename T> struct promote_type<std::complex<T>, u32> : public pro | template<typename T> struct is_promotable<std::complex<T>, u32> : public is | |||
mote_type_ok { typedef std::complex<T> result; }; | _promotable_ok { typedef std::complex<T> result; }; | |||
template<typename T> struct promote_type<std::complex<T>, s16> : public pro | template<typename T> struct is_promotable<std::complex<T>, s16> : public is | |||
mote_type_ok { typedef std::complex<T> result; }; | _promotable_ok { typedef std::complex<T> result; }; | |||
template<typename T> struct promote_type<std::complex<T>, u16> : public pro | template<typename T> struct is_promotable<std::complex<T>, u16> : public is | |||
mote_type_ok { typedef std::complex<T> result; }; | _promotable_ok { typedef std::complex<T> result; }; | |||
template<typename T> struct promote_type<std::complex<T>, s8> : public pro | template<typename T> struct is_promotable<std::complex<T>, s8> : public is | |||
mote_type_ok { typedef std::complex<T> result; }; | _promotable_ok { typedef std::complex<T> result; }; | |||
template<typename T> struct promote_type<std::complex<T>, u8> : public pro | template<typename T> struct is_promotable<std::complex<T>, u8> : public is | |||
mote_type_ok { typedef std::complex<T> result; }; | _promotable_ok { typedef std::complex<T> result; }; | |||
template<> struct promote_type<double, float> : public promote_type_ok { ty | template<> struct is_promotable<double, float> : public is_promotable_ok { | |||
pedef double result; }; | typedef double result; }; | |||
// template<> struct promote_type<double, u64 > : public promote_type_ok { | // template<> struct is_promotable<double, u64 > : public is_promotable_ok | |||
typedef double result; }; | { typedef double result; }; | |||
template<> struct promote_type<double, s32 > : public promote_type_ok { ty | template<> struct is_promotable<double, s32 > : public is_promotable_ok { | |||
pedef double result; }; | typedef double result; }; | |||
template<> struct promote_type<double, u32 > : public promote_type_ok { ty | template<> struct is_promotable<double, u32 > : public is_promotable_ok { | |||
pedef double result; }; | typedef double result; }; | |||
template<> struct promote_type<double, s16 > : public promote_type_ok { ty | template<> struct is_promotable<double, s16 > : public is_promotable_ok { | |||
pedef double result; }; | typedef double result; }; | |||
template<> struct promote_type<double, u16 > : public promote_type_ok { ty | template<> struct is_promotable<double, u16 > : public is_promotable_ok { | |||
pedef double result; }; | typedef double result; }; | |||
template<> struct promote_type<double, s8 > : public promote_type_ok { ty | template<> struct is_promotable<double, s8 > : public is_promotable_ok { | |||
pedef double result; }; | typedef double result; }; | |||
template<> struct promote_type<double, u8 > : public promote_type_ok { ty | template<> struct is_promotable<double, u8 > : public is_promotable_ok { | |||
pedef double result; }; | typedef double result; }; | |||
// template<> struct promote_type<float, u64> : public promote_type_ok { ty | // template<> struct is_promotable<float, u64> : public is_promotable_ok { | |||
pedef float result; }; | typedef float result; }; | |||
template<> struct promote_type<float, s32> : public promote_type_ok { typed | template<> struct is_promotable<float, s32> : public is_promotable_ok { typ | |||
ef float result; }; | edef float result; }; | |||
template<> struct promote_type<float, u32> : public promote_type_ok { typed | template<> struct is_promotable<float, u32> : public is_promotable_ok { typ | |||
ef float result; }; | edef float result; }; | |||
template<> struct promote_type<float, s16> : public promote_type_ok { typed | template<> struct is_promotable<float, s16> : public is_promotable_ok { typ | |||
ef float result; }; | edef float result; }; | |||
template<> struct promote_type<float, u16> : public promote_type_ok { typed | template<> struct is_promotable<float, u16> : public is_promotable_ok { typ | |||
ef float result; }; | edef float result; }; | |||
template<> struct promote_type<float, s8 > : public promote_type_ok { typed | template<> struct is_promotable<float, s8 > : public is_promotable_ok { typ | |||
ef float result; }; | edef float result; }; | |||
template<> struct promote_type<float, u8 > : public promote_type_ok { typed | template<> struct is_promotable<float, u8 > : public is_promotable_ok { typ | |||
ef float result; }; | edef float result; }; | |||
// template<> struct promote_type<u64, u32> : public promote_type_ok { type | // template<> struct is_promotable<u64, u32> : public is_promotable_ok { ty | |||
def u64 result; }; | pedef u64 result; }; | |||
// template<> struct promote_type<u64, u16> : public promote_type_ok { type | // template<> struct is_promotable<u64, u16> : public is_promotable_ok { ty | |||
def u64 result; }; | pedef u64 result; }; | |||
// template<> struct promote_type<u64, u8 > : public promote_type_ok { type | // template<> struct is_promotable<u64, u8 > : public is_promotable_ok { ty | |||
def u64 result; }; | pedef u64 result; }; | |||
template<> struct promote_type<s32, u32> : public promote_type_ok { typedef | template<> struct is_promotable<s32, u32> : public is_promotable_ok { typed | |||
s32 result; }; // float ? | ef s32 result; }; // float ? | |||
template<> struct promote_type<s32, s16> : public promote_type_ok { typedef | template<> struct is_promotable<s32, s16> : public is_promotable_ok { typed | |||
s32 result; }; | ef s32 result; }; | |||
template<> struct promote_type<s32, u16> : public promote_type_ok { typedef | template<> struct is_promotable<s32, u16> : public is_promotable_ok { typed | |||
s32 result; }; | ef s32 result; }; | |||
template<> struct promote_type<s32, s8 > : public promote_type_ok { typedef | template<> struct is_promotable<s32, s8 > : public is_promotable_ok { typed | |||
s32 result; }; | ef s32 result; }; | |||
template<> struct promote_type<s32, u8 > : public promote_type_ok { typedef | template<> struct is_promotable<s32, u8 > : public is_promotable_ok { typed | |||
s32 result; }; | ef s32 result; }; | |||
template<> struct promote_type<u32, s16> : public promote_type_ok { typedef | template<> struct is_promotable<u32, s16> : public is_promotable_ok { typed | |||
s32 result; }; // float ? | ef s32 result; }; // float ? | |||
template<> struct promote_type<u32, u16> : public promote_type_ok { typedef | template<> struct is_promotable<u32, u16> : public is_promotable_ok { typed | |||
u32 result; }; | ef u32 result; }; | |||
template<> struct promote_type<u32, s8 > : public promote_type_ok { typedef | template<> struct is_promotable<u32, s8 > : public is_promotable_ok { typed | |||
s32 result; }; // float ? | ef s32 result; }; // float ? | |||
template<> struct promote_type<u32, u8 > : public promote_type_ok { typedef | template<> struct is_promotable<u32, u8 > : public is_promotable_ok { typed | |||
u32 result; }; | ef u32 result; }; | |||
template<> struct promote_type<s16, u16> : public promote_type_ok { typedef | template<> struct is_promotable<s16, u16> : public is_promotable_ok { typed | |||
s16 result; }; // s32 ? | ef s16 result; }; // s32 ? | |||
template<> struct promote_type<s16, s8 > : public promote_type_ok { typedef | template<> struct is_promotable<s16, s8 > : public is_promotable_ok { typed | |||
s16 result; }; | ef s16 result; }; | |||
template<> struct promote_type<s16, u8 > : public promote_type_ok { typedef | template<> struct is_promotable<s16, u8 > : public is_promotable_ok { typed | |||
s16 result; }; | ef s16 result; }; | |||
template<> struct promote_type<u16, s8> : public promote_type_ok { typedef | template<> struct is_promotable<u16, s8> : public is_promotable_ok { typede | |||
s16 result; }; // s32 ? | f s16 result; }; // s32 ? | |||
template<> struct promote_type<u16, u8> : public promote_type_ok { typedef | template<> struct is_promotable<u16, u8> : public is_promotable_ok { typede | |||
u16 result; }; | f u16 result; }; | |||
template<> struct promote_type<s8, u8> : public promote_type_ok { typedef s 8 result; }; // s16 ? | template<> struct is_promotable<s8, u8> : public is_promotable_ok { typedef s8 result; }; // s16 ? | |||
// | // | |||
// mirrored versions | // mirrored versions | |||
template<typename T> struct promote_type<T, std::complex<T> > : public prom | template<typename T> struct is_promotable<T, std::complex<T> > : public is_ | |||
ote_type_ok { typedef std::complex<T> result; }; | promotable_ok { typedef std::complex<T> result; }; | |||
template<> struct is_promotable<std::complex<float>, std::complex<double> > | ||||
: public is_promotable_ok { typedef std::complex<double> result; }; | ||||
template<> struct is_promotable<float, std::complex<double> > | ||||
: public is_promotable_ok { typedef std::complex<double> result; }; | ||||
template<> struct is_promotable<double, std::complex<float> > | ||||
: public is_promotable_ok { typedef std::complex<double> result; }; | ||||
// template<typename T> struct is_promotable<u64, std::complex<T> > : publi | ||||
c is_promotable_ok { typedef std::complex<T> result; }; | ||||
template<typename T> struct is_promotable<s32, std::complex<T> > : public i | ||||
s_promotable_ok { typedef std::complex<T> result; }; | ||||
template<typename T> struct is_promotable<u32, std::complex<T> > : public i | ||||
s_promotable_ok { typedef std::complex<T> result; }; | ||||
template<typename T> struct is_promotable<s16, std::complex<T> > : public i | ||||
s_promotable_ok { typedef std::complex<T> result; }; | ||||
template<typename T> struct is_promotable<u16, std::complex<T> > : public i | ||||
s_promotable_ok { typedef std::complex<T> result; }; | ||||
template<typename T> struct is_promotable<s8, std::complex<T> > : public i | ||||
s_promotable_ok { typedef std::complex<T> result; }; | ||||
template<typename T> struct is_promotable<u8, std::complex<T> > : public i | ||||
s_promotable_ok { typedef std::complex<T> result; }; | ||||
template<> struct is_promotable<float, double> : public is_promotable_ok { | ||||
typedef double result; }; | ||||
// template<> struct is_promotable<u64 , double> : public is_promotable_ok | ||||
{ typedef double result; }; | ||||
template<> struct is_promotable<s32 , double> : public is_promotable_ok { | ||||
typedef double result; }; | ||||
template<> struct is_promotable<u32 , double> : public is_promotable_ok { | ||||
typedef double result; }; | ||||
template<> struct is_promotable<s16 , double> : public is_promotable_ok { | ||||
typedef double result; }; | ||||
template<> struct is_promotable<u16 , double> : public is_promotable_ok { | ||||
typedef double result; }; | ||||
template<> struct is_promotable<s8 , double> : public is_promotable_ok { | ||||
typedef double result; }; | ||||
template<> struct is_promotable<u8 , double> : public is_promotable_ok { | ||||
typedef double result; }; | ||||
// template<> struct is_promotable<u64, float> : public is_promotable_ok { | ||||
typedef float result; }; | ||||
template<> struct is_promotable<s32, float> : public is_promotable_ok { typ | ||||
edef float result; }; | ||||
template<> struct is_promotable<u32, float> : public is_promotable_ok { typ | ||||
edef float result; }; | ||||
template<> struct is_promotable<s16, float> : public is_promotable_ok { typ | ||||
edef float result; }; | ||||
template<> struct is_promotable<u16, float> : public is_promotable_ok { typ | ||||
edef float result; }; | ||||
template<> struct is_promotable<s8 , float> : public is_promotable_ok { typ | ||||
edef float result; }; | ||||
template<> struct is_promotable<u8 , float> : public is_promotable_ok { typ | ||||
edef float result; }; | ||||
// template<> struct is_promotable<u32, u64> : public is_promotable_ok { ty | ||||
pedef u64 result; }; | ||||
// template<> struct is_promotable<u16, u64> : public is_promotable_ok { ty | ||||
pedef u64 result; }; | ||||
// template<> struct is_promotable<u8, u64> : public is_promotable_ok { ty | ||||
pedef u64 result; }; | ||||
template<> struct is_promotable<u32, s32> : public is_promotable_ok { typed | ||||
ef s32 result; }; // float ? | ||||
template<> struct is_promotable<s16, s32> : public is_promotable_ok { typed | ||||
ef s32 result; }; | ||||
template<> struct is_promotable<u16, s32> : public is_promotable_ok { typed | ||||
ef s32 result; }; | ||||
template<> struct is_promotable<s8 , s32> : public is_promotable_ok { typed | ||||
ef s32 result; }; | ||||
template<> struct is_promotable<u8 , s32> : public is_promotable_ok { typed | ||||
ef s32 result; }; | ||||
template<> struct is_promotable<s16, u32> : public is_promotable_ok { typed | ||||
ef s32 result; }; // float ? | ||||
template<> struct is_promotable<u16, u32> : public is_promotable_ok { typed | ||||
ef u32 result; }; | ||||
template<> struct is_promotable<s8 , u32> : public is_promotable_ok { typed | ||||
ef s32 result; }; // float ? | ||||
template<> struct is_promotable<u8 , u32> : public is_promotable_ok { typed | ||||
ef u32 result; }; | ||||
template<> struct is_promotable<u16, s16> : public is_promotable_ok { typed | ||||
ef s16 result; }; // s32 ? | ||||
template<> struct is_promotable<s8 , s16> : public is_promotable_ok { typed | ||||
ef s16 result; }; | ||||
template<> struct is_promotable<u8 , s16> : public is_promotable_ok { typed | ||||
ef s16 result; }; | ||||
template<> struct is_promotable<s8, u16> : public is_promotable_ok { typede | ||||
f s16 result; }; // s32 ? | ||||
template<> struct is_promotable<u8, u16> : public is_promotable_ok { typede | ||||
f u16 result; }; | ||||
template<> struct promote_type<std::complex<float>, std::complex<double> > | template<> struct is_promotable<u8, s8> : public is_promotable_ok { typedef | |||
: public promote_type_ok { typedef std::complex<double> result; }; | s8 result; }; // s16 ? | |||
template<> struct promote_type<float, std::complex<double> > | ||||
: public promote_type_ok { typedef std::complex<double> result; }; | ||||
template<> struct promote_type<double, std::complex<float> > | ||||
: public promote_type_ok { typedef std::complex<double> result; }; | ||||
// template<typename T> struct promote_type<u64, std::complex<T> > : public | ||||
promote_type_ok { typedef std::complex<T> result; }; | ||||
template<typename T> struct promote_type<s32, std::complex<T> > : public pr | ||||
omote_type_ok { typedef std::complex<T> result; }; | ||||
template<typename T> struct promote_type<u32, std::complex<T> > : public pr | ||||
omote_type_ok { typedef std::complex<T> result; }; | ||||
template<typename T> struct promote_type<s16, std::complex<T> > : public pr | ||||
omote_type_ok { typedef std::complex<T> result; }; | ||||
template<typename T> struct promote_type<u16, std::complex<T> > : public pr | ||||
omote_type_ok { typedef std::complex<T> result; }; | ||||
template<typename T> struct promote_type<s8, std::complex<T> > : public pr | ||||
omote_type_ok { typedef std::complex<T> result; }; | ||||
template<typename T> struct promote_type<u8, std::complex<T> > : public pr | ||||
omote_type_ok { typedef std::complex<T> result; }; | ||||
template<> struct promote_type<float, double> : public promote_type_ok { ty | ||||
pedef double result; }; | ||||
// template<> struct promote_type<u64 , double> : public promote_type_ok { | ||||
typedef double result; }; | ||||
template<> struct promote_type<s32 , double> : public promote_type_ok { ty | ||||
pedef double result; }; | ||||
template<> struct promote_type<u32 , double> : public promote_type_ok { ty | ||||
pedef double result; }; | ||||
template<> struct promote_type<s16 , double> : public promote_type_ok { ty | ||||
pedef double result; }; | ||||
template<> struct promote_type<u16 , double> : public promote_type_ok { ty | ||||
pedef double result; }; | ||||
template<> struct promote_type<s8 , double> : public promote_type_ok { ty | ||||
pedef double result; }; | ||||
template<> struct promote_type<u8 , double> : public promote_type_ok { ty | ||||
pedef double result; }; | ||||
// template<> struct promote_type<u64, float> : public promote_type_ok { ty | ||||
pedef float result; }; | ||||
template<> struct promote_type<s32, float> : public promote_type_ok { typed | ||||
ef float result; }; | ||||
template<> struct promote_type<u32, float> : public promote_type_ok { typed | ||||
ef float result; }; | ||||
template<> struct promote_type<s16, float> : public promote_type_ok { typed | ||||
ef float result; }; | ||||
template<> struct promote_type<u16, float> : public promote_type_ok { typed | ||||
ef float result; }; | ||||
template<> struct promote_type<s8 , float> : public promote_type_ok { typed | ||||
ef float result; }; | ||||
template<> struct promote_type<u8 , float> : public promote_type_ok { typed | ||||
ef float result; }; | ||||
// template<> struct promote_type<u32, u64> : public promote_type_ok { type | ||||
def u64 result; }; | ||||
// template<> struct promote_type<u16, u64> : public promote_type_ok { type | ||||
def u64 result; }; | ||||
// template<> struct promote_type<u8, u64> : public promote_type_ok { type | ||||
def u64 result; }; | ||||
template<> struct promote_type<u32, s32> : public promote_type_ok { typedef | ||||
s32 result; }; // float ? | ||||
template<> struct promote_type<s16, s32> : public promote_type_ok { typedef | ||||
s32 result; }; | ||||
template<> struct promote_type<u16, s32> : public promote_type_ok { typedef | ||||
s32 result; }; | ||||
template<> struct promote_type<s8 , s32> : public promote_type_ok { typedef | ||||
s32 result; }; | ||||
template<> struct promote_type<u8 , s32> : public promote_type_ok { typedef | ||||
s32 result; }; | ||||
template<> struct promote_type<s16, u32> : public promote_type_ok { typedef | ||||
s32 result; }; // float ? | ||||
template<> struct promote_type<u16, u32> : public promote_type_ok { typedef | ||||
u32 result; }; | ||||
template<> struct promote_type<s8 , u32> : public promote_type_ok { typedef | ||||
s32 result; }; // float ? | ||||
template<> struct promote_type<u8 , u32> : public promote_type_ok { typedef | ||||
u32 result; }; | ||||
template<> struct promote_type<u16, s16> : public promote_type_ok { typedef | ||||
s16 result; }; // s32 ? | ||||
template<> struct promote_type<s8 , s16> : public promote_type_ok { typedef | ||||
s16 result; }; | ||||
template<> struct promote_type<u8 , s16> : public promote_type_ok { typedef | ||||
s16 result; }; | ||||
template<> struct promote_type<s8, u16> : public promote_type_ok { typedef | template<typename T1, typename T2> | |||
s16 result; }; // s32 ? | struct promote_type | |||
template<> struct promote_type<u8, u16> : public promote_type_ok { typedef | { | |||
u16 result; }; | inline static void check() | |||
{ | ||||
arma_static_assert< is_promotable<T1,T2>::value > ERROR___UNSUPPORTED_M | ||||
IXTURE_OF_TYPES; | ||||
ERROR___UNSUPPORTED_MIXTURE_OF_TYPES = ERROR___UNSUPPORTED_MIXTURE_OF_T | ||||
YPES; | ||||
} | ||||
template<> struct promote_type<u8, s8> : public promote_type_ok { typedef s | typedef typename is_promotable<T1,T2>::result result; | |||
8 result; }; // s16 ? | }; | |||
template<typename T1, typename T2> | template<typename T1, typename T2> | |||
struct eT_promoter | struct eT_promoter | |||
{ | { | |||
typedef typename promote_type<typename T1::elem_type, typename T2::elem_t ype>::result eT; | typedef typename promote_type<typename T1::elem_type, typename T2::elem_t ype>::result eT; | |||
}; | }; | |||
//! @} | //! @} | |||
End of changes. 12 change blocks. | ||||
201 lines changed or deleted | 209 lines changed or added | |||
running_stat_vec_meat.hpp | running_stat_vec_meat.hpp | |||
---|---|---|---|---|
skipping to change at line 454 | skipping to change at line 454 | |||
if(x.calc_cov == true) | if(x.calc_cov == true) | |||
{ | { | |||
Mat<eT>& tmp1 = x.tmp1; | Mat<eT>& tmp1 = x.tmp1; | |||
Mat<eT>& tmp2 = x.tmp2; | Mat<eT>& tmp2 = x.tmp2; | |||
tmp1 = sample - x.r_mean; | tmp1 = sample - x.r_mean; | |||
if(sample.n_cols == 1) | if(sample.n_cols == 1) | |||
{ | { | |||
tmp2 = conj(tmp1)*strans(tmp1); | tmp2 = conj(tmp1)*trans(tmp1); | |||
} | } | |||
else | else | |||
{ | { | |||
tmp2 = trans(tmp1)*tmp1; //tmp2 = strans(conj(tmp1))*tmp1; | tmp2 = trans(conj(tmp1))*tmp1; | |||
} | } | |||
x.r_cov *= (N_minus_1/N); | x.r_cov *= (N_minus_1/N); | |||
x.r_cov += tmp2 / N_plus_1; | x.r_cov += tmp2 / N_plus_1; | |||
} | } | |||
for(u32 i=0; i<n_elem; ++i) | for(u32 i=0; i<n_elem; ++i) | |||
{ | { | |||
const eT& val = sample_mem[i]; | const eT& val = sample_mem[i]; | |||
const T val_norm = std::norm(val); | const T val_norm = std::norm(val); | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
span.hpp | span.hpp | |||
---|---|---|---|---|
// Copyright (C) 2010-2011 NICTA (www.nicta.com.au) | // Copyright (C) 2010-2011 NICTA (www.nicta.com.au) | |||
// Copyright (C) 2010-2011 Conrad Sanderson | // Copyright (C) 2010-2011 Conrad Sanderson | |||
// Copyright (C) 2011 Stanislav Funiak | ||||
// | // | |||
// This file is part of the Armadillo C++ library. | // This file is part of the Armadillo C++ library. | |||
// It is provided without any warranty of fitness | // It is provided without any warranty of fitness | |||
// for any purpose. You can redistribute this file | // for any purpose. You can redistribute this file | |||
// and/or modify it under the terms of the GNU | // and/or modify it under the terms of the GNU | |||
// Lesser General Public License (LGPL) as published | // Lesser General Public License (LGPL) as published | |||
// by the Free Software Foundation, either version 3 | // by the Free Software Foundation, either version 3 | |||
// of the License or (at your option) any later version. | // of the License or (at your option) any later version. | |||
// (see http://www.opensource.org/licenses for more info) | // (see http://www.opensource.org/licenses for more info) | |||
//! \addtogroup span | //! \addtogroup span | |||
//! @{ | //! @{ | |||
// an "anonymous" namespace is used to avoid possible multiple definitions | struct span_alt {}; | |||
of span::all | ||||
// clashing with each other during linking | template<typename Dummy = int> | |||
namespace | class span_base | |||
{ | ||||
public: | ||||
static const span_alt all; | ||||
}; | ||||
template<typename Dummy> | ||||
const span_alt span_base<Dummy>::all = span_alt(); | ||||
class span : public span_base<> | ||||
{ | { | |||
public: | ||||
class span | u32 a; | |||
u32 b; | ||||
bool whole; | ||||
inline | ||||
span() | ||||
: a(a) | ||||
, b(b) | ||||
, whole(true) | ||||
{ | { | |||
public: | } | |||
const u32 a; | inline | |||
const u32 b; | span(const span_alt&) | |||
const bool whole; | : a(a) | |||
, b(b) | ||||
static const span all; | , whole(true) | |||
{ | ||||
inline | } | |||
span() | ||||
: a(a) | // TODO: | |||
, b(b) | // if the "explicit" keyword is removed or commented out, | |||
, whole(true) | // the compiler will be able to automatically convert integers to an inst | |||
{ | ance of the span class. | |||
} | // this is useful for Cube::operator()(span&, span&, span&), | |||
// but it might have unintended consequences or interactions elsewhere. | ||||
// TODO: | // as such, removal of "explicit" needs thorough testing. | |||
// if the "explicit" keyword is removed or commented out, | inline | |||
// the compiler will be able to automatically convert integers to an in | explicit | |||
stance of the span class. | span(const u32 in_a) | |||
// this is useful for Cube::operator()(span&, span&, span&), | : a(in_a) | |||
// but it might have unintended consequences or interactions elsewhere. | , b(in_a) | |||
// as such, removal of "explicit" needs thorough testing. | , whole(false) | |||
inline | { | |||
explicit | } | |||
span(const u32 in_a) | ||||
: a(in_a) | ||||
, b(in_a) | ||||
, whole(false) | ||||
{ | ||||
} | ||||
inline | ||||
span(const u32 in_a, const u32 in_b) | ||||
: a(in_a) | ||||
, b(in_b) | ||||
, whole(false) | ||||
{ | ||||
} | ||||
}; | inline | |||
span(const u32 in_a, const u32 in_b) | ||||
: a(in_a) | ||||
, b(in_b) | ||||
, whole(false) | ||||
{ | ||||
} | ||||
const span span::all = span(); | }; | |||
} | ||||
//! @} | //! @} | |||
End of changes. 8 change blocks. | ||||
46 lines changed or deleted | 56 lines changed or added | |||
strip.hpp | strip.hpp | |||
---|---|---|---|---|
// Copyright (C) 2010 NICTA (www.nicta.com.au) | // Copyright (C) 2010-2011 NICTA (www.nicta.com.au) | |||
// Copyright (C) 2010 Conrad Sanderson | // Copyright (C) 2010-2011 Conrad Sanderson | |||
// | // | |||
// This file is part of the Armadillo C++ library. | // This file is part of the Armadillo C++ library. | |||
// It is provided without any warranty of fitness | // It is provided without any warranty of fitness | |||
// for any purpose. You can redistribute this file | // for any purpose. You can redistribute this file | |||
// and/or modify it under the terms of the GNU | // and/or modify it under the terms of the GNU | |||
// Lesser General Public License (LGPL) as published | // Lesser General Public License (LGPL) as published | |||
// by the Free Software Foundation, either version 3 | // by the Free Software Foundation, either version 3 | |||
// of the License or (at your option) any later version. | // of the License or (at your option) any later version. | |||
// (see http://www.opensource.org/licenses for more info) | // (see http://www.opensource.org/licenses for more info) | |||
//! \addtogroup strip | //! \addtogroup strip | |||
//! @{ | //! @{ | |||
template<typename T1> | template<typename T1> | |||
struct strip_diagmat | struct strip_diagmat | |||
{ | { | |||
typedef T1 stored_type; | typedef T1 stored_type; | |||
inline strip_diagmat(const Base<typename T1::elem_type, T1>& X) | inline strip_diagmat(const Base<typename T1::elem_type, T1>& X) | |||
: do_diagmat(false) | : M(X.get_ref()) | |||
, M (X.get_ref()) | ||||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
} | } | |||
const bool do_diagmat; | static const bool do_diagmat = false; | |||
const T1& M; | ||||
const T1& M; | ||||
}; | }; | |||
template<typename T1> | template<typename T1> | |||
struct strip_diagmat< Op<T1, op_diagmat> > | struct strip_diagmat< Op<T1, op_diagmat> > | |||
{ | { | |||
typedef T1 stored_type; | typedef T1 stored_type; | |||
inline strip_diagmat(const Op<T1, op_diagmat>& X) | inline strip_diagmat(const Op<T1, op_diagmat>& X) | |||
: do_diagmat(true) | : M(X.m) | |||
, M (X.m) | ||||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
} | } | |||
const bool do_diagmat; | static const bool do_diagmat = true; | |||
const T1& M; | ||||
const T1& M; | ||||
}; | }; | |||
template<typename T1> | template<typename T1> | |||
struct strip_inv | struct strip_inv | |||
{ | { | |||
typedef T1 stored_type; | typedef T1 stored_type; | |||
inline strip_inv(const T1& X) | inline strip_inv(const T1& X) | |||
: do_inv(false) | : M(X) | |||
, M (X) | ||||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
} | } | |||
const bool do_inv; | static const bool do_inv = false; | |||
const T1& M; | ||||
const T1& M; | ||||
}; | }; | |||
template<typename T1> | template<typename T1> | |||
struct strip_inv< Op<T1, op_inv> > | struct strip_inv< Op<T1, op_inv> > | |||
{ | { | |||
typedef T1 stored_type; | typedef T1 stored_type; | |||
inline strip_inv(const Op<T1, op_inv>& X) | inline strip_inv(const Op<T1, op_inv>& X) | |||
: do_inv(true) | : M(X.m) | |||
, M (X.m) | ||||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
} | } | |||
const bool do_inv; | static const bool do_inv = true; | |||
const T1& M; | ||||
const T1& M; | ||||
}; | }; | |||
//! @} | //! @} | |||
End of changes. 9 change blocks. | ||||
18 lines changed or deleted | 18 lines changed or added | |||
subview_bones.hpp | subview_bones.hpp | |||
---|---|---|---|---|
skipping to change at line 131 | skipping to change at line 131 | |||
inline subview<eT> operator()(const span& row_span, const span & col_span); | inline subview<eT> operator()(const span& row_span, const span & col_span); | |||
inline const subview<eT> operator()(const span& row_span, const span & col_span) const; | inline const subview<eT> operator()(const span& row_span, const span & col_span) const; | |||
inline diagview<eT> diag(const s32 in_id = 0); | inline diagview<eT> diag(const s32 in_id = 0); | |||
inline const diagview<eT> diag(const s32 in_id = 0) const; | inline const diagview<eT> diag(const s32 in_id = 0) const; | |||
inline void swap_rows(const u32 in_row1, const u32 in_row2); | inline void swap_rows(const u32 in_row1, const u32 in_row2); | |||
inline void swap_cols(const u32 in_col1, const u32 in_col2); | inline void swap_cols(const u32 in_col1, const u32 in_col2); | |||
inline void print(const std::string extra_text = "") const; | ||||
inline void print(std::ostream& user_stream, const std::string extra_text | ||||
= "") const; | ||||
inline void print_trans(const std::string extra_text = "") const; | ||||
inline void print_trans(std::ostream& user_stream, const std::string extr | ||||
a_text = "") const; | ||||
inline void raw_print(const std::string extra_text = "") const; | ||||
inline void raw_print(std::ostream& user_stream, const std::string extra_ | ||||
text = "") const; | ||||
inline void raw_print_trans(const std::string extra_text = "") const; | ||||
inline void raw_print_trans(std::ostream& user_stream, const std::string | ||||
extra_text = "") const; | ||||
// // primitive forward iterator | // // primitive forward iterator | |||
// class iter | // class iter | |||
// { | // { | |||
// public: | // public: | |||
// | // | |||
// inline iter(const subview<eT>& in_M); | // inline iter(const subview<eT>& in_M); | |||
// | // | |||
// arma_inline eT operator* () const; | // arma_inline eT operator* () const; | |||
// | // | |||
// inline void operator++(); | // inline void operator++(); | |||
End of changes. 1 change blocks. | ||||
0 lines changed or deleted | 16 lines changed or added | |||
subview_cube_bones.hpp | subview_cube_bones.hpp | |||
---|---|---|---|---|
skipping to change at line 88 | skipping to change at line 88 | |||
inline static void extract(Mat<eT>& out, const subview_cube& in); | inline static void extract(Mat<eT>& out, const subview_cube& in); | |||
inline static void plus_inplace(Mat<eT>& out, const subview_cube& in); | inline static void plus_inplace(Mat<eT>& out, const subview_cube& in); | |||
inline static void minus_inplace(Mat<eT>& out, const subview_cube& in); | inline static void minus_inplace(Mat<eT>& out, const subview_cube& in); | |||
inline static void schur_inplace(Mat<eT>& out, const subview_cube& in); | inline static void schur_inplace(Mat<eT>& out, const subview_cube& in); | |||
inline static void div_inplace(Mat<eT>& out, const subview_cube& in); | inline static void div_inplace(Mat<eT>& out, const subview_cube& in); | |||
inline void fill(const eT val); | inline void fill(const eT val); | |||
inline void zeros(); | inline void zeros(); | |||
inline void ones(); | inline void ones(); | |||
arma_inline eT& operator[](const u32 i); | inline eT& operator[](const u32 i); | |||
arma_inline eT operator[](const u32 i) const; | inline eT operator[](const u32 i) const; | |||
arma_inline eT& operator()(const u32 i); | inline eT& operator()(const u32 i); | |||
arma_inline eT operator()(const u32 i) const; | inline eT operator()(const u32 i) const; | |||
arma_inline eT& operator()(const u32 in_row, const u32 in_col, const u32 in_slice); | arma_inline eT& operator()(const u32 in_row, const u32 in_col, const u32 in_slice); | |||
arma_inline eT operator()(const u32 in_row, const u32 in_col, const u32 in_slice) const; | arma_inline eT operator()(const u32 in_row, const u32 in_col, const u32 in_slice) const; | |||
arma_inline eT& at(const u32 in_row, const u32 in_col, const u32 in_slice); | arma_inline eT& at(const u32 in_row, const u32 in_col, const u32 in_slice); | |||
arma_inline eT at(const u32 in_row, const u32 in_col, const u32 in_slice) const; | arma_inline eT at(const u32 in_row, const u32 in_col, const u32 in_slice) const; | |||
arma_inline eT* slice_colptr(const u32 in_slice, const u32 in_col); | arma_inline eT* slice_colptr(const u32 in_slice, const u32 in_col); | |||
arma_inline const eT* slice_colptr(const u32 in_slice, const u32 in_col) const; | arma_inline const eT* slice_colptr(const u32 in_slice, const u32 in_col) const; | |||
End of changes. 2 change blocks. | ||||
4 lines changed or deleted | 4 lines changed or added | |||
subview_cube_meat.hpp | subview_cube_meat.hpp | |||
---|---|---|---|---|
skipping to change at line 846 | skipping to change at line 846 | |||
inline | inline | |||
void | void | |||
subview_cube<eT>::ones() | subview_cube<eT>::ones() | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
fill(eT(1)); | fill(eT(1)); | |||
} | } | |||
template<typename eT> | template<typename eT> | |||
arma_inline | inline | |||
eT& | eT& | |||
subview_cube<eT>::operator[](const u32 i) | subview_cube<eT>::operator[](const u32 i) | |||
{ | { | |||
const u32 in_slice = i / n_elem_slice; | const u32 in_slice = i / n_elem_slice; | |||
const u32 offset = in_slice * n_elem_slice; | const u32 offset = in_slice * n_elem_slice; | |||
const u32 j = i - offset; | const u32 j = i - offset; | |||
const u32 in_col = j / n_rows; | const u32 in_col = j / n_rows; | |||
const u32 in_row = j % n_rows; | const u32 in_row = j % n_rows; | |||
const u32 index = (in_slice + aux_slice1)*m.n_elem_slice + (in_col + aux_ col1)*m.n_rows + aux_row1 + in_row; | const u32 index = (in_slice + aux_slice1)*m.n_elem_slice + (in_col + aux_ col1)*m.n_rows + aux_row1 + in_row; | |||
return access::rw( (*m_ptr).mem[index] ); | return access::rw( (*m_ptr).mem[index] ); | |||
} | } | |||
template<typename eT> | template<typename eT> | |||
arma_inline | inline | |||
eT | eT | |||
subview_cube<eT>::operator[](const u32 i) const | subview_cube<eT>::operator[](const u32 i) const | |||
{ | { | |||
const u32 in_slice = i / n_elem_slice; | const u32 in_slice = i / n_elem_slice; | |||
const u32 offset = in_slice * n_elem_slice; | const u32 offset = in_slice * n_elem_slice; | |||
const u32 j = i - offset; | const u32 j = i - offset; | |||
const u32 in_col = j / n_rows; | const u32 in_col = j / n_rows; | |||
const u32 in_row = j % n_rows; | const u32 in_row = j % n_rows; | |||
const u32 index = (in_slice + aux_slice1)*m.n_elem_slice + (in_col + aux_ col1)*m.n_rows + aux_row1 + in_row; | const u32 index = (in_slice + aux_slice1)*m.n_elem_slice + (in_col + aux_ col1)*m.n_rows + aux_row1 + in_row; | |||
return m.mem[index]; | return m.mem[index]; | |||
} | } | |||
template<typename eT> | template<typename eT> | |||
arma_inline | inline | |||
eT& | eT& | |||
subview_cube<eT>::operator()(const u32 i) | subview_cube<eT>::operator()(const u32 i) | |||
{ | { | |||
arma_debug_check( (i >= n_elem), "subview_cube::operator(): index out of bounds"); | arma_debug_check( (i >= n_elem), "subview_cube::operator(): index out of bounds"); | |||
const u32 in_slice = i / n_elem_slice; | const u32 in_slice = i / n_elem_slice; | |||
const u32 offset = in_slice * n_elem_slice; | const u32 offset = in_slice * n_elem_slice; | |||
const u32 j = i - offset; | const u32 j = i - offset; | |||
const u32 in_col = j / n_rows; | const u32 in_col = j / n_rows; | |||
const u32 in_row = j % n_rows; | const u32 in_row = j % n_rows; | |||
const u32 index = (in_slice + aux_slice1)*m.n_elem_slice + (in_col + aux_ col1)*m.n_rows + aux_row1 + in_row; | const u32 index = (in_slice + aux_slice1)*m.n_elem_slice + (in_col + aux_ col1)*m.n_rows + aux_row1 + in_row; | |||
return access::rw( (*m_ptr).mem[index] ); | return access::rw( (*m_ptr).mem[index] ); | |||
} | } | |||
template<typename eT> | template<typename eT> | |||
arma_inline | inline | |||
eT | eT | |||
subview_cube<eT>::operator()(const u32 i) const | subview_cube<eT>::operator()(const u32 i) const | |||
{ | { | |||
arma_debug_check( (i >= n_elem), "subview_cube::operator(): index out of bounds"); | arma_debug_check( (i >= n_elem), "subview_cube::operator(): index out of bounds"); | |||
const u32 in_slice = i / n_elem_slice; | const u32 in_slice = i / n_elem_slice; | |||
const u32 offset = in_slice * n_elem_slice; | const u32 offset = in_slice * n_elem_slice; | |||
const u32 j = i - offset; | const u32 j = i - offset; | |||
const u32 in_col = j / n_rows; | const u32 in_col = j / n_rows; | |||
End of changes. 4 change blocks. | ||||
4 lines changed or deleted | 4 lines changed or added | |||
subview_meat.hpp | subview_meat.hpp | |||
---|---|---|---|---|
skipping to change at line 2086 | skipping to change at line 2086 | |||
for(u32 row=0; row<n_rows; ++row) | for(u32 row=0; row<n_rows; ++row) | |||
{ | { | |||
const eT tmp = ptr1[row]; | const eT tmp = ptr1[row]; | |||
ptr1[row] = ptr2[row]; | ptr1[row] = ptr2[row]; | |||
ptr2[row] = tmp; | ptr2[row] = tmp; | |||
} | } | |||
} | } | |||
} | } | |||
template<typename eT> | ||||
inline | ||||
void | ||||
subview<eT>::print(const std::string extra_text) const | ||||
{ | ||||
arma_extra_debug_sigprint(); | ||||
Mat<eT>(*this).print(extra_text); | ||||
} | ||||
template<typename eT> | ||||
inline | ||||
void | ||||
subview<eT>::print(std::ostream& user_stream, const std::string extra_text) | ||||
const | ||||
{ | ||||
arma_extra_debug_sigprint(); | ||||
Mat<eT>(*this).print(user_stream, extra_text); | ||||
} | ||||
template<typename eT> | ||||
inline | ||||
void | ||||
subview<eT>::print_trans(const std::string extra_text) const | ||||
{ | ||||
arma_extra_debug_sigprint(); | ||||
Mat<eT>(*this).print_trans(extra_text); | ||||
} | ||||
template<typename eT> | ||||
inline | ||||
void | ||||
subview<eT>::print_trans(std::ostream& user_stream, const std::string extra | ||||
_text) const | ||||
{ | ||||
arma_extra_debug_sigprint(); | ||||
Mat<eT>(*this).print_trans(user_stream, extra_text); | ||||
} | ||||
template<typename eT> | ||||
inline | ||||
void | ||||
subview<eT>::raw_print(const std::string extra_text) const | ||||
{ | ||||
arma_extra_debug_sigprint(); | ||||
Mat<eT>(*this).raw_print(extra_text); | ||||
} | ||||
template<typename eT> | ||||
inline | ||||
void | ||||
subview<eT>::raw_print(std::ostream& user_stream, const std::string extra_t | ||||
ext) const | ||||
{ | ||||
arma_extra_debug_sigprint(); | ||||
Mat<eT>(*this).raw_print(user_stream, extra_text); | ||||
} | ||||
template<typename eT> | ||||
inline | ||||
void | ||||
subview<eT>::raw_print_trans(const std::string extra_text) const | ||||
{ | ||||
arma_extra_debug_sigprint(); | ||||
Mat<eT>(*this).raw_print_trans(extra_text); | ||||
} | ||||
template<typename eT> | ||||
inline | ||||
void | ||||
subview<eT>::raw_print_trans(std::ostream& user_stream, const std::string e | ||||
xtra_text) const | ||||
{ | ||||
arma_extra_debug_sigprint(); | ||||
Mat<eT>(*this).raw_print_trans(user_stream, extra_text); | ||||
} | ||||
// template<typename eT> | // template<typename eT> | |||
// inline | // inline | |||
// subview<eT>::iter::iter(const subview<eT>& S) | // subview<eT>::iter::iter(const subview<eT>& S) | |||
// : mem (S.m.mem) | // : mem (S.m.mem) | |||
// , n_rows (S.m.n_rows) | // , n_rows (S.m.n_rows) | |||
// , row_start (S.aux_row1) | // , row_start (S.aux_row1) | |||
// , row_end_p1(row_start + S.n_rows) | // , row_end_p1(row_start + S.n_rows) | |||
// , row (row_start) | // , row (row_start) | |||
// , col (S.aux_col1) | // , col (S.aux_col1) | |||
// , i (row + col*n_rows) | // , i (row + col*n_rows) | |||
End of changes. 1 change blocks. | ||||
0 lines changed or deleted | 84 lines changed or added | |||
traits.hpp | traits.hpp | |||
---|---|---|---|---|
skipping to change at line 482 | skipping to change at line 482 | |||
static const bool value = \ | static const bool value = \ | |||
is_float<T1>::value || | is_float<T1>::value || | |||
is_double<T1>::value || | is_double<T1>::value || | |||
is_supported_complex_float<T1>::value || | is_supported_complex_float<T1>::value || | |||
is_supported_complex_double<T1>::value; | is_supported_complex_double<T1>::value; | |||
}; | }; | |||
template<typename T> | template<typename T> | |||
struct is_signed | struct is_signed | |||
{ | { | |||
static const bool value = (T(-1) < T(0)); | static const bool value = true; | |||
}; | }; | |||
template<> struct is_signed<unsigned char > { static const bool value = fal se; }; | template<> struct is_signed<unsigned char > { static const bool value = fal se; }; | |||
template<> struct is_signed<unsigned short> { static const bool value = fal se; }; | template<> struct is_signed<unsigned short> { static const bool value = fal se; }; | |||
template<> struct is_signed<unsigned int > { static const bool value = fal se; }; | template<> struct is_signed<unsigned int > { static const bool value = fal se; }; | |||
template<> struct is_signed<unsigned long > { static const bool value = fal se; }; | template<> struct is_signed<unsigned long > { static const bool value = fal se; }; | |||
template<typename T> | template<typename T> | |||
struct is_non_integral | struct is_non_integral | |||
{ | { | |||
static const bool value = (T(1.0) != T(1.1)); | static const bool value = false; | |||
}; | }; | |||
template<> struct is_non_integral< float > { static const bo ol value = true; }; | template<> struct is_non_integral< float > { static const bo ol value = true; }; | |||
template<> struct is_non_integral< double > { static const bo ol value = true; }; | template<> struct is_non_integral< double > { static const bo ol value = true; }; | |||
template<> struct is_non_integral< std::complex<float> > { static const bo ol value = true; }; | template<> struct is_non_integral< std::complex<float> > { static const bo ol value = true; }; | |||
template<> struct is_non_integral< std::complex<double> > { static const bo ol value = true; }; | template<> struct is_non_integral< std::complex<double> > { static const bo ol value = true; }; | |||
template<> struct is_non_integral< char > { static const bool value | ||||
= false; }; | ||||
template<> struct is_non_integral< short> { static const bool value | ||||
= false; }; | ||||
template<> struct is_non_integral< int > { static const bool value | ||||
= false; }; | ||||
template<> struct is_non_integral< long > { static const bool value | ||||
= false; }; | ||||
template<> struct is_non_integral<unsigned char > { static const bool value | ||||
= false; }; | ||||
template<> struct is_non_integral<unsigned short> { static const bool value | ||||
= false; }; | ||||
template<> struct is_non_integral<unsigned int > { static const bool value | ||||
= false; }; | ||||
template<> struct is_non_integral<unsigned long > { static const bool value | ||||
= false; }; | ||||
// | // | |||
class arma_junk_class; | class arma_junk_class; | |||
template<typename T1, typename T2> | template<typename T1, typename T2> | |||
struct force_different_type | struct force_different_type | |||
{ | { | |||
typedef T1 T1_result; | typedef T1 T1_result; | |||
typedef T2 T2_result; | typedef T2 T2_result; | |||
}; | }; | |||
End of changes. 3 change blocks. | ||||
20 lines changed or deleted | 2 lines changed or added | |||
unwrap.hpp | unwrap.hpp | |||
---|---|---|---|---|
// Copyright (C) 2008-2010 NICTA (www.nicta.com.au) | // Copyright (C) 2008-2011 NICTA (www.nicta.com.au) | |||
// Copyright (C) 2008-2010 Conrad Sanderson | // Copyright (C) 2008-2011 Conrad Sanderson | |||
// | // | |||
// This file is part of the Armadillo C++ library. | // This file is part of the Armadillo C++ library. | |||
// It is provided without any warranty of fitness | // It is provided without any warranty of fitness | |||
// for any purpose. You can redistribute this file | // for any purpose. You can redistribute this file | |||
// and/or modify it under the terms of the GNU | // and/or modify it under the terms of the GNU | |||
// Lesser General Public License (LGPL) as published | // Lesser General Public License (LGPL) as published | |||
// by the Free Software Foundation, either version 3 | // by the Free Software Foundation, either version 3 | |||
// of the License or (at your option) any later version. | // of the License or (at your option) any later version. | |||
// (see http://www.opensource.org/licenses for more info) | // (see http://www.opensource.org/licenses for more info) | |||
skipping to change at line 347 | skipping to change at line 347 | |||
// | // | |||
template<typename T1> | template<typename T1> | |||
class partial_unwrap | class partial_unwrap | |||
{ | { | |||
public: | public: | |||
typedef typename T1::elem_type eT; | typedef typename T1::elem_type eT; | |||
inline partial_unwrap(const T1& A) // TODO: change this to Base ? | inline partial_unwrap(const T1& A) // TODO: change this to Base ? | |||
: do_trans(false) | : M(A) | |||
, do_times(false) | ||||
, val (1) | ||||
, M (A) | ||||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
} | } | |||
inline | inline | |||
~partial_unwrap() | ~partial_unwrap() | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
} | } | |||
const bool do_trans; | inline eT get_val() const { return eT(1); } | |||
const bool do_times; | ||||
const eT val; | static const bool do_trans = false; | |||
static const bool do_times = false; | ||||
const Mat<eT> M; | const Mat<eT> M; | |||
}; | }; | |||
template<typename eT> | template<typename eT> | |||
class partial_unwrap< Mat<eT> > | class partial_unwrap< Mat<eT> > | |||
{ | { | |||
public: | public: | |||
inline | inline | |||
partial_unwrap(const Mat<eT>& A) | partial_unwrap(const Mat<eT>& A) | |||
: do_trans(false) | : M(A) | |||
, do_times(false) | ||||
, val (1) | ||||
, M (A) | ||||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
} | } | |||
inline | inline | |||
~partial_unwrap() | ~partial_unwrap() | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
} | } | |||
const bool do_trans; | inline eT get_val() const { return eT(1); } | |||
const bool do_times; | ||||
const eT val; | static const bool do_trans = false; | |||
static const bool do_times = false; | ||||
const Mat<eT>& M; | const Mat<eT>& M; | |||
}; | }; | |||
template<typename eT> | template<typename eT> | |||
class partial_unwrap< Row<eT> > | class partial_unwrap< Row<eT> > | |||
{ | { | |||
public: | public: | |||
inline | inline | |||
partial_unwrap(const Row<eT>& A) | partial_unwrap(const Row<eT>& A) | |||
: do_trans(false) | : M(A) | |||
, do_times(false) | ||||
, val (1) | ||||
, M (A) | ||||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
} | } | |||
inline | inline | |||
~partial_unwrap() | ~partial_unwrap() | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
} | } | |||
const bool do_trans; | inline eT get_val() const { return eT(1); } | |||
const bool do_times; | ||||
const eT val; | static const bool do_trans = false; | |||
static const bool do_times = false; | ||||
const Mat<eT>& M; | const Mat<eT>& M; | |||
}; | }; | |||
template<typename eT> | template<typename eT> | |||
class partial_unwrap< Col<eT> > | class partial_unwrap< Col<eT> > | |||
{ | { | |||
public: | public: | |||
inline | inline | |||
partial_unwrap(const Col<eT>& A) | partial_unwrap(const Col<eT>& A) | |||
: do_trans(false) | : M(A) | |||
, do_times(false) | ||||
, val (1) | ||||
, M (A) | ||||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
} | } | |||
inline | inline | |||
~partial_unwrap() | ~partial_unwrap() | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
} | } | |||
const bool do_trans; | inline eT get_val() const { return eT(1); } | |||
const bool do_times; | ||||
const eT val; | static const bool do_trans = false; | |||
static const bool do_times = false; | ||||
const Mat<eT>& M; | const Mat<eT>& M; | |||
}; | }; | |||
template<typename T1> | template<typename T1> | |||
class partial_unwrap< Op<T1, op_htrans> > | class partial_unwrap< Op<T1, op_htrans> > | |||
{ | { | |||
public: | public: | |||
typedef typename T1::elem_type eT; | typedef typename T1::elem_type eT; | |||
inline | inline | |||
partial_unwrap(const Op<T1,op_htrans>& A) | partial_unwrap(const Op<T1,op_htrans>& A) | |||
: do_trans(true) | : M(A.m) | |||
, do_times(false) | ||||
, val (1) | ||||
, M (A.m) | ||||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
} | } | |||
inline | inline | |||
~partial_unwrap() | ~partial_unwrap() | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
} | } | |||
const bool do_trans; | inline eT get_val() const { return eT(1); } | |||
const bool do_times; | ||||
const eT val; | static const bool do_trans = true; | |||
static const bool do_times = false; | ||||
const Mat<eT> M; | const Mat<eT> M; | |||
}; | }; | |||
template<typename eT> | template<typename eT> | |||
class partial_unwrap< Op< Mat<eT>, op_htrans> > | class partial_unwrap< Op< Mat<eT>, op_htrans> > | |||
{ | { | |||
public: | public: | |||
inline | inline | |||
partial_unwrap(const Op< Mat<eT>, op_htrans>& A) | partial_unwrap(const Op< Mat<eT>, op_htrans>& A) | |||
: do_trans(true) | : M(A.m) | |||
, do_times(false) | ||||
, val (1) | ||||
, M (A.m) | ||||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
} | } | |||
inline | inline | |||
~partial_unwrap() | ~partial_unwrap() | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
} | } | |||
const bool do_trans; | inline eT get_val() const { return eT(1); } | |||
const bool do_times; | ||||
const eT val; | static const bool do_trans = true; | |||
static const bool do_times = false; | ||||
const Mat<eT>& M; | const Mat<eT>& M; | |||
}; | }; | |||
template<typename eT> | template<typename eT> | |||
class partial_unwrap< Op< Row<eT>, op_htrans> > | class partial_unwrap< Op< Row<eT>, op_htrans> > | |||
{ | { | |||
public: | public: | |||
inline | inline | |||
partial_unwrap(const Op< Row<eT>, op_htrans>& A) | partial_unwrap(const Op< Row<eT>, op_htrans>& A) | |||
: do_trans(true) | : M(A.m) | |||
, do_times(false) | ||||
, val (1) | ||||
, M (A.m) | ||||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
} | } | |||
inline | inline | |||
~partial_unwrap() | ~partial_unwrap() | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
} | } | |||
const bool do_trans; | inline eT get_val() const { return eT(1); } | |||
const bool do_times; | ||||
const eT val; | static const bool do_trans = true; | |||
static const bool do_times = false; | ||||
const Mat<eT>& M; | const Mat<eT>& M; | |||
}; | }; | |||
template<typename eT> | template<typename eT> | |||
class partial_unwrap< Op< Col<eT>, op_htrans> > | class partial_unwrap< Op< Col<eT>, op_htrans> > | |||
{ | { | |||
public: | public: | |||
inline | inline | |||
partial_unwrap(const Op< Col<eT>, op_htrans>& A) | partial_unwrap(const Op< Col<eT>, op_htrans>& A) | |||
: do_trans(true) | : M(A.m) | |||
, do_times(false) | ||||
, val (1) | ||||
, M (A.m) | ||||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
} | } | |||
inline | inline | |||
~partial_unwrap() | ~partial_unwrap() | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
} | } | |||
const bool do_trans; | inline eT get_val() const { return eT(1); } | |||
const bool do_times; | ||||
const eT val; | static const bool do_trans = true; | |||
static const bool do_times = false; | ||||
const Mat<eT>& M; | const Mat<eT>& M; | |||
}; | }; | |||
template<typename T1> | template<typename T1> | |||
class partial_unwrap< Op<T1, op_htrans2> > | class partial_unwrap< Op<T1, op_htrans2> > | |||
{ | { | |||
public: | public: | |||
typedef typename T1::elem_type eT; | typedef typename T1::elem_type eT; | |||
inline | inline | |||
partial_unwrap(const Op<T1,op_htrans2>& A) | partial_unwrap(const Op<T1,op_htrans2>& A) | |||
: do_trans(true) | : val(A.aux) | |||
, do_times(true) | , M (A.m) | |||
, val (A.aux) | ||||
, M (A.m) | ||||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
} | } | |||
inline | inline | |||
~partial_unwrap() | ~partial_unwrap() | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
} | } | |||
const bool do_trans; | inline eT get_val() const { return val; } | |||
const bool do_times; | ||||
static const bool do_trans = true; | ||||
static const bool do_times = true; | ||||
const eT val; | const eT val; | |||
const Mat<eT> M; | const Mat<eT> M; | |||
}; | }; | |||
template<typename eT> | template<typename eT> | |||
class partial_unwrap< Op< Mat<eT>, op_htrans2> > | class partial_unwrap< Op< Mat<eT>, op_htrans2> > | |||
{ | { | |||
public: | public: | |||
inline | inline | |||
partial_unwrap(const Op< Mat<eT>, op_htrans2>& A) | partial_unwrap(const Op< Mat<eT>, op_htrans2>& A) | |||
: do_trans(true) | : val(A.aux) | |||
, do_times(true) | , M (A.m) | |||
, val (A.aux) | ||||
, M (A.m) | ||||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
} | } | |||
inline | inline | |||
~partial_unwrap() | ~partial_unwrap() | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
} | } | |||
const bool do_trans; | inline eT get_val() const { return val; } | |||
const bool do_times; | ||||
static const bool do_trans = true; | ||||
static const bool do_times = true; | ||||
const eT val; | const eT val; | |||
const Mat<eT>& M; | const Mat<eT>& M; | |||
}; | }; | |||
template<typename eT> | template<typename eT> | |||
class partial_unwrap< Op< Row<eT>, op_htrans2> > | class partial_unwrap< Op< Row<eT>, op_htrans2> > | |||
{ | { | |||
public: | public: | |||
inline | inline | |||
partial_unwrap(const Op< Row<eT>, op_htrans2>& A) | partial_unwrap(const Op< Row<eT>, op_htrans2>& A) | |||
: do_trans(true) | : val(A.aux) | |||
, do_times(true) | , M (A.m) | |||
, val (A.aux) | ||||
, M (A.m) | ||||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
} | } | |||
inline | inline | |||
~partial_unwrap() | ~partial_unwrap() | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
} | } | |||
const bool do_trans; | inline eT get_val() const { return val; } | |||
const bool do_times; | ||||
static const bool do_trans = true; | ||||
static const bool do_times = true; | ||||
const eT val; | const eT val; | |||
const Mat<eT>& M; | const Mat<eT>& M; | |||
}; | }; | |||
template<typename eT> | template<typename eT> | |||
class partial_unwrap< Op< Col<eT>, op_htrans2> > | class partial_unwrap< Op< Col<eT>, op_htrans2> > | |||
{ | { | |||
public: | public: | |||
inline | inline | |||
partial_unwrap(const Op< Col<eT>, op_htrans2>& A) | partial_unwrap(const Op< Col<eT>, op_htrans2>& A) | |||
: do_trans(true) | : val(A.aux) | |||
, do_times(true) | , M (A.m) | |||
, val (A.aux) | ||||
, M (A.m) | ||||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
} | } | |||
inline | inline | |||
~partial_unwrap() | ~partial_unwrap() | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
} | } | |||
const bool do_trans; | inline eT get_val() const { return val; } | |||
const bool do_times; | ||||
static const bool do_trans = true; | ||||
static const bool do_times = true; | ||||
const eT val; | const eT val; | |||
const Mat<eT>& M; | const Mat<eT>& M; | |||
}; | }; | |||
template<typename T1> | template<typename T1> | |||
class partial_unwrap< eOp<T1, eop_scalar_times> > | class partial_unwrap< eOp<T1, eop_scalar_times> > | |||
{ | { | |||
public: | public: | |||
typedef typename T1::elem_type eT; | typedef typename T1::elem_type eT; | |||
inline | inline | |||
partial_unwrap(const eOp<T1,eop_scalar_times>& A) | partial_unwrap(const eOp<T1,eop_scalar_times>& A) | |||
: do_trans(false) | : val(A.aux) | |||
, do_times(true) | , M (A.P.Q) | |||
, val (A.aux) | ||||
, M (A.P.Q) | ||||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
} | } | |||
inline | inline | |||
~partial_unwrap() | ~partial_unwrap() | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
} | } | |||
const bool do_trans; | inline eT get_val() const { return val; } | |||
const bool do_times; | ||||
static const bool do_trans = false; | ||||
static const bool do_times = true; | ||||
const eT val; | const eT val; | |||
const Mat<eT> M; | const Mat<eT> M; | |||
}; | }; | |||
template<typename eT> | template<typename eT> | |||
class partial_unwrap< eOp<Mat<eT>, eop_scalar_times> > | class partial_unwrap< eOp<Mat<eT>, eop_scalar_times> > | |||
{ | { | |||
public: | public: | |||
inline | inline | |||
partial_unwrap(const eOp<Mat<eT>,eop_scalar_times>& A) | partial_unwrap(const eOp<Mat<eT>,eop_scalar_times>& A) | |||
: do_trans(false) | : val(A.aux) | |||
, do_times(true) | , M (A.P.Q) | |||
, val (A.aux) | ||||
, M (A.P.Q) | ||||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
} | } | |||
inline | inline | |||
~partial_unwrap() | ~partial_unwrap() | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
} | } | |||
const bool do_trans; | inline eT get_val() const { return val; } | |||
const bool do_times; | ||||
static const bool do_trans = false; | ||||
static const bool do_times = true; | ||||
const eT val; | const eT val; | |||
const Mat<eT>& M; | const Mat<eT>& M; | |||
}; | }; | |||
template<typename eT> | template<typename eT> | |||
class partial_unwrap< eOp<Row<eT>, eop_scalar_times> > | class partial_unwrap< eOp<Row<eT>, eop_scalar_times> > | |||
{ | { | |||
public: | public: | |||
inline | inline | |||
partial_unwrap(const eOp<Row<eT>,eop_scalar_times>& A) | partial_unwrap(const eOp<Row<eT>,eop_scalar_times>& A) | |||
: do_trans(false) | : val(A.aux) | |||
, do_times(true) | , M (A.P.Q) | |||
, val (A.aux) | ||||
, M (A.P.Q) | ||||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
} | } | |||
inline | inline | |||
~partial_unwrap() | ~partial_unwrap() | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
} | } | |||
const bool do_trans; | inline eT get_val() const { return val; } | |||
const bool do_times; | ||||
static const bool do_trans = false; | ||||
static const bool do_times = true; | ||||
const eT val; | const eT val; | |||
const Mat<eT>& M; | const Mat<eT>& M; | |||
}; | }; | |||
template<typename eT> | template<typename eT> | |||
class partial_unwrap< eOp<Col<eT>, eop_scalar_times> > | class partial_unwrap< eOp<Col<eT>, eop_scalar_times> > | |||
{ | { | |||
public: | public: | |||
inline | inline | |||
partial_unwrap(const eOp<Col<eT>,eop_scalar_times>& A) | partial_unwrap(const eOp<Col<eT>,eop_scalar_times>& A) | |||
: do_trans(false) | : val(A.aux) | |||
, do_times(true) | , M (A.P.Q) | |||
, val (A.aux) | ||||
, M (A.P.Q) | ||||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
} | } | |||
inline | inline | |||
~partial_unwrap() | ~partial_unwrap() | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
} | } | |||
const bool do_trans; | inline eT get_val() const { return val; } | |||
const bool do_times; | ||||
static const bool do_trans = false; | ||||
static const bool do_times = true; | ||||
const eT val; | const eT val; | |||
const Mat<eT>& M; | const Mat<eT>& M; | |||
}; | }; | |||
// | // | |||
template<typename T1> | template<typename T1> | |||
class partial_unwrap_check | class partial_unwrap_check | |||
{ | { | |||
public: | public: | |||
typedef typename T1::elem_type eT; | typedef typename T1::elem_type eT; | |||
inline partial_unwrap_check(const T1& A, const Mat<eT>& B) | inline partial_unwrap_check(const T1& A, const Mat<eT>& B) | |||
: do_trans(false) | : M(A) | |||
, do_times(false) | ||||
, val (1) | ||||
, M (A) | ||||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
arma_ignore(B); | arma_ignore(B); | |||
} | } | |||
inline | inline | |||
~partial_unwrap_check() | ~partial_unwrap_check() | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
} | } | |||
const bool do_trans; | inline eT get_val() const { return eT(1); } | |||
const bool do_times; | ||||
const eT val; | static const bool do_trans = false; | |||
static const bool do_times = false; | ||||
const Mat<eT> M; | const Mat<eT> M; | |||
}; | }; | |||
template<typename eT> | template<typename eT> | |||
class partial_unwrap_check< Mat<eT> > | class partial_unwrap_check< Mat<eT> > | |||
{ | { | |||
public: | public: | |||
inline | inline | |||
partial_unwrap_check(const Mat<eT>& A, const Mat<eT>& B) | partial_unwrap_check(const Mat<eT>& A, const Mat<eT>& B) | |||
: do_trans(false) | : M_local ( (&A == &B) ? new Mat<eT>(A) : 0 ) | |||
, do_times(false) | ||||
, val (1) | ||||
, M_local ( (&A == &B) ? new Mat<eT>(A) : 0 ) | ||||
, M ( (&A == &B) ? (*M_local) : A ) | , M ( (&A == &B) ? (*M_local) : A ) | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
} | } | |||
inline | inline | |||
~partial_unwrap_check() | ~partial_unwrap_check() | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
if(M_local) | if(M_local) | |||
{ | { | |||
delete M_local; | delete M_local; | |||
} | } | |||
} | } | |||
inline eT get_val() const { return eT(1); } | ||||
static const bool do_trans = false; | ||||
static const bool do_times = false; | ||||
// the order below is important | // the order below is important | |||
const bool do_trans; | ||||
const bool do_times; | ||||
const eT val; | ||||
const Mat<eT>* M_local; | const Mat<eT>* M_local; | |||
const Mat<eT>& M; | const Mat<eT>& M; | |||
}; | }; | |||
template<typename eT> | template<typename eT> | |||
class partial_unwrap_check< Row<eT> > | class partial_unwrap_check< Row<eT> > | |||
{ | { | |||
public: | public: | |||
inline | inline | |||
partial_unwrap_check(const Row<eT>& A, const Mat<eT>& B) | partial_unwrap_check(const Row<eT>& A, const Mat<eT>& B) | |||
: do_trans(false) | : M_local ( (&A == &B) ? new Mat<eT>(A) : 0 ) | |||
, do_times(false) | ||||
, val (1) | ||||
, M_local ( (&A == &B) ? new Mat<eT>(A) : 0 ) | ||||
, M ( (&A == &B) ? (*M_local) : A ) | , M ( (&A == &B) ? (*M_local) : A ) | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
} | } | |||
inline | inline | |||
~partial_unwrap_check() | ~partial_unwrap_check() | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
if(M_local) | if(M_local) | |||
{ | { | |||
delete M_local; | delete M_local; | |||
} | } | |||
} | } | |||
inline eT get_val() const { return eT(1); } | ||||
static const bool do_trans = false; | ||||
static const bool do_times = false; | ||||
// the order below is important | // the order below is important | |||
const bool do_trans; | ||||
const bool do_times; | ||||
const eT val; | ||||
const Mat<eT>* M_local; | const Mat<eT>* M_local; | |||
const Mat<eT>& M; | const Mat<eT>& M; | |||
}; | }; | |||
template<typename eT> | template<typename eT> | |||
class partial_unwrap_check< Col<eT> > | class partial_unwrap_check< Col<eT> > | |||
{ | { | |||
public: | public: | |||
inline | inline | |||
partial_unwrap_check(const Col<eT>& A, const Mat<eT>& B) | partial_unwrap_check(const Col<eT>& A, const Mat<eT>& B) | |||
: do_trans(false) | : M_local ( (&A == &B) ? new Mat<eT>(A) : 0 ) | |||
, do_times(false) | ||||
, val (1) | ||||
, M_local ( (&A == &B) ? new Mat<eT>(A) : 0 ) | ||||
, M ( (&A == &B) ? (*M_local) : A ) | , M ( (&A == &B) ? (*M_local) : A ) | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
} | } | |||
inline | inline | |||
~partial_unwrap_check() | ~partial_unwrap_check() | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
if(M_local) | if(M_local) | |||
{ | { | |||
delete M_local; | delete M_local; | |||
} | } | |||
} | } | |||
inline eT get_val() const { return eT(1); } | ||||
static const bool do_trans = false; | ||||
static const bool do_times = false; | ||||
// the order below is important | // the order below is important | |||
const bool do_trans; | ||||
const bool do_times; | ||||
const eT val; | ||||
const Mat<eT>* M_local; | const Mat<eT>* M_local; | |||
const Mat<eT>& M; | const Mat<eT>& M; | |||
}; | }; | |||
template<typename T1> | template<typename T1> | |||
class partial_unwrap_check< Op<T1, op_htrans> > | class partial_unwrap_check< Op<T1, op_htrans> > | |||
{ | { | |||
public: | public: | |||
typedef typename T1::elem_type eT; | typedef typename T1::elem_type eT; | |||
inline | inline | |||
partial_unwrap_check(const Op<T1,op_htrans>& A, const Mat<eT>& B) | partial_unwrap_check(const Op<T1,op_htrans>& A, const Mat<eT>& B) | |||
: do_trans(true) | : M(A.m) | |||
, do_times(false) | ||||
, val (1) | ||||
, M (A.m) | ||||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
arma_ignore(B); | arma_ignore(B); | |||
} | } | |||
inline | inline | |||
~partial_unwrap_check() | ~partial_unwrap_check() | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
} | } | |||
const bool do_trans; | inline eT get_val() const { return eT(1); } | |||
const bool do_times; | ||||
const eT val; | static const bool do_trans = true; | |||
static const bool do_times = false; | ||||
const Mat<eT> M; | const Mat<eT> M; | |||
}; | }; | |||
template<typename eT> | template<typename eT> | |||
class partial_unwrap_check< Op< Mat<eT>, op_htrans> > | class partial_unwrap_check< Op< Mat<eT>, op_htrans> > | |||
{ | { | |||
public: | public: | |||
inline | inline | |||
partial_unwrap_check(const Op< Mat<eT>, op_htrans>& A, const Mat<eT>& B) | partial_unwrap_check(const Op< Mat<eT>, op_htrans>& A, const Mat<eT>& B) | |||
: do_trans(true) | : M_local ( (&A.m == &B) ? new Mat<eT>(A.m) : 0 ) | |||
, do_times(false) | ||||
, val (1) | ||||
, M_local ( (&A.m == &B) ? new Mat<eT>(A.m) : 0 ) | ||||
, M ( (&A.m == &B) ? (*M_local) : A.m ) | , M ( (&A.m == &B) ? (*M_local) : A.m ) | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
} | } | |||
inline | inline | |||
~partial_unwrap_check() | ~partial_unwrap_check() | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
if(M_local) | if(M_local) | |||
{ | { | |||
delete M_local; | delete M_local; | |||
} | } | |||
} | } | |||
inline eT get_val() const { return eT(1); } | ||||
static const bool do_trans = true; | ||||
static const bool do_times = false; | ||||
// the order below is important | // the order below is important | |||
const bool do_trans; | ||||
const bool do_times; | ||||
const eT val; | ||||
const Mat<eT>* M_local; | const Mat<eT>* M_local; | |||
const Mat<eT>& M; | const Mat<eT>& M; | |||
}; | }; | |||
template<typename eT> | template<typename eT> | |||
class partial_unwrap_check< Op< Row<eT>, op_htrans> > | class partial_unwrap_check< Op< Row<eT>, op_htrans> > | |||
{ | { | |||
public: | public: | |||
inline | inline | |||
partial_unwrap_check(const Op< Row<eT>, op_htrans>& A, const Mat<eT>& B) | partial_unwrap_check(const Op< Row<eT>, op_htrans>& A, const Mat<eT>& B) | |||
: do_trans(true) | : M_local ( (&A.m == &B) ? new Mat<eT>(A.m) : 0 ) | |||
, do_times(false) | ||||
, val (1) | ||||
, M_local ( (&A.m == &B) ? new Mat<eT>(A.m) : 0 ) | ||||
, M ( (&A.m == &B) ? (*M_local) : A.m ) | , M ( (&A.m == &B) ? (*M_local) : A.m ) | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
} | } | |||
inline | inline | |||
~partial_unwrap_check() | ~partial_unwrap_check() | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
if(M_local) | if(M_local) | |||
{ | { | |||
delete M_local; | delete M_local; | |||
} | } | |||
} | } | |||
inline eT get_val() const { return eT(1); } | ||||
static const bool do_trans = true; | ||||
static const bool do_times = false; | ||||
// the order below is important | // the order below is important | |||
const bool do_trans; | ||||
const bool do_times; | ||||
const eT val; | ||||
const Mat<eT>* M_local; | const Mat<eT>* M_local; | |||
const Mat<eT>& M; | const Mat<eT>& M; | |||
}; | }; | |||
template<typename eT> | template<typename eT> | |||
class partial_unwrap_check< Op< Col<eT>, op_htrans> > | class partial_unwrap_check< Op< Col<eT>, op_htrans> > | |||
{ | { | |||
public: | public: | |||
inline | inline | |||
partial_unwrap_check(const Op< Col<eT>, op_htrans>& A, const Mat<eT>& B) | partial_unwrap_check(const Op< Col<eT>, op_htrans>& A, const Mat<eT>& B) | |||
: do_trans(true) | : M_local ( (&A.m == &B) ? new Mat<eT>(A.m) : 0 ) | |||
, do_times(false) | ||||
, val (1) | ||||
, M_local ( (&A.m == &B) ? new Mat<eT>(A.m) : 0 ) | ||||
, M ( (&A.m == &B) ? (*M_local) : A.m ) | , M ( (&A.m == &B) ? (*M_local) : A.m ) | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
} | } | |||
inline | inline | |||
~partial_unwrap_check() | ~partial_unwrap_check() | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
if(M_local) | if(M_local) | |||
{ | { | |||
delete M_local; | delete M_local; | |||
} | } | |||
} | } | |||
inline eT get_val() const { return eT(1); } | ||||
static const bool do_trans = true; | ||||
static const bool do_times = false; | ||||
// the order below is important | // the order below is important | |||
const bool do_trans; | ||||
const bool do_times; | ||||
const eT val; | ||||
const Mat<eT>* M_local; | const Mat<eT>* M_local; | |||
const Mat<eT>& M; | const Mat<eT>& M; | |||
}; | }; | |||
template<typename T1> | template<typename T1> | |||
class partial_unwrap_check< Op<T1, op_htrans2> > | class partial_unwrap_check< Op<T1, op_htrans2> > | |||
{ | { | |||
public: | public: | |||
typedef typename T1::elem_type eT; | typedef typename T1::elem_type eT; | |||
inline | inline | |||
partial_unwrap_check(const Op<T1,op_htrans2>& A, const Mat<eT>& B) | partial_unwrap_check(const Op<T1,op_htrans2>& A, const Mat<eT>& B) | |||
: do_trans(true) | : val(A.aux) | |||
, do_times(true) | , M (A.m) | |||
, val (A.aux) | ||||
, M (A.m) | ||||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
} | } | |||
inline | inline | |||
~partial_unwrap_check() | ~partial_unwrap_check() | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
} | } | |||
const bool do_trans; | inline eT get_val() const { return val; } | |||
const bool do_times; | ||||
static const bool do_trans = true; | ||||
static const bool do_times = true; | ||||
const eT val; | const eT val; | |||
const Mat<eT> M; | const Mat<eT> M; | |||
}; | }; | |||
template<typename eT> | template<typename eT> | |||
class partial_unwrap_check< Op< Mat<eT>, op_htrans2> > | class partial_unwrap_check< Op< Mat<eT>, op_htrans2> > | |||
{ | { | |||
public: | public: | |||
inline | inline | |||
partial_unwrap_check(const Op< Mat<eT>, op_htrans2>& A, const Mat<eT>& B) | partial_unwrap_check(const Op< Mat<eT>, op_htrans2>& A, const Mat<eT>& B) | |||
: do_trans(true) | : val (A.aux) | |||
, do_times(true) | ||||
, val (A.aux) | ||||
, M_local ( (&A.m == &B) ? new Mat<eT>(A.m) : 0 ) | , M_local ( (&A.m == &B) ? new Mat<eT>(A.m) : 0 ) | |||
, M ( (&A.m == &B) ? (*M_local) : A.m ) | , M ( (&A.m == &B) ? (*M_local) : A.m ) | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
} | } | |||
inline | inline | |||
~partial_unwrap_check() | ~partial_unwrap_check() | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
if(M_local) | if(M_local) | |||
{ | { | |||
delete M_local; | delete M_local; | |||
} | } | |||
} | } | |||
inline eT get_val() const { return val; } | ||||
static const bool do_trans = true; | ||||
static const bool do_times = true; | ||||
// the order below is important | // the order below is important | |||
const bool do_trans; | ||||
const bool do_times; | ||||
const eT val; | const eT val; | |||
const Mat<eT>* M_local; | const Mat<eT>* M_local; | |||
const Mat<eT>& M; | const Mat<eT>& M; | |||
}; | }; | |||
template<typename eT> | template<typename eT> | |||
class partial_unwrap_check< Op< Row<eT>, op_htrans2> > | class partial_unwrap_check< Op< Row<eT>, op_htrans2> > | |||
{ | { | |||
public: | public: | |||
inline | inline | |||
partial_unwrap_check(const Op< Row<eT>, op_htrans2>& A, const Mat<eT>& B) | partial_unwrap_check(const Op< Row<eT>, op_htrans2>& A, const Mat<eT>& B) | |||
: do_trans(true) | : val (A.aux) | |||
, do_times(true) | ||||
, val (A.aux) | ||||
, M_local ( (&A.m == &B) ? new Mat<eT>(A.m) : 0 ) | , M_local ( (&A.m == &B) ? new Mat<eT>(A.m) : 0 ) | |||
, M ( (&A.m == &B) ? (*M_local) : A.m ) | , M ( (&A.m == &B) ? (*M_local) : A.m ) | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
} | } | |||
inline | inline | |||
~partial_unwrap_check() | ~partial_unwrap_check() | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
if(M_local) | if(M_local) | |||
{ | { | |||
delete M_local; | delete M_local; | |||
} | } | |||
} | } | |||
inline eT get_val() const { return val; } | ||||
static const bool do_trans = true; | ||||
static const bool do_times = true; | ||||
// the order below is important | // the order below is important | |||
const bool do_trans; | ||||
const bool do_times; | ||||
const eT val; | const eT val; | |||
const Mat<eT>* M_local; | const Mat<eT>* M_local; | |||
const Mat<eT>& M; | const Mat<eT>& M; | |||
}; | }; | |||
template<typename eT> | template<typename eT> | |||
class partial_unwrap_check< Op< Col<eT>, op_htrans2> > | class partial_unwrap_check< Op< Col<eT>, op_htrans2> > | |||
{ | { | |||
public: | public: | |||
inline | inline | |||
partial_unwrap_check(const Op< Mat<eT>, op_htrans2>& A, const Mat<eT>& B) | partial_unwrap_check(const Op< Mat<eT>, op_htrans2>& A, const Mat<eT>& B) | |||
: do_trans(true) | : val (A.aux) | |||
, do_times(true) | ||||
, val (A.aux) | ||||
, M_local ( (&A.m == &B) ? new Mat<eT>(A.m) : 0 ) | , M_local ( (&A.m == &B) ? new Mat<eT>(A.m) : 0 ) | |||
, M ( (&A.m == &B) ? (*M_local) : A.m ) | , M ( (&A.m == &B) ? (*M_local) : A.m ) | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
} | } | |||
inline | inline | |||
~partial_unwrap_check() | ~partial_unwrap_check() | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
if(M_local) | if(M_local) | |||
{ | { | |||
delete M_local; | delete M_local; | |||
} | } | |||
} | } | |||
inline eT get_val() const { return val; } | ||||
static const bool do_trans = true; | ||||
static const bool do_times = true; | ||||
// the order below is important | // the order below is important | |||
const bool do_trans; | ||||
const bool do_times; | ||||
const eT val; | const eT val; | |||
const Mat<eT>* M_local; | const Mat<eT>* M_local; | |||
const Mat<eT>& M; | const Mat<eT>& M; | |||
}; | }; | |||
template<typename T1> | template<typename T1> | |||
class partial_unwrap_check< eOp<T1, eop_scalar_times> > | class partial_unwrap_check< eOp<T1, eop_scalar_times> > | |||
{ | { | |||
public: | public: | |||
typedef typename T1::elem_type eT; | typedef typename T1::elem_type eT; | |||
inline | inline | |||
partial_unwrap_check(const eOp<T1,eop_scalar_times>& A, const Mat<eT>& B) | partial_unwrap_check(const eOp<T1,eop_scalar_times>& A, const Mat<eT>& B) | |||
: do_trans(false) | : val(A.aux) | |||
, do_times(true) | , M (A.P.Q) | |||
, val (A.aux) | ||||
, M (A.P.Q) | ||||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
arma_ignore(B); | arma_ignore(B); | |||
} | } | |||
inline | inline | |||
~partial_unwrap_check() | ~partial_unwrap_check() | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
} | } | |||
const bool do_trans; | inline eT get_val() const { return val; } | |||
const bool do_times; | ||||
static const bool do_trans = false; | ||||
static const bool do_times = true; | ||||
const eT val; | const eT val; | |||
const Mat<eT> M; | const Mat<eT> M; | |||
}; | }; | |||
template<typename eT> | template<typename eT> | |||
class partial_unwrap_check< eOp<Mat<eT>, eop_scalar_times> > | class partial_unwrap_check< eOp<Mat<eT>, eop_scalar_times> > | |||
{ | { | |||
public: | public: | |||
inline | inline | |||
partial_unwrap_check(const eOp<Mat<eT>,eop_scalar_times>& A, const Mat<eT >& B) | partial_unwrap_check(const eOp<Mat<eT>,eop_scalar_times>& A, const Mat<eT >& B) | |||
: do_trans(false) | : val(A.aux) | |||
, do_times(true) | , M (A.P.Q) | |||
, val (A.aux) | ||||
, M (A.P.Q) | ||||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
arma_ignore(B); | arma_ignore(B); | |||
} | } | |||
inline | inline | |||
~partial_unwrap_check() | ~partial_unwrap_check() | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
} | } | |||
const bool do_trans; | inline eT get_val() const { return val; } | |||
const bool do_times; | ||||
static const bool do_trans = false; | ||||
static const bool do_times = true; | ||||
const eT val; | const eT val; | |||
const Mat<eT>& M; | const Mat<eT>& M; | |||
}; | }; | |||
template<typename eT> | template<typename eT> | |||
class partial_unwrap_check< eOp<Row<eT>, eop_scalar_times> > | class partial_unwrap_check< eOp<Row<eT>, eop_scalar_times> > | |||
{ | { | |||
public: | public: | |||
inline | inline | |||
partial_unwrap_check(const eOp<Row<eT>,eop_scalar_times>& A, const Mat<eT >& B) | partial_unwrap_check(const eOp<Row<eT>,eop_scalar_times>& A, const Mat<eT >& B) | |||
: do_trans(false) | : val(A.aux) | |||
, do_times(true) | , M (A.P.Q) | |||
, val (A.aux) | ||||
, M (A.P.Q) | ||||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
arma_ignore(B); | arma_ignore(B); | |||
} | } | |||
inline | inline | |||
~partial_unwrap_check() | ~partial_unwrap_check() | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
} | } | |||
const bool do_trans; | inline eT get_val() const { return val; } | |||
const bool do_times; | ||||
static const bool do_trans = false; | ||||
static const bool do_times = true; | ||||
const eT val; | const eT val; | |||
const Mat<eT>& M; | const Mat<eT>& M; | |||
}; | }; | |||
template<typename eT> | template<typename eT> | |||
class partial_unwrap_check< eOp<Col<eT>, eop_scalar_times> > | class partial_unwrap_check< eOp<Col<eT>, eop_scalar_times> > | |||
{ | { | |||
public: | public: | |||
inline | inline | |||
partial_unwrap_check(const eOp<Col<eT>,eop_scalar_times>& A, const Mat<eT >& B) | partial_unwrap_check(const eOp<Col<eT>,eop_scalar_times>& A, const Mat<eT >& B) | |||
: do_trans(false) | : val(A.aux) | |||
, do_times(true) | , M (A.P.Q) | |||
, val (A.aux) | ||||
, M (A.P.Q) | ||||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
arma_ignore(B); | arma_ignore(B); | |||
} | } | |||
inline | inline | |||
~partial_unwrap_check() | ~partial_unwrap_check() | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
} | } | |||
const bool do_trans; | inline eT get_val() const { return val; } | |||
const bool do_times; | ||||
static const bool do_trans = false; | ||||
static const bool do_times = true; | ||||
const eT val; | const eT val; | |||
const Mat<eT>& M; | const Mat<eT>& M; | |||
}; | }; | |||
//! @} | //! @} | |||
End of changes. 74 change blocks. | ||||
207 lines changed or deleted | 207 lines changed or added | |||