Col_meat.hpp   Col_meat.hpp 
skipping to change at line 23 skipping to change at line 23
//! \addtogroup Col //! \addtogroup Col
//! @{ //! @{
//! construct an empty column vector //! construct an empty column vector
template<typename eT> template<typename eT>
inline inline
Col<eT>::Col() Col<eT>::Col()
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
access::rw(Mat<eT>::n_cols) = 1;
access::rw(Mat<eT>::vec_state) = 1; access::rw(Mat<eT>::vec_state) = 1;
} }
//! construct a column vector with the specified number of n_elem //! construct a column vector with the specified number of n_elem
template<typename eT> template<typename eT>
inline inline
Col<eT>::Col(const u32 in_n_elem) Col<eT>::Col(const u32 in_n_elem)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
access::rw(Mat<eT>::vec_state) = 1; access::rw(Mat<eT>::vec_state) = 1;
Mat<eT>::init(in_n_elem, (in_n_elem > 0) ? 1 : 0); Mat<eT>::init(in_n_elem, 1);
} }
template<typename eT> template<typename eT>
inline inline
Col<eT>::Col(const u32 in_n_rows, const u32 in_n_cols) Col<eT>::Col(const u32 in_n_rows, const u32 in_n_cols)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
access::rw(Mat<eT>::vec_state) = 1; access::rw(Mat<eT>::vec_state) = 1;
skipping to change at line 160 skipping to change at line 161
Mat<eT>::operator=(X.get_ref()); Mat<eT>::operator=(X.get_ref());
return *this; return *this;
} }
//! construct a column vector from a given auxiliary array of eTs //! construct a column vector from a given auxiliary array of eTs
template<typename eT> template<typename eT>
inline inline
Col<eT>::Col(eT* aux_mem, const u32 aux_length, const bool copy_aux_mem, co nst bool strict) Col<eT>::Col(eT* aux_mem, const u32 aux_length, const bool copy_aux_mem, co nst bool strict)
: Mat<eT>(aux_mem, aux_length, ((aux_length > 0) ? 1 : 0), copy_aux_mem, strict) : Mat<eT>(aux_mem, aux_length, 1, copy_aux_mem, strict)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
access::rw(Mat<eT>::vec_state) = 1; access::rw(Mat<eT>::vec_state) = 1;
} }
//! construct a column vector from a given auxiliary array of eTs //! construct a column vector from a given auxiliary array of eTs
template<typename eT> template<typename eT>
inline inline
Col<eT>::Col(const eT* aux_mem, const u32 aux_length) Col<eT>::Col(const eT* aux_mem, const u32 aux_length)
: Mat<eT>(aux_mem, aux_length, ((aux_length > 0) ? 1 : 0)) : Mat<eT>(aux_mem, aux_length, 1)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
access::rw(Mat<eT>::vec_state) = 1; access::rw(Mat<eT>::vec_state) = 1;
} }
template<typename eT> template<typename eT>
template<typename T1, typename T2> template<typename T1, typename T2>
inline inline
Col<eT>::Col Col<eT>::Col
skipping to change at line 487 skipping to change at line 488
template<typename eT> template<typename eT>
template<u32 fixed_n_elem> template<u32 fixed_n_elem>
arma_inline arma_inline
void void
Col<eT>::fixed<fixed_n_elem>::mem_setup() Col<eT>::fixed<fixed_n_elem>::mem_setup()
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
access::rw(Mat<eT>::n_rows) = fixed_n_elem; access::rw(Mat<eT>::n_rows) = fixed_n_elem;
access::rw(Mat<eT>::n_cols) = (fixed_n_elem > 0) ? 1 : 0; access::rw(Mat<eT>::n_cols) = 1;
access::rw(Mat<eT>::n_elem) = fixed_n_elem; access::rw(Mat<eT>::n_elem) = fixed_n_elem;
access::rw(Mat<eT>::vec_state) = 1; access::rw(Mat<eT>::vec_state) = 1;
access::rw(Mat<eT>::mem_state) = 3; access::rw(Mat<eT>::mem_state) = 3;
access::rw(Mat<eT>::mem) = (use_extra) ? mem_local_extra : Mat<eT>: :mem_local; access::rw(Mat<eT>::mem) = (use_extra) ? mem_local_extra : Mat<eT>: :mem_local;
} }
template<typename eT> template<typename eT>
template<u32 fixed_n_elem> template<u32 fixed_n_elem>
arma_inline arma_inline
void void
Col<eT>::fixed<fixed_n_elem>::change_to_row() Col<eT>::fixed<fixed_n_elem>::change_to_row()
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
access::rw(Mat<eT>::n_cols) = fixed_n_elem; access::rw(Mat<eT>::n_cols) = fixed_n_elem;
access::rw(Mat<eT>::n_rows) = (fixed_n_elem > 0) ? 1 : 0; access::rw(Mat<eT>::n_rows) = 1;
} }
template<typename eT> template<typename eT>
template<u32 fixed_n_elem> template<u32 fixed_n_elem>
arma_inline arma_inline
Col<eT>::fixed<fixed_n_elem>::fixed() Col<eT>::fixed<fixed_n_elem>::fixed()
{ {
arma_extra_debug_sigprint_this(this); arma_extra_debug_sigprint_this(this);
mem_setup(); mem_setup();
skipping to change at line 576 skipping to change at line 577
} }
template<typename eT> template<typename eT>
template<u32 fixed_n_elem> template<u32 fixed_n_elem>
inline inline
Col<eT>::fixed<fixed_n_elem>::fixed(eT* aux_mem, const bool copy_aux_mem) Col<eT>::fixed<fixed_n_elem>::fixed(eT* aux_mem, const bool copy_aux_mem)
{ {
arma_extra_debug_sigprint_this(this); arma_extra_debug_sigprint_this(this);
access::rw(Mat<eT>::n_rows) = fixed_n_elem; access::rw(Mat<eT>::n_rows) = fixed_n_elem;
access::rw(Mat<eT>::n_cols) = (fixed_n_elem > 0) ? 1 : 0; access::rw(Mat<eT>::n_cols) = 1;
access::rw(Mat<eT>::n_elem) = fixed_n_elem; access::rw(Mat<eT>::n_elem) = fixed_n_elem;
access::rw(Mat<eT>::vec_state) = 1; access::rw(Mat<eT>::vec_state) = 1;
access::rw(Mat<eT>::mem_state) = 3; access::rw(Mat<eT>::mem_state) = 3;
if(copy_aux_mem == true) if(copy_aux_mem == true)
{ {
eT* dest = (use_extra) ? mem_local_extra : Mat<eT>::mem_local; eT* dest = (use_extra) ? mem_local_extra : Mat<eT>::mem_local;
access::rw(Mat<eT>::mem) = dest; access::rw(Mat<eT>::mem) = dest;
 End of changes. 7 change blocks. 
6 lines changed or deleted 7 lines changed or added


 Mat_bones.hpp   Mat_bones.hpp 
skipping to change at line 470 skipping to change at line 470
arma_inline arma_warn_unused eT& operator() (const u32 in_row, const u3 2 in_col); arma_inline arma_warn_unused eT& operator() (const u32 in_row, const u3 2 in_col);
arma_inline arma_warn_unused eT operator() (const u32 in_row, const u3 2 in_col) const; arma_inline arma_warn_unused eT operator() (const u32 in_row, const u3 2 in_col) const;
arma_hot inline const Mat<eT>& fill(const eT val); arma_hot inline const Mat<eT>& fill(const eT val);
arma_hot inline const Mat<eT>& zeros(); arma_hot inline const Mat<eT>& zeros();
arma_hot inline const Mat<eT>& ones(); arma_hot inline const Mat<eT>& ones();
}; };
protected: protected:
inline void init(const u32 in_rows, const u32 in_cols); inline void init(u32 in_rows, u32 in_cols);
inline void init(const std::string& text); inline void init(const std::string& text);
inline void init(const Mat& x); inline void init(const Mat& x);
template<typename T1, typename T2> template<typename T1, typename T2>
inline void init(const Base<pod_type,T1>& A, const Base<pod_type,T2>& B); inline void init(const Base<pod_type,T1>& A, const Base<pod_type,T2>& B);
inline void steal_mem(Mat& X); inline void steal_mem(Mat& X);
inline Mat(const char junk, const eT* aux_mem, const u32 aux_n_rows, cons t u32 aux_n_cols); inline Mat(const char junk, const eT* aux_mem, const u32 aux_n_rows, cons t u32 aux_n_cols);
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 Mat_meat.hpp   Mat_meat.hpp 
skipping to change at line 77 skipping to change at line 77
{ {
arma_extra_debug_sigprint_this(this); arma_extra_debug_sigprint_this(this);
init(in_n_rows, in_n_cols); init(in_n_rows, in_n_cols);
} }
//! internal matrix construction; if the requested size is small enough, me mory from the stack is used. otherwise memory is allocated via 'new' //! internal matrix construction; if the requested size is small enough, me mory from the stack is used. otherwise memory is allocated via 'new'
template<typename eT> template<typename eT>
inline inline
void void
Mat<eT>::init(const u32 in_n_rows, const u32 in_n_cols) Mat<eT>::init(u32 in_n_rows, u32 in_n_cols)
{ {
arma_extra_debug_sigprint( arma_boost::format("in_n_rows = %d, in_n_cols = %d") % in_n_rows % in_n_cols ); arma_extra_debug_sigprint( arma_boost::format("in_n_rows = %d, in_n_cols = %d") % in_n_rows % in_n_cols );
const bool same_size = ( (n_rows == in_n_rows) && (n_cols == in_n_cols) ) ; const bool same_size = ( (n_rows == in_n_rows) && (n_cols == in_n_cols) ) ;
if(same_size == false) if(same_size == false)
{ {
const u32 t_vec_state = vec_state; const u32 t_vec_state = vec_state;
const u32 t_mem_state = mem_state; const u32 t_mem_state = mem_state;
skipping to change at line 99 skipping to change at line 99
char* err_msg = 0; char* err_msg = 0;
arma_debug_set_error arma_debug_set_error
( (
err_state, err_state,
err_msg, err_msg,
(t_mem_state == 3), (t_mem_state == 3),
"Mat::init(): size is fixed and hence cannot be changed" "Mat::init(): size is fixed and hence cannot be changed"
); );
arma_debug_set_error if(t_vec_state > 0)
( {
err_state, if( (in_n_rows == 0) && (in_n_cols == 0) )
err_msg, {
( if(t_vec_state == 1)
(t_vec_state > 0) && {
in_n_cols = 1;
}
else
if(t_vec_state == 2)
{
in_n_rows = 1;
}
}
else
{
arma_debug_set_error
( (
((t_vec_state == 1) && (in_n_cols > 1)) || err_state,
((t_vec_state == 2) && (in_n_rows > 1)) err_msg,
) ( ((t_vec_state == 1) && (in_n_cols != 1)) || ((t_vec_state == 2)
), && (in_n_rows != 1)) ),
"Mat::init(): object is a vector; requested size is not compatible" "Mat::init(): object is a vector; requested size is not compatibl
); e"
);
}
}
// ensure that n_elem can hold the result of (n_rows * n_cols) // ensure that n_elem can hold the result of (n_rows * n_cols)
// (due to a limitation in the C++98 standard: there is no official "lo ng long" variable type) // (due to a limitation in the C++98 standard: there is no official "lo ng long" variable type)
arma_debug_set_error arma_debug_set_error
( (
err_state, err_state,
err_msg, err_msg,
(double(in_n_rows) * double(in_n_cols)) > double(0xFFFFFFFF), (double(in_n_rows) * double(in_n_cols)) > double(0xFFFFFFFF),
"Mat::init(): requested size is too large" "Mat::init(): requested size is too large"
); );
skipping to change at line 503 skipping to change at line 515
const u32 t_vec_state = vec_state; const u32 t_vec_state = vec_state;
bool layout_ok = false; bool layout_ok = false;
if(t_vec_state == x_vec_state) if(t_vec_state == x_vec_state)
{ {
layout_ok = true; layout_ok = true;
} }
else else
{ {
if( (t_vec_state == 1) && ( x_n_cols <= 1) ) if( (t_vec_state == 1) && ( x_n_cols == 1) )
{ {
layout_ok = true; layout_ok = true;
} }
if( (t_vec_state == 2) && ( x_n_rows <= 1) ) if( (t_vec_state == 2) && ( x_n_rows == 1) )
{ {
layout_ok = true; layout_ok = true;
} }
} }
if( (x_mem_state == 0) && (x_n_elem > arma_config::mat_prealloc) && (la yout_ok == true) ) if( (x_mem_state == 0) && (x_n_elem > arma_config::mat_prealloc) && (la yout_ok == true) )
{ {
reset(); reset();
access::rw(n_rows) = x_n_rows; access::rw(n_rows) = x_n_rows;
skipping to change at line 1924 skipping to change at line 1936
// } // }
//! creation of diagview (diagonal) //! creation of diagview (diagonal)
template<typename eT> template<typename eT>
arma_inline arma_inline
diagview<eT> diagview<eT>
Mat<eT>::diag(const s32 in_id) Mat<eT>::diag(const s32 in_id)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
if(n_elem > 0) const u32 row_offset = (in_id < 0) ? u32(-in_id) : 0;
{ const u32 col_offset = (in_id > 0) ? u32( in_id) : 0;
const u32 row_offset = (in_id < 0) ? u32(-in_id) : 0;
const u32 col_offset = (in_id > 0) ? u32( in_id) : 0;
arma_debug_check arma_debug_check
( (
(row_offset >= n_rows) || (col_offset >= n_cols), ((row_offset > 0) && (row_offset >= n_rows)) || ((col_offset > 0) && (c
"Mat::diag(): requested diagonal out of bounds" ol_offset >= n_cols)),
); "Mat::diag(): requested diagonal out of bounds"
);
const u32 len = (std::min)(n_rows - row_offset, n_cols - col_offset); const u32 len = (std::min)(n_rows - row_offset, n_cols - col_offset);
return diagview<eT>(*this, row_offset, col_offset, len); return diagview<eT>(*this, row_offset, col_offset, len);
}
else
{
return diagview<eT>(*this, 0, 0, 0);
}
} }
//! creation of diagview (diagonal) //! creation of diagview (diagonal)
template<typename eT> template<typename eT>
arma_inline arma_inline
const diagview<eT> const diagview<eT>
Mat<eT>::diag(const s32 in_id) const Mat<eT>::diag(const s32 in_id) const
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
if(n_elem > 0) const u32 row_offset = (in_id < 0) ? -in_id : 0;
{ const u32 col_offset = (in_id > 0) ? in_id : 0;
const u32 row_offset = (in_id < 0) ? -in_id : 0;
const u32 col_offset = (in_id > 0) ? in_id : 0;
arma_debug_check arma_debug_check
( (
(row_offset >= n_rows) || (col_offset >= n_cols), ((row_offset > 0) && (row_offset >= n_rows)) || ((col_offset > 0) && (c
"Mat::diag(): requested diagonal out of bounds" ol_offset >= n_cols)),
); "Mat::diag(): requested diagonal out of bounds"
);
const u32 len = (std::min)(n_rows - row_offset, n_cols - col_offset); const u32 len = (std::min)(n_rows - row_offset, n_cols - col_offset);
return diagview<eT>(*this, row_offset, col_offset, len); return diagview<eT>(*this, row_offset, col_offset, len);
}
else
{
return diagview<eT>(*this, 0, 0, 0);
}
} }
template<typename eT> template<typename eT>
inline inline
void void
Mat<eT>::swap_rows(const u32 in_row1, const u32 in_row2) Mat<eT>::swap_rows(const u32 in_row1, const u32 in_row2)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check arma_debug_check
skipping to change at line 2013 skipping to change at line 2011
Mat<eT>::swap_cols(const u32 in_col1, const u32 in_col2) Mat<eT>::swap_cols(const u32 in_col1, const u32 in_col2)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check arma_debug_check
( (
(in_col1 >= n_cols) || (in_col2 >= n_cols), (in_col1 >= n_cols) || (in_col2 >= n_cols),
"Mat::swap_cols(): out of bounds" "Mat::swap_cols(): out of bounds"
); );
eT* ptr1 = colptr(in_col1); if(n_elem > 0)
eT* ptr2 = colptr(in_col2);
for(u32 row=0; row<n_rows; ++row)
{ {
const eT tmp = ptr1[row]; eT* ptr1 = colptr(in_col1);
ptr1[row] = ptr2[row]; eT* ptr2 = colptr(in_col2);
ptr2[row] = tmp;
}
for(u32 row=0; row<n_rows; ++row)
{
const eT tmp = ptr1[row];
ptr1[row] = ptr2[row];
ptr2[row] = tmp;
}
}
} }
//! remove specified row //! remove specified row
template<typename eT> template<typename eT>
inline inline
void void
Mat<eT>::shed_row(const u32 row_num) Mat<eT>::shed_row(const u32 row_num)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
skipping to change at line 3145 skipping to change at line 3145
return (n_elem == 0); return (n_elem == 0);
} }
//! returns true if the object can be interpreted as a column or row vector //! returns true if the object can be interpreted as a column or row vector
template<typename eT> template<typename eT>
arma_inline arma_inline
arma_warn_unused arma_warn_unused
bool bool
Mat<eT>::is_vec() const Mat<eT>::is_vec() const
{ {
const u32 t_n_rows = n_rows; return ( (n_rows == 1) || (n_cols == 1) );
const u32 t_n_cols = n_cols;
return ( (t_n_rows == 1) || (t_n_cols == 1) || ( (t_n_rows == 0) && (t_n_
cols == 0) ) );
} }
//! returns true if the object has the same number of non-zero rows and col umnns //! returns true if the object has the same number of non-zero rows and col umnns
template<typename eT> template<typename eT>
arma_inline arma_inline
arma_warn_unused arma_warn_unused
bool bool
Mat<eT>::is_square() const Mat<eT>::is_square() const
{ {
return (n_rows == n_cols); return (n_rows == n_cols);
skipping to change at line 3487 skipping to change at line 3484
inline inline
void void
Mat<eT>::set_size(const u32 in_elem) Mat<eT>::set_size(const u32 in_elem)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
switch(vec_state) switch(vec_state)
{ {
case 0: case 0:
case 1: case 1:
init(in_elem, (in_elem > 0) ? 1 : 0); init(in_elem, 1);
break; break;
case 2: case 2:
init((in_elem > 0) ? 1 : 0, in_elem); init(1, in_elem);
break; break;
default: default:
; ;
} }
} }
//! change the matrix to have user specified dimensions (data is not preser ved) //! change the matrix to have user specified dimensions (data is not preser ved)
template<typename eT> template<typename eT>
inline inline
skipping to change at line 3745 skipping to change at line 3742
return (*this).eye(); 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); switch(vec_state)
{
default:
init(0, 0);
break;
case 1:
init(0, 1);
break;
case 2:
init(1, 0);
break;
}
} }
template<typename eT> template<typename eT>
template<typename T1> template<typename T1>
inline inline
void void
Mat<eT>::set_real(const Base<typename Mat<eT>::pod_type,T1>& X) Mat<eT>::set_real(const Base<typename Mat<eT>::pod_type,T1>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
 End of changes. 20 change blocks. 
63 lines changed or deleted 76 lines changed or added


 Row_meat.hpp   Row_meat.hpp 
skipping to change at line 22 skipping to change at line 22
//! \addtogroup Row //! \addtogroup Row
//! @{ //! @{
template<typename eT> template<typename eT>
inline inline
Row<eT>::Row() Row<eT>::Row()
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
access::rw(Mat<eT>::n_rows) = 1;
access::rw(Mat<eT>::vec_state) = 2; access::rw(Mat<eT>::vec_state) = 2;
} }
template<typename eT> template<typename eT>
inline inline
Row<eT>::Row(const u32 in_n_elem) Row<eT>::Row(const u32 in_n_elem)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
access::rw(Mat<eT>::vec_state) = 2; access::rw(Mat<eT>::vec_state) = 2;
Mat<eT>::init((in_n_elem > 0) ? 1 : 0, in_n_elem); Mat<eT>::init(1, in_n_elem);
} }
template<typename eT> template<typename eT>
inline inline
Row<eT>::Row(const u32 in_n_rows, const u32 in_n_cols) Row<eT>::Row(const u32 in_n_rows, const u32 in_n_cols)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
access::rw(Mat<eT>::vec_state) = 2; access::rw(Mat<eT>::vec_state) = 2;
skipping to change at line 134 skipping to change at line 135
Mat<eT>::operator=(X.get_ref()); Mat<eT>::operator=(X.get_ref());
return *this; return *this;
} }
//! construct a row vector from a given auxiliary array //! construct a row vector from a given auxiliary array
template<typename eT> template<typename eT>
inline inline
Row<eT>::Row(eT* aux_mem, const u32 aux_length, const bool copy_aux_mem, co nst bool strict) Row<eT>::Row(eT* aux_mem, const u32 aux_length, const bool copy_aux_mem, co nst bool strict)
: Mat<eT>(aux_mem, ((aux_length > 0) ? 1 : 0), aux_length, copy_aux_mem, strict) : Mat<eT>(aux_mem, 1, aux_length, copy_aux_mem, strict)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
access::rw(Mat<eT>::vec_state) = 2; access::rw(Mat<eT>::vec_state) = 2;
} }
//! construct a row vector from a given auxiliary array //! construct a row vector from a given auxiliary array
template<typename eT> template<typename eT>
inline inline
Row<eT>::Row(const eT* aux_mem, const u32 aux_length) Row<eT>::Row(const eT* aux_mem, const u32 aux_length)
: Mat<eT>(aux_mem, ((aux_length > 0) ? 1 : 0), aux_length) : Mat<eT>(aux_mem, 1, aux_length)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
access::rw(Mat<eT>::vec_state) = 2; access::rw(Mat<eT>::vec_state) = 2;
} }
template<typename eT> template<typename eT>
template<typename T1, typename T2> template<typename T1, typename T2>
inline inline
Row<eT>::Row Row<eT>::Row
skipping to change at line 460 skipping to change at line 461
} }
template<typename eT> template<typename eT>
template<u32 fixed_n_elem> template<u32 fixed_n_elem>
arma_inline arma_inline
void void
Row<eT>::fixed<fixed_n_elem>::mem_setup() Row<eT>::fixed<fixed_n_elem>::mem_setup()
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
access::rw(Mat<eT>::n_rows) = (fixed_n_elem > 0) ? 1 : 0; access::rw(Mat<eT>::n_rows) = 1;
access::rw(Mat<eT>::n_cols) = fixed_n_elem; access::rw(Mat<eT>::n_cols) = fixed_n_elem;
access::rw(Mat<eT>::n_elem) = fixed_n_elem; access::rw(Mat<eT>::n_elem) = fixed_n_elem;
access::rw(Mat<eT>::vec_state) = 2; access::rw(Mat<eT>::vec_state) = 2;
access::rw(Mat<eT>::mem_state) = 3; access::rw(Mat<eT>::mem_state) = 3;
access::rw(Mat<eT>::mem) = (use_extra) ? mem_local_extra : Mat<eT>: :mem_local; access::rw(Mat<eT>::mem) = (use_extra) ? mem_local_extra : Mat<eT>: :mem_local;
} }
template<typename eT> template<typename eT>
template<u32 fixed_n_elem> template<u32 fixed_n_elem>
inline inline
skipping to change at line 537 skipping to change at line 538
Row<eT>::init(A,B); Row<eT>::init(A,B);
} }
template<typename eT> template<typename eT>
template<u32 fixed_n_elem> template<u32 fixed_n_elem>
inline inline
Row<eT>::fixed<fixed_n_elem>::fixed(eT* aux_mem, const bool copy_aux_mem) Row<eT>::fixed<fixed_n_elem>::fixed(eT* aux_mem, const bool copy_aux_mem)
{ {
arma_extra_debug_sigprint_this(this); arma_extra_debug_sigprint_this(this);
access::rw(Mat<eT>::n_rows) = (fixed_n_elem > 0) ? 1 : 0; access::rw(Mat<eT>::n_rows) = 1;
access::rw(Mat<eT>::n_cols) = fixed_n_elem; access::rw(Mat<eT>::n_cols) = fixed_n_elem;
access::rw(Mat<eT>::n_elem) = fixed_n_elem; access::rw(Mat<eT>::n_elem) = fixed_n_elem;
access::rw(Mat<eT>::vec_state) = 2; access::rw(Mat<eT>::vec_state) = 2;
access::rw(Mat<eT>::mem_state) = 3; access::rw(Mat<eT>::mem_state) = 3;
if(copy_aux_mem == true) if(copy_aux_mem == true)
{ {
eT* dest = (use_extra) ? mem_local_extra : Mat<eT>::mem_local; eT* dest = (use_extra) ? mem_local_extra : Mat<eT>::mem_local;
access::rw(Mat<eT>::mem) = dest; access::rw(Mat<eT>::mem) = dest;
 End of changes. 6 change blocks. 
5 lines changed or deleted 6 lines changed or added


 arma_version.hpp   arma_version.hpp 
skipping to change at line 18 skipping to change at line 18
// 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 1 #define ARMA_VERSION_MAJOR 1
#define ARMA_VERSION_MINOR 99 #define ARMA_VERSION_MINOR 99
#define ARMA_VERSION_PATCH 2 #define ARMA_VERSION_PATCH 3
#define ARMA_VERSION_NAME "v2.0 beta 2" #define ARMA_VERSION_NAME "v2.0 beta 3"
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 2 lines changed or added


 armadillo   armadillo 
skipping to change at line 101 skipping to change at line 101
//! \namespace arma namespace for Armadillo classes and functions //! \namespace arma namespace for Armadillo classes and functions
namespace arma namespace arma
{ {
// preliminaries // preliminaries
#include "armadillo_bits/forward_bones.hpp" #include "armadillo_bits/forward_bones.hpp"
#include "armadillo_bits/arma_static_assert.hpp" #include "armadillo_bits/arma_static_assert.hpp"
#include "armadillo_bits/typedef.hpp" #include "armadillo_bits/typedef.hpp"
#include "armadillo_bits/typedef_u64.hpp" //#include "armadillo_bits/typedef_u64.hpp"
#include "armadillo_bits/format_wrap.hpp" #include "armadillo_bits/format_wrap.hpp"
#include "armadillo_bits/arma_version.hpp" #include "armadillo_bits/arma_version.hpp"
#include "armadillo_bits/arma_config.hpp" #include "armadillo_bits/arma_config.hpp"
#include "armadillo_bits/traits.hpp" #include "armadillo_bits/traits.hpp"
#include "armadillo_bits/promote_type.hpp" #include "armadillo_bits/promote_type.hpp"
#include "armadillo_bits/upgrade_val.hpp" #include "armadillo_bits/upgrade_val.hpp"
#include "armadillo_bits/restrictors.hpp" #include "armadillo_bits/restrictors.hpp"
#include "armadillo_bits/access.hpp" #include "armadillo_bits/access.hpp"
#include "armadillo_bits/span.hpp" #include "armadillo_bits/span.hpp"
#include "armadillo_bits/constants.hpp" #include "armadillo_bits/constants.hpp"
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 diagview_bones.hpp   diagview_bones.hpp 
skipping to change at line 32 skipping to change at line 32
public: public:
typedef eT elem_type; typedef eT elem_type;
typedef typename get_pod_type<eT>::result pod_type; typedef typename get_pod_type<eT>::result pod_type;
const u32 row_offset; const u32 row_offset;
const u32 col_offset; const u32 col_offset;
const u32 n_rows; // equal to n_elem const u32 n_rows; // equal to n_elem
const u32 n_cols; // equal to one if n_elem > 0, otherwise equal to zero const u32 n_cols; // always 1
const u32 n_elem; const u32 n_elem;
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();
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 diagview_meat.hpp   diagview_meat.hpp 
skipping to change at line 31 skipping to change at line 31
} }
template<typename eT> template<typename eT>
arma_inline arma_inline
diagview<eT>::diagview(const Mat<eT>& in_m, const u32 in_row_offset, const u32 in_col_offset, const u32 in_len) diagview<eT>::diagview(const Mat<eT>& in_m, const u32 in_row_offset, const u32 in_col_offset, const u32 in_len)
: m(in_m) : m(in_m)
, m_ptr(0) , m_ptr(0)
, 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(1)
, n_elem(in_len) , n_elem(in_len)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
} }
template<typename eT> template<typename eT>
arma_inline arma_inline
diagview<eT>::diagview(Mat<eT>& in_m, const u32 in_row_offset, const u32 in _col_offset, const u32 in_len) diagview<eT>::diagview(Mat<eT>& in_m, const u32 in_row_offset, const u32 in _col_offset, const u32 in_len)
: m(in_m) : m(in_m)
, 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(1)
, 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 //! set a diagonal of our matrix using a diagonal from a foreign matrix
template<typename eT> template<typename eT>
inline inline
void void
diagview<eT>::operator= (const diagview<eT>& x) diagview<eT>::operator= (const diagview<eT>& x)
 End of changes. 2 change blocks. 
2 lines changed or deleted 2 lines changed or added


 diskio_meat.hpp   diskio_meat.hpp 
skipping to change at line 60 skipping to change at line 60
else else
if(is_u32<eT>::value == true) if(is_u32<eT>::value == true)
{ {
return std::string("ARMA_MAT_TXT_IU004"); return std::string("ARMA_MAT_TXT_IU004");
} }
else else
if(is_s32<eT>::value == true) if(is_s32<eT>::value == true)
{ {
return std::string("ARMA_MAT_TXT_IS004"); return std::string("ARMA_MAT_TXT_IS004");
} }
else // else
if(is_u64<eT>::value == true) // if(is_u64<eT>::value == true)
{ // {
return std::string("ARMA_MAT_TXT_IU008"); // return std::string("ARMA_MAT_TXT_IU008");
} // }
else else
if(is_float<eT>::value == true) if(is_float<eT>::value == true)
{ {
return std::string("ARMA_MAT_TXT_FN004"); return std::string("ARMA_MAT_TXT_FN004");
} }
else else
if(is_double<eT>::value == true) if(is_double<eT>::value == true)
{ {
return std::string("ARMA_MAT_TXT_FN008"); return std::string("ARMA_MAT_TXT_FN008");
} }
skipping to change at line 135 skipping to change at line 135
else else
if(is_u32<eT>::value == true) if(is_u32<eT>::value == true)
{ {
return std::string("ARMA_MAT_BIN_IU004"); return std::string("ARMA_MAT_BIN_IU004");
} }
else else
if(is_s32<eT>::value == true) if(is_s32<eT>::value == true)
{ {
return std::string("ARMA_MAT_BIN_IS004"); return std::string("ARMA_MAT_BIN_IS004");
} }
else // else
if(is_u64<eT>::value == true) // if(is_u64<eT>::value == true)
{ // {
return std::string("ARMA_MAT_BIN_IU008"); // return std::string("ARMA_MAT_BIN_IU008");
} // }
else else
if(is_float<eT>::value == true) if(is_float<eT>::value == true)
{ {
return std::string("ARMA_MAT_BIN_FN004"); return std::string("ARMA_MAT_BIN_FN004");
} }
else else
if(is_double<eT>::value == true) if(is_double<eT>::value == true)
{ {
return std::string("ARMA_MAT_BIN_FN008"); return std::string("ARMA_MAT_BIN_FN008");
} }
skipping to change at line 210 skipping to change at line 210
else else
if(is_u32<eT>::value == true) if(is_u32<eT>::value == true)
{ {
return std::string("ARMA_CUB_TXT_IU004"); return std::string("ARMA_CUB_TXT_IU004");
} }
else else
if(is_s32<eT>::value == true) if(is_s32<eT>::value == true)
{ {
return std::string("ARMA_CUB_TXT_IS004"); return std::string("ARMA_CUB_TXT_IS004");
} }
else // else
if(is_u64<eT>::value == true) // if(is_u64<eT>::value == true)
{ // {
return std::string("ARMA_CUB_TXT_IU008"); // return std::string("ARMA_CUB_TXT_IU008");
} // }
else else
if(is_float<eT>::value == true) if(is_float<eT>::value == true)
{ {
return std::string("ARMA_CUB_TXT_FN004"); return std::string("ARMA_CUB_TXT_FN004");
} }
else else
if(is_double<eT>::value == true) if(is_double<eT>::value == true)
{ {
return std::string("ARMA_CUB_TXT_FN008"); return std::string("ARMA_CUB_TXT_FN008");
} }
skipping to change at line 285 skipping to change at line 285
else else
if(is_u32<eT>::value == true) if(is_u32<eT>::value == true)
{ {
return std::string("ARMA_CUB_BIN_IU004"); return std::string("ARMA_CUB_BIN_IU004");
} }
else else
if(is_s32<eT>::value == true) if(is_s32<eT>::value == true)
{ {
return std::string("ARMA_CUB_BIN_IS004"); return std::string("ARMA_CUB_BIN_IS004");
} }
else // else
if(is_u64<eT>::value == true) // if(is_u64<eT>::value == true)
{ // {
return std::string("ARMA_CUB_BIN_IU008"); // return std::string("ARMA_CUB_BIN_IU008");
} // }
else else
if(is_float<eT>::value == true) if(is_float<eT>::value == true)
{ {
return std::string("ARMA_CUB_BIN_FN004"); return std::string("ARMA_CUB_BIN_FN004");
} }
else else
if(is_double<eT>::value == true) if(is_double<eT>::value == true)
{ {
return std::string("ARMA_CUB_BIN_FN008"); return std::string("ARMA_CUB_BIN_FN008");
} }
 End of changes. 4 change blocks. 
20 lines changed or deleted 20 lines changed or added


 fn_accu.hpp   fn_accu.hpp 
skipping to change at line 30 skipping to change at line 30
typename T1::elem_type typename T1::elem_type
accu(const Base<typename T1::elem_type,T1>& X) accu(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; typedef typename Proxy<T1>::ea_type ea_type;
const Proxy<T1> A(X.get_ref()); const Proxy<T1> A(X.get_ref());
ea_type P = A.get_ea(); if(Proxy<T1>::prefer_at_accessor == false)
const u32 n_elem = A.get_n_elem(); {
ea_type P = A.get_ea();
const u32 n_elem = A.get_n_elem();
eT val1 = eT(0); eT val1 = eT(0);
eT val2 = eT(0); eT val2 = eT(0);
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)
{ {
val1 += P[i]; val1 += P[i];
val2 += P[j]; val2 += P[j];
} }
if(i < n_elem) if(i < n_elem)
{ {
val1 += P[i]; val1 += P[i];
}
return val1 + val2;
} }
else
{
const u32 n_rows = A.get_n_rows();
const u32 n_cols = A.get_n_cols();
return val1 + val2; eT val = eT(0);
for(u32 col=0; col<n_cols; ++col)
{
for(u32 row=0; row<n_rows; ++row)
{
val += A.at(row,col);
}
}
return val;
}
} }
//! 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();
skipping to change at line 95 skipping to change at line 115
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; typedef typename ProxyCube<T1>::ea_type ea_type;
const ProxyCube<T1> A(X.get_ref()); const ProxyCube<T1> A(X.get_ref());
ea_type P = A.get_ea(); if(ProxyCube<T1>::prefer_at_accessor == false)
const u32 n_elem = A.get_n_elem(); {
eT val1 = eT(0); ea_type P = A.get_ea();
eT val2 = eT(0); const u32 n_elem = A.get_n_elem();
u32 i,j; eT val1 = eT(0);
eT val2 = eT(0);
for(i=0, j=1; j<n_elem; i+=2, j+=2) u32 i,j;
{
val1 += P[i];
val2 += P[j];
}
if(i < n_elem) for(i=0, j=1; j<n_elem; i+=2, j+=2)
{ {
val1 += P[i]; val1 += P[i];
val2 += P[j];
}
if(i < n_elem)
{
val1 += P[i];
}
return val1 + val2;
} }
else
{
const u32 n_rows = A.get_n_rows();
const u32 n_cols = A.get_n_cols();
const u32 n_slices = A.get_n_slices();
eT val = eT(0);
return val1 + val2; for(u32 slice=0; slice<n_slices; ++slice)
{
for(u32 col=0; col<n_cols; ++col)
{
for(u32 row=0; row<n_rows; ++row)
{
val += A.at(row,col,slice);
}
}
}
return val;
}
} }
//! 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)
{ {
skipping to change at line 149 skipping to change at line 194
//! accumulate the elements of a subview (submatrix) //! accumulate the elements of a subview (submatrix)
template<typename eT> template<typename eT>
arma_pure arma_pure
arma_warn_unused arma_warn_unused
inline inline
eT eT
accu(const subview<eT>& S) accu(const subview<eT>& S)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
if(S.n_elem > 0) const u32 S_n_rows = S.n_rows;
{ const u32 S_n_cols = S.n_cols;
const u32 S_n_rows = S.n_rows; const u32 S_n_elem = S.n_elem;
const u32 S_n_cols = S.n_cols;
eT val = eT(0); eT val = eT(0);
if(S_n_elem > 0)
{
for(u32 col=0; col<S_n_cols; ++col) for(u32 col=0; col<S_n_cols; ++col)
{ {
val += arrayops::accumulate( S.colptr(col), S_n_rows ); val += arrayops::accumulate( S.colptr(col), S_n_rows );
} }
return val;
}
else
{
return eT(0);
} }
return val;
} }
//! accumulate the elements of a subview_row //! accumulate the elements of a subview_row
template<typename eT> template<typename eT>
arma_pure arma_pure
arma_warn_unused arma_warn_unused
inline inline
eT eT
accu(const subview_row<eT>& S) accu(const subview_row<eT>& S)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
const Mat<eT>& X = S.m; const Mat<eT>& X = S.m;
const u32 row = S.aux_row1; const u32 n_elem = S.n_elem;
const u32 start_col = S.aux_col1; const u32 row = S.aux_row1;
const u32 end_col_plus_1 = start_col + S.n_cols; const u32 start_col = S.aux_col1;
const u32 end_col_p1 = start_col + S.n_cols;
// S.n_cols might be equal to zero,
// hence the loop below has a "less than" condition
eT val = eT(0); eT val = eT(0);
u32 i,j; if(n_elem > 0)
for(i=start_col, j=start_col+1; j < end_col_plus_1; i+=2, j+=2)
{ {
val += X.at(row,i); u32 i,j;
val += X.at(row,j);
}
if(i < end_col_plus_1) for(i=start_col, j=start_col+1; j < end_col_p1; i+=2, j+=2)
{ {
val += X.at(row,i); val += X.at(row,i);
val += X.at(row,j);
}
if(i < end_col_p1)
{
val += X.at(row,i);
}
} }
return val; return val;
} }
//! accumulate the elements of a subview_col //! accumulate the elements of a subview_col
template<typename eT> template<typename eT>
arma_pure arma_pure
arma_warn_unused arma_warn_unused
inline inline
eT eT
accu(const subview_col<eT>& S) accu(const subview_col<eT>& S)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return arrayops::accumulate( S.colptr(0), S.n_rows ); return (S.n_elem > 0) ? arrayops::accumulate( S.colptr(0), S.n_rows ) : e T(0);
} }
//! @} //! @}
 End of changes. 24 change blocks. 
