Cube_meat.hpp   Cube_meat.hpp 
skipping to change at line 217 skipping to change at line 217
} }
//! In-place addition of a scalar to all elements of the cube //! In-place addition of a scalar to all elements of the cube
template<typename eT> template<typename eT>
arma_inline arma_inline
const Cube<eT>& const Cube<eT>&
Cube<eT>::operator+=(const eT val) Cube<eT>::operator+=(const eT val)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
for(u32 i=0; i<n_elem; ++i) eT* local_ptr = memptr();
const u32 local_n_elem = n_elem;
u32 i,j;
for(i=0, j=1; j<local_n_elem; i+=2, j+=2)
{
local_ptr[i] += val;
local_ptr[j] += val;
}
if(i < local_n_elem)
{ {
access::rw(mem[i]) += val; local_ptr[i] += val;
} }
return *this; return *this;
} }
//! In-place subtraction of a scalar from all elements of the cube //! In-place subtraction of a scalar from all elements of the cube
template<typename eT> template<typename eT>
arma_inline arma_inline
const Cube<eT>& const Cube<eT>&
Cube<eT>::operator-=(const eT val) Cube<eT>::operator-=(const eT val)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
for(u32 i=0; i<n_elem; ++i) eT* local_ptr = memptr();
const u32 local_n_elem = n_elem;
u32 i,j;
for(i=0, j=1; j<local_n_elem; i+=2, j+=2)
{ {
access::rw(mem[i]) -= val; local_ptr[i] -= val;
local_ptr[j] -= val;
}
if(i < local_n_elem)
{
local_ptr[i] -= val;
} }
return *this; return *this;
} }
//! In-place multiplication of all elements of the cube with a scalar //! In-place multiplication of all elements of the cube with a scalar
template<typename eT> template<typename eT>
arma_inline arma_inline
const Cube<eT>& const Cube<eT>&
Cube<eT>::operator*=(const eT val) Cube<eT>::operator*=(const eT val)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
for(u32 i=0; i<n_elem; ++i) eT* local_ptr = memptr();
const u32 local_n_elem = n_elem;
u32 i,j;
for(i=0, j=1; j<local_n_elem; i+=2, j+=2)
{ {
access::rw(mem[i]) *= val; local_ptr[i] *= val;
local_ptr[j] *= val;
}
if(i < local_n_elem)
{
local_ptr[i] *= val;
} }
return *this; return *this;
} }
//! In-place division of all elements of the cube with a scalar //! In-place division of all elements of the cube with a scalar
template<typename eT> template<typename eT>
arma_inline arma_inline
const Cube<eT>& const Cube<eT>&
Cube<eT>::operator/=(const eT val) Cube<eT>::operator/=(const eT val)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
for(u32 i=0; i<n_elem; ++i) eT* local_ptr = memptr();
const u32 local_n_elem = n_elem;
u32 i,j;
for(i=0, j=1; j<local_n_elem; i+=2, j+=2)
{
local_ptr[i] /= val;
local_ptr[j] /= val;
}
if(i < local_n_elem)
{ {
access::rw(mem[i]) /= val; local_ptr[i] /= val;
} }
return *this; return *this;
} }
//! construct a cube from a given cube //! construct a cube from a given cube
template<typename eT> template<typename eT>
inline inline
Cube<eT>::Cube(const Cube<eT>& in_cube) Cube<eT>::Cube(const Cube<eT>& in_cube)
: n_rows(0) : n_rows(0)
skipping to change at line 379 skipping to change at line 423
//! in-place cube addition //! in-place cube addition
template<typename eT> template<typename eT>
inline inline
const Cube<eT>& const Cube<eT>&
Cube<eT>::operator+=(const Cube<eT>& m) Cube<eT>::operator+=(const Cube<eT>& m)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_assert_same_size(*this, m, "cube addition"); arma_debug_assert_same_size(*this, m, "cube addition");
eT* out_mem = (*this).memptr();
const eT* m_mem = m.memptr();
const u32 local_n_elem = m.n_elem; const u32 local_n_elem = m.n_elem;
for(u32 i=0; i<local_n_elem; ++i) eT* out_mem = (*this).memptr();
const eT* m_mem = m.memptr();
u32 i,j;
for(i=0, j=1; j<local_n_elem; i+=2, j+=2)
{
out_mem[i] += m_mem[i];
out_mem[j] += m_mem[j];
}
if(i < local_n_elem)
{ {
out_mem[i] += m_mem[i]; out_mem[i] += m_mem[i];
} }
return *this; return *this;
} }
//! in-place cube subtraction //! in-place cube subtraction
template<typename eT> template<typename eT>
inline inline
const Cube<eT>& const Cube<eT>&
Cube<eT>::operator-=(const Cube<eT>& m) Cube<eT>::operator-=(const Cube<eT>& m)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_assert_same_size(*this, m, "cube subtraction"); arma_debug_assert_same_size(*this, m, "cube subtraction");
eT* out_mem = (*this).memptr();
const eT* m_mem = m.memptr();
const u32 local_n_elem = m.n_elem; const u32 local_n_elem = m.n_elem;
for(u32 i=0; i<local_n_elem; ++i) eT* out_mem = (*this).memptr();
const eT* m_mem = m.memptr();
u32 i,j;
for(i=0, j=1; j<local_n_elem; i+=2, j+=2)
{
out_mem[i] -= m_mem[i];
out_mem[j] -= m_mem[j];
}
if(i < local_n_elem)
{ {
out_mem[i] -= m_mem[i]; out_mem[i] -= m_mem[i];
} }
return *this; return *this;
} }
//! in-place element-wise cube multiplication //! in-place element-wise cube multiplication
template<typename eT> template<typename eT>
inline inline
const Cube<eT>& const Cube<eT>&
Cube<eT>::operator%=(const Cube<eT>& m) Cube<eT>::operator%=(const Cube<eT>& m)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_assert_same_size(*this, m, "element-wise cube multiplication") ; arma_debug_assert_same_size(*this, m, "element-wise cube multiplication") ;
eT* out_mem = (*this).memptr();
const eT* m_mem = m.memptr();
const u32 local_n_elem = m.n_elem; const u32 local_n_elem = m.n_elem;
for(u32 i=0; i<local_n_elem; ++i) eT* out_mem = (*this).memptr();
const eT* m_mem = m.memptr();
u32 i,j;
for(i=0, j=1; j<local_n_elem; i+=2, j+=2)
{
out_mem[i] *= m_mem[i];
out_mem[j] *= m_mem[j];
}
if(i < local_n_elem)
{ {
out_mem[i] *= m_mem[i]; out_mem[i] *= m_mem[i];
} }
return *this; return *this;
} }
//! in-place element-wise cube division //! in-place element-wise cube division
template<typename eT> template<typename eT>
inline inline
const Cube<eT>& const Cube<eT>&
Cube<eT>::operator/=(const Cube<eT>& m) Cube<eT>::operator/=(const Cube<eT>& m)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_assert_same_size(*this, m, "element-wise cube division"); arma_debug_assert_same_size(*this, m, "element-wise cube division");
eT* out_mem = (*this).memptr();
const eT* m_mem = m.memptr();
const u32 local_n_elem = m.n_elem; const u32 local_n_elem = m.n_elem;
for(u32 i=0; i<local_n_elem; ++i) eT* out_mem = (*this).memptr();
const eT* m_mem = m.memptr();
u32 i,j;
for(i=0, j=1; j<local_n_elem; i+=2, j+=2)
{
out_mem[i] /= m_mem[i];
out_mem[j] /= m_mem[j];
}
if(i < local_n_elem)
{ {
out_mem[i] /= m_mem[i]; out_mem[i] /= m_mem[i];
} }
return *this; return *this;
} }
//! for constructing a complex cube out of two non-complex cubes //! for constructing a complex cube out of two non-complex cubes
template<typename eT> template<typename eT>
template<typename T1, typename T2> template<typename T1, typename T2>
skipping to change at line 735 skipping to change at line 815
inline inline
const Cube<eT>& const Cube<eT>&
Cube<eT>::operator+=(const OpCube<T1, op_type>& X) Cube<eT>::operator+=(const OpCube<T1, op_type>& X)
{ {
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();
const Cube<eT> m(X); const Cube<eT> m(X);
arma_debug_assert_same_size(*this, m, "cube addition"); return (*this).operator+=(m);
eT* out_mem = (*this).memptr();
const eT* m_mem = m.memptr();
const u32 local_n_elem = m.n_elem;
for(u32 i=0; i<local_n_elem; ++i)
{
out_mem[i] += m_mem[i];
}
return *this;
} }
//! in-place cube subtraction, with the right-hand-side operand having dela yed operations //! in-place cube subtraction, with the right-hand-side operand having dela yed operations
template<typename eT> template<typename eT>
template<typename T1, typename op_type> template<typename T1, typename op_type>
inline inline
const Cube<eT>& const Cube<eT>&
Cube<eT>::operator-=(const OpCube<T1, op_type>& X) Cube<eT>::operator-=(const OpCube<T1, op_type>& X)
{ {
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();
const Cube<eT> m(X); const Cube<eT> m(X);
arma_debug_assert_same_size(*this, m, "cube subtraction"); return (*this).operator-=(m);
eT* out_mem = (*this).memptr();
const eT* m_mem = m.memptr();
const u32 local_n_elem = m.n_elem;
for(u32 i=0; i<local_n_elem; ++i)
{
out_mem[i] -= m_mem[i];
}
return *this;
} }
//! in-place cube element-wise multiplication, with the right-hand-side ope rand having delayed operations //! in-place cube element-wise multiplication, with the right-hand-side ope rand having delayed operations
template<typename eT> template<typename eT>
template<typename T1, typename op_type> template<typename T1, typename op_type>
inline inline
const Cube<eT>& const Cube<eT>&
Cube<eT>::operator%=(const OpCube<T1, op_type>& X) Cube<eT>::operator%=(const OpCube<T1, op_type>& X)
{ {
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();
const Cube<eT> m(X); const Cube<eT> m(X);
arma_debug_assert_same_size(*this, m, "element-wise cube multiplication") return (*this).operator%=(m);
;
eT* out_mem = (*this).memptr();
const eT* m_mem = m.memptr();
const u32 local_n_elem = m.n_elem;
for(u32 i=0; i<local_n_elem; ++i)
{
out_mem[i] *= m_mem[i];
}
return *this;
} }
//! in-place cube element-wise division, with the right-hand-side operand h aving delayed operations //! in-place cube element-wise division, with the right-hand-side operand h aving delayed operations
template<typename eT> template<typename eT>
template<typename T1, typename op_type> template<typename T1, typename op_type>
inline inline
const Cube<eT>& const Cube<eT>&
Cube<eT>::operator/=(const OpCube<T1, op_type>& X) Cube<eT>::operator/=(const OpCube<T1, op_type>& X)
{ {
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();
const Cube<eT> m(X); const Cube<eT> m(X);
arma_debug_assert_same_size(*this, m, "element-wise cube division"); return (*this).operator/=(m);
eT* out_mem = (*this).memptr();
const eT* m_mem = m.memptr();
const u32 local_n_elem = m.n_elem;
for(u32 i=0; i<local_n_elem; ++i)
{
out_mem[i] /= m_mem[i];
}
return *this;
} }
//! create a cube from eOpCube, i.e. run the previously delayed unary opera tions //! create a cube from eOpCube, i.e. run the previously delayed unary opera tions
template<typename eT> template<typename eT>
template<typename T1, typename eop_type> template<typename T1, typename eop_type>
inline inline
Cube<eT>::Cube(const eOpCube<T1, eop_type>& X) Cube<eT>::Cube(const eOpCube<T1, eop_type>& X)
: n_rows(0) : n_rows(0)
, n_cols(0) , n_cols(0)
, n_elem_slice(0) , n_elem_slice(0)
skipping to change at line 980 skipping to change at line 1016
const Cube<eT>& const Cube<eT>&
Cube<eT>::operator+=(const GlueCube<T1, T2, glue_type>& X) Cube<eT>::operator+=(const GlueCube<T1, T2, glue_type>& X)
{ {
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();
const Cube<eT> m(X); const Cube<eT> m(X);
arma_debug_assert_same_size(*this, m, "cube addition"); return (*this).operator+=(m);
eT* out_mem = (*this).memptr();
const eT* m_mem = m.memptr();
const u32 local_n_elem = m.n_elem;
for(u32 i=0; i<local_n_elem; ++i)
{
out_mem[i] += m_mem[i];
}
return *this;
} }
//! in-place cube subtraction, with the right-hand-side operands having del ayed operations //! in-place cube subtraction, with the right-hand-side operands having del ayed operations
template<typename eT> template<typename eT>
template<typename T1, typename T2, typename glue_type> template<typename T1, typename T2, typename glue_type>
inline inline
const Cube<eT>& const Cube<eT>&
Cube<eT>::operator-=(const GlueCube<T1, T2, glue_type>& X) Cube<eT>::operator-=(const GlueCube<T1, T2, glue_type>& X)
{ {
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();
const Cube<eT> m(X); const Cube<eT> m(X);
arma_debug_assert_same_size(*this, m, "cube subtraction"); return (*this).operator-=(m);
eT* out_mem = (*this).memptr();
const eT* m_mem = m.memptr();
const u32 local_n_elem = m.n_elem;
for(u32 i=0; i<local_n_elem; ++i)
{
out_mem[i] -= m_mem[i];
}
return *this;
} }
//! in-place cube element-wise multiplication, with the right-hand-side ope rands having delayed operations //! in-place cube element-wise multiplication, with the right-hand-side ope rands having delayed operations
template<typename eT> template<typename eT>
template<typename T1, typename T2, typename glue_type> template<typename T1, typename T2, typename glue_type>
inline inline
const Cube<eT>& const Cube<eT>&
Cube<eT>::operator%=(const GlueCube<T1, T2, glue_type>& X) Cube<eT>::operator%=(const GlueCube<T1, T2, glue_type>& X)
{ {
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();
const Cube<eT> m(X); const Cube<eT> m(X);
arma_debug_assert_same_size(*this, m, "element-wise cube multiplication") return (*this).operator%=(m);
;
eT* out_mem = (*this).memptr();
const eT* m_mem = m.memptr();
const u32 local_n_elem = m.n_elem;
for(u32 i=0; i<local_n_elem; ++i)
{
out_mem[i] *= m_mem[i];
}
return *this;
} }
//! in-place cube element-wise division, with the right-hand-side operands having delayed operations //! in-place cube element-wise division, with the right-hand-side operands having delayed operations
template<typename eT> template<typename eT>
template<typename T1, typename T2, typename glue_type> template<typename T1, typename T2, typename glue_type>
inline inline
const Cube<eT>& const Cube<eT>&
Cube<eT>::operator/=(const GlueCube<T1, T2, glue_type>& X) Cube<eT>::operator/=(const GlueCube<T1, T2, glue_type>& X)
{ {
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();
const Cube<eT> m(X); const Cube<eT> m(X);
arma_debug_assert_same_size(*this, m, "element-wise cube division"); return (*this).operator/=(m);
eT* out_mem = (*this).memptr();
const eT* m_mem = m.memptr();
const u32 local_n_elem = m.n_elem;
for(u32 i=0; i<local_n_elem; ++i)
{
out_mem[i] /= m_mem[i];
}
return *this;
} }
//! create a cube from eGlue, i.e. run the previously delayed binary operat ions //! create a cube from eGlue, i.e. run the previously delayed binary operat ions
template<typename eT> template<typename eT>
template<typename T1, typename T2, typename eglue_type> template<typename T1, typename T2, typename eglue_type>
inline inline
Cube<eT>::Cube(const eGlueCube<T1, T2, eglue_type>& X) Cube<eT>::Cube(const eGlueCube<T1, T2, eglue_type>& X)
: n_rows(0) : n_rows(0)
, n_cols(0) , n_cols(0)
, n_elem_slice(0) , n_elem_slice(0)
skipping to change at line 1489 skipping to change at line 1481
} }
//! fill the cube with the specified value //! fill the cube with the specified value
template<typename eT> template<typename eT>
inline inline
void void
Cube<eT>::fill(const eT val) Cube<eT>::fill(const eT val)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
for(u32 i=0; i<n_elem; ++i) eT* local_ptr = memptr();
const u32 local_n_elem = n_elem;
u32 i,j;
for(i=0, j=1; j<local_n_elem; i+=2, j+=2)
{ {
access::rw(mem[i]) = val; local_ptr[i] = val;
local_ptr[j] = val;
}
if(i < local_n_elem)
{
local_ptr[i] = val;
} }
} }
template<typename eT> template<typename eT>
inline inline
void void
Cube<eT>::zeros() Cube<eT>::zeros()
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
skipping to change at line 1692 skipping to change at line 1695
//! prefix ++ //! prefix ++
template<typename eT> template<typename eT>
arma_inline arma_inline
void void
Cube_aux::prefix_pp(Cube<eT>& x) Cube_aux::prefix_pp(Cube<eT>& x)
{ {
eT* memptr = x.memptr(); eT* memptr = x.memptr();
const u32 n_elem = x.n_elem; const u32 n_elem = x.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)
{
++(memptr[i]);
++(memptr[j]);
}
if(i < n_elem)
{ {
++(memptr[i]); ++(memptr[i]);
} }
} }
//! prefix ++ for complex numbers (work around for limitations of the std:: complex class) //! prefix ++ for complex numbers (work around for limitations of the std:: complex class)
template<typename T> template<typename T>
arma_inline arma_inline
void void
Cube_aux::prefix_pp(Cube< std::complex<T> >& x) Cube_aux::prefix_pp(Cube< std::complex<T> >& x)
skipping to change at line 1716 skipping to change at line 1727
//! postfix ++ //! postfix ++
template<typename eT> template<typename eT>
arma_inline arma_inline
void void
Cube_aux::postfix_pp(Cube<eT>& x) Cube_aux::postfix_pp(Cube<eT>& x)
{ {
eT* memptr = x.memptr(); eT* memptr = x.memptr();
const u32 n_elem = x.n_elem; const u32 n_elem = x.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)
{
(memptr[i])++;
(memptr[j])++;
}
if(i < n_elem)
{ {
(memptr[i])++; (memptr[i])++;
} }
} }
//! postfix ++ for complex numbers (work around for limitations of the std: :complex class) //! postfix ++ for complex numbers (work around for limitations of the std: :complex class)
template<typename T> template<typename T>
arma_inline arma_inline
void void
Cube_aux::postfix_pp(Cube< std::complex<T> >& x) Cube_aux::postfix_pp(Cube< std::complex<T> >& x)
skipping to change at line 1740 skipping to change at line 1759
//! prefix -- //! prefix --
template<typename eT> template<typename eT>
arma_inline arma_inline
void void
Cube_aux::prefix_mm(Cube<eT>& x) Cube_aux::prefix_mm(Cube<eT>& x)
{ {
eT* memptr = x.memptr(); eT* memptr = x.memptr();
const u32 n_elem = x.n_elem; const u32 n_elem = x.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)
{
--(memptr[i]);
--(memptr[j]);
}
if(i < n_elem)
{ {
--(memptr[i]); --(memptr[i]);
} }
} }
//! prefix -- for complex numbers (work around for limitations of the std:: complex class) //! prefix -- for complex numbers (work around for limitations of the std:: complex class)
template<typename T> template<typename T>
arma_inline arma_inline
void void
Cube_aux::prefix_mm(Cube< std::complex<T> >& x) Cube_aux::prefix_mm(Cube< std::complex<T> >& x)
skipping to change at line 1764 skipping to change at line 1791
//! postfix -- //! postfix --
template<typename eT> template<typename eT>
arma_inline arma_inline
void void
Cube_aux::postfix_mm(Cube<eT>& x) Cube_aux::postfix_mm(Cube<eT>& x)
{ {
eT* memptr = x.memptr(); eT* memptr = x.memptr();
const u32 n_elem = x.n_elem; const u32 n_elem = x.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)
{
(memptr[i])--;
(memptr[j])--;
}
if(i < n_elem)
{ {
(memptr[i])--; (memptr[i])--;
} }
} }
//! postfix ++ for complex numbers (work around for limitations of the std: :complex class) //! postfix ++ for complex numbers (work around for limitations of the std: :complex class)
template<typename T> template<typename T>
arma_inline arma_inline
void void
Cube_aux::postfix_mm(Cube< std::complex<T> >& x) Cube_aux::postfix_mm(Cube< std::complex<T> >& x)
 End of changes. 30 change blocks. 
124 lines changed or deleted 157 lines changed or added


 Mat_meat.hpp   Mat_meat.hpp 
