Col_bones.hpp   Col_bones.hpp 
skipping to change at line 40 skipping to change at line 40
inline Col(const Col<eT>& X); inline Col(const Col<eT>& X);
inline explicit Col(const uword n_elem); inline explicit Col(const uword n_elem);
inline Col(const uword in_rows, const uword in_cols); inline Col(const uword in_rows, const uword in_cols);
inline Col(const char* text); inline Col(const char* text);
inline const Col& operator=(const char* text); inline const Col& operator=(const char* text);
inline Col(const std::string& text); inline Col(const std::string& text);
inline const Col& operator=(const std::string& text); inline const Col& operator=(const std::string& text);
inline Col(const std::vector<eT>& x);
inline const Col& operator=(const std::vector<eT>& x);
#if defined(ARMA_USE_CXX11) #if defined(ARMA_USE_CXX11)
inline Col(const std::initializer_list<eT>& list); inline Col(const std::initializer_list<eT>& list);
inline const Col& operator=(const std::initializer_list<eT>& list); inline const Col& operator=(const std::initializer_list<eT>& list);
#endif #endif
inline const Col& operator=(const eT val); inline const Col& operator=(const eT val);
template<typename T1> inline Col(const Base<eT,T1>& X); template<typename T1> inline Col(const Base<eT,T1>& X);
template<typename T1> inline const Col& operator=(const Base<eT,T1>& X); template<typename T1> inline const Col& operator=(const Base<eT,T1>& X);
 End of changes. 1 change blocks. 
0 lines changed or deleted 3 lines changed or added


 Col_meat.hpp   Col_meat.hpp 
skipping to change at line 124 skipping to change at line 124
Mat<eT>::operator=(text); Mat<eT>::operator=(text);
std::swap( access::rw(Mat<eT>::n_rows), access::rw(Mat<eT>::n_cols) ); std::swap( access::rw(Mat<eT>::n_rows), access::rw(Mat<eT>::n_cols) );
access::rw(Mat<eT>::vec_state) = 1; access::rw(Mat<eT>::vec_state) = 1;
return *this; return *this;
} }
//! create a column vector from std::vector
template<typename eT>
inline
Col<eT>::Col(const std::vector<eT>& x)
: Mat<eT>(arma_vec_indicator(), uword(x.size()), 1, 1)
{
arma_extra_debug_sigprint_this(this);
arrayops::copy( Mat<eT>::memptr(), &(x[0]), uword(x.size()) );
}
//! create a column vector from std::vector
template<typename eT>
inline
const Col<eT>&
Col<eT>::operator=(const std::vector<eT>& x)
{
arma_extra_debug_sigprint();
Mat<eT>::init_warm(uword(x.size()), 1);
arrayops::copy( Mat<eT>::memptr(), &(x[0]), uword(x.size()) );
return *this;
}
#if defined(ARMA_USE_CXX11) #if defined(ARMA_USE_CXX11)
template<typename eT> template<typename eT>
inline inline
Col<eT>::Col(const std::initializer_list<eT>& list) Col<eT>::Col(const std::initializer_list<eT>& list)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
access::rw(Mat<eT>::vec_state) = 2; access::rw(Mat<eT>::vec_state) = 2;
 End of changes. 1 change blocks. 
0 lines changed or deleted 26 lines changed or added


 Mat_bones.hpp   Mat_bones.hpp 
skipping to change at line 58 skipping to change at line 58
inline Mat(); inline Mat();
inline Mat(const uword in_rows, const uword in_cols); inline Mat(const uword in_rows, const uword in_cols);
inline Mat(const char* text); inline Mat(const char* text);
inline const Mat& operator=(const char* text); inline const Mat& operator=(const char* text);
inline Mat(const std::string& text); inline Mat(const std::string& text);
inline const Mat& operator=(const std::string& text); inline const Mat& operator=(const std::string& text);
inline Mat(const std::vector<eT>& x);
inline const Mat& operator=(const std::vector<eT>& x);
#if defined(ARMA_USE_CXX11) #if defined(ARMA_USE_CXX11)
inline Mat(const std::initializer_list<eT>& list); inline Mat(const std::initializer_list<eT>& list);
inline const Mat& operator=(const std::initializer_list<eT>& list); inline const Mat& operator=(const std::initializer_list<eT>& list);
#endif #endif
inline Mat( eT* aux_mem, const uword aux_n_rows, const uword aux_n_c ols, const bool copy_aux_mem = true, const bool strict = true); inline Mat( eT* aux_mem, const uword aux_n_rows, const uword aux_n_c ols, const bool copy_aux_mem = true, const bool strict = true);
inline Mat(const eT* aux_mem, const uword aux_n_rows, const uword aux_n_c ols); inline Mat(const eT* aux_mem, const uword aux_n_rows, const uword aux_n_c ols);
arma_inline const Mat& operator=(const eT val); arma_inline const Mat& operator=(const eT val);
arma_inline const Mat& operator+=(const eT val); arma_inline const Mat& operator+=(const eT val);
 End of changes. 1 change blocks. 
0 lines changed or deleted 3 lines changed or added


 Mat_meat.hpp   Mat_meat.hpp 
skipping to change at line 411 skipping to change at line 411
x.at(urow,ucol) = val; x.at(urow,ucol) = val;
++ucol; ++ucol;
} }
++urow; ++urow;
line_start = line_end+1; line_start = line_end+1;
} }
} }
//! create the matrix from std::vector
template<typename eT>
inline
Mat<eT>::Mat(const std::vector<eT>& x)
: n_rows(uword(x.size()))
, n_cols(1)
, n_elem(uword(x.size()))
, vec_state(0)
, mem_state(0)
, mem()
{
arma_extra_debug_sigprint_this(this);
init_cold();
arrayops::copy( memptr(), &(x[0]), uword(x.size()) );
}
//! create the matrix from std::vector
template<typename eT>
inline
const Mat<eT>&
Mat<eT>::operator=(const std::vector<eT>& x)
{
arma_extra_debug_sigprint();
init_warm(uword(x.size()), 1);
arrayops::copy( memptr(), &(x[0]), uword(x.size()) );
return *this;
}
#if defined(ARMA_USE_CXX11) #if defined(ARMA_USE_CXX11)
template<typename eT> template<typename eT>
inline inline
Mat<eT>::Mat(const std::initializer_list<eT>& list) Mat<eT>::Mat(const std::initializer_list<eT>& list)
: n_rows(0) : n_rows(0)
, n_cols(0) , n_cols(0)
, n_elem(0) , n_elem(0)
, vec_state(0) , vec_state(0)
, mem_state(0) , mem_state(0)
 End of changes. 1 change blocks. 
0 lines changed or deleted 33 lines changed or added


 Row_bones.hpp   Row_bones.hpp 
skipping to change at line 40 skipping to change at line 40
inline Row(const Row<eT>& X); inline Row(const Row<eT>& X);
inline explicit Row(const uword N); inline explicit Row(const uword N);
inline Row(const uword in_rows, const uword in_cols); inline Row(const uword in_rows, const uword in_cols);
inline Row(const char* text); inline Row(const char* text);
inline const Row& operator=(const char* text); inline const Row& operator=(const char* text);
inline Row(const std::string& text); inline Row(const std::string& text);
inline const Row& operator=(const std::string& text); inline const Row& operator=(const std::string& text);
inline Row(const std::vector<eT>& x);
inline const Row& operator=(const std::vector<eT>& x);
#if defined(ARMA_USE_CXX11) #if defined(ARMA_USE_CXX11)
inline Row(const std::initializer_list<eT>& list); inline Row(const std::initializer_list<eT>& list);
inline const Row& operator=(const std::initializer_list<eT>& list); inline const Row& operator=(const std::initializer_list<eT>& list);
#endif #endif
inline const Row& operator=(const eT val); inline const Row& operator=(const eT val);
template<typename T1> inline Row(const Base<eT,T1>& X); template<typename T1> inline Row(const Base<eT,T1>& X);
template<typename T1> inline const Row& operator=(const Base<eT,T1>& X); template<typename T1> inline const Row& operator=(const Base<eT,T1>& X);
 End of changes. 1 change blocks. 
0 lines changed or deleted 3 lines changed or added


 Row_meat.hpp   Row_meat.hpp 
skipping to change at line 100 skipping to change at line 100
const Row<eT>& const Row<eT>&
Row<eT>::operator=(const std::string& text) Row<eT>::operator=(const std::string& text)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
Mat<eT>::operator=(text); Mat<eT>::operator=(text);
return *this; return *this;
} }
//! create a row vector from std::vector
template<typename eT>
inline
Row<eT>::Row(const std::vector<eT>& x)
: Mat<eT>(arma_vec_indicator(), 1, uword(x.size()), 2)
{
arma_extra_debug_sigprint_this(this);
arrayops::copy( Mat<eT>::memptr(), &(x[0]), uword(x.size()) );
}
//! create a row vector from std::vector
template<typename eT>
inline
const Row<eT>&
Row<eT>::operator=(const std::vector<eT>& x)
{
arma_extra_debug_sigprint();
Mat<eT>::init_warm(1, uword(x.size()));
arrayops::copy( Mat<eT>::memptr(), &(x[0]), uword(x.size()) );
return *this;
}
#if defined(ARMA_USE_CXX11) #if defined(ARMA_USE_CXX11)
template<typename eT> template<typename eT>
inline inline
Row<eT>::Row(const std::initializer_list<eT>& list) Row<eT>::Row(const std::initializer_list<eT>& list)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
access::rw(Mat<eT>::vec_state) = 2; access::rw(Mat<eT>::vec_state) = 2;
 End of changes. 1 change blocks. 
0 lines changed or deleted 26 lines changed or added


 SpCol_bones.hpp   SpCol_bones.hpp 
// Copyright (C) 2011-2012 Ryan Curtin <ryan@igglybob.com> // Copyright (C) 2011-2012 Ryan Curtin
// Copyright (C) 2011 Matthew Amidon // Copyright (C) 2011 Matthew Amidon
// //
// 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 44 skipping to change at line 44
inline const SpCol& operator=(const char* text); inline const SpCol& operator=(const char* text);
inline SpCol(const std::string& text); inline SpCol(const std::string& text);
inline const SpCol& operator=(const std::string& text); inline const SpCol& operator=(const std::string& text);
inline const SpCol& operator=(const eT val); inline const SpCol& operator=(const eT val);
template<typename T1> inline SpCol(const Base<eT,T1>& X) ; template<typename T1> inline SpCol(const Base<eT,T1>& X) ;
template<typename T1> inline const SpCol& operator=(const Base<eT,T1>& X) ; template<typename T1> inline const SpCol& operator=(const Base<eT,T1>& X) ;
template<typename T1> inline SpCol(const SpBase<eT,T1>&
X);
template<typename T1> inline const SpCol& operator=(const SpBase<eT,T1>&
X);
template<typename T1, typename T2> template<typename T1, typename T2>
inline explicit SpCol(const Base<pod_type,T1>& A, const Base<pod_type,T2> & B); inline explicit SpCol(const SpBase<pod_type,T1>& A, const SpBase<pod_type ,T2>& B);
arma_inline SpValProxy<SpMat<eT> >& row(const uword row_num); inline SpValProxy<SpMat<eT> > row(const uword row_num);
arma_inline eT row(const uword row_num) const; inline eT row(const uword row_num) const;
// arma_inline subview_col<eT> rows(const uword in_row1, const uword in_row2); // arma_inline subview_col<eT> rows(const uword in_row1, const uword in_row2);
// arma_inline const subview_col<eT> rows(const uword in_row1, const uword in_row2) const; // arma_inline const subview_col<eT> rows(const uword in_row1, const uword in_row2) const;
// arma_inline subview_col<eT> subvec(const uword in_row1, const uwo rd in_row2); // arma_inline subview_col<eT> subvec(const uword in_row1, const uwo rd in_row2);
// arma_inline const subview_col<eT> subvec(const uword in_row1, const uwo rd in_row2) const; // arma_inline const subview_col<eT> subvec(const uword in_row1, const uwo rd in_row2) const;
// arma_inline subview_col<eT> subvec(const span& row_span); // arma_inline subview_col<eT> subvec(const span& row_span);
// arma_inline const subview_col<eT> subvec(const span& row_span) const; // arma_inline const subview_col<eT> subvec(const span& row_span) const;
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 // inline void insert_rows(const uword row_num, con
uword N, const bool set_to_zero = true); st uword N, const bool set_to_zero = true);
template<typename T1> inline void insert_rows(const uword row_num, const // template<typename T1> inline void insert_rows(const uword row_num, con
Base<eT,T1>& X); st Base<eT,T1>& X);
typedef typename SpMat<eT>::iterator row_iterator; typedef typename SpMat<eT>::iterator row_iterator;
typedef typename SpMat<eT>::const_iterator const_row_iterator; typedef typename SpMat<eT>::const_iterator const_row_iterator;
inline row_iterator begin_row(const uword row_num = 0); inline row_iterator begin_row(const uword row_num = 0);
inline const_row_iterator begin_row(const uword row_num = 0) const; inline const_row_iterator begin_row(const uword row_num = 0) const;
inline row_iterator end_row (const uword row_num = 0); inline row_iterator end_row (const uword row_num = 0);
inline const_row_iterator end_row (const uword row_num = 0) const; inline const_row_iterator end_row (const uword row_num = 0) const;
 End of changes. 5 change blocks. 