55 lines changed or deleted 98 lines changed or added


 fn_det.hpp   fn_det.hpp 
// Copyright (C) 2008-2010 NICTA (www.nicta.com.au) // Copyright (C) 2008-2011 NICTA (www.nicta.com.au)
// Copyright (C) 2008-2010 Conrad Sanderson // Copyright (C) 2008-2011 Conrad Sanderson
// //
// This file is part of the Armadillo C++ library. // This file is part of the Armadillo C++ library.
// It is provided without any warranty of fitness // It is provided without any warranty of fitness
// for any purpose. You can redistribute this file // for any purpose. You can redistribute this file
// and/or modify it under the terms of the GNU // and/or modify it under the terms of the GNU
// Lesser General Public License (LGPL) as published // Lesser General Public License (LGPL) as published
// by the Free Software Foundation, either version 3 // by the Free Software Foundation, either version 3
// of the License or (at your option) any later version. // of the License or (at your option) any later version.
// (see http://www.opensource.org/licenses for more info) // (see http://www.opensource.org/licenses for more info)
skipping to change at line 43 skipping to change at line 43
arma_warn_unused arma_warn_unused
typename T1::elem_type typename T1::elem_type
det(const Op<T1, op_diagmat>& X) det(const Op<T1, op_diagmat>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
const diagmat_proxy<T1> A(X.m); const diagmat_proxy<T1> A(X.m);
if(A.n_elem == 0) const u32 A_n_elem = A.n_elem;
if(A_n_elem == 0)
{ {
return eT(1); return eT(1);
} }
eT val = A[0]; eT val = A[0];
for(u32 i=1; i<A.n_elem; ++i) for(u32 i=1; i<A_n_elem; ++i)
{ {
val *= A[i]; val *= A[i];
} }
return val; return val;
} }
//! determinant of inv(A), without doing the inverse operation //! determinant of inv(A), without doing the inverse operation
template<typename T1> template<typename T1>
inline inline
 End of changes. 3 change blocks. 
