Base_bones.hpp   Base_bones.hpp 
// Copyright (C) 2008-2011 NICTA (www.nicta.com.au) // Copyright (C) 2008-2012 NICTA (www.nicta.com.au)
// Copyright (C) 2008-2011 Conrad Sanderson // Copyright (C) 2008-2012 Conrad Sanderson
// //
// This file is part of the Armadillo C++ library. // This file is part of the Armadillo C++ library.
// It is provided without any warranty of fitness // It is provided without any warranty of fitness
// for any purpose. You can redistribute this file // for any purpose. You can redistribute this file
// and/or modify it under the terms of the GNU // and/or modify it under the terms of the GNU
// Lesser General Public License (LGPL) as published // Lesser General Public License (LGPL) as published
// by the Free Software Foundation, either version 3 // by the Free Software Foundation, either version 3
// of the License or (at your option) any later version. // of the License or (at your option) any later version.
// (see http://www.opensource.org/licenses for more info) // (see http://www.opensource.org/licenses for more info)
//! \addtogroup Base //! \addtogroup Base
//! @{ //! @{
template<typename derived>
struct Base_blas_elem_type
{
arma_inline const Op<derived,op_inv> i(const bool slow = false) const;
//!< matrix inverse
};
template<typename derived>
struct Base_other_elem_type
{
};
template<typename derived, bool condition>
struct Base_extra {};
template<typename derived>
struct Base_extra<derived, true> { typedef Base_blas_elem_type<derived> r
esult; };
template<typename derived>
struct Base_extra<derived, false> { typedef Base_other_elem_type<derived> r
esult; };
//! Class for static polymorphism, modelled after the "Curiously Recurring Template Pattern" (CRTP). //! Class for static polymorphism, modelled after the "Curiously Recurring Template Pattern" (CRTP).
//! Used for type-safe downcasting in functions that restrict their input(s ) to be classes that are //! Used for type-safe downcasting in functions that restrict their input(s ) to be classes that are
//! derived from Base (e.g. Mat, Op, Glue, diagview, subview). //! derived from Base (e.g. Mat, Op, Glue, diagview, subview).
//! A Base object can be converted to a Mat object by the unwrap class. //! A Base object can be converted to a Mat object by the unwrap class.
template<typename elem_type, typename derived> template<typename elem_type, typename derived>
struct Base struct Base : public Base_extra<derived, is_supported_blas_type<elem_type>: :value>::result
{ {
arma_inline const derived& get_ref() const; arma_inline const derived& get_ref() const;
arma_inline const Op<derived,op_htrans> t() const; arma_inline const Op<derived,op_htrans> t() const; //!< Hermitian trans
arma_inline const Op<derived,op_htrans> ht() const; pose
arma_inline const Op<derived,op_strans> st() const; arma_inline const Op<derived,op_htrans> ht() const; //!< Hermitian trans
pose
arma_inline const Op<derived,op_strans> st() const; //!< simple transpos
e
inline void print(const std::string extra_text = "") const; inline void print(const std::string extra_text = "") const;
inline void print(std::ostream& user_stream, const std::string extra_text = "") const; inline void print(std::ostream& user_stream, const std::string extra_text = "") const;
inline void raw_print(const std::string extra_text = "") const; inline void raw_print(const std::string extra_text = "") const;
inline void raw_print(std::ostream& user_stream, const std::string extra_ text = "") const; inline void raw_print(std::ostream& user_stream, const std::string extra_ text = "") const;
}; };
//! @} //! @}
 End of changes. 4 change blocks. 
6 lines changed or deleted 32 lines changed or added


 Base_meat.hpp   Base_meat.hpp 
// Copyright (C) 2008-2011 NICTA (www.nicta.com.au) // Copyright (C) 2008-2012 NICTA (www.nicta.com.au)
// Copyright (C) 2008-2011 Conrad Sanderson // Copyright (C) 2008-2012 Conrad Sanderson
// //
// This file is part of the Armadillo C++ library. // This file is part of the Armadillo C++ library.
// It is provided without any warranty of fitness // It is provided without any warranty of fitness
// for any purpose. You can redistribute this file // for any purpose. You can redistribute this file
// and/or modify it under the terms of the GNU // and/or modify it under the terms of the GNU
// Lesser General Public License (LGPL) as published // Lesser General Public License (LGPL) as published
// by the Free Software Foundation, either version 3 // by the Free Software Foundation, either version 3
// of the License or (at your option) any later version. // of the License or (at your option) any later version.
// (see http://www.opensource.org/licenses for more info) // (see http://www.opensource.org/licenses for more info)
skipping to change at line 88 skipping to change at line 88
template<typename elem_type, typename derived> template<typename elem_type, typename derived>
inline inline
void void
Base<elem_type,derived>::raw_print(std::ostream& user_stream, const std::st ring extra_text) const Base<elem_type,derived>::raw_print(std::ostream& user_stream, const std::st ring extra_text) const
{ {
const unwrap<derived> tmp( (*this).get_ref() ); const unwrap<derived> tmp( (*this).get_ref() );
tmp.M.impl_raw_print(user_stream, extra_text); tmp.M.impl_raw_print(user_stream, extra_text);
} }
//
// extra functions defined in Base_blas_elem_type
template<typename derived>
arma_inline
const Op<derived,op_inv>
Base_blas_elem_type<derived>::i(const bool slow) const
{
return Op<derived,op_inv>( static_cast<const derived&>(*this), ((slow ==
false) ? 0 : 1), 0 );
}
//! @} //! @}
 End of changes. 2 change blocks. 
2 lines changed or deleted 14 lines changed or added


 Col_bones.hpp   Col_bones.hpp 
skipping to change at line 89 skipping to change at line 89
//arma_inline subview_col<eT> operator()(const span& row_span); //arma_inline subview_col<eT> operator()(const span& row_span);
//arma_inline const subview_col<eT> operator()(const span& row_span) cons t; //arma_inline const subview_col<eT> operator()(const span& row_span) cons t;
inline void shed_row (const uword row_num); inline void shed_row (const uword row_num);
inline void shed_rows(const uword in_row1, const uword in_row2); inline void shed_rows(const uword in_row1, const uword in_row2);
inline void insert_rows(const uword row_num, const uword N, const bool set_to_zero = true); inline void insert_rows(const uword row_num, const uword N, const bool set_to_zero = true);
template<typename T1> inline void insert_rows(const uword row_num, const Base<eT,T1>& X); template<typename T1> inline void insert_rows(const uword row_num, const Base<eT,T1>& X);
arma_inline arma_warn_unused eT& at(const uword i);
arma_inline arma_warn_unused eT at(const uword i) const;
arma_inline arma_warn_unused eT& at(const uword in_row, const uword in_co
l);
arma_inline arma_warn_unused eT at(const uword in_row, const uword in_co
l) const;
typedef eT* row_iterator; typedef eT* row_iterator;
typedef const eT* const_row_iterator; typedef const eT* const_row_iterator;
inline row_iterator begin_row(const uword row_num); inline row_iterator begin_row(const uword row_num);
inline const_row_iterator begin_row(const uword row_num) const; inline const_row_iterator begin_row(const uword row_num) const;
inline row_iterator end_row (const uword row_num); inline row_iterator end_row (const uword row_num);
inline const_row_iterator end_row (const uword row_num) const; inline const_row_iterator end_row (const uword row_num) const;
template<uword fixed_n_elem> template<uword fixed_n_elem>
 End of changes. 1 change blocks. 
0 lines changed or deleted 8 lines changed or added


 Col_meat.hpp   Col_meat.hpp 
skipping to change at line 558 skipping to change at line 558
inline inline
void void
Col<eT>::insert_rows(const uword row_num, const Base<eT,T1>& X) Col<eT>::insert_rows(const uword row_num, const Base<eT,T1>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
Mat<eT>::insert_rows(row_num, X); Mat<eT>::insert_rows(row_num, X);
} }
template<typename eT> template<typename eT>
arma_inline
arma_warn_unused
eT&
Col<eT>::at(const uword i)
{
return access::rw(Mat<eT>::mem[i]);
}
template<typename eT>
arma_inline
arma_warn_unused
eT
Col<eT>::at(const uword i) const
{
return Mat<eT>::mem[i];
}
template<typename eT>
arma_inline
arma_warn_unused
eT&
Col<eT>::at(const uword in_row, const uword)
{
return access::rw( Mat<eT>::mem[in_row] );
}
template<typename eT>
arma_inline
arma_warn_unused
eT
Col<eT>::at(const uword in_row, const uword) const
{
return Mat<eT>::mem[in_row];
}
template<typename eT>
inline inline
typename Col<eT>::row_iterator typename Col<eT>::row_iterator
Col<eT>::begin_row(const uword row_num) Col<eT>::begin_row(const uword row_num)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( (row_num >= Mat<eT>::n_rows), "begin_row(): index out o f bounds"); arma_debug_check( (row_num >= Mat<eT>::n_rows), "begin_row(): index out o f bounds");
return Mat<eT>::memptr() + row_num; return Mat<eT>::memptr() + row_num;
} }
skipping to change at line 941 skipping to change at line 977
arma_debug_check( (i >= fixed_n_elem), "Col::operator(): out of bounds"); arma_debug_check( (i >= fixed_n_elem), "Col::operator(): out of bounds");
return (use_extra) ? mem_local_extra[i] : Mat<eT>::mem_local[i]; return (use_extra) ? mem_local_extra[i] : Mat<eT>::mem_local[i];
} }
template<typename eT> template<typename eT>
template<uword fixed_n_elem> template<uword fixed_n_elem>
arma_inline arma_inline
arma_warn_unused arma_warn_unused
eT& eT&
Col<eT>::fixed<fixed_n_elem>::at(const uword in_row, const uword in_col) Col<eT>::fixed<fixed_n_elem>::at(const uword in_row, const uword)
{ {
return (use_extra) ? mem_local_extra[in_row] : Mat<eT>::mem_local[in_row] ; return (use_extra) ? mem_local_extra[in_row] : Mat<eT>::mem_local[in_row] ;
} }
template<typename eT> template<typename eT>
template<uword fixed_n_elem> template<uword fixed_n_elem>
arma_inline arma_inline
arma_warn_unused arma_warn_unused
eT eT
Col<eT>::fixed<fixed_n_elem>::at(const uword in_row, const uword in_col) co nst Col<eT>::fixed<fixed_n_elem>::at(const uword in_row, const uword) const
{ {
return (use_extra) ? mem_local_extra[in_row] : Mat<eT>::mem_local[in_row] ; return (use_extra) ? mem_local_extra[in_row] : Mat<eT>::mem_local[in_row] ;
} }
template<typename eT> template<typename eT>
template<uword fixed_n_elem> template<uword fixed_n_elem>
arma_inline arma_inline
arma_warn_unused arma_warn_unused
eT& eT&
Col<eT>::fixed<fixed_n_elem>::operator() (const uword in_row, const uword i n_col) Col<eT>::fixed<fixed_n_elem>::operator() (const uword in_row, const uword i n_col)
 End of changes. 3 change blocks. 
2 lines changed or deleted 38 lines changed or added


 Cube_meat.hpp   Cube_meat.hpp 
skipping to change at line 28 skipping to change at line 28
Cube<eT>::~Cube() Cube<eT>::~Cube()
{ {
arma_extra_debug_sigprint_this(this); arma_extra_debug_sigprint_this(this);
delete_mat(); delete_mat();
if(mem_state == 0) if(mem_state == 0)
{ {
if(n_elem > Cube_prealloc::mem_n_elem) if(n_elem > Cube_prealloc::mem_n_elem)
{ {
#if defined(ARMA_USE_TBB_ALLOC) memory::release( access::rw(mem) );
scalable_free((void *)(mem));
#else
delete [] mem;
#endif
} }
} }
if(arma_config::debug == true) if(arma_config::debug == true)
{ {
// try to expose buggy user code that accesses deleted objects // try to expose buggy user code that accesses deleted objects
access::rw(n_rows) = 0; access::rw(n_rows) = 0;
access::rw(n_cols) = 0; access::rw(n_cols) = 0;
access::rw(n_slices) = 0; access::rw(n_slices) = 0;
access::rw(n_elem) = 0; access::rw(n_elem) = 0;
skipping to change at line 108 skipping to change at line 104
); );
if(n_elem <= Cube_prealloc::mem_n_elem) if(n_elem <= Cube_prealloc::mem_n_elem)
{ {
access::rw(mem) = mem_local; access::rw(mem) = mem_local;
} }
else else
{ {
arma_extra_debug_print("Cube::init(): allocating memory"); arma_extra_debug_print("Cube::init(): allocating memory");
#if defined(ARMA_USE_TBB_ALLOC) access::rw(mem) = memory::acquire<eT>(n_elem);
access::rw(mem) = (eT *)scalable_malloc(sizeof(eT)*n_elem);
#else
access::rw(mem) = new(std::nothrow) eT[n_elem];
#endif
arma_check_bad_alloc( (mem == 0), "Cube::init(): out of memory" ); arma_check_bad_alloc( (mem == 0), "Cube::init(): out of memory" );
} }
if(n_elem == 0) if(n_elem == 0)
{ {
access::rw(n_rows) = 0; access::rw(n_rows) = 0;
access::rw(n_cols) = 0; access::rw(n_cols) = 0;
access::rw(n_elem_slice) = 0; access::rw(n_elem_slice) = 0;
access::rw(n_slices) = 0; access::rw(n_slices) = 0;
skipping to change at line 200 skipping to change at line 192
arma_debug_check( (t_mem_state == 2), "Cube::init(): requested size is not compatible with the size of auxiliary memory" ); arma_debug_check( (t_mem_state == 2), "Cube::init(): requested size is not compatible with the size of auxiliary memory" );
delete_mat(); delete_mat();
if(t_mem_state == 0) if(t_mem_state == 0)
{ {
if(n_elem > Cube_prealloc::mem_n_elem ) if(n_elem > Cube_prealloc::mem_n_elem )
{ {
arma_extra_debug_print("Cube::init(): freeing memory"); arma_extra_debug_print("Cube::init(): freeing memory");
#if defined(ARMA_USE_TBB_ALLOC) memory::release( access::rw(mem) );
scalable_free((void *)(mem));
#else
delete [] mem;
#endif
} }
} }
access::rw(mem_state) = 0; access::rw(mem_state) = 0;
if(new_n_elem <= Cube_prealloc::mem_n_elem) if(new_n_elem <= Cube_prealloc::mem_n_elem)
{ {
access::rw(mem) = mem_local; access::rw(mem) = mem_local;
} }
else else
{ {
arma_extra_debug_print("Cube::init(): allocating memory"); arma_extra_debug_print("Cube::init(): allocating memory");
#if defined(ARMA_USE_TBB_ALLOC) access::rw(mem) = memory::acquire<eT>(new_n_elem);
access::rw(mem) = (eT *)scalable_malloc(sizeof(eT)*new_n_elem);
#else
access::rw(mem) = new(std::nothrow) eT[new_n_elem];
#endif
arma_check_bad_alloc( (mem == 0), "Cube::init(): out of memory" ); arma_check_bad_alloc( (mem == 0), "Cube::init(): out of memory" );
} }
if(new_n_elem > 0) if(new_n_elem > 0)
{ {
access::rw(n_rows) = in_n_rows; access::rw(n_rows) = in_n_rows;
access::rw(n_cols) = in_n_cols; access::rw(n_cols) = in_n_cols;
access::rw(n_elem_slice) = in_n_rows*in_n_cols; access::rw(n_elem_slice) = in_n_rows*in_n_cols;
access::rw(n_slices) = in_n_slices; access::rw(n_slices) = in_n_slices;
skipping to change at line 2998 skipping to change at line 2982
const Cube<eT>& A = tmp.M; const Cube<eT>& A = tmp.M;
arma_debug_assert_same_size( out, A, "Cube::set_real()" ); arma_debug_assert_same_size( out, A, "Cube::set_real()" );
out = A; out = A;
} }
template<typename eT, typename T1> template<typename eT, typename T1>
inline inline
void void
Cube_aux::set_imag(Cube<eT>& out, const BaseCube<eT,T1>& X) Cube_aux::set_imag(Cube<eT>&, const BaseCube<eT,T1>&)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
} }
template<typename T, typename T1> template<typename T, typename T1>
inline inline
void void
Cube_aux::set_real(Cube< std::complex<T> >& out, const BaseCube<T,T1>& X) Cube_aux::set_real(Cube< std::complex<T> >& out, const BaseCube<T,T1>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
 End of changes. 5 change blocks. 
21 lines changed or deleted 5 lines changed or added


 Mat_meat.hpp   Mat_meat.hpp 
skipping to change at line 26 skipping to change at line 26
template<typename eT> template<typename eT>
inline inline
Mat<eT>::~Mat() Mat<eT>::~Mat()
{ {
arma_extra_debug_sigprint_this(this); arma_extra_debug_sigprint_this(this);
if(mem_state == 0) if(mem_state == 0)
{ {
if(n_elem > arma_config::mat_prealloc) if(n_elem > arma_config::mat_prealloc)
{ {
#if defined(ARMA_USE_TBB_ALLOC) memory::release( access::rw(mem) );
scalable_free((void *)(mem));
#else
delete [] mem;
#endif
} }
} }
if(arma_config::debug == true) if(arma_config::debug == true)
{ {
// try to expose buggy user code that accesses deleted objects // try to expose buggy user code that accesses deleted objects
access::rw(n_rows) = 0; access::rw(n_rows) = 0;
access::rw(n_cols) = 0; access::rw(n_cols) = 0;
access::rw(n_elem) = 0; access::rw(n_elem) = 0;
access::rw(mem) = 0; access::rw(mem) = 0;
skipping to change at line 132 skipping to change at line 128
); );
if(n_elem <= arma_config::mat_prealloc) if(n_elem <= arma_config::mat_prealloc)
{ {
access::rw(mem) = mem_local; access::rw(mem) = mem_local;
} }
else else
{ {
arma_extra_debug_print("Mat::init(): allocating memory"); arma_extra_debug_print("Mat::init(): allocating memory");
#if defined(ARMA_USE_TBB_ALLOC) access::rw(mem) = memory::acquire<eT>(n_elem);
access::rw(mem) = (eT *) scalable_malloc(sizeof(eT)*n_elem);
#else
access::rw(mem) = new(std::nothrow) eT[n_elem];
#endif
arma_check_bad_alloc( (mem == 0), "Mat::init(): out of memory" ); arma_check_bad_alloc( (mem == 0), "Mat::init(): out of memory" );
} }
} }
//! internal matrix construction; if the requested size is small enough, me mory from the stack is used. otherwise memory is allocated via 'new' //! internal matrix construction; if the requested size is small enough, me mory from the stack is used. otherwise memory is allocated via 'new'
template<typename eT> template<typename eT>
inline inline
void void
Mat<eT>::init_warm(uword in_n_rows, uword in_n_cols) Mat<eT>::init_warm(uword in_n_rows, uword in_n_cols)
skipping to change at line 235 skipping to change at line 227
(t_mem_state == 2), (t_mem_state == 2),
"Mat::init(): mismatch between size of auxiliary memory and requested size" "Mat::init(): mismatch between size of auxiliary memory and requested size"
); );
if(t_mem_state == 0) if(t_mem_state == 0)
{ {
if(old_n_elem > arma_config::mat_prealloc) if(old_n_elem > arma_config::mat_prealloc)
{ {
arma_extra_debug_print("Mat::init(): freeing memory"); arma_extra_debug_print("Mat::init(): freeing memory");
#if defined(ARMA_USE_TBB_ALLOC) memory::release( access::rw(mem) );
scalable_free((void *)(mem));
#else
delete [] mem;
#endif
} }
} }
if(new_n_elem <= arma_config::mat_prealloc) if(new_n_elem <= arma_config::mat_prealloc)
{ {
access::rw(mem) = mem_local; access::rw(mem) = mem_local;
} }
else else
{ {
arma_extra_debug_print("Mat::init(): allocating memory"); arma_extra_debug_print("Mat::init(): allocating memory");
#if defined(ARMA_USE_TBB_ALLOC) access::rw(mem) = memory::acquire<eT>(new_n_elem);
access::rw(mem) = (eT *) scalable_malloc(sizeof(eT)*new_n_elem);
#else
access::rw(mem) = new(std::nothrow) eT[new_n_elem];
#endif
arma_check_bad_alloc( (mem == 0), "Mat::init(): out of memory" ); arma_check_bad_alloc( (mem == 0), "Mat::init(): out of memory" );
} }
access::rw(n_rows) = in_n_rows; access::rw(n_rows) = in_n_rows;
access::rw(n_cols) = in_n_cols; access::rw(n_cols) = in_n_cols;
access::rw(n_elem) = new_n_elem; access::rw(n_elem) = new_n_elem;
access::rw(mem_state) = 0; access::rw(mem_state) = 0;
} }
} }
skipping to change at line 5654 skipping to change at line 5638
const Mat<eT>& A = tmp.M; const Mat<eT>& A = tmp.M;
arma_debug_assert_same_size( out, A, "Mat::set_real()" ); arma_debug_assert_same_size( out, A, "Mat::set_real()" );
out = A; out = A;
} }
template<typename eT, typename T1> template<typename eT, typename T1>
inline inline
void void
Mat_aux::set_imag(Mat<eT>& out, const Base<eT,T1>& X) Mat_aux::set_imag(Mat<eT>&, const Base<eT,T1>&)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
} }
template<typename T, typename T1> template<typename T, typename T1>
inline inline
void void
Mat_aux::set_real(Mat< std::complex<T> >& out, const Base<T,T1>& X) Mat_aux::set_real(Mat< std::complex<T> >& out, const Base<T,T1>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
 End of changes. 5 change blocks. 
21 lines changed or deleted 5 lines changed or added


 Proxy.hpp   Proxy.hpp 
skipping to change at line 20 skipping to change at line 20
// of the License or (at your option) any later version. // of the License or (at your option) any later version.
// (see http://www.opensource.org/licenses for more info) // (see http://www.opensource.org/licenses for more info)
//! \addtogroup Proxy //! \addtogroup Proxy
//! @{ //! @{
template<typename T1> template<typename T1>
class Proxy class Proxy
{ {
public: public:
inline Proxy(const T1& A) inline Proxy(const T1&)
{ {
arma_type_check(( is_arma_type<T1>::value == false )); arma_type_check(( is_arma_type<T1>::value == false ));
} }
}; };
// ea_type is the "element accessor" type, // ea_type is the "element accessor" type,
// which can provide access to elements via operator[] // which can provide access to elements via operator[]
template<typename eT> template<typename eT>
class Proxy< Mat<eT> > class Proxy< Mat<eT> >
skipping to change at line 334 skipping to change at line 334
}; };
template<typename eT> template<typename eT>
class Proxy< subview_col<eT> > class Proxy< subview_col<eT> >
{ {
public: public:
typedef eT elem_type; typedef eT elem_type;
typedef typename get_pod_type<elem_type>::result pod_type; typedef typename get_pod_type<elem_type>::result pod_type;
typedef subview_col<eT> stored_type; typedef subview_col<eT> stored_type;
typedef const subview_col<eT>& ea_type; typedef const eT* ea_type;
static const bool prefer_at_accessor = true; static const bool prefer_at_accessor = false;
static const bool has_subview = true; static const bool has_subview = true;
static const bool is_row = false; static const bool is_row = false;
static const bool is_col = true; static const bool is_col = true;
arma_aligned const subview_col<eT>& Q; arma_aligned const subview_col<eT>& Q;
inline explicit Proxy(const subview_col<eT>& A) inline explicit Proxy(const subview_col<eT>& A)
: Q(A) : Q(A)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
} }
arma_inline uword get_n_rows() const { return Q.n_rows; } arma_inline uword get_n_rows() const { return Q.n_rows; }
arma_inline uword get_n_cols() const { return 1; } arma_inline uword get_n_cols() const { return 1; }
arma_inline uword get_n_elem() const { return Q.n_elem; } arma_inline uword get_n_elem() const { return Q.n_elem; }
arma_inline elem_type operator[] (const uword i) const { r arma_inline elem_type operator[] (const uword i) const { r
eturn Q[i]; } eturn Q[i]; }
arma_inline elem_type at (const uword row, const uword) const { r arma_inline elem_type at (const uword row, const uword) const { r
eturn Q.at(row, 0); } eturn Q[row]; }
arma_inline ea_type get_ea() const { return Q; } arma_inline ea_type get_ea() const { return Q.colptr(0); }
template<typename eT2> template<typename eT2>
arma_inline bool is_alias(const Mat<eT2>& X) const { return (void_ptr(&(Q .m)) == void_ptr(&X)); } arma_inline bool is_alias(const Mat<eT2>& X) const { return (void_ptr(&(Q .m)) == void_ptr(&X)); }
}; };
template<typename eT> template<typename eT>
class Proxy< subview_row<eT> > class Proxy< subview_row<eT> >
{ {
public: public:
typedef eT elem_type; typedef eT elem_type;
typedef typename get_pod_type<elem_type>::result pod_type; typedef typename get_pod_type<elem_type>::result pod_type;
typedef subview_row<eT> stored_type; typedef subview_row<eT> stored_type;
typedef const subview_row<eT>& ea_type; typedef const subview_row<eT>& ea_type;
static const bool prefer_at_accessor = true; static const bool prefer_at_accessor = false;
static const bool has_subview = true; static const bool has_subview = true;
static const bool is_row = true; static const bool is_row = true;
static const bool is_col = false; static const bool is_col = false;
arma_aligned const subview_row<eT>& Q; arma_aligned const subview_row<eT>& Q;
inline explicit Proxy(const subview_row<eT>& A) inline explicit Proxy(const subview_row<eT>& A)
: Q(A) : Q(A)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
} }
arma_inline uword get_n_rows() const { return 1; } arma_inline uword get_n_rows() const { return 1; }
arma_inline uword get_n_cols() const { return Q.n_cols; } arma_inline uword get_n_cols() const { return Q.n_cols; }
arma_inline uword get_n_elem() const { return Q.n_elem; } arma_inline uword get_n_elem() const { return Q.n_elem; }
arma_inline elem_type operator[] (const uword i) const { r arma_inline elem_type operator[] (const uword i) const { r
eturn Q[i]; } eturn Q[i]; }
arma_inline elem_type at (const uword, const uword col) const { r arma_inline elem_type at (const uword, const uword col) const { r
eturn Q.at(0, col); } eturn Q[col]; }
arma_inline ea_type get_ea() const { return Q; } arma_inline ea_type get_ea() const { return Q; }
template<typename eT2> template<typename eT2>
arma_inline bool is_alias(const Mat<eT2>& X) const { return (void_ptr(&(Q .m)) == void_ptr(&X)); } arma_inline bool is_alias(const Mat<eT2>& X) const { return (void_ptr(&(Q .m)) == void_ptr(&X)); }
}; };
template<typename eT, typename T1> template<typename eT, typename T1>
class Proxy< subview_elem1<eT,T1> > class Proxy< subview_elem1<eT,T1> >
{ {
 End of changes. 7 change blocks. 
13 lines changed or deleted 13 lines changed or added


 ProxyCube.hpp   ProxyCube.hpp 
skipping to change at line 20 skipping to change at line 20
// of the License or (at your option) any later version. // of the License or (at your option) any later version.
// (see http://www.opensource.org/licenses for more info) // (see http://www.opensource.org/licenses for more info)
//! \addtogroup ProxyCube //! \addtogroup ProxyCube
//! @{ //! @{
template<typename T1> template<typename T1>
class ProxyCube class ProxyCube
{ {
public: public:
inline ProxyCube(const T1& A) inline ProxyCube(const T1&)
{ {
arma_type_check(( is_arma_cube_type<T1>::value == false )); arma_type_check(( is_arma_cube_type<T1>::value == false ));
} }
}; };
// ea_type is the "element accessor" type, // ea_type is the "element accessor" type,
// which can provide access to elements via operator[] // which can provide access to elements via operator[]
template<typename eT> template<typename eT>
class ProxyCube< Cube<eT> > class ProxyCube< Cube<eT> >
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 Row_bones.hpp   Row_bones.hpp 
skipping to change at line 89 skipping to change at line 89
// arma_inline subview_row<eT> operator()(const span& col_span); // arma_inline subview_row<eT> operator()(const span& col_span);
// arma_inline const subview_row<eT> operator()(const span& col_span) con st; // arma_inline const subview_row<eT> operator()(const span& col_span) con st;
inline void shed_col (const uword col_num); inline void shed_col (const uword col_num);
inline void shed_cols(const uword in_col1, const uword in_col2); inline void shed_cols(const uword in_col1, const uword in_col2);
inline void insert_cols(const uword col_num, const uword N, const bool set_to_zero = true); inline void insert_cols(const uword col_num, const uword N, const bool set_to_zero = true);
template<typename T1> inline void insert_cols(const uword col_num, const Base<eT,T1>& X); template<typename T1> inline void insert_cols(const uword col_num, const Base<eT,T1>& X);
arma_inline arma_warn_unused eT& at(const uword i);
arma_inline arma_warn_unused eT at(const uword i) const;
arma_inline arma_warn_unused eT& at(const uword in_row, const uword in_co
l);
arma_inline arma_warn_unused eT at(const uword in_row, const uword in_co
l) const;
typedef eT* row_iterator; typedef eT* row_iterator;
typedef const eT* const_row_iterator; typedef const eT* const_row_iterator;
inline row_iterator begin_row(const uword row_num); inline row_iterator begin_row(const uword row_num);
inline const_row_iterator begin_row(const uword row_num) const; inline const_row_iterator begin_row(const uword row_num) const;
inline row_iterator end_row (const uword row_num); inline row_iterator end_row (const uword row_num);
inline const_row_iterator end_row (const uword row_num) const; inline const_row_iterator end_row (const uword row_num) const;
template<uword fixed_n_elem> template<uword fixed_n_elem>
 End of changes. 1 change blocks. 
0 lines changed or deleted 8 lines changed or added


 Row_meat.hpp   Row_meat.hpp 
skipping to change at line 524 skipping to change at line 524
inline inline
void void
Row<eT>::insert_cols(const uword col_num, const Base<eT,T1>& X) Row<eT>::insert_cols(const uword col_num, const Base<eT,T1>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
Mat<eT>::insert_cols(col_num, X); Mat<eT>::insert_cols(col_num, X);
} }
template<typename eT> template<typename eT>
arma_inline
arma_warn_unused
eT&
Row<eT>::at(const uword i)
{
return access::rw(Mat<eT>::mem[i]);
}
template<typename eT>
arma_inline
arma_warn_unused
eT
Row<eT>::at(const uword i) const
{
return Mat<eT>::mem[i];
}
template<typename eT>
arma_inline
arma_warn_unused
eT&
Row<eT>::at(const uword, const uword in_col)
{
return access::rw( Mat<eT>::mem[in_col] );
}
template<typename eT>
arma_inline
arma_warn_unused
eT
Row<eT>::at(const uword, const uword in_col) const
{
return Mat<eT>::mem[in_col];
}
template<typename eT>
inline inline
typename Row<eT>::row_iterator typename Row<eT>::row_iterator
Row<eT>::begin_row(const uword row_num) Row<eT>::begin_row(const uword row_num)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( (row_num >= Mat<eT>::n_rows), "begin_row(): index out o f bounds"); arma_debug_check( (row_num >= Mat<eT>::n_rows), "begin_row(): index out o f bounds");
return Mat<eT>::memptr(); return Mat<eT>::memptr();
} }
skipping to change at line 881 skipping to change at line 917
arma_debug_check( (i >= fixed_n_elem), "Row::operator(): out of bounds"); arma_debug_check( (i >= fixed_n_elem), "Row::operator(): out of bounds");
return (use_extra) ? mem_local_extra[i] : Mat<eT>::mem_local[i]; return (use_extra) ? mem_local_extra[i] : Mat<eT>::mem_local[i];
} }
template<typename eT> template<typename eT>
template<uword fixed_n_elem> template<uword fixed_n_elem>
arma_inline arma_inline
arma_warn_unused arma_warn_unused
eT& eT&
Row<eT>::fixed<fixed_n_elem>::at(const uword in_row, const uword in_col) Row<eT>::fixed<fixed_n_elem>::at(const uword, const uword in_col)
{ {
return (use_extra) ? mem_local_extra[in_col] : Mat<eT>::mem_local[in_col] ; return (use_extra) ? mem_local_extra[in_col] : Mat<eT>::mem_local[in_col] ;
} }
template<typename eT> template<typename eT>
template<uword fixed_n_elem> template<uword fixed_n_elem>
arma_inline arma_inline
arma_warn_unused arma_warn_unused
eT eT
Row<eT>::fixed<fixed_n_elem>::at(const uword in_row, const uword in_col) co nst Row<eT>::fixed<fixed_n_elem>::at(const uword, const uword in_col) const
{ {
return (use_extra) ? mem_local_extra[in_col] : Mat<eT>::mem_local[in_col] ; return (use_extra) ? mem_local_extra[in_col] : Mat<eT>::mem_local[in_col] ;
} }
template<typename eT> template<typename eT>
template<uword fixed_n_elem> template<uword fixed_n_elem>
arma_inline arma_inline
arma_warn_unused arma_warn_unused
eT& eT&
Row<eT>::fixed<fixed_n_elem>::operator() (const uword in_row, const uword i n_col) Row<eT>::fixed<fixed_n_elem>::operator() (const uword in_row, const uword i n_col)
 End of changes. 3 change blocks. 