skipping to change at line 300 skipping to change at line 300
} }
//! In-place addition of a scalar to all elements of the matrix //! In-place addition of a scalar to all elements of the matrix
template<typename eT> template<typename eT>
arma_inline arma_inline
const Mat<eT>& const Mat<eT>&
Mat<eT>::operator+=(const eT val) Mat<eT>::operator+=(const eT val)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
for(u32 i=0; i<n_elem; ++i) eT* local_ptr = memptr();
const u32 local_n_elem = n_elem;
u32 i,j;
for(i=0, j=1; j<local_n_elem; i+=2, j+=2)
{ {
access::rw(mem[i]) += val; local_ptr[i] += val;
local_ptr[j] += val;
}
if(i < local_n_elem)
{
local_ptr[i] += val;
} }
return *this; return *this;
} }
//! In-place subtraction of a scalar from all elements of the matrix //! In-place subtraction of a scalar from all elements of the matrix
template<typename eT> template<typename eT>
arma_inline arma_inline
const Mat<eT>& const Mat<eT>&
Mat<eT>::operator-=(const eT val) Mat<eT>::operator-=(const eT val)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
for(u32 i=0; i<n_elem; ++i) eT* local_ptr = memptr();
const u32 local_n_elem = n_elem;
u32 i,j;
for(i=0, j=1; j<local_n_elem; i+=2, j+=2)
{ {
access::rw(mem[i]) -= val; local_ptr[i] -= val;
local_ptr[j] -= val;
}
if(i < local_n_elem)
{
local_ptr[i] -= val;
} }
return *this; return *this;
} }
//! In-place multiplication of all elements of the matrix with a scalar //! In-place multiplication of all elements of the matrix with a scalar
template<typename eT> template<typename eT>
arma_inline arma_inline
const Mat<eT>& const Mat<eT>&
Mat<eT>::operator*=(const eT val) Mat<eT>::operator*=(const eT val)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
for(u32 i=0; i<n_elem; ++i) eT* local_ptr = memptr();
const u32 local_n_elem = n_elem;
u32 i,j;
for(i=0, j=1; j<local_n_elem; i+=2, j+=2)
{
local_ptr[i] *= val;
local_ptr[j] *= val;
}
if(i < local_n_elem)
{ {
access::rw(mem[i]) *= val; local_ptr[i] *= val;
} }
return *this; return *this;
} }
//! In-place division of all elements of the matrix with a scalar //! In-place division of all elements of the matrix with a scalar
template<typename eT> template<typename eT>
arma_inline arma_inline
const Mat<eT>& const Mat<eT>&
Mat<eT>::operator/=(const eT val) Mat<eT>::operator/=(const eT val)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
for(u32 i=0; i<n_elem; ++i) eT* local_ptr = memptr();
const u32 local_n_elem = n_elem;
u32 i,j;
for(i=0, j=1; j<local_n_elem; i+=2, j+=2)
{ {
access::rw(mem[i]) /= val; local_ptr[i] /= val;
local_ptr[j] /= val;
}
if(i < local_n_elem)
{
local_ptr[i] /= val;
} }
return *this; return *this;
} }
//! construct a matrix from a given matrix //! construct a matrix from a given matrix
template<typename eT> template<typename eT>
inline inline
Mat<eT>::Mat(const Mat<eT>& in_mat) Mat<eT>::Mat(const Mat<eT>& in_mat)
: n_rows(0) : n_rows(0)
skipping to change at line 471 skipping to change at line 515
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_assert_same_size(*this, m, "matrix addition"); arma_debug_assert_same_size(*this, m, "matrix addition");
const u32 local_n_elem = m.n_elem; const u32 local_n_elem = m.n_elem;
eT* out_mem = (*this).memptr(); eT* out_mem = (*this).memptr();
const eT* m_mem = m.memptr(); const eT* m_mem = m.memptr();
for(u32 i=0; i<local_n_elem; ++i) u32 i,j;
for(i=0, j=1; j<local_n_elem; i+=2, j+=2)
{
out_mem[i] += m_mem[i];
out_mem[j] += m_mem[j];
}
if(i < local_n_elem)
{ {
out_mem[i] += m_mem[i]; out_mem[i] += m_mem[i];
} }
return *this; return *this;
} }
//! in-place matrix subtraction //! in-place matrix subtraction
template<typename eT> template<typename eT>
inline inline
skipping to change at line 494 skipping to change at line 546
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_assert_same_size(*this, m, "matrix subtraction"); arma_debug_assert_same_size(*this, m, "matrix subtraction");
const u32 local_n_elem = m.n_elem; const u32 local_n_elem = m.n_elem;
eT* out_mem = (*this).memptr(); eT* out_mem = (*this).memptr();
const eT* m_mem = m.memptr(); const eT* m_mem = m.memptr();
for(u32 i=0; i<local_n_elem; ++i) u32 i,j;
for(i=0, j=1; j<local_n_elem; i+=2, j+=2)
{
out_mem[i] -= m_mem[i];
out_mem[j] -= m_mem[j];
}
if(i < local_n_elem)
{ {
out_mem[i] -= m_mem[i]; out_mem[i] -= m_mem[i];
} }
return *this; return *this;
} }
//! in-place matrix multiplication //! in-place matrix multiplication
template<typename eT> template<typename eT>
inline inline
skipping to change at line 529 skipping to change at line 589
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_assert_same_size(*this, m, "element-wise matrix multplication" ); arma_debug_assert_same_size(*this, m, "element-wise matrix multplication" );
const u32 local_n_elem = m.n_elem; const u32 local_n_elem = m.n_elem;
eT* out_mem = (*this).memptr(); eT* out_mem = (*this).memptr();
const eT* m_mem = m.memptr(); const eT* m_mem = m.memptr();
for(u32 i=0; i<local_n_elem; ++i) u32 i,j;
for(i=0, j=1; j<local_n_elem; i+=2, j+=2)
{
out_mem[i] *= m_mem[i];
out_mem[j] *= m_mem[j];
}
if(i < local_n_elem)
{ {
out_mem[i] *= m_mem[i]; out_mem[i] *= m_mem[i];
} }
return *this; return *this;
} }
//! in-place element-wise matrix division //! in-place element-wise matrix division
template<typename eT> template<typename eT>
inline inline
skipping to change at line 552 skipping to change at line 620
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_assert_same_size(*this, m, "element-wise matrix division"); arma_debug_assert_same_size(*this, m, "element-wise matrix division");
const u32 local_n_elem = m.n_elem; const u32 local_n_elem = m.n_elem;
eT* out_mem = (*this).memptr(); eT* out_mem = (*this).memptr();
const eT* m_mem = m.memptr(); const eT* m_mem = m.memptr();
for(u32 i=0; i<local_n_elem; ++i) u32 i,j;
for(i=0, j=1; j<local_n_elem; i+=2, j+=2)
{
out_mem[i] /= m_mem[i];
out_mem[j] /= m_mem[j];
}
if(i < local_n_elem)
{ {
out_mem[i] /= m_mem[i]; out_mem[i] /= m_mem[i];
} }
return *this; return *this;
} }
//! 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>
skipping to change at line 1166 skipping to change at line 1242
inline inline
const Mat<eT>& const Mat<eT>&
Mat<eT>::operator+=(const Op<T1, op_type>& X) Mat<eT>::operator+=(const Op<T1, op_type>& X)
{ {
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();
const Mat<eT> m(X); const Mat<eT> m(X);
arma_debug_assert_same_size(*this, m, "matrix addition"); return (*this).operator+=(m);
eT* out_mem = (*this).memptr();
const eT* m_mem = m.memptr();
const u32 local_n_elem = m.n_elem;
for(u32 i=0; i<local_n_elem; ++i)
{
out_mem[i] += m_mem[i];
}
return *this;
} }
//! in-place matrix subtraction, with the right-hand-side operand having de layed operations //! in-place matrix subtraction, with the right-hand-side operand having de layed operations
template<typename eT> template<typename eT>
template<typename T1, typename op_type> template<typename T1, typename op_type>
inline inline
const Mat<eT>& const Mat<eT>&
Mat<eT>::operator-=(const Op<T1, op_type>& X) Mat<eT>::operator-=(const Op<T1, op_type>& X)
{ {
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();
const Mat<eT> m(X); const Mat<eT> m(X);
arma_debug_assert_same_size(*this, m, "matrix subtraction"); return (*this).operator-=(m);
eT* out_mem = (*this).memptr();
const eT* m_mem = m.memptr();
const u32 local_n_elem = m.n_elem;
for(u32 i=0; i<local_n_elem; ++i)
{
out_mem[i] -= m_mem[i];
}
return *this;
} }
//! in-place matrix multiplication, with the right-hand-side operand having delayed operations //! in-place matrix multiplication, with the right-hand-side operand having delayed operations
template<typename eT> template<typename eT>
template<typename T1, typename op_type> template<typename T1, typename op_type>
inline inline
const Mat<eT>& const Mat<eT>&
Mat<eT>::operator*=(const Op<T1, op_type>& X) Mat<eT>::operator*=(const Op<T1, op_type>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
skipping to change at line 1236 skipping to change at line 1290
inline inline
const Mat<eT>& const Mat<eT>&
Mat<eT>::operator%=(const Op<T1, op_type>& X) Mat<eT>::operator%=(const Op<T1, op_type>& X)
{ {
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();
const Mat<eT> m(X); const Mat<eT> m(X);
arma_debug_assert_same_size(*this, m, "element-wise matrix multiplication return (*this).operator%=(m);
");
eT* out_mem = (*this).memptr();
const eT* m_mem = m.memptr();
const u32 local_n_elem = m.n_elem;
for(u32 i=0; i<local_n_elem; ++i)
{
out_mem[i] *= m_mem[i];
}
return *this;
} }
//! in-place matrix element-wise division, with the right-hand-side operand having delayed operations //! in-place matrix element-wise division, with the right-hand-side operand having delayed operations
template<typename eT> template<typename eT>
template<typename T1, typename op_type> template<typename T1, typename op_type>
inline inline
const Mat<eT>& const Mat<eT>&
Mat<eT>::operator/=(const Op<T1, op_type>& X) Mat<eT>::operator/=(const Op<T1, op_type>& X)
{ {
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();
const Mat<eT> m(X); const Mat<eT> m(X);
arma_debug_assert_same_size(*this, m, "element-wise matrix division"); return (*this).operator/=(m);
eT* out_mem = (*this).memptr();
const eT* m_mem = m.memptr();
const u32 local_n_elem = m.n_elem;
for(u32 i=0; i<local_n_elem; ++i)
{
out_mem[i] /= m_mem[i];
}
return *this;
} }
//! create a matrix from eOp, i.e. run the previously delayed unary operati ons //! create a matrix from eOp, i.e. run the previously delayed unary operati ons
template<typename eT> template<typename eT>
template<typename T1, typename eop_type> template<typename T1, typename eop_type>
inline inline
Mat<eT>::Mat(const eOp<T1, eop_type>& X) Mat<eT>::Mat(const eOp<T1, eop_type>& X)
: n_rows(0) : n_rows(0)
, n_cols(0) , n_cols(0)
, n_elem(0) , n_elem(0)
skipping to change at line 1438 skipping to change at line 1470
const Mat<eT>& const Mat<eT>&
Mat<eT>::operator+=(const Glue<T1, T2, glue_type>& X) Mat<eT>::operator+=(const Glue<T1, T2, glue_type>& X)
{ {
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();
const Mat<eT> m(X); const Mat<eT> m(X);
arma_debug_assert_same_size(*this, m, "matrix addition"); return (*this).operator+=(m);
eT* out_mem = (*this).memptr();
const eT* m_mem = m.memptr();
const u32 local_n_elem = m.n_elem;
for(u32 i=0; i<local_n_elem; ++i)
{
out_mem[i] += m_mem[i];
}
return *this;
} }
//! in-place matrix subtraction, with the right-hand-side operands having d elayed operations //! in-place matrix subtraction, with the right-hand-side operands having d elayed operations
template<typename eT> template<typename eT>
template<typename T1, typename T2, typename glue_type> template<typename T1, typename T2, typename glue_type>
inline inline
const Mat<eT>& const Mat<eT>&
Mat<eT>::operator-=(const Glue<T1, T2, glue_type>& X) Mat<eT>::operator-=(const Glue<T1, T2, glue_type>& X)
{ {
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();
const Mat<eT> m(X); const Mat<eT> m(X);
arma_debug_assert_same_size(*this, m, "matrix subtraction"); return (*this).operator-=(m);
eT* out_mem = (*this).memptr();
const eT* m_mem = m.memptr();
const u32 local_n_elem = m.n_elem;
for(u32 i=0; i<local_n_elem; ++i)
{
out_mem[i] -= m_mem[i];
}
return *this;
} }
//! in-place matrix multiplications, with the right-hand-side operands havi ng delayed operations //! in-place matrix multiplications, with the right-hand-side operands havi ng delayed operations
template<typename eT> template<typename eT>
template<typename T1, typename T2, typename glue_type> template<typename T1, typename T2, typename glue_type>
inline inline
const Mat<eT>& const Mat<eT>&
Mat<eT>::operator*=(const Glue<T1, T2, glue_type>& X) Mat<eT>::operator*=(const Glue<T1, T2, glue_type>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
skipping to change at line 1511 skipping to change at line 1521
const Mat<eT>& const Mat<eT>&
Mat<eT>::operator%=(const Glue<T1, T2, glue_type>& X) Mat<eT>::operator%=(const Glue<T1, T2, glue_type>& X)
{ {
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();
const Mat<eT> m(X); const Mat<eT> m(X);
arma_debug_assert_same_size(*this, m, "element-wise matrix multiplication return (*this).operator%=(m);
");
eT* out_mem = (*this).memptr();
const eT* m_mem = m.memptr();
const u32 local_n_elem = m.n_elem;
for(u32 i=0; i<local_n_elem; ++i)
{
out_mem[i] *= m_mem[i];
}
return *this;
} }
//! in-place matrix element-wise division, with the right-hand-side operand s having delayed operations //! in-place matrix element-wise division, with the right-hand-side operand s having delayed operations
template<typename eT> template<typename eT>
template<typename T1, typename T2, typename glue_type> template<typename T1, typename T2, typename glue_type>
inline inline
const Mat<eT>& const Mat<eT>&
Mat<eT>::operator/=(const Glue<T1, T2, glue_type>& X) Mat<eT>::operator/=(const Glue<T1, T2, glue_type>& X)
{ {
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();
const Mat<eT> m(X); const Mat<eT> m(X);
arma_debug_assert_same_size(*this, m, "element-wise matrix division"); return (*this).operator/=(m);
eT* out_mem = (*this).memptr();
const eT* m_mem = m.memptr();
const u32 local_n_elem = m.n_elem;
for(u32 i=0; i<local_n_elem; ++i)
{
out_mem[i] /= m_mem[i];
}
return *this;
} }
template<typename eT> template<typename eT>
template<typename T1, typename T2> template<typename T1, typename T2>
inline inline
const Mat<eT>& const Mat<eT>&
Mat<eT>::operator+=(const Glue<T1, T2, glue_times>& X) Mat<eT>::operator+=(const Glue<T1, T2, glue_times>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
skipping to change at line 2065 skipping to change at line 2053
void void
Mat<eT>::copy_size(const Mat<eT2>& m) Mat<eT>::copy_size(const Mat<eT2>& m)
{ {
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
inline inline
void void
Mat<eT>::fill(const eT val) Mat<eT>::fill(const eT val)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
for(u32 i=0; i<n_elem; ++i) eT* local_ptr = memptr();
const u32 local_n_elem = n_elem;
u32 i,j;
for(i=0, j=1; j<local_n_elem; i+=2, j+=2)
{ {
access::rw(mem[i]) = val; local_ptr[i] = val;
local_ptr[j] = val;
}
if(i < local_n_elem)
{
local_ptr[i] = val;
} }
} }
template<typename eT> template<typename eT>
inline inline
void void
Mat<eT>::zeros() Mat<eT>::zeros()
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
skipping to change at line 2274 skipping to change at line 2274
//! prefix ++ //! prefix ++
template<typename eT> template<typename eT>
arma_inline arma_inline
void void
Mat_aux::prefix_pp(Mat<eT>& x) Mat_aux::prefix_pp(Mat<eT>& x)
{ {
eT* memptr = x.memptr(); eT* memptr = x.memptr();
const u32 n_elem = x.n_elem; const u32 n_elem = x.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)
{
++(memptr[i]);
++(memptr[j]);
}
if(i < n_elem)
{ {
++(memptr[i]); ++(memptr[i]);
} }
} }
//! prefix ++ for complex numbers (work around for limitations of the std:: complex class) //! prefix ++ for complex numbers (work around for limitations of the std:: complex class)
template<typename T> template<typename T>
arma_inline arma_inline
void void
Mat_aux::prefix_pp(Mat< std::complex<T> >& x) Mat_aux::prefix_pp(Mat< std::complex<T> >& x)
skipping to change at line 2298 skipping to change at line 2306
//! postfix ++ //! postfix ++
template<typename eT> template<typename eT>
arma_inline arma_inline
void void
Mat_aux::postfix_pp(Mat<eT>& x) Mat_aux::postfix_pp(Mat<eT>& x)
{ {
eT* memptr = x.memptr(); eT* memptr = x.memptr();
const u32 n_elem = x.n_elem; const u32 n_elem = x.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)
{
(memptr[i])++;
(memptr[j])++;
}
if(i < n_elem)
{ {
(memptr[i])++; (memptr[i])++;
} }
} }
//! postfix ++ for complex numbers (work around for limitations of the std: :complex class) //! postfix ++ for complex numbers (work around for limitations of the std: :complex class)
template<typename T> template<typename T>
arma_inline arma_inline
void void
Mat_aux::postfix_pp(Mat< std::complex<T> >& x) Mat_aux::postfix_pp(Mat< std::complex<T> >& x)
skipping to change at line 2322 skipping to change at line 2338
//! prefix -- //! prefix --
template<typename eT> template<typename eT>
arma_inline arma_inline
void void
Mat_aux::prefix_mm(Mat<eT>& x) Mat_aux::prefix_mm(Mat<eT>& x)
{ {
eT* memptr = x.memptr(); eT* memptr = x.memptr();
const u32 n_elem = x.n_elem; const u32 n_elem = x.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)
{
--(memptr[i]);
--(memptr[j]);
}
if(i < n_elem)
{ {
--(memptr[i]); --(memptr[i]);
} }
} }
//! prefix -- for complex numbers (work around for limitations of the std:: complex class) //! prefix -- for complex numbers (work around for limitations of the std:: complex class)
template<typename T> template<typename T>
arma_inline arma_inline
void void
Mat_aux::prefix_mm(Mat< std::complex<T> >& x) Mat_aux::prefix_mm(Mat< std::complex<T> >& x)
skipping to change at line 2346 skipping to change at line 2370
//! postfix -- //! postfix --
template<typename eT> template<typename eT>
arma_inline arma_inline
void void
Mat_aux::postfix_mm(Mat<eT>& x) Mat_aux::postfix_mm(Mat<eT>& x)
{ {
eT* memptr = x.memptr(); eT* memptr = x.memptr();
const u32 n_elem = x.n_elem; const u32 n_elem = x.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)
{
(memptr[i])--;
(memptr[j])--;
}
if(i < n_elem)
{ {
(memptr[i])--; (memptr[i])--;
} }
} }
//! postfix ++ for complex numbers (work around for limitations of the std: :complex class) //! postfix ++ for complex numbers (work around for limitations of the std: :complex class)
template<typename T> template<typename T>
arma_inline arma_inline
void void
Mat_aux::postfix_mm(Mat< std::complex<T> >& x) Mat_aux::postfix_mm(Mat< std::complex<T> >& x)
 End of changes. 27 change blocks. 
116 lines changed or deleted 146 lines changed or added


 Mat_proto.hpp   Mat_proto.hpp 
skipping to change at line 196 skipping to change at line 196
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 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_rows, const u32 in_cols); inline void set_size(const u32 in_rows, const u32 in_cols);
inline void fill(const eT val); arma_hot inline void fill(const eT val);
inline void zeros(); inline void zeros();
inline void zeros(const u32 in_rows, const u32 in_cols); inline void zeros(const u32 in_rows, const u32 in_cols);
inline void ones(); inline void ones();
inline void ones(const u32 in_rows, const u32 in_cols); inline void ones(const u32 in_rows, const u32 in_cols);
inline void reset(); inline void reset();
inline void save(const std::string name, const file_type type = arma_bi nary) const; inline void save(const std::string name, const file_type type = arma_bi nary) const;
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 Proxy.hpp   Proxy.hpp 
skipping to change at line 53 skipping to change at line 53
inline explicit Proxy(const Mat<eT>& A) inline explicit Proxy(const Mat<eT>& A)
: Q(A) : Q(A)
, n_rows(A.n_rows) , n_rows(A.n_rows)
, n_cols(A.n_cols) , n_cols(A.n_cols)
, n_elem(A.n_elem) , 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)
: Q(Q)
, n_rows(in_n_rows)
, 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); }
}; };
template<typename eT> template<typename eT>
class Proxy< Col<eT> > class Proxy< Col<eT> >
{ {
public: public:
typedef eT elem_type; typedef eT elem_type;
skipping to change at line 81 skipping to change at line 90
inline explicit Proxy(const Col<eT>& A) inline explicit Proxy(const Col<eT>& A)
: Q(A) : Q(A)
, n_rows(A.n_rows) , n_rows(A.n_rows)
, n_cols(A.n_cols) , n_cols(A.n_cols)
, n_elem(A.n_elem) , 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)
: Q(Q)
, n_rows(in_n_rows)
, 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); }
}; };
template<typename eT> template<typename eT>
class Proxy< Row<eT> > class Proxy< Row<eT> >
{ {
public: public:
typedef eT elem_type; typedef eT elem_type;
skipping to change at line 109 skipping to change at line 127
inline explicit Proxy(const Row<eT>& A) inline explicit Proxy(const Row<eT>& A)
: Q(A) : Q(A)
, n_rows(A.n_rows) , n_rows(A.n_rows)
, n_cols(A.n_cols) , n_cols(A.n_cols)
, n_elem(A.n_elem) , 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)
: Q(Q)
, n_rows(in_n_rows)
, 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); }
}; };
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;
skipping to change at line 242 skipping to change at line 269
typedef eOp<T1, eop_type> stored_type; typedef eOp<T1, eop_type> stored_type;
const eOp<T1, eop_type>& Q; const eOp<T1, eop_type>& Q;
const u32 n_rows; const u32 n_rows;
const u32 n_cols; const u32 n_cols;
const u32 n_elem; 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.n_rows) , n_rows(A.P.n_rows)
, n_cols(A.n_cols) , n_cols(A.P.n_cols)
, n_elem(A.n_elem) , n_elem(A.P.n_elem)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
} }
arma_inline elem_type operator[] (const u32 i) const { r eturn eop_type::get_elem(Q, i); } arma_inline elem_type operator[] (const u32 i) const { r eturn eop_type::get_elem(Q, i); }
arma_inline elem_type at (const u32 row, const u32 col) const { r eturn eop_type::get_elem(Q, row,col); } arma_inline elem_type at (const u32 row, const u32 col) const { r eturn eop_type::get_elem(Q, row,col); }
}; };
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 > >
skipping to change at line 270 skipping to change at line 297
typedef eGlue<T1, T2, eglue_type> stored_type; typedef eGlue<T1, T2, eglue_type> stored_type;
const eGlue<T1, T2, eglue_type>& Q; const eGlue<T1, T2, eglue_type>& Q;
const u32 n_rows; const u32 n_rows;
const u32 n_cols; const u32 n_cols;
const u32 n_elem; 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.n_rows) , n_rows(A.P1.n_rows)
, n_cols(A.n_cols) , n_cols(A.P1.n_cols)
, n_elem(A.n_elem) , n_elem(A.P1.n_elem)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
} }
arma_inline elem_type operator[] (const u32 i) const { r eturn eglue_type::get_elem(Q, i); } arma_inline elem_type operator[] (const u32 i) const { r eturn eglue_type::get_elem(Q, i); }
arma_inline elem_type at (const u32 row, const u32 col) const { r eturn eglue_type::get_elem(Q, row, col); } arma_inline elem_type at (const u32 row, const u32 col) const { r eturn eglue_type::get_elem(Q, row, col); }
}; };
//! @} //! @}
 End of changes. 5 change blocks. 
6 lines changed or deleted 33 lines changed or added


 ProxyCube.hpp   ProxyCube.hpp 
skipping to change at line 57 skipping to change at line 57
: Q (A) : Q (A)
, n_rows (A.n_rows) , n_rows (A.n_rows)
, n_cols (A.n_cols) , n_cols (A.n_cols)
, n_elem_slice(A.n_elem_slice) , n_elem_slice(A.n_elem_slice)
, n_slices (A.n_slices) , n_slices (A.n_slices)
, n_elem (A.n_elem) , 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
u32 in_n_slices)
: Q (Q)
, n_rows (in_n_rows)
, n_cols (in_n_cols)
, 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); }
}; };
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;
skipping to change at line 176 skipping to change at line 187
const eOpCube<T1, eop_type>& Q; const eOpCube<T1, eop_type>& Q;
const u32 n_rows; const u32 n_rows;
const u32 n_cols; const u32 n_cols;
const u32 n_elem_slice; const u32 n_elem_slice;
const u32 n_slices; const u32 n_slices;
const u32 n_elem; 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.n_rows) , n_rows (A.P.n_rows)
, n_cols (A.n_cols) , n_cols (A.P.n_cols)
, n_elem_slice(A.n_elem_slice) , n_elem_slice(A.P.n_elem_slice)
, n_slices (A.n_slices) , n_slices (A.P.n_slices)
, n_elem (A.n_elem) , n_elem (A.P.n_elem)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
} }
arma_inline elem_type operator[] (const u32 i) const { return eop_type::get_elem(Q, i); } arma_inline elem_type operator[] (const u32 i) const { return eop_type::get_elem(Q, i); }
arma_inline elem_type at (const u32 row, const u32 col, const u32 slice) const { return eop_type::get_elem(Q, row, col, slice); } arma_inline elem_type at (const u32 row, const u32 col, const u32 slice) const { return eop_type::get_elem(Q, row, col, slice); }
}; };
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 > >
skipping to change at line 208 skipping to change at line 219
const eGlueCube<T1, T2, eglue_type>& Q; const eGlueCube<T1, T2, eglue_type>& Q;
const u32 n_rows; const u32 n_rows;
const u32 n_cols; const u32 n_cols;
const u32 n_elem_slice; const u32 n_elem_slice;
const u32 n_slices; const u32 n_slices;
const u32 n_elem; 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.n_rows) , n_rows (A.P1.n_rows)
, n_cols (A.n_cols) , n_cols (A.P1.n_cols)
, n_elem_slice(A.n_elem_slice) , n_elem_slice(A.P1.n_elem_slice)
, n_slices (A.n_slices) , n_slices (A.P1.n_slices)
, n_elem (A.n_elem) , n_elem (A.P1.n_elem)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
} }
arma_inline elem_type operator[] (const u32 i) const { return eglue_type::get_elem(Q, i); } arma_inline elem_type operator[] (const u32 i) const { return eglue_type::get_elem(Q, i); }
arma_inline elem_type at (const u32 row, const u32 col, const u32 slice) const { return eglue_type::get_elem(Q, row, col, slice); } arma_inline elem_type at (const u32 row, const u32 col, const u32 slice) const { return eglue_type::get_elem(Q, row, col, slice); }
}; };
//! @} //! @}
 End of changes. 3 change blocks. 
