Col_meat.hpp   Col_meat.hpp 
skipping to change at line 272 skipping to change at line 272
arma_inline arma_inline
const subview_col<eT> const subview_col<eT>
Col<eT>::rows(const u32 in_row1, const u32 in_row2) Col<eT>::rows(const u32 in_row1, const u32 in_row2)
const const
{ {
arma_debug_check( ( (in_row1 > in_row2) || (in_row2 >= Mat<eT>::n_rows) ) , "Col::rows(): indices out of bounds or incorrectly used"); arma_debug_check( ( (in_row1 > in_row2) || (in_row2 >= Mat<eT>::n_rows) ) , "Col::rows(): indices out of bounds or incorrectly used");
return subview_col<eT>(*this, 0, in_row1, in_row2); return subview_col<eT>(*this, 0, in_row1, in_row2);
} }
//! remove specified row
template<typename eT>
inline
void
Col<eT>::shed_row(const u32 row_num)
{
arma_extra_debug_sigprint();
arma_debug_check( row_num >= Mat<eT>::n_rows, "Col::shed_row(): out of bo
unds");
shed_rows(row_num, row_num);
}
//! remove specified rows
template<typename eT>
inline
void
Col<eT>::shed_rows(const u32 in_row1, const u32 in_row2)
{
arma_extra_debug_sigprint();
arma_debug_check
(
(in_row1 > in_row2) || (in_row2 >= Mat<eT>::n_rows),
"Col::shed_rows(): indices out of bounds or incorrectly used"
);
const u32 n_keep_front = in_row1;
const u32 n_keep_back = Mat<eT>::n_rows - (in_row2 + 1);
Col<eT> X(n_keep_front + n_keep_back);
eT* X_mem = X.memptr();
const eT* t_mem = (*this).memptr();
if(n_keep_front > 0)
{
syslib::copy_elem( X_mem, t_mem, n_keep_front );
}
if(n_keep_back > 0)
{
syslib::copy_elem( &(X_mem[n_keep_front]), &(t_mem[in_row2+1]), n_keep_
back);
}
steal_mem(X);
}
//! insert N rows at the specified row position,
//! optionally setting the elements of the inserted rows to zero
template<typename eT>
inline
void
Col<eT>::insert_rows(const u32 row_num, const u32 N, const bool set_to_zero
)
{
arma_extra_debug_sigprint();
const u32 t_n_rows = Mat<eT>::n_rows;
const u32 A_n_rows = row_num;
const u32 B_n_rows = t_n_rows - row_num;
// insertion at row_num == n_rows is in effect an append operation
arma_debug_check( (row_num > t_n_rows), "Col::insert_rows(): out of bound
s");
if(N > 0)
{
Col<eT> out(t_n_rows + N);
eT* out_mem = out.memptr();
const eT* t_mem = (*this).memptr();
if(A_n_rows > 0)
{
syslib::copy_elem( out_mem, t_mem, A_n_rows );
}
if(B_n_rows > 0)
{
syslib::copy_elem( &(out_mem[row_num + N]), &(t_mem[row_num]), B_n_ro
ws );
}
if(set_to_zero == true)
{
arrayops::inplace_set( &(out_mem[row_num]), eT(0), N );
}
steal_mem(out);
}
}
//! insert the given object at the specified row position;
//! the given object must have one column
template<typename eT>
template<typename T1>
inline
void
Col<eT>::insert_rows(const u32 row_num, const Base<eT,T1>& X)
{
arma_extra_debug_sigprint();
Mat<eT>::insert_rows(row_num, X);
}
template<typename eT> template<typename eT>
inline inline
typename Col<eT>::row_iterator typename Col<eT>::row_iterator
Col<eT>::begin_row(const u32 row_num) Col<eT>::begin_row(const u32 row_num)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( (row_num >= Mat<eT>::n_rows), "begin_row(): index out o f bounds"); arma_debug_check( (row_num >= Mat<eT>::n_rows), "begin_row(): index out o f bounds");
return Mat<eT>::memptr() + row_num; return Mat<eT>::memptr() + row_num;
 End of changes. 1 change blocks. 
0 lines changed or deleted 109 lines changed or added


 Col_proto.hpp   Col_proto.hpp 
skipping to change at line 60 skipping to change at line 60
inline const Col& operator=(const subview_cube<eT>& X); inline const Col& operator=(const subview_cube<eT>& X);
inline mat_injector<Col> operator<<(const eT val); inline mat_injector<Col> operator<<(const eT val);
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;
inline void shed_row (const u32 row_num);
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);
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);
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;
template<u32 fixed_n_elem> template<u32 fixed_n_elem>
 End of changes. 1 change blocks. 
0 lines changed or deleted 8 lines changed or added


 Cube_meat.hpp   Cube_meat.hpp 
skipping to change at line 183 skipping to change at line 183
template<typename eT> template<typename eT>
template<typename T1, typename T2> template<typename T1, typename T2>
inline inline
void void
Cube<eT>::init Cube<eT>::init
( (
const BaseCube<typename Cube<eT>::pod_type,T1>& A, const BaseCube<typename Cube<eT>::pod_type,T1>& A,
const BaseCube<typename Cube<eT>::pod_type,T2>& B const BaseCube<typename Cube<eT>::pod_type,T2>& B
) )
{ {
arma_type_check< is_complex<eT>::value == false >::apply(); //!< compil e-time abort if eT isn't std::complex arma_extra_debug_sigprint();
typedef typename T1::elem_type T; typedef typename T1::elem_type T;
arma_type_check< is_complex<T>::value == true >::apply(); //!< compile- typedef typename ProxyCube<T1>::ea_type ea_type1;
time abort if T is std::complex typedef typename ProxyCube<T2>::ea_type ea_type2;
isnt_same_type<std::complex<T>, eT>::check(); //!< compile-time abort i arma_type_check< is_complex<eT>::value == false >::apply(); //!< compil
f types are not compatible e-time abort if eT isn't std::complex
arma_type_check< is_complex< T>::value == true >::apply(); //!< compil
e-time abort if T is std::complex
const unwrap_cube<T1> tmp_A(A.get_ref()); isnt_same_type<std::complex<T>, eT>::check(); //!< compile-time abort i
const unwrap_cube<T2> tmp_B(B.get_ref()); f types are not compatible
const Cube<T>& X = tmp_A.M; const ProxyCube<T1> X(A.get_ref());
const Cube<T>& Y = tmp_B.M; const ProxyCube<T2> Y(B.get_ref());
arma_assert_same_size(X, Y, "Cube()"); arma_assert_same_size(X, Y, "Cube()");
init(X.n_rows, X.n_cols, X.n_slices); init(X.get_n_rows(), X.get_n_cols(), X.get_n_slices());
const T* X_mem = X.mem; const u32 N = n_elem;
const T* Y_mem = Y.mem; eT* out_mem = memptr();
ea_type1 PX = X.get_ea();
ea_type2 PY = Y.get_ea();
for(u32 i=0; i<n_elem; ++i) for(u32 i=0; i<N; ++i)
{ {
access::rw(mem[i]) = std::complex<T>(X_mem[i], Y_mem[i]); out_mem[i] = std::complex<T>(PX[i], PY[i]);
}
}
//! try to steal the memory from a given cube;
//! if memory can't be stolen, copy the given cube
template<typename eT>
inline
void
Cube<eT>::steal_mem(Cube<eT>& x)
{
arma_extra_debug_sigprint();
if(this != &x)
{
if( (x.mem_state == 0) && (x.n_elem > Cube_prealloc::mem_n_elem) )
{
reset();
const u32 x_n_slices = x.n_slices;
access::rw(n_rows) = x.n_rows;
access::rw(n_cols) = x.n_cols;
access::rw(n_elem_slice) = x.n_elem_slice;
access::rw(n_slices) = x_n_slices;
access::rw(n_elem) = x.n_elem;
access::rw(mem) = x.mem;
if(x_n_slices > Cube_prealloc::mat_ptrs_size)
{
access::rw( mat_ptrs) = x.mat_ptrs;
access::rw(x.mat_ptrs) = 0;
}
else
{
access::rw(mat_ptrs) = const_cast< const Mat<eT>** >(mat_ptrs_local
);
for(u32 i=0; i < x_n_slices; ++i)
{
mat_ptrs[i] = x.mat_ptrs[i];
x.mat_ptrs[i] = 0;
}
}
access::rw(x.n_rows) = 0;
access::rw(x.n_cols) = 0;
access::rw(x.n_elem_slice) = 0;
access::rw(x.n_slices) = 0;
access::rw(x.n_elem) = 0;
access::rw(x.mem) = 0;
}
else
{
init(x);
}
} }
} }
template<typename eT> template<typename eT>
inline inline
void void
Cube<eT>::delete_mat() Cube<eT>::delete_mat()
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
skipping to change at line 744 skipping to change at line 801
arma_debug_check arma_debug_check
( (
(in_row1 > in_row2) || (in_col1 > in_col2) || (in_slice1 > in_slice2 ) || (in_row1 > in_row2) || (in_col1 > in_col2) || (in_slice1 > in_slice2 ) ||
(in_row2 >= n_rows) || (in_col2 >= n_cols) || (in_slice2 >= n_slices) , (in_row2 >= n_rows) || (in_col2 >= n_cols) || (in_slice2 >= n_slices) ,
"Cube::subcube(): indices out of bounds or incorrectly used" "Cube::subcube(): indices out of bounds or incorrectly used"
); );
return subview_cube<eT>(*this, in_row1, in_col1, in_slice1, in_row2, in_c ol2, in_slice2); return subview_cube<eT>(*this, in_row1, in_col1, in_slice1, in_row2, in_c ol2, in_slice2);
} }
//! remove specified slice
template<typename eT>
inline
void
Cube<eT>::shed_slice(const u32 slice_num)
{
arma_extra_debug_sigprint();
arma_debug_check( slice_num >= n_slices, "Cube::shed_slice(): out of boun
ds");
shed_slices(slice_num, slice_num);
}
//! remove specified slices
template<typename eT>
inline
void
Cube<eT>::shed_slices(const u32 in_slice1, const u32 in_slice2)
{
arma_extra_debug_sigprint();
arma_debug_check
(
(in_slice1 > in_slice2) || (in_slice2 >= n_slices),
"Cube::shed_slices(): indices out of bounds or incorrectly used"
);
const u32 n_keep_front = in_slice1;
const u32 n_keep_back = n_slices - (in_slice2 + 1);
Cube<eT> X(n_rows, n_cols, n_keep_front + n_keep_back);
if(n_keep_front > 0)
{
X.slices( 0, (n_keep_front-1) ) = slices( 0, (in_slice1-1) );
}
if(n_keep_back > 0)
{
X.slices( n_keep_front, (n_keep_front+n_keep_back-1) ) = slices( (in_s
lice2+1), (n_slices-1) );
}
steal_mem(X);
}
//! insert N slices at the specified slice position,
//! optionally setting the elements of the inserted slices to zero
template<typename eT>
inline
void
Cube<eT>::insert_slices(const u32 slice_num, const u32 N, const bool set_to
_zero)
{
arma_extra_debug_sigprint();
const u32 t_n_slices = n_slices;
const u32 A_n_slices = slice_num;
const u32 B_n_slices = t_n_slices - slice_num;
// insertion at slice_num == n_slices is in effect an append operation
arma_debug_check( (slice_num > t_n_slices), "Cube::insert_slices(): out o
f bounds");
if(N > 0)
{
Cube<eT> out(n_rows, n_cols, t_n_slices + N);
if(A_n_slices > 0)
{
out.slices(0, A_n_slices-1) = slices(0, A_n_slices-1);
}
if(B_n_slices > 0)
{
out.slices(slice_num + N, t_n_slices + N - 1) = slices(slice_num, t_n
_slices-1);
}
if(set_to_zero == true)
{
//out.slices(slice_num, slice_num + N - 1).zeros();
for(u32 i=slice_num; i < (slice_num + N); ++i)
{
out.slice(i).zeros();
}
}
steal_mem(out);
}
}
//! insert the given object at the specified slice position;
//! the given object must have the same number of rows and columns as the c
ube
template<typename eT>
template<typename T1>
inline
void
Cube<eT>::insert_slices(const u32 slice_num, const BaseCube<eT,T1>& X)
{
arma_extra_debug_sigprint();
const unwrap_cube<T1> tmp(X.get_ref());
const Cube<eT>& C = tmp.M;
const u32 N = C.n_slices;
const u32 t_n_slices = n_slices;
const u32 A_n_slices = slice_num;
const u32 B_n_slices = t_n_slices - slice_num;
// insertion at row_num == n_rows is in effect an append operation
arma_debug_check( (slice_num > t_n_slices), "Cube::insert_rows(): out o
f bounds");
arma_debug_check
(
( (C.n_rows != n_rows) || (C.n_cols != n_cols) ),
"Cube::insert_slices(): given object has an incompatible dimensions"
);
if(N > 0)
{
Cube<eT> out(n_rows, n_cols, t_n_slices + N);
if(A_n_slices > 0)
{
out.slices(0, A_n_slices-1) = slices(0, A_n_slices-1);
}
if(B_n_slices > 0)
{
out.slices(slice_num + N, t_n_slices + N - 1) = slices(slice_num, t_n
_slices - 1);
}
out.slices(slice_num, slice_num + N - 1) = C;
steal_mem(out);
}
}
//! create a cube from OpCube, i.e. run the previously delayed unary operat ions //! create a cube from OpCube, i.e. run the previously delayed unary operat ions
template<typename eT> template<typename eT>
template<typename T1, typename op_type> template<typename T1, typename op_type>
inline inline
Cube<eT>::Cube(const OpCube<T1, op_type>& X) Cube<eT>::Cube(const OpCube<T1, op_type>& X)
: n_rows(0) : n_rows(0)
, n_cols(0) , n_cols(0)
, n_elem_slice(0) , n_elem_slice(0)
, n_slices(0) , n_slices(0)
, n_elem(0) , n_elem(0)
skipping to change at line 946 skipping to change at line 1142
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
isnt_same_type<eT, typename T1::elem_type>::check(); isnt_same_type<eT, typename T1::elem_type>::check();
eop_type::apply_inplace_div(*this, X); eop_type::apply_inplace_div(*this, X);
return *this; return *this;
} }
//! EXPERIMENTAL
template<typename eT>
template<typename T1, typename op_type>
inline
Cube<eT>::Cube(const mtOpCube<eT, T1, op_type>& X)
: n_rows(0)
, n_cols(0)
, n_elem_slice(0)
, n_slices(0)
, n_elem(0)
, mem_state(0)
, mat_ptrs(mat_ptrs)
, mem(mem)
{
arma_extra_debug_sigprint_this(this);
op_type::apply(*this, X);
}
//! EXPERIMENTAL
template<typename eT>
template<typename T1, typename op_type>
inline
const Cube<eT>&
Cube<eT>::operator=(const mtOpCube<eT, T1, op_type>& X)
{
arma_extra_debug_sigprint();
op_type::apply(*this, X);
return *this;
}
//! EXPERIMENTAL
template<typename eT>
template<typename T1, typename op_type>
inline
const Cube<eT>&
Cube<eT>::operator+=(const mtOpCube<eT, T1, op_type>& X)
{
arma_extra_debug_sigprint();
const Cube<eT> m(X);
return (*this).operator+=(m);
}
//! EXPERIMENTAL
template<typename eT>
template<typename T1, typename op_type>
inline
const Cube<eT>&
Cube<eT>::operator-=(const mtOpCube<eT, T1, op_type>& X)
{
arma_extra_debug_sigprint();
const Cube<eT> m(X);
return (*this).operator-=(m);
}
//! EXPERIMENTAL
template<typename eT>
template<typename T1, typename op_type>
inline
const Cube<eT>&
Cube<eT>::operator%=(const mtOpCube<eT, T1, op_type>& X)
{
arma_extra_debug_sigprint();
const Cube<eT> m(X);
return (*this).operator%=(m);
}
//! EXPERIMENTAL
template<typename eT>
template<typename T1, typename op_type>
inline
const Cube<eT>&
Cube<eT>::operator/=(const mtOpCube<eT, T1, op_type>& X)
{
arma_extra_debug_sigprint();
const Cube<eT> m(X);
return (*this).operator/=(m);
}
//! create a cube from Glue, i.e. run the previously delayed binary operati ons //! create a cube from Glue, i.e. run the previously delayed binary operati ons
template<typename eT> template<typename eT>
template<typename T1, typename T2, typename glue_type> template<typename T1, typename T2, typename glue_type>
inline inline
Cube<eT>::Cube(const GlueCube<T1, T2, glue_type>& X) Cube<eT>::Cube(const GlueCube<T1, T2, glue_type>& X)
: n_rows(0) : n_rows(0)
, n_cols(0) , n_cols(0)
, n_elem_slice(0) , n_elem_slice(0)
, n_slices(0) , n_slices(0)
, n_elem(0) , n_elem(0)
skipping to change at line 1152 skipping to change at line 1437
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
isnt_same_type<eT, typename T1::elem_type>::check(); isnt_same_type<eT, typename T1::elem_type>::check();
isnt_same_type<eT, typename T2::elem_type>::check(); isnt_same_type<eT, typename T2::elem_type>::check();
eglue_type::apply_inplace_div(*this, X); eglue_type::apply_inplace_div(*this, X);
return *this; return *this;
} }
//! EXPERIMENTAL
template<typename eT>
template<typename T1, typename T2, typename glue_type>
inline
Cube<eT>::Cube(const mtGlueCube<eT, T1, T2, glue_type>& X)
: n_rows(0)
, n_cols(0)
, n_elem_slice(0)
, n_slices(0)
, n_elem(0)
, mem_state(0)
, mat_ptrs(mat_ptrs)
, mem(mem)
{
arma_extra_debug_sigprint_this(this);
glue_type::apply(*this, X);
}
//! EXPERIMENTAL
template<typename eT>
template<typename T1, typename T2, typename glue_type>
inline
const Cube<eT>&
Cube<eT>::operator=(const mtGlueCube<eT, T1, T2, glue_type>& X)
{
arma_extra_debug_sigprint();
glue_type::apply(*this, X);
return *this;
}
//! EXPERIMENTAL
template<typename eT>
template<typename T1, typename T2, typename glue_type>
inline
const Cube<eT>&
Cube<eT>::operator+=(const mtGlueCube<eT, T1, T2, glue_type>& X)
{
arma_extra_debug_sigprint();
const Cube<eT> m(X);
return (*this).operator+=(m);
}
//! EXPERIMENTAL
template<typename eT>
template<typename T1, typename T2, typename glue_type>
inline
const Cube<eT>&
Cube<eT>::operator-=(const mtGlueCube<eT, T1, T2, glue_type>& X)
{
arma_extra_debug_sigprint();
const Cube<eT> m(X);
return (*this).operator-=(m);
}
//! EXPERIMENTAL
template<typename eT>
template<typename T1, typename T2, typename glue_type>
inline
const Cube<eT>&
Cube<eT>::operator%=(const mtGlueCube<eT, T1, T2, glue_type>& X)
{
arma_extra_debug_sigprint();
const Cube<eT> m(X);
return (*this).operator%=(m);
}
//! EXPERIMENTAL
template<typename eT>
template<typename T1, typename T2, typename glue_type>
inline
const Cube<eT>&
Cube<eT>::operator/=(const mtGlueCube<eT, T1, T2, glue_type>& X)
{
arma_extra_debug_sigprint();
const Cube<eT> m(X);
return (*this).operator/=(m);
}
//! linear element accessor (treats the cube as a vector); bounds checking not done when ARMA_NO_DEBUG is defined //! linear element accessor (treats the cube as a vector); bounds checking not done when ARMA_NO_DEBUG is defined
template<typename eT> template<typename eT>
arma_inline arma_inline
eT& eT&
Cube<eT>::operator() (const u32 i) Cube<eT>::operator() (const u32 i)
{ {
arma_debug_check( (i >= n_elem), "Cube::operator(): index out of bounds") ; arma_debug_check( (i >= n_elem), "Cube::operator(): index out of bounds") ;
return access::rw(mem[i]); return access::rw(mem[i]);
} }
skipping to change at line 1493 skipping to change at line 1867
Cube<eT>::copy_size(const Cube<eT2>& m) Cube<eT>::copy_size(const Cube<eT2>& m)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
init(m.n_rows, m.n_cols, m.n_slices); init(m.n_rows, m.n_cols, m.n_slices);
} }
//! fill the cube with the specified value //! fill the cube with the specified value
template<typename eT> template<typename eT>
inline inline
void const Cube<eT>&
Cube<eT>::fill(const eT val) Cube<eT>::fill(const eT val)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arrayops::inplace_set( memptr(), val, n_elem ); arrayops::inplace_set( memptr(), val, n_elem );
return *this;
} }
template<typename eT> template<typename eT>
inline inline
void const Cube<eT>&
Cube<eT>::zeros() Cube<eT>::zeros()
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
fill(eT(0)); return (*this).fill(eT(0));
} }
template<typename eT> template<typename eT>
inline inline
void const Cube<eT>&
Cube<eT>::zeros(const u32 in_rows, const u32 in_cols, const u32 in_slices) Cube<eT>::zeros(const u32 in_rows, const u32 in_cols, const u32 in_slices)
{ {
arma_extra_debug_sigprint( arma_boost::format("in_rows = %d, in_cols = %d , in_slices = %d") % in_rows % in_cols % in_slices ); arma_extra_debug_sigprint();
set_size(in_rows, in_cols, in_slices); set_size(in_rows, in_cols, in_slices);
fill(eT(0)); return (*this).fill(eT(0));
} }
template<typename eT> template<typename eT>
inline inline
void const Cube<eT>&
Cube<eT>::ones() Cube<eT>::ones()
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
fill(eT(1)); return (*this).fill(eT(1));
} }
template<typename eT> template<typename eT>
inline inline
void const Cube<eT>&
Cube<eT>::ones(const u32 in_rows, const u32 in_cols, const u32 in_slices) Cube<eT>::ones(const u32 in_rows, const u32 in_cols, const u32 in_slices)
{ {
arma_extra_debug_sigprint( arma_boost::format("in_rows = %d, in_cols = %d , in_slices = %d") % in_rows % in_cols % in_slices ); arma_extra_debug_sigprint();
set_size(in_rows, in_cols, in_slices); set_size(in_rows, in_cols, in_slices);
fill(eT(1)); return (*this).fill(eT(1));
}
template<typename eT>
inline
const Cube<eT>&
Cube<eT>::randu()
{
arma_extra_debug_sigprint();
const u32 N = n_elem;
eT* ptr = memptr();
u32 i,j;
for(i=0, j=1; j<N; i+=2, j+=2)
{
ptr[i] = eT(eop_aux_randu<eT>());
ptr[j] = eT(eop_aux_randu<eT>());
}
if(i < N)
{
ptr[i] = eT(eop_aux_randu<eT>());
}
return *this;
}
template<typename eT>
inline
const Cube<eT>&
Cube<eT>::randu(const u32 in_rows, const u32 in_cols, const u32 in_slices)
{
arma_extra_debug_sigprint();
set_size(in_rows, in_cols, in_slices);
return (*this).randu();
}
template<typename eT>
inline
const Cube<eT>&
Cube<eT>::randn()
{
arma_extra_debug_sigprint();
const u32 N = n_elem;
eT* ptr = memptr();
u32 i,j;
for(i=0, j=1; j<N; i+=2, j+=2)
{
ptr[i] = eT(eop_aux_randn<eT>());
ptr[j] = eT(eop_aux_randn<eT>());
}
if(i < N)
{
ptr[i] = eT(eop_aux_randn<eT>());
}
return *this;
}
template<typename eT>
inline
const Cube<eT>&
Cube<eT>::randn(const u32 in_rows, const u32 in_cols, const u32 in_slices)
{
arma_extra_debug_sigprint();
set_size(in_rows, in_cols, in_slices);
return (*this).randn();
} }
template<typename eT> template<typename eT>
inline inline
void void
Cube<eT>::reset() Cube<eT>::reset()
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
init(0,0,0); init(0,0,0);
skipping to change at line 2079 skipping to change at line 2531
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
const unwrap_cube<T1> tmp(X.get_ref()); const unwrap_cube<T1> tmp(X.get_ref());
const Cube<eT>& A = tmp.M; const Cube<eT>& A = tmp.M;
arma_debug_assert_same_size( out, A, "Cube::set_real()" ); arma_debug_assert_same_size( out, A, "Cube::set_real()" );
out = A; out = A;
} }
template<typename T, typename T1>
inline
void
Cube_aux::set_real(Cube< std::complex<T> >& out, const BaseCube<T,T1>& X)
{
arma_extra_debug_sigprint();
(is_Cube<T1>::value == true) ? Cube_aux::set_real_via_unwrap(out, X) : Cu
be_aux::set_real_via_proxy(out, X);
}
template<typename eT, typename T1> template<typename eT, typename T1>
inline inline
void void
Cube_aux::set_imag(Cube<eT>& out, const BaseCube<eT,T1>& X) Cube_aux::set_imag(Cube<eT>& out, const BaseCube<eT,T1>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
} }
template<typename T, typename T1> template<typename T, typename T1>
inline inline
void void
Cube_aux::set_imag(Cube< std::complex<T> >& out, const BaseCube<T,T1>& X) Cube_aux::set_real(Cube< std::complex<T> >& out, const BaseCube<T,T1>& X)
{
arma_extra_debug_sigprint();
(is_Cube<T1>::value == true) ? Cube_aux::set_imag_via_unwrap(out, X) : Cu
be_aux::set_imag_via_proxy(out, X);
}
template<typename T, typename T1>
inline
void
Cube_aux::set_real_via_unwrap(Cube< std::complex<T> >& out, const BaseCube<
T,T1>& X)
{
arma_extra_debug_sigprint();
typedef typename std::complex<T> eT;
const unwrap_cube<T1> tmp(X.get_ref());
const Cube<T>& A = tmp.M;
arma_debug_assert_same_size( out, A, "Cube::set_real()" );
const u32 n_elem = out.n_elem;
const T* A_mem = A.memptr();
eT* out_mem = out.memptr();
for(u32 i=0; i<n_elem; ++i)
{
//out_mem[i].real() = A_mem[i];
out_mem[i] = std::complex<T>( A_mem[i], out_mem[i].imag() );
}
}
template<typename T, typename T1>
inline
void
Cube_aux::set_imag_via_unwrap(Cube< std::complex<T> >& out, const BaseCube<
T,T1>& X)
{
arma_extra_debug_sigprint();
typedef typename std::complex<T> eT;
const unwrap_cube<T1> tmp(X.get_ref());
const Cube<T>& A = tmp.M;
arma_debug_assert_same_size( out, A, "Cube::set_imag()" );
const u32 n_elem = out.n_elem;
const T* A_mem = A.memptr();
eT* out_mem = out.memptr();
for(u32 i=0; i<n_elem; ++i)
{
// out_mem[i].imag() = A_mem[i];
out_mem[i] = std::complex<T>(out_mem[i].real(), A_mem[i]);
}
}
template<typename T, typename T1>
inline
void
Cube_aux::set_real_via_proxy(Cube< std::complex<T> >& out, const BaseCube<T
,T1>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename std::complex<T> eT; typedef typename std::complex<T> eT;
typedef typename ProxyCube<T1>::ea_type ea_type;
const ProxyCube<T1> P(X.get_ref()); const ProxyCube<T1> A(X.get_ref());
arma_debug_assert_same_size( out.n_rows, out.n_cols, out.n_slices, P.n_ro arma_debug_assert_same_size
ws, P.n_cols, P.n_slices, "Cube::set_real()" ); (
out.n_rows, out.n_cols, out.n_slices,
A.get_n_rows(), A.get_n_cols(), A.get_n_slices(),
"Cube::set_real()"
);
const u32 n_elem = out.n_elem; const u32 n_elem = out.n_elem;
eT* out_mem = out.memptr(); eT* out_mem = out.memptr();
ea_type PA = A.get_ea();
for(u32 i=0; i<n_elem; ++i) for(u32 i=0; i<n_elem; ++i)
{ {
//out_mem[i].real() = P[i]; //out_mem[i].real() = PA[i];
out_mem[i] = std::complex<T>( P[i], out_mem[i].imag() ); out_mem[i] = std::complex<T>( PA[i], out_mem[i].imag() );
} }
} }
template<typename T, typename T1> template<typename T, typename T1>
inline inline
void void
Cube_aux::set_imag_via_proxy(Cube< std::complex<T> >& out, const BaseCube<T ,T1>& X) Cube_aux::set_imag(Cube< std::complex<T> >& out, const BaseCube<T,T1>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename std::complex<T> eT; typedef typename std::complex<T> eT;
typedef typename ProxyCube<T1>::ea_type ea_type;
const ProxyCube<T1> P(X.get_ref()); const ProxyCube<T1> A(X.get_ref());
arma_debug_assert_same_size( out.n_rows, out.n_cols, out.n_slices, P.n_ro arma_debug_assert_same_size
ws, P.n_cols, P.n_slices, "Cube::set_imag()" ); (
out.n_rows, out.n_cols, out.n_slices,
A.get_n_rows(), A.get_n_cols(), A.get_n_slices(),
"Cube::set_imag()"
);
const u32 n_elem = out.n_elem; const u32 n_elem = out.n_elem;
eT* out_mem = out.memptr(); eT* out_mem = out.memptr();
ea_type PA = A.get_ea();
for(u32 i=0; i<n_elem; ++i) for(u32 i=0; i<n_elem; ++i)
{ {
//out_mem[i].imag() = P[i]; //out_mem[i].imag() = PA[i];
out_mem[i] = std::complex<T>( out_mem[i].real(), P[i] ); out_mem[i] = std::complex<T>( out_mem[i].real(), PA[i] );
} }
} }
#ifdef ARMA_EXTRA_CUBE_MEAT #ifdef ARMA_EXTRA_CUBE_MEAT
#include ARMA_INCFILE_WRAP(ARMA_EXTRA_CUBE_MEAT) #include ARMA_INCFILE_WRAP(ARMA_EXTRA_CUBE_MEAT)
#endif #endif
//! @} //! @}
 End of changes. 37 change blocks. 
121 lines changed or deleted 518 lines changed or added


 Cube_proto.hpp   Cube_proto.hpp 
skipping to change at line 45 skipping to change at line 45
const u32 n_rows; //!< number of rows in each slice (read-only) const u32 n_rows; //!< number of rows in each slice (read-only)
const u32 n_cols; //!< number of columns in each slice (read-only) const u32 n_cols; //!< number of columns in each slice (read-only)
const u32 n_elem_slice; //!< number of elements in each slice (read-only ) const u32 n_elem_slice; //!< number of elements in each slice (read-only )
const u32 n_slices; //!< number of slices in the cube (read-only) const u32 n_slices; //!< number of slices in the cube (read-only)
const u32 n_elem; //!< number of elements in the cube (read-only) const u32 n_elem; //!< number of elements in the cube (read-only)
const u32 mem_state; const u32 mem_state;
// mem_state = 0: normal cube that can be resized; // mem_state = 0: normal cube that can be resized;
// mem_state = 1: use auxiliary memory until change in the number of elem ents is requested; // mem_state = 1: use auxiliary memory until change in the number of elem ents is requested;
// mem_state = 2: use auxiliary memory and don't allow the number of elem ents to be changed; // mem_state = 2: use auxiliary memory and don't allow the number of elem ents to be changed;
// mem_state = 3: fixed size via template based size specification. // mem_state = 3: fixed size (e.g. via template based size specification) .
arma_aligned const Mat<eT>** const mat_ptrs; //!< pointer to an array con taining pointers to Mat instances (one for each slice) arma_aligned const Mat<eT>** const mat_ptrs; //!< pointer to an array con taining pointers to Mat instances (one for each slice)
arma_aligned const eT* const mem; //!< pointer to the memory u sed by the cube (memory is read-only) arma_aligned const eT* const mem; //!< pointer to the memory u sed by the cube (memory is read-only)
protected: protected:
arma_aligned Mat<eT>* mat_ptrs_local[ Cube_prealloc::mat_ptrs_size ]; arma_aligned Mat<eT>* mat_ptrs_local[ Cube_prealloc::mat_ptrs_size ];
arma_aligned eT mem_local[ Cube_prealloc::mem_n_elem ]; arma_aligned eT mem_local[ Cube_prealloc::mem_n_elem ];
public: public:
skipping to change at line 99 skipping to change at line 99
arma_inline subview_cube<eT> slices(const u32 in_slice1, const u32 in_slice2); arma_inline subview_cube<eT> slices(const u32 in_slice1, const u32 in_slice2);
arma_inline const subview_cube<eT> slices(const u32 in_slice1, const u32 in_slice2) const; arma_inline const subview_cube<eT> slices(const u32 in_slice1, const u32 in_slice2) const;
arma_inline subview_cube<eT> subcube(const u32 in_row1, const u32 i n_col1, const u32 in_slice1, const u32 in_row2, const u32 in_col2, const u3 2 in_slice2); arma_inline subview_cube<eT> subcube(const u32 in_row1, const u32 i n_col1, const u32 in_slice1, const u32 in_row2, const u32 in_col2, const u3 2 in_slice2);
arma_inline const subview_cube<eT> subcube(const u32 in_row1, const u32 i n_col1, const u32 in_slice1, const u32 in_row2, const u32 in_col2, const u3 2 in_slice2) const; arma_inline const subview_cube<eT> subcube(const u32 in_row1, const u32 i n_col1, const u32 in_slice1, const u32 in_row2, const u32 in_col2, const u3 2 in_slice2) const;
arma_inline subview_cube<eT> subcube(const span& row_span, const sp an& col_span, const span& slice_span); arma_inline subview_cube<eT> subcube(const span& row_span, const sp an& col_span, const span& slice_span);
arma_inline const subview_cube<eT> subcube(const span& row_span, const sp an& col_span, const span& slice_span) const; arma_inline const subview_cube<eT> subcube(const span& row_span, const sp an& col_span, const span& slice_span) const;
inline void shed_slice(const u32 slice_num);
inline void shed_slices(const u32 in_slice1, const u32 in_slice2);
inline void insert_slices(const u32 slice_num, const u32 N, const bool se
t_to_zero = true);
template<typename T1>
inline void insert_slices(const u32 row_num, const BaseCube<eT,T1>& X);
template<typename T1, typename op_type> inline Cube(con st OpCube<T1, op_type>& X); template<typename T1, typename op_type> inline Cube(con st OpCube<T1, op_type>& X);
template<typename T1, typename op_type> inline const Cube& operator=(con st OpCube<T1, op_type>& X); template<typename T1, typename op_type> inline const Cube& operator=(con st OpCube<T1, op_type>& X);
template<typename T1, typename op_type> inline const Cube& operator+=(con st OpCube<T1, op_type>& X); template<typename T1, typename op_type> inline const Cube& operator+=(con st OpCube<T1, op_type>& X);
template<typename T1, typename op_type> inline const Cube& operator-=(con st OpCube<T1, op_type>& X); template<typename T1, typename op_type> inline const Cube& operator-=(con st OpCube<T1, op_type>& X);
template<typename T1, typename op_type> inline const Cube& operator%=(con st OpCube<T1, op_type>& X); template<typename T1, typename op_type> inline const Cube& operator%=(con st OpCube<T1, op_type>& X);
template<typename T1, typename op_type> inline const Cube& operator/=(con st OpCube<T1, op_type>& X); template<typename T1, typename op_type> inline const Cube& operator/=(con st OpCube<T1, op_type>& X);
template<typename T1, typename eop_type> inline Cube(co nst eOpCube<T1, eop_type>& X); template<typename T1, typename eop_type> inline Cube(co nst eOpCube<T1, eop_type>& X);
template<typename T1, typename eop_type> inline const Cube& operator=(co nst eOpCube<T1, eop_type>& X); template<typename T1, typename eop_type> inline const Cube& operator=(co nst eOpCube<T1, eop_type>& X);
template<typename T1, typename eop_type> inline const Cube& operator+=(co nst eOpCube<T1, eop_type>& X); template<typename T1, typename eop_type> inline const Cube& operator+=(co nst eOpCube<T1, eop_type>& X);
template<typename T1, typename eop_type> inline const Cube& operator-=(co nst eOpCube<T1, eop_type>& X); template<typename T1, typename eop_type> inline const Cube& operator-=(co nst eOpCube<T1, eop_type>& X);
template<typename T1, typename eop_type> inline const Cube& operator%=(co nst eOpCube<T1, eop_type>& X); template<typename T1, typename eop_type> inline const Cube& operator%=(co nst eOpCube<T1, eop_type>& X);
template<typename T1, typename eop_type> inline const Cube& operator/=(co nst eOpCube<T1, eop_type>& X); template<typename T1, typename eop_type> inline const Cube& operator/=(co nst eOpCube<T1, eop_type>& X);
template<typename T1, typename op_type> inline Cube(con
st mtOpCube<eT, T1, op_type>& X);
template<typename T1, typename op_type> inline const Cube& operator=(con
st mtOpCube<eT, T1, op_type>& X);
template<typename T1, typename op_type> inline const Cube& operator+=(con
st mtOpCube<eT, T1, op_type>& X);
template<typename T1, typename op_type> inline const Cube& operator-=(con
st mtOpCube<eT, T1, op_type>& X);
template<typename T1, typename op_type> inline const Cube& operator%=(con
st mtOpCube<eT, T1, op_type>& X);
template<typename T1, typename op_type> inline const Cube& operator/=(con
st mtOpCube<eT, T1, op_type>& X);
template<typename T1, typename T2, typename glue_type> inline Cube(const GlueCube<T1, T2, glue_type>& X); template<typename T1, typename T2, typename glue_type> inline Cube(const GlueCube<T1, T2, glue_type>& X);
template<typename T1, typename T2, typename glue_type> inline const Cube& operator=(const GlueCube<T1, T2, glue_type>& X); template<typename T1, typename T2, typename glue_type> inline const Cube& operator=(const GlueCube<T1, T2, glue_type>& X);
template<typename T1, typename T2, typename glue_type> inline const Cube& operator+=(const GlueCube<T1, T2, glue_type>& X); template<typename T1, typename T2, typename glue_type> inline const Cube& operator+=(const GlueCube<T1, T2, glue_type>& X);
template<typename T1, typename T2, typename glue_type> inline const Cube& operator-=(const GlueCube<T1, T2, glue_type>& X); template<typename T1, typename T2, typename glue_type> inline const Cube& operator-=(const GlueCube<T1, T2, glue_type>& X);
template<typename T1, typename T2, typename glue_type> inline const Cube& operator%=(const GlueCube<T1, T2, glue_type>& X); template<typename T1, typename T2, typename glue_type> inline const Cube& operator%=(const GlueCube<T1, T2, glue_type>& X);
template<typename T1, typename T2, typename glue_type> inline const Cube& operator/=(const GlueCube<T1, T2, glue_type>& X); template<typename T1, typename T2, typename glue_type> inline const Cube& operator/=(const GlueCube<T1, T2, glue_type>& X);
template<typename T1, typename T2, typename eglue_type> inline Cube(const eGlueCube<T1, T2, eglue_type>& X); template<typename T1, typename T2, typename eglue_type> inline Cube(const eGlueCube<T1, T2, eglue_type>& X);
template<typename T1, typename T2, typename eglue_type> inline const Cube & operator=(const eGlueCube<T1, T2, eglue_type>& X); template<typename T1, typename T2, typename eglue_type> inline const Cube & operator=(const eGlueCube<T1, T2, eglue_type>& X);
template<typename T1, typename T2, typename eglue_type> inline const Cube & operator+=(const eGlueCube<T1, T2, eglue_type>& X); template<typename T1, typename T2, typename eglue_type> inline const Cube & operator+=(const eGlueCube<T1, T2, eglue_type>& X);
template<typename T1, typename T2, typename eglue_type> inline const Cube & operator-=(const eGlueCube<T1, T2, eglue_type>& X); template<typename T1, typename T2, typename eglue_type> inline const Cube & operator-=(const eGlueCube<T1, T2, eglue_type>& X);
template<typename T1, typename T2, typename eglue_type> inline const Cube & operator%=(const eGlueCube<T1, T2, eglue_type>& X); template<typename T1, typename T2, typename eglue_type> inline const Cube & operator%=(const eGlueCube<T1, T2, eglue_type>& X);
template<typename T1, typename T2, typename eglue_type> inline const Cube & operator/=(const eGlueCube<T1, T2, eglue_type>& X); template<typename T1, typename T2, typename eglue_type> inline const Cube & operator/=(const eGlueCube<T1, T2, eglue_type>& X);
template<typename T1, typename T2, typename glue_type> inline
Cube(const mtGlueCube<eT, T1, T2, glue_type>& X);
template<typename T1, typename T2, typename glue_type> inline const Cube&
operator=(const mtGlueCube<eT, T1, T2, glue_type>& X);
template<typename T1, typename T2, typename glue_type> inline const Cube&
operator+=(const mtGlueCube<eT, T1, T2, glue_type>& X);
template<typename T1, typename T2, typename glue_type> inline const Cube&
operator-=(const mtGlueCube<eT, T1, T2, glue_type>& X);
template<typename T1, typename T2, typename glue_type> inline const Cube&
operator%=(const mtGlueCube<eT, T1, T2, glue_type>& X);
template<typename T1, typename T2, typename glue_type> inline const Cube&
operator/=(const mtGlueCube<eT, T1, T2, glue_type>& X);
arma_inline eT& operator[] (const u32 i); arma_inline eT& operator[] (const u32 i);
arma_inline eT operator[] (const u32 i) const; arma_inline eT operator[] (const u32 i) const;
arma_inline eT& operator() (const u32 i); arma_inline eT& operator() (const u32 i);
arma_inline eT operator() (const u32 i) const; arma_inline eT operator() (const u32 i) 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& 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;
skipping to change at line 169 skipping to change at line 192
inline void print(std::ostream& user_stream, const std::string extra_text = "") const; inline void print(std::ostream& user_stream, const std::string extra_text = "") const;
inline void raw_print(const std::string extra_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(std::ostream& user_stream, const std::string extra_ text = "") const;
inline void set_size(const u32 in_rows, const u32 in_cols, const u32 in_ slices); inline void set_size(const u32 in_rows, const u32 in_cols, const u32 in_ slices);
inline void reshape(const u32 in_rows, const u32 in_cols, const u32 in_ slices, const u32 dim = 0); inline void reshape(const u32 in_rows, const u32 in_cols, const u32 in_ slices, const u32 dim = 0);
template<typename eT2> inline void copy_size(const Cube<eT2>& m); template<typename eT2> inline void copy_size(const Cube<eT2>& m);
inline void fill(const eT val); inline const Cube& fill(const eT val);
inline const Cube& zeros();
inline const Cube& zeros(const u32 in_rows, const u32 in_cols, const u32
in_slices);
inline const Cube& ones();
inline const Cube& ones(const u32 in_rows, const u32 in_cols, const u32 i
n_slices);
inline void zeros(); inline const Cube& randu();
inline void zeros(const u32 in_rows, const u32 in_cols, const u32 in_slic inline const Cube& randu(const u32 in_rows, const u32 in_cols, const u32
es); in_slices);
inline void ones(); inline const Cube& randn();
inline void ones(const u32 in_rows, const u32 in_cols, const u32 in_slice inline const Cube& randn(const u32 in_rows, const u32 in_cols, const u32
s); in_slices);
inline void reset(); inline void reset();
template<typename T1> inline void set_real(const BaseCube<pod_type,T1>& X ); template<typename T1> inline void set_real(const BaseCube<pod_type,T1>& X );
template<typename T1> inline void set_imag(const BaseCube<pod_type,T1>& X ); template<typename T1> inline void set_imag(const BaseCube<pod_type,T1>& X );
inline bool save(const std::string name, const file_type type = arma_bi nary, const bool print_status = true) const; inline bool save(const std::string name, const file_type type = arma_bi nary, const bool print_status = true) const;
inline bool save( std::ostream& os, const file_type type = arma_bi nary, const bool print_status = true) const; inline bool save( std::ostream& os, const file_type type = arma_bi nary, const bool print_status = true) const;
inline bool load(const std::string name, const file_type type = auto_de tect, const bool print_status = true); inline bool load(const std::string name, const file_type type = auto_de tect, const bool print_status = true);
skipping to change at line 254 skipping to change at line 283
#endif #endif
protected: protected:
inline void init(const u32 in_rows, const u32 in_cols, const u32 in_slice s); inline void init(const u32 in_rows, const u32 in_cols, const u32 in_slice s);
inline void init(const Cube& x); inline void init(const Cube& x);
template<typename T1, typename T2> template<typename T1, typename T2>
inline void init(const BaseCube<pod_type,T1>& A, const BaseCube<pod_type, T2>& B); inline void init(const BaseCube<pod_type,T1>& A, const BaseCube<pod_type, T2>& B);
inline void steal_mem(Cube& X);
inline void delete_mat(); inline void delete_mat();
inline void create_mat(); inline void create_mat();
friend class op_reshape; friend class op_reshape;
friend class glue_join;
}; };
class Cube_aux class Cube_aux
{ {
public: public:
template<typename eT> arma_inline static void prefix_pp(Cube<eT>& x); template<typename eT> arma_inline static void prefix_pp(Cube<eT>& x);
template<typename T> arma_inline static void prefix_pp(Cube< std::comple x<T> >& x); template<typename T> arma_inline static void prefix_pp(Cube< std::comple x<T> >& x);
template<typename eT> arma_inline static void postfix_pp(Cube<eT>& x); template<typename eT> arma_inline static void postfix_pp(Cube<eT>& x);
template<typename T> arma_inline static void postfix_pp(Cube< std::compl ex<T> >& x); template<typename T> arma_inline static void postfix_pp(Cube< std::compl ex<T> >& x);
template<typename eT> arma_inline static void prefix_mm(Cube<eT>& x); template<typename eT> arma_inline static void prefix_mm(Cube<eT>& x);
template<typename T> arma_inline static void prefix_mm(Cube< std::comple x<T> >& x); template<typename T> arma_inline static void prefix_mm(Cube< std::comple x<T> >& x);
template<typename eT> arma_inline static void postfix_mm(Cube<eT>& x); template<typename eT> arma_inline static void postfix_mm(Cube<eT>& x);
template<typename T> arma_inline static void postfix_mm(Cube< std::compl ex<T> >& x); template<typename T> arma_inline static void postfix_mm(Cube< std::compl ex<T> >& x);
template<typename eT, typename T1> inline static void set_real(Cube<eT>& out, const BaseCube<eT,T1>& X); template<typename eT, typename T1> inline static void set_real(Cube<eT>& out, const BaseCube<eT,T1>& X);
template<typename T, typename T1> inline static void set_real(Cube< std:
:complex<T> >& out, const BaseCube< T,T1>& X);
template<typename eT, typename T1> inline static void set_imag(Cube<eT>& out, const BaseCube<eT,T1>& X); template<typename eT, typename T1> inline static void set_imag(Cube<eT>& out, const BaseCube<eT,T1>& X);
template<typename T, typename T1> inline static void set_imag(Cube< std: :complex<T> >& out, const BaseCube< T,T1>& X);
template<typename T, typename T1> inline static void set_real_via_unwrap template<typename T, typename T1> inline static void set_real(Cube< std:
(Cube< std::complex<T> >& out, const BaseCube< T,T1>& X); :complex<T> >& out, const BaseCube< T,T1>& X);
template<typename T, typename T1> inline static void set_imag_via_unwrap template<typename T, typename T1> inline static void set_imag(Cube< std:
(Cube< std::complex<T> >& out, const BaseCube< T,T1>& X); :complex<T> >& out, const BaseCube< T,T1>& X);
template<typename T, typename T1> inline static void set_real_via_proxy(
Cube< std::complex<T> >& out, const BaseCube< T,T1>& X);
template<typename T, typename T1> inline static void set_imag_via_proxy(
Cube< std::complex<T> >& out, const BaseCube< T,T1>& X);
}; };
//! @} //! @}
 End of changes. 12 change blocks. 
21 lines changed or deleted 59 lines changed or added


 Mat_meat.hpp   Mat_meat.hpp 
skipping to change at line 433 skipping to change at line 433
} }
} }
//! for constructing a complex matrix out of two non-complex matrices //! for constructing a complex matrix out of two non-complex matrices
template<typename eT> template<typename eT>
template<typename T1, typename T2> template<typename T1, typename T2>
inline inline
void void
Mat<eT>::init Mat<eT>::init
( (
const Base<typename Mat<eT>::pod_type,T1>& A, const Base<typename Mat<eT>::pod_type, T1>& A,
const Base<typename Mat<eT>::pod_type,T2>& B const Base<typename Mat<eT>::pod_type, T2>& B
) )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_type_check< is_complex<eT>::value == false >::apply(); //!< compil typedef typename T1::elem_type T;
e-time abort if eT isn't std::complex typedef typename Proxy<T1>::ea_type ea_type1;
typedef typename Proxy<T2>::ea_type ea_type2;
typedef typename T1::elem_type T; arma_type_check< is_complex<eT>::value == false >::apply(); //!< compil
arma_type_check< is_complex<T>::value == true >::apply(); //!< compile- e-time abort if eT isn't std::complex
time abort if T is std::complex arma_type_check< is_complex< T>::value == true >::apply(); //!< compil
e-time abort if T is std::complex
isnt_same_type<std::complex<T>, eT>::check(); //!< compile-time abort i f types are not compatible isnt_same_type<std::complex<T>, eT>::check(); //!< compile-time abort i f types are not compatible
const unwrap<T1> tmp_A(A.get_ref()); const Proxy<T1> X(A.get_ref());
const unwrap<T2> tmp_B(B.get_ref()); const Proxy<T2> Y(B.get_ref());
const Mat<T>& X = tmp_A.M;
const Mat<T>& Y = tmp_B.M;
arma_assert_same_size(X, Y, "Mat()"); arma_assert_same_size(X, Y, "Mat()");
init(X.n_rows, Y.n_cols); init(X.get_n_rows(), X.get_n_cols());
const T* X_mem = X.mem; const u32 N = n_elem;
const T* Y_mem = Y.mem; eT* out_mem = memptr();
ea_type1 PX = X.get_ea();
ea_type2 PY = Y.get_ea();
for(u32 i=0; i<n_elem; ++i) for(u32 i=0; i<N; ++i)
{ {
access::rw(mem[i]) = std::complex<T>(X_mem[i], Y_mem[i]); out_mem[i] = std::complex<T>(PX[i], PY[i]);
} }
} }
//! try to steal the memory from a given matrix; //! try to steal the memory from a given matrix;
//! if memory can't be stolen, copy the given matrix //! if memory can't be stolen, copy the given matrix
template<typename eT> template<typename eT>
inline inline
void void
Mat<eT>::steal_mem(Mat<eT>& x) Mat<eT>::steal_mem(Mat<eT>& x)
{ {
skipping to change at line 2673 skipping to change at line 2674
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
init(m.n_rows, m.n_cols); init(m.n_rows, m.n_cols);
} }
//! fill the matrix with the specified value //! fill the matrix with the specified value
template<typename eT> template<typename eT>
arma_hot arma_hot
inline inline
void const Mat<eT>&
Mat<eT>::fill(const eT val) Mat<eT>::fill(const eT val)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arrayops::inplace_set( memptr(), val, n_elem ); arrayops::inplace_set( memptr(), val, n_elem );
return *this;
} }
template<typename eT> template<typename eT>
inline inline
void const Mat<eT>&
Mat<eT>::zeros() Mat<eT>::zeros()
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
fill(eT(0)); return fill(eT(0));
} }
template<typename eT> template<typename eT>
inline inline
void const Mat<eT>&
Mat<eT>::zeros(const u32 in_elem) Mat<eT>::zeros(const u32 in_elem)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
set_size(in_elem); set_size(in_elem);
fill(eT(0)); return fill(eT(0));
} }
template<typename eT> template<typename eT>
inline inline
void const Mat<eT>&
Mat<eT>::zeros(const u32 in_rows, const u32 in_cols) Mat<eT>::zeros(const u32 in_rows, const u32 in_cols)
{ {
arma_extra_debug_sigprint( arma_boost::format("in_rows = %d, in_cols = %d ") % in_rows % in_cols ); arma_extra_debug_sigprint();
set_size(in_rows, in_cols); set_size(in_rows, in_cols);
fill(eT(0)); return fill(eT(0));
} }
template<typename eT> template<typename eT>
inline inline
void const Mat<eT>&
Mat<eT>::ones() Mat<eT>::ones()
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
fill(eT(1)); return fill(eT(1));
} }
template<typename eT> template<typename eT>
inline inline
void const Mat<eT>&
Mat<eT>::ones(const u32 in_elem) Mat<eT>::ones(const u32 in_elem)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
set_size(in_elem); set_size(in_elem);
fill(eT(1)); return fill(eT(1));
} }
template<typename eT> template<typename eT>
inline inline
void const Mat<eT>&
Mat<eT>::ones(const u32 in_rows, const u32 in_cols) Mat<eT>::ones(const u32 in_rows, const u32 in_cols)
{ {
arma_extra_debug_sigprint( arma_boost::format("in_rows = %d, in_cols = %d arma_extra_debug_sigprint();
") % in_rows % in_cols );
set_size(in_rows, in_cols);
return fill(eT(1));
}
template<typename eT>
inline
const Mat<eT>&
Mat<eT>::randu()
{
arma_extra_debug_sigprint();
const u32 N = n_elem;
eT* ptr = memptr();
u32 i,j;
for(i=0, j=1; j<N; i+=2, j+=2)
{
ptr[i] = eT(eop_aux_randu<eT>());
ptr[j] = eT(eop_aux_randu<eT>());
}
if(i < N)
{
ptr[i] = eT(eop_aux_randu<eT>());
}
return *this;
}
template<typename eT>
inline
const Mat<eT>&
Mat<eT>::randu(const u32 in_elem)
{
arma_extra_debug_sigprint();
set_size(in_elem);
return (*this).randu();
}
template<typename eT>
inline
const Mat<eT>&
Mat<eT>::randu(const u32 in_rows, const u32 in_cols)
{
arma_extra_debug_sigprint();
set_size(in_rows, in_cols); set_size(in_rows, in_cols);
fill(eT(1)); return (*this).randu();
}
template<typename eT>
inline
const Mat<eT>&
Mat<eT>::randn()
{
arma_extra_debug_sigprint();
const u32 N = n_elem;
eT* ptr = memptr();
for(u32 i=0; i<N; ++i)
{
ptr[i] = eT(eop_aux_randn<eT>());
}
return *this;
}
template<typename eT>
inline
const Mat<eT>&
Mat<eT>::randn(const u32 in_elem)
{
arma_extra_debug_sigprint();
set_size(in_elem);
return (*this).randn();
}
template<typename eT>
inline
const Mat<eT>&
Mat<eT>::randn(const u32 in_rows, const u32 in_cols)
{
arma_extra_debug_sigprint();
set_size(in_rows, in_cols);
return (*this).randn();
}
template<typename eT>
inline
const Mat<eT>&
Mat<eT>::eye()
{
arma_extra_debug_sigprint();
fill(eT(0));
const u32 N = (std::min)(n_rows, n_cols);
for(u32 i=0; i<N; ++i)
{
at(i,i) = eT(1);
}
return *this;
}
template<typename eT>
inline
const Mat<eT>&
Mat<eT>::eye(const u32 in_rows, const u32 in_cols)
{
arma_extra_debug_sigprint();
set_size(in_rows, in_cols);
return (*this).eye();
} }
template<typename eT> template<typename eT>
inline inline
void void
Mat<eT>::reset() Mat<eT>::reset()
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
init(0,0); init(0,0);
skipping to change at line 3508 skipping to change at line 3634
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
const unwrap<T1> tmp(X.get_ref()); const unwrap<T1> tmp(X.get_ref());
const Mat<eT>& A = tmp.M; const Mat<eT>& A = tmp.M;
arma_debug_assert_same_size( out, A, "Mat::set_real()" ); arma_debug_assert_same_size( out, A, "Mat::set_real()" );
out = A; out = A;
} }
template<typename T, typename T1>
inline
void
Mat_aux::set_real(Mat< std::complex<T> >& out, const Base<T,T1>& X)
{
arma_extra_debug_sigprint();
(is_Mat<T1>::value == true) ? Mat_aux::set_real_via_unwrap(out, X) : Mat_
aux::set_real_via_proxy(out, X);
}
template<typename eT, typename T1> template<typename eT, typename T1>
inline inline
void void
Mat_aux::set_imag(Mat<eT>& out, const Base<eT,T1>& X) Mat_aux::set_imag(Mat<eT>& out, const Base<eT,T1>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
} }
template<typename T, typename T1> template<typename T, typename T1>
inline inline
void void
Mat_aux::set_imag(Mat< std::complex<T> >& out, const Base<T,T1>& X) Mat_aux::set_real(Mat< std::complex<T> >& out, const Base<T,T1>& X)
{
arma_extra_debug_sigprint();
(is_Mat<T1>::value == true) ? Mat_aux::set_imag_via_unwrap(out, X) : Mat_
aux::set_imag_via_proxy(out, X);
}
template<typename T, typename T1>
inline
void
Mat_aux::set_real_via_unwrap(Mat< std::complex<T> >& out, const Base<T,T1>&
X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename std::complex<T> eT; typedef typename std::complex<T> eT;
typedef typename Proxy<T1>::ea_type ea_type;
const unwrap<T1> tmp(X.get_ref()); const Proxy<T1> A(X.get_ref());
const Mat<T>& A = tmp.M;
arma_debug_assert_same_size( out, A, "Mat::set_real()" ); arma_debug_assert_same_size( out, A, "Mat::set_real()" );
const u32 n_elem = out.n_elem; const u32 n_elem = out.n_elem;
eT* out_mem = out.memptr();
const T* A_mem = A.memptr(); ea_type PA = A.get_ea();
eT* out_mem = out.memptr();
for(u32 i=0; i<n_elem; ++i) for(u32 i=0; i<n_elem; ++i)
{ {
//out_mem[i].real() = A_mem[i]; //out_mem[i].real() = PA[i];
out_mem[i] = std::complex<T>( A_mem[i], out_mem[i].imag() ); out_mem[i] = std::complex<T>( PA[i], out_mem[i].imag() );
} }
} }
template<typename T, typename T1> template<typename T, typename T1>
inline inline
void void
Mat_aux::set_imag_via_unwrap(Mat< std::complex<T> >& out, const Base<T,T1>& X) Mat_aux::set_imag(Mat< std::complex<T> >& out, const Base<T,T1>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename std::complex<T> eT; typedef typename std::complex<T> eT;
typedef typename Proxy<T1>::ea_type ea_type;
const unwrap<T1> tmp(X.get_ref()); const Proxy<T1> A(X.get_ref());
const Mat<T>& A = tmp.M;
arma_debug_assert_same_size( out, A, "Mat::set_imag()" ); arma_debug_assert_same_size( out, A, "Mat::set_imag()" );
const u32 n_elem = out.n_elem; const u32 n_elem = out.n_elem;
eT* out_mem = out.memptr();
const T* A_mem = A.memptr(); ea_type PA = A.get_ea();
eT* out_mem = out.memptr();
for(u32 i=0; i<n_elem; ++i)
{
// out_mem[i].imag() = A_mem[i];
out_mem[i] = std::complex<T>(out_mem[i].real(), A_mem[i]);
}
}
template<typename T, typename T1>
inline
void
Mat_aux::set_real_via_proxy(Mat< std::complex<T> >& out, const Base<T,T1>&
X)
{
arma_extra_debug_sigprint();
typedef typename std::complex<T> eT;
const Proxy<T1> P(X.get_ref());
arma_debug_assert_same_size( out.n_rows, out.n_cols, P.n_rows, P.n_cols,
"Mat::set_real()" );
const u32 n_elem = out.n_elem;
eT* out_mem = out.memptr();
for(u32 i=0; i<n_elem; ++i)
{
//out_mem[i].real() = P[i];
out_mem[i] = std::complex<T>( P[i], out_mem[i].imag() );
}
}
template<typename T, typename T1>
inline
void
Mat_aux::set_imag_via_proxy(Mat< std::complex<T> >& out, const Base<T,T1>&
X)
{
arma_extra_debug_sigprint();
typedef typename std::complex<T> eT;
const Proxy<T1> P(X.get_ref());
arma_debug_assert_same_size( out.n_rows, out.n_cols, P.n_rows, P.n_cols,
"Mat::set_imag()" );
const u32 n_elem = out.n_elem;
eT* out_mem = out.memptr();
for(u32 i=0; i<n_elem; ++i) for(u32 i=0; i<n_elem; ++i)
{ {
//out_mem[i].imag() = P[i]; //out_mem[i].imag() = PA[i];
out_mem[i] = std::complex<T>( out_mem[i].real(), P[i] ); out_mem[i] = std::complex<T>( out_mem[i].real(), PA[i] );
} }
} }
#ifdef ARMA_EXTRA_MAT_MEAT #ifdef ARMA_EXTRA_MAT_MEAT
#include ARMA_INCFILE_WRAP(ARMA_EXTRA_MAT_MEAT) #include ARMA_INCFILE_WRAP(ARMA_EXTRA_MAT_MEAT)
#endif #endif
//! @} //! @}
 End of changes. 35 change blocks. 
126 lines changed or deleted 176 lines changed or added


 Mat_proto.hpp   Mat_proto.hpp 
skipping to change at line 43 skipping to change at line 43
const u32 n_rows; //!< number of rows in the matrix (read-only) const u32 n_rows; //!< number of rows in the matrix (read-only)
const u32 n_cols; //!< number of columns in the matrix (read-only) const u32 n_cols; //!< number of columns in the matrix (read-only)
const u32 n_elem; //!< number of elements in the matrix (read-only) const u32 n_elem; //!< number of elements in the matrix (read-only)
const u16 vec_state; //!< 0: matrix layout; 1: column vector layout; 2: r ow vector layout const u16 vec_state; //!< 0: matrix layout; 1: column vector layout; 2: r ow vector layout
const u16 mem_state; const u16 mem_state;
// mem_state = 0: normal matrix that can be resized; // mem_state = 0: normal matrix that can be resized;
// mem_state = 1: use auxiliary memory until change in the number of elem ents is requested; // mem_state = 1: use auxiliary memory until change in the number of elem ents is requested;
// mem_state = 2: use auxiliary memory and don't allow the number of elem ents to be changed; // mem_state = 2: use auxiliary memory and don't allow the number of elem ents to be changed;
// mem_state = 3: fixed size via template based size specification. // mem_state = 3: fixed size (e.g. via template based size specification) .
arma_aligned const eT* const mem; //!< pointer to the memory used by the matrix (memory is read-only) arma_aligned const eT* const mem; //!< pointer to the memory used by the matrix (memory is read-only)
protected: protected:
arma_aligned eT mem_local[ Mat_prealloc::mem_n_elem ]; arma_aligned eT mem_local[ Mat_prealloc::mem_n_elem ];
public: public:
inline ~Mat(); inline ~Mat();
inline Mat(); inline Mat();
skipping to change at line 247 skipping to change at line 247
inline void raw_print_trans(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; inline void raw_print_trans(std::ostream& user_stream, const std::string extra_text = "") const;
template<typename eT2> template<typename eT2>
inline void copy_size(const Mat<eT2>& m); inline void copy_size(const Mat<eT2>& m);
inline void set_size(const u32 in_elem); inline void set_size(const u32 in_elem);
inline void set_size(const u32 in_rows, const u32 in_cols); inline void set_size(const u32 in_rows, const u32 in_cols);
inline void reshape(const u32 in_rows, const u32 in_cols, const u32 dim = 0); inline void reshape(const u32 in_rows, const u32 in_cols, const u32 dim = 0);
arma_hot inline void fill(const eT val); arma_hot inline const Mat& fill(const eT val);
inline void zeros(); inline const Mat& zeros();
inline void zeros(const u32 in_elem); inline const Mat& zeros(const u32 in_elem);
inline void zeros(const u32 in_rows, const u32 in_cols); inline const Mat& zeros(const u32 in_rows, const u32 in_cols);
inline void ones(); inline const Mat& ones();
inline void ones(const u32 in_elem); inline const Mat& ones(const u32 in_elem);
inline void ones(const u32 in_rows, const u32 in_cols); inline const Mat& ones(const u32 in_rows, const u32 in_cols);
inline const Mat& randu();
inline const Mat& randu(const u32 in_elem);
inline const Mat& randu(const u32 in_rows, const u32 in_cols);
inline const Mat& randn();
inline const Mat& randn(const u32 in_elem);
inline const Mat& randn(const u32 in_rows, const u32 in_cols);
inline const Mat& eye();
inline const Mat& eye(const u32 in_rows, const u32 in_cols);
inline void reset(); inline void reset();
template<typename T1> inline void set_real(const Base<pod_type,T1>& X); template<typename T1> inline void set_real(const Base<pod_type,T1>& X);
template<typename T1> inline void set_imag(const Base<pod_type,T1>& X); template<typename T1> inline void set_imag(const Base<pod_type,T1>& X);
inline bool save(const std::string name, const file_type type = arma_bi nary, const bool print_status = true) const; inline bool save(const std::string name, const file_type type = arma_bi nary, const bool print_status = true) const;
inline bool save( std::ostream& os, const file_type type = arma_bi nary, const bool print_status = true) const; inline bool save( std::ostream& os, const file_type type = arma_bi nary, const bool print_status = true) const;
inline bool load(const std::string name, const file_type type = auto_de tect, const bool print_status = true); inline bool load(const std::string name, const file_type type = auto_de tect, const bool print_status = true);
skipping to change at line 427 skipping to change at line 438
template<typename T> arma_inline static void prefix_mm(Mat< std::complex <T> >& x); template<typename T> arma_inline static void prefix_mm(Mat< std::complex <T> >& x);
template<typename eT> arma_inline static void postfix_mm(Mat<eT>& x); template<typename eT> arma_inline static void postfix_mm(Mat<eT>& x);
template<typename T> arma_inline static void postfix_mm(Mat< std::comple x<T> >& x); template<typename T> arma_inline static void postfix_mm(Mat< std::comple x<T> >& x);
template<typename eT, typename T1> inline static void set_real(Mat<eT>& out, const Base<eT,T1>& X); template<typename eT, typename T1> inline static void set_real(Mat<eT>& out, const Base<eT,T1>& X);
template<typename T, typename T1> inline static void set_real(Mat< std:: complex<T> >& out, const Base< T,T1>& X); template<typename T, typename T1> inline static void set_real(Mat< std:: complex<T> >& out, const Base< T,T1>& X);
template<typename eT, typename T1> inline static void set_imag(Mat<eT>& out, const Base<eT,T1>& X); template<typename eT, typename T1> inline static void set_imag(Mat<eT>& out, const Base<eT,T1>& X);
template<typename T, typename T1> inline static void set_imag(Mat< std:: complex<T> >& out, const Base< T,T1>& X); template<typename T, typename T1> inline static void set_imag(Mat< std:: complex<T> >& out, const Base< T,T1>& X);
template<typename T, typename T1> inline static void set_real_via_unwrap
(Mat< std::complex<T> >& out, const Base< T,T1>& X);
template<typename T, typename T1> inline static void set_imag_via_unwrap
(Mat< std::complex<T> >& out, const Base< T,T1>& X);
template<typename T, typename T1> inline static void set_real_via_proxy(
Mat< std::complex<T> >& out, const Base< T,T1>& X);
template<typename T, typename T1> inline static void set_imag_via_proxy(
Mat< std::complex<T> >& out, const Base< T,T1>& X);
}; };
//! @} //! @}
 End of changes. 4 change blocks. 
19 lines changed or deleted 20 lines changed or added


 OpCube_proto.hpp   OpCube_proto.hpp 
skipping to change at line 37 skipping to change at line 37
typedef typename get_pod_type<elem_type>::result pod_type; typedef typename get_pod_type<elem_type>::result pod_type;
inline explicit OpCube(const BaseCube<typename T1::elem_type, T1>& in_m); inline explicit OpCube(const BaseCube<typename T1::elem_type, T1>& in_m);
inline OpCube(const BaseCube<typename T1::elem_type, T1>& in_m, const elem_type in_aux); inline OpCube(const BaseCube<typename T1::elem_type, T1>& in_m, const elem_type in_aux);
inline OpCube(const BaseCube<typename T1::elem_type, T1>& in_m, const u32 in_aux_u32_a, const u32 in_aux_u32_b); inline OpCube(const BaseCube<typename T1::elem_type, T1>& in_m, const u32 in_aux_u32_a, const u32 in_aux_u32_b);
inline OpCube(const BaseCube<typename T1::elem_type, T1>& in_m, const u32 in_aux_u32_a, const u32 in_aux_u32_b, const u32 in_aux_u32_c); inline OpCube(const BaseCube<typename T1::elem_type, T1>& in_m, const u32 in_aux_u32_a, const u32 in_aux_u32_b, const u32 in_aux_u32_c);
inline OpCube(const BaseCube<typename T1::elem_type, T1>& in_m, const elem_type in_aux, const u32 in_aux_u32_a, const u32 in_aux_u32_b, con st u32 in_aux_u32_c); inline OpCube(const BaseCube<typename T1::elem_type, T1>& in_m, const elem_type in_aux, const u32 in_aux_u32_a, const u32 in_aux_u32_b, con st u32 in_aux_u32_c);
inline OpCube(const u32 in_aux_u32_a, const u32 in_aux_u32_b, co nst u32 in_aux_u32_c); inline OpCube(const u32 in_aux_u32_a, const u32 in_aux_u32_b, co nst u32 in_aux_u32_c);
inline ~OpCube(); inline ~OpCube();
const T1& m; //!< storage of reference to the operand (e.g arma_aligned const T1& m; //!< storage of reference to the
. a cube) operand (e.g. a cube)
const elem_type aux; //!< storage of auxiliary data, user defined arma_aligned const elem_type aux; //!< storage of auxiliary data,
format user defined format
const u32 aux_u32_a; //!< storage of auxiliary data, u32 format arma_aligned const u32 aux_u32_a; //!< storage of auxiliary data,
const u32 aux_u32_b; //!< storage of auxiliary data, u32 format u32 format
const u32 aux_u32_c; //!< storage of auxiliary data, u32 format arma_aligned const u32 aux_u32_b; //!< storage of auxiliary data,
u32 format
arma_aligned const u32 aux_u32_c; //!< storage of auxiliary data,
u32 format
}; };
//! @} //! @}
 End of changes. 1 change blocks. 
7 lines changed or deleted 10 lines changed or added


 Op_proto.hpp   Op_proto.hpp 
skipping to change at line 43 skipping to change at line 43
typedef typename T1::elem_type elem_type; typedef typename T1::elem_type elem_type;
typedef typename get_pod_type<elem_type>::result pod_type; typedef typename get_pod_type<elem_type>::result pod_type;
inline explicit Op(const T1& in_m); inline explicit Op(const T1& in_m);
inline Op(const T1& in_m, const elem_type in_aux); inline Op(const T1& in_m, const elem_type in_aux);
inline Op(const T1& in_m, const u32 in_aux_u32_a, const u32 in_a ux_u32_b); inline Op(const T1& in_m, const u32 in_aux_u32_a, const u32 in_a ux_u32_b);
inline Op(const T1& in_m, const elem_type in_aux, const u32 in_a ux_u32_a, const u32 in_aux_u32_b); inline Op(const T1& in_m, const elem_type in_aux, const u32 in_a ux_u32_a, const u32 in_aux_u32_b);
inline ~Op(); inline ~Op();
const T1& m; //!< storage of reference to the operand (e.g arma_aligned const T1& m; //!< storage of reference to the
. a matrix) operand (e.g. a matrix)
const elem_type aux; //!< storage of auxiliary data, user defined arma_aligned const elem_type aux; //!< storage of auxiliary data,
format user defined format
const u32 aux_u32_a; //!< storage of auxiliary data, u32 format arma_aligned const u32 aux_u32_a; //!< storage of auxiliary data,
const u32 aux_u32_b; //!< storage of auxiliary data, u32 format u32 format
arma_aligned const u32 aux_u32_b; //!< storage of auxiliary data,
u32 format
}; };
//! @} //! @}
 End of changes. 1 change blocks. 
6 lines changed or deleted 8 lines changed or added


 Proxy.hpp   Proxy.hpp 
skipping to change at line 29 skipping to change at line 29
template<typename T1> template<typename T1>
class Proxy class Proxy
{ {
public: public:
inline Proxy(const T1& A) inline Proxy(const T1& A)
{ {
arma_type_check< is_arma_type<T1>::value == false >::apply(); arma_type_check< is_arma_type<T1>::value == false >::apply();
} }
}; };
// ea_type is the "element accessor" type,
// which can provide access to elements via operator[]
template<typename eT> template<typename eT>
class Proxy< Mat<eT> > class Proxy< Mat<eT> >
{ {
public: public:
typedef eT elem_type; typedef eT elem_type;
typedef typename get_pod_type<elem_type>::result pod_type; typedef typename get_pod_type<elem_type>::result pod_type;
typedef Mat<eT> stored_type; typedef Mat<eT> stored_type;
typedef const eT* ea_type;
const Mat<eT>& Q; arma_aligned const Mat<eT>& Q;
const u32 n_rows;
const u32 n_cols;
const u32 n_elem;
inline explicit Proxy(const Mat<eT>& A) inline explicit Proxy(const Mat<eT>& A)
: Q(A) : Q(A)
, n_rows(A.n_rows)
, n_cols(A.n_cols)
, n_elem(A.n_elem)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
} }
inline explicit Proxy(const u32 in_n_rows, const u32 in_n_cols) arma_inline u32 get_n_rows() const { return Q.n_rows; }
: Q(Q) arma_inline u32 get_n_cols() const { return Q.n_cols; }
, n_rows(in_n_rows) arma_inline u32 get_n_elem() const { return Q.n_elem; }
, n_cols(in_n_cols)
, n_elem(in_n_rows*in_n_cols)
{
arma_extra_debug_sigprint();
}
arma_inline elem_type operator[] (const u32 i) const { r eturn Q[i]; } arma_inline elem_type operator[] (const u32 i) const { r eturn Q[i]; }
arma_inline elem_type at (const u32 row, const u32 col) const { r eturn Q.at(row, col); } arma_inline elem_type at (const u32 row, const u32 col) const { r eturn Q.at(row, col); }
arma_inline ea_type get_ea() const { return Q.memptr(); }
}; };
template<typename eT> template<typename eT>
class Proxy< Col<eT> > class Proxy< Col<eT> >
{ {
public: public:
typedef eT elem_type; typedef eT elem_type;
typedef typename get_pod_type<elem_type>::result pod_type; typedef typename get_pod_type<elem_type>::result pod_type;
typedef Col<eT> stored_type; typedef Col<eT> stored_type;
typedef const eT* ea_type;
const Col<eT>& Q; arma_aligned const Col<eT>& Q;
const u32 n_rows;
const u32 n_cols;
const u32 n_elem;
inline explicit Proxy(const Col<eT>& A) inline explicit Proxy(const Col<eT>& A)
: Q(A) : Q(A)
, n_rows(A.n_rows)
, n_cols(A.n_cols)
, n_elem(A.n_elem)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
} }
inline explicit Proxy(const u32 in_n_rows, const u32 in_n_cols) arma_inline u32 get_n_rows() const { return Q.n_rows; }
: Q(Q) arma_inline u32 get_n_cols() const { return Q.n_cols; }
, n_rows(in_n_rows) arma_inline u32 get_n_elem() const { return Q.n_elem; }
, n_cols(in_n_cols)
, n_elem(in_n_rows*in_n_cols)
{
arma_extra_debug_sigprint();
}
arma_inline elem_type operator[] (const u32 i) const { r eturn Q[i]; } arma_inline elem_type operator[] (const u32 i) const { r eturn Q[i]; }
arma_inline elem_type at (const u32 row, const u32 col) const { r eturn Q.at(row, col); } arma_inline elem_type at (const u32 row, const u32 col) const { r eturn Q.at(row, col); }
arma_inline ea_type get_ea() const { return Q.memptr(); }
}; };
template<typename eT> template<typename eT>
class Proxy< Row<eT> > class Proxy< Row<eT> >
{ {
public: public:
typedef eT elem_type; typedef eT elem_type;
typedef typename get_pod_type<elem_type>::result pod_type; typedef typename get_pod_type<elem_type>::result pod_type;
typedef Row<eT> stored_type; typedef Row<eT> stored_type;
typedef const eT* ea_type;
const Row<eT>& Q; arma_aligned const Row<eT>& Q;
const u32 n_rows;
const u32 n_cols;
const u32 n_elem;
inline explicit Proxy(const Row<eT>& A) inline explicit Proxy(const Row<eT>& A)
: Q(A) : Q(A)
, n_rows(A.n_rows)
, n_cols(A.n_cols)
, n_elem(A.n_elem)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
} }
inline explicit Proxy(const u32 in_n_rows, const u32 in_n_cols) arma_inline u32 get_n_rows() const { return Q.n_rows; }
: Q(Q) arma_inline u32 get_n_cols() const { return Q.n_cols; }
, n_rows(in_n_rows) arma_inline u32 get_n_elem() const { return Q.n_elem; }
, n_cols(in_n_cols)
, n_elem(in_n_rows*in_n_cols)
{
arma_extra_debug_sigprint();
}
arma_inline elem_type operator[] (const u32 i) const { r eturn Q[i]; } arma_inline elem_type operator[] (const u32 i) const { r eturn Q[i]; }
arma_inline elem_type at (const u32 row, const u32 col) const { r eturn Q.at(row, col); } arma_inline elem_type at (const u32 row, const u32 col) const { r eturn Q.at(row, col); }
arma_inline ea_type get_ea() const { return Q.memptr(); }
}; };
template<typename T1, typename op_type> template<typename T1, typename op_type>
class Proxy< Op<T1, op_type> > class Proxy< Op<T1, op_type> >
{ {
public: public:
typedef typename T1::elem_type elem_type; typedef typename T1::elem_type elem_type;
typedef typename get_pod_type<elem_type>::result pod_type; typedef typename get_pod_type<elem_type>::result pod_type;
typedef Mat<elem_type> stored_type; typedef Mat<elem_type> stored_type;
typedef const elem_type* ea_type;
const Mat<elem_type> Q; arma_aligned const Mat<elem_type> Q;
const u32 n_rows;
const u32 n_cols;
const u32 n_elem;
inline explicit Proxy(const Op<T1, op_type>& A) inline explicit Proxy(const Op<T1, op_type>& A)
: Q(A) : Q(A)
, n_rows(Q.n_rows)
, n_cols(Q.n_cols)
, n_elem(Q.n_elem)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
} }
arma_inline u32 get_n_rows() const { return Q.n_rows; }
arma_inline u32 get_n_cols() const { return Q.n_cols; }
arma_inline u32 get_n_elem() const { return Q.n_elem; }
arma_inline elem_type operator[] (const u32 i) const { r eturn Q[i]; } arma_inline elem_type operator[] (const u32 i) const { r eturn Q[i]; }
arma_inline elem_type at (const u32 row, const u32 col) const { r eturn Q.at(row, col); } arma_inline elem_type at (const u32 row, const u32 col) const { r eturn Q.at(row, col); }
arma_inline ea_type get_ea() const { return Q.memptr(); }
}; };
template<typename T1, typename T2, typename glue_type> template<typename T1, typename T2, typename glue_type>
class Proxy< Glue<T1, T2, glue_type> > class Proxy< Glue<T1, T2, glue_type> >
{ {
public: public:
typedef typename T1::elem_type elem_type; typedef typename T1::elem_type elem_type;
typedef typename get_pod_type<elem_type>::result pod_type; typedef typename get_pod_type<elem_type>::result pod_type;
typedef Mat<elem_type> stored_type; typedef Mat<elem_type> stored_type;
typedef const elem_type* ea_type;
const Mat<elem_type> Q; arma_aligned const Mat<elem_type> Q;
const u32 n_rows;
const u32 n_cols;
const u32 n_elem;
inline explicit Proxy(const Glue<T1, T2, glue_type>& A) inline explicit Proxy(const Glue<T1, T2, glue_type>& A)
: Q(A) : Q(A)
, n_rows(Q.n_rows)
, n_cols(Q.n_cols)
, n_elem(Q.n_elem)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
} }
arma_inline u32 get_n_rows() const { return Q.n_rows; }
arma_inline u32 get_n_cols() const { return Q.n_cols; }
arma_inline u32 get_n_elem() const { return Q.n_elem; }
arma_inline elem_type operator[] (const u32 i) const { r eturn Q[i]; } arma_inline elem_type operator[] (const u32 i) const { r eturn Q[i]; }
arma_inline elem_type at (const u32 row, const u32 col) const { r eturn Q.at(row, col); } arma_inline elem_type at (const u32 row, const u32 col) const { r eturn Q.at(row, col); }
arma_inline ea_type get_ea() const { return Q.memptr(); }
}; };
template<typename eT> template<typename eT>
class Proxy< subview<eT> > class Proxy< subview<eT> >
{ {
public: public:
typedef eT elem_type; typedef eT elem_type;
typedef typename get_pod_type<elem_type>::result pod_type; typedef typename get_pod_type<elem_type>::result pod_type;
typedef subview<eT> stored_type; typedef subview<eT> stored_type;
typedef const subview<eT>& ea_type;
const subview<eT>& Q; arma_aligned const subview<eT>& Q;
const u32 n_rows;
const u32 n_cols;
const u32 n_elem;
inline explicit Proxy(const subview<eT>& A) inline explicit Proxy(const subview<eT>& A)
: Q(A) : Q(A)
, n_rows(A.n_rows)
, n_cols(A.n_cols)
, n_elem(A.n_elem)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
} }
arma_inline u32 get_n_rows() const { return Q.n_rows; }
arma_inline u32 get_n_cols() const { return Q.n_cols; }
arma_inline u32 get_n_elem() const { return Q.n_elem; }
arma_inline elem_type operator[] (const u32 i) const { r eturn Q[i]; } arma_inline elem_type operator[] (const u32 i) const { r eturn Q[i]; }
arma_inline elem_type at (const u32 row, const u32 col) const { r eturn Q.at(row, col); } arma_inline elem_type at (const u32 row, const u32 col) const { r eturn Q.at(row, col); }
arma_inline ea_type get_ea() const { return Q; }
}; };
template<typename eT> template<typename eT>
class Proxy< diagview<eT> > class Proxy< diagview<eT> >
{ {
public: public:
typedef eT elem_type; typedef eT elem_type;
typedef typename get_pod_type<elem_type>::result pod_type; typedef typename get_pod_type<elem_type>::result pod_type;
typedef diagview<eT> stored_type; typedef diagview<eT> stored_type;
typedef const diagview<eT>& ea_type;
const diagview<eT>& Q; arma_aligned const diagview<eT>& Q;
const u32 n_rows;
const u32 n_cols;
const u32 n_elem;
inline explicit Proxy(const diagview<eT>& A) inline explicit Proxy(const diagview<eT>& A)
: Q(A) : Q(A)
, n_rows(A.n_rows)
, n_cols(A.n_cols)
, n_elem(A.n_elem)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
} }
arma_inline u32 get_n_rows() const { return Q.n_rows; }
arma_inline u32 get_n_cols() const { return Q.n_cols; }
arma_inline u32 get_n_elem() const { return Q.n_elem; }
arma_inline elem_type operator[] (const u32 i) const { r eturn Q[i]; } arma_inline elem_type operator[] (const u32 i) const { r eturn Q[i]; }
arma_inline elem_type at (const u32 row, const u32 col) const { r eturn Q.at(row, col); } arma_inline elem_type at (const u32 row, const u32 col) const { r eturn Q.at(row, col); }
arma_inline ea_type get_ea() const { return Q; }
}; };
template<typename T1, typename eop_type> template<typename T1, typename eop_type>
class Proxy< eOp<T1, eop_type > > class Proxy< eOp<T1, eop_type > >
{ {
public: public:
typedef typename T1::elem_type elem_type; typedef typename T1::elem_type elem_type;
typedef typename get_pod_type<elem_type>::result pod_type; typedef typename get_pod_type<elem_type>::result pod_type;
typedef eOp<T1, eop_type> stored_type; typedef eOp<T1, eop_type> stored_type;
typedef const eOp<T1, eop_type>& ea_type;
const eOp<T1, eop_type>& Q; arma_aligned const eOp<T1, eop_type>& Q;
const u32 n_rows;
const u32 n_cols;
const u32 n_elem;
inline explicit Proxy(const eOp<T1, eop_type>& A) inline explicit Proxy(const eOp<T1, eop_type>& A)
: Q(A) : Q(A)
, n_rows(A.P.n_rows)
, n_cols(A.P.n_cols)
, n_elem(A.P.n_elem)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
} }
arma_inline elem_type operator[] (const u32 i) const { r arma_inline u32 get_n_rows() const { return Q.get_n_rows(); }
eturn eop_type::get_elem(Q, i); } arma_inline u32 get_n_cols() const { return Q.get_n_cols(); }
arma_inline elem_type at (const u32 row, const u32 col) const { r arma_inline u32 get_n_elem() const { return Q.get_n_elem(); }
eturn eop_type::get_elem(Q, row,col); }
arma_inline elem_type operator[] (const u32 i) const { r
eturn Q[i]; }
arma_inline elem_type at (const u32 row, const u32 col) const { r
eturn Q.at(row, col); }
arma_inline ea_type get_ea() const { return Q; }
}; };
template<typename T1, typename T2, typename eglue_type> template<typename T1, typename T2, typename eglue_type>
class Proxy< eGlue<T1, T2, eglue_type > > class Proxy< eGlue<T1, T2, eglue_type > >
{ {
public: public:
typedef typename T1::elem_type elem_type; typedef typename T1::elem_type elem_type;
typedef typename get_pod_type<elem_type>::result pod_type; typedef typename get_pod_type<elem_type>::result pod_type;
typedef eGlue<T1, T2, eglue_type> stored_type; typedef eGlue<T1, T2, eglue_type> stored_type;
typedef const eGlue<T1, T2, eglue_type>& ea_type;
const eGlue<T1, T2, eglue_type>& Q; arma_aligned const eGlue<T1, T2, eglue_type>& Q;
const u32 n_rows;
const u32 n_cols;
const u32 n_elem;
inline explicit Proxy(const eGlue<T1, T2, eglue_type>& A) inline explicit Proxy(const eGlue<T1, T2, eglue_type>& A)
: Q(A) : Q(A)
, n_rows(A.P1.n_rows)
, n_cols(A.P1.n_cols)
, n_elem(A.P1.n_elem)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
} }
arma_inline elem_type operator[] (const u32 i) const { r arma_inline u32 get_n_rows() const { return Q.get_n_rows(); }
eturn eglue_type::get_elem(Q, i); } arma_inline u32 get_n_cols() const { return Q.get_n_cols(); }
arma_inline elem_type at (const u32 row, const u32 col) const { r arma_inline u32 get_n_elem() const { return Q.get_n_elem(); }
eturn eglue_type::get_elem(Q, row, col); }
arma_inline elem_type operator[] (const u32 i) const { r
eturn Q[i]; }
arma_inline elem_type at (const u32 row, const u32 col) const { r
eturn Q.at(row, col); }
arma_inline ea_type get_ea() const { return Q; }
}; };
template<typename out_eT, typename T1, typename op_type> template<typename out_eT, typename T1, typename op_type>
class Proxy< mtOp<out_eT, T1, op_type> > class Proxy< mtOp<out_eT, T1, op_type> >
{ {
public: public:
typedef out_eT elem_type; typedef out_eT elem_type;
typedef typename get_pod_type<out_eT>::result pod_type; typedef typename get_pod_type<out_eT>::result pod_type;
typedef Mat<out_eT> stored_type; typedef Mat<out_eT> stored_type;
typedef const elem_type* ea_type;
const Mat<out_eT> Q; arma_aligned const Mat<out_eT> Q;
const u32 n_rows;
const u32 n_cols;
const u32 n_elem;
inline explicit Proxy(const mtOp<out_eT, T1, op_type>& A) inline explicit Proxy(const mtOp<out_eT, T1, op_type>& A)
: Q(A) : Q(A)
, n_rows(Q.n_rows)
, n_cols(Q.n_cols)
, n_elem(Q.n_elem)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
} }
arma_inline u32 get_n_rows() const { return Q.n_rows; }
arma_inline u32 get_n_cols() const { return Q.n_cols; }
arma_inline u32 get_n_elem() const { return Q.n_elem; }
arma_inline elem_type operator[] (const u32 i) const { r eturn Q[i]; } arma_inline elem_type operator[] (const u32 i) const { r eturn Q[i]; }
arma_inline elem_type at (const u32 row, const u32 col) const { r eturn Q.at(row,col); } arma_inline elem_type at (const u32 row, const u32 col) const { r eturn Q.at(row,col); }
arma_inline ea_type get_ea() const { return Q.memptr(); }
}; };
template<typename out_eT, typename T1, typename T2, typename glue_type> template<typename out_eT, typename T1, typename T2, typename glue_type>
class Proxy< mtGlue<out_eT, T1, T2, glue_type > > class Proxy< mtGlue<out_eT, T1, T2, glue_type > >
{ {
public: public:
typedef out_eT elem_type; typedef out_eT elem_type;
typedef typename get_pod_type<out_eT>::result pod_type; typedef typename get_pod_type<out_eT>::result pod_type;
typedef Mat<out_eT> stored_type; typedef Mat<out_eT> stored_type;
typedef const elem_type* ea_type;
const Mat<out_eT> Q; arma_aligned const Mat<out_eT> Q;
const u32 n_rows;
const u32 n_cols;
const u32 n_elem;
inline explicit Proxy(const mtGlue<out_eT, T1, T2, glue_type>& A) inline explicit Proxy(const mtGlue<out_eT, T1, T2, glue_type>& A)
: Q(A) : Q(A)
, n_rows(Q.n_rows)
, n_cols(Q.n_cols)
, n_elem(Q.n_elem)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
} }
arma_inline u32 get_n_rows() const { return Q.n_rows; }
arma_inline u32 get_n_cols() const { return Q.n_cols; }
arma_inline u32 get_n_elem() const { return Q.n_elem; }
arma_inline elem_type operator[] (const u32 i) const { r eturn Q[i]; } arma_inline elem_type operator[] (const u32 i) const { r eturn Q[i]; }
arma_inline elem_type at (const u32 row, const u32 col) const { r eturn Q.at(row,col); } arma_inline elem_type at (const u32 row, const u32 col) const { r eturn Q.at(row,col); }
arma_inline ea_type get_ea() const { return Q.memptr(); }
}; };
//! @} //! @}
 End of changes. 54 change blocks. 
120 lines changed or deleted 96 lines changed or added


 ProxyCube.hpp   ProxyCube.hpp 
skipping to change at line 29 skipping to change at line 29
template<typename T1> template<typename T1>
class ProxyCube class ProxyCube
{ {
public: public:
inline ProxyCube(const T1& A) inline ProxyCube(const T1& A)
{ {
arma_type_check< is_arma_type<T1>::value == false >::apply(); arma_type_check< is_arma_type<T1>::value == false >::apply();
} }
}; };
// ea_type is the "element accessor" type,
// which can provide access to elements via operator[]
template<typename eT> template<typename eT>
class ProxyCube< Cube<eT> > class ProxyCube< Cube<eT> >
{ {
public: public:
typedef eT elem_type; typedef eT elem_type;
typedef typename get_pod_type<elem_type>::result pod_type; typedef typename get_pod_type<elem_type>::result pod_type;
typedef Cube<eT> stored_type; typedef Cube<eT> stored_type;
typedef const eT* ea_type;
const Cube<eT>& Q; arma_aligned const Cube<eT>& Q;
const u32 n_rows;
const u32 n_cols;
const u32 n_elem_slice;
const u32 n_slices;
const u32 n_elem;
inline explicit ProxyCube(const Cube<eT>& A) inline explicit ProxyCube(const Cube<eT>& A)
: Q (A) : Q(A)
, n_rows (A.n_rows)
, n_cols (A.n_cols)
, n_elem_slice(A.n_elem_slice)
, n_slices (A.n_slices)
, n_elem (A.n_elem)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
} }
inline explicit ProxyCube(const u32 in_n_rows, const u32 in_n_cols, const arma_inline u32 get_n_rows() const { return Q.n_rows; }
u32 in_n_slices) arma_inline u32 get_n_cols() const { return Q.n_cols; }
: Q (Q) arma_inline u32 get_n_elem_slice() const { return Q.n_elem_slice; }
, n_rows (in_n_rows) arma_inline u32 get_n_slices() const { return Q.n_slices; }
, n_cols (in_n_cols) arma_inline u32 get_n_elem() const { return Q.n_elem; }
, n_elem_slice(in_n_rows*in_n_cols)
, n_slices (in_n_slices)
, n_elem (in_n_rows*in_n_cols*in_n_slices)
{
arma_extra_debug_sigprint();
}
arma_inline elem_type operator[] (const u32 i) const { return Q[i]; } arma_inline elem_type operator[] (const u32 i) const { return Q[i]; }
arma_inline elem_type at (const u32 row, const u32 col, const u32 slice) const { return Q.at(row, col, slice); } arma_inline elem_type at (const u32 row, const u32 col, const u32 slice) const { return Q.at(row, col, slice); }
arma_inline ea_type get_ea() const { return Q.memptr(); }
}; };
template<typename T1, typename op_type> template<typename T1, typename op_type>
class ProxyCube< OpCube<T1, op_type> > class ProxyCube< OpCube<T1, op_type> >
{ {
public: public:
typedef typename T1::elem_type elem_type; typedef typename T1::elem_type elem_type;
typedef typename get_pod_type<elem_type>::result pod_type; typedef typename get_pod_type<elem_type>::result pod_type;
typedef Cube<elem_type> stored_type; typedef Cube<elem_type> stored_type;
typedef const elem_type* ea_type;
const Cube<elem_type> Q; arma_aligned const Cube<elem_type> Q;
const u32 n_rows;
const u32 n_cols;
const u32 n_elem_slice;
const u32 n_slices;
const u32 n_elem;
inline explicit ProxyCube(const OpCube<T1, op_type>& A) inline explicit ProxyCube(const OpCube<T1, op_type>& A)
: Q (A) : Q(A)
, n_rows (Q.n_rows)
, n_cols (Q.n_cols)
, n_elem_slice(Q.n_elem_slice)
, n_slices (Q.n_slices)
, n_elem (Q.n_elem)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
} }
arma_inline u32 get_n_rows() const { return Q.n_rows; }
arma_inline u32 get_n_cols() const { return Q.n_cols; }
arma_inline u32 get_n_elem_slice() const { return Q.n_elem_slice; }
arma_inline u32 get_n_slices() const { return Q.n_slices; }
arma_inline u32 get_n_elem() const { return Q.n_elem; }
arma_inline elem_type operator[] (const u32 i) const { return Q[i]; } arma_inline elem_type operator[] (const u32 i) const { return Q[i]; }
arma_inline elem_type at (const u32 row, const u32 col, const u32 slice) const { return Q.at(row, col, slice); } arma_inline elem_type at (const u32 row, const u32 col, const u32 slice) const { return Q.at(row, col, slice); }
arma_inline ea_type get_ea() const { return Q.memptr(); }
}; };
template<typename T1, typename T2, typename glue_type> template<typename T1, typename T2, typename glue_type>
class ProxyCube< GlueCube<T1, T2, glue_type> > class ProxyCube< GlueCube<T1, T2, glue_type> >
{ {
public: public:
typedef typename T1::elem_type elem_type; typedef typename T1::elem_type elem_type;
typedef typename get_pod_type<elem_type>::result pod_type; typedef typename get_pod_type<elem_type>::result pod_type;
typedef Cube<elem_type> stored_type; typedef Cube<elem_type> stored_type;
typedef const elem_type* ea_type;
const Cube<elem_type> Q; arma_aligned const Cube<elem_type> Q;
const u32 n_rows;
const u32 n_cols;
const u32 n_elem_slice;
const u32 n_slices;
const u32 n_elem;
inline explicit ProxyCube(const GlueCube<T1, T2, glue_type>& A) inline explicit ProxyCube(const GlueCube<T1, T2, glue_type>& A)
: Q (A) : Q(A)
, n_rows (Q.n_rows)
, n_cols (Q.n_cols)
, n_elem_slice(Q.n_elem_slice)
, n_slices (Q.n_slices)
, n_elem (Q.n_elem)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
} }
arma_inline u32 get_n_rows() const { return Q.n_rows; }
arma_inline u32 get_n_cols() const { return Q.n_cols; }
arma_inline u32 get_n_elem_slice() const { return Q.n_elem_slice; }
arma_inline u32 get_n_slices() const { return Q.n_slices; }
arma_inline u32 get_n_elem() const { return Q.n_elem; }
arma_inline elem_type operator[] (const u32 i) const { return Q[i]; } arma_inline elem_type operator[] (const u32 i) const { return Q[i]; }
arma_inline elem_type at (const u32 row, const u32 col, const u32 slice) const { return Q.at(row, col, slice); } arma_inline elem_type at (const u32 row, const u32 col, const u32 slice) const { return Q.at(row, col, slice); }
arma_inline ea_type get_ea() const { return Q.memptr(); }
}; };
template<typename eT> template<typename eT>
class ProxyCube< subview_cube<eT> > class ProxyCube< subview_cube<eT> >
{ {
public: public:
typedef eT elem_type; typedef eT elem_type;
typedef typename get_pod_type<elem_type>::result pod_type; typedef typename get_pod_type<elem_type>::result pod_type;
typedef subview_cube<eT> stored_type; typedef subview_cube<eT> stored_type;
typedef const subview_cube<eT>& ea_type;
const subview_cube<eT>& Q; arma_aligned const subview_cube<eT>& Q;
const u32 n_rows;
const u32 n_cols;
const u32 n_elem_slice;
const u32 n_slices;
const u32 n_elem;
inline explicit ProxyCube(const subview_cube<eT>& A) inline explicit ProxyCube(const subview_cube<eT>& A)
: Q (A) : Q(A)
, n_rows (A.n_rows)
, n_cols (A.n_cols)
, n_elem_slice(A.n_elem_slice)
, n_slices (A.n_slices)
, n_elem (A.n_elem)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
} }
arma_inline u32 get_n_rows() const { return Q.n_rows; }
arma_inline u32 get_n_cols() const { return Q.n_cols; }
arma_inline u32 get_n_elem_slice() const { return Q.n_elem_slice; }
arma_inline u32 get_n_slices() const { return Q.n_slices; }
arma_inline u32 get_n_elem() const { return Q.n_elem; }
arma_inline elem_type operator[] (const u32 i) const { return Q[i]; } arma_inline elem_type operator[] (const u32 i) const { return Q[i]; }
arma_inline elem_type at (const u32 row, const u32 col, const u32 slice) const { return Q.at(row, col, slice); } arma_inline elem_type at (const u32 row, const u32 col, const u32 slice) const { return Q.at(row, col, slice); }
arma_inline ea_type get_ea() const { return Q; }
}; };
template<typename T1, typename eop_type> template<typename T1, typename eop_type>
class ProxyCube< eOpCube<T1, eop_type > > class ProxyCube< eOpCube<T1, eop_type > >
{ {
public: public:
typedef typename T1::elem_type elem_type; typedef typename T1::elem_type elem_type;
typedef typename get_pod_type<elem_type>::result pod_type; typedef typename get_pod_type<elem_type>::result pod_type;
typedef eOpCube<T1, eop_type> stored_type; typedef eOpCube<T1, eop_type> stored_type;
typedef const eOpCube<T1, eop_type>& ea_type;
const eOpCube<T1, eop_type>& Q; arma_aligned const eOpCube<T1, eop_type>& Q;
const u32 n_rows;
const u32 n_cols;
const u32 n_elem_slice;
const u32 n_slices;
const u32 n_elem;
inline explicit ProxyCube(const eOpCube<T1, eop_type>& A) inline explicit ProxyCube(const eOpCube<T1, eop_type>& A)
: Q (A) : Q(A)
, n_rows (A.P.n_rows)
, n_cols (A.P.n_cols)
, n_elem_slice(A.P.n_elem_slice)
, n_slices (A.P.n_slices)
, n_elem (A.P.n_elem)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
} }
arma_inline elem_type operator[] (const u32 i) arma_inline u32 get_n_rows() const { return Q.get_n_rows(); }
const { return eop_type::get_elem(Q, i); } arma_inline u32 get_n_cols() const { return Q.get_n_cols(); }
arma_inline elem_type at (const u32 row, const u32 col, const u32 arma_inline u32 get_n_elem_slice() const { return Q.get_n_elem_slice(); }
slice) const { return eop_type::get_elem(Q, row, col, slice); } arma_inline u32 get_n_slices() const { return Q.get_n_slices(); }
arma_inline u32 get_n_elem() const { return Q.get_n_elem(); }
arma_inline elem_type operator[] (const u32 i)
const { return Q[i]; }
arma_inline elem_type at (const u32 row, const u32 col, const u32
slice) const { return Q.at(row, col, slice); }
arma_inline ea_type get_ea() const { return Q; }
}; };
template<typename T1, typename T2, typename eglue_type> template<typename T1, typename T2, typename eglue_type>
class ProxyCube< eGlueCube<T1, T2, eglue_type > > class ProxyCube< eGlueCube<T1, T2, eglue_type > >
{ {
public: public:
typedef typename T1::elem_type elem_type; typedef typename T1::elem_type elem_type;
typedef typename get_pod_type<elem_type>::result pod_type; typedef typename get_pod_type<elem_type>::result pod_type;
typedef eGlueCube<T1, T2, eglue_type> stored_type; typedef eGlueCube<T1, T2, eglue_type> stored_type;
typedef const eGlueCube<T1, T2, eglue_type>& ea_type;
const eGlueCube<T1, T2, eglue_type>& Q; arma_aligned const eGlueCube<T1, T2, eglue_type>& Q;
const u32 n_rows;
const u32 n_cols;
const u32 n_elem_slice;
const u32 n_slices;
const u32 n_elem;
inline explicit ProxyCube(const eGlueCube<T1, T2, eglue_type>& A) inline explicit ProxyCube(const eGlueCube<T1, T2, eglue_type>& A)
: Q (A) : Q(A)
, n_rows (A.P1.n_rows)
, n_cols (A.P1.n_cols)
, n_elem_slice(A.P1.n_elem_slice)
, n_slices (A.P1.n_slices)
, n_elem (A.P1.n_elem)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
} }
arma_inline elem_type operator[] (const u32 i) arma_inline u32 get_n_rows() const { return Q.get_n_rows(); }
const { return eglue_type::get_elem(Q, i); } arma_inline u32 get_n_cols() const { return Q.get_n_cols(); }
arma_inline elem_type at (const u32 row, const u32 col, const u32 arma_inline u32 get_n_elem_slice() const { return Q.get_n_elem_slice(); }
slice) const { return eglue_type::get_elem(Q, row, col, slice); } arma_inline u32 get_n_slices() const { return Q.get_n_slices(); }
arma_inline u32 get_n_elem() const { return Q.get_n_elem(); }
arma_inline elem_type operator[] (const u32 i)
const { return Q[i]; }
arma_inline elem_type at (const u32 row, const u32 col, const u32
slice) const { return Q.at(row, col, slice); }
arma_inline ea_type get_ea() const { return Q; }
};
template<typename out_eT, typename T1, typename op_type>
class ProxyCube< mtOpCube<out_eT, T1, op_type> >
{
public:
typedef out_eT elem_type;
typedef typename get_pod_type<out_eT>::result pod_type;
typedef Cube<out_eT> stored_type;
typedef const elem_type* ea_type;
arma_aligned const Cube<out_eT> Q;
inline explicit ProxyCube(const mtOpCube<out_eT, T1, op_type>& A)
: Q(A)
{
arma_extra_debug_sigprint();
}
arma_inline u32 get_n_rows() const { return Q.n_rows; }
arma_inline u32 get_n_cols() const { return Q.n_cols; }
arma_inline u32 get_n_elem_slice() const { return Q.n_elem_slice; }
arma_inline u32 get_n_slices() const { return Q.n_slices; }
arma_inline u32 get_n_elem() const { return Q.n_elem; }
arma_inline elem_type operator[] (const u32 i)
const { return Q[i]; }
arma_inline elem_type at (const u32 row, const u32 col, const u32
slice) const { return Q.at(row, col, slice); }
arma_inline ea_type get_ea() const { return Q.memptr(); }
};
template<typename out_eT, typename T1, typename T2, typename glue_type>
class ProxyCube< mtGlueCube<out_eT, T1, T2, glue_type > >
{
public:
typedef out_eT elem_type;
typedef typename get_pod_type<out_eT>::result pod_type;
typedef Cube<out_eT> stored_type;
typedef const elem_type* ea_type;
arma_aligned const Cube<out_eT> Q;
inline explicit ProxyCube(const mtGlueCube<out_eT, T1, T2, glue_type>& A)
: Q(A)
{
arma_extra_debug_sigprint();
}
arma_inline u32 get_n_rows() const { return Q.n_rows; }
arma_inline u32 get_n_cols() const { return Q.n_cols; }
arma_inline u32 get_n_elem_slice() const { return Q.n_elem_slice; }
arma_inline u32 get_n_slices() const { return Q.n_slices; }
arma_inline u32 get_n_elem() const { return Q.n_elem; }
arma_inline elem_type operator[] (const u32 i)
const { return Q[i]; }
arma_inline elem_type at (const u32 row, const u32 col, const u32
slice) const { return Q.at(row, col, slice); }
arma_inline ea_type get_ea() const { return Q.memptr(); }
}; };
//! @} //! @}
 End of changes. 29 change blocks. 
97 lines changed or deleted 140 lines changed or added


 Row_meat.hpp   Row_meat.hpp 
skipping to change at line 244 skipping to change at line 244
arma_inline arma_inline
const subview_row<eT> const subview_row<eT>
Row<eT>::cols(const u32 in_col1, const u32 in_col2) Row<eT>::cols(const u32 in_col1, const u32 in_col2)
const const
{ {
arma_debug_check( ( (in_col1 > in_col2) || (in_col2 >= Mat<eT>::n_cols) ) , "Row::cols(): indices out of bounds or incorrectly used"); arma_debug_check( ( (in_col1 > in_col2) || (in_col2 >= Mat<eT>::n_cols) ) , "Row::cols(): indices out of bounds or incorrectly used");
return subview_row<eT>(*this, 0, in_col1, in_col2); return subview_row<eT>(*this, 0, in_col1, in_col2);
} }
//! remove specified columns
template<typename eT>
inline
void
Row<eT>::shed_col(const u32 col_num)
{
arma_extra_debug_sigprint();
arma_debug_check( col_num >= Mat<eT>::n_cols, "Row::shed_col(): out of bo
unds");
shed_cols(col_num, col_num);
}
//! remove specified columns
template<typename eT>
inline
void
Row<eT>::shed_cols(const u32 in_col1, const u32 in_col2)
{
arma_extra_debug_sigprint();
arma_debug_check
(
(in_col1 > in_col2) || (in_col2 >= Mat<eT>::n_cols),
"Row::shed_cols(): indices out of bounds or incorrectly used"
);
const u32 n_keep_front = in_col1;
const u32 n_keep_back = Mat<eT>::n_cols - (in_col2 + 1);
Row<eT> X(n_keep_front + n_keep_back);
eT* X_mem = X.memptr();
const eT* t_mem = (*this).memptr();
if(n_keep_front > 0)
{
syslib::copy_elem( X_mem, t_mem, n_keep_front );
}
if(n_keep_back > 0)
{
syslib::copy_elem( &(X_mem[n_keep_front]), &(t_mem[in_col2+1]), n_keep_
back);
}
steal_mem(X);
}
//! insert N cols at the specified col position,
//! optionally setting the elements of the inserted cols to zero
template<typename eT>
inline
void
Row<eT>::insert_cols(const u32 col_num, const u32 N, const bool set_to_zero
)
{
arma_extra_debug_sigprint();
const u32 t_n_cols = Mat<eT>::n_cols;
const u32 A_n_cols = col_num;
const u32 B_n_cols = t_n_cols - col_num;
// insertion at col_num == n_cols is in effect an append operation
arma_debug_check( (col_num > t_n_cols), "Row::insert_cols(): out of bound
s");
if(N > 0)
{
Row<eT> out(t_n_cols + N);
eT* out_mem = out.memptr();
const eT* t_mem = (*this).memptr();
if(A_n_cols > 0)
{
syslib::copy_elem( out_mem, t_mem, A_n_cols );
}
if(B_n_cols > 0)
{
syslib::copy_elem( &(out_mem[col_num + N]), &(t_mem[col_num]), B_n_co
ls );
}
if(set_to_zero == true)
{
arrayops::inplace_set( &(out_mem[col_num]), eT(0), N );
}
steal_mem(out);
}
}
//! insert the given object at the specified col position;
//! the given object must have one row
template<typename eT>
template<typename T1>
inline
void
Row<eT>::insert_cols(const u32 col_num, const Base<eT,T1>& X)
{
arma_extra_debug_sigprint();
Mat<eT>::insert_cols(col_num, X);
}
template<typename eT> template<typename eT>
inline inline
typename Row<eT>::row_iterator typename Row<eT>::row_iterator
Row<eT>::begin_row(const u32 row_num) Row<eT>::begin_row(const u32 row_num)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( (row_num >= Mat<eT>::n_rows), "begin_row(): index out o f bounds"); arma_debug_check( (row_num >= Mat<eT>::n_rows), "begin_row(): index out o f bounds");
return Mat<eT>::memptr(); return Mat<eT>::memptr();
 End of changes. 1 change blocks. 
0 lines changed or deleted 109 lines changed or added


 Row_proto.hpp   Row_proto.hpp 
skipping to change at line 60 skipping to change at line 60
inline const Row& operator=(const subview_cube<eT>& X); inline const Row& operator=(const subview_cube<eT>& X);
inline mat_injector<Row> operator<<(const eT val); inline mat_injector<Row> operator<<(const eT val);
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;
inline void shed_col (const u32 col_num);
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);
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);
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;
template<u32 fixed_n_elem> template<u32 fixed_n_elem>
 End of changes. 1 change blocks. 
0 lines changed or deleted 8 lines changed or added


 arma_version.hpp   arma_version.hpp 
skipping to change at line 21 skipping to change at line 21
// 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 0 #define ARMA_VERSION_MAJOR 0
#define ARMA_VERSION_MINOR 9 #define ARMA_VERSION_MINOR 9
#define ARMA_VERSION_PATCH 70 #define ARMA_VERSION_PATCH 80
#define ARMA_VERSION_NAME "Subtropical Winter Safari" #define ARMA_VERSION_NAME "Chihuahua Muncher"
// http://www.brisbanetimes.com.au/environment/leaping-sharks-are-no-bull-2
0100906-14wyq.html
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. 
2 lines changed or deleted 4 lines changed or added


 armadillo   armadillo 
skipping to change at line 136 skipping to change at line 136
#include "armadillo_bits/Base.hpp" #include "armadillo_bits/Base.hpp"
#include "armadillo_bits/BaseCube.hpp" #include "armadillo_bits/BaseCube.hpp"
#include "armadillo_bits/injector_proto.hpp" #include "armadillo_bits/injector_proto.hpp"
#include "armadillo_bits/Mat_proto.hpp" #include "armadillo_bits/Mat_proto.hpp"
#include "armadillo_bits/Col_proto.hpp" #include "armadillo_bits/Col_proto.hpp"
#include "armadillo_bits/Row_proto.hpp" #include "armadillo_bits/Row_proto.hpp"
#include "armadillo_bits/Cube_proto.hpp" #include "armadillo_bits/Cube_proto.hpp"
#include "armadillo_bits/typedef_fixed.hpp"
#include "armadillo_bits/field_proto.hpp" #include "armadillo_bits/field_proto.hpp"
#include "armadillo_bits/subview_proto.hpp" #include "armadillo_bits/subview_proto.hpp"
#include "armadillo_bits/subview_field_proto.hpp" #include "armadillo_bits/subview_field_proto.hpp"
#include "armadillo_bits/subview_cube_proto.hpp" #include "armadillo_bits/subview_cube_proto.hpp"
#include "armadillo_bits/diagview_proto.hpp" #include "armadillo_bits/diagview_proto.hpp"
#include "armadillo_bits/diskio_proto.hpp" #include "armadillo_bits/diskio_proto.hpp"
#include "armadillo_bits/wall_clock_proto.hpp" #include "armadillo_bits/wall_clock_proto.hpp"
#include "armadillo_bits/running_stat_proto.hpp" #include "armadillo_bits/running_stat_proto.hpp"
#include "armadillo_bits/running_stat_vec_proto.hpp" #include "armadillo_bits/running_stat_vec_proto.hpp"
#include "armadillo_bits/Op_proto.hpp" #include "armadillo_bits/Op_proto.hpp"
#include "armadillo_bits/OpCube_proto.hpp" #include "armadillo_bits/OpCube_proto.hpp"
#include "armadillo_bits/eOp_proto.hpp" #include "armadillo_bits/eOp_proto.hpp"
#include "armadillo_bits/eOpCube_proto.hpp" #include "armadillo_bits/eOpCube_proto.hpp"
#include "armadillo_bits/mtOp_proto.hpp" #include "armadillo_bits/mtOp_proto.hpp"
#include "armadillo_bits/mtOpCube_proto.hpp"
#include "armadillo_bits/Glue_proto.hpp" #include "armadillo_bits/Glue_proto.hpp"
#include "armadillo_bits/eGlue_proto.hpp" #include "armadillo_bits/eGlue_proto.hpp"
#include "armadillo_bits/mtGlue_proto.hpp" #include "armadillo_bits/mtGlue_proto.hpp"
#include "armadillo_bits/GlueCube_proto.hpp" #include "armadillo_bits/GlueCube_proto.hpp"
#include "armadillo_bits/eGlueCube_proto.hpp" #include "armadillo_bits/eGlueCube_proto.hpp"
#include "armadillo_bits/mtGlueCube_proto.hpp"
#include "armadillo_bits/eop_core_proto.hpp" #include "armadillo_bits/eop_core_proto.hpp"
#include "armadillo_bits/eop_cube_core_proto.hpp"
#include "armadillo_bits/eglue_core_proto.hpp" #include "armadillo_bits/eglue_core_proto.hpp"
#include "armadillo_bits/eglue_cube_core_proto.hpp"
#include "armadillo_bits/op_diagmat_proto.hpp" #include "armadillo_bits/op_diagmat_proto.hpp"
#include "armadillo_bits/op_diagvec_proto.hpp" #include "armadillo_bits/op_diagvec_proto.hpp"
#include "armadillo_bits/op_dot_proto.hpp" #include "armadillo_bits/op_dot_proto.hpp"
#include "armadillo_bits/op_inv_proto.hpp" #include "armadillo_bits/op_inv_proto.hpp"
#include "armadillo_bits/op_htrans_proto.hpp" #include "armadillo_bits/op_htrans_proto.hpp"
#include "armadillo_bits/op_max_proto.hpp" #include "armadillo_bits/op_max_proto.hpp"
#include "armadillo_bits/op_min_proto.hpp" #include "armadillo_bits/op_min_proto.hpp"
#include "armadillo_bits/op_mean_proto.hpp" #include "armadillo_bits/op_mean_proto.hpp"
#include "armadillo_bits/op_median_proto.hpp" #include "armadillo_bits/op_median_proto.hpp"
skipping to change at line 238 skipping to change at line 239
#include "armadillo_bits/unwrap.hpp" #include "armadillo_bits/unwrap.hpp"
#include "armadillo_bits/unwrap_cube.hpp" #include "armadillo_bits/unwrap_cube.hpp"
#include "armadillo_bits/strip.hpp" #include "armadillo_bits/strip.hpp"
#include "armadillo_bits/Op_meat.hpp" #include "armadillo_bits/Op_meat.hpp"
#include "armadillo_bits/OpCube_meat.hpp" #include "armadillo_bits/OpCube_meat.hpp"
#include "armadillo_bits/mtOp_meat.hpp" #include "armadillo_bits/mtOp_meat.hpp"
#include "armadillo_bits/mtOpCube_meat.hpp"
#include "armadillo_bits/Glue_meat.hpp" #include "armadillo_bits/Glue_meat.hpp"
#include "armadillo_bits/GlueCube_meat.hpp" #include "armadillo_bits/GlueCube_meat.hpp"
#include "armadillo_bits/eop_aux.hpp" #include "armadillo_bits/eop_aux.hpp"
#include "armadillo_bits/eOp_meat.hpp" #include "armadillo_bits/eOp_meat.hpp"
#include "armadillo_bits/eOpCube_meat.hpp" #include "armadillo_bits/eOpCube_meat.hpp"
#include "armadillo_bits/eGlue_meat.hpp" #include "armadillo_bits/eGlue_meat.hpp"
#include "armadillo_bits/eGlueCube_meat.hpp" #include "armadillo_bits/eGlueCube_meat.hpp"
#include "armadillo_bits/mtGlue_meat.hpp" #include "armadillo_bits/mtGlue_meat.hpp"
#include "armadillo_bits/mtGlueCube_meat.hpp"
#include "armadillo_bits/eglue_misc.hpp"
#include "armadillo_bits/eglue_cube_misc.hpp"
// //
// ostream // ostream
#include "armadillo_bits/arma_ostream_proto.hpp" #include "armadillo_bits/arma_ostream_proto.hpp"
#include "armadillo_bits/arma_ostream_meat.hpp" #include "armadillo_bits/arma_ostream_meat.hpp"
// //
// operators // operators
skipping to change at line 348 skipping to change at line 348
#include "armadillo_bits/fn_toeplitz.hpp" #include "armadillo_bits/fn_toeplitz.hpp"
// //
// class meat // class meat
#include "armadillo_bits/gemm.hpp" #include "armadillo_bits/gemm.hpp"
#include "armadillo_bits/gemv.hpp" #include "armadillo_bits/gemv.hpp"
#include "armadillo_bits/gemm_mixed.hpp" #include "armadillo_bits/gemm_mixed.hpp"
#include "armadillo_bits/eop_core_meat.hpp" #include "armadillo_bits/eop_core_meat.hpp"
#include "armadillo_bits/eop_cube_core_meat.hpp"
#include "armadillo_bits/eglue_core_meat.hpp" #include "armadillo_bits/eglue_core_meat.hpp"
#include "armadillo_bits/eglue_cube_core_meat.hpp"
#include "armadillo_bits/podarray_meat.hpp" #include "armadillo_bits/podarray_meat.hpp"
#include "armadillo_bits/auxlib_meat.hpp" #include "armadillo_bits/auxlib_meat.hpp"
#include "armadillo_bits/injector_meat.hpp" #include "armadillo_bits/injector_meat.hpp"
#include "armadillo_bits/Mat_meat.hpp" #include "armadillo_bits/Mat_meat.hpp"
#include "armadillo_bits/Col_meat.hpp" #include "armadillo_bits/Col_meat.hpp"
#include "armadillo_bits/Row_meat.hpp" #include "armadillo_bits/Row_meat.hpp"
#include "armadillo_bits/Cube_meat.hpp" #include "armadillo_bits/Cube_meat.hpp"
 End of changes. 9 change blocks. 
9 lines changed or deleted 6 lines changed or added


 arrayops_proto.hpp   arrayops_proto.hpp 
skipping to change at line 222 skipping to change at line 222
template<typename eT> template<typename eT>
arma_hot arma_hot
arma_pure arma_pure
inline inline
static static
eT eT
accumulate(const eT* src, const u32 n_elem) accumulate(const eT* src, const u32 n_elem)
{ {
u32 i,j; u32 i,j;
eT acc = eT(0); eT acc1 = eT(0);
eT acc2 = eT(0);
for(i=0, j=1; j<n_elem; i+=2, j+=2) for(i=0, j=1; j<n_elem; i+=2, j+=2)
{ {
acc += src[i]; acc1 += src[i];
acc += src[j]; acc2 += src[j];
} }
if(i < n_elem) if(i < n_elem)
{ {
acc += src[i]; acc1 += src[i];
} }
return acc; return acc1 + acc2;
} }
template<typename eT> template<typename eT>
arma_hot arma_hot
arma_pure arma_pure
inline inline
static static
typename get_pod_type<eT>::result typename get_pod_type<eT>::result
norm_1(const eT* src, const u32 n_elem) norm_1(const eT* src, const u32 n_elem)
{ {
 End of changes. 4 change blocks. 
5 lines changed or deleted 6 lines changed or added


 auxlib_meat.hpp   auxlib_meat.hpp 
skipping to change at line 24 skipping to change at line 24
// 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 auxlib //! \addtogroup auxlib
//! @{ //! @{
//! immediate matrix inverse //! immediate matrix inverse
template<typename eT> template<typename eT>
inline inline
bool bool
auxlib::inv_noalias(Mat<eT>& out, const Mat<eT>& X) auxlib::inv(Mat<eT>& out, const Mat<eT>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
switch(X.n_rows) const u32 N = X.n_rows;
if(N <= 4)
{
const bool status = (&out != &X) ? auxlib::inv_noalias_tinymat(out, X,
N) : auxlib::inv_inplace_tinymat(out, N);
return (status == true) ? true : auxlib::inv_lapack(out, X);
}
else
{
return auxlib::inv_lapack(out, X);
}
}
template<typename eT>
inline
bool
auxlib::inv_noalias_tinymat(Mat<eT>& out, const Mat<eT>& X, const u32 N)
{
arma_extra_debug_sigprint();
bool det_ok = true;
out.set_size(N,N);
switch(N)
{ {
case 1: case 1:
{ {
out.set_size(1,1);
out[0] = eT(1) / X[0]; out[0] = eT(1) / X[0];
}; };
break; break;
case 2: case 2:
{ {
out.set_size(2,2);
const eT a = X.at(0,0); const eT a = X.at(0,0);
const eT b = X.at(0,1); const eT b = X.at(0,1);
const eT c = X.at(1,0); const eT c = X.at(1,0);
const eT d = X.at(1,1); const eT d = X.at(1,1);
const eT k = eT(1) / (a*d - b*c); const eT tmp_det = (a*d - b*c);
out.at(0,0) = d*k; if(tmp_det != eT(0))
out.at(0,1) = -b*k; {
out.at(1,0) = -c*k; out.at(0,0) = d / tmp_det;
out.at(1,1) = a*k; out.at(0,1) = -b / tmp_det;
out.at(1,0) = -c / tmp_det;
out.at(1,1) = a / tmp_det;
}
else
{
det_ok = false;
}
}; };
break; break;
case 3: case 3:
{ {
out.set_size(3,3);
const eT* X_col0 = X.colptr(0); const eT* X_col0 = X.colptr(0);
const eT a11 = X_col0[0]; const eT a11 = X_col0[0];
const eT a21 = X_col0[1]; const eT a21 = X_col0[1];
const eT a31 = X_col0[2]; const eT a31 = X_col0[2];
const eT* X_col1 = X.colptr(1); const eT* X_col1 = X.colptr(1);
const eT a12 = X_col1[0]; const eT a12 = X_col1[0];
const eT a22 = X_col1[1]; const eT a22 = X_col1[1];
const eT a32 = X_col1[2]; const eT a32 = X_col1[2];
const eT* X_col2 = X.colptr(2); const eT* X_col2 = X.colptr(2);
const eT a13 = X_col2[0]; const eT a13 = X_col2[0];
const eT a23 = X_col2[1]; const eT a23 = X_col2[1];
const eT a33 = X_col2[2]; const eT a33 = X_col2[2];
const eT k = eT(1) / ( a11*(a33*a22 - a32*a23) - a21*(a33*a12-a32*a13 const eT tmp_det = a11*(a33*a22 - a32*a23) - a21*(a33*a12-a32*a13) +
) + a31*(a23*a12 - a22*a13) ); a31*(a23*a12 - a22*a13);
eT* out_col0 = out.colptr(0);
out_col0[0] = (a33*a22 - a32*a23) * k;
out_col0[1] = -(a33*a21 - a31*a23) * k;
out_col0[2] = (a32*a21 - a31*a22) * k;
eT* out_col1 = out.colptr(1);
out_col1[0] = -(a33*a12 - a32*a13) * k;
out_col1[1] = (a33*a11 - a31*a13) * k;
out_col1[2] = -(a32*a11 - a31*a12) * k;
eT* out_col2 = out.colptr(2);
out_col2[0] = (a23*a12 - a22*a13) * k;
out_col2[1] = -(a23*a11 - a21*a13) * k;
out_col2[2] = (a22*a11 - a21*a12) * k;
};
break;
case 4: if(tmp_det != eT(0))
{ {
out.set_size(4,4); eT* out_col0 = out.colptr(0);
out_col0[0] = (a33*a22 - a32*a23) / tmp_det;
out_col0[1] = -(a33*a21 - a31*a23) / tmp_det;
out_col0[2] = (a32*a21 - a31*a22) / tmp_det;
out.at(0,0) = X.at(1,2)*X.at(2,3)*X.at(3,1) - X.at(1,3)*X.at(2,2)*X.a eT* out_col1 = out.colptr(1);
t(3,1) + X.at(1,3)*X.at(2,1)*X.at(3,2) - X.at(1,1)*X.at(2,3)*X.at(3,2) - X. out_col1[0] = -(a33*a12 - a32*a13) / tmp_det;
at(1,2)*X.at(2,1)*X.at(3,3) + X.at(1,1)*X.at(2,2)*X.at(3,3); out_col1[1] = (a33*a11 - a31*a13) / tmp_det;
out.at(1,0) = X.at(1,3)*X.at(2,2)*X.at(3,0) - X.at(1,2)*X.at(2,3)*X.a out_col1[2] = -(a32*a11 - a31*a12) / tmp_det;
t(3,0) - X.at(1,3)*X.at(2,0)*X.at(3,2) + X.at(1,0)*X.at(2,3)*X.at(3,2) + X.
at(1,2)*X.at(2,0)*X.at(3,3) - X.at(1,0)*X.at(2,2)*X.at(3,3);
out.at(2,0) = X.at(1,1)*X.at(2,3)*X.at(3,0) - X.at(1,3)*X.at(2,1)*X.a
t(3,0) + X.at(1,3)*X.at(2,0)*X.at(3,1) - X.at(1,0)*X.at(2,3)*X.at(3,1) - X.
at(1,1)*X.at(2,0)*X.at(3,3) + X.at(1,0)*X.at(2,1)*X.at(3,3);
out.at(3,0) = X.at(1,2)*X.at(2,1)*X.at(3,0) - X.at(1,1)*X.at(2,2)*X.a
t(3,0) - X.at(1,2)*X.at(2,0)*X.at(3,1) + X.at(1,0)*X.at(2,2)*X.at(3,1) + X.
at(1,1)*X.at(2,0)*X.at(3,2) - X.at(1,0)*X.at(2,1)*X.at(3,2);
out.at(0,1) = X.at(0,3)*X.at(2,2)*X.at(3,1) - X.at(0,2)*X.at(2,3)*X.a
t(3,1) - X.at(0,3)*X.at(2,1)*X.at(3,2) + X.at(0,1)*X.at(2,3)*X.at(3,2) + X.
at(0,2)*X.at(2,1)*X.at(3,3) - X.at(0,1)*X.at(2,2)*X.at(3,3);
out.at(1,1) = X.at(0,2)*X.at(2,3)*X.at(3,0) - X.at(0,3)*X.at(2,2)*X.a
t(3,0) + X.at(0,3)*X.at(2,0)*X.at(3,2) - X.at(0,0)*X.at(2,3)*X.at(3,2) - X.
at(0,2)*X.at(2,0)*X.at(3,3) + X.at(0,0)*X.at(2,2)*X.at(3,3);
out.at(2,1) = X.at(0,3)*X.at(2,1)*X.at(3,0) - X.at(0,1)*X.at(2,3)*X.a
t(3,0) - X.at(0,3)*X.at(2,0)*X.at(3,1) + X.at(0,0)*X.at(2,3)*X.at(3,1) + X.
at(0,1)*X.at(2,0)*X.at(3,3) - X.at(0,0)*X.at(2,1)*X.at(3,3);
out.at(3,1) = X.at(0,1)*X.at(2,2)*X.at(3,0) - X.at(0,2)*X.at(2,1)*X.a
t(3,0) + X.at(0,2)*X.at(2,0)*X.at(3,1) - X.at(0,0)*X.at(2,2)*X.at(3,1) - X.
at(0,1)*X.at(2,0)*X.at(3,2) + X.at(0,0)*X.at(2,1)*X.at(3,2);
out.at(0,2) = X.at(0,2)*X.at(1,3)*X.at(3,1) - X.at(0,3)*X.at(1,2)*X.a
t(3,1) + X.at(0,3)*X.at(1,1)*X.at(3,2) - X.at(0,1)*X.at(1,3)*X.at(3,2) - X.
at(0,2)*X.at(1,1)*X.at(3,3) + X.at(0,1)*X.at(1,2)*X.at(3,3);
out.at(1,2) = X.at(0,3)*X.at(1,2)*X.at(3,0) - X.at(0,2)*X.at(1,3)*X.a
t(3,0) - X.at(0,3)*X.at(1,0)*X.at(3,2) + X.at(0,0)*X.at(1,3)*X.at(3,2) + X.
at(0,2)*X.at(1,0)*X.at(3,3) - X.at(0,0)*X.at(1,2)*X.at(3,3);
out.at(2,2) = X.at(0,1)*X.at(1,3)*X.at(3,0) - X.at(0,3)*X.at(1,1)*X.a
t(3,0) + X.at(0,3)*X.at(1,0)*X.at(3,1) - X.at(0,0)*X.at(1,3)*X.at(3,1) - X.
at(0,1)*X.at(1,0)*X.at(3,3) + X.at(0,0)*X.at(1,1)*X.at(3,3);
out.at(3,2) = X.at(0,2)*X.at(1,1)*X.at(3,0) - X.at(0,1)*X.at(1,2)*X.a
t(3,0) - X.at(0,2)*X.at(1,0)*X.at(3,1) + X.at(0,0)*X.at(1,2)*X.at(3,1) + X.
at(0,1)*X.at(1,0)*X.at(3,2) - X.at(0,0)*X.at(1,1)*X.at(3,2);
out.at(0,3) = X.at(0,3)*X.at(1,2)*X.at(2,1) - X.at(0,2)*X.at(1,3)*X.a
t(2,1) - X.at(0,3)*X.at(1,1)*X.at(2,2) + X.at(0,1)*X.at(1,3)*X.at(2,2) + X.
at(0,2)*X.at(1,1)*X.at(2,3) - X.at(0,1)*X.at(1,2)*X.at(2,3);
out.at(1,3) = X.at(0,2)*X.at(1,3)*X.at(2,0) - X.at(0,3)*X.at(1,2)*X.a
t(2,0) + X.at(0,3)*X.at(1,0)*X.at(2,2) - X.at(0,0)*X.at(1,3)*X.at(2,2) - X.
at(0,2)*X.at(1,0)*X.at(2,3) + X.at(0,0)*X.at(1,2)*X.at(2,3);
out.at(2,3) = X.at(0,3)*X.at(1,1)*X.at(2,0) - X.at(0,1)*X.at(1,3)*X.a
t(2,0) - X.at(0,3)*X.at(1,0)*X.at(2,1) + X.at(0,0)*X.at(1,3)*X.at(2,1) + X.
at(0,1)*X.at(1,0)*X.at(2,3) - X.at(0,0)*X.at(1,1)*X.at(2,3);
out.at(3,3) = X.at(0,1)*X.at(1,2)*X.at(2,0) - X.at(0,2)*X.at(1,1)*X.a
t(2,0) + X.at(0,2)*X.at(1,0)*X.at(2,1) - X.at(0,0)*X.at(1,2)*X.at(2,1) - X.
at(0,1)*X.at(1,0)*X.at(2,2) + X.at(0,0)*X.at(1,1)*X.at(2,2);
out /= det(X); eT* out_col2 = out.colptr(2);
out_col2[0] = (a23*a12 - a22*a13) / tmp_det;
out_col2[1] = -(a23*a11 - a21*a13) / tmp_det;
out_col2[2] = (a22*a11 - a21*a12) / tmp_det;
}
else
{
det_ok = false;
}
}; };
break; break;
default: case 4:
{ {
#if defined(ARMA_USE_ATLAS) const eT tmp_det = det(X);
{
out = X;
podarray<int> ipiv(out.n_rows);
int info = atlas::clapack_getrf(atlas::CblasColMajor, out.n_rows, o
ut.n_cols, out.memptr(), out.n_rows, ipiv.memptr());
if(info == 0)
{
info = atlas::clapack_getri(atlas::CblasColMajor, out.n_rows, out
.memptr(), out.n_rows, ipiv.memptr());
}
return (info == 0); if(tmp_det != eT(0))
}
#elif defined(ARMA_USE_LAPACK)
{ {
out = X; out.at(0,0) = ( X.at(1,2)*X.at(2,3)*X.at(3,1) - X.at(1,3)*X.at(2,2)
*X.at(3,1) + X.at(1,3)*X.at(2,1)*X.at(3,2) - X.at(1,1)*X.at(2,3)*X.at(3,2)
- X.at(1,2)*X.at(2,1)*X.at(3,3) + X.at(1,1)*X.at(2,2)*X.at(3,3) ) / tmp_det
;
out.at(1,0) = ( X.at(1,3)*X.at(2,2)*X.at(3,0) - X.at(1,2)*X.at(2,3)
*X.at(3,0) - X.at(1,3)*X.at(2,0)*X.at(3,2) + X.at(1,0)*X.at(2,3)*X.at(3,2)
+ X.at(1,2)*X.at(2,0)*X.at(3,3) - X.at(1,0)*X.at(2,2)*X.at(3,3) ) / tmp_det
;
out.at(2,0) = ( X.at(1,1)*X.at(2,3)*X.at(3,0) - X.at(1,3)*X.at(2,1)
*X.at(3,0) + X.at(1,3)*X.at(2,0)*X.at(3,1) - X.at(1,0)*X.at(2,3)*X.at(3,1)
- X.at(1,1)*X.at(2,0)*X.at(3,3) + X.at(1,0)*X.at(2,1)*X.at(3,3) ) / tmp_det
;
out.at(3,0) = ( X.at(1,2)*X.at(2,1)*X.at(3,0) - X.at(1,1)*X.at(2,2)
*X.at(3,0) - X.at(1,2)*X.at(2,0)*X.at(3,1) + X.at(1,0)*X.at(2,2)*X.at(3,1)
+ X.at(1,1)*X.at(2,0)*X.at(3,2) - X.at(1,0)*X.at(2,1)*X.at(3,2) ) / tmp_det
;
int n_rows = out.n_rows; out.at(0,1) = ( X.at(0,3)*X.at(2,2)*X.at(3,1) - X.at(0,2)*X.at(2,3)
int n_cols = out.n_cols; *X.at(3,1) - X.at(0,3)*X.at(2,1)*X.at(3,2) + X.at(0,1)*X.at(2,3)*X.at(3,2)
int info = 0; + X.at(0,2)*X.at(2,1)*X.at(3,3) - X.at(0,1)*X.at(2,2)*X.at(3,3) ) / tmp_det
;
out.at(1,1) = ( X.at(0,2)*X.at(2,3)*X.at(3,0) - X.at(0,3)*X.at(2,2)
*X.at(3,0) + X.at(0,3)*X.at(2,0)*X.at(3,2) - X.at(0,0)*X.at(2,3)*X.at(3,2)
- X.at(0,2)*X.at(2,0)*X.at(3,3) + X.at(0,0)*X.at(2,2)*X.at(3,3) ) / tmp_det
;
out.at(2,1) = ( X.at(0,3)*X.at(2,1)*X.at(3,0) - X.at(0,1)*X.at(2,3)
*X.at(3,0) - X.at(0,3)*X.at(2,0)*X.at(3,1) + X.at(0,0)*X.at(2,3)*X.at(3,1)
+ X.at(0,1)*X.at(2,0)*X.at(3,3) - X.at(0,0)*X.at(2,1)*X.at(3,3) ) / tmp_det
;
out.at(3,1) = ( X.at(0,1)*X.at(2,2)*X.at(3,0) - X.at(0,2)*X.at(2,1)
*X.at(3,0) + X.at(0,2)*X.at(2,0)*X.at(3,1) - X.at(0,0)*X.at(2,2)*X.at(3,1)
- X.at(0,1)*X.at(2,0)*X.at(3,2) + X.at(0,0)*X.at(2,1)*X.at(3,2) ) / tmp_det
;
podarray<int> ipiv(out.n_rows); out.at(0,2) = ( X.at(0,2)*X.at(1,3)*X.at(3,1) - X.at(0,3)*X.at(1,2)
*X.at(3,1) + X.at(0,3)*X.at(1,1)*X.at(3,2) - X.at(0,1)*X.at(1,3)*X.at(3,2)
- X.at(0,2)*X.at(1,1)*X.at(3,3) + X.at(0,1)*X.at(1,2)*X.at(3,3) ) / tmp_det
;
out.at(1,2) = ( X.at(0,3)*X.at(1,2)*X.at(3,0) - X.at(0,2)*X.at(1,3)
*X.at(3,0) - X.at(0,3)*X.at(1,0)*X.at(3,2) + X.at(0,0)*X.at(1,3)*X.at(3,2)
+ X.at(0,2)*X.at(1,0)*X.at(3,3) - X.at(0,0)*X.at(1,2)*X.at(3,3) ) / tmp_det
;
out.at(2,2) = ( X.at(0,1)*X.at(1,3)*X.at(3,0) - X.at(0,3)*X.at(1,1)
*X.at(3,0) + X.at(0,3)*X.at(1,0)*X.at(3,1) - X.at(0,0)*X.at(1,3)*X.at(3,1)
- X.at(0,1)*X.at(1,0)*X.at(3,3) + X.at(0,0)*X.at(1,1)*X.at(3,3) ) / tmp_det
;
out.at(3,2) = ( X.at(0,2)*X.at(1,1)*X.at(3,0) - X.at(0,1)*X.at(1,2)
*X.at(3,0) - X.at(0,2)*X.at(1,0)*X.at(3,1) + X.at(0,0)*X.at(1,2)*X.at(3,1)
+ X.at(0,1)*X.at(1,0)*X.at(3,2) - X.at(0,0)*X.at(1,1)*X.at(3,2) ) / tmp_det
;
// 84 was empirically found -- it is the maximum value suggested by out.at(0,3) = ( X.at(0,3)*X.at(1,2)*X.at(2,1) - X.at(0,2)*X.at(1,3)
LAPACK (as provided by ATLAS v3.6) *X.at(2,1) - X.at(0,3)*X.at(1,1)*X.at(2,2) + X.at(0,1)*X.at(1,3)*X.at(2,2)
// based on tests with various matrix types on 32-bit and 64-bit ma + X.at(0,2)*X.at(1,1)*X.at(2,3) - X.at(0,1)*X.at(1,2)*X.at(2,3) ) / tmp_det
chines ;
// out.at(1,3) = ( X.at(0,2)*X.at(1,3)*X.at(2,0) - X.at(0,3)*X.at(1,2)
// the "work" array is deliberately long so that a secondary (time- *X.at(2,0) + X.at(0,3)*X.at(1,0)*X.at(2,2) - X.at(0,0)*X.at(1,3)*X.at(2,2)
consuming) - X.at(0,2)*X.at(1,0)*X.at(2,3) + X.at(0,0)*X.at(1,2)*X.at(2,3) ) / tmp_det
// memory allocation is avoided, if possible ;
out.at(2,3) = ( X.at(0,3)*X.at(1,1)*X.at(2,0) - X.at(0,1)*X.at(1,3)
int work_len = (std::max)(1, n_rows*84); *X.at(2,0) - X.at(0,3)*X.at(1,0)*X.at(2,1) + X.at(0,0)*X.at(1,3)*X.at(2,1)
podarray<eT> work(work_len); + X.at(0,1)*X.at(1,0)*X.at(2,3) - X.at(0,0)*X.at(1,1)*X.at(2,3) ) / tmp_det
;
lapack::getrf_(&n_rows, &n_cols, out.memptr(), &n_rows, ipiv.memptr out.at(3,3) = ( X.at(0,1)*X.at(1,2)*X.at(2,0) - X.at(0,2)*X.at(1,1)
(), &info); *X.at(2,0) + X.at(0,2)*X.at(1,0)*X.at(2,1) - X.at(0,0)*X.at(1,2)*X.at(2,1)
- X.at(0,1)*X.at(1,0)*X.at(2,2) + X.at(0,0)*X.at(1,1)*X.at(2,2) ) / tmp_det
if(info == 0) ;
{
// query for optimum size of work_len
int work_len_tmp = -1;
lapack::getri_(&n_rows, out.memptr(), &n_rows, ipiv.memptr(), wor
k.memptr(), &work_len_tmp, &info);
if(info == 0)
{
int proposed_work_len = static_cast<int>(access::tmp_real(work[
0]));
// if necessary, allocate more memory
if(work_len < proposed_work_len)
{
work_len = proposed_work_len;
work.set_size(work_len);
}
}
lapack::getri_(&n_rows, out.memptr(), &n_rows, ipiv.memptr(), wor
k.memptr(), &work_len, &info);
}
return (info == 0);
} }
#else else
{ {
arma_stop("inv(): need ATLAS or LAPACK"); det_ok = false;
} }
#endif
}; };
break;
default:
;
} }
return true; return det_ok;
} }
//! immediate inplace matrix inverse
template<typename eT> template<typename eT>
inline inline
bool bool
auxlib::inv_inplace(Mat<eT>& X) auxlib::inv_inplace_tinymat(Mat<eT>& X, const u32 N)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
bool det_ok = true;
// for more info, see: // for more info, see:
// http://www.dr-lex.34sp.com/random/matrix_inv.html // http://www.dr-lex.34sp.com/random/matrix_inv.html
// http://www.cvl.iis.u-tokyo.ac.jp/~miyazaki/tech/teche23.html // http://www.cvl.iis.u-tokyo.ac.jp/~miyazaki/tech/teche23.html
// http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/f ourD/index.htm // http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/f ourD/index.htm
// http://www.geometrictools.com//LibFoundation/Mathematics/Wm4Matrix4.in l // http://www.geometrictools.com//LibFoundation/Mathematics/Wm4Matrix4.in l
switch(X.n_rows) switch(N)
{ {
case 1: case 1:
{ {
X[0] = eT(1) / X[0]; X[0] = eT(1) / X[0];
}; };
break; break;
case 2: case 2:
{ {
const eT a = X.at(0,0); const eT a = X.at(0,0);
const eT b = X.at(0,1); const eT b = X.at(0,1);
const eT c = X.at(1,0); const eT c = X.at(1,0);
const eT d = X.at(1,1); const eT d = X.at(1,1);
const eT k = eT(1) / (a*d - b*c); const eT tmp_det = (a*d - b*c);
X.at(0,0) = d*k; if(tmp_det != eT(0))
X.at(0,1) = -b*k; {
X.at(1,0) = -c*k; X.at(0,0) = d / tmp_det;
X.at(1,1) = a*k; X.at(0,1) = -b / tmp_det;
X.at(1,0) = -c / tmp_det;
X.at(1,1) = a / tmp_det;
}
else
{
det_ok = false;
}
}; };
break; break;
case 3: case 3:
{ {
eT* X_col0 = X.colptr(0); eT* X_col0 = X.colptr(0);
eT* X_col1 = X.colptr(1); eT* X_col1 = X.colptr(1);
eT* X_col2 = X.colptr(2); eT* X_col2 = X.colptr(2);
const eT a11 = X_col0[0]; const eT a11 = X_col0[0];
skipping to change at line 249 skipping to change at line 231
const eT a31 = X_col0[2]; const eT a31 = X_col0[2];
const eT a12 = X_col1[0]; const eT a12 = X_col1[0];
const eT a22 = X_col1[1]; const eT a22 = X_col1[1];
const eT a32 = X_col1[2]; const eT a32 = X_col1[2];
const eT a13 = X_col2[0]; const eT a13 = X_col2[0];
const eT a23 = X_col2[1]; const eT a23 = X_col2[1];
const eT a33 = X_col2[2]; const eT a33 = X_col2[2];
const eT k = eT(1) / ( a11*(a33*a22 - a32*a23) - a21*(a33*a12-a32*a13 const eT tmp_det = a11*(a33*a22 - a32*a23) - a21*(a33*a12-a32*a13) +
) + a31*(a23*a12 - a22*a13) ); a31*(a23*a12 - a22*a13);
if(tmp_det != eT(0))
{
X_col0[0] = (a33*a22 - a32*a23) / tmp_det;
X_col0[1] = -(a33*a21 - a31*a23) / tmp_det;
X_col0[2] = (a32*a21 - a31*a22) / tmp_det;
X_col1[0] = -(a33*a12 - a32*a13) / tmp_det;
X_col1[1] = (a33*a11 - a31*a13) / tmp_det;
X_col1[2] = -(a32*a11 - a31*a12) / tmp_det;
X_col0[0] = (a33*a22 - a32*a23) * k; X_col2[0] = (a23*a12 - a22*a13) / tmp_det;
X_col0[1] = -(a33*a21 - a31*a23) * k; X_col2[1] = -(a23*a11 - a21*a13) / tmp_det;
X_col0[2] = (a32*a21 - a31*a22) * k; X_col2[2] = (a22*a11 - a21*a12) / tmp_det;
}
X_col1[0] = -(a33*a12 - a32*a13) * k; else
X_col1[1] = (a33*a11 - a31*a13) * k; {
X_col1[2] = -(a32*a11 - a31*a12) * k; det_ok = false;
}
X_col2[0] = (a23*a12 - a22*a13) * k;
X_col2[1] = -(a23*a11 - a21*a13) * k;
X_col2[2] = (a22*a11 - a21*a12) * k;
}; };
break; break;
case 4: case 4:
{ {
const Mat<eT> A(X); const eT tmp_det = det(X);
if(tmp_det != eT(0))
{
const Mat<eT> A(X);
X.at(0,0) = ( A.at(1,2)*A.at(2,3)*A.at(3,1) - A.at(1,3)*A.at(2,2)*A
.at(3,1) + A.at(1,3)*A.at(2,1)*A.at(3,2) - A.at(1,1)*A.at(2,3)*A.at(3,2) -
A.at(1,2)*A.at(2,1)*A.at(3,3) + A.at(1,1)*A.at(2,2)*A.at(3,3) ) / tmp_det;
X.at(1,0) = ( A.at(1,3)*A.at(2,2)*A.at(3,0) - A.at(1,2)*A.at(2,3)*A
.at(3,0) - A.at(1,3)*A.at(2,0)*A.at(3,2) + A.at(1,0)*A.at(2,3)*A.at(3,2) +
A.at(1,2)*A.at(2,0)*A.at(3,3) - A.at(1,0)*A.at(2,2)*A.at(3,3) ) / tmp_det;
X.at(2,0) = ( A.at(1,1)*A.at(2,3)*A.at(3,0) - A.at(1,3)*A.at(2,1)*A
.at(3,0) + A.at(1,3)*A.at(2,0)*A.at(3,1) - A.at(1,0)*A.at(2,3)*A.at(3,1) -
A.at(1,1)*A.at(2,0)*A.at(3,3) + A.at(1,0)*A.at(2,1)*A.at(3,3) ) / tmp_det;
X.at(3,0) = ( A.at(1,2)*A.at(2,1)*A.at(3,0) - A.at(1,1)*A.at(2,2)*A
.at(3,0) - A.at(1,2)*A.at(2,0)*A.at(3,1) + A.at(1,0)*A.at(2,2)*A.at(3,1) +
A.at(1,1)*A.at(2,0)*A.at(3,2) - A.at(1,0)*A.at(2,1)*A.at(3,2) ) / tmp_det;
X.at(0,0) = A.at(1,2)*A.at(2,3)*A.at(3,1) - A.at(1,3)*A.at(2,2)*A.at( X.at(0,1) = ( A.at(0,3)*A.at(2,2)*A.at(3,1) - A.at(0,2)*A.at(2,3)*A
3,1) + A.at(1,3)*A.at(2,1)*A.at(3,2) - A.at(1,1)*A.at(2,3)*A.at(3,2) - A.at .at(3,1) - A.at(0,3)*A.at(2,1)*A.at(3,2) + A.at(0,1)*A.at(2,3)*A.at(3,2) +
(1,2)*A.at(2,1)*A.at(3,3) + A.at(1,1)*A.at(2,2)*A.at(3,3); A.at(0,2)*A.at(2,1)*A.at(3,3) - A.at(0,1)*A.at(2,2)*A.at(3,3) ) / tmp_det;
X.at(1,0) = A.at(1,3)*A.at(2,2)*A.at(3,0) - A.at(1,2)*A.at(2,3)*A.at( X.at(1,1) = ( A.at(0,2)*A.at(2,3)*A.at(3,0) - A.at(0,3)*A.at(2,2)*A
3,0) - A.at(1,3)*A.at(2,0)*A.at(3,2) + A.at(1,0)*A.at(2,3)*A.at(3,2) + A.at .at(3,0) + A.at(0,3)*A.at(2,0)*A.at(3,2) - A.at(0,0)*A.at(2,3)*A.at(3,2) -
(1,2)*A.at(2,0)*A.at(3,3) - A.at(1,0)*A.at(2,2)*A.at(3,3); A.at(0,2)*A.at(2,0)*A.at(3,3) + A.at(0,0)*A.at(2,2)*A.at(3,3) ) / tmp_det;
X.at(2,0) = A.at(1,1)*A.at(2,3)*A.at(3,0) - A.at(1,3)*A.at(2,1)*A.at( X.at(2,1) = ( A.at(0,3)*A.at(2,1)*A.at(3,0) - A.at(0,1)*A.at(2,3)*A
3,0) + A.at(1,3)*A.at(2,0)*A.at(3,1) - A.at(1,0)*A.at(2,3)*A.at(3,1) - A.at .at(3,0) - A.at(0,3)*A.at(2,0)*A.at(3,1) + A.at(0,0)*A.at(2,3)*A.at(3,1) +
(1,1)*A.at(2,0)*A.at(3,3) + A.at(1,0)*A.at(2,1)*A.at(3,3); A.at(0,1)*A.at(2,0)*A.at(3,3) - A.at(0,0)*A.at(2,1)*A.at(3,3) ) / tmp_det;
X.at(3,0) = A.at(1,2)*A.at(2,1)*A.at(3,0) - A.at(1,1)*A.at(2,2)*A.at( X.at(3,1) = ( A.at(0,1)*A.at(2,2)*A.at(3,0) - A.at(0,2)*A.at(2,1)*A
3,0) - A.at(1,2)*A.at(2,0)*A.at(3,1) + A.at(1,0)*A.at(2,2)*A.at(3,1) + A.at .at(3,0) + A.at(0,2)*A.at(2,0)*A.at(3,1) - A.at(0,0)*A.at(2,2)*A.at(3,1) -
(1,1)*A.at(2,0)*A.at(3,2) - A.at(1,0)*A.at(2,1)*A.at(3,2); A.at(0,1)*A.at(2,0)*A.at(3,2) + A.at(0,0)*A.at(2,1)*A.at(3,2) ) / tmp_det;
X.at(0,1) = A.at(0,3)*A.at(2,2)*A.at(3,1) - A.at(0,2)*A.at(2,3)*A.at(
3,1) - A.at(0,3)*A.at(2,1)*A.at(3,2) + A.at(0,1)*A.at(2,3)*A.at(3,2) + A.at
(0,2)*A.at(2,1)*A.at(3,3) - A.at(0,1)*A.at(2,2)*A.at(3,3);
X.at(1,1) = A.at(0,2)*A.at(2,3)*A.at(3,0) - A.at(0,3)*A.at(2,2)*A.at(
3,0) + A.at(0,3)*A.at(2,0)*A.at(3,2) - A.at(0,0)*A.at(2,3)*A.at(3,2) - A.at
(0,2)*A.at(2,0)*A.at(3,3) + A.at(0,0)*A.at(2,2)*A.at(3,3);
X.at(2,1) = A.at(0,3)*A.at(2,1)*A.at(3,0) - A.at(0,1)*A.at(2,3)*A.at(
3,0) - A.at(0,3)*A.at(2,0)*A.at(3,1) + A.at(0,0)*A.at(2,3)*A.at(3,1) + A.at
(0,1)*A.at(2,0)*A.at(3,3) - A.at(0,0)*A.at(2,1)*A.at(3,3);
X.at(3,1) = A.at(0,1)*A.at(2,2)*A.at(3,0) - A.at(0,2)*A.at(2,1)*A.at(
3,0) + A.at(0,2)*A.at(2,0)*A.at(3,1) - A.at(0,0)*A.at(2,2)*A.at(3,1) - A.at
(0,1)*A.at(2,0)*A.at(3,2) + A.at(0,0)*A.at(2,1)*A.at(3,2);
X.at(0,2) = A.at(0,2)*A.at(1,3)*A.at(3,1) - A.at(0,3)*A.at(1,2)*A.at(
3,1) + A.at(0,3)*A.at(1,1)*A.at(3,2) - A.at(0,1)*A.at(1,3)*A.at(3,2) - A.at
(0,2)*A.at(1,1)*A.at(3,3) + A.at(0,1)*A.at(1,2)*A.at(3,3);
X.at(1,2) = A.at(0,3)*A.at(1,2)*A.at(3,0) - A.at(0,2)*A.at(1,3)*A.at(
3,0) - A.at(0,3)*A.at(1,0)*A.at(3,2) + A.at(0,0)*A.at(1,3)*A.at(3,2) + A.at
(0,2)*A.at(1,0)*A.at(3,3) - A.at(0,0)*A.at(1,2)*A.at(3,3);
X.at(2,2) = A.at(0,1)*A.at(1,3)*A.at(3,0) - A.at(0,3)*A.at(1,1)*A.at(
3,0) + A.at(0,3)*A.at(1,0)*A.at(3,1) - A.at(0,0)*A.at(1,3)*A.at(3,1) - A.at
(0,1)*A.at(1,0)*A.at(3,3) + A.at(0,0)*A.at(1,1)*A.at(3,3);
X.at(3,2) = A.at(0,2)*A.at(1,1)*A.at(3,0) - A.at(0,1)*A.at(1,2)*A.at(
3,0) - A.at(0,2)*A.at(1,0)*A.at(3,1) + A.at(0,0)*A.at(1,2)*A.at(3,1) + A.at
(0,1)*A.at(1,0)*A.at(3,2) - A.at(0,0)*A.at(1,1)*A.at(3,2);
X.at(0,3) = A.at(0,3)*A.at(1,2)*A.at(2,1) - A.at(0,2)*A.at(1,3)*A.at(
2,1) - A.at(0,3)*A.at(1,1)*A.at(2,2) + A.at(0,1)*A.at(1,3)*A.at(2,2) + A.at
(0,2)*A.at(1,1)*A.at(2,3) - A.at(0,1)*A.at(1,2)*A.at(2,3);
X.at(1,3) = A.at(0,2)*A.at(1,3)*A.at(2,0) - A.at(0,3)*A.at(1,2)*A.at(
2,0) + A.at(0,3)*A.at(1,0)*A.at(2,2) - A.at(0,0)*A.at(1,3)*A.at(2,2) - A.at
(0,2)*A.at(1,0)*A.at(2,3) + A.at(0,0)*A.at(1,2)*A.at(2,3);
X.at(2,3) = A.at(0,3)*A.at(1,1)*A.at(2,0) - A.at(0,1)*A.at(1,3)*A.at(
2,0) - A.at(0,3)*A.at(1,0)*A.at(2,1) + A.at(0,0)*A.at(1,3)*A.at(2,1) + A.at
(0,1)*A.at(1,0)*A.at(2,3) - A.at(0,0)*A.at(1,1)*A.at(2,3);
X.at(3,3) = A.at(0,1)*A.at(1,2)*A.at(2,0) - A.at(0,2)*A.at(1,1)*A.at(
2,0) + A.at(0,2)*A.at(1,0)*A.at(2,1) - A.at(0,0)*A.at(1,2)*A.at(2,1) - A.at
(0,1)*A.at(1,0)*A.at(2,2) + A.at(0,0)*A.at(1,1)*A.at(2,2);
X /= det(A); X.at(0,2) = ( A.at(0,2)*A.at(1,3)*A.at(3,1) - A.at(0,3)*A.at(1,2)*A
.at(3,1) + A.at(0,3)*A.at(1,1)*A.at(3,2) - A.at(0,1)*A.at(1,3)*A.at(3,2) -
A.at(0,2)*A.at(1,1)*A.at(3,3) + A.at(0,1)*A.at(1,2)*A.at(3,3) ) / tmp_det;
X.at(1,2) = ( A.at(0,3)*A.at(1,2)*A.at(3,0) - A.at(0,2)*A.at(1,3)*A
.at(3,0) - A.at(0,3)*A.at(1,0)*A.at(3,2) + A.at(0,0)*A.at(1,3)*A.at(3,2) +
A.at(0,2)*A.at(1,0)*A.at(3,3) - A.at(0,0)*A.at(1,2)*A.at(3,3) ) / tmp_det;
X.at(2,2) = ( A.at(0,1)*A.at(1,3)*A.at(3,0) - A.at(0,3)*A.at(1,1)*A
.at(3,0) + A.at(0,3)*A.at(1,0)*A.at(3,1) - A.at(0,0)*A.at(1,3)*A.at(3,1) -
A.at(0,1)*A.at(1,0)*A.at(3,3) + A.at(0,0)*A.at(1,1)*A.at(3,3) ) / tmp_det;
X.at(3,2) = ( A.at(0,2)*A.at(1,1)*A.at(3,0) - A.at(0,1)*A.at(1,2)*A
.at(3,0) - A.at(0,2)*A.at(1,0)*A.at(3,1) + A.at(0,0)*A.at(1,2)*A.at(3,1) +
A.at(0,1)*A.at(1,0)*A.at(3,2) - A.at(0,0)*A.at(1,1)*A.at(3,2) ) / tmp_det;
X.at(0,3) = ( A.at(0,3)*A.at(1,2)*A.at(2,1) - A.at(0,2)*A.at(1,3)*A
.at(2,1) - A.at(0,3)*A.at(1,1)*A.at(2,2) + A.at(0,1)*A.at(1,3)*A.at(2,2) +
A.at(0,2)*A.at(1,1)*A.at(2,3) - A.at(0,1)*A.at(1,2)*A.at(2,3) ) / tmp_det;
X.at(1,3) = ( A.at(0,2)*A.at(1,3)*A.at(2,0) - A.at(0,3)*A.at(1,2)*A
.at(2,0) + A.at(0,3)*A.at(1,0)*A.at(2,2) - A.at(0,0)*A.at(1,3)*A.at(2,2) -
A.at(0,2)*A.at(1,0)*A.at(2,3) + A.at(0,0)*A.at(1,2)*A.at(2,3) ) / tmp_det;
X.at(2,3) = ( A.at(0,3)*A.at(1,1)*A.at(2,0) - A.at(0,1)*A.at(1,3)*A
.at(2,0) - A.at(0,3)*A.at(1,0)*A.at(2,1) + A.at(0,0)*A.at(1,3)*A.at(2,1) +
A.at(0,1)*A.at(1,0)*A.at(2,3) - A.at(0,0)*A.at(1,1)*A.at(2,3) ) / tmp_det;
X.at(3,3) = ( A.at(0,1)*A.at(1,2)*A.at(2,0) - A.at(0,2)*A.at(1,1)*A
.at(2,0) + A.at(0,2)*A.at(1,0)*A.at(2,1) - A.at(0,0)*A.at(1,2)*A.at(2,1) -
A.at(0,1)*A.at(1,0)*A.at(2,2) + A.at(0,0)*A.at(1,1)*A.at(2,2) ) / tmp_det;
}
else
{
det_ok = false;
}
}; };
break; break;
default: default:
{ ;
#if defined(ARMA_USE_ATLAS) }
{
Mat<eT>& out = X;
podarray<int> ipiv(out.n_rows);
int info = atlas::clapack_getrf(atlas::CblasColMajor, out.n_rows, o
ut.n_cols, out.memptr(), out.n_rows, ipiv.memptr());
if(info == 0) return det_ok;
{ }
info = atlas::clapack_getri(atlas::CblasColMajor, out.n_rows, out
.memptr(), out.n_rows, ipiv.memptr());
}
return (info == 0); template<typename eT>
} inline
#elif defined(ARMA_USE_LAPACK) bool
{ auxlib::inv_lapack(Mat<eT>& out, const Mat<eT>& X)
Mat<eT>& out = X; {
arma_extra_debug_sigprint();
int n_rows = out.n_rows; if(&out != &X)
int n_cols = out.n_cols; {
int info = 0; out = X;
}
podarray<int> ipiv(out.n_rows); #if defined(ARMA_USE_ATLAS)
{
podarray<int> ipiv(out.n_rows);
// 84 was empirically found -- it is the maximum value suggested by int info = atlas::clapack_getrf(atlas::CblasColMajor, out.n_rows, out.n
LAPACK (as provided by ATLAS v3.6) _cols, out.memptr(), out.n_rows, ipiv.memptr());
// based on tests with various matrix types on 32-bit and 64-bit ma
chines
//
// the "work" array is deliberately long so that a secondary (time-
consuming)
// memory allocation is avoided, if possible
int work_len = (std::max)(1, n_rows*84); if(info == 0)
podarray<eT> work(work_len); {
info = atlas::clapack_getri(atlas::CblasColMajor, out.n_rows, out.mem
ptr(), out.n_rows, ipiv.memptr());
}
lapack::getrf_(&n_rows, &n_cols, out.memptr(), &n_rows, ipiv.memptr return (info == 0);
(), &info); }
#elif defined(ARMA_USE_LAPACK)
{
blas_int n_rows = out.n_rows;
blas_int n_cols = out.n_cols;
blas_int info = 0;
podarray<blas_int> ipiv(out.n_rows);
// 84 was empirically found -- it is the maximum value suggested by LAP
ACK (as provided by ATLAS v3.6)
// based on tests with various matrix types on 32-bit and 64-bit machin
es
//
// the "work" array is deliberately long so that a secondary (time-cons
uming)
// memory allocation is avoided, if possible
if(info == 0) blas_int work_len = (std::max)(1, n_rows*84);
{ podarray<eT> work(work_len);
// query for optimum size of work_len
int work_len_tmp = -1; lapack::getrf_(&n_rows, &n_cols, out.memptr(), &n_rows, ipiv.memptr(),
lapack::getri_(&n_rows, out.memptr(), &n_rows, ipiv.memptr(), wor &info);
k.memptr(), &work_len_tmp, &info);
if(info == 0) if(info == 0)
{ {
int proposed_work_len = static_cast<int>(access::tmp_real(work[ // query for optimum size of work_len
0]));
// if necessary, allocate more memory
if(work_len < proposed_work_len)
{
work_len = proposed_work_len;
work.set_size(work_len);
}
}
lapack::getri_(&n_rows, out.memptr(), &n_rows, ipiv.memptr(), wor blas_int work_len_tmp = -1;
k.memptr(), &work_len, &info); lapack::getri_(&n_rows, out.memptr(), &n_rows, ipiv.memptr(), work.me
} mptr(), &work_len_tmp, &info);
return (info == 0); if(info == 0)
}
#else
{ {
arma_stop("inv(): need ATLAS or LAPACK"); blas_int proposed_work_len = static_cast<blas_int>(access::tmp_real
(work[0]));
// if necessary, allocate more memory
if(work_len < proposed_work_len)
{
work_len = proposed_work_len;
work.set_size(work_len);
}
} }
#endif
lapack::getri_(&n_rows, out.memptr(), &n_rows, ipiv.memptr(), work.me
mptr(), &work_len, &info);
} }
return (info == 0);
} }
#else
return true; {
arma_stop("inv(): need ATLAS or LAPACK");
return false;
}
#endif
} }
//! immediate determinant of a matrix using ATLAS or LAPACK
template<typename eT> template<typename eT>
inline inline
eT eT
auxlib::det(const Mat<eT>& X) auxlib::det(const Mat<eT>& X)
{ {
const u32 N = X.n_rows;
switch(N)
{
case 0:
case 1:
case 2:
return auxlib::det_tinymat(X, N);
break;
case 3:
case 4:
{
const eT tmp_det = auxlib::det_tinymat(X, N);
return (tmp_det != eT(0)) ? tmp_det : auxlib::det_lapack(X);
}
break;
default:
return auxlib::det_lapack(X);
}
}
template<typename eT>
inline
eT
auxlib::det_tinymat(const Mat<eT>& X, const u32 N)
{
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
switch(X.n_rows) switch(N)
{ {
case 0: case 0:
return eT(0); return eT(0);
case 1: case 1:
return X[0]; return X[0];
case 2: case 2:
return (X.at(0,0)*X.at(1,1) - X.at(0,1)*X.at(1,0)); return (X.at(0,0)*X.at(1,1) - X.at(0,1)*X.at(1,0));
case 3: case 3:
{ {
// const double tmp1 = X.at(0,0) * X.at(1,1) * X.at(2,2);
// const double tmp2 = X.at(0,1) * X.at(1,2) * X.at(2,0);
// const double tmp3 = X.at(0,2) * X.at(1,0) * X.at(2,1);
// const double tmp4 = X.at(2,0) * X.at(1,1) * X.at(0,2);
// const double tmp5 = X.at(2,1) * X.at(1,2) * X.at(0,0);
// const double tmp6 = X.at(2,2) * X.at(1,0) * X.at(0,1);
// return (tmp1+tmp2+tmp3) - (tmp4+tmp5+tmp6);
const eT* a_col0 = X.colptr(0); const eT* a_col0 = X.colptr(0);
const eT a11 = a_col0[0]; const eT a11 = a_col0[0];
const eT a21 = a_col0[1]; const eT a21 = a_col0[1];
const eT a31 = a_col0[2]; const eT a31 = a_col0[2];
const eT* a_col1 = X.colptr(1); const eT* a_col1 = X.colptr(1);
const eT a12 = a_col1[0]; const eT a12 = a_col1[0];
const eT a22 = a_col1[1]; const eT a22 = a_col1[1];
const eT a32 = a_col1[2]; const eT a32 = a_col1[2];
const eT* a_col2 = X.colptr(2); const eT* a_col2 = X.colptr(2);
const eT a13 = a_col2[0]; const eT a13 = a_col2[0];
const eT a23 = a_col2[1]; const eT a23 = a_col2[1];
const eT a33 = a_col2[2]; const eT a33 = a_col2[2];
return ( a11*(a33*a22 - a32*a23) - a21*(a33*a12-a32*a13) + a31*(a23*a 12 - a22*a13) ); return ( a11*(a33*a22 - a32*a23) - a21*(a33*a12-a32*a13) + a31*(a23*a 12 - a22*a13) );
// const double tmp1 = X.at(0,0) * X.at(1,1) * X.at(2,2);
// const double tmp2 = X.at(0,1) * X.at(1,2) * X.at(2,0);
// const double tmp3 = X.at(0,2) * X.at(1,0) * X.at(2,1);
// const double tmp4 = X.at(2,0) * X.at(1,1) * X.at(0,2);
// const double tmp5 = X.at(2,1) * X.at(1,2) * X.at(0,0);
// const double tmp6 = X.at(2,2) * X.at(1,0) * X.at(0,1);
// return (tmp1+tmp2+tmp3) - (tmp4+tmp5+tmp6);
} }
case 4: case 4:
{ {
const eT val = \ const eT val = \
X.at(0,3) * X.at(1,2) * X.at(2,1) * X.at(3,0) \ X.at(0,3) * X.at(1,2) * X.at(2,1) * X.at(3,0) \
- X.at(0,2) * X.at(1,3) * X.at(2,1) * X.at(3,0) \ - X.at(0,2) * X.at(1,3) * X.at(2,1) * X.at(3,0) \
- X.at(0,3) * X.at(1,1) * X.at(2,2) * X.at(3,0) \ - X.at(0,3) * X.at(1,1) * X.at(2,2) * X.at(3,0) \
+ X.at(0,1) * X.at(1,3) * X.at(2,2) * X.at(3,0) \ + X.at(0,1) * X.at(1,3) * X.at(2,2) * X.at(3,0) \
+ X.at(0,2) * X.at(1,1) * X.at(2,3) * X.at(3,0) \ + X.at(0,2) * X.at(1,1) * X.at(2,3) * X.at(3,0) \
skipping to change at line 446 skipping to change at line 479
+ X.at(0,2) * X.at(1,0) * X.at(2,1) * X.at(3,3) \ + X.at(0,2) * X.at(1,0) * X.at(2,1) * X.at(3,3) \
- X.at(0,0) * X.at(1,2) * X.at(2,1) * X.at(3,3) \ - X.at(0,0) * X.at(1,2) * X.at(2,1) * X.at(3,3) \
- X.at(0,1) * X.at(1,0) * X.at(2,2) * X.at(3,3) \ - X.at(0,1) * X.at(1,0) * X.at(2,2) * X.at(3,3) \
+ X.at(0,0) * X.at(1,1) * X.at(2,2) * X.at(3,3) \ + X.at(0,0) * X.at(1,1) * X.at(2,2) * X.at(3,3) \
; ;
return val; return val;
} }
default: default:
{ return eT(0);
#if defined(ARMA_USE_ATLAS) ;
{ }
Mat<eT> tmp = X; }
podarray<int> ipiv(tmp.n_rows);
atlas::clapack_getrf(atlas::CblasColMajor, tmp.n_rows, tmp.n_cols, //! immediate determinant of a matrix using ATLAS or LAPACK
tmp.memptr(), tmp.n_rows, ipiv.memptr()); template<typename eT>
inline
eT
auxlib::det_lapack(const Mat<eT>& X)
{
arma_extra_debug_sigprint();
// on output tmp appears to be L+U_alt, where U_alt is U with the m #if defined(ARMA_USE_ATLAS)
ain diagonal set to zero {
eT val = tmp.at(0,0); Mat<eT> tmp = X;
for(u32 i=1; i < tmp.n_rows; ++i) podarray<int> ipiv(tmp.n_rows);
{
val *= tmp.at(i,i);
}
int sign = +1; atlas::clapack_getrf(atlas::CblasColMajor, tmp.n_rows, tmp.n_cols, tmp.
for(u32 i=0; i < tmp.n_rows; ++i) memptr(), tmp.n_rows, ipiv.memptr());
{
if( int(i) != ipiv.mem[i] ) // NOTE: no adjustment required, as
the clapack version of getrf() assumes counting from 0
{
sign *= -1;
}
}
return ( (sign < 0) ? -val : val ); // on output tmp appears to be L+U_alt, where U_alt is U with the main
} diagonal set to zero
#elif defined(ARMA_USE_LAPACK) eT val = tmp.at(0,0);
for(u32 i=1; i < tmp.n_rows; ++i)
{
val *= tmp.at(i,i);
}
int sign = +1;
for(u32 i=0; i < tmp.n_rows; ++i)
{
if( int(i) != ipiv.mem[i] ) // NOTE: no adjustment required, as the
clapack version of getrf() assumes counting from 0
{ {
Mat<eT> tmp = X; sign *= -1;
podarray<int> ipiv(tmp.n_rows); }
}
int info = 0; return ( (sign < 0) ? -val : val );
int n_rows = int(tmp.n_rows); }
int n_cols = int(tmp.n_cols); #elif defined(ARMA_USE_LAPACK)
{
Mat<eT> tmp = X;
podarray<blas_int> ipiv(tmp.n_rows);
lapack::getrf_(&n_rows, &n_cols, tmp.memptr(), &n_rows, ipiv.memptr blas_int info = 0;
(), &info); blas_int n_rows = blas_int(tmp.n_rows);
blas_int n_cols = blas_int(tmp.n_cols);
// on output tmp appears to be L+U_alt, where U_alt is U with the m lapack::getrf_(&n_rows, &n_cols, tmp.memptr(), &n_rows, ipiv.memptr(),
ain diagonal set to zero &info);
eT val = tmp.at(0,0);
for(u32 i=1; i < tmp.n_rows; ++i)
{
val *= tmp.at(i,i);
}
int sign = +1; // on output tmp appears to be L+U_alt, where U_alt is U with the main
for(u32 i=0; i < tmp.n_rows; ++i) diagonal set to zero
{ eT val = tmp.at(0,0);
if( int(i) != (ipiv.mem[i] - 1) ) // NOTE: adjustment of -1 is r for(u32 i=1; i < tmp.n_rows; ++i)
equired as Fortran counts from 1 {
{ val *= tmp.at(i,i);
sign *= -1; }
}
}
return ( (sign < 0) ? -val : val ); blas_int sign = +1;
} for(u32 i=0; i < tmp.n_rows; ++i)
#else {
if( blas_int(i) != (ipiv.mem[i] - 1) ) // NOTE: adjustment of -1 is
required as Fortran counts from 1
{ {
arma_stop("det(): need ATLAS or LAPACK"); sign *= -1;
return eT(0);
} }
#endif
} }
return ( (sign < 0) ? -val : val );
}
#else
{
arma_stop("det(): need ATLAS or LAPACK");
return eT(0);
} }
#endif
} }
//! immediate log determinant of a matrix using ATLAS or LAPACK //! immediate log determinant of a matrix using ATLAS or LAPACK
template<typename eT> template<typename eT>
inline inline
void void
auxlib::log_det(eT& out_val, typename get_pod_type<eT>::result& out_sign, c onst Mat<eT>& X) auxlib::log_det(eT& out_val, typename get_pod_type<eT>::result& out_sign, c onst Mat<eT>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
skipping to change at line 555 skipping to change at line 598
sign *= -1; sign *= -1;
} }
} }
out_val = val; out_val = val;
out_sign = T(sign); out_sign = T(sign);
} }
#elif defined(ARMA_USE_LAPACK) #elif defined(ARMA_USE_LAPACK)
{ {
Mat<eT> tmp = X; Mat<eT> tmp = X;
podarray<int> ipiv(tmp.n_rows); podarray<blas_int> ipiv(tmp.n_rows);
int info = 0; blas_int info = 0;
int n_rows = int(tmp.n_rows); blas_int n_rows = blas_int(tmp.n_rows);
int n_cols = int(tmp.n_cols); blas_int n_cols = blas_int(tmp.n_cols);
lapack::getrf_(&n_rows, &n_cols, tmp.memptr(), &n_rows, ipiv.memptr(), &info); lapack::getrf_(&n_rows, &n_cols, tmp.memptr(), &n_rows, ipiv.memptr(), &info);
// on output tmp appears to be L+U_alt, where U_alt is U with the main diagonal set to zero // on output tmp appears to be L+U_alt, where U_alt is U with the main diagonal set to zero
s32 sign = (is_complex<eT>::value == false) ? ( (access::tmp_real( tmp. at(0,0) ) < T(0)) ? -1 : +1 ) : +1; s32 sign = (is_complex<eT>::value == false) ? ( (access::tmp_real( tmp. at(0,0) ) < T(0)) ? -1 : +1 ) : +1;
eT val = (is_complex<eT>::value == false) ? std::log( (access::tmp_re al( tmp.at(0,0) ) < T(0)) ? tmp.at(0,0)*T(-1) : tmp.at(0,0) ) : std::log( t mp.at(0,0) ); eT val = (is_complex<eT>::value == false) ? std::log( (access::tmp_re al( tmp.at(0,0) ) < T(0)) ? tmp.at(0,0)*T(-1) : tmp.at(0,0) ) : std::log( t mp.at(0,0) );
for(u32 i=1; i < tmp.n_rows; ++i) for(u32 i=1; i < tmp.n_rows; ++i)
{ {
const eT x = tmp.at(i,i); const eT x = tmp.at(i,i);
sign *= (is_complex<eT>::value == false) ? ( (access::tmp_real(x) < T (0)) ? -1 : +1 ) : +1; sign *= (is_complex<eT>::value == false) ? ( (access::tmp_real(x) < T (0)) ? -1 : +1 ) : +1;
val += (is_complex<eT>::value == false) ? std::log( (access::tmp_rea l(x) < T(0)) ? x*T(-1) : x ) : std::log(x); val += (is_complex<eT>::value == false) ? std::log( (access::tmp_rea l(x) < T(0)) ? x*T(-1) : x ) : std::log(x);
} }
for(u32 i=0; i < tmp.n_rows; ++i) for(u32 i=0; i < tmp.n_rows; ++i)
{ {
if( int(i) != (ipiv.mem[i] - 1) ) // NOTE: adjustment of -1 is requi red as Fortran counts from 1 if( blas_int(i) != (ipiv.mem[i] - 1) ) // NOTE: adjustment of -1 is required as Fortran counts from 1
{ {
sign *= -1; sign *= -1;
} }
} }
out_val = val; out_val = val;
out_sign = T(sign); out_sign = T(sign);
} }
#else #else
{ {
skipping to change at line 601 skipping to change at line 644
out_val = eT(0); out_val = eT(0);
out_sign = T(0); out_sign = T(0);
} }
#endif #endif
} }
//! immediate LU decomposition of a matrix using ATLAS or LAPACK //! immediate LU decomposition of a matrix using ATLAS or LAPACK
template<typename eT> template<typename eT>
inline inline
void void
auxlib::lu(Mat<eT>& L, Mat<eT>& U, podarray<int>& ipiv, const Mat<eT>& X) auxlib::lu(Mat<eT>& L, Mat<eT>& U, podarray<blas_int>& ipiv, const Mat<eT>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
U = X; U = X;
#if defined(ARMA_USE_ATLAS) || defined(ARMA_USE_LAPACK) #if defined(ARMA_USE_ATLAS) || defined(ARMA_USE_LAPACK)
{ {
#if defined(ARMA_USE_ATLAS) #if defined(ARMA_USE_ATLAS)
{ {
ipiv.set_size(U.n_rows); ipiv.set_size(U.n_rows);
//int info = //int info =
atlas::clapack_getrf(atlas::CblasColMajor, U.n_rows, U.n_cols, U.memp tr(), U.n_rows, ipiv.memptr()); atlas::clapack_getrf(atlas::CblasColMajor, U.n_rows, U.n_cols, U.memp tr(), U.n_rows, ipiv.memptr());
} }
#elif defined(ARMA_USE_LAPACK) #elif defined(ARMA_USE_LAPACK)
{ {
ipiv.set_size(U.n_rows); ipiv.set_size(U.n_rows);
int info = 0; blas_int info = 0;
int n_rows = U.n_rows; blas_int n_rows = U.n_rows;
int n_cols = U.n_cols; blas_int n_cols = U.n_cols;
lapack::getrf_(&n_rows, &n_cols, U.memptr(), &n_rows, ipiv.memptr(), &info); lapack::getrf_(&n_rows, &n_cols, U.memptr(), &n_rows, ipiv.memptr(), &info);
// take into account that Fortran counts from 1 // take into account that Fortran counts from 1
for(u32 i=0; i<U.n_rows; ++i) for(u32 i=0; i<U.n_rows; ++i)
{ {
ipiv[i] -= 1; ipiv[i] -= 1;
} }
} }
skipping to change at line 671 skipping to change at line 714
} }
template<typename eT> template<typename eT>
inline inline
void void
auxlib::lu(Mat<eT>& L, Mat<eT>& U, Mat<eT>& P, const Mat<eT>& X) auxlib::lu(Mat<eT>& L, Mat<eT>& U, Mat<eT>& P, const Mat<eT>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
podarray<int> ipiv; podarray<blas_int> ipiv;
auxlib::lu(L, U, ipiv, X); auxlib::lu(L, U, ipiv, X);
const u32 n = ipiv.n_elem; const u32 n = ipiv.n_elem;
Mat<u32> P_tmp(n,n); Mat<u32> P_tmp(n,n);
Mat<u32> ident = eye< Mat<u32> >(n,n); Mat<u32> ident = eye< Mat<u32> >(n,n);
for(u32 i=n; i>0; --i) for(u32 i=n; i>0; --i)
{ {
const u32 j = i-1; const u32 j = i-1;
skipping to change at line 708 skipping to change at line 751
P = conv_to< Mat<eT> >::from(P_tmp); P = conv_to< Mat<eT> >::from(P_tmp);
} }
template<typename eT> template<typename eT>
inline inline
void void
auxlib::lu(Mat<eT>& L, Mat<eT>& U, const Mat<eT>& X) auxlib::lu(Mat<eT>& L, Mat<eT>& U, const Mat<eT>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
podarray<int> ipiv; podarray<blas_int> ipiv;
auxlib::lu(L, U, ipiv, X); auxlib::lu(L, U, ipiv, X);
} }
//! immediate eigenvalues of a symmetric real matrix using LAPACK //! immediate eigenvalues of a symmetric real matrix using LAPACK
template<typename eT> template<typename eT>
inline inline
void void
auxlib::eig_sym(Col<eT>& eigval, const Mat<eT>& A_orig) auxlib::eig_sym(Col<eT>& eigval, const Mat<eT>& A_orig)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
skipping to change at line 733 skipping to change at line 776
const Mat<eT>& A = tmp.M; const Mat<eT>& A = tmp.M;
arma_debug_check( (A.n_rows != A.n_cols), "eig_sym(): given matrix is n ot square"); arma_debug_check( (A.n_rows != A.n_cols), "eig_sym(): given matrix is n ot square");
// rudimentary "better-than-nothing" test for symmetry // rudimentary "better-than-nothing" test for symmetry
//arma_debug_check( (A.at(A.n_rows-1, 0) != A.at(0, A.n_cols-1)), "auxl ib::eig(): given matrix is not symmetric" ); //arma_debug_check( (A.at(A.n_rows-1, 0) != A.at(0, A.n_cols-1)), "auxl ib::eig(): given matrix is not symmetric" );
char jobz = 'N'; char jobz = 'N';
char uplo = 'U'; char uplo = 'U';
int n_rows = A.n_rows; blas_int n_rows = A.n_rows;
int lwork = (std::max)(1,3*n_rows-1); blas_int lwork = (std::max)(1,3*n_rows-1);
eigval.set_size(n_rows); eigval.set_size(n_rows);
podarray<eT> work(lwork); podarray<eT> work(lwork);
Mat<eT> A_copy = A; Mat<eT> A_copy = A;
int info; blas_int info;
arma_extra_debug_print("lapack::syev_()"); arma_extra_debug_print("lapack::syev_()");
lapack::syev_(&jobz, &uplo, &n_rows, A_copy.memptr(), &n_rows, eigval.m emptr(), work.memptr(), &lwork, &info); lapack::syev_(&jobz, &uplo, &n_rows, A_copy.memptr(), &n_rows, eigval.m emptr(), work.memptr(), &lwork, &info);
} }
#else #else
{ {
arma_stop("eig_sym(): need LAPACK"); arma_stop("eig_sym(): need LAPACK");
} }
#endif #endif
} }
skipping to change at line 769 skipping to change at line 812
typedef typename std::complex<T> eT; typedef typename std::complex<T> eT;
#if defined(ARMA_USE_LAPACK) #if defined(ARMA_USE_LAPACK)
{ {
arma_debug_check( (A.n_rows != A.n_cols), "eig_sym(): given matrix is n ot hermitian"); arma_debug_check( (A.n_rows != A.n_cols), "eig_sym(): given matrix is n ot hermitian");
char jobz = 'N'; char jobz = 'N';
char uplo = 'U'; char uplo = 'U';
int n_rows = A.n_rows; blas_int n_rows = A.n_rows;
int lda = A.n_rows; blas_int lda = A.n_rows;
int lwork = (std::max)(1, 2*n_rows - 1); // TODO: automatically find blas_int lwork = (std::max)(1, 2*n_rows - 1); // TODO: automatically
best size of lwork find best size of lwork
eigval.set_size(n_rows); eigval.set_size(n_rows);
podarray<eT> work(lwork); podarray<eT> work(lwork);
podarray<T> rwork( (std::max)(1, 3*n_rows - 2) ); podarray<T> rwork( (std::max)(1, 3*n_rows - 2) );
Mat<eT> A_copy = A; Mat<eT> A_copy = A;
int info; blas_int info;
arma_extra_debug_print("lapack::heev_()"); arma_extra_debug_print("lapack::heev_()");
lapack::heev_(&jobz, &uplo, &n_rows, A_copy.memptr(), &lda, eigval.memp tr(), work.memptr(), &lwork, rwork.memptr(), &info); lapack::heev_(&jobz, &uplo, &n_rows, A_copy.memptr(), &lda, eigval.memp tr(), work.memptr(), &lwork, rwork.memptr(), &info);
} }
#else #else
{ {
arma_stop("eig_sym(): need LAPACK"); arma_stop("eig_sym(): need LAPACK");
} }
#endif #endif
} }
skipping to change at line 817 skipping to change at line 860
const Mat<eT>& A = tmp2.M; const Mat<eT>& A = tmp2.M;
arma_debug_check( (A.n_rows != A.n_cols), "eig_sym(): given matrix is n ot square" ); arma_debug_check( (A.n_rows != A.n_cols), "eig_sym(): given matrix is n ot square" );
// rudimentary "better-than-nothing" test for symmetry // rudimentary "better-than-nothing" test for symmetry
//arma_debug_check( (A.at(A.n_rows-1, 0) != A.at(0, A.n_cols-1)), "auxl ib::eig(): given matrix is not symmetric" ); //arma_debug_check( (A.at(A.n_rows-1, 0) != A.at(0, A.n_cols-1)), "auxl ib::eig(): given matrix is not symmetric" );
char jobz = 'V'; char jobz = 'V';
char uplo = 'U'; char uplo = 'U';
int n_rows = A.n_rows; blas_int n_rows = A.n_rows;
int lwork = (std::max)(1, 3*n_rows-1); blas_int lwork = (std::max)(1, 3*n_rows-1);
eigval.set_size(n_rows); eigval.set_size(n_rows);
podarray<eT> work(lwork); podarray<eT> work(lwork);
eigvec = A; eigvec = A;
int info; blas_int info;
arma_extra_debug_print("lapack::syev_()"); arma_extra_debug_print("lapack::syev_()");
lapack::syev_(&jobz, &uplo, &n_rows, eigvec.memptr(), &n_rows, eigval.m emptr(), work.memptr(), &lwork, &info); lapack::syev_(&jobz, &uplo, &n_rows, eigvec.memptr(), &n_rows, eigval.m emptr(), work.memptr(), &lwork, &info);
} }
#else #else
{ {
arma_stop("eig_sym(): need LAPACK"); arma_stop("eig_sym(): need LAPACK");
} }
#endif #endif
skipping to change at line 857 skipping to change at line 900
#if defined(ARMA_USE_LAPACK) #if defined(ARMA_USE_LAPACK)
{ {
const unwrap_check< Mat<eT> > tmp(A_orig, eigvec); const unwrap_check< Mat<eT> > tmp(A_orig, eigvec);
const Mat<eT>& A = tmp.M; const Mat<eT>& A = tmp.M;
arma_debug_check( (A.n_rows != A.n_cols), "eig_sym(): given matrix is n ot hermitian" ); arma_debug_check( (A.n_rows != A.n_cols), "eig_sym(): given matrix is n ot hermitian" );
char jobz = 'V'; char jobz = 'V';
char uplo = 'U'; char uplo = 'U';
int n_rows = A.n_rows; blas_int n_rows = A.n_rows;
int lda = A.n_rows; blas_int lda = A.n_rows;
int lwork = (std::max)(1, 2*n_rows - 1); // TODO: automatically find blas_int lwork = (std::max)(1, 2*n_rows - 1); // TODO: automatically
best size of lwork find best size of lwork
eigval.set_size(n_rows); eigval.set_size(n_rows);
podarray<eT> work(lwork); podarray<eT> work(lwork);
podarray<T> rwork( (std::max)(1, 3*n_rows - 2) ); podarray<T> rwork( (std::max)(1, 3*n_rows - 2) );
eigvec = A; eigvec = A;
int info; blas_int info;
arma_extra_debug_print("lapack::heev_()"); arma_extra_debug_print("lapack::heev_()");
lapack::heev_(&jobz, &uplo, &n_rows, eigvec.memptr(), &lda, eigval.memp tr(), work.memptr(), &lwork, rwork.memptr(), &info); lapack::heev_(&jobz, &uplo, &n_rows, eigvec.memptr(), &lda, eigval.memp tr(), work.memptr(), &lwork, rwork.memptr(), &info);
} }
#else #else
{ {
arma_stop("eig_sym(): need LAPACK"); arma_stop("eig_sym(): need LAPACK");
} }
#endif #endif
skipping to change at line 932 skipping to change at line 975
case 'n': // neither case 'n': // neither
jobvl = 'N'; jobvl = 'N';
jobvr = 'N'; jobvr = 'N';
break; break;
default: default:
arma_stop("eig_gen(): parameter 'side' is invalid"); arma_stop("eig_gen(): parameter 'side' is invalid");
} }
int n_rows = A.n_rows; blas_int n_rows = A.n_rows;
int lda = A.n_rows; blas_int lda = A.n_rows;
int lwork = (std::max)(1, 4*n_rows); // TODO: automatically find best blas_int lwork = (std::max)(1, 4*n_rows); // TODO: automatically find
size of lwork best size of lwork
eigval.set_size(n_rows); eigval.set_size(n_rows);
l_eigvec.set_size(n_rows, n_rows); l_eigvec.set_size(n_rows, n_rows);
r_eigvec.set_size(n_rows, n_rows); r_eigvec.set_size(n_rows, n_rows);
podarray<T> work(lwork); podarray<T> work(lwork);
podarray<T> rwork( (std::max)(1, 3*n_rows) ); podarray<T> rwork( (std::max)(1, 3*n_rows) );
podarray<T> wr(n_rows); podarray<T> wr(n_rows);
podarray<T> wi(n_rows); podarray<T> wi(n_rows);
Mat<T> A_copy = A; Mat<T> A_copy = A;
int info; blas_int info;
arma_extra_debug_print("lapack::cx_geev_()"); arma_extra_debug_print("lapack::cx_geev_()");
lapack::geev_(&jobvl, &jobvr, &n_rows, A_copy.memptr(), &lda, wr.memptr (), wi.memptr(), l_eigvec.memptr(), &n_rows, r_eigvec.memptr(), &n_rows, wo rk.memptr(), &lwork, &info); lapack::geev_(&jobvl, &jobvr, &n_rows, A_copy.memptr(), &lda, wr.memptr (), wi.memptr(), l_eigvec.memptr(), &n_rows, r_eigvec.memptr(), &n_rows, wo rk.memptr(), &lwork, &info);
eigval.set_size(n_rows); eigval.set_size(n_rows);
for(u32 i=0; i<u32(n_rows); ++i) for(u32 i=0; i<u32(n_rows); ++i)
{ {
eigval[i] = std::complex<T>(wr[i], wi[i]); eigval[i] = std::complex<T>(wr[i], wi[i]);
} }
skipping to change at line 1021 skipping to change at line 1064
case 'n': // neither case 'n': // neither
jobvl = 'N'; jobvl = 'N';
jobvr = 'N'; jobvr = 'N';
break; break;
default: default:
arma_stop("eig_gen(): parameter 'side' is invalid"); arma_stop("eig_gen(): parameter 'side' is invalid");
} }
int n_rows = A.n_rows; blas_int n_rows = A.n_rows;
int lda = A.n_rows; blas_int lda = A.n_rows;
int lwork = (std::max)(1, 4*n_rows); // TODO: automatically find best blas_int lwork = (std::max)(1, 4*n_rows); // TODO: automatically find
size of lwork best size of lwork
eigval.set_size(n_rows); eigval.set_size(n_rows);
l_eigvec.set_size(n_rows, n_rows); l_eigvec.set_size(n_rows, n_rows);
r_eigvec.set_size(n_rows, n_rows); r_eigvec.set_size(n_rows, n_rows);
podarray<eT> work(lwork); podarray<eT> work(lwork);
podarray<T> rwork( (std::max)(1, 3*n_rows) ); // was 2,3 podarray<T> rwork( (std::max)(1, 3*n_rows) ); // was 2,3
Mat<eT> A_copy = A; Mat<eT> A_copy = A;
int info; blas_int info;
arma_extra_debug_print("lapack::cx_geev_()"); arma_extra_debug_print("lapack::cx_geev_()");
lapack::cx_geev_(&jobvl, &jobvr, &n_rows, A_copy.memptr(), &lda, eigval .memptr(), l_eigvec.memptr(), &n_rows, r_eigvec.memptr(), &n_rows, work.mem ptr(), &lwork, rwork.memptr(), &info); lapack::cx_geev_(&jobvl, &jobvr, &n_rows, A_copy.memptr(), &lda, eigval .memptr(), l_eigvec.memptr(), &n_rows, r_eigvec.memptr(), &n_rows, work.mem ptr(), &lwork, rwork.memptr(), &info);
} }
#else #else
{ {
arma_stop("eig_gen(): need LAPACK"); arma_stop("eig_gen(): need LAPACK");
} }
#endif #endif
skipping to change at line 1055 skipping to change at line 1098
template<typename eT> template<typename eT>
inline inline
bool bool
auxlib::chol(Mat<eT>& out, const Mat<eT>& X) auxlib::chol(Mat<eT>& out, const Mat<eT>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
#if defined(ARMA_USE_LAPACK) #if defined(ARMA_USE_LAPACK)
{ {
char uplo = 'U'; char uplo = 'U';
int n = X.n_rows; blas_int n = X.n_rows;
int lda = X.n_rows; blas_int lda = X.n_rows;
int info; blas_int info;
out = X; out = X;
lapack::potrf_(&uplo, &n, out.memptr(), &lda, &info); lapack::potrf_(&uplo, &n, out.memptr(), &lda, &info);
for(u32 col=0; col<X.n_rows; ++col) for(u32 col=0; col<X.n_rows; ++col)
{ {
eT* colptr = out.colptr(col); eT* colptr = out.colptr(col);
for(u32 row=col+1; row<X.n_rows; ++row) for(u32 row=col+1; row<X.n_rows; ++row)
{ {
colptr[row] = eT(0); colptr[row] = eT(0);
skipping to change at line 1091 skipping to change at line 1134
template<typename eT> template<typename eT>
inline inline
bool bool
auxlib::qr(Mat<eT>& Q, Mat<eT>& R, const Mat<eT>& X) auxlib::qr(Mat<eT>& Q, Mat<eT>& R, const Mat<eT>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
#if defined(ARMA_USE_LAPACK) #if defined(ARMA_USE_LAPACK)
{ {
int m = static_cast<int>(X.n_rows); blas_int m = static_cast<blas_int>(X.n_rows);
int n = static_cast<int>(X.n_cols); blas_int n = static_cast<blas_int>(X.n_cols);
int work_len = (std::max)(1,n); blas_int work_len = (std::max)(1,n);
int work_len_tmp; blas_int work_len_tmp;
int k = (std::min)(m,n); blas_int k = (std::min)(m,n);
int info; blas_int info;
podarray<eT> tau(k); podarray<eT> tau(k);
podarray<eT> work(work_len); podarray<eT> work(work_len);
R = X; R = X;
// query for the optimum value of work_len // query for the optimum value of work_len
work_len_tmp = -1; work_len_tmp = -1;
lapack::geqrf_(&m, &n, R.memptr(), &m, tau.memptr(), work.memptr(), &wo rk_len_tmp, &info); lapack::geqrf_(&m, &n, R.memptr(), &m, tau.memptr(), work.memptr(), &wo rk_len_tmp, &info);
if(info == 0) if(info == 0)
{ {
work_len = static_cast<int>(access::tmp_real(work[0])); work_len = static_cast<blas_int>(access::tmp_real(work[0]));
work.set_size(work_len); work.set_size(work_len);
} }
lapack::geqrf_(&m, &n, R.memptr(), &m, tau.memptr(), work.memptr(), &wo rk_len, &info); lapack::geqrf_(&m, &n, R.memptr(), &m, tau.memptr(), work.memptr(), &wo rk_len, &info);
Q.set_size(X.n_rows, X.n_rows); Q.set_size(X.n_rows, X.n_rows);
eT* Q_mem = Q.memptr(); eT* Q_mem = Q.memptr();
const eT* R_mem = R.mem; const eT* R_mem = R.mem;
skipping to change at line 1144 skipping to change at line 1187
} }
if( (is_float<eT>::value == true) || (is_double<eT>::value == true) ) if( (is_float<eT>::value == true) || (is_double<eT>::value == true) )
{ {
// query for the optimum value of work_len // query for the optimum value of work_len
work_len_tmp = -1; work_len_tmp = -1;
lapack::orgqr_(&m, &m, &k, Q.memptr(), &m, tau.memptr(), work.memptr( ), &work_len_tmp, &info); lapack::orgqr_(&m, &m, &k, Q.memptr(), &m, tau.memptr(), work.memptr( ), &work_len_tmp, &info);
if(info == 0) if(info == 0)
{ {
work_len = static_cast<int>(access::tmp_real(work[0])); work_len = static_cast<blas_int>(access::tmp_real(work[0]));
work.set_size(work_len); work.set_size(work_len);
} }
lapack::orgqr_(&m, &m, &k, Q.memptr(), &m, tau.memptr(), work.memptr( ), &work_len, &info); lapack::orgqr_(&m, &m, &k, Q.memptr(), &m, tau.memptr(), work.memptr( ), &work_len, &info);
} }
else else
if( (is_supported_complex_float<eT>::value == true) || (is_supported_co mplex_double<eT>::value == true) ) if( (is_supported_complex_float<eT>::value == true) || (is_supported_co mplex_double<eT>::value == true) )
{ {
// query for the optimum value of work_len // query for the optimum value of work_len
work_len_tmp = -1; work_len_tmp = -1;
lapack::ungqr_(&m, &m, &k, Q.memptr(), &m, tau.memptr(), work.memptr( ), &work_len_tmp, &info); lapack::ungqr_(&m, &m, &k, Q.memptr(), &m, tau.memptr(), work.memptr( ), &work_len_tmp, &info);
if(info == 0) if(info == 0)
{ {
work_len = static_cast<int>(access::tmp_real(work[0])); work_len = static_cast<blas_int>(access::tmp_real(work[0]));
work.set_size(work_len); work.set_size(work_len);
} }
lapack::ungqr_(&m, &m, &k, Q.memptr(), &m, tau.memptr(), work.memptr( ), &work_len, &info); lapack::ungqr_(&m, &m, &k, Q.memptr(), &m, tau.memptr(), work.memptr( ), &work_len, &info);
} }
return (info == 0); return (info == 0);
} }
#else #else
{ {
skipping to change at line 1193 skipping to change at line 1236
#if defined(ARMA_USE_LAPACK) #if defined(ARMA_USE_LAPACK)
{ {
Mat<eT> A = X; Mat<eT> A = X;
Mat<eT> U(1, 1); Mat<eT> U(1, 1);
Mat<eT> V(1, A.n_cols); Mat<eT> V(1, A.n_cols);
char jobu = 'N'; char jobu = 'N';
char jobvt = 'N'; char jobvt = 'N';
int m = A.n_rows; blas_int m = A.n_rows;
int n = A.n_cols; blas_int n = A.n_cols;
int lda = A.n_rows; blas_int lda = A.n_rows;
int ldu = U.n_rows; blas_int ldu = U.n_rows;
int ldvt = V.n_rows; blas_int ldvt = V.n_rows;
int lwork = 2 * (std::max)(1, (std::max)( (3*(std::min)(m,n) + (std::m blas_int lwork = 2 * (std::max)(1, (std::max)( (3*(std::min)(m,n) + (s
ax)(m,n)), 5*(std::min)(m,n) ) ); td::max)(m,n)), 5*(std::min)(m,n) ) );
int info; blas_int info;
S.set_size( (std::min)(m, n) ); S.set_size( (std::min)(m, n) );
podarray<eT> work(lwork); podarray<eT> work(lwork);
// let gesvd_() calculate the optimum size of the workspace // let gesvd_() calculate the optimum size of the workspace
int lwork_tmp = -1; blas_int lwork_tmp = -1;
lapack::gesvd_<eT> lapack::gesvd_<eT>
( (
&jobu, &jobvt, &jobu, &jobvt,
&m,&n, &m,&n,
A.memptr(), &lda, A.memptr(), &lda,
S.memptr(), S.memptr(),
U.memptr(), &ldu, U.memptr(), &ldu,
V.memptr(), &ldvt, V.memptr(), &ldvt,
work.memptr(), &lwork_tmp, work.memptr(), &lwork_tmp,
&info &info
); );
if(info == 0) if(info == 0)
{ {
int proposed_lwork = static_cast<int>(work[0]); blas_int proposed_lwork = static_cast<blas_int>(work[0]);
if(proposed_lwork > lwork) if(proposed_lwork > lwork)
{ {
lwork = proposed_lwork; lwork = proposed_lwork;
work.set_size(lwork); work.set_size(lwork);
} }
lapack::gesvd_<eT> lapack::gesvd_<eT>
( (
&jobu, &jobvt, &jobu, &jobvt,
skipping to change at line 1272 skipping to change at line 1315
#if defined(ARMA_USE_LAPACK) #if defined(ARMA_USE_LAPACK)
{ {
Mat<eT> A = X; Mat<eT> A = X;
Mat<eT> U(1, 1); Mat<eT> U(1, 1);
Mat<eT> V(1, A.n_cols); Mat<eT> V(1, A.n_cols);
char jobu = 'N'; char jobu = 'N';
char jobvt = 'N'; char jobvt = 'N';
int m = A.n_rows; blas_int m = A.n_rows;
int n = A.n_cols; blas_int n = A.n_cols;
int lda = A.n_rows; blas_int lda = A.n_rows;
int ldu = U.n_rows; blas_int ldu = U.n_rows;
int ldvt = V.n_rows; blas_int ldvt = V.n_rows;
int lwork = 2 * (std::max)(1, 2*(std::min)(m,n)+(std::max)(m,n) ); blas_int lwork = 2 * (std::max)(1, 2*(std::min)(m,n)+(std::max)(m,n) )
int info; ;
blas_int info;
S.set_size( (std::min)(m,n) ); S.set_size( (std::min)(m,n) );
podarray<eT> work(lwork); podarray<eT> work(lwork);
podarray<T> rwork( 5*(std::min)(m,n) ); podarray<T> rwork( 5*(std::min)(m,n) );
// let gesvd_() calculate the optimum size of the workspace // let gesvd_() calculate the optimum size of the workspace
int lwork_tmp = -1; blas_int lwork_tmp = -1;
lapack::cx_gesvd_<T> lapack::cx_gesvd_<T>
( (
&jobu, &jobvt, &jobu, &jobvt,
&m, &n, &m, &n,
A.memptr(), &lda, A.memptr(), &lda,
S.memptr(), S.memptr(),
U.memptr(), &ldu, U.memptr(), &ldu,
V.memptr(), &ldvt, V.memptr(), &ldvt,
work.memptr(), &lwork_tmp, work.memptr(), &lwork_tmp,
rwork.memptr(), rwork.memptr(),
&info &info
); );
if(info == 0) if(info == 0)
{ {
int proposed_lwork = static_cast<int>(real(work[0])); blas_int proposed_lwork = static_cast<blas_int>(real(work[0]));
if(proposed_lwork > lwork) if(proposed_lwork > lwork)
{ {
lwork = proposed_lwork; lwork = proposed_lwork;
work.set_size(lwork); work.set_size(lwork);
} }
lapack::cx_gesvd_<T> lapack::cx_gesvd_<T>
( (
&jobu, &jobvt, &jobu, &jobvt,
&m, &n, &m, &n,
skipping to change at line 1351 skipping to change at line 1394
#if defined(ARMA_USE_LAPACK) #if defined(ARMA_USE_LAPACK)
{ {
Mat<eT> A = X; Mat<eT> A = X;
U.set_size(A.n_rows, A.n_rows); U.set_size(A.n_rows, A.n_rows);
V.set_size(A.n_cols, A.n_cols); V.set_size(A.n_cols, A.n_cols);
char jobu = 'A'; char jobu = 'A';
char jobvt = 'A'; char jobvt = 'A';
int m = A.n_rows; blas_int m = A.n_rows;
int n = A.n_cols; blas_int n = A.n_cols;
int lda = A.n_rows; blas_int lda = A.n_rows;
int ldu = U.n_rows; blas_int ldu = U.n_rows;
int ldvt = V.n_rows; blas_int ldvt = V.n_rows;
int lwork = 2 * (std::max)(1, (std::max)( (3*(std::min)(m,n) + (std::m blas_int lwork = 2 * (std::max)(1, (std::max)( (3*(std::min)(m,n) + (s
ax)(m,n)), 5*(std::min)(m,n) ) ); td::max)(m,n)), 5*(std::min)(m,n) ) );
int info; blas_int info;
S.set_size( (std::min)(m,n) ); S.set_size( (std::min)(m,n) );
podarray<eT> work(lwork); podarray<eT> work(lwork);
// let gesvd_() calculate the optimum size of the workspace // let gesvd_() calculate the optimum size of the workspace
int lwork_tmp = -1; blas_int lwork_tmp = -1;
lapack::gesvd_<eT> lapack::gesvd_<eT>
( (
&jobu, &jobvt, &jobu, &jobvt,
&m, &n, &m, &n,
A.memptr(), &lda, A.memptr(), &lda,
S.memptr(), S.memptr(),
U.memptr(), &ldu, U.memptr(), &ldu,
V.memptr(), &ldvt, V.memptr(), &ldvt,
work.memptr(), &lwork_tmp, work.memptr(), &lwork_tmp,
&info &info
); );
if(info == 0) if(info == 0)
{ {
int proposed_lwork = static_cast<int>(work[0]); blas_int proposed_lwork = static_cast<blas_int>(work[0]);
if(proposed_lwork > lwork) if(proposed_lwork > lwork)
{ {
lwork = proposed_lwork; lwork = proposed_lwork;
work.set_size(lwork); work.set_size(lwork);
} }
lapack::gesvd_<eT> lapack::gesvd_<eT>
( (
&jobu, &jobvt, &jobu, &jobvt,
&m, &n, &m, &n,
skipping to change at line 1430 skipping to change at line 1473
#if defined(ARMA_USE_LAPACK) #if defined(ARMA_USE_LAPACK)
{ {
Mat<eT> A = X; Mat<eT> A = X;
U.set_size(A.n_rows, A.n_rows); U.set_size(A.n_rows, A.n_rows);
V.set_size(A.n_cols, A.n_cols); V.set_size(A.n_cols, A.n_cols);
char jobu = 'A'; char jobu = 'A';
char jobvt = 'A'; char jobvt = 'A';
int m = A.n_rows; blas_int m = A.n_rows;
int n = A.n_cols; blas_int n = A.n_cols;
int lda = A.n_rows; blas_int lda = A.n_rows;
int ldu = U.n_rows; blas_int ldu = U.n_rows;
int ldvt = V.n_rows; blas_int ldvt = V.n_rows;
int lwork = 2 * (std::max)(1, 2*(std::min)(m,n)+(std::max)(m,n) ); blas_int lwork = 2 * (std::max)(1, 2*(std::min)(m,n)+(std::max)(m,n) )
int info; ;
blas_int info;
S.set_size( (std::min)(m,n) ); S.set_size( (std::min)(m,n) );
podarray<eT> work(lwork); podarray<eT> work(lwork);
podarray<T> rwork( 5*(std::min)(m,n) ); podarray<T> rwork( 5*(std::min)(m,n) );
// let gesvd_() calculate the optimum size of the workspace // let gesvd_() calculate the optimum size of the workspace
int lwork_tmp = -1; blas_int lwork_tmp = -1;
lapack::cx_gesvd_<T> lapack::cx_gesvd_<T>
( (
&jobu, &jobvt, &jobu, &jobvt,
&m, &n, &m, &n,
A.memptr(), &lda, A.memptr(), &lda,
S.memptr(), S.memptr(),
U.memptr(), &ldu, U.memptr(), &ldu,
V.memptr(), &ldvt, V.memptr(), &ldvt,
work.memptr(), &lwork_tmp, work.memptr(), &lwork_tmp,
rwork.memptr(), rwork.memptr(),
&info &info
); );
if(info == 0) if(info == 0)
{ {
int proposed_lwork = static_cast<int>(real(work[0])); blas_int proposed_lwork = static_cast<blas_int>(real(work[0]));
if(proposed_lwork > lwork) if(proposed_lwork > lwork)
{ {
lwork = proposed_lwork; lwork = proposed_lwork;
work.set_size(lwork); work.set_size(lwork);
} }
lapack::cx_gesvd_<T> lapack::cx_gesvd_<T>
( (
&jobu, &jobvt, &jobu, &jobvt,
&m, &n, &m, &n,
skipping to change at line 1506 skipping to change at line 1549
//! and B.n_rows = A.n_rows //! and B.n_rows = A.n_rows
template<typename eT> template<typename eT>
inline inline
bool bool
auxlib::solve(Mat<eT>& out, const Mat<eT>& A, const Mat<eT>& B) auxlib::solve(Mat<eT>& out, const Mat<eT>& A, const Mat<eT>& B)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
#if defined(ARMA_USE_LAPACK) #if defined(ARMA_USE_LAPACK)
{ {
int n = A.n_rows; blas_int n = A.n_rows;
int lda = A.n_rows; blas_int lda = A.n_rows;
int ldb = A.n_rows; blas_int ldb = A.n_rows;
int nrhs = B.n_cols; blas_int nrhs = B.n_cols;
int info; blas_int info;
podarray<int> ipiv(n); podarray<blas_int> ipiv(n);
out = B; out = B;
Mat<eT> A_copy = A; Mat<eT> A_copy = A;
lapack::gesv_<eT>(&n, &nrhs, A_copy.memptr(), &lda, ipiv.memptr(), out. memptr(), &ldb, &info); lapack::gesv_<eT>(&n, &nrhs, A_copy.memptr(), &lda, ipiv.memptr(), out. memptr(), &ldb, &info);
return (info == 0); return (info == 0);
} }
#else #else
{ {
skipping to change at line 1543 skipping to change at line 1586
inline inline
bool bool
auxlib::solve_od(Mat<eT>& out, const Mat<eT>& A, const Mat<eT>& B) auxlib::solve_od(Mat<eT>& out, const Mat<eT>& A, const Mat<eT>& B)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
#if defined(ARMA_USE_LAPACK) #if defined(ARMA_USE_LAPACK)
{ {
char trans = 'N'; char trans = 'N';
int m = A.n_rows; blas_int m = A.n_rows;
int n = A.n_cols; blas_int n = A.n_cols;
int lda = A.n_rows; blas_int lda = A.n_rows;
int ldb = A.n_rows; blas_int ldb = A.n_rows;
int nrhs = B.n_cols; blas_int nrhs = B.n_cols;
int lwork = n + (std::max)(n, nrhs); blas_int lwork = n + (std::max)(n, nrhs);
int info; blas_int info;
Mat<eT> A_copy = A; Mat<eT> A_copy = A;
Mat<eT> tmp = B; Mat<eT> tmp = B;
podarray<eT> work(lwork); podarray<eT> work(lwork);
arma_extra_debug_print("lapack::gels_()"); arma_extra_debug_print("lapack::gels_()");
// NOTE: // NOTE:
// the dgels() function in the lapack library supplied by ATLAS 3.6 // the dgels() function in the lapack library supplied by ATLAS 3.6
skipping to change at line 1604 skipping to change at line 1647
inline inline
bool bool
auxlib::solve_ud(Mat<eT>& out, const Mat<eT>& A, const Mat<eT>& B) auxlib::solve_ud(Mat<eT>& out, const Mat<eT>& A, const Mat<eT>& B)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
#if defined(ARMA_USE_LAPACK) #if defined(ARMA_USE_LAPACK)
{ {
char trans = 'N'; char trans = 'N';
int m = A.n_rows; blas_int m = A.n_rows;
int n = A.n_cols; blas_int n = A.n_cols;
int lda = A.n_rows; blas_int lda = A.n_rows;
int ldb = A.n_cols; blas_int ldb = A.n_cols;
int nrhs = B.n_cols; blas_int nrhs = B.n_cols;
int lwork = m + (std::max)(m,nrhs); blas_int lwork = m + (std::max)(m,nrhs);
int info; blas_int info;
Mat<eT> A_copy = A; Mat<eT> A_copy = A;
Mat<eT> tmp; Mat<eT> tmp;
tmp.zeros(A.n_cols, B.n_cols); tmp.zeros(A.n_cols, B.n_cols);
for(u32 col=0; col<B.n_cols; ++col) for(u32 col=0; col<B.n_cols; ++col)
{ {
eT* tmp_colmem = tmp.colptr(col); eT* tmp_colmem = tmp.colptr(col);
 End of changes. 112 change blocks. 
462 lines changed or deleted 515 lines changed or added


 auxlib_proto.hpp   auxlib_proto.hpp 
skipping to change at line 29 skipping to change at line 29
//! wrapper for accessing external functions defined in ATLAS, LAPACK or BL AS libraries //! wrapper for accessing external functions defined in ATLAS, LAPACK or BL AS libraries
class auxlib class auxlib
{ {
public: public:
// //
// inv // inv
template<typename eT> template<typename eT>
inline static bool inv_noalias(Mat<eT>& out, const Mat<eT>& X); inline static bool inv(Mat<eT>& out, const Mat<eT>& X);
template<typename eT> template<typename eT>
inline static bool inv_inplace(Mat<eT>& X); inline static bool inv_noalias_tinymat(Mat<eT>& out, const Mat<eT>& X, co
nst u32 N);
template<typename eT>
inline static bool inv_inplace_tinymat(Mat<eT>& X, const u32 N);
template<typename eT>
inline static bool inv_lapack(Mat<eT>& out, const Mat<eT>& X);
// //
// det // det
template<typename eT> template<typename eT>
inline static eT det(const Mat<eT>& X); inline static eT det(const Mat<eT>& X);
template<typename eT> template<typename eT>
inline static eT det_tinymat(const Mat<eT>& X, const u32 N);
template<typename eT>
inline static eT det_lapack(const Mat<eT>& X);
//
// log_det
template<typename eT>
inline static void log_det(eT& out_val, typename get_pod_type<eT>::result & out_sign, const Mat<eT>& X); inline static void log_det(eT& out_val, typename get_pod_type<eT>::result & out_sign, const Mat<eT>& X);
// //
// lu // lu
template<typename eT> template<typename eT>
inline static void lu(Mat<eT>& L, Mat<eT>& U, podarray<int>& ipiv, const Mat<eT>& X_orig); inline static void lu(Mat<eT>& L, Mat<eT>& U, podarray<int>& ipiv, const Mat<eT>& X_orig);
template<typename eT> template<typename eT>
inline static void lu(Mat<eT>& L, Mat<eT>& U, Mat<eT>& P, const Mat<eT>& X); inline static void lu(Mat<eT>& L, Mat<eT>& U, Mat<eT>& P, const Mat<eT>& X);
skipping to change at line 103 skipping to change at line 118
template<typename T> template<typename T>
inline static bool svd(Col<T>& S, const Mat< std::complex<T> >& X); inline static bool svd(Col<T>& S, const Mat< std::complex<T> >& X);
template<typename eT> template<typename eT>
inline static bool svd(Mat<eT>& U, Col<eT>& S, Mat<eT>& V, const Mat<eT>& X); inline static bool svd(Mat<eT>& U, Col<eT>& S, Mat<eT>& V, const Mat<eT>& X);
template<typename T> template<typename T>
inline static bool svd(Mat< std::complex<T> >& U, Col<T>& S, Mat< std::co mplex<T> >& V, const Mat< std::complex<T> >& X); inline static bool svd(Mat< std::complex<T> >& U, Col<T>& S, Mat< std::co mplex<T> >& V, const Mat< std::complex<T> >& X);
//
// solve // solve
template<typename eT> template<typename eT>
inline static bool solve(Mat<eT>& out, const Mat<eT>& A, const Mat<eT>& B ); inline static bool solve(Mat<eT>& out, const Mat<eT>& A, const Mat<eT>& B );
template<typename eT> template<typename eT>
inline static bool solve_od(Mat<eT>& out, const Mat<eT>& A, const Mat<eT> & B); inline static bool solve_od(Mat<eT>& out, const Mat<eT>& A, const Mat<eT> & B);
template<typename eT> template<typename eT>
inline static bool solve_ud(Mat<eT>& out, const Mat<eT>& A, const Mat<eT> & B); inline static bool solve_ud(Mat<eT>& out, const Mat<eT>& A, const Mat<eT> & B);
 End of changes. 4 change blocks. 
2 lines changed or deleted 19 lines changed or added


 blas_proto.hpp   blas_proto.hpp 
skipping to change at line 23 skipping to change at line 23
// 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)
#ifdef ARMA_USE_BLAS #ifdef ARMA_USE_BLAS
//! \namespace blas namespace for BLAS functions //! \namespace blas namespace for BLAS functions
namespace blas namespace blas
{ {
extern "C" extern "C"
{ {
float sdot_(const int* n, const float* x, const int* incx, const floa float sdot_(const blas_int* n, const float* x, const blas_int* incx,
t* y, const int* incy); const float* y, const blas_int* incy);
double ddot_(const int* n, const double* x, const int* incx, const doub double ddot_(const blas_int* n, const double* x, const blas_int* incx,
le* y, const int* incy); const double* y, const blas_int* incy);
void sgemv_(const char* transA, const int* m, const int* n, const float void sgemv_(const char* transA, const blas_int* m, const blas_int* n, c
* alpha, const float* A, const int* ldA, const float* x, const int* incx onst float* alpha, const float* A, const blas_int* ldA, const float* x,
, const float* beta, float* y, const int* incy); const blas_int* incx, const float* beta, float* y, const blas_int* incy);
void dgemv_(const char* transA, const int* m, const int* n, const doubl void dgemv_(const char* transA, const blas_int* m, const blas_int* n, c
e* alpha, const double* A, const int* ldA, const double* x, const int* incx onst double* alpha, const double* A, const blas_int* ldA, const double* x,
, const double* beta, double* y, const int* incy); const blas_int* incx, const double* beta, double* y, const blas_int* incy);
void cgemv_(const char* transA, const int* m, const int* n, const void* void cgemv_(const char* transA, const blas_int* m, const blas_int* n, c
alpha, const void* A, const int* ldA, const void* x, const int* incx onst void* alpha, const void* A, const blas_int* ldA, const void* x,
, const void* beta, void* y, const int* incy); const blas_int* incx, const void* beta, void* y, const blas_int* incy);
void zgemv_(const char* transA, const int* m, const int* n, const void* void zgemv_(const char* transA, const blas_int* m, const blas_int* n, c
alpha, const void* A, const int* ldA, const void* x, const int* incx onst void* alpha, const void* A, const blas_int* ldA, const void* x,
, const void* beta, void* y, const int* incy); const blas_int* incx, const void* beta, void* y, const blas_int* incy);
void sgemm_(const char* transA, const char* transB, const int* m, const void sgemm_(const char* transA, const char* transB, const blas_int* m,
int* n, const int* k, const float* alpha, const float* A, const int* ldA const blas_int* n, const blas_int* k, const float* alpha, const float* A,
, const float* B, const int* ldB, const float* beta, float* C, const int const blas_int* ldA, const float* B, const blas_int* ldB, const float* b
* ldC); eta, float* C, const blas_int* ldC);
void dgemm_(const char* transA, const char* transB, const int* m, const void dgemm_(const char* transA, const char* transB, const blas_int* m,
int* n, const int* k, const double* alpha, const double* A, const int* ldA const blas_int* n, const blas_int* k, const double* alpha, const double* A,
, const double* B, const int* ldB, const double* beta, double* C, const int const blas_int* ldA, const double* B, const blas_int* ldB, const double* b
* ldC); eta, double* C, const blas_int* ldC);
void cgemm_(const char* transA, const char* transB, const int* m, const void cgemm_(const char* transA, const char* transB, const blas_int* m,
int* n, const int* k, const void* alpha, const void* A, const int* ldA const blas_int* n, const blas_int* k, const void* alpha, const void* A,
, const void* B, const int* ldB, const void* beta, void* C, const int const blas_int* ldA, const void* B, const blas_int* ldB, const void* b
* ldC); eta, void* C, const blas_int* ldC);
void zgemm_(const char* transA, const char* transB, const int* m, const void zgemm_(const char* transA, const char* transB, const blas_int* m,
int* n, const int* k, const void* alpha, const void* A, const int* ldA const blas_int* n, const blas_int* k, const void* alpha, const void* A,
, const void* B, const int* ldB, const void* beta, void* C, const int const blas_int* ldA, const void* B, const blas_int* ldB, const void* b
* ldC); eta, void* C, const blas_int* ldC);
// void dswap_(const int* n, double* x, const int* incx, double* y, c // void dswap_(const blas_int* n, double* x, const blas_int* incx, do
onst int* incy); uble* y, const blas_int* incy);
// void dscal_(const int* n, const double* alpha, double* x, const in // void dscal_(const blas_int* n, const double* alpha, double* x, con
t* incx); st blas_int* incx);
// void dcopy_(const int* n, const double* x, const int* incx, double // void dcopy_(const blas_int* n, const double* x, const blas_int* in
* y, const int* incy); cx, double* y, const blas_int* incy);
// void daxpy_(const int* n, const double* alpha, const double* x, co // void daxpy_(const blas_int* n, const double* alpha, const double*
nst int* incx, double* y, const int* incy); x, const blas_int* incx, double* y, const blas_int* incy);
// void dger_(const int* m, const int* n, const double* alpha, const // void dger_(const blas_int* m, const blas_int* n, const double* al
double* x, const int* incx, const double* y, const int* incy, double* A, c pha, const double* x, const blas_int* incx, const double* y, const blas_int
onst int* ldA); * incy, double* A, const blas_int* ldA);
} }
template<typename eT> template<typename eT>
arma_inline arma_inline
eT eT
dot_(const int* n, const eT* x, const eT* y) dot_(const blas_int* n, const eT* x, const eT* y)
{ {
arma_type_check<is_supported_blas_type<eT>::value == false>::apply(); arma_type_check<is_supported_blas_type<eT>::value == false>::apply();
const int inc = 1; const blas_int inc = 1;
if(is_float<eT>::value == true) if(is_float<eT>::value == true)
{ {
typedef float T; typedef float T;
return eT( sdot_(n, (const T*)x, &inc, (const T*)y, &inc) ); return eT( sdot_(n, (const T*)x, &inc, (const T*)y, &inc) );
} }
else else
if(is_double<eT>::value == true) if(is_double<eT>::value == true)
{ {
typedef double T; typedef double T;
skipping to change at line 72 skipping to change at line 72
} }
else else
{ {
return eT(0); // prevent compiler warnings return eT(0); // prevent compiler warnings
} }
} }
template<typename eT> template<typename eT>
inline inline
void void
gemv_(const char* transA, const int* m, const int* n, const eT* alpha, co nst eT* A, const int* ldA, const eT* x, const int* incx, const eT* beta, eT * y, const int* incy) gemv_(const char* transA, const blas_int* m, const blas_int* n, const eT* alpha, const eT* A, const blas_int* ldA, const eT* x, const blas_int* incx , const eT* beta, eT* y, const blas_int* incy)
{ {
arma_type_check<is_supported_blas_type<eT>::value == false>::apply(); arma_type_check<is_supported_blas_type<eT>::value == false>::apply();
if(is_float<eT>::value == true) if(is_float<eT>::value == true)
{ {
typedef float T; typedef float T;
sgemv_(transA, m, n, (const T*)alpha, (const T*)A, ldA, (const T*)x, incx, (const T*)beta, (T*)y, incy); sgemv_(transA, m, n, (const T*)alpha, (const T*)A, ldA, (const T*)x, incx, (const T*)beta, (T*)y, incy);
} }
else else
if(is_double<eT>::value == true) if(is_double<eT>::value == true)
skipping to change at line 105 skipping to change at line 105
{ {
typedef std::complex<double> T; typedef std::complex<double> T;
zgemv_(transA, m, n, (const T*)alpha, (const T*)A, ldA, (const T*)x, incx, (const T*)beta, (T*)y, incy); zgemv_(transA, m, n, (const T*)alpha, (const T*)A, ldA, (const T*)x, incx, (const T*)beta, (T*)y, incy);
} }
} }
template<typename eT> template<typename eT>
inline inline
void void
gemm_(const char* transA, const char* transB, const int* m, const int* n, const int* k, const eT* alpha, const eT* A, const int* ldA, const eT* B, c onst int* ldB, const eT* beta, eT* C, const int* ldC) gemm_(const char* transA, const char* transB, const blas_int* m, const bl as_int* n, const blas_int* k, const eT* alpha, const eT* A, const blas_int* ldA, const eT* B, const blas_int* ldB, const eT* beta, eT* C, const blas_i nt* ldC)
{ {
arma_type_check<is_supported_blas_type<eT>::value == false>::apply(); arma_type_check<is_supported_blas_type<eT>::value == false>::apply();
if(is_float<eT>::value == true) if(is_float<eT>::value == true)
{ {
typedef float T; typedef float T;
sgemm_(transA, transB, m, n, k, (const T*)alpha, (const T*)A, ldA, (c onst T*)B, ldB, (const T*)beta, (T*)C, ldC); sgemm_(transA, transB, m, n, k, (const T*)alpha, (const T*)A, ldA, (c onst T*)B, ldB, (const T*)beta, (T*)C, ldC);
} }
else else
if(is_double<eT>::value == true) if(is_double<eT>::value == true)
 End of changes. 6 change blocks. 
49 lines changed or deleted 49 lines changed or added


 compiler_setup.hpp   compiler_setup.hpp 
skipping to change at line 96 skipping to change at line 96
#undef ARMA_HAVE_STD_ISFINITE #undef ARMA_HAVE_STD_ISFINITE
#undef ARMA_HAVE_STD_SNPRINTF #undef ARMA_HAVE_STD_SNPRINTF
#undef ARMA_HAVE_LOG1P #undef ARMA_HAVE_LOG1P
#undef ARMA_HAVE_STD_ISINF #undef ARMA_HAVE_STD_ISINF
#undef ARMA_HAVE_STD_ISNAN #undef ARMA_HAVE_STD_ISNAN
#undef ARMA_HAVE_STD_TR1 #undef ARMA_HAVE_STD_TR1
#undef arma_inline #undef arma_inline
#define arma_inline inline __forceinline #define arma_inline inline __forceinline
// #if (_MSC_VER >= 1400)
// #undef arma_aligned
// #define arma_aligned __declspec(align(16))
// #endif
#endif #endif
#if defined(__CUDACC__) #if defined(__CUDACC__)
#undef ARMA_HAVE_STD_ISFINITE #undef ARMA_HAVE_STD_ISFINITE
#undef ARMA_HAVE_STD_SNPRINTF #undef ARMA_HAVE_STD_SNPRINTF
#undef ARMA_HAVE_LOG1P #undef ARMA_HAVE_LOG1P
#undef ARMA_HAVE_STD_ISINF #undef ARMA_HAVE_STD_ISINF
#undef ARMA_HAVE_STD_ISNAN #undef ARMA_HAVE_STD_ISNAN
#undef ARMA_HAVE_STD_TR1 #undef ARMA_HAVE_STD_TR1
#endif #endif
 End of changes. 1 change blocks. 
0 lines changed or deleted 5 lines changed or added


 debug.hpp   debug.hpp 
skipping to change at line 216 skipping to change at line 216
} }
} }
//! stop if given matrices have different sizes //! stop if given matrices have different sizes
template<typename eT1, typename eT2> template<typename eT1, typename eT2>
inline inline
void void
arma_hot arma_hot
arma_assert_same_size(const Mat<eT1>& A, const Mat<eT2>& B, const char* x) arma_assert_same_size(const Mat<eT1>& A, const Mat<eT2>& B, const char* x)
{ {
if( (A.n_rows != B.n_rows) || (A.n_cols != B.n_cols) ) const u32 A_n_rows = A.n_rows;
const u32 A_n_cols = A.n_cols;
const u32 B_n_rows = B.n_rows;
const u32 B_n_cols = B.n_cols;
if( (A_n_rows != B_n_rows) || (A_n_cols != B_n_cols) )
{ {
arma_stop( arma_incompat_size_string(A.n_rows, A.n_cols, B.n_rows, B.n_ cols, x) ); arma_stop( arma_incompat_size_string(A_n_rows, A_n_cols, B_n_rows, B_n_ cols, x) );
} }
} }
//! stop if given proxies have different sizes //! stop if given proxies have different sizes
template<typename eT1, typename eT2> template<typename eT1, typename eT2>
inline inline
void void
arma_hot arma_hot
arma_assert_same_size(const Proxy<eT1>& A, const Proxy<eT2>& B, const char* x) arma_assert_same_size(const Proxy<eT1>& A, const Proxy<eT2>& B, const char* x)
{ {
if( (A.n_rows != B.n_rows) || (A.n_cols != B.n_cols) ) const u32 A_n_rows = A.get_n_rows();
const u32 A_n_cols = A.get_n_cols();
const u32 B_n_rows = B.get_n_rows();
const u32 B_n_cols = B.get_n_cols();
if( (A_n_rows != B_n_rows) || (A_n_cols != B_n_cols) )
{ {
arma_stop( arma_incompat_size_string(A.n_rows, A.n_cols, B.n_rows, B.n_ cols, x) ); arma_stop( arma_incompat_size_string(A_n_rows, A_n_cols, B_n_rows, B_n_ cols, x) );
} }
} }
template<typename eT1, typename eT2> template<typename eT1, typename eT2>
inline inline
void void
arma_hot arma_hot
arma_assert_same_size(const subview<eT1>& A, const subview<eT2>& B, const c har* x) arma_assert_same_size(const subview<eT1>& A, const subview<eT2>& B, const c har* x)
{ {
if( (A.n_rows != B.n_rows) || (A.n_cols != B.n_cols) ) const u32 A_n_rows = A.n_rows;
const u32 A_n_cols = A.n_cols;
const u32 B_n_rows = B.n_rows;
const u32 B_n_cols = B.n_cols;
if( (A_n_rows != B_n_rows) || (A_n_cols != B_n_cols) )
{ {
arma_stop( arma_incompat_size_string(A.n_rows, A.n_cols, B.n_rows, B.n_ cols, x) ); arma_stop( arma_incompat_size_string(A_n_rows, A_n_cols, B_n_rows, B_n_ cols, x) );
} }
} }
template<typename eT1, typename eT2> template<typename eT1, typename eT2>
inline inline
void void
arma_hot arma_hot
arma_assert_same_size(const Mat<eT1>& A, const subview<eT2>& B, const char* x) arma_assert_same_size(const Mat<eT1>& A, const subview<eT2>& B, const char* x)
{ {
if( (A.n_rows != B.n_rows) || (A.n_cols != B.n_cols) ) const u32 A_n_rows = A.n_rows;
const u32 A_n_cols = A.n_cols;
const u32 B_n_rows = B.n_rows;
const u32 B_n_cols = B.n_cols;
if( (A_n_rows != B_n_rows) || (A_n_cols != B_n_cols) )
{ {
arma_stop( arma_incompat_size_string(A.n_rows, A.n_cols, B.n_rows, B.n_ cols, x) ); arma_stop( arma_incompat_size_string(A_n_rows, A_n_cols, B_n_rows, B_n_ cols, x) );
} }
} }
template<typename eT1, typename eT2> template<typename eT1, typename eT2>
inline inline
void void
arma_hot arma_hot
arma_assert_same_size(const subview<eT1>& A, const Mat<eT2>& B, const char* x) arma_assert_same_size(const subview<eT1>& A, const Mat<eT2>& B, const char* x)
{ {
if( (A.n_rows != B.n_rows) || (A.n_cols != B.n_cols) ) const u32 A_n_rows = A.n_rows;
const u32 A_n_cols = A.n_cols;
const u32 B_n_rows = B.n_rows;
const u32 B_n_cols = B.n_cols;
if( (A_n_rows != B_n_rows) || (A_n_cols != B_n_cols) )
{ {
arma_stop( arma_incompat_size_string(A.n_rows, A.n_cols, B.n_rows, B.n_ cols, x) ); arma_stop( arma_incompat_size_string(A_n_rows, A_n_cols, B_n_rows, B_n_ cols, x) );
} }
} }
template<typename eT1, typename eT2> template<typename eT1, typename eT2>
inline inline
void void
arma_hot arma_hot
arma_assert_same_size(const Mat<eT1>& A, const Proxy<eT2>& B, const char* x ) arma_assert_same_size(const Mat<eT1>& A, const Proxy<eT2>& B, const char* x )
{ {
if( (A.n_rows != B.n_rows) || (A.n_cols != B.n_cols) ) const u32 A_n_rows = A.n_rows;
const u32 A_n_cols = A.n_cols;
const u32 B_n_rows = B.get_n_rows();
const u32 B_n_cols = B.get_n_cols();
if( (A_n_rows != B_n_rows) || (A_n_cols != B_n_cols) )
{ {
arma_stop ( arma_incompat_size_string(A.n_rows, A.n_cols, B.n_rows, B.n _cols, x) ); arma_stop( arma_incompat_size_string(A_n_rows, A_n_cols, B_n_rows, B_n_ cols, x) );
} }
} }
template<typename eT1, typename eT2> template<typename eT1, typename eT2>
inline inline
void void
arma_hot arma_hot
arma_assert_same_size(const Proxy<eT1>& A, const Mat<eT2>& B, const char* x ) arma_assert_same_size(const Proxy<eT1>& A, const Mat<eT2>& B, const char* x )
{ {
if( (A.n_rows != B.n_rows) || (A.n_cols != B.n_cols) ) const u32 A_n_rows = A.get_n_rows();
const u32 A_n_cols = A.get_n_cols();
const u32 B_n_rows = B.n_rows;
const u32 B_n_cols = B.n_cols;
if( (A_n_rows != B_n_rows) || (A_n_cols != B_n_cols) )
{ {
arma_stop( arma_incompat_size_string(A.n_rows, A.n_cols, B.n_rows, B.n_ cols, x) ); arma_stop( arma_incompat_size_string(A_n_rows, A_n_cols, B_n_rows, B_n_ cols, x) );
} }
} }
template<typename eT1, typename eT2> template<typename eT1, typename eT2>
inline inline
void void
arma_hot arma_hot
arma_assert_same_size(const Proxy<eT1>& A, const subview<eT2>& B, const cha r* x) arma_assert_same_size(const Proxy<eT1>& A, const subview<eT2>& B, const cha r* x)
{ {
if( (A.n_rows != B.n_rows) || (A.n_cols != B.n_cols) ) const u32 A_n_rows = A.get_n_rows();
const u32 A_n_cols = A.get_n_cols();
const u32 B_n_rows = B.n_rows;
const u32 B_n_cols = B.n_cols;
if( (A_n_rows != B_n_rows) || (A_n_cols != B_n_cols) )
{ {
arma_stop( arma_incompat_size_string(A.n_rows, A.n_cols, B.n_rows, B.n_ cols, x) ); arma_stop( arma_incompat_size_string(A_n_rows, A_n_cols, B_n_rows, B_n_ cols, x) );
} }
} }
template<typename eT1, typename eT2> template<typename eT1, typename eT2>
inline inline
void void
arma_hot arma_hot
arma_assert_same_size(const subview<eT1>& A, const Proxy<eT2>& B, const cha r* x) arma_assert_same_size(const subview<eT1>& A, const Proxy<eT2>& B, const cha r* x)
{ {
if( (A.n_rows != B.n_rows) || (A.n_cols != B.n_cols) ) const u32 A_n_rows = A.n_rows;
const u32 A_n_cols = A.n_cols;
const u32 B_n_rows = B.get_n_rows();
const u32 B_n_cols = B.get_n_cols();
if( (A_n_rows != B_n_rows) || (A_n_cols != B_n_cols) )
{ {
arma_stop( arma_incompat_size_string(A.n_rows, A.n_cols, B.n_rows, B.n_ cols, x) ); arma_stop( arma_incompat_size_string(A_n_rows, A_n_cols, B_n_rows, B_n_ cols, x) );
} }
} }
// //
// functions for checking whether two cubes have the same dimensions // functions for checking whether two cubes have the same dimensions
inline inline
arma_cold arma_cold
std::string std::string
arma_incompat_size_string(const u32 A_n_rows, const u32 A_n_cols, const u32 A_n_slices, const u32 B_n_rows, const u32 B_n_cols, const u32 B_n_slices, const char* x) arma_incompat_size_string(const u32 A_n_rows, const u32 A_n_cols, const u32 A_n_slices, const u32 B_n_rows, const u32 B_n_cols, const u32 B_n_slices, const char* x)
skipping to change at line 401 skipping to change at line 455
} }
} }
//! stop if given cube proxies have different sizes //! stop if given cube proxies have different sizes
template<typename eT1, typename eT2> template<typename eT1, typename eT2>
inline inline
void void
arma_hot arma_hot
arma_assert_same_size(const ProxyCube<eT1>& A, const ProxyCube<eT2>& B, con st char* x) arma_assert_same_size(const ProxyCube<eT1>& A, const ProxyCube<eT2>& B, con st char* x)
{ {
if( (A.n_rows != B.n_rows) || (A.n_cols != B.n_cols) || (A.n_slices != B. const u32 A_n_rows = A.get_n_rows();
n_slices)) const u32 A_n_cols = A.get_n_cols();
const u32 A_n_slices = A.get_n_slices();
const u32 B_n_rows = B.get_n_rows();
const u32 B_n_cols = B.get_n_cols();
const u32 B_n_slices = B.get_n_slices();
if( (A_n_rows != B_n_rows) || (A_n_cols != B_n_cols) || (A_n_slices != B_
n_slices))
{ {
arma_stop( arma_incompat_size_string(A.n_rows, A.n_cols, A.n_slices, B. n_rows, B.n_cols, B.n_slices, x) ); arma_stop( arma_incompat_size_string(A_n_rows, A_n_cols, A_n_slices, B_ n_rows, B_n_cols, B_n_slices, x) );
} }
} }
// //
// functions for checking whether a cube or subcube can be interpreted as a matrix (i.e. single slice) // functions for checking whether a cube or subcube can be interpreted as a matrix (i.e. single slice)
template<typename eT1, typename eT2> template<typename eT1, typename eT2>
inline inline
void void
arma_hot arma_hot
skipping to change at line 479 skipping to change at line 541
} }
} }
//! stop if given matrices are incompatible for multiplication //! stop if given matrices are incompatible for multiplication
template<typename eT1, typename eT2> template<typename eT1, typename eT2>
inline inline
void void
arma_hot arma_hot
arma_assert_mul_size(const Mat<eT1>& A, const Mat<eT2>& B, const char* x) arma_assert_mul_size(const Mat<eT1>& A, const Mat<eT2>& B, const char* x)
{ {
if(A.n_cols != B.n_rows) const u32 A_n_cols = A.n_cols;
const u32 B_n_rows = B.n_rows;
if(A_n_cols != B_n_rows)
{ {
arma_stop( arma_incompat_size_string(A.n_rows, A.n_cols, B.n_rows, B.n_ cols, x) ); arma_stop( arma_incompat_size_string(A.n_rows, A_n_cols, B_n_rows, B.n_ cols, x) );
} }
} }
//! stop if given matrices are incompatible for multiplication //! stop if given matrices are incompatible for multiplication
template<typename eT1, typename eT2> template<typename eT1, typename eT2>
inline inline
void void
arma_hot arma_hot
arma_assert_mul_size(const Mat<eT1>& A, const Mat<eT2>& B, const bool do_tr ans_A, const bool do_trans_B, const char* x) arma_assert_mul_size(const Mat<eT1>& A, const Mat<eT2>& B, const bool do_tr ans_A, const bool do_trans_B, const char* x)
{ {
 End of changes. 22 change blocks. 
23 lines changed or deleted 88 lines changed or added


 diagmat_proxy.hpp   diagmat_proxy.hpp 
skipping to change at line 29 skipping to change at line 29
template<typename T1> template<typename T1>
class diagmat_proxy class diagmat_proxy
{ {
public: public:
typedef typename T1::elem_type elem_type; typedef typename T1::elem_type elem_type;
typedef typename get_pod_type<elem_type>::result pod_type; typedef typename get_pod_type<elem_type>::result pod_type;
inline diagmat_proxy(const Base<typename T1::elem_type,T1>& X) inline diagmat_proxy(const Base<typename T1::elem_type,T1>& X)
: P (X.get_ref()) : P (X.get_ref())
, P_is_vec( (P.n_rows == 1) || (P.n_cols == 1) ) , P_is_vec( (P.get_n_rows() == 1) || (P.get_n_cols() == 1) )
, n_elem ( P_is_vec ? P.n_elem : P.n_rows ) , n_elem ( P_is_vec ? P.get_n_elem() : P.get_n_rows() )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( (P_is_vec == false) && (P.n_rows != P.n_cols), "diagm at(): only vectors and square matrices are accepted" ); arma_debug_check( (P_is_vec == false) && (P.get_n_rows() != P.get_n_col s()), "diagmat(): only vectors and square matrices are accepted" );
} }
arma_inline elem_type operator[] (const u32 i) const { r eturn P_is_vec ? P[i] : P.at(i,i); } arma_inline elem_type operator[] (const u32 i) const { r eturn P_is_vec ? P[i] : P.at(i,i); }
arma_inline elem_type at (const u32 row, const u32 col) const { r eturn (row == col) ? ( P_is_vec ? P[row] : P.at(row,row) ) : elem_type(0); } arma_inline elem_type at (const u32 row, const u32 col) const { r eturn (row == col) ? ( P_is_vec ? P[row] : P.at(row,row) ) : elem_type(0); }
const Proxy<T1> P; const Proxy<T1> P;
const bool P_is_vec; const bool P_is_vec;
const u32 n_elem; const u32 n_elem;
}; };
 End of changes. 2 change blocks. 
3 lines changed or deleted 3 lines changed or added


 diagview_meat.hpp   diagview_meat.hpp 
skipping to change at line 54 skipping to change at line 54
, m_ptr(&in_m) , m_ptr(&in_m)
, row_offset(in_row_offset) , row_offset(in_row_offset)
, col_offset(in_col_offset) , col_offset(in_col_offset)
, n_rows(in_len) , n_rows(in_len)
, n_cols( (in_len > 0) ? 1 : 0 ) , n_cols( (in_len > 0) ? 1 : 0 )
, n_elem(in_len) , n_elem(in_len)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
} }
//! set a diagonal of our matrix using a diagonal from a foreign matrix
template<typename eT>
inline
void
diagview<eT>::operator= (const diagview<eT>& x)
{
arma_extra_debug_sigprint();
diagview<eT>& t = *this;
arma_debug_check( (t.n_elem != x.n_elem), "diagview::operator=(): diagona
ls have incompatible lengths");
Mat<eT>& t_m = *(t.m_ptr);
const Mat<eT>& x_m = x.m;
const u32 t_n_elem = t.n_elem;
const u32 t_row_offset = t.row_offset;
const u32 t_col_offset = t.col_offset;
const u32 x_row_offset = x.row_offset;
const u32 x_col_offset = x.col_offset;
for(u32 i=0; i<t_n_elem; ++i)
{
t_m.at(i + t_row_offset, i + t_col_offset) = x_m.at(i + x_row_offset, i
+ x_col_offset);
}
}
//! set a diagonal of our matrix using data from a foreign object //! set a diagonal of our matrix using data from a foreign object
template<typename eT> template<typename eT>
template<typename T1> template<typename T1>
inline inline
void void
diagview<eT>::operator= (const Base<eT,T1>& o) diagview<eT>::operator= (const Base<eT,T1>& o)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_check( (m_ptr == 0), "diagview::operator=(): matrix is read only");
const unwrap<T1> tmp(o.get_ref()); const unwrap<T1> tmp(o.get_ref());
const Mat<eT>& x = tmp.M; const Mat<eT>& x = tmp.M;
diagview& t = *this; diagview<eT>&amp; t = *this;
arma_debug_check( !x.is_vec(), "diagview::operator=(): need a vector"); arma_debug_check
arma_debug_check( (t.n_elem != x.n_elem), "diagview::operator=(): diagona (
l and given vector have incompatible lengths"); ( (t.n_elem != x.n_elem) || (x.is_vec() == false) ),
"diagview::operator=(): given object has incompatible size"
);
Mat<eT>& t_m = *(t.m_ptr); Mat<eT>& t_m = *(t.m_ptr);
for(u32 i=0; i<n_elem; ++i) const u32 t_n_elem = t.n_elem;
const u32 t_row_offset = t.row_offset;
const u32 t_col_offset = t.col_offset;
const eT* x_mem = x.memptr();
for(u32 i=0; i<t_n_elem; ++i)
{ {
t_m.at(i+row_offset, i+col_offset) = x.mem[i]; t_m.at( i + t_row_offset, i + t_col_offset) = x_mem[i];
} }
}
template<typename eT>
template<typename T1>
inline
void
diagview<eT>::operator+=(const Base<eT,T1>& o)
{
arma_extra_debug_sigprint();
const unwrap<T1> tmp(o.get_ref());
const Mat<eT>& x = tmp.M;
diagview<eT>& t = *this;
arma_debug_check
(
( (t.n_elem != x.n_elem) || (x.is_vec() == false) ),
"diagview::operator=(): given object has incompatible size"
);
Mat<eT>& t_m = *(t.m_ptr);
const u32 t_n_elem = t.n_elem;
const u32 t_row_offset = t.row_offset;
const u32 t_col_offset = t.col_offset;
const eT* x_mem = x.memptr();
for(u32 i=0; i<t_n_elem; ++i)
{
t_m.at( i + t_row_offset, i + t_col_offset) += x_mem[i];
}
} }
//! set a diagonal of our matrix using a diagonal from a foreign matrix
template<typename eT> template<typename eT>
template<typename T1>
inline inline
void void
diagview<eT>::operator= (const diagview<eT>& x) diagview<eT>::operator-=(const Base<eT,T1>& o)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_check( (m_ptr == 0), "diagview::operator=(): matrix is read only");
const unwrap<T1> tmp(o.get_ref());
const Mat<eT>& x = tmp.M;
diagview<eT>& t = *this; diagview<eT>& t = *this;
arma_debug_check( (t.n_elem != x.n_elem), "diagview::operator=(): diagona arma_debug_check
ls have incompatible lengths"); (
( (t.n_elem != x.n_elem) || (x.is_vec() == false) ),
"diagview::operator=(): given object has incompatible size"
);
Mat<eT>& t_m = *(t.m_ptr); Mat<eT>& t_m = *(t.m_ptr);
const Mat<eT>& x_m = x.m;
for(u32 i=0; i<n_elem; ++i) const u32 t_n_elem = t.n_elem;
const u32 t_row_offset = t.row_offset;
const u32 t_col_offset = t.col_offset;
const eT* x_mem = x.memptr();
for(u32 i=0; i<t_n_elem; ++i)
{ {
t_m.at(i+t.row_offset, i+t.col_offset) = x_m.at(i+x.row_offset, i+x.col _offset); t_m.at( i + t_row_offset, i + t_col_offset) -= x_mem[i];
} }
}
template<typename eT>
template<typename T1>
inline
void
diagview<eT>::operator%=(const Base<eT,T1>& o)
{
arma_extra_debug_sigprint();
const unwrap<T1> tmp(o.get_ref());
const Mat<eT>& x = tmp.M;
diagview<eT>& t = *this;
arma_debug_check
(
( (t.n_elem != x.n_elem) || (x.is_vec() == false) ),
"diagview::operator=(): given object has incompatible size"
);
Mat<eT>& t_m = *(t.m_ptr);
const u32 t_n_elem = t.n_elem;
const u32 t_row_offset = t.row_offset;
const u32 t_col_offset = t.col_offset;
const eT* x_mem = x.memptr();
for(u32 i=0; i<t_n_elem; ++i)
{
t_m.at( i + t_row_offset, i + t_col_offset) *= x_mem[i];
}
}
template<typename eT>
template<typename T1>
inline
void
diagview<eT>::operator/=(const Base<eT,T1>& o)
{
arma_extra_debug_sigprint();
const unwrap<T1> tmp(o.get_ref());
const Mat<eT>& x = tmp.M;
diagview<eT>& t = *this;
arma_debug_check
(
( (t.n_elem != x.n_elem) || (x.is_vec() == false) ),
"diagview::operator=(): given object has incompatible size"
);
Mat<eT>& t_m = *(t.m_ptr);
const u32 t_n_elem = t.n_elem;
const u32 t_row_offset = t.row_offset;
const u32 t_col_offset = t.col_offset;
const eT* x_mem = x.memptr();
for(u32 i=0; i<t_n_elem; ++i)
{
t_m.at( i + t_row_offset, i + t_col_offset) /= x_mem[i];
}
} }
//! \brief
//! extract a diagonal and store it as a column vector //! extract a diagonal and store it as a column vector
template<typename eT> template<typename eT>
inline inline
void void
diagview<eT>::extract(Mat<eT>& actual_out, const diagview<eT>& in) diagview<eT>::extract(Mat<eT>& actual_out, const diagview<eT>& in)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
const Mat<eT>& in_m = in.m; const Mat<eT>& in_m = in.m;
const bool alias = (&actual_out == &in_m); const bool alias = (&actual_out == &in_m);
skipping to change at line 272 skipping to change at line 415
diagview<eT>::at(const u32 row, const u32 col) const diagview<eT>::at(const u32 row, const u32 col) const
{ {
return m.at(row+row_offset, row+col_offset); return m.at(row+row_offset, row+col_offset);
} }
template<typename eT> template<typename eT>
arma_inline arma_inline
eT& eT&
diagview<eT>::operator()(const u32 i) diagview<eT>::operator()(const u32 i)
{ {
arma_check( (m_ptr == 0), "diagview::operator(): matrix is read only");
arma_debug_check( (i >= n_elem), "diagview::operator(): out of bounds" ); arma_debug_check( (i >= n_elem), "diagview::operator(): out of bounds" );
return (*m_ptr).at(i+row_offset, i+col_offset); return (*m_ptr).at(i+row_offset, i+col_offset);
} }
template<typename eT> template<typename eT>
arma_inline arma_inline
eT eT
diagview<eT>::operator()(const u32 i) const diagview<eT>::operator()(const u32 i) const
{ {
arma_debug_check( (i >= n_elem), "diagview::operator(): out of bounds" ); arma_debug_check( (i >= n_elem), "diagview::operator(): out of bounds" );
return m.at(i+row_offset, i+col_offset); return m.at(i+row_offset, i+col_offset);
} }
template<typename eT> template<typename eT>
arma_inline arma_inline
eT& eT&
diagview<eT>::operator()(const u32 row, const u32 col) diagview<eT>::operator()(const u32 row, const u32 col)
{ {
arma_check( (m_ptr == 0), "diagview::operator(): matrix is read only");
arma_debug_check( ((row >= n_elem) || (col > 0)), "diagview::operator(): out of bounds" ); arma_debug_check( ((row >= n_elem) || (col > 0)), "diagview::operator(): out of bounds" );
return (*m_ptr).at(row+row_offset, row+col_offset); return (*m_ptr).at(row+row_offset, row+col_offset);
} }
template<typename eT> template<typename eT>
arma_inline arma_inline
eT eT
diagview<eT>::operator()(const u32 row, const u32 col) const diagview<eT>::operator()(const u32 row, const u32 col) const
{ {
skipping to change at line 315 skipping to change at line 456
return m.at(row+row_offset, row+col_offset); return m.at(row+row_offset, row+col_offset);
} }
template<typename eT> template<typename eT>
inline inline
void void
diagview<eT>::fill(const eT val) diagview<eT>::fill(const eT val)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_check( (m_ptr == 0), "diagview::fill(): matrix is read only");
Mat<eT>& x = (*m_ptr); Mat<eT>& x = (*m_ptr);
for(u32 i=0; i<n_elem; ++i) for(u32 i=0; i<n_elem; ++i)
{ {
x.at(i+row_offset, i+col_offset) = val; x.at(i+row_offset, i+col_offset) = val;
} }
} }
template<typename eT> template<typename eT>
inline inline
void void
diagview<eT>::zeros() diagview<eT>::zeros()
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_check( (m_ptr == 0), "diagview::zeros(): matrix is read only");
Mat<eT>& x = (*m_ptr); Mat<eT>& x = (*m_ptr);
for(u32 i=0; i<n_elem; ++i) for(u32 i=0; i<n_elem; ++i)
{ {
x.at(i+row_offset, i+col_offset) = eT(0); x.at(i+row_offset, i+col_offset) = eT(0);
} }
} }
template<typename eT> template<typename eT>
inline inline
void void
diagview<eT>::ones() diagview<eT>::ones()
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_check( (m_ptr == 0), "diagview::ones(): matrix is read only");
Mat<eT>& x = (*m_ptr); Mat<eT>& x = (*m_ptr);
for(u32 i=0; i<n_elem; ++i) for(u32 i=0; i<n_elem; ++i)
{ {
x.at(i+row_offset, i+col_offset) = eT(1); x.at(i+row_offset, i+col_offset) = eT(1);
} }
} }
//! @} //! @}
 End of changes. 24 change blocks. 
22 lines changed or deleted 160 lines changed or added


 diagview_proto.hpp   diagview_proto.hpp 
skipping to change at line 47 skipping to change at line 47
protected: protected:
arma_inline diagview(const Mat<eT>& in_m, const u32 in_row_offset, const u32 in_col_offset, const u32 len); arma_inline diagview(const Mat<eT>& in_m, const u32 in_row_offset, const u32 in_col_offset, const u32 len);
arma_inline diagview( Mat<eT>& in_m, const u32 in_row_offset, const u32 in_col_offset, const u32 len); arma_inline diagview( Mat<eT>& in_m, const u32 in_row_offset, const u32 in_col_offset, const u32 len);
public: public:
inline ~diagview(); inline ~diagview();
template<typename T1>
inline void operator=(const Base<eT,T1>& x);
inline void operator=(const diagview& x); inline void operator=(const diagview& x);
template<typename T1> inline void operator= (const Base<eT,T1>& x);
template<typename T1> inline void operator+=(const Base<eT,T1>& x);
template<typename T1> inline void operator-=(const Base<eT,T1>& x);
template<typename T1> inline void operator%=(const Base<eT,T1>& x);
template<typename T1> inline void operator/=(const Base<eT,T1>& x);
arma_inline eT& operator[](const u32 i); arma_inline eT& operator[](const u32 i);
arma_inline eT operator[](const u32 i) const; arma_inline eT operator[](const u32 i) const;
arma_inline eT& operator()(const u32 i); arma_inline eT& operator()(const u32 i);
arma_inline eT operator()(const u32 i) const; arma_inline eT operator()(const u32 i) const;
arma_inline eT& at(const u32 in_n_row, const u32 in_n_col); arma_inline eT& at(const u32 in_n_row, const u32 in_n_col);
arma_inline eT at(const u32 in_n_row, const u32 in_n_col) const; arma_inline eT at(const u32 in_n_row, const u32 in_n_col) const;
arma_inline eT& operator()(const u32 in_n_row, const u32 in_n_col); arma_inline eT& operator()(const u32 in_n_row, const u32 in_n_col);
 End of changes. 2 change blocks. 
3 lines changed or deleted 6 lines changed or added


 eGlueCube_meat.hpp   eGlueCube_meat.hpp 
skipping to change at line 34 skipping to change at line 34
} }
template<typename T1, typename T2, typename eglue_type> template<typename T1, typename T2, typename eglue_type>
arma_inline arma_inline
eGlueCube<T1,T2,eglue_type>::eGlueCube(const T1& in_A, const T2& in_B) eGlueCube<T1,T2,eglue_type>::eGlueCube(const T1& in_A, const T2& in_B)
: P1(in_A) : P1(in_A)
, P2(in_B) , P2(in_B)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_assert_same_size(P1.n_rows, P1.n_cols, P1.n_slices, P2.n_rows, P2.n_ arma_assert_same_size
cols, P2.n_slices, eglue_type::text()); (
P1.get_n_rows(), P1.get_n_cols(), P1.get_n_slices(),
P2.get_n_rows(), P2.get_n_cols(), P2.get_n_slices(),
eglue_type::text()
);
}
template<typename T1, typename T2, typename eglue_type>
arma_inline
u32
eGlueCube<T1,T2,eglue_type>::get_n_rows() const
{
return P1.get_n_rows();
}
template<typename T1, typename T2, typename eglue_type>
arma_inline
u32
eGlueCube<T1,T2,eglue_type>::get_n_cols() const
{
return P1.get_n_cols();
}
template<typename T1, typename T2, typename eglue_type>
arma_inline
u32
eGlueCube<T1,T2,eglue_type>::get_n_slices() const
{
return P1.get_n_slices();
}
template<typename T1, typename T2, typename eglue_type>
arma_inline
u32
eGlueCube<T1,T2,eglue_type>::get_n_elem_slice() const
{
return P1.get_n_elem_slice();
}
template<typename T1, typename T2, typename eglue_type>
arma_inline
u32
eGlueCube<T1,T2,eglue_type>::get_n_elem() const
{
return P1.get_n_elem();
}
template<typename T1, typename T2, typename eglue_type>
arma_inline
typename T1::elem_type
eGlueCube<T1,T2,eglue_type>::operator[] (const u32 i) const
{
typedef typename T1::elem_type eT;
// the optimiser will keep only one return statement
if(is_same_type<eglue_type, eglue_plus >::value == true) { return P1
[i] + P2[i]; }
else if(is_same_type<eglue_type, eglue_minus>::value == true) { return P1
[i] - P2[i]; }
else if(is_same_type<eglue_type, eglue_div >::value == true) { return P1
[i] / P2[i]; }
else if(is_same_type<eglue_type, eglue_schur>::value == true) { return P1
[i] * P2[i]; }
else
{
arma_stop("eGlueCube::operator[]: unhandled eglue_type");
return eT();
}
}
template<typename T1, typename T2, typename eglue_type>
arma_inline
typename T1::elem_type
eGlueCube<T1,T2,eglue_type>::at(const u32 row, const u32 col, const u32 sli
ce) const
{
typedef typename T1::elem_type eT;
// the optimiser will keep only one return statement
if(is_same_type<eglue_type, eglue_plus >::value == true) { return P1
.at(row,col,slice) + P2.at(row,col,slice); }
else if(is_same_type<eglue_type, eglue_minus>::value == true) { return P1
.at(row,col,slice) - P2.at(row,col,slice); }
else if(is_same_type<eglue_type, eglue_div >::value == true) { return P1
.at(row,col,slice) / P2.at(row,col,slice); }
else if(is_same_type<eglue_type, eglue_schur>::value == true) { return P1
.at(row,col,slice) * P2.at(row,col,slice); }
else
{
arma_stop("eGlueCube::at(): unhandled eglue_type");
return eT();
}
} }
//! @} //! @}
 End of changes. 1 change blocks. 
2 lines changed or deleted 95 lines changed or added


 eGlueCube_proto.hpp   eGlueCube_proto.hpp 
skipping to change at line 27 skipping to change at line 27
//! @{ //! @{
template<typename T1, typename T2, typename eglue_type> template<typename T1, typename T2, typename eglue_type>
class eGlueCube : public BaseCube<typename T1::elem_type, eGlueCube<T1, T2, eglue_type> > class eGlueCube : public BaseCube<typename T1::elem_type, eGlueCube<T1, T2, eglue_type> >
{ {
public: public:
typedef typename T1::elem_type elem_type; typedef typename T1::elem_type elem_type;
typedef typename get_pod_type<elem_type>::result pod_type; typedef typename get_pod_type<elem_type>::result pod_type;
const ProxyCube<T1> P1; arma_aligned const ProxyCube<T1> P1;
const ProxyCube<T2> P2; arma_aligned const ProxyCube<T2> P2;
arma_inline ~eGlueCube(); arma_inline ~eGlueCube();
arma_inline eGlueCube(const T1& in_A, const T2& in_B); arma_inline eGlueCube(const T1& in_A, const T2& in_B);
arma_inline u32 get_n_rows() const;
arma_inline u32 get_n_cols() const;
arma_inline u32 get_n_elem_slice() const;
arma_inline u32 get_n_slices() const;
arma_inline u32 get_n_elem() const;
arma_inline elem_type operator[] (const u32 i)
const;
arma_inline elem_type at (const u32 row, const u32 col, const u32
slice) const;
}; };
//! @} //! @}
 End of changes. 2 change blocks. 
2 lines changed or deleted 12 lines changed or added


 eGlue_meat.hpp   eGlue_meat.hpp 
skipping to change at line 34 skipping to change at line 34
} }
template<typename T1, typename T2, typename eglue_type> template<typename T1, typename T2, typename eglue_type>
arma_inline arma_inline
eGlue<T1,T2,eglue_type>::eGlue(const T1& in_A, const T2& in_B) eGlue<T1,T2,eglue_type>::eGlue(const T1& in_A, const T2& in_B)
: P1(in_A) : P1(in_A)
, P2(in_B) , P2(in_B)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_assert_same_size(P1.n_rows, P1.n_cols, P2.n_rows, P2.n_cols, eglue_t // arma_debug_assert_same_size( P1, P2, eglue_type::text() );
ype::text()); arma_debug_assert_same_size
(
P1.get_n_rows(), P1.get_n_cols(),
P2.get_n_rows(), P2.get_n_cols(),
eglue_type::text()
);
}
template<typename T1, typename T2, typename eglue_type>
arma_inline
u32
eGlue<T1,T2,eglue_type>::get_n_rows() const
{
return P1.get_n_rows();
}
template<typename T1, typename T2, typename eglue_type>
arma_inline
u32
eGlue<T1,T2,eglue_type>::get_n_cols() const
{
return P1.get_n_cols();
}
template<typename T1, typename T2, typename eglue_type>
arma_inline
u32
eGlue<T1,T2,eglue_type>::get_n_elem() const
{
return P1.get_n_elem();
}
template<typename T1, typename T2, typename eglue_type>
arma_inline
typename T1::elem_type
eGlue<T1,T2,eglue_type>::operator[] (const u32 i) const
{
typedef typename T1::elem_type eT;
// the optimiser will keep only one return statement
if(is_same_type<eglue_type, eglue_plus >::value == true) { return P1
[i] + P2[i]; }
else if(is_same_type<eglue_type, eglue_minus>::value == true) { return P1
[i] - P2[i]; }
else if(is_same_type<eglue_type, eglue_div >::value == true) { return P1
[i] / P2[i]; }
else if(is_same_type<eglue_type, eglue_schur>::value == true) { return P1
[i] * P2[i]; }
else
{
arma_stop("eGlue::operator[]: unhandled eglue_type");
return eT();
}
}
template<typename T1, typename T2, typename eglue_type>
arma_inline
typename T1::elem_type
eGlue<T1,T2,eglue_type>::at(const u32 row, const u32 col) const
{
typedef typename T1::elem_type eT;
// the optimiser will keep only one return statement
if(is_same_type<eglue_type, eglue_plus >::value == true) { return P1
.at(row,col) + P2.at(row,col); }
else if(is_same_type<eglue_type, eglue_minus>::value == true) { return P1
.at(row,col) - P2.at(row,col); }
else if(is_same_type<eglue_type, eglue_div >::value == true) { return P1
.at(row,col) / P2.at(row,col); }
else if(is_same_type<eglue_type, eglue_schur>::value == true) { return P1
.at(row,col) * P2.at(row,col); }
else
{
arma_stop("eGlue::at(): unhandled eglue_type");
return eT();
}
} }
//! @} //! @}
 End of changes. 1 change blocks. 
2 lines changed or deleted 79 lines changed or added


 eGlue_proto.hpp   eGlue_proto.hpp 
skipping to change at line 27 skipping to change at line 27
//! @{ //! @{
template<typename T1, typename T2, typename eglue_type> template<typename T1, typename T2, typename eglue_type>
class eGlue : public Base<typename T1::elem_type, eGlue<T1, T2, eglue_type> > class eGlue : public Base<typename T1::elem_type, eGlue<T1, T2, eglue_type> >
{ {
public: public:
typedef typename T1::elem_type elem_type; typedef typename T1::elem_type elem_type;
typedef typename get_pod_type<elem_type>::result pod_type; typedef typename get_pod_type<elem_type>::result pod_type;
const Proxy<T1> P1; arma_aligned const Proxy<T1> P1;
const Proxy<T2> P2; arma_aligned const Proxy<T2> P2;
arma_inline ~eGlue(); arma_inline ~eGlue();
arma_inline eGlue(const T1& in_A, const T2& in_B); arma_inline eGlue(const T1& in_A, const T2& in_B);
arma_inline u32 get_n_rows() const;
arma_inline u32 get_n_cols() const;
arma_inline u32 get_n_elem() const;
arma_inline elem_type operator[] (const u32 i) const;
arma_inline elem_type at (const u32 row, const u32 col) const;
}; };
//! @} //! @}
 End of changes. 2 change blocks. 
2 lines changed or deleted 8 lines changed or added


 eOpCube_meat.hpp   eOpCube_meat.hpp 
skipping to change at line 74 skipping to change at line 74
eOpCube<T1, eop_type>::eOpCube(const BaseCube<typename T1::elem_type, T1>& in_m, const typename T1::elem_type in_aux, const u32 in_aux_u32_a, const u3 2 in_aux_u32_b, const u32 in_aux_u32_c) eOpCube<T1, eop_type>::eOpCube(const BaseCube<typename T1::elem_type, T1>& in_m, const typename T1::elem_type in_aux, const u32 in_aux_u32_a, const u3 2 in_aux_u32_b, const u32 in_aux_u32_c)
: P (in_m.get_ref()) : P (in_m.get_ref())
, aux (in_aux) , aux (in_aux)
, aux_u32_a (in_aux_u32_a) , aux_u32_a (in_aux_u32_a)
, aux_u32_b (in_aux_u32_b) , aux_u32_b (in_aux_u32_b)
, aux_u32_c (in_aux_u32_c) , aux_u32_c (in_aux_u32_c)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
} }
//! used by eop_randu, eop_randn, eop_zeros, eop_ones (i.e. element generat
ors);
//! the proxy P is invalid for generators and must not be used.
template<typename T1, typename eop_type> template<typename T1, typename eop_type>
eOpCube<T1, eop_type>::eOpCube(const u32 in_n_rows, const u32 in_n_cols, co nst u32 in_n_slices) eOpCube<T1, eop_type>::eOpCube(const u32 in_n_rows, const u32 in_n_cols, co nst u32 in_n_slices)
: P (in_n_rows, in_n_cols, in_n_slices) : P (P)
, aux (aux) , aux (aux)
, aux_u32_a (aux_u32_a) , aux_u32_a (in_n_rows)
, aux_u32_b (aux_u32_b) , aux_u32_b (in_n_cols)
, aux_u32_c (aux_u32_c) , aux_u32_c (in_n_slices)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
} }
template<typename T1, typename eop_type> template<typename T1, typename eop_type>
eOpCube<T1, eop_type>::~eOpCube() eOpCube<T1, eop_type>::~eOpCube()
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
} }
template<typename T1, typename eop_type>
arma_inline
u32
eOpCube<T1, eop_type>::get_n_rows() const
{
return (is_generator<eop_type>::value == false) ? P.get_n_rows() : aux_u3
2_a;
}
template<typename T1, typename eop_type>
arma_inline
u32
eOpCube<T1, eop_type>::get_n_cols() const
{
return (is_generator<eop_type>::value == false) ? P.get_n_cols() : aux_u3
2_b;
}
template<typename T1, typename eop_type>
arma_inline
u32
eOpCube<T1, eop_type>::get_n_elem_slice() const
{
return (is_generator<eop_type>::value == false) ? P.get_n_elem_slice() :
(aux_u32_a * aux_u32_b);
}
template<typename T1, typename eop_type>
arma_inline
u32
eOpCube<T1, eop_type>::get_n_slices() const
{
return (is_generator<eop_type>::value == false) ? P.get_n_slices() : aux_
u32_c;
}
template<typename T1, typename eop_type>
arma_inline
u32
eOpCube<T1, eop_type>::get_n_elem() const
{
return (is_generator<eop_type>::value == false) ? P.get_n_elem() : (aux_u
32_a * aux_u32_b * aux_u32_c);
}
template<typename T1, typename eop_type>
arma_inline
typename T1::elem_type
eOpCube<T1, eop_type>::operator[] (const u32 i) const
{
typedef typename T1::elem_type eT;
if(is_generator<eop_type>::value == true)
{
return eop_aux::generate<eT,eop_type>();
}
else
{
return eop_core<eop_type>::process(P[i], aux);
}
}
template<typename T1, typename eop_type>
arma_inline
typename T1::elem_type
eOpCube<T1, eop_type>::at(const u32 row, const u32 col, const u32 slice) co
nst
{
typedef typename T1::elem_type eT;
if(is_generator<eop_type>::value == true)
{
return eop_aux::generate<eT,eop_type>();
}
else
{
return eop_core<eop_type>::process(P.at(row, col, slice), aux);
}
}
//! @} //! @}
 End of changes. 4 change blocks. 
4 lines changed or deleted 87 lines changed or added


 eOpCube_proto.hpp   eOpCube_proto.hpp 
skipping to change at line 27 skipping to change at line 27
//! @{ //! @{
template<typename T1, typename eop_type> template<typename T1, typename eop_type>
class eOpCube : public BaseCube<typename T1::elem_type, eOpCube<T1, eop_typ e> > class eOpCube : public BaseCube<typename T1::elem_type, eOpCube<T1, eop_typ e> >
{ {
public: public:
typedef typename T1::elem_type elem_type; typedef typename T1::elem_type elem_type;
typedef typename get_pod_type<elem_type>::result pod_type; typedef typename get_pod_type<elem_type>::result pod_type;
const ProxyCube<T1> P; arma_aligned const ProxyCube<T1> P;
const elem_type aux; //!< storage of auxiliary data, user defined arma_aligned const elem_type aux; //!< storage of auxiliary data,
format user defined format
const u32 aux_u32_a; //!< storage of auxiliary data, u32 format arma_aligned const u32 aux_u32_a; //!< storage of auxiliary data,
const u32 aux_u32_b; //!< storage of auxiliary data, u32 format u32 format
const u32 aux_u32_c; //!< storage of auxiliary data, u32 format arma_aligned const u32 aux_u32_b; //!< storage of auxiliary data,
u32 format
arma_aligned const u32 aux_u32_c; //!< storage of auxiliary data,
u32 format
inline ~eOpCube(); inline ~eOpCube();
inline explicit eOpCube(const BaseCube<typename T1::elem_type, T1>& in_m) ; inline explicit eOpCube(const BaseCube<typename T1::elem_type, T1>& in_m) ;
inline eOpCube(const BaseCube<typename T1::elem_type, T1>& in_m, const elem_type in_aux); inline eOpCube(const BaseCube<typename T1::elem_type, T1>& in_m, const elem_type in_aux);
inline eOpCube(const BaseCube<typename T1::elem_type, T1>& in_m, const u32 in_aux_u32_a, const u32 in_aux_u32_b); inline eOpCube(const BaseCube<typename T1::elem_type, T1>& in_m, const u32 in_aux_u32_a, const u32 in_aux_u32_b);
inline eOpCube(const BaseCube<typename T1::elem_type, T1>& in_m, const u32 in_aux_u32_a, const u32 in_aux_u32_b, const u32 in_aux_u32_c); inline eOpCube(const BaseCube<typename T1::elem_type, T1>& in_m, const u32 in_aux_u32_a, const u32 in_aux_u32_b, const u32 in_aux_u32_c);
inline eOpCube(const BaseCube<typename T1::elem_type, T1>& in_m, const elem_type in_aux, const u32 in_aux_u32_a, const u32 in_aux_u32_b, co nst u32 in_aux_u32_c); inline eOpCube(const BaseCube<typename T1::elem_type, T1>& in_m, const elem_type in_aux, const u32 in_aux_u32_a, const u32 in_aux_u32_b, co nst u32 in_aux_u32_c);
inline eOpCube(const u32 in_n_rows, const u32 in_n_cols, const u 32 in_n_slices); inline eOpCube(const u32 in_n_rows, const u32 in_n_cols, const u 32 in_n_slices);
arma_inline u32 get_n_rows() const;
arma_inline u32 get_n_cols() const;
arma_inline u32 get_n_elem_slice() const;
arma_inline u32 get_n_slices() const;
arma_inline u32 get_n_elem() const;
arma_inline elem_type operator[] (const u32 i)
const;
arma_inline elem_type at (const u32 row, const u32 col, const u32
slice) const;
}; };
//! @} //! @}
 End of changes. 3 change blocks. 
6 lines changed or deleted 19 lines changed or added


 eOp_meat.hpp   eOp_meat.hpp 
skipping to change at line 27 skipping to change at line 27
//! @{ //! @{
template<typename T1, typename eop_type> template<typename T1, typename eop_type>
eOp<T1, eop_type>::eOp(const Base<typename T1::elem_type, T1>& in_m) eOp<T1, eop_type>::eOp(const Base<typename T1::elem_type, T1>& in_m)
: P(in_m.get_ref()) : P(in_m.get_ref())
, aux(aux) , aux(aux)
, aux_u32_a(aux_u32_a) , aux_u32_a(aux_u32_a)
, aux_u32_b(aux_u32_b) , aux_u32_b(aux_u32_b)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( (eop_type::size_ok(P.n_rows, P.n_cols) == false), eop_t
ype::error_msg() );
} }
template<typename T1, typename eop_type> template<typename T1, typename eop_type>
eOp<T1, eop_type>::eOp(const Base<typename T1::elem_type, T1>& in_m, const typename T1::elem_type in_aux) eOp<T1, eop_type>::eOp(const Base<typename T1::elem_type, T1>& in_m, const typename T1::elem_type in_aux)
: P(in_m.get_ref()) : P(in_m.get_ref())
, aux(in_aux) , aux(in_aux)
, aux_u32_a(aux_u32_a) , aux_u32_a(aux_u32_a)
, aux_u32_b(aux_u32_b) , aux_u32_b(aux_u32_b)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( (eop_type::size_ok(P.n_rows, P.n_cols) == false), eop_t
ype::error_msg() );
} }
template<typename T1, typename eop_type> template<typename T1, typename eop_type>
eOp<T1, eop_type>::eOp(const Base<typename T1::elem_type, T1>& in_m, const u32 in_aux_u32_a, const u32 in_aux_u32_b) eOp<T1, eop_type>::eOp(const Base<typename T1::elem_type, T1>& in_m, const u32 in_aux_u32_a, const u32 in_aux_u32_b)
: P(in_m.get_ref()) : P(in_m.get_ref())
, aux(aux) , aux(aux)
, aux_u32_a(in_aux_u32_a) , aux_u32_a(in_aux_u32_a)
, aux_u32_b(in_aux_u32_b) , aux_u32_b(in_aux_u32_b)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( (eop_type::size_ok(P.n_rows, P.n_cols) == false), eop_t
ype::error_msg() );
} }
template<typename T1, typename eop_type> template<typename T1, typename eop_type>
eOp<T1, eop_type>::eOp(const Base<typename T1::elem_type, T1>& in_m, const typename T1::elem_type in_aux, const u32 in_aux_u32_a, const u32 in_aux_u32 _b) eOp<T1, eop_type>::eOp(const Base<typename T1::elem_type, T1>& in_m, const typename T1::elem_type in_aux, const u32 in_aux_u32_a, const u32 in_aux_u32 _b)
: P(in_m.get_ref()) : P(in_m.get_ref())
, aux(in_aux) , aux(in_aux)
, aux_u32_a(in_aux_u32_a) , aux_u32_a(in_aux_u32_a)
, aux_u32_b(in_aux_u32_b) , aux_u32_b(in_aux_u32_b)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( (eop_type::size_ok(P.n_rows, P.n_cols) == false), eop_t
ype::error_msg() );
} }
//! used by eop_randu, eop_randn, eop_zeros, eop_ones, eop_ones_diag (i.e.
element generators);
//! the proxy P is invalid for generators and must not be used.
template<typename T1, typename eop_type> template<typename T1, typename eop_type>
eOp<T1, eop_type>::eOp(const u32 in_n_rows, const u32 in_n_cols) eOp<T1, eop_type>::eOp(const u32 in_n_rows, const u32 in_n_cols)
: P(in_n_rows, in_n_cols) : P(P)
, aux(aux) , aux(aux)
, aux_u32_a(aux_u32_a) , aux_u32_a(in_n_rows)
, aux_u32_b(aux_u32_b) , aux_u32_b(in_n_cols)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( (eop_type::size_ok(P.n_rows, P.n_cols) == false), eop_t
ype::error_msg() );
} }
template<typename T1, typename eop_type> template<typename T1, typename eop_type>
eOp<T1, eop_type>::~eOp() eOp<T1, eop_type>::~eOp()
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
} }
template<typename T1, typename eop_type>
arma_inline
u32
eOp<T1, eop_type>::get_n_rows() const
{
return (is_generator<eop_type>::value == false) ? P.get_n_rows() : aux_u3
2_a;
}
template<typename T1, typename eop_type>
arma_inline
u32
eOp<T1, eop_type>::get_n_cols() const
{
return (is_generator<eop_type>::value == false) ? P.get_n_cols() : aux_u3
2_b;
}
template<typename T1, typename eop_type>
arma_inline
u32
eOp<T1, eop_type>::get_n_elem() const
{
return (is_generator<eop_type>::value == false) ? P.get_n_elem() : (aux_u
32_a * aux_u32_b);
}
template<typename T1, typename eop_type>
arma_inline
typename T1::elem_type
eOp<T1, eop_type>::operator[] (const u32 i) const
{
typedef typename T1::elem_type eT;
if(is_generator<eop_type>::value == true)
{
if(is_same_type<eop_type, eop_ones_diag>::value == true)
{
return ((i % get_n_rows()) == (i / get_n_rows())) ? eT(1) : eT(0);
}
else
{
return eop_aux::generate<eT,eop_type>();
}
}
else
{
return eop_core<eop_type>::process(P[i], aux);
}
}
template<typename T1, typename eop_type>
arma_inline
typename T1::elem_type
eOp<T1, eop_type>::at(const u32 row, const u32 col) const
{
typedef typename T1::elem_type eT;
if(is_generator<eop_type>::value == true)
{
if(is_same_type<eop_type, eop_ones_diag>::value == true)
{
return (row == col) ? eT(1) : eT(0);
}
else
{
return eop_aux::generate<eT,eop_type>();
}
}
else
{
return eop_core<eop_type>::process(P.at(row, col), aux);
}
}
//! @} //! @}
 End of changes. 9 change blocks. 
18 lines changed or deleted 81 lines changed or added


 eOp_proto.hpp   eOp_proto.hpp 
skipping to change at line 26 skipping to change at line 26
//! \addtogroup eOp //! \addtogroup eOp
//! @{ //! @{
template<typename T1, typename eop_type> template<typename T1, typename eop_type>
class eOp : public Base<typename T1::elem_type, eOp<T1, eop_type> > class eOp : public Base<typename T1::elem_type, eOp<T1, eop_type> >
{ {
public: public:
typedef typename T1::elem_type elem_type; typedef typename T1::elem_type elem_type;
typedef typename get_pod_type<elem_type>::result pod_type; typedef typename get_pod_type<elem_type>::result pod_type;
typedef Proxy<T1> proxy_type;
const Proxy<T1> P; arma_aligned const Proxy<T1> P;
const elem_type aux; //!< storage of auxiliary data, user defined arma_aligned const elem_type aux; //!< storage of auxiliary data,
format user defined format
const u32 aux_u32_a; //!< storage of auxiliary data, u32 format arma_aligned const u32 aux_u32_a; //!< storage of auxiliary data,
const u32 aux_u32_b; //!< storage of auxiliary data, u32 format u32 format
arma_aligned const u32 aux_u32_b; //!< storage of auxiliary data,
u32 format
inline ~eOp(); inline ~eOp();
inline explicit eOp(const Base<typename T1::elem_type, T1>& in_m); inline explicit eOp(const Base<typename T1::elem_type, T1>& in_m);
inline eOp(const Base<typename T1::elem_type, T1>& in_m, const e lem_type in_aux); inline eOp(const Base<typename T1::elem_type, T1>& in_m, const e lem_type in_aux);
inline eOp(const Base<typename T1::elem_type, T1>& in_m, const u 32 in_aux_u32_a, const u32 in_aux_u32_b); inline eOp(const Base<typename T1::elem_type, T1>& in_m, const u 32 in_aux_u32_a, const u32 in_aux_u32_b);
inline eOp(const Base<typename T1::elem_type, T1>& in_m, const e lem_type in_aux, const u32 in_aux_u32_a, const u32 in_aux_u32_b); inline eOp(const Base<typename T1::elem_type, T1>& in_m, const e lem_type in_aux, const u32 in_aux_u32_a, const u32 in_aux_u32_b);
inline eOp(const u32 in_n_rows, const u32 in_n_cols); inline eOp(const u32 in_n_rows, const u32 in_n_cols);
arma_inline u32 get_n_rows() const;
arma_inline u32 get_n_cols() const;
arma_inline u32 get_n_elem() const;
arma_inline elem_type operator[] (const u32 i) const;
arma_inline elem_type at (const u32 row, const u32 col) const;
}; };
//! @} //! @}
 End of changes. 3 change blocks. 
5 lines changed or deleted 14 lines changed or added


 eglue_core_meat.hpp   eglue_core_meat.hpp 
skipping to change at line 19 skipping to change at line 19
// 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 eglue_core //! \addtogroup eglue_core
//! @{ //! @{
class eglue_plus : public eglue_core<eglue_plus>
{
public:
inline static const char* text() { return "addition"; }
};
class eglue_minus : public eglue_core<eglue_minus>
{
public:
inline static const char* text() { return "subtraction"; }
};
class eglue_div : public eglue_core<eglue_div>
{
public:
inline static const char* text() { return "element-wise division"; }
};
class eglue_schur : public eglue_core<eglue_schur>
{
public:
inline static const char* text() { return "element-wise multiplication";
}
};
//
// matrices
template<typename eglue_type> template<typename eglue_type>
template<typename T1, typename T2> template<typename T1, typename T2>
arma_inline arma_hot
typename T1::elem_type inline
eglue_core<eglue_type>::get_elem(const eGlue<T1, T2, eglue_type>& x, const void
u32 i) eglue_core<eglue_type>::apply(Mat<typename T1::elem_type>& out, const eGlue
<T1, T2, eglue_type>& x)
{ {
// arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT; out.set_size(x.get_n_rows(), x.get_n_cols());
// the optimiser will keep only one return statement typedef typename T1::elem_type eT;
typedef typename Proxy<T1>::ea_type ea_type1;
typedef typename Proxy<T2>::ea_type ea_type2;
if(is_same_type<eglue_type, eglue_plus >::value == true) { return x. ea_type1 P1 = x.P1.get_ea();
P1[i] + x.P2[i]; } ea_type2 P2 = x.P2.get_ea();
else if(is_same_type<eglue_type, eglue_minus>::value == true) { return x.
P1[i] - x.P2[i]; } eT* out_mem = out.memptr();
else if(is_same_type<eglue_type, eglue_div >::value == true) { return x. const u32 n_elem = out.n_elem;
P1[i] / x.P2[i]; }
else if(is_same_type<eglue_type, eglue_schur>::value == true) { return x. #undef arma_applier
P1[i] * x.P2[i]; } #define arma_applier(operator) \
{\
u32 i,j;\
\
for(i=0, j=1; j<n_elem; i+=2, j+=2)\
{\
eT tmp_i = P1[i];\
eT tmp_j = P1[j];\
\
tmp_i operator##= P2[i];\
tmp_j operator##= P2[j];\
\
out_mem[i] = tmp_i;\
out_mem[j] = tmp_j;\
}\
\
if(i < n_elem)\
{\
out_mem[i] = P1[i] operator P2[i];\
}\
}
if(is_same_type<eglue_type, eglue_plus >::value == true) { arma_appl
ier(+); }
else if(is_same_type<eglue_type, eglue_minus>::value == true) { arma_appl
ier(-); }
else if(is_same_type<eglue_type, eglue_div >::value == true) { arma_appl
ier(/); }
else if(is_same_type<eglue_type, eglue_schur>::value == true) { arma_appl
ier(*); }
else else
{ {
arma_stop("eglue_core::get_elem(): unhandled eglue_type"); arma_stop("eglue_core::apply_proxy(): unhandled eglue_type");
return eT(0);
} }
} }
template<typename eglue_type> template<typename eglue_type>
template<typename T1, typename T2> template<typename T1, typename T2>
arma_inline arma_hot
typename T1::elem_type inline
eglue_core<eglue_type>::get_elem(const eGlue<T1, T2, eglue_type>& x, const void
u32 row, const u32 col) eglue_core<eglue_type>::apply_inplace_plus(Mat<typename T1::elem_type>& out
{ , const eGlue<T1, T2, eglue_type>& x)
// arma_extra_debug_sigprint(); {
arma_extra_debug_sigprint();
typedef typename T1::elem_type eT;
arma_debug_assert_same_size(out, x.P1, "addition");
if(is_same_type<eglue_type, eglue_plus >::value == true) { return x.
P1.at(row,col) + x.P2.at(row,col); } typedef typename T1::elem_type eT;
else if(is_same_type<eglue_type, eglue_minus>::value == true) { return x. typedef typename Proxy<T1>::ea_type ea_type1;
P1.at(row,col) - x.P2.at(row,col); } typedef typename Proxy<T2>::ea_type ea_type2;
else if(is_same_type<eglue_type, eglue_div >::value == true) { return x.
P1.at(row,col) / x.P2.at(row,col); } ea_type1 P1 = x.P1.get_ea();
else if(is_same_type<eglue_type, eglue_schur>::value == true) { return x. ea_type2 P2 = x.P2.get_ea();
P1.at(row,col) * x.P2.at(row,col); }
eT* out_mem = out.memptr();
const u32 n_elem = out.n_elem;
#undef arma_applier
#define arma_applier(operator) \
{\
u32 i,j;\
\
for(i=0, j=1; j<n_elem; i+=2, j+=2)\
{\
eT tmp_i = P1[i];\
eT tmp_j = P1[j];\
\
tmp_i operator##= P2[i];\
tmp_j operator##= P2[j];\
\
out_mem[i] += tmp_i;\
out_mem[j] += tmp_j;\
}\
\
if(i < n_elem)\
{\
out_mem[i] += P1[i] operator P2[i];\
}\
}
if(is_same_type<eglue_type, eglue_plus >::value == true) { arma_appl
ier(+); }
else if(is_same_type<eglue_type, eglue_minus>::value == true) { arma_appl
ier(-); }
else if(is_same_type<eglue_type, eglue_div >::value == true) { arma_appl
ier(/); }
else if(is_same_type<eglue_type, eglue_schur>::value == true) { arma_appl
ier(*); }
else else
{ {
arma_stop("eglue_core::get_elem(): unhandled eglue_type"); arma_stop("eglue_core::apply_inplace_plus(): unhandled eglue_type");
return eT(0);
} }
} }
template<typename eglue_type> template<typename eglue_type>
template<typename T1, typename T2> template<typename T1, typename T2>
arma_inline arma_hot
inline
void void
eglue_core<eglue_type>::apply(Mat<typename T1::elem_type>& out, const eGlue <T1, T2, eglue_type>& x) eglue_core<eglue_type>::apply_inplace_minus(Mat<typename T1::elem_type>& ou t, const eGlue<T1, T2, eglue_type>& x)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
if( (is_Mat<T1>::value == true) && (is_Mat<T2>::value == true) ) arma_debug_assert_same_size(out, x.P1, "subtraction");
{
eglue_core<eglue_type>::apply_unwrap(out, x); typedef typename T1::elem_type eT;
typedef typename Proxy<T1>::ea_type ea_type1;
typedef typename Proxy<T2>::ea_type ea_type2;
ea_type1 P1 = x.P1.get_ea();
ea_type2 P2 = x.P2.get_ea();
eT* out_mem = out.memptr();
const u32 n_elem = out.n_elem;
#undef arma_applier
#define arma_applier(operator) \
{\
u32 i,j;\
\
for(i=0, j=1; j<n_elem; i+=2, j+=2)\
{\
eT tmp_i = P1[i];\
eT tmp_j = P1[j];\
\
tmp_i operator##= P2[i];\
tmp_j operator##= P2[j];\
\
out_mem[i] -= tmp_i;\
out_mem[j] -= tmp_j;\
}\
\
if(i < n_elem)\
{\
out_mem[i] -= P1[i] operator P2[i];\
}\
} }
if(is_same_type<eglue_type, eglue_plus >::value == true) { arma_appl
ier(+); }
else if(is_same_type<eglue_type, eglue_minus>::value == true) { arma_appl
ier(-); }
else if(is_same_type<eglue_type, eglue_div >::value == true) { arma_appl
ier(/); }
else if(is_same_type<eglue_type, eglue_schur>::value == true) { arma_appl
ier(*); }
else else
{ {
eglue_core<eglue_type>::apply_proxy(out, x); arma_stop("eglue_core::apply_inplace_minus(): unhandled eglue_type");
} }
} }
template<typename eglue_type> template<typename eglue_type>
template<typename T1, typename T2> template<typename T1, typename T2>
arma_hot arma_hot
inline inline
void void
eglue_core<eglue_type>::apply_proxy(Mat<typename T1::elem_type>& out, const eGlue<T1, T2, eglue_type>& x) eglue_core<eglue_type>::apply_inplace_schur(Mat<typename T1::elem_type>& ou t, const eGlue<T1, T2, eglue_type>& x)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
// eglue_type::apply_proxy() function is not allowed to unwrap things arma_debug_assert_same_size(out, x.P1, "element-wise multiplication");
// (in order to get the input into a common format).
// the proxy class is already providing objects with element access
typedef typename T1::elem_type eT;
const Proxy<T1>& P1 = x.P1; typedef typename T1::elem_type eT;
const Proxy<T2>& P2 = x.P2; typedef typename Proxy<T1>::ea_type ea_type1;
typedef typename Proxy<T2>::ea_type ea_type2;
out.set_size(P1.n_rows, P1.n_cols); ea_type1 P1 = x.P1.get_ea();
ea_type2 P2 = x.P2.get_ea();
eT* out_mem = out.memptr(); eT* out_mem = out.memptr();
const u32 n_elem = P1.n_elem; const u32 n_elem = out.n_elem;
#undef arma_applier
#define arma_applier(operator) \
{\
u32 i,j;\
\
for(i=0, j=1; j<n_elem; i+=2, j+=2)\
{\
eT tmp_i = P1[i];\
eT tmp_j = P1[j];\
\
tmp_i operator##= P2[i];\
tmp_j operator##= P2[j];\
\
out_mem[i] *= tmp_i;\
out_mem[j] *= tmp_j;\
}\
\
if(i < n_elem)\
{\
out_mem[i] *= P1[i] operator P2[i];\
}\
}
if(is_same_type<eglue_type, eglue_plus >::value == true) for(u32 i=0 if(is_same_type<eglue_type, eglue_plus >::value == true) { arma_appl
; i<n_elem; ++i) { out_mem[i] = P1[i] + P2[i]; } ier(+); }
else if(is_same_type<eglue_type, eglue_minus>::value == true) for(u32 i=0 else if(is_same_type<eglue_type, eglue_minus>::value == true) { arma_appl
; i<n_elem; ++i) { out_mem[i] = P1[i] - P2[i]; } ier(-); }
else if(is_same_type<eglue_type, eglue_div >::value == true) for(u32 i=0 else if(is_same_type<eglue_type, eglue_div >::value == true) { arma_appl
; i<n_elem; ++i) { out_mem[i] = P1[i] / P2[i]; } ier(/); }
else if(is_same_type<eglue_type, eglue_schur>::value == true) for(u32 i=0 else if(is_same_type<eglue_type, eglue_schur>::value == true) { arma_appl
; i<n_elem; ++i) { out_mem[i] = P1[i] * P2[i]; } ier(*); }
else else
{ {
arma_stop("eglue_core::apply_proxy(): unhandled eglue_type"); arma_stop("eglue_core::apply_inplace_schur(): unhandled eglue_type");
} }
} }
template<typename eglue_type> template<typename eglue_type>
template<typename T1, typename T2> template<typename T1, typename T2>
arma_hot arma_hot
inline inline
void void
eglue_core<eglue_type>::apply_unwrap(Mat<typename T1::elem_type>& out, cons t eGlue<T1, T2, eglue_type>& x) eglue_core<eglue_type>::apply_inplace_div(Mat<typename T1::elem_type>& out, const eGlue<T1, T2, eglue_type>& x)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT; arma_debug_assert_same_size(out, x.P1, "element-wise division");
typedef typename T1::elem_type eT;
typedef typename Proxy<T1>::ea_type ea_type1;
typedef typename Proxy<T2>::ea_type ea_type2;
ea_type1 P1 = x.P1.get_ea();
ea_type2 P2 = x.P2.get_ea();
const unwrap<typename Proxy<T1>::stored_type> tmp1(x.P1.Q); eT* out_mem = out.memptr();
const unwrap<typename Proxy<T2>::stored_type> tmp2(x.P2.Q); const u32 n_elem = out.n_elem;
#undef arma_applier
#define arma_applier(operator) \
{\
u32 i,j;\
\
for(i=0, j=1; j<n_elem; i+=2, j+=2)\
{\
eT tmp_i = P1[i];\
eT tmp_j = P1[j];\
\
tmp_i operator##= P2[i];\
tmp_j operator##= P2[j];\
\
out_mem[i] /= tmp_i;\
out_mem[j] /= tmp_j;\
}\
\
if(i < n_elem)\
{\
out_mem[i] /= P1[i] operator P2[i];\
}\
}
const Mat<eT>& A = tmp1.M; if(is_same_type<eglue_type, eglue_plus >::value == true) { arma_appl
const Mat<eT>& B = tmp2.M; ier(+); }
else if(is_same_type<eglue_type, eglue_minus>::value == true) { arma_appl
ier(-); }
else if(is_same_type<eglue_type, eglue_div >::value == true) { arma_appl
ier(/); }
else if(is_same_type<eglue_type, eglue_schur>::value == true) { arma_appl
ier(*); }
else
{
arma_stop("eglue_core::apply_inplace_div(): unhandled eglue_type");
}
}
out.set_size(A.n_rows, A.n_cols); //
// cubes
template<typename eglue_type>
template<typename T1, typename T2>
arma_hot
inline
void
eglue_core<eglue_type>::apply(Cube<typename T1::elem_type>& out, const eGlu
eCube<T1, T2, eglue_type>& x)
{
arma_extra_debug_sigprint();
out.set_size(x.get_n_rows(), x.get_n_cols(), x.get_n_slices());
typedef typename T1::elem_type eT;
typedef typename ProxyCube<T1>::ea_type ea_type1;
typedef typename ProxyCube<T2>::ea_type ea_type2;
ea_type1 P1 = x.P1.get_ea();
ea_type2 P2 = x.P2.get_ea();
eT* out_mem = out.memptr(); eT* out_mem = out.memptr();
const eT* A_mem = A.memptr(); const u32 n_elem = out.n_elem;
const eT* B_mem = B.memptr();
const u32 n_elem = A.n_elem; #undef arma_applier
#define arma_applier(operator) \
if(is_same_type<eglue_type, eglue_plus >::value == true) for(u32 i=0 {\
; i<n_elem; ++i) { out_mem[i] = A_mem[i] + B_mem[i]; } u32 i,j;\
else if(is_same_type<eglue_type, eglue_minus>::value == true) for(u32 i=0 \
; i<n_elem; ++i) { out_mem[i] = A_mem[i] - B_mem[i]; } for(i=0, j=1; j<n_elem; i+=2, j+=2)\
else if(is_same_type<eglue_type, eglue_div >::value == true) for(u32 i=0 {\
; i<n_elem; ++i) { out_mem[i] = A_mem[i] / B_mem[i]; } eT tmp_i = P1[i];\
else if(is_same_type<eglue_type, eglue_schur>::value == true) for(u32 i=0 eT tmp_j = P1[j];\
; i<n_elem; ++i) { out_mem[i] = A_mem[i] * B_mem[i]; } \
tmp_i operator##= P2[i];\
tmp_j operator##= P2[j];\
\
out_mem[i] = tmp_i;\
out_mem[j] = tmp_j;\
}\
\
if(i < n_elem)\
{\
out_mem[i] = P1[i] operator P2[i];\
}\
}
if(is_same_type<eglue_type, eglue_plus >::value == true) { arma_appl
ier(+); }
else if(is_same_type<eglue_type, eglue_minus>::value == true) { arma_appl
ier(-); }
else if(is_same_type<eglue_type, eglue_div >::value == true) { arma_appl
ier(/); }
else if(is_same_type<eglue_type, eglue_schur>::value == true) { arma_appl
ier(*); }
else else
{ {
arma_stop("eglue_core::apply_unwrap(): unhandled eglue_type"); arma_stop("eglue_core::apply_proxy(): unhandled eglue_type");
} }
} }
template<typename eglue_type> template<typename eglue_type>
template<typename T1, typename T2> template<typename T1, typename T2>
arma_hot arma_hot
inline inline
void void
eglue_core<eglue_type>::apply_inplace_plus(Mat<typename T1::elem_type>& out , const eGlue<T1, T2, eglue_type>& x) eglue_core<eglue_type>::apply_inplace_plus(Cube<typename T1::elem_type>& ou t, const eGlueCube<T1, T2, eglue_type>& x)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT; arma_debug_assert_same_size(out.n_rows, out.n_cols, out.n_slices, x.get_n _rows(), x.get_n_cols(), x.get_n_slices(), "addition");
const Proxy<T1>& P1 = x.P1; typedef typename T1::elem_type eT;
const Proxy<T2>& P2 = x.P2; typedef typename ProxyCube<T1>::ea_type ea_type1;
typedef typename ProxyCube<T2>::ea_type ea_type2;
arma_assert_same_size(out.n_rows, out.n_cols, P1.n_rows, P1.n_cols, "matr ea_type1 P1 = x.P1.get_ea();
ix addition"); ea_type2 P2 = x.P2.get_ea();
const u32 n_elem = out.n_elem;
eT* out_mem = out.memptr(); eT* out_mem = out.memptr();
const u32 n_elem = P1.n_elem;
if(is_same_type<eglue_type, eglue_plus >::value == true) for(u32 i=0 #undef arma_applier
; i<n_elem; ++i) { out_mem[i] += P1[i] + P2[i]; } #define arma_applier(operator) \
else if(is_same_type<eglue_type, eglue_minus>::value == true) for(u32 i=0 {\
; i<n_elem; ++i) { out_mem[i] += P1[i] - P2[i]; } u32 i,j;\
else if(is_same_type<eglue_type, eglue_div >::value == true) for(u32 i=0 \
; i<n_elem; ++i) { out_mem[i] += P1[i] / P2[i]; } for(i=0, j=1; j<n_elem; i+=2, j+=2)\
else if(is_same_type<eglue_type, eglue_schur>::value == true) for(u32 i=0 {\
; i<n_elem; ++i) { out_mem[i] += P1[i] * P2[i]; } eT tmp_i = P1[i];\
eT tmp_j = P1[j];\
\
tmp_i operator##= P2[i];\
tmp_j operator##= P2[j];\
\
out_mem[i] += tmp_i;\
out_mem[j] += tmp_j;\
}\
\
if(i < n_elem)\
{\
out_mem[i] += P1[i] operator P2[i];\
}\
}
if(is_same_type<eglue_type, eglue_plus >::value == true) { arma_appl
ier(+); }
else if(is_same_type<eglue_type, eglue_minus>::value == true) { arma_appl
ier(-); }
else if(is_same_type<eglue_type, eglue_div >::value == true) { arma_appl
ier(/); }
else if(is_same_type<eglue_type, eglue_schur>::value == true) { arma_appl
ier(*); }
else else
{ {
arma_stop("eglue_core::apply_inplace_plus(): unhandled eglue_type"); arma_stop("eglue_core::apply_inplace_plus(): unhandled eglue_type");
} }
} }
template<typename eglue_type> template<typename eglue_type>
template<typename T1, typename T2> template<typename T1, typename T2>
arma_hot arma_hot
inline inline
void void
eglue_core<eglue_type>::apply_inplace_minus(Mat<typename T1::elem_type>& ou t, const eGlue<T1, T2, eglue_type>& x) eglue_core<eglue_type>::apply_inplace_minus(Cube<typename T1::elem_type>& o ut, const eGlueCube<T1, T2, eglue_type>& x)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT; arma_debug_assert_same_size(out.n_rows, out.n_cols, out.n_slices, x.get_n _rows(), x.get_n_cols(), x.get_n_slices(), "subtraction");
const Proxy<T1>& P1 = x.P1; typedef typename T1::elem_type eT;
const Proxy<T2>& P2 = x.P2; typedef typename ProxyCube<T1>::ea_type ea_type1;
typedef typename ProxyCube<T2>::ea_type ea_type2;
arma_assert_same_size(out.n_rows, out.n_cols, P1.n_rows, P1.n_cols, "matr ea_type1 P1 = x.P1.get_ea();
ix subtraction"); ea_type2 P2 = x.P2.get_ea();
const u32 n_elem = out.n_elem;
eT* out_mem = out.memptr(); eT* out_mem = out.memptr();
const u32 n_elem = P1.n_elem;
if(is_same_type<eglue_type, eglue_plus >::value == true) for(u32 i=0 #undef arma_applier
; i<n_elem; ++i) { out_mem[i] -= P1[i] + P2[i]; } #define arma_applier(operator) \
else if(is_same_type<eglue_type, eglue_minus>::value == true) for(u32 i=0 {\
; i<n_elem; ++i) { out_mem[i] -= P1[i] - P2[i]; } u32 i,j;\
else if(is_same_type<eglue_type, eglue_div >::value == true) for(u32 i=0 \
; i<n_elem; ++i) { out_mem[i] -= P1[i] / P2[i]; } for(i=0, j=1; j<n_elem; i+=2, j+=2)\
else if(is_same_type<eglue_type, eglue_schur>::value == true) for(u32 i=0 {\
; i<n_elem; ++i) { out_mem[i] -= P1[i] * P2[i]; } eT tmp_i = P1[i];\
eT tmp_j = P1[j];\
\
tmp_i operator##= P2[i];\
tmp_j operator##= P2[j];\
\
out_mem[i] -= tmp_i;\
out_mem[j] -= tmp_j;\
}\
\
if(i < n_elem)\
{\
out_mem[i] -= P1[i] operator P2[i];\
}\
}
if(is_same_type<eglue_type, eglue_plus >::value == true) { arma_appl
ier(+); }
else if(is_same_type<eglue_type, eglue_minus>::value == true) { arma_appl
ier(-); }
else if(is_same_type<eglue_type, eglue_div >::value == true) { arma_appl
ier(/); }
else if(is_same_type<eglue_type, eglue_schur>::value == true) { arma_appl
ier(*); }
else else
{ {
arma_stop("eglue_core::apply_inplace_minus(): unhandled eglue_type"); arma_stop("eglue_core::apply_inplace_minus(): unhandled eglue_type");
} }
} }
template<typename eglue_type> template<typename eglue_type>
template<typename T1, typename T2> template<typename T1, typename T2>
arma_hot arma_hot
inline inline
void void
eglue_core<eglue_type>::apply_inplace_schur(Mat<typename T1::elem_type>& ou t, const eGlue<T1, T2, eglue_type>& x) eglue_core<eglue_type>::apply_inplace_schur(Cube<typename T1::elem_type>& o ut, const eGlueCube<T1, T2, eglue_type>& x)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT; arma_debug_assert_same_size(out.n_rows, out.n_cols, out.n_slices, x.get_n _rows(), x.get_n_cols(), x.get_n_slices(), "element-wise multiplication");
const Proxy<T1>& P1 = x.P1; typedef typename T1::elem_type eT;
const Proxy<T2>& P2 = x.P2; typedef typename ProxyCube<T1>::ea_type ea_type1;
typedef typename ProxyCube<T2>::ea_type ea_type2;
arma_assert_same_size(out.n_rows, out.n_cols, P1.n_rows, P1.n_cols, "elem ea_type1 P1 = x.P1.get_ea();
ent-wise matrix multiplication"); ea_type2 P2 = x.P2.get_ea();
const u32 n_elem = out.n_elem;
eT* out_mem = out.memptr(); eT* out_mem = out.memptr();
const u32 n_elem = P1.n_elem;
if(is_same_type<eglue_type, eglue_plus >::value == true) for(u32 i=0 #undef arma_applier
; i<n_elem; ++i) { out_mem[i] *= P1[i] + P2[i]; } #define arma_applier(operator) \
else if(is_same_type<eglue_type, eglue_minus>::value == true) for(u32 i=0 {\
; i<n_elem; ++i) { out_mem[i] *= P1[i] - P2[i]; } u32 i,j;\
else if(is_same_type<eglue_type, eglue_div >::value == true) for(u32 i=0 \
; i<n_elem; ++i) { out_mem[i] *= P1[i] / P2[i]; } for(i=0, j=1; j<n_elem; i+=2, j+=2)\
else if(is_same_type<eglue_type, eglue_schur>::value == true) for(u32 i=0 {\
; i<n_elem; ++i) { out_mem[i] *= P1[i] * P2[i]; } eT tmp_i = P1[i];\
eT tmp_j = P1[j];\
\
tmp_i operator##= P2[i];\
tmp_j operator##= P2[j];\
\
out_mem[i] *= tmp_i;\
out_mem[j] *= tmp_j;\
}\
\
if(i < n_elem)\
{\
out_mem[i] *= P1[i] operator P2[i];\
}\
}
if(is_same_type<eglue_type, eglue_plus >::value == true) { arma_appl
ier(+); }
else if(is_same_type<eglue_type, eglue_minus>::value == true) { arma_appl
ier(-); }
else if(is_same_type<eglue_type, eglue_div >::value == true) { arma_appl
ier(/); }
else if(is_same_type<eglue_type, eglue_schur>::value == true) { arma_appl
ier(*); }
else else
{ {
arma_stop("eglue_core::apply_inplace_schur(): unhandled eglue_type"); arma_stop("eglue_core::apply_inplace_schur(): unhandled eglue_type");
} }
} }
template<typename eglue_type> template<typename eglue_type>
template<typename T1, typename T2> template<typename T1, typename T2>
arma_hot arma_hot
inline inline
void void
eglue_core<eglue_type>::apply_inplace_div(Mat<typename T1::elem_type>& out, const eGlue<T1, T2, eglue_type>& x) eglue_core<eglue_type>::apply_inplace_div(Cube<typename T1::elem_type>& out , const eGlueCube<T1, T2, eglue_type>& x)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT; arma_debug_assert_same_size(out.n_rows, out.n_cols, out.n_slices, x.get_n _rows(), x.get_n_cols(), x.get_n_slices(), "element-wise division");
const Proxy<T1>& P1 = x.P1; typedef typename T1::elem_type eT;
const Proxy<T2>& P2 = x.P2; typedef typename ProxyCube<T1>::ea_type ea_type1;
typedef typename ProxyCube<T2>::ea_type ea_type2;
arma_assert_same_size(out.n_rows, out.n_cols, P1.n_rows, P1.n_cols, "elem ea_type1 P1 = x.P1.get_ea();
ent-wise matrix division"); ea_type2 P2 = x.P2.get_ea();
const u32 n_elem = out.n_elem;
eT* out_mem = out.memptr(); eT* out_mem = out.memptr();
const u32 n_elem = P1.n_elem;
if(is_same_type<eglue_type, eglue_plus >::value == true) for(u32 i=0 #undef arma_applier
; i<n_elem; ++i) { out_mem[i] /= P1[i] + P2[i]; } #define arma_applier(operator) \
else if(is_same_type<eglue_type, eglue_minus>::value == true) for(u32 i=0 {\
; i<n_elem; ++i) { out_mem[i] /= P1[i] - P2[i]; } u32 i,j;\
else if(is_same_type<eglue_type, eglue_div >::value == true) for(u32 i=0 \
; i<n_elem; ++i) { out_mem[i] /= P1[i] / P2[i]; } for(i=0, j=1; j<n_elem; i+=2, j+=2)\
else if(is_same_type<eglue_type, eglue_schur>::value == true) for(u32 i=0 {\
; i<n_elem; ++i) { out_mem[i] /= P1[i] * P2[i]; } eT tmp_i = P1[i];\
eT tmp_j = P1[j];\
\
tmp_i operator##= P2[i];\
tmp_j operator##= P2[j];\
\
out_mem[i] /= tmp_i;\
out_mem[j] /= tmp_j;\
}\
\
if(i < n_elem)\
{\
out_mem[i] /= P1[i] operator P2[i];\
}\
}
if(is_same_type<eglue_type, eglue_plus >::value == true) { arma_appl
ier(+); }
else if(is_same_type<eglue_type, eglue_minus>::value == true) { arma_appl
ier(-); }
else if(is_same_type<eglue_type, eglue_div >::value == true) { arma_appl
ier(/); }
else if(is_same_type<eglue_type, eglue_schur>::value == true) { arma_appl
ier(*); }
else else
{ {
arma_stop("eglue_core::apply_inplace_div(): unhandled eglue_type"); arma_stop("eglue_core::apply_inplace_div(): unhandled eglue_type");
} }
} }
//! @} //! @}
 End of changes. 56 change blocks. 
141 lines changed or deleted 476 lines changed or added


 eglue_core_proto.hpp   eglue_core_proto.hpp 
skipping to change at line 23 skipping to change at line 23
// 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 eglue_core //! \addtogroup eglue_core
//! @{ //! @{
template<typename eglue_type> template<typename eglue_type>
struct eglue_core struct eglue_core
{ {
template<typename T1, typename T2> arma_inline static typename T1::elem_t // matrices
ype get_elem(const eGlue<T1, T2, eglue_type>& x, const u32 i);
template<typename T1, typename T2> arma_inline static typename T1::elem_t
ype get_elem(const eGlue<T1, T2, eglue_type>& x, const u32 row, const u32 c
ol);
template<typename T1, typename T2> arma_inline static void apply(Mat<type template<typename T1, typename T2> arma_hot inline static void apply(Mat<
name T1::elem_type>& out, const eGlue<T1, T2, eglue_type>& x); typename T1::elem_type>& out, const eGlue<T1, T2, eglue_type>& x);
template<typename T1, typename T2> arma_hot inline static void apply_prox
y (Mat<typename T1::elem_type>& out, const eGlue<T1, T2, eglue_type>& x);
template<typename T1, typename T2> arma_hot inline static void apply_unwr
ap(Mat<typename T1::elem_type>& out, const eGlue<T1, T2, eglue_type>& x);
template<typename T1, typename T2> arma_hot inline static void apply_inpl ace_plus (Mat<typename T1::elem_type>& out, const eGlue<T1, T2, eglue_type> & x); template<typename T1, typename T2> arma_hot inline static void apply_inpl ace_plus (Mat<typename T1::elem_type>& out, const eGlue<T1, T2, eglue_type> & x);
template<typename T1, typename T2> arma_hot inline static void apply_inpl ace_minus(Mat<typename T1::elem_type>& out, const eGlue<T1, T2, eglue_type> & x); template<typename T1, typename T2> arma_hot inline static void apply_inpl ace_minus(Mat<typename T1::elem_type>& out, const eGlue<T1, T2, eglue_type> & x);
template<typename T1, typename T2> arma_hot inline static void apply_inpl ace_schur(Mat<typename T1::elem_type>& out, const eGlue<T1, T2, eglue_type> & x); template<typename T1, typename T2> arma_hot inline static void apply_inpl ace_schur(Mat<typename T1::elem_type>& out, const eGlue<T1, T2, eglue_type> & x);
template<typename T1, typename T2> arma_hot inline static void apply_inpl ace_div (Mat<typename T1::elem_type>& out, const eGlue<T1, T2, eglue_type> & x); template<typename T1, typename T2> arma_hot inline static void apply_inpl ace_div (Mat<typename T1::elem_type>& out, const eGlue<T1, T2, eglue_type> & x);
// cubes
template<typename T1, typename T2> arma_hot inline static void apply(Cube
<typename T1::elem_type>& out, const eGlueCube<T1, T2, eglue_type>& x);
template<typename T1, typename T2> arma_hot inline static void apply_inpl
ace_plus (Cube<typename T1::elem_type>& out, const eGlueCube<T1, T2, eglue_
type>& x);
template<typename T1, typename T2> arma_hot inline static void apply_inpl
ace_minus(Cube<typename T1::elem_type>& out, const eGlueCube<T1, T2, eglue_
type>& x);
template<typename T1, typename T2> arma_hot inline static void apply_inpl
ace_schur(Cube<typename T1::elem_type>& out, const eGlueCube<T1, T2, eglue_
type>& x);
template<typename T1, typename T2> arma_hot inline static void apply_inpl
ace_div (Cube<typename T1::elem_type>& out, const eGlueCube<T1, T2, eglue_
type>& x);
}; };
class eglue_plus; class eglue_plus;
class eglue_minus; class eglue_minus;
class eglue_div; class eglue_div;
class eglue_schur; class eglue_schur;
//! @} //! @}
 End of changes. 3 change blocks. 
12 lines changed or deleted 20 lines changed or added


 eop_aux.hpp   eop_aux.hpp 
skipping to change at line 162 skipping to change at line 162
template<typename eT> arma_inline static typename arma_float_or_cx_only<e T>::result cos (const eT x) { return std::cos (x); } template<typename eT> arma_inline static typename arma_float_or_cx_only<e T>::result cos (const eT x) { return std::cos (x); }
template<typename eT> arma_inline static typename arma_float_or_cx_only<e T>::result sin (const eT x) { return std::sin (x); } template<typename eT> arma_inline static typename arma_float_or_cx_only<e T>::result sin (const eT x) { return std::sin (x); }
template<typename eT> arma_inline static typename arma_float_or_cx_only<e T>::result tan (const eT x) { return std::tan (x); } template<typename eT> arma_inline static typename arma_float_or_cx_only<e T>::result tan (const eT x) { return std::tan (x); }
template<typename eT> arma_inline static typename arma_float_or_cx_only<e T>::result cosh (const eT x) { return std::cosh (x); } template<typename eT> arma_inline static typename arma_float_or_cx_only<e T>::result cosh (const eT x) { return std::cosh (x); }
template<typename eT> arma_inline static typename arma_float_or_cx_only<e T>::result sinh (const eT x) { return std::sinh (x); } template<typename eT> arma_inline static typename arma_float_or_cx_only<e T>::result sinh (const eT x) { return std::sinh (x); }
template<typename eT> arma_inline static typename arma_float_or_cx_only<e T>::result tanh (const eT x) { return std::tanh (x); } template<typename eT> arma_inline static typename arma_float_or_cx_only<e T>::result tanh (const eT x) { return std::tanh (x); }
template<typename eT> arma_inline static typename arma_unsigned_integral_ only<eT>::result neg (const eT x) { return x; } template<typename eT> arma_inline static typename arma_unsigned_integral_ only<eT>::result neg (const eT x) { return x; }
template<typename eT> arma_inline static typename arma_signed_only<eT>::r esult neg (const eT x) { return -x; } template<typename eT> arma_inline static typename arma_signed_only<eT>::r esult neg (const eT x) { return -x; }
template<typename eT>
arma_inline
static
typename arma_integral_only<eT>::result
log2 (const eT x)
{
return eT( std::log(double(x))/ double(0.69314718055994530942) );
}
template<typename eT>
arma_inline
static
typename arma_float_or_cx_only<eT>::result
log2 (const eT x)
{
typedef typename get_pod_type<eT>::result T;
return std::log(x) / T(0.69314718055994530942);
}
template<typename eT>
arma_inline
static
typename arma_integral_only<eT>::result
exp10 (const eT x)
{
return eT( std::pow(double(10), double(x)) );
}
template<typename eT>
arma_inline
static
typename
arma_float_or_cx_only<eT>::result
exp10 (const eT x)
{
typedef typename get_pod_type<eT>::result T;
return std::pow( T(10), x);
}
template<typename eT>
arma_inline
static
typename arma_integral_only<eT>::result
exp2 (const eT x)
{
return eT( std::pow(double(2), double(x)) );
}
template<typename eT>
arma_inline
static
typename arma_float_or_cx_only<eT>::result
exp2 (const eT x)
{
typedef typename get_pod_type<eT>::result T;
return std::pow( T(2), x);
}
template<typename T1, typename T2> template<typename T1, typename T2>
arma_inline arma_inline
static static
typename arma_float_or_cx_only<T1>::result typename arma_float_or_cx_only<T1>::result
pow(const T1 base, const T2 exponent) pow(const T1 base, const T2 exponent)
{ {
return std::pow(base, exponent); return std::pow(base, exponent);
} }
template<typename T1, typename T2> template<typename T1, typename T2>
skipping to change at line 263 skipping to change at line 321
template<typename T> arma_inline static template<typename T> arma_inline static
typename arma_float_only<T>::result arma_abs(const std::comp lex<T> x) { return std::abs(x); } typename arma_float_only<T>::result arma_abs(const std::comp lex<T> x) { return std::abs(x); }
template<typename eT, typename eop_type> template<typename eT, typename eop_type>
arma_inline arma_inline
static static
eT eT
generate() generate()
{ {
if(is_same_type<eop_type, eop_randu >::value == true) { re if(is_same_type<eop_type, eop_ones_full>::value == true) { return
turn eT(eop_aux_randu<eT>()); } eT(1); }
else if(is_same_type<eop_type, eop_randn >::value == true) { re else if(is_same_type<eop_type, eop_zeros >::value == true) { return
turn eT(eop_aux_randn<eT>()); } eT(0); }
else if(is_same_type<eop_type, eop_zeros >::value == true) { re else if(is_same_type<eop_type, eop_randu >::value == true) { return
turn eT(0); } eT(eop_aux_randu<eT>()); }
else if(is_same_type<eop_type, eop_ones_full >::value == true) { re else if(is_same_type<eop_type, eop_randn >::value == true) { return
turn eT(1); } eT(eop_aux_randn<eT>()); }
else if(is_same_type<eop_type, eop_cube_randu >::value == true) { re else { return
turn eT(eop_aux_randu<eT>()); } eT(); }
else if(is_same_type<eop_type, eop_cube_randn >::value == true) { re
turn eT(eop_aux_randn<eT>()); }
else if(is_same_type<eop_type, eop_cube_zeros >::value == true) { re
turn eT(0); }
else if(is_same_type<eop_type, eop_cube_ones_full>::value == true) { re
turn eT(1); }
else { re
turn eT(0); }
} }
}; };
//! @} //! @}
 End of changes. 2 change blocks. 
18 lines changed or deleted 68 lines changed or added


 eop_core_meat.hpp   eop_core_meat.hpp 
skipping to change at line 19 skipping to change at line 19
// 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 eop_core //! \addtogroup eop_core
//! @{ //! @{
template<typename eop_type> //
template<typename T1> // matrices
arma_hot
arma_inline
typename T1::elem_type
eop_core<eop_type>::get_elem(const eOp<T1, eop_type>& x, const u32 i)
{
typedef typename T1::elem_type eT;
if(is_generator<eop_type>::value == true) { return eo
p_aux::generate<eT,eop_type>(); }
else if(is_same_type<eop_type, eop_ones_diag>::value == true) { return ((
i % x.P.n_rows) == (i / x.P.n_rows)) ? eT(1) : eT(0); }
else { return eo
p_core<eop_type>::process(x, x.P[i]); }
}
template<typename eop_type> template<typename eop_type>
template<typename T1> template<typename T1>
arma_hot arma_hot
arma_inline inline
typename T1::elem_type void
eop_core<eop_type>::get_elem(const eOp<T1, eop_type>& x, const u32 row, con eop_core<eop_type>::apply(Mat<typename T1::elem_type>& out, const eOp<T1, e
st u32 col) op_type>& x)
{ {
typedef typename T1::elem_type eT; arma_extra_debug_sigprint();
if(is_generator<eop_type>::value == true) { return eo
p_aux::generate<eT,eop_type>(); }
else if(is_same_type<eop_type, eop_ones_diag>::value == true) { return (r
ow == col) ? eT(1) : eT(0); }
else { return eo
p_core<eop_type>::process(x, x.P.at(row, col)); }
}
template<typename eop_type>
template<typename T1>
arma_hot
arma_inline
typename T1::elem_type
eop_core<eop_type>::process(const eOp<T1, eop_type>& x, const typename T1::
elem_type val)
{
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
// the optimiser will keep only one return statement const u32 n_rows = x.get_n_rows();
const u32 n_cols = x.get_n_cols();
const u32 n_elem = x.get_n_elem();
if(is_same_type<eop_type, eop_scalar_plus >::value == true) { r out.set_size(n_rows, n_cols);
eturn val + x.aux; }
else if(is_same_type<eop_type, eop_scalar_minus_pre >::value == true) { r
eturn x.aux - val; }
else if(is_same_type<eop_type, eop_scalar_minus_post>::value == true) { r
eturn val - x.aux; }
else if(is_same_type<eop_type, eop_scalar_times >::value == true) { r
eturn val * x.aux; }
else if(is_same_type<eop_type, eop_scalar_div_pre >::value == true) { r
eturn x.aux / val; }
else if(is_same_type<eop_type, eop_scalar_div_post >::value == true) { r
eturn val / x.aux; }
else if(is_same_type<eop_type, eop_square >::value == true) { r
eturn val*val; }
else if(is_same_type<eop_type, eop_neg >::value == true) { r
eturn eop_aux::neg(val); }
else if(is_same_type<eop_type, eop_sqrt >::value == true) { r
eturn eop_aux::sqrt(val); }
else if(is_same_type<eop_type, eop_log10 >::value == true) { r
eturn eop_aux::log10(val); }
else if(is_same_type<eop_type, eop_log >::value == true) { r
eturn eop_aux::log(val); }
else if(is_same_type<eop_type, eop_trunc_log >::value == true) { r
eturn arma::trunc_log(val); }
else if(is_same_type<eop_type, eop_exp >::value == true) { r
eturn eop_aux::exp(val); }
else if(is_same_type<eop_type, eop_trunc_exp >::value == true) { r
eturn arma::trunc_exp(val); }
else if(is_same_type<eop_type, eop_cos >::value == true) { r
eturn eop_aux::cos(val); }
else if(is_same_type<eop_type, eop_sin >::value == true) { r
eturn eop_aux::sin(val); }
else if(is_same_type<eop_type, eop_tan >::value == true) { r
eturn eop_aux::tan(val); }
else if(is_same_type<eop_type, eop_acos >::value == true) { r
eturn eop_aux::acos(val); }
else if(is_same_type<eop_type, eop_asin >::value == true) { r
eturn eop_aux::asin(val); }
else if(is_same_type<eop_type, eop_atan >::value == true) { r
eturn eop_aux::atan(val); }
else if(is_same_type<eop_type, eop_cosh >::value == true) { r
eturn eop_aux::cosh(val); }
else if(is_same_type<eop_type, eop_sinh >::value == true) { r
eturn eop_aux::sinh(val); }
else if(is_same_type<eop_type, eop_tanh >::value == true) { r
eturn eop_aux::tanh(val); }
else if(is_same_type<eop_type, eop_acosh >::value == true) { r
eturn eop_aux::acosh(val); }
else if(is_same_type<eop_type, eop_asinh >::value == true) { r
eturn eop_aux::asinh(val); }
else if(is_same_type<eop_type, eop_atanh >::value == true) { r
eturn eop_aux::atanh(val); }
else if(is_same_type<eop_type, eop_eps >::value == true) { r
eturn eop_aux::direct_eps(val); }
else if(is_same_type<eop_type, eop_abs >::value == true) { r
eturn eop_aux::arma_abs(val); }
else if(is_same_type<eop_type, eop_conj >::value == true) { r
eturn eop_aux::conj(val); }
else if(is_same_type<eop_type, eop_pow >::value == true) { r
eturn eop_aux::pow(val, x.aux); }
else if(is_same_type<eop_type, eop_pow_int >::value == true)
{
const int exponent = (x.aux_u32_b == 0) ? int(x.aux_u32_a) : -int(x.aux
_u32_a);
return eop_aux::pow_int(val, exponent); if(is_generator<eop_type>::value == true)
{
if(is_same_type<eop_type, eop_ones_diag>::value == true) { out.eye
(); }
else if(is_same_type<eop_type, eop_ones_full>::value == true) { out.one
s(); }
else if(is_same_type<eop_type, eop_zeros >::value == true) { out.zer
os(); }
else if(is_same_type<eop_type, eop_randu >::value == true) { out.ran
du(); }
else if(is_same_type<eop_type, eop_randn >::value == true) { out.ran
dn(); }
} }
else else
{ {
arma_stop("eop_core::process(): unhandled eop_type"); typedef typename Proxy<T1>::ea_type ea_type;
return eT(0);
const eT k = x.aux;
ea_type P = x.P.get_ea();
eT* out_mem = out.memptr();
u32 i,j;
for(i=0, j=1; j<n_elem; i+=2, j+=2)
{
const eT tmp_i = eop_core<eop_type>::process(P[i], k);
const eT tmp_j = eop_core<eop_type>::process(P[j], k);
out_mem[i] = tmp_i;
out_mem[j] = tmp_j;
}
if(i < n_elem)
{
out_mem[i] = eop_core<eop_type>::process(P[i], k);
}
} }
} }
template<typename eop_type> template<typename eop_type>
template<typename T1> template<typename T1>
arma_hot arma_hot
arma_inline inline
void void
eop_core<eop_type>::apply(Mat<typename T1::elem_type>& out, const eOp<T1, e op_type>& x) eop_core<eop_type>::apply_inplace_plus(Mat<typename T1::elem_type>& out, co nst eOp<T1, eop_type>& x)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
if(is_Mat<T1>::value == true) typedef typename T1::elem_type eT;
const u32 n_rows = x.get_n_rows();
const u32 n_cols = x.get_n_cols();
arma_debug_assert_same_size(out.n_rows, out.n_cols, n_rows, n_cols, "addi
tion");
if(is_generator<eop_type>::value == true)
{ {
eop_core<eop_type>::apply_unwrap(out, x); if(is_same_type<eop_type, eop_ones_diag>::value == true)
{
const u32 N = (std::min)(n_rows, n_cols);
for(u32 i=0; i<N; ++i)
{
out.at(i,i) += eT(1);
}
}
else
{
eT* out_mem = out.memptr();
const u32 n_elem = out.n_elem;
for(u32 i=0; i<n_elem; ++i)
{
out_mem[i] += eop_aux::generate<eT,eop_type>();
}
}
} }
else else
{ {
eop_core<eop_type>::apply_proxy(out, x); typedef typename Proxy<T1>::ea_type ea_type;
const eT k = x.aux;
ea_type P = x.P.get_ea();
eT* out_mem = out.memptr();
const u32 n_elem = out.n_elem;
u32 i,j;
for(i=0, j=1; j<n_elem; i+=2, j+=2)
{
const eT tmp_i = eop_core<eop_type>::process(P[i], k);
const eT tmp_j = eop_core<eop_type>::process(P[j], k);
out_mem[i] += tmp_i;
out_mem[j] += tmp_j;
}
if(i < n_elem)
{
out_mem[i] += eop_core<eop_type>::process(P[i], k);
}
} }
} }
template<typename eop_type> template<typename eop_type>
template<typename T1> template<typename T1>
arma_hot arma_hot
inline inline
void void
eop_core<eop_type>::apply_proxy(Mat<typename T1::elem_type>& out, const eOp <T1, eop_type>& x) eop_core<eop_type>::apply_inplace_minus(Mat<typename T1::elem_type>& out, c onst eOp<T1, eop_type>& x)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
// eop_type::apply_proxy() function is not allowed to unwrap things
// (in order to get the input into a common format).
// the proxy class is already providing objects with element access
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
const Proxy<T1>& P = x.P; const u32 n_rows = x.get_n_rows();
const u32 n_cols = x.get_n_cols();
out.set_size(P.n_rows, P.n_cols); arma_debug_assert_same_size(out.n_rows, out.n_cols, n_rows, n_cols, "subt
raction");
eT* out_mem = out.memptr();
const u32 n_elem = P.n_elem;
if(is_generator<eop_type>::value == true) if(is_generator<eop_type>::value == true)
{ {
if(is_same_type<eop_type, eop_ones_diag>::value == true)
{
const u32 N = (std::min)(n_rows, n_cols);
for(u32 i=0; i<N; ++i)
{
out.at(i,i) -= eT(1);
}
}
else
{
eT* out_mem = out.memptr();
const u32 n_elem = out.n_elem;
for(u32 i=0; i<n_elem; ++i)
{
out_mem[i] -= eop_aux::generate<eT,eop_type>();
}
}
}
else
{
typedef typename Proxy<T1>::ea_type ea_type;
const eT k = x.aux;
ea_type P = x.P.get_ea();
eT* out_mem = out.memptr();
const u32 n_elem = out.n_elem;
u32 i,j; u32 i,j;
for(i=0, j=1; j<n_elem; i+=2, j+=2) for(i=0, j=1; j<n_elem; i+=2, j+=2)
{ {
out_mem[i] = eop_aux::generate<eT,eop_type>(); const eT tmp_i = eop_core<eop_type>::process(P[i], k);
out_mem[j] = eop_aux::generate<eT,eop_type>(); const eT tmp_j = eop_core<eop_type>::process(P[j], k);
out_mem[i] -= tmp_i;
out_mem[j] -= tmp_j;
} }
if(i < n_elem) if(i < n_elem)
{ {
out_mem[i] = eop_aux::generate<eT,eop_type>(); out_mem[i] -= eop_core<eop_type>::process(P[i], k);
} }
} }
else }
template<typename eop_type>
template<typename T1>
arma_hot
inline
void
eop_core<eop_type>::apply_inplace_schur(Mat<typename T1::elem_type>& out, c
onst eOp<T1, eop_type>& x)
{
arma_extra_debug_sigprint();
typedef typename T1::elem_type eT;
const u32 n_rows = x.get_n_rows();
const u32 n_cols = x.get_n_cols();
arma_debug_assert_same_size(out.n_rows, out.n_cols, n_rows, n_cols, "elem
ent-wise multiplication");
if(is_generator<eop_type>::value == true)
{ {
if(is_same_type<eop_type, eop_ones_diag>::value == true) if(is_same_type<eop_type, eop_ones_diag>::value == true)
{ {
for(u32 col=0; col<P.n_rows; ++col) const u32 N = (std::min)(n_rows, n_cols);
{
for(u32 row=0; row<col; ++row) { out.at(row,col) = eT(0);
}
out.at(col,col) = eT(1);
for(u32 row=col+1; row<P.n_rows; ++row) { out.at(row,col) = eT(0); for(u32 i=0; i<N; ++i)
} {
for(u32 row=0; row<i; ++row) { out.at(row,i) = eT(0); }
for(u32 row=i+1; row<n_rows; ++row) { out.at(row,i) = eT(0); }
} }
} }
else else
{ {
u32 i,j; eT* out_mem = out.memptr();
const u32 n_elem = out.n_elem;
for(i=0, j=1; j<n_elem; i+=2, j+=2) for(u32 i=0; i<n_elem; ++i)
{ {
out_mem[i] = eop_core<eop_type>::process(x, P[i]); out_mem[i] *= eop_aux::generate<eT,eop_type>();
out_mem[j] = eop_core<eop_type>::process(x, P[j]);
} }
}
}
else
{
typedef typename Proxy<T1>::ea_type ea_type;
if(i < n_elem) const eT k = x.aux;
{ ea_type P = x.P.get_ea();
out_mem[i] = eop_core<eop_type>::process(x, P[i]); eT* out_mem = out.memptr();
} const u32 n_elem = out.n_elem;
u32 i,j;
for(i=0, j=1; j<n_elem; i+=2, j+=2)
{
const eT tmp_i = eop_core<eop_type>::process(P[i], k);
const eT tmp_j = eop_core<eop_type>::process(P[j], k);
out_mem[i] *= tmp_i;
out_mem[j] *= tmp_j;
}
if(i < n_elem)
{
out_mem[i] *= eop_core<eop_type>::process(P[i], k);
} }
} }
} }
template<typename eop_type> template<typename eop_type>
template<typename T1> template<typename T1>
arma_hot arma_hot
inline inline
void void
eop_core<eop_type>::apply_unwrap(Mat<typename T1::elem_type>& out, const eO p<T1, eop_type>& x) eop_core<eop_type>::apply_inplace_div(Mat<typename T1::elem_type>& out, con st eOp<T1, eop_type>& x)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
const Proxy<T1>& P = x.P; const u32 n_rows = x.get_n_rows();
const u32 n_cols = x.get_n_cols();
// cout << "*** P.n_rows = " << P.n_rows << endl; arma_debug_assert_same_size(out.n_rows, out.n_cols, n_rows, n_cols, "elem
// cout << "*** P.n_cols = " << P.n_cols << endl; ent-wise division");
out.set_size(P.n_rows, P.n_cols);
eT* out_mem = out.memptr(); eT* out_mem = out.memptr();
const u32 n_elem = P.n_elem; const u32 n_elem = out.n_elem;
const unwrap<typename Proxy<T1>::stored_type> tmp(P.Q);
const Mat<eT>& A = tmp.M;
if(is_generator<eop_type>::value == true) if(is_generator<eop_type>::value == true)
{ {
if(is_same_type<eop_type, eop_ones_diag>::value == true)
{
const u32 N = (std::min)(n_rows, n_cols);
for(u32 i=0; i<N; ++i)
{
const eT zero = eT(0);
for(u32 row=0; row<i; ++row) { out.at(row,i) /= zero; }
for(u32 row=i+1; row<n_rows; ++row) { out.at(row,i) /= zero; }
}
}
else
{
eT* out_mem = out.memptr();
const u32 n_elem = out.n_elem;
for(u32 i=0; i<n_elem; ++i)
{
out_mem[i] /= eop_aux::generate<eT,eop_type>();
}
}
}
else
{
typedef typename Proxy<T1>::ea_type ea_type;
const eT k = x.aux;
ea_type P = x.P.get_ea();
eT* out_mem = out.memptr();
const u32 n_elem = out.n_elem;
u32 i,j; u32 i,j;
for(i=0, j=1; j<n_elem; i+=2, j+=2) for(i=0, j=1; j<n_elem; i+=2, j+=2)
{ {
out_mem[i] = eop_aux::generate<eT,eop_type>(); const eT tmp_i = eop_core<eop_type>::process(P[i], k);
out_mem[j] = eop_aux::generate<eT,eop_type>(); const eT tmp_j = eop_core<eop_type>::process(P[j], k);
out_mem[i] /= tmp_i;
out_mem[j] /= tmp_j;
} }
if(i < n_elem) if(i < n_elem)
{ {
out_mem[i] = eop_aux::generate<eT,eop_type>(); out_mem[i] /= eop_core<eop_type>::process(P[i], k);
} }
} }
}
//
// cubes
template<typename eop_type>
template<typename T1>
arma_hot
inline
void
eop_core<eop_type>::apply(Cube<typename T1::elem_type>& out, const eOpCube<
T1, eop_type>& x)
{
arma_extra_debug_sigprint();
typedef typename T1::elem_type eT;
const u32 n_rows = x.get_n_rows();
const u32 n_cols = x.get_n_cols();
const u32 n_slices = x.get_n_slices();
const u32 n_elem = x.get_n_elem();
out.set_size(n_rows, n_cols, n_slices);
if(is_generator<eop_type>::value == true)
{
if(is_same_type<eop_type, eop_ones_full>::value == true) { out.one
s(); }
else if(is_same_type<eop_type, eop_zeros >::value == true) { out.zer
os(); }
else if(is_same_type<eop_type, eop_randu >::value == true) { out.ran
du(); }
else if(is_same_type<eop_type, eop_randn >::value == true) { out.ran
dn(); }
}
else else
{ {
if(is_same_type<eop_type, eop_ones_diag>::value == true) typedef typename ProxyCube<T1>::ea_type ea_type;
{
for(u32 col=0; col<P.n_rows; ++col)
{
for(u32 row=0; row<col; ++row) { out.at(row,col) = eT(0);
}
out.at(col,col) = eT(1); const eT k = x.aux;
ea_type P = x.P.get_ea();
for(u32 row=col+1; row<P.n_rows; ++row) { out.at(row,col) = eT(0); eT* out_mem = out.memptr();
}
}
}
else
{
const eT* A_mem = A.memptr();
u32 i,j; u32 i,j;
for(i=0, j=1; j<n_elem; i+=2, j+=2) for(i=0, j=1; j<n_elem; i+=2, j+=2)
{ {
out_mem[i] = eop_core<eop_type>::process(x, A_mem[i]); out_mem[i] = eop_core<eop_type>::process(P[i], k);
out_mem[j] = eop_core<eop_type>::process(x, A_mem[j]); out_mem[j] = eop_core<eop_type>::process(P[j], k);
} }
if(i < n_elem) if(i < n_elem)
{ {
out_mem[i] = eop_core<eop_type>::process(x, A_mem[i]); out_mem[i] = eop_core<eop_type>::process(P[i], k);
}
} }
} }
} }
template<typename eop_type> template<typename eop_type>
template<typename T1> template<typename T1>
arma_hot arma_hot
inline inline
void void
eop_core<eop_type>::apply_inplace_plus(Mat<typename T1::elem_type>& out, co nst eOp<T1, eop_type>& x) eop_core<eop_type>::apply_inplace_plus(Cube<typename T1::elem_type>& out, c onst eOpCube<T1, eop_type>& x)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
const Proxy<T1>& P = x.P; const u32 n_rows = x.get_n_rows();
const u32 n_cols = x.get_n_cols();
const u32 n_slices = x.get_n_slices();
arma_debug_assert_same_size(out.n_rows, out.n_cols, P.n_rows, P.n_cols, " matrix addition"); arma_debug_assert_same_size(out.n_rows, out.n_cols, out.n_slices, n_rows, n_cols, n_slices, "addition");
eT* out_mem = out.memptr(); eT* out_mem = out.memptr();
const u32 n_elem = P.n_elem;
if(is_generator<eop_type>::value == true) if(is_generator<eop_type>::value == true)
{ {
eT* out_mem = out.memptr();
const u32 n_elem = out.n_elem;
for(u32 i=0; i<n_elem; ++i) for(u32 i=0; i<n_elem; ++i)
{ {
out_mem[i] += eop_aux::generate<eT,eop_type>(); out_mem[i] += eop_aux::generate<eT,eop_type>();
} }
} }
else else
{ {
if(is_same_type<eop_type, eop_ones_diag>::value == true) typedef typename ProxyCube<T1>::ea_type ea_type;
const eT k = x.aux;
ea_type P = x.P.get_ea();
eT* out_mem = out.memptr();
const u32 n_elem = out.n_elem;
u32 i,j;
for(i=0, j=1; j<n_elem; i+=2, j+=2)
{ {
for(u32 row=0; row<P.n_rows; ++row) const eT tmp_i = eop_core<eop_type>::process(P[i], k);
{ const eT tmp_j = eop_core<eop_type>::process(P[j], k);
out.at(row,row) += eT(1);
} out_mem[i] += tmp_i;
out_mem[j] += tmp_j;
} }
else
if(i < n_elem)
{ {
for(u32 i=0; i<n_elem; ++i) out_mem[i] += eop_core<eop_type>::process(P[i], k);
{
out_mem[i] += eop_core<eop_type>::process(x, P[i]);
}
} }
} }
} }
template<typename eop_type> template<typename eop_type>
template<typename T1> template<typename T1>
arma_hot arma_hot
inline inline
void void
eop_core<eop_type>::apply_inplace_minus(Mat<typename T1::elem_type>& out, c onst eOp<T1, eop_type>& x) eop_core<eop_type>::apply_inplace_minus(Cube<typename T1::elem_type>& out, const eOpCube<T1, eop_type>& x)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
const Proxy<T1>& P = x.P; const u32 n_rows = x.get_n_rows();
const u32 n_cols = x.get_n_cols();
const u32 n_slices = x.get_n_slices();
arma_debug_assert_same_size(out.n_rows, out.n_cols, P.n_rows, P.n_cols, " matrix subtraction"); arma_debug_assert_same_size(out.n_rows, out.n_cols, out.n_slices, n_rows, n_cols, n_slices, "subtraction");
eT* out_mem = out.memptr(); eT* out_mem = out.memptr();
const u32 n_elem = P.n_elem;
if(is_generator<eop_type>::value == true) if(is_generator<eop_type>::value == true)
{ {
eT* out_mem = out.memptr();
const u32 n_elem = out.n_elem;
for(u32 i=0; i<n_elem; ++i) for(u32 i=0; i<n_elem; ++i)
{ {
out_mem[i] -= eop_aux::generate<eT,eop_type>(); out_mem[i] -= eop_aux::generate<eT,eop_type>();
} }
} }
else else
{ {
if(is_same_type<eop_type, eop_ones_diag>::value == true) typedef typename ProxyCube<T1>::ea_type ea_type;
const eT k = x.aux;
ea_type P = x.P.get_ea();
eT* out_mem = out.memptr();
const u32 n_elem = out.n_elem;
u32 i,j;
for(i=0, j=1; j<n_elem; i+=2, j+=2)
{ {
for(u32 row=0; row<P.n_rows; ++row) const eT tmp_i = eop_core<eop_type>::process(P[i], k);
{ const eT tmp_j = eop_core<eop_type>::process(P[j], k);
out.at(row,row) -= eT(1);
} out_mem[i] -= tmp_i;
out_mem[j] -= tmp_j;
} }
else
if(i < n_elem)
{ {
for(u32 i=0; i<n_elem; ++i) out_mem[i] -= eop_core<eop_type>::process(P[i], k);
{
out_mem[i] -= eop_core<eop_type>::process(x, P[i]);
}
} }
} }
} }
template<typename eop_type> template<typename eop_type>
template<typename T1> template<typename T1>
arma_hot arma_hot
inline inline
void void
eop_core<eop_type>::apply_inplace_schur(Mat<typename T1::elem_type>& out, c onst eOp<T1, eop_type>& x) eop_core<eop_type>::apply_inplace_schur(Cube<typename T1::elem_type>& out, const eOpCube<T1, eop_type>& x)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
const Proxy<T1>& P = x.P; const u32 n_rows = x.get_n_rows();
const u32 n_cols = x.get_n_cols();
const u32 n_slices = x.get_n_slices();
arma_debug_assert_same_size(out.n_rows, out.n_cols, P.n_rows, P.n_cols, " element-wise matrix multiplication"); arma_debug_assert_same_size(out.n_rows, out.n_cols, out.n_slices, n_rows, n_cols, n_slices, "element-wise multiplication");
eT* out_mem = out.memptr(); eT* out_mem = out.memptr();
const u32 n_elem = P.n_elem;
if(is_generator<eop_type>::value == true) if(is_generator<eop_type>::value == true)
{ {
eT* out_mem = out.memptr();
const u32 n_elem = out.n_elem;
for(u32 i=0; i<n_elem; ++i) for(u32 i=0; i<n_elem; ++i)
{ {
out_mem[i] *= eop_aux::generate<eT,eop_type>(); out_mem[i] *= eop_aux::generate<eT,eop_type>();
} }
} }
else else
{ {
if(is_same_type<eop_type, eop_ones_diag>::value == true) typedef typename ProxyCube<T1>::ea_type ea_type;
const eT k = x.aux;
ea_type P = x.P.get_ea();
eT* out_mem = out.memptr();
const u32 n_elem = out.n_elem;
u32 i,j;
for(i=0, j=1; j<n_elem; i+=2, j+=2)
{ {
for(u32 col=0; col<P.n_rows; ++col) const eT tmp_i = eop_core<eop_type>::process(P[i], k);
{ const eT tmp_j = eop_core<eop_type>::process(P[j], k);
for(u32 row=0; row<col; ++row) { out.at(row,col) = eT(0);
} out_mem[i] *= tmp_i;
for(u32 row=col+1; row<P.n_rows; ++row) { out.at(row,col) = eT(0); out_mem[j] *= tmp_j;
}
}
} }
else
if(i < n_elem)
{ {
for(u32 i=0; i<n_elem; ++i) out_mem[i] *= eop_core<eop_type>::process(P[i], k);
{
out_mem[i] *= eop_core<eop_type>::process(x, P[i]);
}
} }
} }
} }
template<typename eop_type> template<typename eop_type>
template<typename T1> template<typename T1>
arma_hot arma_hot
inline inline
void void
eop_core<eop_type>::apply_inplace_div(Mat<typename T1::elem_type>& out, con st eOp<T1, eop_type>& x) eop_core<eop_type>::apply_inplace_div(Cube<typename T1::elem_type>& out, co nst eOpCube<T1, eop_type>& x)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
const Proxy<T1>& P = x.P; const u32 n_rows = x.get_n_rows();
const u32 n_cols = x.get_n_cols();
const u32 n_slices = x.get_n_slices();
arma_debug_assert_same_size(out.n_rows, out.n_cols, P.n_rows, P.n_cols, " element-wise matrix division"); arma_debug_assert_same_size(out.n_rows, out.n_cols, out.n_slices, n_rows, n_cols, n_slices, "element-wise division");
eT* out_mem = out.memptr(); eT* out_mem = out.memptr();
const u32 n_elem = P.n_elem;
if(is_generator<eop_type>::value == true) if(is_generator<eop_type>::value == true)
{ {
eT* out_mem = out.memptr();
const u32 n_elem = out.n_elem;
for(u32 i=0; i<n_elem; ++i) for(u32 i=0; i<n_elem; ++i)
{ {
out_mem[i] /= eop_aux::generate<eT,eop_type>(); out_mem[i] /= eop_aux::generate<eT,eop_type>();
} }
} }
else else
{ {
if(is_same_type<eop_type, eop_ones_diag>::value == true) typedef typename ProxyCube<T1>::ea_type ea_type;
const eT k = x.aux;
ea_type P = x.P.get_ea();
eT* out_mem = out.memptr();
const u32 n_elem = out.n_elem;
u32 i,j;
for(i=0, j=1; j<n_elem; i+=2, j+=2)
{ {
for(u32 col=0; col<P.n_rows; ++col) const eT tmp_i = eop_core<eop_type>::process(P[i], k);
{ const eT tmp_j = eop_core<eop_type>::process(P[j], k);
const eT zero = eT(0);
for(u32 row=0; row<col; ++row) { out.at(row,col) /= zero; out_mem[i] /= tmp_i;
} out_mem[j] /= tmp_j;
for(u32 row=col+1; row<P.n_rows; ++row) { out.at(row,col) /= zero;
}
}
} }
else
if(i < n_elem)
{ {
for(u32 i=0; i<n_elem; ++i) out_mem[i] /= eop_core<eop_type>::process(P[i], k);
{
out_mem[i] /= eop_core<eop_type>::process(x, P[i]);
}
} }
} }
} }
//
// common
template<typename eop_type>
template<typename eT>
arma_hot
arma_pure
arma_inline
eT
eop_core<eop_type>::process(const eT val, const eT k)
{
arma_stop("eop_core::process(): unhandled eop_type");
return eT(0);
}
template<> template<typename eT> arma_hot arma_const arma_inline eT
eop_core<eop_scalar_plus >::process(const eT val, const eT k) { return
val + k; }
template<> template<typename eT> arma_hot arma_const arma_inline eT
eop_core<eop_scalar_minus_pre >::process(const eT val, const eT k) { return
k - val; }
template<> template<typename eT> arma_hot arma_const arma_inline eT
eop_core<eop_scalar_minus_post>::process(const eT val, const eT k) { return
val - k; }
template<> template<typename eT> arma_hot arma_const arma_inline eT
eop_core<eop_scalar_times >::process(const eT val, const eT k) { return
val * k; }
template<> template<typename eT> arma_hot arma_const arma_inline eT
eop_core<eop_scalar_div_pre >::process(const eT val, const eT k) { return
k / val; }
template<> template<typename eT> arma_hot arma_const arma_inline eT
eop_core<eop_scalar_div_post >::process(const eT val, const eT k) { return
val / k; }
template<> template<typename eT> arma_hot arma_const arma_inline eT
eop_core<eop_square >::process(const eT val, const eT k) { return
val*val; }
template<> template<typename eT> arma_hot arma_const arma_inline eT
eop_core<eop_neg >::process(const eT val, const eT k) { return
eop_aux::neg(val); }
template<> template<typename eT> arma_hot arma_pure arma_inline eT
eop_core<eop_sqrt >::process(const eT val, const eT k) { return
eop_aux::sqrt(val); }
template<> template<typename eT> arma_hot arma_pure arma_inline eT
eop_core<eop_log >::process(const eT val, const eT k) { return
eop_aux::log(val); }
template<> template<typename eT> arma_hot arma_pure arma_inline eT
eop_core<eop_log2 >::process(const eT val, const eT k) { return
eop_aux::log2(val); }
template<> template<typename eT> arma_hot arma_pure arma_inline eT
eop_core<eop_log10 >::process(const eT val, const eT k) { return
eop_aux::log10(val); }
template<> template<typename eT> arma_hot arma_pure arma_inline eT
eop_core<eop_trunc_log >::process(const eT val, const eT k) { return
arma::trunc_log(val); }
template<> template<typename eT> arma_hot arma_pure arma_inline eT
eop_core<eop_exp >::process(const eT val, const eT k) { return
eop_aux::exp(val); }
template<> template<typename eT> arma_hot arma_pure arma_inline eT
eop_core<eop_exp2 >::process(const eT val, const eT k) { return
eop_aux::exp2(val); }
template<> template<typename eT> arma_hot arma_pure arma_inline eT
eop_core<eop_exp10 >::process(const eT val, const eT k) { return
eop_aux::exp10(val); }
template<> template<typename eT> arma_hot arma_pure arma_inline eT
eop_core<eop_trunc_exp >::process(const eT val, const eT k) { return
arma::trunc_exp(val); }
template<> template<typename eT> arma_hot arma_pure arma_inline eT
eop_core<eop_cos >::process(const eT val, const eT k) { return
eop_aux::cos(val); }
template<> template<typename eT> arma_hot arma_pure arma_inline eT
eop_core<eop_sin >::process(const eT val, const eT k) { return
eop_aux::sin(val); }
template<> template<typename eT> arma_hot arma_pure arma_inline eT
eop_core<eop_tan >::process(const eT val, const eT k) { return
eop_aux::tan(val); }
template<> template<typename eT> arma_hot arma_pure arma_inline eT
eop_core<eop_acos >::process(const eT val, const eT k) { return
eop_aux::acos(val); }
template<> template<typename eT> arma_hot arma_pure arma_inline eT
eop_core<eop_asin >::process(const eT val, const eT k) { return
eop_aux::asin(val); }
template<> template<typename eT> arma_hot arma_pure arma_inline eT
eop_core<eop_atan >::process(const eT val, const eT k) { return
eop_aux::atan(val); }
template<> template<typename eT> arma_hot arma_pure arma_inline eT
eop_core<eop_cosh >::process(const eT val, const eT k) { return
eop_aux::cosh(val); }
template<> template<typename eT> arma_hot arma_pure arma_inline eT
eop_core<eop_sinh >::process(const eT val, const eT k) { return
eop_aux::sinh(val); }
template<> template<typename eT> arma_hot arma_pure arma_inline eT
eop_core<eop_tanh >::process(const eT val, const eT k) { return
eop_aux::tanh(val); }
template<> template<typename eT> arma_hot arma_pure arma_inline eT
eop_core<eop_acosh >::process(const eT val, const eT k) { return
eop_aux::acosh(val); }
template<> template<typename eT> arma_hot arma_pure arma_inline eT
eop_core<eop_asinh >::process(const eT val, const eT k) { return
eop_aux::asinh(val); }
template<> template<typename eT> arma_hot arma_pure arma_inline eT
eop_core<eop_atanh >::process(const eT val, const eT k) { return
eop_aux::atanh(val); }
template<> template<typename eT> arma_hot arma_pure arma_inline eT
eop_core<eop_eps >::process(const eT val, const eT k) { return
eop_aux::direct_eps(val); }
template<> template<typename eT> arma_hot arma_pure arma_inline eT
eop_core<eop_abs >::process(const eT val, const eT k) { return
eop_aux::arma_abs(val); }
template<> template<typename eT> arma_hot arma_pure arma_inline eT
eop_core<eop_conj >::process(const eT val, const eT k) { return
eop_aux::conj(val); }
template<> template<typename eT> arma_hot arma_pure arma_inline eT
eop_core<eop_pow >::process(const eT val, const eT k) { return
eop_aux::pow(val, k); }
//! @} //! @}
 End of changes. 79 change blocks. 
245 lines changed or deleted 536 lines changed or added


 eop_core_proto.hpp   eop_core_proto.hpp 
skipping to change at line 24 skipping to change at line 24
// (see http://www.opensource.org/licenses for more info) // (see http://www.opensource.org/licenses for more info)
//! \addtogroup eop_core //! \addtogroup eop_core
//! @{ //! @{
template<typename eop_type> template<typename eop_type>
class eop_core class eop_core
{ {
public: public:
arma_inline static const char* error_msg() { return ""; } // matrices
arma_inline static bool size_ok(const u32 n_rows, const u32 n_cols) template<typename T1> arma_hot inline static void apply(Mat<typename T1::
{ return true; } elem_type>& out, const eOp<T1, eop_type>& x);
template<typename T1> arma_hot arma_inline static typename T1::elem_type
get_elem(const eOp<T1, eop_type>& x, const u32 i);
template<typename T1> arma_hot arma_inline static typename T1::elem_type
get_elem(const eOp<T1, eop_type>& x, const u32 row, const u32 col);
template<typename T1> arma_hot arma_inline static typename T1::elem_type
process(const eOp<T1, eop_type>& x, const typename T1::elem_type val);
template<typename T1> arma_hot arma_inline static void apply(Mat<typename
T1::elem_type>& out, const eOp<T1, eop_type>& x);
template<typename T1> arma_hot inline static void apply_proxy (Mat<typena
me T1::elem_type>& out, const eOp<T1, eop_type>& x);
template<typename T1> arma_hot inline static void apply_unwrap(Mat<typena
me T1::elem_type>& out, const eOp<T1, eop_type>& x);
template<typename T1> arma_hot inline static void apply_inplace_plus (Mat <typename T1::elem_type>& out, const eOp<T1, eop_type>& x); template<typename T1> arma_hot inline static void apply_inplace_plus (Mat <typename T1::elem_type>& out, const eOp<T1, eop_type>& x);
template<typename T1> arma_hot inline static void apply_inplace_minus(Mat <typename T1::elem_type>& out, const eOp<T1, eop_type>& x); template<typename T1> arma_hot inline static void apply_inplace_minus(Mat <typename T1::elem_type>& out, const eOp<T1, eop_type>& x);
template<typename T1> arma_hot inline static void apply_inplace_schur(Mat <typename T1::elem_type>& out, const eOp<T1, eop_type>& x); template<typename T1> arma_hot inline static void apply_inplace_schur(Mat <typename T1::elem_type>& out, const eOp<T1, eop_type>& x);
template<typename T1> arma_hot inline static void apply_inplace_div (Mat <typename T1::elem_type>& out, const eOp<T1, eop_type>& x); template<typename T1> arma_hot inline static void apply_inplace_div (Mat <typename T1::elem_type>& out, const eOp<T1, eop_type>& x);
// cubes
template<typename T1> arma_hot inline static void apply(Cube<typename T1:
:elem_type>& out, const eOpCube<T1, eop_type>& x);
template<typename T1> arma_hot inline static void apply_inplace_plus (Cub
e<typename T1::elem_type>& out, const eOpCube<T1, eop_type>& x);
template<typename T1> arma_hot inline static void apply_inplace_minus(Cub
e<typename T1::elem_type>& out, const eOpCube<T1, eop_type>& x);
template<typename T1> arma_hot inline static void apply_inplace_schur(Cub
e<typename T1::elem_type>& out, const eOpCube<T1, eop_type>& x);
template<typename T1> arma_hot inline static void apply_inplace_div (Cub
e<typename T1::elem_type>& out, const eOpCube<T1, eop_type>& x);
// common
template<typename eT> arma_hot arma_pure arma_inline static eT process(co
nst eT val, const eT k);
}; };
class eop_neg : public eop_core<eop_neg> {}; class eop_neg : public eop_core<eop_neg> {};
class eop_scalar_plus : public eop_core<eop_scalar_plus> {}; class eop_scalar_plus : public eop_core<eop_scalar_plus> {};
class eop_scalar_minus_pre : public eop_core<eop_scalar_minus_pre> {}; class eop_scalar_minus_pre : public eop_core<eop_scalar_minus_pre> {};
class eop_scalar_minus_post : public eop_core<eop_scalar_minus_post> {}; class eop_scalar_minus_post : public eop_core<eop_scalar_minus_post> {};
class eop_scalar_times : public eop_core<eop_scalar_times> {}; class eop_scalar_times : public eop_core<eop_scalar_times> {};
class eop_scalar_div_pre : public eop_core<eop_scalar_div_pre> {}; class eop_scalar_div_pre : public eop_core<eop_scalar_div_pre> {};
class eop_scalar_div_post : public eop_core<eop_scalar_div_post> {}; class eop_scalar_div_post : public eop_core<eop_scalar_div_post> {};
class eop_square : public eop_core<eop_square> {}; class eop_square : public eop_core<eop_square> {};
class eop_sqrt : public eop_core<eop_sqrt> {}; class eop_sqrt : public eop_core<eop_sqrt> {};
class eop_log10 : public eop_core<eop_log10> {};
class eop_log : public eop_core<eop_log> {}; class eop_log : public eop_core<eop_log> {};
class eop_log2 : public eop_core<eop_log2> {};
class eop_log10 : public eop_core<eop_log10> {};
class eop_trunc_log : public eop_core<eop_trunc_log> {}; class eop_trunc_log : public eop_core<eop_trunc_log> {};
class eop_exp : public eop_core<eop_exp> {}; class eop_exp : public eop_core<eop_exp> {};
class eop_exp2 : public eop_core<eop_exp2> {};
class eop_exp10 : public eop_core<eop_exp10> {};
class eop_trunc_exp : public eop_core<eop_trunc_exp> {}; class eop_trunc_exp : public eop_core<eop_trunc_exp> {};
class eop_cos : public eop_core<eop_cos> {}; class eop_cos : public eop_core<eop_cos> {};
class eop_sin : public eop_core<eop_sin> {}; class eop_sin : public eop_core<eop_sin> {};
class eop_tan : public eop_core<eop_tan> {}; class eop_tan : public eop_core<eop_tan> {};
class eop_acos : public eop_core<eop_acos> {}; class eop_acos : public eop_core<eop_acos> {};
class eop_asin : public eop_core<eop_asin> {}; class eop_asin : public eop_core<eop_asin> {};
class eop_atan : public eop_core<eop_atan> {}; class eop_atan : public eop_core<eop_atan> {};
class eop_cosh : public eop_core<eop_cosh> {}; class eop_cosh : public eop_core<eop_cosh> {};
class eop_sinh : public eop_core<eop_sinh> {}; class eop_sinh : public eop_core<eop_sinh> {};
class eop_tanh : public eop_core<eop_tanh> {}; class eop_tanh : public eop_core<eop_tanh> {};
class eop_acosh : public eop_core<eop_acosh> {}; class eop_acosh : public eop_core<eop_acosh> {};
class eop_asinh : public eop_core<eop_asinh> {}; class eop_asinh : public eop_core<eop_asinh> {};
class eop_atanh : public eop_core<eop_atanh> {}; class eop_atanh : public eop_core<eop_atanh> {};
class eop_eps : public eop_core<eop_eps> {}; class eop_eps : public eop_core<eop_eps> {};
class eop_abs : public eop_core<eop_abs> {}; class eop_abs : public eop_core<eop_abs> {};
class eop_conj : public eop_core<eop_conj> {}; class eop_conj : public eop_core<eop_conj> {};
class eop_pow : public eop_core<eop_pow> {}; class eop_pow : public eop_core<eop_pow> {};
class eop_pow_int : public eop_core<eop_pow_int> {}; class eop_pow_int : public eop_core<eop_pow_int> {};
class eop_randu : public eop_core<eop_randu> {};
class eop_ones_diag : public eop_core<eop_ones_diag> class eop_randn : public eop_core<eop_randn> {};
{ class eop_zeros : public eop_core<eop_zeros> {};
public: class eop_ones_full : public eop_core<eop_ones_full> {};
class eop_ones_diag : public eop_core<eop_ones_diag> {};
arma_inline static const char* error_msg() { return "eye(): given size is
not square"; }
arma_inline static bool size_ok(const u32 n_rows, const u32 n_cols) { ret
urn (n_rows == n_cols); }
};
class eop_ones_full : public eop_core<eop_ones_full>{};
class eop_randu : public eop_core<eop_randu> {};
class eop_randn : public eop_core<eop_randn> {};
class eop_zeros : public eop_core<eop_zeros> {};
template<typename T1> struct is_generator { static const boo l value = false; }; template<typename T1> struct is_generator { static const boo l value = false; };
template<> struct is_generator<eop_ones_full> { static const boo l value = true; };
template<> struct is_generator<eop_randu> { static const boo l value = true; }; template<> struct is_generator<eop_randu> { static const boo l value = true; };
template<> struct is_generator<eop_randn> { static const boo l value = true; }; template<> struct is_generator<eop_randn> { static const boo l value = true; };
template<> struct is_generator<eop_zeros> { static const boo l value = true; }; template<> struct is_generator<eop_zeros> { static const boo l value = true; };
template<> struct is_generator<eop_ones_full> { static const boo
l value = true; };
template<> struct is_generator<eop_ones_diag> { static const boo
l value = true; };
//! @} //! @}
 End of changes. 9 change blocks. 
37 lines changed or deleted 34 lines changed or added


 fn_accu.hpp   fn_accu.hpp 
skipping to change at line 19 skipping to change at line 19
// 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 fn_accu //! \addtogroup fn_accu
//! @{ //! @{
//! accumulate the elements of a matrix
template<typename T1> template<typename T1>
arma_hot arma_hot
inline inline
typename T1::elem_type typename T1::elem_type
accu_unwrap(const Base<typename T1::elem_type,T1>& X) accu(const Base<typename T1::elem_type,T1>& X)
{
arma_extra_debug_sigprint();
typedef typename T1::elem_type eT;
const unwrap<T1> tmp(X.get_ref());
const Mat<eT>& A = tmp.M;
return arrayops::accumulate( A.memptr(), A.n_elem );
}
template<typename T1>
arma_hot
inline
typename T1::elem_type
accu_proxy(const Base<typename T1::elem_type,T1>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
typedef typename Proxy<T1>::ea_type ea_type;
const Proxy<T1> A(X.get_ref()); const Proxy<T1> A(X.get_ref());
const u32 N = A.n_elem; ea_type P = A.get_ea();
const u32 n_elem = A.get_n_elem();
eT val = eT(0); eT val1 = eT(0);
eT val2 = eT(0);
for(u32 i=0; i<N; ++i) u32 i,j;
for(i=0, j=1; j<n_elem; i+=2, j+=2)
{ {
val += A[i]; val1 += P[i];
val2 += P[j];
} }
return val; if(i < n_elem)
} {
val1 += P[i];
//! accumulate the elements of a matrix }
template<typename T1>
arma_inline
arma_warn_unused
typename T1::elem_type
accu(const Base<typename T1::elem_type,T1>& X)
{
arma_extra_debug_sigprint();
return (is_Mat<T1>::value == true) ? accu_unwrap(X) : accu_proxy(X); return val1 + val2;
} }
//! explicit handling of Hamming norm (also known as zero norm) //! explicit handling of Hamming norm (also known as zero norm)
template<typename T1> template<typename T1>
arma_inline arma_inline
arma_warn_unused arma_warn_unused
u32 u32
accu(const mtOp<u32,T1,op_rel_noteq>& X) accu(const mtOp<u32,T1,op_rel_noteq>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
const Proxy<T1> A(X.m); const Proxy<T1> A(X.m);
const u32 n_elem = A.n_elem; const u32 n_elem = A.get_n_elem();
const eT val = X.aux; const eT val = X.aux;
u32 n_nonzero = 0; u32 n_nonzero = 0;
for(u32 i=0; i<n_elem; ++i) for(u32 i=0; i<n_elem; ++i)
{ {
if(A[i] != val) if(A[i] != val)
{ {
++n_nonzero; ++n_nonzero;
} }
} }
skipping to change at line 109 skipping to change at line 93
//! accumulate the elements of a cube //! accumulate the elements of a cube
template<typename T1> template<typename T1>
arma_hot arma_hot
arma_warn_unused arma_warn_unused
inline inline
typename T1::elem_type typename T1::elem_type
accu(const BaseCube<typename T1::elem_type,T1>& X) accu(const BaseCube<typename T1::elem_type,T1>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
typedef typename ProxyCube<T1>::ea_type ea_type;
const ProxyCube<T1> A(X.get_ref()); const ProxyCube<T1> A(X.get_ref());
const u32 n_elem = A.n_elem; ea_type P = A.get_ea();
const u32 n_elem = A.get_n_elem();
eT val = eT(0); eT val1 = eT(0);
eT val2 = eT(0);
for(u32 i=0; i<n_elem; ++i) u32 i,j;
for(i=0, j=1; j<n_elem; i+=2, j+=2)
{
val1 += P[i];
val2 += P[j];
}
if(i < n_elem)
{ {
val += A[i]; val1 += P[i];
} }
return val; return val1 + val2;
} }
//! accumulate the elements of a diagview //! accumulate the elements of a diagview
template<typename eT> template<typename eT>
arma_pure arma_pure
arma_warn_unused arma_warn_unused
inline inline
eT eT
accu(const diagview<eT>& X) accu(const diagview<eT>& X)
{ {
 End of changes. 16 change blocks. 
41 lines changed or deleted 36 lines changed or added


 fn_join.hpp   fn_join.hpp 
skipping to change at line 39 skipping to change at line 39
template<typename T1, typename T2> template<typename T1, typename T2>
inline inline
const Glue<T1, T2, glue_join> const Glue<T1, T2, glue_join>
join_rows(const Base<typename T1::elem_type,T1>& A, const Base<typename T1: :elem_type,T2>& B) join_rows(const Base<typename T1::elem_type,T1>& A, const Base<typename T1: :elem_type,T2>& B)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return Glue<T1, T2, glue_join>(A.get_ref(), B.get_ref(), 1); return Glue<T1, T2, glue_join>(A.get_ref(), B.get_ref(), 1);
} }
template<typename T1, typename T2>
inline
const GlueCube<T1, T2, glue_join>
join_slices(const BaseCube<typename T1::elem_type,T1>& A, const BaseCube<ty
pename T1::elem_type,T2>& B)
{
arma_extra_debug_sigprint();
return GlueCube<T1, T2, glue_join>(A.get_ref(), B.get_ref());
}
//! @} //! @}
 End of changes. 1 change blocks. 
0 lines changed or deleted 11 lines changed or added


 fn_misc.hpp   fn_misc.hpp 
skipping to change at line 30 skipping to change at line 30
//! Generate a vector with 'num' elements. //! Generate a vector with 'num' elements.
//! The values of the elements linearly increase from 'start' upto (and inc luding) 'end'. //! The values of the elements linearly increase from 'start' upto (and inc luding) 'end'.
template<typename vec_type> template<typename vec_type>
inline inline
vec_type vec_type
linspace linspace
( (
const typename vec_type::pod_type start, const typename vec_type::pod_type start,
const typename vec_type::pod_type end, const typename vec_type::pod_type end,
const u32 num const u32 num,
const typename arma_Mat_Col_Row_only<vec_type>::result* junk = 0
) )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_type_check< (is_Mat<vec_type>::value == false) >::apply();
arma_debug_check( (num < 2), "linspace(): num must be >= 2"); arma_debug_check( (num < 2), "linspace(): num must be >= 2");
typedef typename vec_type::elem_type eT; typedef typename vec_type::elem_type eT;
typedef typename vec_type::pod_type T; typedef typename vec_type::pod_type T;
const u32 n_rows = (is_Row<vec_type>::value == true) ? 1 : num; const u32 n_rows = (is_Row<vec_type>::value == true) ? 1 : num;
const u32 n_cols = (is_Row<vec_type>::value == true) ? num : 1; const u32 n_cols = (is_Row<vec_type>::value == true) ? num : 1;
Mat<eT> x(n_rows, n_cols); Mat<eT> x(n_rows, n_cols);
eT* x_mem = x.memptr(); eT* x_mem = x.memptr();
skipping to change at line 135 skipping to change at line 134
const mtOp<typename T1::pod_type, T1, op_real> const mtOp<typename T1::pod_type, T1, op_real>
real(const Base<std::complex<typename T1::pod_type>, T1>& X) real(const Base<std::complex<typename T1::pod_type>, T1>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return mtOp<typename T1::pod_type, T1, op_real>( X.get_ref() ); return mtOp<typename T1::pod_type, T1, op_real>( X.get_ref() );
} }
template<typename T1> template<typename T1>
inline inline
Cube<typename T1::pod_type> const mtOpCube<typename T1::pod_type, T1, op_real>
real(const BaseCube<std::complex<typename T1::pod_type>, T1>& X) real(const BaseCube<std::complex<typename T1::pod_type>, T1>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::pod_type T; return mtOpCube<typename T1::pod_type, T1, op_real>( X.get_ref() );
const ProxyCube<T1> A(X.get_ref());
Cube<T> out(A.n_rows, A.n_cols, A.n_slices);
T* out_mem = out.memptr();
for(u32 i=0; i<out.n_elem; ++i)
{
out_mem[i] = std::real(A[i]);
}
return out;
} }
// //
// imag // imag
template<typename T1> template<typename T1>
inline inline
const eOp<Mat<typename T1::pod_type>, eop_zeros> const eOp<Mat<typename T1::pod_type>, eop_zeros>
imag(const Base<typename T1::pod_type,T1>& X) imag(const Base<typename T1::pod_type,T1>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
const Proxy<T1> A(X.get_ref()); const Proxy<T1> A(X.get_ref());
return eOp<Mat<typename T1::pod_type>, eop_zeros>(A.n_rows, A.n_cols); return eOp<Mat<typename T1::pod_type>, eop_zeros>(A.get_n_rows(), A.get_n _cols());
} }
template<typename T1> template<typename T1>
inline inline
const eOpCube<Cube<typename T1::pod_type>, eop_cube_zeros> const eOpCube<Cube<typename T1::pod_type>, eop_zeros>
imag(const BaseCube<typename T1::pod_type,T1>& X) imag(const BaseCube<typename T1::pod_type,T1>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
const ProxyCube<T1> A(X.get_ref()); const ProxyCube<T1> A(X.get_ref());
return eOpCube<Cube<typename T1::pod_type>, eop_cube_zeros>(A.n_rows, A.n _cols, A.n_slices); return eOpCube<Cube<typename T1::pod_type>, eop_zeros>(A.get_n_rows(), A. get_n_cols(), A.get_n_slices());
} }
template<typename T1> template<typename T1>
inline inline
const mtOp<typename T1::pod_type, T1, op_imag> const mtOp<typename T1::pod_type, T1, op_imag>
imag(const Base<std::complex<typename T1::pod_type>, T1>& X) imag(const Base<std::complex<typename T1::pod_type>, T1>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return mtOp<typename T1::pod_type, T1, op_imag>( X.get_ref() ); return mtOp<typename T1::pod_type, T1, op_imag>( X.get_ref() );
} }
template<typename T1> template<typename T1>
inline inline
Cube<typename T1::pod_type> const mtOpCube<typename T1::pod_type, T1, op_imag>
imag(const BaseCube<std::complex<typename T1::pod_type>,T1>& X) imag(const BaseCube<std::complex<typename T1::pod_type>,T1>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::pod_type T; return mtOpCube<typename T1::pod_type, T1, op_imag>( X.get_ref() );
const ProxyCube<T1> A(X.get_ref());
Cube<T> out(A.n_rows, A.n_cols, A.n_slices);
T* out_mem = out.memptr();
for(u32 i=0; i<out.n_elem; ++i)
{
out_mem[i] = std::imag(A[i]);
}
return out;
} }
// //
// log_add // log_add
template<typename eT> template<typename eT>
inline inline
typename arma_float_only<eT>::result typename arma_float_only<eT>::result
log_add(eT log_a, eT log_b) log_add(eT log_a, eT log_b)
{ {
skipping to change at line 260 skipping to change at line 233
const eOp<T1, eop_log> const eOp<T1, eop_log>
log(const Base<typename T1::elem_type,T1>& A) log(const Base<typename T1::elem_type,T1>& A)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return eOp<T1, eop_log>(A.get_ref()); return eOp<T1, eop_log>(A.get_ref());
} }
template<typename T1> template<typename T1>
arma_inline arma_inline
const eOpCube<T1, eop_cube_log> const eOpCube<T1, eop_log>
log(const BaseCube<typename T1::elem_type,T1>& A) log(const BaseCube<typename T1::elem_type,T1>& A)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return eOpCube<T1, eop_cube_log>(A.get_ref()); return eOpCube<T1, eop_log>(A.get_ref());
}
//
// log2
template<typename T1>
arma_inline
const eOp<T1, eop_log2>
log2(const Base<typename T1::elem_type,T1>& A)
{
arma_extra_debug_sigprint();
return eOp<T1, eop_log2>(A.get_ref());
}
template<typename T1>
arma_inline
const eOpCube<T1, eop_log2>
log2(const BaseCube<typename T1::elem_type,T1>& A)
{
arma_extra_debug_sigprint();
return eOpCube<T1, eop_log2>(A.get_ref());
} }
// //
// log10 // log10
template<typename T1> template<typename T1>
arma_inline arma_inline
const eOp<T1, eop_log10> const eOp<T1, eop_log10>
log10(const Base<typename T1::elem_type,T1>& A) log10(const Base<typename T1::elem_type,T1>& A)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return eOp<T1, eop_log10>(A.get_ref()); return eOp<T1, eop_log10>(A.get_ref());
} }
template<typename T1> template<typename T1>
arma_inline arma_inline
const eOpCube<T1, eop_cube_log10> const eOpCube<T1, eop_log10>
log10(const BaseCube<typename T1::elem_type,T1>& A) log10(const BaseCube<typename T1::elem_type,T1>& A)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return eOpCube<T1, eop_cube_log10>(A.get_ref()); return eOpCube<T1, eop_log10>(A.get_ref());
} }
// //
// exp // exp
template<typename T1> template<typename T1>
arma_inline arma_inline
const eOp<T1, eop_exp> const eOp<T1, eop_exp>
exp(const Base<typename T1::elem_type,T1>& A) exp(const Base<typename T1::elem_type,T1>& A)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return eOp<T1, eop_exp>(A.get_ref()); return eOp<T1, eop_exp>(A.get_ref());
} }
template<typename T1> template<typename T1>
arma_inline arma_inline
const eOpCube<T1, eop_cube_exp> const eOpCube<T1, eop_exp>
exp(const BaseCube<typename T1::elem_type,T1>& A) exp(const BaseCube<typename T1::elem_type,T1>& A)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return eOpCube<T1, eop_cube_exp>(A.get_ref()); return eOpCube<T1, eop_exp>(A.get_ref());
}
// exp2
template<typename T1>
arma_inline
const eOp<T1, eop_exp2>
exp2(const Base<typename T1::elem_type,T1>& A)
{
arma_extra_debug_sigprint();
return eOp<T1, eop_exp2>(A.get_ref());
}
template<typename T1>
arma_inline
const eOpCube<T1, eop_exp2>
exp2(const BaseCube<typename T1::elem_type,T1>& A)
{
arma_extra_debug_sigprint();
return eOpCube<T1, eop_exp2>(A.get_ref());
}
// exp10
template<typename T1>
arma_inline
const eOp<T1, eop_exp10>
exp10(const Base<typename T1::elem_type,T1>& A)
{
arma_extra_debug_sigprint();
return eOp<T1, eop_exp10>(A.get_ref());
}
template<typename T1>
arma_inline
const eOpCube<T1, eop_exp10>
exp10(const BaseCube<typename T1::elem_type,T1>& A)
{
arma_extra_debug_sigprint();
return eOpCube<T1, eop_exp10>(A.get_ref());
} }
// //
// abs // abs
template<typename T1> template<typename T1>
arma_inline arma_inline
const eOp<T1, eop_abs> const eOp<T1, eop_abs>
abs(const Base<typename T1::elem_type,T1>& X, const typename arma_not_cx<ty pename T1::elem_type>::result* junk = 0) abs(const Base<typename T1::elem_type,T1>& X, const typename arma_not_cx<ty pename T1::elem_type>::result* junk = 0)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return eOp<T1, eop_abs>(X.get_ref()); return eOp<T1, eop_abs>(X.get_ref());
} }
template<typename T1> template<typename T1>
arma_inline arma_inline
const eOpCube<T1, eop_cube_abs> const eOpCube<T1, eop_abs>
abs(const BaseCube<typename T1::elem_type,T1>& X, const typename arma_not_c x<typename T1::elem_type>::result* junk = 0) abs(const BaseCube<typename T1::elem_type,T1>& X, const typename arma_not_c x<typename T1::elem_type>::result* junk = 0)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return eOpCube<T1, eop_cube_abs>(X.get_ref()); return eOpCube<T1, eop_abs>(X.get_ref());
} }
template<typename T1> template<typename T1>
inline inline
const mtOp<typename T1::pod_type, T1, op_abs> const mtOp<typename T1::pod_type, T1, op_abs>
abs(const Base<std::complex<typename T1::pod_type>, T1>& X, const typename arma_cx_only<typename T1::elem_type>::result* junk = 0) abs(const Base<std::complex<typename T1::pod_type>, T1>& X, const typename arma_cx_only<typename T1::elem_type>::result* junk = 0)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return mtOp<typename T1::pod_type, T1, op_abs>( X.get_ref() ); return mtOp<typename T1::pod_type, T1, op_abs>( X.get_ref() );
} }
template<typename T1> template<typename T1>
inline inline
Cube<typename T1::pod_type> const mtOpCube<typename T1::pod_type, T1, op_abs>
abs(const BaseCube< std::complex<typename T1::pod_type>,T1>& X, const typen ame arma_cx_only<typename T1::elem_type>::result* junk = 0) abs(const BaseCube< std::complex<typename T1::pod_type>,T1>& X, const typen ame arma_cx_only<typename T1::elem_type>::result* junk = 0)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
const ProxyCube<T1> A(X.get_ref()); return mtOpCube<typename T1::pod_type, T1, op_abs>( X.get_ref() );
// if T1 is a complex matrix,
// pod_type is the underlying type used by std::complex;
// otherwise pod_type is the same as elem_type
typedef typename T1::elem_type in_eT;
typedef typename T1::pod_type out_eT;
Cube<out_eT> out(A.n_rows, A.n_cols, A.n_slices);
out_eT* out_mem = out.memptr();
for(u32 i=0; i<out.n_elem; ++i)
{
out_mem[i] = std::abs(A[i]);
}
return out;
} }
// //
// fabs // fabs
template<typename T1> template<typename T1>
arma_inline arma_inline
const eOp<T1, eop_abs> const eOp<T1, eop_abs>
fabs(const Base<typename T1::pod_type,T1>& X, const typename arma_not_cx<ty pename T1::elem_type>::result* junk = 0) fabs(const Base<typename T1::pod_type,T1>& X, const typename arma_not_cx<ty pename T1::elem_type>::result* junk = 0)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return eOp<T1, eop_abs>(X.get_ref()); return eOp<T1, eop_abs>(X.get_ref());
} }
template<typename T1> template<typename T1>
arma_inline arma_inline
const eOpCube<T1, eop_cube_abs> const eOpCube<T1, eop_abs>
fabs(const BaseCube<typename T1::pod_type,T1>& X, const typename arma_not_c x<typename T1::elem_type>::result* junk = 0) fabs(const BaseCube<typename T1::pod_type,T1>& X, const typename arma_not_c x<typename T1::elem_type>::result* junk = 0)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return eOpCube<T1, eop_cube_abs>(X.get_ref()); return eOpCube<T1, eop_abs>(X.get_ref());
} }
template<typename T1> template<typename T1>
inline inline
const mtOp<typename T1::pod_type, T1, op_abs> const mtOp<typename T1::pod_type, T1, op_abs>
fabs(const Base<std::complex<typename T1::pod_type>, T1>& X, const typename arma_cx_only<typename T1::elem_type>::result* junk = 0) fabs(const Base<std::complex<typename T1::pod_type>, T1>& X, const typename arma_cx_only<typename T1::elem_type>::result* junk = 0)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return mtOp<typename T1::pod_type, T1, op_abs>( X.get_ref() ); return mtOp<typename T1::pod_type, T1, op_abs>( X.get_ref() );
} }
template<typename T1> template<typename T1>
arma_inline arma_inline
Cube<typename T1::pod_type> const mtOpCube<typename T1::pod_type, T1, op_abs>
fabs(const BaseCube< std::complex<typename T1::pod_type>,T1>& X, const type name arma_cx_only<typename T1::elem_type>::result* junk = 0) fabs(const BaseCube< std::complex<typename T1::pod_type>,T1>& X, const type name arma_cx_only<typename T1::elem_type>::result* junk = 0)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return abs(X); return abs(X);
} }
// //
// square // square
skipping to change at line 433 skipping to change at line 455
const eOp<T1, eop_square> const eOp<T1, eop_square>
square(const Base<typename T1::elem_type,T1>& A) square(const Base<typename T1::elem_type,T1>& A)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return eOp<T1, eop_square>(A.get_ref()); return eOp<T1, eop_square>(A.get_ref());
} }
template<typename T1> template<typename T1>
arma_inline arma_inline
const eOpCube<T1, eop_cube_square> const eOpCube<T1, eop_square>
square(const BaseCube<typename T1::elem_type,T1>& A) square(const BaseCube<typename T1::elem_type,T1>& A)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return eOpCube<T1, eop_cube_square>(A.get_ref()); return eOpCube<T1, eop_square>(A.get_ref());
} }
// //
// sqrt // sqrt
template<typename T1> template<typename T1>
arma_inline arma_inline
const eOp<T1, eop_sqrt> const eOp<T1, eop_sqrt>
sqrt(const Base<typename T1::elem_type,T1>& A) sqrt(const Base<typename T1::elem_type,T1>& A)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return eOp<T1, eop_sqrt>(A.get_ref()); return eOp<T1, eop_sqrt>(A.get_ref());
} }
template<typename T1> template<typename T1>
arma_inline arma_inline
const eOpCube<T1, eop_cube_sqrt> const eOpCube<T1, eop_sqrt>
sqrt(const BaseCube<typename T1::elem_type,T1>& A) sqrt(const BaseCube<typename T1::elem_type,T1>& A)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return eOpCube<T1, eop_cube_sqrt>(A.get_ref()); return eOpCube<T1, eop_sqrt>(A.get_ref());
} }
// //
// conj // conj
template<typename T1> template<typename T1>
arma_inline arma_inline
const T1& const T1&
conj(const Base<typename T1::pod_type,T1>& A) conj(const Base<typename T1::pod_type,T1>& A)
{ {
skipping to change at line 499 skipping to change at line 521
const eOp<T1, eop_conj> const eOp<T1, eop_conj>
conj(const Base<std::complex<typename T1::pod_type>,T1>& A) conj(const Base<std::complex<typename T1::pod_type>,T1>& A)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return eOp<T1, eop_conj>(A.get_ref()); return eOp<T1, eop_conj>(A.get_ref());
} }
template<typename T1> template<typename T1>
arma_inline arma_inline
const eOpCube<T1, eop_cube_conj> const eOpCube<T1, eop_conj>
conj(const BaseCube<std::complex<typename T1::pod_type>,T1>& A) conj(const BaseCube<std::complex<typename T1::pod_type>,T1>& A)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return eOpCube<T1, eop_cube_conj>(A.get_ref()); return eOpCube<T1, eop_conj>(A.get_ref());
} }
template<typename T1> template<typename T1>
arma_inline arma_inline
const T1& const T1&
conj(const eOp<T1, eop_conj>& A) conj(const eOp<T1, eop_conj>& A)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return A.m; return A.m;
} }
template<typename T1> template<typename T1>
arma_inline arma_inline
const T1& const T1&
conj(const eOpCube<T1, eop_cube_conj>& A) conj(const eOpCube<T1, eop_conj>& A)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return A.m; return A.m;
} }
// TODO: this needs a more elaborate template restriction mechanism to work properly, // TODO: this needs a more elaborate template restriction mechanism to work properly,
// i.e. an overloaded version of thus function should do nothing if t he input type is non-complex // i.e. an overloaded version of thus function should do nothing if t he input type is non-complex
// //
// //! the conjugate of the transpose of a complex matrix is the same as th e hermitian transpose // //! the conjugate of the transpose of a complex matrix is the same as th e hermitian transpose
skipping to change at line 555 skipping to change at line 577
const eOp<T1, eop_pow> const eOp<T1, eop_pow>
pow(const Base<typename T1::elem_type,T1>& A, const typename T1::elem_type exponent) pow(const Base<typename T1::elem_type,T1>& A, const typename T1::elem_type exponent)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return eOp<T1, eop_pow>(A.get_ref(), exponent); return eOp<T1, eop_pow>(A.get_ref(), exponent);
} }
template<typename T1> template<typename T1>
arma_inline arma_inline
const eOpCube<T1, eop_cube_pow> const eOpCube<T1, eop_pow>
pow(const BaseCube<typename T1::elem_type,T1>& A, const typename T1::elem_t ype exponent) pow(const BaseCube<typename T1::elem_type,T1>& A, const typename T1::elem_t ype exponent)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return eOpCube<T1, eop_cube_pow>(A.get_ref(), exponent); return eOpCube<T1, eop_pow>(A.get_ref(), exponent);
} }
// pow, specialised handling (non-complex exponent for complex matrices) // pow, specialised handling (non-complex exponent for complex matrices)
template<typename T1> template<typename T1>
arma_inline arma_inline
const eOp<T1, eop_pow> const eOp<T1, eop_pow>
pow(const Base<typename T1::elem_type,T1>& A, const typename T1::elem_type: :value_type exponent) pow(const Base<typename T1::elem_type,T1>& A, const typename T1::elem_type: :value_type exponent)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
return eOp<T1, eop_pow>(A.get_ref(), eT(exponent)); return eOp<T1, eop_pow>(A.get_ref(), eT(exponent));
} }
template<typename T1> template<typename T1>
arma_inline arma_inline
const eOpCube<T1, eop_cube_pow> const eOpCube<T1, eop_pow>
pow(const BaseCube<typename T1::elem_type,T1>& A, const typename T1::elem_t ype::value_type exponent) pow(const BaseCube<typename T1::elem_type,T1>& A, const typename T1::elem_t ype::value_type exponent)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
return eOpCube<T1, eop_cube_pow>(A.get_ref(), eT(exponent)); return eOpCube<T1, eop_pow>(A.get_ref(), eT(exponent));
}
#if defined(ARMA_GOOD_COMPILER)
// pow_s32 (integer exponent)
template<typename T1>
arma_inline
const eOp<T1, eop_pow_int>
pow(const Base<typename T1::elem_type,T1>& A, const int exponent)
{
arma_extra_debug_sigprint();
if(exponent >= 0)
{
return eOp<T1, eop_pow_int>(A.get_ref(), exponent, 0);
}
else
{
return eOp<T1, eop_pow_int>(A.get_ref(), -exponent, 1);
}
} }
template<typename T1> // #if defined(ARMA_GOOD_COMPILER)
arma_inline //
const eOpCube<T1, eop_cube_pow_int> //
pow(const BaseCube<typename T1::elem_type,T1>& A, const int exponent) // // pow_s32 (integer exponent)
{ //
arma_extra_debug_sigprint(); // template<typename T1>
// arma_inline
if(exponent >= 0) // const eOp<T1, eop_pow_int>
{ // pow(const Base<typename T1::elem_type,T1>& A, const int exponent)
return eOpCube<T1, eop_cube_pow_int>(A.get_ref(), exponent, 0); // {
} // arma_extra_debug_sigprint();
else //
{ // if(exponent >= 0)
return eOpCube<T1, eop_cube_pow_int>(A.get_ref(), -exponent, 1); // {
} // return eOp<T1, eop_pow_int>(A.get_ref(), exponent, 0);
} // }
// else
#endif // {
// return eOp<T1, eop_pow_int>(A.get_ref(), -exponent, 1);
// }
// }
//
//
//
// template<typename T1>
// arma_inline
// const eOpCube<T1, eop_pow_int>
// pow(const BaseCube<typename T1::elem_type,T1>& A, const int exponent)
// {
// arma_extra_debug_sigprint();
//
// if(exponent >= 0)
// {
// return eOpCube<T1, eop_pow_int>(A.get_ref(), exponent, 0);
// }
// else
// {
// return eOpCube<T1, eop_pow_int>(A.get_ref(), -exponent, 1);
// }
// }
//
//
//
// #endif
//! @} //! @}
 End of changes. 34 change blocks. 
117 lines changed or deleted 144 lines changed or added


 fn_norm.hpp   fn_norm.hpp 
skipping to change at line 21 skipping to change at line 21
// 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 fn_norm //! \addtogroup fn_norm
//! @{ //! @{
template<typename T1> template<typename T1>
arma_hot arma_hot
inline
typename T1::pod_type
norm_unwrap(const Base<typename T1::elem_type, T1>& X, const u32 k)
{
arma_extra_debug_sigprint();
typedef typename T1::elem_type eT;
const unwrap<T1> tmp(X.get_ref());
const Mat<eT>& A = tmp.M;
arma_debug_check( (A.n_elem == 0), "norm(): given
object has no elements" );
arma_debug_check( !( (A.n_rows == 1) || (A.n_cols == 1) ), "norm(): given
object must be a vector" );
const eT* A_mem = A.memptr();
const u32 N = A.n_elem;
switch(k)
{
case 1:
return arrayops::norm_1( A_mem, N );
break;
case 2:
return arrayops::norm_2( A_mem, N );
break;
default:
arma_debug_check( (k == 0), "norm(): k must be greater than zero" );
return arrayops::norm_k( A_mem, N, int(k) );
}
}
template<typename T1>
arma_hot
inline
typename T1::pod_type
norm_unwrap(const Base<typename T1::elem_type, T1>& X, const char* method)
{
arma_extra_debug_sigprint();
typedef typename T1::elem_type eT;
typedef typename T1::pod_type T;
const unwrap<T1> tmp(X.get_ref());
const Mat<eT>& A = tmp.M;
arma_debug_check( (A.n_elem == 0), "norm(): given
object has no elements" );
arma_debug_check( !( (A.n_rows == 1) || (A.n_cols == 1) ), "norm(): given
object must be a vector" );
const eT* A_mem = A.memptr();
const u32 N = A.n_elem;
const char sig = method[0];
if( (sig == 'i') || (sig == 'I') || (sig == '+') ) // max norm
{
return arrayops::norm_max(A_mem, N);
}
else
if(sig == '-') // min norm
{
return arrayops::norm_min(A_mem, N);
}
else
{
arma_stop("norm(): unknown norm type");
return T(0);
}
}
template<typename T1>
arma_hot
arma_inline arma_inline
typename T1::pod_type typename T1::pod_type
norm_1_proxy(const Proxy<T1>& A) norm_1(const Proxy<T1>& A)
{ {
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);
const u32 N = A.n_elem; ea_type P = A.get_ea();
const u32 N = A.get_n_elem();
u32 i,j; u32 i,j;
for(i=0, j=1; j<N; i+=2, j+=2) for(i=0, j=1; j<N; i+=2, j+=2)
{ {
acc += std::abs(A[i]); acc += std::abs(P[i]);
acc += std::abs(A[j]); acc += std::abs(P[j]);
} }
if(i < N) if(i < N)
{ {
acc += std::abs(A[i]); acc += std::abs(P[i]);
} }
return acc; return acc;
} }
template<typename T1> template<typename T1>
arma_hot arma_hot
arma_inline arma_inline
typename T1::pod_type typename T1::pod_type
norm_2_proxy(const Proxy<T1>& A, const typename arma_not_cx<typename T1::el em_type>::result* junk = 0) norm_2(const Proxy<T1>& A, const typename arma_not_cx<typename T1::elem_typ e>::result* junk = 0)
{ {
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);
const u32 N = A.n_elem; ea_type P = A.get_ea();
const u32 N = A.get_n_elem();
u32 i,j; u32 i,j;
for(i=0, j=1; j<N; i+=2, j+=2) for(i=0, j=1; j<N; i+=2, j+=2)
{ {
const T tmp_i = A[i]; const T tmp_i = P[i];
const T tmp_j = A[j]; const T tmp_j = P[j];
acc += tmp_i * tmp_i; acc += tmp_i * tmp_i;
acc += tmp_j * tmp_j; acc += tmp_j * tmp_j;
} }
if(i < N) if(i < N)
{ {
const T tmp_i = A[i]; const T tmp_i = P[i];
acc += tmp_i * tmp_i; acc += tmp_i * tmp_i;
} }
return std::sqrt(acc); return std::sqrt(acc);
} }
template<typename T1> template<typename T1>
arma_hot arma_hot
arma_inline arma_inline
typename T1::pod_type typename T1::pod_type
norm_2_proxy(const Proxy<T1>& A, const typename arma_cx_only<typename T1::e lem_type>::result* junk = 0) norm_2(const Proxy<T1>& A, const typename arma_cx_only<typename T1::elem_ty pe>::result* junk = 0)
{ {
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);
const u32 N = A.n_elem; 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(A[i]); const T tmp = std::abs(P[i]);
acc += tmp*tmp; acc += tmp*tmp;
} }
return std::sqrt(acc); return std::sqrt(acc);
} }
template<typename T1> template<typename T1>
arma_hot arma_hot
arma_inline arma_inline
typename T1::pod_type typename T1::pod_type
norm_k_proxy(const Proxy<T1>& A, const int k) norm_k(const Proxy<T1>& A, const int k)
{ {
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);
const u32 N = A.n_elem; ea_type P = A.get_ea();
const u32 N = A.get_n_elem();
u32 i,j; u32 i,j;
for(i=0, j=1; j<N; i+=2, j+=2) for(i=0, j=1; j<N; i+=2, j+=2)
{ {
acc += std::pow(std::abs(A[i]), k); acc += std::pow(std::abs(P[i]), k);
acc += std::pow(std::abs(A[j]), k); acc += std::pow(std::abs(P[j]), k);
} }
if(i < N) if(i < N)
{ {
acc += std::pow(std::abs(A[i]), k); acc += std::pow(std::abs(P[i]), 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
arma_inline arma_inline
typename T1::pod_type typename T1::pod_type
norm_max_proxy(const Proxy<T1>& A) norm_max(const Proxy<T1>& A)
{ {
typedef typename T1::pod_type T; typedef typename T1::pod_type T;
typedef typename Proxy<T1>::ea_type ea_type;
const u32 N = A.n_elem; ea_type P = A.get_ea();
const u32 N = A.get_n_elem();
T max_val = std::abs(A[0]); T max_val = std::abs(P[0]);
u32 i,j; u32 i,j;
for(i=1, j=2; j<N; i+=2, j+=2) for(i=1, j=2; j<N; i+=2, j+=2)
{ {
const T tmp_i = std::abs(A[i]); const T tmp_i = std::abs(P[i]);
const T tmp_j = std::abs(A[j]); const T tmp_j = std::abs(P[j]);
if(max_val < tmp_i) { max_val = tmp_i; } if(max_val < tmp_i) { max_val = tmp_i; }
if(max_val < tmp_j) { max_val = tmp_j; } if(max_val < tmp_j) { max_val = tmp_j; }
} }
if(i < N) if(i < N)
{ {
const T tmp_i = std::abs(A[i]); const T tmp_i = std::abs(P[i]);
if(max_val < tmp_i) { max_val = tmp_i; } if(max_val < tmp_i) { max_val = tmp_i; }
} }
return max_val; return max_val;
} }
template<typename T1> template<typename T1>
arma_hot arma_hot
arma_inline arma_inline
typename T1::pod_type typename T1::pod_type
norm_min_proxy(const Proxy<T1>& A) norm_min(const Proxy<T1>& A)
{ {
typedef typename T1::pod_type T; typedef typename T1::pod_type T;
typedef typename Proxy<T1>::ea_type ea_type;
const u32 N = A.n_elem; ea_type P = A.get_ea();
const u32 N = A.get_n_elem();
T min_val = std::abs(A[0]); T min_val = std::abs(P[0]);
u32 i,j; u32 i,j;
for(i=1, j=2; j<N; i+=2, j+=2) for(i=1, j=2; j<N; i+=2, j+=2)
{ {
const T tmp_i = std::abs(A[i]); const T tmp_i = std::abs(P[i]);
const T tmp_j = std::abs(A[j]); const T tmp_j = std::abs(P[j]);
if(min_val > tmp_i) { min_val = tmp_i; } if(min_val > tmp_i) { min_val = tmp_i; }
if(min_val > tmp_j) { min_val = tmp_j; } if(min_val > tmp_j) { min_val = tmp_j; }
} }
if(i < N) if(i < N)
{ {
const T tmp_i = std::abs(A[i]); const T tmp_i = std::abs(P[i]);
if(min_val > tmp_i) { min_val = tmp_i; } if(min_val > tmp_i) { min_val = tmp_i; }
} }
return min_val; return min_val;
} }
template<typename T1> template<typename T1>
arma_hot arma_inline
inline arma_warn_unused
typename T1::pod_type typename T1::pod_type
norm_proxy(const Base<typename T1::elem_type, T1>& X, const u32 k) norm
(
const Base<typename T1::elem_type,T1>& X,
const u32 k,
const typename arma_float_or_cx_only<typename T1::elem_type>::result* jun
k = 0
)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
typedef typename T1::pod_type T; typedef typename T1::pod_type T;
const Proxy<T1> A(X.get_ref()); const Proxy<T1> A(X.get_ref());
arma_debug_check( (A.n_elem == 0), "norm(): given arma_debug_check( (A.get_n_elem() == 0), "n
object has no elements" ); orm(): given object has no elements" );
arma_debug_check( !( (A.n_rows == 1) || (A.n_cols == 1) ), "norm(): given arma_debug_check( !( (A.get_n_rows() == 1) || (A.get_n_cols() == 1) ), "n
object must be a vector" ); orm(): given object must be a vector" );
switch(k) switch(k)
{ {
case 1: case 1:
return norm_1_proxy(A); return norm_1(A);
break; break;
case 2: case 2:
return norm_2_proxy(A); return norm_2(A);
break; break;
default: default:
{ {
arma_debug_check( (k == 0), "norm(): k must be greater than zero" ) ; arma_debug_check( (k == 0), "norm(): k must be greater than zero" ) ;
return norm_k_proxy(A, k); return norm_k(A, k);
} }
} }
} }
template<typename T1> template<typename T1>
arma_hot arma_inline
inline arma_warn_unused
typename T1::pod_type typename T1::pod_type
norm_proxy(const Base<typename T1::elem_type, T1>& X, const char* method) norm
(
const Base<typename T1::elem_type,T1>& X,
const char* method,
const typename arma_float_or_cx_only<typename T1::elem_type>::result* jun
k = 0
)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
typedef typename T1::pod_type T; typedef typename T1::pod_type T;
const Proxy<T1> A(X.get_ref()); const Proxy<T1> A(X.get_ref());
arma_debug_check( (A.n_elem == 0), "norm(): given arma_debug_check( (A.get_n_elem() == 0), "n
object has no elements" ); orm(): given object has no elements" );
arma_debug_check( !( (A.n_rows == 1) || (A.n_cols == 1) ), "norm(): given arma_debug_check( !( (A.get_n_rows() == 1) || (A.get_n_cols() == 1) ), "n
object must be a vector" ); orm(): given object must be a vector" );
const char sig = method[0]; const char sig = method[0];
if( (sig == 'i') || (sig == 'I') || (sig == '+') ) // max norm if( (sig == 'i') || (sig == 'I') || (sig == '+') ) // max norm
{ {
return norm_max_proxy(A); return norm_max(A);
} }
else else
if(sig == '-') // min norm if(sig == '-') // min norm
{ {
return norm_min_proxy(A); return norm_min(A);
} }
else else
{ {
arma_stop("norm(): unknown norm type"); arma_stop("norm(): unknown norm type");
return T(0); return T(0);
} }
} }
template<typename T1>
arma_inline
arma_warn_unused
typename T1::pod_type
norm
(
const Base<typename T1::elem_type,T1>& X,
const u32 k,
const typename arma_float_or_cx_only<typename T1::elem_type>::result* jun
k = 0
)
{
arma_extra_debug_sigprint();
return (is_Mat<T1>::value == true) ? norm_unwrap(X, k) : norm_proxy(X, k)
;
}
template<typename T1>
arma_inline
arma_warn_unused
typename T1::pod_type
norm
(
const Base<typename T1::elem_type,T1>& X,
const char* method,
const typename arma_float_or_cx_only<typename T1::elem_type>::result* jun
k = 0
)
{
arma_extra_debug_sigprint();
return (is_Mat<T1>::value == true) ? norm_unwrap(X, method) : norm_proxy(
X, method);
}
//! @} //! @}
 End of changes. 44 change blocks. 
168 lines changed or deleted 78 lines changed or added


 fn_ones.hpp   fn_ones.hpp 
skipping to change at line 69 skipping to change at line 69
ones(const u32 n_rows, const u32 n_cols, const typename arma_Mat_Col_Row_on ly<mat_type>::result* junk = 0) ones(const u32 n_rows, const u32 n_cols, const typename arma_Mat_Col_Row_on ly<mat_type>::result* junk = 0)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_type_check<is_Mat<mat_type>::value == false>::apply(); arma_type_check<is_Mat<mat_type>::value == false>::apply();
return eOp<mat_type, eop_ones_full>(n_rows, n_cols); return eOp<mat_type, eop_ones_full>(n_rows, n_cols);
} }
arma_inline arma_inline
const eOpCube<cube, eop_cube_ones_full> const eOpCube<cube, eop_ones_full>
ones(const u32 n_rows, const u32 n_cols, const u32 n_slices) ones(const u32 n_rows, const u32 n_cols, const u32 n_slices)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return eOpCube<cube, eop_cube_ones_full>(n_rows, n_cols, n_slices); return eOpCube<cube, eop_ones_full>(n_rows, n_cols, n_slices);
} }
template<typename cube_type> template<typename cube_type>
arma_inline arma_inline
const eOpCube<cube_type, eop_cube_ones_full> const eOpCube<cube_type, eop_ones_full>
ones(const u32 n_rows, const u32 n_cols, const u32 n_slices, const typename arma_Cube_only<cube_type>::result* junk = 0) ones(const u32 n_rows, const u32 n_cols, const u32 n_slices, const typename arma_Cube_only<cube_type>::result* junk = 0)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_type_check<is_Cube<cube_type>::value == false>::apply(); arma_type_check<is_Cube<cube_type>::value == false>::apply();
return eOpCube<cube_type, eop_cube_ones_full>(n_rows, n_cols, n_slices); return eOpCube<cube_type, eop_ones_full>(n_rows, n_cols, n_slices);
} }
//! Delayed generation of a diagonal matrix with the diagonal elements set //! Delayed generation of a matrix with the elements along the main diagona
to one l set to one
//! and off-diagonal elements set to zero
arma_inline arma_inline
const eOp<mat, eop_ones_diag> const eOp<mat, eop_ones_diag>
eye(const u32 n_rows, const u32 n_cols) eye(const u32 n_rows, const u32 n_cols)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return eOp<mat, eop_ones_diag>(n_rows, n_cols); return eOp<mat, eop_ones_diag>(n_rows, n_cols);
} }
template<typename mat_type> template<typename mat_type>
 End of changes. 5 change blocks. 
6 lines changed or deleted 7 lines changed or added


 fn_randn.hpp   fn_randn.hpp 
skipping to change at line 82 skipping to change at line 82
arma_inline arma_inline
const eOp<mat_type, eop_randn> const eOp<mat_type, eop_randn>
randn(const u32 n_rows, const u32 n_cols, const typename arma_Mat_Col_Row_o nly<mat_type>::result* junk = 0) randn(const u32 n_rows, const u32 n_cols, const typename arma_Mat_Col_Row_o nly<mat_type>::result* junk = 0)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return eOp<mat_type, eop_randn>(n_rows, n_cols); return eOp<mat_type, eop_randn>(n_rows, n_cols);
} }
arma_inline arma_inline
const eOpCube<cube, eop_cube_randn> const eOpCube<cube, eop_randn>
randn(const u32 n_rows, const u32 n_cols, const u32 n_slices) randn(const u32 n_rows, const u32 n_cols, const u32 n_slices)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return eOpCube<cube, eop_cube_randn>(n_rows, n_cols, n_slices); return eOpCube<cube, eop_randn>(n_rows, n_cols, n_slices);
} }
template<typename cube_type> template<typename cube_type>
arma_inline arma_inline
const eOpCube<cube_type, eop_cube_randn> const eOpCube<cube_type, eop_randn>
randn(const u32 n_rows, const u32 n_cols, const u32 n_slices, const typenam e arma_Cube_only<cube_type>::result* junk = 0) randn(const u32 n_rows, const u32 n_cols, const u32 n_slices, const typenam e arma_Cube_only<cube_type>::result* junk = 0)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return eOpCube<cube_type, eop_cube_randn>(n_rows, n_cols, n_slices); return eOpCube<cube_type, eop_randn>(n_rows, n_cols, n_slices);
} }
//! @} //! @}
 End of changes. 4 change blocks. 
4 lines changed or deleted 4 lines changed or added


 fn_randu.hpp   fn_randu.hpp 
skipping to change at line 82 skipping to change at line 82
arma_inline arma_inline
const eOp<mat_type, eop_randu> const eOp<mat_type, eop_randu>
randu(const u32 n_rows, const u32 n_cols, const typename arma_Mat_Col_Row_o nly<mat_type>::result* junk = 0) randu(const u32 n_rows, const u32 n_cols, const typename arma_Mat_Col_Row_o nly<mat_type>::result* junk = 0)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return eOp<mat_type, eop_randu>(n_rows, n_cols); return eOp<mat_type, eop_randu>(n_rows, n_cols);
} }
arma_inline arma_inline
const eOpCube<cube, eop_cube_randu> const eOpCube<cube, eop_randu>
randu(const u32 n_rows, const u32 n_cols, const u32 n_slices) randu(const u32 n_rows, const u32 n_cols, const u32 n_slices)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return eOpCube<cube, eop_cube_randu>(n_rows, n_cols, n_slices); return eOpCube<cube, eop_randu>(n_rows, n_cols, n_slices);
} }
template<typename cube_type> template<typename cube_type>
arma_inline arma_inline
const eOpCube<cube_type, eop_cube_randu> const eOpCube<cube_type, eop_randu>
randu(const u32 n_rows, const u32 n_cols, const u32 n_slices, const typenam e arma_Cube_only<cube_type>::result* junk = 0) randu(const u32 n_rows, const u32 n_cols, const u32 n_slices, const typenam e arma_Cube_only<cube_type>::result* junk = 0)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return eOpCube<cube_type, eop_cube_randu>(n_rows, n_cols, n_slices); return eOpCube<cube_type, eop_randu>(n_rows, n_cols, n_slices);
} }
// //
// old functions, kept for compatibility with old user code // old functions, kept for compatibility with old user code
//! Generate a dense matrix with all elements set to random values in the [ 0,1] interval (uniform distribution) //! Generate a dense matrix with all elements set to random values in the [ 0,1] interval (uniform distribution)
inline inline
arma_deprecated arma_deprecated
const eOp<mat, eop_randu> const eOp<mat, eop_randu>
rand(const u32 n_rows, const u32 n_cols) rand(const u32 n_rows, const u32 n_cols)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_print("rand() is deprecated; please use randu() instead"); arma_print("rand() is deprecated; please use randu() instead");
return eOp<mat, eop_randu>(n_rows, n_cols); return eOp<mat, eop_randu>(n_rows, n_cols);
} }
inline inline
arma_deprecated arma_deprecated
const eOpCube<cube, eop_cube_randu> const eOpCube<cube, eop_randu>
rand(const u32 n_rows, const u32 n_cols, const u32 n_slices) rand(const u32 n_rows, const u32 n_cols, const u32 n_slices)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_print("rand() is deprecated; please use randu() instead"); arma_print("rand() is deprecated; please use randu() instead");
return eOpCube<cube, eop_cube_randu>(n_rows, n_cols, n_slices); return eOpCube<cube, eop_randu>(n_rows, n_cols, n_slices);
} }
template<typename mat_type> template<typename mat_type>
inline inline
arma_deprecated arma_deprecated
const eOp<mat_type, eop_randu> const eOp<mat_type, eop_randu>
rand(const u32 n_rows, const u32 n_cols) rand(const u32 n_rows, const u32 n_cols)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_type_check<is_Mat<mat_type>::value == false>::apply(); arma_type_check<is_Mat<mat_type>::value == false>::apply();
arma_print("rand() is deprecated; please use randu() instead"); arma_print("rand() is deprecated; please use randu() instead");
return eOp<mat_type, eop_randu>(n_rows, n_cols); return eOp<mat_type, eop_randu>(n_rows, n_cols);
} }
template<typename cube_type> template<typename cube_type>
inline inline
arma_deprecated arma_deprecated
const eOpCube<cube_type, eop_cube_randu> const eOpCube<cube_type, eop_randu>
rand(const u32 n_rows, const u32 n_cols, const u32 n_slices) rand(const u32 n_rows, const u32 n_cols, const u32 n_slices)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_type_check<is_Cube<cube_type>::value == false>::apply(); arma_type_check<is_Cube<cube_type>::value == false>::apply();
arma_print("rand() is deprecated; please use randu() instead"); arma_print("rand() is deprecated; please use randu() instead");
return eOpCube<cube_type, eop_cube_randu>(n_rows, n_cols, n_slices); return eOpCube<cube_type, eop_randu>(n_rows, n_cols, n_slices);
} }
//! Generate a vector with all elements set to random values in the [0,1] i nterval (uniform distribution) //! Generate a vector with all elements set to random values in the [0,1] i nterval (uniform distribution)
inline inline
arma_deprecated arma_deprecated
const eOp<colvec, eop_randu> const eOp<colvec, eop_randu>
rand(const u32 n_elem) rand(const u32 n_elem)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
 End of changes. 8 change blocks. 
8 lines changed or deleted 8 lines changed or added


 fn_sort_index.hpp   fn_sort_index.hpp 
skipping to change at line 86 skipping to change at line 86
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
arma_type_check< is_complex<eT>::value == true>::apply(); arma_type_check< is_complex<eT>::value == true>::apply();
const unwrap<T1> tmp(X.get_ref()); const unwrap<T1> tmp(X.get_ref());
const Mat<eT>& A = tmp.M; const Mat<eT>& A = tmp.M;
if(A.is_empty() == true)
{
return umat();
}
arma_debug_check( (A.is_vec() == false), "sort_index(): currently only ha ndles vectors"); arma_debug_check( (A.is_vec() == false), "sort_index(): currently only ha ndles vectors");
typedef typename umat::elem_type out_elem_type; typedef typename umat::elem_type out_elem_type;
umat out(A.n_rows, A.n_cols); umat out(A.n_rows, A.n_cols);
if(sort_type == 0) if(sort_type == 0)
{ {
std::vector< arma_sort_index_packet_ascend<eT,out_elem_type> > packet_v ec(A.n_elem); std::vector< arma_sort_index_packet_ascend<eT,out_elem_type> > packet_v ec(A.n_elem);
 End of changes. 1 change blocks. 
0 lines changed or deleted 5 lines changed or added


 fn_trace.hpp   fn_trace.hpp 
skipping to change at line 32 skipping to change at line 32
arma_warn_unused arma_warn_unused
typename T1::elem_type typename T1::elem_type
trace(const Base<typename T1::elem_type,T1>& X) trace(const Base<typename T1::elem_type,T1>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
const Proxy<T1> A(X.get_ref()); const Proxy<T1> A(X.get_ref());
arma_debug_check( (A.n_rows != A.n_cols), "trace(): matrix must be square sized" ); arma_debug_check( (A.get_n_rows() != A.get_n_cols()), "trace(): matrix mu st be square sized" );
const u32 N = A.n_rows; const u32 N = A.get_n_rows();
eT val = eT(0); eT val = eT(0);
for(u32 i=0; i<N; ++i) for(u32 i=0; i<N; ++i)
{ {
val += A.at(i,i); val += A.at(i,i);
} }
return val; return val;
} }
 End of changes. 2 change blocks. 
2 lines changed or deleted 2 lines changed or added


 fn_trig.hpp   fn_trig.hpp 
skipping to change at line 40 skipping to change at line 40
const eOp<T1, eop_cos> const eOp<T1, eop_cos>
cos(const Base<typename T1::elem_type,T1>& A) cos(const Base<typename T1::elem_type,T1>& A)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return eOp<T1, eop_cos>(A.get_ref()); return eOp<T1, eop_cos>(A.get_ref());
} }
template<typename T1> template<typename T1>
arma_inline arma_inline
const eOpCube<T1, eop_cube_cos> const eOpCube<T1, eop_cos>
cos(const BaseCube<typename T1::elem_type,T1>& A) cos(const BaseCube<typename T1::elem_type,T1>& A)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return eOpCube<T1, eop_cube_cos>(A.get_ref()); return eOpCube<T1, eop_cos>(A.get_ref());
} }
// //
// acos // acos
template<typename T1> template<typename T1>
arma_inline arma_inline
const eOp<T1, eop_acos> const eOp<T1, eop_acos>
acos(const Base<typename T1::elem_type,T1>& A) acos(const Base<typename T1::elem_type,T1>& A)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return eOp<T1, eop_acos>(A.get_ref()); return eOp<T1, eop_acos>(A.get_ref());
} }
template<typename T1> template<typename T1>
arma_inline arma_inline
const eOpCube<T1, eop_cube_acos> const eOpCube<T1, eop_acos>
acos(const BaseCube<typename T1::elem_type,T1>& A) acos(const BaseCube<typename T1::elem_type,T1>& A)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return eOpCube<T1, eop_cube_acos>(A.get_ref()); return eOpCube<T1, eop_acos>(A.get_ref());
} }
// //
// cosh // cosh
template<typename T1> template<typename T1>
arma_inline arma_inline
const eOp<T1, eop_cosh> const eOp<T1, eop_cosh>
cosh(const Base<typename T1::elem_type,T1>& A) cosh(const Base<typename T1::elem_type,T1>& A)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return eOp<T1, eop_cosh>(A.get_ref()); return eOp<T1, eop_cosh>(A.get_ref());
} }
template<typename T1> template<typename T1>
arma_inline arma_inline
const eOpCube<T1, eop_cube_cosh> const eOpCube<T1, eop_cosh>
cosh(const BaseCube<typename T1::elem_type,T1>& A) cosh(const BaseCube<typename T1::elem_type,T1>& A)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return eOpCube<T1, eop_cube_cosh>(A.get_ref()); return eOpCube<T1, eop_cosh>(A.get_ref());
} }
// //
// acosh // acosh
template<typename T1> template<typename T1>
arma_inline arma_inline
const eOp<T1, eop_acosh> const eOp<T1, eop_acosh>
acosh(const Base<typename T1::elem_type,T1>& A) acosh(const Base<typename T1::elem_type,T1>& A)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return eOp<T1, eop_acosh>(A.get_ref()); return eOp<T1, eop_acosh>(A.get_ref());
} }
template<typename T1> template<typename T1>
arma_inline arma_inline
const eOpCube<T1, eop_cube_acosh> const eOpCube<T1, eop_acosh>
acosh(const BaseCube<typename T1::elem_type,T1>& A) acosh(const BaseCube<typename T1::elem_type,T1>& A)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return eOpCube<T1, eop_cube_acosh>(A.get_ref()); return eOpCube<T1, eop_acosh>(A.get_ref());
} }
// //
// sin // sin
template<typename T1> template<typename T1>
arma_inline arma_inline
const eOp<T1, eop_sin> const eOp<T1, eop_sin>
sin(const Base<typename T1::elem_type,T1>& A) sin(const Base<typename T1::elem_type,T1>& A)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return eOp<T1, eop_sin>(A.get_ref()); return eOp<T1, eop_sin>(A.get_ref());
} }
template<typename T1> template<typename T1>
arma_inline arma_inline
const eOpCube<T1, eop_cube_sin> const eOpCube<T1, eop_sin>
sin(const BaseCube<typename T1::elem_type,T1>& A) sin(const BaseCube<typename T1::elem_type,T1>& A)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return eOpCube<T1, eop_cube_sin>(A.get_ref()); return eOpCube<T1, eop_sin>(A.get_ref());
} }
// //
// asin // asin
template<typename T1> template<typename T1>
arma_inline arma_inline
const eOp<T1, eop_asin> const eOp<T1, eop_asin>
asin(const Base<typename T1::elem_type,T1>& A) asin(const Base<typename T1::elem_type,T1>& A)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return eOp<T1, eop_asin>(A.get_ref()); return eOp<T1, eop_asin>(A.get_ref());
} }
template<typename T1> template<typename T1>
arma_inline arma_inline
const eOpCube<T1, eop_cube_asin> const eOpCube<T1, eop_asin>
asin(const BaseCube<typename T1::elem_type,T1>& A) asin(const BaseCube<typename T1::elem_type,T1>& A)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return eOpCube<T1, eop_cube_asin>(A.get_ref()); return eOpCube<T1, eop_asin>(A.get_ref());
} }
// //
// sinh // sinh
template<typename T1> template<typename T1>
arma_inline arma_inline
const eOp<T1, eop_sinh> const eOp<T1, eop_sinh>
sinh(const Base<typename T1::elem_type,T1>& A) sinh(const Base<typename T1::elem_type,T1>& A)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return eOp<T1, eop_sinh>(A.get_ref()); return eOp<T1, eop_sinh>(A.get_ref());
} }
template<typename T1> template<typename T1>
arma_inline arma_inline
const eOpCube<T1, eop_cube_sinh> const eOpCube<T1, eop_sinh>
sinh(const BaseCube<typename T1::elem_type,T1>& A) sinh(const BaseCube<typename T1::elem_type,T1>& A)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return eOpCube<T1, eop_cube_sinh>(A.get_ref()); return eOpCube<T1, eop_sinh>(A.get_ref());
} }
// //
// asinh // asinh
template<typename T1> template<typename T1>
arma_inline arma_inline
const eOp<T1, eop_asinh> const eOp<T1, eop_asinh>
asinh(const Base<typename T1::elem_type,T1>& A) asinh(const Base<typename T1::elem_type,T1>& A)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return eOp<T1, eop_asinh>(A.get_ref()); return eOp<T1, eop_asinh>(A.get_ref());
} }
template<typename T1> template<typename T1>
arma_inline arma_inline
const eOpCube<T1, eop_cube_asinh> const eOpCube<T1, eop_asinh>
asinh(const BaseCube<typename T1::elem_type,T1>& A) asinh(const BaseCube<typename T1::elem_type,T1>& A)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return eOpCube<T1, eop_cube_asinh>(A.get_ref()); return eOpCube<T1, eop_asinh>(A.get_ref());
} }
// //
// tan // tan
template<typename T1> template<typename T1>
arma_inline arma_inline
const eOp<T1, eop_tan> const eOp<T1, eop_tan>
tan(const Base<typename T1::elem_type,T1>& A) tan(const Base<typename T1::elem_type,T1>& A)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return eOp<T1, eop_tan>(A.get_ref()); return eOp<T1, eop_tan>(A.get_ref());
} }
template<typename T1> template<typename T1>
arma_inline arma_inline
const eOpCube<T1, eop_cube_tan> const eOpCube<T1, eop_tan>
tan(const BaseCube<typename T1::elem_type,T1>& A) tan(const BaseCube<typename T1::elem_type,T1>& A)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return eOpCube<T1, eop_cube_tan>(A.get_ref()); return eOpCube<T1, eop_tan>(A.get_ref());
} }
// //
// atan // atan
template<typename T1> template<typename T1>
arma_inline arma_inline
const eOp<T1, eop_atan> const eOp<T1, eop_atan>
atan(const Base<typename T1::elem_type,T1>& A) atan(const Base<typename T1::elem_type,T1>& A)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return eOp<T1, eop_atan>(A.get_ref()); return eOp<T1, eop_atan>(A.get_ref());
} }
template<typename T1> template<typename T1>
arma_inline arma_inline
const eOpCube<T1, eop_cube_atan> const eOpCube<T1, eop_atan>
atan(const BaseCube<typename T1::elem_type,T1>& A) atan(const BaseCube<typename T1::elem_type,T1>& A)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return eOpCube<T1, eop_cube_atan>(A.get_ref()); return eOpCube<T1, eop_atan>(A.get_ref());
} }
// //
// tanh // tanh
template<typename T1> template<typename T1>
arma_inline arma_inline
const eOp<T1, eop_tanh> const eOp<T1, eop_tanh>
tanh(const Base<typename T1::elem_type,T1>& A) tanh(const Base<typename T1::elem_type,T1>& A)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return eOp<T1, eop_tanh>(A.get_ref()); return eOp<T1, eop_tanh>(A.get_ref());
} }
template<typename T1> template<typename T1>
arma_inline arma_inline
const eOpCube<T1, eop_cube_tanh> const eOpCube<T1, eop_tanh>
tanh(const BaseCube<typename T1::elem_type,T1>& A) tanh(const BaseCube<typename T1::elem_type,T1>& A)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return eOpCube<T1, eop_cube_tanh>(A.get_ref()); return eOpCube<T1, eop_tanh>(A.get_ref());
} }
// //
// atanh // atanh
template<typename T1> template<typename T1>
arma_inline arma_inline
const eOp<T1, eop_atanh> const eOp<T1, eop_atanh>
atanh(const Base<typename T1::elem_type,T1>& A) atanh(const Base<typename T1::elem_type,T1>& A)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return eOp<T1, eop_atanh>(A.get_ref()); return eOp<T1, eop_atanh>(A.get_ref());
} }
template<typename T1> template<typename T1>
arma_inline arma_inline
const eOpCube<T1, eop_cube_atanh> const eOpCube<T1, eop_atanh>
atanh(const BaseCube<typename T1::elem_type,T1>& A) atanh(const BaseCube<typename T1::elem_type,T1>& A)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return eOpCube<T1, eop_cube_atanh>(A.get_ref()); return eOpCube<T1, eop_atanh>(A.get_ref());
} }
//! @} //! @}
 End of changes. 24 change blocks. 
24 lines changed or deleted 24 lines changed or added


 fn_trunc_exp.hpp   fn_trunc_exp.hpp 
skipping to change at line 65 skipping to change at line 65
const eOp<T1, eop_trunc_exp> const eOp<T1, eop_trunc_exp>
trunc_exp(const Base<typename T1::elem_type,T1>& A) trunc_exp(const Base<typename T1::elem_type,T1>& A)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return eOp<T1, eop_trunc_exp>(A.get_ref()); return eOp<T1, eop_trunc_exp>(A.get_ref());
} }
template<typename T1> template<typename T1>
arma_inline arma_inline
const eOpCube<T1, eop_cube_trunc_exp> const eOpCube<T1, eop_trunc_exp>
trunc_exp(const BaseCube<typename T1::elem_type,T1>& A) trunc_exp(const BaseCube<typename T1::elem_type,T1>& A)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return eOpCube<T1, eop_cube_trunc_exp>(A.get_ref()); return eOpCube<T1, eop_trunc_exp>(A.get_ref());
} }
//! @} //! @}
 End of changes. 2 change blocks. 
2 lines changed or deleted 2 lines changed or added


 fn_trunc_log.hpp   fn_trunc_log.hpp 
skipping to change at line 72 skipping to change at line 72
const eOp<T1, eop_trunc_log> const eOp<T1, eop_trunc_log>
trunc_log(const Base<typename T1::elem_type,T1>& A) trunc_log(const Base<typename T1::elem_type,T1>& A)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return eOp<T1, eop_trunc_log>(A.get_ref()); return eOp<T1, eop_trunc_log>(A.get_ref());
} }
template<typename T1> template<typename T1>
arma_inline arma_inline
const eOpCube<T1, eop_cube_trunc_log> const eOpCube<T1, eop_trunc_log>
trunc_log(const BaseCube<typename T1::elem_type,T1>& A) trunc_log(const BaseCube<typename T1::elem_type,T1>& A)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return eOpCube<T1, eop_cube_trunc_log>(A.get_ref()); return eOpCube<T1, eop_trunc_log>(A.get_ref());
} }
//! @} //! @}
 End of changes. 2 change blocks. 
2 lines changed or deleted 2 lines changed or added


 fn_zeros.hpp   fn_zeros.hpp 
skipping to change at line 69 skipping to change at line 69
zeros(const u32 n_rows, const u32 n_cols, const typename arma_Mat_Col_Row_o nly<mat_type>::result* junk = 0) zeros(const u32 n_rows, const u32 n_cols, const typename arma_Mat_Col_Row_o nly<mat_type>::result* junk = 0)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_type_check<is_Mat<mat_type>::value == false>::apply(); arma_type_check<is_Mat<mat_type>::value == false>::apply();
return eOp<mat_type, eop_zeros>(n_rows, n_cols); return eOp<mat_type, eop_zeros>(n_rows, n_cols);
} }
arma_inline arma_inline
const eOpCube<cube, eop_cube_zeros> const eOpCube<cube, eop_zeros>
zeros(const u32 n_rows, const u32 n_cols, const u32 n_slices) zeros(const u32 n_rows, const u32 n_cols, const u32 n_slices)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return eOpCube<cube, eop_cube_zeros>(n_rows, n_cols, n_slices); return eOpCube<cube, eop_zeros>(n_rows, n_cols, n_slices);
} }
template<typename cube_type> template<typename cube_type>
arma_inline arma_inline
const eOpCube<cube_type, eop_cube_zeros> const eOpCube<cube_type, eop_zeros>
zeros(const u32 n_rows, const u32 n_cols, const u32 n_slices, const typenam e arma_Cube_only<cube_type>::result* junk = 0) zeros(const u32 n_rows, const u32 n_cols, const u32 n_slices, const typenam e arma_Cube_only<cube_type>::result* junk = 0)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_type_check<is_Cube<cube_type>::value == false>::apply(); arma_type_check<is_Cube<cube_type>::value == false>::apply();
return eOpCube<cube_type, eop_cube_zeros>(n_rows, n_cols, n_slices); return eOpCube<cube_type, eop_zeros>(n_rows, n_cols, n_slices);
} }
//! @} //! @}
 End of changes. 4 change blocks. 
4 lines changed or deleted 4 lines changed or added


 forward_proto.hpp   forward_proto.hpp 
skipping to change at line 30 skipping to change at line 30
template<typename eT> class Mat; template<typename eT> class Mat;
template<typename eT> class Col; template<typename eT> class Col;
template<typename eT> class Row; template<typename eT> class Row;
template<typename eT> class Cube; template<typename eT> class Cube;
template<typename oT> class field; template<typename oT> class field;
template<typename eT> class subview; template<typename eT> class subview;
template<typename eT> class subview_col; template<typename eT> class subview_col;
template<typename eT> class subview_row; template<typename eT> class subview_row;
template<typename eT> class subview_cube;
template<typename oT> class subview_field; template<typename oT> class subview_field;
template<typename oT> class subview_cube;
template<typename eT> class diagview; template<typename eT> class diagview;
class diskio; class diskio;
class op_min; class op_min;
class op_max; class op_max;
class op_trans; class op_trans;
class op_htrans; class op_htrans;
skipping to change at line 73 skipping to change at line 73
class op_rel_lteq_pre; class op_rel_lteq_pre;
class op_rel_lteq_post; class op_rel_lteq_post;
class op_rel_gteq_pre; class op_rel_gteq_pre;
class op_rel_gteq_post; class op_rel_gteq_post;
class op_rel_eq; class op_rel_eq;
class op_rel_noteq; class op_rel_noteq;
template<const bool, const bool, const bool, const bool> class gemm; template<const bool, const bool, const bool, const bool> class gemm;
template<const bool, const bool, const bool> class gemv; template<const bool, const bool, const bool> class gemv;
template<typename T1, typename op_type> class Op; template< typename T1, typename op_type> class Op;
template<typename T1, typename eop_type> class eOp; template< typename T1, typename eop_type> class eOp;
template<typename out_eT, typename T1, typename op_type> class mtOp;
template<typename T1, typename op_type> class OpCube;
template<typename T1, typename eop_type> class eOpCube; template< typename T1, typename T2, typename glue_type> cl
ass Glue;
template<typename T1, typename T2, typename glue_type> class Glue; template< typename T1, typename T2, typename eglue_type> cl
template<typename T1, typename T2, typename eglue_type> class eGlue; ass eGlue;
template<typename out_eT, typename T1, typename T2, typename glue_type> cl
template<typename out_eT, typename T1, typename op_type > cla ass mtGlue;
ss mtOp;
template<typename out_eT, typename T1, typename T2, typename glue_type> cla template< typename T1, typename op_type> class OpCube;
ss mtGlue; template< typename T1, typename eop_type> class eOpCube;
template<typename out_eT, typename T1, typename op_type> class mtOpCube;
template<typename T1, typename T2, typename glue_type> class GlueCube;
template<typename T1, typename T2, typename eglue_type> class eGlueCube; template< typename T1, typename T2, typename glue_type> cl
ass GlueCube;
template< typename T1, typename T2, typename eglue_type> cl
ass eGlueCube;
template<typename out_eT, typename T1, typename T2, typename glue_type> cl
ass mtGlueCube;
template<typename T1> class Proxy; template<typename T1> class Proxy;
template<typename T1> class ProxyCube; template<typename T1> class ProxyCube;
//! \addtogroup injector //! \addtogroup injector
//! @{ //! @{
enum injector_helper enum injector_helper
{ {
endr //!< indicate "end of row", similar conceptual meaning to std::endl endr //!< indicate "end of row", similar conceptual meaning to std::endl
 End of changes. 3 change blocks. 
17 lines changed or deleted 22 lines changed or added


 gemm.hpp   gemm.hpp 
skipping to change at line 411 skipping to change at line 411
public: public:
template<typename eT> template<typename eT>
inline inline
static static
void void
apply_blas_type( Mat<eT>& C, const Mat<eT>& A, const Mat<eT>& B, const eT alpha = eT(1), const eT beta = eT(0) ) apply_blas_type( Mat<eT>& C, const Mat<eT>& A, const Mat<eT>& B, const eT alpha = eT(1), const eT beta = eT(0) )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
if( ((A.n_elem <= 64u) && (B.n_elem <= 64u)) ) if( ((A.n_elem < 64u) && (B.n_elem < 64u)) )
{ {
gemm_emul_simple<do_trans_A, do_trans_B, use_alpha, use_beta>::apply( C,A,B,alpha,beta); gemm_emul_simple<do_trans_A, do_trans_B, use_alpha, use_beta>::apply( C,A,B,alpha,beta);
} }
else else
{ {
#if defined(ARMA_USE_ATLAS) #if defined(ARMA_USE_ATLAS)
{ {
arma_extra_debug_print("atlas::cblas_gemm()"); arma_extra_debug_print("atlas::cblas_gemm()");
atlas::cblas_gemm<eT> atlas::cblas_gemm<eT>
skipping to change at line 446 skipping to change at line 446
C.n_rows C.n_rows
); );
} }
#elif defined(ARMA_USE_BLAS) #elif defined(ARMA_USE_BLAS)
{ {
arma_extra_debug_print("blas::gemm_()"); arma_extra_debug_print("blas::gemm_()");
const char trans_A = (do_trans_A) ? 'T' : 'N'; const char trans_A = (do_trans_A) ? 'T' : 'N';
const char trans_B = (do_trans_B) ? 'T' : 'N'; const char trans_B = (do_trans_B) ? 'T' : 'N';
const int m = C.n_rows; const blas_int m = C.n_rows;
const int n = C.n_cols; const blas_int n = C.n_cols;
const int k = (do_trans_A) ? A.n_rows : A.n_cols; const blas_int k = (do_trans_A) ? A.n_rows : A.n_cols;
const eT local_alpha = (use_alpha) ? alpha : eT(1); const eT local_alpha = (use_alpha) ? alpha : eT(1);
const int lda = (do_trans_A) ? k : m; const blas_int lda = (do_trans_A) ? k : m;
const int ldb = (do_trans_B) ? n : k; const blas_int ldb = (do_trans_B) ? n : k;
const eT local_beta = (use_beta) ? beta : eT(0); const eT local_beta = (use_beta) ? beta : eT(0);
arma_extra_debug_print( arma_boost::format("blas::gemm_(): trans_A = %c") % trans_A ); arma_extra_debug_print( arma_boost::format("blas::gemm_(): trans_A = %c") % trans_A );
arma_extra_debug_print( arma_boost::format("blas::gemm_(): trans_B = %c") % trans_B ); arma_extra_debug_print( arma_boost::format("blas::gemm_(): trans_B = %c") % trans_B );
blas::gemm_<eT> blas::gemm_<eT>
( (
&trans_A, &trans_A,
&trans_B, &trans_B,
 End of changes. 3 change blocks. 
6 lines changed or deleted 6 lines changed or added


 gemv.hpp   gemv.hpp 
skipping to change at line 162 skipping to change at line 162
1, 1,
(use_beta) ? beta : eT(0), (use_beta) ? beta : eT(0),
y, y,
1 1
); );
} }
#elif defined(ARMA_USE_BLAS) #elif defined(ARMA_USE_BLAS)
{ {
arma_extra_debug_print("blas::gemv_()"); arma_extra_debug_print("blas::gemv_()");
const char trans_A = (do_trans_A) ? 'T' : 'N'; const char trans_A = (do_trans_A) ? 'T' : 'N';
const int m = A.n_rows; const blas_int m = A.n_rows;
const int n = A.n_cols; const blas_int n = A.n_cols;
const eT local_alpha = (use_alpha) ? alpha : eT(1); const eT local_alpha = (use_alpha) ? alpha : eT(1);
//const int lda = A.n_rows; //const blas_int lda = A.n_rows;
const int inc = 1; const blas_int inc = 1;
const eT local_beta = (use_beta) ? beta : eT(0); const eT local_beta = (use_beta) ? beta : eT(0);
arma_extra_debug_print( arma_boost::format("blas::gemv_(): trans_A = %c") % trans_A ); arma_extra_debug_print( arma_boost::format("blas::gemv_(): trans_A = %c") % trans_A );
blas::gemv_<eT> blas::gemv_<eT>
( (
&trans_A, &trans_A,
&m, &m,
&n, &n,
&local_alpha, &local_alpha,
A.mem, A.mem,
 End of changes. 1 change blocks. 
7 lines changed or deleted 7 lines changed or added


 glue_join_meat.hpp   glue_join_meat.hpp 
skipping to change at line 98 skipping to change at line 98
C.submat(0, 0, C.n_rows-1, A.n_cols-1) = A; C.submat(0, 0, C.n_rows-1, A.n_cols-1) = A;
C.submat(0, A.n_cols, C.n_rows-1, C.n_cols-1) = B; C.submat(0, A.n_cols, C.n_rows-1, C.n_cols-1) = B;
} }
out.steal_mem(C); out.steal_mem(C);
} }
} }
template<typename T1, typename T2>
inline
void
glue_join::apply(Cube<typename T1::elem_type>& out, const GlueCube<T1,T2,gl
ue_join>& X)
{
arma_extra_debug_sigprint();
typedef typename T1::elem_type eT;
const unwrap_cube<T1> A_tmp(X.A);
const unwrap_cube<T2> B_tmp(X.B);
const Cube<eT>& A = A_tmp.M;
const Cube<eT>& B = B_tmp.M;
if(A.n_elem == 0)
{
out = B;
return;
}
if(B.n_elem == 0)
{
out = A;
return;
}
arma_debug_check( ( (A.n_rows != B.n_rows) || (A.n_cols != B.n_cols) ), "
join_slices(): size of slices must be the same" );
if( (&out != &A) && (&out != &B) )
{
out.set_size(A.n_rows, A.n_cols, A.n_slices + B.n_slices);
out.slices(0, A.n_slices-1 ) = A;
out.slices(A.n_slices, out.n_slices-1) = B;
}
else // we have aliasing
{
Cube<eT> C(A.n_rows, A.n_cols, A.n_slices + B.n_slices);
C.slices(0, A.n_slices-1) = A;
C.slices(A.n_slices, C.n_slices-1) = B;
out.steal_mem(C);
}
}
//! @} //! @}
 End of changes. 1 change blocks. 
0 lines changed or deleted 50 lines changed or added


 glue_join_proto.hpp   glue_join_proto.hpp 
skipping to change at line 23 skipping to change at line 23
// 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_join //! \addtogroup glue_join
//! @{ //! @{
class glue_join class glue_join
{ {
public: public:
template<typename T1, typename T2> inline static void apply(Mat<typename template<typename T1, typename T2>
T1::elem_type>& out, const Glue<T1,T2,glue_join>& X); inline static void apply(Mat<typename T1::elem_type>& out, const Glue<T1,
T2,glue_join>& X);
template<typename T1, typename T2>
inline static void apply(Cube<typename T1::elem_type>& out, const GlueCub
e<T1,T2,glue_join>& X);
}; };
//! @} //! @}
 End of changes. 1 change blocks. 
2 lines changed or deleted 7 lines changed or added


 glue_mixed_meat.hpp   glue_mixed_meat.hpp 
skipping to change at line 84 skipping to change at line 84
typedef typename promote_type<eT1,eT2>::result out_eT; typedef typename promote_type<eT1,eT2>::result out_eT;
promote_type<eT1,eT2>::check(); promote_type<eT1,eT2>::check();
const Proxy<T1> A(X.A); const Proxy<T1> A(X.A);
const Proxy<T2> B(X.B); const Proxy<T2> B(X.B);
arma_debug_assert_same_size(A, B, "matrix addition"); arma_debug_assert_same_size(A, B, "matrix addition");
out.set_size(A.n_rows, A.n_cols); out.set_size(A.get_n_rows(), A.get_n_cols());
out_eT* out_mem = out.memptr(); out_eT* out_mem = out.memptr();
const u32 n_elem = out.n_elem; const u32 n_elem = out.n_elem;
for(u32 i=0; i<n_elem; ++i) for(u32 i=0; i<n_elem; ++i)
{ {
out_mem[i] = upgrade_val<eT1,eT2>::apply(A[i]) + upgrade_val<eT1,eT2>:: apply(B[i]); out_mem[i] = upgrade_val<eT1,eT2>::apply(A[i]) + upgrade_val<eT1,eT2>:: apply(B[i]);
} }
} }
skipping to change at line 115 skipping to change at line 115
typedef typename promote_type<eT1,eT2>::result out_eT; typedef typename promote_type<eT1,eT2>::result out_eT;
promote_type<eT1,eT2>::check(); promote_type<eT1,eT2>::check();
const Proxy<T1> A(X.A); const Proxy<T1> A(X.A);
const Proxy<T2> B(X.B); const Proxy<T2> B(X.B);
arma_debug_assert_same_size(A, B, "matrix subtraction"); arma_debug_assert_same_size(A, B, "matrix subtraction");
out.set_size(A.n_rows, A.n_cols); out.set_size(A.get_n_rows(), A.get_n_cols());
out_eT* out_mem = out.memptr(); out_eT* out_mem = out.memptr();
const u32 n_elem = out.n_elem; const u32 n_elem = out.n_elem;
for(u32 i=0; i<n_elem; ++i) for(u32 i=0; i<n_elem; ++i)
{ {
out_mem[i] = upgrade_val<eT1,eT2>::apply(A[i]) - upgrade_val<eT1,eT2>:: apply(B[i]); out_mem[i] = upgrade_val<eT1,eT2>::apply(A[i]) - upgrade_val<eT1,eT2>:: apply(B[i]);
} }
} }
skipping to change at line 146 skipping to change at line 146
typedef typename promote_type<eT1,eT2>::result out_eT; typedef typename promote_type<eT1,eT2>::result out_eT;
promote_type<eT1,eT2>::check(); promote_type<eT1,eT2>::check();
const Proxy<T1> A(X.A); const Proxy<T1> A(X.A);
const Proxy<T2> B(X.B); const Proxy<T2> B(X.B);
arma_debug_assert_same_size(A, B, "element-wise matrix division"); arma_debug_assert_same_size(A, B, "element-wise matrix division");
out.set_size(A.n_rows, A.n_cols); out.set_size(A.get_n_rows(), A.get_n_cols());
out_eT* out_mem = out.memptr(); out_eT* out_mem = out.memptr();
const u32 n_elem = out.n_elem; const u32 n_elem = out.n_elem;
for(u32 i=0; i<n_elem; ++i) for(u32 i=0; i<n_elem; ++i)
{ {
out_mem[i] = upgrade_val<eT1,eT2>::apply(A[i]) / upgrade_val<eT1,eT2>:: apply(B[i]); out_mem[i] = upgrade_val<eT1,eT2>::apply(A[i]) / upgrade_val<eT1,eT2>:: apply(B[i]);
} }
} }
skipping to change at line 177 skipping to change at line 177
typedef typename promote_type<eT1,eT2>::result out_eT; typedef typename promote_type<eT1,eT2>::result out_eT;
promote_type<eT1,eT2>::check(); promote_type<eT1,eT2>::check();
const Proxy<T1> A(X.A); const Proxy<T1> A(X.A);
const Proxy<T2> B(X.B); const Proxy<T2> B(X.B);
arma_debug_assert_same_size(A, B, "element-wise matrix multiplication"); arma_debug_assert_same_size(A, B, "element-wise matrix multiplication");
out.set_size(A.n_rows, A.n_cols); out.set_size(A.get_n_rows(), A.get_n_cols());
out_eT* out_mem = out.memptr();
const u32 n_elem = out.n_elem;
for(u32 i=0; i<n_elem; ++i)
{
out_mem[i] = upgrade_val<eT1,eT2>::apply(A[i]) * upgrade_val<eT1,eT2>::
apply(B[i]);
}
}
//
//
//
//! cube addition with different element types
template<typename T1, typename T2>
inline
void
glue_mixed_plus::apply(Cube<typename eT_promoter<T1,T2>::eT>& out, const mt
GlueCube<typename eT_promoter<T1,T2>::eT, T1, T2, glue_mixed_plus>& X)
{
arma_extra_debug_sigprint();
typedef typename T1::elem_type eT1;
typedef typename T2::elem_type eT2;
typedef typename promote_type<eT1,eT2>::result out_eT;
promote_type<eT1,eT2>::check();
const ProxyCube<T1> A(X.A);
const ProxyCube<T2> B(X.B);
arma_debug_assert_same_size(A, B, "cube addition");
out.set_size(A.get_n_rows(), A.get_n_cols(), A.get_n_slices());
out_eT* out_mem = out.memptr();
const u32 n_elem = out.n_elem;
for(u32 i=0; i<n_elem; ++i)
{
out_mem[i] = upgrade_val<eT1,eT2>::apply(A[i]) + upgrade_val<eT1,eT2>::
apply(B[i]);
}
}
//! cube subtraction with different element types
template<typename T1, typename T2>
inline
void
glue_mixed_minus::apply(Cube<typename eT_promoter<T1,T2>::eT>& out, const m
tGlueCube<typename eT_promoter<T1,T2>::eT, T1, T2, glue_mixed_minus>& X)
{
arma_extra_debug_sigprint();
typedef typename T1::elem_type eT1;
typedef typename T2::elem_type eT2;
typedef typename promote_type<eT1,eT2>::result out_eT;
promote_type<eT1,eT2>::check();
const ProxyCube<T1> A(X.A);
const ProxyCube<T2> B(X.B);
arma_debug_assert_same_size(A, B, "cube subtraction");
out.set_size(A.get_n_rows(), A.get_n_cols(), A.get_n_slices());
out_eT* out_mem = out.memptr();
const u32 n_elem = out.n_elem;
for(u32 i=0; i<n_elem; ++i)
{
out_mem[i] = upgrade_val<eT1,eT2>::apply(A[i]) - upgrade_val<eT1,eT2>::
apply(B[i]);
}
}
//! element-wise cube division with different element types
template<typename T1, typename T2>
inline
void
glue_mixed_div::apply(Cube<typename eT_promoter<T1,T2>::eT>& out, const mtG
lueCube<typename eT_promoter<T1,T2>::eT, T1, T2, glue_mixed_div>& X)
{
arma_extra_debug_sigprint();
typedef typename T1::elem_type eT1;
typedef typename T2::elem_type eT2;
typedef typename promote_type<eT1,eT2>::result out_eT;
promote_type<eT1,eT2>::check();
const ProxyCube<T1> A(X.A);
const ProxyCube<T2> B(X.B);
arma_debug_assert_same_size(A, B, "element-wise cube division");
out.set_size(A.get_n_rows(), A.get_n_cols(), A.get_n_slices());
out_eT* out_mem = out.memptr();
const u32 n_elem = out.n_elem;
for(u32 i=0; i<n_elem; ++i)
{
out_mem[i] = upgrade_val<eT1,eT2>::apply(A[i]) / upgrade_val<eT1,eT2>::
apply(B[i]);
}
}
//! element-wise cube multiplication with different element types
template<typename T1, typename T2>
inline
void
glue_mixed_schur::apply(Cube<typename eT_promoter<T1,T2>::eT>& out, const m
tGlueCube<typename eT_promoter<T1,T2>::eT, T1, T2, glue_mixed_schur>& X)
{
arma_extra_debug_sigprint();
typedef typename T1::elem_type eT1;
typedef typename T2::elem_type eT2;
typedef typename promote_type<eT1,eT2>::result out_eT;
promote_type<eT1,eT2>::check();
const ProxyCube<T1> A(X.A);
const ProxyCube<T2> B(X.B);
arma_debug_assert_same_size(A, B, "element-wise cube multiplication");
out.set_size(A.get_n_rows(), A.get_n_cols(), A.get_n_slices());
out_eT* out_mem = out.memptr(); out_eT* out_mem = out.memptr();
const u32 n_elem = out.n_elem; const u32 n_elem = out.n_elem;
for(u32 i=0; i<n_elem; ++i) for(u32 i=0; i<n_elem; ++i)
{ {
out_mem[i] = upgrade_val<eT1,eT2>::apply(A[i]) * upgrade_val<eT1,eT2>:: apply(B[i]); out_mem[i] = upgrade_val<eT1,eT2>::apply(A[i]) * upgrade_val<eT1,eT2>:: apply(B[i]);
} }
} }
 End of changes. 4 change blocks. 
4 lines changed or deleted 140 lines changed or added


 glue_mixed_proto.hpp   glue_mixed_proto.hpp 
skipping to change at line 33 skipping to change at line 33
template<typename T1, typename T2> template<typename T1, typename T2>
inline static void apply(Mat<typename eT_promoter<T1,T2>::eT>& out, const mtGlue<typename eT_promoter<T1,T2>::eT, T1, T2, glue_mixed_times>& X); inline static void apply(Mat<typename eT_promoter<T1,T2>::eT>& out, const mtGlue<typename eT_promoter<T1,T2>::eT, T1, T2, glue_mixed_times>& X);
}; };
class glue_mixed_plus class glue_mixed_plus
{ {
public: public:
template<typename T1, typename T2> template<typename T1, typename T2>
inline static void apply(Mat<typename eT_promoter<T1,T2>::eT>& out, const mtGlue<typename eT_promoter<T1,T2>::eT, T1, T2, glue_mixed_plus>& X); inline static void apply(Mat<typename eT_promoter<T1,T2>::eT>& out, const mtGlue<typename eT_promoter<T1,T2>::eT, T1, T2, glue_mixed_plus>& X);
template<typename T1, typename T2>
inline static void apply(Cube<typename eT_promoter<T1,T2>::eT>& out, cons
t mtGlueCube<typename eT_promoter<T1,T2>::eT, T1, T2, glue_mixed_plus>& X);
}; };
class glue_mixed_minus class glue_mixed_minus
{ {
public: public:
template<typename T1, typename T2> template<typename T1, typename T2>
inline static void apply(Mat<typename eT_promoter<T1,T2>::eT>& out, const mtGlue<typename eT_promoter<T1,T2>::eT, T1, T2, glue_mixed_minus>& X); inline static void apply(Mat<typename eT_promoter<T1,T2>::eT>& out, const mtGlue<typename eT_promoter<T1,T2>::eT, T1, T2, glue_mixed_minus>& X);
template<typename T1, typename T2>
inline static void apply(Cube<typename eT_promoter<T1,T2>::eT>& out, cons
t mtGlueCube<typename eT_promoter<T1,T2>::eT, T1, T2, glue_mixed_minus>& X)
;
}; };
class glue_mixed_div class glue_mixed_div
{ {
public: public:
template<typename T1, typename T2> template<typename T1, typename T2>
inline static void apply(Mat<typename eT_promoter<T1,T2>::eT>& out, const mtGlue<typename eT_promoter<T1,T2>::eT, T1, T2, glue_mixed_div>& X); inline static void apply(Mat<typename eT_promoter<T1,T2>::eT>& out, const mtGlue<typename eT_promoter<T1,T2>::eT, T1, T2, glue_mixed_div>& X);
template<typename T1, typename T2>
inline static void apply(Cube<typename eT_promoter<T1,T2>::eT>& out, cons
t mtGlueCube<typename eT_promoter<T1,T2>::eT, T1, T2, glue_mixed_div>& X);
}; };
class glue_mixed_schur class glue_mixed_schur
{ {
public: public:
template<typename T1, typename T2> template<typename T1, typename T2>
inline static void apply(Mat<typename eT_promoter<T1,T2>::eT>& out, const mtGlue<typename eT_promoter<T1,T2>::eT, T1, T2, glue_mixed_schur>& X); inline static void apply(Mat<typename eT_promoter<T1,T2>::eT>& out, const mtGlue<typename eT_promoter<T1,T2>::eT, T1, T2, glue_mixed_schur>& X);
template<typename T1, typename T2>
inline static void apply(Cube<typename eT_promoter<T1,T2>::eT>& out, cons
t mtGlueCube<typename eT_promoter<T1,T2>::eT, T1, T2, glue_mixed_schur>& X)
;
}; };
//! @} //! @}
 End of changes. 4 change blocks. 
0 lines changed or deleted 18 lines changed or added


 glue_relational_meat.hpp   glue_relational_meat.hpp 
skipping to change at line 30 skipping to change at line 30
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();
const Proxy<T1> A(X.A); typedef typename Proxy<T1>::ea_type ea_type1;
const Proxy<T2> B(X.B); typedef typename Proxy<T2>::ea_type ea_type2;
arma_debug_assert_same_size(A, B, "operator<"); const Proxy<T1> P1(X.A);
const Proxy<T2> P2(X.B);
out.set_size(A.n_rows, A.n_cols); arma_debug_assert_same_size(P1, P2, "operator<");
const u32 n_elem = A.n_elem; out.set_size(P1.get_n_rows(), P1.get_n_cols());
u32* out_mem = out.memptr();
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) for(u32 i=0; i<n_elem; ++i)
{ {
out_mem[i] = (A[i] < B[i]) ? u32(1) : u32(0); 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();
const Proxy<T1> A(X.A); typedef typename Proxy<T1>::ea_type ea_type1;
const Proxy<T2> B(X.B); 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(A, B, "operator>"); arma_debug_assert_same_size(P1, P2, "operator>");
out.set_size(A.n_rows, A.n_cols); out.set_size(P1.get_n_rows(), P1.get_n_cols());
const u32 n_elem = A.n_elem; const u32 n_elem = out.n_elem;
u32* out_mem = out.memptr(); 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) for(u32 i=0; i<n_elem; ++i)
{ {
out_mem[i] = (A[i] > B[i]) ? u32(1) : u32(0); 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();
const Proxy<T1> A(X.A); typedef typename Proxy<T1>::ea_type ea_type1;
const Proxy<T2> B(X.B); 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(A, B, "operator<="); arma_debug_assert_same_size(P1, P2, "operator<=");
out.set_size(A.n_rows, A.n_cols); out.set_size(P1.get_n_rows(), P1.get_n_cols());
const u32 n_elem = A.n_elem; const u32 n_elem = out.n_elem;
u32* out_mem = out.memptr(); 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) for(u32 i=0; i<n_elem; ++i)
{ {
out_mem[i] = (A[i] <= B[i]) ? u32(1) : u32(0); 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();
const Proxy<T1> A(X.A); typedef typename Proxy<T1>::ea_type ea_type1;
const Proxy<T2> B(X.B); 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(A, B, "operator>="); arma_debug_assert_same_size(P1, P2, "operator>=");
out.set_size(A.n_rows, A.n_cols); out.set_size(P1.get_n_rows(), P1.get_n_cols());
const u32 n_elem = A.n_elem; const u32 n_elem = out.n_elem;
u32* out_mem = out.memptr(); 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) for(u32 i=0; i<n_elem; ++i)
{ {
out_mem[i] = (A[i] >= B[i]) ? u32(1) : u32(0); 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();
const Proxy<T1> A(X.A); typedef typename Proxy<T1>::ea_type ea_type1;
const Proxy<T2> B(X.B); 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(A, B, "operator=="); arma_debug_assert_same_size(P1, P2, "operator==");
out.set_size(A.n_rows, A.n_cols); out.set_size(P1.get_n_rows(), P1.get_n_cols());
const u32 n_elem = A.n_elem; const u32 n_elem = out.n_elem;
u32* out_mem = out.memptr(); 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) for(u32 i=0; i<n_elem; ++i)
{ {
out_mem[i] = (A[i] == B[i]) ? u32(1) : u32(0); 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();
const Proxy<T1> A(X.A); typedef typename Proxy<T1>::ea_type ea_type1;
const Proxy<T2> B(X.B); 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(A, B, "operator!="); arma_debug_assert_same_size(P1, P2, "operator!=");
out.set_size(A.n_rows, A.n_cols); out.set_size(P1.get_n_rows(), P1.get_n_cols());
const u32 n_elem = A.n_elem; const u32 n_elem = out.n_elem;
u32* out_mem = out.memptr(); 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) for(u32 i=0; i<n_elem; ++i)
{ {
out_mem[i] = (A[i] != B[i]) ? u32(1) : u32(0); out_mem[i] = (A[i] != B[i]) ? u32(1) : u32(0);
} }
}
//
//
//
template<typename T1, typename T2>
inline
void
glue_rel_lt::apply
(
Cube <u32>& out,
const mtGlueCube<u32, T1, T2, glue_rel_lt>& X
)
{
arma_extra_debug_sigprint();
typedef typename ProxyCube<T1>::ea_type ea_type1;
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>
inline
void
glue_rel_gt::apply
(
Cube <u32>& out,
const mtGlueCube<u32, T1, T2, glue_rel_gt>& X
)
{
arma_extra_debug_sigprint();
typedef typename ProxyCube<T1>::ea_type ea_type1;
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>
inline
void
glue_rel_lteq::apply
(
Cube <u32>& out,
const mtGlueCube<u32, T1, T2, glue_rel_lteq>& X
)
{
arma_extra_debug_sigprint();
typedef typename ProxyCube<T1>::ea_type ea_type1;
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>
inline
void
glue_rel_gteq::apply
(
Cube <u32>& out,
const mtGlueCube<u32, T1, T2, glue_rel_gteq>& X
)
{
arma_extra_debug_sigprint();
typedef typename ProxyCube<T1>::ea_type ea_type1;
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>
inline
void
glue_rel_eq::apply
(
Cube <u32>& out,
const mtGlueCube<u32, T1, T2, glue_rel_eq>& X
)
{
arma_extra_debug_sigprint();
typedef typename ProxyCube<T1>::ea_type ea_type1;
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>
inline
void
glue_rel_noteq::apply
(
Cube <u32>& out,
const mtGlueCube<u32, T1, T2, glue_rel_noteq>& X
)
{
arma_extra_debug_sigprint();
typedef typename ProxyCube<T1>::ea_type ea_type1;
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);
}
} }
//! @} //! @}
 End of changes. 31 change blocks. 
41 lines changed or deleted 261 lines changed or added


 glue_relational_proto.hpp   glue_relational_proto.hpp 
skipping to change at line 25 skipping to change at line 25
//! \addtogroup glue_relational //! \addtogroup glue_relational
//! @{ //! @{
class glue_rel_lt class glue_rel_lt
{ {
public: public:
template<typename T1, typename T2> template<typename T1, typename T2>
inline static void apply(Mat <u32>& out, const mtGlue<u32, T1, T2, glue_r el_lt>& X); inline static void apply(Mat <u32>& out, const mtGlue<u32, T1, T2, glue_r el_lt>& X);
template<typename T1, typename T2>
inline static void apply(Cube <u32>& out, const mtGlueCube<u32, T1, T2, g
lue_rel_lt>& X);
}; };
class glue_rel_gt class glue_rel_gt
{ {
public: public:
template<typename T1, typename T2> template<typename T1, typename T2>
inline static void apply(Mat <u32>& out, const mtGlue<u32, T1, T2, glue_r el_gt>& X); inline static void apply(Mat <u32>& out, const mtGlue<u32, T1, T2, glue_r el_gt>& X);
template<typename T1, typename T2>
inline static void apply(Cube <u32>& out, const mtGlueCube<u32, T1, T2, g
lue_rel_gt>& X);
}; };
class glue_rel_lteq class glue_rel_lteq
{ {
public: public:
template<typename T1, typename T2> template<typename T1, typename T2>
inline static void apply(Mat <u32>& out, const mtGlue<u32, T1, T2, glue_r el_lteq>& X); inline static void apply(Mat <u32>& out, const mtGlue<u32, T1, T2, glue_r el_lteq>& X);
template<typename T1, typename T2>
inline static void apply(Cube <u32>& out, const mtGlueCube<u32, T1, T2, g
lue_rel_lteq>& X);
}; };
class glue_rel_gteq class glue_rel_gteq
{ {
public: public:
template<typename T1, typename T2> template<typename T1, typename T2>
inline static void apply(Mat <u32>& out, const mtGlue<u32, T1, T2, glue_r el_gteq>& X); inline static void apply(Mat <u32>& out, const mtGlue<u32, T1, T2, glue_r el_gteq>& X);
template<typename T1, typename T2>
inline static void apply(Cube <u32>& out, const mtGlueCube<u32, T1, T2, g
lue_rel_gteq>& X);
}; };
class glue_rel_eq class glue_rel_eq
{ {
public: public:
template<typename T1, typename T2> template<typename T1, typename T2>
inline static void apply(Mat <u32>& out, const mtGlue<u32, T1, T2, glue_r el_eq>& X); inline static void apply(Mat <u32>& out, const mtGlue<u32, T1, T2, glue_r el_eq>& X);
template<typename T1, typename T2>
inline static void apply(Cube <u32>& out, const mtGlueCube<u32, T1, T2, g
lue_rel_eq>& X);
}; };
class glue_rel_noteq class glue_rel_noteq
{ {
public: public:
template<typename T1, typename T2> template<typename T1, typename T2>
inline static void apply(Mat <u32>& out, const mtGlue<u32, T1, T2, glue_r el_noteq>& X); inline static void apply(Mat <u32>& out, const mtGlue<u32, T1, T2, glue_r el_noteq>& X);
template<typename T1, typename T2>
inline static void apply(Cube <u32>& out, const mtGlueCube<u32, T1, T2, g
lue_rel_noteq>& X);
}; };
//! @} //! @}
 End of changes. 6 change blocks. 
0 lines changed or deleted 24 lines changed or added


 lapack_proto.hpp   lapack_proto.hpp 
skipping to change at line 28 skipping to change at line 28
//! \namespace lapack namespace for LAPACK functions //! \namespace lapack namespace for LAPACK functions
namespace lapack namespace lapack
{ {
//! \addtogroup LAPACK //! \addtogroup LAPACK
//! @{ //! @{
extern "C" extern "C"
{ {
// LU factorisation // LU factorisation
void sgetrf_(int* m, int* n, float* a, int* lda, int* ipiv, int* info) void sgetrf_(blas_int* m, blas_int* n, float* a, blas_int* lda, blas_i
; nt* ipiv, blas_int* info);
void dgetrf_(int* m, int* n, double* a, int* lda, int* ipiv, int* info) void dgetrf_(blas_int* m, blas_int* n, double* a, blas_int* lda, blas_i
; nt* ipiv, blas_int* info);
void cgetrf_(int* m, int* n, void* a, int* lda, int* ipiv, int* info) void cgetrf_(blas_int* m, blas_int* n, void* a, blas_int* lda, blas_i
; nt* ipiv, blas_int* info);
void zgetrf_(int* m, int* n, void* a, int* lda, int* ipiv, int* info) void zgetrf_(blas_int* m, blas_int* n, void* a, blas_int* lda, blas_i
; nt* ipiv, blas_int* info);
// matrix inversion // matrix inversion
void sgetri_(int* n, float* a, int* lda, int* ipiv, float* work, int* void sgetri_(blas_int* n, float* a, blas_int* lda, blas_int* ipiv, fl
lwork, int* info); oat* work, blas_int* lwork, blas_int* info);
void dgetri_(int* n, double* a, int* lda, int* ipiv, double* work, int* void dgetri_(blas_int* n, double* a, blas_int* lda, blas_int* ipiv, dou
lwork, int* info); ble* work, blas_int* lwork, blas_int* info);
void cgetri_(int* n, void* a, int* lda, int* ipiv, void* work, int* void cgetri_(blas_int* n, void* a, blas_int* lda, blas_int* ipiv, v
lwork, int* info); oid* work, blas_int* lwork, blas_int* info);
void zgetri_(int* n, void* a, int* lda, int* ipiv, void* work, int* void zgetri_(blas_int* n, void* a, blas_int* lda, blas_int* ipiv, v
lwork, int* info); oid* work, blas_int* lwork, blas_int* info);
// eigenvector decomposition of symmetric real matrices // eigenvector decomposition of symmetric real matrices
void ssyev_(char* jobz, char* uplo, int* n, float* a, int* lda, float void ssyev_(char* jobz, char* uplo, blas_int* n, float* a, blas_int* l
* w, float* work, int* lwork, int* info); da, float* w, float* work, blas_int* lwork, blas_int* info);
void dsyev_(char* jobz, char* uplo, int* n, double* a, int* lda, double void dsyev_(char* jobz, char* uplo, blas_int* n, double* a, blas_int* l
* w, double* work, int* lwork, int* info); da, double* w, double* work, blas_int* lwork, blas_int* info);
// eigenvector decomposition of hermitian matrices (complex) // eigenvector decomposition of hermitian matrices (complex)
void cheev_(char* jobz, char* uplo, int* n, void* a, int* lda, float void cheev_(char* jobz, char* uplo, blas_int* n, void* a, blas_int* l
* w, void* work, int* lwork, float* rwork, int* info); da, float* w, void* work, blas_int* lwork, float* rwork, blas_int* info
void zheev_(char* jobz, char* uplo, int* n, void* a, int* lda, double );
* w, void* work, int* lwork, double* rwork, int* info); void zheev_(char* jobz, char* uplo, blas_int* n, void* a, blas_int* l
da, double* w, void* work, blas_int* lwork, double* rwork, blas_int* info
);
// eigenvector decomposition of general real matrices // eigenvector decomposition of general real matrices
void sgeev_(char* jobvl, char* jobvr, int* n, float* a, int* lda, flo void sgeev_(char* jobvl, char* jobvr, blas_int* n, float* a, blas_int*
at* wr, float* wi, float* vl, int* ldvl, float* vr, int* ldvr, float* w lda, float* wr, float* wi, float* vl, blas_int* ldvl, float* vr, blas_
ork, int* lwork, int* info); int* ldvr, float* work, blas_int* lwork, blas_int* info);
void dgeev_(char* jobvl, char* jobvr, int* n, double* a, int* lda, doub void dgeev_(char* jobvl, char* jobvr, blas_int* n, double* a, blas_int*
le* wr, double* wi, double* vl, int* ldvl, double* vr, int* ldvr, double* w lda, double* wr, double* wi, double* vl, blas_int* ldvl, double* vr, blas_
ork, int* lwork, int* info); int* ldvr, double* work, blas_int* lwork, blas_int* info);
// eigenvector decomposition of general complex matrices // eigenvector decomposition of general complex matrices
void cgeev_(char* jobvr, char* jobvl, int* n, void* a, int* lda, void* void cgeev_(char* jobvr, char* jobvl, blas_int* n, void* a, blas_int* l
w, void* vl, int* ldvl, void* vr, int* ldvr, void* work, int* lwork, float da, void* w, void* vl, blas_int* ldvl, void* vr, blas_int* ldvr, void* work
* rwork, int* info); , blas_int* lwork, float* rwork, blas_int* info);
void zgeev_(char* jobvl, char* jobvr, int* n, void* a, int* lda, void* void zgeev_(char* jobvl, char* jobvr, blas_int* n, void* a, blas_int* l
w, void* vl, int *ldvl, void* vr, int *ldvr, void* work, int* lwork, double da, void* w, void* vl, blas_int* ldvl, void* vr, blas_int* ldvr, void* work
* rwork, int* info); , blas_int* lwork, double* rwork, blas_int* info);
// Cholesky decomposition // Cholesky decomposition
void spotrf_(char* uplo, int* n, float* a, int* lda, int* info); void spotrf_(char* uplo, blas_int* n, float* a, blas_int* lda, blas_in
void dpotrf_(char* uplo, int* n, double* a, int* lda, int* info); t* info);
void cpotrf_(char* uplo, int* n, void* a, int* lda, int* info); void dpotrf_(char* uplo, blas_int* n, double* a, blas_int* lda, blas_in
void zpotrf_(char* uplo, int* n, void* a, int* lda, int* info); t* info);
void cpotrf_(char* uplo, blas_int* n, void* a, blas_int* lda, blas_in
t* info);
void zpotrf_(char* uplo, blas_int* n, void* a, blas_int* lda, blas_in
t* info);
// QR decomposition // QR decomposition
void sgeqrf_(int* m, int* n, float* a, int* lda, float* tau, float* void sgeqrf_(blas_int* m, blas_int* n, float* a, blas_int* lda, float
work, int* lwork, int* info); * tau, float* work, blas_int* lwork, blas_int* info);
void dgeqrf_(int* m, int* n, double* a, int* lda, double* tau, double* void dgeqrf_(blas_int* m, blas_int* n, double* a, blas_int* lda, double
work, int* lwork, int* info); * tau, double* work, blas_int* lwork, blas_int* info);
void cgeqrf_(int* m, int* n, void* a, int* lda, void* tau, void* void cgeqrf_(blas_int* m, blas_int* n, void* a, blas_int* lda, void
work, int* lwork, int* info); * tau, void* work, blas_int* lwork, blas_int* info);
void zgeqrf_(int* m, int* n, void* a, int* lda, void* tau, void* void zgeqrf_(blas_int* m, blas_int* n, void* a, blas_int* lda, void
work, int* lwork, int* info); * tau, void* work, blas_int* lwork, blas_int* info);
// Q matrix calculation from QR decomposition (real matrices) // Q matrix calculation from QR decomposition (real matrices)
void sorgqr_(int* m, int* n, int* k, float* a, int* lda, float* tau, void sorgqr_(blas_int* m, blas_int* n, blas_int* k, float* a, blas_int
float* work, int* lwork, int* info); * lda, float* tau, float* work, blas_int* lwork, blas_int* info);
void dorgqr_(int* m, int* n, int* k, double* a, int* lda, double* tau, void dorgqr_(blas_int* m, blas_int* n, blas_int* k, double* a, blas_int
double* work, int* lwork, int* info); * lda, double* tau, double* work, blas_int* lwork, blas_int* info);
// Q matrix calculation from QR decomposition (complex matrices) // Q matrix calculation from QR decomposition (complex matrices)
void cungqr_(int* m, int* n, int* k, void* a, int* lda, void* tau, void cungqr_(blas_int* m, blas_int* n, blas_int* k, void* a, blas_int
void* work, int* lwork, int* info); * lda, void* tau, void* work, blas_int* lwork, blas_int* info);
void zungqr_(int* m, int* n, int* k, void* a, int* lda, void* tau, void zungqr_(blas_int* m, blas_int* n, blas_int* k, void* a, blas_int
void* work, int* lwork, int* info); * lda, void* tau, void* work, blas_int* lwork, blas_int* info);
// SVD (real matrices) // SVD (real matrices)
void sgesvd_(char* jobu, char* jobvt, int* m, int* n, float* a, int* l void sgesvd_(char* jobu, char* jobvt, blas_int* m, blas_int* n, float*
da, float* s, float* u, int* ldu, float* vt, int* ldvt, float* work, in a, blas_int* lda, float* s, float* u, blas_int* ldu, float* vt, blas_in
t* lwork, int* info); t* ldvt, float* work, blas_int* lwork, blas_int* info);
void dgesvd_(char* jobu, char* jobvt, int* m, int* n, double* a, int* l void dgesvd_(char* jobu, char* jobvt, blas_int* m, blas_int* n, double*
da, double* s, double* u, int* ldu, double* vt, int* ldvt, double* work, in a, blas_int* lda, double* s, double* u, blas_int* ldu, double* vt, blas_in
t* lwork, int* info); t* ldvt, double* work, blas_int* lwork, blas_int* info);
// SVD (complex matrices) // SVD (complex matrices)
void cgesvd_(char* jobu, char* jobvt, int* m, int* n, void* a, int* l void cgesvd_(char* jobu, char* jobvt, blas_int* m, blas_int* n, void*
da, float* s, void* u, int* ldu, void* vt, int* ldvt, void* work, in a, blas_int* lda, float* s, void* u, blas_int* ldu, void* vt, blas_in
t* lwork, float* rwork, int* info); t* ldvt, void* work, blas_int* lwork, float* rwork, blas_int* info);
void zgesvd_(char* jobu, char* jobvt, int* m, int* n, void* a, int* l void zgesvd_(char* jobu, char* jobvt, blas_int* m, blas_int* n, void*
da, double* s, void* u, int* ldu, void* vt, int* ldvt, void* work, in a, blas_int* lda, double* s, void* u, blas_int* ldu, void* vt, blas_in
t* lwork, double* rwork, int* info); t* ldvt, void* work, blas_int* lwork, double* rwork, blas_int* info);
// solve system of linear equations, using LU decomposition // solve system of linear equations, using LU decomposition
void sgesv_(int* n, int* nrhs, float* a, int* lda, int* ipiv, float* void sgesv_(blas_int* n, blas_int* nrhs, float* a, blas_int* lda, blas
b, int* ldb, int* info); _int* ipiv, float* b, blas_int* ldb, blas_int* info);
void dgesv_(int* n, int* nrhs, double* a, int* lda, int* ipiv, double* void dgesv_(blas_int* n, blas_int* nrhs, double* a, blas_int* lda, blas
b, int* ldb, int* info); _int* ipiv, double* b, blas_int* ldb, blas_int* info);
void cgesv_(int* n, int* nrhs, void* a, int* lda, int* ipiv, void* void cgesv_(blas_int* n, blas_int* nrhs, void* a, blas_int* lda, blas
b, int* ldb, int* info); _int* ipiv, void* b, blas_int* ldb, blas_int* info);
void zgesv_(int* n, int* nrhs, void* a, int* lda, int* ipiv, void* void zgesv_(blas_int* n, blas_int* nrhs, void* a, blas_int* lda, blas
b, int* ldb, int* info); _int* ipiv, void* b, blas_int* ldb, blas_int* info);
// solve over/underdetermined system of linear equations // solve over/underdetermined system of linear equations
void sgels_(char* trans, int* m, int* n, int* nrhs, float* a, int* lda void sgels_(char* trans, blas_int* m, blas_int* n, blas_int* nrhs, floa
, float* b, int* ldb, float* work, int* lwork, int* info); t* a, blas_int* lda, float* b, blas_int* ldb, float* work, blas_int* lwo
void dgels_(char* trans, int* m, int* n, int* nrhs, double* a, int* lda rk, blas_int* info);
, double* b, int* ldb, double* work, int* lwork, int* info); void dgels_(char* trans, blas_int* m, blas_int* n, blas_int* nrhs, doub
void cgels_(char* trans, int* m, int* n, int* nrhs, void* a, int *lda le* a, blas_int* lda, double* b, blas_int* ldb, double* work, blas_int* lwo
, void* b, int* ldb, void* work, int* lwork, int* info); rk, blas_int* info);
void zgels_(char* trans, int* m, int* n, int* nrhs, void* a, int *lda void cgels_(char* trans, blas_int* m, blas_int* n, blas_int* nrhs, void
, void* b, int* ldb, void* work, int* lwork, int* info); * a, blas_int* lda, void* b, blas_int* ldb, void* work, blas_int* lwo
rk, blas_int* info);
void zgels_(char* trans, blas_int* m, blas_int* n, blas_int* nrhs, void
* a, blas_int* lda, void* b, blas_int* ldb, void* work, blas_int* lwo
rk, blas_int* info);
// void dgeqp3_(int* m, int* n, double* a, int* lda, int* jpvt, double* // void dgeqp3_(blas_int* m, blas_int* n, double* a, blas_int* lda, bla
tau, double* work, int* lwork, int* info); s_int* jpvt, double* tau, double* work, blas_int* lwork, blas_int* info);
// void dormqr_(char* side, char* trans, int* m, int* n, int* k, double // void dormqr_(char* side, char* trans, blas_int* m, blas_int* n, blas
* a, int* lda, double* tau, double* c, int* ldc, double* work, int* lwork, _int* k, double* a, blas_int* lda, double* tau, double* c, blas_int* ldc, d
int* info); ouble* work, blas_int* lwork, blas_int* info);
// void dposv_(char* uplo, int* n, int* nrhs, double* a, int* lda, dou // void dposv_(char* uplo, blas_int* n, blas_int* nrhs, double* a, bla
ble* b, int* ldb, int* info); s_int* lda, double* b, blas_int* ldb, blas_int* info);
// void dtrtrs_(char* uplo, char* trans, char* diag, int* n, int* nrhs, // void dtrtrs_(char* uplo, char* trans, char* diag, blas_int* n, blas_
double* a, int* lda, double* b, int* ldb, int* info); int* nrhs, double* a, blas_int* lda, double* b, blas_int* ldb, blas_int* in
// void dgees_(char* jobvs, char* sort, int* select, int* n, double* a fo);
, int* lda, int* sdim, double* wr, double* wi, double* vs, int* ldvs, doubl // void dgees_(char* jobvs, char* sort, blas_int* select, blas_int* n,
e* work, int* lwork, int* bwork, int* info); double* a, blas_int* lda, blas_int* sdim, double* wr, double* wi, double*
vs, blas_int* ldvs, double* work, blas_int* lwork, blas_int* bwork, blas_in
t* info);
} }
template<typename eT> template<typename eT>
inline inline
void void
getrf_(int* m, int* n, eT* a, int* lda, int* ipiv, int* info) getrf_(blas_int* m, blas_int* n, eT* a, blas_int* lda, blas_int* ipiv, bl as_int* info)
{ {
arma_type_check<is_supported_blas_type<eT>::value == false>::apply(); arma_type_check<is_supported_blas_type<eT>::value == false>::apply();
if(is_float<eT>::value == true) if(is_float<eT>::value == true)
{ {
typedef float T; typedef float T;
sgetrf_(m, n, (T*)a, lda, ipiv, info); sgetrf_(m, n, (T*)a, lda, ipiv, info);
} }
else else
if(is_double<eT>::value == true) if(is_double<eT>::value == true)
skipping to change at line 138 skipping to change at line 138
if(is_supported_complex_double<eT>::value == true) if(is_supported_complex_double<eT>::value == true)
{ {
typedef std::complex<double> T; typedef std::complex<double> T;
zgetrf_(m, n, (T*)a, lda, ipiv, info); zgetrf_(m, n, (T*)a, lda, ipiv, info);
} }
} }
template<typename eT> template<typename eT>
inline inline
void void
getri_(int* n, eT* a, int* lda, int* ipiv, eT* work, int* lwork, int* in fo) getri_(blas_int* n, eT* a, blas_int* lda, blas_int* ipiv, eT* work, blas _int* lwork, blas_int* info)
{ {
arma_type_check<is_supported_blas_type<eT>::value == false>::apply(); arma_type_check<is_supported_blas_type<eT>::value == false>::apply();
if(is_float<eT>::value == true) if(is_float<eT>::value == true)
{ {
typedef float T; typedef float T;
sgetri_(n, (T*)a, lda, ipiv, (T*)work, lwork, info); sgetri_(n, (T*)a, lda, ipiv, (T*)work, lwork, info);
} }
else else
if(is_double<eT>::value == true) if(is_double<eT>::value == true)
skipping to change at line 170 skipping to change at line 170
if(is_supported_complex_double<eT>::value == true) if(is_supported_complex_double<eT>::value == true)
{ {
typedef std::complex<double> T; typedef std::complex<double> T;
zgetri_(n, (T*)a, lda, ipiv, (T*)work, lwork, info); zgetri_(n, (T*)a, lda, ipiv, (T*)work, lwork, info);
} }
} }
template<typename eT> template<typename eT>
inline inline
void void
syev_(char* jobz, char* uplo, int* n, eT* a, int* lda, eT* w, eT* work, int* lwork, int* info) syev_(char* jobz, char* uplo, blas_int* n, eT* a, blas_int* lda, eT* w, eT* work, blas_int* lwork, blas_int* info)
{ {
arma_type_check<is_supported_blas_type<eT>::value == false>::apply(); arma_type_check<is_supported_blas_type<eT>::value == false>::apply();
if(is_float<eT>::value == true) if(is_float<eT>::value == true)
{ {
typedef float T; typedef float T;
ssyev_(jobz, uplo, n, (T*)a, lda, (T*)w, (T*)work, lwork, info); ssyev_(jobz, uplo, n, (T*)a, lda, (T*)w, (T*)work, lwork, info);
} }
else else
if(is_double<eT>::value == true) if(is_double<eT>::value == true)
skipping to change at line 192 skipping to change at line 192
typedef double T; typedef double T;
dsyev_(jobz, uplo, n, (T*)a, lda, (T*)w, (T*)work, lwork, info); dsyev_(jobz, uplo, n, (T*)a, lda, (T*)w, (T*)work, lwork, info);
} }
} }
template<typename eT> template<typename eT>
inline inline
void void
heev_ heev_
( (
char* jobz, char* uplo, int* n, char* jobz, char* uplo, blas_int* n,
eT* a, int* lda, typename eT::value_type* w, eT* a, blas_int* lda, typename eT::value_type* w,
eT* work, int* lwork, typename eT::value_type* rwork, eT* work, blas_int* lwork, typename eT::value_type* rwork,
int* info blas_int* info
) )
{ {
arma_type_check<is_supported_blas_type<eT>::value == false>::apply(); arma_type_check<is_supported_blas_type<eT>::value == false>::apply();
if(is_supported_complex_float<eT>::value == true) if(is_supported_complex_float<eT>::value == true)
{ {
typedef float T; typedef float T;
typedef typename std::complex<T> cx_T; typedef typename std::complex<T> cx_T;
cheev_(jobz, uplo, n, (cx_T*)a, lda, (T*)w, (cx_T*)work, lwork, (T*)r work, info); cheev_(jobz, uplo, n, (cx_T*)a, lda, (T*)w, (cx_T*)work, lwork, (T*)r work, info);
} }
skipping to change at line 220 skipping to change at line 220
typedef typename std::complex<T> cx_T; typedef typename std::complex<T> cx_T;
zheev_(jobz, uplo, n, (cx_T*)a, lda, (T*)w, (cx_T*)work, lwork, (T*)r work, info); zheev_(jobz, uplo, n, (cx_T*)a, lda, (T*)w, (cx_T*)work, lwork, (T*)r work, info);
} }
} }
template<typename eT> template<typename eT>
inline inline
void void
geev_ geev_
( (
char* jobvl, char* jobvr, int* n, char* jobvl, char* jobvr, blas_int* n,
eT* a, int* lda, eT* wr, eT* wi, eT* vl, eT* a, blas_int* lda, eT* wr, eT* wi, eT* vl,
int* ldvl, eT* vr, int* ldvr, blas_int* ldvl, eT* vr, blas_int* ldvr,
eT* work, int* lwork, eT* work, blas_int* lwork,
int* info blas_int* info
) )
{ {
arma_type_check<is_supported_blas_type<eT>::value == false>::apply(); arma_type_check<is_supported_blas_type<eT>::value == false>::apply();
if(is_float<eT>::value == true) if(is_float<eT>::value == true)
{ {
typedef float T; typedef float T;
sgeev_(jobvl, jobvr, n, (T*)a, lda, (T*)wr, (T*)wi, (T*)vl, ldvl, (T *)vr, ldvr, (T*)work, lwork, info); sgeev_(jobvl, jobvr, n, (T*)a, lda, (T*)wr, (T*)wi, (T*)vl, ldvl, (T *)vr, ldvr, (T*)work, lwork, info);
} }
else else
skipping to change at line 247 skipping to change at line 247
typedef double T; typedef double T;
dgeev_(jobvl, jobvr, n, (T*)a, lda, (T*)wr, (T*)wi, (T*)vl, ldvl, (T *)vr, ldvr, (T*)work, lwork, info); dgeev_(jobvl, jobvr, n, (T*)a, lda, (T*)wr, (T*)wi, (T*)vl, ldvl, (T *)vr, ldvr, (T*)work, lwork, info);
} }
} }
template<typename eT> template<typename eT>
inline inline
void void
cx_geev_ cx_geev_
( (
char* jobvl, char* jobvr, int* n, char* jobvl, char* jobvr, blas_int* n,
eT* a, int* lda, eT* w, eT* a, blas_int* lda, eT* w,
eT* vl, int* ldvl, eT* vl, blas_int* ldvl,
eT* vr, int* ldvr, eT* vr, blas_int* ldvr,
eT* work, int* lwork, typename eT::value_type* rwork, eT* work, blas_int* lwork, typename eT::value_type* rwork,
int* info blas_int* info
) )
{ {
arma_type_check<is_supported_blas_type<eT>::value == false>::apply(); arma_type_check<is_supported_blas_type<eT>::value == false>::apply();
if(is_supported_complex_float<eT>::value == true) if(is_supported_complex_float<eT>::value == true)
{ {
typedef float T; typedef float T;
typedef typename std::complex<T> cx_T; typedef typename std::complex<T> cx_T;
cgeev_(jobvl, jobvr, n, (cx_T*)a, lda, (cx_T*)w, (cx_T*)vl, ldvl, (cx _T*)vr, ldvr, (cx_T*)work, lwork, (T*)rwork, info); cgeev_(jobvl, jobvr, n, (cx_T*)a, lda, (cx_T*)w, (cx_T*)vl, ldvl, (cx _T*)vr, ldvr, (cx_T*)work, lwork, (T*)rwork, info);
} }
skipping to change at line 275 skipping to change at line 275
{ {
typedef double T; typedef double T;
typedef typename std::complex<T> cx_T; typedef typename std::complex<T> cx_T;
zgeev_(jobvl, jobvr, n, (cx_T*)a, lda, (cx_T*)w, (cx_T*)vl, ldvl, (cx _T*)vr, ldvr, (cx_T*)work, lwork, (T*)rwork, info); zgeev_(jobvl, jobvr, n, (cx_T*)a, lda, (cx_T*)w, (cx_T*)vl, ldvl, (cx _T*)vr, ldvr, (cx_T*)work, lwork, (T*)rwork, info);
} }
} }
template<typename eT> template<typename eT>
inline inline
void void
potrf_(char* uplo, int* n, eT* a, int* lda, int* info) potrf_(char* uplo, blas_int* n, eT* a, blas_int* lda, blas_int* info)
{ {
arma_type_check<is_supported_blas_type<eT>::value == false>::apply(); arma_type_check<is_supported_blas_type<eT>::value == false>::apply();
if(is_float<eT>::value == true) if(is_float<eT>::value == true)
{ {
typedef float T; typedef float T;
spotrf_(uplo, n, (T*)a, lda, info); spotrf_(uplo, n, (T*)a, lda, info);
} }
else else
if(is_double<eT>::value == true) if(is_double<eT>::value == true)
skipping to change at line 308 skipping to change at line 308
{ {
typedef std::complex<double> T; typedef std::complex<double> T;
zpotrf_(uplo, n, (T*)a, lda, info); zpotrf_(uplo, n, (T*)a, lda, info);
} }
} }
template<typename eT> template<typename eT>
inline inline
void void
geqrf_(int* m, int* n, eT* a, int* lda, eT* tau, eT* work, int* lwork, in t* info) geqrf_(blas_int* m, blas_int* n, eT* a, blas_int* lda, eT* tau, eT* work, blas_int* lwork, blas_int* info)
{ {
arma_type_check<is_supported_blas_type<eT>::value == false>::apply(); arma_type_check<is_supported_blas_type<eT>::value == false>::apply();
if(is_float<eT>::value == true) if(is_float<eT>::value == true)
{ {
typedef float T; typedef float T;
sgeqrf_(m, n, (T*)a, lda, (T*)tau, (T*)work, lwork, info); sgeqrf_(m, n, (T*)a, lda, (T*)tau, (T*)work, lwork, info);
} }
else else
if(is_double<eT>::value == true) if(is_double<eT>::value == true)
skipping to change at line 341 skipping to change at line 341
{ {
typedef std::complex<double> T; typedef std::complex<double> T;
zgeqrf_(m, n, (T*)a, lda, (T*)tau, (T*)work, lwork, info); zgeqrf_(m, n, (T*)a, lda, (T*)tau, (T*)work, lwork, info);
} }
} }
template<typename eT> template<typename eT>
inline inline
void void
orgqr_(int* m, int* n, int* k, eT* a, int* lda, eT* tau, eT* work, int* l work, int* info) orgqr_(blas_int* m, blas_int* n, blas_int* k, eT* a, blas_int* lda, eT* t au, eT* work, blas_int* lwork, blas_int* info)
{ {
arma_type_check<is_supported_blas_type<eT>::value == false>::apply(); arma_type_check<is_supported_blas_type<eT>::value == false>::apply();
if(is_float<eT>::value == true) if(is_float<eT>::value == true)
{ {
typedef float T; typedef float T;
sorgqr_(m, n, k, (T*)a, lda, (T*)tau, (T*)work, lwork, info); sorgqr_(m, n, k, (T*)a, lda, (T*)tau, (T*)work, lwork, info);
} }
else else
if(is_double<eT>::value == true) if(is_double<eT>::value == true)
{ {
typedef double T; typedef double T;
dorgqr_(m, n, k, (T*)a, lda, (T*)tau, (T*)work, lwork, info); dorgqr_(m, n, k, (T*)a, lda, (T*)tau, (T*)work, lwork, info);
} }
} }
template<typename eT> template<typename eT>
inline inline
void void
ungqr_(int* m, int* n, int* k, eT* a, int* lda, eT* tau, eT* work, int* l work, int* info) ungqr_(blas_int* m, blas_int* n, blas_int* k, eT* a, blas_int* lda, eT* t au, eT* work, blas_int* lwork, blas_int* info)
{ {
arma_type_check<is_supported_blas_type<eT>::value == false>::apply(); arma_type_check<is_supported_blas_type<eT>::value == false>::apply();
if(is_supported_complex_float<eT>::value == true) if(is_supported_complex_float<eT>::value == true)
{ {
typedef float T; typedef float T;
cungqr_(m, n, k, (T*)a, lda, (T*)tau, (T*)work, lwork, info); cungqr_(m, n, k, (T*)a, lda, (T*)tau, (T*)work, lwork, info);
} }
else else
if(is_supported_complex_double<eT>::value == true) if(is_supported_complex_double<eT>::value == true)
skipping to change at line 383 skipping to change at line 383
typedef double T; typedef double T;
zungqr_(m, n, k, (T*)a, lda, (T*)tau, (T*)work, lwork, info); zungqr_(m, n, k, (T*)a, lda, (T*)tau, (T*)work, lwork, info);
} }
} }
template<typename eT> template<typename eT>
inline inline
void void
gesvd_ gesvd_
( (
char* jobu, char* jobvt, int* m, int* n, eT* a, int* lda, char* jobu, char* jobvt, blas_int* m, blas_int* n, eT* a, blas_int* lda
eT* s, eT* u, int* ldu, eT* vt, int* ldvt, ,
eT* work, int* lwork, int* info eT* s, eT* u, blas_int* ldu, eT* vt, blas_int* ldvt,
eT* work, blas_int* lwork, blas_int* info
) )
{ {
arma_type_check<is_supported_blas_type<eT>::value == false>::apply(); arma_type_check<is_supported_blas_type<eT>::value == false>::apply();
if(is_float<eT>::value == true) if(is_float<eT>::value == true)
{ {
typedef float T; typedef float T;
sgesvd_(jobu, jobvt, m, n, (T*)a, lda, (T*)s, (T*)u, ldu, (T*)vt, ldv t, (T*)work, lwork, info); sgesvd_(jobu, jobvt, m, n, (T*)a, lda, (T*)s, (T*)u, ldu, (T*)vt, ldv t, (T*)work, lwork, info);
} }
else else
skipping to change at line 408 skipping to change at line 408
typedef double T; typedef double T;
dgesvd_(jobu, jobvt, m, n, (T*)a, lda, (T*)s, (T*)u, ldu, (T*)vt, ldv t, (T*)work, lwork, info); dgesvd_(jobu, jobvt, m, n, (T*)a, lda, (T*)s, (T*)u, ldu, (T*)vt, ldv t, (T*)work, lwork, info);
} }
} }
template<typename T> template<typename T>
inline inline
void void
cx_gesvd_ cx_gesvd_
( (
char* jobu, char* jobvt, int* m, int* n, std::complex<T>* a, int* lda, char* jobu, char* jobvt, blas_int* m, blas_int* n, std::complex<T>* a,
T* s, std::complex<T>* u, int* ldu, std::complex<T>* vt, int* ldvt, blas_int* lda,
std::complex<T>* work, int* lwork, T* rwork, int* info T* s, std::complex<T>* u, blas_int* ldu, std::complex<T>* vt, blas_int*
ldvt,
std::complex<T>* work, blas_int* lwork, T* rwork, blas_int* info
) )
{ {
arma_type_check<is_supported_blas_type<T>::value == false>::apply(); arma_type_check<is_supported_blas_type<T>::value == false>::apply();
arma_type_check<is_supported_blas_type< std::complex<T> >::value == fal se>::apply(); arma_type_check<is_supported_blas_type< std::complex<T> >::value == fal se>::apply();
if(is_float<T>::value == true) if(is_float<T>::value == true)
{ {
typedef float bT; typedef float bT;
cgesvd_ cgesvd_
( (
skipping to change at line 442 skipping to change at line 442
jobu, jobvt, m, n, (std::complex<bT>*)a, lda, jobu, jobvt, m, n, (std::complex<bT>*)a, lda,
(bT*)s, (std::complex<bT>*)u, ldu, (std::complex<bT>*)vt, ldvt, (bT*)s, (std::complex<bT>*)u, ldu, (std::complex<bT>*)vt, ldvt,
(std::complex<bT>*)work, lwork, (bT*)rwork, info (std::complex<bT>*)work, lwork, (bT*)rwork, info
); );
} }
} }
template<typename eT> template<typename eT>
inline inline
void void
gesv_(int* n, int* nrhs, eT* a, int* lda, int* ipiv, eT* b, int* ldb, int * info) gesv_(blas_int* n, blas_int* nrhs, eT* a, blas_int* lda, blas_int* ipiv, eT* b, blas_int* ldb, blas_int* info)
{ {
arma_type_check<is_supported_blas_type<eT>::value == false>::apply(); arma_type_check<is_supported_blas_type<eT>::value == false>::apply();
if(is_float<eT>::value == true) if(is_float<eT>::value == true)
{ {
typedef float T; typedef float T;
sgesv_(n, nrhs, (T*)a, lda, ipiv, (T*)b, ldb, info); sgesv_(n, nrhs, (T*)a, lda, ipiv, (T*)b, ldb, info);
} }
else else
if(is_double<eT>::value == true) if(is_double<eT>::value == true)
skipping to change at line 474 skipping to change at line 474
if(is_supported_complex_double<eT>::value == true) if(is_supported_complex_double<eT>::value == true)
{ {
typedef std::complex<double> T; typedef std::complex<double> T;
zgesv_(n, nrhs, (T*)a, lda, ipiv, (T*)b, ldb, info); zgesv_(n, nrhs, (T*)a, lda, ipiv, (T*)b, ldb, info);
} }
} }
template<typename eT> template<typename eT>
inline inline
void void
//sgels_(char* trans, int* m, int* n, int* nrhs, float* a, int* lda, float //sgels_(char* trans, blas_int* m, blas_int* n, blas_int* nrhs, float* a,
* b, int* ldb, float* work, int* lwork, int* info); blas_int* lda, float* b, blas_int* ldb, float* work, blas_int* lwork, bla
gels_(char* trans, int* m, int* n, int* nrhs, eT* a, int* lda, eT* b, int s_int* info);
* ldb, eT* work, int* lwork, int* info) gels_(char* trans, blas_int* m, blas_int* n, blas_int* nrhs, eT* a, blas_
int* lda, eT* b, blas_int* ldb, eT* work, blas_int* lwork, blas_int* info)
{ {
arma_type_check<is_supported_blas_type<eT>::value == false>::apply(); arma_type_check<is_supported_blas_type<eT>::value == false>::apply();
if(is_float<eT>::value == true) if(is_float<eT>::value == true)
{ {
typedef float T; typedef float T;
sgels_(trans, m, n, nrhs, (T*)a, lda, (T*)b, ldb, (T*)work, lwork, in fo); sgels_(trans, m, n, nrhs, (T*)a, lda, (T*)b, ldb, (T*)work, lwork, in fo);
} }
else else
if(is_double<eT>::value == true) if(is_double<eT>::value == true)
 End of changes. 29 change blocks. 
129 lines changed or deleted 145 lines changed or added


 mtGlue_proto.hpp   mtGlue_proto.hpp 
skipping to change at line 31 skipping to change at line 31
{ {
public: public:
typedef out_eT elem_type; typedef out_eT elem_type;
typedef typename get_pod_type<out_eT>::result pod_type; typedef typename get_pod_type<out_eT>::result pod_type;
arma_inline mtGlue(const T1& in_A, const T2& in_B); arma_inline mtGlue(const T1& in_A, const T2& in_B);
arma_inline mtGlue(const T1& in_A, const T2& in_B, const u32 in_aux_u32) ; arma_inline mtGlue(const T1& in_A, const T2& in_B, const u32 in_aux_u32) ;
arma_inline ~mtGlue(); arma_inline ~mtGlue();
const T1& A; //!< first operand arma_aligned const T1& A; //!< first operand
const T2& B; //!< second operand arma_aligned const T2& B; //!< second operand
const u32 aux_u32; //!< storage of auxiliary data, u32 format arma_aligned const u32 aux_u32; //!< storage of auxiliary data, u32 forma
t
}; };
//! @} //! @}
 End of changes. 1 change blocks. 
3 lines changed or deleted 4 lines changed or added


 mtOp_proto.hpp   mtOp_proto.hpp 
skipping to change at line 38 skipping to change at line 38
inline explicit mtOp(const T1& in_m); inline explicit mtOp(const T1& in_m);
inline mtOp(const T1& in_m, const in_eT in_aux); inline mtOp(const T1& in_m, const in_eT in_aux);
inline mtOp(const T1& in_m, const u32 in_aux_u32_a, const u32 in_aux_u32_b); inline mtOp(const T1& in_m, const u32 in_aux_u32_a, const u32 in_aux_u32_b);
inline mtOp(const T1& in_m, const in_eT in_aux, const u32 in_aux_u32_a, const u32 in_aux_u32_b); inline mtOp(const T1& in_m, const in_eT in_aux, const u32 in_aux_u32_a, const u32 in_aux_u32_b);
inline mtOp(const char junk, const T1& in_m, const out_eT in_aux ); inline mtOp(const char junk, const T1& in_m, const out_eT in_aux );
inline ~mtOp(); inline ~mtOp();
const T1& m; //!< storage of reference to the operand (e.g. arma_aligned const T1& m; //!< storage of reference to the o
a matrix) perand (e.g. a matrix)
const in_eT aux; //!< storage of auxiliary data, using the eleme arma_aligned const in_eT aux; //!< storage of auxiliary data, us
nt type as used by T1 ing the element type as used by T1
const out_eT aux_out_eT; //!< storage of auxiliary data, using the eleme arma_aligned const out_eT aux_out_eT; //!< storage of auxiliary data, us
nt type as specified by the out_eT template parameter ing the element type as specified by the out_eT template parameter
const u32 aux_u32_a; //!< storage of auxiliary data, u32 format arma_aligned const u32 aux_u32_a; //!< storage of auxiliary data, u3
const u32 aux_u32_b; //!< storage of auxiliary data, u32 format 2 format
arma_aligned const u32 aux_u32_b; //!< storage of auxiliary data, u3
2 format
}; };
//! @} //! @}
 End of changes. 1 change blocks. 
8 lines changed or deleted 10 lines changed or added


 op_cx_scalar_meat.hpp   op_cx_scalar_meat.hpp 
skipping to change at line 35 skipping to change at line 35
const mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar _times>& X const mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar _times>& X
) )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename std::complex<typename T1::pod_type> eT; typedef typename std::complex<typename T1::pod_type> eT;
typedef typename T1::pod_type T; typedef typename T1::pod_type T;
const Proxy<T1> A(X.m); const Proxy<T1> A(X.m);
out.set_size(A.n_rows, A.n_cols); out.set_size(A.get_n_rows(), A.get_n_cols());
const u32 n_elem = A.n_elem;
const eT k = X.aux_out_eT; const eT k = X.aux_out_eT;
const u32 n_elem = out.n_elem;
eT* out_mem = out.memptr(); eT* out_mem = out.memptr();
for(u32 i=0; i<n_elem; ++i) for(u32 i=0; i<n_elem; ++i)
{ {
out_mem[i] = A[i] * k; out_mem[i] = A[i] * k;
} }
} }
template<typename T1> template<typename T1>
inline inline
skipping to change at line 63 skipping to change at line 63
const mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar _plus>& X const mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar _plus>& X
) )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename std::complex<typename T1::pod_type> eT; typedef typename std::complex<typename T1::pod_type> eT;
typedef typename T1::pod_type T; typedef typename T1::pod_type T;
const Proxy<T1> A(X.m); const Proxy<T1> A(X.m);
out.set_size(A.n_rows, A.n_cols); out.set_size(A.get_n_rows(), A.get_n_cols());
const u32 n_elem = A.n_elem;
const eT k = X.aux_out_eT; const eT k = X.aux_out_eT;
const u32 n_elem = out.n_elem;
eT* out_mem = out.memptr(); eT* out_mem = out.memptr();
for(u32 i=0; i<n_elem; ++i) for(u32 i=0; i<n_elem; ++i)
{ {
out_mem[i] = A[i] + k; out_mem[i] = A[i] + k;
} }
} }
template<typename T1> template<typename T1>
inline inline
skipping to change at line 91 skipping to change at line 91
const mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar _minus_pre>& X const mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar _minus_pre>& X
) )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename std::complex<typename T1::pod_type> eT; typedef typename std::complex<typename T1::pod_type> eT;
typedef typename T1::pod_type T; typedef typename T1::pod_type T;
const Proxy<T1> A(X.m); const Proxy<T1> A(X.m);
out.set_size(A.n_rows, A.n_cols); out.set_size(A.get_n_rows(), A.get_n_cols());
const u32 n_elem = A.n_elem;
const eT k = X.aux_out_eT; const eT k = X.aux_out_eT;
const u32 n_elem = out.n_elem;
eT* out_mem = out.memptr(); eT* out_mem = out.memptr();
for(u32 i=0; i<n_elem; ++i) for(u32 i=0; i<n_elem; ++i)
{ {
out_mem[i] = k - A[i]; out_mem[i] = k - A[i];
} }
} }
template<typename T1> template<typename T1>
inline inline
skipping to change at line 119 skipping to change at line 119
const mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar _minus_post>& X const mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar _minus_post>& X
) )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename std::complex<typename T1::pod_type> eT; typedef typename std::complex<typename T1::pod_type> eT;
typedef typename T1::pod_type T; typedef typename T1::pod_type T;
const Proxy<T1> A(X.m); const Proxy<T1> A(X.m);
out.set_size(A.n_rows, A.n_cols); out.set_size(A.get_n_rows(), A.get_n_cols());
const u32 n_elem = A.n_elem;
const eT k = X.aux_out_eT; const eT k = X.aux_out_eT;
const u32 n_elem = out.n_elem;
eT* out_mem = out.memptr(); eT* out_mem = out.memptr();
for(u32 i=0; i<n_elem; ++i) for(u32 i=0; i<n_elem; ++i)
{ {
out_mem[i] = A[i] - k; out_mem[i] = A[i] - k;
} }
} }
template<typename T1> template<typename T1>
inline inline
skipping to change at line 147 skipping to change at line 147
const mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar _div_pre>& X const mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar _div_pre>& X
) )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename std::complex<typename T1::pod_type> eT; typedef typename std::complex<typename T1::pod_type> eT;
typedef typename T1::pod_type T; typedef typename T1::pod_type T;
const Proxy<T1> A(X.m); const Proxy<T1> A(X.m);
out.set_size(A.n_rows, A.n_cols); out.set_size(A.get_n_rows(), A.get_n_cols());
const u32 n_elem = A.n_elem;
const eT k = X.aux_out_eT; const eT k = X.aux_out_eT;
const u32 n_elem = out.n_elem;
eT* out_mem = out.memptr(); eT* out_mem = out.memptr();
for(u32 i=0; i<n_elem; ++i) for(u32 i=0; i<n_elem; ++i)
{ {
out_mem[i] = k / A[i]; out_mem[i] = k / A[i];
} }
} }
template<typename T1> template<typename T1>
inline inline
skipping to change at line 175 skipping to change at line 175
const mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar _div_post>& X const mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar _div_post>& X
) )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename std::complex<typename T1::pod_type> eT; typedef typename std::complex<typename T1::pod_type> eT;
typedef typename T1::pod_type T; typedef typename T1::pod_type T;
const Proxy<T1> A(X.m); const Proxy<T1> A(X.m);
out.set_size(A.n_rows, A.n_cols); out.set_size(A.get_n_rows(), A.get_n_cols());
const u32 n_elem = A.n_elem;
const eT k = X.aux_out_eT; const eT k = X.aux_out_eT;
const u32 n_elem = out.n_elem;
eT* out_mem = out.memptr();
for(u32 i=0; i<n_elem; ++i)
{
out_mem[i] = A[i] / k;
}
}
//
//
//
template<typename T1>
inline
void
op_cx_scalar_times::apply
(
Cube< typename std::complex<typename T1::pod_type> >& out,
const mtOpCube<typename std::complex<typename T1::pod_type>, T1, op_cx_sc
alar_times>& X
)
{
arma_extra_debug_sigprint();
typedef typename std::complex<typename T1::pod_type> eT;
typedef typename T1::pod_type T;
const ProxyCube<T1> A(X.m);
out.set_size(A.get_n_rows(), A.get_n_cols(), A.get_n_slices());
const eT k = X.aux_out_eT;
const u32 n_elem = out.n_elem;
eT* out_mem = out.memptr();
for(u32 i=0; i<n_elem; ++i)
{
out_mem[i] = A[i] * k;
}
}
template<typename T1>
inline
void
op_cx_scalar_plus::apply
(
Cube< typename std::complex<typename T1::pod_type> >& out,
const mtOpCube<typename std::complex<typename T1::pod_type>, T1, op_cx_sc
alar_plus>& X
)
{
arma_extra_debug_sigprint();
typedef typename std::complex<typename T1::pod_type> eT;
typedef typename T1::pod_type T;
const ProxyCube<T1> A(X.m);
out.set_size(A.get_n_rows(), A.get_n_cols(), A.get_n_slices());
const eT k = X.aux_out_eT;
const u32 n_elem = out.n_elem;
eT* out_mem = out.memptr();
for(u32 i=0; i<n_elem; ++i)
{
out_mem[i] = A[i] + k;
}
}
template<typename T1>
inline
void
op_cx_scalar_minus_pre::apply
(
Cube< typename std::complex<typename T1::pod_type> >& out,
const mtOpCube<typename std::complex<typename T1::pod_type>, T1, op_cx_sc
alar_minus_pre>& X
)
{
arma_extra_debug_sigprint();
typedef typename std::complex<typename T1::pod_type> eT;
typedef typename T1::pod_type T;
const ProxyCube<T1> A(X.m);
out.set_size(A.get_n_rows(), A.get_n_cols(), A.get_n_slices());
const eT k = X.aux_out_eT;
const u32 n_elem = out.n_elem;
eT* out_mem = out.memptr();
for(u32 i=0; i<n_elem; ++i)
{
out_mem[i] = k - A[i];
}
}
template<typename T1>
inline
void
op_cx_scalar_minus_post::apply
(
Cube< typename std::complex<typename T1::pod_type> >& out,
const mtOpCube<typename std::complex<typename T1::pod_type>, T1, op_cx_sc
alar_minus_post>& X
)
{
arma_extra_debug_sigprint();
typedef typename std::complex<typename T1::pod_type> eT;
typedef typename T1::pod_type T;
const ProxyCube<T1> A(X.m);
out.set_size(A.get_n_rows(), A.get_n_cols(), A.get_n_slices());
const eT k = X.aux_out_eT;
const u32 n_elem = out.n_elem;
eT* out_mem = out.memptr();
for(u32 i=0; i<n_elem; ++i)
{
out_mem[i] = A[i] - k;
}
}
template<typename T1>
inline
void
op_cx_scalar_div_pre::apply
(
Cube< typename std::complex<typename T1::pod_type> >& out,
const mtOpCube<typename std::complex<typename T1::pod_type>, T1, op_cx_sc
alar_div_pre>& X
)
{
arma_extra_debug_sigprint();
typedef typename std::complex<typename T1::pod_type> eT;
typedef typename T1::pod_type T;
const ProxyCube<T1> A(X.m);
out.set_size(A.get_n_rows(), A.get_n_cols(), A.get_n_slices());
const eT k = X.aux_out_eT;
const u32 n_elem = out.n_elem;
eT* out_mem = out.memptr();
for(u32 i=0; i<n_elem; ++i)
{
out_mem[i] = k / A[i];
}
}
template<typename T1>
inline
void
op_cx_scalar_div_post::apply
(
Cube< typename std::complex<typename T1::pod_type> >& out,
const mtOpCube<typename std::complex<typename T1::pod_type>, T1, op_cx_sc
alar_div_post>& X
)
{
arma_extra_debug_sigprint();
typedef typename std::complex<typename T1::pod_type> eT;
typedef typename T1::pod_type T;
const ProxyCube<T1> A(X.m);
out.set_size(A.get_n_rows(), A.get_n_cols(), A.get_n_slices());
const eT k = X.aux_out_eT;
const u32 n_elem = out.n_elem;
eT* out_mem = out.memptr(); eT* out_mem = out.memptr();
for(u32 i=0; i<n_elem; ++i) for(u32 i=0; i<n_elem; ++i)
{ {
out_mem[i] = A[i] / k; out_mem[i] = A[i] / k;
} }
} }
//! @} //! @}
 End of changes. 18 change blocks. 
12 lines changed or deleted 190 lines changed or added


 op_cx_scalar_proto.hpp   op_cx_scalar_proto.hpp 
skipping to change at line 31 skipping to change at line 31
public: public:
template<typename T1> template<typename T1>
inline static void inline static void
apply apply
( (
Mat< typename std::complex<typename T1::pod_type> >& out, Mat< typename std::complex<typename T1::pod_type> >& out,
const mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scal ar_times>& X const mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scal ar_times>& X
); );
template<typename T1>
inline static void
apply
(
Cube< typename std::complex<typename T1::pod_type> >& out,
const mtOpCube<typename std::complex<typename T1::pod_type>, T1, op_cx_
scalar_times>& X
);
}; };
class op_cx_scalar_plus class op_cx_scalar_plus
{ {
public: public:
template<typename T1> template<typename T1>
inline static void inline static void
apply apply
( (
Mat< typename std::complex<typename T1::pod_type> >& out, Mat< typename std::complex<typename T1::pod_type> >& out,
const mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scal ar_plus>& X const mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scal ar_plus>& X
); );
template<typename T1>
inline static void
apply
(
Cube< typename std::complex<typename T1::pod_type> >& out,
const mtOpCube<typename std::complex<typename T1::pod_type>, T1, op_cx_
scalar_plus>& X
);
}; };
class op_cx_scalar_minus_pre class op_cx_scalar_minus_pre
{ {
public: public:
template<typename T1> template<typename T1>
inline static void inline static void
apply apply
( (
Mat< typename std::complex<typename T1::pod_type> >& out, Mat< typename std::complex<typename T1::pod_type> >& out,
const mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scal ar_minus_pre>& X const mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scal ar_minus_pre>& X
); );
template<typename T1>
inline static void
apply
(
Cube< typename std::complex<typename T1::pod_type> >& out,
const mtOpCube<typename std::complex<typename T1::pod_type>, T1, op_cx_
scalar_minus_pre>& X
);
}; };
class op_cx_scalar_minus_post class op_cx_scalar_minus_post
{ {
public: public:
template<typename T1> template<typename T1>
inline static void inline static void
apply apply
( (
Mat< typename std::complex<typename T1::pod_type> >& out, Mat< typename std::complex<typename T1::pod_type> >& out,
const mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scal ar_minus_post>& X const mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scal ar_minus_post>& X
); );
template<typename T1>
inline static void
apply
(
Cube< typename std::complex<typename T1::pod_type> >& out,
const mtOpCube<typename std::complex<typename T1::pod_type>, T1, op_cx_
scalar_minus_post>& X
);
}; };
class op_cx_scalar_div_pre class op_cx_scalar_div_pre
{ {
public: public:
template<typename T1> template<typename T1>
inline static void inline static void
apply apply
( (
Mat< typename std::complex<typename T1::pod_type> >& out, Mat< typename std::complex<typename T1::pod_type> >& out,
const mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scal ar_div_pre>& X const mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scal ar_div_pre>& X
); );
template<typename T1>
inline static void
apply
(
Cube< typename std::complex<typename T1::pod_type> >& out,
const mtOpCube<typename std::complex<typename T1::pod_type>, T1, op_cx_
scalar_div_pre>& X
);
}; };
class op_cx_scalar_div_post class op_cx_scalar_div_post
{ {
public: public:
template<typename T1> template<typename T1>
inline static void inline static void
apply apply
( (
Mat< typename std::complex<typename T1::pod_type> >& out, Mat< typename std::complex<typename T1::pod_type> >& out,
const mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scal ar_div_post>& X const mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scal ar_div_post>& X
); );
template<typename T1>
inline static void
apply
(
Cube< typename std::complex<typename T1::pod_type> >& out,
const mtOpCube<typename std::complex<typename T1::pod_type>, T1, op_cx_
scalar_div_post>& X
);
}; };
//! @} //! @}
 End of changes. 6 change blocks. 
0 lines changed or deleted 54 lines changed or added


 op_dot_meat.hpp   op_dot_meat.hpp 
skipping to change at line 70 skipping to change at line 70
return op_dot::direct_dot_arma(n_elem, A, B); return op_dot::direct_dot_arma(n_elem, A, B);
} }
else else
{ {
#if defined(ARMA_USE_ATLAS) #if defined(ARMA_USE_ATLAS)
{ {
return atlas::cblas_dot(n_elem, A, B); return atlas::cblas_dot(n_elem, A, B);
} }
#elif defined(ARMA_USE_BLAS) #elif defined(ARMA_USE_BLAS)
{ {
const int n = n_elem; const blas_int n = n_elem;
return blas::dot_(&n, A, B); return blas::dot_(&n, A, B);
} }
#else #else
{ {
return op_dot::direct_dot_arma(n_elem, A, B); return op_dot::direct_dot_arma(n_elem, A, B);
} }
#endif #endif
} }
} }
skipping to change at line 183 skipping to change at line 183
} }
template<typename T1, typename T2> template<typename T1, typename T2>
arma_hot arma_hot
inline inline
typename T1::elem_type typename T1::elem_type
op_dot::apply_proxy(const Base<typename T1::elem_type,T1>& X, const Base<ty pename T1::elem_type,T2>& Y) op_dot::apply_proxy(const Base<typename T1::elem_type,T1>& X, const Base<ty pename T1::elem_type,T2>& Y)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
typedef typename Proxy<T1>::ea_type ea_type1;
typedef typename Proxy<T2>::ea_type ea_type2;
const Proxy<T1> A(X.get_ref()); const Proxy<T1> A(X.get_ref());
const Proxy<T2> B(Y.get_ref()); const Proxy<T2> B(Y.get_ref());
arma_debug_check( (A.n_elem != B.n_elem), "dot(): objects must have the s ame number of elements" ); arma_debug_check( (A.get_n_elem() != B.get_n_elem()), "dot(): objects mus t have the same number of elements" );
const u32 n_elem = A.n_elem; const u32 N = A.get_n_elem();
eT val = eT(0); ea_type1 PA = A.get_ea();
ea_type2 PB = B.get_ea();
for(u32 i=0; i<n_elem; ++i) eT val1 = eT(0);
{ eT val2 = eT(0);
val += A[i] * B[i];
}
return val; u32 i,j;
}
// for(i=0, j=1; j<N; i+=2, j+=2)
template<typename T1, typename T2>
arma_hot
arma_inline
typename T1::elem_type
op_norm_dot::apply(const Base<typename T1::elem_type,T1>& X, const Base<typ
ename T1::elem_type,T2>& Y)
{
arma_extra_debug_sigprint();
if( (is_Mat<T1>::value == true) && (is_Mat<T2>::value == true) )
{
return op_norm_dot::apply_unwrap(X,Y);
}
else
{ {
return op_norm_dot::apply_proxy(X,Y); val1 += PA[i] * PB[i];
val2 += PA[j] * PB[j];
} }
}
template<typename T1, typename T2> if(i < N)
arma_hot
inline
typename T1::elem_type
op_norm_dot::apply_unwrap(const Base<typename T1::elem_type,T1>& X, const B
ase<typename T1::elem_type,T2>& Y)
{
arma_extra_debug_sigprint();
typedef typename T1::elem_type eT;
const unwrap<T1> tmp1(X.get_ref());
const unwrap<T2> tmp2(Y.get_ref());
const Mat<eT>& A = tmp1.M;
const Mat<eT>& B = tmp2.M;
arma_debug_check( (A.n_elem != B.n_elem), "norm_dot(): objects must have
the same number of elements" );
const eT* A_mem = A.memptr();
const eT* B_mem = B.memptr();
const u32 N = A.n_elem;
eT acc1 = eT(0);
eT acc2 = eT(0);
eT acc3 = eT(0);
for(u32 i=0; i<N; ++i)
{ {
const eT tmpA = A_mem[i]; val1 += PA[i] * PB[i];
const eT tmpB = B_mem[i];
acc1 += tmpA * tmpA;
acc2 += tmpB * tmpB;
acc3 += tmpA * tmpB;
} }
return acc3 / ( std::sqrt(acc1 * acc2) ); return val1 + val2;
} }
//
// op_norm_dot
template<typename T1, typename T2> template<typename T1, typename T2>
arma_hot arma_hot
inline arma_inline
typename T1::elem_type typename T1::elem_type
op_norm_dot::apply_proxy(const Base<typename T1::elem_type,T1>& X, const Ba se<typename T1::elem_type,T2>& Y) op_norm_dot::apply(const Base<typename T1::elem_type,T1>& X, const Base<typ ename T1::elem_type,T2>& Y)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
typedef typename Proxy<T1>::ea_type ea_type1;
typedef typename Proxy<T2>::ea_type ea_type2;
const Proxy<T1> A(X.get_ref()); const Proxy<T1> A(X.get_ref());
const Proxy<T2> B(Y.get_ref()); const Proxy<T2> B(Y.get_ref());
arma_debug_check( (A.n_elem != B.n_elem), "norm_dot(): objects must have the same number of elements" ); arma_debug_check( (A.get_n_elem() != B.get_n_elem()), "norm_dot(): object s must have the same number of elements" );
const u32 N = A.n_elem; const u32 N = A.get_n_elem();
ea_type1 PA = A.get_ea();
ea_type2 PB = B.get_ea();
eT acc1 = eT(0); eT acc1 = eT(0);
eT acc2 = eT(0); eT acc2 = eT(0);
eT acc3 = eT(0); eT acc3 = eT(0);
for(u32 i=0; i<N; ++i) for(u32 i=0; i<N; ++i)
{ {
const eT tmpA = A[i]; const eT tmpA = PA[i];
const eT tmpB = B[i]; const eT tmpB = PB[i];
acc1 += tmpA * tmpA; acc1 += tmpA * tmpA;
acc2 += tmpB * tmpB; acc2 += tmpB * tmpB;
acc3 += tmpA * tmpB; acc3 += tmpA * tmpB;
} }
return acc3 / ( std::sqrt(acc1 * acc2) ); return acc3 / ( std::sqrt(acc1 * acc2) );
} }
//! @} //! @}
 End of changes. 19 change blocks. 
73 lines changed or deleted 31 lines changed or added


 op_dot_proto.hpp   op_dot_proto.hpp 
skipping to change at line 64 skipping to change at line 64
//! \brief //! \brief
//! normalised dot product operation //! normalised dot product operation
class op_norm_dot class op_norm_dot
{ {
public: public:
template<typename T1, typename T2> template<typename T1, typename T2>
arma_hot arma_inline static typename T1::elem_type apply(const Base<typen ame T1::elem_type,T1>& X, const Base<typename T1::elem_type,T2>& Y); arma_hot arma_inline static typename T1::elem_type apply(const Base<typen ame T1::elem_type,T1>& X, const Base<typename T1::elem_type,T2>& Y);
template<typename T1, typename T2>
arma_hot inline static typename T1::elem_type apply_unwrap(const Base<typ
ename T1::elem_type,T1>& X, const Base<typename T1::elem_type,T2>& Y);
template<typename T1, typename T2>
arma_hot inline static typename T1::elem_type apply_proxy (const Base<typ
ename T1::elem_type,T1>& X, const Base<typename T1::elem_type,T2>& Y);
}; };
//! @} //! @}
 End of changes. 1 change blocks. 
7 lines changed or deleted 0 lines changed or added


 op_find_meat.hpp   op_find_meat.hpp 
skipping to change at line 35 skipping to change at line 35
Mat<u32>& indices, Mat<u32>& indices,
const Base<typename T1::elem_type, T1>& X const Base<typename T1::elem_type, T1>& X
) )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
const Proxy<T1> P(X.get_ref()); const Proxy<T1> P(X.get_ref());
const u32 n_elem = P.n_elem; const u32 n_elem = P.get_n_elem();
indices.set_size(n_elem, 1); indices.set_size(n_elem, 1);
u32* indices_mem = indices.memptr(); u32* indices_mem = indices.memptr();
u32 n_nz = 0; u32 n_nz = 0;
for(u32 i=0; i<n_elem; ++i) for(u32 i=0; i<n_elem; ++i)
{ {
if(P[i] != eT(0)) if(P[i] != eT(0))
{ {
skipping to change at line 73 skipping to change at line 73
) )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
const eT val = X.aux; const eT val = X.aux;
const Proxy<T1> P(X.m); const Proxy<T1> P(X.m);
const u32 n_elem = P.n_elem; const u32 n_elem = P.get_n_elem();
indices.set_size(n_elem, 1); indices.set_size(n_elem, 1);
u32* indices_mem = indices.memptr(); u32* indices_mem = indices.memptr();
u32 n_nz = 0; u32 n_nz = 0;
for(u32 i=0; i<n_elem; ++i) for(u32 i=0; i<n_elem; ++i)
{ {
const eT tmp = P[i]; const eT tmp = P[i];
skipping to change at line 127 skipping to change at line 127
) )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
const eT val = X.aux; const eT val = X.aux;
const Proxy<T1> P(X.m); const Proxy<T1> P(X.m);
const u32 n_elem = P.n_elem; const u32 n_elem = P.get_n_elem();
indices.set_size(n_elem, 1); indices.set_size(n_elem, 1);
u32* indices_mem = indices.memptr(); u32* indices_mem = indices.memptr();
u32 n_nz = 0; u32 n_nz = 0;
for(u32 i=0; i<n_elem; ++i) for(u32 i=0; i<n_elem; ++i)
{ {
const eT tmp = P[i]; const eT tmp = P[i];
skipping to change at line 176 skipping to change at line 176
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT1; typedef typename T1::elem_type eT1;
typedef typename T2::elem_type eT2; typedef typename T2::elem_type eT2;
const Proxy<T1> A(X.A); const Proxy<T1> A(X.A);
const Proxy<T2> B(X.B); const Proxy<T2> B(X.B);
arma_debug_assert_same_size(A, B, "relational operator"); arma_debug_assert_same_size(A, B, "relational operator");
const u32 n_elem = A.n_elem; const u32 n_elem = A.get_n_elem();
indices.set_size(n_elem, 1); indices.set_size(n_elem, 1);
u32* indices_mem = indices.memptr(); u32* indices_mem = indices.memptr();
u32 n_nz = 0; u32 n_nz = 0;
for(u32 i=0; i<n_elem; ++i) for(u32 i=0; i<n_elem; ++i)
{ {
const eT1 tmp1 = A[i]; const eT1 tmp1 = A[i];
const eT1 tmp2 = B[i]; const eT1 tmp2 = B[i];
skipping to change at line 227 skipping to change at line 227
const typename arma_cx_only<typename T2::elem_type>::result junk3 const typename arma_cx_only<typename T2::elem_type>::result junk3
) )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
const Proxy<T1> A(X.A); const Proxy<T1> A(X.A);
const Proxy<T2> B(X.B); const Proxy<T2> B(X.B);
arma_debug_assert_same_size(A, B, "relational operator"); arma_debug_assert_same_size(A, B, "relational operator");
const u32 n_elem = A.n_elem; const u32 n_elem = A.get_n_elem();
indices.set_size(n_elem, 1); indices.set_size(n_elem, 1);
u32* indices_mem = indices.memptr(); u32* indices_mem = indices.memptr();
u32 n_nz = 0; u32 n_nz = 0;
for(u32 i=0; i<n_elem; ++i) for(u32 i=0; i<n_elem; ++i)
{ {
bool not_zero; bool not_zero;
 End of changes. 5 change blocks. 
5 lines changed or deleted 5 lines changed or added


 op_inv_meat.hpp   op_inv_meat.hpp 
skipping to change at line 33 skipping to change at line 33
op_inv::apply(Mat<eT>& out, const Mat<eT>& A) op_inv::apply(Mat<eT>& out, const Mat<eT>& A)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
// no need to check for aliasing, due to: // no need to check for aliasing, due to:
// - auxlib::inv() copies A to out before inversion // - auxlib::inv() copies A to out before inversion
// - for 2x2 and 3x3 matrices the code is alias safe // - for 2x2 and 3x3 matrices the code is alias safe
arma_debug_check( !A.is_square(), "op_inv::apply(): matrix must be square " ); arma_debug_check( !A.is_square(), "op_inv::apply(): matrix must be square " );
const bool status = (&out != &A) ? auxlib::inv_noalias(out, A) : auxlib:: inv_inplace(out); const bool status = auxlib::inv(out, A);
if(status == false) if(status == false)
{ {
arma_warn( true, "inv(): matrix appears to be singular" ); arma_warn( true, "inv(): matrix appears to be singular" );
out.set_size(0,0); out.set_size(0,0);
} }
} }
//! immediate inverse of T1, storing the result in a dense matrix //! immediate inverse of T1, storing the result in a dense matrix
template<typename T1> template<typename T1>
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 op_misc_meat.hpp   op_misc_meat.hpp 
skipping to change at line 29 skipping to change at line 29
template<typename T1> template<typename T1>
inline void inline void
op_real::apply( Mat<typename T1::pod_type>& out, const mtOp<typename T1::po d_type, T1, op_real>& X) op_real::apply( Mat<typename T1::pod_type>& out, const mtOp<typename T1::po d_type, T1, op_real>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::pod_type T; typedef typename T1::pod_type T;
const Proxy<T1> A(X.m); const Proxy<T1> A(X.m);
out.set_size(A.n_rows, A.n_cols); out.set_size(A.get_n_rows(), A.get_n_cols());
const u32 n_elem = A.n_elem; const u32 n_elem = out.n_elem;
T* out_mem = out.memptr();
for(u32 i=0; i<n_elem; ++i)
{
out_mem[i] = std::real(A[i]);
}
}
template<typename T1>
inline void
op_real::apply( Cube<typename T1::pod_type>& out, const mtOpCube<typename T
1::pod_type, T1, op_real>& X)
{
arma_extra_debug_sigprint();
typedef typename T1::pod_type T;
const ProxyCube<T1> A(X.m);
out.set_size(A.get_n_rows(), A.get_n_cols(), A.get_n_slices());
const u32 n_elem = out.n_elem;
T* out_mem = out.memptr(); T* out_mem = out.memptr();
for(u32 i=0; i<n_elem; ++i) for(u32 i=0; i<n_elem; ++i)
{ {
out_mem[i] = std::real(A[i]); out_mem[i] = std::real(A[i]);
} }
} }
template<typename T1> template<typename T1>
inline void inline void
op_imag::apply( Mat<typename T1::pod_type>& out, const mtOp<typename T1::po d_type, T1, op_imag>& X) op_imag::apply( Mat<typename T1::pod_type>& out, const mtOp<typename T1::po d_type, T1, op_imag>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::pod_type T; typedef typename T1::pod_type T;
const Proxy<T1> A(X.m); const Proxy<T1> A(X.m);
out.set_size(A.n_rows, A.n_cols); out.set_size(A.get_n_rows(), A.get_n_cols());
const u32 n_elem = A.n_elem; const u32 n_elem = out.n_elem;
T* out_mem = out.memptr();
for(u32 i=0; i<n_elem; ++i)
{
out_mem[i] = std::imag(A[i]);
}
}
template<typename T1>
inline void
op_imag::apply( Cube<typename T1::pod_type>& out, const mtOpCube<typename T
1::pod_type, T1, op_imag>& X)
{
arma_extra_debug_sigprint();
typedef typename T1::pod_type T;
const ProxyCube<T1> A(X.m);
out.set_size(A.get_n_rows(), A.get_n_cols(), A.get_n_slices());
const u32 n_elem = out.n_elem;
T* out_mem = out.memptr(); T* out_mem = out.memptr();
for(u32 i=0; i<n_elem; ++i) for(u32 i=0; i<n_elem; ++i)
{ {
out_mem[i] = std::imag(A[i]); out_mem[i] = std::imag(A[i]);
} }
} }
template<typename T1> template<typename T1>
inline void inline void
op_abs::apply( Mat<typename T1::pod_type>& out, const mtOp<typename T1::pod _type, T1, op_abs>& X) op_abs::apply( Mat<typename T1::pod_type>& out, const mtOp<typename T1::pod _type, T1, op_abs>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::pod_type T; typedef typename T1::pod_type T;
const Proxy<T1> A(X.m); const Proxy<T1> A(X.m);
out.set_size(A.n_rows, A.n_cols); out.set_size(A.get_n_rows(), A.get_n_cols());
const u32 n_elem = out.n_elem;
T* out_mem = out.memptr();
for(u32 i=0; i<n_elem; ++i)
{
out_mem[i] = std::abs(A[i]);
}
}
template<typename T1>
inline void
op_abs::apply( Cube<typename T1::pod_type>& out, const mtOpCube<typename T1
::pod_type, T1, op_abs>& X)
{
arma_extra_debug_sigprint();
typedef typename T1::pod_type T;
const ProxyCube<T1> A(X.m);
out.set_size(A.get_n_rows(), A.get_n_cols(), A.get_n_slices());
const u32 n_elem = A.n_elem; const u32 n_elem = out.n_elem;
T* out_mem = out.memptr(); T* out_mem = out.memptr();
for(u32 i=0; i<n_elem; ++i) for(u32 i=0; i<n_elem; ++i)
{ {
out_mem[i] = std::abs(A[i]); out_mem[i] = std::abs(A[i]);
} }
} }
//! @} //! @}
 End of changes. 6 change blocks. 
6 lines changed or deleted 72 lines changed or added


 op_misc_proto.hpp   op_misc_proto.hpp 
skipping to change at line 26 skipping to change at line 26
//! \addtogroup op_misc //! \addtogroup op_misc
//! @{ //! @{
class op_real class op_real
{ {
public: public:
template<typename T1> template<typename T1>
inline static void apply( Mat<typename T1::pod_type>& out, const mtOp<typ ename T1::pod_type, T1, op_real>& X); inline static void apply( Mat<typename T1::pod_type>& out, const mtOp<typ ename T1::pod_type, T1, op_real>& X);
template<typename T1>
inline static void apply( Cube<typename T1::pod_type>& out, const mtOpCub
e<typename T1::pod_type, T1, op_real>& X);
}; };
class op_imag class op_imag
{ {
public: public:
template<typename T1> template<typename T1>
inline static void apply( Mat<typename T1::pod_type>& out, const mtOp<typ ename T1::pod_type, T1, op_imag>& X); inline static void apply( Mat<typename T1::pod_type>& out, const mtOp<typ ename T1::pod_type, T1, op_imag>& X);
template<typename T1>
inline static void apply( Cube<typename T1::pod_type>& out, const mtOpCub
e<typename T1::pod_type, T1, op_imag>& X);
}; };
class op_abs class op_abs
{ {
public: public:
template<typename T1> template<typename T1>
inline static void apply( Mat<typename T1::pod_type>& out, const mtOp<typ ename T1::pod_type, T1, op_abs>& X); inline static void apply( Mat<typename T1::pod_type>& out, const mtOp<typ ename T1::pod_type, T1, op_abs>& X);
template<typename T1>
inline static void apply( Cube<typename T1::pod_type>& out, const mtOpCub
e<typename T1::pod_type, T1, op_abs>& X);
}; };
//! @} //! @}
 End of changes. 3 change blocks. 
0 lines changed or deleted 9 lines changed or added


 op_relational_meat.hpp   op_relational_meat.hpp 
skipping to change at line 26 skipping to change at line 26
//! \addtogroup op_relational //! \addtogroup op_relational
//! @{ //! @{
template<typename T1> template<typename T1>
inline inline
void void
op_rel_lt_pre::apply(Mat<u32>& out, const mtOp<u32, T1, op_rel_lt_pre>& X) op_rel_lt_pre::apply(Mat<u32>& out, const mtOp<u32, T1, op_rel_lt_pre>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
typedef typename Proxy<T1>::ea_type ea_type;
const Proxy<T1> A(X.m); const Proxy<T1> Y(X.m);
out.set_size(A.n_rows, A.n_cols); out.set_size(Y.get_n_rows(), Y.get_n_cols());
const u32 n_elem = A.n_elem; const eT val = X.aux;
const eT val = X.aux; ea_type A = Y.get_ea();
u32* out_mem = out.memptr(); u32* out_mem = out.memptr();
const u32 n_elem = out.n_elem;
for(u32 i=0; i<n_elem; ++i) u32 i,j;
for(i=0, j=1; j<n_elem; i+=2, j+=2)
{
out_mem[i] = (val < A[i]) ? u32(1) : u32(0);
out_mem[j] = (val < A[j]) ? u32(1) : u32(0);
}
if(i < n_elem)
{ {
out_mem[i] = (val < A[i]) ? u32(1) : u32(0); out_mem[i] = (val < A[i]) ? u32(1) : u32(0);
} }
} }
template<typename T1> template<typename T1>
inline inline
void void
op_rel_lt_post::apply(Mat<u32>& out, const mtOp<u32, T1, op_rel_lt_post>& X ) op_rel_lt_post::apply(Mat<u32>& out, const mtOp<u32, T1, op_rel_lt_post>& X )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
typedef typename Proxy<T1>::ea_type ea_type;
const Proxy<T1> Y(X.m);
const Proxy<T1> A(X.m); out.set_size(Y.get_n_rows(), Y.get_n_cols());
out.set_size(A.n_rows, A.n_cols); const eT val = X.aux;
ea_type A = Y.get_ea();
u32* out_mem = out.memptr();
const u32 n_elem = out.n_elem;
const u32 n_elem = A.n_elem; u32 i,j;
const eT val = X.aux;
u32* out_mem = out.memptr(); for(i=0, j=1; j<n_elem; i+=2, j+=2)
{
out_mem[i] = (A[i] < val) ? u32(1) : u32(0);
out_mem[j] = (A[j] < val) ? u32(1) : u32(0);
}
for(u32 i=0; i<n_elem; ++i) if(i < n_elem)
{ {
out_mem[i] = (A[i] < val) ? u32(1) : u32(0); out_mem[i] = (A[i] < val) ? u32(1) : u32(0);
} }
} }
template<typename T1> template<typename T1>
inline inline
void void
op_rel_gt_pre::apply(Mat<u32>& out, const mtOp<u32, T1, op_rel_gt_pre>& X) op_rel_gt_pre::apply(Mat<u32>& out, const mtOp<u32, T1, op_rel_gt_pre>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
typedef typename Proxy<T1>::ea_type ea_type;
const Proxy<T1> Y(X.m);
out.set_size(Y.get_n_rows(), Y.get_n_cols());
const Proxy<T1> A(X.m); const eT val = X.aux;
ea_type A = Y.get_ea();
u32* out_mem = out.memptr();
const u32 n_elem = out.n_elem;
out.set_size(A.n_rows, A.n_cols); u32 i,j;
const u32 n_elem = A.n_elem; for(i=0, j=1; j<n_elem; i+=2, j+=2)
const eT val = X.aux; {
u32* out_mem = out.memptr(); out_mem[i] = (val > A[i]) ? u32(1) : u32(0);
out_mem[j] = (val > A[j]) ? u32(1) : u32(0);
}
for(u32 i=0; i<n_elem; ++i) if(i < n_elem)
{ {
out_mem[i] = (val > A[i]) ? u32(1) : u32(0); out_mem[i] = (val > A[i]) ? u32(1) : u32(0);
} }
} }
template<typename T1> template<typename T1>
inline inline
void void
op_rel_gt_post::apply(Mat<u32>& out, const mtOp<u32, T1, op_rel_gt_post>& X ) op_rel_gt_post::apply(Mat<u32>& out, const mtOp<u32, T1, op_rel_gt_post>& X )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
typedef typename Proxy<T1>::ea_type ea_type;
const Proxy<T1> Y(X.m);
const Proxy<T1> A(X.m); out.set_size(Y.get_n_rows(), Y.get_n_cols());
out.set_size(A.n_rows, A.n_cols); const eT val = X.aux;
ea_type A = Y.get_ea();
u32* out_mem = out.memptr();
const u32 n_elem = out.n_elem;
const u32 n_elem = A.n_elem; u32 i,j;
const eT val = X.aux;
u32* out_mem = out.memptr();
for(u32 i=0; i<n_elem; ++i) for(i=0, j=1; j<n_elem; i+=2, j+=2)
{
out_mem[i] = (A[i] > val) ? u32(1) : u32(0);
out_mem[j] = (A[j] > val) ? u32(1) : u32(0);
}
if(i < n_elem)
{ {
out_mem[i] = (A[i] > val) ? u32(1) : u32(0); out_mem[i] = (A[i] > val) ? u32(1) : u32(0);
} }
} }
template<typename T1> template<typename T1>
inline inline
void void
op_rel_lteq_pre::apply(Mat<u32>& out, const mtOp<u32, T1, op_rel_lteq_pre>& X) op_rel_lteq_pre::apply(Mat<u32>& out, const mtOp<u32, T1, op_rel_lteq_pre>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
typedef typename Proxy<T1>::ea_type ea_type;
const Proxy<T1> A(X.m); const Proxy<T1> Y(X.m);
out.set_size(A.n_rows, A.n_cols); out.set_size(Y.get_n_rows(), Y.get_n_cols());
const u32 n_elem = A.n_elem; const eT val = X.aux;
const eT val = X.aux; ea_type A = Y.get_ea();
u32* out_mem = out.memptr(); u32* out_mem = out.memptr();
const u32 n_elem = out.n_elem;
u32 i,j;
for(i=0, j=1; j<n_elem; i+=2, j+=2)
{
out_mem[i] = (val <= A[i]) ? u32(1) : u32(0);
out_mem[j] = (val <= A[j]) ? u32(1) : u32(0);
}
for(u32 i=0; i<n_elem; ++i) if(i < n_elem)
{ {
out_mem[i] = (val <= A[i]) ? u32(1) : u32(0); out_mem[i] = (val <= A[i]) ? u32(1) : u32(0);
} }
} }
template<typename T1> template<typename T1>
inline inline
void void
op_rel_lteq_post::apply(Mat<u32>& out, const mtOp<u32, T1, op_rel_lteq_post >& X) op_rel_lteq_post::apply(Mat<u32>& out, const mtOp<u32, T1, op_rel_lteq_post >& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
typedef typename Proxy<T1>::ea_type ea_type;
const Proxy<T1> Y(X.m);
const Proxy<T1> A(X.m); out.set_size(Y.get_n_rows(), Y.get_n_cols());
out.set_size(A.n_rows, A.n_cols); const eT val = X.aux;
ea_type A = Y.get_ea();
u32* out_mem = out.memptr();
const u32 n_elem = out.n_elem;
const u32 n_elem = A.n_elem; u32 i,j;
const eT val = X.aux;
u32* out_mem = out.memptr(); for(i=0, j=1; j<n_elem; i+=2, j+=2)
{
out_mem[i] = (A[i] <= val) ? u32(1) : u32(0);
out_mem[j] = (A[j] <= val) ? u32(1) : u32(0);
}
for(u32 i=0; i<n_elem; ++i) if(i < n_elem)
{ {
out_mem[i] = (A[i] <= val) ? u32(1) : u32(0); out_mem[i] = (A[i] <= val) ? u32(1) : u32(0);
} }
} }
template<typename T1> template<typename T1>
inline inline
void void
op_rel_gteq_pre::apply(Mat<u32>& out, const mtOp<u32, T1, op_rel_gteq_pre>& X) op_rel_gteq_pre::apply(Mat<u32>& out, const mtOp<u32, T1, op_rel_gteq_pre>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
typedef typename Proxy<T1>::ea_type ea_type;
const Proxy<T1> A(X.m); const Proxy<T1> Y(X.m);
out.set_size(A.n_rows, A.n_cols); out.set_size(Y.get_n_rows(), Y.get_n_cols());
const u32 n_elem = A.n_elem; const eT val = X.aux;
const eT val = X.aux; ea_type A = Y.get_ea();
u32* out_mem = out.memptr(); u32* out_mem = out.memptr();
const u32 n_elem = out.n_elem;
for(u32 i=0; i<n_elem; ++i) u32 i,j;
for(i=0, j=1; j<n_elem; i+=2, j+=2)
{
out_mem[i] = (val >= A[i]) ? u32(1) : u32(0);
out_mem[j] = (val >= A[j]) ? u32(1) : u32(0);
}
if(i < n_elem)
{ {
out_mem[i] = (val >= A[i]) ? u32(1) : u32(0); out_mem[i] = (val >= A[i]) ? u32(1) : u32(0);
} }
} }
template<typename T1> template<typename T1>
inline inline
void void
op_rel_gteq_post::apply(Mat<u32>& out, const mtOp<u32, T1, op_rel_gteq_post >& X) op_rel_gteq_post::apply(Mat<u32>& out, const mtOp<u32, T1, op_rel_gteq_post >& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
typedef typename Proxy<T1>::ea_type ea_type;
const Proxy<T1> Y(X.m);
const Proxy<T1> A(X.m); out.set_size(Y.get_n_rows(), Y.get_n_cols());
out.set_size(A.n_rows, A.n_cols); const eT val = X.aux;
ea_type A = Y.get_ea();
u32* out_mem = out.memptr();
const u32 n_elem = out.n_elem;
const u32 n_elem = A.n_elem; u32 i,j;
const eT val = X.aux;
u32* out_mem = out.memptr(); for(i=0, j=1; j<n_elem; i+=2, j+=2)
{
out_mem[i] = (A[i] >= val) ? u32(1) : u32(0);
out_mem[j] = (A[j] >= val) ? u32(1) : u32(0);
}
for(u32 i=0; i<n_elem; ++i) if(i < n_elem)
{ {
out_mem[i] = (A[i] >= val) ? u32(1) : u32(0); out_mem[i] = (A[i] >= val) ? u32(1) : u32(0);
} }
} }
template<typename T1> template<typename T1>
inline inline
void void
op_rel_eq::apply(Mat<u32>& out, const mtOp<u32, T1, op_rel_eq>& X) op_rel_eq::apply(Mat<u32>& out, const mtOp<u32, T1, op_rel_eq>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
typedef typename Proxy<T1>::ea_type ea_type;
const Proxy<T1> A(X.m); const Proxy<T1> Y(X.m);
out.set_size(A.n_rows, A.n_cols); out.set_size(Y.get_n_rows(), Y.get_n_cols());
const u32 n_elem = A.n_elem; const eT val = X.aux;
const eT val = X.aux; ea_type A = Y.get_ea();
u32* out_mem = out.memptr(); u32* out_mem = out.memptr();
const u32 n_elem = out.n_elem;
for(u32 i=0; i<n_elem; ++i) u32 i,j;
for(i=0, j=1; j<n_elem; i+=2, j+=2)
{
out_mem[i] = (A[i] == val) ? u32(1) : u32(0);
out_mem[j] = (A[j] == val) ? u32(1) : u32(0);
}
if(i < n_elem)
{ {
out_mem[i] = (A[i] == val) ? u32(1) : u32(0); out_mem[i] = (A[i] == val) ? u32(1) : u32(0);
} }
} }
template<typename T1> template<typename T1>
inline inline
void void
op_rel_noteq::apply(Mat<u32>& out, const mtOp<u32, T1, op_rel_noteq>& X) op_rel_noteq::apply(Mat<u32>& out, const mtOp<u32, T1, op_rel_noteq>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
typedef typename Proxy<T1>::ea_type ea_type;
const Proxy<T1> Y(X.m);
out.set_size(Y.get_n_rows(), Y.get_n_cols());
const eT val = X.aux;
ea_type A = Y.get_ea();
u32* out_mem = out.memptr();
const u32 n_elem = out.n_elem;
u32 i,j;
for(i=0, j=1; j<n_elem; i+=2, j+=2)
{
out_mem[i] = (A[i] != val) ? u32(1) : u32(0);
out_mem[j] = (A[j] != val) ? u32(1) : u32(0);
}
if(i < n_elem)
{
out_mem[i] = (A[i] != val) ? u32(1) : u32(0);
}
}
//
//
//
template<typename T1>
inline
void
op_rel_lt_pre::apply(Cube<u32>& out, const mtOpCube<u32, T1, op_rel_lt_pre>
& X)
{
arma_extra_debug_sigprint();
typedef typename T1::elem_type eT;
typedef typename ProxyCube<T1>::ea_type ea_type;
const ProxyCube<T1> Y(X.m);
out.set_size(Y.get_n_rows(), Y.get_n_cols(), Y.get_n_slices());
const eT val = X.aux;
ea_type A = Y.get_ea();
u32* out_mem = out.memptr();
const u32 n_elem = out.n_elem;
u32 i,j;
for(i=0, j=1; j<n_elem; i+=2, j+=2)
{
out_mem[i] = (val < A[i]) ? u32(1) : u32(0);
out_mem[j] = (val < A[j]) ? u32(1) : u32(0);
}
if(i < n_elem)
{
out_mem[i] = (val < A[i]) ? u32(1) : u32(0);
}
}
template<typename T1>
inline
void
op_rel_lt_post::apply(Cube<u32>& out, const mtOpCube<u32, T1, op_rel_lt_pos
t>& X)
{
arma_extra_debug_sigprint();
typedef typename T1::elem_type eT;
typedef typename ProxyCube<T1>::ea_type ea_type;
const ProxyCube<T1> Y(X.m);
out.set_size(Y.get_n_rows(), Y.get_n_cols(), Y.get_n_slices());
const eT val = X.aux;
ea_type A = Y.get_ea();
u32* out_mem = out.memptr();
const u32 n_elem = out.n_elem;
u32 i,j;
for(i=0, j=1; j<n_elem; i+=2, j+=2)
{
out_mem[i] = (A[i] < val) ? u32(1) : u32(0);
out_mem[j] = (A[j] < val) ? u32(1) : u32(0);
}
if(i < n_elem)
{
out_mem[i] = (A[i] < val) ? u32(1) : u32(0);
}
}
template<typename T1>
inline
void
op_rel_gt_pre::apply(Cube<u32>& out, const mtOpCube<u32, T1, op_rel_gt_pre>
& X)
{
arma_extra_debug_sigprint();
typedef typename T1::elem_type eT;
typedef typename ProxyCube<T1>::ea_type ea_type;
const ProxyCube<T1> Y(X.m);
out.set_size(Y.get_n_rows(), Y.get_n_cols(), Y.get_n_slices());
const eT val = X.aux;
ea_type A = Y.get_ea();
u32* out_mem = out.memptr();
const u32 n_elem = out.n_elem;
u32 i,j;
for(i=0, j=1; j<n_elem; i+=2, j+=2)
{
out_mem[i] = (val > A[i]) ? u32(1) : u32(0);
out_mem[j] = (val > A[j]) ? u32(1) : u32(0);
}
if(i < n_elem)
{
out_mem[i] = (val > A[i]) ? u32(1) : u32(0);
}
}
template<typename T1>
inline
void
op_rel_gt_post::apply(Cube<u32>& out, const mtOpCube<u32, T1, op_rel_gt_pos
t>& X)
{
arma_extra_debug_sigprint();
typedef typename T1::elem_type eT;
typedef typename ProxyCube<T1>::ea_type ea_type;
const Proxy<T1> A(X.m); const ProxyCube<T1> Y(X.m);
out.set_size(A.n_rows, A.n_cols); out.set_size(Y.get_n_rows(), Y.get_n_cols(), Y.get_n_slices());
const u32 n_elem = A.n_elem; const eT val = X.aux;
const eT val = X.aux; ea_type A = Y.get_ea();
u32* out_mem = out.memptr(); u32* out_mem = out.memptr();
const u32 n_elem = out.n_elem;
u32 i,j;
for(i=0, j=1; j<n_elem; i+=2, j+=2)
{
out_mem[i] = (A[i] > val) ? u32(1) : u32(0);
out_mem[j] = (A[j] > val) ? u32(1) : u32(0);
}
if(i < n_elem)
{
out_mem[i] = (A[i] > val) ? u32(1) : u32(0);
}
}
template<typename T1>
inline
void
op_rel_lteq_pre::apply(Cube<u32>& out, const mtOpCube<u32, T1, op_rel_lteq_
pre>& X)
{
arma_extra_debug_sigprint();
typedef typename T1::elem_type eT;
typedef typename ProxyCube<T1>::ea_type ea_type;
const ProxyCube<T1> Y(X.m);
out.set_size(Y.get_n_rows(), Y.get_n_cols(), Y.get_n_slices());
const eT val = X.aux;
ea_type A = Y.get_ea();
u32* out_mem = out.memptr();
const u32 n_elem = out.n_elem;
u32 i,j;
for(i=0, j=1; j<n_elem; i+=2, j+=2)
{
out_mem[i] = (val <= A[i]) ? u32(1) : u32(0);
out_mem[j] = (val <= A[j]) ? u32(1) : u32(0);
}
if(i < n_elem)
{
out_mem[i] = (val <= A[i]) ? u32(1) : u32(0);
}
}
template<typename T1>
inline
void
op_rel_lteq_post::apply(Cube<u32>& out, const mtOpCube<u32, T1, op_rel_lteq
_post>& X)
{
arma_extra_debug_sigprint();
typedef typename T1::elem_type eT;
typedef typename ProxyCube<T1>::ea_type ea_type;
const ProxyCube<T1> Y(X.m);
out.set_size(Y.get_n_rows(), Y.get_n_cols(), Y.get_n_slices());
const eT val = X.aux;
ea_type A = Y.get_ea();
u32* out_mem = out.memptr();
const u32 n_elem = out.n_elem;
u32 i,j;
for(i=0, j=1; j<n_elem; i+=2, j+=2)
{
out_mem[i] = (A[i] <= val) ? u32(1) : u32(0);
out_mem[j] = (A[j] <= val) ? u32(1) : u32(0);
}
if(i < n_elem)
{
out_mem[i] = (A[i] <= val) ? u32(1) : u32(0);
}
}
template<typename T1>
inline
void
op_rel_gteq_pre::apply(Cube<u32>& out, const mtOpCube<u32, T1, op_rel_gteq_
pre>& X)
{
arma_extra_debug_sigprint();
typedef typename T1::elem_type eT;
typedef typename ProxyCube<T1>::ea_type ea_type;
const ProxyCube<T1> Y(X.m);
out.set_size(Y.get_n_rows(), Y.get_n_cols(), Y.get_n_slices());
const eT val = X.aux;
ea_type A = Y.get_ea();
u32* out_mem = out.memptr();
const u32 n_elem = out.n_elem;
u32 i,j;
for(i=0, j=1; j<n_elem; i+=2, j+=2)
{
out_mem[i] = (val >= A[i]) ? u32(1) : u32(0);
out_mem[j] = (val >= A[j]) ? u32(1) : u32(0);
}
if(i < n_elem)
{
out_mem[i] = (val >= A[i]) ? u32(1) : u32(0);
}
}
template<typename T1>
inline
void
op_rel_gteq_post::apply(Cube<u32>& out, const mtOpCube<u32, T1, op_rel_gteq
_post>& X)
{
arma_extra_debug_sigprint();
typedef typename T1::elem_type eT;
typedef typename ProxyCube<T1>::ea_type ea_type;
const ProxyCube<T1> Y(X.m);
out.set_size(Y.get_n_rows(), Y.get_n_cols(), Y.get_n_slices());
const eT val = X.aux;
ea_type A = Y.get_ea();
u32* out_mem = out.memptr();
const u32 n_elem = out.n_elem;
u32 i,j;
for(i=0, j=1; j<n_elem; i+=2, j+=2)
{
out_mem[i] = (A[i] >= val) ? u32(1) : u32(0);
out_mem[j] = (A[j] >= val) ? u32(1) : u32(0);
}
if(i < n_elem)
{
out_mem[i] = (A[i] >= val) ? u32(1) : u32(0);
}
}
template<typename T1>
inline
void
op_rel_eq::apply(Cube<u32>& out, const mtOpCube<u32, T1, op_rel_eq>& X)
{
arma_extra_debug_sigprint();
typedef typename T1::elem_type eT;
typedef typename ProxyCube<T1>::ea_type ea_type;
const ProxyCube<T1> Y(X.m);
out.set_size(Y.get_n_rows(), Y.get_n_cols(), Y.get_n_slices());
const eT val = X.aux;
ea_type A = Y.get_ea();
u32* out_mem = out.memptr();
const u32 n_elem = out.n_elem;
u32 i,j;
for(i=0, j=1; j<n_elem; i+=2, j+=2)
{
out_mem[i] = (A[i] == val) ? u32(1) : u32(0);
out_mem[j] = (A[j] == val) ? u32(1) : u32(0);
}
if(i < n_elem)
{
out_mem[i] = (A[i] == val) ? u32(1) : u32(0);
}
}
template<typename T1>
inline
void
op_rel_noteq::apply(Cube<u32>& out, const mtOpCube<u32, T1, op_rel_noteq>&
X)
{
arma_extra_debug_sigprint();
typedef typename T1::elem_type eT;
typedef typename ProxyCube<T1>::ea_type ea_type;
const ProxyCube<T1> Y(X.m);
out.set_size(Y.get_n_rows(), Y.get_n_cols(), Y.get_n_slices());
const eT val = X.aux;
ea_type A = Y.get_ea();
u32* out_mem = out.memptr();
const u32 n_elem = out.n_elem;
u32 i,j;
for(i=0, j=1; j<n_elem; i+=2, j+=2)
{
out_mem[i] = (A[i] != val) ? u32(1) : u32(0);
out_mem[j] = (A[j] != val) ? u32(1) : u32(0);
}
for(u32 i=0; i<n_elem; ++i) if(i < n_elem)
{ {
out_mem[i] = (A[i] != val) ? u32(1) : u32(0); out_mem[i] = (A[i] != val) ? u32(1) : u32(0);
} }
} }
//! @} //! @}
 End of changes. 50 change blocks. 
70 lines changed or deleted 513 lines changed or added


 op_relational_proto.hpp   op_relational_proto.hpp 
skipping to change at line 25 skipping to change at line 25
//! \addtogroup op_relational //! \addtogroup op_relational
//! @{ //! @{
class op_rel_lt_pre class op_rel_lt_pre
{ {
public: public:
template<typename T1> template<typename T1>
inline static void apply(Mat<u32>& out, const mtOp<u32, T1, op_rel_lt_pre >& X); inline static void apply(Mat<u32>& out, const mtOp<u32, T1, op_rel_lt_pre >& X);
template<typename T1>
inline static void apply(Cube<u32>& out, const mtOpCube<u32, T1, op_rel_l
t_pre>& X);
}; };
class op_rel_lt_post class op_rel_lt_post
{ {
public: public:
template<typename T1> template<typename T1>
inline static void apply(Mat<u32>& out, const mtOp<u32, T1, op_rel_lt_pos t>& X); inline static void apply(Mat<u32>& out, const mtOp<u32, T1, op_rel_lt_pos t>& X);
template<typename T1>
inline static void apply(Cube<u32>& out, const mtOpCube<u32, T1, op_rel_l
t_post>& X);
}; };
class op_rel_gt_pre class op_rel_gt_pre
{ {
public: public:
template<typename T1> template<typename T1>
inline static void apply(Mat<u32>& out, const mtOp<u32, T1, op_rel_gt_pre >& X); inline static void apply(Mat<u32>& out, const mtOp<u32, T1, op_rel_gt_pre >& X);
template<typename T1>
inline static void apply(Cube<u32>& out, const mtOpCube<u32, T1, op_rel_g
t_pre>& X);
}; };
class op_rel_gt_post class op_rel_gt_post
{ {
public: public:
template<typename T1> template<typename T1>
inline static void apply(Mat<u32>& out, const mtOp<u32, T1, op_rel_gt_pos t>& X); inline static void apply(Mat<u32>& out, const mtOp<u32, T1, op_rel_gt_pos t>& X);
template<typename T1>
inline static void apply(Cube<u32>& out, const mtOpCube<u32, T1, op_rel_g
t_post>& X);
}; };
class op_rel_lteq_pre class op_rel_lteq_pre
{ {
public: public:
template<typename T1> template<typename T1>
inline static void apply(Mat<u32>& out, const mtOp<u32, T1, op_rel_lteq_p re>& X); inline static void apply(Mat<u32>& out, const mtOp<u32, T1, op_rel_lteq_p re>& X);
template<typename T1>
inline static void apply(Cube<u32>& out, const mtOpCube<u32, T1, op_rel_l
teq_pre>& X);
}; };
class op_rel_lteq_post class op_rel_lteq_post
{ {
public: public:
template<typename T1> template<typename T1>
inline static void apply(Mat<u32>& out, const mtOp<u32, T1, op_rel_lteq_p ost>& X); inline static void apply(Mat<u32>& out, const mtOp<u32, T1, op_rel_lteq_p ost>& X);
template<typename T1>
inline static void apply(Cube<u32>& out, const mtOpCube<u32, T1, op_rel_l
teq_post>& X);
}; };
class op_rel_gteq_pre class op_rel_gteq_pre
{ {
public: public:
template<typename T1> template<typename T1>
inline static void apply(Mat<u32>& out, const mtOp<u32, T1, op_rel_gteq_p re>& X); inline static void apply(Mat<u32>& out, const mtOp<u32, T1, op_rel_gteq_p re>& X);
template<typename T1>
inline static void apply(Cube<u32>& out, const mtOpCube<u32, T1, op_rel_g
teq_pre>& X);
}; };
class op_rel_gteq_post class op_rel_gteq_post
{ {
public: public:
template<typename T1> template<typename T1>
inline static void apply(Mat<u32>& out, const mtOp<u32, T1, op_rel_gteq_p ost>& X); inline static void apply(Mat<u32>& out, const mtOp<u32, T1, op_rel_gteq_p ost>& X);
template<typename T1>
inline static void apply(Cube<u32>& out, const mtOpCube<u32, T1, op_rel_g
teq_post>& X);
}; };
class op_rel_eq class op_rel_eq
{ {
public: public:
template<typename T1> template<typename T1>
inline static void apply(Mat<u32>& out, const mtOp<u32, T1, op_rel_eq>& X ); inline static void apply(Mat<u32>& out, const mtOp<u32, T1, op_rel_eq>& X );
template<typename T1>
inline static void apply(Cube<u32>& out, const mtOpCube<u32, T1, op_rel_e
q>& X);
}; };
class op_rel_noteq class op_rel_noteq
{ {
public: public:
template<typename T1> template<typename T1>
inline static void apply(Mat<u32>& out, const mtOp<u32, T1, op_rel_noteq> & X); inline static void apply(Mat<u32>& out, const mtOp<u32, T1, op_rel_noteq> & X);
template<typename T1>
inline static void apply(Cube<u32>& out, const mtOpCube<u32, T1, op_rel_n
oteq>& X);
}; };
//! @} //! @}
 End of changes. 10 change blocks. 
0 lines changed or deleted 40 lines changed or added


 operator_cube_div.hpp   operator_cube_div.hpp 
skipping to change at line 22 skipping to change at line 22
// 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 operator_cube_div //! \addtogroup operator_cube_div
//! @{ //! @{
//! BaseCube / scalar //! BaseCube / scalar
template<typename T1> template<typename T1>
arma_inline arma_inline
const eOpCube<T1, eop_cube_scalar_div_post> const eOpCube<T1, eop_scalar_div_post>
operator/ operator/
( (
const BaseCube<typename T1::elem_type,T1>& X, const BaseCube<typename T1::elem_type,T1>& X,
const typename T1::elem_type k const typename T1::elem_type k
) )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return eOpCube<T1, eop_cube_scalar_div_post>(X.get_ref(), k); return eOpCube<T1, eop_scalar_div_post>(X.get_ref(), k);
} }
//! scalar / BaseCube //! scalar / BaseCube
template<typename T1> template<typename T1>
arma_inline arma_inline
const eOpCube<T1, eop_cube_scalar_div_pre> const eOpCube<T1, eop_scalar_div_pre>
operator/ operator/
( (
const typename T1::elem_type k, const typename T1::elem_type k,
const BaseCube<typename T1::elem_type,T1>& X const BaseCube<typename T1::elem_type,T1>& X
) )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return eOpCube<T1, eop_cube_scalar_div_pre>(X.get_ref(), k); return eOpCube<T1, eop_scalar_div_pre>(X.get_ref(), k);
}
//! complex scalar / non-complex BaseCube (experimental)
template<typename T1>
arma_inline
const mtOpCube<typename std::complex<typename T1::pod_type>, T1, op_cx_scal
ar_div_pre>
operator/
(
const std::complex<typename T1::pod_type>& k,
const BaseCube<typename T1::pod_type, T1>& X
)
{
arma_extra_debug_sigprint();
return mtOpCube<typename std::complex<typename T1::pod_type>, T1, op_cx_s
calar_div_pre>('j', X.get_ref(), k);
}
//! non-complex BaseCube / complex scalar (experimental)
template<typename T1>
arma_inline
const mtOpCube<typename std::complex<typename T1::pod_type>, T1, op_cx_scal
ar_div_post>
operator/
(
const BaseCube<typename T1::pod_type, T1>& X,
const std::complex<typename T1::pod_type>& k
)
{
arma_extra_debug_sigprint();
return mtOpCube<typename std::complex<typename T1::pod_type>, T1, op_cx_s
calar_div_post>('j', X.get_ref(), k);
} }
//! element-wise division of BaseCube objects with same element type //! element-wise division of BaseCube objects with same element type
template<typename T1, typename T2> template<typename T1, typename T2>
arma_inline arma_inline
const eGlueCube<T1, T2, eglue_cube_div> const eGlueCube<T1, T2, eglue_div>
operator/ operator/
( (
const BaseCube<typename T1::elem_type,T1>& X, const BaseCube<typename T1::elem_type,T1>& X,
const BaseCube<typename T1::elem_type,T2>& Y const BaseCube<typename T1::elem_type,T2>& Y
) )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return eGlueCube<T1, T2, eglue_cube_div>(X.get_ref(), Y.get_ref()); return eGlueCube<T1, T2, eglue_div>(X.get_ref(), Y.get_ref());
} }
//! element-wise division of Base objects with different element types //! element-wise division of BaseCube objects with different element types
template<typename T1, typename T2> template<typename T1, typename T2>
arma_inline inline
Cube<typename promote_type<typename T1::elem_type, typename T2::elem_type>: const mtGlueCube<typename promote_type<typename T1::elem_type, typename T2:
:result> :elem_type>::result, T1, T2, glue_mixed_div>
operator/ operator/
( (
const BaseCube< typename force_different_type<typename T1::elem_type, typ ename T2::elem_type>::T1_result, T1>& X, const BaseCube< typename force_different_type<typename T1::elem_type, typ ename T2::elem_type>::T1_result, T1>& X,
const BaseCube< typename force_different_type<typename T1::elem_type, typ ename T2::elem_type>::T2_result, T2>& Y const BaseCube< typename force_different_type<typename T1::elem_type, typ ename T2::elem_type>::T2_result, T2>& Y
) )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT1; typedef typename T1::elem_type eT1;
typedef typename T2::elem_type eT2; typedef typename T2::elem_type eT2;
typedef typename promote_type<eT1,eT2>::result out_eT; typedef typename promote_type<eT1,eT2>::result out_eT;
promote_type<eT1,eT2>::check(); promote_type<eT1,eT2>::check();
const ProxyCube<T1> A(X.get_ref()); return mtGlueCube<out_eT, T1, T2, glue_mixed_div>( X.get_ref(), Y.get_ref
const ProxyCube<T2> B(Y.get_ref()); () );
arma_debug_assert_same_size(A, B, "element-wise cube division");
Cube<out_eT> out(A.n_rows, A.n_cols, A.n_slices);
out_eT* out_mem = out.memptr();
const u32 n_elem = out.n_elem;
for(u32 i=0; i<n_elem; ++i)
{
out_mem[i] = upgrade_val<eT1,eT2>::apply(A[i]) / upgrade_val<eT1,eT2>::
apply(B[i]);
}
return out;
} }
//! @} //! @}
 End of changes. 9 change blocks. 
27 lines changed or deleted 46 lines changed or added


 operator_cube_minus.hpp   operator_cube_minus.hpp 
skipping to change at line 22 skipping to change at line 22
// 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 operator_cube_minus //! \addtogroup operator_cube_minus
//! @{ //! @{
//! unary - //! unary -
template<typename T1> template<typename T1>
arma_inline arma_inline
const eOpCube<T1, eop_cube_neg> const eOpCube<T1, eop_neg>
operator- operator-
( (
const BaseCube<typename T1::elem_type,T1>& X const BaseCube<typename T1::elem_type,T1>& X
) )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return eOpCube<T1, eop_cube_neg>(X.get_ref()); return eOpCube<T1, eop_neg>(X.get_ref());
} }
//! cancellation of two consecutive negations: -(-T1) //! cancellation of two consecutive negations: -(-T1)
template<typename T1> template<typename T1>
arma_inline arma_inline
const T1& const T1&
operator- operator-
( (
const eOpCube<T1, eop_cube_neg>& X const eOpCube<T1, eop_neg>& X
) )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return X.m; return X.m;
} }
//! BaseCube - scalar //! BaseCube - scalar
template<typename T1> template<typename T1>
arma_inline arma_inline
const eOpCube<T1, eop_cube_scalar_minus_post> const eOpCube<T1, eop_scalar_minus_post>
operator- operator-
( (
const BaseCube<typename T1::elem_type,T1>& X, const BaseCube<typename T1::elem_type,T1>& X,
const typename T1::elem_type k const typename T1::elem_type k
) )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return eOpCube<T1, eop_cube_scalar_minus_post>(X.get_ref(), k); return eOpCube<T1, eop_scalar_minus_post>(X.get_ref(), k);
} }
//! scalar - BaseCube //! scalar - BaseCube
template<typename T1> template<typename T1>
arma_inline arma_inline
const eOpCube<T1, eop_cube_scalar_minus_pre> const eOpCube<T1, eop_scalar_minus_pre>
operator- operator-
( (
const typename T1::elem_type k, const typename T1::elem_type k,
const BaseCube<typename T1::elem_type,T1>& X const BaseCube<typename T1::elem_type,T1>& X
) )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return eOpCube<T1, eop_cube_scalar_minus_pre>(X.get_ref(), k); return eOpCube<T1, eop_scalar_minus_pre>(X.get_ref(), k);
}
//! complex scalar - non-complex BaseCube (experimental)
template<typename T1>
arma_inline
const mtOpCube<typename std::complex<typename T1::pod_type>, T1, op_cx_scal
ar_minus_pre>
operator-
(
const std::complex<typename T1::pod_type>& k,
const BaseCube<typename T1::pod_type, T1>& X
)
{
arma_extra_debug_sigprint();
return mtOpCube<typename std::complex<typename T1::pod_type>, T1, op_cx_s
calar_minus_pre>('j', X.get_ref(), k);
}
//! non-complex BaseCube - complex scalar (experimental)
template<typename T1>
arma_inline
const mtOpCube<typename std::complex<typename T1::pod_type>, T1, op_cx_scal
ar_minus_post>
operator-
(
const BaseCube<typename T1::pod_type, T1>& X,
const std::complex<typename T1::pod_type>& k
)
{
arma_extra_debug_sigprint();
return mtOpCube<typename std::complex<typename T1::pod_type>, T1, op_cx_s
calar_minus_post>('j', X.get_ref(), k);
} }
//! subtraction of BaseCube objects with same element type //! subtraction of BaseCube objects with same element type
template<typename T1, typename T2> template<typename T1, typename T2>
arma_inline arma_inline
const eGlueCube<T1, T2, eglue_cube_minus> const eGlueCube<T1, T2, eglue_minus>
operator- operator-
( (
const BaseCube<typename T1::elem_type,T1>& X, const BaseCube<typename T1::elem_type,T1>& X,
const BaseCube<typename T1::elem_type,T2>& Y const BaseCube<typename T1::elem_type,T2>& Y
) )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return eGlueCube<T1, T2, eglue_cube_minus>(X.get_ref(), Y.get_ref()); return eGlueCube<T1, T2, eglue_minus>(X.get_ref(), Y.get_ref());
} }
//! subtraction of Base objects with different element types //! subtraction of BaseCube objects with different element types
template<typename T1, typename T2> template<typename T1, typename T2>
arma_inline inline
Cube<typename promote_type<typename T1::elem_type, typename T2::elem_type>: const mtGlueCube<typename promote_type<typename T1::elem_type, typename T2:
:result> :elem_type>::result, T1, T2, glue_mixed_minus>
operator- operator-
( (
const BaseCube< typename force_different_type<typename T1::elem_type, typ ename T2::elem_type>::T1_result, T1>& X, const BaseCube< typename force_different_type<typename T1::elem_type, typ ename T2::elem_type>::T1_result, T1>& X,
const BaseCube< typename force_different_type<typename T1::elem_type, typ ename T2::elem_type>::T2_result, T2>& Y const BaseCube< typename force_different_type<typename T1::elem_type, typ ename T2::elem_type>::T2_result, T2>& Y
) )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT1; typedef typename T1::elem_type eT1;
typedef typename T2::elem_type eT2; typedef typename T2::elem_type eT2;
typedef typename promote_type<eT1,eT2>::result out_eT; typedef typename promote_type<eT1,eT2>::result out_eT;
promote_type<eT1,eT2>::check(); promote_type<eT1,eT2>::check();
const ProxyCube<T1> A(X.get_ref()); return mtGlueCube<out_eT, T1, T2, glue_mixed_minus>( X.get_ref(), Y.get_r
const ProxyCube<T2> B(Y.get_ref()); ef() );
arma_debug_assert_same_size(A, B, "cube subtraction");
Cube<out_eT> out(A.n_rows, A.n_cols, A.n_slices);
out_eT* out_mem = out.memptr();
const u32 n_elem = out.n_elem;
for(u32 i=0; i<n_elem; ++i)
{
out_mem[i] = upgrade_val<eT1,eT2>::apply(A[i]) - upgrade_val<eT1,eT2>::
apply(B[i]);
}
return out;
} }
//! @} //! @}
 End of changes. 12 change blocks. 
30 lines changed or deleted 49 lines changed or added


 operator_cube_plus.hpp   operator_cube_plus.hpp 
skipping to change at line 36 skipping to change at line 36
) )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return X; return X;
} }
//! BaseCube + scalar //! BaseCube + scalar
template<typename T1> template<typename T1>
arma_inline arma_inline
const eOpCube<T1, eop_cube_scalar_plus> const eOpCube<T1, eop_scalar_plus>
operator+ operator+
( (
const BaseCube<typename T1::elem_type,T1>& X, const BaseCube<typename T1::elem_type,T1>& X,
const typename T1::elem_type k const typename T1::elem_type k
) )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return eOpCube<T1, eop_cube_scalar_plus>(X.get_ref(), k); return eOpCube<T1, eop_scalar_plus>(X.get_ref(), k);
} }
//! scalar + BaseCube //! scalar + BaseCube
template<typename T1> template<typename T1>
arma_inline arma_inline
const eOpCube<T1, eop_cube_scalar_plus> const eOpCube<T1, eop_scalar_plus>
operator+ operator+
( (
const typename T1::elem_type k, const typename T1::elem_type k,
const BaseCube<typename T1::elem_type,T1>& X const BaseCube<typename T1::elem_type,T1>& X
) )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return eOpCube<T1, eop_cube_scalar_plus>(X.get_ref(), k); return eOpCube<T1, eop_scalar_plus>(X.get_ref(), k);
}
//! non-complex BaseCube + complex scalar (experimental)
template<typename T1>
arma_inline
const mtOpCube<typename std::complex<typename T1::pod_type>, T1, op_cx_scal
ar_plus>
operator+
(
const BaseCube<typename T1::pod_type, T1>& X,
const std::complex<typename T1::pod_type>& k
)
{
arma_extra_debug_sigprint();
return mtOpCube<typename std::complex<typename T1::pod_type>, T1, op_cx_s
calar_plus>('j', X.get_ref(), k);
}
//! complex scalar + non-complex BaseCube (experimental)
template<typename T1>
arma_inline
const mtOpCube<typename std::complex<typename T1::pod_type>, T1, op_cx_scal
ar_plus>
operator+
(
const std::complex<typename T1::pod_type>& k,
const BaseCube<typename T1::pod_type, T1>& X
)
{
arma_extra_debug_sigprint();
return mtOpCube<typename std::complex<typename T1::pod_type>, T1, op_cx_s
calar_plus>('j', X.get_ref(), k); // NOTE: order is swapped
} }
//! addition of BaseCube objects with same element type //! addition of BaseCube objects with same element type
template<typename T1, typename T2> template<typename T1, typename T2>
arma_inline arma_inline
const eGlueCube<T1, T2, eglue_cube_plus> const eGlueCube<T1, T2, eglue_plus>
operator+ operator+
( (
const BaseCube<typename T1::elem_type,T1>& X, const BaseCube<typename T1::elem_type,T1>& X,
const BaseCube<typename T1::elem_type,T2>& Y const BaseCube<typename T1::elem_type,T2>& Y
) )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return eGlueCube<T1, T2, eglue_cube_plus>(X.get_ref(), Y.get_ref()); return eGlueCube<T1, T2, eglue_plus>(X.get_ref(), Y.get_ref());
} }
//! addition of BaseCube objects with different element types //! addition of BaseCube objects with different element types
template<typename T1, typename T2> template<typename T1, typename T2>
arma_inline inline
Cube<typename promote_type<typename T1::elem_type, typename T2::elem_type>: const mtGlueCube<typename promote_type<typename T1::elem_type, typename T2:
:result> :elem_type>::result, T1, T2, glue_mixed_plus>
operator+ operator+
( (
const BaseCube< typename force_different_type<typename T1::elem_type, typ ename T2::elem_type>::T1_result, T1>& X, const BaseCube< typename force_different_type<typename T1::elem_type, typ ename T2::elem_type>::T1_result, T1>& X,
const BaseCube< typename force_different_type<typename T1::elem_type, typ ename T2::elem_type>::T2_result, T2>& Y const BaseCube< typename force_different_type<typename T1::elem_type, typ ename T2::elem_type>::T2_result, T2>& Y
) )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT1; typedef typename T1::elem_type eT1;
typedef typename T2::elem_type eT2; typedef typename T2::elem_type eT2;
typedef typename promote_type<eT1,eT2>::result out_eT; typedef typename promote_type<eT1,eT2>::result out_eT;
promote_type<eT1,eT2>::check(); promote_type<eT1,eT2>::check();
const ProxyCube<T1> A(X.get_ref()); return mtGlueCube<out_eT, T1, T2, glue_mixed_plus>( X.get_ref(), Y.get_re
const ProxyCube<T2> B(Y.get_ref()); f() );
arma_debug_assert_same_size(A, B, "cube addition");
Cube<out_eT> out(A.n_rows, A.n_cols, A.n_slices);
out_eT* out_mem = out.memptr();
const u32 n_elem = out.n_elem;
for(u32 i=0; i<n_elem; ++i)
{
out_mem[i] = upgrade_val<eT1,eT2>::apply(A[i]) + upgrade_val<eT1,eT2>::
apply(B[i]);
}
return out;
} }
//! @} //! @}
 End of changes. 8 change blocks. 
26 lines changed or deleted 45 lines changed or added


 operator_cube_relational.hpp   operator_cube_relational.hpp 
skipping to change at line 19 skipping to change at line 19
// 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 operator_cube_relational //! \addtogroup operator_cube_relational
//! @{ //! @{
// < : lt
// > : gt
// <= : lteq
// >= : gteq
// == : eq
// != : noteq
template<typename T1, typename T2> template<typename T1, typename T2>
inline inline
ucube const mtGlueCube<u32, T1, T2, glue_rel_lt>
operator== operator<
(const BaseCube<typename T1::elem_type,T1>& X, const BaseCube<typename T1:: (const BaseCube<typename arma_not_cx<typename T1::elem_type>::result,T1>& X
elem_type,T2>& Y) , const BaseCube<typename arma_not_cx<typename T1::elem_type>::result,T2>&
Y)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename ucube::elem_type ucube_eT; return mtGlueCube<u32, T1, T2, glue_rel_lt>( X.get_ref(), Y.get_ref() );
const ProxyCube<T1> A(X.get_ref());
const ProxyCube<T2> B(Y.get_ref());
arma_debug_assert_same_size(A, B, "operator==");
ucube out(A.n_rows, A.n_cols, A.n_slices);
ucube_eT* out_mem = out.memptr();
for(u32 i=0; i<A.n_elem; ++i)
{
if(A[i] == B[i])
{
out_mem[i] = ucube_eT(1);
}
else
{
out_mem[i] = ucube_eT(0);
}
}
return out;
} }
template<typename T1, typename T2> template<typename T1, typename T2>
inline inline
ucube const mtGlueCube<u32, T1, T2, glue_rel_gt>
operator!= operator>
(const BaseCube<typename T1::elem_type,T1>& X, const BaseCube<typename T1:: (const BaseCube<typename arma_not_cx<typename T1::elem_type>::result,T1>& X
elem_type,T2>& Y) , const BaseCube<typename arma_not_cx<typename T1::elem_type>::result,T2>&
Y)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename ucube::elem_type ucube_eT; return mtGlueCube<u32, T1, T2, glue_rel_gt>( X.get_ref(), Y.get_ref() );
const ProxyCube<T1> A(X.get_ref());
const ProxyCube<T2> B(Y.get_ref());
arma_debug_assert_same_size(A, B, "operator!=");
ucube out(A.n_rows, A.n_cols, A.n_slices);
ucube_eT* out_mem = out.memptr();
for(u32 i=0; i<A.n_elem; ++i)
{
if(A[i] != B[i])
{
out_mem[i] = ucube_eT(1);
}
else
{
out_mem[i] = ucube_eT(0);
}
}
return out;
} }
template<typename T1, typename T2> template<typename T1, typename T2>
inline inline
ucube const mtGlueCube<u32, T1, T2, glue_rel_lteq>
operator>= operator<=
(const BaseCube<typename T1::elem_type,T1>& X, const BaseCube<typename T1:: (const BaseCube<typename arma_not_cx<typename T1::elem_type>::result,T1>& X
elem_type,T2>& Y) , const BaseCube<typename arma_not_cx<typename T1::elem_type>::result,T2>&
Y)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename ucube::elem_type ucube_eT; return mtGlueCube<u32, T1, T2, glue_rel_lteq>( X.get_ref(), Y.get_ref() )
;
const ProxyCube<T1> A(X.get_ref());
const ProxyCube<T2> B(Y.get_ref());
arma_debug_assert_same_size(A, B, "operator>=");
ucube out(A.n_rows, A.n_cols, A.n_slices);
ucube_eT* out_mem = out.memptr();
for(u32 i=0; i<A.n_elem; ++i)
{
if(A[i] >= B[i])
{
out_mem[i] = ucube_eT(1);
}
else
{
out_mem[i] = ucube_eT(0);
}
}
return out;
} }
template<typename T1, typename T2> template<typename T1, typename T2>
inline inline
ucube const mtGlueCube<u32, T1, T2, glue_rel_gteq>
operator<= operator>=
(const BaseCube<typename T1::elem_type,T1>& X, const BaseCube<typename T1:: (const BaseCube<typename arma_not_cx<typename T1::elem_type>::result,T1>& X
elem_type,T2>& Y) , const BaseCube<typename arma_not_cx<typename T1::elem_type>::result,T2>&
Y)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename ucube::elem_type ucube_eT; return mtGlueCube<u32, T1, T2, glue_rel_gteq>( X.get_ref(), Y.get_ref() )
;
const ProxyCube<T1> A(X.get_ref());
const ProxyCube<T2> B(Y.get_ref());
arma_debug_assert_same_size(A, B, "operator<=");
ucube out(A.n_rows, A.n_cols, A.n_slices);
ucube_eT* out_mem = out.memptr();
for(u32 i=0; i<A.n_elem; ++i)
{
if(A[i] <= B[i])
{
out_mem[i] = ucube_eT(1);
}
else
{
out_mem[i] = ucube_eT(0);
}
}
return out;
} }
template<typename T1, typename T2> template<typename T1, typename T2>
inline inline
ucube const mtGlueCube<u32, T1, T2, glue_rel_eq>
operator> operator==
(const BaseCube<typename T1::elem_type,T1>& X, const BaseCube<typename T1:: elem_type,T2>& Y) (const BaseCube<typename T1::elem_type,T1>& X, const BaseCube<typename T1:: elem_type,T2>& Y)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename ucube::elem_type ucube_eT; return mtGlueCube<u32, T1, T2, glue_rel_eq>( X.get_ref(), Y.get_ref() );
const ProxyCube<T1> A(X.get_ref());
const ProxyCube<T2> B(Y.get_ref());
arma_debug_assert_same_size(A, B, "operator>");
ucube out(A.n_rows, A.n_cols, A.n_slices);
ucube_eT* out_mem = out.memptr();
for(u32 i=0; i<A.n_elem; ++i)
{
if(A[i] > B[i])
{
out_mem[i] = ucube_eT(1);
}
else
{
out_mem[i] = ucube_eT(0);
}
}
return out;
} }
template<typename T1, typename T2> template<typename T1, typename T2>
inline inline
ucube const mtGlueCube<u32, T1, T2, glue_rel_noteq>
operator< operator!=
(const BaseCube<typename T1::elem_type,T1>& X, const BaseCube<typename T1:: elem_type,T2>& Y) (const BaseCube<typename T1::elem_type,T1>& X, const BaseCube<typename T1:: elem_type,T2>& Y)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename ucube::elem_type ucube_eT; return mtGlueCube<u32, T1, T2, glue_rel_noteq>( X.get_ref(), Y.get_ref()
);
const ProxyCube<T1> A(X.get_ref());
const ProxyCube<T2> B(Y.get_ref());
arma_debug_assert_same_size(A, B, "operator<");
ucube out(A.n_rows, A.n_cols, A.n_slices);
ucube_eT* out_mem = out.memptr();
for(u32 i=0; i<A.n_elem; ++i)
{
if(A[i] < B[i])
{
out_mem[i] = ucube_eT(1);
}
else
{
out_mem[i] = ucube_eT(0);
}
}
return out;
} }
//
//
//
template<typename T1> template<typename T1>
inline inline
ucube const mtOpCube<u32, T1, op_rel_lt_pre>
operator== operator<
(const BaseCube<typename T1::elem_type,T1>& X, const typename T1::elem_type (const typename arma_not_cx<typename T1::elem_type>::result val, const Base
val) Cube<typename arma_not_cx<typename T1::elem_type>::result,T1>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename ucube::elem_type ucube_eT; return mtOpCube<u32, T1, op_rel_lt_pre>(X.get_ref(), val);
const ProxyCube<T1> A(X.get_ref());
ucube out(A.n_rows, A.n_cols, A.n_slices);
ucube_eT* out_mem = out.memptr();
for(u32 i=0; i<A.n_elem; ++i)
{
if(A[i] == val)
{
out_mem[i] = ucube_eT(1);
}
else
{
out_mem[i] = ucube_eT(0);
}
}
return out;
} }
template<typename T1> template<typename T1>
inline inline
ucube const mtOpCube<u32, T1, op_rel_lt_post>
operator!= operator<
(const BaseCube<typename T1::elem_type,T1>& X, const typename T1::elem_type (const BaseCube<typename arma_not_cx<typename T1::elem_type>::result,T1>& X
val) , const typename arma_not_cx<typename T1::elem_type>::result val)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename ucube::elem_type ucube_eT; return mtOpCube<u32, T1, op_rel_lt_post>(X.get_ref(), val);
const ProxyCube<T1> A(X.get_ref());
ucube out(A.n_rows, A.n_cols, A.n_slices);
ucube_eT* out_mem = out.memptr();
for(u32 i=0; i<A.n_elem; ++i)
{
if(A[i] != val)
{
out_mem[i] = ucube_eT(1);
}
else
{
out_mem[i] = ucube_eT(0);
}
}
return out;
} }
template<typename T1> template<typename T1>
inline inline
ucube const mtOpCube<u32, T1, op_rel_gt_pre>
operator>= operator>
(const BaseCube<typename T1::elem_type,T1>& X, const typename T1::elem_type (const typename arma_not_cx<typename T1::elem_type>::result val, const Base
val) Cube<typename arma_not_cx<typename T1::elem_type>::result,T1>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename ucube::elem_type ucube_eT; return mtOpCube<u32, T1, op_rel_gt_pre>(X.get_ref(), val);
const ProxyCube<T1> A(X.get_ref());
ucube out(A.n_rows, A.n_cols, A.n_slices);
ucube_eT* out_mem = out.memptr();
for(u32 i=0; i<A.n_elem; ++i)
{
if(A[i] >= val)
{
out_mem[i] = ucube_eT(1);
}
else
{
out_mem[i] = ucube_eT(0);
}
}
return out;
} }
template<typename T1> template<typename T1>
inline inline
ucube const mtOpCube<u32, T1, op_rel_gt_post>
operator<= operator>
(const BaseCube<typename T1::elem_type,T1>& X, const typename T1::elem_type (const BaseCube<typename arma_not_cx<typename T1::elem_type>::result,T1>& X
val) , const typename arma_not_cx<typename T1::elem_type>::result val)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename ucube::elem_type ucube_eT; return mtOpCube<u32, T1, op_rel_gt_post>(X.get_ref(), val);
const ProxyCube<T1> A(X.get_ref());
ucube out(A.n_rows, A.n_cols, A.n_slices);
ucube_eT* out_mem = out.memptr();
for(u32 i=0; i<A.n_elem; ++i)
{
if(A[i] <= val)
{
out_mem[i] = ucube_eT(1);
}
else
{
out_mem[i] = ucube_eT(0);
}
}
return out;
} }
template<typename T1> template<typename T1>
inline inline
ucube const mtOpCube<u32, T1, op_rel_lteq_pre>
operator> operator<=
(const BaseCube<typename T1::elem_type,T1>& X, const typename T1::elem_type (const typename arma_not_cx<typename T1::elem_type>::result val, const Base
val) Cube<typename arma_not_cx<typename T1::elem_type>::result,T1>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename ucube::elem_type ucube_eT; return mtOpCube<u32, T1, op_rel_lteq_pre>(X.get_ref(), val);
const ProxyCube<T1> A(X.get_ref());
ucube out(A.n_rows, A.n_cols, A.n_slices);
ucube_eT* out_mem = out.memptr();
for(u32 i=0; i<A.n_elem; ++i)
{
if(A[i] > val)
{
out_mem[i] = ucube_eT(1);
}
else
{
out_mem[i] = ucube_eT(0);
}
}
return out;
} }
template<typename T1> template<typename T1>
inline inline
ucube const mtOpCube<u32, T1, op_rel_lteq_post>
operator< operator<=
(const BaseCube<typename T1::elem_type,T1>& X, const typename T1::elem_type (const BaseCube<typename arma_not_cx<typename T1::elem_type>::result,T1>& X
val) , const typename arma_not_cx<typename T1::elem_type>::result val)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename ucube::elem_type ucube_eT; return mtOpCube<u32, T1, op_rel_lteq_post>(X.get_ref(), val);
const ProxyCube<T1> A(X.get_ref());
ucube out(A.n_rows, A.n_cols, A.n_slices);
ucube_eT* out_mem = out.memptr();
for(u32 i=0; i<A.n_elem; ++i)
{
if(A[i] < val)
{
out_mem[i] = ucube_eT(1);
}
else
{
out_mem[i] = ucube_eT(0);
}
}
return out;
} }
template<typename T1> template<typename T1>
inline inline
ucube const mtOpCube<u32, T1, op_rel_gteq_pre>
operator== operator>=
(const typename T1::elem_type val, const BaseCube<typename T1::elem_type,T1 (const typename arma_not_cx<typename T1::elem_type>::result val, const Base
>& X) Cube<typename arma_not_cx<typename T1::elem_type>::result,T1>& X)
{ {
return operator==(X,val); arma_extra_debug_sigprint();
return mtOpCube<u32, T1, op_rel_gteq_pre>(X.get_ref(), val);
} }
template<typename T1> template<typename T1>
inline inline
ucube const mtOpCube<u32, T1, op_rel_gteq_post>
operator!= operator>=
(const typename T1::elem_type val, const BaseCube<typename T1::elem_type,T1 (const BaseCube<typename arma_not_cx<typename T1::elem_type>::result,T1>& X
>& X) , const typename arma_not_cx<typename T1::elem_type>::result val)
{ {
return operator!=(X,val); arma_extra_debug_sigprint();
return mtOpCube<u32, T1, op_rel_gteq_post>(X.get_ref(), val);
} }
template<typename T1> template<typename T1>
inline inline
ucube const mtOpCube<u32, T1, op_rel_eq>
operator>= operator==
(const typename T1::elem_type val, const BaseCube<typename T1::elem_type,T1 >& X) (const typename T1::elem_type val, const BaseCube<typename T1::elem_type,T1 >& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename ucube::elem_type ucube_eT; return mtOpCube<u32, T1, op_rel_eq>(X.get_ref(), val);
const ProxyCube<T1> A(X.get_ref());
ucube out(A.n_rows, A.n_cols, A.n_slices);
ucube_eT* out_mem = out.memptr();
for(u32 i=0; i<A.n_elem; ++i)
{
if(val >= A[i])
{
out_mem[i] = ucube_eT(1);
}
else
{
out_mem[i] = ucube_eT(0);
}
}
return out;
} }
template<typename T1> template<typename T1>
inline inline
ucube const mtOpCube<u32, T1, op_rel_eq>
operator<= operator==
(const typename T1::elem_type val, const BaseCube<typename T1::elem_type,T1 (const BaseCube<typename T1::elem_type,T1>& X, const typename T1::elem_type
>& X) val)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename ucube::elem_type ucube_eT; return mtOpCube<u32, T1, op_rel_eq>(X.get_ref(), val);
const ProxyCube<T1> A(X.get_ref());
ucube out(A.n_rows, A.n_cols, A.n_slices);
ucube_eT* out_mem = out.memptr();
for(u32 i=0; i<A.n_elem; ++i)
{
if(val <= A[i])
{
out_mem[i] = ucube_eT(1);
}
else
{
out_mem[i] = ucube_eT(0);
}
}
return out;
} }
template<typename T1> template<typename T1>
inline inline
ucube const mtOpCube<u32, T1, op_rel_noteq>
operator> operator!=
(const typename T1::elem_type val, const BaseCube<typename T1::elem_type,T1 >& X) (const typename T1::elem_type val, const BaseCube<typename T1::elem_type,T1 >& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename ucube::elem_type ucube_eT; return mtOpCube<u32, T1, op_rel_noteq>(X.get_ref(), val);
const ProxyCube<T1> A(X.get_ref());
ucube out(A.n_rows, A.n_cols, A.n_slices);
ucube_eT* out_mem = out.memptr();
for(u32 i=0; i<A.n_elem; ++i)
{
if(val > A[i])
{
out_mem[i] = ucube_eT(1);
}
else
{
out_mem[i] = ucube_eT(0);
}
}
return out;
} }
template<typename T1> template<typename T1>
inline inline
ucube const mtOpCube<u32, T1, op_rel_noteq>
operator< operator!=
(const typename T1::elem_type val, const BaseCube<typename T1::elem_type,T1 (const BaseCube<typename T1::elem_type,T1>& X, const typename T1::elem_type
>& X) val)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename ucube::elem_type ucube_eT; return mtOpCube<u32, T1, op_rel_noteq>(X.get_ref(), val);
const ProxyCube<T1> A(X.get_ref());
ucube out(A.n_rows, A.n_cols, A.n_slices);
ucube_eT* out_mem = out.memptr();
for(u32 i=0; i<A.n_elem; ++i)
{
if(val < A[i])
{
out_mem[i] = ucube_eT(1);
}
else
{
out_mem[i] = ucube_eT(0);
}
}
return out;
} }
//! @} //! @}
 End of changes. 38 change blocks. 
420 lines changed or deleted 104 lines changed or added


 operator_cube_schur.hpp   operator_cube_schur.hpp 
skipping to change at line 24 skipping to change at line 24
// (see http://www.opensource.org/licenses for more info) // (see http://www.opensource.org/licenses for more info)
//! \addtogroup operator_cube_schur //! \addtogroup operator_cube_schur
//! @{ //! @{
// operator %, which we define it to do a schur product (element-wise multi plication) // operator %, which we define it to do a schur product (element-wise multi plication)
//! element-wise multiplication of BaseCube objects with same element type //! element-wise multiplication of BaseCube objects with same element type
template<typename T1, typename T2> template<typename T1, typename T2>
arma_inline arma_inline
const eGlueCube<T1, T2, eglue_cube_schur> const eGlueCube<T1, T2, eglue_schur>
operator% operator%
( (
const BaseCube<typename T1::elem_type,T1>& X, const BaseCube<typename T1::elem_type,T1>& X,
const BaseCube<typename T1::elem_type,T2>& Y const BaseCube<typename T1::elem_type,T2>& Y
) )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return eGlueCube<T1, T2, eglue_cube_schur>(X.get_ref(), Y.get_ref()); return eGlueCube<T1, T2, eglue_schur>(X.get_ref(), Y.get_ref());
} }
//! element-wise multiplication of BaseCube objects with different element types //! element-wise multiplication of BaseCube objects with different element types
template<typename T1, typename T2> template<typename T1, typename T2>
arma_inline inline
Cube<typename promote_type<typename T1::elem_type, typename T2::elem_type>: const mtGlueCube<typename promote_type<typename T1::elem_type, typename T2:
:result> :elem_type>::result, T1, T2, glue_mixed_schur>
operator% operator%
( (
const BaseCube< typename force_different_type<typename T1::elem_type, typ ename T2::elem_type>::T1_result, T1>& X, const BaseCube< typename force_different_type<typename T1::elem_type, typ ename T2::elem_type>::T1_result, T1>& X,
const BaseCube< typename force_different_type<typename T1::elem_type, typ ename T2::elem_type>::T2_result, T2>& Y const BaseCube< typename force_different_type<typename T1::elem_type, typ ename T2::elem_type>::T2_result, T2>& Y
) )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT1; typedef typename T1::elem_type eT1;
typedef typename T2::elem_type eT2; typedef typename T2::elem_type eT2;
typedef typename promote_type<eT1,eT2>::result out_eT; typedef typename promote_type<eT1,eT2>::result out_eT;
promote_type<eT1,eT2>::check(); promote_type<eT1,eT2>::check();
const ProxyCube<T1> A(X.get_ref()); return mtGlueCube<out_eT, T1, T2, glue_mixed_schur>( X.get_ref(), Y.get_r
const ProxyCube<T2> B(Y.get_ref()); ef() );
arma_debug_assert_same_size(A, B, "element-wise cube multiplication");
Cube<out_eT> out(A.n_rows, A.n_cols, A.n_slices);
out_eT* out_mem = out.memptr();
const u32 n_elem = out.n_elem;
for(u32 i=0; i<n_elem; ++i)
{
out_mem[i] = upgrade_val<eT1,eT2>::apply(A[i]) * upgrade_val<eT1,eT2>::
apply(B[i]);
}
return out;
} }
//! @} //! @}
 End of changes. 4 change blocks. 
22 lines changed or deleted 7 lines changed or added


 operator_cube_times.hpp   operator_cube_times.hpp 
skipping to change at line 22 skipping to change at line 22
// 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 operator_cube_times //! \addtogroup operator_cube_times
//! @{ //! @{
//! BaseCube * scalar //! BaseCube * scalar
template<typename T1> template<typename T1>
arma_inline arma_inline
const eOpCube<T1, eop_cube_scalar_times> const eOpCube<T1, eop_scalar_times>
operator* operator*
( (
const BaseCube<typename T1::elem_type,T1>& X, const BaseCube<typename T1::elem_type,T1>& X,
const typename T1::elem_type k const typename T1::elem_type k
) )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return eOpCube<T1, eop_cube_scalar_times>(X.get_ref(), k); return eOpCube<T1, eop_scalar_times>(X.get_ref(), k);
} }
//! scalar * BaseCube //! scalar * BaseCube
template<typename T1> template<typename T1>
arma_inline arma_inline
const eOpCube<T1, eop_cube_scalar_times> const eOpCube<T1, eop_scalar_times>
operator* operator*
( (
const typename T1::elem_type k, const typename T1::elem_type k,
const BaseCube<typename T1::elem_type,T1>& X const BaseCube<typename T1::elem_type,T1>& X
) )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return eOpCube<T1, eop_cube_scalar_times>(X.get_ref(), k); return eOpCube<T1, eop_scalar_times>(X.get_ref(), k);
}
//! non-complex BaseCube * complex scalar (experimental)
template<typename T1>
arma_inline
const mtOpCube<typename std::complex<typename T1::pod_type>, T1, op_cx_scal
ar_times>
operator*
(
const BaseCube<typename T1::pod_type, T1>& X,
const std::complex<typename T1::pod_type>& k
)
{
arma_extra_debug_sigprint();
return mtOpCube<typename std::complex<typename T1::pod_type>, T1, op_cx_s
calar_times>('j', X.get_ref(), k);
}
//! complex scalar * non-complex BaseCube (experimental)
template<typename T1>
arma_inline
const mtOpCube<typename std::complex<typename T1::pod_type>, T1, op_cx_scal
ar_times>
operator*
(
const std::complex<typename T1::pod_type>& k,
const BaseCube<typename T1::pod_type, T1>& X
)
{
arma_extra_debug_sigprint();
return mtOpCube<typename std::complex<typename T1::pod_type>, T1, op_cx_s
calar_times>('j', X.get_ref(), k);
} }
//! @} //! @}
 End of changes. 4 change blocks. 
4 lines changed or deleted 38 lines changed or added


 running_stat_vec_meat.hpp   running_stat_vec_meat.hpp 
skipping to change at line 82 skipping to change at line 82
void void
running_stat_vec<eT>::operator() (const Base<typename get_pod_type<eT>::res ult, T1>& X) running_stat_vec<eT>::operator() (const Base<typename get_pod_type<eT>::res ult, T1>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
//typedef typename get_pod_type<eT>::result T; //typedef typename get_pod_type<eT>::result T;
const unwrap<T1> tmp(X.get_ref()); const unwrap<T1> tmp(X.get_ref());
const Mat<eT>& sample = tmp.M; const Mat<eT>& sample = tmp.M;
arma_check( (sample.is_finite() == false), "running_stat_vec: given sampl if( sample.is_empty() )
e has non-finite elements" ); {
return;
}
if( sample.is_finite() == false )
{
arma_print("running_stat_vec: sample ignored as it has non-finite eleme
nts");
return;
}
running_stat_vec_aux::update_stats(*this, sample); running_stat_vec_aux::update_stats(*this, sample);
} }
//! update statistics to reflect new sample (version for complex numbers) //! update statistics to reflect new sample (version for complex numbers)
template<typename eT> template<typename eT>
template<typename T1> template<typename T1>
arma_hot arma_hot
inline inline
void void
running_stat_vec<eT>::operator() (const Base<std::complex<typename get_pod_ type<eT>::result>, T1>& X) running_stat_vec<eT>::operator() (const Base<std::complex<typename get_pod_ type<eT>::result>, T1>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
//typedef typename std::complex<typename get_pod_type<eT>::result> eT; //typedef typename std::complex<typename get_pod_type<eT>::result> eT;
const unwrap<T1> tmp(X.get_ref()); const unwrap<T1> tmp(X.get_ref());
const Mat<eT>& sample = tmp.M; const Mat<eT>& sample = tmp.M;
arma_check( (sample.is_finite() == false), "running_stat_vec: given sampl if( sample.is_empty() )
e has non-finite elements" ); {
return;
}
if( sample.is_finite() == false )
{
arma_print("running_stat_vec: sample ignored as it has non-finite eleme
nts");
return;
}
running_stat_vec_aux::update_stats(*this, sample); running_stat_vec_aux::update_stats(*this, sample);
} }
//! set all statistics to zero //! set all statistics to zero
template<typename eT> template<typename eT>
inline inline
void void
running_stat_vec<eT>::reset() running_stat_vec<eT>::reset()
{ {
 End of changes. 2 change blocks. 
4 lines changed or deleted 22 lines changed or added


 traits.hpp   traits.hpp 
skipping to change at line 116 skipping to change at line 116
template<typename T> template<typename T>
struct is_Op struct is_Op
{ static const bool value = false; }; { static const bool value = false; };
template<typename T1, typename op_type> template<typename T1, typename op_type>
struct is_Op< Op<T1,op_type> > struct is_Op< Op<T1,op_type> >
{ static const bool value = true; }; { static const bool value = true; };
template<typename T> template<typename T>
struct is_OpCube struct is_eOp
{ static const bool value = false; }; { static const bool value = false; };
template<typename T1, typename op_type> template<typename T1, typename eop_type>
struct is_OpCube< OpCube<T1,op_type> > struct is_eOp< eOp<T1,eop_type> >
{ static const bool value = true; };
template<typename T>
struct is_mtOp
{ static const bool value = false; };
template<typename eT, typename T1, typename op_type>
struct is_mtOp< mtOp<eT, T1, op_type> >
{ static const bool value = true; }; { static const bool value = true; };
template<typename T> template<typename T>
struct is_Glue struct is_Glue
{ static const bool value = false; }; { static const bool value = false; };
template<typename T1, typename T2, typename glue_type> template<typename T1, typename T2, typename glue_type>
struct is_Glue< Glue<T1,T2,glue_type> > struct is_Glue< Glue<T1,T2,glue_type> >
{ static const bool value = true; }; { static const bool value = true; };
template<typename T> template<typename T>
struct is_GlueCube struct is_eGlue
{ static const bool value = false; }; { static const bool value = false; };
template<typename T1, typename T2, typename glue_type> template<typename T1, typename T2, typename eglue_type>
struct is_GlueCube< GlueCube<T1,T2,glue_type> > struct is_eGlue< eGlue<T1,T2,eglue_type> >
{ static const bool value = true; }; { static const bool value = true; };
template<typename T> template<typename T>
struct is_mtGlue
{ static const bool value = false; };
template<typename eT, typename T1, typename T2, typename glue_type>
struct is_mtGlue< mtGlue<eT, T1, T2, glue_type> >
{ static const bool value = true; };
//
//
template<typename T>
struct is_glue_times struct is_glue_times
{ static const bool value = false; }; { static const bool value = false; };
template<typename T1, typename T2> template<typename T1, typename T2>
struct is_glue_times< Glue<T1,T2,glue_times> > struct is_glue_times< Glue<T1,T2,glue_times> >
{ static const bool value = true; }; { static const bool value = true; };
template<typename T> template<typename T>
struct is_glue_times_diag struct is_glue_times_diag
{ static const bool value = false; }; { static const bool value = false; };
template<typename T1, typename T2> template<typename T1, typename T2>
struct is_glue_times_diag< Glue<T1,T2,glue_times_diag> > struct is_glue_times_diag< Glue<T1,T2,glue_times_diag> >
{ static const bool value = true; }; { static const bool value = true; };
// template<typename T>
struct is_op_diagmat
{ static const bool value = false; };
template<typename T1>
struct is_op_diagmat< Op<T1,op_diagmat> >
{ static const bool value = true; };
// //
// //
template<typename T> template<typename T>
struct is_eOp struct is_OpCube
{ static const bool value = false; };
template<typename T1, typename op_type>
struct is_OpCube< OpCube<T1,op_type> >
{ static const bool value = true; };
template<typename T>
struct is_eOpCube
{ static const bool value = false; }; { static const bool value = false; };
template<typename T1, typename eop_type> template<typename T1, typename eop_type>
struct is_eOp< eOp<T1,eop_type> > struct is_eOpCube< eOpCube<T1,eop_type> >
{ static const bool value = true; }; { static const bool value = true; };
template<typename T> template<typename T>
struct is_eGlue struct is_mtOpCube
{ static const bool value = false; };
template<typename eT, typename T1, typename op_type>
struct is_mtOpCube< mtOpCube<eT, T1, op_type> >
{ static const bool value = true; };
template<typename T>
struct is_GlueCube
{ static const bool value = false; };
template<typename T1, typename T2, typename glue_type>
struct is_GlueCube< GlueCube<T1,T2,glue_type> >
{ static const bool value = true; };
template<typename T>
struct is_eGlueCube
{ static const bool value = false; }; { static const bool value = false; };
template<typename T1, typename T2, typename eglue_type> template<typename T1, typename T2, typename eglue_type>
struct is_eGlue< eGlue<T1,T2,eglue_type> > struct is_eGlueCube< eGlueCube<T1,T2,eglue_type> >
{ static const bool value = true; }; { static const bool value = true; };
template<typename T> template<typename T>
struct is_op_diagmat struct is_mtGlueCube
{ static const bool value = false; }; { static const bool value = false; };
template<typename T1> template<typename eT, typename T1, typename T2, typename glue_type>
struct is_op_diagmat< Op<T1,op_diagmat> > struct is_mtGlueCube< mtGlueCube<eT, T1, T2, glue_type> >
{ static const bool value = true; }; { static const bool value = true; };
// //
// //
// //
template<typename T> template<typename T>
struct is_op_rel struct is_op_rel
{ static const bool value = false; }; { static const bool value = false; };
skipping to change at line 241 skipping to change at line 291
// //
// //
// //
template<typename T1> template<typename T1>
struct is_arma_type struct is_arma_type
{ {
static const bool value static const bool value
= is_Mat<T1>::value = is_Mat<T1>::value
|| is_Op<T1>::value || is_Op<T1>::value
|| is_eOp<T1>::value
|| is_mtOp<T1>::value
|| is_Glue<T1>::value || is_Glue<T1>::value
|| is_eGlue<T1>::value
|| is_mtGlue<T1>::value
|| is_subview<T1>::value || is_subview<T1>::value
|| is_diagview<T1>::value || is_diagview<T1>::value
|| is_eOp<T1>::value
|| is_eGlue<T1>::value
; ;
}; };
template<typename T1> template<typename T1>
struct is_arma_cube_type struct is_arma_cube_type
{ {
static const bool value static const bool value
= is_Cube<T1>::value = is_Cube<T1>::value
|| is_OpCube<T1>::value || is_OpCube<T1>::value
|| is_eOpCube<T1>::value
|| is_mtOpCube<T1>::value
|| is_GlueCube<T1>::value || is_GlueCube<T1>::value
|| is_eGlueCube<T1>::value
|| is_mtGlueCube<T1>::value
|| is_subview_cube<T1>::value || is_subview_cube<T1>::value
; ;
}; };
// //
// //
// //
template<typename T1, typename T2> template<typename T1, typename T2>
struct is_same_type struct is_same_type
 End of changes. 17 change blocks. 
16 lines changed or deleted 72 lines changed or added


 typedef.hpp   typedef.hpp 
skipping to change at line 64 skipping to change at line 64
// //
// //! unsigned 16 bit type // //! unsigned 16 bit type
// typedef uint16_t u16; // typedef uint16_t u16;
// //
// //! unsigned 32 bit type // //! unsigned 32 bit type
// typedef uint32_t u32; // typedef uint32_t u32;
// //
// //! signed 32 bit type // //! signed 32 bit type
// typedef int32_t s32; // typedef int32_t s32;
#if !defined(ARMA_BLAS_LONG_INT)
typedef int blas_int;
#else
typedef long blas_int;
#endif
typedef std::complex<float> cx_float; typedef std::complex<float> cx_float;
typedef std::complex<double> cx_double; typedef std::complex<double> cx_double;
typedef Mat<unsigned char> uchar_mat; typedef Mat<unsigned char> uchar_mat;
typedef Col<unsigned char> uchar_vec; typedef Col<unsigned char> uchar_vec;
typedef Col<unsigned char> uchar_colvec; typedef Col<unsigned char> uchar_colvec;
typedef Row<unsigned char> uchar_rowvec; typedef Row<unsigned char> uchar_rowvec;
typedef Cube<unsigned char> uchar_cube; typedef Cube<unsigned char> uchar_cube;
typedef Mat<u32> umat; typedef Mat<u32> umat;
 End of changes. 1 change blocks. 
0 lines changed or deleted 6 lines changed or added


 unwrap.hpp   unwrap.hpp 
skipping to change at line 250 skipping to change at line 250
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
} }
const bool do_trans; const bool do_trans;
const bool do_times; const bool do_times;
const eT val; const eT val;
const Mat<eT> M; const Mat<eT> M;
}; };
template<typename T1> template<typename eT>
class partial_unwrap< Op<T1, op_trans> > class partial_unwrap< Mat<eT> >
{ {
public: public:
typedef typename T1::elem_type eT;
inline inline
partial_unwrap(const Op<T1,op_trans>& A) partial_unwrap(const Mat<eT>& A)
: do_trans(true) : do_trans(false)
, do_times(false) , do_times(false)
, val (1) , val (1)
, M (A.m) , 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; const bool do_trans;
const bool do_times; const bool do_times;
const eT val; const eT val;
const Mat<eT> M; const Mat<eT>& M;
}; };
template<typename T1> template<typename eT>
class partial_unwrap< Op<T1, op_trans2> > class partial_unwrap< Row<eT> >
{ {
public: public:
typedef typename T1::elem_type eT;
inline inline
partial_unwrap(const Op<T1,op_trans2>& A) partial_unwrap(const Row<eT>& A)
: do_trans(true) : do_trans(false)
, do_times(true) , do_times(false)
, val (A.aux) , val (1)
, M (A.m) , 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; const bool do_trans;
const bool do_times; const bool do_times;
const eT val; const eT val;
const Mat<eT> M; const Mat<eT>& M;
}; };
template<typename T1> template<typename eT>
class partial_unwrap< eOp<T1, eop_scalar_times> > class partial_unwrap< Col<eT> >
{ {
public: public:
typedef typename T1::elem_type eT;
inline inline
partial_unwrap(const eOp<T1,eop_scalar_times>& A) partial_unwrap(const Col<eT>& A)
: do_trans(false) : do_trans(false)
, do_times(true) , do_times(false)
, val (A.aux) , val (1)
, M (A.P.Q) , 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; const bool do_trans;
const bool do_times; const bool do_times;
const eT val; const eT val;
const Mat<eT> M; const Mat<eT>& M;
}; };
template<typename eT> template<typename T1>
class partial_unwrap< Mat<eT> > class partial_unwrap< Op<T1, op_trans> >
{ {
public: public:
typedef typename T1::elem_type eT;
inline inline
partial_unwrap(const Mat<eT>& A) partial_unwrap(const Op<T1,op_trans>& A)
: do_trans(false) : do_trans(true)
, do_times(false) , do_times(false)
, val (1) , val (1)
, M (A) , 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; const bool do_trans;
const bool do_times; const bool do_times;
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_trans> > class partial_unwrap< Op< Mat<eT>, op_trans> >
{ {
public: public:
inline inline
partial_unwrap(const Op< Mat<eT>, op_trans>& A) partial_unwrap(const Op< Mat<eT>, op_trans>& A)
: do_trans(true) : do_trans(true)
skipping to change at line 392 skipping to change at line 388
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
} }
const bool do_trans; const bool do_trans;
const bool do_times; const bool do_times;
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_trans2> > class partial_unwrap< Op< Row<eT>, op_trans> >
{ {
public: public:
inline inline
partial_unwrap(const Op< Mat<eT>, op_trans2>& A) partial_unwrap(const Op< Row<eT>, op_trans>& A)
: do_trans(true) : do_trans(true)
, do_times(true) , do_times(false)
, val (A.aux) , val (1)
, M (A.m) , 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; const bool do_trans;
const bool do_times; const bool do_times;
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< Op< Col<eT>, op_trans> >
{ {
public: public:
inline inline
partial_unwrap(const eOp<Mat<eT>,eop_scalar_times>& A) partial_unwrap(const Op< Col<eT>, op_trans>& A)
: do_trans(false) : do_trans(true)
, do_times(true) , do_times(false)
, val (A.aux) , val (1)
, M (A.P.Q) , 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; const bool do_trans;
const bool do_times; const bool do_times;
const eT val; const eT val;
const Mat<eT>& M; const Mat<eT>& M;
}; };
template<typename eT> template<typename T1>
class partial_unwrap< Row<eT> > class partial_unwrap< Op<T1, op_trans2> >
{ {
public: public:
typedef typename T1::elem_type eT;
inline inline
partial_unwrap(const Row<eT>& A) partial_unwrap(const Op<T1,op_trans2>& A)
: do_trans(false) : do_trans(true)
, do_times(false) , do_times(true)
, val (1) , val (A.aux)
, M (A) , 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; const bool do_trans;
const bool do_times; const bool do_times;
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_trans> > class partial_unwrap< Op< Mat<eT>, op_trans2> >
{ {
public: public:
inline inline
partial_unwrap(const Op< Row<eT>, op_trans>& A) partial_unwrap(const Op< Mat<eT>, op_trans2>& A)
: do_trans(true) : do_trans(true)
, do_times(false) , do_times(true)
, val (1) , val (A.aux)
, M (A.m) , 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();
} }
skipping to change at line 527 skipping to change at line 525
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
} }
const bool do_trans; const bool do_trans;
const bool do_times; const bool do_times;
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< Op< Col<eT>, op_trans2> >
{ {
public: public:
inline inline
partial_unwrap(const eOp<Row<eT>,eop_scalar_times>& A) partial_unwrap(const Op< Col<eT>, op_trans2>& A)
: do_trans(false) : do_trans(true)
, do_times(true) , do_times(true)
, val (A.aux) , val (A.aux)
, M (A.P.Q) , 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; const bool do_trans;
const bool do_times; const bool do_times;
const eT val; const eT val;
const Mat<eT>& M; const Mat<eT>& M;
}; };
template<typename eT> template<typename T1>
class partial_unwrap< Col<eT> > class partial_unwrap< eOp<T1, eop_scalar_times> >
{ {
public: public:
typedef typename T1::elem_type eT;
inline inline
partial_unwrap(const Col<eT>& A) partial_unwrap(const eOp<T1,eop_scalar_times>& A)
: do_trans(false) : do_trans(false)
, do_times(false) , do_times(true)
, val (1) , val (A.aux)
, M (A) , 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; const bool do_trans;
const bool do_times; const bool do_times;
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_trans> > class partial_unwrap< eOp<Mat<eT>, eop_scalar_times> >
{ {
public: public:
inline inline
partial_unwrap(const Op< Col<eT>, op_trans>& A) partial_unwrap(const eOp<Mat<eT>,eop_scalar_times>& A)
: do_trans(true) : do_trans(false)
, do_times(false) , do_times(true)
, val (1) , val (A.aux)
, M (A.m) , 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; const bool do_trans;
const bool do_times; const bool do_times;
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_trans2> > class partial_unwrap< eOp<Row<eT>, eop_scalar_times> >
{ {
public: public:
inline inline
partial_unwrap(const Op< Col<eT>, op_trans2>& A) partial_unwrap(const eOp<Row<eT>,eop_scalar_times>& A)
: do_trans(true) : do_trans(false)
, do_times(true) , do_times(true)
, val (A.aux) , val (A.aux)
, M (A.m) , 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();
} }
skipping to change at line 691 skipping to change at line 691
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
} }
const bool do_trans; const bool do_trans;
const bool do_times; const bool do_times;
const eT val; const eT val;
const Mat<eT> M; const Mat<eT> M;
}; };
template<typename T1> template<typename eT>
class partial_unwrap_check< Op<T1, op_trans> > class partial_unwrap_check< Mat<eT> >
{ {
public: public:
typedef typename T1::elem_type eT;
inline inline
partial_unwrap_check(const Op<T1,op_trans>& A, const Mat<eT>& B) partial_unwrap_check(const Mat<eT>& A, const Mat<eT>& B)
: do_trans(true) : do_trans(false)
, do_times(false) , do_times(false)
, val (1) , val (1)
, M (A.m) , M_local ( (&A == &B) ? new Mat<eT>(A) : 0 )
, 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)
{
delete M_local;
}
} }
const bool do_trans; // the order below is important
const bool do_times; const bool do_trans;
const eT val; const bool do_times;
const Mat<eT> M; const eT val;
const Mat<eT>* M_local;
const Mat<eT>& M;
}; };
template<typename T1> template<typename eT>
class partial_unwrap_check< Op<T1, op_trans2> > class partial_unwrap_check< Row<eT> >
{ {
public: public:
typedef typename T1::elem_type eT; inline
partial_unwrap_check(const Row<eT>& A, const Mat<eT>& B)
: do_trans(false)
, do_times(false)
, val (1)
, M_local ( (&A == &B) ? new Mat<eT>(A) : 0 )
, M ( (&A == &B) ? (*M_local) : A )
{
arma_extra_debug_sigprint();
}
inline inline
partial_unwrap_check(const Op<T1,op_trans2>& A, const Mat<eT>& B) ~partial_unwrap_check()
: do_trans(true) {
, do_times(true) arma_extra_debug_sigprint();
, val (A.aux)
, M (A.m) if(M_local)
{
delete M_local;
}
}
// 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;
};
template<typename eT>
class partial_unwrap_check< Col<eT> >
{
public:
inline
partial_unwrap_check(const Col<eT>& A, const Mat<eT>& B)
: do_trans(false)
, do_times(false)
, val (1)
, M_local ( (&A == &B) ? new Mat<eT>(A) : 0 )
, 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)
{
delete M_local;
}
} }
const bool do_trans; // the order below is important
const bool do_times; const bool do_trans;
const eT val; const bool do_times;
const Mat<eT> M; const eT val;
const Mat<eT>* M_local;
const Mat<eT>& M;
}; };
template<typename T1> template<typename T1>
class partial_unwrap_check< eOp<T1, eop_scalar_times> > class partial_unwrap_check< Op<T1, op_trans> >
{ {
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 Op<T1,op_trans>& A, const Mat<eT>& B)
: do_trans(false) : do_trans(true)
, do_times(true) , do_times(false)
, val (A.aux) , val (1)
, M (A.P.Q) , 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; const bool do_trans;
const bool do_times; const bool do_times;
const eT val; const eT val;
const Mat<eT> M; const Mat<eT> M;
}; };
template<typename eT> template<typename eT>
class partial_unwrap_check< Mat<eT> > class partial_unwrap_check< Op< Mat<eT>, op_trans> >
{ {
public: public:
inline inline
partial_unwrap_check(const Mat<eT>& A, const Mat<eT>& B) partial_unwrap_check(const Op< Mat<eT>, op_trans>& A, const Mat<eT>& B)
: do_trans(false) : do_trans(true)
, do_times(false) , do_times(false)
, val (1) , val (1)
, M_local ( (&A == &B) ? new Mat<eT>(A) : 0 ) , M_local ( (&A.m == &B) ? new Mat<eT>(A.m) : 0 )
, M ( (&A == &B) ? (*M_local) : A ) , 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)
skipping to change at line 814 skipping to change at line 861
// the order below is important // the order below is important
const bool do_trans; const bool do_trans;
const bool do_times; 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< Mat<eT>, op_trans> > class partial_unwrap_check< Op< Row<eT>, op_trans> >
{ {
public: public:
inline inline
partial_unwrap_check(const Op< Mat<eT>, op_trans>& A, const Mat<eT>& B) partial_unwrap_check(const Op< Row<eT>, op_trans>& A, const Mat<eT>& B)
: do_trans(true) : do_trans(true)
, do_times(false) , do_times(false)
, val (1) , val (1)
, 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
skipping to change at line 849 skipping to change at line 896
// the order below is important // the order below is important
const bool do_trans; const bool do_trans;
const bool do_times; 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< Mat<eT>, op_trans2> > class partial_unwrap_check< Op< Col<eT>, op_trans> >
{ {
public: public:
inline inline
partial_unwrap_check(const Op< Mat<eT>, op_trans2>& A, const Mat<eT>& B) partial_unwrap_check(const Op< Col<eT>, op_trans>& A, const Mat<eT>& B)
: do_trans(true) : do_trans(true)
, do_times(true) , do_times(false)
, val (A.aux) , val (1)
, 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();
skipping to change at line 883 skipping to change at line 930
} }
// the order below is important // the order below is important
const bool do_trans; const bool do_trans;
const bool do_times; 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 T1>
class partial_unwrap_check< eOp<Mat<eT>, eop_scalar_times> > class partial_unwrap_check< Op<T1, op_trans2> >
{ {
public: public:
typedef typename T1::elem_type eT;
inline inline
partial_unwrap_check(const eOp<Mat<eT>,eop_scalar_times>& A, const Mat<eT partial_unwrap_check(const Op<T1,op_trans2>& A, const Mat<eT>& B)
>& B) : do_trans(true)
: do_trans(false)
, do_times(true) , do_times(true)
, val (A.aux) , val (A.aux)
, M (A.P.Q) , 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; const bool do_trans;
const bool do_times; const bool do_times;
const eT val; const eT val;
const Mat<eT>& M; const Mat<eT> M;
}; };
template<typename eT> template<typename eT>
class partial_unwrap_check< Row<eT> > class partial_unwrap_check< Op< Mat<eT>, op_trans2> >
{ {
public: public:
inline inline
partial_unwrap_check(const Row<eT>& A, const Mat<eT>& B) partial_unwrap_check(const Op< Mat<eT>, op_trans2>& A, const Mat<eT>& B)
: do_trans(false) : do_trans(true)
, do_times(false) , do_times(true)
, val (1) , val (A.aux)
, M_local ( (&A == &B) ? new Mat<eT>(A) : 0 ) , M_local ( (&A.m == &B) ? new Mat<eT>(A.m) : 0 )
, M ( (&A == &B) ? (*M_local) : A ) , 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)
skipping to change at line 946 skipping to change at line 995
// the order below is important // the order below is important
const bool do_trans; const bool do_trans;
const bool do_times; 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_trans> > class partial_unwrap_check< Op< Row<eT>, op_trans2> >
{ {
public: public:
inline inline
partial_unwrap_check(const Op< Row<eT>, op_trans>& A, const Mat<eT>& B) partial_unwrap_check(const Op< Row<eT>, op_trans2>& A, const Mat<eT>& B)
: do_trans(true) : do_trans(true)
, do_times(false) , do_times(true)
, val (1) , 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();
skipping to change at line 981 skipping to change at line 1030
// the order below is important // the order below is important
const bool do_trans; const bool do_trans;
const bool do_times; 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_trans2> > class partial_unwrap_check< Op< Col<eT>, op_trans2> >
{ {
public: public:
inline inline
partial_unwrap_check(const Op< Row<eT>, op_trans2>& A, const Mat<eT>& B) partial_unwrap_check(const Op< Mat<eT>, op_trans2>& A, const Mat<eT>& B)
: do_trans(true) : do_trans(true)
, do_times(true) , do_times(true)
, val (A.aux) , 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
skipping to change at line 1015 skipping to change at line 1064
} }
// the order below is important // the order below is important
const bool do_trans; const bool do_trans;
const bool do_times; 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 T1>
class partial_unwrap_check< eOp<Row<eT>, eop_scalar_times> > class partial_unwrap_check< eOp<T1, eop_scalar_times> >
{ {
public: public:
typedef typename T1::elem_type eT;
inline inline
partial_unwrap_check(const eOp<Row<eT>,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) : do_trans(false)
, do_times(true) , do_times(true)
, val (A.aux) , val (A.aux)
, M (A.P.Q) , M (A.P.Q)
{ {
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; const bool do_trans;
const bool do_times; const bool do_times;
const eT val; const eT val;
const Mat<eT>& M; const Mat<eT> M;
}; };
template<typename eT> template<typename eT>
class partial_unwrap_check< Col<eT> > class partial_unwrap_check< eOp<Mat<eT>, eop_scalar_times> >
{ {
public: public:
inline inline
partial_unwrap_check(const Col<eT>& A, const Mat<eT>& B) partial_unwrap_check(const eOp<Mat<eT>,eop_scalar_times>& A, const Mat<eT >& B)
: do_trans(false) : do_trans(false)
, do_times(false) , do_times(true)
, val (1) , val (A.aux)
, M_local ( (&A == &B) ? new Mat<eT>(A) : 0 ) , M (A.P.Q)
, M ( (&A == &B) ? (*M_local) : A )
{
arma_extra_debug_sigprint();
}
inline
~partial_unwrap_check()
{
arma_extra_debug_sigprint();
if(M_local)
{
delete M_local;
}
}
// 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;
};
template<typename eT>
class partial_unwrap_check< Op< Col<eT>, op_trans> >
{
public:
inline
partial_unwrap_check(const Op< Col<eT>, op_trans>& A, const Mat<eT>& B)
: do_trans(true)
, do_times(false)
, val (1)
, M_local ( (&A.m == &B) ? new Mat<eT>(A.m) : 0 )
, 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)
{
delete M_local;
}
} }
// the order below is important
const bool do_trans; const bool do_trans;
const bool do_times; const bool do_times;
const eT val; const eT val;
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_trans2> > class partial_unwrap_check< eOp<Row<eT>, eop_scalar_times> >
{ {
public: public:
inline inline
partial_unwrap_check(const Op< Mat<eT>, op_trans2>& A, const Mat<eT>& B) partial_unwrap_check(const eOp<Row<eT>,eop_scalar_times>& A, const Mat<eT
: do_trans(true) >& B)
: do_trans(false)
, do_times(true) , do_times(true)
, val (A.aux) , val (A.aux)
, M_local ( (&A.m == &B) ? new Mat<eT>(A.m) : 0 ) , M (A.P.Q)
, 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)
{
delete M_local;
}
} }
// the order below is important
const bool do_trans; const bool do_trans;
const bool do_times; const bool do_times;
const eT val; const eT val;
const Mat<eT>* M_local;
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)
 End of changes. 93 change blocks. 
224 lines changed or deleted 224 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/