8 lines changed or deleted 13 lines changed or added


 SpCol_meat.hpp   SpCol_meat.hpp 
// Copyright (C) 2011-2012 Ryan Curtin <ryan@igglybob.com> // Copyright (C) 2011-2012 Ryan Curtin
// Copyright (C) 2011 Matthew Amidon // Copyright (C) 2011 Matthew Amidon
// //
// 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 144 skipping to change at line 144
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
access::rw(SpMat<eT>::vec_state) = 1; access::rw(SpMat<eT>::vec_state) = 1;
SpMat<eT>::operator=(X.get_ref()); SpMat<eT>::operator=(X.get_ref());
return *this; return *this;
} }
template<typename eT> template<typename eT>
template<typename T1>
inline
SpCol<eT>::SpCol(const SpBase<eT,T1>& X)
{
arma_extra_debug_sigprint();
access::rw(SpMat<eT>::vec_state) = 1;
SpMat<eT>::operator=(X.get_ref());
}
template<typename eT>
template<typename T1>
inline
const SpCol<eT>&
SpCol<eT>::operator=(const SpBase<eT,T1>& X)
{
arma_extra_debug_sigprint();
access::rw(SpMat<eT>::vec_state) = 1;
SpMat<eT>::operator=(X.get_ref());
return *this;
}
template<typename eT>
template<typename T1, typename T2> template<typename T1, typename T2>
inline inline
SpCol<eT>::SpCol SpCol<eT>::SpCol
( (
const Base<typename SpCol<eT>::pod_type, T1>& A, const SpBase<typename SpCol<eT>::pod_type, T1>& A,
const Base<typename SpCol<eT>::pod_type, T2>& B const SpBase<typename SpCol<eT>::pod_type, T2>& B
) )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
access::rw(SpMat<eT>::vec_state) = 1; access::rw(SpMat<eT>::vec_state) = 1;
SpMat<eT>::init(A,B); SpMat<eT>::init(A,B);
} }
template<typename eT> template<typename eT>
arma_inline inline
SpValProxy<SpMat<eT> >& SpValProxy< SpMat<eT> >
SpCol<eT>::row(const uword row_num) SpCol<eT>::row(const uword row_num)
{ {
arma_debug_check( (row_num >= SpMat<eT>::n_rows), "SpCol::row(): out of b ounds" ); arma_debug_check( (row_num >= SpMat<eT>::n_rows), "SpCol::row(): out of b ounds" );
return SpMat<eT>::at(row_num, 0); return SpMat<eT>::at(row_num, 0);
} }
template<typename eT> template<typename eT>
arma_inline inline
eT eT
SpCol<eT>::row(const uword row_num) const SpCol<eT>::row(const uword row_num) const
{ {
arma_debug_check( (row_num >= SpMat<eT>::n_rows), "SpCol::row(): out of b ounds" ); arma_debug_check( (row_num >= SpMat<eT>::n_rows), "SpCol::row(): out of b ounds" );
return SpMat<eT>::at(row_num, 0); return SpMat<eT>::at(row_num, 0);
} }
/* /*
template<typename eT> template<typename eT>
skipping to change at line 370 skipping to change at line 397
access::rw(SpMat<eT>::n_nonzero) -= elem_diff; access::rw(SpMat<eT>::n_nonzero) -= elem_diff;
access::rw(SpMat<eT>::col_ptrs[1]) -= elem_diff; access::rw(SpMat<eT>::col_ptrs[1]) -= elem_diff;
} }
access::rw(SpMat<eT>::n_rows) -= diff; access::rw(SpMat<eT>::n_rows) -= diff;
access::rw(SpMat<eT>::n_elem) -= diff; access::rw(SpMat<eT>::n_elem) -= diff;
} }
//! insert N rows at the specified row position, // //! insert N rows at the specified row position,
//! optionally setting the elements of the inserted rows to zero // //! optionally setting the elements of the inserted rows to zero
template<typename eT> // template<typename eT>
inline // inline
void // void
SpCol<eT>::insert_rows(const uword row_num, const uword N, const bool set_t // SpCol<eT>::insert_rows(const uword row_num, const uword N, const bool se
o_zero) t_to_zero)
{ // {
arma_extra_debug_sigprint(); // arma_extra_debug_sigprint();
//
arma_debug_check(set_to_zero == false, "SpCol::insert_rows(): cannot set // arma_debug_check(set_to_zero == false, "SpCol::insert_rows(): cannot s
nonzero values"); et nonzero values");
//
arma_debug_check((row_num > SpMat<eT>::n_rows), "SpCol::insert_rows(): ou // arma_debug_check((row_num > SpMat<eT>::n_rows), "SpCol::insert_rows():
t of bounds"); out of bounds");
//
for(uword row = 0; row < SpMat<eT>::n_rows; ++row) // for(uword row = 0; row < SpMat<eT>::n_rows; ++row)
{ // {
if (SpMat<eT>::row_indices[row] >= row_num) // if (SpMat<eT>::row_indices[row] >= row_num)
{ // {
access::rw(SpMat<eT>::row_indices[row]) += N; // access::rw(SpMat<eT>::row_indices[row]) += N;
} // }
} // }
//
access::rw(SpMat<eT>::n_rows) += N; // access::rw(SpMat<eT>::n_rows) += N;
access::rw(SpMat<eT>::n_elem) += N; // access::rw(SpMat<eT>::n_elem) += N;
} // }
//
//! insert the given object at the specified row position; //
//! the given object must have one column //
template<typename eT> // //! insert the given object at the specified row position;
template<typename T1> // //! the given object must have one column
inline // template<typename eT>
void // template<typename T1>
SpCol<eT>::insert_rows(const uword row_num, const Base<eT,T1>& X) // inline
{ // void
arma_extra_debug_sigprint(); // SpCol<eT>::insert_rows(const uword row_num, const Base<eT,T1>& X)
// {
SpMat<eT>::insert_rows(row_num, X); // arma_extra_debug_sigprint();
} //
// SpMat<eT>::insert_rows(row_num, X);
// }
template<typename eT> template<typename eT>
inline inline
typename SpCol<eT>::row_iterator typename SpCol<eT>::row_iterator
SpCol<eT>::begin_row(const uword row_num) SpCol<eT>::begin_row(const uword row_num)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( (row_num >= SpMat<eT>::n_rows), "begin_row(): index out of bounds"); arma_debug_check( (row_num >= SpMat<eT>::n_rows), "begin_row(): index out of bounds");
 End of changes. 6 change blocks. 
46 lines changed or deleted 75 lines changed or added


 SpMat_bones.hpp   SpMat_bones.hpp 
// Copyright (C) 2011-2012 Ryan Curtin <ryan@igglybob.com> // Copyright (C) 2011-2012 Ryan Curtin
// Copyright (C) 2011 Matthew Amidon // Copyright (C) 2011 Matthew Amidon
// Copyright (C) 2012 Conrad Sanderson // Copyright (C) 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 SpMat //! \addtogroup SpMat
//! @{ //! @{
//! Sparse matrix class, which uses the compressed sparse column (CSC) form at. For external solvers we depend on GMM++. //! Sparse matrix class, with data stored in compressed sparse column (CSC) format
template<typename eT> template<typename eT>
class SpMat : public SpBase< eT, SpMat<eT> > class SpMat : public SpBase< eT, SpMat<eT> >
{ {
public: public:
typedef eT elem_type; //!< the type of el ements stored in the matrix typedef eT elem_type; //!< the type of el ements stored in the matrix
typedef typename get_pod_type<eT>::result pod_type; //!< if eT is non-c omplex, pod_type is the same as eT; otherwise, pod_type is the underlying t ype used by std::complex typedef typename get_pod_type<eT>::result pod_type; //!< if eT is non-c omplex, pod_type is the same as eT; otherwise, pod_type is the underlying t ype used by std::complex
static const bool is_row = false; static const bool is_row = false;
 End of changes. 2 change blocks. 
2 lines changed or deleted 2 lines changed or added


 SpMat_iterators_meat.hpp   SpMat_iterators_meat.hpp 
// Copyright (C) 2011-2012 Ryan Curtin <ryan@igglybob.com> // Copyright (C) 2011-2012 Ryan Curtin
// Copyright (C) 2011 Matthew Amidon // Copyright (C) 2011 Matthew Amidon
// Copyright (C) 2012 Conrad Sanderson // Copyright (C) 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.
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 SpMat_meat.hpp   SpMat_meat.hpp 
// Copyright (C) 2011-2012 Ryan Curtin <ryan@igglybob.com> // Copyright (C) 2011-2012 Ryan Curtin
// Copyright (C) 2011 Matthew Amidon // Copyright (C) 2011 Matthew Amidon
// Copyright (C) 2012 Conrad Sanderson // Copyright (C) 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.
skipping to change at line 585 skipping to change at line 585
} }
// Now add all partial sums to the matrix. // Now add all partial sums to the matrix.
for(uword i = 0; i < n_rows; ++i) for(uword i = 0; i < n_rows; ++i)
{ {
if(partial_sums[i] != 0) if(partial_sums[i] != 0)
{ {
access::rw(z.values[cur_pos]) = partial_sums[i]; access::rw(z.values[cur_pos]) = partial_sums[i];
access::rw(z.row_indices[cur_pos]) = i; access::rw(z.row_indices[cur_pos]) = i;
++access::rw(z.col_ptrs[col + 1]); ++access::rw(z.col_ptrs[col + 1]);
printf("colptr %d now %d\n", col + 1, z.col_ptrs[col + 1]); //printf("colptr %d now %d\n", col + 1, z.col_ptrs[col + 1]);
++cur_pos; ++cur_pos;
partial_sums[i] = 0; // Would it be faster to do this in batch late r? partial_sums[i] = 0; // Would it be faster to do this in batch late r?
} }
} }
} }
// Now fix the column pointers. // Now fix the column pointers.
for(uword c = 1; c <= z.n_cols; ++c) for(uword c = 1; c <= z.n_cols; ++c)
{ {
access::rw(z.col_ptrs[c]) += z.col_ptrs[c - 1]; access::rw(z.col_ptrs[c]) += z.col_ptrs[c - 1];
 End of changes. 2 change blocks. 
2 lines changed or deleted 2 lines changed or added


 SpRow_bones.hpp   SpRow_bones.hpp 
// Copyright (C) 2011-2012 Ryan Curtin <ryan@igglybob.com> // Copyright (C) 2011-2012 Ryan Curtin
// Copyright (C) 2011 Matthew Amidon // Copyright (C) 2011 Matthew Amidon
// //
// 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 41 skipping to change at line 41
inline SpRow(const uword in_rows, const uword in_cols); inline SpRow(const uword in_rows, const uword in_cols);
inline SpRow(const char* text); inline SpRow(const char* text);
inline const SpRow& operator=(const char* text); inline const SpRow& operator=(const char* text);
inline SpRow(const std::string& text); inline SpRow(const std::string& text);
inline const SpRow& operator=(const std::string& text); inline const SpRow& operator=(const std::string& text);
inline const SpRow& operator=(const eT val); inline const SpRow& operator=(const eT val);
template<typename T1> inline SpRow(const Base<eT,T1>& X template<typename T1> inline SpRow(const Base<eT,T1>& X)
); ;
template<typename T1> inline const SpRow& operator=(const Base<eT,T1>& X template<typename T1> inline const SpRow& operator=(const Base<eT,T1>& X)
); ;
template<typename T1> inline SpRow(const SpBase<eT,T1>&
X);
template<typename T1> inline const SpRow& operator=(const SpBase<eT,T1>&
X);
template<typename T1, typename T2> template<typename T1, typename T2>
inline explicit SpRow(const Base<pod_type,T1>& A, const Base<pod_type,T2> & B); inline explicit SpRow(const SpBase<pod_type,T1>& A, const SpBase<pod_type ,T2>& B);
arma_inline SpValProxy<SpMat<eT> > col(const uword col_num); inline SpValProxy<SpMat<eT> > col(const uword col_num);
arma_inline eT col(const uword col_num) const; inline eT col(const uword col_num) const;
// arma_inline subview_row<eT> cols(const uword in_col1, const uword in_col2); // arma_inline subview_row<eT> cols(const uword in_col1, const uword in_col2);
// arma_inline const subview_row<eT> cols(const uword in_col1, const uword in_col2) const; // arma_inline const subview_row<eT> cols(const uword in_col1, const uword in_col2) const;
// arma_inline subview_row<eT> subvec(const uword in_col1, const uwo rd in_col2); // arma_inline subview_row<eT> subvec(const uword in_col1, const uwo rd in_col2);
// arma_inline const subview_row<eT> subvec(const uword in_col1, const uwo rd in_col2) const; // arma_inline const subview_row<eT> subvec(const uword in_col1, const uwo rd in_col2) const;
// arma_inline subview_row<eT> subvec(const span& col_span); // arma_inline subview_row<eT> subvec(const span& col_span);
// arma_inline const subview_row<eT> subvec(const span& col_span) const; // arma_inline const subview_row<eT> subvec(const span& col_span) const;
// 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) cons t; // arma_inline const subview_row<eT> operator()(const span& col_span) cons t;
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 // inline void insert_cols(const uword col_num, con
uword N, const bool set_to_zero = true); st uword N, const bool set_to_zero = true);
template<typename T1> inline void insert_cols(const uword col_num, const // template<typename T1> inline void insert_cols(const uword col_num, con
Base<eT,T1>& X); st Base<eT,T1>& X);
typedef typename SpMat<eT>::iterator row_iterator; typedef typename SpMat<eT>::iterator row_iterator;
typedef typename SpMat<eT>::const_iterator const_row_iterator; typedef typename SpMat<eT>::const_iterator const_row_iterator;
inline row_iterator begin_row(); inline row_iterator begin_row();
inline const_row_iterator begin_row() const; inline const_row_iterator begin_row() const;
inline row_iterator end_row(); inline row_iterator end_row();
inline const_row_iterator end_row() const; inline const_row_iterator end_row() const;
 End of changes. 5 change blocks. 
12 lines changed or deleted 17 lines changed or added


 SpRow_meat.hpp   SpRow_meat.hpp 
// Copyright (C) 2011-2012 Ryan Curtin <ryan@igglybob.com> // Copyright (C) 2011-2012 Ryan Curtin
// Copyright (C) 2011 Matthew Amidon // Copyright (C) 2011 Matthew Amidon
// //
// 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 136 skipping to change at line 136
SpRow<eT>::operator=(const Base<eT,T1>& X) SpRow<eT>::operator=(const Base<eT,T1>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
SpMat<eT>::operator=(X.get_ref()); SpMat<eT>::operator=(X.get_ref());
return *this; return *this;
} }
template<typename eT> template<typename eT>
template<typename T1>
inline
SpRow<eT>::SpRow(const SpBase<eT,T1>& X)
{
arma_extra_debug_sigprint();
access::rw(SpMat<eT>::vec_state) = 2;
SpMat<eT>::operator=(X.get_ref());
}
template<typename eT>
template<typename T1>
inline
const SpRow<eT>&
SpRow<eT>::operator=(const SpBase<eT,T1>& X)
{
arma_extra_debug_sigprint();
SpMat<eT>::operator=(X.get_ref());
return *this;
}
template<typename eT>
template<typename T1, typename T2> template<typename T1, typename T2>
inline inline
SpRow<eT>::SpRow SpRow<eT>::SpRow
( (
const Base<typename SpRow<eT>::pod_type, T1>& A, const SpBase<typename SpRow<eT>::pod_type, T1>& A,
const Base<typename SpRow<eT>::pod_type, T2>& B const SpBase<typename SpRow<eT>::pod_type, T2>& B
) )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
access::rw(SpMat<eT>::vec_state) = 2; access::rw(SpMat<eT>::vec_state) = 2;
SpMat<eT>::init(A,B); SpMat<eT>::init(A,B);
} }
template<typename eT> template<typename eT>
arma_inline inline
SpValProxy<SpMat<eT> > SpValProxy< SpMat<eT> >
SpRow<eT>::col(const uword col_num) SpRow<eT>::col(const uword col_num)
{ {
arma_debug_check( (col_num >= SpMat<eT>::n_cols), "SpRow::col(): out of b ounds" ); arma_debug_check( (col_num >= SpMat<eT>::n_cols), "SpRow::col(): out of b ounds" );
return SpMat<eT>::at(0, col_num); return SpMat<eT>::at(0, col_num);
} }
template<typename eT> template<typename eT>
arma_inline inline
eT eT
SpRow<eT>::col(const uword col_num) const SpRow<eT>::col(const uword col_num) const
{ {
arma_debug_check( (col_num >= SpMat<eT>::n_cols), "SpRow::col(): out of b ounds" ); arma_debug_check( (col_num >= SpMat<eT>::n_cols), "SpRow::col(): out of b ounds" );
return SpMat<eT>::at(0, col_num); return SpMat<eT>::at(0, col_num);
} }
/* /*
template<typename eT> template<typename eT>
skipping to change at line 379 skipping to change at line 404
} }
memory::release(SpMat<eT>::col_ptrs); memory::release(SpMat<eT>::col_ptrs);
access::rw(SpMat<eT>::col_ptrs) = new_col_ptrs; access::rw(SpMat<eT>::col_ptrs) = new_col_ptrs;
access::rw(SpMat<eT>::n_cols) -= diff; access::rw(SpMat<eT>::n_cols) -= diff;
access::rw(SpMat<eT>::n_elem) -= diff; access::rw(SpMat<eT>::n_elem) -= diff;
} }
//! insert N cols at the specified col position, // //! insert N cols at the specified col position,
//! optionally setting the elements of the inserted cols to zero // //! optionally setting the elements of the inserted cols to zero
template<typename eT> // template<typename eT>
inline // inline
void // void
SpRow<eT>::insert_cols(const uword col_num, const uword N, const bool set_t // SpRow<eT>::insert_cols(const uword col_num, const uword N, const bool se
o_zero) t_to_zero)
{ // {
arma_extra_debug_sigprint(); // arma_extra_debug_sigprint();
//
// insertion at col_num == n_cols is in effect an append operation // // insertion at col_num == n_cols is in effect an append operation
arma_debug_check( (col_num > SpMat<eT>::n_cols), "SpRow::insert_cols(): o // arma_debug_check( (col_num > SpMat<eT>::n_cols), "SpRow::insert_cols()
ut of bounds"); : out of bounds");
//
arma_debug_check( (set_to_zero == false), "SpRow::insert_cols(): cannot s // arma_debug_check( (set_to_zero == false), "SpRow::insert_cols(): canno
et elements to nonzero values"); t set elements to nonzero values");
//
uword newVal = (col_num == 0) ? 0 : SpMat<eT>::col_ptrs[col_num]; // uword newVal = (col_num == 0) ? 0 : SpMat<eT>::col_ptrs[col_num];
SpMat<eT>::col_ptrs.insert(col_num, N, newVal); // SpMat<eT>::col_ptrs.insert(col_num, N, newVal);
uword* new_col_ptrs = memory::acquire<uword>(SpMat<eT>::n_cols + N); // uword* new_col_ptrs = memory::acquire<uword>(SpMat<eT>::n_cols + N);
//
arrayops::copy(new_col_ptrs, SpMat<eT>::col_ptrs, col_num); // arrayops::copy(new_col_ptrs, SpMat<eT>::col_ptrs, col_num);
//
uword fill_value = (col_num == 0) ? 0 : SpMat<eT>::col_ptrs[col_num - 1]; // uword fill_value = (col_num == 0) ? 0 : SpMat<eT>::col_ptrs[col_num -
arrayops::inplace_set(new_col_ptrs + col_num, fill_value, N); 1];
// arrayops::inplace_set(new_col_ptrs + col_num, fill_value, N);
arrayops::copy(new_col_ptrs + col_num + N, SpMat<eT>::col_ptrs + col_num, //
SpMat<eT>::n_cols - col_num); // arrayops::copy(new_col_ptrs + col_num + N, SpMat<eT>::col_ptrs + col_n
um, SpMat<eT>::n_cols - col_num);
access::rw(SpMat<eT>::n_cols) += N; //
access::rw(SpMat<eT>::n_elem) += N; // access::rw(SpMat<eT>::n_cols) += N;
} // access::rw(SpMat<eT>::n_elem) += N;
// }
//! insert the given object at the specified col position; //
//! the given object must have one row //
template<typename eT> //
template<typename T1> // //! insert the given object at the specified col position;
inline // //! the given object must have one row
void // template<typename eT>
SpRow<eT>::insert_cols(const uword col_num, const Base<eT,T1>& X) // template<typename T1>
{ // inline
arma_extra_debug_sigprint(); // void
// SpRow<eT>::insert_cols(const uword col_num, const Base<eT,T1>& X)
SpMat<eT>::insert_cols(col_num, X); // {
} // arma_extra_debug_sigprint();
//
// SpMat<eT>::insert_cols(col_num, X);
// }
template<typename eT> template<typename eT>
inline inline
typename SpRow<eT>::row_iterator typename SpRow<eT>::row_iterator
SpRow<eT>::begin_row() SpRow<eT>::begin_row()
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return SpMat<eT>::begin(); return SpMat<eT>::begin();
} }
 End of changes. 6 change blocks. 
51 lines changed or deleted 79 lines changed or added


 SpSubview_bones.hpp   SpSubview_bones.hpp 
// Copyright (C) 2011-2012 Ryan Curtin <ryan@igglybob.com> // Copyright (C) 2011-2012 Ryan Curtin
// Copyright (C) 2011 Matthew Amidon // Copyright (C) 2011 Matthew Amidon
// Copyright (C) 2012 Conrad Sanderson // Copyright (C) 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.
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 SpSubview_iterators_meat.hpp   SpSubview_iterators_meat.hpp 
// Copyright (C) 2012 Ryan Curtin <ryan@igglybob.com> // Copyright (C) 2012 Ryan Curtin
// Copyright (C) 2012 Conrad Sanderson // Copyright (C) 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. 
1 lines changed or deleted 1 lines changed or added


 SpSubview_meat.hpp   SpSubview_meat.hpp 
// Copyright (C) 2011-2012 Ryan Curtin <ryan@igglybob.com> // Copyright (C) 2011-2012 Ryan Curtin
// Copyright (C) 2011 Matthew Amidon // Copyright (C) 2011 Matthew Amidon
// Copyright (C) 2012 Conrad Sanderson // Copyright (C) 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 SpSubview
//! @{
template<typename eT> template<typename eT>
arma_inline arma_inline
SpSubview<eT>::SpSubview(const SpMat<eT>& in_m, const uword in_row1, const uword in_col1, const uword in_n_rows, const uword in_n_cols) SpSubview<eT>::SpSubview(const SpMat<eT>& in_m, const uword in_row1, const uword in_col1, const uword in_n_rows, const uword in_n_cols)
: m(in_m) : m(in_m)
, aux_row1(in_row1) , aux_row1(in_row1)
, aux_col1(in_col1) , aux_col1(in_col1)
, n_rows(in_n_rows) , n_rows(in_n_rows)
, n_cols(in_n_cols) , n_cols(in_n_cols)
, n_elem(in_n_rows * in_n_cols) , n_elem(in_n_rows * in_n_cols)
, n_nonzero(0) , n_nonzero(0)
skipping to change at line 1119 skipping to change at line 1122
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
} }
template<typename eT> template<typename eT>
inline inline
SpSubview_row<eT>::SpSubview_row(Mat<eT>& in_m, const uword in_row, const u word in_col1, const uword in_n_cols) SpSubview_row<eT>::SpSubview_row(Mat<eT>& in_m, const uword in_row, const u word in_col1, const uword in_n_cols)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
} }
*/ */
//! @}
 End of changes. 3 change blocks. 