10 lines changed or deleted 22 lines changed or added


 armadillo   armadillo 
skipping to change at line 38 skipping to change at line 38
#include <fstream> #include <fstream>
#include <sstream> #include <sstream>
#include <stdexcept> #include <stdexcept>
#include <limits> #include <limits>
#include <algorithm> #include <algorithm>
#include <complex> #include <complex>
#include <vector> #include <vector>
#if defined(ARMA_HAVE_GETTIMEOFDAY) #if defined(ARMA_HAVE_GETTIMEOFDAY)
#include <sys/time.h> #include <sys/time.h>
#undef ARMA_USE_BOOST_DATE
#endif #endif
#if defined(ARMA_USE_BOOST) #if defined(ARMA_USE_BOOST)
#include <boost/format.hpp>
#include <boost/current_function.hpp>
#include <boost/math/complex.hpp> #include <boost/math/complex.hpp>
#include <boost/math/special_functions/acosh.hpp> #include <boost/math/special_functions/acosh.hpp>
#include <boost/math/special_functions/asinh.hpp> #include <boost/math/special_functions/asinh.hpp>
#include <boost/math/special_functions/atanh.hpp> #include <boost/math/special_functions/atanh.hpp>
#include <boost/current_function.hpp>
#if defined(ARMA_EXTRA_DEBUG)
#include <boost/format.hpp>
#define ARMA_USE_BOOST_FORMAT
#endif
#endif #endif
#if defined(ARMA_USE_BOOST_DATE) #if defined(ARMA_USE_BOOST_DATE)
#include <boost/date_time/posix_time/posix_time.hpp> #include <boost/date_time/posix_time/posix_time.hpp>
#endif #endif
#if defined(ARMA_USE_ATLAS) #if defined(ARMA_USE_ATLAS)
#define ARMA_TMP_STRING(x) x #define ARMA_TMP_STRING(x) x
#define ARMA_ATLAS_INCLUDE_1 <ARMA_TMP_STRING(ARMA_ATLAS_INCLUDE_DIR)/ARM A_TMP_STRING(cblas.h)> #define ARMA_ATLAS_INCLUDE_1 <ARMA_TMP_STRING(ARMA_ATLAS_INCLUDE_DIR)/ARM A_TMP_STRING(cblas.h)>
skipping to change at line 163 skipping to change at line 168
#include "armadillo_bits/op_repmat_proto.hpp" #include "armadillo_bits/op_repmat_proto.hpp"
#include "armadillo_bits/op_reshape_proto.hpp" #include "armadillo_bits/op_reshape_proto.hpp"
#include "armadillo_bits/op_cov_proto.hpp" #include "armadillo_bits/op_cov_proto.hpp"
#include "armadillo_bits/op_cor_proto.hpp" #include "armadillo_bits/op_cor_proto.hpp"
#include "armadillo_bits/op_shuffle_proto.hpp" #include "armadillo_bits/op_shuffle_proto.hpp"
#include "armadillo_bits/op_prod_proto.hpp" #include "armadillo_bits/op_prod_proto.hpp"
#include "armadillo_bits/op_pinv_proto.hpp" #include "armadillo_bits/op_pinv_proto.hpp"
#include "armadillo_bits/op_dotext_proto.hpp" #include "armadillo_bits/op_dotext_proto.hpp"
#include "armadillo_bits/op_flip_proto.hpp" #include "armadillo_bits/op_flip_proto.hpp"
#include "armadillo_bits/op_princomp_proto.hpp" #include "armadillo_bits/op_princomp_proto.hpp"
#include "armadillo_bits/op_princomp_cov_proto.hpp"
#include "armadillo_bits/glue_times_proto.hpp" #include "armadillo_bits/glue_times_proto.hpp"
#include "armadillo_bits/glue_cov_proto.hpp" #include "armadillo_bits/glue_cov_proto.hpp"
#include "armadillo_bits/glue_cor_proto.hpp" #include "armadillo_bits/glue_cor_proto.hpp"
#include "armadillo_bits/glue_kron_proto.hpp" #include "armadillo_bits/glue_kron_proto.hpp"
// //
// debugging functions // debugging functions
#include "armadillo_bits/debug.hpp" #include "armadillo_bits/debug.hpp"
skipping to change at line 281 skipping to change at line 287
#include "armadillo_bits/fn_cor.hpp" #include "armadillo_bits/fn_cor.hpp"
#include "armadillo_bits/fn_shuffle.hpp" #include "armadillo_bits/fn_shuffle.hpp"
#include "armadillo_bits/fn_prod.hpp" #include "armadillo_bits/fn_prod.hpp"
#include "armadillo_bits/fn_eps.hpp" #include "armadillo_bits/fn_eps.hpp"
#include "armadillo_bits/fn_pinv.hpp" #include "armadillo_bits/fn_pinv.hpp"
#include "armadillo_bits/fn_rank.hpp" #include "armadillo_bits/fn_rank.hpp"
#include "armadillo_bits/fn_kron.hpp" #include "armadillo_bits/fn_kron.hpp"
#include "armadillo_bits/fn_flip.hpp" #include "armadillo_bits/fn_flip.hpp"
#include "armadillo_bits/fn_as_scalar.hpp" #include "armadillo_bits/fn_as_scalar.hpp"
#include "armadillo_bits/fn_princomp.hpp" #include "armadillo_bits/fn_princomp.hpp"
#include "armadillo_bits/fn_princomp_cov.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/eop_cube_core_meat.hpp"
skipping to change at line 337 skipping to change at line 344
#include "armadillo_bits/op_repmat_meat.hpp" #include "armadillo_bits/op_repmat_meat.hpp"
#include "armadillo_bits/op_reshape_meat.hpp" #include "armadillo_bits/op_reshape_meat.hpp"
#include "armadillo_bits/op_cov_meat.hpp" #include "armadillo_bits/op_cov_meat.hpp"
#include "armadillo_bits/op_cor_meat.hpp" #include "armadillo_bits/op_cor_meat.hpp"
#include "armadillo_bits/op_shuffle_meat.hpp" #include "armadillo_bits/op_shuffle_meat.hpp"
#include "armadillo_bits/op_prod_meat.hpp" #include "armadillo_bits/op_prod_meat.hpp"
#include "armadillo_bits/op_pinv_meat.hpp" #include "armadillo_bits/op_pinv_meat.hpp"
#include "armadillo_bits/op_dotext_meat.hpp" #include "armadillo_bits/op_dotext_meat.hpp"
#include "armadillo_bits/op_flip_meat.hpp" #include "armadillo_bits/op_flip_meat.hpp"
#include "armadillo_bits/op_princomp_meat.hpp" #include "armadillo_bits/op_princomp_meat.hpp"
#include "armadillo_bits/op_princomp_cov_meat.hpp"
#include "armadillo_bits/glue_times_meat.hpp" #include "armadillo_bits/glue_times_meat.hpp"
#include "armadillo_bits/glue_cov_meat.hpp" #include "armadillo_bits/glue_cov_meat.hpp"
#include "armadillo_bits/glue_cor_meat.hpp" #include "armadillo_bits/glue_cor_meat.hpp"
#include "armadillo_bits/glue_kron_meat.hpp" #include "armadillo_bits/glue_kron_meat.hpp"
} }
#endif #endif
 End of changes. 6 change blocks. 
2 lines changed or deleted 10 lines changed or added


 auxlib_meat.hpp   auxlib_meat.hpp 
skipping to change at line 1187 skipping to change at line 1187
inline inline
bool bool
auxlib::svd(Col<eT>& S, const Mat<eT>& X) auxlib::svd(Col<eT>& S, const Mat<eT>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
#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> V(1, A.n_cols);
char jobu = 'N'; char jobu = 'N';
char jobvt = 'N'; char jobvt = 'N';
int m = A.n_rows; int m = A.n_rows;
int n = A.n_cols; int n = A.n_cols;
int lda = A.n_rows; int lda = A.n_rows;
int ldu = A.n_rows; int ldu = U.n_rows;
int ldvt = A.n_cols; int ldvt = V.n_rows;
int lwork = 2; int lwork = 2 * (std::max)(1, (std::max)( (3*(std::min)(m,n) + (std::m
ax)(m,n)), 5*(std::min)(m,n) ) );
int info; int info;
Mat<eT> U(1,1);
Mat<eT> V(1,1);
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; int lwork_tmp = -1;
lapack::gesvd_<eT> lapack::gesvd_<eT>
( (
&jobu, &jobvt, &jobu, &jobvt,
skipping to change at line 1222 skipping to change at line 1222
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)
{ {
lwork = static_cast<int>(work[0]); int proposed_lwork = static_cast<int>(work[0]);
work.set_size(lwork);
if(proposed_lwork > lwork)
{
lwork = proposed_lwork;
work.set_size(lwork);
}
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, work.memptr(), &lwork,
&info &info
); );
return (info == 0);
}
else
{
return false;
} }
return (info == 0);
} }
#else #else
{ {
arma_stop("svd(): need LAPACK"); arma_stop("svd(): need LAPACK");
return false; return false;
} }
#endif #endif
} }
template<typename T> template<typename T>
skipping to change at line 1265 skipping to change at line 1266
auxlib::svd(Col<T>& S, const Mat< std::complex<T> >& X) auxlib::svd(Col<T>& S, const Mat< std::complex<T> >& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef std::complex<T> eT; typedef std::complex<T> eT;
#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> V(1, A.n_cols);
char jobu = 'N'; char jobu = 'N';
char jobvt = 'N'; char jobvt = 'N';
int m = A.n_rows; int m = A.n_rows;
int n = A.n_cols; int n = A.n_cols;
int lda = A.n_rows; int lda = A.n_rows;
int ldu = A.n_rows; int ldu = U.n_rows;
int ldvt = A.n_cols; int ldvt = V.n_rows;
int lwork = 2 * (std::min)(m,n) + (std::max)(m,n); int lwork = 2 * (std::max)(1, 2*(std::min)(m,n)+(std::max)(m,n) );
int info; int info;
Mat<eT> U(1,1);
Mat<eT> V(1,1);
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; int lwork_tmp = -1;
lapack::cx_gesvd_<T> lapack::cx_gesvd_<T>
( (
skipping to change at line 1321 skipping to change at line 1322
&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, work.memptr(), &lwork,
rwork.memptr(), rwork.memptr(),
&info &info
); );
return (info == 0);
}
else
{
return false;
} }
return (info == 0);
} }
#else #else
{ {
arma_stop("svd(): need LAPACK"); arma_stop("svd(): need LAPACK");
return false; return false;
} }
#endif #endif
} }
template<typename eT> template<typename eT>
inline inline
bool bool
auxlib::svd(Mat<eT>& U, Col<eT>& S, Mat<eT>& V, const Mat<eT>& X) auxlib::svd(Mat<eT>& U, Col<eT>& S, Mat<eT>& V, const Mat<eT>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
#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);
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; int m = A.n_rows;
int n = A.n_cols; int n = A.n_cols;
int lda = A.n_rows; int lda = A.n_rows;
int ldu = A.n_rows; int ldu = U.n_rows;
int ldvt = A.n_cols; int ldvt = V.n_rows;
int lwork = 2; int lwork = 2 * (std::max)(1, (std::max)( (3*(std::min)(m,n) + (std::m
ax)(m,n)), 5*(std::min)(m,n) ) );
int info; int info;
U.set_size(m,m);
V.set_size(n,n);
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; 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)
{ {
lwork = static_cast<int>(work[0]); int proposed_lwork = static_cast<int>(work[0]);
work.set_size(lwork); if(proposed_lwork > lwork)
{
lwork = proposed_lwork;
work.set_size(lwork);
}
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, work.memptr(), &lwork,
&info &info
); );
op_trans::apply(V,V); // op_trans will work out that an in-place tra nspose can be done op_trans::apply(V,V); // op_trans will work out that an in-place tra nspose can be done
return (info == 0);
}
else
{
return false;
} }
return (info == 0);
} }
#else #else
{ {
arma_stop("svd(): need LAPACK"); arma_stop("svd(): need LAPACK");
return false; return false;
} }
#endif #endif
} }
template<typename T> template<typename T>
inline inline
bool bool
auxlib::svd(Mat< std::complex<T> >& U, Col<T> &S, Mat< std::complex<T> >& V , const Mat< std::complex<T> >& X) auxlib::svd(Mat< std::complex<T> >& U, Col<T>& S, Mat< std::complex<T> >& V , const Mat< std::complex<T> >& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef std::complex<T> eT; typedef std::complex<T> eT;
#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);
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; int m = A.n_rows;
int n = A.n_cols; int n = A.n_cols;
int lda = A.n_rows; int lda = A.n_rows;
int ldu = A.n_rows; int ldu = U.n_rows;
int ldvt = A.n_cols; int ldvt = V.n_rows;
int lwork = 2; int lwork = 2 * (std::max)(1, 2*(std::min)(m,n)+(std::max)(m,n) );
int info; int info;
U.set_size(m,m);
V.set_size(n,n);
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; int lwork_tmp = -1;
lapack::cx_gesvd_<T> lapack::cx_gesvd_<T>
( (
&jobu, &jobvt, &jobu, &jobvt,
skipping to change at line 1463 skipping to change at line 1460
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)
{ {
lwork = static_cast<int>(real(work[0])); int proposed_lwork = static_cast<int>(real(work[0]));
work.set_size(lwork); if(proposed_lwork > lwork)
{
lwork = proposed_lwork;
work.set_size(lwork);
}
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, work.memptr(), &lwork,
rwork.memptr(), rwork.memptr(),
&info &info
); );
op_htrans::apply(V,V); // op_htrans will work out that an in-place t ranspose can be done op_htrans::apply(V,V); // op_htrans will work out that an in-place t ranspose can be done
for(u32 i=0; i<A.n_cols; ++i)
{
V.at(i,i) = std::conj( V.at(i,i) );
}
return (info == 0);
}
else
{
return false;
} }
return (info == 0);
} }
#else #else
{ {
arma_stop("svd(): need LAPACK"); arma_stop("svd(): need LAPACK");
return false; return false;
} }
#endif #endif
} }
 End of changes. 24 change blocks. 
60 lines changed or deleted 54 lines changed or added


 compiler_setup.hpp   compiler_setup.hpp 
skipping to change at line 17 skipping to change at line 17
// 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)
#define arma_hot #define arma_hot
#define arma_cold
#define arma_pure #define arma_pure
#define arma_const #define arma_const
#define arma_inline inline #define arma_inline inline
#define arma_aligned #define arma_aligned
#define arma_warn_unused
#if defined(__GNUG__) #if defined(__GNUG__)
#if (__GNUC__ < 4) #if (__GNUC__ < 4)
#error "*** Need a newer compiler ***" #error "*** Need a newer compiler ***"
#endif #endif
#if (__GNUC_MINOR__ >= 3) #if (__GNUC_MINOR__ >= 3)
#undef arma_hot #undef arma_hot
#define arma_hot __attribute__((hot)) #undef arma_cold
#define arma_hot __attribute__((hot))
#define arma_cold __attribute__((cold))
#endif #endif
#undef arma_pure #undef arma_pure
#undef arma_const #undef arma_const
#undef arma_inline #undef arma_inline
#undef arma_aligned #undef arma_aligned
#undef arma_warn_unused
#define arma_pure __attribute__((pure)) #define arma_pure __attribute__((pure))
#define arma_const __attribute__((const)) #define arma_const __attribute__((const))
#define arma_inline inline __attribute__((always_inline)) #define arma_inline inline __attribute__((always_inline))
#define arma_aligned __attribute__((aligned)) #define arma_aligned __attribute__((aligned))
#define arma_warn_unused __attribute__((warn_unused_result))
#define ARMA_GOOD_COMPILER #define ARMA_GOOD_COMPILER
#elif defined(__INTEL_COMPILER) #elif defined(__INTEL_COMPILER)
#if (__INTEL_COMPILER < 1000) #if (__INTEL_COMPILER < 1000)
#error "*** Need a newer compiler ***" #error "*** Need a newer compiler ***"
#endif #endif
#define ARMA_GOOD_COMPILER #define ARMA_GOOD_COMPILER
 End of changes. 6 change blocks. 
6 lines changed or deleted 13 lines changed or added


 debug.hpp   debug.hpp 
skipping to change at line 65 skipping to change at line 65
} }
template<typename T1, typename T2> template<typename T1, typename T2>
inline inline
void void
arma_print(const T1& x, const T2& y) arma_print(const T1& x, const T2& y)
{ {
std::cout << x << y << std::endl; std::cout << x << y << std::endl;
} }
#ifdef ARMA_USE_BOOST #ifdef ARMA_USE_BOOST_FORMAT
template<typename T1> template<typename T1>
inline inline
void void
arma_print(const arma_boost::basic_format<T1>& x) arma_print(const arma_boost::basic_format<T1>& x)
{ {
std::cout << x << std::endl; std::cout << x << std::endl;
} }
#else #else
template<typename T1, typename T2> template<typename T1, typename T2>
inline inline
skipping to change at line 122 skipping to change at line 122
} }
template<typename T1, typename T2> template<typename T1, typename T2>
inline inline
void void
arma_bktprint(const T1& x, const T2& y) arma_bktprint(const T1& x, const T2& y)
{ {
std::cout << " [" << x << y << ']' << std::endl; std::cout << " [" << x << y << ']' << std::endl;
} }
#ifdef ARMA_USE_BOOST #ifdef ARMA_USE_BOOST_FORMAT
template<typename T1> template<typename T1>
inline inline
void void
arma_bktprint(const arma_boost::basic_format<T1>& x) arma_bktprint(const arma_boost::basic_format<T1>& x)
{ {
std::cout << " [" << x << ']' << std::endl; std::cout << " [" << x << ']' << std::endl;
} }
#else #else
template<typename T1, typename T2> template<typename T1, typename T2>
inline inline
skipping to change at line 178 skipping to change at line 178
void void
arma_hot arma_hot
arma_warn(const bool state, const T1& x, const T2& y) arma_warn(const bool state, const T1& x, const T2& y)
{ {
if(state==true) if(state==true)
{ {
arma_print(x,y); arma_print(x,y);
} }
} }
#ifdef ARMA_USE_BOOST #ifdef ARMA_USE_BOOST_FORMAT
template<typename T1> template<typename T1>
inline inline
void void
arma_hot arma_hot
arma_warn(const bool state, const arma_boost::basic_format<T1>& x) arma_warn(const bool state, const arma_boost::basic_format<T1>& x)
{ {
if(state==true) if(state==true)
arma_print(x); arma_print(x);
} }
#else #else
skipping to change at line 228 skipping to change at line 228
void void
arma_hot arma_hot
arma_check(const bool state, const T1& x, const T2& y) arma_check(const bool state, const T1& x, const T2& y)
{ {
if(state==true) if(state==true)
{ {
arma_stop( std::string(x) + std::string(y) ); arma_stop( std::string(x) + std::string(y) );
} }
} }
#ifdef ARMA_USE_BOOST #ifdef ARMA_USE_BOOST_FORMAT
template<typename T1> template<typename T1>
inline inline
void void
arma_hot arma_hot
arma_check(const bool state, const arma_boost::basic_format<T1>& x) arma_check(const bool state, const arma_boost::basic_format<T1>& x)
{ {
if(state==true) if(state==true)
{ {
arma_stop(str(x)); arma_stop(str(x));
} }
 End of changes. 4 change blocks. 
4 lines changed or deleted 4 lines changed or added


 eGlueCube_meat.hpp   eGlueCube_meat.hpp 
skipping to change at line 29 skipping to change at line 29
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() eGlueCube<T1,T2,eglue_type>::~eGlueCube()
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
} }
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)
, n_rows (P1.n_rows)
, n_cols (P1.n_cols)
, n_elem_slice(P1.n_elem_slice)
, n_slices (P1.n_slices)
, n_elem (P1.n_elem)
{ {
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_ cols, P2.n_slices, eglue_type::id()); arma_assert_same_size(P1.n_rows, P1.n_cols, P1.n_slices, P2.n_rows, P2.n_ cols, P2.n_slices, eglue_type::id());
} }
//! @} //! @}
 End of changes. 1 change blocks. 
7 lines changed or deleted 2 lines changed or added


 eGlueCube_proto.hpp   eGlueCube_proto.hpp 
skipping to change at line 30 skipping to change at line 30
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; const ProxyCube<T1> P1;
const ProxyCube<T2> P2; const ProxyCube<T2> P2;
const u32 n_rows;
const u32 n_cols;
const u32 n_elem_slice;
const u32 n_slices;
const u32 n_elem;
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);
}; };
//! @} //! @}
 End of changes. 1 change blocks. 
6 lines changed or deleted 0 lines changed or added


 eGlue_meat.hpp   eGlue_meat.hpp 
skipping to change at line 31 skipping to change at line 31
eGlue<T1,T2,eglue_type>::~eGlue() eGlue<T1,T2,eglue_type>::~eGlue()
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
} }
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)
, n_rows(P1.n_rows)
, n_cols(P1.n_cols)
, n_elem(P1.n_elem)
{ {
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 ype::id()); arma_assert_same_size(P1.n_rows, P1.n_cols, P2.n_rows, P2.n_cols, eglue_t ype::id());
} }
//! @} //! @}
 End of changes. 1 change blocks. 
3 lines changed or deleted 0 lines changed or added


 eGlue_proto.hpp   eGlue_proto.hpp 
skipping to change at line 30 skipping to change at line 30
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; const Proxy<T1> P1;
const Proxy<T2> P2; const Proxy<T2> P2;
const u32 n_rows;
const u32 n_cols;
const u32 n_elem;
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);
}; };
//! @} //! @}
 End of changes. 1 change blocks. 
4 lines changed or deleted 0 lines changed or added


 eOpCube_meat.hpp   eOpCube_meat.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 eOpCube //! \addtogroup eOpCube
