Mat_meat.hpp   Mat_meat.hpp 
skipping to change at line 2394 skipping to change at line 2394
//! postfix -- (must not return the object by reference) //! postfix -- (must not return the object by reference)
template<typename eT> template<typename eT>
arma_inline arma_inline
void void
Mat<eT>::operator--(int) Mat<eT>::operator--(int)
{ {
Mat_aux::postfix_mm(*this); Mat_aux::postfix_mm(*this);
} }
//! returns true if the matrix has no elements
template<typename eT>
arma_inline
arma_warn_unused
bool
Mat<eT>::is_empty() const
{
return (n_elem == 0);
}
//! returns true if the object can be interpreted as a column or row vector //! returns true if the object can be interpreted as a column or row vector
template<typename eT> template<typename eT>
arma_inline arma_inline
arma_warn_unused arma_warn_unused
bool bool
Mat<eT>::is_vec() const Mat<eT>::is_vec() const
{ {
return ( (n_rows == 1) || (n_cols == 1) ); return ( (n_rows == 1) || (n_cols == 1) );
} }
skipping to change at line 2416 skipping to change at line 2426
arma_inline arma_inline
arma_warn_unused arma_warn_unused
bool bool
Mat<eT>::is_square() const Mat<eT>::is_square() const
{ {
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>
arma_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; const u32 N = n_elem;
const eT* ptr = memptr(); const eT* ptr = memptr();
u32 i,j; u32 i,j;
for(i=0, j=1; j<N; i+=2, j+=2) for(i=0, j=1; j<N; i+=2, j+=2)
{ {
const eT ptr_i = ptr[i]; const eT val_i = ptr[i];
const eT ptr_j = ptr[j]; const eT val_j = ptr[j];
if( (arma_isfinite(ptr_i) == false) || (arma_isfinite(ptr_j) == false)) if( (arma_isfinite(val_i) == false) || (arma_isfinite(val_j) == false) )
{ {
return false; return false;
} }
} }
if(i<N) if(i<N)
{ {
if(arma_isfinite(ptr[i]) == false) if(arma_isfinite(ptr[i]) == false)
{ {
return false; return false;
} }
} }
return true; return true;
} }
//! returns true if the matrix has no elements
template<typename eT>
arma_inline
arma_warn_unused
bool
Mat<eT>::is_empty() const
{
return (n_elem == 0);
}
//! 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. 5 change blocks. 
14 lines changed or deleted 14 lines changed or added


 Mat_proto.hpp   Mat_proto.hpp 
skipping to change at line 214 skipping to change at line 214
arma_inline arma_warn_unused eT at (const u32 in_row, const u32 in_col) const; arma_inline arma_warn_unused eT at (const u32 in_row, const u32 in_col) const;
arma_inline arma_warn_unused eT& operator() (const u32 in_row, const u32 in_col); arma_inline arma_warn_unused eT& operator() (const u32 in_row, const u32 in_col);
arma_inline arma_warn_unused eT operator() (const u32 in_row, const u32 in_col) const; arma_inline arma_warn_unused eT operator() (const u32 in_row, const u32 in_col) const;
arma_inline const Mat& operator++(); arma_inline const Mat& operator++();
arma_inline void operator++(int); arma_inline void operator++(int);
arma_inline const Mat& operator--(); arma_inline const Mat& operator--();
arma_inline void operator--(int); arma_inline void operator--(int);
arma_inline arma_warn_unused bool is_empty() const;
arma_inline arma_warn_unused bool is_vec() const; arma_inline arma_warn_unused bool is_vec() const;
arma_inline arma_warn_unused bool is_square() const; arma_inline arma_warn_unused bool is_square() const;
arma_inline arma_warn_unused bool is_finite() const; inline arma_warn_unused bool is_finite() const;
arma_inline arma_warn_unused bool is_empty() const;
arma_inline arma_warn_unused bool in_range(const u32 i) const; arma_inline arma_warn_unused bool in_range(const u32 i) const;
arma_inline arma_warn_unused bool in_range(const u32 in_row, const u32 in _col) const; arma_inline arma_warn_unused bool in_range(const u32 in_row, const u32 in _col) const;
arma_inline arma_warn_unused eT* colptr(const u32 in_col); arma_inline arma_warn_unused eT* colptr(const u32 in_col);
arma_inline arma_warn_unused const eT* colptr(const u32 in_col) const; arma_inline arma_warn_unused const eT* colptr(const u32 in_col) const;
arma_inline arma_warn_unused eT* memptr(); arma_inline arma_warn_unused eT* memptr();
arma_inline arma_warn_unused const eT* memptr() const; arma_inline arma_warn_unused const eT* memptr() const;
 End of changes. 2 change blocks. 
