Col_bones.hpp   Col_bones.hpp 
skipping to change at line 191 skipping to change at line 191
using Col<eT>::operator(); using Col<eT>::operator();
#if defined(ARMA_USE_CXX11) #if defined(ARMA_USE_CXX11)
inline fixed(const std::initializer_list<eT>& list); inline fixed(const std::initializer_list<eT>& list);
inline const Col& operator=(const std::initializer_list<eT>& list); inline const Col& operator=(const std::initializer_list<eT>& list);
#endif #endif
arma_inline const Col& operator=(const fixed<fixed_n_elem>& X); arma_inline const Col& operator=(const fixed<fixed_n_elem>& X);
template<typename T1, typename eop_type> inline const Col& operator=(cons
t eOp<T1, eop_type>& X);
template<typename T1, typename T2, typename eglue_type> inline const Col&
operator=(const eGlue<T1, T2, eglue_type>& X);
arma_inline const Op< Col_fixed_type, op_htrans > t() const; arma_inline const Op< Col_fixed_type, op_htrans > t() const;
arma_inline const Op< Col_fixed_type, op_htrans > ht() const; arma_inline const Op< Col_fixed_type, op_htrans > ht() const;
arma_inline const Op< Col_fixed_type, op_strans > st() const; arma_inline const Op< Col_fixed_type, op_strans > st() const;
arma_inline arma_warn_unused const eT& at_alt (const uword i) const; arma_inline arma_warn_unused const eT& at_alt (const uword i) const;
arma_inline arma_warn_unused eT& operator[] (const uword i); arma_inline arma_warn_unused eT& operator[] (const uword i);
arma_inline arma_warn_unused const eT& operator[] (const uword i) const; arma_inline arma_warn_unused const eT& operator[] (const uword i) const;
arma_inline arma_warn_unused eT& at (const uword i); arma_inline arma_warn_unused eT& at (const uword i);
arma_inline arma_warn_unused const eT& at (const uword i) const; arma_inline arma_warn_unused const eT& at (const uword i) const;
 End of changes. 1 change blocks. 
0 lines changed or deleted 6 lines changed or added


 Col_meat.hpp   Col_meat.hpp 