1 lines changed or deleted 4 lines changed or added


 SpValProxy_bones.hpp   SpValProxy_bones.hpp 
// Copyright (C) 2011 Ryan Curtin <ryan@igglybob.com> // Copyright (C) 2011-2012 Ryan Curtin
// //
// 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 SpMat //! \addtogroup SpValProxy
//! @{ //! @{
/** /**
* Sparse value proxy class, meant to prevent 0s from being added to sparse * Sparse value proxy class, meant to prevent 0s from being added to sparse
* matrices. T1 should be either SpMat or SpSubview, and if it's not, bad news * matrices. T1 should be either SpMat or SpSubview, and if it's not, bad news
* is probably coming. This class only uses T1::add_element() and * is probably coming. This class only uses T1::add_element() and
* T1::delete_element(). * T1::delete_element().
*/ */
template<typename T1> template<typename T1>
class SpValProxy class SpValProxy
 End of changes. 2 change blocks. 
2 lines changed or deleted 2 lines changed or added


 SpValProxy_meat.hpp   SpValProxy_meat.hpp 
// Copyright (C) 2011 Ryan Curtin <ryan@igglybob.com> // Copyright (C) 2011-2012 Ryan Curtin
// Copyright (C) 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 SpMat //! \addtogroup SpValProxy
//! @{ //! @{
//! SpValProxy implementation. //! SpValProxy implementation.
template<typename T1> template<typename T1>
arma_inline arma_inline
SpValProxy<T1>::SpValProxy(uword in_row, uword in_col, T1& in_parent, eT* i n_val_ptr) SpValProxy<T1>::SpValProxy(uword in_row, uword in_col, T1& in_parent, eT* i n_val_ptr)
: row(in_row) : row(in_row)
, col(in_col) , col(in_col)
, val_ptr(in_val_ptr) , val_ptr(in_val_ptr)
, parent(in_parent) , parent(in_parent)
 End of changes. 2 change blocks. 