4 lines changed or deleted 6 lines changed or added


 fn_prod.hpp   fn_prod.hpp 
skipping to change at line 38 skipping to change at line 38
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return Op<T1, op_prod>(X.get_ref(), dim, 0); return Op<T1, op_prod>(X.get_ref(), dim, 0);
} }
//! \brief //! \brief
//! Immediate 'product of all values' operation for a row vector //! Immediate 'product of all values' operation for a row vector
template<typename eT> template<typename eT>
inline inline
arma_warn_unused
eT eT
prod(const Row<eT>& X) prod(const Row<eT>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return arrayops::product(X.memptr(), X.n_elem); return arrayops::product(X.memptr(), X.n_elem);
} }
//! \brief //! \brief
//! Immediate 'product of all values' operation for a column vector //! Immediate 'product of all values' operation for a column vector
template<typename eT> template<typename eT>
inline inline
arma_warn_unused
eT eT
prod(const Col<eT>& X) prod(const Col<eT>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return arrayops::product(X.memptr(), X.n_elem); return arrayops::product(X.memptr(), X.n_elem);
} }
//! \brief //! \brief
//! Immediate 'product of all values' operation, //! Immediate 'product of all values' operation,
skipping to change at line 91 skipping to change at line 93
prod(const Op<T1, op_prod>& in, const u32 dim) prod(const Op<T1, op_prod>& in, const u32 dim)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return Op<Op<T1, op_prod>, op_prod>(in, dim, 0); return Op<Op<T1, op_prod>, op_prod>(in, dim, 0);
} }
//! product of all values of a subview_row //! product of all values of a subview_row
template<typename eT> template<typename eT>
inline inline
arma_warn_unused
eT eT
prod(const subview_row<eT>& S) prod(const subview_row<eT>& S)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
const Mat<eT>& X = S.m; const Mat<eT>& X = S.m;
const u32 n_elem = S.n_elem;
const u32 row = S.aux_row1; const u32 row = S.aux_row1;
const u32 start_col = S.aux_col1; const u32 start_col = S.aux_col1;
const u32 end_col_plus_1 = start_col + S.n_cols; const u32 end_col_plus_1 = start_col + S.n_cols;
eT val = eT(1); eT val = eT(1);
for(u32 col=start_col; col<end_col_plus_1; ++col) if(n_elem > 0)
{ {
val *= X.at(row,col); for(u32 col=start_col; col<end_col_plus_1; ++col)
{
val *= X.at(row,col);
}
} }
return val; return val;
} }
//! product of all values of a subview_col //! product of all values of a subview_col
template<typename eT> template<typename eT>
inline inline
arma_warn_unused
eT eT
prod(const subview_col<eT>& S) prod(const subview_col<eT>& S)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return arrayops::product( S.colptr(0), S.n_rows ); return (S.n_elem > 0) ? arrayops::product( S.colptr(0), S.n_rows ) : eT(1 );
} }
//! product of all values of a diagview //! product of all values of a diagview
template<typename eT> template<typename eT>
arma_warn_unused
inline inline
eT eT
prod(const diagview<eT>& X) prod(const diagview<eT>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
const u32 X_n_elem = X.n_elem; const u32 X_n_elem = X.n_elem;
eT val = eT(1); eT val = eT(1);
 End of changes. 9 change blocks. 
3 lines changed or deleted 12 lines changed or added


 op_dot_bones.hpp   op_dot_bones.hpp 
// Copyright (C) 2008-2010 NICTA (www.nicta.com.au) // Copyright (C) 2008-2011 NICTA (www.nicta.com.au)
// Copyright (C) 2008-2010 Conrad Sanderson // Copyright (C) 2008-2011 Conrad Sanderson
// //
// This file is part of the Armadillo C++ library. // This file is part of the Armadillo C++ library.
// It is provided without any warranty of fitness // It is provided without any warranty of fitness
// for any purpose. You can redistribute this file // for any purpose. You can redistribute this file
// and/or modify it under the terms of the GNU // and/or modify it under the terms of the GNU
// Lesser General Public License (LGPL) as published // Lesser General Public License (LGPL) as published
// by the Free Software Foundation, either version 3 // by the Free Software Foundation, either version 3
// of the License or (at your option) any later version. // of the License or (at your option) any later version.
// (see http://www.opensource.org/licenses for more info) // (see http://www.opensource.org/licenses for more info)
skipping to change at line 59 skipping to change at line 59
}; };
//! \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 arma_hot inline static typename T1::elem_type apply (const Base<typ
ame T1::elem_type,T1>& X, const Base<typename T1::elem_type,T2>& Y); 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_unwrap(const Base<typ
ename T1::elem_type,T1>& X, const Base<typename T1::elem_type,T2>& Y);
}; };
class op_cdot class op_cdot
{ {
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);
}; };
 End of changes. 2 change blocks. 