2 lines changed or deleted 38 lines changed or added


 arma_ostream_meat.hpp   arma_ostream_meat.hpp 
// Copyright (C) 2008-2011 NICTA (www.nicta.com.au) // Copyright (C) 2008-2012 NICTA (www.nicta.com.au)
// Copyright (C) 2008-2011 Conrad Sanderson // Copyright (C) 2008-2012 Conrad Sanderson
// //
// This file is part of the Armadillo C++ library. // This file is part of the Armadillo C++ library.
// It is provided without any warranty of fitness // It is provided without any warranty of fitness
// for any purpose. You can redistribute this file // for any purpose. You can redistribute this file
// and/or modify it under the terms of the GNU // and/or modify it under the terms of the GNU
// Lesser General Public License (LGPL) as published // Lesser General Public License (LGPL) as published
// by the Free Software Foundation, either version 3 // by the Free Software Foundation, either version 3
// of the License or (at your option) any later version. // of the License or (at your option) any later version.
// (see http://www.opensource.org/licenses for more info) // (see http://www.opensource.org/licenses for more info)
skipping to change at line 59 skipping to change at line 59
std::streamsize cell_width; std::streamsize cell_width;
bool use_layout_B = false; bool use_layout_B = false;
bool use_layout_C = false; bool use_layout_C = false;
for(uword i=0; i<n_elem; ++i) for(uword i=0; i<n_elem; ++i)
{ {
const eT val = data[i]; const eT val = data[i];
if( if(
val >= eT(+100) || ( val >= eT(+100) )
( (is_signed<eT>::value == true) && (val <= eT(-100)) ) || ||
( (is_non_integral<eT>::value == true) && (val > eT(0)) && (val <= eT //( (is_signed<eT>::value == true) && (val <= eT(-100)) ) ||
(+1e-4)) ) || //( (is_non_integral<eT>::value == true) && (val > eT(0)) && (val <=
( (is_non_integral<eT>::value == true) && (is_signed<eT>::value == tr eT(+1e-4)) ) ||
ue) && (val < eT(0)) && (val >= eT(-1e-4)) ) //( (is_non_integral<eT>::value == true) && (is_signed<eT>::value ==
true) && (val < eT(0)) && (val >= eT(-1e-4)) )
(
cond_rel< is_signed<eT>::value >::leq(val, eT(-100))
)
||
(
cond_rel< is_non_integral<eT>::value >::gt(val, eT(0))
&&
cond_rel< is_non_integral<eT>::value >::leq(val, eT(+1e-4))
)
||
(
cond_rel< is_non_integral<eT>::value && is_signed<eT>::value >::lt(
val, eT(0))
&&
cond_rel< is_non_integral<eT>::value && is_signed<eT>::value >::geq
(val, eT(-1e-4))
)
) )
{ {
use_layout_C = true; use_layout_C = true;
break; break;
} }
if( if(
(val >= eT(+10)) || ( (is_signed<eT>::value == true) && (val <= eT(-1 // (val >= eT(+10)) || ( (is_signed<eT>::value == true) && (val <= eT
0)) ) (-10)) )
(val >= eT(+10)) || ( cond_rel< is_signed<eT>::value >::leq(val, eT(-
10)) )
) )
{ {
use_layout_B = true; use_layout_B = true;
} }
} }
if(use_layout_C == true) if(use_layout_C == true)
{ {
o.setf(ios::scientific); o.setf(ios::scientific);
o.setf(ios::right); o.setf(ios::right);
 End of changes. 3 change blocks. 
10 lines changed or deleted 30 lines changed or added


 arma_version.hpp   arma_version.hpp 
skipping to change at line 18 skipping to change at line 18
// Lesser General Public License (LGPL) as published // Lesser General Public License (LGPL) as published
// by the Free Software Foundation, either version 3 // by the Free Software Foundation, either version 3
// of the License or (at your option) any later version. // of the License or (at your option) any later version.
// (see http://www.opensource.org/licenses for more info) // (see http://www.opensource.org/licenses for more info)
//! \addtogroup arma_version //! \addtogroup arma_version
//! @{ //! @{
#define ARMA_VERSION_MAJOR 2 #define ARMA_VERSION_MAJOR 2
#define ARMA_VERSION_MINOR 99 #define ARMA_VERSION_MINOR 99
#define ARMA_VERSION_PATCH 1 #define ARMA_VERSION_PATCH 2
#define ARMA_VERSION_NAME "Antarctic Chilli Ranch (Beta 1)" #define ARMA_VERSION_NAME "Antarctic Chilli Ranch (Beta 2)"
struct arma_version struct arma_version
{ {
static const unsigned int major = ARMA_VERSION_MAJOR; static const unsigned int major = ARMA_VERSION_MAJOR;
static const unsigned int minor = ARMA_VERSION_MINOR; static const unsigned int minor = ARMA_VERSION_MINOR;
static const unsigned int patch = ARMA_VERSION_PATCH; static const unsigned int patch = ARMA_VERSION_PATCH;
static static
inline inline
std::string std::string
 End of changes. 1 change blocks. 
2 lines changed or deleted 2 lines changed or added


 armadillo   armadillo 
skipping to change at line 51 skipping to change at line 51
#if defined(ARMA_HAVE_GETTIMEOFDAY) #if defined(ARMA_HAVE_GETTIMEOFDAY)
#include <sys/time.h> #include <sys/time.h>
#undef ARMA_USE_BOOST_DATE #undef ARMA_USE_BOOST_DATE
#endif #endif
#if defined(ARMA_USE_BOOST_DATE) #if defined(ARMA_USE_BOOST_DATE)
#include <boost/date_time/posix_time/posix_time.hpp> #include <boost/date_time/posix_time/posix_time.hpp>
#endif #endif
#if defined(ARMA_USE_MKL_ALLOC)
#include <mkl_service.h>
#endif
#if defined(ARMA_HAVE_STD_TR1) #if defined(ARMA_HAVE_STD_TR1)
// TODO: add handling of this functionality when use of C++11 is enabled // TODO: add handling of this functionality when use of C++11 is enabled
#include <tr1/cmath> #include <tr1/cmath>
#include <tr1/complex> #include <tr1/complex>
#elif defined(ARMA_USE_BOOST) #elif defined(ARMA_USE_BOOST)
#include <boost/math/complex.hpp> #include <boost/math/complex.hpp>
#include <boost/math/special_functions/acosh.hpp> #include <boost/math/special_functions/acosh.hpp>
#include <boost/math/special_functions/asinh.hpp> #include <boost/math/special_functions/asinh.hpp>
#include <boost/math/special_functions/atanh.hpp> #include <boost/math/special_functions/atanh.hpp>
#endif #endif
skipping to change at line 90 skipping to change at line 94
#include "armadillo_bits/typedef.hpp" #include "armadillo_bits/typedef.hpp"
#include "armadillo_bits/typedef_blas_int.hpp" #include "armadillo_bits/typedef_blas_int.hpp"
#include "armadillo_bits/format_wrap.hpp" #include "armadillo_bits/format_wrap.hpp"
#include "armadillo_bits/arma_version.hpp" #include "armadillo_bits/arma_version.hpp"
#include "armadillo_bits/arma_config.hpp" #include "armadillo_bits/arma_config.hpp"
#include "armadillo_bits/traits.hpp" #include "armadillo_bits/traits.hpp"
#include "armadillo_bits/promote_type.hpp" #include "armadillo_bits/promote_type.hpp"
#include "armadillo_bits/upgrade_val.hpp" #include "armadillo_bits/upgrade_val.hpp"
#include "armadillo_bits/restrictors.hpp" #include "armadillo_bits/restrictors.hpp"
#include "armadillo_bits/access.hpp" #include "armadillo_bits/access.hpp"
#include "armadillo_bits/memory.hpp"
#include "armadillo_bits/span.hpp" #include "armadillo_bits/span.hpp"
#include "armadillo_bits/constants.hpp" #include "armadillo_bits/constants.hpp"
#include "armadillo_bits/constants_compat.hpp" #include "armadillo_bits/constants_compat.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/blas_bones.hpp" #include "armadillo_bits/blas_bones.hpp"
#include "armadillo_bits/lapack_bones.hpp" #include "armadillo_bits/lapack_bones.hpp"
#include "armadillo_bits/atlas_bones.hpp" #include "armadillo_bits/atlas_bones.hpp"
#include "armadillo_bits/blas_wrapper.hpp" #include "armadillo_bits/blas_wrapper.hpp"
#include "armadillo_bits/lapack_wrapper.hpp" #include "armadillo_bits/lapack_wrapper.hpp"
#include "armadillo_bits/atlas_wrapper.hpp" #include "armadillo_bits/atlas_wrapper.hpp"
#include "armadillo_bits/cond_rel_bones.hpp"
#include "armadillo_bits/arrayops_bones.hpp" #include "armadillo_bits/arrayops_bones.hpp"
#include "armadillo_bits/podarray_bones.hpp" #include "armadillo_bits/podarray_bones.hpp"
#include "armadillo_bits/auxlib_bones.hpp" #include "armadillo_bits/auxlib_bones.hpp"
#include "armadillo_bits/injector_bones.hpp" #include "armadillo_bits/injector_bones.hpp"
#include "armadillo_bits/Mat_bones.hpp" #include "armadillo_bits/Mat_bones.hpp"
#include "armadillo_bits/Col_bones.hpp" #include "armadillo_bits/Col_bones.hpp"
#include "armadillo_bits/Row_bones.hpp" #include "armadillo_bits/Row_bones.hpp"
#include "armadillo_bits/Cube_bones.hpp" #include "armadillo_bits/Cube_bones.hpp"
skipping to change at line 358 skipping to change at line 364
// //
// class meat // class meat
#include "armadillo_bits/gemv.hpp" #include "armadillo_bits/gemv.hpp"
#include "armadillo_bits/gemm.hpp" #include "armadillo_bits/gemm.hpp"
#include "armadillo_bits/gemm_mixed.hpp" #include "armadillo_bits/gemm_mixed.hpp"
#include "armadillo_bits/eop_core_meat.hpp" #include "armadillo_bits/eop_core_meat.hpp"
#include "armadillo_bits/eglue_core_meat.hpp" #include "armadillo_bits/eglue_core_meat.hpp"
#include "armadillo_bits/cond_rel_meat.hpp"
#include "armadillo_bits/arrayops_meat.hpp" #include "armadillo_bits/arrayops_meat.hpp"
#include "armadillo_bits/podarray_meat.hpp" #include "armadillo_bits/podarray_meat.hpp"
#include "armadillo_bits/auxlib_meat.hpp" #include "armadillo_bits/auxlib_meat.hpp"
#include "armadillo_bits/injector_meat.hpp" #include "armadillo_bits/injector_meat.hpp"
#include "armadillo_bits/Mat_meat.hpp" #include "armadillo_bits/Mat_meat.hpp"
#include "armadillo_bits/Col_meat.hpp" #include "armadillo_bits/Col_meat.hpp"
#include "armadillo_bits/Row_meat.hpp" #include "armadillo_bits/Row_meat.hpp"
#include "armadillo_bits/Cube_meat.hpp" #include "armadillo_bits/Cube_meat.hpp"
 End of changes. 4 change blocks. 
0 lines changed or deleted 7 lines changed or added


 arrayops_meat.hpp   arrayops_meat.hpp 
skipping to change at line 185 skipping to change at line 185
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; 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)
{ {
const in_eT tmp_i = src[i]; const in_eT tmp_i = src[i];
const in_eT tmp_j = src[j]; const in_eT tmp_j = src[j];
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)
? 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)
? out_eT( tmp_j )
: ( cond_rel< is_signed<in_eT>::value >::lt(tmp_j, in_eT(0))
? out_eT(0) : out_eT(tmp_j) );
} }
if(i < n_elem) if(i < n_elem)
{ {
dest[i] = out_eT( src[i] ); const in_eT tmp_i = src[i];
// dest[i] = out_eT( tmp_i );
dest[i] = (is_signed<out_eT>::value)
? 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 i,j;
 End of changes. 2 change blocks. 
3 lines changed or deleted 20 lines changed or added


 auxlib_meat.hpp   auxlib_meat.hpp 
skipping to change at line 894 skipping to change at line 894
} }
} }
out_val = val; out_val = val;
out_sign = T(sign); out_sign = T(sign);
return (info == 0); return (info == 0);
} }
#else #else
{ {
arma_ignore(X);
out_val = eT(0); out_val = eT(0);
out_sign = T(0); out_sign = T(0);
arma_stop("log_det(): use of ATLAS or LAPACK needs to be enabled"); arma_stop("log_det(): use of ATLAS or LAPACK needs to be enabled");
return false; return false;
} }
#endif #endif
} }
skipping to change at line 1133 skipping to change at line 1135
return true; return true;
} }
// rudimentary "better-than-nothing" test for symmetry // rudimentary "better-than-nothing" test for symmetry
//arma_debug_check( (A.at(A.n_rows-1, 0) != A.at(0, A.n_cols-1)), "auxl ib::eig(): given matrix is not symmetric" ); //arma_debug_check( (A.at(A.n_rows-1, 0) != A.at(0, A.n_cols-1)), "auxl ib::eig(): given matrix is not symmetric" );
char jobz = 'N'; char jobz = 'N';
char uplo = 'U'; char uplo = 'U';
blas_int n_rows = A.n_rows; blas_int n_rows = A.n_rows;
blas_int lwork = (std::max)(blas_int(1), 3*n_rows-1); blas_int lwork = (std::max)(blas_int(1), 3*n_rows-1) + 2; // +2 for p aranoia: some versions of Lapack might be trashing memory
eigval.set_size( static_cast<uword>(n_rows) ); eigval.set_size( static_cast<uword>(n_rows) );
podarray<eT> work( static_cast<uword>(lwork) ); podarray<eT> work( static_cast<uword>(lwork) );
blas_int info; blas_int info;
arma_extra_debug_print("lapack::syev()"); arma_extra_debug_print("lapack::syev()");
lapack::syev(&jobz, &uplo, &n_rows, A.memptr(), &n_rows, eigval.memptr( ), work.memptr(), &lwork, &info); lapack::syev(&jobz, &uplo, &n_rows, A.memptr(), &n_rows, eigval.memptr( ), work.memptr(), &lwork, &info);
return (info == 0); return (info == 0);
skipping to change at line 1181 skipping to change at line 1183
{ {
eigval.reset(); eigval.reset();
return true; return true;
} }
char jobz = 'N'; char jobz = 'N';
char uplo = 'U'; char uplo = 'U';
blas_int n_rows = A.n_rows; blas_int n_rows = A.n_rows;
blas_int lda = A.n_rows; blas_int lda = A.n_rows;
blas_int lwork = (std::max)(blas_int(1), 2*n_rows - 1); // TODO: auto blas_int lwork = (std::max)(blas_int(1), 2*n_rows - 1) + 2; // +2 for
matically find best size of lwork paranoia: some versions of Lapack might be trashing memory
// TODO: automatically find best size of lwork
eigval.set_size( static_cast<uword>(n_rows) ); eigval.set_size( static_cast<uword>(n_rows) );
podarray<eT> work( static_cast<uword>(lwork) ); podarray<eT> work( static_cast<uword>(lwork) );
podarray<T> rwork( static_cast<uword>((std::max)(blas_int(1), 3*n_rows - 2)) ); podarray<T> rwork( static_cast<uword>((std::max)(blas_int(1), 3*n_rows - 2)) );
blas_int info; blas_int info;
arma_extra_debug_print("lapack::heev()"); arma_extra_debug_print("lapack::heev()");
lapack::heev(&jobz, &uplo, &n_rows, A.memptr(), &lda, eigval.memptr(), work.memptr(), &lwork, rwork.memptr(), &info); lapack::heev(&jobz, &uplo, &n_rows, A.memptr(), &lda, eigval.memptr(), work.memptr(), &lwork, rwork.memptr(), &info);
return (info == 0); return (info == 0);
} }
#else #else
skipping to change at line 1233 skipping to change at line 1236
return true; return true;
} }
// rudimentary "better-than-nothing" test for symmetry // rudimentary "better-than-nothing" test for symmetry
//arma_debug_check( (A.at(A.n_rows-1, 0) != A.at(0, A.n_cols-1)), "auxl ib::eig(): given matrix is not symmetric" ); //arma_debug_check( (A.at(A.n_rows-1, 0) != A.at(0, A.n_cols-1)), "auxl ib::eig(): given matrix is not symmetric" );
char jobz = 'V'; char jobz = 'V';
char uplo = 'U'; char uplo = 'U';
blas_int n_rows = eigvec.n_rows; blas_int n_rows = eigvec.n_rows;
blas_int lwork = (std::max)(blas_int(1), 3*n_rows-1); blas_int lwork = (std::max)(blas_int(1), 3*n_rows-1) + 2; // +2 for p aranoia: some versions of Lapack might be trashing memory
eigval.set_size( static_cast<uword>(n_rows) ); eigval.set_size( static_cast<uword>(n_rows) );
podarray<eT> work( static_cast<uword>(lwork) ); podarray<eT> work( static_cast<uword>(lwork) );
blas_int info; blas_int info;
arma_extra_debug_print("lapack::syev()"); arma_extra_debug_print("lapack::syev()");
lapack::syev(&jobz, &uplo, &n_rows, eigvec.memptr(), &n_rows, eigval.me mptr(), work.memptr(), &lwork, &info); lapack::syev(&jobz, &uplo, &n_rows, eigvec.memptr(), &n_rows, eigval.me mptr(), work.memptr(), &lwork, &info);
return (info == 0); return (info == 0);
} }
#else #else
{ {
arma_ignore(eigval); arma_ignore(eigval);
arma_ignore(eigvec); arma_ignore(eigvec);
arma_ignore(X);
arma_stop("eig_sym(): use of LAPACK needs to be enabled"); arma_stop("eig_sym(): use of LAPACK needs to be enabled");
return false; return false;
} }
#endif #endif
} }
//! immediate eigenvalues and eigenvectors of a hermitian complex matrix us ing LAPACK //! immediate eigenvalues and eigenvectors of a hermitian complex matrix us ing LAPACK
template<typename T, typename T1> template<typename T, typename T1>
inline inline
skipping to change at line 1284 skipping to change at line 1289
eigval.reset(); eigval.reset();
eigvec.reset(); eigvec.reset();
return true; return true;
} }
char jobz = 'V'; char jobz = 'V';
char uplo = 'U'; char uplo = 'U';
blas_int n_rows = eigvec.n_rows; blas_int n_rows = eigvec.n_rows;
blas_int lda = eigvec.n_rows; blas_int lda = eigvec.n_rows;
blas_int lwork = (std::max)(blas_int(1), 2*n_rows - 1); // TODO: auto blas_int lwork = (std::max)(blas_int(1), 2*n_rows - 1) + 2; // +2 for
matically find best size of lwork paranoia: some versions of Lapack might be trashing memory
// TODO: automatically find best size of lwork
eigval.set_size( static_cast<uword>(n_rows) ); eigval.set_size( static_cast<uword>(n_rows) );
podarray<eT> work( static_cast<uword>(lwork) ); podarray<eT> work( static_cast<uword>(lwork) );
podarray<T> rwork( static_cast<uword>((std::max)(blas_int(1), 3*n_rows - 2)) ); podarray<T> rwork( static_cast<uword>((std::max)(blas_int(1), 3*n_rows - 2)) );
blas_int info; blas_int info;
arma_extra_debug_print("lapack::heev()"); arma_extra_debug_print("lapack::heev()");
lapack::heev(&jobz, &uplo, &n_rows, eigvec.memptr(), &lda, eigval.mempt r(), work.memptr(), &lwork, rwork.memptr(), &info); lapack::heev(&jobz, &uplo, &n_rows, eigvec.memptr(), &lda, eigval.mempt r(), work.memptr(), &lwork, rwork.memptr(), &info);
skipping to change at line 1373 skipping to change at line 1379
eigval.reset(); eigval.reset();
l_eigvec.reset(); l_eigvec.reset();
r_eigvec.reset(); r_eigvec.reset();
return true; return true;
} }
uword A_n_rows = A.n_rows; uword A_n_rows = A.n_rows;
blas_int n_rows = A_n_rows; blas_int n_rows = A_n_rows;
blas_int lda = A_n_rows; blas_int lda = A_n_rows;
blas_int lwork = (std::max)(blas_int(1), 4*n_rows); // TODO: automati blas_int lwork = (std::max)(blas_int(1), 4*n_rows) + 2; // +2 for par
cally find best size of lwork anoia: some versions of Lapack might be trashing memory
// TODO: automatically find best size of lwork
eigval.set_size(A_n_rows); eigval.set_size(A_n_rows);
l_eigvec.set_size(A_n_rows, A_n_rows); l_eigvec.set_size(A_n_rows, A_n_rows);
r_eigvec.set_size(A_n_rows, A_n_rows); r_eigvec.set_size(A_n_rows, A_n_rows);
podarray<T> work( static_cast<uword>(lwork) ); podarray<T> work( static_cast<uword>(lwork) );
podarray<T> rwork( static_cast<uword>((std::max)(blas_int(1), 3*n_rows) ) ); podarray<T> rwork( static_cast<uword>((std::max)(blas_int(1), 3*n_rows) ) );
podarray<T> wr(A_n_rows); podarray<T> wr(A_n_rows);
podarray<T> wi(A_n_rows); podarray<T> wi(A_n_rows);
Mat<T> A_copy = A; Mat<T> A_copy = A;
blas_int info; blas_int info;
arma_extra_debug_print("lapack::geev()"); arma_extra_debug_print("lapack::geev()");
lapack::geev(&jobvl, &jobvr, &n_rows, A_copy.memptr(), &lda, wr.memptr( ), wi.memptr(), l_eigvec.memptr(), &n_rows, r_eigvec.memptr(), &n_rows, wor k.memptr(), &lwork, &info); lapack::geev(&jobvl, &jobvr, &n_rows, A_copy.memptr(), &lda, wr.memptr( ), wi.memptr(), l_eigvec.memptr(), &n_rows, r_eigvec.memptr(), &n_rows, wor k.memptr(), &lwork, &info);
skipping to change at line 1478 skipping to change at line 1485
eigval.reset(); eigval.reset();
l_eigvec.reset(); l_eigvec.reset();
r_eigvec.reset(); r_eigvec.reset();
return true; return true;
} }
uword A_n_rows = A.n_rows; uword A_n_rows = A.n_rows;
blas_int n_rows = A_n_rows; blas_int n_rows = A_n_rows;
blas_int lda = A_n_rows; blas_int lda = A_n_rows;
blas_int lwork = (std::max)(blas_int(1), 4*n_rows); // TODO: automati blas_int lwork = (std::max)(blas_int(1), 4*n_rows) + 2; // +2 for par
cally find best size of lwork anoia: some versions of Lapack might be trashing memory
// TODO: automatically find best size of lwork
eigval.set_size(A_n_rows); eigval.set_size(A_n_rows);
l_eigvec.set_size(A_n_rows, A_n_rows); l_eigvec.set_size(A_n_rows, A_n_rows);
r_eigvec.set_size(A_n_rows, A_n_rows); r_eigvec.set_size(A_n_rows, A_n_rows);
podarray<eT> work( static_cast<uword>(lwork) ); podarray<eT> work( static_cast<uword>(lwork) );
podarray<T> rwork( static_cast<uword>((std::max)(blas_int(1), 3*n_rows )) ); // was 2,3 podarray<T> rwork( static_cast<uword>((std::max)(blas_int(1), 3*n_rows )) ); // was 2,3
blas_int info; blas_int info;
skipping to change at line 1548 skipping to change at line 1556
{ {
colptr[row] = eT(0); colptr[row] = eT(0);
} }
} }
return (info == 0); return (info == 0);
} }
#else #else
{ {
arma_ignore(out); arma_ignore(out);
arma_ignore(X);
arma_stop("chol(): use of LAPACK needs to be enabled"); arma_stop("chol(): use of LAPACK needs to be enabled");
return false; return false;
} }
#endif #endif
} }
template<typename eT, typename T1> template<typename eT, typename T1>
inline inline
bool bool
auxlib::qr(Mat<eT>& Q, Mat<eT>& R, const Base<eT,T1>& X) auxlib::qr(Mat<eT>& Q, Mat<eT>& R, const Base<eT,T1>& X)
skipping to change at line 2360 skipping to change at line 2370
gemm_emul<false,false,false,false>::apply(out, A_inv, B); gemm_emul<false,false,false,false>::apply(out, A_inv, B);
return true; return true;
} }
} }
if( (A_n_rows > 4) || (status == false) ) if( (A_n_rows > 4) || (status == false) )
{ {
#if defined(ARMA_USE_ATLAS) #if defined(ARMA_USE_ATLAS)
{ {
podarray<int> ipiv(A_n_rows);
out = B; out = B;
podarray<int> ipiv(A_n_rows + 2); // +2 for paranoia: old versions
of Atlas might be trashing memory
int info = atlas::clapack_gesv<eT>(atlas::CblasColMajor, A_n_rows, B.n_cols, A.memptr(), A_n_rows, ipiv.memptr(), out.memptr(), A_n_rows); int info = atlas::clapack_gesv<eT>(atlas::CblasColMajor, A_n_rows, B.n_cols, A.memptr(), A_n_rows, ipiv.memptr(), out.memptr(), A_n_rows);
return (info == 0); return (info == 0);
} }
#elif defined(ARMA_USE_LAPACK) #elif defined(ARMA_USE_LAPACK)
{ {
blas_int n = A_n_rows; blas_int n = A_n_rows; // assuming A is square
blas_int lda = A_n_rows; blas_int lda = A_n_rows;
blas_int ldb = A_n_rows; blas_int ldb = A_n_rows;
blas_int nrhs = B.n_cols; blas_int nrhs = B.n_cols;
blas_int info; blas_int info;
podarray<blas_int> ipiv(A_n_rows);
out = B; out = B;
podarray<blas_int> ipiv(A_n_rows + 2); // +2 for paranoia: some ve
rsions of Lapack might be trashing memory
lapack::gesv<eT>(&n, &nrhs, A.memptr(), &lda, ipiv.memptr(), out.me mptr(), &ldb, &info); lapack::gesv<eT>(&n, &nrhs, A.memptr(), &lda, ipiv.memptr(), out.me mptr(), &ldb, &info);
return (info == 0); return (info == 0);
} }
#else #else
{ {
arma_stop("solve(): use of ATLAS or LAPACK needs to be enabled"); arma_stop("solve(): use of ATLAS or LAPACK needs to be enabled");
return false; return false;
} }
#endif #endif
skipping to change at line 2420 skipping to change at line 2430
return true; return true;
} }
char trans = 'N'; char trans = 'N';
blas_int m = A.n_rows; blas_int m = A.n_rows;
blas_int n = A.n_cols; blas_int n = A.n_cols;
blas_int lda = A.n_rows; blas_int lda = A.n_rows;
blas_int ldb = A.n_rows; blas_int ldb = A.n_rows;
blas_int nrhs = B.n_cols; blas_int nrhs = B.n_cols;
blas_int lwork = n + (std::max)(n, nrhs); blas_int lwork = n + (std::max)(n, nrhs) + 2; // +2 for paranoia: som e versions of Lapack might be trashing memory
blas_int info; blas_int info;
Mat<eT> tmp = B; Mat<eT> tmp = B;
podarray<eT> work( static_cast<uword>(lwork) ); podarray<eT> work( static_cast<uword>(lwork) );
arma_extra_debug_print("lapack::gels()"); arma_extra_debug_print("lapack::gels()");
// NOTE: the dgels() function in the lapack library supplied by ATLAS 3 .6 seems to have problems // NOTE: the dgels() function in the lapack library supplied by ATLAS 3 .6 seems to have problems
skipping to change at line 2486 skipping to change at line 2496
return true; return true;
} }
char trans = 'N'; char trans = 'N';
blas_int m = A.n_rows; blas_int m = A.n_rows;
blas_int n = A.n_cols; blas_int n = A.n_cols;
blas_int lda = A.n_rows; blas_int lda = A.n_rows;
blas_int ldb = A.n_cols; blas_int ldb = A.n_cols;
blas_int nrhs = B.n_cols; blas_int nrhs = B.n_cols;
blas_int lwork = m + (std::max)(m,nrhs); blas_int lwork = m + (std::max)(m,nrhs) + 2; // +2 for paranoia: some versions of Lapack might be trashing memory
blas_int info; blas_int info;
Mat<eT> tmp; Mat<eT> tmp;
tmp.zeros(A.n_cols, B.n_cols); tmp.zeros(A.n_cols, B.n_cols);
for(uword col=0; col<B.n_cols; ++col) for(uword col=0; col<B.n_cols; ++col)
{ {
eT* tmp_colmem = tmp.colptr(col); eT* tmp_colmem = tmp.colptr(col);
arrayops::copy( tmp_colmem, B.colptr(col), B.n_rows ); arrayops::copy( tmp_colmem, B.colptr(col), B.n_rows );
skipping to change at line 2634 skipping to change at line 2644
podarray<eT> wi(A_n_rows); // output for eigenvalues podarray<eT> wi(A_n_rows); // output for eigenvalues
lapack::gees(&jobvs, &sort, select, &n, T.memptr(), &n, &sdim, wr.mempt r(), wi.memptr(), Z.memptr(), &n, work.memptr(), &lwork, bwork.memptr(), &i nfo); lapack::gees(&jobvs, &sort, select, &n, T.memptr(), &n, &sdim, wr.mempt r(), wi.memptr(), Z.memptr(), &n, work.memptr(), &lwork, bwork.memptr(), &i nfo);
return (info == 0); return (info == 0);
} }
#else #else
{ {
arma_ignore(Z); arma_ignore(Z);
arma_ignore(T); arma_ignore(T);
arma_ignore(A);
arma_stop("schur_dec(): use of LAPACK needs to be enabled"); arma_stop("schur_dec(): use of LAPACK needs to be enabled");
return false; return false;
} }
#endif #endif
} }
template<typename cT> template<typename cT>
inline inline
bool bool
auxlib::schur_dec(Mat<std::complex<cT> >& Z, Mat<std::complex<cT> >& T, con st Mat<std::complex<cT> >& A) auxlib::schur_dec(Mat<std::complex<cT> >& Z, Mat<std::complex<cT> >& T, con st Mat<std::complex<cT> >& A)
skipping to change at line 2689 skipping to change at line 2701
podarray<cT> rwork(A_n_rows); podarray<cT> rwork(A_n_rows);
lapack::cx_gees(&jobvs, &sort, select, &n, T.memptr(), &n, &sdim, w.mem ptr(), Z.memptr(), &n, work.memptr(), &lwork, rwork.memptr(), bwork.memptr( ), &info); lapack::cx_gees(&jobvs, &sort, select, &n, T.memptr(), &n, &sdim, w.mem ptr(), Z.memptr(), &n, work.memptr(), &lwork, rwork.memptr(), bwork.memptr( ), &info);
return (info == 0); return (info == 0);
} }
#else #else
{ {
arma_ignore(Z); arma_ignore(Z);
arma_ignore(T); arma_ignore(T);
arma_ignore(A);
arma_stop("schur_dec(): use of LAPACK needs to be enabled"); arma_stop("schur_dec(): use of LAPACK needs to be enabled");
return false; return false;
} }
#endif #endif
} }
// //
// syl (solution of the Sylvester equation AX + XB = C) // syl (solution of the Sylvester equation AX + XB = C)
template<typename eT> template<typename eT>
 End of changes. 20 change blocks. 