2 lines changed or deleted 3 lines changed or added


 access.hpp   access.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 access //! \addtogroup access
//! @{ //! @{
class access class access
{ {
public: public:
//! internal function to allow modification of data declared as read-only //! internal function to allow modification of data declared as read-only (use with caution)
template<typename T1> arma_inline static T1& rw (const T1& x) { r eturn const_cast<T1& >(x); } template<typename T1> arma_inline static T1& rw (const T1& x) { r eturn const_cast<T1& >(x); }
template<typename T1> arma_inline static T1*& rwp(const T1* const& x) { r eturn const_cast<T1*&>(x); } template<typename T1> arma_inline static T1*& rwp(const T1* const& x) { r eturn const_cast<T1*&>(x); }
//! internal function to allow modification of
//! internal function to obtain the real part of either a plain number or a complex number //! internal function to obtain the real part of either a plain number or a complex number
template<typename eT> arma_inline static const eT& tmp_real(const eT& X) { return X; } template<typename eT> arma_inline static const eT& tmp_real(const eT& X) { return X; }
template<typename T> arma_inline static const T tmp_real(const std::co mplex<T>& X) { return X.real(); } template<typename T> arma_inline static const T tmp_real(const std::co mplex<T>& X) { return X.real(); }
}; };
//! @} //! @}
 End of changes. 3 change blocks. 
5 lines changed or deleted 3 lines changed or added


 arma_config.hpp   arma_config.hpp 
skipping to change at line 24 skipping to change at line 24
//! @{ //! @{
struct arma_config struct arma_config
{ {
#if defined(ARMA_MAT_PREALLOC) #if defined(ARMA_MAT_PREALLOC)
static const uword mat_prealloc = (sword(ARMA_MAT_PREALLOC) > 0) ? uwor d(ARMA_MAT_PREALLOC) : 1; static const uword mat_prealloc = (sword(ARMA_MAT_PREALLOC) > 0) ? uwor d(ARMA_MAT_PREALLOC) : 1;
#else #else
static const uword mat_prealloc = 16; static const uword mat_prealloc = 16;
#endif #endif
// TODO: place ARMA_SPMAT_CHUNKSIZE in confg.hpp and config.hpp.cmake
#if defined(ARMA_SPMAT_CHUNKSIZE) #if defined(ARMA_SPMAT_CHUNKSIZE)
static const uword spmat_chunksize = (sword(ARMA_SPMAT_CHUNKSIZE) > 0) ? uword(ARMA_SPMAT_CHUNKSIZE) : 256; static const uword spmat_chunksize = (sword(ARMA_SPMAT_CHUNKSIZE) > 0) ? uword(ARMA_SPMAT_CHUNKSIZE) : 256;
#else #else
static const uword spmat_chunksize = 256; static const uword spmat_chunksize = 256;
#endif #endif
#if defined(ARMA_USE_ATLAS) #if defined(ARMA_USE_ATLAS)
static const bool atlas = true; static const bool atlas = true;
#else #else
static const bool atlas = false; static const bool atlas = false;
 End of changes. 1 change blocks. 
1 lines changed or deleted 0 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 3 #define ARMA_VERSION_MAJOR 3
#define ARMA_VERSION_MINOR 3 #define ARMA_VERSION_MINOR 3
#define ARMA_VERSION_PATCH 91 #define ARMA_VERSION_PATCH 92
#define ARMA_VERSION_NAME "v3.4 beta 1; for testing use only" #define ARMA_VERSION_NAME "v3.4 beta 2; for testing use only"
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


 config.hpp   config.hpp 
skipping to change at line 69 skipping to change at line 69
//// This will enable additional features, such as use of initialiser lists //// This will enable additional features, such as use of initialiser lists
#if !defined(ARMA_MAT_PREALLOC) #if !defined(ARMA_MAT_PREALLOC)
#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.
#if !defined(ARMA_SPMAT_CHUNKSIZE)
#define ARMA_SPMAT_CHUNKSIZE 256
#endif
//// This is the minimum increase in the amount of memory (in terms of elem
ents) allocated by a sparse matrix;
//// it must be an integer that is at least 1.
//// The minimum recommended size is 16.
// #define ARMA_NO_DEBUG // #define ARMA_NO_DEBUG
//// Uncomment the above line if you want to disable all run-time checks. //// Uncomment the above line if you want to disable all run-time checks.
//// This will result in faster code, but you first need to make sure that your code runs correctly! //// This will result in faster code, but you first need to make sure that your code runs correctly!
//// We strongly recommend to have the run-time checks enabled during devel opment, //// We strongly recommend to have the run-time checks enabled during devel opment,
//// as this greatly aids in finding mistakes in your code, and hence speed s up development. //// as this greatly aids in finding mistakes in your code, and hence speed s up development.
//// We recommend that run-time checks be disabled _only_ for the shipped v ersion of your program. //// We recommend that run-time checks be disabled _only_ for the shipped v ersion of your program.
// #define ARMA_EXTRA_DEBUG // #define ARMA_EXTRA_DEBUG
//// Uncomment the above line if you want to see the function traces of how Armadillo evaluates expressions. //// Uncomment the above line if you want to see the function traces of how Armadillo evaluates expressions.
//// This is mainly useful for debugging of the library. //// This is mainly useful for debugging of the library.
 End of changes. 1 change blocks. 
0 lines changed or deleted 8 lines changed or added


 fn_conv_to.hpp   fn_conv_to.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)