4 lines changed or deleted 8 lines changed or added


 op_dot_meat.hpp   op_dot_meat.hpp 
// Copyright (C) 2008-2010 NICTA (www.nicta.com.au) // Copyright (C) 2008-2011 NICTA (www.nicta.com.au)
// Copyright (C) 2008-2010 Conrad Sanderson // Copyright (C) 2008-2011 Conrad Sanderson
// //
// This file is part of the Armadillo C++ library. // This file is part of the Armadillo C++ library.
// It is provided without any warranty of fitness // It is provided without any warranty of fitness
// for any purpose. You can redistribute this file // for any purpose. You can redistribute this file
// and/or modify it under the terms of the GNU // and/or modify it under the terms of the GNU
// Lesser General Public License (LGPL) as published // Lesser General Public License (LGPL) as published
// by the Free Software Foundation, either version 3 // by the Free Software Foundation, either version 3
// of the License or (at your option) any later version. // of the License or (at your option) any later version.
// (see http://www.opensource.org/licenses for more info) // (see http://www.opensource.org/licenses for more info)
skipping to change at line 192 skipping to change at line 192
{ {
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<T1>::ea_type ea_type1;
typedef typename Proxy<T2>::ea_type ea_type2; 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.get_n_elem() != B.get_n_elem()), "dot(): objects mus t have the same number of elements" ); const bool prefer_at_accessor = (Proxy<T1>::prefer_at_accessor) && (Proxy <T2>::prefer_at_accessor);
const u32 N = A.get_n_elem(); if(prefer_at_accessor == false)
ea_type1 PA = A.get_ea(); {
ea_type2 PB = B.get_ea(); arma_debug_check( (A.get_n_elem() != B.get_n_elem()), "dot(): objects m
ust have the same number of elements" );
eT val1 = eT(0); const u32 N = A.get_n_elem();
eT val2 = eT(0); ea_type1 PA = A.get_ea();
ea_type2 PB = B.get_ea();
u32 i,j; eT val1 = eT(0);
eT val2 = eT(0);
for(i=0, j=1; j<N; i+=2, j+=2) u32 i,j;
{
val1 += PA[i] * PB[i];
val2 += PA[j] * PB[j];
}
if(i < N) for(i=0, j=1; j<N; i+=2, j+=2)
{
val1 += PA[i] * PB[i];
val2 += PA[j] * PB[j];
}
if(i < N)
{
val1 += PA[i] * PB[i];
}
return val1 + val2;
}
else
{ {
val1 += PA[i] * PB[i]; return op_dot::apply_unwrap(A.Q, B.Q);
} }
return val1 + val2;
} }
// //
// op_norm_dot // op_norm_dot
template<typename T1, typename T2> template<typename T1, typename T2>
arma_hot arma_hot
arma_inline inline
typename T1::elem_type 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) 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<T1>::ea_type ea_type1;
typedef typename Proxy<T2>::ea_type ea_type2; typedef typename Proxy<T2>::ea_type ea_type2;
const Proxy<T1> A(X.get_ref()); const bool prefer_at_accessor = (Proxy<T1>::prefer_at_accessor) && (Proxy
const Proxy<T2> B(Y.get_ref()); <T2>::prefer_at_accessor);
if(prefer_at_accessor == false)
{
const Proxy<T1> A(X.get_ref());
const Proxy<T2> B(Y.get_ref());
arma_debug_check( (A.get_n_elem() != B.get_n_elem()), "norm_dot(): obje
cts must have the same number of elements" );
const u32 N = A.get_n_elem();
ea_type1 PA = A.get_ea();
ea_type2 PB = B.get_ea();
eT acc1 = eT(0);
eT acc2 = eT(0);
eT acc3 = eT(0);
for(u32 i=0; i<N; ++i)
{
const eT tmpA = PA[i];
const eT tmpB = PB[i];
acc1 += tmpA * tmpA;
acc2 += tmpB * tmpB;
acc3 += tmpA * tmpB;
}
return acc3 / ( std::sqrt(acc1 * acc2) );
}
else
{
return op_norm_dot::apply_unwrap(X, Y);
}
}
template<typename T1, typename T2>
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" );
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(); const eT* A_mem = A.memptr();
ea_type1 PA = A.get_ea(); const eT* B_mem = B.memptr();
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 = PA[i]; const eT tmpA = A_mem[i];
const eT tmpB = PB[i]; const eT tmpB = B_mem[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. 14 change blocks. 
27 lines changed or deleted 90 lines changed or added


 promote_type.hpp   promote_type.hpp 
skipping to change at line 40 skipping to change at line 40
arma_inline static void check() {} arma_inline static void check() {}
}; };
template<typename T> struct promote_type<T, T> : public promo te_type_ok { typedef T result; }; template<typename T> struct promote_type<T, T> : public promo te_type_ok { typedef T result; };
template<typename T> struct promote_type<std::complex<T>, T> : public promo te_type_ok { typedef std::complex<T> result; }; template<typename T> struct promote_type<std::complex<T>, T> : public promo te_type_ok { typedef std::complex<T> result; };
template<> struct promote_type<std::complex<double>, std::complex<float> > : public promote_type_ok { typedef std::complex<double> result; }; template<> struct promote_type<std::complex<double>, std::complex<float> > : public promote_type_ok { typedef std::complex<double> result; };
template<> struct promote_type<std::complex<double>, float> : public promote_type_ok { typedef std::complex<double> result; }; template<> struct promote_type<std::complex<double>, float> : public promote_type_ok { typedef std::complex<double> result; };
template<> struct promote_type<std::complex<float>, double> : public promote_type_ok { typedef std::complex<double> result; }; template<> struct promote_type<std::complex<float>, double> : public promote_type_ok { typedef std::complex<double> result; };
template<typename T> struct promote_type<std::complex<T>, u64> : public pro mote_type_ok { typedef std::complex<T> result; }; // template<typename T> struct promote_type<std::complex<T>, u64> : public promote_type_ok { typedef std::complex<T> result; };
template<typename T> struct promote_type<std::complex<T>, s32> : public pro mote_type_ok { typedef std::complex<T> result; }; template<typename T> struct promote_type<std::complex<T>, s32> : public pro mote_type_ok { typedef std::complex<T> result; };
template<typename T> struct promote_type<std::complex<T>, u32> : public pro mote_type_ok { typedef std::complex<T> result; }; template<typename T> struct promote_type<std::complex<T>, u32> : public pro mote_type_ok { typedef std::complex<T> result; };
template<typename T> struct promote_type<std::complex<T>, s16> : public pro mote_type_ok { typedef std::complex<T> result; }; template<typename T> struct promote_type<std::complex<T>, s16> : public pro mote_type_ok { typedef std::complex<T> result; };
template<typename T> struct promote_type<std::complex<T>, u16> : public pro mote_type_ok { typedef std::complex<T> result; }; template<typename T> struct promote_type<std::complex<T>, u16> : public pro mote_type_ok { typedef std::complex<T> result; };
template<typename T> struct promote_type<std::complex<T>, s8> : public pro mote_type_ok { typedef std::complex<T> result; }; template<typename T> struct promote_type<std::complex<T>, s8> : public pro mote_type_ok { typedef std::complex<T> result; };
template<typename T> struct promote_type<std::complex<T>, u8> : public pro mote_type_ok { typedef std::complex<T> result; }; template<typename T> struct promote_type<std::complex<T>, u8> : public pro mote_type_ok { typedef std::complex<T> result; };
template<> struct promote_type<double, float> : public promote_type_ok { ty pedef double result; }; template<> struct promote_type<double, float> : public promote_type_ok { ty pedef double result; };
template<> struct promote_type<double, u64 > : public promote_type_ok { ty pedef double result; }; // template<> struct promote_type<double, u64 > : public promote_type_ok { typedef double result; };
template<> struct promote_type<double, s32 > : public promote_type_ok { ty pedef double result; }; template<> struct promote_type<double, s32 > : public promote_type_ok { ty pedef double result; };
template<> struct promote_type<double, u32 > : public promote_type_ok { ty pedef double result; }; template<> struct promote_type<double, u32 > : public promote_type_ok { ty pedef double result; };
template<> struct promote_type<double, s16 > : public promote_type_ok { ty pedef double result; }; template<> struct promote_type<double, s16 > : public promote_type_ok { ty pedef double result; };
template<> struct promote_type<double, u16 > : public promote_type_ok { ty pedef double result; }; template<> struct promote_type<double, u16 > : public promote_type_ok { ty pedef double result; };
template<> struct promote_type<double, s8 > : public promote_type_ok { ty pedef double result; }; template<> struct promote_type<double, s8 > : public promote_type_ok { ty pedef double result; };
template<> struct promote_type<double, u8 > : public promote_type_ok { ty pedef double result; }; template<> struct promote_type<double, u8 > : public promote_type_ok { ty pedef double result; };
template<> struct promote_type<float, u64> : public promote_type_ok { typed ef float result; }; // template<> struct promote_type<float, u64> : public promote_type_ok { ty pedef float result; };
template<> struct promote_type<float, s32> : public promote_type_ok { typed ef float result; }; template<> struct promote_type<float, s32> : public promote_type_ok { typed ef float result; };
template<> struct promote_type<float, u32> : public promote_type_ok { typed ef float result; }; template<> struct promote_type<float, u32> : public promote_type_ok { typed ef float result; };
template<> struct promote_type<float, s16> : public promote_type_ok { typed ef float result; }; template<> struct promote_type<float, s16> : public promote_type_ok { typed ef float result; };
template<> struct promote_type<float, u16> : public promote_type_ok { typed ef float result; }; template<> struct promote_type<float, u16> : public promote_type_ok { typed ef float result; };
template<> struct promote_type<float, s8 > : public promote_type_ok { typed ef float result; }; template<> struct promote_type<float, s8 > : public promote_type_ok { typed ef float result; };
template<> struct promote_type<float, u8 > : public promote_type_ok { typed ef float result; }; template<> struct promote_type<float, u8 > : public promote_type_ok { typed ef float result; };
template<> struct promote_type<u64, u32> : public promote_type_ok { typedef // template<> struct promote_type<u64, u32> : public promote_type_ok { type
u64 result; }; def u64 result; };
template<> struct promote_type<u64, u16> : public promote_type_ok { typedef // template<> struct promote_type<u64, u16> : public promote_type_ok { type
u64 result; }; def u64 result; };
template<> struct promote_type<u64, u8 > : public promote_type_ok { typedef // template<> struct promote_type<u64, u8 > : public promote_type_ok { type
u64 result; }; def u64 result; };
template<> struct promote_type<s32, u32> : public promote_type_ok { typedef s32 result; }; // float ? template<> struct promote_type<s32, u32> : public promote_type_ok { typedef s32 result; }; // float ?
template<> struct promote_type<s32, s16> : public promote_type_ok { typedef s32 result; }; template<> struct promote_type<s32, s16> : public promote_type_ok { typedef s32 result; };
template<> struct promote_type<s32, u16> : public promote_type_ok { typedef s32 result; }; template<> struct promote_type<s32, u16> : public promote_type_ok { typedef s32 result; };
template<> struct promote_type<s32, s8 > : public promote_type_ok { typedef s32 result; }; template<> struct promote_type<s32, s8 > : public promote_type_ok { typedef s32 result; };
template<> struct promote_type<s32, u8 > : public promote_type_ok { typedef s32 result; }; template<> struct promote_type<s32, u8 > : public promote_type_ok { typedef s32 result; };
template<> struct promote_type<u32, s16> : public promote_type_ok { typedef s32 result; }; // float ? template<> struct promote_type<u32, s16> : public promote_type_ok { typedef s32 result; }; // float ?
template<> struct promote_type<u32, u16> : public promote_type_ok { typedef u32 result; }; template<> struct promote_type<u32, u16> : public promote_type_ok { typedef u32 result; };
template<> struct promote_type<u32, s8 > : public promote_type_ok { typedef s32 result; }; // float ? template<> struct promote_type<u32, s8 > : public promote_type_ok { typedef s32 result; }; // float ?
skipping to change at line 98 skipping to change at line 98
// //
// mirrored versions // mirrored versions
template<typename T> struct promote_type<T, std::complex<T> > : public prom ote_type_ok { typedef std::complex<T> result; }; template<typename T> struct promote_type<T, std::complex<T> > : public prom ote_type_ok { typedef std::complex<T> result; };
template<> struct promote_type<std::complex<float>, std::complex<double> > : public promote_type_ok { typedef std::complex<double> result; }; template<> struct promote_type<std::complex<float>, std::complex<double> > : public promote_type_ok { typedef std::complex<double> result; };
template<> struct promote_type<float, std::complex<double> > : public promote_type_ok { typedef std::complex<double> result; }; template<> struct promote_type<float, std::complex<double> > : public promote_type_ok { typedef std::complex<double> result; };
template<> struct promote_type<double, std::complex<float> > : public promote_type_ok { typedef std::complex<double> result; }; template<> struct promote_type<double, std::complex<float> > : public promote_type_ok { typedef std::complex<double> result; };
template<typename T> struct promote_type<u64, std::complex<T> > : public pr omote_type_ok { typedef std::complex<T> result; }; // template<typename T> struct promote_type<u64, std::complex<T> > : public promote_type_ok { typedef std::complex<T> result; };
template<typename T> struct promote_type<s32, std::complex<T> > : public pr omote_type_ok { typedef std::complex<T> result; }; template<typename T> struct promote_type<s32, std::complex<T> > : public pr omote_type_ok { typedef std::complex<T> result; };
template<typename T> struct promote_type<u32, std::complex<T> > : public pr omote_type_ok { typedef std::complex<T> result; }; template<typename T> struct promote_type<u32, std::complex<T> > : public pr omote_type_ok { typedef std::complex<T> result; };
template<typename T> struct promote_type<s16, std::complex<T> > : public pr omote_type_ok { typedef std::complex<T> result; }; template<typename T> struct promote_type<s16, std::complex<T> > : public pr omote_type_ok { typedef std::complex<T> result; };
template<typename T> struct promote_type<u16, std::complex<T> > : public pr omote_type_ok { typedef std::complex<T> result; }; template<typename T> struct promote_type<u16, std::complex<T> > : public pr omote_type_ok { typedef std::complex<T> result; };
template<typename T> struct promote_type<s8, std::complex<T> > : public pr omote_type_ok { typedef std::complex<T> result; }; template<typename T> struct promote_type<s8, std::complex<T> > : public pr omote_type_ok { typedef std::complex<T> result; };
template<typename T> struct promote_type<u8, std::complex<T> > : public pr omote_type_ok { typedef std::complex<T> result; }; template<typename T> struct promote_type<u8, std::complex<T> > : public pr omote_type_ok { typedef std::complex<T> result; };
template<> struct promote_type<float, double> : public promote_type_ok { ty pedef double result; }; template<> struct promote_type<float, double> : public promote_type_ok { ty pedef double result; };
template<> struct promote_type<u64 , double> : public promote_type_ok { ty pedef double result; }; // template<> struct promote_type<u64 , double> : public promote_type_ok { typedef double result; };
template<> struct promote_type<s32 , double> : public promote_type_ok { ty pedef double result; }; template<> struct promote_type<s32 , double> : public promote_type_ok { ty pedef double result; };
template<> struct promote_type<u32 , double> : public promote_type_ok { ty pedef double result; }; template<> struct promote_type<u32 , double> : public promote_type_ok { ty pedef double result; };
template<> struct promote_type<s16 , double> : public promote_type_ok { ty pedef double result; }; template<> struct promote_type<s16 , double> : public promote_type_ok { ty pedef double result; };
template<> struct promote_type<u16 , double> : public promote_type_ok { ty pedef double result; }; template<> struct promote_type<u16 , double> : public promote_type_ok { ty pedef double result; };
template<> struct promote_type<s8 , double> : public promote_type_ok { ty pedef double result; }; template<> struct promote_type<s8 , double> : public promote_type_ok { ty pedef double result; };
template<> struct promote_type<u8 , double> : public promote_type_ok { ty pedef double result; }; template<> struct promote_type<u8 , double> : public promote_type_ok { ty pedef double result; };
template<> struct promote_type<u64, float> : public promote_type_ok { typed ef float result; }; // template<> struct promote_type<u64, float> : public promote_type_ok { ty pedef float result; };
template<> struct promote_type<s32, float> : public promote_type_ok { typed ef float result; }; template<> struct promote_type<s32, float> : public promote_type_ok { typed ef float result; };
template<> struct promote_type<u32, float> : public promote_type_ok { typed ef float result; }; template<> struct promote_type<u32, float> : public promote_type_ok { typed ef float result; };
template<> struct promote_type<s16, float> : public promote_type_ok { typed ef float result; }; template<> struct promote_type<s16, float> : public promote_type_ok { typed ef float result; };
template<> struct promote_type<u16, float> : public promote_type_ok { typed ef float result; }; template<> struct promote_type<u16, float> : public promote_type_ok { typed ef float result; };
template<> struct promote_type<s8 , float> : public promote_type_ok { typed ef float result; }; template<> struct promote_type<s8 , float> : public promote_type_ok { typed ef float result; };
template<> struct promote_type<u8 , float> : public promote_type_ok { typed ef float result; }; template<> struct promote_type<u8 , float> : public promote_type_ok { typed ef float result; };
template<> struct promote_type<u32, u64> : public promote_type_ok { typedef // template<> struct promote_type<u32, u64> : public promote_type_ok { type
u64 result; }; def u64 result; };
template<> struct promote_type<u16, u64> : public promote_type_ok { typedef // template<> struct promote_type<u16, u64> : public promote_type_ok { type
u64 result; }; def u64 result; };
template<> struct promote_type<u8, u64> : public promote_type_ok { typedef // template<> struct promote_type<u8, u64> : public promote_type_ok { type
u64 result; }; def u64 result; };
template<> struct promote_type<u32, s32> : public promote_type_ok { typedef s32 result; }; // float ? template<> struct promote_type<u32, s32> : public promote_type_ok { typedef s32 result; }; // float ?
template<> struct promote_type<s16, s32> : public promote_type_ok { typedef s32 result; }; template<> struct promote_type<s16, s32> : public promote_type_ok { typedef s32 result; };
template<> struct promote_type<u16, s32> : public promote_type_ok { typedef s32 result; }; template<> struct promote_type<u16, s32> : public promote_type_ok { typedef s32 result; };
template<> struct promote_type<s8 , s32> : public promote_type_ok { typedef s32 result; }; template<> struct promote_type<s8 , s32> : public promote_type_ok { typedef s32 result; };
template<> struct promote_type<u8 , s32> : public promote_type_ok { typedef s32 result; }; template<> struct promote_type<u8 , s32> : public promote_type_ok { typedef s32 result; };
template<> struct promote_type<s16, u32> : public promote_type_ok { typedef s32 result; }; // float ? template<> struct promote_type<s16, u32> : public promote_type_ok { typedef s32 result; }; // float ?
template<> struct promote_type<u16, u32> : public promote_type_ok { typedef u32 result; }; template<> struct promote_type<u16, u32> : public promote_type_ok { typedef u32 result; };
template<> struct promote_type<s8 , u32> : public promote_type_ok { typedef s32 result; }; // float ? template<> struct promote_type<s8 , u32> : public promote_type_ok { typedef s32 result; }; // float ?
 End of changes. 8 change blocks. 