19 lines changed or deleted 35 lines changed or added


 compiler_setup.hpp   compiler_setup.hpp 
skipping to change at line 98 skipping to change at line 98
#if defined(__GXX_EXPERIMENTAL_CXX0X__) #if defined(__GXX_EXPERIMENTAL_CXX0X__)
#undef ARMA_HAVE_STD_TR1 #undef ARMA_HAVE_STD_TR1
#if !defined(ARMA_USE_CXX11) #if !defined(ARMA_USE_CXX11)
#define ARMA_USE_CXX11 #define ARMA_USE_CXX11
#endif #endif
#endif #endif
#if defined(__clang__) #if defined(__clang__)
#undef ARMA_HAVE_STD_TR1 #undef ARMA_HAVE_STD_TR1
#undef ARMA_GOOD_COMPILER //#undef ARMA_GOOD_COMPILER
#endif #endif
#if (ARMA_GCC_VERSION >= 40300) #if (ARMA_GCC_VERSION >= 40300)
#undef arma_hot #undef arma_hot
#undef arma_cold #undef arma_cold
#define arma_hot __attribute__((hot)) #define arma_hot __attribute__((hot))
#define arma_cold __attribute__((cold)) #define arma_cold __attribute__((cold))
#endif #endif
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 config.hpp   config.hpp 
skipping to change at line 60 skipping to change at line 60
#define ARMA_MAT_PREALLOC 16 #define ARMA_MAT_PREALLOC 16
#endif #endif
//// This is the number of preallocated elements used by matrices and vecto rs; //// This is the number of preallocated elements used by matrices and vecto rs;
//// it must be an integer that is at least 1. //// it must be an integer that is at least 1.
//// If you mainly use lots of very small vectors (eg. <= 4 elements), //// If you mainly use lots of very small vectors (eg. <= 4 elements),
//// change the number to the size of your vectors. //// change the number to the size of your vectors.
// #define ARMA_USE_TBB_ALLOC // #define ARMA_USE_TBB_ALLOC
//// Uncomment the above line if you want to use Intel TBB scalable_malloc( ) and scalable_free() instead of standard new[] and delete[] //// Uncomment the above line if you want to use Intel TBB scalable_malloc( ) and scalable_free() instead of standard new[] and delete[]
// #define ARMA_USE_MKL_ALLOC
//// Uncomment the above line if you want to use Intel MKL mkl_malloc() and
mkl_free() instead of standard new[] and delete[]
#define ARMA_USE_ATLAS #define ARMA_USE_ATLAS
#define ARMA_ATLAS_INCLUDE_DIR /usr/include/ #define ARMA_ATLAS_INCLUDE_DIR /usr/include/
//// If you're using ATLAS and the compiler can't find cblas.h and/or clapa ck.h //// If you're using ATLAS and the compiler can't find cblas.h and/or clapa ck.h
//// uncomment the above define and specify the appropriate include directo ry. //// uncomment the above define and specify the appropriate include directo ry.
//// Make sure the directory has a trailing / //// Make sure the directory has a trailing /
#define ARMA_USE_BOOST #define ARMA_USE_BOOST
#define ARMA_USE_BOOST_DATE #define ARMA_USE_BOOST_DATE
#define ARMA_USE_WRAPPER #define ARMA_USE_WRAPPER
 End of changes. 1 change blocks. 
0 lines changed or deleted 4 lines changed or added


 diskio_meat.hpp   diskio_meat.hpp 
skipping to change at line 1225 skipping to change at line 1225
f.close(); f.close();
} }
return load_okay; return load_okay;
} }
//! Load a matrix in CSV text format (human readable) //! Load a matrix in CSV text format (human readable)
template<typename eT> template<typename eT>
inline inline
bool bool
diskio::load_csv_ascii(Mat<eT>& x, std::istream& f, std::string& err_msg) diskio::load_csv_ascii(Mat<eT>& x, std::istream& f, std::string&)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
bool load_okay = f.good(); bool load_okay = f.good();
f.clear(); f.clear();
const std::fstream::pos_type pos1 = f.tellg(); const std::fstream::pos_type pos1 = f.tellg();
// //
// work out the size // work out the size
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 eGlue_bones.hpp   eGlue_bones.hpp 
// Copyright (C) 2010-2011 NICTA (www.nicta.com.au) // Copyright (C) 2010-2012 NICTA (www.nicta.com.au)
// Copyright (C) 2010-2011 Conrad Sanderson // Copyright (C) 2010-2012 Conrad Sanderson
// //
// This file is part of the Armadillo C++ library. // This file is part of the Armadillo C++ library.
// It is provided without any warranty of fitness // It is provided without any warranty of fitness
// for any purpose. You can redistribute this file // for any purpose. You can redistribute this file
// and/or modify it under the terms of the GNU // and/or modify it under the terms of the GNU
// Lesser General Public License (LGPL) as published // Lesser General Public License (LGPL) as published
// by the Free Software Foundation, either version 3 // by the Free Software Foundation, either version 3
// of the License or (at your option) any later version. // of the License or (at your option) any later version.
// (see http://www.opensource.org/licenses for more info) // (see http://www.opensource.org/licenses for more info)
 End of changes. 1 change blocks. 
2 lines changed or deleted 2 lines changed or added


 eGlue_meat.hpp   eGlue_meat.hpp 
// Copyright (C) 2010-2011 NICTA (www.nicta.com.au) // Copyright (C) 2010-2012 NICTA (www.nicta.com.au)
// Copyright (C) 2010-2011 Conrad Sanderson // Copyright (C) 2010-2012 Conrad Sanderson
// //
// This file is part of the Armadillo C++ library. // This file is part of the Armadillo C++ library.
// It is provided without any warranty of fitness // It is provided without any warranty of fitness
// for any purpose. You can redistribute this file // for any purpose. You can redistribute this file
// and/or modify it under the terms of the GNU // and/or modify it under the terms of the GNU
// Lesser General Public License (LGPL) as published // Lesser General Public License (LGPL) as published
// by the Free Software Foundation, either version 3 // by the Free Software Foundation, either version 3
// of the License or (at your option) any later version. // of the License or (at your option) any later version.
// (see http://www.opensource.org/licenses for more info) // (see http://www.opensource.org/licenses for more info)
 End of changes. 1 change blocks. 
2 lines changed or deleted 2 lines changed or added


 eOp_bones.hpp   eOp_bones.hpp 
// Copyright (C) 2010-2011 NICTA (www.nicta.com.au) // Copyright (C) 2010-2012 NICTA (www.nicta.com.au)
// Copyright (C) 2010-2011 Conrad Sanderson // Copyright (C) 2010-2012 Conrad Sanderson
// //
// This file is part of the Armadillo C++ library. // This file is part of the Armadillo C++ library.
// It is provided without any warranty of fitness // It is provided without any warranty of fitness
// for any purpose. You can redistribute this file // for any purpose. You can redistribute this file
// and/or modify it under the terms of the GNU // and/or modify it under the terms of the GNU
// Lesser General Public License (LGPL) as published // Lesser General Public License (LGPL) as published
// by the Free Software Foundation, either version 3 // by the Free Software Foundation, either version 3
// of the License or (at your option) any later version. // of the License or (at your option) any later version.
// (see http://www.opensource.org/licenses for more info) // (see http://www.opensource.org/licenses for more info)
skipping to change at line 32 skipping to change at line 32
typedef typename get_pod_type<elem_type>::result pod_type; typedef typename get_pod_type<elem_type>::result pod_type;
typedef Proxy<T1> proxy_type; typedef Proxy<T1> proxy_type;
static const bool prefer_at_accessor = Proxy<T1>::prefer_at_accessor; static const bool prefer_at_accessor = Proxy<T1>::prefer_at_accessor;
static const bool has_subview = Proxy<T1>::has_subview; static const bool has_subview = Proxy<T1>::has_subview;
static const bool is_row = Proxy<T1>::is_row; static const bool is_row = Proxy<T1>::is_row;
static const bool is_col = Proxy<T1>::is_col; static const bool is_col = Proxy<T1>::is_col;
arma_aligned const Proxy<T1> P; arma_aligned const Proxy<T1> P;
arma_aligned elem_type aux; //!< storage of auxiliary data , user defined format arma_aligned elem_type aux; //!< storage of auxiliary data , user defined format
arma_aligned uword aux_uword_a; //!< storage of auxiliary data , uword format arma_aligned uword aux_uword_a; //!< storage of auxiliary data , uword format
arma_aligned uword aux_uword_b; //!< storage of auxiliary data , uword format arma_aligned uword aux_uword_b; //!< storage of auxiliary data , uword format
inline ~eOp(); inline ~eOp();
inline explicit eOp(const T1& in_m); inline explicit eOp(const T1& in_m);
inline eOp(const T1& in_m, const elem_type in_aux); inline eOp(const T1& in_m, const elem_type in_aux);
inline eOp(const T1& in_m, const uword in_aux_uword_a, const uwo rd in_aux_uword_b); inline eOp(const T1& in_m, const uword in_aux_uword_a, const uwo rd in_aux_uword_b);
inline eOp(const T1& in_m, const elem_type in_aux, const uword i n_aux_uword_a, const uword in_aux_uword_b); inline eOp(const T1& in_m, const elem_type in_aux, const uword i n_aux_uword_a, const uword in_aux_uword_b);
 End of changes. 2 change blocks. 
2 lines changed or deleted 3 lines changed or added


 field_meat.hpp   field_meat.hpp 
skipping to change at line 1279 skipping to change at line 1279
} }
} }
// //
// //
// //
template<typename oT> template<typename oT>
inline inline
bool bool
field_aux::save(const field<oT>& x, const std::string& name, const file_typ e type, std::string& err_msg) field_aux::save(const field<oT>&, const std::string&, const file_type, std: :string& err_msg)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
err_msg = " [sorry, saving/loading this type of field is currently not su pported] filename = "; err_msg = " [sorry, saving/loading this type of field is currently not su pported] filename = ";
return false; return false;
} }
template<typename oT> template<typename oT>
inline inline
bool bool
field_aux::save(const field<oT>& x, std::ostream& os, const file_type type, std::string& err_msg) field_aux::save(const field<oT>&, std::ostream&, const file_type, std::stri ng& err_msg)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
err_msg = " [sorry, saving/loading this type of field is currently not su pported] filename = "; err_msg = " [sorry, saving/loading this type of field is currently not su pported] filename = ";
return false; return false;
} }
template<typename oT> template<typename oT>
inline inline
bool bool
field_aux::load(field<oT>& x, const std::string& name, const file_type type , std::string& err_msg) field_aux::load(field<oT>&, const std::string&, const file_type, std::strin g& err_msg)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
err_msg = " [sorry, saving/loading this type of field is currently not su pported] filename = "; err_msg = " [sorry, saving/loading this type of field is currently not su pported] filename = ";
return false; return false;
} }
template<typename oT> template<typename oT>
inline inline
bool bool
field_aux::load(field<oT>& x, std::istream& is, const file_type type, std:: string& err_msg) field_aux::load(field<oT>&, std::istream&, const file_type, std::string& er r_msg)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
err_msg = " [sorry, saving/loading this type of field is currently not su pported] filename = "; err_msg = " [sorry, saving/loading this type of field is currently not su pported] filename = ";
return false; return false;
} }
template<typename eT> template<typename eT>
inline inline
 End of changes. 4 change blocks. 
4 lines changed or deleted 4 lines changed or added


 fn_accu.hpp   fn_accu.hpp 
skipping to change at line 46 skipping to change at line 46
} }
if(i < n_elem) if(i < n_elem)
{ {
val1 += A[i]; val1 += A[i];
} }
return (val1 + val2); return (val1 + val2);
} }
#if defined(ARMA_GOOD_COMPILER) template<typename T1>
template<typename T1> arma_hot
arma_hot inline
inline typename T1::elem_type
typename T1::elem_type accu_proxy_at(const Proxy<T1>& P)
accu_proxy_at(const Proxy<T1>& P) {
{ typedef typename T1::elem_type eT;
typedef typename T1::elem_type eT;
const uword n_rows = P.get_n_rows();
const uword n_cols = P.get_n_cols();
if(n_rows != 1) const uword n_rows = P.get_n_rows();
{ const uword n_cols = P.get_n_cols();
eT val1 = eT(0);
eT val2 = eT(0);
for(uword col=0; col < n_cols; ++col) eT val = eT(0);
{
uword i,j;
for(i=0, j=1; j < n_rows; i+=2, j+=2)
{
val1 += P.at(i,col);
val2 += P.at(j,col);
}
if(i < n_rows)
{
val1 += P.at(i,col);
}
}
return (val1 + val2); if(n_rows != 1)
} {
else for(uword col=0; col < n_cols; ++col)
for(uword row=0; row < n_rows; ++row)
{ {
eT val1 = eT(0); val += P.at(row,col);
eT val2 = eT(0);
uword i,j;
for(i=0, j=1; j < n_cols; i+=2, j+=2)
{
val1 += P.at(0,i);
val2 += P.at(0,j);
}
if(i < n_cols)
{
val1 += P.at(0,i);
}
return (val1 + val2);
} }
} }
#else else
template<typename T1>
arma_hot
inline
typename T1::elem_type
accu_proxy_at(const Proxy<T1>& P)
{ {
typedef typename T1::elem_type eT; for(uword col=0; col < n_cols; ++col)
const uword n_rows = P.get_n_rows();
const uword n_cols = P.get_n_cols();
eT val = eT(0);
if(n_rows != 1)
{ {
for(uword col=0; col < n_cols; ++col) val += P.at(0,col);
for(uword row=0; row < n_rows; ++row)
{
val += P.at(row,col);
}
} }
else
{
for(uword col=0; col < n_cols; ++col)
{
val += P.at(0,col);
}
}
return val;
} }
#endif
return val;
}
//! accumulate the elements of a matrix //! accumulate the elements of a matrix
template<typename T1> template<typename T1>
arma_hot arma_hot
inline inline
typename T1::elem_type typename T1::elem_type
accu(const Base<typename T1::elem_type,T1>& X) accu(const Base<typename T1::elem_type,T1>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
 End of changes. 10 change blocks. 
77 lines changed or deleted 21 lines changed or added


 fn_dot.hpp   fn_dot.hpp 
skipping to change at line 43 skipping to change at line 43
arma_warn_unused arma_warn_unused
typename T1::elem_type typename T1::elem_type
norm_dot norm_dot
( (
const Base<typename T1::elem_type,T1>& A, const Base<typename T1::elem_type,T1>& A,
const Base<typename T1::elem_type,T2>& B, const Base<typename T1::elem_type,T2>& B,
const typename arma_blas_type_only<typename T1::elem_type>::result* junk = 0 const typename arma_blas_type_only<typename T1::elem_type>::result* junk = 0
) )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_ignore(junk);
return op_norm_dot::apply(A,B); return op_norm_dot::apply(A,B);
} }
// //
// cdot // cdot
template<typename T1, typename T2> template<typename T1, typename T2>
arma_inline arma_inline
arma_warn_unused arma_warn_unused
 End of changes. 1 change blocks. 
0 lines changed or deleted 1 lines changed or added


 fn_princomp.hpp   fn_princomp.hpp 
