Cube_meat.hpp   Cube_meat.hpp 
skipping to change at line 1750 skipping to change at line 1750
Cube_aux::postfix_mm(*this); Cube_aux::postfix_mm(*this);
} }
//! returns true if all of the elements are finite //! returns true if all of the elements are finite
template<typename eT> template<typename eT>
arma_inline arma_inline
arma_warn_unused arma_warn_unused
bool bool
Cube<eT>::is_finite() const Cube<eT>::is_finite() const
{ {
for(u32 i=0; i<n_elem; ++i) return arrayops::is_finite( memptr(), n_elem );
{
if(arma_isfinite(mem[i]) == false)
{
return false;
}
}
return true;
} }
//! returns true if the cube has no elements //! returns true if the cube has no elements
template<typename eT> template<typename eT>
arma_inline arma_inline
arma_warn_unused arma_warn_unused
bool bool
Cube<eT>::is_empty() const Cube<eT>::is_empty() const
{ {
return (n_elem == 0); return (n_elem == 0);
 End of changes. 1 change blocks. 
9 lines changed or deleted 1 lines changed or added


 Mat_meat.hpp   Mat_meat.hpp 
skipping to change at line 1911 skipping to change at line 1911
// } // }
//! creation of diagview (diagonal) //! creation of diagview (diagonal)
template<typename eT> template<typename eT>
arma_inline arma_inline
diagview<eT> diagview<eT>
Mat<eT>::diag(const s32 in_id) Mat<eT>::diag(const s32 in_id)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
const u32 row_offset = (in_id < 0) ? -in_id : 0; const u32 row_offset = (in_id < 0) ? u32(-in_id) : 0;
const u32 col_offset = (in_id > 0) ? in_id : 0; const u32 col_offset = (in_id > 0) ? u32( in_id) : 0;
arma_debug_check arma_debug_check
( (
(row_offset >= n_rows) || (col_offset >= n_cols), (row_offset >= n_rows) || (col_offset >= n_cols),
"Mat::diag(): requested diagonal out of bounds" "Mat::diag(): requested diagonal out of bounds"
); );
const u32 len = (std::min)(n_rows - row_offset, n_cols - col_offset); const u32 len = (std::min)(n_rows - row_offset, n_cols - col_offset);
return diagview<eT>(*this, row_offset, col_offset, len); return diagview<eT>(*this, row_offset, col_offset, len);
skipping to change at line 3138 skipping to change at line 3138
return ( (n_rows == n_cols) && (n_elem > 0) ); return ( (n_rows == n_cols) && (n_elem > 0) );
} }
//! returns true if all of the elements are finite //! returns true if all of the elements are finite
template<typename eT> template<typename eT>
inline inline
arma_warn_unused arma_warn_unused
bool bool
Mat<eT>::is_finite() const Mat<eT>::is_finite() const
{ {
const u32 N = n_elem; return arrayops::is_finite( memptr(), n_elem );
const eT* ptr = memptr();
u32 i,j;
for(i=0, j=1; j<N; i+=2, j+=2)
{
const eT val_i = ptr[i];
const eT val_j = ptr[j];
if( (arma_isfinite(val_i) == false) || (arma_isfinite(val_j) == false)
)
{
return false;
}
}
if(i<N)
{
if(arma_isfinite(ptr[i]) == false)
{
return false;
}
}
return true;
} }
//! returns true if the given index is currently in range //! returns true if the given index is currently in range
template<typename eT> template<typename eT>
arma_inline arma_inline
arma_warn_unused arma_warn_unused
bool bool
Mat<eT>::in_range(const u32 i) const Mat<eT>::in_range(const u32 i) const
{ {
return (i < n_elem); return (i < n_elem);
 End of changes. 2 change blocks. 
28 lines changed or deleted 3 lines changed or added


 arma_ostream_meat.hpp   arma_ostream_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 132 skipping to change at line 132
o.unsetf(ios::fixed); o.unsetf(ios::fixed);
u32 cell_width; u32 cell_width;
o.precision(3); o.precision(3);
cell_width = 2 + 2*(1 + 3 + o.precision() + 5) + 1; cell_width = 2 + 2*(1 + 3 + o.precision() + 5) + 1;
return cell_width; return cell_width;
} }
template<typename eT>
inline
void
arma_ostream::print_elem_zero(std::ostream& o)
{
const std::streamsize orig_precision = o.precision();
o.precision(0);
o << eT(0);
o.precision(orig_precision);
}
//! Print an element to the specified stream //! Print an element to the specified stream
template<typename eT> template<typename eT>
arma_inline arma_inline
void void
arma_ostream::print_elem(std::ostream& o, const eT& x) arma_ostream::print_elem(std::ostream& o, const eT& x)
{ {
if(x != eT(0)) if(x != eT(0))
{ {
o << x; o << x;
} }
else else
{ {
const std::streamsize orig_precision = o.precision(); arma_ostream::print_elem_zero<eT>(o);
o.precision(0);
o << eT(0);
o.precision(orig_precision);
} }
} }
//! Print a complex element to the specified stream //! Print a complex element to the specified stream
//! EXPERIMENTAL !
template<typename T> template<typename T>
arma_inline inline
void void
arma_ostream::print_elem(std::ostream& o, const std::complex<T>& x) arma_ostream::print_elem(std::ostream& o, const std::complex<T>& x)
{ {
if( (x.real() != T(0)) || (x.imag() != T(0)) ) if( (x.real() != T(0)) || (x.imag() != T(0)) )
{ {
std::ostringstream ss; std::ostringstream ss;
ss.flags(o.flags()); ss.flags(o.flags());
//ss.imbue(o.getloc()); //ss.imbue(o.getloc());
ss.precision(o.precision()); ss.precision(o.precision());
skipping to change at line 187 skipping to change at line 194
//! Print a matrix to the specified stream //! Print a matrix to the specified stream
template<typename eT> template<typename eT>
inline inline
void void
arma_ostream::print(std::ostream& o, const Mat<eT>& m, const bool modify) arma_ostream::print(std::ostream& o, const Mat<eT>& m, const bool modify)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
const arma_ostream_state stream_state(o); const arma_ostream_state stream_state(o);
u32 cell_width; const u32 cell_width = modify ? arma_ostream::modify_stream(o, m.memptr() , m.n_elem) : o.width();
if(modify == true) const u32 m_n_rows = m.n_rows;
{ const u32 m_n_cols = m.n_cols;
cell_width = arma_ostream::modify_stream(o, m.memptr(), m.n_elem);
}
else
{
cell_width = o.width(); // copy the user's cell width
}
if(cell_width > 0) if(m_n_cols > 0)
{ {
for(u32 row=0; row < m.n_rows; ++row) if(cell_width > 0)
{ {
for(u32 col=0; col < m.n_cols; ++col) for(u32 row=0; row < m_n_rows; ++row)
{ {
// the cell width appears to be reset after each element is printed for(u32 col=0; col < m_n_cols; ++col)
, {
// hence we need to restore it // the cell width appears to be reset after each element is print
o.width(cell_width); ed,
arma_ostream::print_elem(o, m.at(row,col)); // hence we need to restore it
} o.width(cell_width);
arma_ostream::print_elem(o, m.at(row,col));
}
o << '\n'; o << '\n';
}
} }
} else
else
{
for(u32 row=0; row < m.n_rows; ++row)
{ {
for(u32 col=0; col < m.n_cols-1; ++col) for(u32 row=0; row < m_n_rows; ++row)
{ {
arma_ostream::print_elem(o, m.at(row,col)); for(u32 col=0; col < m_n_cols-1; ++col)
o << ' '; {
} arma_ostream::print_elem(o, m.at(row,col));
o << ' ';
}
arma_ostream::print_elem(o, m.at(row, m.n_cols-1)); arma_ostream::print_elem(o, m.at(row, m_n_cols-1));
o << '\n'; o << '\n';
}
} }
} }
o.flush(); o.flush();
stream_state.restore(o); stream_state.restore(o);
} }
//! Print a cube to the specified stream //! Print a cube to the specified stream
template<typename eT> template<typename eT>
inline inline
void void
arma_ostream::print(std::ostream& o, const Cube<eT>& x, const bool modify) arma_ostream::print(std::ostream& o, const Cube<eT>& x, const bool modify)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
const arma_ostream_state stream_state(o); const arma_ostream_state stream_state(o);
u32 cell_width; const u32 cell_width = modify ? arma_ostream::modify_stream(o, x.memptr()
, x.n_elem) : o.width();
if(modify == true)
{
cell_width = arma_ostream::modify_stream(o, x.memptr(), x.n_elem);
}
else
{
cell_width = o.width();
}
for(u32 slice=0; slice < x.n_slices; ++slice) for(u32 slice=0; slice < x.n_slices; ++slice)
{ {
o << "[cube slice " << slice << ']' << '\n'; o << "[cube slice " << slice << ']' << '\n';
o.width(cell_width); o.width(cell_width);
arma_ostream::print(o, x.slice(slice), false); arma_ostream::print(o, x.slice(slice), false);
o << '\n'; o << '\n';
} }
stream_state.restore(o); stream_state.restore(o);
skipping to change at line 277 skipping to change at line 272
inline inline
void void
arma_ostream::print(std::ostream& o, const field<oT>& x) arma_ostream::print(std::ostream& o, const field<oT>& x)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
const arma_ostream_state stream_state(o); const arma_ostream_state stream_state(o);
const std::streamsize cell_width = o.width(); const std::streamsize cell_width = o.width();
for(u32 col=0; col<x.n_cols; ++col) const u32 x_n_rows = x.n_rows;
const u32 x_n_cols = x.n_cols;
for(u32 col=0; col<x_n_cols; ++col)
{ {
o << "[field column " << col << ']' << '\n'; o << "[field column " << col << ']' << '\n';
for(u32 row=0; row<x.n_rows; ++row)
for(u32 row=0; row<x_n_rows; ++row)
{ {
o.width(cell_width); o.width(cell_width);
o << x.at(row,col) << '\n'; o << x.at(row,col) << '\n';
} }
o << '\n'; o << '\n';
} }
o.flush(); o.flush();
stream_state.restore(o); stream_state.restore(o);
skipping to change at line 306 skipping to change at line 305
inline inline
void void
arma_ostream::print(std::ostream& o, const subview_field<oT>& x) arma_ostream::print(std::ostream& o, const subview_field<oT>& x)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
const arma_ostream_state stream_state(o); const arma_ostream_state stream_state(o);
const std::streamsize cell_width = o.width(); const std::streamsize cell_width = o.width();
for(u32 col=0; col<x.n_cols; ++col) const u32 x_n_rows = x.n_rows;
const u32 x_n_cols = x.n_cols;
for(u32 col=0; col<x_n_cols; ++col)
{ {
o << "[subfield column " << col << ']' << '\n'; o << "[field column " << col << ']' << '\n';
for(u32 row=0; row<x.n_rows; ++row) for(u32 row=0; row<x_n_rows; ++row)
{ {
o.width(cell_width); o.width(cell_width);
o << x.at(row,col) << '\n'; o << x.at(row,col) << '\n';
} }
o << '\n'; o << '\n';
} }
o.flush(); o.flush();
stream_state.restore(o); stream_state.restore(o);
 End of changes. 21 change blocks. 
55 lines changed or deleted 58 lines changed or added


 arma_ostream_proto.hpp   arma_ostream_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)
skipping to change at line 39 skipping to change at line 39
inline void restore(std::ostream& o) const; inline void restore(std::ostream& o) const;
}; };
class arma_ostream class arma_ostream
{ {
public: public:
template<typename eT> inline static u32 modify_stream(std::ostream& o, co nst eT* data, const u32 n_elem); template<typename eT> inline static u32 modify_stream(std::ostream& o, co nst eT* data, const u32 n_elem);
template<typename T> inline static u32 modify_stream(std::ostream& o, co nst std::complex<T>* data, const u32 n_elem); template<typename T> inline static u32 modify_stream(std::ostream& o, co nst std::complex<T>* data, const u32 n_elem);
template<typename eT> inline static void print_elem_zero(std::ostream& o)
;
template<typename eT> arma_inline static void print_elem(std::ostream& o, const eT& x); template<typename eT> arma_inline static void print_elem(std::ostream& o, const eT& x);
template<typename T> arma_inline static void print_elem(std::ostream& o, const std::complex<T>& x); template<typename T> inline static void print_elem(std::ostream& o, const std::complex<T>& x);
template<typename eT> inline static void print(std::ostream& o, const Ma t<eT>& m, const bool modify); template<typename eT> inline static void print(std::ostream& o, const Ma t<eT>& m, const bool modify);
template<typename eT> inline static void print(std::ostream& o, const Cub e<eT>& m, const bool modify); template<typename eT> inline static void print(std::ostream& o, const Cub e<eT>& m, const bool modify);
template<typename oT> inline static void print(std::ostream& o, const fie ld<oT>& m); template<typename oT> inline static void print(std::ostream& o, const fie ld<oT>& m);
template<typename oT> inline static void print(std::ostream& o, const sub view_field<oT>& m); template<typename oT> inline static void print(std::ostream& o, const sub view_field<oT>& m);
}; };
//! @} //! @}
 End of changes. 3 change blocks. 
3 lines changed or deleted 6 lines changed or added


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


 armadillo   armadillo 