18 lines changed or deleted 18 lines changed or added


 running_stat_bones.hpp   running_stat_bones.hpp 
// Copyright (C) 2009-2010 NICTA (www.nicta.com.au) // Copyright (C) 2009-2011 NICTA (www.nicta.com.au)
// Copyright (C) 2009-2010 Conrad Sanderson // Copyright (C) 2009-2011 Conrad Sanderson
// //
// This file is part of the Armadillo C++ library. // This file is part of the Armadillo C++ library.
// It is provided without any warranty of fitness // It is provided without any warranty of fitness
// for any purpose. You can redistribute this file // for any purpose. You can redistribute this file
// and/or modify it under the terms of the GNU // and/or modify it under the terms of the GNU
// Lesser General Public License (LGPL) as published // Lesser General Public License (LGPL) as published
// by the Free Software Foundation, either version 3 // by the Free Software Foundation, either version 3
// of the License or (at your option) any later version. // of the License or (at your option) any later version.
// (see http://www.opensource.org/licenses for more info) // (see http://www.opensource.org/licenses for more info)
skipping to change at line 57 skipping to change at line 57
typedef typename get_pod_type<eT>::result T; typedef typename get_pod_type<eT>::result T;
inline ~running_stat(); inline ~running_stat();
inline running_stat(); inline running_stat();
inline void operator() (const T sample); inline void operator() (const T sample);
inline void operator() (const std::complex<T>& sample); inline void operator() (const std::complex<T>& sample);
inline void reset(); inline void reset();
inline eT mean() const; inline eT mean() const;
inline T var (const u32 norm_type = 0) const; inline T var (const u32 norm_type = 0) const;
inline T stddev(const u32 norm_type = 0) const; inline T stddev(const u32 norm_type = 0) const;
inline eT min() const; inline eT min() const;
inline eT max() const; inline eT max() const;
inline T count() const;
// //
// //
private: private:
arma_aligned arma_counter<T> counter; arma_aligned arma_counter<T> counter;
arma_aligned eT r_mean; arma_aligned eT r_mean;
arma_aligned T r_var; arma_aligned T r_var;
 End of changes. 4 change blocks. 