skipping to change at line 37 skipping to change at line 37
( (
Mat<typename T1::elem_type>& coeff_out, Mat<typename T1::elem_type>& coeff_out,
Mat<typename T1::elem_type>& score_out, Mat<typename T1::elem_type>& score_out,
Col<typename T1::pod_type>& latent_out, Col<typename T1::pod_type>& latent_out,
Col<typename T1::elem_type>& tsquared_out, Col<typename T1::elem_type>& tsquared_out,
const Base<typename T1::elem_type,T1>& X, const Base<typename T1::elem_type,T1>& X,
const typename arma_blas_type_only<typename T1::elem_type>::result* junk = 0 const typename arma_blas_type_only<typename T1::elem_type>::result* junk = 0
) )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_ignore(junk);
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
const unwrap<T1> tmp(X.get_ref()); const unwrap<T1> tmp(X.get_ref());
const Mat<eT>& A = tmp.M; const Mat<eT>& A = tmp.M;
const bool status = op_princomp::direct_princomp(coeff_out, score_out, la tent_out, tsquared_out, A); const bool status = op_princomp::direct_princomp(coeff_out, score_out, la tent_out, tsquared_out, A);
if(status == false) if(status == false)
{ {
skipping to change at line 76 skipping to change at line 77
princomp princomp
( (
Mat<typename T1::elem_type>& coeff_out, Mat<typename T1::elem_type>& coeff_out,
Mat<typename T1::elem_type>& score_out, Mat<typename T1::elem_type>& score_out,
Col<typename T1::pod_type>& latent_out, Col<typename T1::pod_type>& latent_out,
const Base<typename T1::elem_type,T1>& X, const Base<typename T1::elem_type,T1>& X,
const typename arma_blas_type_only<typename T1::elem_type>::result* junk = 0 const typename arma_blas_type_only<typename T1::elem_type>::result* junk = 0
) )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_ignore(junk);
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
const unwrap<T1> tmp(X.get_ref()); const unwrap<T1> tmp(X.get_ref());
const Mat<eT>& A = tmp.M; const Mat<eT>& A = tmp.M;
const bool status = op_princomp::direct_princomp(coeff_out, score_out, la tent_out, A); const bool status = op_princomp::direct_princomp(coeff_out, score_out, la tent_out, A);
if(status == false) if(status == false)
{ {
skipping to change at line 112 skipping to change at line 114
bool bool
princomp princomp
( (
Mat<typename T1::elem_type>& coeff_out, Mat<typename T1::elem_type>& coeff_out,
Mat<typename T1::elem_type>& score_out, Mat<typename T1::elem_type>& score_out,
const Base<typename T1::elem_type,T1>& X, const Base<typename T1::elem_type,T1>& X,
const typename arma_blas_type_only<typename T1::elem_type>::result* junk = 0 const typename arma_blas_type_only<typename T1::elem_type>::result* junk = 0
) )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_ignore(junk);
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
const unwrap<T1> tmp(X.get_ref()); const unwrap<T1> tmp(X.get_ref());
const Mat<eT>& A = tmp.M; const Mat<eT>& A = tmp.M;
const bool status = op_princomp::direct_princomp(coeff_out, score_out, A) ; const bool status = op_princomp::direct_princomp(coeff_out, score_out, A) ;
if(status == false) if(status == false)
{ {
skipping to change at line 145 skipping to change at line 148
inline inline
bool bool
princomp princomp
( (
Mat<typename T1::elem_type>& coeff_out, Mat<typename T1::elem_type>& coeff_out,
const Base<typename T1::elem_type,T1>& X, const Base<typename T1::elem_type,T1>& X,
const typename arma_blas_type_only<typename T1::elem_type>::result* junk = 0 const typename arma_blas_type_only<typename T1::elem_type>::result* junk = 0
) )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_ignore(junk);
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
const unwrap<T1> tmp(X.get_ref()); const unwrap<T1> tmp(X.get_ref());
const Mat<eT>& A = tmp.M; const Mat<eT>& A = tmp.M;
const bool status = op_princomp::direct_princomp(coeff_out, A); const bool status = op_princomp::direct_princomp(coeff_out, A);
if(status == false) if(status == false)
{ {
skipping to change at line 173 skipping to change at line 177
template<typename T1> template<typename T1>
inline inline
const Op<T1, op_princomp> const Op<T1, op_princomp>
princomp princomp
( (
const Base<typename T1::elem_type,T1>& X, const Base<typename T1::elem_type,T1>& X,
const typename arma_blas_type_only<typename T1::elem_type>::result* junk = 0 const typename arma_blas_type_only<typename T1::elem_type>::result* junk = 0
) )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_ignore(junk);
return Op<T1, op_princomp>(X.get_ref()); return Op<T1, op_princomp>(X.get_ref());
} }
//! @} //! @}
 End of changes. 5 change blocks. 
0 lines changed or deleted 5 lines changed or added


 forward_bones.hpp   forward_bones.hpp 
// Copyright (C) 2008-2010 NICTA (www.nicta.com.au) // Copyright (C) 2008-2012 NICTA (www.nicta.com.au)
// Copyright (C) 2008-2010 Conrad Sanderson // Copyright (C) 2008-2012 Conrad Sanderson
// //
// This file is part of the Armadillo C++ library. // This file is part of the Armadillo C++ library.
// It is provided without any warranty of fitness // It is provided without any warranty of fitness
// for any purpose. You can redistribute this file // for any purpose. You can redistribute this file
// and/or modify it under the terms of the GNU // and/or modify it under the terms of the GNU
// Lesser General Public License (LGPL) as published // Lesser General Public License (LGPL) as published
// by the Free Software Foundation, either version 3 // by the Free Software Foundation, either version 3
// of the License or (at your option) any later version. // of the License or (at your option) any later version.
// (see http://www.opensource.org/licenses for more info) // (see http://www.opensource.org/licenses for more info)
using std::cout; using std::cout;
using std::cerr; using std::cerr;
using std::endl; using std::endl;
using std::ios; using std::ios;
template<typename elem_type, typename derived> struct Base;
template<typename elem_type, typename derived> struct BaseCube;
template<typename eT> class Mat; template<typename eT> class Mat;
template<typename eT> class Col; template<typename eT> class Col;
template<typename eT> class Row; template<typename eT> class Row;
template<typename eT> class Cube; template<typename eT> class Cube;
template<typename oT> class field; template<typename oT> class field;
template<typename eT> class subview; template<typename eT> class subview;
template<typename eT> class subview_col; template<typename eT> class subview_col;
template<typename eT> class subview_row; template<typename eT> class subview_row;
template<typename eT> class subview_cube; template<typename eT> class subview_cube;
 End of changes. 2 change blocks. 
2 lines changed or deleted 5 lines changed or added


 gemv.hpp   gemv.hpp 
skipping to change at line 282 skipping to change at line 282
} }
template<typename eT> template<typename eT>
arma_hot arma_hot
inline inline
static static
void void
apply( eT* y, const Mat<eT>& A, const eT* x, const eT alpha = eT(1), cons t eT beta = eT(0), const typename arma_cx_only<eT>::result* junk = 0 ) apply( eT* y, const Mat<eT>& A, const eT* x, const eT alpha = eT(1), cons t eT beta = eT(0), const typename arma_cx_only<eT>::result* junk = 0 )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_ignore(junk);
Mat<eT> tmp_A; Mat<eT> tmp_A;
if(do_trans_A) if(do_trans_A)
{ {
op_htrans::apply_noalias(tmp_A, A); op_htrans::apply_noalias(tmp_A, A);
} }
const Mat<eT>& AA = (do_trans_A == false) ? A : tmp_A; const Mat<eT>& AA = (do_trans_A == false) ? A : tmp_A;
 End of changes. 1 change blocks. 
0 lines changed or deleted 1 lines changed or added


 glue_solve_bones.hpp   glue_solve_bones.hpp 
// Copyright (C) 2009-2011 NICTA (www.nicta.com.au) // Copyright (C) 2009-2012 NICTA (www.nicta.com.au)
// Copyright (C) 2009-2011 Conrad Sanderson // Copyright (C) 2009-2012 Conrad Sanderson
// //
// This file is part of the Armadillo C++ library. // This file is part of the Armadillo C++ library.
// It is provided without any warranty of fitness // It is provided without any warranty of fitness
// for any purpose. You can redistribute this file // for any purpose. You can redistribute this file
// and/or modify it under the terms of the GNU // and/or modify it under the terms of the GNU
// Lesser General Public License (LGPL) as published // Lesser General Public License (LGPL) as published
// by the Free Software Foundation, either version 3 // by the Free Software Foundation, either version 3
// of the License or (at your option) any later version. // of the License or (at your option) any later version.
// (see http://www.opensource.org/licenses for more info) // (see http://www.opensource.org/licenses for more info)
//! \addtogroup glue_solve //! \addtogroup glue_solve
//! @{ //! @{
class glue_solve class glue_solve
{ {
public: public:
template<typename eT> inline static void solve_direct(Mat<eT>& out, Mat<e
T>& A, const Mat<eT>& B, const bool slow);
template<typename T1, typename T2> inline static void apply(Mat<typename T1::elem_type>& out, const Glue<T1,T2,glue_solve>& X); template<typename T1, typename T2> inline static void apply(Mat<typename T1::elem_type>& out, const Glue<T1,T2,glue_solve>& X);
}; };
class glue_solve_tr class glue_solve_tr
{ {
public: public:
template<typename T1, typename T2> inline static void apply(Mat<typename T1::elem_type>& out, const Glue<T1,T2,glue_solve_tr>& X); template<typename T1, typename T2> inline static void apply(Mat<typename T1::elem_type>& out, const Glue<T1,T2,glue_solve_tr>& X);
}; };
 End of changes. 2 change blocks. 
2 lines changed or deleted 5 lines changed or added


 glue_solve_meat.hpp   glue_solve_meat.hpp 
// Copyright (C) 2009-2011 NICTA (www.nicta.com.au) // Copyright (C) 2009-2012 NICTA (www.nicta.com.au)
// Copyright (C) 2009-2011 Conrad Sanderson // Copyright (C) 2009-2012 Conrad Sanderson
// //
// This file is part of the Armadillo C++ library. // This file is part of the Armadillo C++ library.
// It is provided without any warranty of fitness // It is provided without any warranty of fitness
// for any purpose. You can redistribute this file // for any purpose. You can redistribute this file
// and/or modify it under the terms of the GNU // and/or modify it under the terms of the GNU
// Lesser General Public License (LGPL) as published // Lesser General Public License (LGPL) as published
// by the Free Software Foundation, either version 3 // by the Free Software Foundation, either version 3
// of the License or (at your option) any later version. // of the License or (at your option) any later version.
// (see http://www.opensource.org/licenses for more info) // (see http://www.opensource.org/licenses for more info)
//! \addtogroup glue_solve //! \addtogroup glue_solve
//! @{ //! @{
template<typename T1, typename T2> template<typename eT>
inline inline
void void
glue_solve::apply(Mat<typename T1::elem_type>& out, const Glue<T1,T2,glue_s olve>& X) glue_solve::solve_direct(Mat<eT>& out, Mat<eT>& A, const Mat<eT>& B, const bool slow)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT; const uword A_n_rows = A.n_rows;
const uword A_n_cols = A.n_cols;
Mat<eT> A = X.A.get_ref(); arma_debug_check( (A_n_rows != B.n_rows), "solve(): number of rows in A a
nd B must be the same" );
const unwrap_check<T2> B_tmp(X.B, out);
const Mat<eT>& B = B_tmp.M;
arma_debug_check( (A.n_rows != B.n_rows), "solve(): number of rows in A a nd B must be the same" ); bool status = false;
bool status; if(A_n_rows == A_n_cols)
if(A.n_rows == A.n_cols)
{ {
const uword mode = X.aux_uword; status = auxlib::solve(out, A, B, slow);
status = (mode == 0) ? auxlib::solve(out, A, B) : auxlib::solve(out, A,
B, true);
} }
else else
if(A.n_rows > A.n_cols) if(A_n_rows > A_n_cols)
{ {
arma_extra_debug_print("solve(): detected over-determined system"); arma_extra_debug_print("solve(): detected over-determined system");
status = auxlib::solve_od(out, A, B); status = auxlib::solve_od(out, A, B);
} }
else else
{ {
arma_extra_debug_print("solve(): detected under-determined system"); arma_extra_debug_print("solve(): detected under-determined system");
status = auxlib::solve_ud(out, A, B); status = auxlib::solve_ud(out, A, B);
} }
if(status == false) if(status == false)
{ {
out.reset(); out.reset();
arma_bad("solve(): solution not found"); arma_bad("solve(): solution not found");
} }
} }
template<typename T1, typename T2> template<typename T1, typename T2>
inline inline
void void
glue_solve::apply(Mat<typename T1::elem_type>& out, const Glue<T1,T2,glue_s
olve>& X)
{
arma_extra_debug_sigprint();
typedef typename T1::elem_type eT;
Mat<eT> A = X.A.get_ref();
const unwrap_check<T2> B_tmp(X.B, out);
const Mat<eT>& B = B_tmp.M;
glue_solve::solve_direct( out, A, B, (X.aux_uword == 1) );
}
template<typename T1, typename T2>
inline
void
glue_solve_tr::apply(Mat<typename T1::elem_type>& out, const Glue<T1,T2,glu e_solve_tr>& X) glue_solve_tr::apply(Mat<typename T1::elem_type>& out, const Glue<T1,T2,glu e_solve_tr>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
const unwrap_check<T1> A_tmp(X.A, out); const unwrap_check<T1> A_tmp(X.A, out);
const unwrap_check<T2> B_tmp(X.B, out); const unwrap_check<T2> B_tmp(X.B, out);
const Mat<eT>& A = A_tmp.M; const Mat<eT>& A = A_tmp.M;
 End of changes. 10 change blocks. 
18 lines changed or deleted 30 lines changed or added


 glue_times_bones.hpp   glue_times_bones.hpp 
skipping to change at line 41 skipping to change at line 41
}; };
template<uword N> template<uword N>
struct glue_times_redirect struct glue_times_redirect
{ {
template<typename T1, typename T2> template<typename T1, typename T2>
arma_hot inline static void apply(Mat<typename T1::elem_type>& out, const Glue<T1,T2,glue_times>& X); arma_hot inline static void apply(Mat<typename T1::elem_type>& out, const Glue<T1,T2,glue_times>& X);
}; };
template<> template<>
struct glue_times_redirect<2>
{
template<typename T1, typename T2>
arma_hot inline static void apply(Mat<typename T1::elem_type>& out, const
Glue<T1,T2,glue_times>& X, const typename arma_blas_type_only<typename T1:
:elem_type>::result* junk = 0);
template<typename T1, typename T2>
arma_hot inline static void apply(Mat<typename T1::elem_type>& out, const
Glue<T1,T2,glue_times>& X, const typename arma_not_blas_type<typename T1::
elem_type>::result* junk = 0);
};
template<>
struct glue_times_redirect<3> struct glue_times_redirect<3>
{ {
template<typename T1, typename T2, typename T3> template<typename T1, typename T2, typename T3>
arma_hot inline static void apply(Mat<typename T1::elem_type>& out, const Glue< Glue<T1,T2,glue_times>,T3,glue_times>& X); arma_hot inline static void apply(Mat<typename T1::elem_type>& out, const Glue< Glue<T1,T2,glue_times>,T3,glue_times>& X);
}; };
template<> template<>
struct glue_times_redirect<4> struct glue_times_redirect<4>
{ {
template<typename T1, typename T2, typename T3, typename T4> template<typename T1, typename T2, typename T3, typename T4>
 End of changes. 1 change blocks. 
0 lines changed or deleted 14 lines changed or added


 glue_times_meat.hpp   glue_times_meat.hpp 
skipping to change at line 46 skipping to change at line 46
glue_times::apply glue_times::apply
< <
eT, eT,
partial_unwrap_check<T1>::do_trans, partial_unwrap_check<T1>::do_trans,
partial_unwrap_check<T2>::do_trans, partial_unwrap_check<T2>::do_trans,
(partial_unwrap_check<T1>::do_times || partial_unwrap_check<T2>::do_tim es) (partial_unwrap_check<T1>::do_times || partial_unwrap_check<T2>::do_tim es)
> >
(out, A, B, alpha); (out, A, B, alpha);
} }
template<typename T1, typename T2>
arma_hot
inline
void
glue_times_redirect<2>::apply(Mat<typename T1::elem_type>& out, const Glue<
T1,T2,glue_times>& X, const typename arma_blas_type_only<typename T1::elem_
type>::result* junk)
{
arma_extra_debug_sigprint();
arma_ignore(junk);
typedef typename T1::elem_type eT;
if(strip_inv<T1>::do_inv == false)
{
const partial_unwrap_check<T1> tmp1(X.A, out);
const partial_unwrap_check<T2> tmp2(X.B, out);
const Mat<eT>& A = tmp1.M;
const Mat<eT>& B = tmp2.M;
const bool use_alpha = partial_unwrap_check<T1>::do_times || partial_un
wrap_check<T2>::do_times;
const eT alpha = use_alpha ? (tmp1.get_val() * tmp2.get_val()) :
eT(0);
glue_times::apply
<
eT,
partial_unwrap_check<T1>::do_trans,
partial_unwrap_check<T2>::do_trans,
(partial_unwrap_check<T1>::do_times || partial_unwrap_check<T2>::do_t
imes)
>
(out, A, B, alpha);
}
else
{
arma_extra_debug_print("glue_times_redirect<2>::apply(): detected inv(A
)*B");
typedef typename strip_inv<T1>::stored_type T1_stripped;
const strip_inv<T1> A_strip(X.A);
Mat<eT> A = A_strip.M;
arma_debug_check( (A.is_square() == false), "inv(): given matrix is not
square" );
const unwrap_check<T2> B_tmp(X.B, out);
const Mat<eT>& B = B_tmp.M;
glue_solve::solve_direct( out, A, B, A_strip.slow );
}
}
template<typename T1, typename T2>
arma_hot
inline
void
glue_times_redirect<2>::apply(Mat<typename T1::elem_type>& out, const Glue<
T1,T2,glue_times>& X, const typename arma_not_blas_type<typename T1::elem_t
ype>::result* junk)
{
arma_extra_debug_sigprint();
arma_ignore(junk);
typedef typename T1::elem_type eT;
const partial_unwrap_check<T1> tmp1(X.A, out);
const partial_unwrap_check<T2> tmp2(X.B, out);
const Mat<eT>& A = tmp1.M;
const Mat<eT>& B = tmp2.M;
const bool use_alpha = partial_unwrap_check<T1>::do_times || partial_unwr
ap_check<T2>::do_times;
const eT alpha = use_alpha ? (tmp1.get_val() * tmp2.get_val()) : eT
(0);
glue_times::apply
<
eT,
partial_unwrap_check<T1>::do_trans,
partial_unwrap_check<T2>::do_trans,
(partial_unwrap_check<T1>::do_times || partial_unwrap_check<T2>::do_tim
es)
>
(out, A, B, alpha);
}
template<typename T1, typename T2, typename T3> template<typename T1, typename T2, typename T3>
arma_hot arma_hot
inline inline
void void
glue_times_redirect<3>::apply(Mat<typename T1::elem_type>& out, const Glue< Glue<T1,T2,glue_times>, T3, glue_times>& X) glue_times_redirect<3>::apply(Mat<typename T1::elem_type>& out, const Glue< Glue<T1,T2,glue_times>, T3, glue_times>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
 End of changes. 1 change blocks. 
0 lines changed or deleted 92 lines changed or added


 op_median_bones.hpp   op_median_bones.hpp 
skipping to change at line 46 skipping to change at line 46
template<typename T1> template<typename T1>
inline static void apply(Mat<typename T1::elem_type>& out, const Op<T1,op _median>& in); inline static void apply(Mat<typename T1::elem_type>& out, const Op<T1,op _median>& in);
template<typename T, typename T1> template<typename T, typename T1>
inline static void apply(Mat< std::complex<T> >& out, const Op<T1,op_medi an>& in); inline static void apply(Mat< std::complex<T> >& out, const Op<T1,op_medi an>& in);
// //
// //
template<typename T1> template<typename T1>
inline static typename T1::elem_type median_vec(const Base<typename T1::e lem_type, T1>& X, const typename arma_not_cx<typename T1::elem_type>::resul t* junk = 0); inline static typename T1::elem_type median_vec(const T1& X, const typena me arma_not_cx<typename T1::elem_type>::result* junk = 0);
template<typename T1> template<typename T1>
inline static typename T1::elem_type median_vec(const Base<typename T1::e lem_type, T1>& X, const typename arma_cx_only<typename T1::elem_type>::resu lt* junk = 0); inline static typename T1::elem_type median_vec(const T1& X, const typena me arma_cx_only<typename T1::elem_type>::result* junk = 0);
// //
// //
template<typename eT> template<typename eT>
inline static eT direct_median(std::vector<eT>& X); inline static eT direct_median(std::vector<eT>& X);
template<typename T> template<typename T>
inline static void direct_cx_median_index(uword& out_index1, uword& out_i ndex2, std::vector< arma_cx_median_packet<T> >& X); inline static void direct_cx_median_index(uword& out_index1, uword& out_i ndex2, std::vector< arma_cx_median_packet<T> >& X);
}; };
 End of changes. 2 change blocks. 
2 lines changed or deleted 2 lines changed or added


 op_median_meat.hpp   op_median_meat.hpp 
skipping to change at line 164 skipping to change at line 164
out[row] = op_mean::robust_mean( X.at(row,index1), X.at(row,index2) ) ; out[row] = op_mean::robust_mean( X.at(row,index1), X.at(row,index2) ) ;
} }
} }
} }
template<typename T1> template<typename T1>
inline inline
typename T1::elem_type typename T1::elem_type
op_median::median_vec op_median::median_vec
( (
const Base<typename T1::elem_type, T1>& X, const T1& X,
const typename arma_not_cx<typename T1::elem_type>::result* junk const typename arma_not_cx<typename T1::elem_type>::result* junk
) )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_ignore(junk); arma_ignore(junk);
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
const Proxy<T1> P(X.get_ref()); const Proxy<T1> P(X);
const uword n_elem = P.get_n_elem(); const uword n_elem = P.get_n_elem();
arma_debug_check( (n_elem == 0), "median(): given object has no elements" ); arma_debug_check( (n_elem == 0), "median(): given object has no elements" );
std::vector<eT> tmp_vec(n_elem); std::vector<eT> tmp_vec(n_elem);
if(Proxy<T1>::prefer_at_accessor == false) if(Proxy<T1>::prefer_at_accessor == false)
{ {
typedef typename Proxy<T1>::ea_type ea_type; typedef typename Proxy<T1>::ea_type ea_type;
skipping to change at line 226 skipping to change at line 226
} }
return op_median::direct_median(tmp_vec); return op_median::direct_median(tmp_vec);
} }
template<typename T1> template<typename T1>
inline inline
typename T1::elem_type typename T1::elem_type
op_median::median_vec op_median::median_vec
( (
const Base<typename T1::elem_type, T1>& X, const T1& X,
const typename arma_cx_only<typename T1::elem_type>::result* junk const typename arma_cx_only<typename T1::elem_type>::result* junk
) )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_ignore(junk); arma_ignore(junk);
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
typedef typename T1::pod_type T; typedef typename T1::pod_type T;
const Proxy<T1> P(X.get_ref()); const Proxy<T1> P(X);
const uword n_elem = P.get_n_elem(); const uword n_elem = P.get_n_elem();
arma_debug_check( (n_elem == 0), "median(): given object has no elements" ); arma_debug_check( (n_elem == 0), "median(): given object has no elements" );
std::vector< arma_cx_median_packet<T> > tmp_vec(n_elem); std::vector< arma_cx_median_packet<T> > tmp_vec(n_elem);
if(Proxy<T1>::prefer_at_accessor == false) if(Proxy<T1>::prefer_at_accessor == false)
{ {
typedef typename Proxy<T1>::ea_type ea_type; typedef typename Proxy<T1>::ea_type ea_type;
 End of changes. 4 change blocks. 
4 lines changed or deleted 4 lines changed or added


 operator_div.hpp   operator_div.hpp 
skipping to change at line 19 skipping to change at line 19
// by the Free Software Foundation, either version 3 // by the Free Software Foundation, either version 3
// of the License or (at your option) any later version. // of the License or (at your option) any later version.
// (see http://www.opensource.org/licenses for more info) // (see http://www.opensource.org/licenses for more info)
//! \addtogroup operator_div //! \addtogroup operator_div
//! @{ //! @{
//! Base / scalar //! Base / scalar
template<typename T1> template<typename T1>
arma_inline arma_inline
const eOp<T1, eop_scalar_div_post> typename
enable_if2< is_arma_type<T1>::value, const eOp<T1, eop_scalar_div_post> >::
result
operator/ operator/
( (
const Base<typename T1::elem_type,T1>& X, const T1& X,
const typename T1::elem_type k const typename T1::elem_type k
) )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return eOp<T1, eop_scalar_div_post>(X.get_ref(), k); return eOp<T1, eop_scalar_div_post>(X, k);
} }
//! scalar / Base //! scalar / Base
template<typename T1> template<typename T1>
arma_inline arma_inline
const eOp<T1, eop_scalar_div_pre> typename
enable_if2< is_arma_type<T1>::value, const eOp<T1, eop_scalar_div_pre> >::r
esult
operator/ operator/
( (
const typename T1::elem_type k, const typename T1::elem_type k,
const Base<typename T1::elem_type,T1>& X const T1& X
) )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return eOp<T1, eop_scalar_div_pre>(X.get_ref(), k); return eOp<T1, eop_scalar_div_pre>(X, k);
} }
//! complex scalar / non-complex Base (experimental) //! complex scalar / non-complex Base
template<typename T1> template<typename T1>
arma_inline arma_inline
const mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar_d typename
iv_pre> enable_if2
<
(is_arma_type<T1>::value && is_complex<typename T1::elem_type>::value ==
false),
const mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar
_div_pre>
>::result
operator/ operator/
( (
const std::complex<typename T1::pod_type>& k, const std::complex<typename T1::pod_type>& k,
const Base<typename T1::pod_type, T1>& X const T1& X
) )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scala r_div_pre>('j', X.get_ref(), k); return mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scala r_div_pre>('j', X, k);
} }
//! non-complex Base / complex scalar (experimental) //! non-complex Base / complex scalar
template<typename T1> template<typename T1>
arma_inline arma_inline
const mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar_d typename
iv_post> enable_if2
<
(is_arma_type<T1>::value && is_complex<typename T1::elem_type>::value ==
false),
const mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar
_div_post>
>::result
operator/ operator/
( (
const Base<typename T1::pod_type, T1>& X, const T1& X,
const std::complex<typename T1::pod_type>& k const std::complex<typename T1::pod_type>& k
) )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scala r_div_post>('j', X.get_ref(), k); return mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scala r_div_post>('j', X, k);
} }
//! element-wise division of Base objects with same element type //! element-wise division of Base objects with same element type
template<typename T1, typename T2> template<typename T1, typename T2>
arma_inline arma_inline
const eGlue<T1, T2, eglue_div> typename
enable_if2
<
(is_arma_type<T1>::value && is_arma_type<T2>::value && is_same_type<typen
ame T1::elem_type, typename T2::elem_type>::value),
const eGlue<T1, T2, eglue_div>
>::result
operator/ operator/
( (
const Base<typename T1::elem_type,T1>& X, const T1& X,
const Base<typename T1::elem_type,T2>& Y const T2& Y
) )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return eGlue<T1, T2, eglue_div>(X.get_ref(), Y.get_ref()); return eGlue<T1, T2, eglue_div>(X, Y);
} }
//! element-wise division of Base objects with different element types //! element-wise division of Base objects with different element types
template<typename T1, typename T2> template<typename T1, typename T2>
inline inline
const mtGlue<typename promote_type<typename T1::elem_type, typename T2::ele typename
m_type>::result, T1, T2, glue_mixed_div> enable_if2
<
(is_arma_type<T1>::value && is_arma_type<T2>::value && (is_same_type<type
name T1::elem_type, typename T2::elem_type>::value == false)),
const mtGlue<typename promote_type<typename T1::elem_type, typename T2::e
lem_type>::result, T1, T2, glue_mixed_div>
>::result
operator/ operator/
( (
const Base< typename force_different_type<typename T1::elem_type, typenam const T1& X,
e T2::elem_type>::T1_result, T1>& X, const T2& Y
const Base< typename force_different_type<typename T1::elem_type, typenam
e T2::elem_type>::T2_result, T2>& Y
) )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT1; typedef typename T1::elem_type eT1;
typedef typename T2::elem_type eT2; typedef typename T2::elem_type eT2;
typedef typename promote_type<eT1,eT2>::result out_eT; typedef typename promote_type<eT1,eT2>::result out_eT;
promote_type<eT1,eT2>::check(); promote_type<eT1,eT2>::check();
return mtGlue<out_eT, T1, T2, glue_mixed_div>( X.get_ref(), Y.get_ref() ) ; return mtGlue<out_eT, T1, T2, glue_mixed_div>( X, Y );
} }
//
//
//
#undef armaObj
#undef armaObjA
#undef armaObjB
#undef arma_operator_obj_scalar
#undef arma_operator_scalar_obj
#undef arma_operator_obj_cx_scalar
#undef arma_operator_cx_scalar_obj
#undef arma_operator_obj_base
#undef arma_operator_base_obj
#undef arma_operator_obj1_obj2
#undef arma_operator_obj1_obj2_mixed
#define arma_operator_obj_scalar(armaObj) \
template<typename eT> \
arma_inline \
const eOp<armaObj<eT>, eop_scalar_div_post> \
operator/ \
(const armaObj<eT>& X, const typename armaObj<eT>::elem_type k) \
{ \
arma_extra_debug_sigprint(); \
\
return eOp<armaObj<eT>, eop_scalar_div_post>(X, k); \
}
#define arma_operator_scalar_obj(armaObj) \
template<typename eT> \
arma_inline \
const eOp<armaObj<eT>, eop_scalar_div_pre> \
operator/ \
(const typename armaObj<eT>::elem_type k, const armaObj<eT>& X) \
{ \
arma_extra_debug_sigprint(); \
\
return eOp<armaObj<eT>, eop_scalar_div_pre>(X, k); \
}
#define arma_operator_obj_cx_scalar(armaObj) \
template<typename eT> \
arma_inline \
const mtOp<typename std::complex<typename armaObj<eT>::pod_type>, armaObj<e
T>, op_cx_scalar_div_post> \
operator/ \
( \
const armaObj<eT>& X, \
const std::complex<typename armaObj<eT>::pod_type>& k \
) \
{ \
arma_extra_debug_sigprint(); \
\
return mtOp<typename std::complex<typename armaObj<eT>::pod_type>, armaOb
j<eT>, op_cx_scalar_div_post>('j', X, k); \
}
#define arma_operator_cx_scalar_obj(armaObj) \
template<typename eT> \
arma_inline \
const mtOp<typename std::complex<typename armaObj<eT>::pod_type>, armaObj<e
T>, op_cx_scalar_div_pre> \
operator/ \
( \
const std::complex<typename armaObj<eT>::pod_type>& k, \
const armaObj<eT>& X \
) \
{ \
arma_extra_debug_sigprint(); \
\
return mtOp<typename std::complex<typename armaObj<eT>::pod_type>, armaOb
j<eT>, op_cx_scalar_div_pre>('j', X, k); \
}
#define arma_operator_obj_base(armaObj) \
template<typename BT> \
arma_inline \
const eGlue<armaObj<typename BT::elem_type>, BT, eglue_div> \
operator/ \
( \
const armaObj<typename BT::elem_type>& X, \
const Base<typename BT::elem_type, BT>& Y \
) \
{ \
arma_extra_debug_sigprint(); \
\
return eGlue<armaObj<typename BT::elem_type>, BT, eglue_div>(X, Y.get_ref
()); \
}
#define arma_operator_base_obj(armaObj) \
template<typename BT> \
arma_inline \
const eGlue<BT, armaObj<typename BT::elem_type>, eglue_div> \
operator/ \
( \
const Base<typename BT::elem_type, BT>& X, \
const armaObj<typename BT::elem_type> & Y \
) \
{ \
arma_extra_debug_sigprint(); \
\
return eGlue<BT, armaObj<typename BT::elem_type>, eglue_div>(X.get_ref(),
Y); \
}
#define arma_operator_obj1_obj2(armaObjA, armaObjB) \
template<typename eT> \
arma_inline \
const eGlue<armaObjA<eT>, armaObjB<eT>, eglue_div> \
operator/ \
( \
const armaObjA<eT>& X, \
const armaObjB<eT>& Y \
) \
{ \
arma_extra_debug_sigprint(); \
\
return eGlue<armaObjA<eT>, armaObjB<eT>, eglue_div>(X, Y); \
}
#define arma_operator_obj1_obj2_mixed(armaObjA, armaObjB) \
template<typename eT1, typename eT2> \
inline \
const mtGlue<typename promote_type<eT1, eT2>::result, armaObjA<eT1>, armaOb
jB<eT2>, glue_mixed_div> \
operator/ \
( \
const armaObjA<eT1>& X, \
const armaObjB<eT2>& Y \
) \
{ \
arma_extra_debug_sigprint(); \
\
typedef typename promote_type<eT1,eT2>::result out_eT; \
\
promote_type<eT1,eT2>::check(); \
\
return mtGlue<out_eT, armaObjA<eT1>, armaObjB<eT2>, glue_mixed_div>( X, Y
); \
}
arma_operator_obj_scalar(Col)
arma_operator_obj_scalar(Row)
arma_operator_obj_scalar(diagview)
arma_operator_obj_scalar(subview_col)
arma_operator_obj_scalar(subview_row)
arma_operator_scalar_obj(Col)
arma_operator_scalar_obj(Row)
arma_operator_scalar_obj(diagview)
arma_operator_scalar_obj(subview_col)
arma_operator_scalar_obj(subview_row)
arma_operator_obj_cx_scalar(Col)
arma_operator_obj_cx_scalar(Row)
arma_operator_obj_cx_scalar(diagview)
arma_operator_obj_cx_scalar(subview_col)
arma_operator_obj_cx_scalar(subview_row)
arma_operator_cx_scalar_obj(Col)
arma_operator_cx_scalar_obj(Row)
arma_operator_cx_scalar_obj(diagview)
arma_operator_cx_scalar_obj(subview_col)
arma_operator_cx_scalar_obj(subview_row)
arma_operator_obj_base(Col)
arma_operator_obj_base(Row)
arma_operator_obj_base(diagview)
arma_operator_obj_base(subview_col)
arma_operator_obj_base(subview_row)
arma_operator_base_obj(Col)
arma_operator_base_obj(Row)
arma_operator_base_obj(diagview)
arma_operator_base_obj(subview_col)
arma_operator_base_obj(subview_row)
arma_operator_obj1_obj2(Col,Col)
arma_operator_obj1_obj2(Col,Row)
arma_operator_obj1_obj2(Col,diagview)
arma_operator_obj1_obj2(Col,subview_col)
arma_operator_obj1_obj2(Col,subview_row)
arma_operator_obj1_obj2(Row,Col)
arma_operator_obj1_obj2(Row,Row)
arma_operator_obj1_obj2(Row,diagview)
arma_operator_obj1_obj2(Row,subview_col)
arma_operator_obj1_obj2(Row,subview_row)
arma_operator_obj1_obj2(diagview,Col)
arma_operator_obj1_obj2(diagview,Row)
arma_operator_obj1_obj2(diagview,diagview)
arma_operator_obj1_obj2(diagview,subview_col)
arma_operator_obj1_obj2(diagview,subview_row)
arma_operator_obj1_obj2(subview_col,Col)
arma_operator_obj1_obj2(subview_col,Row)
arma_operator_obj1_obj2(subview_col,diagview)
arma_operator_obj1_obj2(subview_col,subview_col)
arma_operator_obj1_obj2(subview_col,subview_row)
arma_operator_obj1_obj2(subview_row,Col)
arma_operator_obj1_obj2(subview_row,Row)
arma_operator_obj1_obj2(subview_row,diagview)
arma_operator_obj1_obj2(subview_row,subview_col)
arma_operator_obj1_obj2(subview_row,subview_row)
arma_operator_obj1_obj2_mixed(Col,Col)
arma_operator_obj1_obj2_mixed(Col,Row)
arma_operator_obj1_obj2_mixed(Col,diagview)
arma_operator_obj1_obj2_mixed(Col,subview_col)
arma_operator_obj1_obj2_mixed(Col,subview_row)
arma_operator_obj1_obj2_mixed(Row,Col)
arma_operator_obj1_obj2_mixed(Row,Row)
arma_operator_obj1_obj2_mixed(Row,diagview)
arma_operator_obj1_obj2_mixed(Row,subview_col)
arma_operator_obj1_obj2_mixed(Row,subview_row)
arma_operator_obj1_obj2_mixed(diagview,Col)
arma_operator_obj1_obj2_mixed(diagview,Row)
arma_operator_obj1_obj2_mixed(diagview,diagview)
arma_operator_obj1_obj2_mixed(diagview,subview_col)
arma_operator_obj1_obj2_mixed(diagview,subview_row)
arma_operator_obj1_obj2_mixed(subview_col,Col)
arma_operator_obj1_obj2_mixed(subview_col,Row)
arma_operator_obj1_obj2_mixed(subview_col,diagview)
arma_operator_obj1_obj2_mixed(subview_col,subview_col)
arma_operator_obj1_obj2_mixed(subview_col,subview_row)
arma_operator_obj1_obj2_mixed(subview_row,Col)
arma_operator_obj1_obj2_mixed(subview_row,Row)
arma_operator_obj1_obj2_mixed(subview_row,diagview)
arma_operator_obj1_obj2_mixed(subview_row,subview_col)
arma_operator_obj1_obj2_mixed(subview_row,subview_row)
// TODO: explicit handling of subview_elem1, perhaps via expanding the abov
e macros to take another paramater (for template<T1>)
//! @} //! @}
 End of changes. 21 change blocks. 