skipping to change at line 101 skipping to change at line 101
//! \namespace arma namespace for Armadillo classes and functions //! \namespace arma namespace for Armadillo classes and functions
namespace arma namespace arma
{ {
// preliminaries // preliminaries
#include "armadillo_bits/forward_proto.hpp" #include "armadillo_bits/forward_proto.hpp"
#include "armadillo_bits/arma_static_assert.hpp" #include "armadillo_bits/arma_static_assert.hpp"
#include "armadillo_bits/typedef.hpp" #include "armadillo_bits/typedef.hpp"
#include "armadillo_bits/format_wrap.hpp" #include "armadillo_bits/format_wrap.hpp"
#include "armadillo_bits/constants.hpp"
#include "armadillo_bits/arma_version.hpp" #include "armadillo_bits/arma_version.hpp"
#include "armadillo_bits/arma_config.hpp" #include "armadillo_bits/arma_config.hpp"
#include "armadillo_bits/traits.hpp" #include "armadillo_bits/traits.hpp"
#include "armadillo_bits/promote_type.hpp" #include "armadillo_bits/promote_type.hpp"
#include "armadillo_bits/upgrade_val.hpp" #include "armadillo_bits/upgrade_val.hpp"
#include "armadillo_bits/restrictors.hpp" #include "armadillo_bits/restrictors.hpp"
#include "armadillo_bits/access.hpp" #include "armadillo_bits/access.hpp"
#include "armadillo_bits/span.hpp" #include "armadillo_bits/span.hpp"
#include "armadillo_bits/constants.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/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"
 End of changes. 2 change blocks. 
1 lines changed or deleted 1 lines changed or added


 arrayops_meat.hpp   arrayops_meat.hpp 
skipping to change at line 397 skipping to change at line 397
val1 *= src[i]; val1 *= src[i];
} }
return val1 * val2; return val1 * val2;
} }
template<typename eT> template<typename eT>
arma_hot arma_hot
arma_pure arma_pure
inline inline
bool
arrayops::is_finite(const eT* src, const u32 n_elem)
{
u32 i,j;
for(i=0, j=1; j<n_elem; i+=2, j+=2)
{
const eT val_i = src[i];
const eT val_j = src[j];
if( (arma_isfinite(val_i) == false) || (arma_isfinite(val_j) == false)
)
{
return false;
}
}
if(i < n_elem)
{
if(arma_isfinite(src[i]) == false)
{
return false;
}
}
return true;
}
// TODO: this function is currently not used
template<typename eT>
arma_hot
arma_pure
inline
typename get_pod_type<eT>::result typename get_pod_type<eT>::result
arrayops::norm_1(const eT* src, const u32 n_elem) arrayops::norm_1(const eT* src, const u32 n_elem)
{ {
typedef typename get_pod_type<eT>::result T; typedef typename get_pod_type<eT>::result T;
T acc = T(0); T acc = T(0);
u32 i,j; u32 i,j;
for(i=0, j=1; j<n_elem; i+=2, j+=2) for(i=0, j=1; j<n_elem; i+=2, j+=2)
skipping to change at line 420 skipping to change at line 452
} }
if(i < n_elem) if(i < n_elem)
{ {
acc += std::abs(src[i]); acc += std::abs(src[i]);
} }
return acc; return acc;
} }
// TODO: this function is currently not used
template<typename eT> template<typename eT>
arma_hot arma_hot
arma_pure arma_pure
inline inline
eT eT
arrayops::norm_2(const eT* src, const u32 n_elem, const typename arma_not_c x<eT>::result* junk) arrayops::norm_2(const eT* src, const u32 n_elem, const typename arma_not_c x<eT>::result* junk)
{ {
arma_ignore(junk); arma_ignore(junk);
eT acc = eT(0); eT acc = eT(0);
skipping to change at line 452 skipping to change at line 485
if(i < n_elem) if(i < n_elem)
{ {
const eT tmp_i = src[i]; const eT tmp_i = src[i];
acc += tmp_i * tmp_i; acc += tmp_i * tmp_i;
} }
return std::sqrt(acc); return std::sqrt(acc);
} }
// TODO: this function is currently not used
template<typename T> template<typename T>
arma_hot arma_hot
arma_pure arma_pure
inline inline
T T
arrayops::norm_2(const std::complex<T>* src, const u32 n_elem) arrayops::norm_2(const std::complex<T>* src, const u32 n_elem)
{ {
T acc = T(0); T acc = T(0);
u32 i,j; u32 i,j;
skipping to change at line 482 skipping to change at line 516
if(i < n_elem) if(i < n_elem)
{ {
const T tmp_i = std::abs(src[i]); const T tmp_i = std::abs(src[i]);
acc += tmp_i * tmp_i; acc += tmp_i * tmp_i;
} }
return std::sqrt(acc); return std::sqrt(acc);
} }
// TODO: this function is currently not used
template<typename eT> template<typename eT>
arma_hot arma_hot
arma_pure arma_pure
inline inline
typename get_pod_type<eT>::result typename get_pod_type<eT>::result
arrayops::norm_k(const eT* src, const u32 n_elem, const int k) arrayops::norm_k(const eT* src, const u32 n_elem, const int k)
{ {
typedef typename get_pod_type<eT>::result T; typedef typename get_pod_type<eT>::result T;
T acc = T(0); T acc = T(0);
skipping to change at line 509 skipping to change at line 544
} }
if(i < n_elem) if(i < n_elem)
{ {
acc += std::pow(std::abs(src[i]), k); acc += std::pow(std::abs(src[i]), k);
} }
return std::pow(acc, T(1)/T(k)); return std::pow(acc, T(1)/T(k));
} }
// TODO: this function is currently not used
template<typename eT> template<typename eT>
arma_hot arma_hot
arma_pure arma_pure
inline inline
typename get_pod_type<eT>::result typename get_pod_type<eT>::result
arrayops::norm_max(const eT* src, const u32 n_elem) arrayops::norm_max(const eT* src, const u32 n_elem)
{ {
typedef typename get_pod_type<eT>::result T; typedef typename get_pod_type<eT>::result T;
T max_val = std::abs(src[0]); T max_val = std::abs(src[0]);
skipping to change at line 541 skipping to change at line 577
if(i < n_elem) if(i < n_elem)
{ {
const T tmp_i = std::abs(src[i]); const T tmp_i = std::abs(src[i]);
if(max_val < tmp_i) { max_val = tmp_i; } if(max_val < tmp_i) { max_val = tmp_i; }
} }
return max_val; return max_val;
} }
// TODO: this function is currently not used
template<typename eT> template<typename eT>
arma_hot arma_hot
arma_pure arma_pure
inline inline
typename get_pod_type<eT>::result typename get_pod_type<eT>::result
arrayops::norm_min(const eT* src, const u32 n_elem) arrayops::norm_min(const eT* src, const u32 n_elem)
{ {
typedef typename get_pod_type<eT>::result T; typedef typename get_pod_type<eT>::result T;
T min_val = std::abs(src[0]); T min_val = std::abs(src[0]);
 End of changes. 6 change blocks. 
0 lines changed or deleted 38 lines changed or added


 arrayops_proto.hpp   arrayops_proto.hpp 
skipping to change at line 112 skipping to change at line 112
eT eT
accumulate(const eT* src, const u32 n_elem); accumulate(const eT* src, const u32 n_elem);
template<typename eT> template<typename eT>
arma_hot arma_pure inline static arma_hot arma_pure inline static
eT eT
product(const eT* src, const u32 n_elem); product(const eT* src, const u32 n_elem);
template<typename eT> template<typename eT>
arma_hot arma_pure inline static arma_hot arma_pure inline static
bool
is_finite(const eT* src, const u32 n_elem);
template<typename eT>
arma_hot arma_pure inline static
typename get_pod_type<eT>::result typename get_pod_type<eT>::result
norm_1(const eT* src, const u32 n_elem); norm_1(const eT* src, const u32 n_elem);
template<typename eT> template<typename eT>
arma_hot arma_pure inline static arma_hot arma_pure inline static
eT eT
norm_2(const eT* src, const u32 n_elem, const typename arma_not_cx<eT>::r esult* junk = 0); norm_2(const eT* src, const u32 n_elem, const typename arma_not_cx<eT>::r esult* junk = 0);
template<typename T> template<typename T>
arma_hot arma_pure inline static arma_hot arma_pure inline static
 End of changes. 1 change blocks. 
0 lines changed or deleted 5 lines changed or added


 auxlib_meat.hpp   auxlib_meat.hpp 
skipping to change at line 853 skipping to change at line 853
const u32 n = ipiv1.n_elem; const u32 n = ipiv1.n_elem;
const u32 P_rows = U.n_rows; const u32 P_rows = U.n_rows;
podarray<blas_int> ipiv2(P_rows); podarray<blas_int> ipiv2(P_rows);
const blas_int* ipiv1_mem = ipiv1.memptr(); const blas_int* ipiv1_mem = ipiv1.memptr();
blas_int* ipiv2_mem = ipiv2.memptr(); blas_int* ipiv2_mem = ipiv2.memptr();
for(u32 i=0; i<P_rows; ++i) for(u32 i=0; i<P_rows; ++i)
{ {
ipiv2_mem[i] = i; ipiv2_mem[i] = blas_int(i);
} }
for(u32 i=0; i<n; ++i) for(u32 i=0; i<n; ++i)
{ {
const u32 k = ipiv1_mem[i]; const u32 k = u32(ipiv1_mem[i]);
if( ipiv2_mem[i] != ipiv2_mem[k] ) if( ipiv2_mem[i] != ipiv2_mem[k] )
{ {
std::swap( ipiv2_mem[i], ipiv2_mem[k] ); std::swap( ipiv2_mem[i], ipiv2_mem[k] );
} }
} }
P.zeros(P_rows, P_rows); P.zeros(P_rows, P_rows);
for(u32 row=0; row<P_rows; ++row) for(u32 row=0; row<P_rows; ++row)
{ {
P.at(row, ipiv2_mem[row]) = eT(1); P.at(row, u32(ipiv2_mem[row])) = eT(1);
} }
if(L.n_cols > U.n_rows) if(L.n_cols > U.n_rows)
{ {
L.shed_cols(U.n_rows, L.n_cols-1); L.shed_cols(U.n_rows, L.n_cols-1);
} }
if(U.n_rows > L.n_cols) if(U.n_rows > L.n_cols)
{ {
U.shed_rows(L.n_cols, U.n_rows-1); U.shed_rows(L.n_cols, U.n_rows-1);
skipping to change at line 904 skipping to change at line 904
const u32 n = ipiv1.n_elem; const u32 n = ipiv1.n_elem;
const u32 P_rows = U.n_rows; const u32 P_rows = U.n_rows;
podarray<blas_int> ipiv2(P_rows); podarray<blas_int> ipiv2(P_rows);
const blas_int* ipiv1_mem = ipiv1.memptr(); const blas_int* ipiv1_mem = ipiv1.memptr();
blas_int* ipiv2_mem = ipiv2.memptr(); blas_int* ipiv2_mem = ipiv2.memptr();
for(u32 i=0; i<P_rows; ++i) for(u32 i=0; i<P_rows; ++i)
{ {
ipiv2_mem[i] = i; ipiv2_mem[i] = blas_int(i);
} }
for(u32 i=0; i<n; ++i) for(u32 i=0; i<n; ++i)
{ {
const u32 k = ipiv1_mem[i]; const u32 k = u32(ipiv1_mem[i]);
if( ipiv2_mem[i] != ipiv2_mem[k] ) if( ipiv2_mem[i] != ipiv2_mem[k] )
{ {
std::swap( ipiv2_mem[i], ipiv2_mem[k] ); std::swap( ipiv2_mem[i], ipiv2_mem[k] );
L.swap_rows( u32(ipiv2_mem[i]), u32(ipiv2_mem[k]) ); L.swap_rows( u32(ipiv2_mem[i]), u32(ipiv2_mem[k]) );
} }
} }
if(L.n_cols > U.n_rows) if(L.n_cols > U.n_rows)
{ {
 End of changes. 5 change blocks. 
5 lines changed or deleted 5 lines changed or added


 constants.hpp   constants.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 constants //! \addtogroup constants
//! @{ //! @{
// the long lengths of the constants are for future support of "long double namespace priv
" {
// and any smart compiler that does high-precision computation at compile-t class Math_helper
ime {
public:
template<typename eT>
static
typename arma_float_only<eT>::result
nan(typename arma_float_only<eT>::result* junk = 0)
{
arma_ignore(junk);
if(std::numeric_limits<eT>::has_quiet_NaN == true)
{
return std::numeric_limits<eT>::quiet_NaN();
}
else
{
const eT a = eT(0);
const eT b = eT(0);
return a / b;
}
}
template<typename eT>
static
typename arma_cx_only<eT>::result
nan(typename arma_cx_only<eT>::result* junk = 0)
{
arma_ignore(junk);
typedef typename get_pod_type<eT>::result T;
return eT( Math_helper::nan<T>(), Math_helper::nan<T>() );
}
template<typename eT>
static
typename arma_integral_only<eT>::result
nan(typename arma_integral_only<eT>::result* junk = 0)
{
arma_ignore(junk);
return eT(0);
}
template<typename eT>
static
typename arma_float_only<eT>::result
inf(typename arma_float_only<eT>::result* junk = 0)
{
arma_ignore(junk);
if(std::numeric_limits<eT>::has_infinity == true)
{
return std::numeric_limits<eT>::infinity();
}
else
{
const eT a = eT(1);
const eT b = eT(0);
return a / b;
}
}
template<typename eT>
static
typename arma_cx_only<eT>::result
inf(typename arma_cx_only<eT>::result* junk = 0)
{
arma_ignore(junk);
typedef typename get_pod_type<eT>::result T;
return eT( Math_helper::inf<T>(), Math_helper::inf<T>() );
}
template<typename eT>
static
typename arma_integral_only<eT>::result
inf(typename arma_integral_only<eT>::result* junk = 0)
{
arma_ignore(junk);
return std::numeric_limits<eT>::max();
}
};
}
template<typename eT> template<typename eT>
class Math class Math
{ {
public: public:
// the long lengths of the constants are for future support of "long doub
le"
// and any smart compiler that does high-precision computation at compile
-time
//! ratio of any circle's circumference to its diameter //! ratio of any circle's circumference to its diameter
static const eT pi() { return eT(3.1415926535897932384626433832795 028841971693993751058209749445923078164062862089986280348253421170679); } static eT pi() { return eT(3.1415926535897932384626433832795028841 971693993751058209749445923078164062862089986280348253421170679); }
//! base of the natural logarithm //! base of the natural logarithm
static const eT e() { return eT(2.7182818284590452353602874713526 624977572470936999595749669676277240766303535475945713821785251664274); } static eT e() { return eT(2.7182818284590452353602874713526624977 572470936999595749669676277240766303535475945713821785251664274); }
//! Euler's constant, aka Euler-Mascheroni constant //! Euler's constant, aka Euler-Mascheroni constant
static const eT euler() { return eT(0.5772156649015328606065120900824 024310421593359399235988057672348848677267776646709369470632917467495); } static eT euler() { return eT(0.5772156649015328606065120900824024310 421593359399235988057672348848677267776646709369470632917467495); }
//! golden ratio //! golden ratio
static const eT gratio() { return eT(1.6180339887498948482045868343656 381177203091798057628621354486227052604628189024497072072041893911374); } static eT gratio() { return eT(1.6180339887498948482045868343656381177 203091798057628621354486227052604628189024497072072041893911374); }
//! square root of 2 //! square root of 2
static const eT sqrt2() { return eT(1.4142135623730950488016887242096 980785696718753769480731766797379907324784621070388503875343276415727); } static eT sqrt2() { return eT(1.4142135623730950488016887242096980785 696718753769480731766797379907324784621070388503875343276415727); }
//! the difference between 1 and the least value greater than 1 that is r epresentable //! the difference between 1 and the least value greater than 1 that is r epresentable
static const eT eps() { return std::numeric_limits<eT>::epsilon(); } static eT eps() { return std::numeric_limits<eT>::epsilon(); }
//! log of the minimum representable value //! log of the minimum representable value
static const eT log_min() { static const eT out = std::log(std::numeric _limits<eT>::min()); return out; } static eT log_min() { static const eT out = std::log(std::numeric_limit s<eT>::min()); return out; }
//! log of the maximum representable value //! log of the maximum representable value
static const eT log_max() { static const eT out = std::log(std::numeric static eT log_max() { static const eT out = std::log(std::numeric_limit
_limits<eT>::max()); return out; } s<eT>::max()); return out; }
//! "not a number"
static eT nan() { return priv::Math_helper::nan<eT>(); }
//! infinity
static eT inf() { return priv::Math_helper::inf<eT>(); }
}; };
//! Physical constants taken from NIST and WolframAlpha on 2009-06-23 //! Physical constants taken from NIST and WolframAlpha on 2009-06-23
//! http://physics.nist.gov/cuu/Constants //! http://physics.nist.gov/cuu/Constants
//! http://www.wolframalpha.com //! http://www.wolframalpha.com
//! See also http://en.wikipedia.org/wiki/Physical_constant //! See also http://en.wikipedia.org/wiki/Physical_constant
template<typename eT> template<typename eT>
class Phy class Phy
{ {
public: public:
//! atomic mass constant (in kg) //! atomic mass constant (in kg)
static const eT m_u() { return eT(1.660538782e-27); } static eT m_u() { return eT(1.660538782e-27); }
//! Avogadro constant //! Avogadro constant
static const eT N_A() { return eT(6.02214179e23); } static eT N_A() { return eT(6.02214179e23); }
//! Boltzmann constant (in joules per kelvin) //! Boltzmann constant (in joules per kelvin)
static const eT k() { return eT(1.3806504e-23); } static eT k() { return eT(1.3806504e-23); }
//! Boltzmann constant (in eV/K) //! Boltzmann constant (in eV/K)
static const eT k_evk() { return eT(8.617343e-5); } static eT k_evk() { return eT(8.617343e-5); }
//! Bohr radius (in meters) //! Bohr radius (in meters)
static const eT a_0() { return eT(0.52917720859e-10); } static eT a_0() { return eT(0.52917720859e-10); }
//! Bohr magneton //! Bohr magneton
static const eT mu_B() { return(927.400915e-26); } static eT mu_B() { return(927.400915e-26); }
//! characteristic impedance of vacuum (in ohms) //! characteristic impedance of vacuum (in ohms)
static const eT Z_0() { return eT(3.76730313461771e-2); } static eT Z_0() { return eT(3.76730313461771e-2); }
//! conductance quantum (in siemens) //! conductance quantum (in siemens)
static const eT G_0() { return eT(7.7480917004e-5); } static eT G_0() { return eT(7.7480917004e-5); }
//! Coulomb's constant (in meters per farad) //! Coulomb's constant (in meters per farad)
static const eT k_e() { return eT(8.9875517873681764e9); } static eT k_e() { return eT(8.9875517873681764e9); }
//! electric constant (in farads per meter) //! electric constant (in farads per meter)
static const eT eps_0() { return eT(8.85418781762039e-12); } static eT eps_0() { return eT(8.85418781762039e-12); }
//! electron mass (in kg) //! electron mass (in kg)
static const eT m_e() { return eT(9.10938215e-31); } static eT m_e() { return eT(9.10938215e-31); }
//! electron volt (in joules) //! electron volt (in joules)
static const eT eV() { return eT(1.602176487e-19); } static eT eV() { return eT(1.602176487e-19); }
//! elementary charge (in coulombs) //! elementary charge (in coulombs)
static const eT e() { return eT(1.602176487e-19); } static eT e() { return eT(1.602176487e-19); }
//! Faraday constant (in coulombs) //! Faraday constant (in coulombs)
static const eT F() { return eT(96485.3399); } static eT F() { return eT(96485.3399); }
//! fine-structure constant //! fine-structure constant
static const eT alpha() { return eT(7.2973525376e-3); } static eT alpha() { return eT(7.2973525376e-3); }
//! inverse fine-structure constant //! inverse fine-structure constant
static const eT alpha_inv() { return eT(137.035999679); } static eT alpha_inv() { return eT(137.035999679); }
//! Josephson constant //! Josephson constant
static const eT K_J() { return eT(483597.891e9); } static eT K_J() { return eT(483597.891e9); }
//! magnetic constant (in henries per meter) //! magnetic constant (in henries per meter)
static const eT mu_0() { return eT(1.25663706143592e-06); } static eT mu_0() { return eT(1.25663706143592e-06); }
//! magnetic flux quantum (in webers) //! magnetic flux quantum (in webers)
static const eT phi_0() { return eT(2.067833667e-15); } static eT phi_0() { return eT(2.067833667e-15); }
//! molar gas constant (in joules per mole kelvin) //! molar gas constant (in joules per mole kelvin)
static const eT R() { return eT(8.314472); } static eT R() { return eT(8.314472); }
//! Newtonian constant of gravitation (in newton square meters per kilogr am squared) //! Newtonian constant of gravitation (in newton square meters per kilogr am squared)
static const eT G() { return eT(6.67428e-11); } static eT G() { return eT(6.67428e-11); }
//! Planck constant (in joule seconds) //! Planck constant (in joule seconds)
static const eT h() { return eT(6.62606896e-34); } static eT h() { return eT(6.62606896e-34); }
//! Planck constant over 2 pi, aka reduced Planck constant (in joule seco nds) //! Planck constant over 2 pi, aka reduced Planck constant (in joule seco nds)
static const eT h_bar() { return eT(1.054571628e-34); } static eT h_bar() { return eT(1.054571628e-34); }
//! proton mass (in kg) //! proton mass (in kg)
static const eT m_p() { return eT(1.672621637e-27); } static eT m_p() { return eT(1.672621637e-27); }
//! Rydberg constant (in reciprocal meters) //! Rydberg constant (in reciprocal meters)
static const eT R_inf() { return eT(10973731.568527); } static eT R_inf() { return eT(10973731.568527); }
//! speed of light in vacuum (in meters per second) //! speed of light in vacuum (in meters per second)
static const eT c_0() { return eT(299792458.0); } static eT c_0() { return eT(299792458.0); }
//! Stefan-Boltzmann constant //! Stefan-Boltzmann constant
static const eT sigma() { return eT(5.670400e-8); } static eT sigma() { return eT(5.670400e-8); }
//! von Klitzing constant (in ohms) //! von Klitzing constant (in ohms)
static const eT R_k() { return eT(25812.807557); } static eT R_k() { return eT(25812.807557); }
//! Wien wavelength displacement law constant //! Wien wavelength displacement law constant
static const eT b() { return eT(2.8977685e-3); } static eT b() { return eT(2.8977685e-3); }
}; };
typedef Math<float> fmath; typedef Math<float> fmath;
typedef Math<double> math; typedef Math<double> math;
typedef Phy<float> fphy; typedef Phy<float> fphy;
typedef Phy<double> phy; typedef Phy<double> phy;
namespace priv
{
template<typename eT>
static
arma_inline
arma_hot
typename arma_float_only<eT>::result
most_neg(typename arma_float_only<eT>::result* junk = 0)
{
arma_ignore(junk);
if(std::numeric_limits<eT>::has_infinity == true)
{
return -(std::numeric_limits<eT>::infinity());
}
else
{
const eT a = eT(1);
const eT b = eT(0);
return -(a / b);
}
}
template<typename eT>
static
arma_inline
arma_hot
typename arma_integral_only<eT>::result
most_neg(typename arma_integral_only<eT>::result* junk = 0)
{
arma_ignore(junk);
return std::numeric_limits<eT>::min();
}
template<typename eT>
static
arma_inline
arma_hot
typename arma_float_only<eT>::result
most_pos(typename arma_float_only<eT>::result* junk = 0)
{
arma_ignore(junk);
if(std::numeric_limits<eT>::has_infinity == true)
{
return std::numeric_limits<eT>::infinity();
}
else
{
const eT a = eT(1);
const eT b = eT(0);
return a / b;
}
}
template<typename eT>
static
arma_inline
arma_hot
typename arma_integral_only<eT>::result
most_pos(typename arma_integral_only<eT>::result* junk = 0)
{
arma_ignore(junk);
return std::numeric_limits<eT>::max();
}
}
//! @} //! @}
 End of changes. 41 change blocks. 
44 lines changed or deleted 216 lines changed or added


 diskio_meat.hpp   diskio_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-2010 Ian Cullinan // Copyright (C) 2009-2010 Ian Cullinan
// //
// 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 322 skipping to change at line 322
const u32 N = ( (pos1 >= 0) && (pos2 >= 0) ) ? u32(pos2 - pos1) : 0; const u32 N = ( (pos1 >= 0) && (pos2 >= 0) ) ? u32(pos2 - pos1) : 0;
f.clear(); f.clear();
f.seekg(pos1); f.seekg(pos1);
podarray<unsigned char> data(N); podarray<unsigned char> data(N);
unsigned char* ptr = data.memptr(); unsigned char* ptr = data.memptr();
f.clear(); f.clear();
f.read(reinterpret_cast<char*>(ptr), N); f.read( reinterpret_cast<char*>(ptr), std::streamsize(N) );
bool has_non_text_val = false; bool has_non_text_val = false;
if(f.good() == true) if(f.good() == true)
{ {
for(u32 i=0; i<N; ++i) for(u32 i=0; i<N; ++i)
{ {
const unsigned char val = ptr[i]; const unsigned char val = ptr[i];
// the range checking can be made more elaborate // the range checking can be made more elaborate
skipping to change at line 585 skipping to change at line 585
return save_okay; return save_okay;
} }
template<typename eT> template<typename eT>
inline inline
bool bool
diskio::save_raw_binary(const Mat<eT>& x, std::ostream& f) diskio::save_raw_binary(const Mat<eT>& x, std::ostream& f)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
f.write(reinterpret_cast<const char*>(x.mem), x.n_elem*sizeof(eT)); f.write( reinterpret_cast<const char*>(x.mem), std::streamsize(x.n_elem*s izeof(eT)) );
return f.good(); return f.good();
} }
//! Save a matrix in text format (human readable), //! Save a matrix in text format (human readable),
//! with a header that indicates the matrix type as well as its dimensions //! with a header that indicates the matrix type as well as its dimensions
template<typename eT> template<typename eT>
inline inline
bool bool
diskio::save_arma_ascii(const Mat<eT>& x, const std::string& final_name) diskio::save_arma_ascii(const Mat<eT>& x, const std::string& final_name)
skipping to change at line 713 skipping to change at line 713
template<typename eT> template<typename eT>
inline inline
bool bool
diskio::save_arma_binary(const Mat<eT>& x, std::ostream& f) diskio::save_arma_binary(const Mat<eT>& x, std::ostream& f)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
f << diskio::gen_bin_header(x) << '\n'; f << diskio::gen_bin_header(x) << '\n';
f << x.n_rows << ' ' << x.n_cols << '\n'; f << x.n_rows << ' ' << x.n_cols << '\n';
f.write(reinterpret_cast<const char*>(x.mem), x.n_elem*sizeof(eT)); f.write( reinterpret_cast<const char*>(x.mem), std::streamsize(x.n_elem*s izeof(eT)) );
return f.good(); return f.good();
} }
//! Save a matrix as a PGM greyscale image //! Save a matrix as a PGM greyscale image
template<typename eT> template<typename eT>
inline inline
bool bool
diskio::save_pgm_binary(const Mat<eT>& x, const std::string& final_name) diskio::save_pgm_binary(const Mat<eT>& x, const std::string& final_name)
{ {
skipping to change at line 779 skipping to change at line 779
for(u32 row=0; row < x.n_rows; ++row) for(u32 row=0; row < x.n_rows; ++row)
{ {
for(u32 col=0; col < x.n_cols; ++col) for(u32 col=0; col < x.n_cols; ++col)
{ {
tmp[i] = u8( x.at(row,col) ); // TODO: add round() ? tmp[i] = u8( x.at(row,col) ); // TODO: add round() ?
++i; ++i;
} }
} }
f.write(reinterpret_cast<const char*>(tmp.mem), n_elem); f.write(reinterpret_cast<const char*>(tmp.mem), std::streamsize(n_elem) ) ;
return f.good(); return f.good();
} }
//! Save a matrix as a PGM greyscale image //! Save a matrix as a PGM greyscale image
template<typename T> template<typename T>
inline inline
bool bool
diskio::save_pgm_binary(const Mat< std::complex<T> >& x, const std::string& final_name) diskio::save_pgm_binary(const Mat< std::complex<T> >& x, const std::string& final_name)
{ {
skipping to change at line 968 skipping to change at line 968
const u32 N = ( (pos1 >= 0) && (pos2 >= 0) ) ? u32(pos2 - pos1) : 0; const u32 N = ( (pos1 >= 0) && (pos2 >= 0) ) ? u32(pos2 - pos1) : 0;
f.clear(); f.clear();
//f.seekg(0, ios::beg); //f.seekg(0, ios::beg);
f.seekg(pos1); f.seekg(pos1);
x.set_size(N / sizeof(eT), 1); x.set_size(N / sizeof(eT), 1);
f.clear(); f.clear();
f.read( reinterpret_cast<char *>(x.memptr()), N); f.read( reinterpret_cast<char *>(x.memptr()), std::streamsize(N) );
return f.good(); return f.good();
} }
//! Load a matrix in text format (human readable), //! Load a matrix in text format (human readable),
//! with a header that indicates the matrix type as well as its dimensions //! with a header that indicates the matrix type as well as its dimensions
template<typename eT> template<typename eT>
inline inline
bool bool
diskio::load_arma_ascii(Mat<eT>& x, const std::string& name, std::string& e rr_msg) diskio::load_arma_ascii(Mat<eT>& x, const std::string& name, std::string& e rr_msg)
skipping to change at line 1083 skipping to change at line 1083
f >> f_header; f >> f_header;
f >> f_n_rows; f >> f_n_rows;
f >> f_n_cols; f >> f_n_cols;
if(f_header == diskio::gen_bin_header(x)) if(f_header == diskio::gen_bin_header(x))
{ {
//f.seekg(1, ios::cur); // NOTE: this may not be portable, as on a Win dows machine a newline could be two characters //f.seekg(1, ios::cur); // NOTE: this may not be portable, as on a Win dows machine a newline could be two characters
f.get(); f.get();
x.set_size(f_n_rows,f_n_cols); x.set_size(f_n_rows,f_n_cols);
f.read( reinterpret_cast<char *>(x.memptr()), x.n_elem*sizeof(eT)); f.read( reinterpret_cast<char *>(x.memptr()), std::streamsize(x.n_elem* sizeof(eT)) );
load_okay = f.good(); load_okay = f.good();
} }
else else
{ {
load_okay = false; load_okay = false;
err_msg = "incorrect header in "; err_msg = "incorrect header in ";
} }
return load_okay; return load_okay;
skipping to change at line 1176 skipping to change at line 1176
if( (f_maxval > 0) || (f_maxval <= 65535) ) if( (f_maxval > 0) || (f_maxval <= 65535) )
{ {
x.set_size(f_n_rows,f_n_cols); x.set_size(f_n_rows,f_n_cols);
if(f_maxval <= 255) if(f_maxval <= 255)
{ {
const u32 n_elem = f_n_cols*f_n_rows; const u32 n_elem = f_n_cols*f_n_rows;
podarray<u8> tmp(n_elem); podarray<u8> tmp(n_elem);
f.read( reinterpret_cast<char*>(tmp.memptr()), n_elem); f.read( reinterpret_cast<char*>(tmp.memptr()), std::streamsize(n_el em) );
u32 i = 0; u32 i = 0;
//cout << "f_n_cols = " << f_n_cols << endl; //cout << "f_n_cols = " << f_n_cols << endl;
//cout << "f_n_rows = " << f_n_rows << endl; //cout << "f_n_rows = " << f_n_rows << endl;
for(u32 row=0; row < f_n_rows; ++row) for(u32 row=0; row < f_n_rows; ++row)
{ {
for(u32 col=0; col < f_n_cols; ++col) for(u32 col=0; col < f_n_cols; ++col)
{ {
skipping to change at line 1198 skipping to change at line 1198
++i; ++i;
} }
} }
} }
else else
{ {
const u32 n_elem = f_n_cols*f_n_rows; const u32 n_elem = f_n_cols*f_n_rows;
podarray<u16> tmp(n_elem); podarray<u16> tmp(n_elem);
f.read( reinterpret_cast<char *>(tmp.memptr()), n_elem*2); f.read( reinterpret_cast<char *>(tmp.memptr()), std::streamsize(n_e lem*2) );
u32 i = 0; u32 i = 0;
for(u32 row=0; row < f_n_rows; ++row) for(u32 row=0; row < f_n_rows; ++row)
{ {
for(u32 col=0; col < f_n_cols; ++col) for(u32 col=0; col < f_n_cols; ++col)
{ {
x.at(row,col) = eT(tmp[i]); x.at(row,col) = eT(tmp[i]);
++i; ++i;
} }
skipping to change at line 1304 skipping to change at line 1304
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
static const std::string ARMA_MAT_TXT = "ARMA_MAT_TXT"; static const std::string ARMA_MAT_TXT = "ARMA_MAT_TXT";
static const std::string ARMA_MAT_BIN = "ARMA_MAT_BIN"; static const std::string ARMA_MAT_BIN = "ARMA_MAT_BIN";
static const std::string P5 = "P5"; static const std::string P5 = "P5";
podarray<char> raw_header(ARMA_MAT_TXT.length() + 1); podarray<char> raw_header(ARMA_MAT_TXT.length() + 1);
std::streampos pos = f.tellg(); std::streampos pos = f.tellg();
f.read(raw_header.memptr(), ARMA_MAT_TXT.length()); f.read( raw_header.memptr(), std::streamsize(ARMA_MAT_TXT.length()) );
raw_header[ARMA_MAT_TXT.length()] = '\0'; raw_header[ARMA_MAT_TXT.length()] = '\0';
f.clear(); f.clear();
f.seekg(pos); f.seekg(pos);
const std::string header = raw_header.mem; const std::string header = raw_header.mem;
if(ARMA_MAT_TXT == header.substr(0,ARMA_MAT_TXT.length())) if(ARMA_MAT_TXT == header.substr(0,ARMA_MAT_TXT.length()))
{ {
return load_arma_ascii(x, f, err_msg); return load_arma_ascii(x, f, err_msg);
skipping to change at line 1450 skipping to change at line 1450
return save_okay; return save_okay;
} }
template<typename eT> template<typename eT>
inline inline
bool bool
diskio::save_raw_binary(const Cube<eT>& x, std::ostream& f) diskio::save_raw_binary(const Cube<eT>& x, std::ostream& f)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
f.write(reinterpret_cast<const char*>(x.mem), x.n_elem*sizeof(eT)); f.write( reinterpret_cast<const char*>(x.mem), std::streamsize(x.n_elem*s izeof(eT)) );
return f.good(); return f.good();
} }
//! Save a cube in text format (human readable), //! Save a cube in text format (human readable),
//! with a header that indicates the cube type as well as its dimensions //! with a header that indicates the cube type as well as its dimensions
template<typename eT> template<typename eT>
inline inline
bool bool
diskio::save_arma_ascii(const Cube<eT>& x, const std::string& final_name) diskio::save_arma_ascii(const Cube<eT>& x, const std::string& final_name)
skipping to change at line 1581 skipping to change at line 1581
template<typename eT> template<typename eT>
inline inline
bool bool
diskio::save_arma_binary(const Cube<eT>& x, std::ostream& f) diskio::save_arma_binary(const Cube<eT>& x, std::ostream& f)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
f << diskio::gen_bin_header(x) << '\n'; f << diskio::gen_bin_header(x) << '\n';
f << x.n_rows << ' ' << x.n_cols << ' ' << x.n_slices << '\n'; f << x.n_rows << ' ' << x.n_cols << ' ' << x.n_slices << '\n';
f.write(reinterpret_cast<const char*>(x.mem), x.n_elem*sizeof(eT)); f.write( reinterpret_cast<const char*>(x.mem), std::streamsize(x.n_elem*s izeof(eT)) );
return f.good(); return f.good();
} }
//! Load a cube as raw text (no header, human readable). //! Load a cube as raw text (no header, human readable).
//! NOTE: this is much slower than reading a file with a header. //! NOTE: this is much slower than reading a file with a header.
template<typename eT> template<typename eT>
inline inline
bool bool
diskio::load_raw_ascii(Cube<eT>& x, const std::string& name, std::string& e rr_msg) diskio::load_raw_ascii(Cube<eT>& x, const std::string& name, std::string& e rr_msg)
skipping to change at line 1687 skipping to change at line 1687
const u32 N = ( (pos1 >= 0) && (pos2 >= 0) ) ? u32(pos2 - pos1) : 0; const u32 N = ( (pos1 >= 0) && (pos2 >= 0) ) ? u32(pos2 - pos1) : 0;
f.clear(); f.clear();
//f.seekg(0, ios::beg); //f.seekg(0, ios::beg);
f.seekg(pos1); f.seekg(pos1);
x.set_size(N / sizeof(eT), 1, 1); x.set_size(N / sizeof(eT), 1, 1);
f.clear(); f.clear();
f.read( reinterpret_cast<char *>(x.memptr()), N); f.read( reinterpret_cast<char *>(x.memptr()), std::streamsize(N) );
return f.good(); return f.good();
} }
//! Load a cube in text format (human readable), //! Load a cube in text format (human readable),
//! with a header that indicates the cube type as well as its dimensions //! with a header that indicates the cube type as well as its dimensions
template<typename eT> template<typename eT>
inline inline
bool bool
diskio::load_arma_ascii(Cube<eT>& x, const std::string& name, std::string& err_msg) diskio::load_arma_ascii(Cube<eT>& x, const std::string& name, std::string& err_msg)
skipping to change at line 1809 skipping to change at line 1809
f >> f_n_rows; f >> f_n_rows;
f >> f_n_cols; f >> f_n_cols;
f >> f_n_slices; f >> f_n_slices;
if(f_header == diskio::gen_bin_header(x)) if(f_header == diskio::gen_bin_header(x))
{ {
//f.seekg(1, ios::cur); // NOTE: this may not be portable, as on a Win dows machine a newline could be two characters //f.seekg(1, ios::cur); // NOTE: this may not be portable, as on a Win dows machine a newline could be two characters
f.get(); f.get();
x.set_size(f_n_rows, f_n_cols, f_n_slices); x.set_size(f_n_rows, f_n_cols, f_n_slices);
f.read( reinterpret_cast<char *>(x.memptr()), x.n_elem*sizeof(eT)); f.read( reinterpret_cast<char *>(x.memptr()), std::streamsize(x.n_elem* sizeof(eT)) );
load_okay = f.good(); load_okay = f.good();
} }
else else
{ {
load_okay = false; load_okay = false;
err_msg = "incorrect header in "; err_msg = "incorrect header in ";
} }
return load_okay; return load_okay;
skipping to change at line 1860 skipping to change at line 1860
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
static const std::string ARMA_CUB_TXT = "ARMA_CUB_TXT"; static const std::string ARMA_CUB_TXT = "ARMA_CUB_TXT";
static const std::string ARMA_CUB_BIN = "ARMA_CUB_BIN"; static const std::string ARMA_CUB_BIN = "ARMA_CUB_BIN";
static const std::string P6 = "P6"; static const std::string P6 = "P6";
podarray<char> raw_header(ARMA_CUB_TXT.length() + 1); podarray<char> raw_header(ARMA_CUB_TXT.length() + 1);
std::streampos pos = f.tellg(); std::streampos pos = f.tellg();
f.read(raw_header.memptr(), ARMA_CUB_TXT.length()); f.read( raw_header.memptr(), std::streamsize(ARMA_CUB_TXT.length()) );
raw_header[ARMA_CUB_TXT.length()] = '\0'; raw_header[ARMA_CUB_TXT.length()] = '\0';
f.clear(); f.clear();
f.seekg(pos); f.seekg(pos);
const std::string header = raw_header.mem; const std::string header = raw_header.mem;
if(ARMA_CUB_TXT == header.substr(0, ARMA_CUB_TXT.length())) if(ARMA_CUB_TXT == header.substr(0, ARMA_CUB_TXT.length()))
{ {
return load_arma_ascii(x, f, err_msg); return load_arma_ascii(x, f, err_msg);
skipping to change at line 2202 skipping to change at line 2202
arma_type_check<is_Mat<T1>::value == false>::apply(); arma_type_check<is_Mat<T1>::value == false>::apply();
static const std::string ARMA_FLD_BIN = "ARMA_FLD_BIN"; static const std::string ARMA_FLD_BIN = "ARMA_FLD_BIN";
static const std::string P6 = "P6"; static const std::string P6 = "P6";
podarray<char> raw_header(ARMA_FLD_BIN.length() + 1); podarray<char> raw_header(ARMA_FLD_BIN.length() + 1);
std::streampos pos = f.tellg(); std::streampos pos = f.tellg();
f.read(raw_header.memptr(), ARMA_FLD_BIN.length()); f.read( raw_header.memptr(), std::streamsize(ARMA_FLD_BIN.length()) );
f.clear(); f.clear();
f.seekg(pos); f.seekg(pos);
raw_header[ARMA_FLD_BIN.length()] = '\0'; raw_header[ARMA_FLD_BIN.length()] = '\0';
const std::string header = raw_header.mem; const std::string header = raw_header.mem;
if(ARMA_FLD_BIN == header.substr(0, ARMA_FLD_BIN.length())) if(ARMA_FLD_BIN == header.substr(0, ARMA_FLD_BIN.length()))
{ {
skipping to change at line 2289 skipping to change at line 2289
if( (f_maxval > 0) || (f_maxval <= 65535) ) if( (f_maxval > 0) || (f_maxval <= 65535) )
{ {
x.set_size(f_n_rows, f_n_cols, 3); x.set_size(f_n_rows, f_n_cols, 3);
if(f_maxval <= 255) if(f_maxval <= 255)
{ {
const u32 n_elem = 3*f_n_cols*f_n_rows; const u32 n_elem = 3*f_n_cols*f_n_rows;
podarray<u8> tmp(n_elem); podarray<u8> tmp(n_elem);
f.read( reinterpret_cast<char*>(tmp.memptr()), n_elem); f.read( reinterpret_cast<char*>(tmp.memptr()), std::streamsize(n_el em) );
u32 i = 0; u32 i = 0;
//cout << "f_n_cols = " << f_n_cols << endl; //cout << "f_n_cols = " << f_n_cols << endl;
//cout << "f_n_rows = " << f_n_rows << endl; //cout << "f_n_rows = " << f_n_rows << endl;
for(u32 row=0; row < f_n_rows; ++row) for(u32 row=0; row < f_n_rows; ++row)
{ {
for(u32 col=0; col < f_n_cols; ++col) for(u32 col=0; col < f_n_cols; ++col)
{ {
skipping to change at line 2313 skipping to change at line 2313
i+=3; i+=3;
} }
} }
} }
else else
{ {
const u32 n_elem = 3*f_n_cols*f_n_rows; const u32 n_elem = 3*f_n_cols*f_n_rows;
podarray<u16> tmp(n_elem); podarray<u16> tmp(n_elem);
f.read( reinterpret_cast<char *>(tmp.memptr()), 2*n_elem); f.read( reinterpret_cast<char *>(tmp.memptr()), std::streamsize(2*n _elem) );
u32 i = 0; u32 i = 0;
for(u32 row=0; row < f_n_rows; ++row) for(u32 row=0; row < f_n_rows; ++row)
{ {
for(u32 col=0; col < f_n_cols; ++col) for(u32 col=0; col < f_n_cols; ++col)
{ {
x.at(row,col,0) = eT(tmp[i+0]); x.at(row,col,0) = eT(tmp[i+0]);
x.at(row,col,1) = eT(tmp[i+1]); x.at(row,col,1) = eT(tmp[i+1]);
x.at(row,col,2) = eT(tmp[i+2]); x.at(row,col,2) = eT(tmp[i+2]);
skipping to change at line 2412 skipping to change at line 2412
i+=3; i+=3;
} }
} }
f << "P6" << '\n'; f << "P6" << '\n';
f << x.n_cols << '\n'; f << x.n_cols << '\n';
f << x.n_rows << '\n'; f << x.n_rows << '\n';
f << 255 << '\n'; f << 255 << '\n';
f.write(reinterpret_cast<const char*>(tmp.mem), n_elem); f.write( reinterpret_cast<const char*>(tmp.mem), std::streamsize(n_elem) );
return f.good(); return f.good();
} }
// //
// handling of PPM images by fields // handling of PPM images by fields
template<typename T1> template<typename T1>
inline inline
bool bool
skipping to change at line 2489 skipping to change at line 2489
R.set_size(f_n_rows,f_n_cols); R.set_size(f_n_rows,f_n_cols);
G.set_size(f_n_rows,f_n_cols); G.set_size(f_n_rows,f_n_cols);
B.set_size(f_n_rows,f_n_cols); B.set_size(f_n_rows,f_n_cols);
if(f_maxval <= 255) if(f_maxval <= 255)
{ {
const u32 n_elem = 3*f_n_cols*f_n_rows; const u32 n_elem = 3*f_n_cols*f_n_rows;
podarray<u8> tmp(n_elem); podarray<u8> tmp(n_elem);
f.read( reinterpret_cast<char*>(tmp.memptr()), n_elem); f.read( reinterpret_cast<char*>(tmp.memptr()), std::streamsize(n_el em) );
u32 i = 0; u32 i = 0;
//cout << "f_n_cols = " << f_n_cols << endl; //cout << "f_n_cols = " << f_n_cols << endl;
//cout << "f_n_rows = " << f_n_rows << endl; //cout << "f_n_rows = " << f_n_rows << endl;
for(u32 row=0; row < f_n_rows; ++row) for(u32 row=0; row < f_n_rows; ++row)
{ {
for(u32 col=0; col < f_n_cols; ++col) for(u32 col=0; col < f_n_cols; ++col)
{ {
skipping to change at line 2513 skipping to change at line 2513
i+=3; i+=3;
} }
} }
} }
else else
{ {
const u32 n_elem = 3*f_n_cols*f_n_rows; const u32 n_elem = 3*f_n_cols*f_n_rows;
podarray<u16> tmp(n_elem); podarray<u16> tmp(n_elem);
f.read( reinterpret_cast<char *>(tmp.memptr()), 2*n_elem); f.read( reinterpret_cast<char *>(tmp.memptr()), std::streamsize(2*n _elem) );
u32 i = 0; u32 i = 0;
for(u32 row=0; row < f_n_rows; ++row) for(u32 row=0; row < f_n_rows; ++row)
{ {
for(u32 col=0; col < f_n_cols; ++col) for(u32 col=0; col < f_n_cols; ++col)
{ {
R.at(row,col) = eT(tmp[i+0]); R.at(row,col) = eT(tmp[i+0]);
G.at(row,col) = eT(tmp[i+1]); G.at(row,col) = eT(tmp[i+1]);
B.at(row,col) = eT(tmp[i+2]); B.at(row,col) = eT(tmp[i+2]);
skipping to change at line 2631 skipping to change at line 2631
for(u32 col=0; col < R.n_cols; ++col) for(u32 col=0; col < R.n_cols; ++col)
{ {
tmp[i+0] = u8( access::tmp_real( R.at(row,col) ) ); tmp[i+0] = u8( access::tmp_real( R.at(row,col) ) );
tmp[i+1] = u8( access::tmp_real( G.at(row,col) ) ); tmp[i+1] = u8( access::tmp_real( G.at(row,col) ) );
tmp[i+2] = u8( access::tmp_real( B.at(row,col) ) ); tmp[i+2] = u8( access::tmp_real( B.at(row,col) ) );
i+=3; i+=3;
} }
} }
f.write(reinterpret_cast<const char*>(tmp.mem), n_elem); f.write( reinterpret_cast<const char*>(tmp.mem), std::streamsize(n_elem) );
return f.good(); return f.good();
} }
//! @} //! @}
 End of changes. 22 change blocks. 
23 lines changed or deleted 23 lines changed or added


 eglue_core_meat.hpp   eglue_core_meat.hpp 
// Copyright (C) 2010 NICTA (www.nicta.com.au) // Copyright (C) 2010-2011 NICTA (www.nicta.com.au)
// Copyright (C) 2010 Conrad Sanderson // Copyright (C) 2010-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 44 skipping to change at line 44
inline static const char* text() { return "element-wise division"; } inline static const char* text() { return "element-wise division"; }
}; };
class eglue_schur : public eglue_core<eglue_schur> class eglue_schur : public eglue_core<eglue_schur>
{ {
public: public:
inline static const char* text() { return "element-wise multiplication"; } inline static const char* text() { return "element-wise multiplication"; }
}; };
#undef arma_applier
#undef operatorA
#undef operatorB
#define arma_applier(operatorA, operatorB) \
{\
u32 i,j;\
\
for(i=0, j=1; j<n_elem; i+=2, j+=2)\
{\
eT tmp_i = P1[i];\
eT tmp_j = P1[j];\
\
tmp_i operatorB##= P2[i];\
tmp_j operatorB##= P2[j];\
\
out_mem[i] operatorA tmp_i;\
out_mem[j] operatorA tmp_j;\
}\
\
if(i < n_elem)\
{\
out_mem[i] operatorA P1[i] operatorB P2[i];\
}\
}
// //
// matrices // matrices
template<typename eglue_type> template<typename eglue_type>
template<typename T1, typename T2> template<typename T1, typename T2>
arma_hot arma_hot
inline inline
void void
eglue_core<eglue_type>::apply(Mat<typename T1::elem_type>& out, const eGlue <T1, T2, eglue_type>& x) eglue_core<eglue_type>::apply(Mat<typename T1::elem_type>& out, const eGlue <T1, T2, eglue_type>& x)
{ {
skipping to change at line 68 skipping to change at line 94
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
typedef typename Proxy<T1>::ea_type ea_type1; typedef typename Proxy<T1>::ea_type ea_type1;
typedef typename Proxy<T2>::ea_type ea_type2; typedef typename Proxy<T2>::ea_type ea_type2;
ea_type1 P1 = x.P1.get_ea(); ea_type1 P1 = x.P1.get_ea();
ea_type2 P2 = x.P2.get_ea(); ea_type2 P2 = x.P2.get_ea();
eT* out_mem = out.memptr(); eT* out_mem = out.memptr();
const u32 n_elem = out.n_elem; const u32 n_elem = out.n_elem;
#undef arma_applier if(is_same_type<eglue_type, eglue_plus >::value == true) { arma_appl
#define arma_applier(operator) \ ier(=, +); }
{\ else if(is_same_type<eglue_type, eglue_minus>::value == true) { arma_appl
u32 i,j;\ ier(=, -); }
\ else if(is_same_type<eglue_type, eglue_div >::value == true) { arma_appl
for(i=0, j=1; j<n_elem; i+=2, j+=2)\ ier(=, /); }
{\ else if(is_same_type<eglue_type, eglue_schur>::value == true) { arma_appl
eT tmp_i = P1[i];\ ier(=, *); }
eT tmp_j = P1[j];\
\
tmp_i operator##= P2[i];\
tmp_j operator##= P2[j];\
\
out_mem[i] = tmp_i;\
out_mem[j] = tmp_j;\
}\
\
if(i < n_elem)\
{\
out_mem[i] = P1[i] operator P2[i];\
}\
}
if(is_same_type<eglue_type, eglue_plus >::value == true) { arma_appl
ier(+); }
else if(is_same_type<eglue_type, eglue_minus>::value == true) { arma_appl
ier(-); }
else if(is_same_type<eglue_type, eglue_div >::value == true) { arma_appl
ier(/); }
else if(is_same_type<eglue_type, eglue_schur>::value == true) { arma_appl
ier(*); }
else else
{ {
arma_stop("eglue_core::apply_proxy(): unhandled eglue_type"); arma_stop("eglue_core::apply_proxy(): unhandled eglue_type");
} }
} }
template<typename eglue_type> template<typename eglue_type>
template<typename T1, typename T2> template<typename T1, typename T2>
arma_hot arma_hot
inline inline
skipping to change at line 122 skipping to change at line 125
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
typedef typename Proxy<T1>::ea_type ea_type1; typedef typename Proxy<T1>::ea_type ea_type1;
typedef typename Proxy<T2>::ea_type ea_type2; typedef typename Proxy<T2>::ea_type ea_type2;
ea_type1 P1 = x.P1.get_ea(); ea_type1 P1 = x.P1.get_ea();
ea_type2 P2 = x.P2.get_ea(); ea_type2 P2 = x.P2.get_ea();
eT* out_mem = out.memptr(); eT* out_mem = out.memptr();
const u32 n_elem = out.n_elem; const u32 n_elem = out.n_elem;
#undef arma_applier if(is_same_type<eglue_type, eglue_plus >::value == true) { arma_appl
#define arma_applier(operator) \ ier(+=, +); }
{\ else if(is_same_type<eglue_type, eglue_minus>::value == true) { arma_appl
u32 i,j;\ ier(+=, -); }
\ else if(is_same_type<eglue_type, eglue_div >::value == true) { arma_appl
for(i=0, j=1; j<n_elem; i+=2, j+=2)\ ier(+=, /); }
{\ else if(is_same_type<eglue_type, eglue_schur>::value == true) { arma_appl
eT tmp_i = P1[i];\ ier(+=, *); }
eT tmp_j = P1[j];\
\
tmp_i operator##= P2[i];\
tmp_j operator##= P2[j];\
\
out_mem[i] += tmp_i;\
out_mem[j] += tmp_j;\
}\
\
if(i < n_elem)\
{\
out_mem[i] += P1[i] operator P2[i];\
}\
}
if(is_same_type<eglue_type, eglue_plus >::value == true) { arma_appl
ier(+); }
else if(is_same_type<eglue_type, eglue_minus>::value == true) { arma_appl
ier(-); }
else if(is_same_type<eglue_type, eglue_div >::value == true) { arma_appl
ier(/); }
else if(is_same_type<eglue_type, eglue_schur>::value == true) { arma_appl
ier(*); }
else else
{ {
arma_stop("eglue_core::apply_inplace_plus(): unhandled eglue_type"); arma_stop("eglue_core::apply_inplace_plus(): unhandled eglue_type");
} }
} }
template<typename eglue_type> template<typename eglue_type>
template<typename T1, typename T2> template<typename T1, typename T2>
arma_hot arma_hot
inline inline
skipping to change at line 176 skipping to change at line 156
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
typedef typename Proxy<T1>::ea_type ea_type1; typedef typename Proxy<T1>::ea_type ea_type1;
typedef typename Proxy<T2>::ea_type ea_type2; typedef typename Proxy<T2>::ea_type ea_type2;
ea_type1 P1 = x.P1.get_ea(); ea_type1 P1 = x.P1.get_ea();
ea_type2 P2 = x.P2.get_ea(); ea_type2 P2 = x.P2.get_ea();
eT* out_mem = out.memptr(); eT* out_mem = out.memptr();
const u32 n_elem = out.n_elem; const u32 n_elem = out.n_elem;
#undef arma_applier if(is_same_type<eglue_type, eglue_plus >::value == true) { arma_appl
#define arma_applier(operator) \ ier(-=, +); }
{\ else if(is_same_type<eglue_type, eglue_minus>::value == true) { arma_appl
u32 i,j;\ ier(-=, -); }
\ else if(is_same_type<eglue_type, eglue_div >::value == true) { arma_appl
for(i=0, j=1; j<n_elem; i+=2, j+=2)\ ier(-=, /); }
{\ else if(is_same_type<eglue_type, eglue_schur>::value == true) { arma_appl
eT tmp_i = P1[i];\ ier(-=, *); }
eT tmp_j = P1[j];\
\
tmp_i operator##= P2[i];\
tmp_j operator##= P2[j];\
\
out_mem[i] -= tmp_i;\
out_mem[j] -= tmp_j;\
}\
\
if(i < n_elem)\
{\
out_mem[i] -= P1[i] operator P2[i];\
}\
}
if(is_same_type<eglue_type, eglue_plus >::value == true) { arma_appl
ier(+); }
else if(is_same_type<eglue_type, eglue_minus>::value == true) { arma_appl
ier(-); }
else if(is_same_type<eglue_type, eglue_div >::value == true) { arma_appl
ier(/); }
else if(is_same_type<eglue_type, eglue_schur>::value == true) { arma_appl
ier(*); }
else else
{ {
arma_stop("eglue_core::apply_inplace_minus(): unhandled eglue_type"); arma_stop("eglue_core::apply_inplace_minus(): unhandled eglue_type");
} }
} }
template<typename eglue_type> template<typename eglue_type>
template<typename T1, typename T2> template<typename T1, typename T2>
arma_hot arma_hot
inline inline
skipping to change at line 230 skipping to change at line 187
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
typedef typename Proxy<T1>::ea_type ea_type1; typedef typename Proxy<T1>::ea_type ea_type1;
typedef typename Proxy<T2>::ea_type ea_type2; typedef typename Proxy<T2>::ea_type ea_type2;
ea_type1 P1 = x.P1.get_ea(); ea_type1 P1 = x.P1.get_ea();
ea_type2 P2 = x.P2.get_ea(); ea_type2 P2 = x.P2.get_ea();
eT* out_mem = out.memptr(); eT* out_mem = out.memptr();
const u32 n_elem = out.n_elem; const u32 n_elem = out.n_elem;
#undef arma_applier if(is_same_type<eglue_type, eglue_plus >::value == true) { arma_appl
#define arma_applier(operator) \ ier(*=, +); }
{\ else if(is_same_type<eglue_type, eglue_minus>::value == true) { arma_appl
u32 i,j;\ ier(*=, -); }
\ else if(is_same_type<eglue_type, eglue_div >::value == true) { arma_appl
for(i=0, j=1; j<n_elem; i+=2, j+=2)\ ier(*=, /); }
{\ else if(is_same_type<eglue_type, eglue_schur>::value == true) { arma_appl
eT tmp_i = P1[i];\ ier(*=, *); }
eT tmp_j = P1[j];\
\
tmp_i operator##= P2[i];\
tmp_j operator##= P2[j];\
\
out_mem[i] *= tmp_i;\
out_mem[j] *= tmp_j;\
}\
\
if(i < n_elem)\
{\
out_mem[i] *= P1[i] operator P2[i];\
}\
}
if(is_same_type<eglue_type, eglue_plus >::value == true) { arma_appl
ier(+); }
else if(is_same_type<eglue_type, eglue_minus>::value == true) { arma_appl
ier(-); }
else if(is_same_type<eglue_type, eglue_div >::value == true) { arma_appl
ier(/); }
else if(is_same_type<eglue_type, eglue_schur>::value == true) { arma_appl
ier(*); }
else else
{ {
arma_stop("eglue_core::apply_inplace_schur(): unhandled eglue_type"); arma_stop("eglue_core::apply_inplace_schur(): unhandled eglue_type");
} }
} }
template<typename eglue_type> template<typename eglue_type>
template<typename T1, typename T2> template<typename T1, typename T2>
arma_hot arma_hot
inline inline
skipping to change at line 284 skipping to change at line 218
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
typedef typename Proxy<T1>::ea_type ea_type1; typedef typename Proxy<T1>::ea_type ea_type1;
typedef typename Proxy<T2>::ea_type ea_type2; typedef typename Proxy<T2>::ea_type ea_type2;
ea_type1 P1 = x.P1.get_ea(); ea_type1 P1 = x.P1.get_ea();
ea_type2 P2 = x.P2.get_ea(); ea_type2 P2 = x.P2.get_ea();
eT* out_mem = out.memptr(); eT* out_mem = out.memptr();
const u32 n_elem = out.n_elem; const u32 n_elem = out.n_elem;
#undef arma_applier if(is_same_type<eglue_type, eglue_plus >::value == true) { arma_appl
#define arma_applier(operator) \ ier(/=, +); }
{\ else if(is_same_type<eglue_type, eglue_minus>::value == true) { arma_appl
u32 i,j;\ ier(/=, -); }
\ else if(is_same_type<eglue_type, eglue_div >::value == true) { arma_appl
for(i=0, j=1; j<n_elem; i+=2, j+=2)\ ier(/=, /); }
{\ else if(is_same_type<eglue_type, eglue_schur>::value == true) { arma_appl
eT tmp_i = P1[i];\ ier(/=, *); }
eT tmp_j = P1[j];\
\
tmp_i operator##= P2[i];\
tmp_j operator##= P2[j];\
\
out_mem[i] /= tmp_i;\
out_mem[j] /= tmp_j;\
}\
\
if(i < n_elem)\
{\
out_mem[i] /= P1[i] operator P2[i];\
}\
}
if(is_same_type<eglue_type, eglue_plus >::value == true) { arma_appl
ier(+); }
else if(is_same_type<eglue_type, eglue_minus>::value == true) { arma_appl
ier(-); }
else if(is_same_type<eglue_type, eglue_div >::value == true) { arma_appl
ier(/); }
else if(is_same_type<eglue_type, eglue_schur>::value == true) { arma_appl
ier(*); }
else else
{ {
arma_stop("eglue_core::apply_inplace_div(): unhandled eglue_type"); arma_stop("eglue_core::apply_inplace_div(): unhandled eglue_type");
} }
} }
// //
// cubes // cubes
template<typename eglue_type> template<typename eglue_type>
skipping to change at line 341 skipping to change at line 252
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
typedef typename ProxyCube<T1>::ea_type ea_type1; typedef typename ProxyCube<T1>::ea_type ea_type1;
typedef typename ProxyCube<T2>::ea_type ea_type2; typedef typename ProxyCube<T2>::ea_type ea_type2;
ea_type1 P1 = x.P1.get_ea(); ea_type1 P1 = x.P1.get_ea();
ea_type2 P2 = x.P2.get_ea(); ea_type2 P2 = x.P2.get_ea();
eT* out_mem = out.memptr(); eT* out_mem = out.memptr();
const u32 n_elem = out.n_elem; const u32 n_elem = out.n_elem;
#undef arma_applier if(is_same_type<eglue_type, eglue_plus >::value == true) { arma_appl
#define arma_applier(operator) \ ier(=, +); }
{\ else if(is_same_type<eglue_type, eglue_minus>::value == true) { arma_appl
u32 i,j;\ ier(=, -); }
\ else if(is_same_type<eglue_type, eglue_div >::value == true) { arma_appl
for(i=0, j=1; j<n_elem; i+=2, j+=2)\ ier(=, /); }
{\ else if(is_same_type<eglue_type, eglue_schur>::value == true) { arma_appl
eT tmp_i = P1[i];\ ier(=, *); }
eT tmp_j = P1[j];\
\
tmp_i operator##= P2[i];\
tmp_j operator##= P2[j];\
\
out_mem[i] = tmp_i;\
out_mem[j] = tmp_j;\
}\
\
if(i < n_elem)\
{\
out_mem[i] = P1[i] operator P2[i];\
}\
}
if(is_same_type<eglue_type, eglue_plus >::value == true) { arma_appl
ier(+); }
else if(is_same_type<eglue_type, eglue_minus>::value == true) { arma_appl
ier(-); }
else if(is_same_type<eglue_type, eglue_div >::value == true) { arma_appl
ier(/); }
else if(is_same_type<eglue_type, eglue_schur>::value == true) { arma_appl
ier(*); }
else else
{ {
arma_stop("eglue_core::apply(): unhandled eglue_type"); arma_stop("eglue_core::apply(): unhandled eglue_type");
} }
} }
template<typename eglue_type> template<typename eglue_type>
template<typename T1, typename T2> template<typename T1, typename T2>
arma_hot arma_hot
inline inline
skipping to change at line 395 skipping to change at line 283
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
typedef typename ProxyCube<T1>::ea_type ea_type1; typedef typename ProxyCube<T1>::ea_type ea_type1;
typedef typename ProxyCube<T2>::ea_type ea_type2; typedef typename ProxyCube<T2>::ea_type ea_type2;
ea_type1 P1 = x.P1.get_ea(); ea_type1 P1 = x.P1.get_ea();
ea_type2 P2 = x.P2.get_ea(); ea_type2 P2 = x.P2.get_ea();
const u32 n_elem = out.n_elem; const u32 n_elem = out.n_elem;
eT* out_mem = out.memptr(); eT* out_mem = out.memptr();
#undef arma_applier if(is_same_type<eglue_type, eglue_plus >::value == true) { arma_appl
#define arma_applier(operator) \ ier(+=, +); }
{\ else if(is_same_type<eglue_type, eglue_minus>::value == true) { arma_appl
u32 i,j;\ ier(+=, -); }
\ else if(is_same_type<eglue_type, eglue_div >::value == true) { arma_appl
for(i=0, j=1; j<n_elem; i+=2, j+=2)\ ier(+=, /); }
{\ else if(is_same_type<eglue_type, eglue_schur>::value == true) { arma_appl
eT tmp_i = P1[i];\ ier(+=, *); }
eT tmp_j = P1[j];\
\
tmp_i operator##= P2[i];\
tmp_j operator##= P2[j];\
\
out_mem[i] += tmp_i;\
out_mem[j] += tmp_j;\
}\
\
if(i < n_elem)\
{\
out_mem[i] += P1[i] operator P2[i];\
}\
}
if(is_same_type<eglue_type, eglue_plus >::value == true) { arma_appl
ier(+); }
else if(is_same_type<eglue_type, eglue_minus>::value == true) { arma_appl
ier(-); }
else if(is_same_type<eglue_type, eglue_div >::value == true) { arma_appl
ier(/); }
else if(is_same_type<eglue_type, eglue_schur>::value == true) { arma_appl
ier(*); }
else else
{ {
arma_stop("eglue_core::apply_inplace_plus(): unhandled eglue_type"); arma_stop("eglue_core::apply_inplace_plus(): unhandled eglue_type");
} }
} }
template<typename eglue_type> template<typename eglue_type>
template<typename T1, typename T2> template<typename T1, typename T2>
arma_hot arma_hot
inline inline
skipping to change at line 449 skipping to change at line 314
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
typedef typename ProxyCube<T1>::ea_type ea_type1; typedef typename ProxyCube<T1>::ea_type ea_type1;
typedef typename ProxyCube<T2>::ea_type ea_type2; typedef typename ProxyCube<T2>::ea_type ea_type2;
ea_type1 P1 = x.P1.get_ea(); ea_type1 P1 = x.P1.get_ea();
ea_type2 P2 = x.P2.get_ea(); ea_type2 P2 = x.P2.get_ea();
const u32 n_elem = out.n_elem; const u32 n_elem = out.n_elem;
eT* out_mem = out.memptr(); eT* out_mem = out.memptr();
#undef arma_applier if(is_same_type<eglue_type, eglue_plus >::value == true) { arma_appl
#define arma_applier(operator) \ ier(-=, +); }
{\ else if(is_same_type<eglue_type, eglue_minus>::value == true) { arma_appl
u32 i,j;\ ier(-=, -); }
\ else if(is_same_type<eglue_type, eglue_div >::value == true) { arma_appl
for(i=0, j=1; j<n_elem; i+=2, j+=2)\ ier(-=, /); }
{\ else if(is_same_type<eglue_type, eglue_schur>::value == true) { arma_appl
eT tmp_i = P1[i];\ ier(-=, *); }
eT tmp_j = P1[j];\
\
tmp_i operator##= P2[i];\
tmp_j operator##= P2[j];\
\
out_mem[i] -= tmp_i;\
out_mem[j] -= tmp_j;\
}\
\
if(i < n_elem)\
{\
out_mem[i] -= P1[i] operator P2[i];\
}\
}
if(is_same_type<eglue_type, eglue_plus >::value == true) { arma_appl
ier(+); }
else if(is_same_type<eglue_type, eglue_minus>::value == true) { arma_appl
ier(-); }
else if(is_same_type<eglue_type, eglue_div >::value == true) { arma_appl
ier(/); }
else if(is_same_type<eglue_type, eglue_schur>::value == true) { arma_appl
ier(*); }
else else
{ {
arma_stop("eglue_core::apply_inplace_minus(): unhandled eglue_type"); arma_stop("eglue_core::apply_inplace_minus(): unhandled eglue_type");
} }
} }
template<typename eglue_type> template<typename eglue_type>
template<typename T1, typename T2> template<typename T1, typename T2>
arma_hot arma_hot
inline inline
skipping to change at line 503 skipping to change at line 345
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
typedef typename ProxyCube<T1>::ea_type ea_type1; typedef typename ProxyCube<T1>::ea_type ea_type1;
typedef typename ProxyCube<T2>::ea_type ea_type2; typedef typename ProxyCube<T2>::ea_type ea_type2;
ea_type1 P1 = x.P1.get_ea(); ea_type1 P1 = x.P1.get_ea();
ea_type2 P2 = x.P2.get_ea(); ea_type2 P2 = x.P2.get_ea();
const u32 n_elem = out.n_elem; const u32 n_elem = out.n_elem;
eT* out_mem = out.memptr(); eT* out_mem = out.memptr();
#undef arma_applier if(is_same_type<eglue_type, eglue_plus >::value == true) { arma_appl
#define arma_applier(operator) \ ier(*=, +); }
{\ else if(is_same_type<eglue_type, eglue_minus>::value == true) { arma_appl
u32 i,j;\ ier(*=, -); }
\ else if(is_same_type<eglue_type, eglue_div >::value == true) { arma_appl
for(i=0, j=1; j<n_elem; i+=2, j+=2)\ ier(*=, /); }
{\ else if(is_same_type<eglue_type, eglue_schur>::value == true) { arma_appl
eT tmp_i = P1[i];\ ier(*=, *); }
eT tmp_j = P1[j];\
\
tmp_i operator##= P2[i];\
tmp_j operator##= P2[j];\
\
out_mem[i] *= tmp_i;\
out_mem[j] *= tmp_j;\
}\
\
if(i < n_elem)\
{\
out_mem[i] *= P1[i] operator P2[i];\
}\
}
if(is_same_type<eglue_type, eglue_plus >::value == true) { arma_appl
ier(+); }
else if(is_same_type<eglue_type, eglue_minus>::value == true) { arma_appl
ier(-); }
else if(is_same_type<eglue_type, eglue_div >::value == true) { arma_appl
ier(/); }
else if(is_same_type<eglue_type, eglue_schur>::value == true) { arma_appl
ier(*); }
else else
{ {
arma_stop("eglue_core::apply_inplace_schur(): unhandled eglue_type"); arma_stop("eglue_core::apply_inplace_schur(): unhandled eglue_type");
} }
} }
template<typename eglue_type> template<typename eglue_type>
template<typename T1, typename T2> template<typename T1, typename T2>
arma_hot arma_hot
inline inline
skipping to change at line 557 skipping to change at line 376
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
typedef typename ProxyCube<T1>::ea_type ea_type1; typedef typename ProxyCube<T1>::ea_type ea_type1;
typedef typename ProxyCube<T2>::ea_type ea_type2; typedef typename ProxyCube<T2>::ea_type ea_type2;
ea_type1 P1 = x.P1.get_ea(); ea_type1 P1 = x.P1.get_ea();
ea_type2 P2 = x.P2.get_ea(); ea_type2 P2 = x.P2.get_ea();
const u32 n_elem = out.n_elem; const u32 n_elem = out.n_elem;
eT* out_mem = out.memptr(); eT* out_mem = out.memptr();
#undef arma_applier if(is_same_type<eglue_type, eglue_plus >::value == true) { arma_appl
#define arma_applier(operator) \ ier(/=, +); }
{\ else if(is_same_type<eglue_type, eglue_minus>::value == true) { arma_appl
u32 i,j;\ ier(/=, -); }
\ else if(is_same_type<eglue_type, eglue_div >::value == true) { arma_appl
for(i=0, j=1; j<n_elem; i+=2, j+=2)\ ier(/=, /); }
{\ else if(is_same_type<eglue_type, eglue_schur>::value == true) { arma_appl
eT tmp_i = P1[i];\ ier(/=, *); }
eT tmp_j = P1[j];\
\
tmp_i operator##= P2[i];\
tmp_j operator##= P2[j];\
\
out_mem[i] /= tmp_i;\
out_mem[j] /= tmp_j;\
}\
\
if(i < n_elem)\
{\
out_mem[i] /= P1[i] operator P2[i];\
}\
}
if(is_same_type<eglue_type, eglue_plus >::value == true) { arma_appl
ier(+); }
else if(is_same_type<eglue_type, eglue_minus>::value == true) { arma_appl
ier(-); }
else if(is_same_type<eglue_type, eglue_div >::value == true) { arma_appl
ier(/); }
else if(is_same_type<eglue_type, eglue_schur>::value == true) { arma_appl
ier(*); }
else else
{ {
arma_stop("eglue_core::apply_inplace_div(): unhandled eglue_type"); arma_stop("eglue_core::apply_inplace_div(): unhandled eglue_type");
} }
} }
#undef arma_applier
//! @} //! @}
 End of changes. 13 change blocks. 