2 lines changed or deleted 2 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 0 #define ARMA_VERSION_MAJOR 0
#define ARMA_VERSION_MINOR 9 #define ARMA_VERSION_MINOR 9
#define ARMA_VERSION_PATCH 90 #define ARMA_VERSION_PATCH 92
#define ARMA_VERSION_NAME "Water Dragon" #define ARMA_VERSION_NAME "Wall Street Gangster"
// http://en.wikipedia.org/wiki/Australian_Water_Dragon
struct arma_version struct arma_version
{ {
static const unsigned int major = ARMA_VERSION_MAJOR; static const unsigned int major = ARMA_VERSION_MAJOR;
static const unsigned int minor = ARMA_VERSION_MINOR; static const unsigned int minor = ARMA_VERSION_MINOR;
static const unsigned int patch = ARMA_VERSION_PATCH; static const unsigned int patch = ARMA_VERSION_PATCH;
static static
inline inline
std::string std::string
 End of changes. 1 change blocks. 
3 lines changed or deleted 2 lines changed or added


 blas_proto.hpp   blas_proto.hpp 
skipping to change at line 20 skipping to change at line 20
// of the License or (at your option) any later version. // of the License or (at your option) any later version.
// (see http://www.opensource.org/licenses for more info) // (see http://www.opensource.org/licenses for more info)
#ifdef ARMA_USE_BLAS #ifdef ARMA_USE_BLAS
//! \namespace blas namespace for BLAS functions //! \namespace blas namespace for BLAS functions
namespace blas namespace blas
{ {
extern "C" extern "C"
{ {
float arma_fortran(sdot)(const blas_int* n, const float* x, const bla float arma_fortran(sdot)(blas_int* n, const float* x, blas_int* incx,
s_int* incx, const float* y, const blas_int* incy); const float* y, blas_int* incy);
double arma_fortran(ddot)(const blas_int* n, const double* x, const bla double arma_fortran(ddot)(blas_int* n, const double* x, blas_int* incx,
s_int* incx, const double* y, const blas_int* incy); const double* y, blas_int* incy);
void arma_fortran(sgemv)(const char* transA, const blas_int* m, const b las_int* n, const float* alpha, const float* A, const blas_int* ldA, cons t float* x, const blas_int* incx, const float* beta, float* y, const bla s_int* incy); void arma_fortran(sgemv)(const char* transA, const blas_int* m, const b las_int* n, const float* alpha, const float* A, const blas_int* ldA, cons t float* x, const blas_int* incx, const float* beta, float* y, const bla s_int* incy);
void arma_fortran(dgemv)(const char* transA, const blas_int* m, const b las_int* n, const double* alpha, const double* A, const blas_int* ldA, cons t double* x, const blas_int* incx, const double* beta, double* y, const bla s_int* incy); void arma_fortran(dgemv)(const char* transA, const blas_int* m, const b las_int* n, const double* alpha, const double* A, const blas_int* ldA, cons t double* x, const blas_int* incx, const double* beta, double* y, const bla s_int* incy);
void arma_fortran(cgemv)(const char* transA, const blas_int* m, const b las_int* n, const void* alpha, const void* A, const blas_int* ldA, cons t void* x, const blas_int* incx, const void* beta, void* y, const bla s_int* incy); void arma_fortran(cgemv)(const char* transA, const blas_int* m, const b las_int* n, const void* alpha, const void* A, const blas_int* ldA, cons t void* x, const blas_int* incx, const void* beta, void* y, const bla s_int* incy);
void arma_fortran(zgemv)(const char* transA, const blas_int* m, const b las_int* n, const void* alpha, const void* A, const blas_int* ldA, cons t void* x, const blas_int* incx, const void* beta, void* y, const bla s_int* incy); void arma_fortran(zgemv)(const char* transA, const blas_int* m, const b las_int* n, const void* alpha, const void* A, const blas_int* ldA, cons t void* x, const blas_int* incx, const void* beta, void* y, const bla s_int* incy);
void arma_fortran(sgemm)(const char* transA, const char* transB, const blas_int* m, const blas_int* n, const blas_int* k, const float* alpha, con st float* A, const blas_int* ldA, const float* B, const blas_int* ldB, co nst float* beta, float* C, const blas_int* ldC); void arma_fortran(sgemm)(const char* transA, const char* transB, const blas_int* m, const blas_int* n, const blas_int* k, const float* alpha, con st float* A, const blas_int* ldA, const float* B, const blas_int* ldB, co nst float* beta, float* C, const blas_int* ldC);
void arma_fortran(dgemm)(const char* transA, const char* transB, const blas_int* m, const blas_int* n, const blas_int* k, const double* alpha, con st double* A, const blas_int* ldA, const double* B, const blas_int* ldB, co nst double* beta, double* C, const blas_int* ldC); void arma_fortran(dgemm)(const char* transA, const char* transB, const blas_int* m, const blas_int* n, const blas_int* k, const double* alpha, con st double* A, const blas_int* ldA, const double* B, const blas_int* ldB, co nst double* beta, double* C, const blas_int* ldC);
void arma_fortran(cgemm)(const char* transA, const char* transB, const blas_int* m, const blas_int* n, const blas_int* k, const void* alpha, con st void* A, const blas_int* ldA, const void* B, const blas_int* ldB, co nst void* beta, void* C, const blas_int* ldC); void arma_fortran(cgemm)(const char* transA, const char* transB, const blas_int* m, const blas_int* n, const blas_int* k, const void* alpha, con st void* A, const blas_int* ldA, const void* B, const blas_int* ldB, co nst void* beta, void* C, const blas_int* ldC);
void arma_fortran(zgemm)(const char* transA, const char* transB, const blas_int* m, const blas_int* n, const blas_int* k, const void* alpha, con st void* A, const blas_int* ldA, const void* B, const blas_int* ldB, co nst void* beta, void* C, const blas_int* ldC); void arma_fortran(zgemm)(const char* transA, const char* transB, const blas_int* m, const blas_int* n, const blas_int* k, const void* alpha, con st void* A, const blas_int* ldA, const void* B, const blas_int* ldB, co nst void* beta, void* C, const blas_int* ldC);
// void arma_fortran(dswap)(const blas_int* n, double* x, const blas_ int* incx, double* y, const blas_int* incy); // void arma_fortran(dswap)(const blas_int* n, double* x, const blas_ int* incx, double* y, const blas_int* incy);
// void arma_fortran(dscal)(const blas_int* n, const double* alpha, d ouble* x, const blas_int* incx); // void arma_fortran(dscal)(const blas_int* n, const double* alpha, d ouble* x, const blas_int* incx);
// void arma_fortran(dcopy)(const blas_int* n, const double* x, const blas_int* incx, double* y, const blas_int* incy); // void arma_fortran(dcopy)(const blas_int* n, const double* x, const blas_int* incx, double* y, const blas_int* incy);
// void arma_fortran(daxpy)(const blas_int* n, const double* alpha, c onst double* x, const blas_int* incx, double* y, const blas_int* incy); // void arma_fortran(daxpy)(const blas_int* n, const double* alpha, c onst double* x, const blas_int* incx, double* y, const blas_int* incy);
// void arma_fortran(dger)(const blas_int* m, const blas_int* n, con st double* alpha, const double* x, const blas_int* incx, const double* y, c onst blas_int* incy, double* A, const blas_int* ldA); // void arma_fortran(dger)(const blas_int* m, const blas_int* n, con st double* alpha, const double* x, const blas_int* incx, const double* y, c onst blas_int* incy, double* A, const blas_int* ldA);
} }
template<typename eT> template<typename eT>
arma_inline inline
eT eT
dot(const blas_int* n, const eT* x, const eT* y) dot(const u32 n_elem, const eT* x, const eT* y)
{ {
arma_type_check<is_supported_blas_type<eT>::value == false>::apply(); arma_ignore(n_elem);
arma_ignore(x);
arma_ignore(y);
const blas_int inc = 1; return eT(0);
}
if(is_float<eT>::value == true) template<>
{ inline
typedef float T; float
return eT( arma_fortran(sdot)(n, (const T*)x, &inc, (const T*)y, &inc dot(const u32 n_elem, const float* x, const float* y)
) ); {
} blas_int n = blas_int(n_elem);
else blas_int inc = blas_int(1);
if(is_double<eT>::value == true)
{ return arma_fortran(sdot)(&n, x, &inc, y, &inc);
typedef double T; }
return eT( arma_fortran(ddot)(n, (const T*)x, &inc, (const T*)y, &inc
) ); template<>
} inline
else double
{ dot(const u32 n_elem, const double* x, const double* y)
return eT(0); // prevent compiler warnings {
} blas_int n = blas_int(n_elem);
blas_int inc = blas_int(1);
return arma_fortran(ddot)(&n, x, &inc, y, &inc);
} }
template<typename eT> template<typename eT>
inline inline
void void
gemv(const char* transA, const blas_int* m, const blas_int* n, const eT* alpha, const eT* A, const blas_int* ldA, const eT* x, const blas_int* incx, const eT* beta, eT* y, const blas_int* incy) gemv(const char* transA, const blas_int* m, const blas_int* n, const eT* alpha, const eT* A, const blas_int* ldA, const eT* x, const blas_int* incx, const eT* beta, eT* y, const blas_int* incy)
{ {
arma_type_check<is_supported_blas_type<eT>::value == false>::apply(); arma_type_check<is_supported_blas_type<eT>::value == false>::apply();
if(is_float<eT>::value == true) if(is_float<eT>::value == true)
 End of changes. 6 change blocks. 
25 lines changed or deleted 31 lines changed or added


 compiler_setup.hpp   compiler_setup.hpp 
skipping to change at line 29 skipping to change at line 29
#define arma_warn_unused #define arma_warn_unused
#define arma_deprecated #define arma_deprecated
#define arma_ignore(variable) ((void)(variable)) #define arma_ignore(variable) ((void)(variable))
#define arma_fortran(function) function #define arma_fortran(function) function
#if defined(ARMA_BLAS_UNDERSCORE) #if defined(ARMA_BLAS_UNDERSCORE)
#undef arma_fortran #undef arma_fortran
#define arma_fortran(function) function##_ #define arma_fortran(function) function##_
#endif #endif
#if defined(__GNUG__) #if defined(__INTEL_COMPILER)
#if (__INTEL_COMPILER < 1000)
#error "*** Need a newer compiler ***"
#endif
#define ARMA_GOOD_COMPILER
#undef ARMA_HAVE_STD_TR1
#if (__INTEL_COMPILER <= 1110)
#undef ARMA_HAVE_STD_ISFINITE
#endif
#elif defined(__GNUG__)
#if (__GNUC__ < 4) #if (__GNUC__ < 4)
#error "*** Need a newer compiler ***" #error "*** Need a newer compiler ***"
#endif #endif
#define ARMA_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNU C_PATCHLEVEL__) #define ARMA_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNU C_PATCHLEVEL__)
#define ARMA_GOOD_COMPILER #define ARMA_GOOD_COMPILER
#undef ARMA_HAVE_STD_TR1 #undef ARMA_HAVE_STD_TR1
skipping to change at line 70 skipping to change at line 83
#if (ARMA_GCC_VERSION >= 40300) #if (ARMA_GCC_VERSION >= 40300)
#undef arma_hot #undef arma_hot
#undef arma_cold #undef arma_cold
#define arma_hot __attribute__((hot)) #define arma_hot __attribute__((hot))
#define arma_cold __attribute__((cold)) #define arma_cold __attribute__((cold))
#endif #endif
#undef ARMA_GCC_VERSION #undef ARMA_GCC_VERSION
#elif defined(__INTEL_COMPILER)
#if (__INTEL_COMPILER < 1000)
#error "*** Need a newer compiler ***"
#endif
#define ARMA_GOOD_COMPILER
#undef ARMA_HAVE_STD_TR1
#if (__INTEL_COMPILER <= 1110)
#undef ARMA_HAVE_STD_ISFINITE
#endif
#endif #endif
#if defined(_MSC_VER) #if defined(_MSC_VER)
#pragma message ("*** WARNING: This compiler may have an incomplete imple mentation of the C++ standard ***") #pragma message ("*** WARNING: This compiler may have an incomplete imple mentation of the C++ standard ***")
#undef ARMA_GOOD_COMPILER #undef ARMA_GOOD_COMPILER
#undef ARMA_HAVE_STD_ISFINITE #undef ARMA_HAVE_STD_ISFINITE
#undef ARMA_HAVE_STD_SNPRINTF #undef ARMA_HAVE_STD_SNPRINTF
#undef ARMA_HAVE_LOG1P #undef ARMA_HAVE_LOG1P
 End of changes. 2 change blocks. 
14 lines changed or deleted 14 lines changed or added


 fn_max.hpp   fn_max.hpp 
skipping to change at line 19 skipping to change at line 19
// by the Free Software Foundation, either version 3 // by the Free Software Foundation, either version 3
// of the License or (at your option) any later version. // of the License or (at your option) any later version.
// (see http://www.opensource.org/licenses for more info) // (see http://www.opensource.org/licenses for more info)
//! \addtogroup fn_max //! \addtogroup fn_max
//! @{ //! @{
//! \brief //! \brief
//! Delayed 'maximum values' operation. //! Delayed 'maximum values' operation.
//! The dimension, along which the maxima are found, is set via 'dim'. //! The dimension, along which the maxima are found, is set via 'dim'.
//! For dim = 0, the maximum value of each column is found. //! For dim = 0, the maximum value of each column is found (i.e. searches b
//! For dim = 1, the maximum value of each row is found. y traversing across rows).
//! For dim = 1, the maximum value of each row is found (i.e. searches by t
raversing across columns).
//! The default is dim = 0. //! The default is dim = 0.
//! NOTE: This function works differently than in Matlab/Octave.
template<typename T1> template<typename T1>
arma_inline arma_inline
const Op<T1, op_max> const Op<T1, op_max>
max(const Base<typename T1::elem_type,T1>& X, const u32 dim = 0) max(const Base<typename T1::elem_type,T1>& X, const u32 dim = 0)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return Op<T1, op_max>(X.get_ref(), dim, 0); return Op<T1, op_max>(X.get_ref(), dim, 0);
} }
 End of changes. 2 change blocks. 
3 lines changed or deleted 4 lines changed or added


 fn_min.hpp   fn_min.hpp 
skipping to change at line 19 skipping to change at line 19
// by the Free Software Foundation, either version 3 // by the Free Software Foundation, either version 3
// of the License or (at your option) any later version. // of the License or (at your option) any later version.
// (see http://www.opensource.org/licenses for more info) // (see http://www.opensource.org/licenses for more info)
//! \addtogroup fn_min //! \addtogroup fn_min
//! @{ //! @{
//! \brief //! \brief
//! Delayed 'minimum values' operation. //! Delayed 'minimum values' operation.
//! The dimension, along which the minima are found, is set via 'dim'. //! The dimension, along which the minima are found, is set via 'dim'.
//! For dim = 0, the maximum value of each column is found (i.e. searches b //! For dim = 0, the minimum value of each column is found (i.e. searches b
y traversing across rows). y traversing across rows).
//! For dim = 1, the maximum value of each row is found (i.e. searches by t //! For dim = 1, the minimum value of each row is found (i.e. searches by t
raversing across columns). raversing across columns).
//! The default is dim = 0. //! The default is dim = 0.
//! NOTE: This function works differently than in Matlab/Octave.
template<typename T1> template<typename T1>
arma_inline arma_inline
const Op<T1, op_min> const Op<T1, op_min>
min(const Base<typename T1::elem_type,T1>& X, const u32 dim = 0) min(const Base<typename T1::elem_type,T1>& X, const u32 dim = 0)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return Op<T1, op_min>(X.get_ref(), dim, 0); return Op<T1, op_min>(X.get_ref(), dim, 0);
} }
 End of changes. 2 change blocks. 