270 lines changed or deleted 55 lines changed or added


 operator_minus.hpp   operator_minus.hpp 
skipping to change at line 19 skipping to change at line 19
// by the Free Software Foundation, either version 3 // by the Free Software Foundation, either version 3
// of the License or (at your option) any later version. // of the License or (at your option) any later version.
// (see http://www.opensource.org/licenses for more info) // (see http://www.opensource.org/licenses for more info)
//! \addtogroup operator_minus //! \addtogroup operator_minus
//! @{ //! @{
//! unary - //! unary -
template<typename T1> template<typename T1>
arma_inline arma_inline
const eOp<T1, eop_neg> typename
enable_if2< is_arma_type<T1>::value, const eOp<T1, eop_neg> >::result
operator- operator-
(const Base<typename T1::elem_type,T1>& X) (const T1& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return eOp<T1,eop_neg>(X.get_ref()); return eOp<T1,eop_neg>(X);
} }
//! cancellation of two consecutive negations: -(-T1) //! cancellation of two consecutive negations: -(-T1)
template<typename T1> template<typename T1>
arma_inline arma_inline
const T1& const T1&
operator- operator-
(const eOp<T1, eop_neg>& X) (const eOp<T1, eop_neg>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return X.m; return X.m;
} }
//! Base - scalar //! Base - scalar
template<typename T1> template<typename T1>
arma_inline arma_inline
const eOp<T1, eop_scalar_minus_post> typename
enable_if2< is_arma_type<T1>::value, const eOp<T1, eop_scalar_minus_post> >
::result
operator- operator-
( (
const Base<typename T1::elem_type,T1>& X, const T1& X,
const typename T1::elem_type k const typename T1::elem_type k
) )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return eOp<T1, eop_scalar_minus_post>(X.get_ref(), k); return eOp<T1, eop_scalar_minus_post>(X, k);
} }
//! scalar - Base //! scalar - Base
template<typename T1> template<typename T1>
arma_inline arma_inline
const eOp<T1, eop_scalar_minus_pre> typename
enable_if2< is_arma_type<T1>::value, const eOp<T1, eop_scalar_minus_pre> >:
:result
operator- operator-
( (
const typename T1::elem_type k, const typename T1::elem_type k,
const Base<typename T1::elem_type,T1>& X const T1& X
) )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return eOp<T1, eop_scalar_minus_pre>(X.get_ref(), k); return eOp<T1, eop_scalar_minus_pre>(X, k);
} }
//! complex scalar - non-complex Base (experimental) //! complex scalar - non-complex Base
template<typename T1> template<typename T1>
arma_inline arma_inline
const mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar_m typename
inus_pre> enable_if2
<
(is_arma_type<T1>::value && is_complex<typename T1::elem_type>::value ==
false),
const mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar
_minus_pre>
>::result
operator- operator-
( (
const std::complex<typename T1::pod_type>& k, const std::complex<typename T1::pod_type>& k,
const Base<typename T1::pod_type, T1>& X const T1& X
) )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scala r_minus_pre>('j', X.get_ref(), k); return mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scala r_minus_pre>('j', X, k);
} }
//! non-complex Base - complex scalar (experimental) //! non-complex Base - complex scalar
template<typename T1> template<typename T1>
arma_inline arma_inline
const mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar_m typename
inus_post> enable_if2
<
(is_arma_type<T1>::value && is_complex<typename T1::elem_type>::value ==
false),
const mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar
_minus_post>
>::result
operator- operator-
( (
const Base<typename T1::pod_type, T1>& X, const T1& X,
const std::complex<typename T1::pod_type>& k const std::complex<typename T1::pod_type>& k
) )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scala r_minus_post>('j', X.get_ref(), k); return mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scala r_minus_post>('j', X, k);
} }
//! subtraction of Base objects with same element type //! subtraction of Base objects with same element type
template<typename T1, typename T2> template<typename T1, typename T2>
arma_inline arma_inline
const eGlue<T1, T2, eglue_minus> typename
enable_if2
<
is_arma_type<T1>::value && is_arma_type<T2>::value && is_same_type<typena
me T1::elem_type, typename T2::elem_type>::value,
const eGlue<T1, T2, eglue_minus>
>::result
operator- operator-
( (
const Base<typename T1::elem_type,T1>& X, const T1& X,
const Base<typename T1::elem_type,T2>& Y const T2& Y
) )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return eGlue<T1, T2, eglue_minus>(X.get_ref(), Y.get_ref()); return eGlue<T1, T2, eglue_minus>(X, Y);
} }
//! subtraction of Base objects with different element types //! subtraction of Base objects with different element types
template<typename T1, typename T2> template<typename T1, typename T2>
inline inline
const mtGlue<typename promote_type<typename T1::elem_type, typename T2::ele typename
m_type>::result, T1, T2, glue_mixed_minus> enable_if2
<
(is_arma_type<T1>::value && is_arma_type<T2>::value && (is_same_type<type
name T1::elem_type, typename T2::elem_type>::value == false)),
const mtGlue<typename promote_type<typename T1::elem_type, typename T2::e
lem_type>::result, T1, T2, glue_mixed_minus>
>::result
operator- operator-
( (
const Base< typename force_different_type<typename T1::elem_type, typenam const T1& X,
e T2::elem_type>::T1_result, T1>& X, const T2& Y
const Base< typename force_different_type<typename T1::elem_type, typenam
e T2::elem_type>::T2_result, T2>& Y
) )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT1; typedef typename T1::elem_type eT1;
typedef typename T2::elem_type eT2; typedef typename T2::elem_type eT2;
typedef typename promote_type<eT1,eT2>::result out_eT; typedef typename promote_type<eT1,eT2>::result out_eT;
promote_type<eT1,eT2>::check(); promote_type<eT1,eT2>::check();
return mtGlue<out_eT, T1, T2, glue_mixed_minus>( X.get_ref(), Y.get_ref() ); return mtGlue<out_eT, T1, T2, glue_mixed_minus>( X, Y );
} }
//
//
//
#undef armaObj
#undef armaObjA
#undef armaObjB
#undef arma_operator_unary
#undef arma_operator_obj_scalar
#undef arma_operator_scalar_obj
#undef arma_operator_obj_cx_scalar
#undef arma_operator_cx_scalar_obj
#undef arma_operator_obj_base
#undef arma_operator_base_obj
#undef arma_operator_obj1_obj2
#undef arma_operator_obj1_obj2_mixed
#define arma_operator_unary(armaObj) \
template<typename eT> \
arma_inline \
const eOp<armaObj<eT>, eop_neg> \
operator- \
(const armaObj<eT>& X) \
{ \
arma_extra_debug_sigprint(); \
\
return eOp<armaObj<eT>,eop_neg>(X); \
}
#define arma_operator_obj_scalar(armaObj) \
template<typename eT> \
arma_inline \
const eOp<armaObj<eT>, eop_scalar_minus_post> \
operator- \
(const armaObj<eT>& X, const typename armaObj<eT>::elem_type k) \
{ \
arma_extra_debug_sigprint(); \
\
return eOp<armaObj<eT>, eop_scalar_minus_post>(X, k); \
}
#define arma_operator_scalar_obj(armaObj) \
template<typename eT> \
arma_inline \
const eOp<armaObj<eT>, eop_scalar_minus_pre> \
operator- \
(const typename armaObj<eT>::elem_type k, const armaObj<eT>& X) \
{ \
arma_extra_debug_sigprint(); \
\
return eOp<armaObj<eT>, eop_scalar_minus_pre>(X, k); \
}
#define arma_operator_obj_cx_scalar(armaObj) \
template<typename eT> \
arma_inline \
const mtOp<typename std::complex<typename armaObj<eT>::pod_type>, armaObj<e
T>, op_cx_scalar_minus_post> \
operator- \
( \
const armaObj<eT>& X, \
const std::complex<typename armaObj<eT>::pod_type>& k \
) \
{ \
arma_extra_debug_sigprint(); \
\
return mtOp<typename std::complex<typename armaObj<eT>::pod_type>, armaOb
j<eT>, op_cx_scalar_minus_post>('j', X, k); \
}
#define arma_operator_cx_scalar_obj(armaObj) \
template<typename eT> \
arma_inline \
const mtOp<typename std::complex<typename armaObj<eT>::pod_type>, armaObj<e
T>, op_cx_scalar_minus_pre> \
operator- \
( \
const std::complex<typename armaObj<eT>::pod_type>& k, \
const armaObj<eT>& X \
) \
{ \
arma_extra_debug_sigprint(); \
\
return mtOp<typename std::complex<typename armaObj<eT>::pod_type>, armaOb
j<eT>, op_cx_scalar_minus_pre>('j', X, k); \
}
#define arma_operator_obj_base(armaObj) \
template<typename BT> \
arma_inline \
const eGlue<armaObj<typename BT::elem_type>, BT, eglue_minus> \
operator- \
( \
const armaObj<typename BT::elem_type>& X, \
const Base<typename BT::elem_type, BT>& Y \
) \
{ \
arma_extra_debug_sigprint(); \
\
return eGlue<armaObj<typename BT::elem_type>, BT, eglue_minus>(X, Y.get_r
ef()); \
}
#define arma_operator_base_obj(armaObj) \
template<typename BT> \
arma_inline \
const eGlue<BT, armaObj<typename BT::elem_type>, eglue_minus> \
operator- \
( \
const Base<typename BT::elem_type, BT>& X, \
const armaObj<typename BT::elem_type> & Y \
) \
{ \
arma_extra_debug_sigprint(); \
\
return eGlue<BT, armaObj<typename BT::elem_type>, eglue_minus>(X.get_ref(
), Y); \
}
#define arma_operator_obj1_obj2(armaObjA, armaObjB) \
template<typename eT> \
arma_inline \
const eGlue<armaObjA<eT>, armaObjB<eT>, eglue_minus> \
operator- \
( \
const armaObjA<eT>& X, \
const armaObjB<eT>& Y \
) \
{ \
arma_extra_debug_sigprint(); \
\
return eGlue<armaObjA<eT>, armaObjB<eT>, eglue_minus>(X, Y); \
}
#define arma_operator_obj1_obj2_mixed(armaObjA, armaObjB) \
template<typename eT1, typename eT2> \
inline \
const mtGlue<typename promote_type<eT1, eT2>::result, armaObjA<eT1>, armaOb
jB<eT2>, glue_mixed_minus> \
operator- \
( \
const armaObjA<eT1>& X, \
const armaObjB<eT2>& Y \
) \
{ \
arma_extra_debug_sigprint(); \
\
typedef typename promote_type<eT1,eT2>::result out_eT; \
\
promote_type<eT1,eT2>::check(); \
\
return mtGlue<out_eT, armaObjA<eT1>, armaObjB<eT2>, glue_mixed_minus>( X,
Y ); \
}
arma_operator_unary(Col)
arma_operator_unary(Row)
arma_operator_unary(diagview)
arma_operator_unary(subview_col)
arma_operator_unary(subview_row)
arma_operator_obj_scalar(Col)
arma_operator_obj_scalar(Row)
arma_operator_obj_scalar(diagview)
arma_operator_obj_scalar(subview_col)
arma_operator_obj_scalar(subview_row)
arma_operator_scalar_obj(Col)
arma_operator_scalar_obj(Row)
arma_operator_scalar_obj(diagview)
arma_operator_scalar_obj(subview_col)
arma_operator_scalar_obj(subview_row)
arma_operator_obj_cx_scalar(Col)
arma_operator_obj_cx_scalar(Row)
arma_operator_obj_cx_scalar(diagview)
arma_operator_obj_cx_scalar(subview_col)
arma_operator_obj_cx_scalar(subview_row)
arma_operator_cx_scalar_obj(Col)
arma_operator_cx_scalar_obj(Row)
arma_operator_cx_scalar_obj(diagview)
arma_operator_cx_scalar_obj(subview_col)
arma_operator_cx_scalar_obj(subview_row)
arma_operator_obj_base(Col)
arma_operator_obj_base(Row)
arma_operator_obj_base(diagview)
arma_operator_obj_base(subview_col)
arma_operator_obj_base(subview_row)
arma_operator_base_obj(Col)
arma_operator_base_obj(Row)
arma_operator_base_obj(diagview)
arma_operator_base_obj(subview_col)
arma_operator_base_obj(subview_row)
arma_operator_obj1_obj2(Col,Col)
arma_operator_obj1_obj2(Col,Row)
arma_operator_obj1_obj2(Col,diagview)
arma_operator_obj1_obj2(Col,subview_col)
arma_operator_obj1_obj2(Col,subview_row)
arma_operator_obj1_obj2(Row,Col)
arma_operator_obj1_obj2(Row,Row)
arma_operator_obj1_obj2(Row,diagview)
arma_operator_obj1_obj2(Row,subview_col)
arma_operator_obj1_obj2(Row,subview_row)
arma_operator_obj1_obj2(diagview,Col)
arma_operator_obj1_obj2(diagview,Row)
arma_operator_obj1_obj2(diagview,diagview)
arma_operator_obj1_obj2(diagview,subview_col)
arma_operator_obj1_obj2(diagview,subview_row)
arma_operator_obj1_obj2(subview_col,Col)
arma_operator_obj1_obj2(subview_col,Row)
arma_operator_obj1_obj2(subview_col,diagview)
arma_operator_obj1_obj2(subview_col,subview_col)
arma_operator_obj1_obj2(subview_col,subview_row)
arma_operator_obj1_obj2(subview_row,Col)
arma_operator_obj1_obj2(subview_row,Row)
arma_operator_obj1_obj2(subview_row,diagview)
arma_operator_obj1_obj2(subview_row,subview_col)
arma_operator_obj1_obj2(subview_row,subview_row)
arma_operator_obj1_obj2_mixed(Col,Col)
arma_operator_obj1_obj2_mixed(Col,Row)
arma_operator_obj1_obj2_mixed(Col,diagview)
arma_operator_obj1_obj2_mixed(Col,subview_col)
arma_operator_obj1_obj2_mixed(Col,subview_row)
arma_operator_obj1_obj2_mixed(Row,Col)
arma_operator_obj1_obj2_mixed(Row,Row)
arma_operator_obj1_obj2_mixed(Row,diagview)
arma_operator_obj1_obj2_mixed(Row,subview_col)
arma_operator_obj1_obj2_mixed(Row,subview_row)
arma_operator_obj1_obj2_mixed(diagview,Col)
arma_operator_obj1_obj2_mixed(diagview,Row)
arma_operator_obj1_obj2_mixed(diagview,diagview)
arma_operator_obj1_obj2_mixed(diagview,subview_col)
arma_operator_obj1_obj2_mixed(diagview,subview_row)
arma_operator_obj1_obj2_mixed(subview_col,Col)
arma_operator_obj1_obj2_mixed(subview_col,Row)
arma_operator_obj1_obj2_mixed(subview_col,diagview)
arma_operator_obj1_obj2_mixed(subview_col,subview_col)
arma_operator_obj1_obj2_mixed(subview_col,subview_row)
arma_operator_obj1_obj2_mixed(subview_row,Col)
arma_operator_obj1_obj2_mixed(subview_row,Row)
arma_operator_obj1_obj2_mixed(subview_row,diagview)
arma_operator_obj1_obj2_mixed(subview_row,subview_col)
arma_operator_obj1_obj2_mixed(subview_row,subview_row)
// TODO: explicit handling of subview_elem1, perhaps via expanding the abov
e macros to take another paramater (for template<T1>)
//! @} //! @}
 End of changes. 24 change blocks. 
292 lines changed or deleted 59 lines changed or added


 operator_plus.hpp   operator_plus.hpp 
skipping to change at line 19 skipping to change at line 19
// by the Free Software Foundation, either version 3 // by the Free Software Foundation, either version 3
// of the License or (at your option) any later version. // of the License or (at your option) any later version.
// (see http://www.opensource.org/licenses for more info) // (see http://www.opensource.org/licenses for more info)
//! \addtogroup operator_plus //! \addtogroup operator_plus
//! @{ //! @{
//! unary plus operation (does nothing, but is required for completeness) //! unary plus operation (does nothing, but is required for completeness)
template<typename T1> template<typename T1>
arma_inline arma_inline
const Base<typename T1::elem_type,T1>& typename enable_if2< is_arma_type<T1>::value, const T1& >::result
operator+ operator+
(const Base<typename T1::elem_type,T1>& X) (const T1& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return X; return X;
} }
//! Base + scalar //! Base + scalar
template<typename T1> template<typename T1>
arma_inline arma_inline
const eOp<T1, eop_scalar_plus> typename enable_if2< is_arma_type<T1>::value, const eOp<T1, eop_scalar_plus > >::result
operator+ operator+
(const Base<typename T1::elem_type,T1>& X, const typename T1::elem_type k) (const T1& X, const typename T1::elem_type k)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return eOp<T1, eop_scalar_plus>(X.get_ref(), k); return eOp<T1, eop_scalar_plus>(X, k);
} }
//! scalar + Base //! scalar + Base
template<typename T1> template<typename T1>
arma_inline arma_inline
const eOp<T1, eop_scalar_plus> typename enable_if2< is_arma_type<T1>::value, const eOp<T1, eop_scalar_plus > >::result
operator+ operator+
(const typename T1::elem_type k, const Base<typename T1::elem_type,T1>& X) (const typename T1::elem_type k, const T1& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return eOp<T1, eop_scalar_plus>(X.get_ref(), k); // NOTE: order is swapp ed return eOp<T1, eop_scalar_plus>(X, k); // NOTE: order is swapped
} }
//! non-complex Base + complex scalar //! non-complex Base + complex scalar
template<typename T1> template<typename T1>
arma_inline arma_inline
const mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar_p typename
lus> enable_if2
<
(is_arma_type<T1>::value && is_complex<typename T1::elem_type>::value ==
false),
const mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar
_plus>
>::result
operator+ operator+
( (
const Base<typename T1::pod_type, T1>& X, const T1& X,
const std::complex<typename T1::pod_type>& k const std::complex<typename T1::pod_type>& k
) )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scala r_plus>('j', X.get_ref(), k); return mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scala r_plus>('j', X, k);
} }
//! complex scalar + non-complex Base //! complex scalar + non-complex Base
template<typename T1> template<typename T1>
arma_inline arma_inline
const mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar_p typename
lus> enable_if2
<
(is_arma_type<T1>::value && is_complex<typename T1::elem_type>::value ==
false),
const mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar
_plus>
>::result
operator+ operator+
( (
const std::complex<typename T1::pod_type>& k, const std::complex<typename T1::pod_type>& k,
const Base<typename T1::pod_type, T1>& X const T1& X
) )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scala r_plus>('j', X.get_ref(), k); // NOTE: order is swapped return mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scala r_plus>('j', X, k); // NOTE: order is swapped
} }
//! addition of Base objects with same element type //! addition of user-accessible Armadillo objects with same element type
template<typename T1, typename T2> template<typename T1, typename T2>
arma_inline arma_inline
const eGlue<T1, T2, eglue_plus> typename
enable_if2
<
is_arma_type<T1>::value && is_arma_type<T2>::value && is_same_type<typena
me T1::elem_type, typename T2::elem_type>::value,
const eGlue<T1, T2, eglue_plus>
>::result
operator+ operator+
( (
const Base<typename T1::elem_type,T1>& X, const T1& X,
const Base<typename T1::elem_type,T2>& Y const T2& Y
) )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return eGlue<T1, T2, eglue_plus>(X.get_ref(), Y.get_ref()); return eGlue<T1, T2, eglue_plus>(X, Y);
} }
//! addition of Base objects with different element types //! addition of user-accessible Armadillo objects with different element ty pes
template<typename T1, typename T2> template<typename T1, typename T2>
inline inline
const mtGlue<typename promote_type<typename T1::elem_type, typename T2::ele typename
m_type>::result, T1, T2, glue_mixed_plus> enable_if2
<
(is_arma_type<T1>::value && is_arma_type<T2>::value && (is_same_type<type
name T1::elem_type, typename T2::elem_type>::value == false)),
const mtGlue<typename promote_type<typename T1::elem_type, typename T2::e
lem_type>::result, T1, T2, glue_mixed_plus>
>::result
operator+ operator+
( (
const Base< typename force_different_type<typename T1::elem_type, typenam const T1& X,
e T2::elem_type>::T1_result, T1>& X, const T2& Y
const Base< typename force_different_type<typename T1::elem_type, typenam
e T2::elem_type>::T2_result, T2>& Y
) )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT1; typedef typename T1::elem_type eT1;
typedef typename T2::elem_type eT2; typedef typename T2::elem_type eT2;
typedef typename promote_type<eT1,eT2>::result out_eT; typedef typename promote_type<eT1,eT2>::result out_eT;
promote_type<eT1,eT2>::check(); promote_type<eT1,eT2>::check();
return mtGlue<out_eT, T1, T2, glue_mixed_plus>( X.get_ref(), Y.get_ref() ); return mtGlue<out_eT, T1, T2, glue_mixed_plus>( X, Y );
} }
//
//
//
#undef armaObj
#undef armaObjA
#undef armaObjB
#undef arma_operator_unary
#undef arma_operator_obj_scalar
#undef arma_operator_scalar_obj
#undef arma_operator_obj_cx_scalar
#undef arma_operator_cx_scalar_obj
#undef arma_operator_obj_base
#undef arma_operator_base_obj
#undef arma_operator_obj1_obj2
#undef arma_operator_obj1_obj2_mixed
#define arma_operator_unary(armaObj) \
template<typename eT> \
arma_inline \
const armaObj<eT>& \
operator+ \
(const armaObj<eT>& X) \
{ \
arma_extra_debug_sigprint(); \
\
return X; \
}
#define arma_operator_obj_scalar(armaObj) \
template<typename eT> \
arma_inline \
const eOp<armaObj<eT>, eop_scalar_plus> \
operator+ \
(const armaObj<eT>& X, const typename armaObj<eT>::elem_type k) \
{ \
arma_extra_debug_sigprint(); \
\
return eOp<armaObj<eT>, eop_scalar_plus>(X, k); \
}
#define arma_operator_scalar_obj(armaObj) \
template<typename eT> \
arma_inline \
const eOp<armaObj<eT>, eop_scalar_plus> \
operator+ \
(const typename armaObj<eT>::elem_type k, const armaObj<eT>& X) \
{ \
arma_extra_debug_sigprint(); \
\
return eOp<armaObj<eT>, eop_scalar_plus>(X, k); \
}
#define arma_operator_obj_cx_scalar(armaObj) \
template<typename eT> \
arma_inline \
const mtOp<typename std::complex<typename armaObj<eT>::pod_type>, armaObj<e
T>, op_cx_scalar_plus> \
operator+ \
( \
const armaObj<eT>& X, \
const std::complex<typename armaObj<eT>::pod_type>& k \
) \
{ \
arma_extra_debug_sigprint(); \
\
return mtOp<typename std::complex<typename armaObj<eT>::pod_type>, armaOb
j<eT>, op_cx_scalar_plus>('j', X, k); \
}
#define arma_operator_cx_scalar_obj(armaObj) \
template<typename eT> \
arma_inline \
const mtOp<typename std::complex<typename armaObj<eT>::pod_type>, armaObj<e
T>, op_cx_scalar_plus> \
operator+ \
( \
const std::complex<typename armaObj<eT>::pod_type>& k, \
const armaObj<eT>& X \
) \
{ \
arma_extra_debug_sigprint(); \
\
return mtOp<typename std::complex<typename armaObj<eT>::pod_type>, armaOb
j<eT>, op_cx_scalar_plus>('j', X, k); \
}
#define arma_operator_obj_base(armaObj) \
template<typename BT> \
arma_inline \
const eGlue<armaObj<typename BT::elem_type>, BT, eglue_plus> \
operator+ \
( \
const armaObj<typename BT::elem_type>& X, \
const Base<typename BT::elem_type, BT>& Y \
) \
{ \
arma_extra_debug_sigprint(); \
\
return eGlue<armaObj<typename BT::elem_type>, BT, eglue_plus>(X, Y.get_re
f()); \
}
#define arma_operator_base_obj(armaObj) \
template<typename BT> \
arma_inline \
const eGlue<BT, armaObj<typename BT::elem_type>, eglue_plus> \
operator+ \
( \
const Base<typename BT::elem_type, BT>& X, \
const armaObj<typename BT::elem_type> & Y \
) \
{ \
arma_extra_debug_sigprint(); \
\
return eGlue<BT, armaObj<typename BT::elem_type>, eglue_plus>(X.get_ref()
, Y); \
}
#define arma_operator_obj1_obj2(armaObjA, armaObjB) \
template<typename eT> \
arma_inline \
const eGlue<armaObjA<eT>, armaObjB<eT>, eglue_plus> \
operator+ \
( \
const armaObjA<eT>& X, \
const armaObjB<eT>& Y \
) \
{ \
arma_extra_debug_sigprint(); \
\
return eGlue<armaObjA<eT>, armaObjB<eT>, eglue_plus>(X, Y); \
}
#define arma_operator_obj1_obj2_mixed(armaObjA, armaObjB) \
template<typename eT1, typename eT2> \
inline \
const mtGlue<typename promote_type<eT1, eT2>::result, armaObjA<eT1>, armaOb
jB<eT2>, glue_mixed_plus> \
operator+ \
( \
const armaObjA<eT1>& X, \
const armaObjB<eT2>& Y \
) \
{ \
arma_extra_debug_sigprint(); \
\
typedef typename promote_type<eT1,eT2>::result out_eT; \
\
promote_type<eT1,eT2>::check(); \
\
return mtGlue<out_eT, armaObjA<eT1>, armaObjB<eT2>, glue_mixed_plus>( X,
Y ); \
}
arma_operator_unary(Col)
arma_operator_unary(Row)
arma_operator_unary(diagview)
arma_operator_unary(subview_col)
arma_operator_unary(subview_row)
arma_operator_obj_scalar(Col)
arma_operator_obj_scalar(Row)
arma_operator_obj_scalar(diagview)
arma_operator_obj_scalar(subview_col)
arma_operator_obj_scalar(subview_row)
arma_operator_scalar_obj(Col)
arma_operator_scalar_obj(Row)
arma_operator_scalar_obj(diagview)
arma_operator_scalar_obj(subview_col)
arma_operator_scalar_obj(subview_row)
arma_operator_obj_cx_scalar(Col)
arma_operator_obj_cx_scalar(Row)
arma_operator_obj_cx_scalar(diagview)
arma_operator_obj_cx_scalar(subview_col)
arma_operator_obj_cx_scalar(subview_row)
arma_operator_cx_scalar_obj(Col)
arma_operator_cx_scalar_obj(Row)
arma_operator_cx_scalar_obj(diagview)
arma_operator_cx_scalar_obj(subview_col)
arma_operator_cx_scalar_obj(subview_row)
arma_operator_obj_base(Col)
arma_operator_obj_base(Row)
arma_operator_obj_base(diagview)
arma_operator_obj_base(subview_col)
arma_operator_obj_base(subview_row)
arma_operator_base_obj(Col)
arma_operator_base_obj(Row)
arma_operator_base_obj(diagview)
arma_operator_base_obj(subview_col)
arma_operator_base_obj(subview_row)
arma_operator_obj1_obj2(Col,Col)
arma_operator_obj1_obj2(Col,Row)
arma_operator_obj1_obj2(Col,diagview)
arma_operator_obj1_obj2(Col,subview_col)
arma_operator_obj1_obj2(Col,subview_row)
arma_operator_obj1_obj2(Row,Col)
arma_operator_obj1_obj2(Row,Row)
arma_operator_obj1_obj2(Row,diagview)
arma_operator_obj1_obj2(Row,subview_col)
arma_operator_obj1_obj2(Row,subview_row)
arma_operator_obj1_obj2(diagview,Col)
arma_operator_obj1_obj2(diagview,Row)
arma_operator_obj1_obj2(diagview,diagview)
arma_operator_obj1_obj2(diagview,subview_col)
arma_operator_obj1_obj2(diagview,subview_row)
arma_operator_obj1_obj2(subview_col,Col)
arma_operator_obj1_obj2(subview_col,Row)
arma_operator_obj1_obj2(subview_col,diagview)
arma_operator_obj1_obj2(subview_col,subview_col)
arma_operator_obj1_obj2(subview_col,subview_row)
arma_operator_obj1_obj2(subview_row,Col)
arma_operator_obj1_obj2(subview_row,Row)
arma_operator_obj1_obj2(subview_row,diagview)
arma_operator_obj1_obj2(subview_row,subview_col)
arma_operator_obj1_obj2(subview_row,subview_row)
arma_operator_obj1_obj2_mixed(Col,Col)
arma_operator_obj1_obj2_mixed(Col,Row)
arma_operator_obj1_obj2_mixed(Col,diagview)
arma_operator_obj1_obj2_mixed(Col,subview_col)
arma_operator_obj1_obj2_mixed(Col,subview_row)
arma_operator_obj1_obj2_mixed(Row,Col)
arma_operator_obj1_obj2_mixed(Row,Row)
arma_operator_obj1_obj2_mixed(Row,diagview)
arma_operator_obj1_obj2_mixed(Row,subview_col)
arma_operator_obj1_obj2_mixed(Row,subview_row)
arma_operator_obj1_obj2_mixed(diagview,Col)
arma_operator_obj1_obj2_mixed(diagview,Row)
arma_operator_obj1_obj2_mixed(diagview,diagview)
arma_operator_obj1_obj2_mixed(diagview,subview_col)
arma_operator_obj1_obj2_mixed(diagview,subview_row)
arma_operator_obj1_obj2_mixed(subview_col,Col)
arma_operator_obj1_obj2_mixed(subview_col,Row)
arma_operator_obj1_obj2_mixed(subview_col,diagview)
arma_operator_obj1_obj2_mixed(subview_col,subview_col)
arma_operator_obj1_obj2_mixed(subview_col,subview_row)
arma_operator_obj1_obj2_mixed(subview_row,Col)
arma_operator_obj1_obj2_mixed(subview_row,Row)
arma_operator_obj1_obj2_mixed(subview_row,diagview)
arma_operator_obj1_obj2_mixed(subview_row,subview_col)
arma_operator_obj1_obj2_mixed(subview_row,subview_row)
// TODO: explicit handling of subview_elem1, perhaps via expanding the abov
e macros to take another paramater (for template<T1>)
//! @} //! @}
 End of changes. 23 change blocks. 