skipping to change at line 43 skipping to change at line 43
inline static out_eT from(const BaseCube<in_eT, T1>& in, const typename a rma_cx_only<in_eT>::result* junk = 0); inline static out_eT from(const BaseCube<in_eT, T1>& in, const typename a rma_cx_only<in_eT>::result* junk = 0);
}; };
template<typename out_eT> template<typename out_eT>
template<typename in_eT, typename T1> template<typename in_eT, typename T1>
inline inline
out_eT out_eT
conv_to<out_eT>::from(const Base<in_eT, T1>& in, const typename arma_not_cx <in_eT>::result* junk) conv_to<out_eT>::from(const Base<in_eT, T1>& in, const typename arma_not_cx <in_eT>::result* junk)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_ignore(junk); arma_ignore(junk);
arma_type_check(( is_supported_elem_type<out_eT>::value == false )); arma_type_check(( is_supported_elem_type<out_eT>::value == false ));
const unwrap<T1> tmp(in.get_ref()); const unwrap<T1> tmp(in.get_ref());
const Mat<in_eT>& X = tmp.M; const Mat<in_eT>& X = tmp.M;
arma_debug_check( (X.n_elem != 1), "conv_to(): given object doesn't have exactly one element" ); arma_debug_check( (X.n_elem != 1), "conv_to(): given object doesn't have exactly one element" );
return out_eT(X.mem[0]); return out_eT(X.mem[0]);
} }
template<typename out_eT> template<typename out_eT>
template<typename in_eT, typename T1> template<typename in_eT, typename T1>
inline inline
out_eT out_eT
conv_to<out_eT>::from(const Base<in_eT, T1>& in, const typename arma_cx_onl y<in_eT>::result* junk) conv_to<out_eT>::from(const Base<in_eT, T1>& in, const typename arma_cx_onl y<in_eT>::result* junk)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_ignore(junk); arma_ignore(junk);
arma_type_check(( is_supported_elem_type<out_eT>::value == false )); arma_type_check(( is_supported_elem_type<out_eT>::value == false ));
const unwrap<T1> tmp(in.get_ref()); const unwrap<T1> tmp(in.get_ref());
const Mat<in_eT>& X = tmp.M; const Mat<in_eT>& X = tmp.M;
arma_debug_check( (X.n_elem != 1), "conv_to(): given object doesn't have exactly one element" ); arma_debug_check( (X.n_elem != 1), "conv_to(): given object doesn't have exactly one element" );
out_eT out; out_eT out;
skipping to change at line 87 skipping to change at line 85
return out; return out;
} }
template<typename out_eT> template<typename out_eT>
template<typename in_eT, typename T1> template<typename in_eT, typename T1>
inline inline
out_eT out_eT
conv_to<out_eT>::from(const BaseCube<in_eT, T1>& in, const typename arma_no t_cx<in_eT>::result* junk) conv_to<out_eT>::from(const BaseCube<in_eT, T1>& in, const typename arma_no t_cx<in_eT>::result* junk)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_ignore(junk); arma_ignore(junk);
arma_type_check(( is_supported_elem_type<out_eT>::value == false )); arma_type_check(( is_supported_elem_type<out_eT>::value == false ));
const unwrap_cube<T1> tmp(in.get_ref()); const unwrap_cube<T1> tmp(in.get_ref());
const Cube<in_eT>& X = tmp.M; const Cube<in_eT>& X = tmp.M;
arma_debug_check( (X.n_elem != 1), "conv_to(): given object doesn't have exactly one element" ); arma_debug_check( (X.n_elem != 1), "conv_to(): given object doesn't have exactly one element" );
return out_eT(X.mem[0]); return out_eT(X.mem[0]);
} }
template<typename out_eT> template<typename out_eT>
template<typename in_eT, typename T1> template<typename in_eT, typename T1>
inline inline
out_eT out_eT
conv_to<out_eT>::from(const BaseCube<in_eT, T1>& in, const typename arma_cx _only<in_eT>::result* junk) conv_to<out_eT>::from(const BaseCube<in_eT, T1>& in, const typename arma_cx _only<in_eT>::result* junk)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_ignore(junk); arma_ignore(junk);
arma_type_check(( is_supported_elem_type<out_eT>::value == false )); arma_type_check(( is_supported_elem_type<out_eT>::value == false ));
const unwrap_cube<T1> tmp(in.get_ref()); const unwrap_cube<T1> tmp(in.get_ref());
const Cube<in_eT>& X = tmp.M; const Cube<in_eT>& X = tmp.M;
arma_debug_check( (X.n_elem != 1), "conv_to(): given object doesn't have exactly one element" ); arma_debug_check( (X.n_elem != 1), "conv_to(): given object doesn't have exactly one element" );
out_eT out; out_eT out;
skipping to change at line 150 skipping to change at line 146
inline static Mat<out_eT> from(const std::vector<in_eT>& in, const typena me arma_cx_only<in_eT>::result* junk = 0); inline static Mat<out_eT> from(const std::vector<in_eT>& in, const typena me arma_cx_only<in_eT>::result* junk = 0);
}; };
template<typename out_eT> template<typename out_eT>
template<typename in_eT, typename T1> template<typename in_eT, typename T1>
inline inline
Mat<out_eT> Mat<out_eT>
conv_to< Mat<out_eT> >::from(const Base<in_eT, T1>& in, const typename arma _not_cx<in_eT>::result* junk) conv_to< Mat<out_eT> >::from(const Base<in_eT, T1>& in, const typename arma _not_cx<in_eT>::result* junk)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_ignore(junk); arma_ignore(junk);
const unwrap<T1> tmp(in.get_ref()); const unwrap<T1> tmp(in.get_ref());
const Mat<in_eT>& X = tmp.M; const Mat<in_eT>& X = tmp.M;
Mat<out_eT> out(X.n_rows, X.n_cols); Mat<out_eT> out(X.n_rows, X.n_cols);
arrayops::convert( out.memptr(), X.memptr(), out.n_elem ); arrayops::convert( out.memptr(), X.memptr(), out.n_elem );
return out; return out;
} }
template<typename out_eT> template<typename out_eT>
template<typename in_eT, typename T1> template<typename in_eT, typename T1>
inline inline
Mat<out_eT> Mat<out_eT>
conv_to< Mat<out_eT> >::from(const Base<in_eT, T1>& in, const typename arma _cx_only<in_eT>::result* junk) conv_to< Mat<out_eT> >::from(const Base<in_eT, T1>& in, const typename arma _cx_only<in_eT>::result* junk)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_ignore(junk); arma_ignore(junk);
const unwrap<T1> tmp(in.get_ref()); const unwrap<T1> tmp(in.get_ref());
const Mat<in_eT>& X = tmp.M; const Mat<in_eT>& X = tmp.M;
Mat<out_eT> out(X.n_rows, X.n_cols); Mat<out_eT> out(X.n_rows, X.n_cols);
arrayops::convert_cx( out.memptr(), X.memptr(), out.n_elem ); arrayops::convert_cx( out.memptr(), X.memptr(), out.n_elem );
return out; return out;
} }
template<typename out_eT> template<typename out_eT>
template<typename in_eT> template<typename in_eT>
inline inline
Mat<out_eT> Mat<out_eT>
conv_to< Mat<out_eT> >::from(const std::vector<in_eT>& in, const typename a rma_not_cx<in_eT>::result* junk) conv_to< Mat<out_eT> >::from(const std::vector<in_eT>& in, const typename a rma_not_cx<in_eT>::result* junk)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_ignore(junk); arma_ignore(junk);
Mat<out_eT> out(in.size(), 1); const uword N = uword( in.size() );
typename std::vector<in_eT>::const_iterator in_begin = in.begin(); Mat<out_eT> out(N, 1);
typename std::vector<in_eT>::const_iterator in_end = in.end();
typename Mat<out_eT>::iterator out_begin = out.begin(); if(N > 0)
typename Mat<out_eT>::iterator out_end = out.end();
typename std::vector<in_eT>::const_iterator in_it;
typename Mat<out_eT>::iterator out_it;
for(in_it = in_begin, out_it = out_begin; (in_it != in_end) && (out_it !=
out_end); ++in_it, ++out_it)
{ {
(*out_it) = out_eT(*in_it); out_eT* out_mem = out.memptr();
const in_eT* in_mem = &(in[0]);
for(uword i=0; i<N; ++i)
{
out_mem[i] = out_eT( in_mem[i] );
}
} }
return out; return out;
} }
template<typename out_eT> template<typename out_eT>
template<typename in_eT> template<typename in_eT>
inline inline
Mat<out_eT> Mat<out_eT>
conv_to< Mat<out_eT> >::from(const std::vector<in_eT>& in, const typename a rma_cx_only<in_eT>::result* junk) conv_to< Mat<out_eT> >::from(const std::vector<in_eT>& in, const typename a rma_cx_only<in_eT>::result* junk)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_ignore(junk); arma_ignore(junk);
Mat<out_eT> out(in.size(), 1); Mat<out_eT> out(in.size(), 1);
typename std::vector<in_eT>::const_iterator in_begin = in.begin(); typename std::vector<in_eT>::const_iterator in_begin = in.begin();
typename std::vector<in_eT>::const_iterator in_end = in.end(); typename std::vector<in_eT>::const_iterator in_end = in.end();
typename Mat<out_eT>::iterator out_begin = out.begin(); typename Mat<out_eT>::iterator out_begin = out.begin();
typename Mat<out_eT>::iterator out_end = out.end(); typename Mat<out_eT>::iterator out_end = out.end();
skipping to change at line 270 skipping to change at line 261
inline static Row<out_eT> from(const std::vector<in_eT>& in, const typena me arma_cx_only<in_eT>::result* junk = 0); inline static Row<out_eT> from(const std::vector<in_eT>& in, const typena me arma_cx_only<in_eT>::result* junk = 0);
}; };
template<typename out_eT> template<typename out_eT>
template<typename in_eT, typename T1> template<typename in_eT, typename T1>
inline inline
Row<out_eT> Row<out_eT>
conv_to< Row<out_eT> >::from(const Base<in_eT, T1>& in, const typename arma _not_cx<in_eT>::result* junk) conv_to< Row<out_eT> >::from(const Base<in_eT, T1>& in, const typename arma _not_cx<in_eT>::result* junk)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_ignore(junk); arma_ignore(junk);
const unwrap<T1> tmp(in.get_ref()); const unwrap<T1> tmp(in.get_ref());
const Mat<in_eT>& X = tmp.M; const Mat<in_eT>& X = tmp.M;
arma_debug_check( (X.is_vec() == false), "conv_to(): given object can't b e interpreted as a vector" ); arma_debug_check( (X.is_vec() == false), "conv_to(): given object can't b e interpreted as a vector" );
Row<out_eT> out(X.n_elem); Row<out_eT> out(X.n_elem);
arrayops::convert( out.memptr(), X.memptr(), out.n_elem ); arrayops::convert( out.memptr(), X.memptr(), out.n_elem );
skipping to change at line 292 skipping to change at line 282
return out; return out;
} }
template<typename out_eT> template<typename out_eT>
template<typename in_eT, typename T1> template<typename in_eT, typename T1>
inline inline
Row<out_eT> Row<out_eT>
conv_to< Row<out_eT> >::from(const Base<in_eT, T1>& in, const typename arma _cx_only<in_eT>::result* junk) conv_to< Row<out_eT> >::from(const Base<in_eT, T1>& in, const typename arma _cx_only<in_eT>::result* junk)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_ignore(junk); arma_ignore(junk);
const unwrap<T1> tmp(in.get_ref()); const unwrap<T1> tmp(in.get_ref());
const Mat<in_eT>& X = tmp.M; const Mat<in_eT>& X = tmp.M;
arma_debug_check( (X.is_vec() == false), "conv_to(): given object can't b e interpreted as a vector" ); arma_debug_check( (X.is_vec() == false), "conv_to(): given object can't b e interpreted as a vector" );
Row<out_eT> out(X.n_rows, X.n_cols); Row<out_eT> out(X.n_rows, X.n_cols);
arrayops::convert_cx( out.memptr(), X.memptr(), out.n_elem ); arrayops::convert_cx( out.memptr(), X.memptr(), out.n_elem );
skipping to change at line 314 skipping to change at line 303
return out; return out;
} }
template<typename out_eT> template<typename out_eT>
template<typename in_eT> template<typename in_eT>
inline inline
Row<out_eT> Row<out_eT>
conv_to< Row<out_eT> >::from(const std::vector<in_eT>& in, const typename a rma_not_cx<in_eT>::result* junk) conv_to< Row<out_eT> >::from(const std::vector<in_eT>& in, const typename a rma_not_cx<in_eT>::result* junk)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_ignore(junk); arma_ignore(junk);
Row<out_eT> out( in.size() ); const uword N = uword( in.size() );
typename std::vector<in_eT>::const_iterator in_begin = in.begin();
typename std::vector<in_eT>::const_iterator in_end = in.end();
typename Row<out_eT>::iterator out_begin = out.begin();
typename Row<out_eT>::iterator out_end = out.end();
typename std::vector<in_eT>::const_iterator in_it; Row<out_eT> out(N);
typename Row<out_eT>::iterator out_it;
for(in_it = in_begin, out_it = out_begin; (in_it != in_end) && (out_it != out_end); ++in_it, ++out_it) if(N > 0)
{ {
(*out_it) = out_eT(*in_it); out_eT* out_mem = out.memptr();
const in_eT* in_mem = &(in[0]);
for(uword i=0; i<N; ++i)
{
out_mem[i] = out_eT( in_mem[i] );
}
} }
return out; return out;
} }
template<typename out_eT> template<typename out_eT>
template<typename in_eT> template<typename in_eT>
inline inline
Row<out_eT> Row<out_eT>
conv_to< Row<out_eT> >::from(const std::vector<in_eT>& in, const typename a rma_cx_only<in_eT>::result* junk) conv_to< Row<out_eT> >::from(const std::vector<in_eT>& in, const typename a rma_cx_only<in_eT>::result* junk)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_ignore(junk); arma_ignore(junk);
Row<out_eT> out( in.size() ); Row<out_eT> out( in.size() );
typename std::vector<in_eT>::const_iterator in_begin = in.begin(); typename std::vector<in_eT>::const_iterator in_begin = in.begin();
typename std::vector<in_eT>::const_iterator in_end = in.end(); typename std::vector<in_eT>::const_iterator in_end = in.end();
typename Row<out_eT>::iterator out_begin = out.begin(); typename Row<out_eT>::iterator out_begin = out.begin();
typename Row<out_eT>::iterator out_end = out.end(); typename Row<out_eT>::iterator out_end = out.end();
skipping to change at line 394 skipping to change at line 380
inline static Col<out_eT> from(const std::vector<in_eT>& in, const typena me arma_cx_only<in_eT>::result* junk = 0); inline static Col<out_eT> from(const std::vector<in_eT>& in, const typena me arma_cx_only<in_eT>::result* junk = 0);
}; };
template<typename out_eT> template<typename out_eT>
template<typename in_eT, typename T1> template<typename in_eT, typename T1>
inline inline
Col<out_eT> Col<out_eT>
conv_to< Col<out_eT> >::from(const Base<in_eT, T1>& in, const typename arma _not_cx<in_eT>::result* junk) conv_to< Col<out_eT> >::from(const Base<in_eT, T1>& in, const typename arma _not_cx<in_eT>::result* junk)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_ignore(junk); arma_ignore(junk);
const unwrap<T1> tmp(in.get_ref()); const unwrap<T1> tmp(in.get_ref());
const Mat<in_eT>& X = tmp.M; const Mat<in_eT>& X = tmp.M;
arma_debug_check( (X.is_vec() == false), "conv_to(): given object can't b e interpreted as a vector" ); arma_debug_check( (X.is_vec() == false), "conv_to(): given object can't b e interpreted as a vector" );
Col<out_eT> out(X.n_elem); Col<out_eT> out(X.n_elem);
arrayops::convert( out.memptr(), X.memptr(), out.n_elem ); arrayops::convert( out.memptr(), X.memptr(), out.n_elem );
skipping to change at line 416 skipping to change at line 401
return out; return out;
} }
template<typename out_eT> template<typename out_eT>
template<typename in_eT, typename T1> template<typename in_eT, typename T1>
inline inline
Col<out_eT> Col<out_eT>
conv_to< Col<out_eT> >::from(const Base<in_eT, T1>& in, const typename arma _cx_only<in_eT>::result* junk) conv_to< Col<out_eT> >::from(const Base<in_eT, T1>& in, const typename arma _cx_only<in_eT>::result* junk)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_ignore(junk); arma_ignore(junk);
const unwrap<T1> tmp(in.get_ref()); const unwrap<T1> tmp(in.get_ref());
const Mat<in_eT>& X = tmp.M; const Mat<in_eT>& X = tmp.M;
arma_debug_check( (X.is_vec() == false), "conv_to(): given object can't b e interpreted as a vector" ); arma_debug_check( (X.is_vec() == false), "conv_to(): given object can't b e interpreted as a vector" );
Col<out_eT> out(X.n_rows, X.n_cols); Col<out_eT> out(X.n_rows, X.n_cols);
arrayops::convert_cx( out.memptr(), X.memptr(), out.n_elem ); arrayops::convert_cx( out.memptr(), X.memptr(), out.n_elem );
skipping to change at line 438 skipping to change at line 422
return out; return out;
} }
template<typename out_eT> template<typename out_eT>
template<typename in_eT> template<typename in_eT>
inline inline
Col<out_eT> Col<out_eT>
conv_to< Col<out_eT> >::from(const std::vector<in_eT>& in, const typename a rma_not_cx<in_eT>::result* junk) conv_to< Col<out_eT> >::from(const std::vector<in_eT>& in, const typename a rma_not_cx<in_eT>::result* junk)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_ignore(junk); arma_ignore(junk);
Col<out_eT> out( in.size() ); const uword N = uword( in.size() );
typename std::vector<in_eT>::const_iterator in_begin = in.begin(); Col<out_eT> out(N);
typename std::vector<in_eT>::const_iterator in_end = in.end();
typename Col<out_eT>::iterator out_begin = out.begin(); if(N > 0)
typename Col<out_eT>::iterator out_end = out.end();
typename std::vector<in_eT>::const_iterator in_it;
typename Col<out_eT>::iterator out_it;
for(in_it = in_begin, out_it = out_begin; (in_it != in_end) && (out_it !=
out_end); ++in_it, ++out_it)
{ {
(*out_it) = out_eT(*in_it); out_eT* out_mem = out.memptr();
const in_eT* in_mem = &(in[0]);
for(uword i=0; i<N; ++i)
{
out_mem[i] = out_eT( in_mem[i] );
}
} }
return out; return out;
} }
template<typename out_eT> template<typename out_eT>
template<typename in_eT> template<typename in_eT>
inline inline
Col<out_eT> Col<out_eT>
conv_to< Col<out_eT> >::from(const std::vector<in_eT>& in, const typename a rma_cx_only<in_eT>::result* junk) conv_to< Col<out_eT> >::from(const std::vector<in_eT>& in, const typename a rma_cx_only<in_eT>::result* junk)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_ignore(junk); arma_ignore(junk);
Col<out_eT> out( in.size() ); Col<out_eT> out( in.size() );
typename std::vector<in_eT>::const_iterator in_begin = in.begin(); typename std::vector<in_eT>::const_iterator in_begin = in.begin();
typename std::vector<in_eT>::const_iterator in_end = in.end(); typename std::vector<in_eT>::const_iterator in_end = in.end();
typename Col<out_eT>::iterator out_begin = out.begin(); typename Col<out_eT>::iterator out_begin = out.begin();
typename Col<out_eT>::iterator out_end = out.end(); typename Col<out_eT>::iterator out_end = out.end();
skipping to change at line 512 skipping to change at line 493
inline static Cube<out_eT> from(const BaseCube<in_eT, T1>& in, const type name arma_cx_only<in_eT>::result* junk = 0); inline static Cube<out_eT> from(const BaseCube<in_eT, T1>& in, const type name arma_cx_only<in_eT>::result* junk = 0);
}; };
template<typename out_eT> template<typename out_eT>
template<typename in_eT, typename T1> template<typename in_eT, typename T1>
inline inline
Cube<out_eT> Cube<out_eT>
conv_to< Cube<out_eT> >::from(const BaseCube<in_eT, T1>& in, const typename arma_not_cx<in_eT>::result* junk) conv_to< Cube<out_eT> >::from(const BaseCube<in_eT, T1>& in, const typename arma_not_cx<in_eT>::result* junk)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_ignore(junk); arma_ignore(junk);
const unwrap_cube<T1> tmp( in.get_ref() ); const unwrap_cube<T1> tmp( in.get_ref() );
const Cube<in_eT>& X = tmp.M; const Cube<in_eT>& X = tmp.M;
Cube<out_eT> out(X.n_rows, X.n_cols, X.n_slices); Cube<out_eT> out(X.n_rows, X.n_cols, X.n_slices);
arrayops::convert( out.memptr(), X.memptr(), out.n_elem ); arrayops::convert( out.memptr(), X.memptr(), out.n_elem );
return out; return out;
} }
template<typename out_eT> template<typename out_eT>
template<typename in_eT, typename T1> template<typename in_eT, typename T1>
inline inline
Cube<out_eT> Cube<out_eT>
conv_to< Cube<out_eT> >::from(const BaseCube<in_eT, T1>& in, const typename arma_cx_only<in_eT>::result* junk) conv_to< Cube<out_eT> >::from(const BaseCube<in_eT, T1>& in, const typename arma_cx_only<in_eT>::result* junk)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_ignore(junk); arma_ignore(junk);
const unwrap_cube<T1> tmp( in.get_ref() ); const unwrap_cube<T1> tmp( in.get_ref() );
const Cube<in_eT>& X = tmp.M; const Cube<in_eT>& X = tmp.M;
Cube<out_eT> out(X.n_rows, X.n_cols, X.n_slices); Cube<out_eT> out(X.n_rows, X.n_cols, X.n_slices);
arrayops::convert_cx( out.memptr(), X.memptr(), out.n_elem ); arrayops::convert_cx( out.memptr(), X.memptr(), out.n_elem );
return out; return out;
skipping to change at line 565 skipping to change at line 544
inline static std::vector<out_eT> from(const Base<in_eT, T1>& in, const t ypename arma_cx_only<in_eT>::result* junk = 0); inline static std::vector<out_eT> from(const Base<in_eT, T1>& in, const t ypename arma_cx_only<in_eT>::result* junk = 0);
}; };
template<typename out_eT> template<typename out_eT>
template<typename in_eT, typename T1> template<typename in_eT, typename T1>
inline inline
std::vector<out_eT> std::vector<out_eT>
conv_to< std::vector<out_eT> >::from(const Base<in_eT, T1>& in, const typen ame arma_not_cx<in_eT>::result* junk) conv_to< std::vector<out_eT> >::from(const Base<in_eT, T1>& in, const typen ame arma_not_cx<in_eT>::result* junk)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_ignore(junk); arma_ignore(junk);
const unwrap<T1> tmp(in.get_ref()); const unwrap<T1> tmp(in.get_ref());
const Mat<in_eT>& X = tmp.M; const Mat<in_eT>& X = tmp.M;
arma_debug_check( (X.is_vec() == false), "conv_to(): given object can't b e interpreted as a vector" ); arma_debug_check( (X.is_vec() == false), "conv_to(): given object can't b e interpreted as a vector" );
std::vector<out_eT> out(X.n_elem); const uword N = X.n_elem;
typename Mat<in_eT>::const_iterator X_begin = X.begin();
typename Mat<in_eT>::const_iterator X_end = X.end();
typename std::vector<out_eT>::iterator out_begin = out.begin(); std::vector<out_eT> out(N);
typename std::vector<out_eT>::iterator out_end = out.end();
typename Mat<in_eT>::const_iterator X_it; if(N > 0)
typename std::vector<out_eT>::iterator out_it;
for(X_it = X_begin, out_it = out_begin; (X_it != X_end) && (out_it != out
_end); ++X_it, ++out_it)
{ {
(*out_it) = out_eT(*X_it); out_eT* out_mem = &(out[0]);
const in_eT* X_mem = X.memptr();
for(uword i=0; i<N; ++i)
{
out_mem[i] = out_eT( X_mem[i] );
}
} }
return out; return out;
} }
template<typename out_eT> template<typename out_eT>
template<typename in_eT, typename T1> template<typename in_eT, typename T1>
inline inline
std::vector<out_eT> std::vector<out_eT>
conv_to< std::vector<out_eT> >::from(const Base<in_eT, T1>& in, const typen ame arma_cx_only<in_eT>::result* junk) conv_to< std::vector<out_eT> >::from(const Base<in_eT, T1>& in, const typen ame arma_cx_only<in_eT>::result* junk)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_ignore(junk); arma_ignore(junk);
const unwrap<T1> tmp(in.get_ref()); const unwrap<T1> tmp(in.get_ref());
const Mat<in_eT>& X = tmp.M; const Mat<in_eT>& X = tmp.M;
arma_debug_check( (X.is_vec() == false), "conv_to(): given object can't b e interpreted as a vector" ); arma_debug_check( (X.is_vec() == false), "conv_to(): given object can't b e interpreted as a vector" );
std::vector<out_eT> out(X.n_elem); std::vector<out_eT> out(X.n_elem);
typename Mat<in_eT>::const_iterator X_begin = X.begin(); typename Mat<in_eT>::const_iterator X_begin = X.begin();
 End of changes. 37 change blocks. 