7 lines changed or deleted 9 lines changed or added


 running_stat_meat.hpp   running_stat_meat.hpp 
// Copyright (C) 2009-2010 NICTA (www.nicta.com.au) // Copyright (C) 2009-2011 NICTA (www.nicta.com.au)
// Copyright (C) 2009-2010 Conrad Sanderson // Copyright (C) 2009-2011 Conrad Sanderson
// //
// This file is part of the Armadillo C++ library. // This file is part of the Armadillo C++ library.
// It is provided without any warranty of fitness // It is provided without any warranty of fitness
// for any purpose. You can redistribute this file // for any purpose. You can redistribute this file
// and/or modify it under the terms of the GNU // and/or modify it under the terms of the GNU
// Lesser General Public License (LGPL) as published // Lesser General Public License (LGPL) as published
// by the Free Software Foundation, either version 3 // by the Free Software Foundation, either version 3
// of the License or (at your option) any later version. // of the License or (at your option) any later version.
// (see http://www.opensource.org/licenses for more info) // (see http://www.opensource.org/licenses for more info)
skipping to change at line 46 skipping to change at line 46
{ {
const u32 max_val = 0xffffffff; const u32 max_val = 0xffffffff;
if(i_count < max_val) if(i_count < max_val)
{ {
i_count++; i_count++;
} }
else else
{ {
d_count += eT(max_val); d_count += eT(max_val);
i_count = 1; i_count = 0;
} }
return *this; return *this;
} }
template<typename eT> template<typename eT>
inline inline
void void
arma_counter<eT>::operator++(int) arma_counter<eT>::operator++(int)
{ {
skipping to change at line 72 skipping to change at line 72
void void
arma_counter<eT>::reset() arma_counter<eT>::reset()
{ {
d_count = eT(0); d_count = eT(0);
i_count = u32(0); i_count = u32(0);
} }
template<typename eT> template<typename eT>
inline inline
eT eT
arma_counter<eT>::value() arma_counter<eT>::value() const
const
{ {
return d_count + eT(i_count); return d_count + eT(i_count);
} }
template<typename eT> template<typename eT>
inline inline
eT eT
arma_counter<eT>::value_plus_1() arma_counter<eT>::value_plus_1() const
const
{ {
const u32 max_val = 0xffffffff; const u32 max_val = 0xffffffff;
if(i_count < max_val) if(i_count < max_val)
{ {
return d_count + eT(i_count + 1); return d_count + eT(i_count + 1);
} }
else else
{ {
return d_count + eT(max_val) + eT(1); return d_count + eT(max_val) + eT(1);
} }
} }
template<typename eT> template<typename eT>
inline inline
eT eT
arma_counter<eT>::value_minus_1() arma_counter<eT>::value_minus_1() const
const
{ {
if(i_count > 0) if(i_count > 0)
{ {
return d_count + eT(i_count - 1); return d_count + eT(i_count - 1);
} }
else else
{ {
return d_count - eT(1); return d_count - eT(1);
} }
} }
skipping to change at line 194 skipping to change at line 191
max_val = eT(0); max_val = eT(0);
min_val_norm = T(0); min_val_norm = T(0);
max_val_norm = T(0); max_val_norm = T(0);
} }
//! mean or average value //! mean or average value
template<typename eT> template<typename eT>
inline inline
eT eT
running_stat<eT>::mean() running_stat<eT>::mean() const
const
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return r_mean; return r_mean;
} }
//! variance //! variance
template<typename eT> template<typename eT>
inline inline
typename running_stat<eT>::T typename running_stat<eT>::T
running_stat<eT>::var(const u32 norm_type) running_stat<eT>::var(const u32 norm_type) const
const
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
const T N = counter.value(); const T N = counter.value();
if(N > T(1)) if(N > T(1))
{ {
if(norm_type == 0) if(norm_type == 0)
{ {
return r_var; return r_var;
skipping to change at line 235 skipping to change at line 230
else else
{ {
return T(0); return T(0);
} }
} }
//! standard deviation //! standard deviation
template<typename eT> template<typename eT>
inline inline
typename running_stat<eT>::T typename running_stat<eT>::T
running_stat<eT>::stddev(const u32 norm_type) running_stat<eT>::stddev(const u32 norm_type) const
const
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return std::sqrt( (*this).var(norm_type) ); return std::sqrt( (*this).var(norm_type) );
} }
//! minimum value //! minimum value
template<typename eT> template<typename eT>
inline inline
eT eT
running_stat<eT>::min() running_stat<eT>::min() const
const
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return min_val; return min_val;
} }
//! maximum value //! maximum value
template<typename eT> template<typename eT>
inline inline
eT eT
running_stat<eT>::max() running_stat<eT>::max() const
const
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return max_val; return max_val;
} }
//! number of samples so far
template<typename eT>
inline
typename get_pod_type<eT>::result
running_stat<eT>::count() const
{
arma_extra_debug_sigprint();
return counter.value();
}
//! update statistics to reflect new sample //! update statistics to reflect new sample
template<typename eT> template<typename eT>
inline inline
void void
running_stat_aux::update_stats(running_stat<eT>& x, const eT sample) running_stat_aux::update_stats(running_stat<eT>& x, const eT sample)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename running_stat<eT>::T T; typedef typename running_stat<eT>::T T;
 End of changes. 11 change blocks. 