289 lines changed or deleted 51 lines changed or added


 operator_relational.hpp   operator_relational.hpp 
// Copyright (C) 2009-2010 NICTA (www.nicta.com.au) // Copyright (C) 2009-2012 NICTA (www.nicta.com.au)
// Copyright (C) 2009-2010 Conrad Sanderson // Copyright (C) 2009-2012 Conrad Sanderson
// //
// This file is part of the Armadillo C++ library. // This file is part of the Armadillo C++ library.
// It is provided without any warranty of fitness // It is provided without any warranty of fitness
// for any purpose. You can redistribute this file // for any purpose. You can redistribute this file
// and/or modify it under the terms of the GNU // and/or modify it under the terms of the GNU
// Lesser General Public License (LGPL) as published // Lesser General Public License (LGPL) as published
// by the Free Software Foundation, either version 3 // by the Free Software Foundation, either version 3
// of the License or (at your option) any later version. // of the License or (at your option) any later version.
// (see http://www.opensource.org/licenses for more info) // (see http://www.opensource.org/licenses for more info)
skipping to change at line 25 skipping to change at line 25
// < : lt // < : lt
// > : gt // > : gt
// <= : lteq // <= : lteq
// >= : gteq // >= : gteq
// == : eq // == : eq
// != : noteq // != : noteq
template<typename T1, typename T2> template<typename T1, typename T2>
inline inline
const mtGlue<uword, T1, T2, glue_rel_lt> typename
enable_if2
<
(is_arma_type<T1>::value && is_arma_type<T2>::value && (is_complex<typena
me T1::elem_type>::value == false) && (is_complex<typename T2::elem_type>::
value == false)),
const mtGlue<uword, T1, T2, glue_rel_lt>
>::result
operator< operator<
(const Base<typename arma_not_cx<typename T1::elem_type>::result,T1>& X, co nst Base<typename arma_not_cx<typename T1::elem_type>::result,T2>& Y) (const T1& X, const T2& Y)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return mtGlue<uword, T1, T2, glue_rel_lt>( X.get_ref(), Y.get_ref() ); return mtGlue<uword, T1, T2, glue_rel_lt>( X, Y );
} }
template<typename T1, typename T2> template<typename T1, typename T2>
inline inline
const mtGlue<uword, T1, T2, glue_rel_gt> typename
enable_if2
<
(is_arma_type<T1>::value && is_arma_type<T2>::value && (is_complex<typena
me T1::elem_type>::value == false) && (is_complex<typename T2::elem_type>::
value == false)),
const mtGlue<uword, T1, T2, glue_rel_gt>
>::result
operator> operator>
(const Base<typename arma_not_cx<typename T1::elem_type>::result,T1>& X, co nst Base<typename arma_not_cx<typename T1::elem_type>::result,T2>& Y) (const T1& X, const T2& Y)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return mtGlue<uword, T1, T2, glue_rel_gt>( X.get_ref(), Y.get_ref() ); return mtGlue<uword, T1, T2, glue_rel_gt>( X, Y );
} }
template<typename T1, typename T2> template<typename T1, typename T2>
inline inline
const mtGlue<uword, T1, T2, glue_rel_lteq> typename
enable_if2
<
(is_arma_type<T1>::value && is_arma_type<T2>::value && (is_complex<typena
me T1::elem_type>::value == false) && (is_complex<typename T2::elem_type>::
value == false)),
const mtGlue<uword, T1, T2, glue_rel_lteq>
>::result
operator<= operator<=
(const Base<typename arma_not_cx<typename T1::elem_type>::result,T1>& X, co nst Base<typename arma_not_cx<typename T1::elem_type>::result,T2>& Y) (const T1& X, const T2& Y)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return mtGlue<uword, T1, T2, glue_rel_lteq>( X.get_ref(), Y.get_ref() ); return mtGlue<uword, T1, T2, glue_rel_lteq>( X, Y );
} }
template<typename T1, typename T2> template<typename T1, typename T2>
inline inline
const mtGlue<uword, T1, T2, glue_rel_gteq> typename
enable_if2
<
(is_arma_type<T1>::value && is_arma_type<T2>::value && (is_complex<typena
me T1::elem_type>::value == false) && (is_complex<typename T2::elem_type>::
value == false)),
const mtGlue<uword, T1, T2, glue_rel_gteq>
>::result
operator>= operator>=
(const Base<typename arma_not_cx<typename T1::elem_type>::result,T1>& X, co nst Base<typename arma_not_cx<typename T1::elem_type>::result,T2>& Y) (const T1& X, const T2& Y)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return mtGlue<uword, T1, T2, glue_rel_gteq>( X.get_ref(), Y.get_ref() ); return mtGlue<uword, T1, T2, glue_rel_gteq>( X, Y );
} }
template<typename T1, typename T2> template<typename T1, typename T2>
inline inline
const mtGlue<uword, T1, T2, glue_rel_eq> typename
enable_if2
<
(is_arma_type<T1>::value && is_arma_type<T2>::value),
const mtGlue<uword, T1, T2, glue_rel_eq>
>::result
operator== operator==
(const Base<typename T1::elem_type,T1>& X, const Base<typename T1::elem_typ e,T2>& Y) (const T1& X, const T2& Y)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return mtGlue<uword, T1, T2, glue_rel_eq>( X.get_ref(), Y.get_ref() ); return mtGlue<uword, T1, T2, glue_rel_eq>( X, Y );
} }
template<typename T1, typename T2> template<typename T1, typename T2>
inline inline
const mtGlue<uword, T1, T2, glue_rel_noteq> typename
enable_if2
<
(is_arma_type<T1>::value && is_arma_type<T2>::value),
const mtGlue<uword, T1, T2, glue_rel_noteq>
>::result
operator!= operator!=
(const Base<typename T1::elem_type,T1>& X, const Base<typename T1::elem_typ e,T2>& Y) (const T1& X, const T2& Y)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return mtGlue<uword, T1, T2, glue_rel_noteq>( X.get_ref(), Y.get_ref() ); return mtGlue<uword, T1, T2, glue_rel_noteq>( X, Y );
} }
// //
// //
// //
template<typename T1> template<typename T1>
inline inline
const mtOp<uword, T1, op_rel_lt_pre> typename
enable_if2
<
(is_arma_type<T1>::value && (is_complex<typename T1::elem_type>::value ==
false)),
const mtOp<uword, T1, op_rel_lt_pre>
>::result
operator< operator<
(const typename arma_not_cx<typename T1::elem_type>::result val, const Base <typename arma_not_cx<typename T1::elem_type>::result,T1>& X) (const typename T1::elem_type val, const T1& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return mtOp<uword, T1, op_rel_lt_pre>(X.get_ref(), val); return mtOp<uword, T1, op_rel_lt_pre>(X, val);
} }
template<typename T1> template<typename T1>
inline inline
const mtOp<uword, T1, op_rel_lt_post> typename
enable_if2
<
(is_arma_type<T1>::value && (is_complex<typename T1::elem_type>::value ==
false)),
const mtOp<uword, T1, op_rel_lt_post>
>::result
operator< operator<
(const Base<typename arma_not_cx<typename T1::elem_type>::result,T1>& X, co nst typename arma_not_cx<typename T1::elem_type>::result val) (const T1& X, const typename T1::elem_type val)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return mtOp<uword, T1, op_rel_lt_post>(X.get_ref(), val); return mtOp<uword, T1, op_rel_lt_post>(X, val);
} }
template<typename T1> template<typename T1>
inline inline
const mtOp<uword, T1, op_rel_gt_pre> typename
enable_if2
<
(is_arma_type<T1>::value && (is_complex<typename T1::elem_type>::value ==
false)),
const mtOp<uword, T1, op_rel_gt_pre>
>::result
operator> operator>
(const typename arma_not_cx<typename T1::elem_type>::result val, const Base <typename arma_not_cx<typename T1::elem_type>::result,T1>& X) (const typename T1::elem_type val, const T1& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return mtOp<uword, T1, op_rel_gt_pre>(X.get_ref(), val); return mtOp<uword, T1, op_rel_gt_pre>(X, val);
} }
template<typename T1> template<typename T1>
inline inline
const mtOp<uword, T1, op_rel_gt_post> typename
enable_if2
<
(is_arma_type<T1>::value && (is_complex<typename T1::elem_type>::value ==
false)),
const mtOp<uword, T1, op_rel_gt_post>
>::result
operator> operator>
(const Base<typename arma_not_cx<typename T1::elem_type>::result,T1>& X, co nst typename arma_not_cx<typename T1::elem_type>::result val) (const T1& X, const typename T1::elem_type val)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return mtOp<uword, T1, op_rel_gt_post>(X.get_ref(), val); return mtOp<uword, T1, op_rel_gt_post>(X, val);
} }
template<typename T1> template<typename T1>
inline inline
const mtOp<uword, T1, op_rel_lteq_pre> typename
enable_if2
<
(is_arma_type<T1>::value && (is_complex<typename T1::elem_type>::value ==
false)),
const mtOp<uword, T1, op_rel_lteq_pre>
>::result
operator<= operator<=
(const typename arma_not_cx<typename T1::elem_type>::result val, const Base <typename arma_not_cx<typename T1::elem_type>::result,T1>& X) (const typename T1::elem_type val, const T1& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return mtOp<uword, T1, op_rel_lteq_pre>(X.get_ref(), val); return mtOp<uword, T1, op_rel_lteq_pre>(X, val);
} }
template<typename T1> template<typename T1>
inline inline
const mtOp<uword, T1, op_rel_lteq_post> typename
enable_if2
<
(is_arma_type<T1>::value && (is_complex<typename T1::elem_type>::value ==
false)),
const mtOp<uword, T1, op_rel_lteq_post>
>::result
operator<= operator<=
(const Base<typename arma_not_cx<typename T1::elem_type>::result,T1>& X, co nst typename arma_not_cx<typename T1::elem_type>::result val) (const T1& X, const typename T1::elem_type val)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return mtOp<uword, T1, op_rel_lteq_post>(X.get_ref(), val); return mtOp<uword, T1, op_rel_lteq_post>(X, val);
} }
template<typename T1> template<typename T1>
inline inline
const mtOp<uword, T1, op_rel_gteq_pre> typename
enable_if2
<
(is_arma_type<T1>::value && (is_complex<typename T1::elem_type>::value ==
false)),
const mtOp<uword, T1, op_rel_gteq_pre>
>::result
operator>= operator>=
(const typename arma_not_cx<typename T1::elem_type>::result val, const Base <typename arma_not_cx<typename T1::elem_type>::result,T1>& X) (const typename T1::elem_type val, const T1& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return mtOp<uword, T1, op_rel_gteq_pre>(X.get_ref(), val); return mtOp<uword, T1, op_rel_gteq_pre>(X, val);
} }
template<typename T1> template<typename T1>
inline inline
const mtOp<uword, T1, op_rel_gteq_post> typename
enable_if2
<
(is_arma_type<T1>::value && (is_complex<typename T1::elem_type>::value ==
false)),
const mtOp<uword, T1, op_rel_gteq_post>
>::result
operator>= operator>=
(const Base<typename arma_not_cx<typename T1::elem_type>::result,T1>& X, co nst typename arma_not_cx<typename T1::elem_type>::result val) (const T1& X, const typename T1::elem_type val)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return mtOp<uword, T1, op_rel_gteq_post>(X.get_ref(), val); return mtOp<uword, T1, op_rel_gteq_post>(X, val);
} }
template<typename T1> template<typename T1>
inline inline
const mtOp<uword, T1, op_rel_eq> typename
enable_if2
<
is_arma_type<T1>::value,
const mtOp<uword, T1, op_rel_eq>
>::result
operator== operator==
(const typename T1::elem_type val, const Base<typename T1::elem_type,T1>& X ) (const typename T1::elem_type val, const T1& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return mtOp<uword, T1, op_rel_eq>(X.get_ref(), val); return mtOp<uword, T1, op_rel_eq>(X, val);
} }
template<typename T1> template<typename T1>
inline inline
const mtOp<uword, T1, op_rel_eq> typename
enable_if2
<
is_arma_type<T1>::value,
const mtOp<uword, T1, op_rel_eq>
>::result
operator== operator==
(const Base<typename T1::elem_type,T1>& X, const typename T1::elem_type val ) (const T1& X, const typename T1::elem_type val)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return mtOp<uword, T1, op_rel_eq>(X.get_ref(), val); return mtOp<uword, T1, op_rel_eq>(X, val);
} }
template<typename T1> template<typename T1>
inline inline
const mtOp<uword, T1, op_rel_noteq> typename
enable_if2
<
is_arma_type<T1>::value,
const mtOp<uword, T1, op_rel_noteq>
>::result
operator!= operator!=
(const typename T1::elem_type val, const Base<typename T1::elem_type,T1>& X ) (const typename T1::elem_type val, const T1& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return mtOp<uword, T1, op_rel_noteq>(X.get_ref(), val); return mtOp<uword, T1, op_rel_noteq>(X, val);
} }
template<typename T1> template<typename T1>
inline inline
const mtOp<uword, T1, op_rel_noteq> typename
enable_if2
<
is_arma_type<T1>::value,
const mtOp<uword, T1, op_rel_noteq>
>::result
operator!= operator!=
(const Base<typename T1::elem_type,T1>& X, const typename T1::elem_type val ) (const T1& X, const typename T1::elem_type val)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return mtOp<uword, T1, op_rel_noteq>(X.get_ref(), val); return mtOp<uword, T1, op_rel_noteq>(X, val);
} }
//! @} //! @}
 End of changes. 55 change blocks. 
56 lines changed or deleted 162 lines changed or added


 operator_schur.hpp   operator_schur.hpp 
// Copyright (C) 2008-2010 NICTA (www.nicta.com.au) // Copyright (C) 2008-2012 NICTA (www.nicta.com.au)
// Copyright (C) 2008-2010 Conrad Sanderson // Copyright (C) 2008-2012 Conrad Sanderson
// //
// This file is part of the Armadillo C++ library. // This file is part of the Armadillo C++ library.
// It is provided without any warranty of fitness // It is provided without any warranty of fitness
// for any purpose. You can redistribute this file // for any purpose. You can redistribute this file
// and/or modify it under the terms of the GNU // and/or modify it under the terms of the GNU
// Lesser General Public License (LGPL) as published // Lesser General Public License (LGPL) as published
// by the Free Software Foundation, either version 3 // by the Free Software Foundation, either version 3
// of the License or (at your option) any later version. // of the License or (at your option) any later version.
// (see http://www.opensource.org/licenses for more info) // (see http://www.opensource.org/licenses for more info)
//! \addtogroup operator_schur //! \addtogroup operator_schur
//! @{ //! @{
// operator %, which we define it to do a schur product (element-wise multi plication) // operator %, which we define it to do a schur product (element-wise multi plication)
//! element-wise multiplication of Base objects with same element type //! element-wise multiplication of user-accessible Armadillo objects with s ame element type
template<typename T1, typename T2> template<typename T1, typename T2>
arma_inline arma_inline
const eGlue<T1, T2, eglue_schur> typename
enable_if2
<
is_arma_type<T1>::value && is_arma_type<T2>::value && is_same_type<typena
me T1::elem_type, typename T2::elem_type>::value,
const eGlue<T1, T2, eglue_schur>
>::result
operator% operator%
( (
const Base<typename T1::elem_type,T1>& X, const T1& X,
const Base<typename T1::elem_type,T2>& Y const T2& Y
) )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return eGlue<T1, T2, eglue_schur>(X.get_ref(), Y.get_ref()); return eGlue<T1, T2, eglue_schur>(X, Y);
} }
//! element-wise multiplication of Base objects with different element type s //! element-wise multiplication of user-accessible Armadillo objects with d ifferent element types
template<typename T1, typename T2> template<typename T1, typename T2>
inline inline
const mtGlue<typename promote_type<typename T1::elem_type, typename T2::ele typename
m_type>::result, T1, T2, glue_mixed_schur> enable_if2
<
(is_arma_type<T1>::value && is_arma_type<T2>::value && (is_same_type<type
name T1::elem_type, typename T2::elem_type>::value == false)),
const mtGlue<typename promote_type<typename T1::elem_type, typename T2::e
lem_type>::result, T1, T2, glue_mixed_schur>
>::result
operator% operator%
( (
const Base< typename force_different_type<typename T1::elem_type, typenam const T1& X,
e T2::elem_type>::T1_result, T1>& X, const T2& Y
const Base< typename force_different_type<typename T1::elem_type, typenam
e T2::elem_type>::T2_result, T2>& Y
) )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT1; typedef typename T1::elem_type eT1;
typedef typename T2::elem_type eT2; typedef typename T2::elem_type eT2;
typedef typename promote_type<eT1,eT2>::result out_eT; typedef typename promote_type<eT1,eT2>::result out_eT;
promote_type<eT1,eT2>::check(); promote_type<eT1,eT2>::check();
return mtGlue<out_eT, T1, T2, glue_mixed_schur>( X.get_ref(), Y.get_ref() ); return mtGlue<out_eT, T1, T2, glue_mixed_schur>( X, Y );
} }
//! @} //! @}
 End of changes. 9 change blocks. 
15 lines changed or deleted 25 lines changed or added


 operator_times.hpp   operator_times.hpp 
skipping to change at line 19 skipping to change at line 19
// by the Free Software Foundation, either version 3 // by the Free Software Foundation, either version 3
// of the License or (at your option) any later version. // of the License or (at your option) any later version.
// (see http://www.opensource.org/licenses for more info) // (see http://www.opensource.org/licenses for more info)
//! \addtogroup operator_times //! \addtogroup operator_times
//! @{ //! @{
//! Base * scalar //! Base * scalar
template<typename T1> template<typename T1>
arma_inline arma_inline
const eOp<T1, eop_scalar_times> typename enable_if2< is_arma_type<T1>::value, const eOp<T1, eop_scalar_time s> >::result
operator* operator*
(const Base<typename T1::elem_type,T1>& X, const typename T1::elem_type k) (const T1& X, const typename T1::elem_type k)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return eOp<T1, eop_scalar_times>(X.get_ref(),k); return eOp<T1, eop_scalar_times>(X,k);
} }
//! scalar * Base //! scalar * Base
template<typename T1> template<typename T1>
arma_inline arma_inline
const eOp<T1, eop_scalar_times> typename enable_if2< is_arma_type<T1>::value, const eOp<T1, eop_scalar_time s> >::result
operator* operator*
(const typename T1::elem_type k, const Base<typename T1::elem_type,T1>& X) (const typename T1::elem_type k, const T1& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return eOp<T1, eop_scalar_times>(X.get_ref(),k); // NOTE: order is swapp ed return eOp<T1, eop_scalar_times>(X,k); // NOTE: order is swapped
} }
//! non-complex Base * complex scalar (experimental) //! non-complex Base * complex scalar
template<typename T1> template<typename T1>
arma_inline arma_inline
const mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar_t typename
imes> enable_if2
<
(is_arma_type<T1>::value && is_complex<typename T1::elem_type>::value ==
false),
const mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar
_times>
>::result
operator* operator*
( (
const Base<typename T1::pod_type, T1>& X, const T1& X,
const std::complex<typename T1::pod_type>& k const std::complex<typename T1::pod_type>& k
) )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scala r_times>('j', X.get_ref(), k); return mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scala r_times>('j', X, k);
} }
//! complex scalar * non-complex Base (experimental) //! complex scalar * non-complex Base
template<typename T1> template<typename T1>
arma_inline arma_inline
const mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar_t typename
imes> enable_if2
<
(is_arma_type<T1>::value && is_complex<typename T1::elem_type>::value ==
false),
const mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scalar
_times>
>::result
operator* operator*
( (
const std::complex<typename T1::pod_type>& k, const std::complex<typename T1::pod_type>& k,
const Base<typename T1::pod_type, T1>& X const T1& X
) )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scala r_times>('j', X.get_ref(), k); return mtOp<typename std::complex<typename T1::pod_type>, T1, op_cx_scala r_times>('j', X, k);
} }
//! scalar * trans(T1) //! scalar * trans(T1)
template<typename T1> template<typename T1>
arma_inline arma_inline
const Op<T1, op_htrans2> const Op<T1, op_htrans2>
operator* operator*
(const typename T1::elem_type k, const Op<T1, op_htrans>& X) (const typename T1::elem_type k, const Op<T1, op_htrans>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
skipping to change at line 97 skipping to change at line 107
(const Op<T1, op_htrans>& X, const typename T1::elem_type k) (const Op<T1, op_htrans>& X, const typename T1::elem_type k)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return Op<T1, op_htrans2>(X.m, k); return Op<T1, op_htrans2>(X.m, k);
} }
//! Base * diagmat //! Base * diagmat
template<typename T1, typename T2> template<typename T1, typename T2>
arma_inline arma_inline
const Glue<T1, Op<T2, op_diagmat>, glue_times_diag> typename
enable_if2
<
(is_arma_type<T1>::value && is_same_type<typename T1::elem_type, typename
T2::elem_type>::value),
const Glue<T1, Op<T2, op_diagmat>, glue_times_diag>
>::result
operator* operator*
(const Base<typename T2::elem_type,T1>& X, const Op<T2, op_diagmat>& Y) (const T1& X, const Op<T2, op_diagmat>& Y)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return Glue<T1, Op<T2, op_diagmat>, glue_times_diag>(X.get_ref(), Y); return Glue<T1, Op<T2, op_diagmat>, glue_times_diag>(X, Y);
} }
//! diagmat * Base //! diagmat * Base
template<typename T1, typename T2> template<typename T1, typename T2>
arma_inline arma_inline
const Glue<Op<T1, op_diagmat>, T2, glue_times_diag> typename
enable_if2
<
(is_arma_type<T2>::value && is_same_type<typename T1::elem_type, typename
T2::elem_type>::value),
const Glue<Op<T1, op_diagmat>, T2, glue_times_diag>
>::result
operator* operator*
(const Op<T1, op_diagmat>& X, const Base<typename T1::elem_type,T2>& Y) (const Op<T1, op_diagmat>& X, const T2& Y)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return Glue<Op<T1, op_diagmat>, T2, glue_times_diag>(X, Y.get_ref()); return Glue<Op<T1, op_diagmat>, T2, glue_times_diag>(X, Y);
} }
//! diagmat * diagmat //! diagmat * diagmat
template<typename T1, typename T2> template<typename T1, typename T2>
arma_inline arma_inline
Mat< typename promote_type<typename T1::elem_type, typename T2::elem_type>: :result > Mat< typename promote_type<typename T1::elem_type, typename T2::elem_type>: :result >
operator* operator*
(const Op<T1, op_diagmat>& X, const Op<T2, op_diagmat>& Y) (const Op<T1, op_diagmat>& X, const Op<T2, op_diagmat>& Y)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
skipping to change at line 156 skipping to change at line 176
{ {
out.at(i,i) = upgrade_val<eT1,eT2>::apply( A[i] ) * upgrade_val<eT1,eT2 >::apply( B[i] ); out.at(i,i) = upgrade_val<eT1,eT2>::apply( A[i] ) * upgrade_val<eT1,eT2 >::apply( B[i] );
} }
return out; return out;
} }
//! multiplication of Base objects with same element type //! multiplication of Base objects with same element type
template<typename T1, typename T2> template<typename T1, typename T2>
arma_inline arma_inline
const Glue<T1, T2, glue_times> typename
enable_if2
<
is_arma_type<T1>::value && is_arma_type<T2>::value && is_same_type<typena
me T1::elem_type, typename T2::elem_type>::value,
const Glue<T1, T2, glue_times>
>::result
operator* operator*
(const Base<typename T1::elem_type,T1>& X, const Base<typename T1::elem_typ e,T2>& Y) (const T1& X, const T2& Y)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return Glue<T1, T2, glue_times>(X.get_ref(), Y.get_ref()); return Glue<T1, T2, glue_times>(X, Y);
} }
//! multiplication of Base objects with different element types //! multiplication of Base objects with different element types
template<typename T1, typename T2> template<typename T1, typename T2>
inline inline
const mtGlue< typename promote_type<typename T1::elem_type, typename T2::el typename
em_type>::result, T1, T2, glue_mixed_times > enable_if2
<
(is_arma_type<T1>::value && is_arma_type<T2>::value && (is_same_type<type
name T1::elem_type, typename T2::elem_type>::value == false)),
const mtGlue< typename promote_type<typename T1::elem_type, typename T2::
elem_type>::result, T1, T2, glue_mixed_times >
>::result
operator* operator*
( (
const Base< typename force_different_type<typename T1::elem_type, typenam const T1& X,
e T2::elem_type>::T1_result, T1>& X, const T2& Y
const Base< typename force_different_type<typename T1::elem_type, typenam
e T2::elem_type>::T2_result, T2>& Y
) )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT1; typedef typename T1::elem_type eT1;
typedef typename T2::elem_type eT2; typedef typename T2::elem_type eT2;
typedef typename promote_type<eT1,eT2>::result out_eT; typedef typename promote_type<eT1,eT2>::result out_eT;
promote_type<eT1,eT2>::check(); promote_type<eT1,eT2>::check();
return mtGlue<out_eT, T1, T2, glue_mixed_times>( X.get_ref(), Y.get_ref() ); return mtGlue<out_eT, T1, T2, glue_mixed_times>( X, Y );
} }
//
//
//
#undef armaObj
#undef armaObjA
#undef armaObjB
// TODO: add handling of scalar*trans(object)
// TODO: add handling of trans(object)*scalar
#undef arma_operator_obj_scalar
#undef arma_operator_scalar_obj
#undef arma_operator_obj_cx_scalar
#undef arma_operator_cx_scalar_obj
#undef arma_operator_obj_base
#undef arma_operator_base_obj
#undef arma_operator_obj_diagmat
#undef arma_operator_diagmat_obj
#undef arma_operator_obj1_obj2
#undef arma_operator_obj1_obj2_mixed
#define arma_operator_obj_scalar(armaObj) \
template<typename eT> \
arma_inline \
const eOp<armaObj<eT>, eop_scalar_times> \
operator* \
(const armaObj<eT>& X, const typename armaObj<eT>::elem_type k) \
{ \
arma_extra_debug_sigprint(); \
\
return eOp<armaObj<eT>, eop_scalar_times>(X, k); \
}
#define arma_operator_scalar_obj(armaObj) \
template<typename eT> \
arma_inline \
const eOp<armaObj<eT>, eop_scalar_times> \
operator* \
(const typename armaObj<eT>::elem_type k, const armaObj<eT>& X) \
{ \
arma_extra_debug_sigprint(); \
\
return eOp<armaObj<eT>, eop_scalar_times>(X, k); \
}
#define arma_operator_obj_cx_scalar(armaObj) \
template<typename eT> \
arma_inline \
const mtOp<typename std::complex<typename armaObj<eT>::pod_type>, armaObj<e
T>, op_cx_scalar_times> \
operator* \
( \
const armaObj<eT>& X, \
const std::complex<typename armaObj<eT>::pod_type>& k \
) \
{ \
arma_extra_debug_sigprint(); \
\
return mtOp<typename std::complex<typename armaObj<eT>::pod_type>, armaOb
j<eT>, op_cx_scalar_times>('j', X, k); \
}
#define arma_operator_cx_scalar_obj(armaObj) \
template<typename eT> \
arma_inline \
const mtOp<typename std::complex<typename armaObj<eT>::pod_type>, armaObj<e
T>, op_cx_scalar_times> \
operator* \
( \
const std::complex<typename armaObj<eT>::pod_type>& k, \
const armaObj<eT>& X \
) \
{ \
arma_extra_debug_sigprint(); \
\
return mtOp<typename std::complex<typename armaObj<eT>::pod_type>, armaOb
j<eT>, op_cx_scalar_times>('j', X, k); \
}
#define arma_operator_obj_base(armaObj) \
template<typename BT> \
arma_inline \
const Glue<armaObj<typename BT::elem_type>, BT, glue_times> \
operator* \
( \
const armaObj<typename BT::elem_type>& X, \
const Base<typename BT::elem_type, BT>& Y \
) \
{ \
arma_extra_debug_sigprint(); \
\
return Glue<armaObj<typename BT::elem_type>, BT, glue_times>(X, Y.get_ref
()); \
}
#define arma_operator_base_obj(armaObj) \
template<typename BT> \
arma_inline \
const Glue<BT, armaObj<typename BT::elem_type>, glue_times> \
operator* \
( \
const Base<typename BT::elem_type, BT>& X, \
const armaObj<typename BT::elem_type> & Y \
) \
{ \
arma_extra_debug_sigprint(); \
\
return Glue<BT, armaObj<typename BT::elem_type>, glue_times>(X.get_ref(),
Y); \
}
#define arma_operator_obj_diagmat(armaObj) \
template<typename T1> \
arma_inline \
const Glue< armaObj<typename T1::elem_type>, Op<T1, op_diagmat>, glue_times
_diag > \
operator* \
( \
const armaObj<typename T1::elem_type>& X, \
const Op<T1, op_diagmat>& Y \
) \
{ \
arma_extra_debug_sigprint(); \
\
return Glue< armaObj<typename T1::elem_type>, Op<T1, op_diagmat>, glue_ti
mes_diag >(X, Y); \
}
#define arma_operator_diagmat_obj(armaObj) \
template<typename T1> \
arma_inline \
const Glue< Op<T1, op_diagmat>, armaObj<typename T1::elem_type>, glue_times
_diag > \
operator* \
( \
const Op<T1, op_diagmat>& X, \
const armaObj<typename T1::elem_type>& Y \
) \
{ \
arma_extra_debug_sigprint(); \
\
return Glue< Op<T1, op_diagmat>, armaObj<typename T1::elem_type>, glue_ti
mes_diag >(X, Y); \
}
#define arma_operator_obj1_obj2(armaObjA, armaObjB) \
template<typename eT> \
arma_inline \
const Glue<armaObjA<eT>, armaObjB<eT>, glue_times> \
operator* \
( \
const armaObjA<eT>& X, \
const armaObjB<eT>& Y \
) \
{ \
arma_extra_debug_sigprint(); \
\
return Glue<armaObjA<eT>, armaObjB<eT>, glue_times>(X, Y); \
}
#define arma_operator_obj1_obj2_mixed(armaObjA, armaObjB) \
template<typename eT1, typename eT2> \
inline \
const mtGlue<typename promote_type<eT1, eT2>::result, armaObjA<eT1>, armaOb
jB<eT2>, glue_mixed_times> \
operator* \
( \
const armaObjA<eT1>& X, \
const armaObjB<eT2>& Y \
) \
{ \
arma_extra_debug_sigprint(); \
\
typedef typename promote_type<eT1,eT2>::result out_eT; \
\
promote_type<eT1,eT2>::check(); \
\
return mtGlue<out_eT, armaObjA<eT1>, armaObjB<eT2>, glue_mixed_times>( X,
Y ); \
}
arma_operator_obj_scalar(Col)
arma_operator_obj_scalar(Row)
arma_operator_obj_scalar(diagview)
arma_operator_obj_scalar(subview_col)
arma_operator_obj_scalar(subview_row)
arma_operator_scalar_obj(Col)
arma_operator_scalar_obj(Row)
arma_operator_scalar_obj(diagview)
arma_operator_scalar_obj(subview_col)
arma_operator_scalar_obj(subview_row)
arma_operator_obj_cx_scalar(Col)
arma_operator_obj_cx_scalar(Row)
arma_operator_obj_cx_scalar(diagview)
arma_operator_obj_cx_scalar(subview_col)
arma_operator_obj_cx_scalar(subview_row)
arma_operator_cx_scalar_obj(Col)
arma_operator_cx_scalar_obj(Row)
arma_operator_cx_scalar_obj(diagview)
arma_operator_cx_scalar_obj(subview_col)
arma_operator_cx_scalar_obj(subview_row)
arma_operator_obj_base(Col)
arma_operator_obj_base(Row)
arma_operator_obj_base(diagview)
arma_operator_obj_base(subview_col)
arma_operator_obj_base(subview_row)
arma_operator_base_obj(Col)
arma_operator_base_obj(Row)
arma_operator_base_obj(diagview)
arma_operator_base_obj(subview_col)
arma_operator_base_obj(subview_row)
arma_operator_obj_diagmat(Col)
arma_operator_obj_diagmat(Row)
arma_operator_obj_diagmat(diagview)
arma_operator_obj_diagmat(subview_col)
arma_operator_obj_diagmat(subview_row)
arma_operator_diagmat_obj(Col)
arma_operator_diagmat_obj(Row)
arma_operator_diagmat_obj(diagview)
arma_operator_diagmat_obj(subview_col)
arma_operator_diagmat_obj(subview_row)
arma_operator_obj1_obj2(Col,Col)
arma_operator_obj1_obj2(Col,Row)
arma_operator_obj1_obj2(Col,diagview)
arma_operator_obj1_obj2(Col,subview_col)
arma_operator_obj1_obj2(Col,subview_row)
arma_operator_obj1_obj2(Row,Col)
arma_operator_obj1_obj2(Row,Row)
arma_operator_obj1_obj2(Row,diagview)
arma_operator_obj1_obj2(Row,subview_col)
arma_operator_obj1_obj2(Row,subview_row)
arma_operator_obj1_obj2(diagview,Col)
arma_operator_obj1_obj2(diagview,Row)
arma_operator_obj1_obj2(diagview,diagview)
arma_operator_obj1_obj2(diagview,subview_col)
arma_operator_obj1_obj2(diagview,subview_row)
arma_operator_obj1_obj2(subview_col,Col)
arma_operator_obj1_obj2(subview_col,Row)
arma_operator_obj1_obj2(subview_col,diagview)
arma_operator_obj1_obj2(subview_col,subview_col)
arma_operator_obj1_obj2(subview_col,subview_row)
arma_operator_obj1_obj2(subview_row,Col)
arma_operator_obj1_obj2(subview_row,Row)
arma_operator_obj1_obj2(subview_row,diagview)
arma_operator_obj1_obj2(subview_row,subview_col)
arma_operator_obj1_obj2(subview_row,subview_row)
arma_operator_obj1_obj2_mixed(Col,Col)
arma_operator_obj1_obj2_mixed(Col,Row)
arma_operator_obj1_obj2_mixed(Col,diagview)
arma_operator_obj1_obj2_mixed(Col,subview_col)
arma_operator_obj1_obj2_mixed(Col,subview_row)
arma_operator_obj1_obj2_mixed(Row,Col)
arma_operator_obj1_obj2_mixed(Row,Row)
arma_operator_obj1_obj2_mixed(Row,diagview)
arma_operator_obj1_obj2_mixed(Row,subview_col)
arma_operator_obj1_obj2_mixed(Row,subview_row)
arma_operator_obj1_obj2_mixed(diagview,Col)
arma_operator_obj1_obj2_mixed(diagview,Row)
arma_operator_obj1_obj2_mixed(diagview,diagview)
arma_operator_obj1_obj2_mixed(diagview,subview_col)
arma_operator_obj1_obj2_mixed(diagview,subview_row)
arma_operator_obj1_obj2_mixed(subview_col,Col)
arma_operator_obj1_obj2_mixed(subview_col,Row)
arma_operator_obj1_obj2_mixed(subview_col,diagview)
arma_operator_obj1_obj2_mixed(subview_col,subview_col)
arma_operator_obj1_obj2_mixed(subview_col,subview_row)
arma_operator_obj1_obj2_mixed(subview_row,Col)
arma_operator_obj1_obj2_mixed(subview_row,Row)
arma_operator_obj1_obj2_mixed(subview_row,diagview)
arma_operator_obj1_obj2_mixed(subview_row,subview_col)
arma_operator_obj1_obj2_mixed(subview_row,subview_row)
// TODO: explicit handling of subview_elem1, perhaps via expanding the abov
e macros to take another paramater (for template<T1>)
//! @} //! @}
 End of changes. 27 change blocks. 