69 lines changed or deleted 42 lines changed or added


 fn_elem.hpp   fn_elem.hpp 
skipping to change at line 339 skipping to change at line 339
template<typename T1> template<typename T1>
arma_inline arma_inline
const eOpCube<T1, eop_square> const eOpCube<T1, eop_square>
square(const BaseCube<typename T1::elem_type,T1>& A) square(const BaseCube<typename T1::elem_type,T1>& A)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return eOpCube<T1, eop_square>(A.get_ref()); return eOpCube<T1, eop_square>(A.get_ref());
} }
template<typename T1>
arma_inline
const SpOp<T1, spop_square>
square(const SpBase<typename T1::elem_type,T1>& A)
{
arma_extra_debug_sigprint();
return SpOp<T1, spop_square>(A.get_ref());
}
// //
// sqrt // sqrt
template<typename T1> template<typename T1>
arma_inline arma_inline
const eOp<T1, eop_sqrt> const eOp<T1, eop_sqrt>
sqrt(const Base<typename T1::elem_type,T1>& A) sqrt(const Base<typename T1::elem_type,T1>& A)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
 End of changes. 1 change blocks. 
0 lines changed or deleted 10 lines changed or added


 operator_div.hpp   operator_div.hpp 
// Copyright (C) 2009-2012 NICTA (www.nicta.com.au) // Copyright (C) 2009-2012 NICTA (www.nicta.com.au)
// Copyright (C) 2009-2012 Conrad Sanderson // Copyright (C) 2009-2012 Conrad Sanderson
// Copyright (C) 2012 Ryan Curtin
// //
// 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 200 skipping to change at line 201
// //
// return result; // return result;
// } // }
//! element-wise division of one sparse and one dense object //! element-wise division of one sparse and one dense object
template<typename T1, typename T2> template<typename T1, typename T2>
inline inline
typename typename
enable_if2 enable_if2
< <
(is_arma_sparse_type<T1>::value && is_arma_type<T2>::value && (is_arma_sparse_type<T1>::value && is_arma_type<T2>::value && is_same_typ
is_same_type<typename T1::elem_type, typename T2::elem_type>::value), e<typename T1::elem_type, typename T2::elem_type>::value),
SpMat<typename T1::elem_type> SpMat<typename T1::elem_type>
>::result >::result
operator/ operator/
( (
const SpBase<typename T1::elem_type, T1>& x, const SpBase<typename T1::elem_type, T1>& x,
const Base<typename T2::elem_type, T2>& y const Base<typename T2::elem_type, T2>& y
) )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
const SpProxy<T1> pa(x.get_ref()); const SpProxy<T1> pa(x.get_ref());
const Proxy<T2> pb(y.get_ref()); const Proxy<T2> pb(y.get_ref());
arma_debug_assert_same_size(pa.get_n_rows(), pa.get_n_cols(), pb.get_n_ro ws(), pb.get_n_cols(), "element-wise division"); arma_debug_assert_same_size(pa.get_n_rows(), pa.get_n_cols(), pb.get_n_ro ws(), pb.get_n_cols(), "element-wise division");
SpMat<typename T1::elem_type> result(pa.get_n_rows(), pa.get_n_cols()); SpMat<typename T1::elem_type> result(pa.get_n_rows(), pa.get_n_cols());
// The compiler should be smart enough to optimize out the inner if/else statement entirely // The compiler should be smart enough to optimize out the inner if/else statement entirely
typename SpProxy<T1>::const_iterator_type it = pa.begin(); typename SpProxy<T1>::const_iterator_type it = pa.begin();
uword new_n_nonzero; uword new_n_nonzero;
while(it.pos() < pa.get_n_nonzero()) while(it.pos() < pa.get_n_nonzero())
{ {
skipping to change at line 291 skipping to change at line 291
return result; return result;
} }
//! element-wise division of one dense and one sparse object //! element-wise division of one dense and one sparse object
template<typename T1, typename T2> template<typename T1, typename T2>
inline inline
typename typename
enable_if2 enable_if2
< <
(is_arma_type<T1>::value && is_arma_sparse_type<T2>::value && (is_arma_type<T1>::value && is_arma_sparse_type<T2>::value && is_same_typ
is_same_type<typename T1::elem_type, typename T2::elem_type>::value), e<typename T1::elem_type, typename T2::elem_type>::value),
Mat<typename T1::elem_type> Mat<typename T1::elem_type>
>::result >::result
operator/ operator/
( (
const Base<typename T1::elem_type, T1>& x, const Base<typename T1::elem_type, T1>& x,
const SpBase<typename T2::elem_type, T2>& y const SpBase<typename T2::elem_type, T2>& y
) )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
const Proxy<T1> pa(x.get_ref()); const Proxy<T1> pa(x.get_ref());
const SpProxy<T2> pb(y.get_ref()); const SpProxy<T2> pb(y.get_ref());
arma_debug_assert_same_size(pa.get_n_rows(), pa.get_n_cols(), pb.get_n_ro ws(), pb.get_n_cols(), "element-wise division"); arma_debug_assert_same_size(pa.get_n_rows(), pa.get_n_cols(), pb.get_n_ro ws(), pb.get_n_cols(), "element-wise division");
Mat<typename T1::elem_type> result(pa.get_n_rows(), pa.get_n_cols()); Mat<typename T1::elem_type> result(pa.get_n_rows(), pa.get_n_cols());
result.fill(Datum<typename T1::elem_type>::inf); result.fill(Datum<typename T1::elem_type>::inf);
// Now divide each element // Now divide each element
typename SpProxy<T2>::const_iterator_type it = pb.begin(); typename SpProxy<T2>::const_iterator_type it = pb.begin();
 End of changes. 7 change blocks. 