skipping to change at line 1091 skipping to change at line 1091
#endif #endif
template<typename eT> template<typename eT>
template<uword fixed_n_elem> template<uword fixed_n_elem>
arma_inline arma_inline
const Col<eT>& const Col<eT>&
Col<eT>::fixed<fixed_n_elem>::operator=(const fixed<fixed_n_elem>& X) Col<eT>::fixed<fixed_n_elem>::operator=(const fixed<fixed_n_elem>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
eT* dest = (use_extra) ? mem_local_extra : Mat<eT>::mem_local; if(this != &X)
const eT* src = (use_extra) ? X.mem_local_extra : X.mem_local; {
eT* dest = (use_extra) ? mem_local_extra : Mat<eT>::mem_local;
const eT* src = (use_extra) ? X.mem_local_extra : X.mem_local;
arrayops::copy( dest, src, fixed_n_elem ); arrayops::copy( dest, src, fixed_n_elem );
}
return *this;
}
template<typename eT>
template<uword fixed_n_elem>
template<typename T1, typename eop_type>
inline
const Col<eT>&
Col<eT>::fixed<fixed_n_elem>::operator=(const eOp<T1, eop_type>& X)
{
arma_extra_debug_sigprint();
arma_type_check(( is_same_type< eT, typename T1::elem_type >::no ));
const bool bad_alias = (eOp<T1, eop_type>::proxy_type::has_subview && X
.P.is_alias(*this));
if(bad_alias == false)
{
arma_debug_assert_same_size(fixed_n_elem, uword(1), X.get_n_rows(), X.g
et_n_cols(), "Col::fixed::operator=");
eop_type::apply(*this, X);
}
else
{
arma_extra_debug_print("bad_alias = true");
Col<eT> tmp(X);
(*this) = tmp;
}
return *this;
}
template<typename eT>
template<uword fixed_n_elem>
template<typename T1, typename T2, typename eglue_type>
inline
const Col<eT>&
Col<eT>::fixed<fixed_n_elem>::operator=(const eGlue<T1, T2, eglue_type>& X)
{
arma_extra_debug_sigprint();
arma_type_check(( is_same_type< eT, typename T1::elem_type >::no ));
arma_type_check(( is_same_type< eT, typename T2::elem_type >::no ));
const bool bad_alias =
(
(eGlue<T1, T2, eglue_type>::proxy1_type::has_subview && X.P1.is_alias
(*this))
||
(eGlue<T1, T2, eglue_type>::proxy2_type::has_subview && X.P2.is_alias
(*this))
);
if(bad_alias == false)
{
arma_debug_assert_same_size(fixed_n_elem, uword(1), X.get_n_rows(), X.g
et_n_cols(), "Col::fixed::operator=");
eglue_type::apply(*this, X);
}
else
{
arma_extra_debug_print("bad_alias = true");
Col<eT> tmp(X);
(*this) = tmp;
}
return *this; return *this;
} }
template<typename eT> template<typename eT>
template<uword fixed_n_elem> template<uword fixed_n_elem>
arma_inline arma_inline
const Op< typename Col<eT>::template fixed<fixed_n_elem>::Col_fixed_type, o p_htrans > const Op< typename Col<eT>::template fixed<fixed_n_elem>::Col_fixed_type, o p_htrans >
Col<eT>::fixed<fixed_n_elem>::t() const Col<eT>::fixed<fixed_n_elem>::t() const
{ {
 End of changes. 2 change blocks. 
3 lines changed or deleted 79 lines changed or added


 Mat_bones.hpp   Mat_bones.hpp 
// Copyright (C) 2008-2014 Conrad Sanderson // Copyright (C) 2008-2015 Conrad Sanderson
// Copyright (C) 2008-2014 NICTA (www.nicta.com.au) // Copyright (C) 2008-2015 NICTA (www.nicta.com.au)
// Copyright (C) 2012-2014 Ryan Curtin // Copyright (C) 2012-2014 Ryan Curtin
// //
// This Source Code Form is subject to the terms of the Mozilla Public // This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this // License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
//! \addtogroup Mat //! \addtogroup Mat
//! @{ //! @{
//! Dense matrix class //! Dense matrix class
skipping to change at line 197 skipping to change at line 197
inline subview<eT> submat (const span& row_span, const span & col_span); inline subview<eT> submat (const span& row_span, const span & col_span);
inline const subview<eT> submat (const span& row_span, const span & col_span) const; inline const subview<eT> submat (const span& row_span, const span & col_span) const;
inline subview<eT> operator()(const span& row_span, const span & col_span); inline subview<eT> operator()(const span& row_span, const span & col_span);
inline const subview<eT> operator()(const span& row_span, const span & col_span) const; inline const subview<eT> operator()(const span& row_span, const span & col_span) const;
inline subview<eT> operator()(const uword in_row1, const uword in_col1, const SizeMat& s); inline subview<eT> operator()(const uword in_row1, const uword in_col1, const SizeMat& s);
inline const subview<eT> operator()(const uword in_row1, const uword in_col1, const SizeMat& s) const; inline const subview<eT> operator()(const uword in_row1, const uword in_col1, const SizeMat& s) const;
inline subview<eT> head_rows(const uword N);
inline const subview<eT> head_rows(const uword N) const;
inline subview<eT> tail_rows(const uword N);
inline const subview<eT> tail_rows(const uword N) const;
inline subview<eT> head_cols(const uword N);
inline const subview<eT> head_cols(const uword N) const;
inline subview<eT> tail_cols(const uword N);
inline const subview<eT> tail_cols(const uword N) const;
template<typename T1> arma_inline subview_elem1<eT,T1> elem(const B ase<uword,T1>& a); template<typename T1> arma_inline subview_elem1<eT,T1> elem(const B ase<uword,T1>& a);
template<typename T1> arma_inline const subview_elem1<eT,T1> elem(const B ase<uword,T1>& a) const; template<typename T1> arma_inline const subview_elem1<eT,T1> elem(const B ase<uword,T1>& a) const;
template<typename T1> arma_inline subview_elem1<eT,T1> operator()(c onst Base<uword,T1>& a); template<typename T1> arma_inline subview_elem1<eT,T1> operator()(c onst Base<uword,T1>& a);
template<typename T1> arma_inline const subview_elem1<eT,T1> operator()(c onst Base<uword,T1>& a) const; template<typename T1> arma_inline const subview_elem1<eT,T1> operator()(c onst Base<uword,T1>& a) const;
template<typename T1, typename T2> arma_inline subview_elem2<eT,T1, T2> elem(const Base<uword,T1>& ri, const Base<uword,T2>& ci); template<typename T1, typename T2> arma_inline subview_elem2<eT,T1, T2> elem(const Base<uword,T1>& ri, const Base<uword,T2>& ci);
template<typename T1, typename T2> arma_inline const subview_elem2<eT,T1, T2> elem(const Base<uword,T1>& ri, const Base<uword,T2>& ci) const; template<typename T1, typename T2> arma_inline const subview_elem2<eT,T1, T2> elem(const Base<uword,T1>& ri, const Base<uword,T2>& ci) const;
template<typename T1, typename T2> arma_inline subview_elem2<eT,T1, T2> submat(const Base<uword,T1>& ri, const Base<uword,T2>& ci); template<typename T1, typename T2> arma_inline subview_elem2<eT,T1, T2> submat(const Base<uword,T1>& ri, const Base<uword,T2>& ci);
skipping to change at line 670 skipping to change at line 682
using Mat<eT>::operator=; using Mat<eT>::operator=;
using Mat<eT>::operator(); using Mat<eT>::operator();
#if defined(ARMA_USE_CXX11) #if defined(ARMA_USE_CXX11)
inline fixed(const std::initializer_list<eT>& list); inline fixed(const std::initializer_list<eT>& list);
inline const Mat& operator=(const std::initializer_list<eT>& list); inline const Mat& operator=(const std::initializer_list<eT>& list);
#endif #endif
arma_inline const Mat& operator=(const fixed<fixed_n_rows, fixed_n_cols>& X); arma_inline const Mat& operator=(const fixed<fixed_n_rows, fixed_n_cols>& X);
template<typename T1, typename eop_type> inline const Mat& operator=(cons
t eOp<T1, eop_type>& X);
template<typename T1, typename T2, typename eglue_type> inline const Mat&
operator=(const eGlue<T1, T2, eglue_type>& X);
arma_inline const Op< Mat_fixed_type, op_htrans > t() const; arma_inline const Op< Mat_fixed_type, op_htrans > t() const;
arma_inline const Op< Mat_fixed_type, op_htrans > ht() const; arma_inline const Op< Mat_fixed_type, op_htrans > ht() const;
arma_inline const Op< Mat_fixed_type, op_strans > st() const; arma_inline const Op< Mat_fixed_type, op_strans > st() const;
arma_inline arma_warn_unused const eT& at_alt (const uword i) const; arma_inline arma_warn_unused const eT& at_alt (const uword i) const;
arma_inline arma_warn_unused eT& operator[] (const uword i); arma_inline arma_warn_unused eT& operator[] (const uword i);
arma_inline arma_warn_unused const eT& operator[] (const uword i) const; arma_inline arma_warn_unused const eT& operator[] (const uword i) const;
arma_inline arma_warn_unused eT& at (const uword i); arma_inline arma_warn_unused eT& at (const uword i);
arma_inline arma_warn_unused const eT& at (const uword i) const; arma_inline arma_warn_unused const eT& at (const uword i) const;
 End of changes. 3 change blocks. 
2 lines changed or deleted 20 lines changed or added


 Mat_meat.hpp   Mat_meat.hpp 
skipping to change at line 2933 skipping to change at line 2933
inline inline
const subview<eT> const subview<eT>
Mat<eT>::operator()(const uword in_row1, const uword in_col1, const SizeMat & s) const Mat<eT>::operator()(const uword in_row1, const uword in_col1, const SizeMat & s) const
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return (*this).submat(in_row1, in_col1, s); return (*this).submat(in_row1, in_col1, s);
} }
template<typename eT> template<typename eT>
inline
subview<eT>
Mat<eT>::head_rows(const uword N)
{
arma_extra_debug_sigprint();
arma_debug_check( (N > n_rows), "Mat::head_rows(): size out of bounds");
return subview<eT>(*this, 0, 0, N, n_cols);
}
template<typename eT>
inline
const subview<eT>
Mat<eT>::head_rows(const uword N) const
{
arma_extra_debug_sigprint();
arma_debug_check( (N > n_rows), "Mat::head_rows(): size out of bounds");
return subview<eT>(*this, 0, 0, N, n_cols);
}
template<typename eT>
inline
subview<eT>
Mat<eT>::tail_rows(const uword N)
{
arma_extra_debug_sigprint();
arma_debug_check( (N > n_rows), "Mat::tail_rows(): size out of bounds");
const uword start_row = n_rows - N;
return subview<eT>(*this, start_row, 0, N, n_cols);
}
template<typename eT>
inline
const subview<eT>
Mat<eT>::tail_rows(const uword N) const
{
arma_extra_debug_sigprint();
arma_debug_check( (N > n_rows), "Mat::tail_rows(): size out of bounds");
const uword start_row = n_rows - N;
return subview<eT>(*this, start_row, 0, N, n_cols);
}
template<typename eT>
inline
subview<eT>
Mat<eT>::head_cols(const uword N)
{
arma_extra_debug_sigprint();
arma_debug_check( (N > n_cols), "Mat::head_cols(): size out of bounds");
return subview<eT>(*this, 0, 0, n_rows, N);
}
template<typename eT>
inline
const subview<eT>
Mat<eT>::head_cols(const uword N) const
{
arma_extra_debug_sigprint();
arma_debug_check( (N > n_cols), "Mat::head_cols(): size out of bounds");
return subview<eT>(*this, 0, 0, n_rows, N);
}
template<typename eT>
inline
subview<eT>
Mat<eT>::tail_cols(const uword N)
{
arma_extra_debug_sigprint();
arma_debug_check( (N > n_cols), "Mat::tail_cols(): size out of bounds");
const uword start_col = n_cols - N;
return subview<eT>(*this, 0, start_col, n_rows, N);
}
template<typename eT>
inline
const subview<eT>
Mat<eT>::tail_cols(const uword N) const
{
arma_extra_debug_sigprint();
arma_debug_check( (N > n_cols), "Mat::tail_cols(): size out of bounds");
const uword start_col = n_cols - N;
return subview<eT>(*this, 0, start_col, n_rows, N);
}
template<typename eT>
template<typename T1> template<typename T1>
arma_inline arma_inline
subview_elem1<eT,T1> subview_elem1<eT,T1>
Mat<eT>::elem(const Base<uword,T1>& a) Mat<eT>::elem(const Base<uword,T1>& a)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return subview_elem1<eT,T1>(*this, a); return subview_elem1<eT,T1>(*this, a);
} }
skipping to change at line 6519 skipping to change at line 6623
#endif #endif
template<typename eT> template<typename eT>
template<uword fixed_n_rows, uword fixed_n_cols> template<uword fixed_n_rows, uword fixed_n_cols>
arma_inline arma_inline
const Mat<eT>& const Mat<eT>&
Mat<eT>::fixed<fixed_n_rows, fixed_n_cols>::operator=(const fixed<fixed_n_r ows, fixed_n_cols>& X) Mat<eT>::fixed<fixed_n_rows, fixed_n_cols>::operator=(const fixed<fixed_n_r ows, fixed_n_cols>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
eT* dest = (use_extra) ? mem_local_extra : mem_local; if(this != &X)
const eT* src = (use_extra) ? X.mem_local_extra : X.mem_local; {
eT* dest = (use_extra) ? mem_local_extra : mem_local;
const eT* src = (use_extra) ? X.mem_local_extra : X.mem_local;
arrayops::copy( dest, src, fixed_n_elem ); arrayops::copy( dest, src, fixed_n_elem );
}
return *this;
}
template<typename eT>
template<uword fixed_n_rows, uword fixed_n_cols>
template<typename T1, typename eop_type>
inline
const Mat<eT>&
Mat<eT>::fixed<fixed_n_rows, fixed_n_cols>::operator=(const eOp<T1, eop_typ
e>& X)
{
arma_extra_debug_sigprint();
arma_type_check(( is_same_type< eT, typename T1::elem_type >::no ));
const bool bad_alias = (eOp<T1, eop_type>::proxy_type::has_subview && X
.P.is_alias(*this));
if(bad_alias == false)
{
arma_debug_assert_same_size(fixed_n_rows, fixed_n_cols, X.get_n_rows(),
X.get_n_cols(), "Mat::fixed::operator=");
eop_type::apply(*this, X);
}
else
{
arma_extra_debug_print("bad_alias = true");
Mat<eT> tmp(X);
(*this) = tmp;
}
return *this;
}
template<typename eT>
template<uword fixed_n_rows, uword fixed_n_cols>
template<typename T1, typename T2, typename eglue_type>
inline
const Mat<eT>&
Mat<eT>::fixed<fixed_n_rows, fixed_n_cols>::operator=(const eGlue<T1, T2, e
glue_type>& X)
{
arma_extra_debug_sigprint();
arma_type_check(( is_same_type< eT, typename T1::elem_type >::no ));
arma_type_check(( is_same_type< eT, typename T2::elem_type >::no ));
const bool bad_alias =
(
(eGlue<T1, T2, eglue_type>::proxy1_type::has_subview && X.P1.is_alias
(*this))
||
(eGlue<T1, T2, eglue_type>::proxy2_type::has_subview && X.P2.is_alias
(*this))
);
if(bad_alias == false)
{
arma_debug_assert_same_size(fixed_n_rows, fixed_n_cols, X.get_n_rows(),
X.get_n_cols(), "Mat::fixed::operator=");
eglue_type::apply(*this, X);
}
else
{
arma_extra_debug_print("bad_alias = true");
Mat<eT> tmp(X);
(*this) = tmp;
}
return *this; return *this;
} }
template<typename eT> template<typename eT>
template<uword fixed_n_rows, uword fixed_n_cols> template<uword fixed_n_rows, uword fixed_n_cols>
arma_inline arma_inline
const Op< typename Mat<eT>::template fixed<fixed_n_rows, fixed_n_cols>::Mat _fixed_type, op_htrans > const Op< typename Mat<eT>::template fixed<fixed_n_rows, fixed_n_cols>::Mat _fixed_type, op_htrans >
Mat<eT>::fixed<fixed_n_rows, fixed_n_cols>::t() const Mat<eT>::fixed<fixed_n_rows, fixed_n_cols>::t() const
{ {
 End of changes. 3 change blocks. 
3 lines changed or deleted 185 lines changed or added


 Row_bones.hpp   Row_bones.hpp 
skipping to change at line 189 skipping to change at line 189
using Row<eT>::operator(); using Row<eT>::operator();
#if defined(ARMA_USE_CXX11) #if defined(ARMA_USE_CXX11)
inline fixed(const std::initializer_list<eT>& list); inline fixed(const std::initializer_list<eT>& list);
inline const Row& operator=(const std::initializer_list<eT>& list); inline const Row& operator=(const std::initializer_list<eT>& list);
#endif #endif
arma_inline const Row& operator=(const fixed<fixed_n_elem>& X); arma_inline const Row& operator=(const fixed<fixed_n_elem>& X);
template<typename T1, typename eop_type> inline const Row& operator=(cons
t eOp<T1, eop_type>& X);
template<typename T1, typename T2, typename eglue_type> inline const Row&
operator=(const eGlue<T1, T2, eglue_type>& X);
arma_inline const Op< Row_fixed_type, op_htrans > t() const; arma_inline const Op< Row_fixed_type, op_htrans > t() const;
arma_inline const Op< Row_fixed_type, op_htrans > ht() const; arma_inline const Op< Row_fixed_type, op_htrans > ht() const;
arma_inline const Op< Row_fixed_type, op_strans > st() const; arma_inline const Op< Row_fixed_type, op_strans > st() const;
arma_inline arma_warn_unused const eT& at_alt (const uword i) const; arma_inline arma_warn_unused const eT& at_alt (const uword i) const;
arma_inline arma_warn_unused eT& operator[] (const uword i); arma_inline arma_warn_unused eT& operator[] (const uword i);
arma_inline arma_warn_unused const eT& operator[] (const uword i) const; arma_inline arma_warn_unused const eT& operator[] (const uword i) const;
arma_inline arma_warn_unused eT& at (const uword i); arma_inline arma_warn_unused eT& at (const uword i);
arma_inline arma_warn_unused const eT& at (const uword i) const; arma_inline arma_warn_unused const eT& at (const uword i) const;
 End of changes. 1 change blocks. 
0 lines changed or deleted 6 lines changed or added


 Row_meat.hpp   Row_meat.hpp 
skipping to change at line 1031 skipping to change at line 1031
#endif #endif
template<typename eT> template<typename eT>
template<uword fixed_n_elem> template<uword fixed_n_elem>
arma_inline arma_inline
const Row<eT>& const Row<eT>&
Row<eT>::fixed<fixed_n_elem>::operator=(const fixed<fixed_n_elem>& X) Row<eT>::fixed<fixed_n_elem>::operator=(const fixed<fixed_n_elem>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
eT* dest = (use_extra) ? mem_local_extra : Mat<eT>::mem_local; if(this != &X)
const eT* src = (use_extra) ? X.mem_local_extra : X.mem_local; {
eT* dest = (use_extra) ? mem_local_extra : Mat<eT>::mem_local;
const eT* src = (use_extra) ? X.mem_local_extra : X.mem_local;
arrayops::copy( dest, src, fixed_n_elem ); arrayops::copy( dest, src, fixed_n_elem );
}
return *this;
}
template<typename eT>
template<uword fixed_n_elem>
template<typename T1, typename eop_type>
inline
const Row<eT>&
Row<eT>::fixed<fixed_n_elem>::operator=(const eOp<T1, eop_type>& X)
{
arma_extra_debug_sigprint();
arma_type_check(( is_same_type< eT, typename T1::elem_type >::no ));
const bool bad_alias = (eOp<T1, eop_type>::proxy_type::has_subview && X
.P.is_alias(*this));
if(bad_alias == false)
{
arma_debug_assert_same_size(uword(1), fixed_n_elem, X.get_n_rows(), X.g
et_n_cols(), "Row::fixed::operator=");
eop_type::apply(*this, X);
}
else
{
arma_extra_debug_print("bad_alias = true");
Row<eT> tmp(X);
(*this) = tmp;
}
return *this;
}
template<typename eT>
template<uword fixed_n_elem>
template<typename T1, typename T2, typename eglue_type>
inline
const Row<eT>&
Row<eT>::fixed<fixed_n_elem>::operator=(const eGlue<T1, T2, eglue_type>& X)
{
arma_extra_debug_sigprint();
arma_type_check(( is_same_type< eT, typename T1::elem_type >::no ));
arma_type_check(( is_same_type< eT, typename T2::elem_type >::no ));
const bool bad_alias =
(
(eGlue<T1, T2, eglue_type>::proxy1_type::has_subview && X.P1.is_alias
(*this))
||
(eGlue<T1, T2, eglue_type>::proxy2_type::has_subview && X.P2.is_alias
(*this))
);
if(bad_alias == false)
{
arma_debug_assert_same_size(uword(1), fixed_n_elem, X.get_n_rows(), X.g
et_n_cols(), "Row::fixed::operator=");
eglue_type::apply(*this, X);
}
else
{
arma_extra_debug_print("bad_alias = true");
Row<eT> tmp(X);
(*this) = tmp;
}
return *this; return *this;
} }
template<typename eT> template<typename eT>
template<uword fixed_n_elem> template<uword fixed_n_elem>
arma_inline arma_inline
const Op< typename Row<eT>::template fixed<fixed_n_elem>::Row_fixed_type, o p_htrans > const Op< typename Row<eT>::template fixed<fixed_n_elem>::Row_fixed_type, o p_htrans >
Row<eT>::fixed<fixed_n_elem>::t() const Row<eT>::fixed<fixed_n_elem>::t() const
{ {
 End of changes. 2 change blocks. 
3 lines changed or deleted 79 lines changed or added


 SpMat_bones.hpp   SpMat_bones.hpp 
// Copyright (C) 2011-2014 Ryan Curtin // Copyright (C) 2011-2014 Ryan Curtin
// Copyright (C) 2012-2014 Conrad Sanderson // Copyright (C) 2012-2015 Conrad Sanderson
// Copyright (C) 2011 Matthew Amidon // Copyright (C) 2011 Matthew Amidon
// //
// This Source Code Form is subject to the terms of the Mozilla Public // This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this // License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
//! \addtogroup SpMat //! \addtogroup SpMat
//! @{ //! @{
//! Sparse matrix class, with data stored in compressed sparse column (CSC) format //! Sparse matrix class, with data stored in compressed sparse column (CSC) format
skipping to change at line 77 skipping to change at line 77
* *
* The col_ptrs array is set by the init() function (which is called by t he * The col_ptrs array is set by the init() function (which is called by t he
* constructors and set_size() and other functions that set the size of t he * constructors and set_size() and other functions that set the size of t he
* matrix), so allocating col_ptrs by hand should not be necessary. * matrix), so allocating col_ptrs by hand should not be necessary.
*/ */
const uword* const col_ptrs; const uword* const col_ptrs;
inline SpMat(); //! Size will be 0x0 (empty). inline SpMat(); //! Size will be 0x0 (empty).
inline ~SpMat(); inline ~SpMat();
inline SpMat(const uword in_rows, const uword in_cols); inline SpMat(const uword in_rows, const uword in_cols);
inline SpMat(const char* text); inline SpMat(const char* text);
inline const SpMat& operator=(const char* text); inline const SpMat& operator=(const char* text);
inline SpMat(const std::string& text); inline SpMat(const std::string& text);
inline const SpMat& operator=(const std::string& text); inline const SpMat& operator=(const std::string& text);
inline SpMat(const SpMat<eT>& x); inline SpMat(const SpMat<eT>& x);
#if defined(ARMA_USE_CXX11) #if defined(ARMA_USE_CXX11)
inline SpMat(SpMat&& m); inline SpMat(SpMat&& m);
inline const SpMat& operator=(SpMat&& m); inline const SpMat& operator=(SpMat&& m);
skipping to change at line 194 skipping to change at line 194
inline SpSubview<eT> operator()(const uword row_num, const spa n& col_span); inline SpSubview<eT> operator()(const uword row_num, const spa n& col_span);
inline const SpSubview<eT> operator()(const uword row_num, const spa n& col_span) const; inline const SpSubview<eT> operator()(const uword row_num, const spa n& col_span) const;
arma_inline SpSubview<eT> col(const uword col_num); arma_inline SpSubview<eT> col(const uword col_num);
arma_inline const SpSubview<eT> col(const uword col_num) const; arma_inline const SpSubview<eT> col(const uword col_num) const;
inline SpSubview<eT> operator()(const span& row_span, const uw ord col_num); inline SpSubview<eT> operator()(const span& row_span, const uw ord col_num);
inline const SpSubview<eT> operator()(const span& row_span, const uw ord col_num) const; inline const SpSubview<eT> operator()(const span& row_span, const uw ord col_num) const;
/**
* Row- and column-related functions.
*/
inline void swap_rows(const uword in_row1, const uword in_row2);
inline void swap_cols(const uword in_col1, const uword in_col2);
inline void shed_row(const uword row_num);
inline void shed_col(const uword col_num);
inline void shed_rows(const uword in_row1, const uword in_row2);
inline void shed_cols(const uword in_col1, const uword in_col2);
arma_inline SpSubview<eT> rows(const uword in_row1, const uword in_ row2); arma_inline SpSubview<eT> rows(const uword in_row1, const uword in_ row2);
arma_inline const SpSubview<eT> rows(const uword in_row1, const uword in_ row2) const; arma_inline const SpSubview<eT> rows(const uword in_row1, const uword in_ row2) const;
arma_inline SpSubview<eT> cols(const uword in_col1, const uword in_ col2); arma_inline SpSubview<eT> cols(const uword in_col1, const uword in_ col2);
arma_inline const SpSubview<eT> cols(const uword in_col1, const uword in_ col2) const; arma_inline const SpSubview<eT> cols(const uword in_col1, const uword in_ col2) const;
arma_inline SpSubview<eT> submat(const uword in_row1, const uword i n_col1, const uword in_row2, const uword in_col2); arma_inline SpSubview<eT> submat(const uword in_row1, const uword i n_col1, const uword in_row2, const uword in_col2);
arma_inline const SpSubview<eT> submat(const uword in_row1, const uword i n_col1, const uword in_row2, const uword in_col2) const; arma_inline const SpSubview<eT> submat(const uword in_row1, const uword i n_col1, const uword in_row2, const uword in_col2) const;
arma_inline SpSubview<eT> submat(const uword in_row1, const uword i n_col1, const SizeMat& s); arma_inline SpSubview<eT> submat(const uword in_row1, const uword i n_col1, const SizeMat& s);
skipping to change at line 227 skipping to change at line 215
inline SpSubview<eT> submat (const span& row_span, const sp an& col_span); inline SpSubview<eT> submat (const span& row_span, const sp an& col_span);
inline const SpSubview<eT> submat (const span& row_span, const sp an& col_span) const; inline const SpSubview<eT> submat (const span& row_span, const sp an& col_span) const;
inline SpSubview<eT> operator()(const span& row_span, const sp an& col_span); inline SpSubview<eT> operator()(const span& row_span, const sp an& col_span);
inline const SpSubview<eT> operator()(const span& row_span, const sp an& col_span) const; inline const SpSubview<eT> operator()(const span& row_span, const sp an& col_span) const;
arma_inline SpSubview<eT> operator()(const uword in_row1, const uwo rd in_col1, const SizeMat& s); arma_inline SpSubview<eT> operator()(const uword in_row1, const uwo rd in_col1, const SizeMat& s);
arma_inline const SpSubview<eT> operator()(const uword in_row1, const uwo rd in_col1, const SizeMat& s) const; arma_inline const SpSubview<eT> operator()(const uword in_row1, const uwo rd in_col1, const SizeMat& s) const;
inline SpSubview<eT> head_rows(const uword N);
inline const SpSubview<eT> head_rows(const uword N) const;
inline SpSubview<eT> tail_rows(const uword N);
inline const SpSubview<eT> tail_rows(const uword N) const;
inline SpSubview<eT> head_cols(const uword N);
inline const SpSubview<eT> head_cols(const uword N) const;
inline SpSubview<eT> tail_cols(const uword N);
inline const SpSubview<eT> tail_cols(const uword N) const;
inline void swap_rows(const uword in_row1, const uword in_row2);
inline void swap_cols(const uword in_col1, const uword in_col2);
inline void shed_row(const uword row_num);
inline void shed_col(const uword col_num);
inline void shed_rows(const uword in_row1, const uword in_row2);
inline void shed_cols(const uword in_col1, const uword in_col2);
/** /**
* Element access; access the i'th element (works identically to the Mat accessors). * Element access; access the i'th element (works identically to the Mat accessors).
* If there is nothing at element i, 0 is returned. * If there is nothing at element i, 0 is returned.
* *
* @param i Element to access. * @param i Element to access.
*/ */
arma_inline arma_warn_unused SpValProxy<SpMat<eT> > operator[] (const uwo rd i); arma_inline arma_warn_unused SpValProxy<SpMat<eT> > operator[] (const uwo rd i);
arma_inline arma_warn_unused eT operator[] (const uwo rd i) const; arma_inline arma_warn_unused eT operator[] (const uwo rd i) const;
arma_inline arma_warn_unused SpValProxy<SpMat<eT> > at (const uwo rd i); arma_inline arma_warn_unused SpValProxy<SpMat<eT> > at (const uwo rd i);
arma_inline arma_warn_unused eT at (const uwo rd i) const; arma_inline arma_warn_unused eT at (const uwo rd i) const;
 End of changes. 4 change blocks. 
14 lines changed or deleted 23 lines changed or added


 SpMat_meat.hpp   SpMat_meat.hpp 
// Copyright (C) 2011-2014 Ryan Curtin // Copyright (C) 2011-2014 Ryan Curtin
// Copyright (C) 2012-2014 Conrad Sanderson // Copyright (C) 2012-2015 Conrad Sanderson
// Copyright (C) 2011 Matthew Amidon // Copyright (C) 2011 Matthew Amidon
// //
// This Source Code Form is subject to the terms of the Mozilla Public // This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this // License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
//! \addtogroup SpMat //! \addtogroup SpMat
//! @{ //! @{
/** /**
skipping to change at line 1744 skipping to change at line 1744
(col_num >= n_cols) (col_num >= n_cols)
|| ||
( row_all ? false : ((in_row1 > in_row2) || (in_row2 >= local_n_rows)) ) ( row_all ? false : ((in_row1 > in_row2) || (in_row2 >= local_n_rows)) )
, ,
"SpMat::operator(): indices out of bounds or incorrectly used" "SpMat::operator(): indices out of bounds or incorrectly used"
); );
return SpSubview<eT>(*this, in_row1, col_num, submat_n_rows, 1); return SpSubview<eT>(*this, in_row1, col_num, submat_n_rows, 1);
} }
/** template<typename eT>
* Swap in_row1 with in_row2. arma_inline
*/ SpSubview<eT>
SpMat<eT>::rows(const uword in_row1, const uword in_row2)
{
arma_extra_debug_sigprint();
arma_debug_check
(
(in_row1 > in_row2) || (in_row2 >= n_rows),
"SpMat::rows(): indices out of bounds or incorrectly used"
);
const uword subview_n_rows = in_row2 - in_row1 + 1;
return SpSubview<eT>(*this, in_row1, 0, subview_n_rows, n_cols);
}
template<typename eT>
arma_inline
const SpSubview<eT>
SpMat<eT>::rows(const uword in_row1, const uword in_row2) const
{
arma_extra_debug_sigprint();
arma_debug_check
(
(in_row1 > in_row2) || (in_row2 >= n_rows),
"SpMat::rows(): indices out of bounds or incorrectly used"
);
const uword subview_n_rows = in_row2 - in_row1 + 1;
return SpSubview<eT>(*this, in_row1, 0, subview_n_rows, n_cols);
}
template<typename eT>
arma_inline
SpSubview<eT>
SpMat<eT>::cols(const uword in_col1, const uword in_col2)
{
arma_extra_debug_sigprint();
arma_debug_check
(
(in_col1 > in_col2) || (in_col2 >= n_cols),
"SpMat::cols(): indices out of bounds or incorrectly used"
);
const uword subview_n_cols = in_col2 - in_col1 + 1;
return SpSubview<eT>(*this, 0, in_col1, n_rows, subview_n_cols);
}
template<typename eT>
arma_inline
const SpSubview<eT>
SpMat<eT>::cols(const uword in_col1, const uword in_col2) const
{
arma_extra_debug_sigprint();
arma_debug_check
(
(in_col1 > in_col2) || (in_col2 >= n_cols),
"SpMat::cols(): indices out of bounds or incorrectly used"
);
const uword subview_n_cols = in_col2 - in_col1 + 1;
return SpSubview<eT>(*this, 0, in_col1, n_rows, subview_n_cols);
}
template<typename eT>
arma_inline
SpSubview<eT>
SpMat<eT>::submat(const uword in_row1, const uword in_col1, const uword in_
row2, const uword in_col2)
{
arma_extra_debug_sigprint();
arma_debug_check
(
(in_row1 > in_row2) || (in_col1 > in_col2) || (in_row2 >= n_rows) || (
in_col2 >= n_cols),
"SpMat::submat(): indices out of bounds or incorrectly used"
);
const uword subview_n_rows = in_row2 - in_row1 + 1;
const uword subview_n_cols = in_col2 - in_col1 + 1;
return SpSubview<eT>(*this, in_row1, in_col1, subview_n_rows, subview_n_c
ols);
}
template<typename eT>
arma_inline
const SpSubview<eT>
SpMat<eT>::submat(const uword in_row1, const uword in_col1, const uword in_
row2, const uword in_col2) const
{
arma_extra_debug_sigprint();
arma_debug_check
(
(in_row1 > in_row2) || (in_col1 > in_col2) || (in_row2 >= n_rows) || (
in_col2 >= n_cols),
"SpMat::submat(): indices out of bounds or incorrectly used"
);
const uword subview_n_rows = in_row2 - in_row1 + 1;
const uword subview_n_cols = in_col2 - in_col1 + 1;
return SpSubview<eT>(*this, in_row1, in_col1, subview_n_rows, subview_n_c
ols);
}
template<typename eT>
arma_inline
SpSubview<eT>
SpMat<eT>::submat(const uword in_row1, const uword in_col1, const SizeMat&
s)
{
arma_extra_debug_sigprint();
const uword l_n_rows = n_rows;
const uword l_n_cols = n_cols;
const uword s_n_rows = s.n_rows;
const uword s_n_cols = s.n_cols;
arma_debug_check
(
((in_row1 >= l_n_rows) || (in_col1 >= l_n_cols) || ((in_row1 + s_n_rows
) > l_n_rows) || ((in_col1 + s_n_cols) > l_n_cols)),
"SpMat::submat(): indices or size out of bounds"
);
return SpSubview<eT>(*this, in_row1, in_col1, s_n_rows, s_n_cols);
}
template<typename eT>
arma_inline
const SpSubview<eT>
SpMat<eT>::submat(const uword in_row1, const uword in_col1, const SizeMat&
s) const
{
arma_extra_debug_sigprint();
const uword l_n_rows = n_rows;
const uword l_n_cols = n_cols;
const uword s_n_rows = s.n_rows;
const uword s_n_cols = s.n_cols;
arma_debug_check
(
((in_row1 >= l_n_rows) || (in_col1 >= l_n_cols) || ((in_row1 + s_n_rows
) > l_n_rows) || ((in_col1 + s_n_cols) > l_n_cols)),
"SpMat::submat(): indices or size out of bounds"
);
return SpSubview<eT>(*this, in_row1, in_col1, s_n_rows, s_n_cols);
}
template<typename eT>
inline
SpSubview<eT>
SpMat<eT>::submat(const span& row_span, const span& col_span)
{
arma_extra_debug_sigprint();
const bool row_all = row_span.whole;
const bool col_all = col_span.whole;
const uword local_n_rows = n_rows;
const uword local_n_cols = n_cols;
const uword in_row1 = row_all ? 0 : row_span.a;
const uword in_row2 = row_span.b;
const uword submat_n_rows = row_all ? local_n_rows : in_row2 - in_row1 +
1;
const uword in_col1 = col_all ? 0 : col_span.a;
const uword in_col2 = col_span.b;
const uword submat_n_cols = col_all ? local_n_cols : in_col2 - in_col1 +
1;
arma_debug_check
(
( row_all ? false : ((in_row1 > in_row2) || (in_row2 >= local_n_rows))
)
||
( col_all ? false : ((in_col1 > in_col2) || (in_col2 >= local_n_cols))
)
,
"SpMat::submat(): indices out of bounds or incorrectly used"
);
return SpSubview<eT>(*this, in_row1, in_col1, submat_n_rows, submat_n_col
s);
}
template<typename eT>
inline
const SpSubview<eT>
SpMat<eT>::submat(const span& row_span, const span& col_span) const
{
arma_extra_debug_sigprint();
const bool row_all = row_span.whole;
const bool col_all = col_span.whole;
const uword local_n_rows = n_rows;
const uword local_n_cols = n_cols;
const uword in_row1 = row_all ? 0 : row_span.a;
const uword in_row2 = row_span.b;
const uword submat_n_rows = row_all ? local_n_rows : in_row2 - in_row1 +
1;
const uword in_col1 = col_all ? 0 : col_span.a;
const uword in_col2 = col_span.b;
const uword submat_n_cols = col_all ? local_n_cols : in_col2 - in_col1 +
1;
arma_debug_check
(
( row_all ? false : ((in_row1 > in_row2) || (in_row2 >= local_n_rows))
)
||
( col_all ? false : ((in_col1 > in_col2) || (in_col2 >= local_n_cols))
)
,
"SpMat::submat(): indices out of bounds or incorrectly used"
);
return SpSubview<eT>(*this, in_row1, in_col1, submat_n_rows, submat_n_col
s);
}
template<typename eT>
inline
SpSubview<eT>
SpMat<eT>::operator()(const span& row_span, const span& col_span)
{
arma_extra_debug_sigprint();
return submat(row_span, col_span);
}
template<typename eT>
inline
const SpSubview<eT>
SpMat<eT>::operator()(const span& row_span, const span& col_span) const
{
arma_extra_debug_sigprint();
return submat(row_span, col_span);
}
template<typename eT>
arma_inline
SpSubview<eT>
SpMat<eT>::operator()(const uword in_row1, const uword in_col1, const SizeM
at& s)
{
arma_extra_debug_sigprint();
return (*this).submat(in_row1, in_col1, s);
}
template<typename eT>
arma_inline
const SpSubview<eT>
SpMat<eT>::operator()(const uword in_row1, const uword in_col1, const SizeM
at& s) const
{
arma_extra_debug_sigprint();
return (*this).submat(in_row1, in_col1, s);
}
template<typename eT>
inline
SpSubview<eT>
SpMat<eT>::head_rows(const uword N)
{
arma_extra_debug_sigprint();
arma_debug_check( (N > n_rows), "SpMat::head_rows(): size out of bounds")
;
return SpSubview<eT>(*this, 0, 0, N, n_cols);
}
template<typename eT>
inline
const SpSubview<eT>
SpMat<eT>::head_rows(const uword N) const
{
arma_extra_debug_sigprint();
arma_debug_check( (N > n_rows), "SpMat::head_rows(): size out of bounds")
;
return SpSubview<eT>(*this, 0, 0, N, n_cols);
}
template<typename eT>
inline
SpSubview<eT>
SpMat<eT>::tail_rows(const uword N)
{
arma_extra_debug_sigprint();
arma_debug_check( (N > n_rows), "SpMat::tail_rows(): size out of bounds")
;
const uword start_row = n_rows - N;
return SpSubview<eT>(*this, start_row, 0, N, n_cols);
}
template<typename eT>
inline
const SpSubview<eT>
SpMat<eT>::tail_rows(const uword N) const
{
arma_extra_debug_sigprint();
arma_debug_check( (N > n_rows), "SpMat::tail_rows(): size out of bounds")
;
const uword start_row = n_rows - N;
return SpSubview<eT>(*this, start_row, 0, N, n_cols);
}
template<typename eT>
inline
SpSubview<eT>
SpMat<eT>::head_cols(const uword N)
{
arma_extra_debug_sigprint();
arma_debug_check( (N > n_cols), "SpMat::head_cols(): size out of bounds")
;
return SpSubview<eT>(*this, 0, 0, n_rows, N);
}
template<typename eT>
inline
const SpSubview<eT>
SpMat<eT>::head_cols(const uword N) const
{
arma_extra_debug_sigprint();
arma_debug_check( (N > n_cols), "SpMat::head_cols(): size out of bounds")
;
return SpSubview<eT>(*this, 0, 0, n_rows, N);
}
template<typename eT>
inline
SpSubview<eT>
SpMat<eT>::tail_cols(const uword N)
{
arma_extra_debug_sigprint();
arma_debug_check( (N > n_cols), "SpMat::tail_cols(): size out of bounds")
;
const uword start_col = n_cols - N;
return SpSubview<eT>(*this, 0, start_col, n_rows, N);
}
template<typename eT>
inline
const SpSubview<eT>
SpMat<eT>::tail_cols(const uword N) const
{
arma_extra_debug_sigprint();
arma_debug_check( (N > n_cols), "SpMat::tail_cols(): size out of bounds")
;
const uword start_col = n_cols - N;
return SpSubview<eT>(*this, 0, start_col, n_rows, N);
}
template<typename eT> template<typename eT>
inline inline
void void
SpMat<eT>::swap_rows(const uword in_row1, const uword in_row2) SpMat<eT>::swap_rows(const uword in_row1, const uword in_row2)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check arma_debug_check
( (
(in_row1 >= n_rows) || (in_row2 >= n_rows), (in_row1 >= n_rows) || (in_row2 >= n_rows),
skipping to change at line 1855 skipping to change at line 2216
} }
// Now set the row index correctly. // Now set the row index correctly.
access::rw(row_indices[loc2]) = in_row1; access::rw(row_indices[loc2]) = in_row1;
} }
/* else: no need to swap anything; both values are zero */ /* else: no need to swap anything; both values are zero */
} }
} }
/**
* Swap in_col1 with in_col2.
*/
template<typename eT> template<typename eT>
inline inline
void void
SpMat<eT>::swap_cols(const uword in_col1, const uword in_col2) SpMat<eT>::swap_cols(const uword in_col1, const uword in_col2)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
// slow but works // slow but works
for(uword lrow = 0; lrow < n_rows; ++lrow) for(uword lrow = 0; lrow < n_rows; ++lrow)
{ {
eT tmp = at(lrow, in_col1); eT tmp = at(lrow, in_col1);
at(lrow, in_col1) = at(lrow, in_col2); at(lrow, in_col1) = at(lrow, in_col2);
at(lrow, in_col2) = tmp; at(lrow, in_col2) = tmp;
} }
}
/**
* Remove the row row_num.
*/
template<typename eT>
inline
void
SpMat<eT>::shed_row(const uword row_num)
{
arma_extra_debug_sigprint();
arma_debug_check (row_num >= n_rows, "SpMat::shed_row(): out of bounds");
shed_rows (row_num, row_num);
}
/**
* Remove the column col_num.
*/
template<typename eT>
inline
void
SpMat<eT>::shed_col(const uword col_num)
{
arma_extra_debug_sigprint();
arma_debug_check (col_num >= n_cols, "SpMat::shed_col(): out of bounds");
shed_cols(col_num, col_num);
}
/**
* Remove all rows between (and including) in_row1 and in_row2.
*/
template<typename eT>
inline
void
SpMat<eT>::shed_rows(const uword in_row1, const uword in_row2)
{
arma_extra_debug_sigprint();
arma_debug_check
(
(in_row1 > in_row2) || (in_row2 >= n_rows),
"SpMat::shed_rows(): indices out of bounds or incorectly used"
);
uword i, j;
// Store the length of values
uword vlength = n_nonzero;
// Store the length of col_ptrs
uword clength = n_cols + 1;
// This is O(n * n_cols) and inplace, there may be a faster way, though.
for (i = 0, j = 0; i < vlength; ++i)
{
// Store the row of the ith element.
const uword lrow = row_indices[i];
// Is the ith element in the range of rows we want to remove?
if (lrow >= in_row1 && lrow <= in_row2)
{
// Increment our "removed elements" counter.
++j;
// Adjust the values of col_ptrs each time we remove an element.
// Basically, the length of one column reduces by one, and everything
to
// its right gets reduced by one to represent all the elements being
// shifted to the left by one.
for(uword k = 0; k < clength; ++k)
{
if (col_ptrs[k] > (i - j + 1))
{
--access::rw(col_ptrs[k]);
}
}
}
else
{
// We shift the element we checked to the left by how many elements
// we have removed.
// j = 0 until we remove the first element.
if (j != 0)
{
access::rw(row_indices[i - j]) = (lrow > in_row2) ? (lrow - (in_row
2 - in_row1 + 1)) : lrow;
access::rw(values[i - j]) = values[i];
}
}
}
// j is the number of elements removed.
// Shrink the vectors. This will copy the memory.
mem_resize(n_nonzero - j);
// Adjust row and element counts.
access::rw(n_rows) = n_rows - (in_row2 - in_row1) - 1;
access::rw(n_elem) = n_rows * n_cols;
}
/**
* Remove all columns between (and including) in_col1 and in_col2.
*/
template<typename eT>
inline
void
SpMat<eT>::shed_cols(const uword in_col1, const uword in_col2)
{
arma_extra_debug_sigprint();
arma_debug_check
(
(in_col1 > in_col2) || (in_col2 >= n_cols),
"SpMat::shed_cols(): indices out of bounds or incorrectly used"
);
// First we find the locations in values and row_indices for the column e
ntries.
uword col_beg = col_ptrs[in_col1];
uword col_end = col_ptrs[in_col2 + 1];
// Then we find the number of entries in the column.
uword diff = col_end - col_beg;
if (diff > 0)
{
eT* new_values = memory::acquire_chunked<eT> (n_nonzero - dif
f);
uword* new_row_indices = memory::acquire_chunked<uword>(n_nonzero - dif
f);
// Copy first part.
if (col_beg != 0)
{
arrayops::copy(new_values, values, col_beg);
arrayops::copy(new_row_indices, row_indices, col_beg);
}
// Copy second part.
if (col_end != n_nonzero)
{
arrayops::copy(new_values + col_beg, values + col_end, n_nonzero - co
l_end);
arrayops::copy(new_row_indices + col_beg, row_indices + col_end, n_no
nzero - col_end);
}
memory::release(values);
memory::release(row_indices);
access::rw(values) = new_values;
access::rw(row_indices) = new_row_indices;
// Update counts and such.
access::rw(n_nonzero) -= diff;
}
// Update column pointers.
const uword new_n_cols = n_cols - ((in_col2 - in_col1) + 1);
uword* new_col_ptrs = memory::acquire<uword>(new_n_cols + 2);
new_col_ptrs[new_n_cols + 1] = std::numeric_limits<uword>::max();
// Copy first set of columns (no manipulation required).
if (in_col1 != 0)
{
arrayops::copy(new_col_ptrs, col_ptrs, in_col1);
}
// Copy second set of columns (manipulation required).
uword cur_col = in_col1;
for (uword i = in_col2 + 1; i <= n_cols; ++i, ++cur_col)
{
new_col_ptrs[cur_col] = col_ptrs[i] - diff;
}
memory::release(col_ptrs);
access::rw(col_ptrs) = new_col_ptrs;
// We update the element and column counts, and we're done.
access::rw(n_cols) = new_n_cols;
access::rw(n_elem) = n_cols * n_rows;
}
template<typename eT>
arma_inline
SpSubview<eT>
SpMat<eT>::rows(const uword in_row1, const uword in_row2)
{
arma_extra_debug_sigprint();
arma_debug_check
(
(in_row1 > in_row2) || (in_row2 >= n_rows),
"SpMat::rows(): indices out of bounds or incorrectly used"
);
const uword subview_n_rows = in_row2 - in_row1 + 1;
return SpSubview<eT>(*this, in_row1, 0, subview_n_rows, n_cols);
}
template<typename eT>
arma_inline
const SpSubview<eT>
SpMat<eT>::rows(const uword in_row1, const uword in_row2) const
{
arma_extra_debug_sigprint();
arma_debug_check
(
(in_row1 > in_row2) || (in_row2 >= n_rows),
"SpMat::rows(): indices out of bounds or incorrectly used"
);
const uword subview_n_rows = in_row2 - in_row1 + 1;
return SpSubview<eT>(*this, in_row1, 0, subview_n_rows, n_cols);
}
template<typename eT>
arma_inline
SpSubview<eT>
SpMat<eT>::cols(const uword in_col1, const uword in_col2)
{
arma_extra_debug_sigprint();
arma_debug_check
(
(in_col1 > in_col2) || (in_col2 >= n_cols),
"SpMat::cols(): indices out of bounds or incorrectly used"
);
const uword subview_n_cols = in_col2 - in_col1 + 1;
return SpSubview<eT>(*this, 0, in_col1, n_rows, subview_n_cols);
}
template<typename eT>
arma_inline
const SpSubview<eT>
SpMat<eT>::cols(const uword in_col1, const uword in_col2) const
{
arma_extra_debug_sigprint();
arma_debug_check
(
(in_col1 > in_col2) || (in_col2 >= n_cols),
"SpMat::cols(): indices out of bounds or incorrectly used"
);
const uword subview_n_cols = in_col2 - in_col1 + 1;
return SpSubview<eT>(*this, 0, in_col1, n_rows, subview_n_cols);
} }
template<typename eT> template<typename eT>
arma_inline inline
SpSubview<eT> void
SpMat<eT>::submat(const uword in_row1, const uword in_col1, const uword in_ SpMat<eT>::shed_row(const uword row_num)
row2, const uword in_col2)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check (row_num >= n_rows, "SpMat::shed_row(): out of bounds");
arma_debug_check shed_rows (row_num, row_num);
(
(in_row1 > in_row2) || (in_col1 > in_col2) || (in_row2 >= n_rows) || (
in_col2 >= n_cols),
"SpMat::submat(): indices out of bounds or incorrectly used"
);
const uword subview_n_rows = in_row2 - in_row1 + 1;
const uword subview_n_cols = in_col2 - in_col1 + 1;
return SpSubview<eT>(*this, in_row1, in_col1, subview_n_rows, subview_n_c
ols);
} }
template<typename eT> template<typename eT>
arma_inline inline
const SpSubview<eT> void
SpMat<eT>::submat(const uword in_row1, const uword in_col1, const uword in_ SpMat<eT>::shed_col(const uword col_num)
row2, const uword in_col2) const
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check (col_num >= n_cols, "SpMat::shed_col(): out of bounds");
arma_debug_check shed_cols(col_num, col_num);
(
(in_row1 > in_row2) || (in_col1 > in_col2) || (in_row2 >= n_rows) || (
in_col2 >= n_cols),
"SpMat::submat(): indices out of bounds or incorrectly used"
);
const uword subview_n_rows = in_row2 - in_row1 + 1;
const uword subview_n_cols = in_col2 - in_col1 + 1;
return SpSubview<eT>(*this, in_row1, in_col1, subview_n_rows, subview_n_c
ols);
} }
template<typename eT> template<typename eT>
arma_inline inline
SpSubview<eT> void
SpMat<eT>::submat(const uword in_row1, const uword in_col1, const SizeMat& SpMat<eT>::shed_rows(const uword in_row1, const uword in_row2)
s)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
const uword l_n_rows = n_rows;
const uword l_n_cols = n_cols;
const uword s_n_rows = s.n_rows;
const uword s_n_cols = s.n_cols;
arma_debug_check arma_debug_check
( (
((in_row1 >= l_n_rows) || (in_col1 >= l_n_cols) || ((in_row1 + s_n_rows (in_row1 > in_row2) || (in_row2 >= n_rows),
) > l_n_rows) || ((in_col1 + s_n_cols) > l_n_cols)), "SpMat::shed_rows(): indices out of bounds or incorectly used"
"SpMat::submat(): indices or size out of bounds"
); );
return SpSubview<eT>(*this, in_row1, in_col1, s_n_rows, s_n_cols); uword i, j;
} // Store the length of values
uword vlength = n_nonzero;
// Store the length of col_ptrs
uword clength = n_cols + 1;
template<typename eT> // This is O(n * n_cols) and inplace, there may be a faster way, though.
arma_inline for (i = 0, j = 0; i < vlength; ++i)
const SpSubview<eT> {
SpMat<eT>::submat(const uword in_row1, const uword in_col1, const SizeMat& // Store the row of the ith element.
s) const const uword lrow = row_indices[i];
{ // Is the ith element in the range of rows we want to remove?
arma_extra_debug_sigprint(); if (lrow >= in_row1 && lrow <= in_row2)
{
// Increment our "removed elements" counter.
++j;
const uword l_n_rows = n_rows; // Adjust the values of col_ptrs each time we remove an element.
const uword l_n_cols = n_cols; // Basically, the length of one column reduces by one, and everything
to
// its right gets reduced by one to represent all the elements being
// shifted to the left by one.
for(uword k = 0; k < clength; ++k)
{
if (col_ptrs[k] > (i - j + 1))
{
--access::rw(col_ptrs[k]);
}
}
}
else
{
// We shift the element we checked to the left by how many elements
// we have removed.
// j = 0 until we remove the first element.
if (j != 0)
{
access::rw(row_indices[i - j]) = (lrow > in_row2) ? (lrow - (in_row
2 - in_row1 + 1)) : lrow;
access::rw(values[i - j]) = values[i];
}
}
}
const uword s_n_rows = s.n_rows; // j is the number of elements removed.
const uword s_n_cols = s.n_cols;
arma_debug_check // Shrink the vectors. This will copy the memory.
( mem_resize(n_nonzero - j);
((in_row1 >= l_n_rows) || (in_col1 >= l_n_cols) || ((in_row1 + s_n_rows
) > l_n_rows) || ((in_col1 + s_n_cols) > l_n_cols)),
"SpMat::submat(): indices or size out of bounds"
);
return SpSubview<eT>(*this, in_row1, in_col1, s_n_rows, s_n_cols); // Adjust row and element counts.
access::rw(n_rows) = n_rows - (in_row2 - in_row1) - 1;
access::rw(n_elem) = n_rows * n_cols;
} }
template<typename eT> template<typename eT>
inline inline
SpSubview<eT> void
SpMat<eT>::submat(const span& row_span, const span& col_span) SpMat<eT>::shed_cols(const uword in_col1, const uword in_col2)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
const bool row_all = row_span.whole;
const bool col_all = col_span.whole;
const uword local_n_rows = n_rows;
const uword local_n_cols = n_cols;
const uword in_row1 = row_all ? 0 : row_span.a;
const uword in_row2 = row_span.b;
const uword submat_n_rows = row_all ? local_n_rows : in_row2 - in_row1 +
1;
const uword in_col1 = col_all ? 0 : col_span.a;
const uword in_col2 = col_span.b;
const uword submat_n_cols = col_all ? local_n_cols : in_col2 - in_col1 +
1;
arma_debug_check arma_debug_check
( (
( row_all ? false : ((in_row1 > in_row2) || (in_row2 >= local_n_rows)) (in_col1 > in_col2) || (in_col2 >= n_cols),
) "SpMat::shed_cols(): indices out of bounds or incorrectly used"
||
( col_all ? false : ((in_col1 > in_col2) || (in_col2 >= local_n_cols))
)
,
"SpMat::submat(): indices out of bounds or incorrectly used"
); );
return SpSubview<eT>(*this, in_row1, in_col1, submat_n_rows, submat_n_col // First we find the locations in values and row_indices for the column e
s); ntries.
} uword col_beg = col_ptrs[in_col1];
uword col_end = col_ptrs[in_col2 + 1];
template<typename eT>
inline
const SpSubview<eT>
SpMat<eT>::submat(const span& row_span, const span& col_span) const
{
arma_extra_debug_sigprint();
const bool row_all = row_span.whole;
const bool col_all = col_span.whole;
const uword local_n_rows = n_rows; // Then we find the number of entries in the column.
const uword local_n_cols = n_cols; uword diff = col_end - col_beg;
const uword in_row1 = row_all ? 0 : row_span.a; if (diff > 0)
const uword in_row2 = row_span.b; {
const uword submat_n_rows = row_all ? local_n_rows : in_row2 - in_row1 + eT* new_values = memory::acquire_chunked<eT> (n_nonzero - dif
1; f);
uword* new_row_indices = memory::acquire_chunked<uword>(n_nonzero - dif
f);
const uword in_col1 = col_all ? 0 : col_span.a; // Copy first part.
const uword in_col2 = col_span.b; if (col_beg != 0)
const uword submat_n_cols = col_all ? local_n_cols : in_col2 - in_col1 + {
1; arrayops::copy(new_values, values, col_beg);
arrayops::copy(new_row_indices, row_indices, col_beg);
}
arma_debug_check // Copy second part.
( if (col_end != n_nonzero)
( row_all ? false : ((in_row1 > in_row2) || (in_row2 >= local_n_rows)) {
) arrayops::copy(new_values + col_beg, values + col_end, n_nonzero - co
|| l_end);
( col_all ? false : ((in_col1 > in_col2) || (in_col2 >= local_n_cols)) arrayops::copy(new_row_indices + col_beg, row_indices + col_end, n_no
) nzero - col_end);
, }
"SpMat::submat(): indices out of bounds or incorrectly used"
);
return SpSubview<eT>(*this, in_row1, in_col1, submat_n_rows, submat_n_col memory::release(values);
s); memory::release(row_indices);
}
template<typename eT> access::rw(values) = new_values;
inline access::rw(row_indices) = new_row_indices;
SpSubview<eT>
SpMat<eT>::operator()(const span& row_span, const span& col_span)
{
arma_extra_debug_sigprint();
return submat(row_span, col_span); // Update counts and such.
} access::rw(n_nonzero) -= diff;
}
template<typename eT> // Update column pointers.
inline const uword new_n_cols = n_cols - ((in_col2 - in_col1) + 1);
const SpSubview<eT>
SpMat<eT>::operator()(const span& row_span, const span& col_span) const
{
arma_extra_debug_sigprint();
return submat(row_span, col_span); uword* new_col_ptrs = memory::acquire<uword>(new_n_cols + 2);
} new_col_ptrs[new_n_cols + 1] = std::numeric_limits<uword>::max();
template<typename eT> // Copy first set of columns (no manipulation required).
arma_inline if (in_col1 != 0)
SpSubview<eT> {
SpMat<eT>::operator()(const uword in_row1, const uword in_col1, const SizeM arrayops::copy(new_col_ptrs, col_ptrs, in_col1);
at& s) }
{
arma_extra_debug_sigprint();
return (*this).submat(in_row1, in_col1, s); // Copy second set of columns (manipulation required).
} uword cur_col = in_col1;
for (uword i = in_col2 + 1; i <= n_cols; ++i, ++cur_col)
{
new_col_ptrs[cur_col] = col_ptrs[i] - diff;
}
template<typename eT> memory::release(col_ptrs);
arma_inline access::rw(col_ptrs) = new_col_ptrs;
const SpSubview<eT>
SpMat<eT>::operator()(const uword in_row1, const uword in_col1, const SizeM
at& s) const
{
arma_extra_debug_sigprint();
return (*this).submat(in_row1, in_col1, s); // We update the element and column counts, and we're done.
access::rw(n_cols) = new_n_cols;
access::rw(n_elem) = n_cols * n_rows;
} }
/** /**
* Element access; acces the i'th element (works identically to the Mat acc essors). * Element access; acces the i'th element (works identically to the Mat acc essors).
* If there is nothing at element i, 0 is returned. * If there is nothing at element i, 0 is returned.
* *
* @param i Element to access. * @param i Element to access.
*/ */
template<typename eT> template<typename eT>
skipping to change at line 2474 skipping to change at line 2560
return (n_rows == n_cols); return (n_rows == n_cols);
} }
//! returns true if all of the elements are finite //! returns true if all of the elements are finite
template<typename eT> template<typename eT>
inline inline
arma_warn_unused arma_warn_unused
bool bool
SpMat<eT>::is_finite() const SpMat<eT>::is_finite() const
{ {
for(uword i = 0; i < n_nonzero; i++) return arrayops::is_finite(values, n_nonzero);
{
if(arma_isfinite(values[i]) == false)
{
return false;
}
}
return true; // No infinite values.
} }
//! returns true if the given index is currently in range //! returns true if the given index is currently in range
template<typename eT> template<typename eT>
arma_inline arma_inline
arma_warn_unused arma_warn_unused
bool bool
SpMat<eT>::in_range(const uword i) const SpMat<eT>::in_range(const uword i) const
{ {
return (i < n_elem); return (i < n_elem);
skipping to change at line 4527 skipping to change at line 4605
const uword old_n_nonzero = n_nonzero; const uword old_n_nonzero = n_nonzero;
--access::rw(n_nonzero); // Remove one from the count of nonzero el ements. --access::rw(n_nonzero); // Remove one from the count of nonzero el ements.
// Found it. Now remove it. // Found it. Now remove it.
// Figure out the actual amount of memory currently allocated and t he actual amount that will be required // Figure out the actual amount of memory currently allocated and t he actual amount that will be required
// NOTE: this relies on memory::acquire_chunked() being used for th e 'values' and 'row_indices' arrays // NOTE: this relies on memory::acquire_chunked() being used for th e 'values' and 'row_indices' arrays
const uword n_alloc = memory::enlarge_to_mult_of_chunksize(old_ n_nonzero + 1); const uword n_alloc = memory::enlarge_to_mult_of_chunksize(old_ n_nonzero + 1);
const uword n_alloc_mod = memory::enlarge_to_mult_of_chunksize(n_no nzero + 1); const uword n_alloc_mod = memory::enlarge_to_mult_of_chunksize(n_no nzero + 1);
// If possible, avoid time-consuming memory allocation // If possible, avoid time-consuming memory allocation
if(n_alloc_mod == n_alloc) if(n_alloc_mod == n_alloc)
{ {
if (pos < n_nonzero) // remember, we decremented n_nonzero if (pos < n_nonzero) // remember, we decremented n_nonzero
{ {
arrayops::copy_forwards(access::rwp(values) + pos, values + pos + 1, (n_nonzero - pos) + 1); arrayops::copy_forwards(access::rwp(values) + pos, values + pos + 1, (n_nonzero - pos) + 1);
arrayops::copy_forwards(access::rwp(row_indices) + pos, row_ind ices + pos + 1, (n_nonzero - pos) + 1); arrayops::copy_forwards(access::rwp(row_indices) + pos, row_ind ices + pos + 1, (n_nonzero - pos) + 1);
} }
} }
else else
{ {
// Make new arrays. // Make new arrays.
eT* new_values = memory::acquire_chunked<eT> (n_nonzero + 1); eT* new_values = memory::acquire_chunked<eT> (n_nonzero + 1);
uword* new_row_indices = memory::acquire_chunked<uword>(n_nonzero + 1); uword* new_row_indices = memory::acquire_chunked<uword>(n_nonzero + 1);
if (pos > 0) if (pos > 0)
 End of changes. 39 change blocks. 
433 lines changed or deleted 519 lines changed or added


 arma_rng.hpp   arma_rng.hpp 
// Copyright (C) 2013-2014 Conrad Sanderson // Copyright (C) 2013-2015 Conrad Sanderson
// Copyright (C) 2013-2014 NICTA (www.nicta.com.au) // Copyright (C) 2013-2015 NICTA (www.nicta.com.au)
// //
// This Source Code Form is subject to the terms of the Mozilla Public // This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this // License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
//! \addtogroup arma_rng //! \addtogroup arma_rng
//! @{ //! @{
#if defined(ARMA_RNG_ALT) #if defined(ARMA_RNG_ALT)
#undef ARMA_USE_CXX11_RNG #undef ARMA_USE_EXTERN_CXX11_RNG
#endif #endif
#if defined(ARMA_USE_CXX11_RNG) #if !defined(ARMA_USE_CXX11)
#undef ARMA_USE_EXTERN_CXX11_RNG
#endif
#if defined(ARMA_USE_EXTERN_CXX11_RNG)
extern thread_local arma_rng_cxx11 arma_rng_cxx11_instance; extern thread_local arma_rng_cxx11 arma_rng_cxx11_instance;
// thread_local arma_rng_cxx11 arma_rng_cxx11_instance; // namespace { thread_local arma_rng_cxx11 arma_rng_cxx11_instance; }
#endif #endif
class arma_rng class arma_rng
{ {
public: public:
#if defined(ARMA_RNG_ALT) #if defined(ARMA_RNG_ALT)
typedef arma_rng_alt::seed_type seed_type; typedef arma_rng_alt::seed_type seed_type;
#elif defined(ARMA_USE_CXX11_RNG) #elif defined(ARMA_USE_EXTERN_CXX11_RNG)
typedef arma_rng_cxx11::seed_type seed_type; typedef arma_rng_cxx11::seed_type seed_type;
#else #else
typedef arma_rng_cxx98::seed_type seed_type; typedef arma_rng_cxx98::seed_type seed_type;
#endif #endif
#if defined(ARMA_RNG_ALT) #if defined(ARMA_RNG_ALT)
static const int rng_method = 2; static const int rng_method = 2;
#elif defined(ARMA_USE_CXX11_RNG) #elif defined(ARMA_USE_EXTERN_CXX11_RNG)
static const int rng_method = 1; static const int rng_method = 1;
#else #else
static const int rng_method = 0; static const int rng_method = 0;
#endif #endif
inline static void set_seed(const seed_type val); inline static void set_seed(const seed_type val);
inline static void set_seed_random(); inline static void set_seed_random();
template<typename eT> struct randi; template<typename eT> struct randi;
template<typename eT> struct randu; template<typename eT> struct randu;
skipping to change at line 56 skipping to change at line 60
}; };
inline inline
void void
arma_rng::set_seed(const arma_rng::seed_type val) arma_rng::set_seed(const arma_rng::seed_type val)
{ {
#if defined(ARMA_RNG_ALT) #if defined(ARMA_RNG_ALT)
{ {
arma_rng_alt::set_seed(val); arma_rng_alt::set_seed(val);
} }
#elif defined(ARMA_USE_CXX11_RNG) #elif defined(ARMA_USE_EXTERN_CXX11_RNG)
{ {
arma_rng_cxx11_instance.set_seed(val); arma_rng_cxx11_instance.set_seed(val);
} }
#else #else
{ {
arma_rng_cxx98::set_seed(val); arma_rng_cxx98::set_seed(val);
} }
#endif #endif
} }
skipping to change at line 147 skipping to change at line 151
template<typename eT> template<typename eT>
struct arma_rng::randi struct arma_rng::randi
{ {
arma_inline arma_inline
operator eT () operator eT ()
{ {
#if defined(ARMA_RNG_ALT) #if defined(ARMA_RNG_ALT)
{ {
return eT( arma_rng_alt::randi_val() ); return eT( arma_rng_alt::randi_val() );
} }
#elif defined(ARMA_USE_CXX11_RNG) #elif defined(ARMA_USE_EXTERN_CXX11_RNG)
{ {
return eT( arma_rng_cxx11_instance.randi_val() ); return eT( arma_rng_cxx11_instance.randi_val() );
} }
#else #else
{ {
return eT( arma_rng_cxx98::randi_val() ); return eT( arma_rng_cxx98::randi_val() );
} }
#endif #endif
} }
inline inline
static static
int int
max_val() max_val()
{ {
#if defined(ARMA_RNG_ALT) #if defined(ARMA_RNG_ALT)
{ {
return arma_rng_alt::randi_max_val(); return arma_rng_alt::randi_max_val();
} }
#elif defined(ARMA_USE_CXX11_RNG) #elif defined(ARMA_USE_EXTERN_CXX11_RNG)
{ {
return arma_rng_cxx11::randi_max_val(); return arma_rng_cxx11::randi_max_val();
} }
#else #else
{ {
return arma_rng_cxx98::randi_max_val(); return arma_rng_cxx98::randi_max_val();
} }
#endif #endif
} }
inline inline
static static
void void
fill(eT* mem, const uword N, const int a, const int b) fill(eT* mem, const uword N, const int a, const int b)
{ {
#if defined(ARMA_RNG_ALT) #if defined(ARMA_RNG_ALT)
{ {
return arma_rng_alt::randi_fill(mem, N, a, b); return arma_rng_alt::randi_fill(mem, N, a, b);
} }
#elif defined(ARMA_USE_CXX11_RNG) #elif defined(ARMA_USE_EXTERN_CXX11_RNG)
{ {
return arma_rng_cxx11_instance.randi_fill(mem, N, a, b); return arma_rng_cxx11_instance.randi_fill(mem, N, a, b);
} }
#else #else
{ {
return arma_rng_cxx98::randi_fill(mem, N, a, b); return arma_rng_cxx98::randi_fill(mem, N, a, b);
} }
#endif #endif
} }
}; };
skipping to change at line 209 skipping to change at line 213
template<typename eT> template<typename eT>
struct arma_rng::randu struct arma_rng::randu
{ {
arma_inline arma_inline
operator eT () operator eT ()
{ {
#if defined(ARMA_RNG_ALT) #if defined(ARMA_RNG_ALT)
{ {
return eT( arma_rng_alt::randu_val() ); return eT( arma_rng_alt::randu_val() );
} }
#elif defined(ARMA_USE_CXX11_RNG) #elif defined(ARMA_USE_EXTERN_CXX11_RNG)
{ {
return eT( arma_rng_cxx11_instance.randu_val() ); return eT( arma_rng_cxx11_instance.randu_val() );
} }
#else #else
{ {
return eT( arma_rng_cxx98::randu_val() ); return eT( arma_rng_cxx98::randu_val() );
} }
#endif #endif
} }
skipping to change at line 280 skipping to change at line 284
template<typename eT> template<typename eT>
struct arma_rng::randn struct arma_rng::randn
{ {
inline inline
operator eT () const operator eT () const
{ {
#if defined(ARMA_RNG_ALT) #if defined(ARMA_RNG_ALT)
{ {
return eT( arma_rng_alt::randn_val() ); return eT( arma_rng_alt::randn_val() );
} }
#elif defined(ARMA_USE_CXX11_RNG) #elif defined(ARMA_USE_EXTERN_CXX11_RNG)
{ {
return eT( arma_rng_cxx11_instance.randn_val() ); return eT( arma_rng_cxx11_instance.randn_val() );
} }
#else #else
{ {
return eT( arma_rng_cxx98::randn_val() ); return eT( arma_rng_cxx98::randn_val() );
} }
#endif #endif
} }
arma_inline arma_inline
static static
void void
dual_val(eT& out1, eT& out2) dual_val(eT& out1, eT& out2)
{ {
#if defined(ARMA_RNG_ALT) #if defined(ARMA_RNG_ALT)
{ {
arma_rng_alt::randn_dual_val(out1, out2); arma_rng_alt::randn_dual_val(out1, out2);
} }
#elif defined(ARMA_USE_CXX11_RNG) #elif defined(ARMA_USE_EXTERN_CXX11_RNG)
{ {
arma_rng_cxx11_instance.randn_dual_val(out1, out2); arma_rng_cxx11_instance.randn_dual_val(out1, out2);
} }
#else #else
{ {
arma_rng_cxx98::randn_dual_val(out1, out2); arma_rng_cxx98::randn_dual_val(out1, out2);
} }
#endif #endif
} }
 End of changes. 13 change blocks. 
14 lines changed or deleted 18 lines changed or added


 arma_rng_cxx11.hpp   arma_rng_cxx11.hpp 
// Copyright (C) 2013 Conrad Sanderson // Copyright (C) 2013-2015 Conrad Sanderson
// Copyright (C) 2013 NICTA (www.nicta.com.au) // Copyright (C) 2013-2015 NICTA (www.nicta.com.au)
// //
// This Source Code Form is subject to the terms of the Mozilla Public // This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this // License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
//! \addtogroup arma_rng_cxx11 //! \addtogroup arma_rng_cxx11
//! @{ //! @{
#if defined(ARMA_USE_CXX11)
class arma_rng_cxx11 class arma_rng_cxx11
{ {
public: public:
typedef typename std::mt19937_64::result_type seed_type; typedef std::mt19937_64::result_type seed_type;
inline void set_seed(const seed_type val); inline void set_seed(const seed_type val);
arma_inline int randi_val(); arma_inline int randi_val();
arma_inline double randu_val(); arma_inline double randu_val();
arma_inline double randn_val(); arma_inline double randn_val();
template<typename eT> template<typename eT>
arma_inline void randn_dual_val(eT& out1, eT& out2); arma_inline void randn_dual_val(eT& out1, eT& out2);
template<typename eT> template<typename eT>
inline void randi_fill(eT* mem, const uword N, const int a, const int b); inline void randi_fill(eT* mem, const uword N, const int a, const int b);
inline static int randi_max_val(); inline static int randi_max_val();
template<typename eT>
inline void randg_fill(eT* mem, const uword N, const double a, const doub
le b);
private: private:
arma_aligned std::mt19937_64 engine; // typedef for std::mersenne_twister_engine with preset parameters arma_aligned std::mt19937_64 engine; // typedef for std::mersenne_twister_engine with preset parameters
arma_aligned std::uniform_int_distribution<int> i_distr; // by defa ult uses a=0, b=std::numeric_limits<int>::max() arma_aligned std::uniform_int_distribution<int> i_distr; // by defa ult uses a=0, b=std::numeric_limits<int>::max()
arma_aligned std::uniform_real_distribution<double> u_distr; // by defa ult uses [0,1) interval arma_aligned std::uniform_real_distribution<double> u_distr; // by defa ult uses [0,1) interval
arma_aligned std::normal_distribution<double> n_distr; // by defa ult uses mean=0.0 and stddev=1.0 arma_aligned std::normal_distribution<double> n_distr; // by defa ult uses mean=0.0 and stddev=1.0
}; };
skipping to change at line 88 skipping to change at line 93
template<typename eT> template<typename eT>
inline inline
void void
arma_rng_cxx11::randi_fill(eT* mem, const uword N, const int a, const int b ) arma_rng_cxx11::randi_fill(eT* mem, const uword N, const int a, const int b )
{ {
std::uniform_int_distribution<int> i_distr(a, b); std::uniform_int_distribution<int> i_distr(a, b);
for(uword i=0; i<N; ++i) for(uword i=0; i<N; ++i)
{ {
mem[i] = i_distr(engine); mem[i] = eT(i_distr(engine));
} }
} }
inline inline
int int
arma_rng_cxx11::randi_max_val() arma_rng_cxx11::randi_max_val()
{ {
return std::numeric_limits<int>::max(); return std::numeric_limits<int>::max();
} }
template<typename eT>
inline
void
arma_rng_cxx11::randg_fill(eT* mem, const uword N, const double a, const do
uble b)
{
std::gamma_distribution<double> g_distr(a,b);
for(uword i=0; i<N; ++i)
{
mem[i] = eT(g_distr(engine));
}
}
#endif
//! @} //! @}
 End of changes. 6 change blocks. 
4 lines changed or deleted 26 lines changed or added


 arma_version.hpp   arma_version.hpp 
skipping to change at line 12 skipping to change at line 12
// Copyright (C) 2009-2014 NICTA (www.nicta.com.au) // Copyright (C) 2009-2014 NICTA (www.nicta.com.au)
// //
// This Source Code Form is subject to the terms of the Mozilla Public // This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this // License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
//! \addtogroup arma_version //! \addtogroup arma_version
//! @{ //! @{
#define ARMA_VERSION_MAJOR 4 #define ARMA_VERSION_MAJOR 4
#define ARMA_VERSION_MINOR 600 #define ARMA_VERSION_MINOR 650
#define ARMA_VERSION_PATCH 5 #define ARMA_VERSION_PATCH 0
#define ARMA_VERSION_NAME "Off The Reservation" #define ARMA_VERSION_NAME "Intravenous Caffeine Injector"
struct arma_version struct arma_version
{ {
static const unsigned int major = ARMA_VERSION_MAJOR; static const unsigned int major = ARMA_VERSION_MAJOR;
static const unsigned int minor = ARMA_VERSION_MINOR; static const unsigned int minor = ARMA_VERSION_MINOR;
static const unsigned int patch = ARMA_VERSION_PATCH; static const unsigned int patch = ARMA_VERSION_PATCH;
static static
inline inline
std::string std::string
 End of changes. 1 change blocks. 
3 lines changed or deleted 3 lines changed or added


 armadillo   armadillo 
// Copyright (C) 2008-2014 Conrad Sanderson // Copyright (C) 2008-2015 Conrad Sanderson
// Copyright (C) 2008-2014 NICTA (www.nicta.com.au) // Copyright (C) 2008-2015 NICTA (www.nicta.com.au)
// //
// This Source Code Form is subject to the terms of the Mozilla Public // This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this // License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
#ifndef ARMA_INCLUDES #ifndef ARMA_INCLUDES
#define ARMA_INCLUDES #define ARMA_INCLUDES
#include <cstdlib> #include <cstdlib>
#include <cstring> #include <cstring>
skipping to change at line 96 skipping to change at line 96
#include "armadillo_bits/upgrade_val.hpp" #include "armadillo_bits/upgrade_val.hpp"
#include "armadillo_bits/restrictors.hpp" #include "armadillo_bits/restrictors.hpp"
#include "armadillo_bits/access.hpp" #include "armadillo_bits/access.hpp"
#include "armadillo_bits/span.hpp" #include "armadillo_bits/span.hpp"
#include "armadillo_bits/distr_param.hpp" #include "armadillo_bits/distr_param.hpp"
#include "armadillo_bits/constants.hpp" #include "armadillo_bits/constants.hpp"
#include "armadillo_bits/constants_compat.hpp" #include "armadillo_bits/constants_compat.hpp"
#ifdef ARMA_RNG_ALT #ifdef ARMA_RNG_ALT
#include ARMA_INCFILE_WRAP(ARMA_RNG_ALT) #include ARMA_INCFILE_WRAP(ARMA_RNG_ALT)
#include "armadillo_bits/arma_rng.hpp"
#elif defined(ARMA_USE_CXX11_RNG)
#include "armadillo_bits/arma_rng_cxx11.hpp"
#include "armadillo_bits/arma_rng.hpp"
#else #else
#include "armadillo_bits/arma_rng_cxx11.hpp"
#include "armadillo_bits/arma_rng_cxx98.hpp" #include "armadillo_bits/arma_rng_cxx98.hpp"
#include "armadillo_bits/arma_rng.hpp"
#endif #endif
#include "armadillo_bits/arma_rng.hpp"
// //
// class prototypes // class prototypes
#include "armadillo_bits/Base_bones.hpp" #include "armadillo_bits/Base_bones.hpp"
#include "armadillo_bits/BaseCube_bones.hpp" #include "armadillo_bits/BaseCube_bones.hpp"
#include "armadillo_bits/SpBase_bones.hpp" #include "armadillo_bits/SpBase_bones.hpp"
#include "armadillo_bits/blas_bones.hpp" #include "armadillo_bits/blas_bones.hpp"
#include "armadillo_bits/lapack_bones.hpp" #include "armadillo_bits/lapack_bones.hpp"
skipping to change at line 428 skipping to change at line 425
#include "armadillo_bits/fn_unique.hpp" #include "armadillo_bits/fn_unique.hpp"
#include "armadillo_bits/fn_fft.hpp" #include "armadillo_bits/fn_fft.hpp"
#include "armadillo_bits/fn_fft2.hpp" #include "armadillo_bits/fn_fft2.hpp"
#include "armadillo_bits/fn_any.hpp" #include "armadillo_bits/fn_any.hpp"
#include "armadillo_bits/fn_all.hpp" #include "armadillo_bits/fn_all.hpp"
#include "armadillo_bits/fn_size.hpp" #include "armadillo_bits/fn_size.hpp"
#include "armadillo_bits/fn_numel.hpp" #include "armadillo_bits/fn_numel.hpp"
#include "armadillo_bits/fn_inplace_strans.hpp" #include "armadillo_bits/fn_inplace_strans.hpp"
#include "armadillo_bits/fn_inplace_trans.hpp" #include "armadillo_bits/fn_inplace_trans.hpp"
#include "armadillo_bits/fn_randi.hpp" #include "armadillo_bits/fn_randi.hpp"
#include "armadillo_bits/fn_randg.hpp"
#include "armadillo_bits/fn_cond.hpp" #include "armadillo_bits/fn_cond.hpp"
#include "armadillo_bits/fn_normalise.hpp" #include "armadillo_bits/fn_normalise.hpp"
#include "armadillo_bits/fn_clamp.hpp" #include "armadillo_bits/fn_clamp.hpp"
#include "armadillo_bits/fn_expmat.hpp" #include "armadillo_bits/fn_expmat.hpp"
#include "armadillo_bits/fn_speye.hpp" #include "armadillo_bits/fn_speye.hpp"
#include "armadillo_bits/fn_spones.hpp" #include "armadillo_bits/fn_spones.hpp"
#include "armadillo_bits/fn_sprandn.hpp" #include "armadillo_bits/fn_sprandn.hpp"
#include "armadillo_bits/fn_sprandu.hpp" #include "armadillo_bits/fn_sprandu.hpp"
#include "armadillo_bits/fn_eigs_sym.hpp" #include "armadillo_bits/fn_eigs_sym.hpp"
 End of changes. 6 change blocks. 
7 lines changed or deleted 5 lines changed or added


 arrayops_meat.hpp   arrayops_meat.hpp 
// Copyright (C) 2011-2014 Conrad Sanderson // Copyright (C) 2011-2015 Conrad Sanderson
// Copyright (C) 2011-2014 NICTA (www.nicta.com.au) // Copyright (C) 2011-2015 NICTA (www.nicta.com.au)
// //
// This Source Code Form is subject to the terms of the Mozilla Public // This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this // License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
//! \addtogroup arrayops //! \addtogroup arrayops
//! @{ //! @{
template<typename eT> template<typename eT>
arma_hot arma_hot
skipping to change at line 62 skipping to change at line 62
} }
} }
template<typename eT> template<typename eT>
arma_hot arma_hot
inline inline
void void
arrayops::copy_forwards(eT* dest, const eT* src, const uword n_elem) arrayops::copy_forwards(eT* dest, const eT* src, const uword n_elem)
{ {
// can't use std::memcpy(), as we don't know how it copies data // can't use std::memcpy(), as we don't know how it copies data
uword i,j; uword j;
for(i=0, j=1; j < n_elem; i+=2, j+=2) for(j=1; j < n_elem; j+=2)
{ {
dest[i] = src[i]; const eT tmp_i = (*src); src++;
dest[j] = src[j]; const eT tmp_j = (*src); src++;
(*dest) = tmp_i; dest++;
(*dest) = tmp_j; dest++;
} }
if(i < n_elem) if((j-1) < n_elem)
{ {
dest[i] = src[i]; (*dest) = (*src);
} }
} }
// template<typename eT>
// arma_hot
// inline
// void
// arrayops::copy_backwards(eT* dest, const eT* src, const uword n_elem)
// {
// // can't use std::memcpy(), as we don't know how it copies data
//
// switch(n_elem)
// {
// default:
// for(uword i = (n_elem-1); i >= 1; --i) { dest[i] = src[i]; }
// // NOTE: the 'break' statement has been deliberately omitted
// case 1:
// dest[0] = src[0];
// case 0:
// ;
// }
// }
template<typename eT> template<typename eT>
arma_hot arma_hot
inline inline
void void
arrayops::copy_backwards(eT* dest, const eT* src, const uword n_elem) arrayops::copy_backwards(eT* dest, const eT* src, const uword n_elem)
{ {
// can't use std::memcpy(), as we don't know how it copies data // can't use std::memcpy(), as we don't know how it copies data
switch(n_elem) // for(uword i=0; i < n_elem; ++i)
// {
// const uword j = n_elem-i-1;
//
// dest[j] = src[j];
// }
if(n_elem > 0)
{ {
default: eT* dest_it = &(dest[n_elem-1]);
{ const eT* src_it = &( src[n_elem-1]);
uword i, j;
for(i = (n_elem-1), j = (n_elem-2); j >= 2; i-=2, j-=2)
{
const eT tmp_i = src[i];
const eT tmp_j = src[j];
dest[i] = tmp_i; uword j;
dest[j] = tmp_j; for(j=1; j < n_elem; j+=2)
} {
const eT tmp_i = (*src_it); src_it--;
const eT tmp_j = (*src_it); src_it--;
// j is less than 2: it can be 1 or 0 (*dest_it) = tmp_i; dest_it--;
// i is j+1, ie. less than 3: it can be 2 or 1 (*dest_it) = tmp_j; dest_it--;
}
if(i == 2) if((j-1) < n_elem)
{ {
dest[2] = src[2]; (*dest_it) = (*src_it);
}
} }
// NOTE: the 'break' statement has been deliberately omitted
case 2:
dest[1] = src[1];
case 1:
dest[0] = src[0];
case 0:
;
} }
} }
template<typename eT> template<typename eT>
arma_hot arma_hot
inline inline
void void
arrayops::fill_zeros(eT* dest, const uword n_elem) arrayops::fill_zeros(eT* dest, const uword n_elem)
{ {
arrayops::inplace_set(dest, eT(0), n_elem); arrayops::inplace_set(dest, eT(0), n_elem);
skipping to change at line 200 skipping to change at line 180
out = out_eT(in); out = out_eT(in);
} }
template<typename out_eT, typename in_eT> template<typename out_eT, typename in_eT>
arma_hot arma_hot
inline inline
void void
arrayops::convert(out_eT* dest, const in_eT* src, const uword n_elem) arrayops::convert(out_eT* dest, const in_eT* src, const uword n_elem)
{ {
uword i,j; if(is_same_type<out_eT,in_eT>::value)
{
const out_eT* src2 = (const out_eT*)src;
for(i=0, j=1; j<n_elem; i+=2, j+=2) if(dest != src2) { arrayops::copy(dest, src2, n_elem); }
return;
}
uword j;
for(j=1; j<n_elem; j+=2)
{ {
const in_eT tmp_i = src[i]; const in_eT tmp_i = (*src); src++;
const in_eT tmp_j = src[j]; const in_eT tmp_j = (*src); src++;
// dest[i] = out_eT( tmp_i ); // dest[i] = out_eT( tmp_i );
// dest[j] = out_eT( tmp_j ); // dest[j] = out_eT( tmp_j );
dest[i] = (is_signed<out_eT>::value) (*dest) = (is_signed<out_eT>::value)
? out_eT( tmp_i ) ? out_eT( tmp_i )
: ( cond_rel< is_signed<in_eT>::value >::lt(tmp_i, in_eT(0)) ? out_eT(0) : out_eT(tmp_i) ); : ( cond_rel< is_signed<in_eT>::value >::lt(tmp_i, in_eT(0)) ? out_eT(0) : out_eT(tmp_i) );
dest[j] = (is_signed<out_eT>::value) dest++;
(*dest) = (is_signed<out_eT>::value)
? out_eT( tmp_j ) ? out_eT( tmp_j )
: ( cond_rel< is_signed<in_eT>::value >::lt(tmp_j, in_eT(0)) ? out_eT(0) : out_eT(tmp_j) ); : ( cond_rel< is_signed<in_eT>::value >::lt(tmp_j, in_eT(0)) ? out_eT(0) : out_eT(tmp_j) );
dest++;
} }
if(i < n_elem) if((j-1) < n_elem)
{ {
const in_eT tmp_i = src[i]; const in_eT tmp_i = (*src);
// dest[i] = out_eT( tmp_i ); // dest[i] = out_eT( tmp_i );
dest[i] = (is_signed<out_eT>::value) (*dest) = (is_signed<out_eT>::value)
? out_eT( tmp_i ) ? out_eT( tmp_i )
: ( cond_rel< is_signed<in_eT>::value >::lt(tmp_i, in_eT(0)) ? out_eT(0) : out_eT(tmp_i) ); : ( cond_rel< is_signed<in_eT>::value >::lt(tmp_i, in_eT(0)) ? out_eT(0) : out_eT(tmp_i) );
} }
} }
template<typename out_eT, typename in_eT> template<typename out_eT, typename in_eT>
arma_hot arma_hot
inline inline
void void
arrayops::convert_cx(out_eT* dest, const in_eT* src, const uword n_elem) arrayops::convert_cx(out_eT* dest, const in_eT* src, const uword n_elem)
{ {
uword i,j; uword j;
for(i=0, j=1; j<n_elem; i+=2, j+=2) for(j=1; j<n_elem; j+=2)
{ {
arrayops::convert_cx_scalar( dest[i], src[i] ); arrayops::convert_cx_scalar( (*dest), (*src) ); dest++; src++;
arrayops::convert_cx_scalar( dest[j], src[j] ); arrayops::convert_cx_scalar( (*dest), (*src) ); dest++; src++;
} }
if(i < n_elem) if((j-1) < n_elem)
{ {
arrayops::convert_cx_scalar( dest[i], src[i] ); arrayops::convert_cx_scalar( (*dest), (*src) );
} }
} }
template<typename eT> template<typename eT>
arma_hot arma_hot
inline inline
void void
arrayops::inplace_plus(eT* dest, const eT* src, const uword n_elem) arrayops::inplace_plus(eT* dest, const eT* src, const uword n_elem)
{ {
if(memory::is_aligned(dest)) if(memory::is_aligned(dest))
skipping to change at line 911 skipping to change at line 903
return val1 * val2; return val1 * val2;
} }
template<typename eT> template<typename eT>
arma_hot arma_hot
arma_pure arma_pure
inline inline
bool bool
arrayops::is_finite(const eT* src, const uword n_elem) arrayops::is_finite(const eT* src, const uword n_elem)
{ {
uword i,j; uword j;
for(i=0, j=1; j<n_elem; i+=2, j+=2) for(j=1; j<n_elem; j+=2)
{ {
const eT val_i = src[i]; const eT val_i = (*src); src++;
const eT val_j = src[j]; const eT val_j = (*src); src++;
if( (arma_isfinite(val_i) == false) || (arma_isfinite(val_j) == false) ) if( (arma_isfinite(val_i) == false) || (arma_isfinite(val_j) == false) )
{ {
return false; return false;
} }
} }
if(i < n_elem) if((j-1) < n_elem)
{ {
if(arma_isfinite(src[i]) == false) if(arma_isfinite(*src) == false)
{ {
return false; return false;
} }
} }
return true; return true;
} }
// TODO: this function is currently not used // TODO: this function is currently not used
template<typename eT> template<typename eT>
 End of changes. 32 change blocks. 
73 lines changed or deleted 65 lines changed or added


 compiler_setup.hpp   compiler_setup.hpp 
skipping to change at line 166 skipping to change at line 166
#define arma_deprecated __attribute__((__deprecated__)) #define arma_deprecated __attribute__((__deprecated__))
#define arma_malloc __attribute__((__malloc__)) #define arma_malloc __attribute__((__malloc__))
#define arma_inline inline __attribute__((__always_inline__)) #define arma_inline inline __attribute__((__always_inline__))
#define arma_noinline __attribute__((__noinline__)) #define arma_noinline __attribute__((__noinline__))
#undef ARMA_HAVE_ALIGNED_ATTRIBUTE #undef ARMA_HAVE_ALIGNED_ATTRIBUTE
#define ARMA_HAVE_ALIGNED_ATTRIBUTE #define ARMA_HAVE_ALIGNED_ATTRIBUTE
#if defined(ARMA_USE_CXX11) #if defined(ARMA_USE_CXX11)
#if (ARMA_GCC_VERSION < 40800) #if (ARMA_GCC_VERSION < 40800)
#pragma message ("WARNING: your C++ compiler is in C++11 mode, but it #pragma message ("WARNING: compiler is in C++11 mode, but it has inco
has incomplete support for C++11 features; if something breaks, you get to mplete support for C++11 features;")
keep all the pieces") #pragma message ("WARNING: if something breaks, you get to keep all t
#pragma message ("WARNING: to forcefully prevent Armadillo from using he pieces")
C++11 features, #define ARMA_DONT_USE_CXX11 before #include <armadillo>") #pragma message ("WARNING: To forcefully prevent Armadillo from using
C++11 features,")
#pragma message ("WARNING: #define ARMA_DONT_USE_CXX11 before #includ
e <armadillo>")
#define ARMA_DONT_USE_CXX11_CHRONO #define ARMA_DONT_USE_CXX11_CHRONO
#endif #endif
#endif #endif
#undef ARMA_HAVE_TR1 #undef ARMA_HAVE_TR1
#if !defined(ARMA_USE_CXX11) #if !defined(ARMA_USE_CXX11)
#if defined(_GLIBCXX_USE_C99_MATH_TR1) && defined(_GLIBCXX_USE_C99_COMP LEX_TR1) #if defined(_GLIBCXX_USE_C99_MATH_TR1) && defined(_GLIBCXX_USE_C99_COMP LEX_TR1)
#define ARMA_HAVE_TR1 #define ARMA_HAVE_TR1
#endif #endif
skipping to change at line 304 skipping to change at line 306
#endif #endif
#if defined(_MSC_VER) #if defined(_MSC_VER)
#if (_MSC_VER < 1600) #if (_MSC_VER < 1600)
#error "*** Need a newer compiler ***" #error "*** Need a newer compiler ***"
#endif #endif
#if (_MSC_VER < 1700) #if (_MSC_VER < 1700)
#pragma message ("WARNING: your C++ compiler is outdated and has incomp #pragma message ("WARNING: this compiler is outdated and has incomplete
lete support for the C++ standard; if something breaks, you get to keep all support for the C++ standard;")
the pieces") #pragma message ("WARNING: if something breaks, you get to keep all the
pieces")
#endif #endif
#if defined(ARMA_USE_CXX11) #if defined(ARMA_USE_CXX11)
#if (_MSC_VER < 1800) #if (_MSC_VER < 1800)
#pragma message ("WARNING: your C++ compiler is in C++11 mode, but it #pragma message ("WARNING: compiler is in C++11 mode, but it has inco
has incomplete support for C++11 features; if something breaks, you get to mplete support for C++11 features;")
keep all the pieces") #pragma message ("WARNING: if something breaks, you get to keep all t
he pieces")
#endif #endif
#endif #endif
#undef ARMA_SIMPLE_LOOPS #undef ARMA_SIMPLE_LOOPS
#define ARMA_SIMPLE_LOOPS #define ARMA_SIMPLE_LOOPS
#undef ARMA_GOOD_COMPILER #undef ARMA_GOOD_COMPILER
#undef ARMA_HAVE_SNPRINTF #undef ARMA_HAVE_SNPRINTF
#undef ARMA_HAVE_ISFINITE #undef ARMA_HAVE_ISFINITE
#undef ARMA_HAVE_LOG1P #undef ARMA_HAVE_LOG1P
skipping to change at line 397 skipping to change at line 401
#undef ARMA_HAVE_SNPRINTF #undef ARMA_HAVE_SNPRINTF
#undef ARMA_HAVE_ISFINITE #undef ARMA_HAVE_ISFINITE
#undef ARMA_HAVE_LOG1P #undef ARMA_HAVE_LOG1P
#undef ARMA_HAVE_ISINF #undef ARMA_HAVE_ISINF
#undef ARMA_HAVE_ISNAN #undef ARMA_HAVE_ISNAN
#undef ARMA_HAVE_TR1 #undef ARMA_HAVE_TR1
#endif #endif
#if defined(log2) #if defined(log2)
#undef log2 #undef log2
#pragma message ("detected 'log2' macro and undefined it") #pragma message ("WARNING: detected 'log2' macro and undefined it")
#endif #endif
// //
// whoever defined macros with the names "min" and "max" should be permanen tly removed from the gene pool // whoever defined macros with the names "min" and "max" should be permanen tly removed from the gene pool
#if defined(min) || defined(max) #if defined(min) || defined(max)
#undef min #undef min
#undef max #undef max
#pragma message ("detected 'min' and/or 'max' macros and undefined them; #pragma message ("WARNING: detected 'min' and/or 'max' macros and undefin
you may wish to define NOMINMAX before including any windows header") ed them;")
#pragma message ("WARNING: you may wish to define NOMINMAX before includi
ng any windows header")
#endif #endif
 End of changes. 5 change blocks. 
14 lines changed or deleted 21 lines changed or added


 config.hpp   config.hpp 
// Copyright (C) 2008-2014 Conrad Sanderson // Copyright (C) 2008-2015 Conrad Sanderson
// Copyright (C) 2013 Ryan Curtin // Copyright (C) 2013 Ryan Curtin
// Copyright (C) 2008-2014 NICTA (www.nicta.com.au) // Copyright (C) 2008-2015 NICTA (www.nicta.com.au)
// //
// This Source Code Form is subject to the terms of the Mozilla Public // This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this // License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
#if !defined(ARMA_USE_LAPACK) #if !defined(ARMA_USE_LAPACK)
#define ARMA_USE_LAPACK #define ARMA_USE_LAPACK
//// Comment out the above line if you don't have LAPACK or a high-speed re placement for LAPACK, //// Comment out the above line if you don't have LAPACK or a high-speed re placement for LAPACK,
//// such as Intel MKL, AMD ACML, or the Accelerate framework. //// such as Intel MKL, AMD ACML, or the Accelerate framework.
//// LAPACK is required for matrix decompositions (eg. SVD) and matrix inve rse. //// LAPACK is required for matrix decompositions (eg. SVD) and matrix inve rse.
skipping to change at line 161 skipping to change at line 161
#undef ARMA_ATLAS_INCLUDE_DIR #undef ARMA_ATLAS_INCLUDE_DIR
#endif #endif
#if defined(ARMA_DONT_USE_WRAPPER) #if defined(ARMA_DONT_USE_WRAPPER)
#undef ARMA_USE_WRAPPER #undef ARMA_USE_WRAPPER
#undef ARMA_USE_HDF5_ALT #undef ARMA_USE_HDF5_ALT
#endif #endif
#if defined(ARMA_DONT_USE_CXX11) #if defined(ARMA_DONT_USE_CXX11)
#undef ARMA_USE_CXX11 #undef ARMA_USE_CXX11
#undef ARMA_USE_CXX11_RNG #undef ARMA_USE_EXTERN_CXX11_RNG
#endif #endif
#if defined(ARMA_USE_WRAPPER) #if defined(ARMA_USE_WRAPPER)
#if defined(ARMA_USE_CXX11) #if defined(ARMA_USE_CXX11)
#if !defined(ARMA_USE_CXX11_RNG) #if !defined(ARMA_USE_EXTERN_CXX11_RNG)
/* #undef ARMA_USE_CXX11_RNG */ /* #undef ARMA_USE_EXTERN_CXX11_RNG */
#endif #endif
#endif #endif
#endif #endif
#if defined(ARMA_DONT_USE_CXX11_RNG) #if defined(ARMA_DONT_USE_EXTERN_CXX11_RNG)
#undef ARMA_USE_CXX11_RNG #undef ARMA_USE_EXTERN_CXX11_RNG
#endif #endif
#if defined(ARMA_DONT_USE_HDF5) #if defined(ARMA_DONT_USE_HDF5)
#undef ARMA_USE_HDF5 #undef ARMA_USE_HDF5
#endif #endif
 End of changes. 5 change blocks. 
7 lines changed or deleted 7 lines changed or added


 diskio_meat.hpp   diskio_meat.hpp 
// Copyright (C) 2008-2012 NICTA (www.nicta.com.au) // Copyright (C) 2008-2015 NICTA (www.nicta.com.au)
// Copyright (C) 2008-2012 Conrad Sanderson // Copyright (C) 2008-2015 Conrad Sanderson
// Copyright (C) 2009-2010 Ian Cullinan // Copyright (C) 2009-2010 Ian Cullinan
// Copyright (C) 2012 Ryan Curtin // Copyright (C) 2012 Ryan Curtin
// Copyright (C) 2013 Szabolcs Horvat // Copyright (C) 2013 Szabolcs Horvat
// //
// This Source Code Form is subject to the terms of the Mozilla Public // This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this // License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
//! \addtogroup diskio //! \addtogroup diskio
//! @{ //! @{
skipping to change at line 2905 skipping to change at line 2905
f.get(); f.get();
x.set_size(f_n_rows, f_n_cols); x.set_size(f_n_rows, f_n_cols);
x.mem_resize(f_n_nz); x.mem_resize(f_n_nz);
f.read( reinterpret_cast<char*>(access::rwp(x.values)), std::strea msize(x.n_nonzero*sizeof(eT)) ); f.read( reinterpret_cast<char*>(access::rwp(x.values)), std::strea msize(x.n_nonzero*sizeof(eT)) );
f.read( reinterpret_cast<char*>(access::rwp(x.row_indices)), std::strea msize(x.n_nonzero*sizeof(uword)) ); f.read( reinterpret_cast<char*>(access::rwp(x.row_indices)), std::strea msize(x.n_nonzero*sizeof(uword)) );
f.read( reinterpret_cast<char*>(access::rwp(x.col_ptrs)), std::strea msize((x.n_cols+1)*sizeof(uword)) ); f.read( reinterpret_cast<char*>(access::rwp(x.col_ptrs)), std::strea msize((x.n_cols+1)*sizeof(uword)) );
load_okay = f.good(); bool check1 = true;
for(uword i=0; i < x.n_nonzero; ++i)
{
if(x.values[i] == eT(0)) { check1 = false; break; }
}
bool check2 = true;
for(uword i=0; i < x.n_cols; ++i)
{
if(x.col_ptrs[i+1] < x.col_ptrs[i]) { check2 = false; break; }
}
const bool check3 = (x.col_ptrs[x.n_cols] == x.n_nonzero);
if((check1 == false) || (check2 == false) || (check3 == false))
{
load_okay = false;
err_msg = "inconsistent data in ";
}
else
{
load_okay = f.good();
}
} }
else else
{ {
load_okay = false; load_okay = false;
err_msg = "incorrect header in "; err_msg = "incorrect header in ";
} }
return load_okay; return load_okay;
} }
 End of changes. 2 change blocks. 
3 lines changed or deleted 27 lines changed or added


 eglue_core_bones.hpp   eglue_core_bones.hpp 
// Copyright (C) 2010-2012 Conrad Sanderson // Copyright (C) 2010-2015 Conrad Sanderson
// Copyright (C) 2010-2012 NICTA (www.nicta.com.au) // Copyright (C) 2010-2015 NICTA (www.nicta.com.au)
// //
// This Source Code Form is subject to the terms of the Mozilla Public // This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this // License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
//! \addtogroup eglue_core //! \addtogroup eglue_core
//! @{ //! @{
template<typename eglue_type> template<typename eglue_type>
struct eglue_core struct eglue_core
{ {
// matrices // matrices
template<typename T1, typename T2> arma_hot inline static void apply(Mat< typename T1::elem_type>& out, const eGlue<T1, T2, eglue_type>& x); template<typename outT, typename T1, typename T2> arma_hot inline static void apply(outT& out, const eGlue<T1, T2, eglue_type>& x);
template<typename T1, typename T2> arma_hot inline static void apply_inpl ace_plus (Mat<typename T1::elem_type>& out, const eGlue<T1, T2, eglue_type> & x); template<typename T1, typename T2> arma_hot inline static void apply_inpl ace_plus (Mat<typename T1::elem_type>& out, const eGlue<T1, T2, eglue_type> & x);
template<typename T1, typename T2> arma_hot inline static void apply_inpl ace_minus(Mat<typename T1::elem_type>& out, const eGlue<T1, T2, eglue_type> & x); template<typename T1, typename T2> arma_hot inline static void apply_inpl ace_minus(Mat<typename T1::elem_type>& out, const eGlue<T1, T2, eglue_type> & x);
template<typename T1, typename T2> arma_hot inline static void apply_inpl ace_schur(Mat<typename T1::elem_type>& out, const eGlue<T1, T2, eglue_type> & x); template<typename T1, typename T2> arma_hot inline static void apply_inpl ace_schur(Mat<typename T1::elem_type>& out, const eGlue<T1, T2, eglue_type> & x);
template<typename T1, typename T2> arma_hot inline static void apply_inpl ace_div (Mat<typename T1::elem_type>& out, const eGlue<T1, T2, eglue_type> & x); template<typename T1, typename T2> arma_hot inline static void apply_inpl ace_div (Mat<typename T1::elem_type>& out, const eGlue<T1, T2, eglue_type> & x);
// cubes // cubes
template<typename T1, typename T2> arma_hot inline static void apply(Cube <typename T1::elem_type>& out, const eGlueCube<T1, T2, eglue_type>& x); template<typename T1, typename T2> arma_hot inline static void apply(Cube <typename T1::elem_type>& out, const eGlueCube<T1, T2, eglue_type>& x);
 End of changes. 2 change blocks. 
3 lines changed or deleted 3 lines changed or added


 eglue_core_meat.hpp   eglue_core_meat.hpp 
// Copyright (C) 2010-2014 Conrad Sanderson // Copyright (C) 2010-2015 Conrad Sanderson
// Copyright (C) 2010-2014 NICTA (www.nicta.com.au) // Copyright (C) 2010-2015 NICTA (www.nicta.com.au)
// //
// This Source Code Form is subject to the terms of the Mozilla Public // This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this // License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
//! \addtogroup eglue_core //! \addtogroup eglue_core
//! @{ //! @{
#undef arma_applier_1u #undef arma_applier_1u
#undef arma_applier_1a #undef arma_applier_1a
skipping to change at line 162 skipping to change at line 162
*out_mem operatorA P1.at(i,col,slice) operatorB P2.at(i,col,slice); out_mem++; \ *out_mem operatorA P1.at(i,col,slice) operatorB P2.at(i,col,slice); out_mem++; \
}\ }\
}\ }\
}\ }\
} }
// //
// matrices // matrices
template<typename eglue_type> template<typename eglue_type>
template<typename T1, typename T2> template<typename outT, typename T1, typename T2>
arma_hot arma_hot
inline inline
void void
eglue_core<eglue_type>::apply(Mat<typename T1::elem_type>& out, const eGlue <T1, T2, eglue_type>& x) eglue_core<eglue_type>::apply(outT& 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;
const bool prefer_at_accessor = (Proxy<T1>::prefer_at_accessor || Proxy<T 2>::prefer_at_accessor); const bool prefer_at_accessor = (Proxy<T1>::prefer_at_accessor || Proxy<T 2>::prefer_at_accessor);
// NOTE: we're assuming that the matrix has already been set to the corre ct size and there is no aliasing; // NOTE: we're assuming that the matrix has already been set to the corre ct size and there is no aliasing;
// size setting and alias checking is done by either the Mat contructor o r operator=() // size setting and alias checking is done by either the Mat contructor o r operator=()
 End of changes. 3 change blocks. 
4 lines changed or deleted 4 lines changed or added


 eop_core_bones.hpp   eop_core_bones.hpp 
// Copyright (C) 2010-2013 Conrad Sanderson // Copyright (C) 2010-2015 Conrad Sanderson
// Copyright (C) 2010-2013 NICTA (www.nicta.com.au) // Copyright (C) 2010-2015 NICTA (www.nicta.com.au)
// //
// This Source Code Form is subject to the terms of the Mozilla Public // This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this // License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
//! \addtogroup eop_core //! \addtogroup eop_core
//! @{ //! @{
template<typename eop_type> template<typename eop_type>
class eop_core class eop_core
{ {
public: public:
// matrices // matrices
template<typename T1> arma_hot inline static void apply(Mat<typename T1:: elem_type>& out, const eOp<T1, eop_type>& x); template<typename outT, typename T1> arma_hot inline static void apply(ou tT& out, const eOp<T1, eop_type>& x);
template<typename T1> arma_hot inline static void apply_inplace_plus (Mat <typename T1::elem_type>& out, const eOp<T1, eop_type>& x); template<typename T1> arma_hot inline static void apply_inplace_plus (Mat <typename T1::elem_type>& out, const eOp<T1, eop_type>& x);
template<typename T1> arma_hot inline static void apply_inplace_minus(Mat <typename T1::elem_type>& out, const eOp<T1, eop_type>& x); template<typename T1> arma_hot inline static void apply_inplace_minus(Mat <typename T1::elem_type>& out, const eOp<T1, eop_type>& x);
template<typename T1> arma_hot inline static void apply_inplace_schur(Mat <typename T1::elem_type>& out, const eOp<T1, eop_type>& x); template<typename T1> arma_hot inline static void apply_inplace_schur(Mat <typename T1::elem_type>& out, const eOp<T1, eop_type>& x);
template<typename T1> arma_hot inline static void apply_inplace_div (Mat <typename T1::elem_type>& out, const eOp<T1, eop_type>& x); template<typename T1> arma_hot inline static void apply_inplace_div (Mat <typename T1::elem_type>& out, const eOp<T1, eop_type>& x);
// cubes // cubes
template<typename T1> arma_hot inline static void apply(Cube<typename T1: :elem_type>& out, const eOpCube<T1, eop_type>& x); template<typename T1> arma_hot inline static void apply(Cube<typename T1: :elem_type>& out, const eOpCube<T1, eop_type>& x);
 End of changes. 2 change blocks. 
3 lines changed or deleted 3 lines changed or added


 eop_core_meat.hpp   eop_core_meat.hpp 
// Copyright (C) 2010-2014 Conrad Sanderson // Copyright (C) 2010-2015 Conrad Sanderson
// Copyright (C) 2010-2014 NICTA (www.nicta.com.au) // Copyright (C) 2010-2015 NICTA (www.nicta.com.au)
// //
// This Source Code Form is subject to the terms of the Mozilla Public // This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this // License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
//! \addtogroup eop_core //! \addtogroup eop_core
//! @{ //! @{
#undef arma_applier_1u #undef arma_applier_1u
#undef arma_applier_1a #undef arma_applier_1a
skipping to change at line 148 skipping to change at line 148
*out_mem operatorA eop_core<eop_type>::process(P.at(i,col,slice), k ); out_mem++; \ *out_mem operatorA eop_core<eop_type>::process(P.at(i,col,slice), k ); out_mem++; \
}\ }\
}\ }\
}\ }\
} }
// //
// matrices // matrices
template<typename eop_type> template<typename eop_type>
template<typename T1> template<typename outT, typename T1>
arma_hot arma_hot
inline inline
void void
eop_core<eop_type>::apply(Mat<typename T1::elem_type>& out, const eOp<T1, e op_type>& x) eop_core<eop_type>::apply(outT& out, const 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;
// NOTE: we're assuming that the matrix has already been set to the corre ct size and there is no aliasing; // NOTE: we're assuming that the matrix has already been set to the corre ct size and there is no aliasing;
// size setting and alias checking is done by either the Mat contructor o r operator=() // size setting and alias checking is done by either the Mat contructor o r operator=()
const eT k = x.aux; const eT k = x.aux;
eT* out_mem = out.memptr(); eT* out_mem = out.memptr();
 End of changes. 3 change blocks. 
4 lines changed or deleted 4 lines changed or added


 fn_conv_to.hpp   fn_conv_to.hpp 
// Copyright (C) 2008-2012 Conrad Sanderson // Copyright (C) 2008-2015 Conrad Sanderson
// Copyright (C) 2008-2012 NICTA (www.nicta.com.au) // Copyright (C) 2008-2015 NICTA (www.nicta.com.au)
// //
// This Source Code Form is subject to the terms of the Mozilla Public // This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this // License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
//! \addtogroup fn_conv_to //! \addtogroup fn_conv_to
//! @{ //! @{
//! conversion from Armadillo Base and BaseCube objects to scalars //! conversion from Armadillo Base and BaseCube objects to scalars
//! (kept only for compatibility with old code; use as_scalar() instead for Base objects like Mat) //! (kept only for compatibility with old code; use as_scalar() instead for Base objects like Mat)
skipping to change at line 42 skipping to change at line 42
template<typename in_eT, typename T1> template<typename in_eT, typename T1>
inline inline
out_eT out_eT
conv_to<out_eT>::from(const Base<in_eT, T1>& in, const typename arma_not_cx <in_eT>::result* junk) conv_to<out_eT>::from(const Base<in_eT, T1>& in, const typename arma_not_cx <in_eT>::result* junk)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_ignore(junk); arma_ignore(junk);
arma_type_check(( is_supported_elem_type<out_eT>::value == false )); arma_type_check(( is_supported_elem_type<out_eT>::value == false ));
const unwrap<T1> tmp(in.get_ref()); const Proxy<T1> P(in.get_ref());
const Mat<in_eT>& X = tmp.M;
arma_debug_check( (X.n_elem != 1), "conv_to(): given object doesn't have exactly one element" ); arma_debug_check( (P.get_n_elem() != 1), "conv_to(): given object doesn't have exactly one element" );
return out_eT(X.mem[0]); return out_eT(Proxy<T1>::prefer_at_accessor ? P.at(0,0) : P[0]);
} }
template<typename out_eT> template<typename out_eT>
template<typename in_eT, typename T1> template<typename in_eT, typename T1>
inline inline
out_eT out_eT
conv_to<out_eT>::from(const Base<in_eT, T1>& in, const typename arma_cx_onl y<in_eT>::result* junk) conv_to<out_eT>::from(const Base<in_eT, T1>& in, const typename arma_cx_onl y<in_eT>::result* junk)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_ignore(junk); arma_ignore(junk);
arma_type_check(( is_supported_elem_type<out_eT>::value == false )); arma_type_check(( is_supported_elem_type<out_eT>::value == false ));
const unwrap<T1> tmp(in.get_ref()); const Proxy<T1> P(in.get_ref());
const Mat<in_eT>& X = tmp.M;
arma_debug_check( (X.n_elem != 1), "conv_to(): given object doesn't have exactly one element" ); arma_debug_check( (P.get_n_elem() != 1), "conv_to(): given object doesn't have exactly one element" );
out_eT out; out_eT out;
arrayops::convert_cx_scalar(out, X.mem[0]); arrayops::convert_cx_scalar(out, (Proxy<T1>::prefer_at_accessor ? P.at(0, 0) : P[0]));
return out; return out;
} }
template<typename out_eT> template<typename out_eT>
template<typename in_eT, typename T1> template<typename in_eT, typename T1>
inline inline
out_eT out_eT
conv_to<out_eT>::from(const BaseCube<in_eT, T1>& in, const typename arma_no t_cx<in_eT>::result* junk) conv_to<out_eT>::from(const BaseCube<in_eT, T1>& in, const typename arma_no t_cx<in_eT>::result* junk)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_ignore(junk); arma_ignore(junk);
arma_type_check(( is_supported_elem_type<out_eT>::value == false )); arma_type_check(( is_supported_elem_type<out_eT>::value == false ));
const unwrap_cube<T1> tmp(in.get_ref()); const ProxyCube<T1> P(in.get_ref());
const Cube<in_eT>& X = tmp.M;
arma_debug_check( (X.n_elem != 1), "conv_to(): given object doesn't have exactly one element" ); arma_debug_check( (P.get_n_elem() != 1), "conv_to(): given object doesn't have exactly one element" );
return out_eT(X.mem[0]); return out_eT(ProxyCube<T1>::prefer_at_accessor ? P.at(0,0,0) : P[0]);
} }
template<typename out_eT> template<typename out_eT>
template<typename in_eT, typename T1> template<typename in_eT, typename T1>
inline inline
out_eT out_eT
conv_to<out_eT>::from(const BaseCube<in_eT, T1>& in, const typename arma_cx _only<in_eT>::result* junk) conv_to<out_eT>::from(const BaseCube<in_eT, T1>& in, const typename arma_cx _only<in_eT>::result* junk)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_ignore(junk); arma_ignore(junk);
arma_type_check(( is_supported_elem_type<out_eT>::value == false )); arma_type_check(( is_supported_elem_type<out_eT>::value == false ));
const unwrap_cube<T1> tmp(in.get_ref()); const ProxyCube<T1> P(in.get_ref());
const Cube<in_eT>& X = tmp.M;
arma_debug_check( (X.n_elem != 1), "conv_to(): given object doesn't have exactly one element" ); arma_debug_check( (P.get_n_elem() != 1), "conv_to(): given object doesn't have exactly one element" );
out_eT out; out_eT out;
arrayops::convert_cx_scalar(out, X.mem[0]); arrayops::convert_cx_scalar(out, (ProxyCube<T1>::prefer_at_accessor ? P.a t(0,0,0) : P[0]));
return out; return out;
} }
//! conversion to Armadillo matrices from Armadillo Base objects, as well a s from std::vector //! conversion to Armadillo matrices from Armadillo Base objects, as well a s from std::vector
template<typename out_eT> template<typename out_eT>
class conv_to< Mat<out_eT> > class conv_to< Mat<out_eT> >
{ {
public: public:
template<typename in_eT, typename T1> template<typename in_eT, typename T1>
inline static Mat<out_eT> from(const Base<in_eT, T1>& in, const typename arma_not_cx<in_eT>::result* junk = 0); inline static Mat<out_eT> from(const Base<in_eT, T1>& in, const typename arma_not_cx<in_eT>::result* junk = 0);
template<typename in_eT, typename T1> template<typename in_eT, typename T1>
inline static Mat<out_eT> from(const Base<in_eT, T1>& in, const typename arma_cx_only<in_eT>::result* junk = 0); inline static Mat<out_eT> from(const Base<in_eT, T1>& in, const typename arma_cx_only<in_eT>::result* junk = 0);
template<typename T1>
inline static Mat<out_eT> from(const SpBase<out_eT, T1>& in);
template<typename in_eT> template<typename in_eT>
inline static Mat<out_eT> from(const std::vector<in_eT>& in, const typena me arma_not_cx<in_eT>::result* junk = 0); inline static Mat<out_eT> from(const std::vector<in_eT>& in, const typena me arma_not_cx<in_eT>::result* junk = 0);
template<typename in_eT> template<typename in_eT>
inline static Mat<out_eT> from(const std::vector<in_eT>& in, const typena me arma_cx_only<in_eT>::result* junk = 0); inline static Mat<out_eT> from(const std::vector<in_eT>& in, const typena me arma_cx_only<in_eT>::result* junk = 0);
}; };
template<typename out_eT> template<typename out_eT>
template<typename in_eT, typename T1> template<typename in_eT, typename T1>
inline inline
Mat<out_eT> Mat<out_eT>
conv_to< Mat<out_eT> >::from(const Base<in_eT, T1>& in, const typename arma _not_cx<in_eT>::result* junk) conv_to< Mat<out_eT> >::from(const Base<in_eT, T1>& in, const typename arma _not_cx<in_eT>::result* junk)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_ignore(junk); arma_ignore(junk);
const unwrap<T1> tmp(in.get_ref()); const quasi_unwrap<T1> tmp(in.get_ref());
const Mat<in_eT>& X = tmp.M; const Mat<in_eT>& X = tmp.M;
Mat<out_eT> out(X.n_rows, X.n_cols); Mat<out_eT> out(X.n_rows, X.n_cols);
arrayops::convert( out.memptr(), X.memptr(), out.n_elem ); arrayops::convert( out.memptr(), X.memptr(), X.n_elem );
return out; return out;
} }
template<typename out_eT> template<typename out_eT>
template<typename in_eT, typename T1> template<typename in_eT, typename T1>
inline inline
Mat<out_eT> Mat<out_eT>
conv_to< Mat<out_eT> >::from(const Base<in_eT, T1>& in, const typename arma _cx_only<in_eT>::result* junk) conv_to< Mat<out_eT> >::from(const Base<in_eT, T1>& in, const typename arma _cx_only<in_eT>::result* junk)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_ignore(junk); arma_ignore(junk);
const unwrap<T1> tmp(in.get_ref()); const quasi_unwrap<T1> tmp(in.get_ref());
const Mat<in_eT>& X = tmp.M; const Mat<in_eT>& X = tmp.M;
Mat<out_eT> out(X.n_rows, X.n_cols); Mat<out_eT> out(X.n_rows, X.n_cols);
arrayops::convert_cx( out.memptr(), X.memptr(), out.n_elem ); arrayops::convert_cx( out.memptr(), X.memptr(), X.n_elem );
return out; return out;
} }
template<typename out_eT> template<typename out_eT>
template<typename T1>
inline
Mat<out_eT>
conv_to< Mat<out_eT> >::from(const SpBase<out_eT, T1>& in)
{
arma_extra_debug_sigprint();
return Mat<out_eT>(in.get_ref());
}
template<typename out_eT>
template<typename in_eT> template<typename in_eT>
inline inline
Mat<out_eT> Mat<out_eT>
conv_to< Mat<out_eT> >::from(const std::vector<in_eT>& in, const typename a rma_not_cx<in_eT>::result* junk) conv_to< Mat<out_eT> >::from(const std::vector<in_eT>& in, const typename a rma_not_cx<in_eT>::result* junk)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_ignore(junk); arma_ignore(junk);
const uword N = uword( in.size() ); const uword N = uword( in.size() );
Mat<out_eT> out(N, 1); Mat<out_eT> out(N, 1);
if(N > 0) if(N > 0)
{ {
out_eT* out_mem = out.memptr(); arrayops::convert( out.memptr(), &(in[0]), N );
const in_eT* in_mem = &(in[0]);
for(uword i=0; i<N; ++i)
{
out_mem[i] = out_eT( in_mem[i] );
}
} }
return out; return out;
} }
template<typename out_eT> template<typename out_eT>
template<typename in_eT> template<typename in_eT>
inline inline
Mat<out_eT> Mat<out_eT>
conv_to< Mat<out_eT> >::from(const std::vector<in_eT>& in, const typename a rma_cx_only<in_eT>::result* junk) conv_to< Mat<out_eT> >::from(const std::vector<in_eT>& in, const typename a rma_cx_only<in_eT>::result* junk)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_ignore(junk); arma_ignore(junk);
Mat<out_eT> out(in.size(), 1); const uword N = uword( in.size() );
typename std::vector<in_eT>::const_iterator in_begin = in.begin();
typename std::vector<in_eT>::const_iterator in_end = in.end();
typename Mat<out_eT>::iterator out_begin = out.begin();
typename Mat<out_eT>::iterator out_end = out.end();
typename std::vector<in_eT>::const_iterator in_it; Mat<out_eT> out(N, 1);
typename Mat<out_eT>::iterator out_it;
for(in_it = in_begin, out_it = out_begin; (in_it != in_end) && (out_it != out_end); ++in_it, ++out_it) if(N > 0)
{ {
out_eT& out_elem = (*out_it); arrayops::convert_cx( out.memptr(), &(in[0]), N );
const in_eT& in_elem = (*in_it);
arrayops::convert_cx_scalar(out_elem, in_elem);
} }
return out; return out;
} }
//! conversion to Armadillo row vectors from Armadillo Base objects, as wel l as from std::vector //! conversion to Armadillo row vectors from Armadillo Base objects, as wel l as from std::vector
template<typename out_eT> template<typename out_eT>
class conv_to< Row<out_eT> > class conv_to< Row<out_eT> >
{ {
public: public:
skipping to change at line 258 skipping to change at line 252
template<typename out_eT> template<typename out_eT>
template<typename in_eT, typename T1> template<typename in_eT, typename T1>
inline inline
Row<out_eT> Row<out_eT>
conv_to< Row<out_eT> >::from(const Base<in_eT, T1>& in, const typename arma _not_cx<in_eT>::result* junk) conv_to< Row<out_eT> >::from(const Base<in_eT, T1>& in, const typename arma _not_cx<in_eT>::result* junk)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_ignore(junk); arma_ignore(junk);
const unwrap<T1> tmp(in.get_ref()); const quasi_unwrap<T1> tmp(in.get_ref());
const Mat<in_eT>& X = tmp.M; const Mat<in_eT>& X = tmp.M;
arma_debug_check( ( (X.is_vec() == false) && (X.is_empty() == false) ), " conv_to(): given object can't be interpreted as a vector" ); arma_debug_check( ( (X.is_vec() == false) && (X.is_empty() == false) ), " conv_to(): given object can't be interpreted as a vector" );
Row<out_eT> out(X.n_elem); Row<out_eT> out(X.n_elem);
arrayops::convert( out.memptr(), X.memptr(), out.n_elem ); arrayops::convert( out.memptr(), X.memptr(), X.n_elem );
return out; return out;
} }
template<typename out_eT> template<typename out_eT>
template<typename in_eT, typename T1> template<typename in_eT, typename T1>
inline inline
Row<out_eT> Row<out_eT>
conv_to< Row<out_eT> >::from(const Base<in_eT, T1>& in, const typename arma _cx_only<in_eT>::result* junk) conv_to< Row<out_eT> >::from(const Base<in_eT, T1>& in, const typename arma _cx_only<in_eT>::result* junk)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_ignore(junk); arma_ignore(junk);
const unwrap<T1> tmp(in.get_ref()); const quasi_unwrap<T1> tmp(in.get_ref());
const Mat<in_eT>& X = tmp.M; const Mat<in_eT>& X = tmp.M;
arma_debug_check( ( (X.is_vec() == false) && (X.is_empty() == false) ), " conv_to(): given object can't be interpreted as a vector" ); arma_debug_check( ( (X.is_vec() == false) && (X.is_empty() == false) ), " conv_to(): given object can't be interpreted as a vector" );
Row<out_eT> out(X.n_rows, X.n_cols); Row<out_eT> out(X.n_rows, X.n_cols);
arrayops::convert_cx( out.memptr(), X.memptr(), out.n_elem ); arrayops::convert_cx( out.memptr(), X.memptr(), X.n_elem );
return out; return out;
} }
template<typename out_eT> template<typename out_eT>
template<typename in_eT> template<typename in_eT>
inline inline
Row<out_eT> Row<out_eT>
conv_to< Row<out_eT> >::from(const std::vector<in_eT>& in, const typename a rma_not_cx<in_eT>::result* junk) conv_to< Row<out_eT> >::from(const std::vector<in_eT>& in, const typename a rma_not_cx<in_eT>::result* junk)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_ignore(junk); arma_ignore(junk);
const uword N = uword( in.size() ); const uword N = uword( in.size() );
Row<out_eT> out(N); Row<out_eT> out(N);
if(N > 0) if(N > 0)
{ {
out_eT* out_mem = out.memptr(); arrayops::convert( out.memptr(), &(in[0]), N );
const in_eT* in_mem = &(in[0]);
for(uword i=0; i<N; ++i)
{
out_mem[i] = out_eT( in_mem[i] );
}
} }
return out; return out;
} }
template<typename out_eT> template<typename out_eT>
template<typename in_eT> template<typename in_eT>
inline inline
Row<out_eT> Row<out_eT>
conv_to< Row<out_eT> >::from(const std::vector<in_eT>& in, const typename a rma_cx_only<in_eT>::result* junk) conv_to< Row<out_eT> >::from(const std::vector<in_eT>& in, const typename a rma_cx_only<in_eT>::result* junk)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_ignore(junk); arma_ignore(junk);
Row<out_eT> out( in.size() ); const uword N = uword( in.size() );
typename std::vector<in_eT>::const_iterator in_begin = in.begin();
typename std::vector<in_eT>::const_iterator in_end = in.end();
typename Row<out_eT>::iterator out_begin = out.begin();
typename Row<out_eT>::iterator out_end = out.end();
typename std::vector<in_eT>::const_iterator in_it; Row<out_eT> out(N);
typename Row<out_eT>::iterator out_it;
for(in_it = in_begin, out_it = out_begin; (in_it != in_end) && (out_it != out_end); ++in_it, ++out_it) if(N > 0)
{ {
out_eT& out_elem = (*out_it); arrayops::convert_cx( out.memptr(), &(in[0]), N );
const in_eT& in_elem = (*in_it);
arrayops::convert_cx_scalar(out_elem, in_elem);
} }
return out; return out;
} }
//! conversion to Armadillo column vectors from Armadillo Base objects, as well as from std::vector //! conversion to Armadillo column vectors from Armadillo Base objects, as well as from std::vector
template<typename out_eT> template<typename out_eT>
class conv_to< Col<out_eT> > class conv_to< Col<out_eT> >
{ {
public: public:
skipping to change at line 377 skipping to change at line 355
template<typename out_eT> template<typename out_eT>
template<typename in_eT, typename T1> template<typename in_eT, typename T1>
inline inline
Col<out_eT> Col<out_eT>
conv_to< Col<out_eT> >::from(const Base<in_eT, T1>& in, const typename arma _not_cx<in_eT>::result* junk) conv_to< Col<out_eT> >::from(const Base<in_eT, T1>& in, const typename arma _not_cx<in_eT>::result* junk)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_ignore(junk); arma_ignore(junk);
const unwrap<T1> tmp(in.get_ref()); const quasi_unwrap<T1> tmp(in.get_ref());
const Mat<in_eT>& X = tmp.M; const Mat<in_eT>& X = tmp.M;
arma_debug_check( ( (X.is_vec() == false) && (X.is_empty() == false) ), " conv_to(): given object can't be interpreted as a vector" ); arma_debug_check( ( (X.is_vec() == false) && (X.is_empty() == false) ), " conv_to(): given object can't be interpreted as a vector" );
Col<out_eT> out(X.n_elem); Col<out_eT> out(X.n_elem);
arrayops::convert( out.memptr(), X.memptr(), out.n_elem ); arrayops::convert( out.memptr(), X.memptr(), X.n_elem );
return out; return out;
} }
template<typename out_eT> template<typename out_eT>
template<typename in_eT, typename T1> template<typename in_eT, typename T1>
inline inline
Col<out_eT> Col<out_eT>
conv_to< Col<out_eT> >::from(const Base<in_eT, T1>& in, const typename arma _cx_only<in_eT>::result* junk) conv_to< Col<out_eT> >::from(const Base<in_eT, T1>& in, const typename arma _cx_only<in_eT>::result* junk)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_ignore(junk); arma_ignore(junk);
const unwrap<T1> tmp(in.get_ref()); const quasi_unwrap<T1> tmp(in.get_ref());
const Mat<in_eT>& X = tmp.M; const Mat<in_eT>& X = tmp.M;
arma_debug_check( ( (X.is_vec() == false) && (X.is_empty() == false) ), " conv_to(): given object can't be interpreted as a vector" ); arma_debug_check( ( (X.is_vec() == false) && (X.is_empty() == false) ), " conv_to(): given object can't be interpreted as a vector" );
Col<out_eT> out(X.n_rows, X.n_cols); Col<out_eT> out(X.n_rows, X.n_cols);
arrayops::convert_cx( out.memptr(), X.memptr(), out.n_elem ); arrayops::convert_cx( out.memptr(), X.memptr(), X.n_elem );
return out; return out;
} }
template<typename out_eT> template<typename out_eT>
template<typename in_eT> template<typename in_eT>
inline inline
Col<out_eT> Col<out_eT>
conv_to< Col<out_eT> >::from(const std::vector<in_eT>& in, const typename a rma_not_cx<in_eT>::result* junk) conv_to< Col<out_eT> >::from(const std::vector<in_eT>& in, const typename a rma_not_cx<in_eT>::result* junk)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_ignore(junk); arma_ignore(junk);
const uword N = uword( in.size() ); const uword N = uword( in.size() );
Col<out_eT> out(N); Col<out_eT> out(N);
if(N > 0) if(N > 0)
{ {
out_eT* out_mem = out.memptr(); arrayops::convert( out.memptr(), &(in[0]), N );
const in_eT* in_mem = &(in[0]);
for(uword i=0; i<N; ++i)
{
out_mem[i] = out_eT( in_mem[i] );
}
} }
return out; return out;
} }
template<typename out_eT> template<typename out_eT>
template<typename in_eT> template<typename in_eT>
inline inline
Col<out_eT> Col<out_eT>
conv_to< Col<out_eT> >::from(const std::vector<in_eT>& in, const typename a rma_cx_only<in_eT>::result* junk) conv_to< Col<out_eT> >::from(const std::vector<in_eT>& in, const typename a rma_cx_only<in_eT>::result* junk)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_ignore(junk); arma_ignore(junk);
Col<out_eT> out( in.size() ); const uword N = uword( in.size() );
typename std::vector<in_eT>::const_iterator in_begin = in.begin();
typename std::vector<in_eT>::const_iterator in_end = in.end();
typename Col<out_eT>::iterator out_begin = out.begin();
typename Col<out_eT>::iterator out_end = out.end();
typename std::vector<in_eT>::const_iterator in_it; Col<out_eT> out(N);
typename Col<out_eT>::iterator out_it;
for(in_it = in_begin, out_it = out_begin; (in_it != in_end) && (out_it != out_end); ++in_it, ++out_it) if(N > 0)
{ {
out_eT& out_elem = (*out_it); arrayops::convert_cx( out.memptr(), &(in[0]), N );
const in_eT& in_elem = (*in_it);
arrayops::convert_cx_scalar(out_elem, in_elem);
} }
return out; return out;
} }
template<typename out_eT>
class conv_to< SpMat<out_eT> >
{
public:
template<typename T1>
inline static SpMat<out_eT> from(const Base<out_eT, T1>& in);
};
template<typename out_eT>
template<typename T1>
inline
SpMat<out_eT>
conv_to< SpMat<out_eT> >::from(const Base<out_eT, T1>& in)
{
arma_extra_debug_sigprint();
return SpMat<out_eT>(in.get_ref());
}
//! conversion to Armadillo cubes from Armadillo BaseCube objects //! conversion to Armadillo cubes from Armadillo BaseCube objects
template<typename out_eT> template<typename out_eT>
class conv_to< Cube<out_eT> > class conv_to< Cube<out_eT> >
{ {
public: public:
template<typename in_eT, typename T1> template<typename in_eT, typename T1>
inline static Cube<out_eT> from(const BaseCube<in_eT, T1>& in, const type name arma_not_cx<in_eT>::result* junk = 0); inline static Cube<out_eT> from(const BaseCube<in_eT, T1>& in, const type name arma_not_cx<in_eT>::result* junk = 0);
template<typename in_eT, typename T1> template<typename in_eT, typename T1>
skipping to change at line 495 skipping to change at line 477
conv_to< Cube<out_eT> >::from(const BaseCube<in_eT, T1>& in, const typename arma_not_cx<in_eT>::result* junk) conv_to< Cube<out_eT> >::from(const BaseCube<in_eT, T1>& in, const typename arma_not_cx<in_eT>::result* junk)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_ignore(junk); arma_ignore(junk);
const unwrap_cube<T1> tmp( in.get_ref() ); const unwrap_cube<T1> tmp( in.get_ref() );
const Cube<in_eT>& X = tmp.M; const Cube<in_eT>& X = tmp.M;
Cube<out_eT> out(X.n_rows, X.n_cols, X.n_slices); Cube<out_eT> out(X.n_rows, X.n_cols, X.n_slices);
arrayops::convert( out.memptr(), X.memptr(), out.n_elem ); arrayops::convert( out.memptr(), X.memptr(), X.n_elem );
return out; return out;
} }
template<typename out_eT> template<typename out_eT>
template<typename in_eT, typename T1> template<typename in_eT, typename T1>
inline inline
Cube<out_eT> Cube<out_eT>
conv_to< Cube<out_eT> >::from(const BaseCube<in_eT, T1>& in, const typename arma_cx_only<in_eT>::result* junk) conv_to< Cube<out_eT> >::from(const BaseCube<in_eT, T1>& in, const typename arma_cx_only<in_eT>::result* junk)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_ignore(junk); arma_ignore(junk);
const unwrap_cube<T1> tmp( in.get_ref() ); const unwrap_cube<T1> tmp( in.get_ref() );
const Cube<in_eT>& X = tmp.M; const Cube<in_eT>& X = tmp.M;
Cube<out_eT> out(X.n_rows, X.n_cols, X.n_slices); Cube<out_eT> out(X.n_rows, X.n_cols, X.n_slices);
arrayops::convert_cx( out.memptr(), X.memptr(), out.n_elem ); arrayops::convert_cx( out.memptr(), X.memptr(), X.n_elem );
return out; return out;
} }
//! conversion to std::vector from Armadillo Base objects //! conversion to std::vector from Armadillo Base objects
template<typename out_eT> template<typename out_eT>
class conv_to< std::vector<out_eT> > class conv_to< std::vector<out_eT> >
{ {
public: public:
skipping to change at line 541 skipping to change at line 523
template<typename out_eT> template<typename out_eT>
template<typename in_eT, typename T1> template<typename in_eT, typename T1>
inline inline
std::vector<out_eT> std::vector<out_eT>
conv_to< std::vector<out_eT> >::from(const Base<in_eT, T1>& in, const typen ame arma_not_cx<in_eT>::result* junk) conv_to< std::vector<out_eT> >::from(const Base<in_eT, T1>& in, const typen ame arma_not_cx<in_eT>::result* junk)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_ignore(junk); arma_ignore(junk);
const unwrap<T1> tmp(in.get_ref()); const quasi_unwrap<T1> tmp(in.get_ref());
const Mat<in_eT>& X = tmp.M; const Mat<in_eT>& X = tmp.M;
arma_debug_check( ( (X.is_vec() == false) && (X.is_empty() == false) ), " conv_to(): given object can't be interpreted as a vector" ); arma_debug_check( ( (X.is_vec() == false) && (X.is_empty() == false) ), " conv_to(): given object can't be interpreted as a vector" );
const uword N = X.n_elem; const uword N = X.n_elem;
std::vector<out_eT> out(N); std::vector<out_eT> out(N);
if(N > 0) if(N > 0)
{ {
out_eT* out_mem = &(out[0]); arrayops::convert( &(out[0]), X.memptr(), N );
const in_eT* X_mem = X.memptr();
for(uword i=0; i<N; ++i)
{
out_mem[i] = out_eT( X_mem[i] );
}
} }
return out; return out;
} }
template<typename out_eT> template<typename out_eT>
template<typename in_eT, typename T1> template<typename in_eT, typename T1>
inline inline
std::vector<out_eT> std::vector<out_eT>
conv_to< std::vector<out_eT> >::from(const Base<in_eT, T1>& in, const typen ame arma_cx_only<in_eT>::result* junk) conv_to< std::vector<out_eT> >::from(const Base<in_eT, T1>& in, const typen ame arma_cx_only<in_eT>::result* junk)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_ignore(junk); arma_ignore(junk);
const unwrap<T1> tmp(in.get_ref()); const quasi_unwrap<T1> tmp(in.get_ref());
const Mat<in_eT>& X = tmp.M; const Mat<in_eT>& X = tmp.M;
arma_debug_check( ( (X.is_vec() == false) && (X.is_empty() == false) ), " conv_to(): given object can't be interpreted as a vector" ); arma_debug_check( ( (X.is_vec() == false) && (X.is_empty() == false) ), " conv_to(): given object can't be interpreted as a vector" );
std::vector<out_eT> out(X.n_elem); const uword N = X.n_elem;
typename Mat<in_eT>::const_iterator X_begin = X.begin();
typename Mat<in_eT>::const_iterator X_end = X.end();
typename std::vector<out_eT>::iterator out_begin = out.begin();
typename std::vector<out_eT>::iterator out_end = out.end();
typename Mat<in_eT>::const_iterator X_it; std::vector<out_eT> out(N);
typename std::vector<out_eT>::iterator out_it;
for(X_it = X_begin, out_it = out_begin; (X_it != X_end) && (out_it != out _end); ++X_it, ++out_it) if(N > 0)
{ {
out_eT& out_elem = (*out_it); arrayops::convert_cx( &(out[0]), X.memptr(), N );
const in_eT& X_elem = (*X_it);
arrayops::convert_cx_scalar(out_elem, X_elem);
} }
return out; return out;
} }
//! @} //! @}
 End of changes. 52 change blocks. 