324 lines changed or deleted 66 lines changed or added


 podarray_meat.hpp   podarray_meat.hpp 
skipping to change at line 24 skipping to change at line 24
//! @{ //! @{
template<typename eT> template<typename eT>
inline inline
podarray<eT>::~podarray() podarray<eT>::~podarray()
{ {
arma_extra_debug_sigprint_this(this); arma_extra_debug_sigprint_this(this);
if(n_elem > sizeof(mem_local)/sizeof(eT) ) if(n_elem > sizeof(mem_local)/sizeof(eT) )
{ {
delete [] mem; memory::release( access::rw(mem) );
} }
if(arma_config::debug == true) if(arma_config::debug == true)
{ {
access::rw(n_elem) = 0; access::rw(n_elem) = 0;
access::rw(mem) = 0; access::rw(mem) = 0;
} }
} }
template<typename eT> template<typename eT>
skipping to change at line 329 skipping to change at line 329
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
if(n_elem == new_n_elem) if(n_elem == new_n_elem)
{ {
return; return;
} }
if(n_elem > sizeof(mem_local)/sizeof(eT) ) if(n_elem > sizeof(mem_local)/sizeof(eT) )
{ {
delete [] mem; memory::release( access::rw(mem) );
} }
if(new_n_elem <= sizeof(mem_local)/sizeof(eT) ) if(new_n_elem <= sizeof(mem_local)/sizeof(eT) )
{ {
access::rw(mem) = mem_local; access::rw(mem) = mem_local;
} }
else else
{ {
access::rw(mem) = new eT[new_n_elem]; access::rw(mem) = memory::acquire<eT>(new_n_elem);
arma_check_bad_alloc( (mem == 0), "podarray::init(): out of memory" );
} }
access::rw(n_elem) = new_n_elem; access::rw(n_elem) = new_n_elem;
} }
//! @} //! @}
 End of changes. 3 change blocks. 
3 lines changed or deleted 5 lines changed or added


 restrictors.hpp   restrictors.hpp 
skipping to change at line 109 skipping to change at line 109
template<typename T> struct arma_not_cx { typedef T resu lt; }; template<typename T> struct arma_not_cx { typedef T resu lt; };
template<typename T> struct arma_not_cx< std::complex<T> > { }; template<typename T> struct arma_not_cx< std::complex<T> > { };
template<typename T> struct arma_blas_type_only { }; template<typename T> struct arma_blas_type_only { };
template<> struct arma_blas_type_only< float > { typedef flo at result; }; template<> struct arma_blas_type_only< float > { typedef flo at result; };
template<> struct arma_blas_type_only< double > { typedef dou ble result; }; template<> struct arma_blas_type_only< double > { typedef dou ble result; };
template<> struct arma_blas_type_only< std::complex<float> > { typedef std ::complex<float> result; }; template<> struct arma_blas_type_only< std::complex<float> > { typedef std ::complex<float> result; };
template<> struct arma_blas_type_only< std::complex<double> > { typedef std ::complex<double> result; }; template<> struct arma_blas_type_only< std::complex<double> > { typedef std ::complex<double> result; };
template<typename T> struct arma_not_blas_type { typedef T result; };
template<> struct arma_not_blas_type< float > { };
template<> struct arma_not_blas_type< double > { };
template<> struct arma_not_blas_type< std::complex<float> > { };
template<> struct arma_not_blas_type< std::complex<double> > { };
template<typename T> struct arma_op_rel_only { }; template<typename T> struct arma_op_rel_only { };
template<> struct arma_op_rel_only< op_rel_lt_pre > { typedef int result ; }; template<> struct arma_op_rel_only< op_rel_lt_pre > { typedef int result ; };
template<> struct arma_op_rel_only< op_rel_lt_post > { typedef int result ; }; template<> struct arma_op_rel_only< op_rel_lt_post > { typedef int result ; };
template<> struct arma_op_rel_only< op_rel_gt_pre > { typedef int result ; }; template<> struct arma_op_rel_only< op_rel_gt_pre > { typedef int result ; };
template<> struct arma_op_rel_only< op_rel_gt_post > { typedef int result ; }; template<> struct arma_op_rel_only< op_rel_gt_post > { typedef int result ; };
template<> struct arma_op_rel_only< op_rel_lteq_pre > { typedef int result ; }; template<> struct arma_op_rel_only< op_rel_lteq_pre > { typedef int result ; };
template<> struct arma_op_rel_only< op_rel_lteq_post > { typedef int result ; }; template<> struct arma_op_rel_only< op_rel_lteq_post > { typedef int result ; };
template<> struct arma_op_rel_only< op_rel_gteq_pre > { typedef int result ; }; template<> struct arma_op_rel_only< op_rel_gteq_pre > { typedef int result ; };
template<> struct arma_op_rel_only< op_rel_gteq_post > { typedef int result ; }; template<> struct arma_op_rel_only< op_rel_gteq_post > { typedef int result ; };
 End of changes. 1 change blocks. 
0 lines changed or deleted 7 lines changed or added


 strip.hpp   strip.hpp 
// Copyright (C) 2010-2011 NICTA (www.nicta.com.au) // Copyright (C) 2010-2012 NICTA (www.nicta.com.au)
// Copyright (C) 2010-2011 Conrad Sanderson // Copyright (C) 2010-2012 Conrad Sanderson
// //
// This file is part of the Armadillo C++ library. // This file is part of the Armadillo C++ library.
// It is provided without any warranty of fitness // It is provided without any warranty of fitness
// for any purpose. You can redistribute this file // for any purpose. You can redistribute this file
// and/or modify it under the terms of the GNU // and/or modify it under the terms of the GNU
// Lesser General Public License (LGPL) as published // Lesser General Public License (LGPL) as published
// by the Free Software Foundation, either version 3 // by the Free Software Foundation, either version 3
// of the License or (at your option) any later version. // of the License or (at your option) any later version.
// (see http://www.opensource.org/licenses for more info) // (see http://www.opensource.org/licenses for more info)
skipping to change at line 59 skipping to change at line 59
struct strip_inv struct strip_inv
{ {
typedef T1 stored_type; typedef T1 stored_type;
inline strip_inv(const T1& X) inline strip_inv(const T1& X)
: M(X) : M(X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
} }
static const bool do_inv = false;
const T1& M; const T1& M;
static const bool slow = false;
static const bool do_inv = false;
}; };
template<typename T1> template<typename T1>
struct strip_inv< Op<T1, op_inv> > struct strip_inv< Op<T1, op_inv> >
{ {
typedef T1 stored_type; typedef T1 stored_type;
inline strip_inv(const Op<T1, op_inv>& X) inline strip_inv(const Op<T1, op_inv>& X)
: M(X.m) : M(X.m)
, slow(X.aux_uword_a == 1)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
} }
static const bool do_inv = true; const T1& M;
const bool slow;
const T1& M; static const bool do_inv = true;
}; };
//! @} //! @}
 End of changes. 6 change blocks. 
6 lines changed or deleted 9 lines changed or added


 subview_bones.hpp   subview_bones.hpp 