//! @{ //! @{
template<typename T1, typename eop_type> template<typename T1, typename eop_type>
eOpCube<T1, eop_type>::eOpCube(const BaseCube<typename T1::elem_type, T1>& in_m) eOpCube<T1, eop_type>::eOpCube(const BaseCube<typename T1::elem_type, T1>& in_m)
: P (in_m.get_ref()) : P (in_m.get_ref())
, n_rows (P.n_rows) , aux (aux)
, n_cols (P.n_cols) , aux_u32_a (aux_u32_a)
, n_elem_slice(P.n_elem_slice) , aux_u32_b (aux_u32_b)
, n_slices (P.n_slices) , aux_u32_c (aux_u32_c)
, n_elem (P.n_elem)
, aux (aux)
, aux_u32_a (aux_u32_a)
, aux_u32_b (aux_u32_b)
, aux_u32_c (aux_u32_c)
{ {
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(const BaseCube<typename T1::elem_type, T1>& in_m, const typename T1::elem_type in_aux) eOpCube<T1, eop_type>::eOpCube(const BaseCube<typename T1::elem_type, T1>& in_m, const typename T1::elem_type in_aux)
: P (in_m.get_ref()) : P (in_m.get_ref())
, n_rows (P.n_rows) , aux (in_aux)
, n_cols (P.n_cols) , aux_u32_a (aux_u32_a)
, n_elem_slice(P.n_elem_slice) , aux_u32_b (aux_u32_b)
, n_slices (P.n_slices) , aux_u32_c (aux_u32_c)
, n_elem (P.n_elem)
, aux (in_aux)
, aux_u32_a (aux_u32_a)
, aux_u32_b (aux_u32_b)
, aux_u32_c (aux_u32_c)
{ {
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(const BaseCube<typename T1::elem_type, T1>& in_m, const u32 in_aux_u32_a, const u32 in_aux_u32_b) eOpCube<T1, eop_type>::eOpCube(const BaseCube<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())
, n_rows (P.n_rows) , aux (aux)
, n_cols (P.n_cols) , aux_u32_a (in_aux_u32_a)
, n_elem_slice(P.n_elem_slice) , aux_u32_b (in_aux_u32_b)
, n_slices (P.n_slices) , aux_u32_c (aux_u32_c)
, n_elem (P.n_elem)
, aux (aux)
, aux_u32_a (in_aux_u32_a)
, aux_u32_b (in_aux_u32_b)
, aux_u32_c (aux_u32_c)
{ {
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(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) eOpCube<T1, eop_type>::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)
: P (in_m.get_ref()) : P (in_m.get_ref())
, n_rows (P.n_rows) , aux (aux)
, n_cols (P.n_cols) , aux_u32_a (in_aux_u32_a)
, n_elem_slice(P.n_elem_slice) , aux_u32_b (in_aux_u32_b)
, n_slices (P.n_slices) , aux_u32_c (in_aux_u32_c)
, n_elem (P.n_elem)
, aux (aux)
, aux_u32_a (in_aux_u32_a)
, aux_u32_b (in_aux_u32_b)
, aux_u32_c (in_aux_u32_c)
{ {
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(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())
, n_rows (P.n_rows) , aux (in_aux)
, n_cols (P.n_cols) , aux_u32_a (in_aux_u32_a)
, n_elem_slice(P.n_elem_slice) , aux_u32_b (in_aux_u32_b)
, n_slices (P.n_slices) , aux_u32_c (in_aux_u32_c)
, n_elem (P.n_elem)
, aux (in_aux)
, aux_u32_a (in_aux_u32_a)
, aux_u32_b (in_aux_u32_b)
, aux_u32_c (in_aux_u32_c)
{ {
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(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 (P) : P (in_n_rows, in_n_cols, in_n_slices)
, n_rows (in_n_rows) , aux (aux)
, n_cols (in_n_cols) , aux_u32_a (aux_u32_a)
, n_elem_slice(n_rows*n_cols) , aux_u32_b (aux_u32_b)
, n_slices (in_n_slices) , aux_u32_c (aux_u32_c)
, n_elem (n_elem_slice*n_slices)
, aux (aux)
, aux_u32_a (aux_u32_a)
, aux_u32_b (aux_u32_b)
, aux_u32_c (aux_u32_c)
{ {
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();
} }
 End of changes. 6 change blocks. 
60 lines changed or deleted 30 lines changed or added


 eOpCube_proto.hpp   eOpCube_proto.hpp 
skipping to change at line 28 skipping to change at line 28
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; const ProxyCube<T1> P;
const u32 n_rows;
const u32 n_cols;
const u32 n_elem_slice;
const u32 n_slices;
const u32 n_elem;
const elem_type aux; //!< storage of auxiliary data, user defined format const elem_type aux; //!< storage of auxiliary data, user defined format
const u32 aux_u32_a; //!< storage of auxiliary data, u32 format const u32 aux_u32_a; //!< storage of auxiliary data, u32 format
const u32 aux_u32_b; //!< storage of auxiliary data, u32 format const u32 aux_u32_b; //!< storage of auxiliary data, u32 format
const u32 aux_u32_c; //!< storage of auxiliary data, u32 format 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);
 End of changes. 1 change blocks. 
5 lines changed or deleted 0 lines changed or added


 eOp_meat.hpp   eOp_meat.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 eOp //! \addtogroup eOp
//! @{ //! @{
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())
, n_rows(P.n_rows)
, n_cols(P.n_cols)
, n_elem(P.n_elem)
, 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(n_rows, n_cols) == false), eop_type: :error_msg() ); 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())
, n_rows(P.n_rows)
, n_cols(P.n_cols)
, n_elem(P.n_elem)
, 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(n_rows, n_cols) == false), eop_type: :error_msg() ); 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())
, n_rows(P.n_rows)
, n_cols(P.n_cols)
, n_elem(P.n_elem)
, 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(n_rows, n_cols) == false), eop_type: :error_msg() ); 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())
, n_rows(P.n_rows)
, n_cols(P.n_cols)
, n_elem(P.n_elem)
, 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(n_rows, n_cols) == false), eop_type: :error_msg() ); 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 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(P) : P(in_n_rows, in_n_cols)
, n_rows(in_n_rows)
, n_cols(in_n_cols)
, n_elem(n_rows*n_cols)
, 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(n_rows, n_cols) == false), eop_type: :error_msg() ); 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();
} }
//! @} //! @}
 End of changes. 10 change blocks. 
21 lines changed or deleted 6 lines changed or added


 eOp_proto.hpp   eOp_proto.hpp 
skipping to change at line 28 skipping to change at line 28
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;
const Proxy<T1> P; const Proxy<T1> P;
const u32 n_rows;
const u32 n_cols;
const u32 n_elem;
const elem_type aux; //!< storage of auxiliary data, user defined format const elem_type aux; //!< storage of auxiliary data, user defined format
const u32 aux_u32_a; //!< storage of auxiliary data, u32 format const u32 aux_u32_a; //!< storage of auxiliary data, u32 format
const u32 aux_u32_b; //!< storage of auxiliary data, u32 format 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);
 End of changes. 1 change blocks. 
4 lines changed or deleted 0 lines changed or added


 eglue_core_meat.hpp   eglue_core_meat.hpp 
skipping to change at line 96 skipping to change at line 96
eglue_core<eglue_type>::apply_proxy(Mat<typename T1::elem_type>& out, const eGlue<T1, T2, eglue_type>& x) eglue_core<eglue_type>::apply_proxy(Mat<typename T1::elem_type>& out, 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 // eglue_type::apply_proxy() function is not allowed to unwrap things
// (in order to get the input into a common format). // (in order to get the input into a common format).
// the proxy class is already providing objects with element access // the proxy class is already providing objects with element access
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
out.set_size(x.n_rows, x.n_cols); const Proxy<T1>& P1 = x.P1;
const Proxy<T2>& P2 = x.P2;
eT* out_mem = out.memptr(); out.set_size(P1.n_rows, P1.n_cols);
const Proxy<T1>& P1 = x.P1;
const Proxy<T2>& P2 = x.P2; eT* out_mem = out.memptr();
const u32 n_elem = x.n_elem; const u32 n_elem = P1.n_elem;
if(is_same_type<eglue_type, eglue_plus >::value == true) for(u32 i=0 ; i<n_elem; ++i) { out_mem[i] = P1[i] + P2[i]; } if(is_same_type<eglue_type, eglue_plus >::value == true) for(u32 i=0 ; i<n_elem; ++i) { out_mem[i] = P1[i] + P2[i]; }
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]; } 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]; }
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]; } 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]; }
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]; } 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]; }
else else
{ {
arma_stop("eglue_core::apply_proxy(): unhandled eglue_type"); arma_stop("eglue_core::apply_proxy(): unhandled eglue_type");
} }
} }
skipping to change at line 124 skipping to change at line 125
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_unwrap(Mat<typename T1::elem_type>& out, cons t eGlue<T1, T2, eglue_type>& x)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
out.set_size(x.n_rows, x.n_cols);
const unwrap<typename Proxy<T1>::stored_type> tmp1(x.P1.Q); const unwrap<typename Proxy<T1>::stored_type> tmp1(x.P1.Q);
const unwrap<typename Proxy<T2>::stored_type> tmp2(x.P2.Q); const unwrap<typename Proxy<T2>::stored_type> tmp2(x.P2.Q);
const Mat<eT>& A = tmp1.M; const Mat<eT>& A = tmp1.M;
const Mat<eT>& B = tmp2.M; const Mat<eT>& B = tmp2.M;
out.set_size(A.n_rows, A.n_cols);
eT* out_mem = out.memptr(); eT* out_mem = out.memptr();
const eT* A_mem = A.memptr(); const eT* A_mem = A.memptr();
const eT* B_mem = B.memptr(); const eT* B_mem = B.memptr();
const u32 n_elem = x.n_elem; const u32 n_elem = A.n_elem;
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]; } 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]; }
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]; } 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]; }
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]; } 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]; }
else if(is_same_type<eglue_type, eglue_schur>::value == true) for(u32 i=0 ; i<n_elem; ++i) { out_mem[i] = A_mem[i] * B_mem[i]; } else if(is_same_type<eglue_type, eglue_schur>::value == true) for(u32 i=0 ; i<n_elem; ++i) { out_mem[i] = A_mem[i] * B_mem[i]; }
else else
{ {
arma_stop("eglue_core::apply_unwrap(): unhandled eglue_type"); arma_stop("eglue_core::apply_unwrap(): unhandled eglue_type");
} }
} }
skipping to change at line 158 skipping to change at line 159
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(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; typedef typename T1::elem_type eT;
arma_assert_same_size(out.n_rows, out.n_cols, x.n_rows, x.n_cols, "matrix const Proxy<T1>& P1 = x.P1;
addition"); const Proxy<T2>& P2 = x.P2;
arma_assert_same_size(out.n_rows, out.n_cols, P1.n_rows, P1.n_cols, "matr
ix addition");
eT* out_mem = out.memptr(); eT* out_mem = out.memptr();
const Proxy<T1>& P1 = x.P1; const u32 n_elem = P1.n_elem;
const Proxy<T2>& P2 = x.P2;
const u32 n_elem = x.n_elem;
if(is_same_type<eglue_type, eglue_plus >::value == true) for(u32 i=0 ; i<n_elem; ++i) { out_mem[i] += P1[i] + P2[i]; } if(is_same_type<eglue_type, eglue_plus >::value == true) for(u32 i=0 ; i<n_elem; ++i) { out_mem[i] += P1[i] + P2[i]; }
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]; } 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]; }
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]; } 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]; }
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]; } 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]; }
else else
{ {
arma_stop("eglue_core::apply_inplace_plus(): unhandled eglue_type"); arma_stop("eglue_core::apply_inplace_plus(): unhandled eglue_type");
} }
} }
skipping to change at line 186 skipping to change at line 188
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(Mat<typename T1::elem_type>& ou t, const eGlue<T1, T2, eglue_type>& x)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
arma_assert_same_size(out.n_rows, out.n_cols, x.n_rows, x.n_cols, "matrix const Proxy<T1>& P1 = x.P1;
subtraction"); const Proxy<T2>& P2 = x.P2;
eT* out_mem = out.memptr(); arma_assert_same_size(out.n_rows, out.n_cols, P1.n_rows, P1.n_cols, "matr
const Proxy<T1>& P1 = x.P1; ix subtraction");
const Proxy<T2>& P2 = x.P2;
const u32 n_elem = x.n_elem; 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 ; i<n_elem; ++i) { out_mem[i] -= P1[i] + P2[i]; } if(is_same_type<eglue_type, eglue_plus >::value == true) for(u32 i=0 ; i<n_elem; ++i) { out_mem[i] -= P1[i] + P2[i]; }
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]; } 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]; }
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]; } 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]; }
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]; } 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]; }
else else
{ {
arma_stop("eglue_core::apply_inplace_minus(): unhandled eglue_type"); arma_stop("eglue_core::apply_inplace_minus(): unhandled eglue_type");
} }
} }
skipping to change at line 214 skipping to change at line 217
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(Mat<typename T1::elem_type>& ou t, const eGlue<T1, T2, eglue_type>& x)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
arma_assert_same_size(out.n_rows, out.n_cols, x.n_rows, x.n_cols, "elemen const Proxy<T1>& P1 = x.P1;
t-wise matrix multiplication"); const Proxy<T2>& P2 = x.P2;
arma_assert_same_size(out.n_rows, out.n_cols, P1.n_rows, P1.n_cols, "elem
ent-wise matrix multiplication");
eT* out_mem = out.memptr(); eT* out_mem = out.memptr();
const Proxy<T1>& P1 = x.P1; const u32 n_elem = P1.n_elem;
const Proxy<T2>& P2 = x.P2;
const u32 n_elem = x.n_elem;
if(is_same_type<eglue_type, eglue_plus >::value == true) for(u32 i=0 ; i<n_elem; ++i) { out_mem[i] *= P1[i] + P2[i]; } if(is_same_type<eglue_type, eglue_plus >::value == true) for(u32 i=0 ; i<n_elem; ++i) { out_mem[i] *= P1[i] + P2[i]; }
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]; } 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]; }
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]; } 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]; }
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]; } 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]; }
else else
{ {
arma_stop("eglue_core::apply_inplace_schur(): unhandled eglue_type"); arma_stop("eglue_core::apply_inplace_schur(): unhandled eglue_type");
} }
} }
skipping to change at line 242 skipping to change at line 246
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(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; typedef typename T1::elem_type eT;
arma_assert_same_size(out.n_rows, out.n_cols, x.n_rows, x.n_cols, "elemen const Proxy<T1>& P1 = x.P1;
t-wise matrix division"); const Proxy<T2>& P2 = x.P2;
arma_assert_same_size(out.n_rows, out.n_cols, P1.n_rows, P1.n_cols, "elem
ent-wise matrix division");
eT* out_mem = out.memptr(); eT* out_mem = out.memptr();
const Proxy<T1>& P1 = x.P1; const u32 n_elem = P1.n_elem;
const Proxy<T2>& P2 = x.P2;
const u32 n_elem = x.n_elem;
if(is_same_type<eglue_type, eglue_plus >::value == true) for(u32 i=0 ; i<n_elem; ++i) { out_mem[i] /= P1[i] + P2[i]; } if(is_same_type<eglue_type, eglue_plus >::value == true) for(u32 i=0 ; i<n_elem; ++i) { out_mem[i] /= P1[i] + P2[i]; }
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]; } 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]; }
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]; } 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]; }
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]; } 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]; }
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. 13 change blocks. 
32 lines changed or deleted 37 lines changed or added


 eglue_cube_core_meat.hpp   eglue_cube_core_meat.hpp 
skipping to change at line 74 skipping to change at line 74
eglue_cube_core<eglue_type>::apply(Cube<typename T1::elem_type>& out, const eGlueCube<T1, T2, eglue_type>& x) eglue_cube_core<eglue_type>::apply(Cube<typename T1::elem_type>& out, const eGlueCube<T1, T2, eglue_type>& x)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
// eglue_type::apply() function is not allowed to unwrap things // eglue_type::apply() function is not allowed to unwrap things
// (in order to get the input into a common format). // (in order to get the input into a common format).
// the proxy class is already providing objects with element access // the proxy class is already providing objects with element access
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
out.set_size(x.n_rows, x.n_cols, x.n_slices); const ProxyCube<T1>& P1 = x.P1;
const ProxyCube<T2>& P2 = x.P2;
eT* out_mem = out.memptr(); out.set_size(P1.n_rows, P1.n_cols, P1.n_slices);
const ProxyCube<T1>& P1 = x.P1;
const ProxyCube<T2>& P2 = x.P2; eT* out_mem = out.memptr();
const u32 n_elem = x.n_elem; const u32 n_elem = P1.n_elem;
if(is_same_type<eglue_type, eglue_cube_plus >::value == true) for(u3 2 i=0; i<n_elem; ++i) { out_mem[i] = P1[i] + P2[i]; } if(is_same_type<eglue_type, eglue_cube_plus >::value == true) for(u3 2 i=0; i<n_elem; ++i) { out_mem[i] = P1[i] + P2[i]; }
else if(is_same_type<eglue_type, eglue_cube_minus>::value == true) for(u3 2 i=0; i<n_elem; ++i) { out_mem[i] = P1[i] - P2[i]; } else if(is_same_type<eglue_type, eglue_cube_minus>::value == true) for(u3 2 i=0; i<n_elem; ++i) { out_mem[i] = P1[i] - P2[i]; }
else if(is_same_type<eglue_type, eglue_cube_div >::value == true) for(u3 2 i=0; i<n_elem; ++i) { out_mem[i] = P1[i] / P2[i]; } else if(is_same_type<eglue_type, eglue_cube_div >::value == true) for(u3 2 i=0; i<n_elem; ++i) { out_mem[i] = P1[i] / P2[i]; }
else if(is_same_type<eglue_type, eglue_cube_schur>::value == true) for(u3 2 i=0; i<n_elem; ++i) { out_mem[i] = P1[i] * P2[i]; } else if(is_same_type<eglue_type, eglue_cube_schur>::value == true) for(u3 2 i=0; i<n_elem; ++i) { out_mem[i] = P1[i] * P2[i]; }
else else
{ {
arma_stop("eglue_cube_core::apply(): unhandled eglue_type"); arma_stop("eglue_cube_core::apply(): unhandled eglue_type");
} }
} }
skipping to change at line 102 skipping to change at line 103
template<typename T1, typename T2> template<typename T1, typename T2>
arma_hot arma_hot
inline inline
void void
eglue_cube_core<eglue_type>::apply_inplace_plus(Cube<typename T1::elem_type >& out, const eGlueCube<T1, T2, eglue_type>& x) eglue_cube_core<eglue_type>::apply_inplace_plus(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; typedef typename T1::elem_type eT;
arma_assert_same_size(out.n_rows, out.n_cols, out.n_slices, x.n_rows, x.n const ProxyCube<T1>& P1 = x.P1;
_cols, x.n_slices, "cube addition"); const ProxyCube<T2>& P2 = x.P2;
arma_assert_same_size(out.n_rows, out.n_cols, out.n_slices, P1.n_rows, P1
.n_cols, P1.n_slices, "cube addition");
eT* out_mem = out.memptr(); eT* out_mem = out.memptr();
const ProxyCube<T1>& P1 = x.P1; const u32 n_elem = P1.n_elem;
const ProxyCube<T2>& P2 = x.P2;
const u32 n_elem = x.n_elem;
if(is_same_type<eglue_type, eglue_cube_plus >::value == true) for(u3 2 i=0; i<n_elem; ++i) { out_mem[i] += P1[i] + P2[i]; } if(is_same_type<eglue_type, eglue_cube_plus >::value == true) for(u3 2 i=0; i<n_elem; ++i) { out_mem[i] += P1[i] + P2[i]; }
else if(is_same_type<eglue_type, eglue_cube_minus>::value == true) for(u3 2 i=0; i<n_elem; ++i) { out_mem[i] += P1[i] - P2[i]; } else if(is_same_type<eglue_type, eglue_cube_minus>::value == true) for(u3 2 i=0; i<n_elem; ++i) { out_mem[i] += P1[i] - P2[i]; }
else if(is_same_type<eglue_type, eglue_cube_div >::value == true) for(u3 2 i=0; i<n_elem; ++i) { out_mem[i] += P1[i] / P2[i]; } else if(is_same_type<eglue_type, eglue_cube_div >::value == true) for(u3 2 i=0; i<n_elem; ++i) { out_mem[i] += P1[i] / P2[i]; }
else if(is_same_type<eglue_type, eglue_cube_schur>::value == true) for(u3 2 i=0; i<n_elem; ++i) { out_mem[i] += P1[i] * P2[i]; } else if(is_same_type<eglue_type, eglue_cube_schur>::value == true) for(u3 2 i=0; i<n_elem; ++i) { out_mem[i] += P1[i] * P2[i]; }
else else
{ {
arma_stop("eglue_cube_core::apply_inplace_plus(): unhandled eglue_type" ); arma_stop("eglue_cube_core::apply_inplace_plus(): unhandled eglue_type" );
} }
} }
skipping to change at line 130 skipping to change at line 132
template<typename T1, typename T2> template<typename T1, typename T2>
arma_hot arma_hot
inline inline
void void
eglue_cube_core<eglue_type>::apply_inplace_minus(Cube<typename T1::elem_typ e>& out, const eGlueCube<T1, T2, eglue_type>& x) eglue_cube_core<eglue_type>::apply_inplace_minus(Cube<typename T1::elem_typ e>& out, const eGlueCube<T1, T2, eglue_type>& x)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
arma_assert_same_size(out.n_rows, out.n_cols, out.n_slices, x.n_rows, x.n const ProxyCube<T1>& P1 = x.P1;
_cols, x.n_slices, "cube subtraction"); const ProxyCube<T2>& P2 = x.P2;
arma_assert_same_size(out.n_rows, out.n_cols, out.n_slices, P1.n_rows, P1
.n_cols, P1.n_slices, "cube subtraction");
eT* out_mem = out.memptr(); eT* out_mem = out.memptr();
const ProxyCube<T1>& P1 = x.P1; const u32 n_elem = P1.n_elem;
const ProxyCube<T2>& P2 = x.P2;
const u32 n_elem = x.n_elem;
if(is_same_type<eglue_type, eglue_cube_plus >::value == true) for(u3 2 i=0; i<n_elem; ++i) { out_mem[i] -= P1[i] + P2[i]; } if(is_same_type<eglue_type, eglue_cube_plus >::value == true) for(u3 2 i=0; i<n_elem; ++i) { out_mem[i] -= P1[i] + P2[i]; }
else if(is_same_type<eglue_type, eglue_cube_minus>::value == true) for(u3 2 i=0; i<n_elem; ++i) { out_mem[i] -= P1[i] - P2[i]; } else if(is_same_type<eglue_type, eglue_cube_minus>::value == true) for(u3 2 i=0; i<n_elem; ++i) { out_mem[i] -= P1[i] - P2[i]; }
else if(is_same_type<eglue_type, eglue_cube_div >::value == true) for(u3 2 i=0; i<n_elem; ++i) { out_mem[i] -= P1[i] / P2[i]; } else if(is_same_type<eglue_type, eglue_cube_div >::value == true) for(u3 2 i=0; i<n_elem; ++i) { out_mem[i] -= P1[i] / P2[i]; }
else if(is_same_type<eglue_type, eglue_cube_schur>::value == true) for(u3 2 i=0; i<n_elem; ++i) { out_mem[i] -= P1[i] * P2[i]; } else if(is_same_type<eglue_type, eglue_cube_schur>::value == true) for(u3 2 i=0; i<n_elem; ++i) { out_mem[i] -= P1[i] * P2[i]; }
else else
{ {
arma_stop("eglue_cube_core::apply_inplace_minus(): unhandled eglue_type "); arma_stop("eglue_cube_core::apply_inplace_minus(): unhandled eglue_type ");
} }
} }
skipping to change at line 158 skipping to change at line 161
template<typename T1, typename T2> template<typename T1, typename T2>
arma_hot arma_hot
inline inline
void void
eglue_cube_core<eglue_type>::apply_inplace_schur(Cube<typename T1::elem_typ e>& out, const eGlueCube<T1, T2, eglue_type>& x) eglue_cube_core<eglue_type>::apply_inplace_schur(Cube<typename T1::elem_typ e>& out, const eGlueCube<T1, T2, eglue_type>& x)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
arma_assert_same_size(out.n_rows, out.n_cols, out.n_slices, x.n_rows, x.n const ProxyCube<T1>& P1 = x.P1;
_cols, x.n_slices, "element-wise cube multiplication"); const ProxyCube<T2>& P2 = x.P2;
eT* out_mem = out.memptr(); arma_assert_same_size(out.n_rows, out.n_cols, out.n_slices, P1.n_rows, P1
const ProxyCube<T1>& P1 = x.P1; .n_cols, P1.n_slices, "element-wise cube multiplication");
const ProxyCube<T2>& P2 = x.P2;
const u32 n_elem = x.n_elem; eT* out_mem = out.memptr();
const u32 n_elem = P1.n_elem;
if(is_same_type<eglue_type, eglue_cube_plus >::value == true) for(u3 2 i=0; i<n_elem; ++i) { out_mem[i] *= P1[i] + P2[i]; } if(is_same_type<eglue_type, eglue_cube_plus >::value == true) for(u3 2 i=0; i<n_elem; ++i) { out_mem[i] *= P1[i] + P2[i]; }
else if(is_same_type<eglue_type, eglue_cube_minus>::value == true) for(u3 2 i=0; i<n_elem; ++i) { out_mem[i] *= P1[i] - P2[i]; } else if(is_same_type<eglue_type, eglue_cube_minus>::value == true) for(u3 2 i=0; i<n_elem; ++i) { out_mem[i] *= P1[i] - P2[i]; }
else if(is_same_type<eglue_type, eglue_cube_div >::value == true) for(u3 2 i=0; i<n_elem; ++i) { out_mem[i] *= P1[i] / P2[i]; } else if(is_same_type<eglue_type, eglue_cube_div >::value == true) for(u3 2 i=0; i<n_elem; ++i) { out_mem[i] *= P1[i] / P2[i]; }
else if(is_same_type<eglue_type, eglue_cube_schur>::value == true) for(u3 2 i=0; i<n_elem; ++i) { out_mem[i] *= P1[i] * P2[i]; } else if(is_same_type<eglue_type, eglue_cube_schur>::value == true) for(u3 2 i=0; i<n_elem; ++i) { out_mem[i] *= P1[i] * P2[i]; }
else else
{ {
arma_stop("eglue_cube_core::apply_inplace_schur(): unhandled eglue_type "); arma_stop("eglue_cube_core::apply_inplace_schur(): unhandled eglue_type ");
} }
} }
skipping to change at line 186 skipping to change at line 190
template<typename T1, typename T2> template<typename T1, typename T2>
arma_hot arma_hot
inline inline
void void
eglue_cube_core<eglue_type>::apply_inplace_div(Cube<typename T1::elem_type> & out, const eGlueCube<T1, T2, eglue_type>& x) eglue_cube_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; typedef typename T1::elem_type eT;
arma_assert_same_size(out.n_rows, out.n_cols, out.n_slices, x.n_rows, x.n const ProxyCube<T1>& P1 = x.P1;
_cols, x.n_slices, "element-wise cube division"); const ProxyCube<T2>& P2 = x.P2;
arma_assert_same_size(out.n_rows, out.n_cols, out.n_slices, P1.n_rows, P1
.n_cols, P1.n_slices, "element-wise cube division");
eT* out_mem = out.memptr(); eT* out_mem = out.memptr();
const ProxyCube<T1>& P1 = x.P1; const u32 n_elem = P1.n_elem;
const ProxyCube<T2>& P2 = x.P2;
const u32 n_elem = x.n_elem;
if(is_same_type<eglue_type, eglue_cube_plus >::value == true) for(u3 2 i=0; i<n_elem; ++i) { out_mem[i] /= P1[i] + P2[i]; } if(is_same_type<eglue_type, eglue_cube_plus >::value == true) for(u3 2 i=0; i<n_elem; ++i) { out_mem[i] /= P1[i] + P2[i]; }
else if(is_same_type<eglue_type, eglue_cube_minus>::value == true) for(u3 2 i=0; i<n_elem; ++i) { out_mem[i] /= P1[i] - P2[i]; } else if(is_same_type<eglue_type, eglue_cube_minus>::value == true) for(u3 2 i=0; i<n_elem; ++i) { out_mem[i] /= P1[i] - P2[i]; }
else if(is_same_type<eglue_type, eglue_cube_div >::value == true) for(u3 2 i=0; i<n_elem; ++i) { out_mem[i] /= P1[i] / P2[i]; } else if(is_same_type<eglue_type, eglue_cube_div >::value == true) for(u3 2 i=0; i<n_elem; ++i) { out_mem[i] /= P1[i] / P2[i]; }
else if(is_same_type<eglue_type, eglue_cube_schur>::value == true) for(u3 2 i=0; i<n_elem; ++i) { out_mem[i] /= P1[i] * P2[i]; } else if(is_same_type<eglue_type, eglue_cube_schur>::value == true) for(u3 2 i=0; i<n_elem; ++i) { out_mem[i] /= P1[i] * P2[i]; }
else else
{ {
arma_stop("eglue_cube_core::apply_inplace_div(): unhandled eglue_type") ; arma_stop("eglue_cube_core::apply_inplace_div(): unhandled eglue_type") ;
} }
} }
 End of changes. 10 change blocks. 