19 lines changed or deleted 22 lines changed or added


 running_stat_vec_bones.hpp   running_stat_vec_bones.hpp 
// Copyright (C) 2009-2010 NICTA (www.nicta.com.au) // Copyright (C) 2009-2011 NICTA (www.nicta.com.au)
// Copyright (C) 2009-2010 Conrad Sanderson // Copyright (C) 2009-2011 Conrad Sanderson
// //
// This file is part of the Armadillo C++ library. // This file is part of the Armadillo C++ library.
// It is provided without any warranty of fitness // It is provided without any warranty of fitness
// for any purpose. You can redistribute this file // for any purpose. You can redistribute this file
// and/or modify it under the terms of the GNU // and/or modify it under the terms of the GNU
// Lesser General Public License (LGPL) as published // Lesser General Public License (LGPL) as published
// by the Free Software Foundation, either version 3 // by the Free Software Foundation, either version 3
// of the License or (at your option) any later version. // of the License or (at your option) any later version.
// (see http://www.opensource.org/licenses for more info) // (see http://www.opensource.org/licenses for more info)
skipping to change at line 48 skipping to change at line 48
inline const Mat<eT>& mean() const; inline const Mat<eT>& mean() const;
inline const Mat< T>& var (const u32 norm_type = 0); inline const Mat< T>& var (const u32 norm_type = 0);
inline Mat< T> stddev(const u32 norm_type = 0) const; inline Mat< T> stddev(const u32 norm_type = 0) const;
inline const Mat<eT>& cov (const u32 norm_type = 0); inline const Mat<eT>& cov (const u32 norm_type = 0);
inline const Mat<eT>& min() const; inline const Mat<eT>& min() const;
inline const Mat<eT>& max() const; inline const Mat<eT>& max() const;
inline T count() const;
// //
// //
private: private:
const bool calc_cov; const bool calc_cov;
arma_aligned arma_counter<T> counter; arma_aligned arma_counter<T> counter;
arma_aligned Mat<eT> r_mean; arma_aligned Mat<eT> r_mean;
 End of changes. 2 change blocks. 