126 lines changed or deleted 92 lines changed or added


 fn_misc.hpp   fn_misc.hpp 
// Copyright (C) 2008-2014 Conrad Sanderson // Copyright (C) 2008-2015 Conrad Sanderson
// Copyright (C) 2008-2014 NICTA (www.nicta.com.au) // Copyright (C) 2008-2015 NICTA (www.nicta.com.au)
// //
// This Source Code Form is subject to the terms of the Mozilla Public // This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this // License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
//! \addtogroup fn_misc //! \addtogroup fn_misc
//! @{ //! @{
//! \brief //! \brief
//! Generate a vector with 'num' elements. //! Generate a vector with 'num' elements.
skipping to change at line 150 skipping to change at line 150
bool bool
>::result >::result
is_finite(const T1& X) is_finite(const T1& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
const Proxy<T1> P(X); const Proxy<T1> P(X);
const bool have_direct_mem = (is_Mat<typename Proxy<T1>::stored_type>::va
lue) || (is_subview_col<typename Proxy<T1>::stored_type>::value);
if(have_direct_mem)
{
const quasi_unwrap<typename Proxy<T1>::stored_type> tmp(P.Q);
return tmp.M.is_finite();
}
if(Proxy<T1>::prefer_at_accessor == false) if(Proxy<T1>::prefer_at_accessor == false)
{ {
const typename Proxy<T1>::ea_type Pea = P.get_ea(); const typename Proxy<T1>::ea_type Pea = P.get_ea();
const uword n_elem = P.get_n_elem(); const uword n_elem = P.get_n_elem();
uword i,j; uword i,j;
for(i=0, j=1; j<n_elem; i+=2, j+=2) for(i=0, j=1; j<n_elem; i+=2, j+=2)
{ {
skipping to change at line 190 skipping to change at line 199
} }
} }
return true; return true;
} }
template<typename T1> template<typename T1>
inline inline
arma_warn_unused arma_warn_unused
bool bool
is_finite(const SpBase<typename T1::elem_type,T1>& X)
{
arma_extra_debug_sigprint();
const SpProxy<T1> P(X.get_ref());
if(is_SpMat<typename SpProxy<T1>::stored_type>::value)
{
const unwrap_spmat<typename SpProxy<T1>::stored_type> tmp(P.Q);
return tmp.M.is_finite();
}
else
{
typename SpProxy<T1>::const_iterator_type it = P.begin();
typename SpProxy<T1>::const_iterator_type it_end = P.end();
while(it != it_end)
{
if(arma_isfinite(*it) == false) { return false; }
++it;
}
}
return true;
}
template<typename T1>
inline
arma_warn_unused
bool
is_finite(const BaseCube<typename T1::elem_type,T1>& X) is_finite(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;
return A.is_finite(); return A.is_finite();
 End of changes. 3 change blocks. 
2 lines changed or deleted 43 lines changed or added


 op_pinv_meat.hpp   op_pinv_meat.hpp 
// Copyright (C) 2009-2013 Conrad Sanderson // Copyright (C) 2009-2015 Conrad Sanderson
// Copyright (C) 2009-2013 NICTA (www.nicta.com.au) // Copyright (C) 2009-2015 NICTA (www.nicta.com.au)
// Copyright (C) 2009-2010 Dimitrios Bouzas // Copyright (C) 2009-2010 Dimitrios Bouzas
// Copyright (C) 2011 Stanislav Funiak // Copyright (C) 2011 Stanislav Funiak
// //
// This Source Code Form is subject to the terms of the Mozilla Public // This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this // License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
//! \addtogroup op_pinv //! \addtogroup op_pinv
//! @{ //! @{
skipping to change at line 66 skipping to change at line 66
if(status == false) if(status == false)
{ {
out.reset(); out.reset();
arma_bad("pinv(): svd failed"); arma_bad("pinv(): svd failed");
return; return;
} }
const uword s_n_elem = s.n_elem; const uword s_n_elem = s.n_elem;
const T* s_mem = s.memptr(); const T* s_mem = s.memptr();
// set tolerance to default if it hasn't been specified as an argument // set tolerance to default if it hasn't been specified
if( (tol == T(0)) && (s_n_elem > 0) ) if( (tol == T(0)) && (s_n_elem > 0) )
{ {
tol = (std::max)(n_rows, n_cols) * eop_aux::direct_eps( op_max::direct_ max(s_mem, s_n_elem) ); tol = (std::max)(n_rows, n_cols) * s_mem[0] * std::numeric_limits<T>::e psilon();
} }
// count non zero valued elements in s
uword count = 0; uword count = 0;
for(uword i = 0; i < s_n_elem; ++i) for(uword i = 0; i < s_n_elem; ++i)
{ {
if(s_mem[i] > tol) { ++count; } count += (s_mem[i] >= tol) ? uword(1) : uword(0);
} }
if(count > 0) if(count > 0)
{ {
Col<T> s2(count); Col<T> s2(count);
T* s2_mem = s2.memptr(); T* s2_mem = s2.memptr();
uword count2 = 0; uword count2 = 0;
for(uword i=0; i < s_n_elem; ++i) for(uword i=0; i < s_n_elem; ++i)
{ {
const T val = s_mem[i]; const T val = s_mem[i];
if(val > tol) { s2_mem[count2] = T(1) / val; ++count2; } if(val >= tol) { s2_mem[count2] = T(1) / val; ++count2; }
} }
if(n_rows >= n_cols) if(n_rows >= n_cols)
{ {
out = ( (V.n_cols > count) ? V.cols(0,count-1) : V ) * diagmat(s2) * trans( (U.n_cols > count) ? U.cols(0,count-1) : U ); out = ( (V.n_cols > count) ? V.cols(0,count-1) : V ) * diagmat(s2) * trans( (U.n_cols > count) ? U.cols(0,count-1) : U );
} }
else else
{ {
out = ( (U.n_cols > count) ? U.cols(0,count-1) : U ) * diagmat(s2) * trans( (V.n_cols > count) ? V.cols(0,count-1) : V ); out = ( (U.n_cols > count) ? U.cols(0,count-1) : U ) * diagmat(s2) * trans( (V.n_cols > count) ? V.cols(0,count-1) : V );
} }
 End of changes. 6 change blocks. 
8 lines changed or deleted 6 lines changed or added


 running_stat_vec_meat.hpp   running_stat_vec_meat.hpp 
skipping to change at line 73 skipping to change at line 73
//! update statistics to reflect new sample //! update statistics to reflect new sample
template<typename obj_type> template<typename obj_type>
template<typename T1> template<typename T1>
arma_hot arma_hot
inline inline
void void
running_stat_vec<obj_type>::operator() (const Base<typename running_stat_ve c<obj_type>::T, T1>& X) running_stat_vec<obj_type>::operator() (const Base<typename running_stat_ve c<obj_type>::T, T1>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
const unwrap<T1> tmp(X.get_ref()); const quasi_unwrap<T1> tmp(X.get_ref());
const Mat<T>& sample = tmp.M; const Mat<T>& sample = tmp.M;
if( sample.is_empty() ) if( sample.is_empty() )
{ {
return; return;
} }
if( sample.is_finite() == false ) if( sample.is_finite() == false )
{ {
arma_warn(true, "running_stat_vec: sample ignored as it has non-finite elements"); arma_warn(true, "running_stat_vec: sample ignored as it has non-finite elements");
skipping to change at line 99 skipping to change at line 99
template<typename obj_type> template<typename obj_type>
template<typename T1> template<typename T1>
arma_hot arma_hot
inline inline
void void
running_stat_vec<obj_type>::operator() (const Base< std::complex<typename r unning_stat_vec<obj_type>::T>, T1>& X) running_stat_vec<obj_type>::operator() (const Base< std::complex<typename r unning_stat_vec<obj_type>::T>, T1>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
const unwrap<T1> tmp(X.get_ref()); const quasi_unwrap<T1> tmp(X.get_ref());
const Mat< std::complex<T> >& sample = tmp.M; const Mat< std::complex<T> >& sample = tmp.M;
if( sample.is_empty() ) if( sample.is_empty() )
{ {
return; return;
} }
if( sample.is_finite() == false ) if( sample.is_finite() == false )
{ {
 End of changes. 2 change blocks. 
2 lines changed or deleted 2 lines changed or added


 sp_auxlib_bones.hpp   sp_auxlib_bones.hpp 
skipping to change at line 19 skipping to change at line 19
//! \addtogroup sp_auxlib //! \addtogroup sp_auxlib
//! @{ //! @{
//! wrapper for accesing external functions for sparse matrices defined in ARPACK //! wrapper for accesing external functions for sparse matrices defined in ARPACK
class sp_auxlib class sp_auxlib
{ {
public: public:
enum form_type enum form_type
{ {
form_none, form_lm, form_sm, form_lr, form_sr, form_li, form_si form_none, form_lm, form_sm, form_lr, form_la, form_sr, form_li, form_s i, form_sa
}; };
inline static form_type interpret_form_str(const char* form_str); inline static form_type interpret_form_str(const char* form_str);
// //
// eigs_sym() via ARPACK // eigs_sym() via ARPACK
template<typename eT, typename T1> template<typename eT, typename T1>
inline static bool eigs_sym(Col<eT>& eigval, Mat<eT>& eigvec, const SpBas e<eT, T1>& X, const uword n_eigvals, const char* form_str, const eT default _tol); inline static bool eigs_sym(Col<eT>& eigval, Mat<eT>& eigvec, const SpBas e<eT, T1>& X, const uword n_eigvals, const char* form_str, const eT default _tol);
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 sp_auxlib_meat.hpp   sp_auxlib_meat.hpp 
skipping to change at line 31 skipping to change at line 31
if( form_str[1] == char(0) ) { return form_none; } if( form_str[1] == char(0) ) { return form_none; }
const char c1 = form_str[0]; const char c1 = form_str[0];
const char c2 = form_str[1]; const char c2 = form_str[1];
if(c1 == 'l') if(c1 == 'l')
{ {
if(c2 == 'm') { return form_lm; } if(c2 == 'm') { return form_lm; }
if(c2 == 'r') { return form_lr; } if(c2 == 'r') { return form_lr; }
if(c2 == 'i') { return form_li; } if(c2 == 'i') { return form_li; }
if(c2 == 'a') { return form_la; }
} }
else else
if(c1 == 's') if(c1 == 's')
{ {
if(c2 == 'm') { return form_sm; } if(c2 == 'm') { return form_sm; }
if(c2 == 'r') { return form_sr; } if(c2 == 'r') { return form_sr; }
if(c2 == 'i') { return form_si; } if(c2 == 'i') { return form_si; }
if(c2 == 'a') { return form_sa; }
} }
return form_none; return form_none;
} }
//! immediate eigendecomposition of symmetric real sparse object //! immediate eigendecomposition of symmetric real sparse object
template<typename eT, typename T1> template<typename eT, typename T1>
inline inline
bool bool
sp_auxlib::eigs_sym(Col<eT>& eigval, Mat<eT>& eigvec, const SpBase<eT, T1>& X, const uword n_eigvals, const char* form_str, const eT default_tol) sp_auxlib::eigs_sym(Col<eT>& eigval, Mat<eT>& eigvec, const SpBase<eT, T1>& X, const uword n_eigvals, const char* form_str, const eT default_tol)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
#if defined(ARMA_USE_ARPACK) #if defined(ARMA_USE_ARPACK)
{ {
const form_type form_val = sp_auxlib::interpret_form_str(form_str); const form_type form_val = sp_auxlib::interpret_form_str(form_str);
arma_debug_check( (form_val != form_lm) && (form_val != form_sm), "eigs _sym(): unknown form specified" ); arma_debug_check( (form_val != form_lm) && (form_val != form_sm) && (fo rm_val != form_la) && (form_val != form_sa), "eigs_sym(): unknown form spec ified" );
char which_sm[3] = "SM"; char which_sm[3] = "SM";
char which_lm[3] = "LM"; char which_lm[3] = "LM";
char* which = (form_val == form_sm) ? which_sm : which_lm; // sel char which_sa[3] = "SA";
ect which eigenvalues we want: smallest magnitude or largest magnitude char which_la[3] = "LA";
char* which;
switch (form_val)
{
case form_sm: which = which_sm; break;
case form_lm: which = which_lm; break;
case form_sa: which = which_sa; break;
case form_la: which = which_la; break;
default: which = which_lm; break;
}
// Make a sparse proxy object. // Make a sparse proxy object.
SpProxy<T1> p(X.get_ref()); SpProxy<T1> p(X.get_ref());
// Make sure it's square. // Make sure it's square.
arma_debug_check( (p.get_n_rows() != p.get_n_cols()), "eigs_sym(): give n sparse matrix is not square"); arma_debug_check( (p.get_n_rows() != p.get_n_cols()), "eigs_sym(): give n sparse matrix is not square");
// Make sure we aren't asking for every eigenvalue. // Make sure we aren't asking for every eigenvalue.
arma_debug_check( (n_eigvals + 1 >= p.get_n_rows()), "eigs_sym(): n_eig vals + 1 must be less than the number of rows in the matrix"); arma_debug_check( (n_eigvals + 1 >= p.get_n_rows()), "eigs_sym(): n_eig vals + 1 must be less than the number of rows in the matrix");
 End of changes. 4 change blocks. 
3 lines changed or deleted 15 lines changed or added


 subview_bones.hpp   subview_bones.hpp 
// Copyright (C) 2008-2014 Conrad Sanderson // Copyright (C) 2008-2015 Conrad Sanderson
// Copyright (C) 2008-2014 NICTA (www.nicta.com.au) // Copyright (C) 2008-2015 NICTA (www.nicta.com.au)
// Copyright (C) 2011 James Sanders // Copyright (C) 2011 James Sanders
// //
// This Source Code Form is subject to the terms of the Mozilla Public // This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this // License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
//! \addtogroup subview //! \addtogroup subview
//! @{ //! @{
//! Class for storing data required to construct or apply operations to a s ubmatrix //! Class for storing data required to construct or apply operations to a s ubmatrix
skipping to change at line 106 skipping to change at line 106
inline eT operator()(const uword in_row, const uword in_col) const; inline eT operator()(const uword in_row, const uword in_col) const;
inline eT& at(const uword in_row, const uword in_col); inline eT& at(const uword in_row, const uword in_col);
inline eT at(const uword in_row, const uword in_col) const; inline eT at(const uword in_row, const uword in_col) const;
arma_inline eT* colptr(const uword in_col); arma_inline eT* colptr(const uword in_col);
arma_inline const eT* colptr(const uword in_col) const; arma_inline const eT* colptr(const uword in_col) const;
inline bool check_overlap(const subview& x) const; inline bool check_overlap(const subview& x) const;
inline bool is_vec() const; inline arma_warn_unused bool is_vec() const;
inline arma_warn_unused bool is_finite() const;
inline subview_row<eT> row(const uword row_num); inline subview_row<eT> row(const uword row_num);
inline const subview_row<eT> row(const uword row_num) const; inline const subview_row<eT> row(const uword row_num) const;
inline subview_row<eT> operator()(const uword row_num, const s pan& col_span); inline subview_row<eT> operator()(const uword row_num, const s pan& col_span);
inline const subview_row<eT> operator()(const uword row_num, const s pan& col_span) const; inline const subview_row<eT> operator()(const uword row_num, const s pan& col_span) const;
inline subview_col<eT> col(const uword col_num); inline subview_col<eT> col(const uword col_num);
inline const subview_col<eT> col(const uword col_num) const; inline const subview_col<eT> col(const uword col_num) const;
 End of changes. 2 change blocks. 
3 lines changed or deleted 4 lines changed or added


 subview_cube_bones.hpp   subview_cube_bones.hpp 
// Copyright (C) 2008-2014 Conrad Sanderson // Copyright (C) 2008-2015 Conrad Sanderson
// Copyright (C) 2008-2014 NICTA (www.nicta.com.au) // Copyright (C) 2008-2015 NICTA (www.nicta.com.au)
// //
// This Source Code Form is subject to the terms of the Mozilla Public // This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this // License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
//! \addtogroup subview_cube //! \addtogroup subview_cube
//! @{ //! @{
//! Class for storing data required to construct or apply operations to a s ubcube //! Class for storing data required to construct or apply operations to a s ubcube
//! (i.e. where the subcube starts and ends as well as a reference/pointer to the original cube), //! (i.e. where the subcube starts and ends as well as a reference/pointer to the original cube),
skipping to change at line 87 skipping to change at line 87
template<typename functor> inline void transform(functor F); template<typename functor> inline void transform(functor F);
template<typename functor> inline void imbue(functor F); template<typename functor> inline void imbue(functor F);
inline void fill(const eT val); inline void fill(const eT val);
inline void zeros(); inline void zeros();
inline void ones(); inline void ones();
inline void randu(); inline void randu();
inline void randn(); inline void randn();
inline arma_warn_unused bool is_finite() const;
inline arma_warn_unused eT min() const; inline arma_warn_unused eT min() const;
inline arma_warn_unused eT max() const; inline arma_warn_unused eT max() const;
inline eT at_alt (const uword i) const; inline eT at_alt (const uword i) const;
inline eT& operator[](const uword i); inline eT& operator[](const uword i);
inline eT operator[](const uword i) const; inline eT operator[](const uword i) const;
inline eT& operator()(const uword i); inline eT& operator()(const uword i);
inline eT operator()(const uword i) const; inline eT operator()(const uword i) const;
 End of changes. 2 change blocks. 
2 lines changed or deleted 4 lines changed or added


 subview_cube_meat.hpp   subview_cube_meat.hpp 
skipping to change at line 1100 skipping to change at line 1100
for(uword col = 0; col < local_n_cols; ++col) for(uword col = 0; col < local_n_cols; ++col)
{ {
arma_rng::randn<eT>::fill( slice_colptr(slice,col), local_n_rows ); arma_rng::randn<eT>::fill( slice_colptr(slice,col), local_n_rows );
} }
} }
} }
template<typename eT> template<typename eT>
inline inline
arma_warn_unused arma_warn_unused
bool
subview_cube<eT>::is_finite() const
{
arma_extra_debug_sigprint();
const uword local_n_rows = n_rows;
const uword local_n_cols = n_cols;
const uword local_n_slices = n_slices;
for(uword slice = 0; slice < local_n_slices; ++slice)
{
for(uword col = 0; col < local_n_cols; ++col)
{
if(arrayops::is_finite(slice_colptr(slice,col), local_n_rows) == fals
e) { return false; }
}
}
return true;
}
template<typename eT>
inline
arma_warn_unused
eT eT
subview_cube<eT>::min() const subview_cube<eT>::min() const
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( (n_elem == 0), "subview_cube::min(): object has no elem ents" ); arma_debug_check( (n_elem == 0), "subview_cube::min(): object has no elem ents" );
const uword local_n_rows = n_rows; const uword local_n_rows = n_rows;
const uword local_n_cols = n_cols; const uword local_n_cols = n_cols;
const uword local_n_slices = n_slices; const uword local_n_slices = n_slices;
 End of changes. 1 change blocks. 
0 lines changed or deleted 24 lines changed or added


 subview_meat.hpp   subview_meat.hpp 
// Copyright (C) 2008-2014 Conrad Sanderson // Copyright (C) 2008-2015 Conrad Sanderson
// Copyright (C) 2008-2014 NICTA (www.nicta.com.au) // Copyright (C) 2008-2015 NICTA (www.nicta.com.au)
// Copyright (C) 2011 James Sanders // Copyright (C) 2011 James Sanders
// Copyright (C) 2013 Ryan Curtin // Copyright (C) 2013 Ryan Curtin
// //
// This Source Code Form is subject to the terms of the Mozilla Public // This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this // License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
//! \addtogroup subview //! \addtogroup subview
//! @{ //! @{
skipping to change at line 1538 skipping to change at line 1538
const bool outside_rows = ( (x_row_start >= s_row_end_p1) || (s_row_s tart >= x_row_end_p1) ); const bool outside_rows = ( (x_row_start >= s_row_end_p1) || (s_row_s tart >= x_row_end_p1) );
const bool outside_cols = ( (x_col_start >= s_col_end_p1) || (s_col_s tart >= x_col_end_p1) ); const bool outside_cols = ( (x_col_start >= s_col_end_p1) || (s_col_s tart >= x_col_end_p1) );
return ( (outside_rows == false) && (outside_cols == false) ); return ( (outside_rows == false) && (outside_cols == false) );
} }
} }
} }
template<typename eT> template<typename eT>
inline inline
arma_warn_unused
bool bool
subview<eT>::is_vec() const subview<eT>::is_vec() const
{ {
return ( (n_rows == 1) || (n_cols == 1) ); return ( (n_rows == 1) || (n_cols == 1) );
} }
template<typename eT>
inline
arma_warn_unused
bool
subview<eT>::is_finite() const
{
arma_extra_debug_sigprint();
const uword local_n_rows = n_rows;
const uword local_n_cols = n_cols;
for(uword ii=0; ii<local_n_cols; ++ii)
{
if(arrayops::is_finite(colptr(ii), local_n_rows) == false) { return fa
lse; }
}
return true;
}
//! X = Y.submat(...) //! X = Y.submat(...)
template<typename eT> template<typename eT>
inline inline
void void
subview<eT>::extract(Mat<eT>& out, const subview<eT>& in) subview<eT>::extract(Mat<eT>& out, const subview<eT>& in)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
// NOTE: we're assuming that the matrix has already been set to the corre ct size and there is no aliasing; // NOTE: we're assuming that the matrix has already been set to the corre ct size and there is no aliasing;
// size setting and alias checking is done by either the Mat contructor o r operator=() // size setting and alias checking is done by either the Mat contructor o r operator=()
 End of changes. 3 change blocks. 
2 lines changed or deleted 23 lines changed or added


 unwrap.hpp   unwrap.hpp 
skipping to change at line 317 skipping to change at line 317
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
} }
const Mat<out_eT> M; const Mat<out_eT> M;
template<typename eT2> template<typename eT2>
arma_inline bool is_alias(const Mat<eT2>&) const { return false; } arma_inline bool is_alias(const Mat<eT2>&) const { return false; }
}; };
template<typename T1>
struct quasi_unwrap< Op<T1, op_vectorise_col> >
{
static const bool has_subview = true;
typedef typename T1::elem_type eT;
inline
quasi_unwrap(const Op<T1, op_vectorise_col>& A)
: U( A.m )
, M( const_cast<eT*>(U.M.memptr()), U.M.n_elem, 1, false, false )
{
arma_extra_debug_sigprint();
}
const unwrap<T1> U;
const Mat<eT> M;
template<typename eT2>
arma_inline bool is_alias(const Mat<eT2>& X) const { return (void_ptr(&(U
.M)) == void_ptr(&X)); }
};
// //
// //
// //
template<typename T1> template<typename T1>
struct unwrap_check_default struct unwrap_check_default
{ {
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
typedef Mat<eT> stored_type; typedef Mat<eT> stored_type;
 End of changes. 1 change blocks. 
0 lines changed or deleted 23 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/