29 lines changed or deleted 34 lines changed or added


 eop_core_meat.hpp   eop_core_meat.hpp 
skipping to change at line 28 skipping to change at line 28
template<typename eop_type> template<typename eop_type>
template<typename T1> template<typename T1>
arma_hot arma_hot
arma_inline arma_inline
typename T1::elem_type typename T1::elem_type
eop_core<eop_type>::get_elem(const eOp<T1, eop_type>& x, const u32 i) eop_core<eop_type>::get_elem(const eOp<T1, eop_type>& x, const u32 i)
{ {
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
if(is_generator<eop_type>::value == true) { return eo if(is_generator<eop_type>::value == true) { return eo
p_aux::generate<eT,eop_type>(); } p_aux::generate<eT,eop_type>(); }
else if(is_same_type<eop_type, eop_ones_diag>::value == true) { return (( else if(is_same_type<eop_type, eop_ones_diag>::value == true) { return ((
i % x.n_rows) == (i / x.n_rows)) ? eT(1) : eT(0); } i % x.P.n_rows) == (i / x.P.n_rows)) ? eT(1) : eT(0); }
else { return eo else { return eo
p_core<eop_type>::process(x, x.P[i]); } 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 arma_inline
typename T1::elem_type typename T1::elem_type
eop_core<eop_type>::get_elem(const eOp<T1, eop_type>& x, const u32 row, con st u32 col) eop_core<eop_type>::get_elem(const eOp<T1, eop_type>& x, const u32 row, con st u32 col)
{ {
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
skipping to change at line 73 skipping to change at line 73
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_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_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_square >::value == true) { r eturn val*val; }
else if(is_same_type<eop_type, eop_sqrt >::value == true) { r eturn std::sqrt(val); } else if(is_same_type<eop_type, eop_sqrt >::value == true) { r eturn std::sqrt(val); }
else if(is_same_type<eop_type, eop_log10 >::value == true) { r eturn std::log10(val); } else if(is_same_type<eop_type, eop_log10 >::value == true) { r eturn std::log10(val); }
else if(is_same_type<eop_type, eop_log >::value == true) { r eturn std::log(val); } else if(is_same_type<eop_type, eop_log >::value == true) { r eturn std::log(val); }
else if(is_same_type<eop_type, eop_trunc_log >::value == true) { r eturn eop_aux::trunc_log(val); } else if(is_same_type<eop_type, eop_trunc_log >::value == true) { r eturn eop_aux::trunc_log(val); }
else if(is_same_type<eop_type, eop_exp >::value == true) { r eturn std::exp(val); } else if(is_same_type<eop_type, eop_exp >::value == true) { r eturn std::exp(val); }
else if(is_same_type<eop_type, eop_trunc_exp >::value == true) { r eturn eop_aux::trunc_exp(val); } else if(is_same_type<eop_type, eop_trunc_exp >::value == true) { r eturn eop_aux::trunc_exp(val); }
else if(is_same_type<eop_type, eop_cos >::value == true) { r eturn std::cos(val); } else if(is_same_type<eop_type, eop_cos >::value == true) { r eturn std::cos(val); }
else if(is_same_type<eop_type, eop_cosh >::value == true) { r
eturn std::cosh(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_acosh >::value == true) { r
eturn eop_aux::acosh(val); }
else if(is_same_type<eop_type, eop_sin >::value == true) { r eturn std::sin(val); } else if(is_same_type<eop_type, eop_sin >::value == true) { r eturn std::sin(val); }
else if(is_same_type<eop_type, eop_sinh >::value == true) { r
eturn std::sinh(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_asinh >::value == true) { r
eturn eop_aux::asinh(val); }
else if(is_same_type<eop_type, eop_tan >::value == true) { r eturn std::tan(val); } else if(is_same_type<eop_type, eop_tan >::value == true) { r eturn std::tan(val); }
else if(is_same_type<eop_type, eop_tanh >::value == true) { r else if(is_same_type<eop_type, eop_acos >::value == true) { r
eturn std::tanh(val); } 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_atan >::value == true) { r eturn eop_aux::atan(val); }
else if(is_same_type<eop_type, eop_cosh >::value == true) { r
eturn std::cosh(val); }
else if(is_same_type<eop_type, eop_sinh >::value == true) { r
eturn std::sinh(val); }
else if(is_same_type<eop_type, eop_tanh >::value == true) { r
eturn std::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_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_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_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_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 >::value == true) { r eturn eop_aux::pow(val, x.aux); }
else if(is_same_type<eop_type, eop_pow_int >::value == true) 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); 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); return eop_aux::pow_int(val, exponent);
skipping to change at line 135 skipping to change at line 135
eop_core<eop_type>::apply_proxy(Mat<typename T1::elem_type>& out, const eOp <T1, eop_type>& x) eop_core<eop_type>::apply_proxy(Mat<typename T1::elem_type>& out, const eOp <T1, eop_type>& x)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
// eop_type::apply_proxy() function is not allowed to unwrap things // eop_type::apply_proxy() function is not allowed to unwrap things
// (in order to get the input into a common format). // (in order to get the input into a common format).
// the proxy class is already providing objects with element access // the proxy class is already providing objects with element access
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
if(is_generator<eop_type>::value == true) const Proxy<T1>& P = x.P;
{
out.set_size(x.n_rows, x.n_cols); out.set_size(P.n_rows, P.n_cols);
eT* out_mem = out.memptr(); eT* out_mem = out.memptr();
const u32 n_elem = x.n_elem; const u32 n_elem = P.n_elem;
if(is_generator<eop_type>::value == true)
{
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)
{ {
out.set_size(x.n_rows, x.n_cols); if(is_same_type<eop_type, eop_ones_diag>::value == true)
for(u32 col=0; col<x.n_rows; ++col)
{ {
for(u32 row=0; row<col; ++row) { out.at(row,col) = eT(0); } 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); out.at(col,col) = eT(1);
for(u32 row=col+1; row<x.n_rows; ++row) { out.at(row,col) = eT(0); } for(u32 row=col+1; row<P.n_rows; ++row) { out.at(row,col) = eT(0);
}
}
} }
} else
else
{
out.set_size(x.n_rows, x.n_cols);
eT* out_mem = out.memptr();
const Proxy<T1>& P = x.P;
const u32 n_elem = x.n_elem;
for(u32 i=0; i<n_elem; ++i)
{ {
out_mem[i] = eop_core<eop_type>::process(x, P[i]); for(u32 i=0; i<n_elem; ++i)
{
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_unwrap(Mat<typename T1::elem_type>& out, const eO p<T1, eop_type>& x) eop_core<eop_type>::apply_unwrap(Mat<typename T1::elem_type>& out, const eO p<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 unwrap<typename Proxy<T1>::stored_type> tmp(x.P.Q); const Proxy<T1>& P = x.P;
out.set_size(P.n_rows, P.n_cols);
eT* out_mem = out.memptr();
const u32 n_elem = P.n_elem;
const unwrap<typename Proxy<T1>::stored_type> tmp(P.Q);
const Mat<eT>& A = tmp.M; const Mat<eT>& A = tmp.M;
if(is_generator<eop_type>::value == true) if(is_generator<eop_type>::value == true)
{ {
out.set_size(x.n_rows, x.n_cols);
eT* out_mem = out.memptr();
const u32 n_elem = x.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)
{ {
out.set_size(x.n_rows, x.n_cols); if(is_same_type<eop_type, eop_ones_diag>::value == true)
for(u32 col=0; col<x.n_rows; ++col)
{ {
for(u32 row=0; row<col; ++row) { out.at(row,col) = eT(0); } 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); out.at(col,col) = eT(1);
for(u32 row=col+1; row<x.n_rows; ++row) { out.at(row,col) = eT(0); } for(u32 row=col+1; row<P.n_rows; ++row) { out.at(row,col) = eT(0);
}
}
} }
} else
else
{
out.set_size(x.n_rows, x.n_cols);
eT* out_mem = out.memptr();
const eT* A_mem = A.memptr();
const u32 n_elem = x.n_elem;
for(u32 i=0; i<n_elem; ++i)
{ {
out_mem[i] = eop_core<eop_type>::process(x, A_mem[i]); const eT* A_mem = A.memptr();
for(u32 i=0; i<n_elem; ++i)
{
out_mem[i] = eop_core<eop_type>::process(x, A_mem[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_plus(Mat<typename T1::elem_type>& out, co nst eOp<T1, eop_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();
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
arma_debug_assert_same_size(out.n_rows, out.n_cols, x.n_rows, x.n_cols, " const Proxy<T1>& P = x.P;
matrix addition");
arma_debug_assert_same_size(out.n_rows, out.n_cols, P.n_rows, P.n_cols, "
matrix addition");
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 = x.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)
{
for(u32 row=0; row<x.n_rows; ++row)
{
out.at(row,row) += eT(1);
}
}
else
{ {
eT* out_mem = out.memptr(); if(is_same_type<eop_type, eop_ones_diag>::value == true)
const Proxy<T1>& P = x.P;
const u32 n_elem = x.n_elem;
for(u32 i=0; i<n_elem; ++i)
{ {
out_mem[i] += eop_core<eop_type>::process(x, P[i]); for(u32 row=0; row<P.n_rows; ++row)
{
out.at(row,row) += eT(1);
}
}
else
{
for(u32 i=0; i<n_elem; ++i)
{
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(Mat<typename T1::elem_type>& out, c onst 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;
arma_debug_assert_same_size(out.n_rows, out.n_cols, x.n_rows, x.n_cols, " const Proxy<T1>& P = x.P;
matrix subtraction");
arma_debug_assert_same_size(out.n_rows, out.n_cols, P.n_rows, P.n_cols, "
matrix subtraction");
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 = x.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)
{ {
for(u32 row=0; row<x.n_rows; ++row) if(is_same_type<eop_type, eop_ones_diag>::value == true)
{
out.at(row,row) -= eT(1);
}
}
else
{
eT* out_mem = out.memptr();
const Proxy<T1>& P = x.P;
const u32 n_elem = x.n_elem;
for(u32 i=0; i<n_elem; ++i)
{ {
out_mem[i] -= eop_core<eop_type>::process(x, P[i]); for(u32 row=0; row<P.n_rows; ++row)
{
out.at(row,row) -= eT(1);
}
}
else
{
for(u32 i=0; i<n_elem; ++i)
{
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(Mat<typename T1::elem_type>& out, c onst 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;
arma_debug_assert_same_size(out.n_rows, out.n_cols, x.n_rows, x.n_cols, " const Proxy<T1>& P = x.P;
element-wise matrix multiplication");
arma_debug_assert_same_size(out.n_rows, out.n_cols, P.n_rows, P.n_cols, "
element-wise matrix multiplication");
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 = x.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>();
} }
} }
if(is_same_type<eop_type, eop_ones_diag>::value == true)
{
for(u32 col=0; col<x.n_rows; ++col)
{
for(u32 row=0; row<col; ++row) { out.at(row,col) = eT(0); }
for(u32 row=col+1; row<x.n_rows; ++row) { out.at(row,col) = eT(0); }
}
}
else else
{ {
eT* out_mem = out.memptr(); if(is_same_type<eop_type, eop_ones_diag>::value == true)
const Proxy<T1>& P = x.P;
const u32 n_elem = x.n_elem;
for(u32 i=0; i<n_elem; ++i)
{ {
out_mem[i] *= eop_core<eop_type>::process(x, P[i]); for(u32 col=0; col<P.n_rows; ++col)
{
for(u32 row=0; row<col; ++row) { out.at(row,col) = eT(0);
}
for(u32 row=col+1; row<P.n_rows; ++row) { out.at(row,col) = eT(0);
}
}
}
else
{
for(u32 i=0; i<n_elem; ++i)
{
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(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;
arma_debug_assert_same_size(out.n_rows, out.n_cols, x.n_rows, x.n_cols, " const Proxy<T1>& P = x.P;
element-wise matrix division");
arma_debug_assert_same_size(out.n_rows, out.n_cols, P.n_rows, P.n_cols, "
element-wise matrix division");
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 = x.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>();
} }
} }
if(is_same_type<eop_type, eop_ones_diag>::value == true)
{
for(u32 col=0; col<x.n_rows; ++col)
{
for(u32 row=0; row<col; ++row) { out.at(row,col) /= eT(0); }
for(u32 row=col+1; row<x.n_rows; ++row) { out.at(row,col) /= eT(0); }
}
}
else else
{ {
eT* out_mem = out.memptr(); if(is_same_type<eop_type, eop_ones_diag>::value == true)
const Proxy<T1>& P = x.P;
const u32 n_elem = x.n_elem;
for(u32 i=0; i<n_elem; ++i)
{ {
out_mem[i] /= eop_core<eop_type>::process(x, P[i]); for(u32 col=0; col<P.n_rows; ++col)
{
for(u32 row=0; row<col; ++row) { out.at(row,col) /= eT(0);
}
for(u32 row=col+1; row<P.n_rows; ++row) { out.at(row,col) /= eT(0);
}
}
}
else
{
for(u32 i=0; i<n_elem; ++i)
{
out_mem[i] /= eop_core<eop_type>::process(x, P[i]);
}
} }
} }
} }
//! @} //! @}
 End of changes. 44 change blocks. 
143 lines changed or deleted 147 lines changed or added


 eop_core_proto.hpp   eop_core_proto.hpp 
skipping to change at line 60 skipping to change at line 60
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_log10 : public eop_core<eop_log10> {};
class eop_log : public eop_core<eop_log> {}; class eop_log : public eop_core<eop_log> {};
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_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_cosh : public eop_core<eop_cosh> {};
class eop_acos : public eop_core<eop_acos> {};
class eop_acosh : public eop_core<eop_acosh> {};
class eop_sin : public eop_core<eop_sin> {}; class eop_sin : public eop_core<eop_sin> {};
class eop_sinh : public eop_core<eop_sinh> {};
class eop_asin : public eop_core<eop_asin> {};
class eop_asinh : public eop_core<eop_asinh> {};
class eop_tan : public eop_core<eop_tan> {}; class eop_tan : public eop_core<eop_tan> {};
class eop_tanh : public eop_core<eop_tanh> {}; class eop_acos : public eop_core<eop_acos> {};
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_sinh : public eop_core<eop_sinh> {};
class eop_tanh : public eop_core<eop_tanh> {};
class eop_acosh : public eop_core<eop_acosh> {};
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_ones_diag : public eop_core<eop_ones_diag> class eop_ones_diag : public eop_core<eop_ones_diag>
{ {
public: public:
 End of changes. 4 change blocks. 
7 lines changed or deleted 7 lines changed or added


 eop_cube_core_meat.hpp   eop_cube_core_meat.hpp 
skipping to change at line 133 skipping to change at line 133
eop_cube_core<eop_cube_type>::apply_proxy(Cube<typename T1::elem_type>& out , const eOpCube<T1, eop_cube_type>& x) eop_cube_core<eop_cube_type>::apply_proxy(Cube<typename T1::elem_type>& out , const eOpCube<T1, eop_cube_type>& x)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
// eop_cube_type::apply() function is not allowed to unwrap things // eop_cube_type::apply() function is not allowed to unwrap things
// (in order to get the input into a common format). // (in order to get the input into a common format).
// the proxy class is already providing objects with element access // the proxy class is already providing objects with element access
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
if(is_cube_generator<eop_cube_type>::value == true) const ProxyCube<T1>& P = x.P;
{
out.set_size(x.n_rows, x.n_cols, x.n_slices);
eT* out_mem = out.memptr(); out.set_size(P.n_rows, P.n_cols, P.n_slices);
const u32 n_elem = x.n_elem;
eT* out_mem = out.memptr();
const u32 n_elem = P.n_elem;
if(is_cube_generator<eop_cube_type>::value == true)
{
for(u32 i=0; i<n_elem; ++i) for(u32 i=0; i<n_elem; ++i)
{ {
out_mem[i] = eop_aux::generate<eT,eop_cube_type>(); out_mem[i] = eop_aux::generate<eT,eop_cube_type>();
} }
} }
else else
{ {
out.set_size(x.n_rows, x.n_cols, x.n_slices);
eT* out_mem = out.memptr();
const ProxyCube<T1>& P = x.P;
const u32 n_elem = x.n_elem;
for(u32 i=0; i<n_elem; ++i) for(u32 i=0; i<n_elem; ++i)
{ {
out_mem[i] = eop_cube_core<eop_cube_type>::process(x, P[i]); out_mem[i] = eop_cube_core<eop_cube_type>::process(x, P[i]);
} }
} }
} }
template<typename eop_cube_type> template<typename eop_cube_type>
template<typename T1> template<typename T1>
arma_hot arma_hot
inline inline
void void
eop_cube_core<eop_cube_type>::apply_unwrap(Cube<typename T1::elem_type>& ou t, const eOpCube<T1, eop_cube_type>& x) eop_cube_core<eop_cube_type>::apply_unwrap(Cube<typename T1::elem_type>& ou t, const eOpCube<T1, eop_cube_type>& x)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
const unwrap_cube<typename ProxyCube<T1>::stored_type> tmp(x.P.Q); const ProxyCube<T1>& P = x.P;
const Cube<eT>& A = tmp.M;
if(is_cube_generator<eop_cube_type>::value == true) out.set_size(P.n_rows, P.n_cols, P.n_slices);
{
out.set_size(x.n_rows, x.n_cols, x.n_slices);
eT* out_mem = out.memptr(); eT* out_mem = out.memptr();
const u32 n_elem = x.n_elem; const u32 n_elem = P.n_elem;
if(is_cube_generator<eop_cube_type>::value == true)
{
for(u32 i=0; i<n_elem; ++i) for(u32 i=0; i<n_elem; ++i)
{ {
out_mem[i] = eop_aux::generate<eT,eop_cube_type>(); out_mem[i] = eop_aux::generate<eT,eop_cube_type>();
} }
} }
else else
{ {
out.set_size(x.n_rows, x.n_cols, x.n_slices); const unwrap_cube<typename ProxyCube<T1>::stored_type> tmp(P.Q);
eT* out_mem = out.memptr(); const Cube<eT>& A = tmp.M;
const eT* A_mem = A.memptr(); const eT* A_mem = A.memptr();
const u32 n_elem = x.n_elem;
for(u32 i=0; i<n_elem; ++i) for(u32 i=0; i<n_elem; ++i)
{ {
out_mem[i] = eop_cube_core<eop_cube_type>::process(x, A_mem[i]); out_mem[i] = eop_cube_core<eop_cube_type>::process(x, A_mem[i]);
} }
} }
} }
template<typename eop_cube_type> template<typename eop_cube_type>
template<typename T1> template<typename T1>
arma_hot arma_hot
inline inline
void void
eop_cube_core<eop_cube_type>::apply_inplace_plus(Cube<typename T1::elem_typ e>& out, const eOpCube<T1, eop_cube_type>& x) eop_cube_core<eop_cube_type>::apply_inplace_plus(Cube<typename T1::elem_typ e>& out, const eOpCube<T1, eop_cube_type>& x)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
arma_debug_assert_same_size(out.n_rows, out.n_cols, out.n_slices, x.n_row const ProxyCube<T1>& P = x.P;
s, x.n_cols, x.n_slices, "cube addition");
arma_debug_assert_same_size(out.n_rows, out.n_cols, out.n_slices, P.n_row
s, P.n_cols, P.n_slices, "cube addition");
eT* out_mem = out.memptr();
const u32 n_elem = P.n_elem;
if(is_cube_generator<eop_cube_type>::value == true) if(is_cube_generator<eop_cube_type>::value == true)
{ {
eT* out_mem = out.memptr();
const u32 n_elem = x.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_cube_type>(); out_mem[i] += eop_aux::generate<eT,eop_cube_type>();
} }
} }
else else
{ {
eT* out_mem = out.memptr();
const ProxyCube<T1>& P = x.P;
const u32 n_elem = x.n_elem;
for(u32 i=0; i<n_elem; ++i) for(u32 i=0; i<n_elem; ++i)
{ {
out_mem[i] += eop_cube_core<eop_cube_type>::process(x, P[i]); out_mem[i] += eop_cube_core<eop_cube_type>::process(x, P[i]);
} }
} }
} }
template<typename eop_cube_type> template<typename eop_cube_type>
template<typename T1> template<typename T1>
arma_hot arma_hot
inline inline
void void
eop_cube_core<eop_cube_type>::apply_inplace_minus(Cube<typename T1::elem_ty pe>& out, const eOpCube<T1, eop_cube_type>& x) eop_cube_core<eop_cube_type>::apply_inplace_minus(Cube<typename T1::elem_ty pe>& out, const eOpCube<T1, eop_cube_type>& x)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
arma_debug_assert_same_size(out.n_rows, out.n_cols, out.n_slices, x.n_row const ProxyCube<T1>& P = x.P;
s, x.n_cols, x.n_slices, "cube subtraction");
arma_debug_assert_same_size(out.n_rows, out.n_cols, out.n_slices, P.n_row
s, P.n_cols, P.n_slices, "cube subtraction");
eT* out_mem = out.memptr();
const u32 n_elem = P.n_elem;
if(is_cube_generator<eop_cube_type>::value == true) if(is_cube_generator<eop_cube_type>::value == true)
{ {
eT* out_mem = out.memptr();
const u32 n_elem = x.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_cube_type>(); out_mem[i] -= eop_aux::generate<eT,eop_cube_type>();
} }
} }
else else
{ {
eT* out_mem = out.memptr();
const ProxyCube<T1>& P = x.P;
const u32 n_elem = x.n_elem;
for(u32 i=0; i<n_elem; ++i) for(u32 i=0; i<n_elem; ++i)
{ {
out_mem[i] -= eop_cube_core<eop_cube_type>::process(x, P[i]); out_mem[i] -= eop_cube_core<eop_cube_type>::process(x, P[i]);
} }
} }
} }
template<typename eop_cube_type> template<typename eop_cube_type>
template<typename T1> template<typename T1>
arma_hot arma_hot
inline inline
void void
eop_cube_core<eop_cube_type>::apply_inplace_schur(Cube<typename T1::elem_ty pe>& out, const eOpCube<T1, eop_cube_type>& x) eop_cube_core<eop_cube_type>::apply_inplace_schur(Cube<typename T1::elem_ty pe>& out, const eOpCube<T1, eop_cube_type>& x)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
arma_debug_assert_same_size(out.n_rows, out.n_cols, out.n_slices, x.n_row const ProxyCube<T1>& P = x.P;
s, x.n_cols, x.n_slices, "element-wise cube multiplication");
arma_debug_assert_same_size(out.n_rows, out.n_cols, out.n_slices, P.n_row
s, P.n_cols, P.n_slices, "element-wise cube multiplication");
eT* out_mem = out.memptr();
const u32 n_elem = P.n_elem;
if(is_cube_generator<eop_cube_type>::value == true) if(is_cube_generator<eop_cube_type>::value == true)
{ {
eT* out_mem = out.memptr();
const u32 n_elem = x.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_cube_type>(); out_mem[i] *= eop_aux::generate<eT,eop_cube_type>();
} }
} }
else else
{ {
eT* out_mem = out.memptr();
const ProxyCube<T1>& P = x.P;
const u32 n_elem = x.n_elem;
for(u32 i=0; i<n_elem; ++i) for(u32 i=0; i<n_elem; ++i)
{ {
out_mem[i] *= eop_cube_core<eop_cube_type>::process(x, P[i]); out_mem[i] *= eop_cube_core<eop_cube_type>::process(x, P[i]);
} }
} }
} }
template<typename eop_cube_type> template<typename eop_cube_type>
template<typename T1> template<typename T1>
arma_hot arma_hot
inline inline
void void
eop_cube_core<eop_cube_type>::apply_inplace_div(Cube<typename T1::elem_type >& out, const eOpCube<T1, eop_cube_type>& x) eop_cube_core<eop_cube_type>::apply_inplace_div(Cube<typename T1::elem_type >& out, const eOpCube<T1, eop_cube_type>& x)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
arma_debug_assert_same_size(out.n_rows, out.n_cols, out.n_slices, x.n_row const ProxyCube<T1>& P = x.P;
s, x.n_cols, x.n_slices, "element-wise cube division");
arma_debug_assert_same_size(out.n_rows, out.n_cols, out.n_slices, P.n_row
s, P.n_cols, P.n_slices, "element-wise cube division");
eT* out_mem = out.memptr();
const u32 n_elem = P.n_elem;
if(is_cube_generator<eop_cube_type>::value == true) if(is_cube_generator<eop_cube_type>::value == true)
{ {
eT* out_mem = out.memptr();
const u32 n_elem = x.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_cube_type>(); out_mem[i] /= eop_aux::generate<eT,eop_cube_type>();
} }
} }
else else
{ {
eT* out_mem = out.memptr();
const ProxyCube<T1>& P = x.P;
const u32 n_elem = x.n_elem;
for(u32 i=0; i<n_elem; ++i) for(u32 i=0; i<n_elem; ++i)
{ {
out_mem[i] /= eop_cube_core<eop_cube_type>::process(x, P[i]); out_mem[i] /= eop_cube_core<eop_cube_type>::process(x, P[i]);
} }
} }
} }
//! @} //! @}
 End of changes. 22 change blocks. 
58 lines changed or deleted 44 lines changed or added


 fn_accu.hpp   fn_accu.hpp 
skipping to change at line 32 skipping to change at line 32
typename T1::elem_type typename T1::elem_type
accu_unwrap(const Base<typename T1::elem_type,T1>& X) accu_unwrap(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 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;
const u32 N = A.n_elem; const eT* A_mem = A.memptr();
const u32 N = A.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; i+=2, j+=2)
{ {
val += A[i]; val1 += A_mem[i];
val2 += A_mem[j];
} }
return val; if(i < N)
{
val1 += A_mem[i];
}
return val1 + val2;
} }
template<typename T1> template<typename T1>
arma_hot arma_hot
inline inline
typename T1::elem_type typename T1::elem_type
accu_proxy(const Base<typename T1::elem_type,T1>& X) accu_proxy(const Base<typename T1::elem_type,T1>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
skipping to change at line 71 skipping to change at line 81
{ {
val += A[i]; val += A[i];
} }
return val; return val;
} }
//! accumulate the elements of a matrix //! accumulate the elements of a matrix
template<typename T1> template<typename T1>
arma_inline arma_inline
arma_warn_unused
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();
return (is_Mat<T1>::value == true) ? accu_unwrap(X) : accu_proxy(X); return (is_Mat<T1>::value == true) ? accu_unwrap(X) : accu_proxy(X);
} }
//! 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
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;
const ProxyCube<T1> A(X.get_ref()); const ProxyCube<T1> A(X.get_ref());
skipping to change at line 106 skipping to change at line 118
for(u32 i=0; i<n_elem; ++i) for(u32 i=0; i<n_elem; ++i)
{ {
val += A[i]; val += A[i];
} }
return val; return val;
} }
//! accumulate the elements of a diagview //! accumulate the elements of a diagview
template<typename eT> template<typename eT>
arma_pure
arma_warn_unused
inline inline
eT eT
accu(const diagview<eT>& X) accu(const diagview<eT>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
const u32 n_elem = X.n_elem; const u32 n_elem = X.n_elem;
eT val = eT(0); eT val = eT(0);
for(u32 i=0; i<n_elem; ++i) for(u32 i=0; i<n_elem; ++i)
{ {
val += X[i]; val += X[i];
} }
return val; return val;
} }
//! accumulate the elements of a subview (submatrix) //! accumulate the elements of a subview (submatrix)
template<typename eT> template<typename eT>
arma_pure
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();
eT val = eT(0); eT val = eT(0);
for(u32 col=0; col<S.n_cols; ++col) for(u32 col=0; col<S.n_cols; ++col)
{ {
skipping to change at line 149 skipping to change at line 165
val += coldata[row]; val += coldata[row];
} }
} }
return val; 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_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 row = S.aux_row1;
const u32 start_col = S.aux_col1; const u32 start_col = S.aux_col1;
skipping to change at line 173 skipping to change at line 191
for(u32 col=start_col; col<=end_col; ++col) for(u32 col=start_col; col<=end_col; ++col)
{ {
val += X.at(row,col); val += X.at(row,col);
} }
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_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();
const eT* S_colptr = S.colptr(0); const eT* S_colptr = S.colptr(0);
const u32 n_rows = S.n_rows; const u32 n_rows = S.n_rows;
eT val = eT(0); eT val = eT(0);
 End of changes. 11 change blocks. 
5 lines changed or deleted 25 lines changed or added


 fn_as_scalar.hpp   fn_as_scalar.hpp 
skipping to change at line 297 skipping to change at line 297
return val * op_dot::direct_dot(A.n_elem, A.mem, B.mem, C.mem); return val * op_dot::direct_dot(A.n_elem, A.mem, B.mem, C.mem);
} }
else else
{ {
return val * op_dotext::direct_rowvec_diagmat_colvec(A.mem, B, C.mem); return val * op_dotext::direct_rowvec_diagmat_colvec(A.mem, B, C.mem);
} }
} }
template<typename T1, typename T2> template<typename T1, typename T2>
arma_inline arma_inline
arma_warn_unused
typename T1::elem_type typename T1::elem_type
as_scalar(const Glue<T1, T2, glue_times>& X) as_scalar(const Glue<T1, T2, glue_times>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
if(is_glue_times_diag<T1>::value == false) if(is_glue_times_diag<T1>::value == false)
{ {
const s32 N_mat = 1 + depth_lhs< glue_times, Glue<T1,T2,glue_times> >:: num; const s32 N_mat = 1 + depth_lhs< glue_times, Glue<T1,T2,glue_times> >:: num;
arma_extra_debug_print(arma_boost::format("N_mat = %d") % N_mat); arma_extra_debug_print(arma_boost::format("N_mat = %d") % N_mat);
skipping to change at line 318 skipping to change at line 319
return as_scalar_redirect<N_mat>::apply(X); return as_scalar_redirect<N_mat>::apply(X);
} }
else else
{ {
return as_scalar_diag(X); return as_scalar_diag(X);
} }
} }
template<typename T1> template<typename T1>
inline inline
arma_warn_unused
typename T1::elem_type typename T1::elem_type
as_scalar(const Base<typename T1::elem_type,T1>& X) as_scalar(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 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_check( (A.n_elem != 1), "as_scalar(): expression doesn't evalu ate to exactly one element" ); arma_debug_check( (A.n_elem != 1), "as_scalar(): expression doesn't evalu ate to exactly one element" );
return A.mem[0]; return A.mem[0];
} }
template<typename T1> template<typename T1>
arma_inline arma_inline
arma_warn_unused
typename T1::elem_type typename T1::elem_type
as_scalar(const eOp<T1, eop_neg>& X) as_scalar(const eOp<T1, eop_neg>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return -(as_scalar(X.P.Q)); return -(as_scalar(X.P.Q));
} }
template<typename T1> template<typename T1>
inline inline
arma_warn_unused
typename T1::elem_type typename T1::elem_type
as_scalar(const BaseCube<typename T1::elem_type,T1>& X) as_scalar(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;
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_check( (A.n_elem != 1), "as_scalar(): expression doesn't evalu ate to exactly one element" ); arma_debug_check( (A.n_elem != 1), "as_scalar(): expression doesn't evalu ate to exactly one element" );
return A.mem[0]; return A.mem[0];
} }
template<typename T> template<typename T>
arma_inline arma_inline
arma_warn_unused
const typename arma_scalar_only<T>::result & const typename arma_scalar_only<T>::result &
as_scalar(const T& x) as_scalar(const T& x)
{ {
return x; return x;
} }
//! @} //! @}
 End of changes. 5 change blocks. 