2 lines changed or deleted 4 lines changed or added


 running_stat_vec_meat.hpp   running_stat_vec_meat.hpp 
// Copyright (C) 2009-2010 NICTA (www.nicta.com.au) // Copyright (C) 2009-2011 NICTA (www.nicta.com.au)
// Copyright (C) 2009-2010 Conrad Sanderson // Copyright (C) 2009-2011 Conrad Sanderson
// //
// This file is part of the Armadillo C++ library. // This file is part of the Armadillo C++ library.
// It is provided without any warranty of fitness // It is provided without any warranty of fitness
// for any purpose. You can redistribute this file // for any purpose. You can redistribute this file
// and/or modify it under the terms of the GNU // and/or modify it under the terms of the GNU
// Lesser General Public License (LGPL) as published // Lesser General Public License (LGPL) as published
// by the Free Software Foundation, either version 3 // by the Free Software Foundation, either version 3
// of the License or (at your option) any later version. // of the License or (at your option) any later version.
// (see http://www.opensource.org/licenses for more info) // (see http://www.opensource.org/licenses for more info)
skipping to change at line 288 skipping to change at line 288
template<typename eT> template<typename eT>
inline inline
const Mat<eT>& const Mat<eT>&
running_stat_vec<eT>::max() const running_stat_vec<eT>::max() const
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return max_val; return max_val;
} }
//! number of samples so far
template<typename eT>
inline
typename get_pod_type<eT>::result
running_stat_vec<eT>::count() const
{
arma_extra_debug_sigprint();
return counter.value();
}
// //
//! update statistics to reflect new sample //! update statistics to reflect new sample
template<typename eT> template<typename eT>
inline inline
void void
running_stat_vec_aux::update_stats(running_stat_vec<eT>& x, const Mat<eT>& sample) running_stat_vec_aux::update_stats(running_stat_vec<eT>& x, const Mat<eT>& sample)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
 End of changes. 2 change blocks. 
2 lines changed or deleted 13 lines changed or added


 subview_meat.hpp   subview_meat.hpp 
skipping to change at line 1995 skipping to change at line 1995
diagview<eT> diagview<eT>
subview<eT>::diag(const s32 in_id) subview<eT>::diag(const s32 in_id)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
const u32 row_offset = (in_id < 0) ? u32(-in_id) : 0; const u32 row_offset = (in_id < 0) ? u32(-in_id) : 0;
const u32 col_offset = (in_id > 0) ? u32( in_id) : 0; const u32 col_offset = (in_id > 0) ? u32( in_id) : 0;
arma_debug_check arma_debug_check
( (
(row_offset >= n_rows) || (col_offset >= n_cols), ((row_offset > 0) && (row_offset >= n_rows)) || ((col_offset > 0) && (c ol_offset >= n_cols)),
"subview::diag(): requested diagonal out of bounds" "subview::diag(): requested diagonal out of bounds"
); );
const u32 len = (std::min)(n_rows - row_offset, n_cols - col_offset); const u32 len = (std::min)(n_rows - row_offset, n_cols - col_offset);
const u32 base_row_offset = aux_row1 + row_offset; const u32 base_row_offset = aux_row1 + row_offset;
const u32 base_col_offset = aux_col1 + col_offset; const u32 base_col_offset = aux_col1 + col_offset;
return diagview<eT>(*m_ptr, base_row_offset, base_col_offset, len); return diagview<eT>(*m_ptr, base_row_offset, base_col_offset, len);
} }
skipping to change at line 2020 skipping to change at line 2020
const diagview<eT> const diagview<eT>
subview<eT>::diag(const s32 in_id) const subview<eT>::diag(const s32 in_id) const
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
const u32 row_offset = (in_id < 0) ? -in_id : 0; const u32 row_offset = (in_id < 0) ? -in_id : 0;
const u32 col_offset = (in_id > 0) ? in_id : 0; const u32 col_offset = (in_id > 0) ? in_id : 0;
arma_debug_check arma_debug_check
( (
(row_offset >= n_rows) || (col_offset >= n_cols), ((row_offset > 0) && (row_offset >= n_rows)) || ((col_offset > 0) && (c ol_offset >= n_cols)),
"subview::diag(): requested diagonal out of bounds" "subview::diag(): requested diagonal out of bounds"
); );
const u32 len = (std::min)(n_rows - row_offset, n_cols - col_offset); const u32 len = (std::min)(n_rows - row_offset, n_cols - col_offset);
const u32 base_row_offset = aux_row1 + row_offset; const u32 base_row_offset = aux_row1 + row_offset;
const u32 base_col_offset = aux_col1 + col_offset; const u32 base_col_offset = aux_col1 + col_offset;
return diagview<eT>(m, base_row_offset, base_col_offset, len); return diagview<eT>(m, base_row_offset, base_col_offset, len);
} }
skipping to change at line 2072 skipping to change at line 2072
subview<eT>::swap_cols(const u32 in_col1, const u32 in_col2) subview<eT>::swap_cols(const u32 in_col1, const u32 in_col2)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check arma_debug_check
( (
(in_col1 >= n_cols) || (in_col2 >= n_cols), (in_col1 >= n_cols) || (in_col2 >= n_cols),
"subview::swap_cols(): out of bounds" "subview::swap_cols(): out of bounds"
); );
eT* ptr1 = colptr(in_col1); if(n_elem > 0)
eT* ptr2 = colptr(in_col2);
for(u32 row=0; row<n_rows; ++row)
{ {
const eT tmp = ptr1[row]; eT* ptr1 = colptr(in_col1);
ptr1[row] = ptr2[row]; eT* ptr2 = colptr(in_col2);
ptr2[row] = tmp;
}
for(u32 row=0; row<n_rows; ++row)
{
const eT tmp = ptr1[row];
ptr1[row] = ptr2[row];
ptr2[row] = tmp;
}
}
} }
// template<typename eT> // template<typename eT>
// inline // inline
// subview<eT>::iter::iter(const subview<eT>& S) // subview<eT>::iter::iter(const subview<eT>& S)
// : mem (S.m.mem) // : mem (S.m.mem)
// , n_rows (S.m.n_rows) // , n_rows (S.m.n_rows)
// , row_start (S.aux_row1) // , row_start (S.aux_row1)
// , row_end_p1(row_start + S.n_rows) // , row_end_p1(row_start + S.n_rows)
// , row (row_start) // , row (row_start)
 End of changes. 5 change blocks. 
10 lines changed or deleted 12 lines changed or added


 traits.hpp   traits.hpp 
skipping to change at line 377 skipping to change at line 377
{ static const bool value = true; }; { static const bool value = true; };
template<typename T1> template<typename T1>
struct is_s32 struct is_s32
{ static const bool value = false; }; { static const bool value = false; };
template<> template<>
struct is_s32<s32> struct is_s32<s32>
{ static const bool value = true; }; { static const bool value = true; };
template<typename T1> // template<typename T1>
struct is_u64 // struct is_u64
{ static const bool value = false; }; // { static const bool value = false; };
//
template<> // template<>
struct is_u64<u64> // struct is_u64<u64>
{ static const bool value = true; }; // { static const bool value = true; };
template<typename T1> template<typename T1>
struct is_float struct is_float
{ static const bool value = false; }; { static const bool value = false; };
template<> template<>
struct is_float<float> struct is_float<float>
{ static const bool value = true; }; { static const bool value = true; };
template<typename T1> template<typename T1>
skipping to change at line 462 skipping to change at line 462
template<typename T1> template<typename T1>
struct is_supported_elem_type struct is_supported_elem_type
{ {
static const bool value = \ static const bool value = \
is_u8<T1>::value || is_u8<T1>::value ||
is_s8<T1>::value || is_s8<T1>::value ||
is_u16<T1>::value || is_u16<T1>::value ||
is_s16<T1>::value || is_s16<T1>::value ||
is_u32<T1>::value || is_u32<T1>::value ||
is_s32<T1>::value || is_s32<T1>::value ||
is_u64<T1>::value || // is_u64<T1>::value ||
is_float<T1>::value || is_float<T1>::value ||
is_double<T1>::value || is_double<T1>::value ||
is_supported_complex_float<T1>::value || is_supported_complex_float<T1>::value ||
is_supported_complex_double<T1>::value; is_supported_complex_double<T1>::value;
}; };
template<typename T1> template<typename T1>
struct is_supported_blas_type struct is_supported_blas_type
{ {
static const bool value = \ static const bool value = \
 End of changes. 2 change blocks. 
8 lines changed or deleted 8 lines changed or added


 typedef_u64.hpp   typedef_u64.hpp 
skipping to change at line 59 skipping to change at line 59
#elif (_MSC_VER >= 1200) #elif (_MSC_VER >= 1200)
//#elif (_MSC_VER >= 1310) && defined(_MSC_EXTENSIONS) //#elif (_MSC_VER >= 1310) && defined(_MSC_EXTENSIONS)
typedef unsigned __int64 u64; typedef unsigned __int64 u64;
static const u64 max = 0xFFFFFFFFFFFFFFFF; static const u64 max = 0xFFFFFFFFFFFFFFFF;
static const bool trunc = false; static const bool trunc = false;
#else #else
// #error "don't know how to typedef 'u64' on this system" #error "don't know how to typedef 'u64' on this system"
// use u32 as a last resort
typedef u32 u64;
static const u64 max = 0xFFFFFFFF;
static const bool trunc = true;
#endif #endif
}; };
typedef deduce_u64< (sizeof(std::size_t) >= 8) >::u64 u64; typedef deduce_u64< (sizeof(std::size_t) >= 8) >::u64 u64;
//! @} //! @}
 End of changes. 1 change blocks. 
8 lines changed or deleted 1 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/