5 lines changed or deleted 4 lines changed or added


 fn_norm.hpp   fn_norm.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 fn_norm //! \addtogroup fn_norm
//! @{ //! @{
template<typename T1> template<typename T1>
arma_hot arma_hot
arma_inline inline
typename T1::pod_type typename T1::pod_type
norm_1(const Proxy<T1>& A) arma_vec_norm_1(const Proxy<T1>& A)
{ {
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;
T acc = T(0); T acc = T(0);
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();
u32 i,j; u32 i,j;
skipping to change at line 48 skipping to change at line 50
if(i < N) if(i < N)
{ {
acc += std::abs(P[i]); acc += std::abs(P[i]);
} }
return acc; return acc;
} }
template<typename T1> template<typename T1>
arma_hot arma_hot
arma_inline inline
typename T1::pod_type typename T1::pod_type
norm_2(const Proxy<T1>& A, const typename arma_not_cx<typename T1::elem_typ e>::result* junk = 0) arma_vec_norm_2(const Proxy<T1>& A, const typename arma_not_cx<typename T1: :elem_type>::result* junk = 0)
{ {
arma_extra_debug_sigprint();
arma_ignore(junk); arma_ignore(junk);
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;
T acc = T(0); T acc = T(0);
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();
skipping to change at line 85 skipping to change at line 88
const T tmp_i = P[i]; const T tmp_i = P[i];
acc += tmp_i * tmp_i; acc += tmp_i * tmp_i;
} }
return std::sqrt(acc); return std::sqrt(acc);
} }
template<typename T1> template<typename T1>
arma_hot arma_hot
arma_inline inline
typename T1::pod_type typename T1::pod_type
norm_2(const Proxy<T1>& A, const typename arma_cx_only<typename T1::elem_ty pe>::result* junk = 0) arma_vec_norm_2(const Proxy<T1>& A, const typename arma_cx_only<typename T1 ::elem_type>::result* junk = 0)
{ {
arma_extra_debug_sigprint();
arma_ignore(junk); arma_ignore(junk);
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;
T acc = T(0); T acc = T(0);
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();
skipping to change at line 110 skipping to change at line 114
{ {
const T tmp = std::abs(P[i]); const T tmp = std::abs(P[i]);
acc += tmp*tmp; acc += tmp*tmp;
} }
return std::sqrt(acc); return std::sqrt(acc);
} }
template<typename T1> template<typename T1>
arma_hot arma_hot
arma_inline inline
typename T1::pod_type typename T1::pod_type
norm_k(const Proxy<T1>& A, const int k) arma_vec_norm_k(const Proxy<T1>& A, const int k)
{ {
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;
T acc = T(0); T acc = T(0);
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();
u32 i,j; u32 i,j;
skipping to change at line 140 skipping to change at line 146
if(i < N) if(i < N)
{ {
acc += std::pow(std::abs(P[i]), k); acc += std::pow(std::abs(P[i]), k);
} }
return std::pow(acc, T(1)/T(k)); return std::pow(acc, T(1)/T(k));
} }
template<typename T1> template<typename T1>
arma_hot arma_hot
arma_inline inline
typename T1::pod_type typename T1::pod_type
norm_max(const Proxy<T1>& A) arma_vec_norm_max(const Proxy<T1>& A)
{ {
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 = std::abs(P[0]);
u32 i,j; u32 i,j;
skipping to change at line 175 skipping to change at line 183
const T tmp_i = std::abs(P[i]); const T tmp_i = std::abs(P[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;
} }
template<typename T1> template<typename T1>
arma_hot arma_hot
arma_inline inline
typename T1::pod_type typename T1::pod_type
norm_min(const Proxy<T1>& A) arma_vec_norm_min(const Proxy<T1>& A)
{ {
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 = std::abs(P[0]);
u32 i,j; u32 i,j;
skipping to change at line 209 skipping to change at line 219
{ {
const T tmp_i = std::abs(P[i]); const T tmp_i = std::abs(P[i]);
if(min_val > tmp_i) { min_val = tmp_i; } if(min_val > tmp_i) { min_val = tmp_i; }
} }
return min_val; return min_val;
} }
template<typename T1> template<typename T1>
arma_inline inline
typename T1::pod_type
arma_mat_norm_1(const Proxy<T1>& A)
{
arma_extra_debug_sigprint();
typedef typename T1::elem_type eT;
typedef typename T1::pod_type T;
const unwrap<typename Proxy<T1>::stored_type> tmp(A.Q);
const Mat<eT>& X = tmp.M;
// TODO: this can be sped up with a dedicated implementation
return as_scalar( max( sum(abs(X)), 1) );
}
template<typename T1>
inline
typename T1::pod_type
arma_mat_norm_2(const Proxy<T1>& A)
{
arma_extra_debug_sigprint();
typedef typename T1::elem_type eT;
typedef typename T1::pod_type T;
const unwrap<typename Proxy<T1>::stored_type> tmp(A.Q);
const Mat<eT>& X = tmp.M;
Col<T> S;
svd(S, X);
return (S.n_elem > 0) ? max(S) : T(0);
}
template<typename T1>
inline
typename T1::pod_type
arma_mat_norm_inf(const Proxy<T1>& A)
{
arma_extra_debug_sigprint();
typedef typename T1::elem_type eT;
typedef typename T1::pod_type T;
const unwrap<typename Proxy<T1>::stored_type> tmp(A.Q);
const Mat<eT>& X = tmp.M;
// TODO: this can be sped up with a dedicated implementation
return as_scalar( max( sum(abs(X),1) ) );
}
template<typename T1>
inline
arma_warn_unused arma_warn_unused
typename T1::pod_type typename T1::pod_type
norm norm
( (
const Base<typename T1::elem_type,T1>& X, const Base<typename T1::elem_type,T1>& X,
const u32 k, const u32 k,
const typename arma_float_or_cx_only<typename T1::elem_type>::result* jun k = 0 const typename arma_float_or_cx_only<typename T1::elem_type>::result* jun k = 0
) )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_ignore(junk); arma_ignore(junk);
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
typedef typename T1::pod_type T; typedef typename T1::pod_type T;
const Proxy<T1> A(X.get_ref()); const Proxy<T1> A(X.get_ref());
arma_debug_check( (A.get_n_elem() == 0), "n if(A.get_n_elem() == 0)
orm(): given object has no elements" );
arma_debug_check( !( (A.get_n_rows() == 1) || (A.get_n_cols() == 1) ), "n
orm(): given object must be a vector" );
switch(k)
{ {
case 1: return T(0);
return norm_1(A); }
break;
case 2: const bool is_vec = (A.get_n_rows() == 1) || (A.get_n_cols() == 1);
return norm_2(A);
break;
default: if(is_vec == true)
{
switch(k)
{ {
arma_debug_check( (k == 0), "norm(): k must be greater than zero" ) case 1:
; return arma_vec_norm_1(A);
break;
return norm_k(A, k);
case 2:
return arma_vec_norm_2(A);
break;
default:
{
arma_debug_check( (k == 0), "norm(): k must be greater than zero"
);
return arma_vec_norm_k(A, k);
}
}
}
else
{
switch(k)
{
case 1:
return arma_mat_norm_1(A);
break;
case 2:
return arma_mat_norm_2(A);
break;
default:
arma_stop("norm(): unsupported matrix norm type");
return T(0);
} }
} }
} }
template<typename T1> template<typename T1>
arma_inline inline
arma_warn_unused arma_warn_unused
typename T1::pod_type typename T1::pod_type
norm norm
( (
const Base<typename T1::elem_type,T1>& X, const Base<typename T1::elem_type,T1>& X,
const char* method, const char* method,
const typename arma_float_or_cx_only<typename T1::elem_type>::result* jun k = 0 const typename arma_float_or_cx_only<typename T1::elem_type>::result* jun k = 0
) )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_ignore(junk); arma_ignore(junk);
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
typedef typename T1::pod_type T; typedef typename T1::pod_type T;
const Proxy<T1> A(X.get_ref()); const Proxy<T1> A(X.get_ref());
arma_debug_check( (A.get_n_elem() == 0), "n if(A.get_n_elem() == 0)
orm(): given object has no elements" );
arma_debug_check( !( (A.get_n_rows() == 1) || (A.get_n_cols() == 1) ), "n
orm(): given object must be a vector" );
const char sig = method[0];
if( (sig == 'i') || (sig == 'I') || (sig == '+') ) // max norm
{ {
return norm_max(A); return T(0);
} }
else
if(sig == '-') // min norm const char sig = method[0];
const bool is_vec = (A.get_n_rows() == 1) || (A.get_n_cols() == 1);
if(is_vec == true)
{ {
return norm_min(A); if( (sig == 'i') || (sig == 'I') || (sig == '+') ) // max norm
{
return arma_vec_norm_max(A);
}
else
if(sig == '-') // min norm
{
return arma_vec_norm_min(A);
}
else
if( (sig == 'f') || (sig == 'F') )
{
return arma_vec_norm_2(A);
}
else
{
arma_stop("norm(): unsupported vector norm type");
return T(0);
}
} }
else else
{ {
arma_stop("norm(): unknown norm type"); if( (sig == 'i') || (sig == 'I') || (sig == '+') ) // inf norm
{
return T(0); return arma_mat_norm_inf(A);
}
else
if( (sig == 'f') || (sig == 'F') )
{
return arma_vec_norm_2(A);
}
else
{
arma_stop("norm(): unsupported matrix norm type");
return T(0);
}
} }
} }
//! @} //! @}
 End of changes. 33 change blocks. 
49 lines changed or deleted 155 lines changed or added


 op_dot_meat.hpp   op_dot_meat.hpp 
skipping to change at line 63 skipping to change at line 63
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
if( n_elem <= (128/sizeof(eT)) ) if( n_elem <= (128/sizeof(eT)) )
{ {
return op_dot::direct_dot_arma(n_elem, A, B); return op_dot::direct_dot_arma(n_elem, A, B);
} }
else else
{ {
#if defined(ARMA_USE_ATLAS) #if defined(ARMA_USE_ATLAS)
{ {
arma_extra_debug_print("atlas::cblas_dot()");
return atlas::cblas_dot(n_elem, A, B); return atlas::cblas_dot(n_elem, A, B);
} }
#elif defined(ARMA_USE_BLAS) #elif defined(ARMA_USE_BLAS)
{ {
const blas_int n = n_elem; arma_extra_debug_print("blas::dot()");
return blas::dot(&n, A, B);
return blas::dot(n_elem, A, B);
} }
#else #else
{ {
return op_dot::direct_dot_arma(n_elem, A, B); return op_dot::direct_dot_arma(n_elem, A, B);
} }
#endif #endif
} }
} }
//! for two arrays, complex version //! for two arrays, complex version
template<typename eT> template<typename eT>
inline inline
arma_hot arma_hot
arma_pure arma_pure
typename arma_cx_only<eT>::result typename arma_cx_only<eT>::result
op_dot::direct_dot(const u32 n_elem, const eT* const A, const eT* const B) op_dot::direct_dot(const u32 n_elem, const eT* const A, const eT* const B)
{ {
#if defined(ARMA_USE_ATLAS) #if defined(ARMA_USE_ATLAS)
{ {
arma_extra_debug_print("atlas::cx_cblas_dot()");
return atlas::cx_cblas_dot(n_elem, A, B); return atlas::cx_cblas_dot(n_elem, A, B);
} }
#elif defined(ARMA_USE_BLAS) #elif defined(ARMA_USE_BLAS)
{ {
// TODO: work out the mess with zdotu() and zdotu_sub() in BLAS // TODO: work out the mess with zdotu() and zdotu_sub() in BLAS
return op_dot::direct_dot_arma(n_elem, A, B); return op_dot::direct_dot_arma(n_elem, A, B);
} }
#else #else
{ {
return op_dot::direct_dot_arma(n_elem, A, B); return op_dot::direct_dot_arma(n_elem, A, B);
 End of changes. 3 change blocks. 
2 lines changed or deleted 7 lines changed or added


 running_stat_meat.hpp   running_stat_meat.hpp 
skipping to change at line 140 skipping to change at line 140
} }
//! update statistics to reflect new sample //! update statistics to reflect new sample
template<typename eT> template<typename eT>
inline inline
void void
running_stat<eT>::operator() (const typename running_stat<eT>::T sample) running_stat<eT>::operator() (const typename running_stat<eT>::T sample)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_check( (arma_isfinite(sample) == false), "running_stat: non-finite s if( arma_isfinite(sample) == false )
ample given" ); {
arma_print("running_stat: sample ignored as it is non-finite" );
return;
}
running_stat_aux::update_stats(*this, sample); running_stat_aux::update_stats(*this, sample);
} }
//! update statistics to reflect new sample (version for complex numbers) //! update statistics to reflect new sample (version for complex numbers)
template<typename eT> template<typename eT>
inline inline
void void
running_stat<eT>::operator() (const std::complex< typename running_stat<eT> ::T >& sample) running_stat<eT>::operator() (const std::complex< typename running_stat<eT> ::T >& sample)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
isnt_same_type<eT, std::complex< typename running_stat<eT>::T > >::check( ); isnt_same_type<eT, std::complex< typename running_stat<eT>::T > >::check( );
arma_check( (arma_isfinite(sample) == false), "running_stat: non-finite s if( arma_isfinite(sample) == false )
ample given" ); {
arma_print("running_stat: sample ignored as it is non-finite" );
return;
}
running_stat_aux::update_stats(*this, sample); running_stat_aux::update_stats(*this, sample);
} }
//! set all statistics to zero //! set all statistics to zero
template<typename eT> template<typename eT>
inline inline
void void
running_stat<eT>::reset() running_stat<eT>::reset()
{ {
 End of changes. 2 change blocks. 
4 lines changed or deleted 10 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/