0 lines changed or deleted 5 lines changed or added


 fn_det.hpp   fn_det.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 fn_det //! \addtogroup fn_det
//! @{ //! @{
//! determinant of mat //! determinant of mat
template<typename T1> template<typename T1>
inline inline
arma_warn_unused
typename T1::elem_type typename T1::elem_type
det(const Base<typename T1::elem_type,T1>& X) det(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 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_check( !A.is_square(), "det(): matrix must be square" ); arma_debug_check( !A.is_square(), "det(): matrix must be square" );
return auxlib::det(A); return auxlib::det(A);
} }
//! determinant of diagmat //! determinant of diagmat
template<typename T1> template<typename T1>
inline inline
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);
arma_debug_check( (A.n_elem == 0), "det(): given object has no elements" ); arma_debug_check( (A.n_elem == 0), "det(): given object has no elements" );
skipping to change at line 64 skipping to change at line 66
{ {
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
arma_warn_unused
typename T1::elem_type typename T1::elem_type
det(const Op<T1,op_inv>& in) det(const Op<T1,op_inv>& in)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
isnt_fltpt<eT>::check(); isnt_fltpt<eT>::check();
eT tmp = det(in.m); eT tmp = det(in.m);
arma_warn( (tmp == eT(0)), "det(): warning: denominator is zero" ); arma_warn( (tmp == eT(0)), "det(): warning: denominator is zero" );
return eT(1) / tmp; return eT(1) / tmp;
} }
//! determinant of trans(A) //! determinant of trans(A)
template<typename T1> template<typename T1>
inline inline
arma_warn_unused
typename T1::elem_type typename T1::elem_type
det(const Op<T1,op_trans>& in) det(const Op<T1,op_trans>& in)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
const unwrap<T1> tmp(in.m); const unwrap<T1> tmp(in.m);
const Mat<eT>& X = tmp.M; const Mat<eT>& X = tmp.M;
 End of changes. 4 change blocks. 
0 lines changed or deleted 4 lines changed or added


 fn_dot.hpp   fn_dot.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_dot //! \addtogroup fn_dot
//! @{ //! @{
template<typename T1, typename T2> template<typename T1, typename T2>
arma_inline arma_inline
arma_warn_unused
typename T1::elem_type typename T1::elem_type
dot(const Base<typename T1::elem_type,T1>& A, const Base<typename T1::elem_ type,T2>& B) dot(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 op_dot::apply(A,B); return op_dot::apply(A,B);
} }
template<typename T1, typename T2> template<typename T1, typename T2>
arma_inline arma_inline
arma_warn_unused
typename T1::elem_type typename T1::elem_type
norm_dot(const Base<typename T1::elem_type,T1>& A, const Base<typename T1:: elem_type,T2>& B) norm_dot(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 op_norm_dot::apply(A,B); return op_norm_dot::apply(A,B);
} }
//! @} //! @}
 End of changes. 2 change blocks. 
0 lines changed or deleted 2 lines changed or added


 fn_eps.hpp   fn_eps.hpp 
skipping to change at line 65 skipping to change at line 65
for(u32 i=0; i<n_elem; ++i) for(u32 i=0; i<n_elem; ++i)
{ {
out_mem[i] = eop_aux::direct_eps( A_mem[i] ); out_mem[i] = eop_aux::direct_eps( A_mem[i] );
} }
return out; return out;
} }
template<typename eT> template<typename eT>
arma_inline arma_inline
arma_warn_unused
typename arma_integral_only<eT>::result typename arma_integral_only<eT>::result
eps(const eT& x) eps(const eT& x)
{ {
return eT(0); return eT(0);
} }
template<typename eT> template<typename eT>
arma_inline arma_inline
arma_warn_unused
typename arma_float_only<eT>::result typename arma_float_only<eT>::result
eps(const eT& x) eps(const eT& x)
{ {
return eop_aux::direct_eps(x); return eop_aux::direct_eps(x);
} }
template<typename T> template<typename T>
arma_inline arma_inline
arma_warn_unused
typename arma_float_only<T>::result typename arma_float_only<T>::result
eps(const std::complex<T>& x) eps(const std::complex<T>& x)
{ {
return eop_aux::direct_eps(x); return eop_aux::direct_eps(x);
} }
//! @} //! @}
 End of changes. 3 change blocks. 
0 lines changed or deleted 3 lines changed or added


 fn_max.hpp   fn_max.hpp 
skipping to change at line 40 skipping to change at line 40
max(const Base<typename T1::elem_type,T1>& X, const u32 dim = 0) max(const Base<typename T1::elem_type,T1>& X, const u32 dim = 0)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return Op<T1, op_max>(X.get_ref(), dim, 0); return Op<T1, op_max>(X.get_ref(), dim, 0);
} }
//! Immediate 'find the maximum value in a row vector' operation //! Immediate 'find the maximum value in a row vector' operation
template<typename eT> template<typename eT>
inline inline
arma_warn_unused
eT eT
max(const Row<eT>& A) max(const Row<eT>& A)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( (A.n_elem == 0), "max(): given vector has no elements" ); arma_debug_check( (A.n_elem == 0), "max(): given vector has no elements" );
return op_max::direct_max(A.mem, A.n_elem); return op_max::direct_max(A.mem, A.n_elem);
} }
//! Immediate 'find the maximum value in a column vector' operation //! Immediate 'find the maximum value in a column vector' operation
template<typename eT> template<typename eT>
inline inline
arma_warn_unused
eT eT
max(const Col<eT>& A) max(const Col<eT>& A)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( (A.n_elem == 0), "max(): given vector has no elements" ); arma_debug_check( (A.n_elem == 0), "max(): given vector has no elements" );
return op_max::direct_max(A.mem, A.n_elem); return op_max::direct_max(A.mem, A.n_elem);
} }
//! \brief //! \brief
//! Immediate 'find maximum value' operation, //! Immediate 'find maximum value' operation,
//! invoked, for example, by: max(max(A)) //! invoked, for example, by: max(max(A))
template<typename T1> template<typename T1>
inline inline
arma_warn_unused
typename T1::elem_type typename T1::elem_type
max(const Op<T1, op_max>& in) max(const Op<T1, op_max>& in)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_extra_debug_print("max(): two consecutive max() calls detected"); arma_extra_debug_print("max(): two consecutive max() calls detected");
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
const unwrap<T1> tmp1(in.m); const unwrap<T1> tmp1(in.m);
const Mat<eT>& X = tmp1.M; const Mat<eT>& X = tmp1.M;
skipping to change at line 96 skipping to change at line 99
const Op< Op<T1, op_max>, op_max> const Op< Op<T1, op_max>, op_max>
max(const Op<T1, op_max>& in, const u32 dim) max(const Op<T1, op_max>& in, const u32 dim)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return Op< Op<T1, op_max>, op_max>(in, dim, 0); return Op< Op<T1, op_max>, op_max>(in, dim, 0);
} }
template<typename eT> template<typename eT>
inline inline
arma_warn_unused
eT eT
max(const subview_row<eT>& A) max(const subview_row<eT>& A)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( (A.n_elem == 0), "max(): given vector has no elements" ); arma_debug_check( (A.n_elem == 0), "max(): given vector has no elements" );
return op_max::direct_max(A); return op_max::direct_max(A);
} }
template<typename eT> template<typename eT>
inline inline
arma_warn_unused
eT eT
max(const subview_col<eT>& A) max(const subview_col<eT>& A)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( (A.n_elem == 0), "max(): given vector has no elements" ); arma_debug_check( (A.n_elem == 0), "max(): given vector has no elements" );
return op_max::direct_max(A); return op_max::direct_max(A);
} }
template<typename eT> template<typename eT>
inline inline
arma_warn_unused
eT eT
max(const Op<subview<eT>, op_max>& in) max(const Op<subview<eT>, op_max>& in)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_extra_debug_print("max(): two consecutive max() calls detected"); arma_extra_debug_print("max(): two consecutive max() calls detected");
const subview<eT>& X = in.m; const subview<eT>& X = in.m;
arma_debug_check( (X.n_elem == 0), "max(): given matrix has no elements" ); arma_debug_check( (X.n_elem == 0), "max(): given matrix has no elements" );
return op_max::direct_max(X); return op_max::direct_max(X);
} }
template<typename eT> template<typename eT>
inline inline
arma_warn_unused
eT eT
max(const diagview<eT>& A) max(const diagview<eT>& A)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( (A.n_elem == 0), "max(): given vector has no elements" ); arma_debug_check( (A.n_elem == 0), "max(): given vector has no elements" );
return op_max::direct_max(A); return op_max::direct_max(A);
} }
 End of changes. 7 change blocks. 
0 lines changed or deleted 7 lines changed or added


 fn_mean.hpp   fn_mean.hpp 
skipping to change at line 32 skipping to change at line 32
mean(const Base<typename T1::elem_type,T1>& X, const u32 dim = 0) mean(const Base<typename T1::elem_type,T1>& X, const u32 dim = 0)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return Op<T1, op_mean>(X.get_ref(), dim, 0); return Op<T1, op_mean>(X.get_ref(), dim, 0);
} }
//! Immediate 'find the mean value of a row vector' operation //! Immediate 'find the mean value of a row vector' operation
template<typename eT> template<typename eT>
inline inline
arma_warn_unused
eT eT
mean(const Row<eT>& A) mean(const Row<eT>& A)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( (A.n_elem == 0), "mean(): given vector has no elements" ); arma_debug_check( (A.n_elem == 0), "mean(): given vector has no elements" );
return op_mean::direct_mean(A.mem, A.n_elem); return op_mean::direct_mean(A.mem, A.n_elem);
} }
//! Immediate 'find the mean value of a column vector' operation //! Immediate 'find the mean value of a column vector' operation
template<typename eT> template<typename eT>
inline inline
arma_warn_unused
eT eT
mean(const Col<eT>& A) mean(const Col<eT>& A)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( (A.n_elem == 0), "mean(): given vector has no elements" ); arma_debug_check( (A.n_elem == 0), "mean(): given vector has no elements" );
return op_mean::direct_mean(A.mem, A.n_elem); return op_mean::direct_mean(A.mem, A.n_elem);
} }
//! \brief //! \brief
//! Immediate 'find mean value' operation, //! Immediate 'find mean value' operation,
//! invoked, for example, by: mean(mean(A)) //! invoked, for example, by: mean(mean(A))
template<typename T1> template<typename T1>
inline inline
arma_warn_unused
typename T1::elem_type typename T1::elem_type
mean(const Op<T1, op_mean>& in) mean(const Op<T1, op_mean>& in)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_extra_debug_print("mean(): two consecutive mean() calls detected"); arma_extra_debug_print("mean(): two consecutive mean() calls detected");
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
const unwrap<T1> tmp1(in.m); const unwrap<T1> tmp1(in.m);
const Mat<eT>& X = tmp1.M; const Mat<eT>& X = tmp1.M;
skipping to change at line 88 skipping to change at line 91
const Op< Op<T1, op_mean>, op_mean> const Op< Op<T1, op_mean>, op_mean>
mean(const Op<T1, op_mean>& in, const u32 dim) mean(const Op<T1, op_mean>& in, const u32 dim)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return Op< Op<T1, op_mean>, op_mean>(in, dim, 0); return Op< Op<T1, op_mean>, op_mean>(in, dim, 0);
} }
template<typename eT> template<typename eT>
inline inline
arma_warn_unused
eT eT
mean(const subview_row<eT>& A) mean(const subview_row<eT>& A)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( (A.n_elem == 0), "mean(): given vector has no elements" ); arma_debug_check( (A.n_elem == 0), "mean(): given vector has no elements" );
return op_mean::direct_mean(A); return op_mean::direct_mean(A);
} }
template<typename eT> template<typename eT>
inline inline
arma_warn_unused
eT eT
mean(const subview_col<eT>& A) mean(const subview_col<eT>& A)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( (A.n_elem == 0), "mean(): given vector has no elements" ); arma_debug_check( (A.n_elem == 0), "mean(): given vector has no elements" );
return op_mean::direct_mean(A); return op_mean::direct_mean(A);
} }
template<typename eT> template<typename eT>
inline inline
arma_warn_unused
eT eT
mean(const Op<subview<eT>, op_mean>& in) mean(const Op<subview<eT>, op_mean>& in)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_extra_debug_print("mean(): two consecutive mean() calls detected"); arma_extra_debug_print("mean(): two consecutive mean() calls detected");
const subview<eT>& X = in.m; const subview<eT>& X = in.m;
arma_debug_check( (X.n_elem == 0), "mean(): given matrix has no elements" ); arma_debug_check( (X.n_elem == 0), "mean(): given matrix has no elements" );
return op_mean::direct_mean(X); return op_mean::direct_mean(X);
} }
template<typename eT> template<typename eT>
inline inline
arma_warn_unused
eT eT
mean(const diagview<eT>& A) mean(const diagview<eT>& A)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( (A.n_elem == 0), "mean(): given vector has no elements" ); arma_debug_check( (A.n_elem == 0), "mean(): given vector has no elements" );
return op_mean::direct_mean(A); return op_mean::direct_mean(A);
} }
 End of changes. 7 change blocks. 