8 lines changed or deleted 9 lines changed or added


 operator_minus.hpp   operator_minus.hpp 
// Copyright (C) 2008-2012 NICTA (www.nicta.com.au) // Copyright (C) 2008-2012 NICTA (www.nicta.com.au)
// Copyright (C) 2008-2012 Conrad Sanderson // Copyright (C) 2008-2012 Conrad Sanderson
// Copyright (C) 2012 Ryan Curtin
// //
// This file is part of the Armadillo C++ library. // This file is part of the Armadillo C++ library.
// It is provided without any warranty of fitness // It is provided without any warranty of fitness
// for any purpose. You can redistribute this file // for any purpose. You can redistribute this file
// and/or modify it under the terms of the GNU // and/or modify it under the terms of the GNU
// Lesser General Public License (LGPL) as published // Lesser General Public License (LGPL) as published
// by the Free Software Foundation, either version 3 // by the Free Software Foundation, either version 3
// of the License or (at your option) any later version. // of the License or (at your option) any later version.
// (see http://www.opensource.org/licenses for more info) // (see http://www.opensource.org/licenses for more info)
skipping to change at line 192 skipping to change at line 193
inline inline
typename typename
enable_if2 enable_if2
< <
(is_arma_sparse_type<T1>::value && is_arma_type<T2>::value && is_same_typ e<typename T1::elem_type, typename T2::elem_type>::value), (is_arma_sparse_type<T1>::value && is_arma_type<T2>::value && is_same_typ e<typename T1::elem_type, typename T2::elem_type>::value),
Mat<typename T1::elem_type> Mat<typename T1::elem_type>
>::result >::result
operator- operator-
( (
const SpBase<typename T1::elem_type, T1>& x, const SpBase<typename T1::elem_type, T1>& x,
const Base<typename T2::elem_type, T2>& y const Base<typename T2::elem_type, T2>& y
) )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
Mat<typename T1::elem_type> result(-y.get_ref()); Mat<typename T1::elem_type> result(-y.get_ref());
const SpProxy<T1> pa(x.get_ref()); const SpProxy<T1> pa(x.get_ref());
arma_debug_assert_same_size( pa.get_n_rows(), pa.get_n_cols(), result.n_r
ows, result.n_cols, "subtraction" );
typename SpProxy<T1>::const_iterator_type it = pa.begin(); typename SpProxy<T1>::const_iterator_type it = pa.begin();
while(it.pos() != pa.get_n_nonzero()) while(it.pos() != pa.get_n_nonzero())
{ {
const uword pos = it.col() * pa.get_n_cols() + it.row(); const uword pos = it.col() * pa.get_n_cols() + it.row();
result[pos] += (*it); result[pos] += (*it);
++it; ++it;
} }
return result; return result;
skipping to change at line 223 skipping to change at line 227
template<typename T1, typename T2> template<typename T1, typename T2>
inline inline
typename typename
enable_if2 enable_if2
< <
(is_arma_type<T1>::value && is_arma_sparse_type<T2>::value && is_same_typ e<typename T1::elem_type, typename T2::elem_type>::value), (is_arma_type<T1>::value && is_arma_sparse_type<T2>::value && is_same_typ e<typename T1::elem_type, typename T2::elem_type>::value),
Mat<typename T1::elem_type> Mat<typename T1::elem_type>
>::result >::result
operator- operator-
( (
const Base<typename T1::elem_type, T1>& x, const Base<typename T1::elem_type, T1>& x,
const SpBase<typename T2::elem_type, T2>& y const SpBase<typename T2::elem_type, T2>& y
) )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
Mat<typename T1::elem_type> result(x.get_ref()); Mat<typename T1::elem_type> result(x.get_ref());
const SpProxy<T2> pb(y.get_ref()); const SpProxy<T2> pb(y.get_ref());
arma_debug_assert_same_size( result.n_rows, result.n_cols, pb.get_n_rows(
), pb.get_n_cols(), "subtraction" );
typename SpProxy<T2>::const_iterator_type it = pb.begin(); typename SpProxy<T2>::const_iterator_type it = pb.begin();
while(it.pos() < pb.get_n_nonzero()) while(it.pos() < pb.get_n_nonzero())
{ {
const uword pos = it.col() * pb.get_n_cols() + it.row(); const uword pos = it.col() * pb.get_n_cols() + it.row();
result[pos] -= (*it); result[pos] -= (*it);
++it; ++it;
} }
return result; return result;
 End of changes. 7 change blocks. 
2 lines changed or deleted 11 lines changed or added


 operator_plus.hpp   operator_plus.hpp 
// Copyright (C) 2008-2012 NICTA (www.nicta.com.au) // Copyright (C) 2008-2012 NICTA (www.nicta.com.au)
// Copyright (C) 2008-2012 Conrad Sanderson // Copyright (C) 2008-2012 Conrad Sanderson
// Copyright (C) 2012 Ryan Curtin
// //
// 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 172 skipping to change at line 173
arma_inline arma_inline
typename typename
enable_if2 enable_if2
< <
(is_arma_sparse_type<T1>::value && is_arma_type<T2>::value && is_same_typ e<typename T1::elem_type, typename T2::elem_type>::value), (is_arma_sparse_type<T1>::value && is_arma_type<T2>::value && is_same_typ e<typename T1::elem_type, typename T2::elem_type>::value),
Mat<typename T1::elem_type> Mat<typename T1::elem_type>
>::result >::result
operator+ operator+
( (
const SpBase<typename T1::elem_type, T1>& x, const SpBase<typename T1::elem_type, T1>& x,
const Base<typename T2::elem_type, T2>& y const Base<typename T2::elem_type, T2>& y
) )
{ {
// Just call the other order (these operations are commutative) // Just call the other order (these operations are commutative)
return (y + x); return (y + x);
} }
//! addition of sparse and non-sparse object //! addition of sparse and non-sparse object
template<typename T1, typename T2> template<typename T1, typename T2>
inline inline
typename typename
enable_if2 enable_if2
< <
(is_arma_type<T1>::value && is_arma_sparse_type<T2>::value && is_same_typ e<typename T1::elem_type, typename T2::elem_type>::value), (is_arma_type<T1>::value && is_arma_sparse_type<T2>::value && is_same_typ e<typename T1::elem_type, typename T2::elem_type>::value),
Mat<typename T1::elem_type> Mat<typename T1::elem_type>
>::result >::result
operator+ operator+
( (
const Base<typename T1::elem_type, T1>& x, const Base<typename T1::elem_type, T1>& x,
const SpBase<typename T2::elem_type, T2>& y const SpBase<typename T2::elem_type, T2>& y
) )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
Mat<typename T1::elem_type> result(x.get_ref()); Mat<typename T1::elem_type> result(x.get_ref());
const SpProxy<T2> pb(y.get_ref()); const SpProxy<T2> pb(y.get_ref());
arma_debug_assert_same_size( result.n_rows, result.n_cols, pb.get_n_rows(
), pb.get_n_cols(), "addition" );
typename SpProxy<T2>::const_iterator_type it = pb.begin(); typename SpProxy<T2>::const_iterator_type it = pb.begin();
while(it.pos() < pb.get_n_nonzero()) while(it.pos() < pb.get_n_nonzero())
{ {
const uword pos = it.col() * pb.get_n_cols() + it.row(); const uword pos = it.col() * pb.get_n_cols() + it.row();
result[pos] += (*it); result[pos] += (*it);
++it; ++it;
} }
return result; return result;
 End of changes. 5 change blocks. 
2 lines changed or deleted 7 lines changed or added


 operator_schur.hpp   operator_schur.hpp 