312 lines changed or deleted 110 lines changed or added


 eop_aux.hpp   eop_aux.hpp 
// Copyright (C) 2010 NICTA (www.nicta.com.au) // Copyright (C) 2010-2011 NICTA (www.nicta.com.au)
// Copyright (C) 2010 Conrad Sanderson // Copyright (C) 2010-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 131 skipping to change at line 131
template<typename eT> arma_inline static typename arma_cx_only<eT>::resul t atan (const eT x) { return arma_atan(x); } template<typename eT> arma_inline static typename arma_cx_only<eT>::resul t atan (const eT x) { return arma_atan(x); }
template<typename eT> arma_inline static typename arma_integral_only<eT>: :result acosh (const eT x) { return eT( arma_acosh(double(x)) ); } template<typename eT> arma_inline static typename arma_integral_only<eT>: :result acosh (const eT x) { return eT( arma_acosh(double(x)) ); }
template<typename eT> arma_inline static typename arma_integral_only<eT>: :result asinh (const eT x) { return eT( arma_asinh(double(x)) ); } template<typename eT> arma_inline static typename arma_integral_only<eT>: :result asinh (const eT x) { return eT( arma_asinh(double(x)) ); }
template<typename eT> arma_inline static typename arma_integral_only<eT>: :result atanh (const eT x) { return eT( arma_atanh(double(x)) ); } template<typename eT> arma_inline static typename arma_integral_only<eT>: :result atanh (const eT x) { return eT( arma_atanh(double(x)) ); }
template<typename eT> arma_inline static typename arma_float_or_cx_only<e T>::result acosh (const eT x) { return arma_acosh(x); } template<typename eT> arma_inline static typename arma_float_or_cx_only<e T>::result acosh (const eT x) { return arma_acosh(x); }
template<typename eT> arma_inline static typename arma_float_or_cx_only<e T>::result asinh (const eT x) { return arma_asinh(x); } template<typename eT> arma_inline static typename arma_float_or_cx_only<e T>::result asinh (const eT x) { return arma_asinh(x); }
template<typename eT> arma_inline static typename arma_float_or_cx_only<e T>::result atanh (const eT x) { return arma_atanh(x); } template<typename eT> arma_inline static typename arma_float_or_cx_only<e T>::result atanh (const eT x) { return arma_atanh(x); }
template<typename eT> arma_inline static typename arma_not_cx<eT>::result template<typename eT> arma_inline static typename arma_not_cx<eT>::result
conj(const eT x) { return x; } conj(const eT x) { return x; }
template<typename T> arma_inline static std::complex<T> template<typename T> arma_inline static std::complex<T>
conj(const std::complex<T> x) { return std::conj(x); } conj(const std::complex<T>& x) { return std::conj(x); }
template<typename eT> arma_inline static typename arma_integral_only<eT>: :result sqrt (const eT x) { return eT( std::sqrt (double(x)) ); } template<typename eT> arma_inline static typename arma_integral_only<eT>: :result sqrt (const eT x) { return eT( std::sqrt (double(x)) ); }
template<typename eT> arma_inline static typename arma_integral_only<eT>: :result log10 (const eT x) { return eT( std::log10(double(x)) ); } template<typename eT> arma_inline static typename arma_integral_only<eT>: :result log10 (const eT x) { return eT( std::log10(double(x)) ); }
template<typename eT> arma_inline static typename arma_integral_only<eT>: :result log (const eT x) { return eT( std::log (double(x)) ); } template<typename eT> arma_inline static typename arma_integral_only<eT>: :result log (const eT x) { return eT( std::log (double(x)) ); }
template<typename eT> arma_inline static typename arma_integral_only<eT>: :result exp (const eT x) { return eT( std::exp (double(x)) ); } template<typename eT> arma_inline static typename arma_integral_only<eT>: :result exp (const eT x) { return eT( std::exp (double(x)) ); }
template<typename eT> arma_inline static typename arma_integral_only<eT>: :result cos (const eT x) { return eT( std::cos (double(x)) ); } template<typename eT> arma_inline static typename arma_integral_only<eT>: :result cos (const eT x) { return eT( std::cos (double(x)) ); }
template<typename eT> arma_inline static typename arma_integral_only<eT>: :result sin (const eT x) { return eT( std::sin (double(x)) ); } template<typename eT> arma_inline static typename arma_integral_only<eT>: :result sin (const eT x) { return eT( std::sin (double(x)) ); }
template<typename eT> arma_inline static typename arma_integral_only<eT>: :result tan (const eT x) { return eT( std::tan (double(x)) ); } template<typename eT> arma_inline static typename arma_integral_only<eT>: :result tan (const eT x) { return eT( std::tan (double(x)) ); }
template<typename eT> arma_inline static typename arma_integral_only<eT>: :result cosh (const eT x) { return eT( std::cosh (double(x)) ); } template<typename eT> arma_inline static typename arma_integral_only<eT>: :result cosh (const eT x) { return eT( std::cosh (double(x)) ); }
template<typename eT> arma_inline static typename arma_integral_only<eT>: :result sinh (const eT x) { return eT( std::sinh (double(x)) ); } template<typename eT> arma_inline static typename arma_integral_only<eT>: :result sinh (const eT x) { return eT( std::sinh (double(x)) ); }
skipping to change at line 159 skipping to change at line 159
template<typename eT> arma_inline static typename arma_float_or_cx_only<e T>::result cos (const eT x) { return std::cos (x); } template<typename eT> arma_inline static typename arma_float_or_cx_only<e T>::result cos (const eT x) { return std::cos (x); }
template<typename eT> arma_inline static typename arma_float_or_cx_only<e T>::result sin (const eT x) { return std::sin (x); } template<typename eT> arma_inline static typename arma_float_or_cx_only<e T>::result sin (const eT x) { return std::sin (x); }
template<typename eT> arma_inline static typename arma_float_or_cx_only<e T>::result tan (const eT x) { return std::tan (x); } template<typename eT> arma_inline static typename arma_float_or_cx_only<e T>::result tan (const eT x) { return std::tan (x); }
template<typename eT> arma_inline static typename arma_float_or_cx_only<e T>::result cosh (const eT x) { return std::cosh (x); } template<typename eT> arma_inline static typename arma_float_or_cx_only<e T>::result cosh (const eT x) { return std::cosh (x); }
template<typename eT> arma_inline static typename arma_float_or_cx_only<e T>::result sinh (const eT x) { return std::sinh (x); } template<typename eT> arma_inline static typename arma_float_or_cx_only<e T>::result sinh (const eT x) { return std::sinh (x); }
template<typename eT> arma_inline static typename arma_float_or_cx_only<e T>::result tanh (const eT x) { return std::tanh (x); } template<typename eT> arma_inline static typename arma_float_or_cx_only<e T>::result tanh (const eT x) { return std::tanh (x); }
template<typename eT> arma_inline static typename arma_unsigned_integral_ only<eT>::result neg (const eT x) { return x; } template<typename eT> arma_inline static typename arma_unsigned_integral_ only<eT>::result neg (const eT x) { return x; }
template<typename eT> arma_inline static typename arma_signed_only<eT>::r esult neg (const eT x) { return -x; } template<typename eT> arma_inline static typename arma_signed_only<eT>::r esult neg (const eT x) { return -x; }
template<typename eT> arma_inline static typename arma_integral_only<eT>:
:result floor(const eT x) { return x;
}
template<typename eT> arma_inline static typename arma_float_only<eT>::re
sult floor(const eT x) { return std::floor(x);
}
template<typename eT> arma_inline static typename arma_cx_only<eT>::resul
t floor(const eT& x) { return eT( std::floor(x.real()), std::floor(x.
imag()) ); }
template<typename eT> arma_inline static typename arma_integral_only<eT>:
:result ceil(const eT x) { return x;
}
template<typename eT> arma_inline static typename arma_float_only<eT>::re
sult ceil(const eT x) { return std::ceil(x);
}
template<typename eT> arma_inline static typename arma_cx_only<eT>::resul
t ceil(const eT& x) { return eT( std::ceil(x.real()), std::ceil(x.im
ag()) ); }
template<typename eT> template<typename eT>
arma_inline arma_inline
static static
typename arma_integral_only<eT>::result typename arma_integral_only<eT>::result
log2 (const eT x) log2 (const eT x)
{ {
return eT( std::log(double(x))/ double(0.69314718055994530942) ); return eT( std::log(double(x))/ double(0.69314718055994530942) );
} }
template<typename eT> template<typename eT>
 End of changes. 3 change blocks. 