0 lines changed or deleted 7 lines changed or added


 fn_median.hpp   fn_median.hpp 
skipping to change at line 32 skipping to change at line 32
median(const Base<typename T1::elem_type,T1>& X, const u32 dim = 0) median(const Base<typename T1::elem_type,T1>& X, const u32 dim = 0)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return Op<T1, op_median>(X.get_ref(), dim, 0); return Op<T1, op_median>(X.get_ref(), dim, 0);
} }
//! Immediate 'find the median value of a row vector' operation //! Immediate 'find the median value of a row vector' operation
template<typename eT> template<typename eT>
inline inline
arma_warn_unused
eT eT
median(const Row<eT>& A) median(const Row<eT>& A)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( (A.n_elem == 0), "median(): given vector has no element s" ); arma_debug_check( (A.n_elem == 0), "median(): given vector has no element s" );
return op_median::direct_median(A.mem, A.n_elem); return op_median::direct_median(A.mem, A.n_elem);
} }
//! Immediate 'find the median value of a column vector' operation //! Immediate 'find the median value of a column vector' operation
template<typename eT> template<typename eT>
inline inline
arma_warn_unused
eT eT
median(const Col<eT>& A) median(const Col<eT>& A)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( (A.n_elem == 0), "median(): given vector has no element s" ); arma_debug_check( (A.n_elem == 0), "median(): given vector has no element s" );
return op_median::direct_median(A.mem, A.n_elem); return op_median::direct_median(A.mem, A.n_elem);
} }
//! Immediate 'find the median value of a row vector' operation (complex nu mber version) //! Immediate 'find the median value of a row vector' operation (complex nu mber version)
template<typename T> template<typename T>
inline inline
arma_warn_unused
std::complex<T> std::complex<T>
median(const Row< std::complex<T> >& A) median(const Row< std::complex<T> >& A)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( (A.n_elem == 0), "median(): given vector has no element s" ); arma_debug_check( (A.n_elem == 0), "median(): given vector has no element s" );
u32 index1; u32 index1;
u32 index2; u32 index2;
op_median::direct_cx_median_index(index1, index2, A.mem, A.n_elem); op_median::direct_cx_median_index(index1, index2, A.mem, A.n_elem);
return (A.mem[index1] + A.mem[index2]) / T(2); return (A.mem[index1] + A.mem[index2]) / T(2);
} }
//! Immediate 'find the median value of a column vector' operation (complex number version) //! Immediate 'find the median value of a column vector' operation (complex number version)
template<typename T> template<typename T>
inline inline
arma_warn_unused
std::complex<T> std::complex<T>
median(const Col< std::complex<T> >& A) median(const Col< std::complex<T> >& A)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( (A.n_elem == 0), "median(): given vector has no element s" ); arma_debug_check( (A.n_elem == 0), "median(): given vector has no element s" );
u32 index1; u32 index1;
u32 index2; u32 index2;
op_median::direct_cx_median_index(index1, index2, A.mem, A.n_elem); op_median::direct_cx_median_index(index1, index2, A.mem, A.n_elem);
return (A.mem[index1] + A.mem[index2]) / T(2); return (A.mem[index1] + A.mem[index2]) / T(2);
} }
//! find the median value of a subview_row //! find the median value of a subview_row
template<typename eT> template<typename eT>
inline inline
arma_warn_unused
eT eT
median(const subview_row<eT>& A) median(const subview_row<eT>& A)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( (A.n_elem == 0), "median(): given vector has no element s" ); arma_debug_check( (A.n_elem == 0), "median(): given vector has no element s" );
return op_median::direct_median(A); return op_median::direct_median(A);
} }
//! find the median value of a subview_col //! find the median value of a subview_col
template<typename eT> template<typename eT>
inline inline
arma_warn_unused
eT eT
median(const subview_col<eT>& A) median(const subview_col<eT>& A)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( (A.n_elem == 0), "median(): given vector has no element s" ); arma_debug_check( (A.n_elem == 0), "median(): given vector has no element s" );
return op_median::direct_median(A); return op_median::direct_median(A);
} }
//! find the median value of a subview_row (complex number version) //! find the median value of a subview_row (complex number version)
template<typename T> template<typename T>
inline inline
arma_warn_unused
std::complex<T> std::complex<T>
median(const subview_row< std::complex<T> >& A) median(const subview_row< std::complex<T> >& A)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( (A.n_elem == 0), "median(): given vector has no element s" ); arma_debug_check( (A.n_elem == 0), "median(): given vector has no element s" );
u32 index1; u32 index1;
u32 index2; u32 index2;
op_median::direct_cx_median_index(index1, index2, A); op_median::direct_cx_median_index(index1, index2, A);
return (A[index1] + A[index2]) / T(2); return (A[index1] + A[index2]) / T(2);
} }
//! find the median value of a subview_col (complex number version) //! find the median value of a subview_col (complex number version)
template<typename T> template<typename T>
inline inline
arma_warn_unused
std::complex<T> std::complex<T>
median(const subview_col< std::complex<T> >& A) median(const subview_col< std::complex<T> >& A)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( (A.n_elem == 0), "median(): given vector has no element s" ); arma_debug_check( (A.n_elem == 0), "median(): given vector has no element s" );
u32 index1; u32 index1;
u32 index2; u32 index2;
op_median::direct_cx_median_index(index1, index2, A); op_median::direct_cx_median_index(index1, index2, A);
return (A[index1] + A[index2]) / T(2); return (A[index1] + A[index2]) / T(2);
} }
template<typename eT> template<typename eT>
inline inline
arma_warn_unused
eT eT
median(const diagview<eT>& A) median(const diagview<eT>& A)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( (A.n_elem == 0), "median(): given vector has no element s" ); arma_debug_check( (A.n_elem == 0), "median(): given vector has no element s" );
return op_median::direct_median(A); return op_median::direct_median(A);
} }
template<typename T> template<typename T>
inline inline
arma_warn_unused
std::complex<T> std::complex<T>
median(const diagview< std::complex<T> >& A) median(const diagview< std::complex<T> >& A)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( (A.n_elem == 0), "median(): given vector has no element s" ); arma_debug_check( (A.n_elem == 0), "median(): given vector has no element s" );
u32 index1; u32 index1;
u32 index2; u32 index2;
op_median::direct_cx_median_index(index1, index2, A); op_median::direct_cx_median_index(index1, index2, A);
 End of changes. 10 change blocks. 
0 lines changed or deleted 10 lines changed or added


 fn_min.hpp   fn_min.hpp 
skipping to change at line 40 skipping to change at line 40
min(const Base<typename T1::elem_type,T1>& X, const u32 dim = 0) min(const Base<typename T1::elem_type,T1>& X, const u32 dim = 0)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return Op<T1, op_min>(X.get_ref(), dim, 0); return Op<T1, op_min>(X.get_ref(), dim, 0);
} }
//! Immediate 'find the minimum value in a row vector' operation //! Immediate 'find the minimum value in a row vector' operation
template<typename eT> template<typename eT>
inline inline
arma_warn_unused
eT eT
min(const Row<eT>& A) min(const Row<eT>& A)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( (A.n_elem == 0), "min(): given vector has no elements" ); arma_debug_check( (A.n_elem == 0), "min(): given vector has no elements" );
return op_min::direct_min(A.mem, A.n_elem); return op_min::direct_min(A.mem, A.n_elem);
} }
//! Immediate 'find the minimum value in a column vector' //! Immediate 'find the minimum value in a column vector'
template<typename eT> template<typename eT>
inline inline
arma_warn_unused
eT eT
min(const Col<eT>& A) min(const Col<eT>& A)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( (A.n_elem == 0), "min(): given vector has no elements" ); arma_debug_check( (A.n_elem == 0), "min(): given vector has no elements" );
return op_min::direct_min(A.mem, A.n_elem); return op_min::direct_min(A.mem, A.n_elem);
} }
//! \brief //! \brief
//! Immediate 'find minimum value' operation, //! Immediate 'find minimum value' operation,
//! invoked, for example, by: min(min(A)) //! invoked, for example, by: min(min(A))
template<typename T1> template<typename T1>
inline inline
arma_warn_unused
typename T1::elem_type typename T1::elem_type
min(const Op<T1, op_min>& in) min(const Op<T1, op_min>& in)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_extra_debug_print("min(): two consecutive min() calls detected"); arma_extra_debug_print("min(): two consecutive min() calls detected");
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
const unwrap<T1> tmp1(in.m); const unwrap<T1> tmp1(in.m);
const Mat<eT>& X = tmp1.M; const Mat<eT>& X = tmp1.M;
skipping to change at line 96 skipping to change at line 99
const Op< Op<T1, op_min>, op_min> const Op< Op<T1, op_min>, op_min>
min(const Op<T1, op_min>& in, const u32 dim) min(const Op<T1, op_min>& in, const u32 dim)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return Op< Op<T1, op_min>, op_min>(in, dim, 0); return Op< Op<T1, op_min>, op_min>(in, dim, 0);
} }
template<typename eT> template<typename eT>
inline inline
arma_warn_unused
eT eT
min(const subview_row<eT>& A) min(const subview_row<eT>& A)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( (A.n_elem == 0), "min(): given vector has no elements" ); arma_debug_check( (A.n_elem == 0), "min(): given vector has no elements" );
return op_min::direct_min(A); return op_min::direct_min(A);
} }
template<typename eT> template<typename eT>
inline inline
arma_warn_unused
eT eT
min(const subview_col<eT>& A) min(const subview_col<eT>& A)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( (A.n_elem == 0), "min(): given vector has no elements" ); arma_debug_check( (A.n_elem == 0), "min(): given vector has no elements" );
return op_min::direct_min(A); return op_min::direct_min(A);
} }
template<typename eT> template<typename eT>
inline inline
arma_warn_unused
eT eT
min(const diagview<eT>& A) min(const diagview<eT>& A)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( (A.n_elem == 0), "min(): given vector has no elements" ); arma_debug_check( (A.n_elem == 0), "min(): given vector has no elements" );
return op_min::direct_min(A); return op_min::direct_min(A);
} }
template<typename eT> template<typename eT>
inline inline
arma_warn_unused
eT eT
min(const Op<subview<eT>, op_min>& in) min(const Op<subview<eT>, op_min>& in)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_extra_debug_print("max(): two consecutive max() calls detected"); arma_extra_debug_print("max(): two consecutive max() calls detected");
const subview<eT>& X = in.m; const subview<eT>& X = in.m;
arma_debug_check( (X.n_elem == 0), "max(): given matrix has no elements" ); arma_debug_check( (X.n_elem == 0), "max(): given matrix has no elements" );
 End of changes. 7 change blocks. 
0 lines changed or deleted 7 lines changed or added


 fn_norm.hpp   fn_norm.hpp 
skipping to change at line 164 skipping to change at line 164
acc += std::pow(std::abs(A[i]), int(k)); acc += std::pow(std::abs(A[i]), int(k));
} }
return std::pow(acc, eT(1)/eT(k)); return std::pow(acc, eT(1)/eT(k));
} }
} }
template<typename T1> template<typename T1>
arma_inline arma_inline
arma_warn_unused
typename T1::elem_type typename T1::elem_type
norm(const Base<typename T1::elem_type,T1>& X, const u32 k) norm(const Base<typename T1::elem_type,T1>& X, const u32 k)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
if(is_Mat<T1>::value == true) if(is_Mat<T1>::value == true)
{ {
return norm_unwrap(X, k); return norm_unwrap(X, k);
} }
else else
 End of changes. 1 change blocks. 
0 lines changed or deleted 1 lines changed or added


 fn_rank.hpp   fn_rank.hpp 
skipping to change at line 22 skipping to change at line 22
// 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_rank //! \addtogroup fn_rank
//! @{ //! @{
template<typename T1> template<typename T1>
inline inline
arma_warn_unused
u32 u32
rank(const Base<typename T1::elem_type,T1>& X, typename T1::pod_type tol = 0.0) rank(const Base<typename T1::elem_type,T1>& X, typename T1::pod_type tol = 0.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 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;
 End of changes. 1 change blocks. 
0 lines changed or deleted 1 lines changed or added


 fn_sort_index.hpp   fn_sort_index.hpp 
skipping to change at line 72 skipping to change at line 72
} }
std::sort( packet_vec.begin(), packet_vec.end() ); std::sort( packet_vec.begin(), packet_vec.end() );
for(u32 i=0; i<n_elem; ++i) for(u32 i=0; i<n_elem; ++i)
{ {
out_mem[i] = packet_vec[i].index; out_mem[i] = packet_vec[i].index;
} }
} }
template<typename T>
struct sort_index_result_type_deducer
{
typedef umat out_type;
};
//template<>
template<typename eT>
struct sort_index_result_type_deducer< Col<eT> >
{
typedef ucolvec out_type;
};
//template<>
template<typename eT>
struct sort_index_result_type_deducer< Row<eT> >
{
typedef urowvec out_type;
};
template<typename T1> template<typename T1>
inline inline
typename sort_index_result_type_deducer<T1>::out_type umat
sort_index(const BaseVec<typename T1::elem_type,T1>& X, const u32 sort_type sort_index(const Base<typename T1::elem_type,T1>& X, const u32 sort_type =
= 0) 0)
{ {
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;
arma_debug_check( (A.is_vec() == false), "sort_index(): internal error: e xpected a vector"); arma_debug_check( (A.is_vec() == false), "sort_index(): currently only ha ndles vectors");
typedef typename sort_index_result_type_deducer<T1>::out_type out_type; typedef typename umat::elem_type out_elem_type;
typedef typename out_type::elem_type out_elem_type;
out_type out(A.n_elem); 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);
sort_index_helper(out.memptr(), packet_vec, A.mem); sort_index_helper(out.memptr(), packet_vec, A.mem);
return out;
} }
else else
{ {
std::vector< arma_sort_index_packet_descend<eT,out_elem_type> > packet_ vec(A.n_elem); std::vector< arma_sort_index_packet_descend<eT,out_elem_type> > packet_ vec(A.n_elem);
sort_index_helper(out.memptr(), packet_vec, A.mem); sort_index_helper(out.memptr(), packet_vec, A.mem);
return out;
} }
return out;
} }
//! @} //! @}
 End of changes. 8 change blocks. 
31 lines changed or deleted 7 lines changed or added


 fn_stddev.hpp   fn_stddev.hpp 
skipping to change at line 42 skipping to change at line 42
Mat<out_eT> out; Mat<out_eT> out;
op_stddev::apply(out, A, norm_type, dim); op_stddev::apply(out, A, norm_type, dim);
return out; return out;
} }
//! Immediate 'find the standard deviation of a row vector' operation //! Immediate 'find the standard deviation of a row vector' operation
template<typename eT> template<typename eT>
inline inline
arma_warn_unused
typename get_pod_type<eT>::result typename get_pod_type<eT>::result
stddev(const Row<eT>& A, const u32 norm_type = 0) stddev(const Row<eT>& A, const u32 norm_type = 0)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( (A.n_elem == 0), "stddev(): given vector has no element s" ); arma_debug_check( (A.n_elem == 0), "stddev(): given vector has no element s" );
return std::sqrt( op_var::direct_var(A.mem, A.n_elem, norm_type) ); return std::sqrt( op_var::direct_var(A.mem, A.n_elem, norm_type) );
} }
//! Immediate 'find the standard deviation of a column vector' operation //! Immediate 'find the standard deviation of a column vector' operation
template<typename eT> template<typename eT>
inline inline
arma_warn_unused
typename get_pod_type<eT>::result typename get_pod_type<eT>::result
stddev(const Col<eT>& A, const u32 norm_type = 0) stddev(const Col<eT>& A, const u32 norm_type = 0)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( (A.n_elem == 0), "stddev(): given vector has no element s" ); arma_debug_check( (A.n_elem == 0), "stddev(): given vector has no element s" );
return std::sqrt( op_var::direct_var(A.mem, A.n_elem, norm_type) ); return std::sqrt( op_var::direct_var(A.mem, A.n_elem, norm_type) );
} }
//! find the standard deviation of a subview_row //! find the standard deviation of a subview_row
template<typename eT> template<typename eT>
inline inline
arma_warn_unused
typename get_pod_type<eT>::result typename get_pod_type<eT>::result
stddev(const subview_row<eT>& A, const u32 norm_type = 0) stddev(const subview_row<eT>& A, const u32 norm_type = 0)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( (A.n_elem == 0), "stddev(): given vector has no element s" ); arma_debug_check( (A.n_elem == 0), "stddev(): given vector has no element s" );
return std::sqrt( op_var::direct_var(A, norm_type) ); return std::sqrt( op_var::direct_var(A, norm_type) );
} }
//! find the standard deviation of a subview_col //! find the standard deviation of a subview_col
template<typename eT> template<typename eT>
inline inline
arma_warn_unused
typename get_pod_type<eT>::result typename get_pod_type<eT>::result
stddev(const subview_col<eT>& A, const u32 norm_type = 0) stddev(const subview_col<eT>& A, const u32 norm_type = 0)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( (A.n_elem == 0), "stddev(): given vector has no element s" ); arma_debug_check( (A.n_elem == 0), "stddev(): given vector has no element s" );
return std::sqrt( op_var::direct_var(A, norm_type) ); return std::sqrt( op_var::direct_var(A, norm_type) );
} }
//! find the standard deviation of a diagview //! find the standard deviation of a diagview
template<typename eT> template<typename eT>
inline inline
arma_warn_unused
typename get_pod_type<eT>::result typename get_pod_type<eT>::result
stddev(const diagview<eT>& A, const u32 norm_type = 0) stddev(const diagview<eT>& A, const u32 norm_type = 0)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( (A.n_elem == 0), "stddev(): given vector has no element s" ); arma_debug_check( (A.n_elem == 0), "stddev(): given vector has no element s" );
return std::sqrt( op_var::direct_var(A, norm_type) ); return std::sqrt( op_var::direct_var(A, norm_type) );
} }
 End of changes. 5 change blocks. 
0 lines changed or deleted 5 lines changed or added


 fn_sum.hpp   fn_sum.hpp 
skipping to change at line 41 skipping to change at line 41
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return Op<T1, op_sum>(X.get_ref(), dim, 0); return Op<T1, op_sum>(X.get_ref(), dim, 0);
} }
//! \brief //! \brief
//! Immediate 'sum all values' operation for a row vector //! Immediate 'sum all values' operation for a row vector
template<typename eT> template<typename eT>
arma_inline arma_inline
arma_warn_unused
eT eT
sum(const Row<eT>& X) sum(const Row<eT>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return accu(X); return accu(X);
} }
//! \brief //! \brief
//! Immediate 'sum all values' operation for a column vector //! Immediate 'sum all values' operation for a column vector
template<typename eT> template<typename eT>
arma_inline arma_inline
arma_warn_unused
eT eT
sum(const Col<eT>& X) sum(const Col<eT>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return accu(X); return accu(X);
} }
//! \brief //! \brief
//! Immediate 'sum all values' operation, //! Immediate 'sum all values' operation,
//! invoked, for example, by: sum(sum(A)) //! invoked, for example, by: sum(sum(A))
template<typename T1> template<typename T1>
arma_inline arma_inline
arma_warn_unused
typename T1::elem_type typename T1::elem_type
sum(const Op<T1, op_sum>& in) sum(const Op<T1, op_sum>& in)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_extra_debug_print("sum(): two consecutive sum() calls detected"); arma_extra_debug_print("sum(): two consecutive sum() calls detected");
return accu(in.m); return accu(in.m);
} }
template<typename T1> template<typename T1>
skipping to change at line 89 skipping to change at line 92
sum(const Op<T1, op_sum>& in, const u32 dim) sum(const Op<T1, op_sum>& in, const u32 dim)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return Op<Op<T1, op_sum>, op_sum>(in, dim, 0); return Op<Op<T1, op_sum>, op_sum>(in, dim, 0);
} }
//! sum all values of a subview_row //! sum all values of a subview_row
template<typename eT> template<typename eT>
arma_inline arma_inline
arma_warn_unused
eT eT
sum(const subview_row<eT>& X) sum(const subview_row<eT>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return accu(X); return accu(X);
} }
//! sum all values of a subview_col //! sum all values of a subview_col
template<typename eT> template<typename eT>
arma_inline arma_inline
arma_warn_unused
eT eT
sum(const subview_col<eT>& X) sum(const subview_col<eT>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return accu(X); return accu(X);
} }
//! sum all values of a diagview //! sum all values of a diagview
template<typename eT> template<typename eT>
arma_inline arma_inline
arma_warn_unused
eT eT
sum(const diagview<eT>& X) sum(const diagview<eT>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return accu(X); return accu(X);
} }
//! @} //! @}
 End of changes. 6 change blocks. 
0 lines changed or deleted 6 lines changed or added


 fn_trace.hpp   fn_trace.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 fn_trace //! \addtogroup fn_trace
//! @{ //! @{
//! Immediate trace (sum of diagonal elements) of a square dense matrix //! Immediate trace (sum of diagonal elements) of a square dense matrix
template<typename T1> template<typename T1>
inline inline
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 " ); arma_debug_check( (A.n_rows != A.n_cols), "trace(): matrix must be square " );
skipping to change at line 45 skipping to change at line 46
for(u32 i=0; i<A.n_rows; ++i) for(u32 i=0; i<A.n_rows; ++i)
{ {
val += A.at(i,i); val += A.at(i,i);
} }
return val; return val;
} }
template<typename T1> template<typename T1>
inline inline
arma_warn_unused
typename T1::elem_type typename T1::elem_type
trace(const Op<T1, op_diagmat>& X) trace(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);
const u32 N = A.n_elem; const u32 N = A.n_elem;
 End of changes. 2 change blocks. 
0 lines changed or deleted 2 lines changed or added


 fn_var.hpp   fn_var.hpp 