// Copyright (C) 2008-2012 NICTA (www.nicta.com.au) // Copyright (C) 2008-2012 NICTA (www.nicta.com.au)
// Copyright (C) 2008-2012 Conrad Sanderson // Copyright (C) 2008-2012 Conrad Sanderson
// Copyright (C) 2012 Ryan Curtin
// //
// 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 165 skipping to change at line 166
template<typename T1, typename T2> template<typename T1, typename T2>
inline inline
typename typename
enable_if2 enable_if2
< <
(is_arma_type<T1>::value && is_arma_sparse_type<T2>::value && is_same_typ e<typename T1::elem_type, typename T2::elem_type>::value), (is_arma_type<T1>::value && is_arma_sparse_type<T2>::value && is_same_typ e<typename T1::elem_type, typename T2::elem_type>::value),
SpMat<typename T1::elem_type> SpMat<typename T1::elem_type>
>::result >::result
operator% operator%
( (
const Base<typename T1::elem_type, T1>& x, const Base<typename T1::elem_type, T1>& x,
const SpBase<typename T2::elem_type, T2>& y const SpBase<typename T2::elem_type, T2>& y
) )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
const Proxy<T1> pa(x.get_ref()); const Proxy<T1> pa(x.get_ref());
const SpProxy<T2> pb(y.get_ref()); const SpProxy<T2> pb(y.get_ref());
arma_debug_assert_same_size(pa.get_n_rows(), pa.get_n_cols(), pb.get_n_ro ws(), pb.get_n_cols(), "element-wise multiplication"); arma_debug_assert_same_size(pa.get_n_rows(), pa.get_n_cols(), pb.get_n_ro ws(), pb.get_n_cols(), "element-wise multiplication");
SpMat<typename T1::elem_type> result(pa.get_n_rows(), pa.get_n_cols()); SpMat<typename T1::elem_type> result(pa.get_n_rows(), pa.get_n_cols());
if(Proxy<T1>::prefer_at_accessor == false) if(Proxy<T1>::prefer_at_accessor == false)
{ {
// use direct operator[] access // use direct operator[] access
// count new size // count new size
 End of changes. 3 change blocks. 
2 lines changed or deleted 3 lines changed or added


 operator_times.hpp   operator_times.hpp 
skipping to change at line 426 skipping to change at line 426
>::result >::result
operator* operator*
( (
const T1& x, const T1& x,
const T2& y const T2& y
) )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
const SpProxy<T1> pa(x.get_ref()); const SpProxy<T1> pa(x.get_ref());
const Proxy<T2> pb(y.get_ref()); const Proxy<T2> pb(y.get_ref());
arma_debug_assert_mul_size(pa.get_n_rows(), pa.get_n_cols(), pb.get_n_row s(), pb.get_n_cols(), "matrix multiplication"); arma_debug_assert_mul_size(pa.get_n_rows(), pa.get_n_cols(), pb.get_n_row s(), pb.get_n_cols(), "matrix multiplication");
Mat<typename T1::elem_type> result(pa.get_n_rows(), pb.get_n_cols()); Mat<typename T1::elem_type> result(pa.get_n_rows(), pb.get_n_cols());
result.zeros(); result.zeros();
if(Proxy<T2>::prefer_at_accessor == false) if( (pa.get_n_nonzero() > 0) && (pb.get_n_elem() > 0) )
{ {
// use direct operator[] access if(Proxy<T2>::prefer_at_accessor == false)
for(typename SpProxy<T1>::const_iterator_type x_it = pa.begin(); x_it.p
os() < pa.get_n_nonzero(); x_it++)
{ {
// We just want to use values where y.row = x_it.col. // use direct operator[] access
for(uword col = 0; col < result.n_cols; col++) for(typename SpProxy<T1>::const_iterator_type x_it = pa.begin(); x_it
.pos() < pa.get_n_nonzero(); x_it++)
{ {
const uword index = x_it.col() + (pb.get_n_rows() * col); // We just want to use values where y.row = x_it.col.
result(x_it.row(), col) += (*x_it) * pb[index]; for(uword col = 0; col < result.n_cols; col++)
{
const uword index = x_it.col() + (pb.get_n_rows() * col);
result.at(x_it.row(), col) += (*x_it) * pb[index];
}
} }
} }
} else
else
{
// use at() access
for(typename SpProxy<T1>::const_iterator_type x_it = pa.begin(); x_it.p
os() < pa.get_n_nonzero(); x_it++)
{ {
for(uword col = 0; col < result.n_cols; col++) // use at() access
for(typename SpProxy<T1>::const_iterator_type x_it = pa.begin(); x_it
.pos() < pa.get_n_nonzero(); x_it++)
{ {
result(x_it.row(), col) += (*x_it) * pb.at(x_it.col(), col); for(uword col = 0; col < result.n_cols; col++)
{
result.at(x_it.row(), col) += (*x_it) * pb.at(x_it.col(), col);
}
} }
} }
} }
return result; return result;
} }
//! multiplication of one dense and one sparse object //! multiplication of one dense and one sparse object
template<typename T1, typename T2> template<typename T1, typename T2>
inline inline
skipping to change at line 478 skipping to change at line 481
Mat<typename T1::elem_type> Mat<typename T1::elem_type>
>::result >::result
operator* operator*
( (
const T1& x, const T1& x,
const T2& y const T2& y
) )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
const Proxy<T1> pa(x.get_ref()); const Proxy<T1> pa(x.get_ref());
const SpProxy<T2> pb(y.get_ref()); const SpProxy<T2> pb(y.get_ref());
arma_debug_assert_mul_size(pa.get_n_rows(), pa.get_n_cols(), pb.get_n_row s(), pb.get_n_cols(), "matrix multiplication"); arma_debug_assert_mul_size(pa.get_n_rows(), pa.get_n_cols(), pb.get_n_row s(), pb.get_n_cols(), "matrix multiplication");
Mat<typename T1::elem_type> result(pa.get_n_rows(), pb.get_n_cols()); Mat<typename T1::elem_type> result(pa.get_n_rows(), pb.get_n_cols());
result.zeros(); result.zeros();
if(Proxy<T1>::prefer_at_accessor == false) if( (pa.get_n_elem() > 0) && (pb.get_n_nonzero() > 0) )
{ {
// use direct operator[] access if(Proxy<T1>::prefer_at_accessor == false)
for(typename SpProxy<T2>::const_iterator_type y_col_it = pb.begin(); y_
col_it.pos() < pb.get_n_nonzero(); ++y_col_it)
{ {
for(uword row = 0; row < result.n_rows; ++row) // use direct operator[] access
for(typename SpProxy<T2>::const_iterator_type y_col_it = pb.begin();
y_col_it.pos() < pb.get_n_nonzero(); ++y_col_it)
{ {
const uword index = row + (y_col_it.row() * result.n_rows); for(uword row = 0; row < result.n_rows; ++row)
result(row, y_col_it.col()) += pa[index] * (*y_col_it); {
const uword index = row + (y_col_it.row() * result.n_rows);
result.at(row, y_col_it.col()) += pa[index] * (*y_col_it);
}
} }
} }
} else
else
{
// use at() access
for(typename SpProxy<T2>::const_iterator_type y_col_it = pb.begin(); y_
col_it.pos() < pb.get_n_nonzero(); ++y_col_it)
{ {
for(uword row = 0; row < result.n_rows; ++row) // use at() access
for(typename SpProxy<T2>::const_iterator_type y_col_it = pb.begin();
y_col_it.pos() < pb.get_n_nonzero(); ++y_col_it)
{ {
result(row, y_col_it.col()) += pa.at(row, y_col_it.row()) * (*y_col for(uword row = 0; row < result.n_rows; ++row)
_it); {
result.at(row, y_col_it.col()) += pa.at(row, y_col_it.row()) * (*
y_col_it);
}
} }
} }
} }
return result; return result;
} }
//! @} //! @}
 End of changes. 16 change blocks. 
34 lines changed or deleted 40 lines changed or added


 spop_misc_bones.hpp   spop_misc_bones.hpp 
skipping to change at line 23 skipping to change at line 23
//! @{ //! @{
class spop_scalar_times class spop_scalar_times
{ {
public: public:
template<typename T1> template<typename T1>
arma_hot inline static void apply(SpMat<typename T1::elem_type>& out, con st SpOp<T1, spop_scalar_times>& in); arma_hot inline static void apply(SpMat<typename T1::elem_type>& out, con st SpOp<T1, spop_scalar_times>& in);
}; };
class spop_square
{
public:
template<typename T1>
arma_hot inline static void apply(SpMat<typename T1::elem_type>& out, con
st SpOp<T1, spop_square>& in);
};
//! @} //! @}
 End of changes. 1 change blocks. 
0 lines changed or deleted 9 lines changed or added


 spop_misc_meat.hpp   spop_misc_meat.hpp 
skipping to change at line 28 skipping to change at line 28
void void
spop_scalar_times::apply(SpMat<typename T1::elem_type>& out, const SpOp<T1, spop_scalar_times>& in) spop_scalar_times::apply(SpMat<typename T1::elem_type>& out, const SpOp<T1, spop_scalar_times>& in)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
out = in.m; out = in.m;
out *= in.aux; out *= in.aux;
} }
template<typename T1>
arma_hot
inline
void
spop_square::apply(SpMat<typename T1::elem_type>& out, const SpOp<T1,spop_s
quare>& in)
{
arma_extra_debug_sigprint();
typedef typename T1::elem_type eT;
out = in.m;
eT* values = access::rwp(out.values);
const uword n_nz = out.n_nonzero;
uword i,j;
for(i=0, j=1; j < n_nz; i+=2, j+=2)
{
const eT tmp_i = values[i];
const eT tmp_j = values[j];
values[i] = tmp_i*tmp_i;
values[j] = tmp_j*tmp_j;
}
if(i < n_nz)
{
const eT tmp_i = values[i];
values[i] = tmp_i*tmp_i;
}
}
//! @} //! @}
 End of changes. 1 change blocks. 
0 lines changed or deleted 35 lines changed or added


 subview_elem2_bones.hpp   subview_elem2_bones.hpp 
skipping to change at line 37 skipping to change at line 37
arma_aligned const Mat<eT>& m; arma_aligned const Mat<eT>& m;
arma_aligned const Base<uword,T1>& base_ri; arma_aligned const Base<uword,T1>& base_ri;
arma_aligned const Base<uword,T2>& base_ci; arma_aligned const Base<uword,T2>& base_ci;
const bool all_rows; const bool all_rows;
const bool all_cols; const bool all_cols;
protected: protected:
arma_inline subview_elem2(const Mat<eT>& in_m, const Base<uword,T1>& in_r i, const Base<uword,T1>& in_ci, const bool in_all_rows, const bool in_all_c ols); arma_inline subview_elem2(const Mat<eT>& in_m, const Base<uword,T1>& in_r i, const Base<uword,T2>& in_ci, const bool in_all_rows, const bool in_all_c ols);
public: public:
inline ~subview_elem2(); inline ~subview_elem2();
template<typename op_type> template<typename op_type>
inline void inplace_op(const eT val); inline void inplace_op(const eT val);
template<typename op_type, typename expr> template<typename op_type, typename expr>
inline void inplace_op(const Base<eT,expr>& x); inline void inplace_op(const Base<eT,expr>& x);
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 subview_elem2_meat.hpp   subview_elem2_meat.hpp 
skipping to change at line 29 skipping to change at line 29
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
} }
template<typename eT, typename T1, typename T2> template<typename eT, typename T1, typename T2>
arma_inline arma_inline
subview_elem2<eT,T1,T2>::subview_elem2 subview_elem2<eT,T1,T2>::subview_elem2
( (
const Mat<eT>& in_m, const Mat<eT>& in_m,
const Base<uword,T1>& in_ri, const Base<uword,T1>& in_ri,
const Base<uword,T1>& in_ci, const Base<uword,T2>& in_ci,
const bool in_all_rows, const bool in_all_rows,
const bool in_all_cols const bool in_all_cols
) )
: m (in_m ) : m (in_m )
, base_ri (in_ri ) , base_ri (in_ri )
, base_ci (in_ci ) , base_ci (in_ci )
, all_rows (in_all_rows) , all_rows (in_all_rows)
, all_cols (in_all_cols) , all_cols (in_all_cols)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
 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/