6 lines changed or deleted 26 lines changed or added


 eop_core_meat.hpp   eop_core_meat.hpp 
// Copyright (C) 2010 NICTA (www.nicta.com.au) // Copyright (C) 2010-2011 NICTA (www.nicta.com.au)
// Copyright (C) 2010 Conrad Sanderson // Copyright (C) 2010-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 86 skipping to change at line 86
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
const u32 n_rows = x.get_n_rows(); const u32 n_rows = x.get_n_rows();
const u32 n_cols = x.get_n_cols(); const u32 n_cols = x.get_n_cols();
arma_debug_assert_same_size(out.n_rows, out.n_cols, n_rows, n_cols, "addi tion"); arma_debug_assert_same_size(out.n_rows, out.n_cols, n_rows, n_cols, "addi tion");
eT* out_mem = out.memptr();
const u32 n_elem = out.n_elem;
if(is_generator<eop_type>::value == true) if(is_generator<eop_type>::value == true)
{ {
if(is_same_type<eop_type, eop_ones_diag>::value == true) if(is_same_type<eop_type, eop_ones_diag>::value == true)
{ {
const u32 N = (std::min)(n_rows, n_cols); const u32 N = (std::min)(n_rows, n_cols);
for(u32 i=0; i<N; ++i) for(u32 i=0; i<N; ++i)
{ {
out.at(i,i) += eT(1); out.at(i,i) += eT(1);
} }
} }
else else
{ {
eT* out_mem = out.memptr();
const u32 n_elem = out.n_elem;
for(u32 i=0; i<n_elem; ++i) for(u32 i=0; i<n_elem; ++i)
{ {
out_mem[i] += eop_aux::generate<eT,eop_type>(); out_mem[i] += eop_aux::generate<eT,eop_type>();
} }
} }
} }
else else
{ {
typedef typename Proxy<T1>::ea_type ea_type; typedef typename Proxy<T1>::ea_type ea_type;
const eT k = x.aux; const eT k = x.aux;
ea_type P = x.P.get_ea(); ea_type P = x.P.get_ea();
eT* out_mem = out.memptr();
const u32 n_elem = out.n_elem;
u32 i,j; u32 i,j;
for(i=0, j=1; j<n_elem; i+=2, j+=2) for(i=0, j=1; j<n_elem; i+=2, j+=2)
{ {
const eT tmp_i = eop_core<eop_type>::process(P[i], k); const eT tmp_i = eop_core<eop_type>::process(P[i], k);
const eT tmp_j = eop_core<eop_type>::process(P[j], k); const eT tmp_j = eop_core<eop_type>::process(P[j], k);
out_mem[i] += tmp_i; out_mem[i] += tmp_i;
out_mem[j] += tmp_j; out_mem[j] += tmp_j;
skipping to change at line 151 skipping to change at line 149
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
const u32 n_rows = x.get_n_rows(); const u32 n_rows = x.get_n_rows();
const u32 n_cols = x.get_n_cols(); const u32 n_cols = x.get_n_cols();
arma_debug_assert_same_size(out.n_rows, out.n_cols, n_rows, n_cols, "subt raction"); arma_debug_assert_same_size(out.n_rows, out.n_cols, n_rows, n_cols, "subt raction");
eT* out_mem = out.memptr();
const u32 n_elem = out.n_elem;
if(is_generator<eop_type>::value == true) if(is_generator<eop_type>::value == true)
{ {
if(is_same_type<eop_type, eop_ones_diag>::value == true) if(is_same_type<eop_type, eop_ones_diag>::value == true)
{ {
const u32 N = (std::min)(n_rows, n_cols); const u32 N = (std::min)(n_rows, n_cols);
for(u32 i=0; i<N; ++i) for(u32 i=0; i<N; ++i)
{ {
out.at(i,i) -= eT(1); out.at(i,i) -= eT(1);
} }
} }
else else
{ {
eT* out_mem = out.memptr();
const u32 n_elem = out.n_elem;
for(u32 i=0; i<n_elem; ++i) for(u32 i=0; i<n_elem; ++i)
{ {
out_mem[i] -= eop_aux::generate<eT,eop_type>(); out_mem[i] -= eop_aux::generate<eT,eop_type>();
} }
} }
} }
else else
{ {
typedef typename Proxy<T1>::ea_type ea_type; typedef typename Proxy<T1>::ea_type ea_type;
const eT k = x.aux; const eT k = x.aux;
ea_type P = x.P.get_ea(); ea_type P = x.P.get_ea();
eT* out_mem = out.memptr();
const u32 n_elem = out.n_elem;
u32 i,j; u32 i,j;
for(i=0, j=1; j<n_elem; i+=2, j+=2) for(i=0, j=1; j<n_elem; i+=2, j+=2)
{ {
const eT tmp_i = eop_core<eop_type>::process(P[i], k); const eT tmp_i = eop_core<eop_type>::process(P[i], k);
const eT tmp_j = eop_core<eop_type>::process(P[j], k); const eT tmp_j = eop_core<eop_type>::process(P[j], k);
out_mem[i] -= tmp_i; out_mem[i] -= tmp_i;
out_mem[j] -= tmp_j; out_mem[j] -= tmp_j;
skipping to change at line 216 skipping to change at line 212
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
const u32 n_rows = x.get_n_rows(); const u32 n_rows = x.get_n_rows();
const u32 n_cols = x.get_n_cols(); const u32 n_cols = x.get_n_cols();
arma_debug_assert_same_size(out.n_rows, out.n_cols, n_rows, n_cols, "elem ent-wise multiplication"); arma_debug_assert_same_size(out.n_rows, out.n_cols, n_rows, n_cols, "elem ent-wise multiplication");
eT* out_mem = out.memptr();
const u32 n_elem = out.n_elem;
if(is_generator<eop_type>::value == true) if(is_generator<eop_type>::value == true)
{ {
if(is_same_type<eop_type, eop_ones_diag>::value == true) if(is_same_type<eop_type, eop_ones_diag>::value == true)
{ {
const u32 N = (std::min)(n_rows, n_cols); const u32 N = (std::min)(n_rows, n_cols);
for(u32 i=0; i<N; ++i) for(u32 i=0; i<N; ++i)
{ {
for(u32 row=0; row<i; ++row) { out.at(row,i) = eT(0); } for(u32 row=0; row<i; ++row) { out.at(row,i) = eT(0); }
for(u32 row=i+1; row<n_rows; ++row) { out.at(row,i) = eT(0); } for(u32 row=i+1; row<n_rows; ++row) { out.at(row,i) = eT(0); }
} }
} }
else else
{ {
eT* out_mem = out.memptr();
const u32 n_elem = out.n_elem;
for(u32 i=0; i<n_elem; ++i) for(u32 i=0; i<n_elem; ++i)
{ {
out_mem[i] *= eop_aux::generate<eT,eop_type>(); out_mem[i] *= eop_aux::generate<eT,eop_type>();
} }
} }
} }
else else
{ {
typedef typename Proxy<T1>::ea_type ea_type; typedef typename Proxy<T1>::ea_type ea_type;
const eT k = x.aux; const eT k = x.aux;
ea_type P = x.P.get_ea(); ea_type P = x.P.get_ea();
eT* out_mem = out.memptr();
const u32 n_elem = out.n_elem;
u32 i,j; u32 i,j;
for(i=0, j=1; j<n_elem; i+=2, j+=2) for(i=0, j=1; j<n_elem; i+=2, j+=2)
{ {
const eT tmp_i = eop_core<eop_type>::process(P[i], k); const eT tmp_i = eop_core<eop_type>::process(P[i], k);
const eT tmp_j = eop_core<eop_type>::process(P[j], k); const eT tmp_j = eop_core<eop_type>::process(P[j], k);
out_mem[i] *= tmp_i; out_mem[i] *= tmp_i;
out_mem[j] *= tmp_j; out_mem[j] *= tmp_j;
skipping to change at line 301 skipping to change at line 295
for(u32 i=0; i<N; ++i) for(u32 i=0; i<N; ++i)
{ {
const eT zero = eT(0); const eT zero = eT(0);
for(u32 row=0; row<i; ++row) { out.at(row,i) /= zero; } for(u32 row=0; row<i; ++row) { out.at(row,i) /= zero; }
for(u32 row=i+1; row<n_rows; ++row) { out.at(row,i) /= zero; } for(u32 row=i+1; row<n_rows; ++row) { out.at(row,i) /= zero; }
} }
} }
else else
{ {
eT* out_mem = out.memptr();
const u32 n_elem = out.n_elem;
for(u32 i=0; i<n_elem; ++i) for(u32 i=0; i<n_elem; ++i)
{ {
out_mem[i] /= eop_aux::generate<eT,eop_type>(); out_mem[i] /= eop_aux::generate<eT,eop_type>();
} }
} }
} }
else else
{ {
typedef typename Proxy<T1>::ea_type ea_type; typedef typename Proxy<T1>::ea_type ea_type;
const eT k = x.aux; const eT k = x.aux;
ea_type P = x.P.get_ea(); ea_type P = x.P.get_ea();
eT* out_mem = out.memptr();
const u32 n_elem = out.n_elem;
u32 i,j; u32 i,j;
for(i=0, j=1; j<n_elem; i+=2, j+=2) for(i=0, j=1; j<n_elem; i+=2, j+=2)
{ {
const eT tmp_i = eop_core<eop_type>::process(P[i], k); const eT tmp_i = eop_core<eop_type>::process(P[i], k);
const eT tmp_j = eop_core<eop_type>::process(P[j], k); const eT tmp_j = eop_core<eop_type>::process(P[j], k);
out_mem[i] /= tmp_i; out_mem[i] /= tmp_i;
out_mem[j] /= tmp_j; out_mem[j] /= tmp_j;
skipping to change at line 405 skipping to change at line 394
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
const u32 n_rows = x.get_n_rows(); const u32 n_rows = x.get_n_rows();
const u32 n_cols = x.get_n_cols(); const u32 n_cols = x.get_n_cols();
const u32 n_slices = x.get_n_slices(); const u32 n_slices = x.get_n_slices();
arma_debug_assert_same_size(out.n_rows, out.n_cols, out.n_slices, n_rows, n_cols, n_slices, "addition"); arma_debug_assert_same_size(out.n_rows, out.n_cols, out.n_slices, n_rows, n_cols, n_slices, "addition");
eT* out_mem = out.memptr(); eT* out_mem = out.memptr();
const u32 n_elem = out.n_elem;
if(is_generator<eop_type>::value == true) if(is_generator<eop_type>::value == true)
{ {
eT* out_mem = out.memptr();
const u32 n_elem = out.n_elem;
for(u32 i=0; i<n_elem; ++i) for(u32 i=0; i<n_elem; ++i)
{ {
out_mem[i] += eop_aux::generate<eT,eop_type>(); out_mem[i] += eop_aux::generate<eT,eop_type>();
} }
} }
else else
{ {
typedef typename ProxyCube<T1>::ea_type ea_type; typedef typename ProxyCube<T1>::ea_type ea_type;
const eT k = x.aux; const eT k = x.aux;
ea_type P = x.P.get_ea(); ea_type P = x.P.get_ea();
eT* out_mem = out.memptr();
const u32 n_elem = out.n_elem;
u32 i,j; u32 i,j;
for(i=0, j=1; j<n_elem; i+=2, j+=2) for(i=0, j=1; j<n_elem; i+=2, j+=2)
{ {
const eT tmp_i = eop_core<eop_type>::process(P[i], k); const eT tmp_i = eop_core<eop_type>::process(P[i], k);
const eT tmp_j = eop_core<eop_type>::process(P[j], k); const eT tmp_j = eop_core<eop_type>::process(P[j], k);
out_mem[i] += tmp_i; out_mem[i] += tmp_i;
out_mem[j] += tmp_j; out_mem[j] += tmp_j;
skipping to change at line 461 skipping to change at line 446
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
const u32 n_rows = x.get_n_rows(); const u32 n_rows = x.get_n_rows();
const u32 n_cols = x.get_n_cols(); const u32 n_cols = x.get_n_cols();
const u32 n_slices = x.get_n_slices(); const u32 n_slices = x.get_n_slices();
arma_debug_assert_same_size(out.n_rows, out.n_cols, out.n_slices, n_rows, n_cols, n_slices, "subtraction"); arma_debug_assert_same_size(out.n_rows, out.n_cols, out.n_slices, n_rows, n_cols, n_slices, "subtraction");
eT* out_mem = out.memptr(); eT* out_mem = out.memptr();
const u32 n_elem = out.n_elem;
if(is_generator<eop_type>::value == true) if(is_generator<eop_type>::value == true)
{ {
eT* out_mem = out.memptr();
const u32 n_elem = out.n_elem;
for(u32 i=0; i<n_elem; ++i) for(u32 i=0; i<n_elem; ++i)
{ {
out_mem[i] -= eop_aux::generate<eT,eop_type>(); out_mem[i] -= eop_aux::generate<eT,eop_type>();
} }
} }
else else
{ {
typedef typename ProxyCube<T1>::ea_type ea_type; typedef typename ProxyCube<T1>::ea_type ea_type;
const eT k = x.aux; const eT k = x.aux;
ea_type P = x.P.get_ea(); ea_type P = x.P.get_ea();
eT* out_mem = out.memptr();
const u32 n_elem = out.n_elem;
u32 i,j; u32 i,j;
for(i=0, j=1; j<n_elem; i+=2, j+=2) for(i=0, j=1; j<n_elem; i+=2, j+=2)
{ {
const eT tmp_i = eop_core<eop_type>::process(P[i], k); const eT tmp_i = eop_core<eop_type>::process(P[i], k);
const eT tmp_j = eop_core<eop_type>::process(P[j], k); const eT tmp_j = eop_core<eop_type>::process(P[j], k);
out_mem[i] -= tmp_i; out_mem[i] -= tmp_i;
out_mem[j] -= tmp_j; out_mem[j] -= tmp_j;
skipping to change at line 517 skipping to change at line 498
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
const u32 n_rows = x.get_n_rows(); const u32 n_rows = x.get_n_rows();
const u32 n_cols = x.get_n_cols(); const u32 n_cols = x.get_n_cols();
const u32 n_slices = x.get_n_slices(); const u32 n_slices = x.get_n_slices();
arma_debug_assert_same_size(out.n_rows, out.n_cols, out.n_slices, n_rows, n_cols, n_slices, "element-wise multiplication"); arma_debug_assert_same_size(out.n_rows, out.n_cols, out.n_slices, n_rows, n_cols, n_slices, "element-wise multiplication");
eT* out_mem = out.memptr(); eT* out_mem = out.memptr();
const u32 n_elem = out.n_elem;
if(is_generator<eop_type>::value == true) if(is_generator<eop_type>::value == true)
{ {
eT* out_mem = out.memptr();
const u32 n_elem = out.n_elem;
for(u32 i=0; i<n_elem; ++i) for(u32 i=0; i<n_elem; ++i)
{ {
out_mem[i] *= eop_aux::generate<eT,eop_type>(); out_mem[i] *= eop_aux::generate<eT,eop_type>();
} }
} }
else else
{ {
typedef typename ProxyCube<T1>::ea_type ea_type; typedef typename ProxyCube<T1>::ea_type ea_type;
const eT k = x.aux; const eT k = x.aux;
ea_type P = x.P.get_ea(); ea_type P = x.P.get_ea();
eT* out_mem = out.memptr();
const u32 n_elem = out.n_elem;
u32 i,j; u32 i,j;
for(i=0, j=1; j<n_elem; i+=2, j+=2) for(i=0, j=1; j<n_elem; i+=2, j+=2)
{ {
const eT tmp_i = eop_core<eop_type>::process(P[i], k); const eT tmp_i = eop_core<eop_type>::process(P[i], k);
const eT tmp_j = eop_core<eop_type>::process(P[j], k); const eT tmp_j = eop_core<eop_type>::process(P[j], k);
out_mem[i] *= tmp_i; out_mem[i] *= tmp_i;
out_mem[j] *= tmp_j; out_mem[j] *= tmp_j;
skipping to change at line 573 skipping to change at line 550
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
const u32 n_rows = x.get_n_rows(); const u32 n_rows = x.get_n_rows();
const u32 n_cols = x.get_n_cols(); const u32 n_cols = x.get_n_cols();
const u32 n_slices = x.get_n_slices(); const u32 n_slices = x.get_n_slices();
arma_debug_assert_same_size(out.n_rows, out.n_cols, out.n_slices, n_rows, n_cols, n_slices, "element-wise division"); arma_debug_assert_same_size(out.n_rows, out.n_cols, out.n_slices, n_rows, n_cols, n_slices, "element-wise division");
eT* out_mem = out.memptr(); eT* out_mem = out.memptr();
const u32 n_elem = out.n_elem;
if(is_generator<eop_type>::value == true) if(is_generator<eop_type>::value == true)
{ {
eT* out_mem = out.memptr();
const u32 n_elem = out.n_elem;
for(u32 i=0; i<n_elem; ++i) for(u32 i=0; i<n_elem; ++i)
{ {
out_mem[i] /= eop_aux::generate<eT,eop_type>(); out_mem[i] /= eop_aux::generate<eT,eop_type>();
} }
} }
else else
{ {
typedef typename ProxyCube<T1>::ea_type ea_type; typedef typename ProxyCube<T1>::ea_type ea_type;
const eT k = x.aux; const eT k = x.aux;
ea_type P = x.P.get_ea(); ea_type P = x.P.get_ea();
eT* out_mem = out.memptr();
const u32 n_elem = out.n_elem;
u32 i,j; u32 i,j;
for(i=0, j=1; j<n_elem; i+=2, j+=2) for(i=0, j=1; j<n_elem; i+=2, j+=2)
{ {
const eT tmp_i = eop_core<eop_type>::process(P[i], k); const eT tmp_i = eop_core<eop_type>::process(P[i], k);
const eT tmp_j = eop_core<eop_type>::process(P[j], k); const eT tmp_j = eop_core<eop_type>::process(P[j], k);
out_mem[i] /= tmp_i; out_mem[i] /= tmp_i;
out_mem[j] /= tmp_j; out_mem[j] /= tmp_j;
skipping to change at line 729 skipping to change at line 702
template<> template<typename eT> arma_hot arma_pure arma_inline eT template<> template<typename eT> arma_hot arma_pure arma_inline eT
eop_core<eop_abs >::process(const eT val, const eT ) { return eop_aux::arma_abs(val); } eop_core<eop_abs >::process(const eT val, const eT ) { return eop_aux::arma_abs(val); }
template<> template<typename eT> arma_hot arma_pure arma_inline eT template<> template<typename eT> arma_hot arma_pure arma_inline eT
eop_core<eop_conj >::process(const eT val, const eT ) { return eop_aux::conj(val); } eop_core<eop_conj >::process(const eT val, const eT ) { return eop_aux::conj(val); }
template<> template<typename eT> arma_hot arma_pure arma_inline eT template<> template<typename eT> arma_hot arma_pure arma_inline eT
eop_core<eop_pow >::process(const eT val, const eT k) { return eop_aux::pow(val, k); } eop_core<eop_pow >::process(const eT val, const eT k) { return eop_aux::pow(val, k); }
template<> template<typename eT> arma_hot arma_pure arma_inline eT
eop_core<eop_floor >::process(const eT val, const eT ) { return
eop_aux::floor(val); }
template<> template<typename eT> arma_hot arma_pure arma_inline eT
eop_core<eop_ceil >::process(const eT val, const eT ) { return
eop_aux::ceil(val); }
//! @} //! @}
 End of changes. 25 change blocks. 
62 lines changed or deleted 43 lines changed or added


 eop_core_proto.hpp   eop_core_proto.hpp 
// Copyright (C) 2010 NICTA (www.nicta.com.au) // Copyright (C) 2010-2011 NICTA (www.nicta.com.au)
// Copyright (C) 2010 Conrad Sanderson // Copyright (C) 2010-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 77 skipping to change at line 77
class eop_cosh : public eop_core<eop_cosh> {}; class eop_cosh : public eop_core<eop_cosh> {};
class eop_sinh : public eop_core<eop_sinh> {}; class eop_sinh : public eop_core<eop_sinh> {};
class eop_tanh : public eop_core<eop_tanh> {}; class eop_tanh : public eop_core<eop_tanh> {};
class eop_acosh : public eop_core<eop_acosh> {}; class eop_acosh : public eop_core<eop_acosh> {};
class eop_asinh : public eop_core<eop_asinh> {}; class eop_asinh : public eop_core<eop_asinh> {};
class eop_atanh : public eop_core<eop_atanh> {}; class eop_atanh : public eop_core<eop_atanh> {};
class eop_eps : public eop_core<eop_eps> {}; class eop_eps : public eop_core<eop_eps> {};
class eop_abs : public eop_core<eop_abs> {}; class eop_abs : public eop_core<eop_abs> {};
class eop_conj : public eop_core<eop_conj> {}; class eop_conj : public eop_core<eop_conj> {};
class eop_pow : public eop_core<eop_pow> {}; class eop_pow : public eop_core<eop_pow> {};
class eop_floor : public eop_core<eop_floor> {};
class eop_ceil : public eop_core<eop_ceil> {};
class eop_randu : public eop_core<eop_randu> {}; class eop_randu : public eop_core<eop_randu> {};
class eop_randn : public eop_core<eop_randn> {}; class eop_randn : public eop_core<eop_randn> {};
class eop_zeros : public eop_core<eop_zeros> {}; class eop_zeros : public eop_core<eop_zeros> {};
class eop_ones_full : public eop_core<eop_ones_full> {}; class eop_ones_full : public eop_core<eop_ones_full> {};
class eop_ones_diag : public eop_core<eop_ones_diag> {}; class eop_ones_diag : public eop_core<eop_ones_diag> {};
template<typename T1> struct is_generator { static const boo l value = false; }; template<typename T1> struct is_generator { static const boo l value = false; };
template<> struct is_generator<eop_randu> { static const boo l value = true; }; template<> struct is_generator<eop_randu> { static const boo l value = true; };
template<> struct is_generator<eop_randn> { static const boo l value = true; }; template<> struct is_generator<eop_randn> { static const boo l value = true; };
template<> struct is_generator<eop_zeros> { static const boo l value = true; }; template<> struct is_generator<eop_zeros> { static const boo l value = true; };
 End of changes. 2 change blocks. 
2 lines changed or deleted 4 lines changed or added


 fn_elem.hpp   fn_elem.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 539 skipping to change at line 539
const eOpCube<T1, eop_pow> const eOpCube<T1, eop_pow>
pow(const BaseCube<typename T1::elem_type,T1>& A, const typename T1::elem_t ype::value_type exponent) pow(const BaseCube<typename T1::elem_type,T1>& A, const typename T1::elem_t ype::value_type exponent)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
return eOpCube<T1, eop_pow>(A.get_ref(), eT(exponent)); return eOpCube<T1, eop_pow>(A.get_ref(), eT(exponent));
} }
//
// floor
template<typename T1>
arma_inline
const eOp<T1, eop_floor>
floor(const Base<typename T1::elem_type,T1>& A)
{
arma_extra_debug_sigprint();
return eOp<T1, eop_floor>(A.get_ref());
}
template<typename T1>
arma_inline
const eOpCube<T1, eop_floor>
floor(const BaseCube<typename T1::elem_type,T1>& A)
{
arma_extra_debug_sigprint();
return eOpCube<T1, eop_floor>(A.get_ref());
}
//
// ceil
template<typename T1>
arma_inline
const eOp<T1, eop_ceil>
ceil(const Base<typename T1::elem_type,T1>& A)
{
arma_extra_debug_sigprint();
return eOp<T1, eop_ceil>(A.get_ref());
}
template<typename T1>
arma_inline
const eOpCube<T1, eop_ceil>
ceil(const BaseCube<typename T1::elem_type,T1>& A)
{
arma_extra_debug_sigprint();
return eOpCube<T1, eop_ceil>(A.get_ref());
}
//! @} //! @}
 End of changes. 2 change blocks. 
2 lines changed or deleted 48 lines changed or added


 fn_misc.hpp   fn_misc.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 111 skipping to change at line 111
else else
{ {
#if defined(ARMA_HAVE_LOG1P) #if defined(ARMA_HAVE_LOG1P)
return (log_a + log1p(std::exp(negdelta))); return (log_a + log1p(std::exp(negdelta)));
#else #else
return (log_a + std::log(1.0 + std::exp(negdelta))); return (log_a + std::log(1.0 + std::exp(negdelta)));
#endif #endif
} }
} }
template<typename eT>
arma_inline
arma_warn_unused
bool
is_finite(const eT x, const typename arma_scalar_only<eT>::result* junk = 0
)
{
arma_ignore(junk);
return arma_isfinite(x);
}
template<typename T1>
inline
arma_warn_unused
bool
is_finite(const Base<typename T1::elem_type,T1>& X)
{
arma_extra_debug_sigprint();
typedef typename T1::elem_type eT;
const unwrap<T1> tmp(X.get_ref());
const Mat<eT>& A = tmp.M;
return A.is_finite();
}
template<typename T1>
inline
arma_warn_unused
bool
is_finite(const BaseCube<typename T1::elem_type,T1>& X)
{
arma_extra_debug_sigprint();
typedef typename T1::elem_type eT;
const unwrap_cube<T1> tmp(X.get_ref());
const Cube<eT>& A = tmp.M;
return A.is_finite();
}
//! @} //! @}
 End of changes. 2 change blocks. 
2 lines changed or deleted 46 lines changed or added


 fn_norm.hpp   fn_norm.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 158 skipping to change at line 158
arma_vec_norm_max(const Proxy<T1>& A) arma_vec_norm_max(const Proxy<T1>& A)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::pod_type T; typedef typename T1::pod_type T;
typedef typename Proxy<T1>::ea_type ea_type; typedef typename Proxy<T1>::ea_type ea_type;
ea_type P = A.get_ea(); ea_type P = A.get_ea();
const u32 N = A.get_n_elem(); const u32 N = A.get_n_elem();
T max_val = std::abs(P[0]); T max_val = (N != 1) ? priv::most_neg<T>() : std::abs(P[0]);
u32 i,j; u32 i,j;
for(i=1, j=2; j<N; i+=2, j+=2) for(i=0, j=1; j<N; i+=2, j+=2)
{ {
const T tmp_i = std::abs(P[i]); const T tmp_i = std::abs(P[i]);
const T tmp_j = std::abs(P[j]); const T tmp_j = std::abs(P[j]);
if(max_val < tmp_i) { max_val = tmp_i; } if(max_val < tmp_i) { max_val = tmp_i; }
if(max_val < tmp_j) { max_val = tmp_j; } if(max_val < tmp_j) { max_val = tmp_j; }
} }
if(i < N) if(i < N)
{ {
skipping to change at line 195 skipping to change at line 195
arma_vec_norm_min(const Proxy<T1>& A) arma_vec_norm_min(const Proxy<T1>& A)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::pod_type T; typedef typename T1::pod_type T;
typedef typename Proxy<T1>::ea_type ea_type; typedef typename Proxy<T1>::ea_type ea_type;
ea_type P = A.get_ea(); ea_type P = A.get_ea();
const u32 N = A.get_n_elem(); const u32 N = A.get_n_elem();
T min_val = std::abs(P[0]); T min_val = (N != 1) ? priv::most_pos<T>() : std::abs(P[0]);
u32 i,j; u32 i,j;
for(i=1, j=2; j<N; i+=2, j+=2) for(i=0, j=1; j<N; i+=2, j+=2)
{ {
const T tmp_i = std::abs(P[i]); const T tmp_i = std::abs(P[i]);
const T tmp_j = std::abs(P[j]); const T tmp_j = std::abs(P[j]);
if(min_val > tmp_i) { min_val = tmp_i; } if(min_val > tmp_i) { min_val = tmp_i; }
if(min_val > tmp_j) { min_val = tmp_j; } if(min_val > tmp_j) { min_val = tmp_j; }
} }
if(i < N) if(i < N)
{ {
skipping to change at line 312 skipping to change at line 312
return arma_vec_norm_1(A); return arma_vec_norm_1(A);
break; break;
case 2: case 2:
return arma_vec_norm_2(A); return arma_vec_norm_2(A);
break; break;
default: default:
{ {
arma_debug_check( (k == 0), "norm(): k must be greater than zero" ); arma_debug_check( (k == 0), "norm(): k must be greater than zero" );
return arma_vec_norm_k(A, k); return arma_vec_norm_k(A, int(k));
} }
} }
} }
else else
{ {
switch(k) switch(k)
{ {
case 1: case 1:
return arma_mat_norm_1(A); return arma_mat_norm_1(A);
break; break;
 End of changes. 6 change blocks. 
7 lines changed or deleted 7 lines changed or added


 format_wrap.hpp   format_wrap.hpp 
skipping to change at line 135 skipping to change at line 135
std::string out; std::string out;
do do
{ {
if(using_local_buffer == false) if(using_local_buffer == false)
{ {
buffer = new char[buffer_size]; buffer = new char[buffer_size];
} }
required_size = arma_snprintf(buffer, buffer_size, X.A.A.c_str(), X .B); required_size = arma_snprintf(buffer, size_t(buffer_size), X.A.A.c_ str(), X.B);
if(required_size < buffer_size) if(required_size < buffer_size)
{ {
if(required_size > 0) if(required_size > 0)
{ {
out = buffer; out = buffer;
} }
} }
else else
{ {
skipping to change at line 185 skipping to change at line 185
std::string out; std::string out;
do do
{ {
if(using_local_buffer == false) if(using_local_buffer == false)
{ {
buffer = new char[buffer_size]; buffer = new char[buffer_size];
} }
required_size = arma_snprintf(buffer, buffer_size, X.A.A.A.c_str(), X.A.B, X.B); required_size = arma_snprintf(buffer, size_t(buffer_size), X.A.A.A. c_str(), X.A.B, X.B);
if(required_size < buffer_size) if(required_size < buffer_size)
{ {
if(required_size > 0) if(required_size > 0)
{ {
out = buffer; out = buffer;
} }
} }
else else
{ {
skipping to change at line 235 skipping to change at line 235
std::string out; std::string out;
do do
{ {
if(using_local_buffer == false) if(using_local_buffer == false)
{ {
buffer = new char[buffer_size]; buffer = new char[buffer_size];
} }
required_size = arma_snprintf(buffer, buffer_size, X.A.A.A.A.c_str( ), X.A.A.B, X.A.B, X.B); required_size = arma_snprintf(buffer, size_t(buffer_size), X.A.A.A. A.c_str(), X.A.A.B, X.A.B, X.B);
if(required_size < buffer_size) if(required_size < buffer_size)
{ {
if(required_size > 0) if(required_size > 0)
{ {
out = buffer; out = buffer;
} }
} }
else else
{ {
skipping to change at line 285 skipping to change at line 285
std::string out; std::string out;
do do
{ {
if(using_local_buffer == false) if(using_local_buffer == false)
{ {
buffer = new char[buffer_size]; buffer = new char[buffer_size];
} }
required_size = arma_snprintf(buffer, buffer_size, X.A.A.A.A.A.c_st r(), X.A.A.A.B, X.A.A.B, X.A.B, X.B); required_size = arma_snprintf(buffer, size_t(buffer_size), X.A.A.A. A.A.c_str(), X.A.A.A.B, X.A.A.B, X.A.B, X.B);
if(required_size < buffer_size) if(required_size < buffer_size)
{ {
if(required_size > 0) if(required_size > 0)
{ {
out = buffer; out = buffer;
} }
} }
else else
{ {
skipping to change at line 335 skipping to change at line 335
std::string out; std::string out;
do do
{ {
if(using_local_buffer == false) if(using_local_buffer == false)
{ {
buffer = new char[buffer_size]; buffer = new char[buffer_size];
} }
required_size = arma_snprintf(buffer, buffer_size, X.A.A.A.A.A.A.c_ str(), X.A.A.A.A.B, X.A.A.A.B, X.A.A.B, X.A.B, X.B); required_size = arma_snprintf(buffer, size_t(buffer_size), X.A.A.A. A.A.A.c_str(), X.A.A.A.A.B, X.A.A.A.B, X.A.A.B, X.A.B, X.B);
if(required_size < buffer_size) if(required_size < buffer_size)
{ {
if(required_size > 0) if(required_size > 0)
{ {
out = buffer; out = buffer;
} }
} }
else else
{ {
skipping to change at line 385 skipping to change at line 385
std::string out; std::string out;
do do
{ {
if(using_local_buffer == false) if(using_local_buffer == false)
{ {
buffer = new char[buffer_size]; buffer = new char[buffer_size];
} }
required_size = arma_snprintf(buffer, buffer_size, X.A.A.A.A.A.A.A. c_str(), X.A.A.A.A.A.B, X.A.A.A.A.B, X.A.A.A.B, X.A.A.B, X.A.B, X.B); required_size = arma_snprintf(buffer, size_t(buffer_size), X.A.A.A. A.A.A.A.c_str(), X.A.A.A.A.A.B, X.A.A.A.A.B, X.A.A.A.B, X.A.A.B, X.A.B, X.B );
if(required_size < buffer_size) if(required_size < buffer_size)
{ {
if(required_size > 0) if(required_size > 0)
{ {
out = buffer; out = buffer;
} }
} }
else else
{ {
 End of changes. 6 change blocks. 
6 lines changed or deleted 6 lines changed or added


 op_max_meat.hpp   op_max_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 25 skipping to change at line 25
//! find the maximum value in an array //! find the maximum value in an array
template<typename eT> template<typename eT>
arma_pure arma_pure
inline inline
eT eT
op_max::direct_max(const eT* const X, const u32 n_elem) op_max::direct_max(const eT* const X, const u32 n_elem)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
eT max_val = X[0]; eT max_val = (n_elem != 1) ? priv::most_neg<eT>() : X[0];
u32 i,j; u32 i,j;
for(i=1, j=2; j<n_elem; i+=2, j+=2) for(i=0, j=1; j<n_elem; i+=2, j+=2)
{ {
const eT X_i = X[i]; const eT X_i = X[i];
const eT X_j = X[j];
if(X_i > max_val) if(X_i > max_val)
{ {
max_val = X_i; max_val = X_i;
} }
const eT X_j = X[j];
if(X_j > max_val) if(X_j > max_val)
{ {
max_val = X_j; max_val = X_j;
} }
} }
if(i < n_elem) if(i < n_elem)
{ {
const eT X_i = X[i]; const eT X_i = X[i];
skipping to change at line 68 skipping to change at line 67
//! find the maximum value in a subview //! find the maximum value in a subview
template<typename eT> template<typename eT>
inline inline
eT eT
op_max::direct_max(const subview<eT>& X) op_max::direct_max(const subview<eT>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
const u32 X_n_elem = X.n_elem; const u32 X_n_elem = X.n_elem;
eT max_val = X[0]; eT max_val = (X_n_elem != 1) ? priv::most_neg<eT>() : X[0];
for(u32 i=1; i<X_n_elem; ++i) for(u32 i=0; i<X_n_elem; ++i)
{ {
eT tmp_val = X[i]; eT tmp_val = X[i];
if(tmp_val > max_val) if(tmp_val > max_val)
{ {
max_val = tmp_val; max_val = tmp_val;
} }
} }
return max_val; return max_val;
skipping to change at line 92 skipping to change at line 91
//! find the maximum value in a diagview //! find the maximum value in a diagview
template<typename eT> template<typename eT>
inline inline
eT eT
op_max::direct_max(const diagview<eT>& X) op_max::direct_max(const diagview<eT>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
const u32 X_n_elem = X.n_elem; const u32 X_n_elem = X.n_elem;
eT max_val = X[0]; eT max_val = (X_n_elem != 1) ? priv::most_neg<eT>() : X[0];
for(u32 i=1; i<X_n_elem; ++i) for(u32 i=0; i<X_n_elem; ++i)
{ {
eT tmp_val = X[i]; eT tmp_val = X[i];
if(tmp_val > max_val) if(tmp_val > max_val)
{ {
max_val = tmp_val; max_val = tmp_val;
} }
} }
return max_val; return max_val;
skipping to change at line 151 skipping to change at line 150
} }
else else
if(dim == 1) if(dim == 1)
{ {
arma_extra_debug_print("op_max::apply(), dim = 1"); arma_extra_debug_print("op_max::apply(), dim = 1");
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 max_val = X.at(row,0); eT max_val = (X_n_cols != 1) ? priv::most_neg<eT>() : X.at(row,0);
for(u32 col=1; col<X_n_cols; ++col) for(u32 col=0; col<X_n_cols; ++col)
{ {
const eT tmp_val = X.at(row,col); const eT tmp_val = X.at(row,col);
if(tmp_val > max_val) if(tmp_val > max_val)
{ {
max_val = tmp_val; max_val = tmp_val;
} }
} }
out[row] = max_val; out[row] = max_val;
} }
} }
} }
//! Find the maximum value in an array (version for complex numbers) //! Find the maximum value in an array (version for complex numbers)
template<typename T> template<typename T>
inline inline
std::complex<T> std::complex<T>
op_max::direct_max(const std::complex<T>* const X, const u32 n_elem) op_max::direct_max(const std::complex<T>* const X, const u32 n_elem)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
u32 index = 0; u32 index = 0;
T max_val = std::abs(X[index]); T max_val = (n_elem != 1) ? priv::most_neg<T>() : std::abs(X[0]);
for(u32 i=1; i<n_elem; ++i) for(u32 i=0; i<n_elem; ++i)
{ {
const T tmp_val = std::abs(X[i]); const T tmp_val = std::abs(X[i]);
if(tmp_val > max_val) if(tmp_val > max_val)
{ {
max_val = tmp_val; max_val = tmp_val;
index = i; index = i;
} }
} }
skipping to change at line 206 skipping to change at line 202
//! Find the maximum value in a subview (version for complex numbers) //! Find the maximum value in a subview (version for complex numbers)
template<typename T> template<typename T>
inline inline
std::complex<T> std::complex<T>
op_max::direct_max(const subview< std::complex<T> >& X) op_max::direct_max(const subview< std::complex<T> >& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
const u32 X_n_elem = X.n_elem; const u32 X_n_elem = X.n_elem;
u32 index = 0; u32 index = 0;
T max_val = std::abs(X[index]); T max_val = (X_n_elem != 1) ? priv::most_neg<T>() : std::abs(X[0 ]);
for(u32 i=1; i<X_n_elem; ++i) for(u32 i=0; i<X_n_elem; ++i)
{ {
const T tmp_val = std::abs(X[i]); const T tmp_val = std::abs(X[i]);
if(tmp_val > max_val) if(tmp_val > max_val)
{ {
max_val = tmp_val; max_val = tmp_val;
index = i; index = i;
} }
} }
skipping to change at line 232 skipping to change at line 228
//! Find the maximum value in a diagview (version for complex numbers) //! Find the maximum value in a diagview (version for complex numbers)
template<typename T> template<typename T>
inline inline
std::complex<T> std::complex<T>
op_max::direct_max(const diagview< std::complex<T> >& X) op_max::direct_max(const diagview< std::complex<T> >& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
const u32 X_n_elem = X.n_elem; const u32 X_n_elem = X.n_elem;
u32 index = 0; u32 index = 0;
T max_val = std::abs(X[index]); T max_val = (X_n_elem != 1) ? priv::most_neg<T>() : std::abs(X[0 ]);
for(u32 i=1; i<X_n_elem; ++i) for(u32 i=0; i<X_n_elem; ++i)
{ {
const T tmp_val = std::abs(X[i]); const T tmp_val = std::abs(X[i]);
if(tmp_val > max_val) if(tmp_val > max_val)
{ {
max_val = tmp_val; max_val = tmp_val;
index = i; index = i;
} }
} }
skipping to change at line 289 skipping to change at line 285
else else
if(dim == 1) // row-wise max if(dim == 1) // row-wise max
{ {
arma_extra_debug_print("op_max::apply(), dim = 1"); arma_extra_debug_print("op_max::apply(), dim = 1");
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)
{ {
u32 index = 0; u32 index = 0;
T max_val = std::abs(X.at(row,index)); T max_val = (X_n_cols != 1) ? priv::most_neg<T>() : std::abs(X.at(r ow,0));
for(u32 col=1; col<X.n_cols; ++col) for(u32 col=0; col<X_n_cols; ++col)
{ {
const T tmp_val = std::abs(X.at(row,col)); const T tmp_val = std::abs(X.at(row,col));
if(tmp_val > max_val) if(tmp_val > max_val)
{ {
max_val = tmp_val; max_val = tmp_val;
index = col; index = col;
} }
} }
 End of changes. 22 change blocks. 
23 lines changed or deleted 19 lines changed or added


 op_mean_meat.hpp   op_mean_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
//! find the mean value of an array //! find the mean value of an array
template<typename eT> template<typename eT>
arma_pure arma_pure
inline inline
eT eT
op_mean::direct_mean(const eT* const X, const u32 n_elem) op_mean::direct_mean(const eT* const X, const u32 n_elem)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
eT val = eT(0); typedef typename get_pod_type<eT>::result T;
u32 i,j; return arrayops::accumulate(X, n_elem) / T(n_elem);
for(i=0, j=1; j<n_elem; i+=2, j+=2)
{
val += X[i];
val += X[j];
}
if(i < n_elem)
{
val += X[i];
}
return val / eT(n_elem);
} }
//! find the mean value of a subview //! find the mean value of a subview
template<typename eT> template<typename eT>
inline inline
eT eT
op_mean::direct_mean(const subview<eT>& X) op_mean::direct_mean(const subview<eT>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename get_pod_type<eT>::result T;
const u32 X_n_elem = X.n_elem; const u32 X_n_elem = X.n_elem;
eT val = eT(0); eT val = eT(0);
for(u32 i=0; i<X_n_elem; ++i) for(u32 i=0; i<X_n_elem; ++i)
{ {
val += X[i]; val += X[i];
} }
return val / eT(X_n_elem); return val / T(X_n_elem);
} }
//! find the mean value of a diagview //! find the mean value of a diagview
template<typename eT> template<typename eT>
inline inline
eT eT
op_mean::direct_mean(const diagview<eT>& X) op_mean::direct_mean(const diagview<eT>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename get_pod_type<eT>::result T;
const u32 X_n_elem = X.n_elem; const u32 X_n_elem = X.n_elem;
eT val = eT(0); eT val = eT(0);
for(u32 i=0; i<X_n_elem; ++i) for(u32 i=0; i<X_n_elem; ++i)
{ {
val += X[i]; val += X[i];
} }
return val / eT(X_n_elem); return val / T(X_n_elem);
} }
//! \brief //! \brief
//! For each row or for each column, find the mean value. //! For each row or for each column, find the mean value.
//! The result is stored in a dense matrix that has either one column or on e row. //! The result is stored in a dense matrix that has either one column or on e row.
//! The dimension, for which the means are found, is set via the mean() fun ction. //! The dimension, for which the means are found, is set via the mean() fun ction.
template<typename T1> template<typename T1>
inline inline
void void
op_mean::apply(Mat<typename T1::elem_type>& out, const Op<T1,op_mean>& in) op_mean::apply(Mat<typename T1::elem_type>& out, const Op<T1,op_mean>& in)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
typedef typename get_pod_type<eT>::result T;
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 == 0), "mean(): given matrix has no elements" ); arma_debug_check( (X.n_elem == 0), "mean(): given matrix has no elements" );
const u32 dim = in.aux_u32_a; const u32 dim = in.aux_u32_a;
arma_debug_check( (dim > 1), "mean(): incorrect usage. dim must be 0 or 1 "); arma_debug_check( (dim > 1), "mean(): incorrect usage. dim must be 0 or 1 ");
const u32 X_n_rows = X.n_rows; const u32 X_n_rows = X.n_rows;
skipping to change at line 132 skipping to change at line 124
for(u32 row=0; row<X_n_rows; ++row) for(u32 row=0; row<X_n_rows; ++row)
{ {
eT val = eT(0); eT val = eT(0);
for(u32 col=0; col<X_n_cols; ++col) for(u32 col=0; col<X_n_cols; ++col)
{ {
val += X.at(row,col); val += X.at(row,col);
} }
out[row] = val / eT(X_n_cols); out[row] = val / T(X_n_cols);
} }
} }
} }
//! @} //! @}
 End of changes. 11 change blocks. 
24 lines changed or deleted 13 lines changed or added


 op_min_meat.hpp   op_min_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 25 skipping to change at line 25
//! Find the minimum value in an array //! Find the minimum value in an array
template<typename eT> template<typename eT>
arma_pure arma_pure
inline inline
eT eT
op_min::direct_min(const eT* const X, const u32 n_elem) op_min::direct_min(const eT* const X, const u32 n_elem)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
eT min_val = X[0]; eT min_val = (n_elem != 1) ? priv::most_pos<eT>() : X[0];
u32 i,j; u32 i,j;
for(i=1, j=2; j<n_elem; i+=2, j+=2) for(i=0, j=1; j<n_elem; i+=2, j+=2)
{ {
const eT X_i = X[i]; const eT X_i = X[i];
const eT X_j = X[j];
if(X_i < min_val) if(X_i < min_val)
{ {
min_val = X_i; min_val = X_i;
} }
const eT X_j = X[j];
if(X_j < min_val) if(X_j < min_val)
{ {
min_val = X_j; min_val = X_j;
} }
} }
if(i < n_elem) if(i < n_elem)
{ {
const eT X_i = X[i]; const eT X_i = X[i];
skipping to change at line 68 skipping to change at line 67
//! find the minimum value in a subview //! find the minimum value in a subview
template<typename eT> template<typename eT>
inline inline
eT eT
op_min::direct_min(const subview<eT>& X) op_min::direct_min(const subview<eT>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
const u32 X_n_elem = X.n_elem; const u32 X_n_elem = X.n_elem;
eT min_val = X[0];
for(u32 i=1; i<X_n_elem; ++i) eT min_val = (X_n_elem != 1) ? priv::most_pos<eT>() : X[0];
for(u32 i=0; i<X_n_elem; ++i)
{ {
eT tmp_val = X[i]; eT tmp_val = X[i];
if(tmp_val < min_val) if(tmp_val < min_val)
{ {
min_val = tmp_val; min_val = tmp_val;
} }
} }
return min_val; return min_val;
skipping to change at line 92 skipping to change at line 92
//! find the minimum value in a diagview //! find the minimum value in a diagview
template<typename eT> template<typename eT>
inline inline
eT eT
op_min::direct_min(const diagview<eT>& X) op_min::direct_min(const diagview<eT>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
const u32 X_n_elem = X.n_elem; const u32 X_n_elem = X.n_elem;
eT min_val = X[0];
for(u32 i=1; i<X_n_elem; ++i) eT min_val = (X_n_elem != 1) ? priv::most_pos<eT>() : X[0];
for(u32 i=0; i<X_n_elem; ++i)
{ {
eT tmp_val = X[i]; eT tmp_val = X[i];
if(tmp_val < min_val) if(tmp_val < min_val)
{ {
min_val = tmp_val; min_val = tmp_val;
} }
} }
return min_val; return min_val;
skipping to change at line 129 skipping to change at line 130
const Mat<eT>& X = tmp.M; const Mat<eT>& X = tmp.M;
arma_debug_check( (X.n_elem == 0), "min(): given matrix has no elements" ); arma_debug_check( (X.n_elem == 0), "min(): given matrix has no elements" );
const u32 dim = in.aux_u32_a; const u32 dim = in.aux_u32_a;
arma_debug_check( (dim > 1), "min(): incorrect usage. dim must be 0 or 1" ); arma_debug_check( (dim > 1), "min(): incorrect usage. dim must be 0 or 1" );
const u32 X_n_rows = X.n_rows; const u32 X_n_rows = X.n_rows;
const u32 X_n_cols = X.n_cols; const u32 X_n_cols = X.n_cols;
if(dim == 0) // column-wise min if(dim == 0) // min in each column
{ {
arma_extra_debug_print("op_min::apply(), dim = 0"); arma_extra_debug_print("op_min::apply(), dim = 0");
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)
{ {
out[col] = op_min::direct_min( X.colptr(col), X_n_rows ); out[col] = op_min::direct_min( X.colptr(col), X_n_rows );
} }
} }
else else
if(dim == 1) // row-wise min if(dim == 1) // min in each row
{ {
arma_extra_debug_print("op_min::apply(), dim = 1"); arma_extra_debug_print("op_min::apply(), dim = 1");
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 min_val = X.at(row,0); eT min_val = (X_n_cols != 1) ? priv::most_pos<eT>() : X.at(row,0);
for(u32 col=1; col<X_n_cols; ++col) for(u32 col=0; col<X_n_cols; ++col)
{ {
const eT tmp_val = X.at(row,col); const eT tmp_val = X.at(row,col);
if(tmp_val < min_val) if(tmp_val < min_val)
{ {
min_val = tmp_val; min_val = tmp_val;
} }
} }
out[row] = min_val; out[row] = min_val;
} }
} }
} }
//! Find the minimum value in an array (version for complex numbers) //! Find the minimum value in an array (version for complex numbers)
template<typename T> template<typename T>
inline inline
std::complex<T> std::complex<T>
op_min::direct_min(const std::complex<T>* const X, const u32 n_elem) op_min::direct_min(const std::complex<T>* const X, const u32 n_elem)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
u32 index = 0; u32 index = 0;
T min_val = std::abs(X[index]); T min_val = (n_elem != 1) ? priv::most_pos<T>() : std::abs(X[0]);
for(u32 i=1; i<n_elem; ++i) for(u32 i=0; i<n_elem; ++i)
{ {
const T tmp_val = std::abs(X[i]); const T tmp_val = std::abs(X[i]);
if(tmp_val < min_val) if(tmp_val < min_val)
{ {
min_val = tmp_val; min_val = tmp_val;
index = i; index = i;
} }
} }
skipping to change at line 204 skipping to change at line 204
//! Find the minimum value in a subview (version for complex numbers) //! Find the minimum value in a subview (version for complex numbers)
template<typename T> template<typename T>
inline inline
std::complex<T> std::complex<T>
op_min::direct_min(const subview< std::complex<T> >& X) op_min::direct_min(const subview< std::complex<T> >& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
const u32 X_n_elem = X.n_elem; const u32 X_n_elem = X.n_elem;
u32 index = 0; u32 index = 0;
T min_val = std::abs(X[index]); T min_val = (X_n_elem != 1) ? priv::most_pos<T>() : std::abs(X[0 ]);
for(u32 i=1; i<X_n_elem; ++i) for(u32 i=0; i<X_n_elem; ++i)
{ {
const T tmp_val = std::abs(X[i]); const T tmp_val = std::abs(X[i]);
if(tmp_val < min_val) if(tmp_val < min_val)
{ {
min_val = tmp_val; min_val = tmp_val;
index = i; index = i;
} }
} }
skipping to change at line 230 skipping to change at line 230
//! Find the minimum value in a diagview (version for complex numbers) //! Find the minimum value in a diagview (version for complex numbers)
template<typename T> template<typename T>
inline inline
std::complex<T> std::complex<T>
op_min::direct_min(const diagview< std::complex<T> >& X) op_min::direct_min(const diagview< std::complex<T> >& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
const u32 X_n_elem = X.n_elem; const u32 X_n_elem = X.n_elem;
u32 index = 0; u32 index = 0;
T min_val = std::abs(X[index]); T min_val = (X_n_elem != 1) ? priv::most_pos<T>() : std::abs(X[0 ]);
for(u32 i=1; i<X_n_elem; ++i) for(u32 i=0; i<X_n_elem; ++i)
{ {
const T tmp_val = std::abs(X[i]); const T tmp_val = std::abs(X[i]);
if(tmp_val < min_val) if(tmp_val < min_val)
{ {
min_val = tmp_val; min_val = tmp_val;
index = i; index = i;
} }
} }
skipping to change at line 287 skipping to change at line 287
else else
if(dim == 1) // row-wise min if(dim == 1) // row-wise min
{ {
arma_extra_debug_print("op_min::apply(), dim = 1"); arma_extra_debug_print("op_min::apply(), dim = 1");
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)
{ {
u32 index = 0; u32 index = 0;
T min_val = std::abs(X.at(row,index)); T min_val = (X_n_cols != 1) ? priv::most_pos<T>() : std::abs(X.at(r ow,0));
for(u32 col=1; col<X.n_cols; ++col) for(u32 col=0; col<X_n_cols; ++col)
{ {
const T tmp_val = std::abs(X.at(row,col)); const T tmp_val = std::abs(X.at(row,col));
if(tmp_val < min_val) if(tmp_val < min_val)
{ {
min_val = tmp_val; min_val = tmp_val;
index = col; index = col;
} }
} }
 End of changes. 22 change blocks. 
23 lines changed or deleted 23 lines changed or added


 op_var_meat.hpp   op_var_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 24 skipping to change at line 24
//! @{ //! @{
//! find the variance of an array //! find the variance of an array
template<typename eT> template<typename eT>
inline inline
eT eT
op_var::direct_var(const eT* const X, const u32 n_elem, const u32 norm_type ) op_var::direct_var(const eT* const X, const u32 n_elem, const u32 norm_type )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
eT acc1 = eT(0);
for(u32 i=0; i<n_elem; ++i)
{
acc1 += X[i];
}
const eT div_val = (n_elem > 0) ? eT(n_elem) : eT(1); const eT div_val = (n_elem > 0) ? eT(n_elem) : eT(1);
acc1 /= div_val;
const eT acc1 = arrayops::accumulate(X,n_elem) / div_val;
eT acc2 = eT(0); eT acc2 = eT(0);
eT acc3 = eT(0); eT acc3 = eT(0);
for(u32 i=0; i<n_elem; ++i) for(u32 i=0; i<n_elem; ++i)
{ {
const eT tmp = acc1 - X[i]; const eT tmp = acc1 - X[i];
acc2 += tmp*tmp; acc2 += tmp*tmp;
acc3 += tmp; acc3 += tmp;
skipping to change at line 61 skipping to change at line 55
//! find the variance of an array (version for complex numbers) //! find the variance of an array (version for complex numbers)
template<typename T> template<typename T>
inline inline
T T
op_var::direct_var(const std::complex<T>* const X, const u32 n_elem, const u32 norm_type) op_var::direct_var(const std::complex<T>* const X, const u32 n_elem, const u32 norm_type)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename std::complex<T> eT; typedef typename std::complex<T> eT;
eT acc1 = eT(0);
for(u32 i=0; i<n_elem; ++i)
{
acc1 += X[i];
}
const T div_val = (n_elem > 0) ? T(n_elem) : T(1); const T div_val = (n_elem > 0) ? T(n_elem) : T(1);
acc1 /= div_val;
const eT acc1 = arrayops::accumulate(X,n_elem) / div_val;
T acc2 = T(0); T acc2 = T(0);
eT acc3 = eT(0); eT acc3 = eT(0);
for(u32 i=0; i<n_elem; ++i) for(u32 i=0; i<n_elem; ++i)
{ {
const eT tmp = acc1 - X[i]; const eT tmp = acc1 - X[i];
acc2 += std::norm(tmp); acc2 += std::norm(tmp);
acc3 += tmp; acc3 += tmp;
skipping to change at line 193 skipping to change at line 181
for(u32 row=0; row<n_rows; ++row) for(u32 row=0; row<n_rows; ++row)
{ {
for(u32 col=0; col<n_cols; ++col) for(u32 col=0; col<n_cols; ++col)
{ {
tmp_mem[col] = X.at(row,col); tmp_mem[col] = X.at(row,col);
} }
out[row] = op_var::direct_var(tmp_mem, n_cols, norm_type); out[row] = op_var::direct_var(tmp_mem, n_cols, norm_type);
} }
} }
} }
//! @} //! @}
 End of changes. 7 change blocks. 
20 lines changed or deleted 6 lines changed or added


 restrictors.hpp   restrictors.hpp 
// Copyright (C) 2010 NICTA (www.nicta.com.au) // Copyright (C) 2010-2011 NICTA (www.nicta.com.au)
// Copyright (C) 2010 Conrad Sanderson // Copyright (C) 2010-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 86 skipping to change at line 86
template<> struct arma_float_only<double> { typedef double result; }; template<> struct arma_float_only<double> { typedef double result; };
template<typename T> struct arma_float_or_cx_only { }; template<typename T> struct arma_float_or_cx_only { };
template<> struct arma_float_or_cx_only< float > { typedef f loat result; }; template<> struct arma_float_or_cx_only< float > { typedef f loat result; };
template<> struct arma_float_or_cx_only< double > { typedef d ouble result; }; template<> struct arma_float_or_cx_only< double > { typedef d ouble result; };
template<> struct arma_float_or_cx_only< std::complex<float> > { typedef s td::complex<float> result; }; template<> struct arma_float_or_cx_only< std::complex<float> > { typedef s td::complex<float> result; };
template<> struct arma_float_or_cx_only< std::complex<double> > { typedef s td::complex<double> result; }; template<> struct arma_float_or_cx_only< std::complex<double> > { typedef s td::complex<double> result; };
template<typename T> struct arma_cx_only { }; template<typename T> struct arma_cx_only { };
template<typename T> struct arma_cx_only< std::complex<T> > { typedef std::
complex<T> result; }; template<> struct arma_cx_only< std::complex<float> > { typedef std::compl
ex<float> result; };
template<> struct arma_cx_only< std::complex<double> > { typedef std::compl
ex<double> result; };
template<typename T> struct arma_not_cx { typedef T resu lt; }; template<typename T> struct arma_not_cx { typedef T resu lt; };
template<typename T> struct arma_not_cx< std::complex<T> > { }; template<typename T> struct arma_not_cx< std::complex<T> > { };
template<typename T> struct arma_blas_type_only { }; template<typename T> struct arma_blas_type_only { };
template<> struct arma_blas_type_only< float > { typedef flo at result; }; template<> struct arma_blas_type_only< float > { typedef flo at result; };
template<> struct arma_blas_type_only< double > { typedef dou ble result; }; template<> struct arma_blas_type_only< double > { typedef dou ble result; };
template<> struct arma_blas_type_only< std::complex<float> > { typedef std ::complex<float> result; }; template<> struct arma_blas_type_only< std::complex<float> > { typedef std ::complex<float> result; };
template<> struct arma_blas_type_only< std::complex<double> > { typedef std ::complex<double> result; }; template<> struct arma_blas_type_only< std::complex<double> > { typedef std ::complex<double> result; };
 End of changes. 2 change blocks. 
4 lines changed or deleted 7 lines changed or added


 traits.hpp   traits.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 537 skipping to change at line 537
template<> struct is_signed<unsigned short> { static const bool value = fal se; }; template<> struct is_signed<unsigned short> { static const bool value = fal se; };
template<> struct is_signed<unsigned int > { static const bool value = fal se; }; template<> struct is_signed<unsigned int > { static const bool value = fal se; };
template<> struct is_signed<unsigned long > { static const bool value = fal se; }; template<> struct is_signed<unsigned long > { static const bool value = fal se; };
template<typename T> template<typename T>
struct is_non_integral struct is_non_integral
{ {
static const bool value = (T(1.0) != T(1.1)); static const bool value = (T(1.0) != T(1.1));
}; };
template<> struct is_non_integral< float > { static const bo
ol value = true; };
template<> struct is_non_integral< double > { static const bo
ol value = true; };
template<> struct is_non_integral< std::complex<float> > { static const bo
ol value = true; };
template<> struct is_non_integral< std::complex<double> > { static const bo
ol value = true; };
template<> struct is_non_integral< char > { static const bool value
= false; };
template<> struct is_non_integral< short> { static const bool value
= false; };
template<> struct is_non_integral< int > { static const bool value
= false; };
template<> struct is_non_integral< long > { static const bool value
= false; };
template<> struct is_non_integral<unsigned char > { static const bool value
= false; };
template<> struct is_non_integral<unsigned short> { static const bool value
= false; };
template<> struct is_non_integral<unsigned int > { static const bool value
= false; };
template<> struct is_non_integral<unsigned long > { static const bool value
= false; };
// //
class arma_junk_class; class arma_junk_class;
template<typename T1, typename T2> template<typename T1, typename T2>
struct force_different_type struct force_different_type
{ {
typedef T1 T1_result; typedef T1 T1_result;
typedef T2 T2_result; typedef T2 T2_result;
}; };
 End of changes. 2 change blocks. 
2 lines changed or deleted 29 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/