skipping to change at line 89 skipping to change at line 89
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 in_row, const uword in_col); inline eT& operator()(const uword in_row, const uword in_col);
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;
inline eT& at_slow(const uword in_row, const uword in_col);
inline eT at_slow(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 bool is_vec() 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;
skipping to change at line 176 skipping to change at line 179
class subview_col : public subview<eT> class subview_col : public subview<eT>
{ {
public: public:
typedef eT elem_type; typedef eT elem_type;
typedef typename get_pod_type<elem_type>::result pod_type; typedef typename get_pod_type<elem_type>::result pod_type;
static const bool is_row = false; static const bool is_row = false;
static const bool is_col = true; static const bool is_col = true;
const eT* colmem;
inline void operator= (const subview<eT>& x); inline void operator= (const subview<eT>& x);
inline void operator= (const subview_col& x); inline void operator= (const subview_col& x);
template<typename T1> template<typename T1>
inline void operator= (const Base<eT,T1>& x); inline void operator= (const Base<eT,T1>& x);
arma_inline const Op<subview_col<eT>,op_htrans> t() const; arma_inline const Op<subview_col<eT>,op_htrans> t() const;
arma_inline const Op<subview_col<eT>,op_htrans> ht() const; arma_inline const Op<subview_col<eT>,op_htrans> ht() const;
arma_inline const Op<subview_col<eT>,op_strans> st() const; arma_inline const Op<subview_col<eT>,op_strans> st() const;
inline eT& operator[](const uword i);
inline eT operator[](const uword i) const;
inline eT& operator()(const uword i);
inline eT operator()(const uword i) const;
inline eT& operator()(const uword in_row, const uword in_col);
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) const;
arma_inline eT* colptr(const uword in_col);
arma_inline const eT* colptr(const uword in_col) const;
inline subview_col<eT> rows(const uword in_row1, const uword in_row 2); inline subview_col<eT> rows(const uword in_row1, const uword in_row 2);
inline const subview_col<eT> rows(const uword in_row1, const uword in_row 2) const; inline const subview_col<eT> rows(const uword in_row1, const uword in_row 2) const;
inline subview_col<eT> subvec(const uword in_row1, const uword in_r ow2); inline subview_col<eT> subvec(const uword in_row1, const uword in_r ow2);
inline const subview_col<eT> subvec(const uword in_row1, const uword in_r ow2) const; inline const subview_col<eT> subvec(const uword in_row1, const uword in_r ow2) const;
protected: protected:
inline subview_col(const Mat<eT>& in_m, const uword in_col); inline subview_col(const Mat<eT>& in_m, const uword in_col);
inline subview_col(const Mat<eT>& in_m, const uword in_col, const uword i n_row1, const uword in_n_rows); inline subview_col(const Mat<eT>& in_m, const uword in_col, const uword i n_row1, const uword in_n_rows);
skipping to change at line 227 skipping to change at line 247
inline void operator= (const subview<eT>& x); inline void operator= (const subview<eT>& x);
inline void operator= (const subview_row& x); inline void operator= (const subview_row& x);
template<typename T1> template<typename T1>
inline void operator= (const Base<eT,T1>& x); inline void operator= (const Base<eT,T1>& x);
arma_inline const Op<subview_row<eT>,op_htrans> t() const; arma_inline const Op<subview_row<eT>,op_htrans> t() const;
arma_inline const Op<subview_row<eT>,op_htrans> ht() const; arma_inline const Op<subview_row<eT>,op_htrans> ht() const;
arma_inline const Op<subview_row<eT>,op_strans> st() const; arma_inline const Op<subview_row<eT>,op_strans> st() const;
inline eT& operator[](const uword i);
inline eT operator[](const uword i) const;
inline eT& operator()(const uword i);
inline eT operator()(const uword i) const;
inline eT& operator()(const uword in_row, const uword in_col);
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) const;
inline subview_row<eT> cols(const uword in_col1, const uword in_col 2); inline subview_row<eT> cols(const uword in_col1, const uword in_col 2);
inline const subview_row<eT> cols(const uword in_col1, const uword in_col 2) const; inline const subview_row<eT> cols(const uword in_col1, const uword in_col 2) const;
inline subview_row<eT> subvec(const uword in_col1, const uword in_c ol2); inline subview_row<eT> subvec(const uword in_col1, const uword in_c ol2);
inline const subview_row<eT> subvec(const uword in_col1, const uword in_c ol2) const; inline const subview_row<eT> subvec(const uword in_col1, const uword in_c ol2) const;
protected: protected:
inline subview_row(const Mat<eT>& in_m, const uword in_row); inline subview_row(const Mat<eT>& in_m, const uword in_row);
inline subview_row(const Mat<eT>& in_m, const uword in_row, const uword i n_col1, const uword in_n_cols); inline subview_row(const Mat<eT>& in_m, const uword in_row, const uword i n_col1, const uword in_n_cols);
 End of changes. 4 change blocks. 
0 lines changed or deleted 32 lines changed or added


 subview_meat.hpp   subview_meat.hpp 
skipping to change at line 247 skipping to change at line 247
A.at(row, start_col+j) = x_mem[j]; A.at(row, start_col+j) = x_mem[j];
} }
if(i < t_n_cols) if(i < t_n_cols)
{ {
A.at(row, start_col+i) = x_mem[i]; A.at(row, start_col+i) = x_mem[i];
} }
} }
else else
{ {
for(uword col=0; col<t_n_cols; ++col) for(uword col=0; col < t_n_cols; ++col)
{ {
arrayops::copy( t.colptr(col), x.colptr(col), t_n_rows ); arrayops::copy( t.colptr(col), x.colptr(col), t_n_rows );
} }
} }
} }
else else
{ {
if(t_n_rows == 1) if(t_n_rows == 1)
{ {
Mat<eT>& A = const_cast< Mat<eT>& >(m); Mat<eT>& A = const_cast< Mat<eT>& >(m);
skipping to change at line 353 skipping to change at line 353
A.at(row, start_col+j) += x_mem[j]; A.at(row, start_col+j) += x_mem[j];
} }
if(i < t_n_cols) if(i < t_n_cols)
{ {
A.at(row, start_col+i) += x_mem[i]; A.at(row, start_col+i) += x_mem[i];
} }
} }
else else
{ {
for(uword col=0; col<t_n_cols; ++col) for(uword col=0; col < t_n_cols; ++col)
{ {
arrayops::inplace_plus( t.colptr(col), x.colptr(col), t_n_rows ); arrayops::inplace_plus( t.colptr(col), x.colptr(col), t_n_rows );
} }
} }
} }
else else
{ {
if(t_n_rows == 1) if(t_n_rows == 1)
{ {
Mat<eT>& A = const_cast< Mat<eT>& >(m); Mat<eT>& A = const_cast< Mat<eT>& >(m);
skipping to change at line 457 skipping to change at line 457
A.at(row, start_col+j) -= x_mem[j]; A.at(row, start_col+j) -= x_mem[j];
} }
if(i < t_n_cols) if(i < t_n_cols)
{ {
A.at(row, start_col+i) -= x_mem[i]; A.at(row, start_col+i) -= x_mem[i];
} }
} }
else else
{ {
for(uword col=0; col<t_n_cols; ++col) for(uword col=0; col < t_n_cols; ++col)
{ {
arrayops::inplace_minus( t.colptr(col), x.colptr(col), t_n_rows ); arrayops::inplace_minus( t.colptr(col), x.colptr(col), t_n_rows );
} }
} }
} }
else else
{ {
if(t_n_rows == 1) if(t_n_rows == 1)
{ {
Mat<eT>& A = const_cast< Mat<eT>& >(m); Mat<eT>& A = const_cast< Mat<eT>& >(m);
skipping to change at line 563 skipping to change at line 563
A.at(row, start_col+j) *= x_mem[j]; A.at(row, start_col+j) *= x_mem[j];
} }
if(i < t_n_cols) if(i < t_n_cols)
{ {
A.at(row, start_col+i) *= x_mem[i]; A.at(row, start_col+i) *= x_mem[i];
} }
} }
else else
{ {
for(uword col=0; col<t_n_cols; ++col) for(uword col=0; col < t_n_cols; ++col)
{ {
arrayops::inplace_mul( t.colptr(col), x.colptr(col), t_n_rows ); arrayops::inplace_mul( t.colptr(col), x.colptr(col), t_n_rows );
} }
} }
} }
else else
{ {
if(t_n_rows == 1) if(t_n_rows == 1)
{ {
Mat<eT>& A = const_cast< Mat<eT>& >(m); Mat<eT>& A = const_cast< Mat<eT>& >(m);
skipping to change at line 669 skipping to change at line 669
A.at(row, start_col+j) /= x_mem[j]; A.at(row, start_col+j) /= x_mem[j];
} }
if(i < t_n_cols) if(i < t_n_cols)
{ {
A.at(row, start_col+i) /= x_mem[i]; A.at(row, start_col+i) /= x_mem[i];
} }
} }
else else
{ {
for(uword col=0; col<t_n_cols; ++col) for(uword col=0; col < t_n_cols; ++col)
{ {
arrayops::inplace_div( t.colptr(col), x.colptr(col), t_n_rows ); arrayops::inplace_div( t.colptr(col), x.colptr(col), t_n_rows );
} }
} }
} }
else else
{ {
if(t_n_rows == 1) if(t_n_rows == 1)
{ {
Mat<eT>& A = const_cast< Mat<eT>& >(m); Mat<eT>& A = const_cast< Mat<eT>& >(m);
skipping to change at line 1072 skipping to change at line 1072
X.at(row, j) = val; X.at(row, j) = val;
} }
if(i < end_col_plus1) if(i < end_col_plus1)
{ {
X.at(row, i) = val; X.at(row, i) = val;
} }
} }
else else
{ {
for(uword col=0; col<local_n_cols; ++col) for(uword col=0; col < local_n_cols; ++col)
{ {
arrayops::inplace_set( colptr(col), val, local_n_rows ); arrayops::inplace_set( colptr(col), val, local_n_rows );
} }
} }
} }
template<typename eT> template<typename eT>
inline inline
void void
subview<eT>::zeros() subview<eT>::zeros()
skipping to change at line 1168 skipping to change at line 1168
inline inline
eT eT
subview<eT>::operator()(const uword i) const subview<eT>::operator()(const uword i) const
{ {
arma_debug_check( (i >= n_elem), "subview::operator(): index out of bound s"); arma_debug_check( (i >= n_elem), "subview::operator(): index out of bound s");
const uword in_col = i / n_rows; const uword in_col = i / n_rows;
const uword in_row = i % n_rows; const uword in_row = i % n_rows;
const uword index = (in_col + aux_col1)*m.n_rows + aux_row1 + in_row; const uword index = (in_col + aux_col1)*m.n_rows + aux_row1 + in_row;
return m.mem[index]; return m.mem[index];
} }
template<typename eT> template<typename eT>
inline inline
eT& eT&
subview<eT>::operator()(const uword in_row, const uword in_col) subview<eT>::operator()(const uword in_row, const uword in_col)
{ {
arma_debug_check( ((in_row >= n_rows) || (in_col >= n_cols)), "subview::o perator(): index out of bounds"); arma_debug_check( ((in_row >= n_rows) || (in_col >= n_cols)), "subview::o perator(): index out of bounds");
skipping to change at line 1211 skipping to change at line 1212
return access::rw( (const_cast< Mat<eT>& >(m)).mem[index] ); return access::rw( (const_cast< Mat<eT>& >(m)).mem[index] );
} }
template<typename eT> template<typename eT>
inline inline
eT eT
subview<eT>::at(const uword in_row, const uword in_col) const subview<eT>::at(const uword in_row, const uword in_col) const
{ {
const uword index = (in_col + aux_col1)*m.n_rows + aux_row1 + in_row; const uword index = (in_col + aux_col1)*m.n_rows + aux_row1 + in_row;
return m.mem[index];
}
template<typename eT>
inline
eT&
subview<eT>::at_slow(const uword in_row, const uword in_col)
{
const uword index = (in_col + aux_col1)*m.n_rows + aux_row1 + in_row;
return access::rw( (const_cast< Mat<eT>& >(m)).mem[index] );
}
template<typename eT>
inline
eT
subview<eT>::at_slow(const uword in_row, const uword in_col) const
{
const uword index = (in_col + aux_col1)*m.n_rows + aux_row1 + in_row;
return m.mem[index]; return m.mem[index];
} }
template<typename eT> template<typename eT>
arma_inline arma_inline
eT* eT*
subview<eT>::colptr(const uword in_col) subview<eT>::colptr(const uword in_col)
{ {
return & access::rw((const_cast< Mat<eT>& >(m)).mem[ (in_col + aux_col1)* m.n_rows + aux_row1 ]); return & access::rw((const_cast< Mat<eT>& >(m)).mem[ (in_col + aux_col1)* m.n_rows + aux_row1 ]);
} }
skipping to change at line 1334 skipping to change at line 1356
if(i < n_cols) if(i < n_cols)
{ {
out_mem[i] = X.at(row, start_col+i); out_mem[i] = X.at(row, start_col+i);
} }
} }
} }
else // general submatrix else // general submatrix
{ {
arma_extra_debug_print("subview::extract(): general submatrix"); arma_extra_debug_print("subview::extract(): general submatrix");
for(uword col = 0; col<n_cols; ++col) for(uword col=0; col < n_cols; ++col)
{ {
arrayops::copy( out.colptr(col), in.colptr(col), n_rows ); arrayops::copy( out.colptr(col), in.colptr(col), n_rows );
} }
} }
} }
//! X += Y.submat(...) //! X += Y.submat(...)
template<typename eT> template<typename eT>
inline inline
void void
skipping to change at line 1380 skipping to change at line 1402
out_mem[j] += tmp2; out_mem[j] += tmp2;
} }
if(i < n_cols) if(i < n_cols)
{ {
out_mem[i] += X.at(row, start_col+i); out_mem[i] += X.at(row, start_col+i);
} }
} }
else else
{ {
for(uword col=0; col<n_cols; ++col) for(uword col=0; col < n_cols; ++col)
{ {
arrayops::inplace_plus(out.colptr(col), in.colptr(col), n_rows); arrayops::inplace_plus(out.colptr(col), in.colptr(col), n_rows);
} }
} }
} }
//! X -= Y.submat(...) //! X -= Y.submat(...)
template<typename eT> template<typename eT>
inline inline
void void
skipping to change at line 1426 skipping to change at line 1448
out_mem[j] -= tmp2; out_mem[j] -= tmp2;
} }
if(i < n_cols) if(i < n_cols)
{ {
out_mem[i] -= X.at(row, start_col+i); out_mem[i] -= X.at(row, start_col+i);
} }
} }
else else
{ {
for(uword col=0; col<n_cols; ++col) for(uword col=0; col < n_cols; ++col)
{ {
arrayops::inplace_minus(out.colptr(col), in.colptr(col), n_rows); arrayops::inplace_minus(out.colptr(col), in.colptr(col), n_rows);
} }
} }
} }
//! X %= Y.submat(...) //! X %= Y.submat(...)
template<typename eT> template<typename eT>
inline inline
void void
skipping to change at line 1472 skipping to change at line 1494
out_mem[j] *= tmp2; out_mem[j] *= tmp2;
} }
if(i < n_cols) if(i < n_cols)
{ {
out_mem[i] *= X.at(row, start_col+i); out_mem[i] *= X.at(row, start_col+i);
} }
} }
else else
{ {
for(uword col=0; col<n_cols; ++col) for(uword col=0; col < n_cols; ++col)
{ {
arrayops::inplace_mul(out.colptr(col), in.colptr(col), n_rows); arrayops::inplace_mul(out.colptr(col), in.colptr(col), n_rows);
} }
} }
} }
//! X /= Y.submat(...) //! X /= Y.submat(...)
template<typename eT> template<typename eT>
inline inline
void void
skipping to change at line 1518 skipping to change at line 1540
out_mem[j] /= tmp2; out_mem[j] /= tmp2;
} }
if(i < n_cols) if(i < n_cols)
{ {
out_mem[i] /= X.at(row, start_col+i); out_mem[i] /= X.at(row, start_col+i);
} }
} }
else else
{ {
for(uword col=0; col<n_cols; ++col) for(uword col=0; col < n_cols; ++col)
{ {
arrayops::inplace_div(out.colptr(col), in.colptr(col), n_rows); arrayops::inplace_div(out.colptr(col), in.colptr(col), n_rows);
} }
} }
} }
//! creation of subview (row vector) //! creation of subview (row vector)
template<typename eT> template<typename eT>
inline inline
subview_row<eT> subview_row<eT>
skipping to change at line 2127 skipping to change at line 2149
// } // }
// //
// //
// //
template<typename eT> template<typename eT>
inline inline
subview_col<eT>::subview_col(const Mat<eT>& in_m, const uword in_col) subview_col<eT>::subview_col(const Mat<eT>& in_m, const uword in_col)
: subview<eT>(in_m, 0, in_col, in_m.n_rows, 1) : subview<eT>(in_m, 0, in_col, in_m.n_rows, 1)
, colmem(subview<eT>::colptr(0))
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
} }
template<typename eT> template<typename eT>
inline inline
subview_col<eT>::subview_col(const Mat<eT>& in_m, const uword in_col, const uword in_row1, const uword in_n_rows) subview_col<eT>::subview_col(const Mat<eT>& in_m, const uword in_col, const uword in_row1, const uword in_n_rows)
: subview<eT>(in_m, in_row1, in_col, in_n_rows, 1) : subview<eT>(in_m, in_row1, in_col, in_n_rows, 1)
, colmem(subview<eT>::colptr(0))
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
} }
template<typename eT> template<typename eT>
inline inline
void void
subview_col<eT>::operator=(const subview<eT>& X) subview_col<eT>::operator=(const subview<eT>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
subview<eT>::operator=(X); subview<eT>::operator=(X);
access::rw(colmem) = subview<eT>::colptr(0);
arma_debug_check( (subview<eT>::n_cols > 1), "subview_col(): incompatible dimensions" ); arma_debug_check( (subview<eT>::n_cols > 1), "subview_col(): incompatible dimensions" );
} }
template<typename eT> template<typename eT>
inline inline
void void
subview_col<eT>::operator=(const subview_col<eT>& X) subview_col<eT>::operator=(const subview_col<eT>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
subview<eT>::operator=(X); // interprets 'subview_col' as 'subview' subview<eT>::operator=(X); // interprets 'subview_col' as 'subview'
access::rw(colmem) = subview<eT>::colptr(0);
arma_debug_check( (subview<eT>::n_cols > 1), "subview_col(): incompatible dimensions" ); arma_debug_check( (subview<eT>::n_cols > 1), "subview_col(): incompatible dimensions" );
} }
template<typename eT> template<typename eT>
template<typename T1> template<typename T1>
inline inline
void void
subview_col<eT>::operator=(const Base<eT,T1>& X) subview_col<eT>::operator=(const Base<eT,T1>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
subview<eT>::operator=(X); subview<eT>::operator=(X);
access::rw(colmem) = subview<eT>::colptr(0);
arma_debug_check( (subview<eT>::n_cols > 1), "subview_col(): incompatible dimensions" ); arma_debug_check( (subview<eT>::n_cols > 1), "subview_col(): incompatible dimensions" );
} }
template<typename eT> template<typename eT>
arma_inline arma_inline
const Op<subview_col<eT>,op_htrans> const Op<subview_col<eT>,op_htrans>
subview_col<eT>::t() const subview_col<eT>::t() const
{ {
return Op<subview_col<eT>,op_htrans>(*this); return Op<subview_col<eT>,op_htrans>(*this);
} }
skipping to change at line 2199 skipping to change at line 2232
template<typename eT> template<typename eT>
arma_inline arma_inline
const Op<subview_col<eT>,op_strans> const Op<subview_col<eT>,op_strans>
subview_col<eT>::st() const subview_col<eT>::st() const
{ {
return Op<subview_col<eT>,op_strans>(*this); return Op<subview_col<eT>,op_strans>(*this);
} }
template<typename eT> template<typename eT>
inline inline
eT&
subview_col<eT>::operator[](const uword i)
{
return access::rw( colmem[i] );
}
template<typename eT>
inline
eT
subview_col<eT>::operator[](const uword i) const
{
return colmem[i];
}
template<typename eT>
inline
eT&
subview_col<eT>::operator()(const uword i)
{
arma_debug_check( (i >= subview<eT>::n_elem), "subview::operator(): index
out of bounds");
return access::rw( colmem[i] );
}
template<typename eT>
inline
eT
subview_col<eT>::operator()(const uword i) const
{
arma_debug_check( (i >= subview<eT>::n_elem), "subview::operator(): index
out of bounds");
return colmem[i];
}
template<typename eT>
inline
eT&
subview_col<eT>::operator()(const uword in_row, const uword in_col)
{
arma_debug_check( ((in_row >= subview<eT>::n_rows) || (in_col > 0)), "sub
view::operator(): index out of bounds");
return access::rw( colmem[in_row] );
}
template<typename eT>
inline
eT
subview_col<eT>::operator()(const uword in_row, const uword in_col) const
{
arma_debug_check( ((in_row >= subview<eT>::n_rows) || (in_col > 0)), "sub
view::operator(): index out of bounds");
return colmem[in_row];
}
template<typename eT>
inline
eT&
subview_col<eT>::at(const uword in_row, const uword)
{
return access::rw( colmem[in_row] );
}
template<typename eT>
inline
eT
subview_col<eT>::at(const uword in_row, const uword) const
{
return colmem[in_row];
}
template<typename eT>
arma_inline
eT*
subview_col<eT>::colptr(const uword)
{
return const_cast<eT*>(colmem);
}
template<typename eT>
arma_inline
const eT*
subview_col<eT>::colptr(const uword) const
{
return colmem;
}
template<typename eT>
inline
subview_col<eT> subview_col<eT>
subview_col<eT>::rows(const uword in_row1, const uword in_row2) subview_col<eT>::rows(const uword in_row1, const uword in_row2)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( ( (in_row1 > in_row2) || (in_row2 >= subview<eT>::n_row s) ), "subview_col::rows(): indices out of bounds or incorrectly used"); arma_debug_check( ( (in_row1 > in_row2) || (in_row2 >= subview<eT>::n_row s) ), "subview_col::rows(): indices out of bounds or incorrectly used");
const uword subview_n_rows = in_row2 - in_row1 + 1; const uword subview_n_rows = in_row2 - in_row1 + 1;
const uword base_row1 = this->aux_row1 + in_row1; const uword base_row1 = this->aux_row1 + in_row1;
skipping to change at line 2341 skipping to change at line 2462
template<typename eT> template<typename eT>
arma_inline arma_inline
const Op<subview_row<eT>,op_strans> const Op<subview_row<eT>,op_strans>
subview_row<eT>::st() const subview_row<eT>::st() const
{ {
return Op<subview_row<eT>,op_strans>(*this); return Op<subview_row<eT>,op_strans>(*this);
} }
template<typename eT> template<typename eT>
inline inline
eT&
subview_row<eT>::operator[](const uword i)
{
const uword index = (i + (subview<eT>::aux_col1))*(subview<eT>::m).n_rows
+ (subview<eT>::aux_row1);
return access::rw( (const_cast< Mat<eT>& >(subview<eT>::m)).mem[index] );
}
template<typename eT>
inline
eT
subview_row<eT>::operator[](const uword i) const
{
const uword index = (i + (subview<eT>::aux_col1))*(subview<eT>::m).n_rows
+ (subview<eT>::aux_row1);
return subview<eT>::m.mem[index];
}
template<typename eT>
inline
eT&
subview_row<eT>::operator()(const uword i)
{
arma_debug_check( (i >= subview<eT>::n_elem), "subview::operator(): index
out of bounds");
const uword index = (i + (subview<eT>::aux_col1))*(subview<eT>::m).n_rows
+ (subview<eT>::aux_row1);
return access::rw( (const_cast< Mat<eT>& >(subview<eT>::m)).mem[index] );
}
template<typename eT>
inline
eT
subview_row<eT>::operator()(const uword i) const
{
arma_debug_check( (i >= subview<eT>::n_elem), "subview::operator(): index
out of bounds");
const uword index = (i + (subview<eT>::aux_col1))*(subview<eT>::m).n_rows
+ (subview<eT>::aux_row1);
return subview<eT>::m.mem[index];
}
template<typename eT>
inline
eT&
subview_row<eT>::operator()(const uword in_row, const uword in_col)
{
arma_debug_check( ((in_row > 0) || (in_col >= subview<eT>::n_cols)), "sub
view::operator(): index out of bounds");
const uword index = (in_col + (subview<eT>::aux_col1))*(subview<eT>::m).n
_rows + (subview<eT>::aux_row1);
return access::rw( (const_cast< Mat<eT>& >(subview<eT>::m)).mem[index] );
}
template<typename eT>
inline
eT
subview_row<eT>::operator()(const uword in_row, const uword in_col) const
{
arma_debug_check( ((in_row > 0) || (in_col >= subview<eT>::n_cols)), "sub
view::operator(): index out of bounds");
const uword index = (in_col + (subview<eT>::aux_col1))*(subview<eT>::m).n
_rows + (subview<eT>::aux_row1);
return subview<eT>::m.mem[index];
}
template<typename eT>
inline
eT&
subview_row<eT>::at(const uword, const uword in_col)
{
const uword index = (in_col + (subview<eT>::aux_col1))*(subview<eT>::m).n
_rows + (subview<eT>::aux_row1);
return access::rw( (const_cast< Mat<eT>& >(subview<eT>::m)).mem[index] );
}
template<typename eT>
inline
eT
subview_row<eT>::at(const uword, const uword in_col) const
{
const uword index = (in_col + (subview<eT>::aux_col1))*(subview<eT>::m).n
_rows + (subview<eT>::aux_row1);
return subview<eT>::m.mem[index];
}
template<typename eT>
inline
subview_row<eT> subview_row<eT>
subview_row<eT>::cols(const uword in_col1, const uword in_col2) subview_row<eT>::cols(const uword in_col1, const uword in_col2)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( ( (in_col1 > in_col2) || (in_col2 >= subview<eT>::n_col s) ), "subview_row::cols(): indices out of bounds or incorrectly used" ); arma_debug_check( ( (in_col1 > in_col2) || (in_col2 >= subview<eT>::n_col s) ), "subview_row::cols(): indices out of bounds or incorrectly used" );
const uword subview_n_cols = in_col2 - in_col1 + 1; const uword subview_n_cols = in_col2 - in_col1 + 1;
const uword base_col1 = this->aux_col1 + in_col1; const uword base_col1 = this->aux_col1 + in_col1;
 End of changes. 20 change blocks. 
11 lines changed or deleted 236 lines changed or added


 traits.hpp   traits.hpp 
// Copyright (C) 2008-2011 NICTA (www.nicta.com.au) // Copyright (C) 2008-2012 NICTA (www.nicta.com.au)
// Copyright (C) 2008-2011 Conrad Sanderson // Copyright (C) 2008-2012 Conrad Sanderson
// //
// This file is part of the Armadillo C++ library. // This file is part of the Armadillo C++ library.
// It is provided without any warranty of fitness // It is provided without any warranty of fitness
// for any purpose. You can redistribute this file // for any purpose. You can redistribute this file
// and/or modify it under the terms of the GNU // and/or modify it under the terms of the GNU
// Lesser General Public License (LGPL) as published // Lesser General Public License (LGPL) as published
// by the Free Software Foundation, either version 3 // by the Free Software Foundation, either version 3
// of the License or (at your option) any later version. // of the License or (at your option) any later version.
// (see http://www.opensource.org/licenses for more info) // (see http://www.opensource.org/licenses for more info)
skipping to change at line 32 skipping to change at line 32
{ typedef T2 result; }; { typedef T2 result; };
template<typename T> template<typename T>
struct is_Mat_only struct is_Mat_only
{ static const bool value = false; }; { static const bool value = false; };
template<typename eT> template<typename eT>
struct is_Mat_only< Mat<eT> > struct is_Mat_only< Mat<eT> >
{ static const bool value = true; }; { static const bool value = true; };
template<typename eT>
struct is_Mat_only< const Mat<eT> >
{ static const bool value = true; };
template<typename T> template<typename T>
struct is_Mat struct is_Mat
{ static const bool value = false; }; { static const bool value = false; };
template<typename eT> template<typename eT>
struct is_Mat< Mat<eT> > struct is_Mat< Mat<eT> >
{ static const bool value = true; }; { static const bool value = true; };
template<typename eT> template<typename eT>
struct is_Mat< const Mat<eT> >
{ static const bool value = true; };
template<typename eT>
struct is_Mat< Row<eT> > struct is_Mat< Row<eT> >
{ static const bool value = true; }; { static const bool value = true; };
template<typename eT> template<typename eT>
struct is_Mat< const Row<eT> >
{ static const bool value = true; };
template<typename eT>
struct is_Mat< Col<eT> > struct is_Mat< Col<eT> >
{ static const bool value = true; }; { static const bool value = true; };
template<typename eT>
struct is_Mat< const Col<eT> >
{ static const bool value = true; };
template<typename T> template<typename T>
struct is_Row struct is_Row
{ static const bool value = false; }; { static const bool value = false; };
template<typename eT> template<typename eT>
struct is_Row< Row<eT> > struct is_Row< Row<eT> >
{ static const bool value = true; }; { static const bool value = true; };
template<typename eT>
struct is_Row< const Row<eT> >
{ static const bool value = true; };
template<typename T> template<typename T>
struct is_Col struct is_Col
{ static const bool value = false; }; { static const bool value = false; };
template<typename eT> template<typename eT>
struct is_Col< Col<eT> > struct is_Col< Col<eT> >
{ static const bool value = true; }; { static const bool value = true; };
template<typename eT>
struct is_Col< const Col<eT> >
{ static const bool value = true; };
template<typename T>
struct is_diagview
{ static const bool value = false; };
template<typename eT>
struct is_diagview< diagview<eT> >
{ static const bool value = true; };
template<typename eT>
struct is_diagview< const diagview<eT> >
{ static const bool value = true; };
template<typename T> template<typename T>
struct is_subview struct is_subview
{ static const bool value = false; }; { static const bool value = false; };
template<typename eT> template<typename eT>
struct is_subview< subview<eT> > struct is_subview< subview<eT> >
{ static const bool value = true; }; { static const bool value = true; };
template<typename eT>
struct is_subview< const subview<eT> >
{ static const bool value = true; };
template<typename T> template<typename T>
struct is_diagview struct is_subview_row
{ static const bool value = false; }; { static const bool value = false; };
template<typename eT> template<typename eT>
struct is_diagview< diagview<eT> > struct is_subview_row< subview_row<eT> >
{ static const bool value = true; };
template<typename eT>
struct is_subview_row< const subview_row<eT> >
{ static const bool value = true; };
template<typename T>
struct is_subview_col
{ static const bool value = false; };
template<typename eT>
struct is_subview_col< subview_col<eT> >
{ static const bool value = true; };
template<typename eT>
struct is_subview_col< const subview_col<eT> >
{ static const bool value = true; };
template<typename T>
struct is_subview_elem1
{ static const bool value = false; };
template<typename eT, typename T1>
struct is_subview_elem1< subview_elem1<eT, T1> >
{ static const bool value = true; };
template<typename eT, typename T1>
struct is_subview_elem1< const subview_elem1<eT, T1> >
{ static const bool value = true; };
template<typename T>
struct is_subview_elem2
{ static const bool value = false; };
template<typename eT, typename T1, typename T2>
struct is_subview_elem2< subview_elem2<eT, T1, T2> >
{ static const bool value = true; };
template<typename eT, typename T1, typename T2>
struct is_subview_elem2< const subview_elem2<eT, T1, T2> >
{ static const bool value = true; }; { static const bool value = true; };
// //
// //
// //
template<typename T> template<typename T>
struct is_Cube struct is_Cube
{ static const bool value = false; }; { static const bool value = false; };
skipping to change at line 108 skipping to change at line 188
{ static const bool value = true; }; { static const bool value = true; };
// //
// //
// //
template<typename T> template<typename T>
struct is_Gen struct is_Gen
{ static const bool value = false; }; { static const bool value = false; };
template<typename eT, typename gen_type> template<typename T1, typename gen_type>
struct is_Gen< Gen<eT,gen_type> > struct is_Gen< Gen<T1,gen_type> >
{ static const bool value = true; };
template<typename T1, typename gen_type>
struct is_Gen< const Gen<T1,gen_type> >
{ static const bool value = true; }; { static const bool value = true; };
template<typename T> template<typename T>
struct is_Op struct is_Op
{ static const bool value = false; }; { static const bool value = false; };
template<typename T1, typename op_type> template<typename T1, typename op_type>
struct is_Op< Op<T1,op_type> > struct is_Op< Op<T1,op_type> >
{ static const bool value = true; }; { static const bool value = true; };
template<typename T1, typename op_type>
struct is_Op< const Op<T1,op_type> >
{ static const bool value = true; };
template<typename T> template<typename T>
struct is_eOp struct is_eOp
{ static const bool value = false; }; { static const bool value = false; };
template<typename T1, typename eop_type> template<typename T1, typename eop_type>
struct is_eOp< eOp<T1,eop_type> > struct is_eOp< eOp<T1,eop_type> >
{ static const bool value = true; }; { static const bool value = true; };
template<typename T1, typename eop_type>
struct is_eOp< const eOp<T1,eop_type> >
{ static const bool value = true; };
template<typename T> template<typename T>
struct is_mtOp struct is_mtOp
{ static const bool value = false; }; { static const bool value = false; };
template<typename eT, typename T1, typename op_type> template<typename eT, typename T1, typename op_type>
struct is_mtOp< mtOp<eT, T1, op_type> > struct is_mtOp< mtOp<eT, T1, op_type> >
{ static const bool value = true; }; { static const bool value = true; };
template<typename eT, typename T1, typename op_type>
struct is_mtOp< const mtOp<eT, T1, op_type> >
{ static const bool value = true; };
template<typename T> template<typename T>
struct is_Glue struct is_Glue
{ static const bool value = false; }; { static const bool value = false; };
template<typename T1, typename T2, typename glue_type> template<typename T1, typename T2, typename glue_type>
struct is_Glue< Glue<T1,T2,glue_type> > struct is_Glue< Glue<T1,T2,glue_type> >
{ static const bool value = true; }; { static const bool value = true; };
template<typename T1, typename T2, typename glue_type>
struct is_Glue< const Glue<T1,T2,glue_type> >
{ static const bool value = true; };
template<typename T> template<typename T>
struct is_eGlue struct is_eGlue
{ static const bool value = false; }; { static const bool value = false; };
template<typename T1, typename T2, typename eglue_type> template<typename T1, typename T2, typename eglue_type>
struct is_eGlue< eGlue<T1,T2,eglue_type> > struct is_eGlue< eGlue<T1,T2,eglue_type> >
{ static const bool value = true; }; { static const bool value = true; };
template<typename T1, typename T2, typename eglue_type>
struct is_eGlue< const eGlue<T1,T2,eglue_type> >
{ static const bool value = true; };
template<typename T> template<typename T>
struct is_mtGlue struct is_mtGlue
{ static const bool value = false; }; { static const bool value = false; };
template<typename eT, typename T1, typename T2, typename glue_type> template<typename eT, typename T1, typename T2, typename glue_type>
struct is_mtGlue< mtGlue<eT, T1, T2, glue_type> > struct is_mtGlue< mtGlue<eT, T1, T2, glue_type> >
{ static const bool value = true; }; { static const bool value = true; };
template<typename eT, typename T1, typename T2, typename glue_type>
struct is_mtGlue< const mtGlue<eT, T1, T2, glue_type> >
{ static const bool value = true; };
// //
// //
template<typename T> template<typename T>
struct is_glue_times struct is_glue_times
{ static const bool value = false; }; { static const bool value = false; };
template<typename T1, typename T2> template<typename T1, typename T2>
struct is_glue_times< Glue<T1,T2,glue_times> > struct is_glue_times< Glue<T1,T2,glue_times> >
{ static const bool value = true; }; { static const bool value = true; };
template<typename T1, typename T2>
struct is_glue_times< const Glue<T1,T2,glue_times> >
{ static const bool value = true; };
template<typename T> template<typename T>
struct is_glue_times_diag struct is_glue_times_diag
{ static const bool value = false; }; { static const bool value = false; };
template<typename T1, typename T2> template<typename T1, typename T2>
struct is_glue_times_diag< Glue<T1,T2,glue_times_diag> > struct is_glue_times_diag< Glue<T1,T2,glue_times_diag> >
{ static const bool value = true; }; { static const bool value = true; };
template<typename T1, typename T2>
struct is_glue_times_diag< const Glue<T1,T2,glue_times_diag> >
{ static const bool value = true; };
template<typename T> template<typename T>
struct is_op_diagmat struct is_op_diagmat
{ static const bool value = false; }; { static const bool value = false; };
template<typename T1> template<typename T1>
struct is_op_diagmat< Op<T1,op_diagmat> > struct is_op_diagmat< Op<T1,op_diagmat> >
{ static const bool value = true; }; { static const bool value = true; };
template<typename T1>
struct is_op_diagmat< const Op<T1,op_diagmat> >
{ static const bool value = true; };
// //
// //
template<typename T> template<typename T>
struct is_GenCube struct is_GenCube
{ static const bool value = false; }; { static const bool value = false; };
template<typename eT, typename gen_type> template<typename eT, typename gen_type>
struct is_GenCube< GenCube<eT,gen_type> > struct is_GenCube< GenCube<eT,gen_type> >
{ static const bool value = true; }; { static const bool value = true; };
skipping to change at line 307 skipping to change at line 427
template<typename T> template<typename T>
struct is_basevec struct is_basevec
{ static const bool value = false; }; { static const bool value = false; };
template<typename eT> template<typename eT>
struct is_basevec< Row<eT> > struct is_basevec< Row<eT> >
{ static const bool value = true; }; { static const bool value = true; };
template<typename eT> template<typename eT>
struct is_basevec< const Row<eT> >
{ static const bool value = true; };
template<typename eT>
struct is_basevec< Col<eT> > struct is_basevec< Col<eT> >
{ static const bool value = true; }; { static const bool value = true; };
template<typename eT> template<typename eT>
struct is_basevec< const Col<eT> >
{ static const bool value = true; };
template<typename eT>
struct is_basevec< subview_row<eT> > struct is_basevec< subview_row<eT> >
{ static const bool value = true; }; { static const bool value = true; };
template<typename eT> template<typename eT>
struct is_basevec< const subview_row<eT> >
{ static const bool value = true; };
template<typename eT>
struct is_basevec< subview_col<eT> > struct is_basevec< subview_col<eT> >
{ static const bool value = true; }; { static const bool value = true; };
template<typename eT> template<typename eT>
struct is_basevec< const subview_col<eT> >
{ static const bool value = true; };
template<typename eT>
struct is_basevec< diagview<eT> > struct is_basevec< diagview<eT> >
{ static const bool value = true; }; { static const bool value = true; };
template<typename eT>
struct is_basevec< const diagview<eT> >
{ static const bool value = true; };
template<typename eT, typename T1> template<typename eT, typename T1>
struct is_basevec< subview_elem1<eT,T1> > struct is_basevec< subview_elem1<eT,T1> >
{ static const bool value = true; }; { static const bool value = true; };
template<typename eT, typename T1>
struct is_basevec< const subview_elem1<eT,T1> >
{ static const bool value = true; };
// //
// //
// //
template<typename T1> template<typename T1>
struct is_arma_type struct is_arma_type
{ {
static const bool value static const bool value
= is_Mat<T1>::value = is_Mat<T1>::value
|| is_Gen<T1>::value || is_Gen<T1>::value
|| is_Op<T1>::value || is_Op<T1>::value
|| is_eOp<T1>::value
|| is_mtOp<T1>::value
|| is_Glue<T1>::value || is_Glue<T1>::value
|| is_eOp<T1>::value
|| is_eGlue<T1>::value || is_eGlue<T1>::value
|| is_mtOp<T1>::value
|| is_mtGlue<T1>::value || is_mtGlue<T1>::value
|| is_subview<T1>::value
|| is_diagview<T1>::value || is_diagview<T1>::value
|| is_subview<T1>::value
|| is_subview_row<T1>::value
|| is_subview_col<T1>::value
|| is_subview_elem1<T1>::value
|| is_subview_elem2<T1>::value
; ;
}; };
template<typename T1> template<typename T1>
struct is_arma_cube_type struct is_arma_cube_type
{ {
static const bool value static const bool value
= is_Cube<T1>::value = is_Cube<T1>::value
|| is_GenCube<T1>::value || is_GenCube<T1>::value
|| is_OpCube<T1>::value || is_OpCube<T1>::value
 End of changes. 31 change blocks. 
9 lines changed or deleted 157 lines changed or added


 unwrap.hpp   unwrap.hpp 
skipping to change at line 1049 skipping to change at line 1049
}; };
template<typename T1> template<typename T1>
class partial_unwrap_check< Op<T1, op_htrans2> > class partial_unwrap_check< Op<T1, op_htrans2> >
{ {
public: public:
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
inline inline
partial_unwrap_check(const Op<T1,op_htrans2>& A, const Mat<eT>& B) partial_unwrap_check(const Op<T1,op_htrans2>& A, const Mat<eT>&)
: val(A.aux) : val(A.aux)
, M (A.m) , M (A.m)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
} }
inline inline
~partial_unwrap_check() ~partial_unwrap_check()
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 unwrap_cube.hpp   unwrap_cube.hpp 
skipping to change at line 58 skipping to change at line 58
// //
// //
// //
template<typename T1> template<typename T1>
class unwrap_cube_check class unwrap_cube_check
{ {
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
inline inline
unwrap_cube_check(const T1& A, const Cube<eT>& B) unwrap_cube_check(const T1& A, const Cube<eT>&)
: M(A) : M(A)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_type_check(( is_arma_cube_type<T1>::value == false )); arma_type_check(( is_arma_cube_type<T1>::value == false ));
} }
const Cube<eT> M; const Cube<eT> M;
}; };
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added

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