Base.hpp   Base.hpp 
skipping to change at line 34 skipping to change at line 34
arma_inline arma_inline
const derived& const derived&
get_ref() const get_ref() const
{ {
return static_cast<const derived&>(*this); return static_cast<const derived&>(*this);
} }
}; };
template<typename elem_type, typename derived>
struct BaseVec
{
arma_inline
const derived&
get_ref() const
{
return static_cast<const derived&>(*this);
}
};
//! @} //! @}
 End of changes. 1 change blocks. 
13 lines changed or deleted 0 lines changed or added


 Col_meat.hpp   Col_meat.hpp 
// Copyright (C) 2008-2010 NICTA (www.nicta.com.au) // Copyright (C) 2008-2011 NICTA (www.nicta.com.au)
// Copyright (C) 2008-2010 Conrad Sanderson // Copyright (C) 2008-2011 Conrad Sanderson
// //
// This file is part of the Armadillo C++ library. // This file is part of the Armadillo C++ library.
// It is provided without any warranty of fitness // It is provided without any warranty of fitness
// for any purpose. You can redistribute this file // for any purpose. You can redistribute this file
// and/or modify it under the terms of the GNU // and/or modify it under the terms of the GNU
// Lesser General Public License (LGPL) as published // Lesser General Public License (LGPL) as published
// by the Free Software Foundation, either version 3 // by the Free Software Foundation, either version 3
// of the License or (at your option) any later version. // of the License or (at your option) any later version.
// (see http://www.opensource.org/licenses for more info) // (see http://www.opensource.org/licenses for more info)
skipping to change at line 327 skipping to change at line 327
const u32 n_keep_front = in_row1; const u32 n_keep_front = in_row1;
const u32 n_keep_back = Mat<eT>::n_rows - (in_row2 + 1); const u32 n_keep_back = Mat<eT>::n_rows - (in_row2 + 1);
Col<eT> X(n_keep_front + n_keep_back); Col<eT> X(n_keep_front + n_keep_back);
eT* X_mem = X.memptr(); eT* X_mem = X.memptr();
const eT* t_mem = (*this).memptr(); const eT* t_mem = (*this).memptr();
if(n_keep_front > 0) if(n_keep_front > 0)
{ {
syslib::copy_elem( X_mem, t_mem, n_keep_front ); arrayops::copy( X_mem, t_mem, n_keep_front );
} }
if(n_keep_back > 0) if(n_keep_back > 0)
{ {
syslib::copy_elem( &(X_mem[n_keep_front]), &(t_mem[in_row2+1]), n_keep_ back); arrayops::copy( &(X_mem[n_keep_front]), &(t_mem[in_row2+1]), n_keep_bac k);
} }
steal_mem(X); steal_mem(X);
} }
//! 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
skipping to change at line 364 skipping to change at line 364
if(N > 0) if(N > 0)
{ {
Col<eT> out(t_n_rows + N); Col<eT> out(t_n_rows + N);
eT* out_mem = out.memptr(); eT* out_mem = out.memptr();
const eT* t_mem = (*this).memptr(); const eT* t_mem = (*this).memptr();
if(A_n_rows > 0) if(A_n_rows > 0)
{ {
syslib::copy_elem( out_mem, t_mem, A_n_rows ); arrayops::copy( out_mem, t_mem, A_n_rows );
} }
if(B_n_rows > 0) if(B_n_rows > 0)
{ {
syslib::copy_elem( &(out_mem[row_num + N]), &(t_mem[row_num]), B_n_ro ws ); arrayops::copy( &(out_mem[row_num + N]), &(t_mem[row_num]), B_n_rows );
} }
if(set_to_zero == true) if(set_to_zero == true)
{ {
arrayops::inplace_set( &(out_mem[row_num]), eT(0), N ); arrayops::inplace_set( &(out_mem[row_num]), eT(0), N );
} }
steal_mem(out); steal_mem(out);
} }
} }
skipping to change at line 457 skipping to change at line 457
{ {
arma_extra_debug_sigprint_this(this); arma_extra_debug_sigprint_this(this);
if(fixed_n_elem > 0) if(fixed_n_elem > 0)
{ {
access::rw(Mat<eT>::n_rows) = fixed_n_elem; access::rw(Mat<eT>::n_rows) = fixed_n_elem;
access::rw(Mat<eT>::n_cols) = 1; access::rw(Mat<eT>::n_cols) = 1;
access::rw(Mat<eT>::n_elem) = fixed_n_elem; access::rw(Mat<eT>::n_elem) = fixed_n_elem;
access::rw(Mat<eT>::vec_state) = 1; access::rw(Mat<eT>::vec_state) = 1;
access::rw(Mat<eT>::mem_state) = 3; access::rw(Mat<eT>::mem_state) = 3;
access::rw(Mat<eT>::mem) = (fixed_n_elem > Mat_prealloc::mem_n_el em) ? mem_local_extra : Mat<eT>::mem_local; access::rw(Mat<eT>::mem) = (fixed_n_elem > arma_config::mat_preal loc) ? mem_local_extra : Mat<eT>::mem_local;
} }
else else
{ {
access::rw(Mat<eT>::n_rows) = 0; access::rw(Mat<eT>::n_rows) = 0;
access::rw(Mat<eT>::n_cols) = 0; access::rw(Mat<eT>::n_cols) = 0;
access::rw(Mat<eT>::n_elem) = 0; access::rw(Mat<eT>::n_elem) = 0;
access::rw(Mat<eT>::vec_state) = 1; access::rw(Mat<eT>::vec_state) = 1;
access::rw(Mat<eT>::mem_state) = 3; access::rw(Mat<eT>::mem_state) = 3;
access::rw(Mat<eT>::mem) = 0; access::rw(Mat<eT>::mem) = 0;
} }
 End of changes. 6 change blocks. 
7 lines changed or deleted 7 lines changed or added


 Col_proto.hpp   Col_proto.hpp 
// Copyright (C) 2008-2010 NICTA (www.nicta.com.au) // Copyright (C) 2008-2011 NICTA (www.nicta.com.au)
// Copyright (C) 2008-2010 Conrad Sanderson // Copyright (C) 2008-2011 Conrad Sanderson
// //
// This file is part of the Armadillo C++ library. // This file is part of the Armadillo C++ library.
// It is provided without any warranty of fitness // It is provided without any warranty of fitness
// for any purpose. You can redistribute this file // for any purpose. You can redistribute this file
// and/or modify it under the terms of the GNU // and/or modify it under the terms of the GNU
// Lesser General Public License (LGPL) as published // Lesser General Public License (LGPL) as published
// by the Free Software Foundation, either version 3 // by the Free Software Foundation, either version 3
// of the License or (at your option) any later version. // of the License or (at your option) any later version.
// (see http://www.opensource.org/licenses for more info) // (see http://www.opensource.org/licenses for more info)
//! \addtogroup Col //! \addtogroup Col
//! @{ //! @{
//! Class for column vectors (matrices with only one column) //! Class for column vectors (matrices with only one column)
template<typename eT> template<typename eT>
class Col : public Mat<eT>, public BaseVec< eT, Col<eT> > class Col : public Mat<eT>
{ {
public: public:
typedef eT elem_type; typedef eT elem_type;
typedef typename get_pod_type<eT>::result pod_type; typedef typename get_pod_type<eT>::result pod_type;
inline Col(); inline Col();
inline explicit Col(const u32 n_elem); inline explicit Col(const u32 n_elem);
inline Col(const u32 in_rows, const u32 in_cols); inline Col(const u32 in_rows, const u32 in_cols);
skipping to change at line 80 skipping to change at line 80
inline const_row_iterator begin_row(const u32 row_num) const; inline const_row_iterator begin_row(const u32 row_num) const;
inline row_iterator end_row (const u32 row_num); inline row_iterator end_row (const u32 row_num);
inline const_row_iterator end_row (const u32 row_num) const; inline const_row_iterator end_row (const u32 row_num) const;
template<u32 fixed_n_elem> template<u32 fixed_n_elem>
class fixed : public Col<eT> class fixed : public Col<eT>
{ {
private: private:
arma_aligned eT mem_local_extra[ ( fixed_n_elem > Mat_prealloc::mem_n_e lem ) ? fixed_n_elem : 1 ]; arma_aligned eT mem_local_extra[ (fixed_n_elem > arma_config::mat_preal loc) ? fixed_n_elem : 1 ];
arma_inline void mem_setup(); arma_inline void mem_setup();
arma_inline void swap_rows_cols() { access::rw(Mat<eT>::n_cols) = fixed _n_elem; access::rw(Mat<eT>::n_rows) = 1; } arma_inline void swap_rows_cols() { access::rw(Mat<eT>::n_cols) = fixed _n_elem; access::rw(Mat<eT>::n_rows) = 1; }
public: public:
inline fixed() { mem_setup(); } inline fixed() { mem_setup(); }
inline fixed(const char* text) { mem_setup(); swa p_rows_cols(); Col<eT>::operator=(text); } inline fixed(const char* text) { mem_setup(); swa p_rows_cols(); Col<eT>::operator=(text); }
inline const Col& operator=(const char* text) { swa p_rows_cols(); Col<eT>::operator=(text); return *this; } inline const Col& operator=(const char* text) { swa p_rows_cols(); Col<eT>::operator=(text); return *this; }
 End of changes. 3 change blocks. 
4 lines changed or deleted 4 lines changed or added


 Cube_meat.hpp   Cube_meat.hpp 
skipping to change at line 418 skipping to change at line 418
template<typename eT> template<typename eT>
inline inline
void void
Cube<eT>::init(const Cube<eT>& x) Cube<eT>::init(const Cube<eT>& x)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
if(this != &x) if(this != &x)
{ {
init(x.n_rows, x.n_cols, x.n_slices); init(x.n_rows, x.n_cols, x.n_slices);
syslib::copy_elem( memptr(), x.mem, n_elem ); arrayops::copy( memptr(), x.mem, n_elem );
} }
} }
//! construct a cube from a given auxiliary array of eTs. //! construct a cube from a given auxiliary array of eTs.
//! if copy_aux_mem is true, new memory is allocated and the array is copie d. //! if copy_aux_mem is true, new memory is allocated and the array is copie d.
//! if copy_aux_mem is false, the auxiliary array is used directly (without allocating memory and copying). //! if copy_aux_mem is false, the auxiliary array is used directly (without allocating memory and copying).
//! note that in the latter case //! note that in the latter case
//! the default is to copy the array. //! the default is to copy the array.
template<typename eT> template<typename eT>
skipping to change at line 446 skipping to change at line 446
, mem_state (copy_aux_mem ? 0 : (strict ? 2 : 1) ) , mem_state (copy_aux_mem ? 0 : (strict ? 2 : 1) )
, mat_ptrs (mat_ptrs ) , mat_ptrs (mat_ptrs )
, mem (copy_aux_mem ? mem : aux_mem ) , mem (copy_aux_mem ? mem : aux_mem )
{ {
arma_extra_debug_sigprint_this(this); arma_extra_debug_sigprint_this(this);
if(copy_aux_mem == true) if(copy_aux_mem == true)
{ {
init(aux_n_rows, aux_n_cols, aux_n_slices); init(aux_n_rows, aux_n_cols, aux_n_slices);
syslib::copy_elem( memptr(), aux_mem, n_elem ); arrayops::copy( memptr(), aux_mem, n_elem );
} }
else else
{ {
create_mat(); create_mat();
} }
} }
//! construct a cube from a given auxiliary read-only array of eTs. //! construct a cube from a given auxiliary read-only array of eTs.
//! the array is copied. //! the array is copied.
template<typename eT> template<typename eT>
skipping to change at line 471 skipping to change at line 471
, n_elem_slice(0) , n_elem_slice(0)
, n_slices(0) , n_slices(0)
, n_elem(0) , n_elem(0)
, mem_state(0) , mem_state(0)
, mat_ptrs(mat_ptrs) , mat_ptrs(mat_ptrs)
, mem(mem) , mem(mem)
{ {
arma_extra_debug_sigprint_this(this); arma_extra_debug_sigprint_this(this);
init(aux_n_rows, aux_n_cols, aux_n_slices); init(aux_n_rows, aux_n_cols, aux_n_slices);
syslib::copy_elem( memptr(), aux_mem, n_elem ); arrayops::copy( memptr(), aux_mem, n_elem );
} }
//! in-place cube addition //! in-place cube addition
template<typename eT> template<typename eT>
inline inline
const Cube<eT>& const Cube<eT>&
Cube<eT>::operator+=(const Cube<eT>& m) Cube<eT>::operator+=(const Cube<eT>& m)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
 End of changes. 3 change blocks. 
3 lines changed or deleted 3 lines changed or added


 Mat_meat.hpp   Mat_meat.hpp 
// Copyright (C) 2008-2010 NICTA (www.nicta.com.au) // Copyright (C) 2008-2011 NICTA (www.nicta.com.au)
// Copyright (C) 2008-2010 Conrad Sanderson // Copyright (C) 2008-2011 Conrad Sanderson
// //
// This file is part of the Armadillo C++ library. // This file is part of the Armadillo C++ library.
// It is provided without any warranty of fitness // It is provided without any warranty of fitness
// for any purpose. You can redistribute this file // for any purpose. You can redistribute this file
// and/or modify it under the terms of the GNU // and/or modify it under the terms of the GNU
// Lesser General Public License (LGPL) as published // Lesser General Public License (LGPL) as published
// by the Free Software Foundation, either version 3 // by the Free Software Foundation, either version 3
// of the License or (at your option) any later version. // of the License or (at your option) any later version.
// (see http://www.opensource.org/licenses for more info) // (see http://www.opensource.org/licenses for more info)
skipping to change at line 24 skipping to change at line 24
//! @{ //! @{
template<typename eT> template<typename eT>
inline inline
Mat<eT>::~Mat() Mat<eT>::~Mat()
{ {
arma_extra_debug_sigprint_this(this); arma_extra_debug_sigprint_this(this);
if(mem_state == 0) if(mem_state == 0)
{ {
if(n_elem > Mat_prealloc::mem_n_elem) if(n_elem > arma_config::mat_prealloc)
{ {
delete [] mem; delete [] mem;
} }
} }
if(arma_config::debug == true) if(arma_config::debug == true)
{ {
// try to expose buggy user code that accesses deleted objects // try to expose buggy user code that accesses deleted objects
access::rw(n_rows) = 0; access::rw(n_rows) = 0;
access::rw(n_cols) = 0; access::rw(n_cols) = 0;
skipping to change at line 126 skipping to change at line 126
else else
{ {
arma_debug_check arma_debug_check
( (
(t_mem_state == 2), (t_mem_state == 2),
"Mat::init(): requested size is not compatible with the size of aux iliary memory" "Mat::init(): requested size is not compatible with the size of aux iliary memory"
); );
if(t_mem_state == 0) if(t_mem_state == 0)
{ {
if(old_n_elem > Mat_prealloc::mem_n_elem ) if(old_n_elem > arma_config::mat_prealloc)
{ {
arma_extra_debug_print("Mat::init(): freeing memory"); arma_extra_debug_print("Mat::init(): freeing memory");
delete [] mem; delete [] mem;
} }
} }
if(new_n_elem <= Mat_prealloc::mem_n_elem ) if(new_n_elem <= arma_config::mat_prealloc)
{ {
access::rw(mem) = mem_local; access::rw(mem) = mem_local;
} }
else else
{ {
arma_extra_debug_print("Mat::init(): allocating memory"); arma_extra_debug_print("Mat::init(): allocating memory");
access::rw(mem) = new(std::nothrow) eT[new_n_elem]; access::rw(mem) = new(std::nothrow) eT[new_n_elem];
arma_check( (mem == 0), "Mat::init(): out of memory" ); arma_check( (mem == 0), "Mat::init(): out of memory" );
skipping to change at line 419 skipping to change at line 419
template<typename eT> template<typename eT>
inline inline
void void
Mat<eT>::init(const Mat<eT>& x) Mat<eT>::init(const Mat<eT>& x)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
if(this != &x) if(this != &x)
{ {
init(x.n_rows, x.n_cols); init(x.n_rows, x.n_cols);
syslib::copy_elem( memptr(), x.mem, x.n_elem ); arrayops::copy( memptr(), x.mem, x.n_elem );
} }
} }
//! for constructing a complex matrix out of two non-complex matrices //! for constructing a complex matrix out of two non-complex matrices
template<typename eT> template<typename eT>
template<typename T1, typename T2> template<typename T1, typename T2>
inline inline
void void
Mat<eT>::init Mat<eT>::init
( (
skipping to change at line 501 skipping to change at line 501
{ {
layout_ok = true; layout_ok = true;
} }
if( (t_vec_state == 2) && ( x_n_rows <= 1) ) if( (t_vec_state == 2) && ( x_n_rows <= 1) )
{ {
layout_ok = true; layout_ok = true;
} }
} }
if( (x_mem_state == 0) && (x_n_elem > Mat_prealloc::mem_n_elem) && (lay out_ok == true) ) if( (x_mem_state == 0) && (x_n_elem > arma_config::mat_prealloc) && (la yout_ok == true) )
{ {
reset(); reset();
access::rw(n_rows) = x_n_rows; access::rw(n_rows) = x_n_rows;
access::rw(n_cols) = x_n_cols; access::rw(n_cols) = x_n_cols;
access::rw(n_elem) = x_n_elem; access::rw(n_elem) = x_n_elem;
access::rw(mem) = x.mem; access::rw(mem) = x.mem;
access::rw(x.n_rows) = 0; access::rw(x.n_rows) = 0;
access::rw(x.n_cols) = 0; access::rw(x.n_cols) = 0;
skipping to change at line 543 skipping to change at line 543
, vec_state( 0 ) , vec_state( 0 )
, mem_state(copy_aux_mem ? 0 : ( strict ? 2 : 1 ) ) , mem_state(copy_aux_mem ? 0 : ( strict ? 2 : 1 ) )
, mem (copy_aux_mem ? mem : aux_mem ) , mem (copy_aux_mem ? mem : aux_mem )
{ {
arma_extra_debug_sigprint_this(this); arma_extra_debug_sigprint_this(this);
if(copy_aux_mem == true) if(copy_aux_mem == true)
{ {
init(aux_n_rows, aux_n_cols); init(aux_n_rows, aux_n_cols);
syslib::copy_elem( memptr(), aux_mem, n_elem ); arrayops::copy( memptr(), aux_mem, n_elem );
} }
} }
//! construct a matrix from a given auxiliary read-only array of eTs. //! construct a matrix from a given auxiliary read-only array of eTs.
//! the array is copied. //! the array is copied.
template<typename eT> template<typename eT>
inline inline
Mat<eT>::Mat(const eT* aux_mem, const u32 aux_n_rows, const u32 aux_n_cols) Mat<eT>::Mat(const eT* aux_mem, const u32 aux_n_rows, const u32 aux_n_cols)
: 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)
//, mem(0) //, mem(0)
, mem(mem) , mem(mem)
{ {
arma_extra_debug_sigprint_this(this); arma_extra_debug_sigprint_this(this);
init(aux_n_rows, aux_n_cols); init(aux_n_rows, aux_n_cols);
syslib::copy_elem( memptr(), aux_mem, n_elem ); arrayops::copy( memptr(), aux_mem, n_elem );
} }
//! DANGEROUS! Construct a temporary matrix, using auxiliary memory. //! DANGEROUS! Construct a temporary matrix, using auxiliary memory.
//! This constructor is NOT intended for usage by user code. //! This constructor is NOT intended for usage by user code.
//! Its sole purpose is to be used by the Cube class. //! Its sole purpose is to be used by the Cube class.
template<typename eT> template<typename eT>
inline inline
Mat<eT>::Mat(const char junk, const eT* aux_mem, const u32 aux_n_rows, cons t u32 aux_n_cols) Mat<eT>::Mat(const char junk, const eT* aux_mem, const u32 aux_n_rows, cons t u32 aux_n_cols)
: n_rows (aux_n_rows ) : n_rows (aux_n_rows )
skipping to change at line 3953 skipping to change at line 3953
{ {
arma_extra_debug_sigprint_this(this); arma_extra_debug_sigprint_this(this);
if(fixed_n_elem > 0) if(fixed_n_elem > 0)
{ {
access::rw(Mat<eT>::n_rows) = fixed_n_rows; access::rw(Mat<eT>::n_rows) = fixed_n_rows;
access::rw(Mat<eT>::n_cols) = fixed_n_cols; access::rw(Mat<eT>::n_cols) = fixed_n_cols;
access::rw(Mat<eT>::n_elem) = fixed_n_elem; access::rw(Mat<eT>::n_elem) = fixed_n_elem;
access::rw(Mat<eT>::vec_state) = 0; access::rw(Mat<eT>::vec_state) = 0;
access::rw(Mat<eT>::mem_state) = 3; access::rw(Mat<eT>::mem_state) = 3;
access::rw(Mat<eT>::mem) = (fixed_n_elem > Mat_prealloc::mem_n_el em) ? mem_local_extra : mem_local; access::rw(Mat<eT>::mem) = (fixed_n_elem > arma_config::mat_preal loc) ? mem_local_extra : mem_local;
} }
else else
{ {
access::rw(Mat<eT>::n_rows) = 0; access::rw(Mat<eT>::n_rows) = 0;
access::rw(Mat<eT>::n_cols) = 0; access::rw(Mat<eT>::n_cols) = 0;
access::rw(Mat<eT>::n_elem) = 0; access::rw(Mat<eT>::n_elem) = 0;
access::rw(Mat<eT>::vec_state) = 0; access::rw(Mat<eT>::vec_state) = 0;
access::rw(Mat<eT>::mem_state) = 3; access::rw(Mat<eT>::mem_state) = 3;
access::rw(Mat<eT>::mem) = 0; access::rw(Mat<eT>::mem) = 0;
} }
 End of changes. 9 change blocks. 
10 lines changed or deleted 10 lines changed or added


 Mat_proto.hpp   Mat_proto.hpp 
// Copyright (C) 2008-2010 NICTA (www.nicta.com.au) // Copyright (C) 2008-2011 NICTA (www.nicta.com.au)
// Copyright (C) 2008-2010 Conrad Sanderson // Copyright (C) 2008-2011 Conrad Sanderson
// //
// This file is part of the Armadillo C++ library. // This file is part of the Armadillo C++ library.
// It is provided without any warranty of fitness // It is provided without any warranty of fitness
// for any purpose. You can redistribute this file // for any purpose. You can redistribute this file
// and/or modify it under the terms of the GNU // and/or modify it under the terms of the GNU
// Lesser General Public License (LGPL) as published // Lesser General Public License (LGPL) as published
// by the Free Software Foundation, either version 3 // by the Free Software Foundation, either version 3
// of the License or (at your option) any later version. // of the License or (at your option) any later version.
// (see http://www.opensource.org/licenses for more info) // (see http://www.opensource.org/licenses for more info)
//! \addtogroup Mat //! \addtogroup Mat
//! @{ //! @{
struct Mat_prealloc
{
static const u32 mem_n_elem = 16;
};
//! Dense matrix class //! Dense matrix class
template<typename eT> template<typename eT>
class Mat : public Base< eT, Mat<eT> > class Mat : public Base< eT, Mat<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 same as eT. otherwise, pod_type is the underlying type used by std::complex typedef typename get_pod_type<eT>::result pod_type; //!< if eT is non-c omplex, pod_type is same as eT. otherwise, pod_type is the underlying type used by std::complex
skipping to change at line 45 skipping to change at line 40
const u16 mem_state; const u16 mem_state;
// mem_state = 0: normal matrix that can be resized; // mem_state = 0: normal matrix that can be resized;
// mem_state = 1: use auxiliary memory until change in the number of elem ents is requested; // mem_state = 1: use auxiliary memory until change in the number of elem ents is requested;
// mem_state = 2: use auxiliary memory and don't allow the number of elem ents to be changed; // mem_state = 2: use auxiliary memory and don't allow the number of elem ents to be changed;
// mem_state = 3: fixed size (e.g. via template based size specification) . // mem_state = 3: fixed size (e.g. via template based size specification) .
arma_aligned const eT* const mem; //!< pointer to the memory used by the matrix (memory is read-only) arma_aligned const eT* const mem; //!< pointer to the memory used by the matrix (memory is read-only)
protected: protected:
arma_aligned eT mem_local[ Mat_prealloc::mem_n_elem ]; arma_aligned eT mem_local[ arma_config::mat_prealloc ];
public: public:
inline ~Mat(); inline ~Mat();
inline Mat(); inline Mat();
inline Mat(const u32 in_rows, const u32 in_cols); inline Mat(const u32 in_rows, const u32 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);
skipping to change at line 410 skipping to change at line 405
// arma_inline bool empty() const; // arma_inline bool empty() const;
// arma_inline u32 size() const; // arma_inline u32 size() const;
template<u32 fixed_n_rows, u32 fixed_n_cols> template<u32 fixed_n_rows, u32 fixed_n_cols>
class fixed : public Mat<eT> class fixed : public Mat<eT>
{ {
private: private:
static const u32 fixed_n_elem = fixed_n_rows * fixed_n_cols; static const u32 fixed_n_elem = fixed_n_rows * fixed_n_cols;
arma_aligned eT mem_local_extra[ ( fixed_n_elem > Mat_prealloc::mem_n_e lem ) ? fixed_n_elem : 1 ]; arma_aligned eT mem_local_extra[ (fixed_n_elem > arma_config::mat_preal loc) ? fixed_n_elem : 1 ];
arma_inline void mem_setup(); arma_inline void mem_setup();
public: public:
inline fixed() { mem_setup(); } inline fixed() { mem_setup(); }
inline fixed(const char* text) { mem_setup(); Mat <eT>::operator=(text); } inline fixed(const char* text) { mem_setup(); Mat <eT>::operator=(text); }
inline const Mat& operator=(const char* text) { Mat <eT>::operator=(text); return *this; } inline const Mat& operator=(const char* text) { Mat <eT>::operator=(text); return *this; }
inline fixed(const std::string& text) { mem_setup(); Mat <eT>::operator=(text); } inline fixed(const std::string& text) { mem_setup(); Mat <eT>::operator=(text); }
 End of changes. 4 change blocks. 
9 lines changed or deleted 4 lines changed or added


 Row_meat.hpp   Row_meat.hpp 
// Copyright (C) 2008-2010 NICTA (www.nicta.com.au) // Copyright (C) 2008-2011 NICTA (www.nicta.com.au)
// Copyright (C) 2008-2010 Conrad Sanderson // Copyright (C) 2008-2011 Conrad Sanderson
// //
// This file is part of the Armadillo C++ library. // This file is part of the Armadillo C++ library.
// It is provided without any warranty of fitness // It is provided without any warranty of fitness
// for any purpose. You can redistribute this file // for any purpose. You can redistribute this file
// and/or modify it under the terms of the GNU // and/or modify it under the terms of the GNU
// Lesser General Public License (LGPL) as published // Lesser General Public License (LGPL) as published
// by the Free Software Foundation, either version 3 // by the Free Software Foundation, either version 3
// of the License or (at your option) any later version. // of the License or (at your option) any later version.
// (see http://www.opensource.org/licenses for more info) // (see http://www.opensource.org/licenses for more info)
skipping to change at line 299 skipping to change at line 299
const u32 n_keep_front = in_col1; const u32 n_keep_front = in_col1;
const u32 n_keep_back = Mat<eT>::n_cols - (in_col2 + 1); const u32 n_keep_back = Mat<eT>::n_cols - (in_col2 + 1);
Row<eT> X(n_keep_front + n_keep_back); Row<eT> X(n_keep_front + n_keep_back);
eT* X_mem = X.memptr(); eT* X_mem = X.memptr();
const eT* t_mem = (*this).memptr(); const eT* t_mem = (*this).memptr();
if(n_keep_front > 0) if(n_keep_front > 0)
{ {
syslib::copy_elem( X_mem, t_mem, n_keep_front ); arrayops::copy( X_mem, t_mem, n_keep_front );
} }
if(n_keep_back > 0) if(n_keep_back > 0)
{ {
syslib::copy_elem( &(X_mem[n_keep_front]), &(t_mem[in_col2+1]), n_keep_ back); arrayops::copy( &(X_mem[n_keep_front]), &(t_mem[in_col2+1]), n_keep_bac k);
} }
steal_mem(X); steal_mem(X);
} }
//! 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
skipping to change at line 336 skipping to change at line 336
if(N > 0) if(N > 0)
{ {
Row<eT> out(t_n_cols + N); Row<eT> out(t_n_cols + N);
eT* out_mem = out.memptr(); eT* out_mem = out.memptr();
const eT* t_mem = (*this).memptr(); const eT* t_mem = (*this).memptr();
if(A_n_cols > 0) if(A_n_cols > 0)
{ {
syslib::copy_elem( out_mem, t_mem, A_n_cols ); arrayops::copy( out_mem, t_mem, A_n_cols );
} }
if(B_n_cols > 0) if(B_n_cols > 0)
{ {
syslib::copy_elem( &(out_mem[col_num + N]), &(t_mem[col_num]), B_n_co ls ); arrayops::copy( &(out_mem[col_num + N]), &(t_mem[col_num]), B_n_cols );
} }
if(set_to_zero == true) if(set_to_zero == true)
{ {
arrayops::inplace_set( &(out_mem[col_num]), eT(0), N ); arrayops::inplace_set( &(out_mem[col_num]), eT(0), N );
} }
steal_mem(out); steal_mem(out);
} }
} }
skipping to change at line 429 skipping to change at line 429
{ {
arma_extra_debug_sigprint_this(this); arma_extra_debug_sigprint_this(this);
if(fixed_n_elem > 0) if(fixed_n_elem > 0)
{ {
access::rw(Mat<eT>::n_rows) = 1; access::rw(Mat<eT>::n_rows) = 1;
access::rw(Mat<eT>::n_cols) = fixed_n_elem; access::rw(Mat<eT>::n_cols) = fixed_n_elem;
access::rw(Mat<eT>::n_elem) = fixed_n_elem; access::rw(Mat<eT>::n_elem) = fixed_n_elem;
access::rw(Mat<eT>::vec_state) = 2; access::rw(Mat<eT>::vec_state) = 2;
access::rw(Mat<eT>::mem_state) = 3; access::rw(Mat<eT>::mem_state) = 3;
access::rw(Mat<eT>::mem) = (fixed_n_elem > Mat_prealloc::mem_n_el em) ? mem_local_extra : Mat<eT>::mem_local; access::rw(Mat<eT>::mem) = (fixed_n_elem > arma_config::mat_preal loc) ? mem_local_extra : Mat<eT>::mem_local;
} }
else else
{ {
access::rw(Mat<eT>::n_rows) = 0; access::rw(Mat<eT>::n_rows) = 0;
access::rw(Mat<eT>::n_cols) = 0; access::rw(Mat<eT>::n_cols) = 0;
access::rw(Mat<eT>::n_elem) = 0; access::rw(Mat<eT>::n_elem) = 0;
access::rw(Mat<eT>::vec_state) = 2; access::rw(Mat<eT>::vec_state) = 2;
access::rw(Mat<eT>::mem_state) = 3; access::rw(Mat<eT>::mem_state) = 3;
access::rw(Mat<eT>::mem) = 0; access::rw(Mat<eT>::mem) = 0;
} }
 End of changes. 6 change blocks. 
7 lines changed or deleted 7 lines changed or added


 Row_proto.hpp   Row_proto.hpp 
// Copyright (C) 2008-2010 NICTA (www.nicta.com.au) // Copyright (C) 2008-2011 NICTA (www.nicta.com.au)
// Copyright (C) 2008-2010 Conrad Sanderson // Copyright (C) 2008-2011 Conrad Sanderson
// //
// This file is part of the Armadillo C++ library. // This file is part of the Armadillo C++ library.
// It is provided without any warranty of fitness // It is provided without any warranty of fitness
// for any purpose. You can redistribute this file // for any purpose. You can redistribute this file
// and/or modify it under the terms of the GNU // and/or modify it under the terms of the GNU
// Lesser General Public License (LGPL) as published // Lesser General Public License (LGPL) as published
// by the Free Software Foundation, either version 3 // by the Free Software Foundation, either version 3
// of the License or (at your option) any later version. // of the License or (at your option) any later version.
// (see http://www.opensource.org/licenses for more info) // (see http://www.opensource.org/licenses for more info)
//! \addtogroup Row //! \addtogroup Row
//! @{ //! @{
//! Class for row vectors (matrices with only one row) //! Class for row vectors (matrices with only one row)
template<typename eT> template<typename eT>
class Row : public Mat<eT>, public BaseVec< eT, Row<eT> > class Row : public Mat<eT>
{ {
public: public:
typedef eT elem_type; typedef eT elem_type;
typedef typename get_pod_type<eT>::result pod_type; typedef typename get_pod_type<eT>::result pod_type;
inline Row(); inline Row();
inline explicit Row(const u32 N); inline explicit Row(const u32 N);
inline Row(const u32 in_rows, const u32 in_cols); inline Row(const u32 in_rows, const u32 in_cols);
skipping to change at line 80 skipping to change at line 80
inline const_row_iterator begin_row(const u32 row_num) const; inline const_row_iterator begin_row(const u32 row_num) const;
inline row_iterator end_row (const u32 row_num); inline row_iterator end_row (const u32 row_num);
inline const_row_iterator end_row (const u32 row_num) const; inline const_row_iterator end_row (const u32 row_num) const;
template<u32 fixed_n_elem> template<u32 fixed_n_elem>
class fixed : public Row<eT> class fixed : public Row<eT>
{ {
private: private:
arma_aligned eT mem_local_extra[ ( fixed_n_elem > Mat_prealloc::mem_n_e lem ) ? fixed_n_elem : 1 ]; arma_aligned eT mem_local_extra[ (fixed_n_elem > arma_config::mat_preal loc) ? fixed_n_elem : 1 ];
arma_inline void mem_setup(); arma_inline void mem_setup();
public: public:
inline fixed() { mem_setup(); } inline fixed() { mem_setup(); }
inline fixed(const char* text) { mem_setup(); Row <eT>::operator=(text); } inline fixed(const char* text) { mem_setup(); Row <eT>::operator=(text); }
inline const Row& operator=(const char* text) { Row <eT>::operator=(text); return *this; } inline const Row& operator=(const char* text) { Row <eT>::operator=(text); return *this; }
inline fixed(const std::string& text) { mem_setup(); Row <eT>::operator=(text); } inline fixed(const std::string& text) { mem_setup(); Row <eT>::operator=(text); }
 End of changes. 3 change blocks. 
4 lines changed or deleted 4 lines changed or added


 arma_config.hpp   arma_config.hpp 
// Copyright (C) 2008-2010 NICTA (www.nicta.com.au) // Copyright (C) 2008-2011 NICTA (www.nicta.com.au)
// Copyright (C) 2008-2010 Conrad Sanderson // Copyright (C) 2008-2011 Conrad Sanderson
// //
// This file is part of the Armadillo C++ library. // This file is part of the Armadillo C++ library.
// It is provided without any warranty of fitness // It is provided without any warranty of fitness
// for any purpose. You can redistribute this file // for any purpose. You can redistribute this file
// and/or modify it under the terms of the GNU // and/or modify it under the terms of the GNU
// Lesser General Public License (LGPL) as published // Lesser General Public License (LGPL) as published
// by the Free Software Foundation, either version 3 // by the Free Software Foundation, either version 3
// of the License or (at your option) any later version. // of the License or (at your option) any later version.
// (see http://www.opensource.org/licenses for more info) // (see http://www.opensource.org/licenses for more info)
//! \addtogroup arma_config //! \addtogroup arma_config
//! @{ //! @{
struct arma_config struct arma_config
{ {
#if defined(ARMA_MAT_PREALLOC)
static const u32 mat_prealloc = (s32(ARMA_MAT_PREALLOC) > 0) ? u32(ARMA
_MAT_PREALLOC) : 1;
#else
static const u32 mat_prealloc = 16;
#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;
#endif #endif
#if defined(ARMA_USE_LAPACK) #if defined(ARMA_USE_LAPACK)
static const bool lapack = true; static const bool lapack = true;
#else #else
static const bool lapack = false; static const bool lapack = false;
 End of changes. 2 change blocks. 
2 lines changed or deleted 9 lines changed or added


 arma_version.hpp   arma_version.hpp 
// Copyright (C) 2009-2010 NICTA (www.nicta.com.au) // Copyright (C) 2009-2011 NICTA (www.nicta.com.au)
// Copyright (C) 2009-2010 Conrad Sanderson // Copyright (C) 2009-2011 Conrad Sanderson
// //
// This file is part of the Armadillo C++ library. // This file is part of the Armadillo C++ library.
// It is provided without any warranty of fitness // It is provided without any warranty of fitness
// for any purpose. You can redistribute this file // for any purpose. You can redistribute this file
// and/or modify it under the terms of the GNU // and/or modify it under the terms of the GNU
// Lesser General Public License (LGPL) as published // Lesser General Public License (LGPL) as published
// by the Free Software Foundation, either version 3 // by the Free Software Foundation, either version 3
// of the License or (at your option) any later version. // of the License or (at your option) any later version.
// (see http://www.opensource.org/licenses for more info) // (see http://www.opensource.org/licenses for more info)
//! \addtogroup arma_version //! \addtogroup arma_version
//! @{ //! @{
#define ARMA_VERSION_MAJOR 1 #define ARMA_VERSION_MAJOR 1
#define ARMA_VERSION_MINOR 1 #define ARMA_VERSION_MINOR 1
#define ARMA_VERSION_PATCH 0 #define ARMA_VERSION_PATCH 2
#define ARMA_VERSION_NAME "Climate Vandal" #define ARMA_VERSION_NAME "Flood Kayak"
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. 2 change blocks. 
4 lines changed or deleted 4 lines changed or added


 armadillo   armadillo 
// Copyright (C) 2008-2010 NICTA (www.nicta.com.au) // Copyright (C) 2008-2011 NICTA (www.nicta.com.au)
// Copyright (C) 2008-2010 Conrad Sanderson // Copyright (C) 2008-2011 Conrad Sanderson
// //
// This file is part of the Armadillo C++ library. // This file is part of the Armadillo C++ library.
// It is provided without any warranty of fitness // It is provided without any warranty of fitness
// for any purpose. You can redistribute this file // for any purpose. You can redistribute this file
// and/or modify it under the terms of the GNU // and/or modify it under the terms of the GNU
// Lesser General Public License (LGPL) as published // Lesser General Public License (LGPL) as published
// by the Free Software Foundation, either version 3 // by the Free Software Foundation, either version 3
// of the License or (at your option) any later version. // of the License or (at your option) any later version.
// (see http://www.opensource.org/licenses for more info) // (see http://www.opensource.org/licenses for more info)
skipping to change at line 117 skipping to change at line 117
#include "armadillo_bits/restrictors.hpp" #include "armadillo_bits/restrictors.hpp"
#include "armadillo_bits/access.hpp" #include "armadillo_bits/access.hpp"
#include "armadillo_bits/span.hpp" #include "armadillo_bits/span.hpp"
// //
// class prototypes // class prototypes
#include "armadillo_bits/Base.hpp" #include "armadillo_bits/Base.hpp"
#include "armadillo_bits/BaseCube.hpp" #include "armadillo_bits/BaseCube.hpp"
#include "armadillo_bits/syslib_proto.hpp"
#include "armadillo_bits/arrayops_proto.hpp"
#include "armadillo_bits/podarray_proto.hpp"
#include "armadillo_bits/blas_proto.hpp" #include "armadillo_bits/blas_proto.hpp"
#include "armadillo_bits/lapack_proto.hpp" #include "armadillo_bits/lapack_proto.hpp"
#include "armadillo_bits/atlas_proto.hpp" #include "armadillo_bits/atlas_proto.hpp"
#include "armadillo_bits/arrayops_proto.hpp"
#include "armadillo_bits/podarray_proto.hpp"
#include "armadillo_bits/auxlib_proto.hpp" #include "armadillo_bits/auxlib_proto.hpp"
#include "armadillo_bits/injector_proto.hpp" #include "armadillo_bits/injector_proto.hpp"
#include "armadillo_bits/Mat_proto.hpp" #include "armadillo_bits/Mat_proto.hpp"
#include "armadillo_bits/Col_proto.hpp" #include "armadillo_bits/Col_proto.hpp"
#include "armadillo_bits/Row_proto.hpp" #include "armadillo_bits/Row_proto.hpp"
#include "armadillo_bits/Cube_proto.hpp" #include "armadillo_bits/Cube_proto.hpp"
#include "armadillo_bits/typedef_fixed.hpp" #include "armadillo_bits/typedef_fixed.hpp"
skipping to change at line 353 skipping to change at line 352
// //
// class meat // class meat
#include "armadillo_bits/gemm.hpp" #include "armadillo_bits/gemm.hpp"
#include "armadillo_bits/gemv.hpp" #include "armadillo_bits/gemv.hpp"
#include "armadillo_bits/gemm_mixed.hpp" #include "armadillo_bits/gemm_mixed.hpp"
#include "armadillo_bits/eop_core_meat.hpp" #include "armadillo_bits/eop_core_meat.hpp"
#include "armadillo_bits/eglue_core_meat.hpp" #include "armadillo_bits/eglue_core_meat.hpp"
#include "armadillo_bits/arrayops_meat.hpp"
#include "armadillo_bits/podarray_meat.hpp" #include "armadillo_bits/podarray_meat.hpp"
#include "armadillo_bits/auxlib_meat.hpp" #include "armadillo_bits/auxlib_meat.hpp"
#include "armadillo_bits/injector_meat.hpp" #include "armadillo_bits/injector_meat.hpp"
#include "armadillo_bits/Mat_meat.hpp" #include "armadillo_bits/Mat_meat.hpp"
#include "armadillo_bits/Col_meat.hpp" #include "armadillo_bits/Col_meat.hpp"
#include "armadillo_bits/Row_meat.hpp" #include "armadillo_bits/Row_meat.hpp"
#include "armadillo_bits/Cube_meat.hpp" #include "armadillo_bits/Cube_meat.hpp"
#include "armadillo_bits/field_meat.hpp" #include "armadillo_bits/field_meat.hpp"
 End of changes. 4 change blocks. 
6 lines changed or deleted 6 lines changed or added


 arrayops_proto.hpp   arrayops_proto.hpp 
// Copyright (C) 2010 NICTA (www.nicta.com.au) // Copyright (C) 2011 NICTA (www.nicta.com.au)
// Copyright (C) 2010 Conrad Sanderson // Copyright (C) 2011 Conrad Sanderson
// //
// This file is part of the Armadillo C++ library. // This file is part of the Armadillo C++ library.
// It is provided without any warranty of fitness // It is provided without any warranty of fitness
// for any purpose. You can redistribute this file // for any purpose. You can redistribute this file
// and/or modify it under the terms of the GNU // and/or modify it under the terms of the GNU
// Lesser General Public License (LGPL) as published // Lesser General Public License (LGPL) as published
// by the Free Software Foundation, either version 3 // by the Free Software Foundation, either version 3
// of the License or (at your option) any later version. // of the License or (at your option) any later version.
// (see http://www.opensource.org/licenses for more info) // (see http://www.opensource.org/licenses for more info)
//! \addtogroup arrayops //! \addtogroup arrayops
//! @{ //! @{
class arrayops class arrayops
{ {
public: public:
template<typename eT> template<typename eT>
arma_hot arma_hot inline static void
inline copy(eT* dest, const eT* src, const u32 n_elem);
static
void
inplace_plus(eT* dest, const eT* src, const u32 n_elem)
{
u32 i,j;
for(i=0, j=1; j<n_elem; i+=2, j+=2)
{
dest[i] += src[i];
dest[j] += src[j];
}
if(i < n_elem)
{
dest[i] += src[i];
}
}
template<typename eT>
arma_hot
inline
static
void
inplace_minus(eT* dest, const eT* src, const u32 n_elem)
{
u32 i,j;
for(i=0, j=1; j<n_elem; i+=2, j+=2)
{
dest[i] -= src[i];
dest[j] -= src[j];
}
if(i < n_elem)
{
dest[i] -= src[i];
}
}
template<typename eT>
arma_hot
inline
static
void
inplace_mul(eT* dest, const eT* src, const u32 n_elem)
{
u32 i,j;
for(i=0, j=1; j<n_elem; i+=2, j+=2)
{
dest[i] *= src[i];
dest[j] *= src[j];
}
if(i < n_elem)
{
dest[i] *= src[i];
}
}
template<typename eT>
arma_hot
inline
static
void
inplace_div(eT* dest, const eT* src, const u32 n_elem)
{
u32 i,j;
for(i=0, j=1; j<n_elem; i+=2, j+=2)
{
dest[i] /= src[i];
dest[j] /= src[j];
}
if(i < n_elem)
{
dest[i] /= src[i];
}
}
template<typename eT>
arma_hot
inline
static
void
inplace_set(eT* dest, const eT val, const u32 n_elem)
{
u32 i,j;
for(i=0, j=1; j<n_elem; i+=2, j+=2)
{
dest[i] = val;
dest[j] = val;
}
if(i < n_elem)
{
dest[i] = val;
}
}
template<typename eT>
arma_hot
inline
static
void
inplace_plus(eT* dest, const eT val, const u32 n_elem)
{
u32 i,j;
for(i=0, j=1; j<n_elem; i+=2, j+=2)
{
dest[i] += val;
dest[j] += val;
}
if(i < n_elem)
{
dest[i] += val;
}
}
template<typename eT>
arma_hot
inline
static
void
inplace_minus(eT* dest, const eT val, const u32 n_elem)
{
u32 i,j;
for(i=0, j=1; j<n_elem; i+=2, j+=2)
{
dest[i] -= val;
dest[j] -= val;
}
if(i < n_elem)
{
dest[i] -= val;
}
}
template<typename eT>
arma_hot
inline
static
void
inplace_mul(eT* dest, const eT val, const u32 n_elem)
{
u32 i,j;
for(i=0, j=1; j<n_elem; i+=2, j+=2)
{
dest[i] *= val;
dest[j] *= val;
}
if(i < n_elem)
{
dest[i] *= val;
}
}
template<typename eT>
arma_hot
inline
static
void
inplace_div(eT* dest, const eT val, const u32 n_elem)
{
u32 i,j;
for(i=0, j=1; j<n_elem; i+=2, j+=2)
{
dest[i] /= val;
dest[j] /= val;
}
if(i < n_elem)
{
dest[i] /= val;
}
}
template<typename eT>
arma_hot
arma_pure
inline
static
eT
accumulate(const eT* src, const u32 n_elem)
{
u32 i,j;
eT acc1 = eT(0);
eT acc2 = eT(0);
for(i=0, j=1; j<n_elem; i+=2, j+=2)
{
acc1 += src[i];
acc2 += src[j];
}
if(i < n_elem)
{
acc1 += src[i];
}
return acc1 + acc2;
}
template<typename eT>
arma_hot
arma_pure
inline
static
typename get_pod_type<eT>::result
norm_1(const eT* src, const u32 n_elem)
{
typedef typename get_pod_type<eT>::result T;
T acc = T(0); //
// array = convert(array)
u32 i,j; template<typename out_eT, typename in_eT>
arma_hot arma_inline static void
convert_cx_scalar(out_eT& out, const in_eT& in, const typename arma_not_
cx<out_eT>::result* junk1 = 0, const typename arma_not_cx< in_eT>::result*
junk2 = 0);
for(i=0, j=1; j<n_elem; i+=2, j+=2) template<typename out_eT, typename in_T>
{ arma_hot arma_inline static void
acc += std::abs(src[i]); convert_cx_scalar(out_eT& out, const std::complex<in_T>& in, const typena
acc += std::abs(src[j]); me arma_not_cx<out_eT>::result* junk = 0);
}
if(i < n_elem) template<typename out_T, typename in_T>
{ arma_hot arma_inline static void
acc += std::abs(src[i]); convert_cx_scalar(std::complex<out_T>& out, const std::complex< in_T>& in
} );
return acc; template<typename out_eT, typename in_eT>
} arma_hot inline static void
convert(out_eT* dest, const in_eT* src, const u32 n_elem);
template<typename eT>
arma_hot
arma_pure
inline
static
eT
norm_2(const eT* src, const u32 n_elem, const typename arma_not_cx<eT>::r
esult* junk = 0)
{
eT acc = eT(0);
u32 i,j;
for(i=0, j=1; j<n_elem; i+=2, j+=2)
{
const eT tmp_i = src[i];
const eT tmp_j = src[j];
acc += tmp_i * tmp_i;
acc += tmp_j * tmp_j;
}
if(i < n_elem)
{
const eT tmp_i = src[i];
acc += tmp_i * tmp_i; template<typename out_eT, typename in_eT>
} arma_hot inline static void
convert_cx(out_eT* dest, const in_eT* src, const u32 n_elem);
return std::sqrt(acc); //
} // array op= array
template<typename T> template<typename eT>
arma_hot arma_hot inline static
arma_pure void
inline inplace_plus(eT* dest, const eT* src, const u32 n_elem);
static
T
norm_2(const std::complex<T>* src, const u32 n_elem)
{
T acc = T(0);
u32 i,j; template<typename eT>
arma_hot inline static
void
inplace_minus(eT* dest, const eT* src, const u32 n_elem);
for(i=0, j=1; j<n_elem; i+=2, j+=2) template<typename eT>
{ arma_hot inline static
const T tmp_i = std::abs(src[i]); void
const T tmp_j = std::abs(src[j]); inplace_mul(eT* dest, const eT* src, const u32 n_elem);
acc += tmp_i * tmp_i; template<typename eT>
acc += tmp_j * tmp_j; arma_hot inline static
} void
inplace_div(eT* dest, const eT* src, const u32 n_elem);
if(i < n_elem) //
{ // array op= scalar
const T tmp_i = std::abs(src[i]);
acc += tmp_i * tmp_i; template<typename eT>
} arma_hot inline static
void
inplace_set(eT* dest, const eT val, const u32 n_elem);
return std::sqrt(acc); template<typename eT>
} arma_hot inline static
void
inplace_plus(eT* dest, const eT val, const u32 n_elem);
template<typename eT> template<typename eT>
arma_hot arma_hot inline static
arma_pure void
inline inplace_minus(eT* dest, const eT val, const u32 n_elem);
static
typename get_pod_type<eT>::result
norm_k(const eT* src, const u32 n_elem, const int k)
{
typedef typename get_pod_type<eT>::result T;
T acc = T(0); template<typename eT>
arma_hot inline static void
inplace_mul(eT* dest, const eT val, const u32 n_elem);
u32 i,j; template<typename eT>
arma_hot inline static
void
inplace_div(eT* dest, const eT val, const u32 n_elem);
for(i=0, j=1; j<n_elem; i+=2, j+=2) //
{ // scalar = op(array)
acc += std::pow(std::abs(src[i]), k);
acc += std::pow(std::abs(src[j]), k);
}
if(i < n_elem) template<typename eT>
{ arma_hot arma_pure inline static
acc += std::pow(std::abs(src[i]), k); eT
} accumulate(const eT* src, const u32 n_elem);
return std::pow(acc, T(1)/T(k)); template<typename eT>
} arma_hot arma_pure inline static
eT
product(const eT* src, const u32 n_elem);
template<typename eT> template<typename eT>
arma_hot arma_hot arma_pure inline static
arma_pure
inline
static
typename get_pod_type<eT>::result typename get_pod_type<eT>::result
norm_max(const eT* src, const u32 n_elem) norm_1(const eT* src, const u32 n_elem);
{
typedef typename get_pod_type<eT>::result T;
T max_val = std::abs(src[0]);
u32 i,j;
for(i=1, j=2; j<n_elem; i+=2, j+=2)
{
const T tmp_i = std::abs(src[i]);
const T tmp_j = std::abs(src[j]);
if(max_val < tmp_i) { max_val = tmp_i; }
if(max_val < tmp_j) { max_val = tmp_j; }
}
if(i < n_elem)
{
const T tmp_i = std::abs(src[i]);
if(max_val < tmp_i) { max_val = tmp_i; } template<typename eT>
} arma_hot arma_pure inline static
eT
norm_2(const eT* src, const u32 n_elem, const typename arma_not_cx<eT>::r
esult* junk = 0);
return max_val; template<typename T>
} arma_hot arma_pure inline static
T
norm_2(const std::complex<T>* src, const u32 n_elem);
template<typename eT> template<typename eT>
arma_hot arma_hot arma_pure inline static
arma_pure
inline
static
typename get_pod_type<eT>::result typename get_pod_type<eT>::result
norm_min(const eT* src, const u32 n_elem) norm_k(const eT* src, const u32 n_elem, const int k);
{
typedef typename get_pod_type<eT>::result T;
T min_val = std::abs(src[0]);
u32 i,j;
for(i=1, j=2; j<n_elem; i+=2, j+=2)
{
const T tmp_i = std::abs(src[i]);
const T tmp_j = std::abs(src[j]);
if(min_val > tmp_i) { min_val = tmp_i; } template<typename eT>
if(min_val > tmp_j) { min_val = tmp_j; } arma_hot arma_pure inline static
} typename get_pod_type<eT>::result
norm_max(const eT* src, const u32 n_elem);
if(i < n_elem)
{
const T tmp_i = std::abs(src[i]);
if(min_val > tmp_i) { min_val = tmp_i; }
}
return min_val; template<typename eT>
} arma_hot arma_pure inline static
typename get_pod_type<eT>::result
norm_min(const eT* src, const u32 n_elem);
}; };
//! @} //! @}
 End of changes. 30 change blocks. 
370 lines changed or deleted 94 lines changed or added


 auxlib_meat.hpp   auxlib_meat.hpp 
// Copyright (C) 2008-2010 NICTA (www.nicta.com.au) // Copyright (C) 2008-2011 NICTA (www.nicta.com.au)
// Copyright (C) 2008-2010 Conrad Sanderson // Copyright (C) 2008-2011 Conrad Sanderson
// Copyright (C) 2009 Edmund Highcock // Copyright (C) 2009 Edmund Highcock
// //
// 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 1369 skipping to change at line 1369
if(info == 0) if(info == 0)
{ {
work_len = static_cast<blas_int>(access::tmp_real(work[0])); work_len = static_cast<blas_int>(access::tmp_real(work[0]));
work.set_size(work_len); work.set_size(work_len);
} }
lapack::geqrf(&m, &n, R.memptr(), &m, tau.memptr(), work.memptr(), &wor k_len, &info); lapack::geqrf(&m, &n, R.memptr(), &m, tau.memptr(), work.memptr(), &wor k_len, &info);
Q.set_size(R_n_rows, R_n_rows); Q.set_size(R_n_rows, R_n_rows);
syslib::copy_elem( Q.memptr(), R.memptr(), (std::min)(Q.n_elem, R.n_ele m) ); arrayops::copy( Q.memptr(), R.memptr(), (std::min)(Q.n_elem, R.n_elem) );
// //
// construct R // construct R
for(u32 col=0; col < R_n_cols; ++col) for(u32 col=0; col < R_n_cols; ++col)
{ {
for(u32 row=(col+1); row < R_n_rows; ++row) for(u32 row=(col+1); row < R_n_rows; ++row)
{ {
R.at(row,col) = eT(0); R.at(row,col) = eT(0);
} }
skipping to change at line 1816 skipping to change at line 1816
arma_ignore(S); arma_ignore(S);
arma_ignore(V); arma_ignore(V);
arma_ignore(X); arma_ignore(X);
arma_stop("svd(): need LAPACK"); arma_stop("svd(): need LAPACK");
return false; return false;
} }
#endif #endif
} }
//! Solve a system of linear equations //! Solve a system of linear equations.
//! Assumes that A.n_rows = A.n_cols //! Assumes that A.n_rows = A.n_cols and B.n_rows = A.n_rows
//! and B.n_rows = A.n_rows
template<typename eT> template<typename eT>
inline inline
bool bool
auxlib::solve(Mat<eT>& out, const Mat<eT>& A, const Mat<eT>& B) auxlib::solve(Mat<eT>& out, Mat<eT>& A, const Mat<eT>& B)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
if(A.is_empty() || B.is_empty()) if(A.is_empty() || B.is_empty())
{ {
out.reset(); out.reset();
return false; return false;
} }
#if defined(ARMA_USE_LAPACK) #if defined(ARMA_USE_LAPACK)
{ {
blas_int n = A.n_rows; blas_int n = A.n_rows;
blas_int lda = A.n_rows; blas_int lda = A.n_rows;
blas_int ldb = A.n_rows; blas_int ldb = A.n_rows;
blas_int nrhs = B.n_cols; blas_int nrhs = B.n_cols;
blas_int info; blas_int info;
podarray<blas_int> ipiv(n); podarray<blas_int> ipiv(n);
out = B; out = B;
Mat<eT> A_copy = A;
lapack::gesv<eT>(&n, &nrhs, A_copy.memptr(), &lda, ipiv.memptr(), out.m emptr(), &ldb, &info); lapack::gesv<eT>(&n, &nrhs, A.memptr(), &lda, ipiv.memptr(), out.memptr (), &ldb, &info);
return (info == 0); return (info == 0);
} }
#else #else
{ {
arma_ignore(out); arma_ignore(out);
arma_ignore(A); arma_ignore(A);
arma_ignore(B); arma_ignore(B);
arma_stop("solve(): need LAPACK"); arma_stop("solve(): need LAPACK");
return false; return false;
} }
#endif #endif
} }
//! Solve an over-determined system. //! Solve an over-determined system.
//! Assumes that A.n_rows > A.n_cols //! Assumes that A.n_rows > A.n_cols and B.n_rows = A.n_rows
//! and B.n_rows = A.n_rows
template<typename eT> template<typename eT>
inline inline
bool bool
auxlib::solve_od(Mat<eT>& out, const Mat<eT>& A, const Mat<eT>& B) auxlib::solve_od(Mat<eT>& out, Mat<eT>& A, const Mat<eT>& B)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
if(A.is_empty() || B.is_empty()) if(A.is_empty() || B.is_empty())
{ {
out.reset(); out.reset();
return false; return false;
} }
#if defined(ARMA_USE_LAPACK) #if defined(ARMA_USE_LAPACK)
skipping to change at line 1888 skipping to change at line 1885
char trans = 'N'; char trans = 'N';
blas_int m = A.n_rows; blas_int m = A.n_rows;
blas_int n = A.n_cols; blas_int n = A.n_cols;
blas_int lda = A.n_rows; blas_int lda = A.n_rows;
blas_int ldb = A.n_rows; blas_int ldb = A.n_rows;
blas_int nrhs = B.n_cols; blas_int nrhs = B.n_cols;
blas_int lwork = n + (std::max)(n, nrhs); blas_int lwork = n + (std::max)(n, nrhs);
blas_int info; blas_int info;
Mat<eT> A_copy = A; Mat<eT> tmp = B;
Mat<eT> tmp = B;
podarray<eT> work(lwork); podarray<eT> work(lwork);
arma_extra_debug_print("lapack::gels()"); arma_extra_debug_print("lapack::gels()");
// NOTE: // NOTE: the dgels() function in the lapack library supplied by ATLAS 3
// the dgels() function in the lapack library supplied by ATLAS 3.6 .6 seems to have problems
// seems to have problems
lapack::gels<eT> lapack::gels<eT>
( (
&trans, &m, &n, &nrhs, &trans, &m, &n, &nrhs,
A_copy.memptr(), &lda, A.memptr(), &lda,
tmp.memptr(), &ldb, tmp.memptr(), &ldb,
work.memptr(), &lwork, work.memptr(), &lwork,
&info &info
); );
arma_extra_debug_print("lapack::gels() -- finished"); arma_extra_debug_print("lapack::gels() -- finished");
out.set_size(A.n_cols, B.n_cols); out.set_size(A.n_cols, B.n_cols);
for(u32 col=0; col<B.n_cols; ++col) for(u32 col=0; col<B.n_cols; ++col)
{ {
syslib::copy_elem( out.colptr(col), tmp.colptr(col), A.n_cols ); arrayops::copy( out.colptr(col), tmp.colptr(col), A.n_cols );
} }
return (info == 0); return (info == 0);
} }
#else #else
{ {
arma_ignore(out); arma_ignore(out);
arma_ignore(A); arma_ignore(A);
arma_ignore(B); arma_ignore(B);
arma_stop("auxlib::solve_od(): need LAPACK"); arma_stop("solve(): need LAPACK");
return false; return false;
} }
#endif #endif
} }
//! Solve an under-determined system. //! Solve an under-determined system.
//! Assumes that A.n_rows < A.n_cols //! Assumes that A.n_rows < A.n_cols and B.n_rows = A.n_rows
//! and B.n_rows = A.n_rows
template<typename eT> template<typename eT>
inline inline
bool bool
auxlib::solve_ud(Mat<eT>& out, const Mat<eT>& A, const Mat<eT>& B) auxlib::solve_ud(Mat<eT>& out, Mat<eT>& A, const Mat<eT>& B)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
if(A.is_empty() || B.is_empty()) if(A.is_empty() || B.is_empty())
{ {
out.reset(); out.reset();
return false; return false;
} }
#if defined(ARMA_USE_LAPACK) #if defined(ARMA_USE_LAPACK)
skipping to change at line 1958 skipping to change at line 1951
char trans = 'N'; char trans = 'N';
blas_int m = A.n_rows; blas_int m = A.n_rows;
blas_int n = A.n_cols; blas_int n = A.n_cols;
blas_int lda = A.n_rows; blas_int lda = A.n_rows;
blas_int ldb = A.n_cols; blas_int ldb = A.n_cols;
blas_int nrhs = B.n_cols; blas_int nrhs = B.n_cols;
blas_int lwork = m + (std::max)(m,nrhs); blas_int lwork = m + (std::max)(m,nrhs);
blas_int info; blas_int info;
Mat<eT> A_copy = A;
Mat<eT> tmp; Mat<eT> tmp;
tmp.zeros(A.n_cols, B.n_cols); tmp.zeros(A.n_cols, B.n_cols);
for(u32 col=0; col<B.n_cols; ++col) for(u32 col=0; col<B.n_cols; ++col)
{ {
eT* tmp_colmem = tmp.colptr(col); eT* tmp_colmem = tmp.colptr(col);
syslib::copy_elem( tmp_colmem, B.colptr(col), B.n_rows ); arrayops::copy( tmp_colmem, B.colptr(col), B.n_rows );
for(u32 row=B.n_rows; row<A.n_cols; ++row) for(u32 row=B.n_rows; row<A.n_cols; ++row)
{ {
tmp_colmem[row] = eT(0); tmp_colmem[row] = eT(0);
} }
} }
podarray<eT> work(lwork); podarray<eT> work(lwork);
arma_extra_debug_print("lapack::gels()"); arma_extra_debug_print("lapack::gels()");
// NOTE: // NOTE: the dgels() function in the lapack library supplied by ATLAS 3
// the dgels() function in the lapack library supplied by ATLAS 3.6 .6 seems to have problems
// seems to have problems
lapack::gels<eT> lapack::gels<eT>
( (
&trans, &m, &n, &nrhs, &trans, &m, &n, &nrhs,
A_copy.memptr(), &lda, A.memptr(), &lda,
tmp.memptr(), &ldb, tmp.memptr(), &ldb,
work.memptr(), &lwork, work.memptr(), &lwork,
&info &info
); );
arma_extra_debug_print("lapack::gels() -- finished"); arma_extra_debug_print("lapack::gels() -- finished");
out.set_size(A.n_cols, B.n_cols); out.set_size(A.n_cols, B.n_cols);
for(u32 col=0; col<B.n_cols; ++col) for(u32 col=0; col<B.n_cols; ++col)
{ {
syslib::copy_elem( out.colptr(col), tmp.colptr(col), A.n_cols ); arrayops::copy( out.colptr(col), tmp.colptr(col), A.n_cols );
} }
return (info == 0); return (info == 0);
} }
#else #else
{ {
arma_ignore(out); arma_ignore(out);
arma_ignore(A); arma_ignore(A);
arma_ignore(B); arma_ignore(B);
arma_stop("auxlib::solve_ud(): need LAPACK"); arma_stop("solve(): need LAPACK");
return false; return false;
} }
#endif #endif
} }
// //
// solve_tr // solve_tr
template<typename eT> template<typename eT>
inline inline
 End of changes. 21 change blocks. 
32 lines changed or deleted 23 lines changed or added


 auxlib_proto.hpp   auxlib_proto.hpp 
// Copyright (C) 2008-2010 NICTA (www.nicta.com.au) // Copyright (C) 2008-2011 NICTA (www.nicta.com.au)
// Copyright (C) 2008-2010 Conrad Sanderson // Copyright (C) 2008-2011 Conrad Sanderson
// Copyright (C) 2009 Edmund Highcock // Copyright (C) 2009 Edmund Highcock
// //
// 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 134 skipping to change at line 134
template<typename eT, typename T1> template<typename eT, typename T1>
inline static bool svd(Mat<eT>& U, Col<eT>& S, Mat<eT>& V, const Base<eT, T1>& X); inline static bool svd(Mat<eT>& U, Col<eT>& S, Mat<eT>& V, const Base<eT, T1>& X);
template<typename T, typename T1> template<typename T, typename T1>
inline static bool svd(Mat< std::complex<T> >& U, Col<T>& S, Mat< std::co mplex<T> >& V, const Base< std::complex<T>, T1>& X); inline static bool svd(Mat< std::complex<T> >& U, Col<T>& S, Mat< std::co mplex<T> >& V, const Base< std::complex<T>, T1>& X);
// //
// solve // solve
template<typename eT> template<typename eT>
inline static bool solve(Mat<eT>& out, const Mat<eT>& A, const Mat<eT>& B ); inline static bool solve (Mat<eT>& out, Mat<eT>& A, const Mat<eT>& B);
template<typename eT> template<typename eT>
inline static bool solve_od(Mat<eT>& out, const Mat<eT>& A, const Mat<eT> & B); inline static bool solve_od(Mat<eT>& out, Mat<eT>& A, const Mat<eT>& B);
template<typename eT> template<typename eT>
inline static bool solve_ud(Mat<eT>& out, const Mat<eT>& A, const Mat<eT> & B); inline static bool solve_ud(Mat<eT>& out, Mat<eT>& A, const Mat<eT>& B);
// //
// solve_tr // solve_tr
template<typename eT> template<typename eT>
inline static bool solve_tr(Mat<eT>& out, const Mat<eT>& A, const Mat<eT> & B, const u32 layout); inline static bool solve_tr(Mat<eT>& out, const Mat<eT>& A, const Mat<eT> & B, const u32 layout);
}; };
//! @} //! @}
 End of changes. 4 change blocks. 
5 lines changed or deleted 5 lines changed or added


 compiler_setup.hpp   compiler_setup.hpp 
// Copyright (C) 2008-2010 NICTA (www.nicta.com.au) // Copyright (C) 2008-2011 NICTA (www.nicta.com.au)
// Copyright (C) 2008-2010 Conrad Sanderson // Copyright (C) 2008-2011 Conrad Sanderson
// //
// This file is part of the Armadillo C++ library. // This file is part of the Armadillo C++ library.
// It is provided without any warranty of fitness // It is provided without any warranty of fitness
// for any purpose. You can redistribute this file // for any purpose. You can redistribute this file
// and/or modify it under the terms of the GNU // and/or modify it under the terms of the GNU
// Lesser General Public License (LGPL) as published // Lesser General Public License (LGPL) as published
// by the Free Software Foundation, either version 3 // by the Free Software Foundation, either version 3
// of the License or (at your option) any later version. // of the License or (at your option) any later version.
// (see http://www.opensource.org/licenses for more info) // (see http://www.opensource.org/licenses for more info)
skipping to change at line 73 skipping to change at line 73
#define arma_aligned __attribute__((aligned)) #define arma_aligned __attribute__((aligned))
#define arma_warn_unused __attribute__((warn_unused_result)) #define arma_warn_unused __attribute__((warn_unused_result))
#define arma_deprecated __attribute__((deprecated)) #define arma_deprecated __attribute__((deprecated))
#if (ARMA_GCC_VERSION >= 40200) #if (ARMA_GCC_VERSION >= 40200)
#if defined(_GLIBCXX_USE_C99_MATH_TR1) && defined(_GLIBCXX_USE_C99_COMP LEX_TR1) #if defined(_GLIBCXX_USE_C99_MATH_TR1) && defined(_GLIBCXX_USE_C99_COMP LEX_TR1)
#define ARMA_HAVE_STD_TR1 #define ARMA_HAVE_STD_TR1
#endif #endif
#endif #endif
#if defined(__GXX_EXPERIMENTAL_CXX0X__)
#undef ARMA_HAVE_STD_TR1
#endif
#if (ARMA_GCC_VERSION >= 40300) #if (ARMA_GCC_VERSION >= 40300)
#undef arma_hot #undef arma_hot
#undef arma_cold #undef arma_cold
#define arma_hot __attribute__((hot)) #define arma_hot __attribute__((hot))
#define arma_cold __attribute__((cold)) #define arma_cold __attribute__((cold))
#endif #endif
#undef ARMA_GCC_VERSION #undef ARMA_GCC_VERSION
 End of changes. 2 change blocks. 
2 lines changed or deleted 6 lines changed or added


 config.hpp   config.hpp 
// Copyright (C) 2008-2010 NICTA (www.nicta.com.au) // Copyright (C) 2008-2011 NICTA (www.nicta.com.au)
// Copyright (C) 2008-2010 Conrad Sanderson // Copyright (C) 2008-2011 Conrad Sanderson
// //
// This file is part of the Armadillo C++ library. // This file is part of the Armadillo C++ library.
// It is provided without any warranty of fitness // It is provided without any warranty of fitness
// for any purpose. You can redistribute this file // for any purpose. You can redistribute this file
// and/or modify it under the terms of the GNU // and/or modify it under the terms of the GNU
// Lesser General Public License (LGPL) as published // Lesser General Public License (LGPL) as published
// by the Free Software Foundation, either version 3 // by the Free Software Foundation, either version 3
// of the License or (at your option) any later version. // of the License or (at your option) any later version.
// (see http://www.opensource.org/licenses for more info) // (see http://www.opensource.org/licenses for more info)
#if !defined(ARMA_USE_LAPACK) #if !defined(ARMA_USE_LAPACK)
#define ARMA_USE_LAPACK #define ARMA_USE_LAPACK
#endif #endif
#if !defined(ARMA_USE_BLAS) #if !defined(ARMA_USE_BLAS)
#define ARMA_USE_BLAS #define ARMA_USE_BLAS
#endif #endif
// #define ARMA_BLAS_LONG // #define ARMA_BLAS_LONG
// uncomment the above line if your BLAS and LAPACK libraries use "long" in stead of "int" //// Uncomment the above line if your BLAS and LAPACK libraries use "long" instead of "int"
// #define ARMA_BLAS_LONG_LONG // #define ARMA_BLAS_LONG_LONG
// uncomment the above line if your BLAS and LAPACK libraries use "long lon g" instead of "int" //// Uncomment the above line if your BLAS and LAPACK libraries use "long l ong" instead of "int"
#define ARMA_BLAS_UNDERSCORE #define ARMA_BLAS_UNDERSCORE
// uncomment the above line if your BLAS and LAPACK libraries have function //// Uncomment the above line if your BLAS and LAPACK libraries have functi
names with a trailing underscore on names with a trailing underscore.
// conversely, comment it out if the function names don't have a trailing u //// Conversely, comment it out if the function names don't have a trailing
nderscore underscore
#if !defined(ARMA_MAT_PREALLOC)
#define ARMA_MAT_PREALLOC 16
#endif
//// This is the number of preallocated elements used by matrices and vecto
rs;
//// it must be an integer that is at least 1.
//// If you mainly use lots of very small vectors (eg. <= 4 elements),
//// change the number to the size of your vectors.
#define ARMA_USE_ATLAS #define ARMA_USE_ATLAS
#define ARMA_ATLAS_INCLUDE_DIR /usr/include/ #define ARMA_ATLAS_INCLUDE_DIR /usr/include/
//// If you're using ATLAS and the compiler can't find cblas.h and/or clapa ck.h //// If you're using ATLAS and the compiler can't find cblas.h and/or clapa ck.h
//// uncomment the above define and specify the appropriate include directo ry. //// uncomment the above define and specify the appropriate include directo ry.
//// Make sure the directory has a trailing / //// Make sure the directory has a trailing /
#define ARMA_USE_BOOST #define ARMA_USE_BOOST
#define ARMA_USE_BOOST_DATE #define ARMA_USE_BOOST_DATE
#define ARMA_HAVE_STD_ISFINITE #define ARMA_HAVE_STD_ISFINITE
#define ARMA_HAVE_STD_ISINF #define ARMA_HAVE_STD_ISINF
#define ARMA_HAVE_STD_ISNAN #define ARMA_HAVE_STD_ISNAN
#define ARMA_HAVE_STD_SNPRINTF #define ARMA_HAVE_STD_SNPRINTF
#define ARMA_HAVE_LOG1P #define ARMA_HAVE_LOG1P
#define ARMA_HAVE_GETTIMEOFDAY #define ARMA_HAVE_GETTIMEOFDAY
/* #undef ARMA_EXTRA_DEBUG */ // #define ARMA_EXTRA_DEBUG
/* #undef ARMA_NO_DEBUG */ // #define ARMA_NO_DEBUG
 End of changes. 5 change blocks. 
8 lines changed or deleted 17 lines changed or added


 debug.hpp   debug.hpp 
skipping to change at line 700 skipping to change at line 700
namespace junk namespace junk
{ {
class arma_first_extra_debug_message class arma_first_extra_debug_message
{ {
public: public:
inline inline
arma_cold arma_cold
arma_first_extra_debug_message() arma_first_extra_debug_message()
{ {
const char* nickname = ARMA_VERSION_NAME; union
{
unsigned short a;
unsigned char b[sizeof(unsigned short)];
} endian_test;
endian_test.a = 1;
const bool little_endian = (endian_test.b[0] == 1);
const char* nickname = ARMA_VERSION_NAME;
get_log_stream() << "@ ---" << '\n'; get_log_stream() << "@ ---" << '\n';
get_log_stream() << "@ Armadillo " get_log_stream() << "@ Armadillo "
<< arma_version::major << '.' << arma_version::minor << ' .' << arma_version::patch << arma_version::major << '.' << arma_version::minor << ' .' << arma_version::patch
<< " (" << nickname << ")\n"; << " (" << nickname << ")\n";
get_log_stream() << "@ arma_config::atlas = " << arma_config:: get_log_stream() << "@ arma_config::mat_prealloc = " << arma_config
atlas << '\n'; ::mat_prealloc << " element(s)\n";
get_log_stream() << "@ arma_config::lapack = " << arma_config:: get_log_stream() << "@ arma_config::atlas = " << arma_config
lapack << '\n'; ::atlas << '\n';
get_log_stream() << "@ arma_config::blas = " << arma_config:: get_log_stream() << "@ arma_config::lapack = " << arma_config
blas << '\n'; ::lapack << '\n';
get_log_stream() << "@ arma_config::boost = " << arma_config:: get_log_stream() << "@ arma_config::blas = " << arma_config
boost << '\n'; ::blas << '\n';
get_log_stream() << "@ arma_config::boost_date = " << arma_config:: get_log_stream() << "@ arma_config::boost = " << arma_config
boost_date << '\n'; ::boost << '\n';
get_log_stream() << "@ arma_config::good_comp = " << arma_config:: get_log_stream() << "@ arma_config::boost_date = " << arma_config
good_comp << '\n'; ::boost_date << '\n';
get_log_stream() << "@ arma_config::extra_code = " << arma_config:: get_log_stream() << "@ arma_config::good_comp = " << arma_config
extra_code << '\n'; ::good_comp << '\n';
get_log_stream() << "@ arma_config::extra_code = " << arma_config
::extra_code << '\n';
get_log_stream() << "@ sizeof(void*) = " << sizeof(void*) << '\n'; get_log_stream() << "@ sizeof(void*) = " << sizeof(void*) << '\n';
get_log_stream() << "@ sizeof(int) = " << sizeof(int) << '\n'; get_log_stream() << "@ sizeof(int) = " << sizeof(int) << '\n';
get_log_stream() << "@ sizeof(long) = " << sizeof(long) << '\n'; get_log_stream() << "@ sizeof(long) = " << sizeof(long) << '\n';
get_log_stream() << "@ sizeof(blas_int) = " << sizeof(blas_int) << '\n'; get_log_stream() << "@ sizeof(blas_int) = " << sizeof(blas_int) << '\n';
get_log_stream() << "@ little_endian = " << little_endian << '\n';
get_log_stream() << "@ ---" << std::endl; get_log_stream() << "@ ---" << std::endl;
} }
}; };
static arma_first_extra_debug_message arma_first_extra_debug_message_ru n; static arma_first_extra_debug_message arma_first_extra_debug_message_ru n;
} }
#endif #endif
 End of changes. 3 change blocks. 
15 lines changed or deleted 27 lines changed or added


 fn_conv_to.hpp   fn_conv_to.hpp 
skipping to change at line 75 skipping to change at line 75
arma_type_check< is_supported_elem_type<out_eT>::value == false >::apply( ); arma_type_check< is_supported_elem_type<out_eT>::value == false >::apply( );
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;
syslib::convert_cx_scalar(out, X.mem[0]); arrayops::convert_cx_scalar(out, X.mem[0]);
return out; return out;
} }
template<typename out_eT> template<typename out_eT>
template<typename in_eT, typename T1> template<typename in_eT, typename T1>
inline inline
out_eT out_eT
conv_to<out_eT>::from(const BaseCube<in_eT, T1>& in, const typename arma_no t_cx<in_eT>::result* junk) conv_to<out_eT>::from(const BaseCube<in_eT, T1>& in, const typename arma_no t_cx<in_eT>::result* junk)
{ {
skipping to change at line 119 skipping to change at line 119
arma_type_check< is_supported_elem_type<out_eT>::value == false >::apply( ); arma_type_check< is_supported_elem_type<out_eT>::value == false >::apply( );
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;
syslib::convert_cx_scalar(out, X.mem[0]); arrayops::convert_cx_scalar(out, X.mem[0]);
return out; return out;
} }
//! conversion to Armadillo matrices from Armadillo Base objects, //! conversion to Armadillo matrices from Armadillo Base objects,
//! as well as from std::vector, itpp::Mat and itpp::Vec //! as well as from std::vector, itpp::Mat and itpp::Vec
template<typename out_eT> template<typename out_eT>
class conv_to< Mat<out_eT> > class conv_to< Mat<out_eT> >
{ {
public: public:
skipping to change at line 171 skipping to change at line 171
{ {
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);
syslib::copy_and_convert_elem( 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);
syslib::copy_and_convert_cx_elem( 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)
{ {
skipping to change at line 251 skipping to change at line 251
typename Mat<out_eT>::iterator out_end = out.end(); typename Mat<out_eT>::iterator out_end = out.end();
typename std::vector<in_eT>::const_iterator in_it; typename std::vector<in_eT>::const_iterator in_it;
typename Mat<out_eT>::iterator out_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) for(in_it = in_begin, out_it = out_begin; (in_it != in_end) && (out_it != out_end); ++in_it, ++out_it)
{ {
out_eT& out_elem = (*out_it); out_eT& out_elem = (*out_it);
const in_eT& in_elem = (*in_it); const in_eT& in_elem = (*in_it);
syslib::convert_cx_scalar(out_elem, in_elem); arrayops::convert_cx_scalar(out_elem, in_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 itpp::Mat<in_eT>& in, const typename arm a_not_cx<in_eT>::result* junk) conv_to< Mat<out_eT> >::from(const itpp::Mat<in_eT>& in, const typename arm a_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.rows(), in.cols()); Mat<out_eT> out(in.rows(), in.cols());
syslib::copy_and_convert_elem( out.memptr(), in._data(), out.n_elem ); arrayops::convert( out.memptr(), in._data(), 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 itpp::Mat<in_eT>& in, const typename arm a_cx_only<in_eT>::result* junk) conv_to< Mat<out_eT> >::from(const itpp::Mat<in_eT>& in, const typename arm a_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.rows(), in.cols()); Mat<out_eT> out(in.rows(), in.cols());
syslib::copy_and_convert_cx_elem( out.memptr(), in._data(), out.n_elem ); arrayops::convert_cx( out.memptr(), in._data(), 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 itpp::Vec<in_eT>& in, const typename arm a_not_cx<in_eT>::result* junk) conv_to< Mat<out_eT> >::from(const itpp::Vec<in_eT>& in, const typename arm a_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.length(), 1); Mat<out_eT> out(in.length(), 1);
syslib::copy_and_convert_elem( out.memptr(), in._data(), out.n_elem ); arrayops::convert( out.memptr(), in._data(), 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 itpp::Vec<in_eT>& in, const typename arm a_cx_only<in_eT>::result* junk) conv_to< Mat<out_eT> >::from(const itpp::Vec<in_eT>& in, const typename arm a_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.length(), 1); Mat<out_eT> out(in.length(), 1);
syslib::copy_and_convert_cx_elem( out.memptr(), in._data(), out.n_elem ); arrayops::convert_cx( out.memptr(), in._data(), out.n_elem );
return out; return out;
} }
//! conversion to Armadillo row vectors from Armadillo Base objects, //! conversion to Armadillo row vectors from Armadillo Base objects,
//! as well as from std::vector, itpp::Mat and itpp::Vec //! as well as from std::vector, itpp::Mat and itpp::Vec
template<typename out_eT> template<typename out_eT>
class conv_to< Row<out_eT> > class conv_to< Row<out_eT> >
{ {
public: public:
skipping to change at line 374 skipping to change at line 374
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);
syslib::copy_and_convert_elem( 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
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)
{ {
skipping to change at line 396 skipping to change at line 396
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);
syslib::copy_and_convert_cx_elem( 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
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)
{ {
skipping to change at line 456 skipping to change at line 456
typename Col<out_eT>::iterator out_end = out.end(); typename Col<out_eT>::iterator out_end = out.end();
typename std::vector<in_eT>::const_iterator in_it; typename std::vector<in_eT>::const_iterator in_it;
typename Col<out_eT>::iterator out_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) for(in_it = in_begin, out_it = out_begin; (in_it != in_end) && (out_it != out_end); ++in_it, ++out_it)
{ {
out_eT& out_elem = (*out_it); out_eT& out_elem = (*out_it);
const in_eT& in_elem = (*in_it); const in_eT& in_elem = (*in_it);
syslib::convert_cx_scalar(out_elem, in_elem); arrayops::convert_cx_scalar(out_elem, in_elem);
} }
return out; return out;
} }
template<typename out_eT> template<typename out_eT>
template<typename in_eT> template<typename in_eT>
inline inline
Row<out_eT> Row<out_eT>
conv_to< Row<out_eT> >::from(const itpp::Mat<in_eT>& in, const typename arm a_not_cx<in_eT>::result* junk) conv_to< Row<out_eT> >::from(const itpp::Mat<in_eT>& in, const typename arm a_not_cx<in_eT>::result* junk)
skipping to change at line 478 skipping to change at line 478
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_ignore(junk); arma_ignore(junk);
const bool is_vec = ( (in.rows() == 1) || (in.cols() == 1) ); const bool is_vec = ( (in.rows() == 1) || (in.cols() == 1) );
arma_debug_check( (is_vec == false), "conv_to(): given object can't be in terpreted as a vector" ); arma_debug_check( (is_vec == false), "conv_to(): given object can't be in terpreted as a vector" );
Row<out_eT> out(in.rows() * in.cols()); Row<out_eT> out(in.rows() * in.cols());
syslib::copy_and_convert_elem( out.memptr(), in._data(), out.n_elem ); arrayops::convert( out.memptr(), in._data(), 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
Row<out_eT> Row<out_eT>
conv_to< Row<out_eT> >::from(const itpp::Mat<in_eT>& in, const typename arm a_cx_only<in_eT>::result* junk) conv_to< Row<out_eT> >::from(const itpp::Mat<in_eT>& in, const typename arm a_cx_only<in_eT>::result* junk)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_ignore(junk); arma_ignore(junk);
const bool is_vec = ( (in.rows() == 1) || (in.cols() == 1) ); const bool is_vec = ( (in.rows() == 1) || (in.cols() == 1) );
Row<out_eT> out(in.rows() * in.cols()); Row<out_eT> out(in.rows() * in.cols());
syslib::copy_and_convert_cx_elem( out.memptr(), in._data(), out.n_elem ); arrayops::convert_cx( out.memptr(), in._data(), 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
Row<out_eT> Row<out_eT>
conv_to< Row<out_eT> >::from(const itpp::Vec<in_eT>& in, const typename arm a_not_cx<in_eT>::result* junk) conv_to< Row<out_eT> >::from(const itpp::Vec<in_eT>& in, const typename arm a_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.length()); Row<out_eT> out(in.length());
syslib::copy_and_convert_elem( out.memptr(), in._data(), out.n_elem ); arrayops::convert( out.memptr(), in._data(), 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
Row<out_eT> Row<out_eT>
conv_to< Row<out_eT> >::from(const itpp::Vec<in_eT>& in, const typename arm a_cx_only<in_eT>::result* junk) conv_to< Row<out_eT> >::from(const itpp::Vec<in_eT>& in, const typename arm a_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.length()); Row<out_eT> out(in.length());
syslib::copy_and_convert_cx_elem( out.memptr(), in._data(), out.n_elem ); arrayops::convert_cx( out.memptr(), in._data(), out.n_elem );
return out; return out;
} }
//! conversion to Armadillo column vectors from Armadillo Base objects, //! conversion to Armadillo column vectors from Armadillo Base objects,
//! as well as from std::vector, itpp::Mat and itpp::Vec //! as well as from std::vector, itpp::Mat and itpp::Vec
template<typename out_eT> template<typename out_eT>
class conv_to< Col<out_eT> > class conv_to< Col<out_eT> >
{ {
public: public:
skipping to change at line 585 skipping to change at line 585
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);
syslib::copy_and_convert_elem( 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
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)
{ {
skipping to change at line 607 skipping to change at line 607
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);
syslib::copy_and_convert_cx_elem( 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
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)
{ {
skipping to change at line 667 skipping to change at line 667
typename Col<out_eT>::iterator out_end = out.end(); typename Col<out_eT>::iterator out_end = out.end();
typename std::vector<in_eT>::const_iterator in_it; typename std::vector<in_eT>::const_iterator in_it;
typename Col<out_eT>::iterator out_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) for(in_it = in_begin, out_it = out_begin; (in_it != in_end) && (out_it != out_end); ++in_it, ++out_it)
{ {
out_eT& out_elem = (*out_it); out_eT& out_elem = (*out_it);
const in_eT& in_elem = (*in_it); const in_eT& in_elem = (*in_it);
syslib::convert_cx_scalar(out_elem, in_elem); arrayops::convert_cx_scalar(out_elem, in_elem);
} }
return out; return out;
} }
template<typename out_eT> template<typename out_eT>
template<typename in_eT> template<typename in_eT>
inline inline
Col<out_eT> Col<out_eT>
conv_to< Col<out_eT> >::from(const itpp::Mat<in_eT>& in, const typename arm a_not_cx<in_eT>::result* junk) conv_to< Col<out_eT> >::from(const itpp::Mat<in_eT>& in, const typename arm a_not_cx<in_eT>::result* junk)
skipping to change at line 689 skipping to change at line 689
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_ignore(junk); arma_ignore(junk);
const bool is_vec = ( (in.rows() == 1) || (in.cols() == 1) ); const bool is_vec = ( (in.rows() == 1) || (in.cols() == 1) );
arma_debug_check( (is_vec == false), "conv_to(): given object can't be in terpreted as a vector" ); arma_debug_check( (is_vec == false), "conv_to(): given object can't be in terpreted as a vector" );
Col<out_eT> out(in.rows() * in.cols()); Col<out_eT> out(in.rows() * in.cols());
syslib::copy_and_convert_elem( out.memptr(), in._data(), out.n_elem ); arrayops::convert( out.memptr(), in._data(), 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
Col<out_eT> Col<out_eT>
conv_to< Col<out_eT> >::from(const itpp::Mat<in_eT>& in, const typename arm a_cx_only<in_eT>::result* junk) conv_to< Col<out_eT> >::from(const itpp::Mat<in_eT>& in, const typename arm a_cx_only<in_eT>::result* junk)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_ignore(junk); arma_ignore(junk);
const bool is_vec = ( (in.rows() == 1) || (in.cols() == 1) ); const bool is_vec = ( (in.rows() == 1) || (in.cols() == 1) );
Col<out_eT> out(in.rows() * in.cols()); Col<out_eT> out(in.rows() * in.cols());
syslib::copy_and_convert_cx_elem( out.memptr(), in._data(), out.n_elem ); arrayops::convert_cx( out.memptr(), in._data(), 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
Col<out_eT> Col<out_eT>
conv_to< Col<out_eT> >::from(const itpp::Vec<in_eT>& in, const typename arm a_not_cx<in_eT>::result* junk) conv_to< Col<out_eT> >::from(const itpp::Vec<in_eT>& in, const typename arm a_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.length() ); Col<out_eT> out( in.length() );
syslib::copy_and_convert_elem( out.memptr(), in._data(), out.n_elem ); arrayops::convert( out.memptr(), in._data(), 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
Col<out_eT> Col<out_eT>
conv_to< Col<out_eT> >::from(const itpp::Vec<in_eT>& in, const typename arm a_cx_only<in_eT>::result* junk) conv_to< Col<out_eT> >::from(const itpp::Vec<in_eT>& in, const typename arm a_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.length() ); Col<out_eT> out( in.length() );
syslib::copy_and_convert_cx_elem( out.memptr(), in._data(), out.n_elem ); arrayops::convert_cx( out.memptr(), in._data(), out.n_elem );
return out; return out;
} }
//! conversion to Armadillo cubes from Armadillo BaseCube objects //! conversion to Armadillo cubes from Armadillo BaseCube objects
template<typename out_eT> template<typename out_eT>
class conv_to< Cube<out_eT> > class conv_to< Cube<out_eT> >
{ {
public: public:
skipping to change at line 775 skipping to change at line 775
{ {
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);
syslib::copy_and_convert_elem( 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);
syslib::copy_and_convert_cx_elem( out.memptr(), X.memptr(), out.n_elem ); arrayops::convert_cx( out.memptr(), X.memptr(), out.n_elem );
return out; return out;
} }
//! conversion to std::vector from Armadillo Base objects //! conversion to std::vector from Armadillo Base objects
template<typename out_eT> template<typename out_eT>
class conv_to< std::vector<out_eT> > class conv_to< std::vector<out_eT> >
{ {
public: public:
skipping to change at line 878 skipping to change at line 878
typename std::vector<out_eT>::iterator out_end = out.end(); typename std::vector<out_eT>::iterator out_end = out.end();
typename Mat<in_eT>::const_iterator X_it; typename Mat<in_eT>::const_iterator X_it;
typename std::vector<out_eT>::iterator out_it; 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) for(X_it = X_begin, out_it = out_begin; (X_it != X_end) && (out_it != out _end); ++X_it, ++out_it)
{ {
out_eT& out_elem = (*out_it); out_eT& out_elem = (*out_it);
const in_eT& X_elem = (*X_it); const in_eT& X_elem = (*X_it);
syslib::convert_cx_scalar(out_elem, X_elem); arrayops::convert_cx_scalar(out_elem, X_elem);
} }
return out; return out;
} }
//! conversion to itpp::Mat from Armadillo Base objects //! conversion to itpp::Mat from Armadillo Base objects
template<typename out_eT> template<typename out_eT>
class conv_to< itpp::Mat<out_eT> > class conv_to< itpp::Mat<out_eT> >
{ {
public: public:
skipping to change at line 912 skipping to change at line 912
{ {
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;
itpp::Mat<out_eT> out(X.n_rows, X.n_cols); itpp::Mat<out_eT> out(X.n_rows, X.n_cols);
syslib::copy_and_convert_elem( out._data(), X.memptr(), X.n_elem ); arrayops::convert( out._data(), X.memptr(), X.n_elem );
return out; return out;
} }
template<typename out_eT> template<typename out_eT>
template<typename in_eT, typename T1> template<typename in_eT, typename T1>
inline inline
itpp::Mat<out_eT> itpp::Mat<out_eT>
conv_to< itpp::Mat<out_eT> >::from(const Base<in_eT, T1>& in, const typenam e arma_cx_only<in_eT>::result* junk) conv_to< itpp::Mat<out_eT> >::from(const Base<in_eT, T1>& in, const typenam e 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;
itpp::Mat<out_eT> out(X.n_rows, X.n_cols); itpp::Mat<out_eT> out(X.n_rows, X.n_cols);
syslib::copy_and_convert_cx_elem( out._data(), X.memptr(), X.n_elem ); arrayops::convert_cx( out._data(), X.memptr(), X.n_elem );
return out; return out;
} }
//! conversion to itpp::Vec from Armadillo Base objects //! conversion to itpp::Vec from Armadillo Base objects
template<typename out_eT> template<typename out_eT>
class conv_to< itpp::Vec<out_eT> > class conv_to< itpp::Vec<out_eT> >
{ {
public: public:
skipping to change at line 967 skipping to change at line 967
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" );
itpp::Vec<out_eT> out(X.n_elem); itpp::Vec<out_eT> out(X.n_elem);
syslib::copy_and_convert_elem( out._data(), X.memptr(), X.n_elem ); arrayops::convert( out._data(), X.memptr(), X.n_elem );
return out; return out;
} }
template<typename out_eT> template<typename out_eT>
template<typename in_eT, typename T1> template<typename in_eT, typename T1>
inline inline
itpp::Vec<out_eT> itpp::Vec<out_eT>
conv_to< itpp::Vec<out_eT> >::from(const Base<in_eT, T1>& in, const typenam e arma_cx_only<in_eT>::result* junk) conv_to< itpp::Vec<out_eT> >::from(const Base<in_eT, T1>& in, const typenam e 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;
itpp::Vec<out_eT> out(X.n_elem); itpp::Vec<out_eT> out(X.n_elem);
syslib::copy_and_convert_cx_elem( out._data(), X.memptr(), X.n_elem ); arrayops::convert_cx( out._data(), X.memptr(), X.n_elem );
return out; return out;
} }
//! @} //! @}
 End of changes. 30 change blocks. 
30 lines changed or deleted 30 lines changed or added


 fn_prod.hpp   fn_prod.hpp 
// Copyright (C) 2009-2010 NICTA (www.nicta.com.au) // Copyright (C) 2009-2011 NICTA (www.nicta.com.au)
// Copyright (C) 2009-2010 Conrad Sanderson // Copyright (C) 2009-2011 Conrad Sanderson
// //
// This file is part of the Armadillo C++ library. // This file is part of the Armadillo C++ library.
// It is provided without any warranty of fitness // It is provided without any warranty of fitness
// for any purpose. You can redistribute this file // for any purpose. You can redistribute this file
// and/or modify it under the terms of the GNU // and/or modify it under the terms of the GNU
// Lesser General Public License (LGPL) as published // Lesser General Public License (LGPL) as published
// by the Free Software Foundation, either version 3 // by the Free Software Foundation, either version 3
// of the License or (at your option) any later version. // of the License or (at your option) any later version.
// (see http://www.opensource.org/licenses for more info) // (see http://www.opensource.org/licenses for more info)
skipping to change at line 45 skipping to change at line 45
//! Immediate 'product of all values' operation for a row vector //! Immediate 'product of all values' operation for a row vector
template<typename eT> template<typename eT>
inline inline
eT eT
prod(const Row<eT>& X) prod(const Row<eT>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( (X.n_elem < 1), "prod(): given object has no elements" ); arma_debug_check( (X.n_elem < 1), "prod(): given object has no elements" );
const u32 n_elem = X.n_elem; return arrayops::product(X.memptr(), X.n_elem);
const eT* X_mem = X.memptr();
eT val = X_mem[0];
for(u32 i=1; i<n_elem; ++i)
{
val *= X_mem[i];
}
return val;
} }
//! \brief //! \brief
//! Immediate 'product of all values' operation for a column vector //! Immediate 'product of all values' operation for a column vector
template<typename eT> template<typename eT>
inline inline
eT eT
prod(const Col<eT>& X) prod(const Col<eT>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( (X.n_elem < 1), "prod(): given object has no elements" ); arma_debug_check( (X.n_elem < 1), "prod(): given object has no elements" );
const u32 n_elem = X.n_elem; return arrayops::product(X.memptr(), X.n_elem);
const eT* X_mem = X.memptr();
eT val = X_mem[0];
for(u32 i=1; i<n_elem; ++i)
{
val *= X_mem[i];
}
return val;
} }
//! \brief //! \brief
//! Immediate 'product of all values' operation, //! Immediate 'product of all values' operation,
//! invoked, for example, by: prod(prod(A)) //! invoked, for example, by: prod(prod(A))
template<typename T1> template<typename T1>
inline inline
typename T1::elem_type typename T1::elem_type
prod(const Op<T1, op_prod>& in) prod(const Op<T1, op_prod>& in)
skipping to change at line 160 skipping to change at line 140
//! product of all values of a subview_col //! product of all values of a subview_col
template<typename eT> template<typename eT>
inline inline
eT eT
prod(const subview_col<eT>& S) prod(const subview_col<eT>& S)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( (S.n_elem < 1), "prod(): given object has no elements" ); arma_debug_check( (S.n_elem < 1), "prod(): given object has no elements" );
const eT* S_colptr = S.colptr(0); return arrayops::product( S.colptr(0), S.n_rows );
const u32 n_rows = S.n_rows;
eT val = S_colptr[0];
for(u32 row=1; row<n_rows; ++row)
{
val *= S_colptr[row];
}
return val;
} }
//! product of all values of a diagview //! product of all values of a diagview
template<typename eT> template<typename eT>
inline inline
eT eT
prod(const diagview<eT>& X) prod(const diagview<eT>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
 End of changes. 4 change blocks. 
35 lines changed or deleted 5 lines changed or added


 glue_solve_meat.hpp   glue_solve_meat.hpp 
// Copyright (C) 2009-2010 NICTA (www.nicta.com.au) // Copyright (C) 2009-2011 NICTA (www.nicta.com.au)
// Copyright (C) 2009-2010 Conrad Sanderson // Copyright (C) 2009-2011 Conrad Sanderson
// //
// This file is part of the Armadillo C++ library. // This file is part of the Armadillo C++ library.
// It is provided without any warranty of fitness // It is provided without any warranty of fitness
// for any purpose. You can redistribute this file // for any purpose. You can redistribute this file
// and/or modify it under the terms of the GNU // and/or modify it under the terms of the GNU
// Lesser General Public License (LGPL) as published // Lesser General Public License (LGPL) as published
// by the Free Software Foundation, either version 3 // by the Free Software Foundation, either version 3
// of the License or (at your option) any later version. // of the License or (at your option) any later version.
// (see http://www.opensource.org/licenses for more info) // (see http://www.opensource.org/licenses for more info)
skipping to change at line 25 skipping to change at line 25
template<typename T1, typename T2> template<typename T1, typename T2>
inline inline
void void
glue_solve::apply(Mat<typename T1::elem_type>& out, const Glue<T1,T2,glue_s olve>& X) glue_solve::apply(Mat<typename T1::elem_type>& out, const Glue<T1,T2,glue_s olve>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
const unwrap_check<T1> A_tmp(X.A, out); Mat<eT> A = X.A.get_ref();
const unwrap_check<T2> B_tmp(X.B, out);
const Mat<eT>& A = A_tmp.M; const unwrap_check<T2> B_tmp(X.B, out);
const Mat<eT>& B = B_tmp.M; const Mat<eT>& B = B_tmp.M;
arma_debug_check( ( (&A) == (&B) ), "solve(): A is an alias of B" ) ;
arma_debug_check( (A.n_rows != B.n_rows), "solve(): number of rows in A a nd B must be the same" ); arma_debug_check( (A.n_rows != B.n_rows), "solve(): number of rows in A a nd B must be the same" );
bool status; bool status;
if(A.n_rows == A.n_cols) if(A.n_rows == A.n_cols)
{ {
status = auxlib::solve(out, A, B); status = auxlib::solve(out, A, B);
} }
else else
if(A.n_rows > A.n_cols) if(A.n_rows > A.n_cols)
 End of changes. 4 change blocks. 
6 lines changed or deleted 4 lines changed or added


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


 injector_meat.hpp   injector_meat.hpp 
skipping to change at line 42 skipping to change at line 42
if(n_cols < A.n_elem) if(n_cols < A.n_elem)
{ {
A[n_cols] = val; A[n_cols] = val;
++n_cols; ++n_cols;
} }
else else
{ {
B.set_size(2 * A.n_elem); B.set_size(2 * A.n_elem);
syslib::copy_elem(B.memptr(), A.memptr(), n_cols); arrayops::copy(B.memptr(), A.memptr(), n_cols);
B[n_cols] = val; B[n_cols] = val;
++n_cols; ++n_cols;
std::swap( access::rw(A.mem), access::rw(B.mem) ); std::swap( access::rw(A.mem), access::rw(B.mem) );
std::swap( access::rw(A.n_elem), access::rw(B.n_elem) ); std::swap( access::rw(A.n_elem), access::rw(B.n_elem) );
} }
} }
// //
skipping to change at line 163 skipping to change at line 163
} }
else else
if(is_Row<T1>::value == true) if(is_Row<T1>::value == true)
{ {
arma_debug_check( (max_n_rows > 1), "operator<<: incompatible dimensi ons" ); arma_debug_check( (max_n_rows > 1), "operator<<: incompatible dimensi ons" );
const u32 n_cols = (*(A[0])).n_cols; const u32 n_cols = (*(A[0])).n_cols;
X.set_size(1, n_cols); X.set_size(1, n_cols);
syslib::copy_elem( X.memptr(), (*(A[0])).A.memptr(), n_cols ); arrayops::copy( X.memptr(), (*(A[0])).A.memptr(), n_cols );
} }
else else
if(is_Col<T1>::value == true) if(is_Col<T1>::value == true)
{ {
const bool is_vec = ( (max_n_rows == 1) || (max_n_cols == 1) ); const bool is_vec = ( (max_n_rows == 1) || (max_n_cols == 1) );
arma_debug_check( (is_vec == false), "operator<<: incompatible dimens ions" ); arma_debug_check( (is_vec == false), "operator<<: incompatible dimens ions" );
const u32 n_elem = (std::max)(max_n_rows, max_n_cols); const u32 n_elem = (std::max)(max_n_rows, max_n_cols);
skipping to change at line 233 skipping to change at line 233
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename mat_injector<T1>::elem_type eT; typedef typename mat_injector<T1>::elem_type eT;
podarray< mat_injector_row<eT>* >& A = *AA; podarray< mat_injector_row<eT>* >& A = *AA;
podarray< mat_injector_row<eT>* >& B = *BB; podarray< mat_injector_row<eT>* >& B = *BB;
B.set_size( n_rows+1 ); B.set_size( n_rows+1 );
syslib::copy_elem(B.memptr(), A.memptr(), n_rows); arrayops::copy(B.memptr(), A.memptr(), n_rows);
for(u32 row=n_rows; row<(n_rows+1); ++row) for(u32 row=n_rows; row<(n_rows+1); ++row)
{ {
B[row] = new mat_injector_row<eT>; B[row] = new mat_injector_row<eT>;
} }
std::swap(AA, BB); std::swap(AA, BB);
n_rows += 1; n_rows += 1;
} }
 End of changes. 3 change blocks. 
3 lines changed or deleted 3 lines changed or added


 op_dot_meat.hpp   op_dot_meat.hpp 
skipping to change at line 294 skipping to change at line 294
u32 i,j; u32 i,j;
for(i=0, j=1; j<N; i+=2, j+=2) for(i=0, j=1; j<N; i+=2, j+=2)
{ {
val1 += std::conj(PA[i]) * PB[i]; val1 += std::conj(PA[i]) * PB[i];
val2 += std::conj(PA[j]) * PB[j]; val2 += std::conj(PA[j]) * PB[j];
} }
if(i < N) if(i < N)
{ {
val1 += conj(PA[i]) * PB[i]; val1 += std::conj(PA[i]) * PB[i];
} }
return val1 + val2; return val1 + val2;
} }
//! @} //! @}
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 op_prod_meat.hpp   op_prod_meat.hpp 
// Copyright (C) 2009-2010 NICTA (www.nicta.com.au) // Copyright (C) 2009-2011 NICTA (www.nicta.com.au)
// Copyright (C) 2009-2010 Conrad Sanderson // Copyright (C) 2009-2011 Conrad Sanderson
// //
// This file is part of the Armadillo C++ library. // This file is part of the Armadillo C++ library.
// It is provided without any warranty of fitness // It is provided without any warranty of fitness
// for any purpose. You can redistribute this file // for any purpose. You can redistribute this file
// and/or modify it under the terms of the GNU // and/or modify it under the terms of the GNU
// Lesser General Public License (LGPL) as published // Lesser General Public License (LGPL) as published
// by the Free Software Foundation, either version 3 // by the Free Software Foundation, either version 3
// of the License or (at your option) any later version. // of the License or (at your option) any later version.
// (see http://www.opensource.org/licenses for more info) // (see http://www.opensource.org/licenses for more info)
skipping to change at line 37 skipping to change at line 37
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
const u32 dim = in.aux_u32_a; const u32 dim = in.aux_u32_a;
arma_debug_check( (dim > 1), "prod(): incorrect usage. dim must be 0 or 1 "); arma_debug_check( (dim > 1), "prod(): incorrect usage. dim must be 0 or 1 ");
const unwrap_check<T1> tmp(in.m, out); const unwrap_check<T1> tmp(in.m, out);
const Mat<eT>& X = tmp.M; const Mat<eT>& X = tmp.M;
arma_debug_check( (X.n_elem < 1), "prod(): give object has no elements"); arma_debug_check( (X.n_elem < 1), "prod(): give object has no elements");
const u32 X_n_rows = X.n_rows;
const u32 X_n_cols = X.n_cols;
if(dim == 0) // traverse across rows (i.e. find the product in each colu mn) if(dim == 0) // traverse across rows (i.e. find the product in each colu mn)
{ {
out.set_size(1, X.n_cols); out.set_size(1, X_n_cols);
for(u32 col=0; col<X.n_cols; ++col) for(u32 col=0; col<X_n_cols; ++col)
{ {
const eT* X_colptr = X.colptr(col); out.at(0,col) = arrayops::product(X.colptr(col), X_n_rows);
eT val = X_colptr[0];
for(u32 row=1; row < X.n_rows; ++row)
{
val *= X_colptr[row];
}
out.at(0,col) = val;
} }
} }
else // traverse across columns (i.e. find the product in each row) else // traverse across columns (i.e. find the product in each row)
{ {
out.set_size(X.n_rows, 1); out.set_size(X_n_rows, 1);
for(u32 row=0; row < X.n_rows; ++row) for(u32 row=0; row < X_n_rows; ++row)
{ {
eT val = X.at(row,0); eT val = X.at(row,0);
for(u32 col=1; col < X.n_cols; ++col) for(u32 col=1; col < X_n_cols; ++col)
{ {
val *= X.at(row,col); val *= X.at(row,col);
} }
out.at(row,0) = val; out.at(row,0) = val;
} }
} }
} }
 End of changes. 8 change blocks. 
17 lines changed or deleted 11 lines changed or added


 op_reshape_meat.hpp   op_reshape_meat.hpp 
skipping to change at line 40 skipping to change at line 40
const u32 in_n_elem = in_n_rows * in_n_cols; const u32 in_n_elem = in_n_rows * in_n_cols;
if(A.n_elem == in_n_elem) if(A.n_elem == in_n_elem)
{ {
if(in.aux == eT(0)) if(in.aux == eT(0))
{ {
if(&out != &A) if(&out != &A)
{ {
out.set_size(in_n_rows, in_n_cols); out.set_size(in_n_rows, in_n_cols);
syslib::copy_elem( out.memptr(), A.memptr(), out.n_elem ); arrayops::copy( out.memptr(), A.memptr(), out.n_elem );
} }
else // &out == &A, i.e. inplace resize else // &out == &A, i.e. inplace resize
{ {
const bool same_size = ( (out.n_rows == in_n_rows) && (out.n_cols = = in_n_cols) ); const bool same_size = ( (out.n_rows == in_n_rows) && (out.n_cols = = in_n_cols) );
if(same_size == false) if(same_size == false)
{ {
arma_debug_check arma_debug_check
( (
(out.mem_state == 3), (out.mem_state == 3),
skipping to change at line 93 skipping to change at line 93
const Mat<eT>& B = tmp.M; const Mat<eT>& B = tmp.M;
const u32 n_elem_to_copy = (std::min)(B.n_elem, in_n_elem); const u32 n_elem_to_copy = (std::min)(B.n_elem, in_n_elem);
out.set_size(in_n_rows, in_n_cols); out.set_size(in_n_rows, in_n_cols);
eT* out_mem = out.memptr(); eT* out_mem = out.memptr();
if(in.aux == eT(0)) if(in.aux == eT(0))
{ {
syslib::copy_elem( out_mem, B.memptr(), n_elem_to_copy ); arrayops::copy( out_mem, B.memptr(), n_elem_to_copy );
} }
else else
{ {
u32 row = 0; u32 row = 0;
u32 col = 0; u32 col = 0;
for(u32 i=0; i<n_elem_to_copy; ++i) for(u32 i=0; i<n_elem_to_copy; ++i)
{ {
out_mem[i] = B.at(row,col); out_mem[i] = B.at(row,col);
skipping to change at line 147 skipping to change at line 147
const u32 in_n_elem = in_n_rows * in_n_cols * in_n_slices; const u32 in_n_elem = in_n_rows * in_n_cols * in_n_slices;
if(A.n_elem == in_n_elem) if(A.n_elem == in_n_elem)
{ {
if(in.aux == eT(0)) if(in.aux == eT(0))
{ {
if(&out != &A) if(&out != &A)
{ {
out.set_size(in_n_rows, in_n_cols, in_n_slices); out.set_size(in_n_rows, in_n_cols, in_n_slices);
syslib::copy_elem( out.memptr(), A.memptr(), out.n_elem ); arrayops::copy( out.memptr(), A.memptr(), out.n_elem );
} }
else // &out == &A, i.e. inplace resize else // &out == &A, i.e. inplace resize
{ {
const bool same_size = ( (out.n_rows == in_n_rows) && (out.n_cols = = in_n_cols) && (out.n_slices == in_n_slices) ); const bool same_size = ( (out.n_rows == in_n_rows) && (out.n_cols = = in_n_cols) && (out.n_slices == in_n_slices) );
if(same_size == false) if(same_size == false)
{ {
arma_debug_check arma_debug_check
( (
(out.mem_state == 3), (out.mem_state == 3),
skipping to change at line 209 skipping to change at line 209
const Cube<eT>& B = tmp.M; const Cube<eT>& B = tmp.M;
const u32 n_elem_to_copy = (std::min)(B.n_elem, in_n_elem); const u32 n_elem_to_copy = (std::min)(B.n_elem, in_n_elem);
out.set_size(in_n_rows, in_n_cols, in_n_slices); out.set_size(in_n_rows, in_n_cols, in_n_slices);
eT* out_mem = out.memptr(); eT* out_mem = out.memptr();
if(in.aux == eT(0)) if(in.aux == eT(0))
{ {
syslib::copy_elem( out_mem, B.memptr(), n_elem_to_copy ); arrayops::copy( out_mem, B.memptr(), n_elem_to_copy );
} }
else else
{ {
u32 row = 0; u32 row = 0;
u32 col = 0; u32 col = 0;
u32 slice = 0; u32 slice = 0;
for(u32 i=0; i<n_elem_to_copy; ++i) for(u32 i=0; i<n_elem_to_copy; ++i)
{ {
out_mem[i] = B.at(row,col,slice); out_mem[i] = B.at(row,col,slice);
 End of changes. 4 change blocks. 
4 lines changed or deleted 4 lines changed or added


 op_trans_meat.hpp   op_trans_meat.hpp 
skipping to change at line 31 skipping to change at line 31
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
const u32 A_n_cols = A.n_cols; const u32 A_n_cols = A.n_cols;
const u32 A_n_rows = A.n_rows; const u32 A_n_rows = A.n_rows;
out.set_size(A_n_cols, A_n_rows); out.set_size(A_n_cols, A_n_rows);
if( (A_n_cols == 1) || (A_n_rows == 1) ) if( (A_n_cols == 1) || (A_n_rows == 1) )
{ {
syslib::copy_elem( out.memptr(), A.mem, A.n_elem ); arrayops::copy( out.memptr(), A.mem, A.n_elem );
} }
else else
{ {
for(u32 in_row = 0; in_row<A_n_rows; ++in_row) for(u32 in_row = 0; in_row<A_n_rows; ++in_row)
{ {
const u32 out_col = in_row; const u32 out_col = in_row;
for(u32 in_col = 0; in_col<A_n_cols; ++in_col) for(u32 in_col = 0; in_col<A_n_cols; ++in_col)
{ {
const u32 out_row = in_col; const u32 out_row = in_col;
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 op_trimat_meat.hpp   op_trimat_meat.hpp 
skipping to change at line 44 skipping to change at line 44
out.copy_size(A); out.copy_size(A);
if(in.aux_u32_a == 0) if(in.aux_u32_a == 0)
{ {
// upper triangular: copy the diagonal and the elements above the dia gonal // upper triangular: copy the diagonal and the elements above the dia gonal
for(u32 i=0; i<N; ++i) for(u32 i=0; i<N; ++i)
{ {
const eT* A_data = A.colptr(i); const eT* A_data = A.colptr(i);
eT* out_data = out.colptr(i); eT* out_data = out.colptr(i);
syslib::copy_elem( out_data, A_data, i+1 ); arrayops::copy( out_data, A_data, i+1 );
} }
} }
else else
{ {
// lower triangular: copy the diagonal and the elements below the dia gonal // lower triangular: copy the diagonal and the elements below the dia gonal
for(u32 i=0; i<N; ++i) for(u32 i=0; i<N; ++i)
{ {
const eT* A_data = A.colptr(i); const eT* A_data = A.colptr(i);
eT* out_data = out.colptr(i); eT* out_data = out.colptr(i);
syslib::copy_elem( &out_data[i], &A_data[i], N-i ); arrayops::copy( &out_data[i], &A_data[i], N-i );
} }
} }
} }
if(in.aux_u32_a == 0) if(in.aux_u32_a == 0)
{ {
// upper triangular: set all elements below the diagonal to zero // upper triangular: set all elements below the diagonal to zero
for(u32 i=0; i<N; ++i) for(u32 i=0; i<N; ++i)
{ {
 End of changes. 2 change blocks. 
2 lines changed or deleted 2 lines changed or added


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


 subview_cube_meat.hpp   subview_cube_meat.hpp 
skipping to change at line 184 skipping to change at line 184
arma_debug_assert_same_size(t, x, "copy into subcube"); arma_debug_assert_same_size(t, x, "copy into subcube");
const u32 t_n_rows = t.n_rows; const u32 t_n_rows = t.n_rows;
const u32 t_n_cols = t.n_cols; const u32 t_n_cols = t.n_cols;
const u32 t_n_slices = t.n_slices; const u32 t_n_slices = t.n_slices;
for(u32 slice = 0; slice < t_n_slices; ++slice) for(u32 slice = 0; slice < t_n_slices; ++slice)
{ {
for(u32 col = 0; col < t_n_cols; ++col) for(u32 col = 0; col < t_n_cols; ++col)
{ {
syslib::copy_elem( t.slice_colptr(slice,col), x.slice_colptr(slice,co l), t_n_rows ); arrayops::copy( t.slice_colptr(slice,col), x.slice_colptr(slice,col), t_n_rows );
} }
} }
} }
template<typename eT> template<typename eT>
template<typename T1> template<typename T1>
inline inline
void void
subview_cube<eT>::operator+= (const BaseCube<eT,T1>& in) subview_cube<eT>::operator+= (const BaseCube<eT,T1>& in)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
const unwrap_cube<T1> tmp(in.get_ref()); const unwrap_cube<T1> tmp(in.get_ref());
const Cube<eT>& x = tmp.M; const Cube<eT>& x = tmp.M;
subview_cube<eT>& t = *this; subview_cube<eT>& t = *this;
arma_debug_assert_same_size(t, x, "cube addition"); arma_debug_assert_same_size(t, x, "addition");
const u32 t_n_rows = t.n_rows; const u32 t_n_rows = t.n_rows;
const u32 t_n_cols = t.n_cols; const u32 t_n_cols = t.n_cols;
const u32 t_n_slices = t.n_slices; const u32 t_n_slices = t.n_slices;
for(u32 slice = 0; slice < t_n_slices; ++slice) for(u32 slice = 0; slice < t_n_slices; ++slice)
{ {
for(u32 col = 0; col < t_n_cols; ++col) for(u32 col = 0; col < t_n_cols; ++col)
{ {
arrayops::inplace_plus( t.slice_colptr(slice,col), x.slice_colptr(sli ce,col), t_n_rows ); arrayops::inplace_plus( t.slice_colptr(slice,col), x.slice_colptr(sli ce,col), t_n_rows );
skipping to change at line 230 skipping to change at line 230
void void
subview_cube<eT>::operator-= (const BaseCube<eT,T1>& in) subview_cube<eT>::operator-= (const BaseCube<eT,T1>& in)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
const unwrap_cube<T1> tmp(in.get_ref()); const unwrap_cube<T1> tmp(in.get_ref());
const Cube<eT>& x = tmp.M; const Cube<eT>& x = tmp.M;
subview_cube<eT>& t = *this; subview_cube<eT>& t = *this;
arma_debug_assert_same_size(t, x, "cube subtraction"); arma_debug_assert_same_size(t, x, "subtraction");
const u32 t_n_rows = t.n_rows; const u32 t_n_rows = t.n_rows;
const u32 t_n_cols = t.n_cols; const u32 t_n_cols = t.n_cols;
const u32 t_n_slices = t.n_slices; const u32 t_n_slices = t.n_slices;
for(u32 slice = 0; slice < t_n_slices; ++slice) for(u32 slice = 0; slice < t_n_slices; ++slice)
{ {
for(u32 col = 0; col < t_n_cols; ++col) for(u32 col = 0; col < t_n_cols; ++col)
{ {
arrayops::inplace_minus( t.slice_colptr(slice,col), x.slice_colptr(sl ice,col), t_n_rows ); arrayops::inplace_minus( t.slice_colptr(slice,col), x.slice_colptr(sl ice,col), t_n_rows );
skipping to change at line 258 skipping to change at line 258
void void
subview_cube<eT>::operator%= (const BaseCube<eT,T1>& in) subview_cube<eT>::operator%= (const BaseCube<eT,T1>& in)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
const unwrap_cube<T1> tmp(in.get_ref()); const unwrap_cube<T1> tmp(in.get_ref());
const Cube<eT>& x = tmp.M; const Cube<eT>& x = tmp.M;
subview_cube<eT>& t = *this; subview_cube<eT>& t = *this;
arma_debug_assert_same_size(t, x, "cube schur product"); arma_debug_assert_same_size(t, x, "element-wise multiplication");
const u32 t_n_rows = t.n_rows; const u32 t_n_rows = t.n_rows;
const u32 t_n_cols = t.n_cols; const u32 t_n_cols = t.n_cols;
const u32 t_n_slices = t.n_slices; const u32 t_n_slices = t.n_slices;
for(u32 slice = 0; slice < t_n_slices; ++slice) for(u32 slice = 0; slice < t_n_slices; ++slice)
{ {
for(u32 col = 0; col < t_n_cols; ++col) for(u32 col = 0; col < t_n_cols; ++col)
{ {
arrayops::inplace_mul( t.slice_colptr(slice,col), x.slice_colptr(slic e,col), t_n_rows ); arrayops::inplace_mul( t.slice_colptr(slice,col), x.slice_colptr(slic e,col), t_n_rows );
skipping to change at line 286 skipping to change at line 286
void void
subview_cube<eT>::operator/= (const BaseCube<eT,T1>& in) subview_cube<eT>::operator/= (const BaseCube<eT,T1>& in)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
const unwrap_cube<T1> tmp(in.get_ref()); const unwrap_cube<T1> tmp(in.get_ref());
const Cube<eT>& x = tmp.M; const Cube<eT>& x = tmp.M;
subview_cube<eT>& t = *this; subview_cube<eT>& t = *this;
arma_debug_assert_same_size(t, x, "element-wise cube division"); arma_debug_assert_same_size(t, x, "element-wise division");
const u32 t_n_rows = t.n_rows; const u32 t_n_rows = t.n_rows;
const u32 t_n_cols = t.n_cols; const u32 t_n_cols = t.n_cols;
const u32 t_n_slices = t.n_slices; const u32 t_n_slices = t.n_slices;
for(u32 slice = 0; slice < t_n_slices; ++slice) for(u32 slice = 0; slice < t_n_slices; ++slice)
{ {
for(u32 col = 0; col < t_n_cols; ++col) for(u32 col = 0; col < t_n_cols; ++col)
{ {
arrayops::inplace_div( t.slice_colptr(slice,col), x.slice_colptr(slic e,col), t_n_rows ); arrayops::inplace_div( t.slice_colptr(slice,col), x.slice_colptr(slic e,col), t_n_rows );
skipping to change at line 327 skipping to change at line 327
arma_debug_assert_same_size(t, x, "copy into subcube"); arma_debug_assert_same_size(t, x, "copy into subcube");
const u32 t_n_rows = t.n_rows; const u32 t_n_rows = t.n_rows;
const u32 t_n_cols = t.n_cols; const u32 t_n_cols = t.n_cols;
const u32 t_n_slices = t.n_slices; const u32 t_n_slices = t.n_slices;
for(u32 slice = 0; slice < t_n_slices; ++slice) for(u32 slice = 0; slice < t_n_slices; ++slice)
{ {
for(u32 col = 0; col < t_n_cols; ++col) for(u32 col = 0; col < t_n_cols; ++col)
{ {
syslib::copy_elem( t.slice_colptr(slice,col), x.slice_colptr(slice,co l), t_n_rows ); arrayops::copy( t.slice_colptr(slice,col), x.slice_colptr(slice,col), t_n_rows );
} }
} }
if(overlap) if(overlap)
{ {
delete tmp_subview_cube; delete tmp_subview_cube;
delete tmp_cube; delete tmp_cube;
} }
} }
skipping to change at line 354 skipping to change at line 354
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
const bool overlap = check_overlap(x_in); const bool overlap = check_overlap(x_in);
Cube<eT>* tmp_cube = overlap ? new Cube<eT>(x_in.m) : 0; Cube<eT>* tmp_cube = overlap ? new Cube<eT>(x_in.m) : 0;
const subview_cube<eT>* tmp_subview_cube = overlap ? new subview_cube<eT> (*tmp_cube, x_in.aux_row1, x_in.aux_col1, x_in.aux_slice1, x_in.aux_row2, x _in.aux_col2, x_in.aux_slice2) : 0; const subview_cube<eT>* tmp_subview_cube = overlap ? new subview_cube<eT> (*tmp_cube, x_in.aux_row1, x_in.aux_col1, x_in.aux_slice1, x_in.aux_row2, x _in.aux_col2, x_in.aux_slice2) : 0;
const subview_cube<eT>& x = overlap ? (*tmp_subview_cube) : x_in; const subview_cube<eT>& x = overlap ? (*tmp_subview_cube) : x_in;
subview_cube<eT>& t = *this; subview_cube<eT>& t = *this;
arma_debug_assert_same_size(t, x, "cube addition"); arma_debug_assert_same_size(t, x, "addition");
const u32 t_n_rows = t.n_rows; const u32 t_n_rows = t.n_rows;
const u32 t_n_cols = t.n_cols; const u32 t_n_cols = t.n_cols;
const u32 t_n_slices = t.n_slices; const u32 t_n_slices = t.n_slices;
for(u32 slice = 0; slice < t_n_slices; ++slice) for(u32 slice = 0; slice < t_n_slices; ++slice)
{ {
for(u32 col = 0; col < t_n_cols; ++col) for(u32 col = 0; col < t_n_cols; ++col)
{ {
arrayops::inplace_plus( t.slice_colptr(slice,col), x.slice_colptr(sli ce,col), t_n_rows ); arrayops::inplace_plus( t.slice_colptr(slice,col), x.slice_colptr(sli ce,col), t_n_rows );
skipping to change at line 391 skipping to change at line 391
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
const bool overlap = check_overlap(x_in); const bool overlap = check_overlap(x_in);
Cube<eT>* tmp_cube = overlap ? new Cube<eT>(x_in.m) : 0; Cube<eT>* tmp_cube = overlap ? new Cube<eT>(x_in.m) : 0;
const subview_cube<eT>* tmp_subview_cube = overlap ? new subview_cube<eT> (*tmp_cube, x_in.aux_row1, x_in.aux_col1, x_in.aux_slice1, x_in.aux_row2, x _in.aux_col2, x_in.aux_slice2) : 0; const subview_cube<eT>* tmp_subview_cube = overlap ? new subview_cube<eT> (*tmp_cube, x_in.aux_row1, x_in.aux_col1, x_in.aux_slice1, x_in.aux_row2, x _in.aux_col2, x_in.aux_slice2) : 0;
const subview_cube<eT>& x = overlap ? (*tmp_subview_cube) : x_in; const subview_cube<eT>& x = overlap ? (*tmp_subview_cube) : x_in;
subview_cube<eT>& t = *this; subview_cube<eT>& t = *this;
arma_debug_assert_same_size(t, x, "cube subtraction"); arma_debug_assert_same_size(t, x, "subtraction");
const u32 t_n_rows = t.n_rows; const u32 t_n_rows = t.n_rows;
const u32 t_n_cols = t.n_cols; const u32 t_n_cols = t.n_cols;
const u32 t_n_slices = t.n_slices; const u32 t_n_slices = t.n_slices;
for(u32 slice = 0; slice < t_n_slices; ++slice) for(u32 slice = 0; slice < t_n_slices; ++slice)
{ {
for(u32 col = 0; col < t_n_cols; ++col) for(u32 col = 0; col < t_n_cols; ++col)
{ {
arrayops::inplace_minus( t.slice_colptr(slice,col), x.slice_colptr(sl ice,col), t_n_rows ); arrayops::inplace_minus( t.slice_colptr(slice,col), x.slice_colptr(sl ice,col), t_n_rows );
skipping to change at line 428 skipping to change at line 428
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
const bool overlap = check_overlap(x_in); const bool overlap = check_overlap(x_in);
Cube<eT>* tmp_cube = overlap ? new Cube<eT>(x_in.m) : 0; Cube<eT>* tmp_cube = overlap ? new Cube<eT>(x_in.m) : 0;
const subview_cube<eT>* tmp_subview_cube = overlap ? new subview_cube<eT> (*tmp_cube, x_in.aux_row1, x_in.aux_col1, x_in.aux_slice1, x_in.aux_row2, x _in.aux_col2, x_in.aux_slice2) : 0; const subview_cube<eT>* tmp_subview_cube = overlap ? new subview_cube<eT> (*tmp_cube, x_in.aux_row1, x_in.aux_col1, x_in.aux_slice1, x_in.aux_row2, x _in.aux_col2, x_in.aux_slice2) : 0;
const subview_cube<eT>& x = overlap ? (*tmp_subview_cube) : x_in; const subview_cube<eT>& x = overlap ? (*tmp_subview_cube) : x_in;
subview_cube<eT>& t = *this; subview_cube<eT>& t = *this;
arma_debug_assert_same_size(t, x, "element-wise cube multiplication"); arma_debug_assert_same_size(t, x, "element-wise multiplication");
const u32 t_n_rows = t.n_rows; const u32 t_n_rows = t.n_rows;
const u32 t_n_cols = t.n_cols; const u32 t_n_cols = t.n_cols;
const u32 t_n_slices = t.n_slices; const u32 t_n_slices = t.n_slices;
for(u32 slice = 0; slice < t_n_slices; ++slice) for(u32 slice = 0; slice < t_n_slices; ++slice)
{ {
for(u32 col = 0; col < t_n_cols; ++col) for(u32 col = 0; col < t_n_cols; ++col)
{ {
arrayops::inplace_mul( t.slice_colptr(slice,col), x.slice_colptr(slic e,col), t_n_rows ); arrayops::inplace_mul( t.slice_colptr(slice,col), x.slice_colptr(slic e,col), t_n_rows );
skipping to change at line 465 skipping to change at line 465
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
const bool overlap = check_overlap(x_in); const bool overlap = check_overlap(x_in);
Cube<eT>* tmp_cube = overlap ? new Cube<eT>(x_in.m) : 0; Cube<eT>* tmp_cube = overlap ? new Cube<eT>(x_in.m) : 0;
const subview_cube<eT>* tmp_subview_cube = overlap ? new subview_cube<eT> (*tmp_cube, x_in.aux_row1, x_in.aux_col1, x_in.aux_slice1, x_in.aux_row2, x _in.aux_col2, x_in.aux_slice2) : 0; const subview_cube<eT>* tmp_subview_cube = overlap ? new subview_cube<eT> (*tmp_cube, x_in.aux_row1, x_in.aux_col1, x_in.aux_slice1, x_in.aux_row2, x _in.aux_col2, x_in.aux_slice2) : 0;
const subview_cube<eT>& x = overlap ? (*tmp_subview_cube) : x_in; const subview_cube<eT>& x = overlap ? (*tmp_subview_cube) : x_in;
subview_cube<eT>& t = *this; subview_cube<eT>& t = *this;
arma_debug_assert_same_size(t, x, "element-wise cube division"); arma_debug_assert_same_size(t, x, "element-wise division");
const u32 t_n_rows = t.n_rows; const u32 t_n_rows = t.n_rows;
const u32 t_n_cols = t.n_cols; const u32 t_n_cols = t.n_cols;
const u32 t_n_slices = t.n_slices; const u32 t_n_slices = t.n_slices;
for(u32 slice = 0; slice < t_n_slices; ++slice) for(u32 slice = 0; slice < t_n_slices; ++slice)
{ {
for(u32 col = 0; col < t_n_cols; ++col) for(u32 col = 0; col < t_n_cols; ++col)
{ {
arrayops::inplace_div( t.slice_colptr(slice,col), x.slice_colptr(slic e,col), t_n_rows ); arrayops::inplace_div( t.slice_colptr(slice,col), x.slice_colptr(slic e,col), t_n_rows );
skipping to change at line 508 skipping to change at line 508
subview_cube<eT>& t = *this; subview_cube<eT>& t = *this;
arma_debug_assert_same_size(t, x, "copy into subcube"); arma_debug_assert_same_size(t, x, "copy into subcube");
const u32 t_n_rows = t.n_rows; const u32 t_n_rows = t.n_rows;
const u32 t_n_cols = t.n_cols; const u32 t_n_cols = t.n_cols;
const u32 t_aux_slice1 = t.aux_slice1; const u32 t_aux_slice1 = t.aux_slice1;
for(u32 col = 0; col < t_n_cols; ++col) for(u32 col = 0; col < t_n_cols; ++col)
{ {
syslib:copy_elem( t.slice_colptr(t_aux_slice1, col), x.colptr(col), t_n _rows ); arrayops::copy( t.slice_colptr(t_aux_slice1, col), x.colptr(col), t_n_r ows );
} }
} }
template<typename eT> template<typename eT>
template<typename T1> template<typename T1>
inline inline
void void
subview_cube<eT>::operator+= (const Base<eT,T1>& in) subview_cube<eT>::operator+= (const Base<eT,T1>& in)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
const unwrap<T1> tmp(in.get_ref()); const unwrap<T1> tmp(in.get_ref());
const Mat<eT>& x = tmp.M; const Mat<eT>& x = tmp.M;
subview_cube<eT>& t = *this; subview_cube<eT>& t = *this;
arma_debug_assert_same_size(t, x, "cube addition"); arma_debug_assert_same_size(t, x, "addition");
const u32 t_n_rows = t.n_rows; const u32 t_n_rows = t.n_rows;
const u32 t_n_cols = t.n_cols; const u32 t_n_cols = t.n_cols;
const u32 t_aux_slice1 = t.aux_slice1; const u32 t_aux_slice1 = t.aux_slice1;
for(u32 col = 0; col < t_n_cols; ++col) for(u32 col = 0; col < t_n_cols; ++col)
{ {
arrayops::inplace_plus( t.slice_colptr(t_aux_slice1, col), x.colptr(col ), t_n_rows ); arrayops::inplace_plus( t.slice_colptr(t_aux_slice1, col), x.colptr(col ), t_n_rows );
} }
} }
skipping to change at line 550 skipping to change at line 550
void void
subview_cube<eT>::operator-= (const Base<eT,T1>& in) subview_cube<eT>::operator-= (const Base<eT,T1>& in)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
const unwrap<T1> tmp(in.get_ref()); const unwrap<T1> tmp(in.get_ref());
const Mat<eT>& x = tmp.M; const Mat<eT>& x = tmp.M;
subview_cube<eT>& t = *this; subview_cube<eT>& t = *this;
arma_debug_assert_same_size(t, x, "cube subtraction"); arma_debug_assert_same_size(t, x, "subtraction");
const u32 t_n_rows = t.n_rows; const u32 t_n_rows = t.n_rows;
const u32 t_n_cols = t.n_cols; const u32 t_n_cols = t.n_cols;
const u32 t_aux_slice1 = t.aux_slice1; const u32 t_aux_slice1 = t.aux_slice1;
for(u32 col = 0; col < t_n_cols; ++col) for(u32 col = 0; col < t_n_cols; ++col)
{ {
arrayops::inplace_minus( t.slice_colptr(t_aux_slice1, col), x.colptr(co l), t_n_rows ); arrayops::inplace_minus( t.slice_colptr(t_aux_slice1, col), x.colptr(co l), t_n_rows );
} }
} }
skipping to change at line 575 skipping to change at line 575
void void
subview_cube<eT>::operator%= (const Base<eT,T1>& in) subview_cube<eT>::operator%= (const Base<eT,T1>& in)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
const unwrap<T1> tmp(in.get_ref()); const unwrap<T1> tmp(in.get_ref());
const Mat<eT>& x = tmp.M; const Mat<eT>& x = tmp.M;
subview_cube<eT>& t = *this; subview_cube<eT>& t = *this;
arma_debug_assert_same_size(t, x, "cube schur product"); arma_debug_assert_same_size(t, x, "element-wise multiplication");
const u32 t_n_rows = t.n_rows; const u32 t_n_rows = t.n_rows;
const u32 t_n_cols = t.n_cols; const u32 t_n_cols = t.n_cols;
const u32 t_aux_slice1 = t.aux_slice1; const u32 t_aux_slice1 = t.aux_slice1;
for(u32 col = 0; col < t_n_cols; ++col) for(u32 col = 0; col < t_n_cols; ++col)
{ {
arrayops::inplace_mul( t.slice_colptr(t_aux_slice1, col), x.colptr(col) , t_n_rows ); arrayops::inplace_mul( t.slice_colptr(t_aux_slice1, col), x.colptr(col) , t_n_rows );
} }
} }
skipping to change at line 600 skipping to change at line 600
void void
subview_cube<eT>::operator/= (const Base<eT,T1>& in) subview_cube<eT>::operator/= (const Base<eT,T1>& in)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
const unwrap<T1> tmp(in.get_ref()); const unwrap<T1> tmp(in.get_ref());
const Mat<eT>& x = tmp.M; const Mat<eT>& x = tmp.M;
subview_cube<eT>& t = *this; subview_cube<eT>& t = *this;
arma_debug_assert_same_size(t, x, "element-wise cube division"); arma_debug_assert_same_size(t, x, "element-wise division");
const u32 t_n_rows = t.n_rows; const u32 t_n_rows = t.n_rows;
const u32 t_n_cols = t.n_cols; const u32 t_n_cols = t.n_cols;
const u32 t_aux_slice1 = t.aux_slice1; const u32 t_aux_slice1 = t.aux_slice1;
for(u32 col = 0; col < t_n_cols; ++col) for(u32 col = 0; col < t_n_cols; ++col)
{ {
arrayops::inplace_div( t.slice_colptr(t_aux_slice1, col), x.colptr(col) , t_n_rows ); arrayops::inplace_div( t.slice_colptr(t_aux_slice1, col), x.colptr(col) , t_n_rows );
} }
} }
skipping to change at line 865 skipping to change at line 865
const u32 n_slices = in.n_slices; const u32 n_slices = in.n_slices;
out.set_size(n_rows, n_cols, n_slices); out.set_size(n_rows, n_cols, n_slices);
arma_extra_debug_print(arma_boost::format("out.n_rows = %d out.n_cols = %d out.n_slices = %d in.m.n_rows = %d in.m.n_cols = %d in.m.n_sl ices = %d") % out.n_rows % out.n_cols % out.n_slices % in.m.n_rows % in.m.n _cols % in.m.n_slices); arma_extra_debug_print(arma_boost::format("out.n_rows = %d out.n_cols = %d out.n_slices = %d in.m.n_rows = %d in.m.n_cols = %d in.m.n_sl ices = %d") % out.n_rows % out.n_cols % out.n_slices % in.m.n_rows % in.m.n _cols % in.m.n_slices);
for(u32 slice = 0; slice < n_slices; ++slice) for(u32 slice = 0; slice < n_slices; ++slice)
{ {
for(u32 col = 0; col < n_cols; ++col) for(u32 col = 0; col < n_cols; ++col)
{ {
syslib::copy_elem( out.slice_colptr(slice,col), in.slice_colptr(slice ,col), n_rows ); arrayops::copy( out.slice_colptr(slice,col), in.slice_colptr(slice,co l), n_rows );
} }
} }
if(alias) if(alias)
{ {
actual_out = out; actual_out = out;
delete tmp; delete tmp;
} }
} }
skipping to change at line 895 skipping to change at line 895
arma_debug_check( (in.n_slices != 1), "subview_cube::extract(): given sub cube doesn't have exactly one slice" ); arma_debug_check( (in.n_slices != 1), "subview_cube::extract(): given sub cube doesn't have exactly one slice" );
const u32 n_rows = in.n_rows; const u32 n_rows = in.n_rows;
const u32 n_cols = in.n_cols; const u32 n_cols = in.n_cols;
const u32 aux_slice1 = in.aux_slice1; const u32 aux_slice1 = in.aux_slice1;
out.set_size(n_rows, n_cols); out.set_size(n_rows, n_cols);
for(u32 col = 0; col < n_cols; ++col) for(u32 col = 0; col < n_cols; ++col)
{ {
syslib::copy_elem( out.colptr(col), in.slice_colptr(aux_slice1, col), n _rows ); arrayops::copy( out.colptr(col), in.slice_colptr(aux_slice1, col), n_ro ws );
} }
} }
//! cube X += Y.subcube(...) //! cube X += Y.subcube(...)
template<typename eT> template<typename eT>
inline inline
void void
subview_cube<eT>::plus_inplace(Cube<eT>& out, const subview_cube<eT>& in) subview_cube<eT>::plus_inplace(Cube<eT>& out, const subview_cube<eT>& in)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_assert_same_size(out, in, "cube addition"); arma_debug_assert_same_size(out, in, "addition");
const u32 n_rows = out.n_rows; const u32 n_rows = out.n_rows;
const u32 n_cols = out.n_cols; const u32 n_cols = out.n_cols;
const u32 n_slices = out.n_slices; const u32 n_slices = out.n_slices;
for(u32 slice = 0; slice<n_slices; ++slice) for(u32 slice = 0; slice<n_slices; ++slice)
{ {
for(u32 col = 0; col<n_cols; ++col) for(u32 col = 0; col<n_cols; ++col)
{ {
arrayops::inplace_plus( out.slice_colptr(slice,col), in.slice_colptr( slice,col), n_rows ); arrayops::inplace_plus( out.slice_colptr(slice,col), in.slice_colptr( slice,col), n_rows );
skipping to change at line 930 skipping to change at line 930
} }
//! cube X -= Y.subcube(...) //! cube X -= Y.subcube(...)
template<typename eT> template<typename eT>
inline inline
void void
subview_cube<eT>::minus_inplace(Cube<eT>& out, const subview_cube<eT>& in) subview_cube<eT>::minus_inplace(Cube<eT>& out, const subview_cube<eT>& in)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_assert_same_size(out, in, "cube subtraction"); arma_debug_assert_same_size(out, in, "subtraction");
const u32 n_rows = out.n_rows; const u32 n_rows = out.n_rows;
const u32 n_cols = out.n_cols; const u32 n_cols = out.n_cols;
const u32 n_slices = out.n_slices; const u32 n_slices = out.n_slices;
for(u32 slice = 0; slice<n_slices; ++slice) for(u32 slice = 0; slice<n_slices; ++slice)
{ {
for(u32 col = 0; col<n_cols; ++col) for(u32 col = 0; col<n_cols; ++col)
{ {
arrayops::inplace_minus( out.slice_colptr(slice,col), in.slice_colptr (slice,col), n_rows ); arrayops::inplace_minus( out.slice_colptr(slice,col), in.slice_colptr (slice,col), n_rows );
skipping to change at line 953 skipping to change at line 953
} }
//! cube X %= Y.subcube(...) //! cube X %= Y.subcube(...)
template<typename eT> template<typename eT>
inline inline
void void
subview_cube<eT>::schur_inplace(Cube<eT>& out, const subview_cube<eT>& in) subview_cube<eT>::schur_inplace(Cube<eT>& out, const subview_cube<eT>& in)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_assert_same_size(out, in, "cube schur product"); arma_debug_assert_same_size(out, in, "element-wise multiplication");
const u32 n_rows = out.n_rows; const u32 n_rows = out.n_rows;
const u32 n_cols = out.n_cols; const u32 n_cols = out.n_cols;
const u32 n_slices = out.n_slices; const u32 n_slices = out.n_slices;
for(u32 slice = 0; slice<n_slices; ++slice) for(u32 slice = 0; slice<n_slices; ++slice)
{ {
for(u32 col = 0; col<n_cols; ++col) for(u32 col = 0; col<n_cols; ++col)
{ {
arrayops::inplace_mul( out.slice_colptr(slice,col), in.slice_colptr(s lice,col), n_rows ); arrayops::inplace_mul( out.slice_colptr(slice,col), in.slice_colptr(s lice,col), n_rows );
skipping to change at line 976 skipping to change at line 976
} }
//! cube X /= Y.subcube(...) //! cube X /= Y.subcube(...)
template<typename eT> template<typename eT>
inline inline
void void
subview_cube<eT>::div_inplace(Cube<eT>& out, const subview_cube<eT>& in) subview_cube<eT>::div_inplace(Cube<eT>& out, const subview_cube<eT>& in)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_assert_same_size(out, in, "element-wise cube division"); arma_debug_assert_same_size(out, in, "element-wise division");
const u32 n_rows = out.n_rows; const u32 n_rows = out.n_rows;
const u32 n_cols = out.n_cols; const u32 n_cols = out.n_cols;
const u32 n_slices = out.n_slices; const u32 n_slices = out.n_slices;
for(u32 slice = 0; slice<n_slices; ++slice) for(u32 slice = 0; slice<n_slices; ++slice)
{ {
for(u32 col = 0; col<n_cols; ++col) for(u32 col = 0; col<n_cols; ++col)
{ {
arrayops::inplace_div( out.slice_colptr(slice,col), in.slice_colptr(s lice,col), n_rows ); arrayops::inplace_div( out.slice_colptr(slice,col), in.slice_colptr(s lice,col), n_rows );
skipping to change at line 999 skipping to change at line 999
} }
//! mat X += Y.subcube(...) //! mat X += Y.subcube(...)
template<typename eT> template<typename eT>
inline inline
void void
subview_cube<eT>::plus_inplace(Mat<eT>& out, const subview_cube<eT>& in) subview_cube<eT>::plus_inplace(Mat<eT>& out, const subview_cube<eT>& in)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_assert_same_size(out, in, "matrix addition"); arma_debug_assert_same_size(out, in, "addition");
const u32 in_n_rows = in.n_rows; const u32 in_n_rows = in.n_rows;
const u32 in_n_cols = in.n_cols; const u32 in_n_cols = in.n_cols;
const u32 in_aux_slice1 = in.aux_slice1; const u32 in_aux_slice1 = in.aux_slice1;
for(u32 col = 0; col < in_n_cols; ++col) for(u32 col = 0; col < in_n_cols; ++col)
{ {
arrayops::inplace_plus( out.colptr(col), in.slice_colptr(in_aux_slice1, col), in_n_rows ); arrayops::inplace_plus( out.colptr(col), in.slice_colptr(in_aux_slice1, col), in_n_rows );
} }
} }
//! mat X -= Y.subcube(...) //! mat X -= Y.subcube(...)
template<typename eT> template<typename eT>
inline inline
void void
subview_cube<eT>::minus_inplace(Mat<eT>& out, const subview_cube<eT>& in) subview_cube<eT>::minus_inplace(Mat<eT>& out, const subview_cube<eT>& in)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_assert_same_size(out, in, "matrix subtraction"); arma_debug_assert_same_size(out, in, "subtraction");
const u32 in_n_rows = in.n_rows; const u32 in_n_rows = in.n_rows;
const u32 in_n_cols = in.n_cols; const u32 in_n_cols = in.n_cols;
const u32 in_aux_slice1 = in.aux_slice1; const u32 in_aux_slice1 = in.aux_slice1;
for(u32 col = 0; col < in_n_cols; ++col) for(u32 col = 0; col < in_n_cols; ++col)
{ {
arrayops::inplace_minus( out.colptr(col), in.slice_colptr(in_aux_slice1 , col), in_n_rows ); arrayops::inplace_minus( out.colptr(col), in.slice_colptr(in_aux_slice1 , col), in_n_rows );
} }
} }
//! mat X %= Y.subcube(...) //! mat X %= Y.subcube(...)
template<typename eT> template<typename eT>
inline inline
void void
subview_cube<eT>::schur_inplace(Mat<eT>& out, const subview_cube<eT>& in) subview_cube<eT>::schur_inplace(Mat<eT>& out, const subview_cube<eT>& in)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_assert_same_size(out, in, "matrix schur product"); arma_debug_assert_same_size(out, in, "element-wise multiplication");
const u32 in_n_rows = in.n_rows; const u32 in_n_rows = in.n_rows;
const u32 in_n_cols = in.n_cols; const u32 in_n_cols = in.n_cols;
const u32 in_aux_slice1 = in.aux_slice1; const u32 in_aux_slice1 = in.aux_slice1;
for(u32 col = 0; col < in_n_cols; ++col) for(u32 col = 0; col < in_n_cols; ++col)
{ {
arrayops::inplace_mul( out.colptr(col), in.slice_colptr(in_aux_slice1, col), in_n_rows ); arrayops::inplace_mul( out.colptr(col), in.slice_colptr(in_aux_slice1, col), in_n_rows );
} }
} }
//! mat X /= Y.subcube(...) //! mat X /= Y.subcube(...)
template<typename eT> template<typename eT>
inline inline
void void
subview_cube<eT>::div_inplace(Mat<eT>& out, const subview_cube<eT>& in) subview_cube<eT>::div_inplace(Mat<eT>& out, const subview_cube<eT>& in)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_assert_same_size(out, in, "matrix element-wise division"); arma_debug_assert_same_size(out, in, "element-wise division");
const u32 in_n_rows = in.n_rows; const u32 in_n_rows = in.n_rows;
const u32 in_n_cols = in.n_cols; const u32 in_n_cols = in.n_cols;
const u32 in_aux_slice1 = in.aux_slice1; const u32 in_aux_slice1 = in.aux_slice1;
for(u32 col = 0; col < in_n_cols; ++col) for(u32 col = 0; col < in_n_cols; ++col)
{ {
arrayops::inplace_div( out.colptr(col), in.slice_colptr(in_aux_slice1, col), in_n_rows ); arrayops::inplace_div( out.colptr(col), in.slice_colptr(in_aux_slice1, col), in_n_rows );
} }
} }
 End of changes. 25 change blocks. 
25 lines changed or deleted 25 lines changed or added


 subview_meat.hpp   subview_meat.hpp 
skipping to change at line 198 skipping to change at line 198
for(u32 col=0; col<t_n_cols; ++col) for(u32 col=0; col<t_n_cols; ++col)
{ {
at(0,col) = x_mem[col]; at(0,col) = x_mem[col];
} }
} }
else else
{ {
for(u32 col=0; col<t_n_cols; ++col) for(u32 col=0; col<t_n_cols; ++col)
{ {
syslib::copy_elem( t.colptr(col), x.colptr(col), t_n_rows ); arrayops::copy( t.colptr(col), x.colptr(col), t_n_rows );
} }
} }
} }
else else
{ {
if(t_n_rows == 1) if(t_n_rows == 1)
{ {
for(u32 col=0; col<t_n_cols; ++col) for(u32 col=0; col<t_n_cols; ++col)
{ {
at(0,col) = P[col]; at(0,col) = P[col];
skipping to change at line 574 skipping to change at line 574
{ {
for(u32 col=0; col<t_n_cols; ++col) for(u32 col=0; col<t_n_cols; ++col)
{ {
t.at(0,col) = x.at(0,col); t.at(0,col) = x.at(0,col);
} }
} }
else else
{ {
for(u32 col=0; col<t_n_cols; ++col) for(u32 col=0; col<t_n_cols; ++col)
{ {
syslib::copy_elem( t.colptr(col), x.colptr(col), t_n_rows ); arrayops::copy( t.colptr(col), x.colptr(col), t_n_rows );
} }
} }
if(overlap) if(overlap)
{ {
delete tmp_subview; delete tmp_subview;
delete tmp_mat; delete tmp_mat;
} }
} }
skipping to change at line 971 skipping to change at line 971
arma_extra_debug_print(arma_boost::format("out.n_rows = %d out.n_cols = %d in.m.n_rows = %d in.m.n_cols = %d") % out.n_rows % out.n_cols % in. m.n_rows % in.m.n_cols ); arma_extra_debug_print(arma_boost::format("out.n_rows = %d out.n_cols = %d in.m.n_rows = %d in.m.n_cols = %d") % out.n_rows % out.n_cols % in. m.n_rows % in.m.n_cols );
if(in.is_vec() == true) if(in.is_vec() == true)
{ {
if(n_cols == 1) // a column vector if(n_cols == 1) // a column vector
{ {
arma_extra_debug_print("subview::extract(): copying col (going across rows)"); arma_extra_debug_print("subview::extract(): copying col (going across rows)");
// in.colptr(0) the first column of the subview, taking into account any row offset // in.colptr(0) the first column of the subview, taking into account any row offset
syslib::copy_elem( out.memptr(), in.colptr(0), n_rows ); arrayops::copy( out.memptr(), in.colptr(0), n_rows );
} }
else // a row vector else // a row vector
{ {
arma_extra_debug_print("subview::extract(): copying row (going across columns)"); arma_extra_debug_print("subview::extract(): copying row (going across columns)");
const Mat<eT>& X = in.m; const Mat<eT>& X = in.m;
eT* out_mem = out.memptr(); eT* out_mem = out.memptr();
const u32 row = in.aux_row1; const u32 row = in.aux_row1;
const u32 start_col = in.aux_col1; const u32 start_col = in.aux_col1;
skipping to change at line 995 skipping to change at line 995
out_mem[i] = X.at(row, i+start_col); out_mem[i] = X.at(row, i+start_col);
} }
} }
} }
else // general submatrix else // general submatrix
{ {
arma_extra_debug_print("subview::extract(): general submatrix"); arma_extra_debug_print("subview::extract(): general submatrix");
for(u32 col = 0; col<n_cols; ++col) for(u32 col = 0; col<n_cols; ++col)
{ {
syslib::copy_elem( out.colptr(col), in.colptr(col), n_rows ); arrayops::copy( out.colptr(col), in.colptr(col), n_rows );
} }
} }
if(alias) if(alias)
{ {
actual_out = out; actual_out = out;
delete tmp; delete tmp;
} }
} }
 End of changes. 4 change blocks. 
4 lines changed or deleted 4 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/