skipping to change at line 42 skipping to change at line 42
Mat<out_eT> out; Mat<out_eT> out;
op_var::apply(out, A, norm_type, dim); op_var::apply(out, A, norm_type, dim);
return out; return out;
} }
//! Immediate 'find the variance of a row vector' operation //! Immediate 'find the variance of a row vector' operation
template<typename eT> template<typename eT>
inline inline
arma_warn_unused
typename get_pod_type<eT>::result typename get_pod_type<eT>::result
var(const Row<eT>& A, const u32 norm_type = 0) var(const Row<eT>& A, const u32 norm_type = 0)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( (A.n_elem == 0), "var(): given vector has no elements" ); arma_debug_check( (A.n_elem == 0), "var(): given vector has no elements" );
return op_var::direct_var(A.mem, A.n_elem, norm_type); return op_var::direct_var(A.mem, A.n_elem, norm_type);
} }
//! Immediate 'find the variance of a column vector' operation //! Immediate 'find the variance of a column vector' operation
template<typename eT> template<typename eT>
inline inline
arma_warn_unused
typename get_pod_type<eT>::result typename get_pod_type<eT>::result
var(const Col<eT>& A, const u32 norm_type = 0) var(const Col<eT>& A, const u32 norm_type = 0)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( (A.n_elem == 0), "var(): given vector has no elements" ); arma_debug_check( (A.n_elem == 0), "var(): given vector has no elements" );
return op_var::direct_var(A.mem, A.n_elem, norm_type); return op_var::direct_var(A.mem, A.n_elem, norm_type);
} }
template<typename eT> template<typename eT>
inline inline
arma_warn_unused
typename get_pod_type<eT>::result typename get_pod_type<eT>::result
var(const subview_row<eT>& A, const u32 norm_type = 0) var(const subview_row<eT>& A, const u32 norm_type = 0)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( (A.n_elem == 0), "var(): given vector has no elements" ); arma_debug_check( (A.n_elem == 0), "var(): given vector has no elements" );
return op_var::direct_var(A, norm_type); return op_var::direct_var(A, norm_type);
} }
template<typename eT> template<typename eT>
inline inline
arma_warn_unused
typename get_pod_type<eT>::result typename get_pod_type<eT>::result
var(const subview_col<eT>& A, const u32 norm_type = 0) var(const subview_col<eT>& A, const u32 norm_type = 0)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( (A.n_elem == 0), "var(): given vector has no elements" ); arma_debug_check( (A.n_elem == 0), "var(): given vector has no elements" );
return op_var::direct_var(A, norm_type); return op_var::direct_var(A, norm_type);
} }
template<typename eT> template<typename eT>
inline inline
arma_warn_unused
typename get_pod_type<eT>::result typename get_pod_type<eT>::result
var(const diagview<eT>& A, const u32 norm_type = 0) var(const diagview<eT>& A, const u32 norm_type = 0)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( (A.n_elem == 0), "var(): given vector has no elements" ); arma_debug_check( (A.n_elem == 0), "var(): given vector has no elements" );
return op_var::direct_var(A, norm_type); return op_var::direct_var(A, norm_type);
} }
 End of changes. 5 change blocks. 
0 lines changed or deleted 5 lines changed or added


 op_htrans_meat.hpp   op_htrans_meat.hpp 
skipping to change at line 69 skipping to change at line 69
{ {
arma_extra_debug_print("doing in-place hermitian transpose of a squar e matrix"); arma_extra_debug_print("doing in-place hermitian transpose of a squar e matrix");
const u32 n_rows = out.n_rows; const u32 n_rows = out.n_rows;
const u32 n_cols = out.n_cols; const u32 n_cols = out.n_cols;
for(u32 col=0; col<n_cols; ++col) for(u32 col=0; col<n_cols; ++col)
{ {
eT* coldata = out.colptr(col); eT* coldata = out.colptr(col);
out.at(col,col) = std::conj( out.at(col,col) );
for(u32 row=(col+1); row<n_rows; ++row) for(u32 row=(col+1); row<n_rows; ++row)
{ {
eT val1 = std::conj(coldata[row]); const eT val1 = std::conj(coldata[row]);
eT val2 = std::conj(out.at(col,row)); const eT val2 = std::conj(out.at(col,row));
out.at(col,row) = val1; out.at(col,row) = val1;
coldata[row] = val2; coldata[row] = val2;
} }
} }
} }
else else
{ {
const Mat<eT> A_copy = A; const Mat<eT> A_copy = A;
op_trans::apply_noalias(out, A_copy); op_htrans::apply_noalias(out, A_copy);
} }
} }
} }
template<typename T, typename T1> template<typename T, typename T1>
inline inline
void void
op_htrans::apply(Mat< std::complex<T> >& out, const Op<T1,op_htrans>& in) op_htrans::apply(Mat< std::complex<T> >& out, const Op<T1,op_htrans>& in)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename std::complex<T> eT; typedef typename std::complex<T> eT;
isnt_same_type<eT,typename T1::elem_type>::check(); isnt_same_type<eT,typename T1::elem_type>::check();
const unwrap<T1> tmp(in.m); const unwrap<T1> tmp(in.m);
const Mat<eT>& A = tmp.M; const Mat<eT>& A = tmp.M;
if(&out != &A) op_htrans::apply(out, A);
{
op_htrans::apply_noalias(out, A);
}
else
{
if(out.n_rows == out.n_cols)
{
arma_extra_debug_print("doing in-place hermitian transpose of a squar
e matrix");
const u32 n_rows = out.n_rows;
const u32 n_cols = out.n_cols;
for(u32 col=0; col<n_cols; ++col)
{
eT* coldata = out.colptr(col);
for(u32 row=(col+1); row<n_rows; ++row)
{
eT val1 = std::conj(coldata[row]);
eT val2 = std::conj(out.at(col,row));
out.at(col,row) = val1;
coldata[row] = val2;
}
}
}
else
{
const Mat<eT> A_copy = A;
op_trans::apply_noalias(out, A_copy);
}
}
} }
//! @} //! @}
 End of changes. 4 change blocks. 
38 lines changed or deleted 6 lines changed or added


 op_princomp_meat.hpp   op_princomp_meat.hpp 
skipping to change at line 49 skipping to change at line 49
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
const u32 n_rows = in.n_rows; const u32 n_rows = in.n_rows;
const u32 n_cols = in.n_cols; const u32 n_cols = in.n_cols;
if(n_rows > 1) // more than one sample if(n_rows > 1) // more than one sample
{ {
// subtract the mean - use score_out as temporary matrix // subtract the mean - use score_out as temporary matrix
score_out = in - repmat(mean(in), n_rows, 1); score_out = in - repmat(mean(in), n_rows, 1);
// singular value decomposition // singular value decomposition
Mat<eT> U; Mat<eT> U;
Col<eT> s; Col<eT> s;
const bool svd_ok = svd(U,s,coeff_out,score_out); const bool svd_ok = svd(U,s,coeff_out,score_out);
arma_debug_check(svd_ok == false, "princomp(): singular value decomposi
tion failed"); if(svd_ok == false)
{
arma_print("princomp(): singular value decomposition failed");
coeff_out.reset();
score_out.reset();
latent_out.reset();
tsquared_out.reset();
return;
}
//U.reset(); // TODO: do we need this ? U will get automatically dele ted anyway //U.reset(); // TODO: do we need this ? U will get automatically dele ted anyway
// normalize the eigenvalues // normalize the eigenvalues
s /= std::sqrt(n_rows - 1); s /= std::sqrt(n_rows - 1);
// project the samples to the principals // project the samples to the principals
score_out *= coeff_out; score_out *= coeff_out;
if(n_rows <= n_cols) // number of samples is less than their dimensiona lity if(n_rows <= n_cols) // number of samples is less than their dimensiona lity
skipping to change at line 144 skipping to change at line 155
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
const u32 n_rows = in.n_rows; const u32 n_rows = in.n_rows;
const u32 n_cols = in.n_cols; const u32 n_cols = in.n_cols;
if(n_rows > 1) // more than one sample if(n_rows > 1) // more than one sample
{ {
// subtract the mean - use score_out as temporary matrix // subtract the mean - use score_out as temporary matrix
score_out = in - repmat(mean(in), n_rows, 1); score_out = in - repmat(mean(in), n_rows, 1);
// singular value decomposition // singular value decomposition
Mat<eT> U; Mat<eT> U;
Col<eT> s; Col<eT> s;
const bool svd_ok = svd(U,s,coeff_out,score_out); const bool svd_ok = svd(U,s,coeff_out,score_out);
arma_debug_check(svd_ok == false, "princomp(): singular value decomposi
tion failed"); if(svd_ok == false)
{
arma_print("princomp(): singular value decomposition failed");
coeff_out.reset();
score_out.reset();
latent_out.reset();
return;
}
// U.reset(); // U.reset();
// normalize the eigenvalues // normalize the eigenvalues
s /= std::sqrt(n_rows - 1); s /= std::sqrt(n_rows - 1);
// project the samples to the principals // project the samples to the principals
score_out *= coeff_out; score_out *= coeff_out;
if(n_rows <= n_cols) // number of samples is less than their dimensiona lity if(n_rows <= n_cols) // number of samples is less than their dimensiona lity
skipping to change at line 219 skipping to change at line 240
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
const u32 n_rows = in.n_rows; const u32 n_rows = in.n_rows;
const u32 n_cols = in.n_cols; const u32 n_cols = in.n_cols;
if(n_rows > 1) // more than one sample if(n_rows > 1) // more than one sample
{ {
// subtract the mean - use score_out as temporary matrix // subtract the mean - use score_out as temporary matrix
score_out = in - repmat(mean(in), n_rows, 1); score_out = in - repmat(mean(in), n_rows, 1);
// singular value decomposition // singular value decomposition
Mat<eT> U; Mat<eT> U;
Col<eT> s; Col<eT> s;
const bool svd_ok = svd(U,s,coeff_out,score_out); const bool svd_ok = svd(U,s,coeff_out,score_out);
arma_debug_check(svd_ok == false, "princomp(): singular value decomposi
tion failed"); if(svd_ok == false)
{
arma_print("princomp(): singular value decomposition failed");
coeff_out.reset();
score_out.reset();
return;
}
// U.reset(); // U.reset();
// normalize the eigenvalues // normalize the eigenvalues
s /= std::sqrt(n_rows - 1); s /= std::sqrt(n_rows - 1);
// project the samples to the principals // project the samples to the principals
score_out *= coeff_out; score_out *= coeff_out;
if(n_rows <= n_cols) // number of samples is less than their dimensiona lity if(n_rows <= n_cols) // number of samples is less than their dimensiona lity
skipping to change at line 276 skipping to change at line 306
op_princomp::direct_princomp op_princomp::direct_princomp
( (
Mat<eT>& coeff_out, Mat<eT>& coeff_out,
const Mat<eT>& in const Mat<eT>& in
) )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
if(in.n_elem != 0) if(in.n_elem != 0)
{ {
// singular value decomposition // singular value decomposition
Mat<eT> U; Mat<eT> U;
Col<eT> s; Col<eT> s;
const bool svd_ok = svd(U,s,coeff_out, (in - repmat(mean(in), in.n_rows const Mat<eT> tmp = in - repmat(mean(in), in.n_rows, 1);
, 1)));
const bool svd_ok = svd(U,s,coeff_out, tmp);
arma_debug_check(svd_ok == false, "princomp(): singular value decomposi if(svd_ok == false)
tion failed"); {
arma_print("princomp(): singular value decomposition failed");
coeff_out.reset();
}
} }
else else
{ {
coeff_out.reset(); coeff_out.reset();
} }
} }
//! \brief //! \brief
//! principal component analysis -- 4 arguments complex version //! principal component analysis -- 4 arguments complex version
//! computation is done via singular value decomposition //! computation is done via singular value decomposition
skipping to change at line 321 skipping to change at line 358
typedef std::complex<T> eT; typedef std::complex<T> eT;
const u32 n_rows = in.n_rows; const u32 n_rows = in.n_rows;
const u32 n_cols = in.n_cols; const u32 n_cols = in.n_cols;
if(n_rows > 1) // more than one sample if(n_rows > 1) // more than one sample
{ {
// subtract the mean - use score_out as temporary matrix // subtract the mean - use score_out as temporary matrix
score_out = in - repmat(mean(in), n_rows, 1); score_out = in - repmat(mean(in), n_rows, 1);
// singular value decomposition // singular value decomposition
Mat<eT> U; Mat<eT> U;
Col<T> s; Col<T> s;
const bool svd_ok = svd(U,s,coeff_out,score_out); const bool svd_ok = svd(U,s,coeff_out,score_out);
arma_debug_check(svd_ok == false, "princomp(): singular value decomposi
tion failed"); if(svd_ok == false)
{
arma_print("princomp(): singular value decomposition failed");
coeff_out.reset();
score_out.reset();
latent_out.reset();
tsquared_out.reset();
return;
}
//U.reset(); //U.reset();
// normalize the eigenvalues // normalize the eigenvalues
s /= std::sqrt(n_rows - 1); s /= std::sqrt(n_rows - 1);
// project the samples to the principals // project the samples to the principals
score_out *= coeff_out; score_out *= coeff_out;
if(n_rows <= n_cols) // number of samples is less than their dimensiona lity if(n_rows <= n_cols) // number of samples is less than their dimensiona lity
skipping to change at line 352 skipping to change at line 400
s = s_tmp; s = s_tmp;
// compute the Hotelling's T-squared // compute the Hotelling's T-squared
s_tmp.rows(0,n_rows-2) = 1.0 / s_tmp.rows(0,n_rows-2); s_tmp.rows(0,n_rows-2) = 1.0 / s_tmp.rows(0,n_rows-2);
const Mat<eT> S = score_out * diagmat(Col<T>(s_tmp)); const Mat<eT> S = score_out * diagmat(Col<T>(s_tmp));
tsquared_out = sum(S%S,1); tsquared_out = sum(S%S,1);
} }
else else
{ {
// compute the Hotelling's T-squared // compute the Hotelling's T-squared
const Mat<eT> S = score_out * diagmat(Col<T>(eT(1) / s)); const Mat<eT> S = score_out * diagmat(Col<T>(T(1) / s));
tsquared_out = sum(S%S,1); tsquared_out = sum(S%S,1);
} }
// compute the eigenvalues of the principal vectors // compute the eigenvalues of the principal vectors
latent_out = s%s; latent_out = s%s;
} }
else // single sample - row else // single sample - row
{ {
if(n_rows == 1) if(n_rows == 1)
skipping to change at line 414 skipping to change at line 462
typedef std::complex<T> eT; typedef std::complex<T> eT;
const u32 n_rows = in.n_rows; const u32 n_rows = in.n_rows;
const u32 n_cols = in.n_cols; const u32 n_cols = in.n_cols;
if(n_rows > 1) // more than one sample if(n_rows > 1) // more than one sample
{ {
// subtract the mean - use score_out as temporary matrix // subtract the mean - use score_out as temporary matrix
score_out = in - repmat(mean(in), n_rows, 1); score_out = in - repmat(mean(in), n_rows, 1);
// singular value decomposition // singular value decomposition
Mat<eT> U; Mat<eT> U;
Col< T> s; Col< T> s;
const bool svd_ok = svd(U,s,coeff_out,score_out); const bool svd_ok = svd(U,s,coeff_out,score_out);
arma_debug_check(svd_ok == false, "princomp(): singular value decomposi
tion failed"); if(svd_ok == false)
{
arma_print("princomp(): singular value decomposition failed");
coeff_out.reset();
score_out.reset();
latent_out.reset();
return;
}
// U.reset(); // U.reset();
// normalize the eigenvalues // normalize the eigenvalues
s /= std::sqrt(n_rows - 1); s /= std::sqrt(n_rows - 1);
// project the samples to the principals // project the samples to the principals
score_out *= coeff_out; score_out *= coeff_out;
if(n_rows <= n_cols) // number of samples is less than their dimensiona lity if(n_rows <= n_cols) // number of samples is less than their dimensiona lity
skipping to change at line 488 skipping to change at line 546
typedef std::complex<T> eT; typedef std::complex<T> eT;
const u32 n_rows = in.n_rows; const u32 n_rows = in.n_rows;
const u32 n_cols = in.n_cols; const u32 n_cols = in.n_cols;
if(n_rows > 1) // more than one sample if(n_rows > 1) // more than one sample
{ {
// subtract the mean - use score_out as temporary matrix // subtract the mean - use score_out as temporary matrix
score_out = in - repmat(mean(in), n_rows, 1); score_out = in - repmat(mean(in), n_rows, 1);
// singular value decomposition // singular value decomposition
Mat<eT> U; Mat<eT> U;
Col< T> s; Col< T> s;
const bool svd_ok = svd(U,s,coeff_out,score_out); const bool svd_ok = svd(U,s,coeff_out,score_out);
arma_debug_check(svd_ok == false, "princomp(): singular value decomposi
tion failed"); if(svd_ok == false)
{
arma_print("princomp(): singular value decomposition failed");
coeff_out.reset();
score_out.reset();
return;
}
// U.reset(); // U.reset();
// normalize the eigenvalues // normalize the eigenvalues
s /= std::sqrt(n_rows - 1); s /= std::sqrt(n_rows - 1);
// project the samples to the principals // project the samples to the principals
score_out *= coeff_out; score_out *= coeff_out;
if(n_rows <= n_cols) // number of samples is less than their dimensiona lity if(n_rows <= n_cols) // number of samples is less than their dimensiona lity
skipping to change at line 549 skipping to change at line 616
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename std::complex<T> eT; typedef typename std::complex<T> eT;
if(in.n_elem != 0) if(in.n_elem != 0)
{ {
// singular value decomposition // singular value decomposition
Mat<eT> U; Mat<eT> U;
Col< T> s; Col< T> s;
const bool svd_ok = svd(U,s,coeff_out, (in - repmat(mean(in), in.n_rows const Mat<eT> tmp = in - repmat(mean(in), in.n_rows, 1);
, 1)));
arma_debug_check(svd_ok == false, "princomp(): singular value decomposi const bool svd_ok = svd(U,s,coeff_out, tmp);
tion failed");
if(svd_ok == false)
{
arma_print("princomp(): singular value decomposition failed");
coeff_out.reset();
}
} }
else else
{ {
coeff_out.reset(); coeff_out.reset();
} }
} }
template<typename T1> template<typename T1>
inline inline
void void
 End of changes. 17 change blocks. 
35 lines changed or deleted 100 lines changed or added


 op_trans_meat.hpp   op_trans_meat.hpp 
skipping to change at line 102 skipping to change at line 102
void void
op_trans::apply(Mat<typename T1::elem_type>& out, const Op<T1,op_trans>& in ) op_trans::apply(Mat<typename T1::elem_type>& out, const Op<T1,op_trans>& in )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
const unwrap<T1> tmp(in.m); const unwrap<T1> tmp(in.m);
const Mat<eT>& A = tmp.M; const Mat<eT>& A = tmp.M;
if(&out != &A) op_trans::apply(out, A);
{
op_trans::apply_noalias(out, A);
}
else
{
if(out.n_rows == out.n_cols)
{
arma_extra_debug_print("op_trans::apply(): doing in-place transpose o
f a square matrix");
const u32 n_rows = out.n_rows;
const u32 n_cols = out.n_cols;
for(u32 col=0; col<n_cols; ++col)
{
eT* coldata = out.colptr(col);
for(u32 row=(col+1); row<n_rows; ++row)
{
std::swap( out.at(col,row), coldata[row] );
}
}
}
else
{
const Mat<eT> A_copy = A;
op_trans::apply_noalias(out, A_copy);
}
}
} }
// inline void op_trans::apply_inplace(mat &X) // inline void op_trans::apply_inplace(mat &X)
// { // {
// arma_extra_debug_sigprint(); // arma_extra_debug_sigprint();
// //
// if((X.n_rows == 1) || (X.n_cols == 1)) // if((X.n_rows == 1) || (X.n_cols == 1))
// { // {
// const u32 old_n_rows = X.n_rows; // const u32 old_n_rows = X.n_rows;
// access::rw(X.n_rows) = X.n_cols; // access::rw(X.n_rows) = X.n_cols;
 End of changes. 1 change blocks. 
31 lines changed or deleted 1 lines changed or added


 podarray_meat.hpp   podarray_meat.hpp 
skipping to change at line 68 skipping to change at line 68
inline inline
const podarray<eT>& const podarray<eT>&
podarray<eT>::operator=(const podarray& x) podarray<eT>::operator=(const podarray& x)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
if(this != &x) if(this != &x)
{ {
init(x.n_elem); init(x.n_elem);
for(u32 i=0; i<n_elem; ++i) syslib::copy_elem( memptr(), x.memptr(), n_elem );
{
access::rw(mem[i]) = x.mem[i];
}
} }
return *this; return *this;
} }
template<typename eT> template<typename eT>
arma_inline arma_inline
podarray<eT>::podarray(const u32 new_n_elem) podarray<eT>::podarray(const u32 new_n_elem)
: n_elem(0) : n_elem(0)
, mem (0) , mem (0)
skipping to change at line 98 skipping to change at line 95
template<typename eT> template<typename eT>
arma_inline arma_inline
podarray<eT>::podarray(const eT* X, const u32 new_n_elem) podarray<eT>::podarray(const eT* X, const u32 new_n_elem)
: n_elem(0) : n_elem(0)
, mem (0) , mem (0)
{ {
arma_extra_debug_sigprint_this(this); arma_extra_debug_sigprint_this(this);
init(new_n_elem); init(new_n_elem);
for(u32 i=0; i<n_elem; ++i) syslib::copy_elem( memptr(), X, new_n_elem );
{
access::rw(mem[i]) = X[i];
}
} }
template<typename eT> template<typename eT>
arma_inline arma_inline
eT eT
podarray<eT>::operator[] (const u32 i) const podarray<eT>::operator[] (const u32 i) const
{ {
return mem[i]; return mem[i];
} }
 End of changes. 2 change blocks. 
8 lines changed or deleted 2 lines changed or added


 syslib_proto.hpp   syslib_proto.hpp 
skipping to change at line 32 skipping to change at line 32
template<typename eT> template<typename eT>
arma_hot arma_hot
inline inline
static static
void void
copy_elem(eT* dest, const eT* src, const u32 n_elem) copy_elem(eT* dest, const eT* src, const u32 n_elem)
{ {
if( n_elem <= (128/sizeof(eT)) ) if( n_elem <= (128/sizeof(eT)) )
{ {
for(u32 i=0; i<n_elem; ++i) u32 i,j;
for(i=0, j=1; j<n_elem; i+=2, j+=2)
{
dest[i] = src[i];
dest[j] = src[j];
}
if(i < n_elem)
{ {
dest[i] = src[i]; dest[i] = src[i];
} }
} }
else else
{ {
std::memcpy(dest, src, n_elem*sizeof(eT)); std::memcpy(dest, src, n_elem*sizeof(eT));
} }
} }
 End of changes. 1 change blocks. 
1 lines changed or deleted 9 lines changed or added


 version.hpp   version.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 version //! \addtogroup version
//! @{ //! @{
struct arma_version struct arma_version
{ {
static const unsigned int major = 0; static const unsigned int major = 0;
static const unsigned int minor = 9; static const unsigned int minor = 9;
static const unsigned int patch = 0; static const unsigned int patch = 2;
}; };
struct arma_config struct arma_config
{ {
#if defined(ARMA_USE_ATLAS) #if defined(ARMA_USE_ATLAS)
static const bool atlas = true; static const bool atlas = true;
#else #else
static const bool atlas = false; static const bool atlas = false;
#endif #endif
 End of changes. 1 change blocks. 
1 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/