arma_rng.hpp   arma_rng.hpp 
skipping to change at line 249 skipping to change at line 249
} }
} }
}; };
template<typename T> template<typename T>
struct arma_rng::randu< std::complex<T> > struct arma_rng::randu< std::complex<T> >
{ {
arma_inline arma_inline
operator std::complex<T> () operator std::complex<T> ()
{ {
return std::complex<T>( T( arma_rng::randu<T>() ), T( arma_rng::randu<T const T a = T( arma_rng::randu<T>() );
>() ) ); const T b = T( arma_rng::randu<T>() );
return std::complex<T>(a, b);
} }
inline inline
static static
void void
fill(std::complex<T>* mem, const uword N) fill(std::complex<T>* mem, const uword N)
{ {
for(uword i=0; i < N; ++i) for(uword i=0; i < N; ++i)
{ {
mem[i] = std::complex<T>( T( arma_rng::randu<T>() ), T( arma_rng::ran const T a = T( arma_rng::randu<T>() );
du<T>() ) ); const T b = T( arma_rng::randu<T>() );
mem[i] = std::complex<T>(a, b);
} }
} }
}; };
template<typename eT> template<typename eT>
struct arma_rng::randn struct arma_rng::randn
{ {
inline inline
operator eT () const operator eT () const
{ {
 End of changes. 2 change blocks. 
4 lines changed or deleted 8 lines changed or added


 arma_version.hpp   arma_version.hpp 
skipping to change at line 13 skipping to change at line 13
// //
// This Source Code Form is subject to the terms of the Mozilla Public // This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this // License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
//! \addtogroup arma_version //! \addtogroup arma_version
//! @{ //! @{
#define ARMA_VERSION_MAJOR 4 #define ARMA_VERSION_MAJOR 4
#define ARMA_VERSION_MINOR 450 #define ARMA_VERSION_MINOR 450
#define ARMA_VERSION_PATCH 2 #define ARMA_VERSION_PATCH 3
#define ARMA_VERSION_NAME "Spring Hill Fort" #define ARMA_VERSION_NAME "Spring Hill Fort"
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
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 fn_norm.hpp   fn_norm.hpp 
skipping to change at line 15 skipping to change at line 15
// License, v. 2.0. If a copy of the MPL was not distributed with this // License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/. // file, You can obtain one at http://mozilla.org/MPL/2.0/.
//! \addtogroup fn_norm //! \addtogroup fn_norm
//! @{ //! @{
template<typename T1> template<typename T1>
arma_hot arma_hot
inline inline
typename T1::pod_type typename T1::pod_type
arma_vec_norm_1(const Proxy<T1>& P) arma_vec_norm_1
(
const Proxy<T1>& P,
const typename arma_not_cx<typename T1::elem_type>::result* junk = 0
)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_ignore(junk);
typedef typename T1::pod_type T; typedef typename T1::pod_type T;
T acc = T(0); T acc = T(0);
if(Proxy<T1>::prefer_at_accessor == false) if(Proxy<T1>::prefer_at_accessor == false)
{ {
typename Proxy<T1>::ea_type A = P.get_ea(); typename Proxy<T1>::ea_type A = P.get_ea();
const uword N = P.get_n_elem(); const uword N = P.get_n_elem();
skipping to change at line 60 skipping to change at line 65
if(n_rows == 1) if(n_rows == 1)
{ {
for(uword col=0; col<n_cols; ++col) for(uword col=0; col<n_cols; ++col)
{ {
acc += std::abs(P.at(0,col)); acc += std::abs(P.at(0,col));
} }
} }
else else
{ {
T acc1 = T(0);
T acc2 = T(0);
for(uword col=0; col<n_cols; ++col) for(uword col=0; col<n_cols; ++col)
{ {
uword i,j; uword i,j;
for(i=0, j=1; j<n_rows; i+=2, j+=2) for(i=0, j=1; j<n_rows; i+=2, j+=2)
{ {
acc += std::abs(P.at(i,col)); acc1 += std::abs(P.at(i,col));
acc += std::abs(P.at(j,col)); acc2 += std::abs(P.at(j,col));
} }
if(i < n_rows) if(i < n_rows)
{ {
acc += std::abs(P.at(i,col)); acc1 += std::abs(P.at(i,col));
} }
} }
acc = acc1 + acc2;
} }
} }
return acc; return acc;
} }
template<typename T1> template<typename T1>
arma_hot arma_hot
inline inline
typename T1::pod_type typename T1::pod_type
arma_vec_norm_1
(
const Proxy<T1>& P,
const typename arma_cx_only<typename T1::elem_type>::result* junk = 0
)
{
arma_extra_debug_sigprint();
arma_ignore(junk);
typedef typename T1::elem_type eT;
typedef typename T1::pod_type T;
T acc = T(0);
if(Proxy<T1>::prefer_at_accessor == false)
{
typename Proxy<T1>::ea_type A = P.get_ea();
const uword N = P.get_n_elem();
for(uword i=0; i<N; ++i)
{
const std::complex<T>& X = A[i];
const T a = X.real();
const T b = X.imag();
acc += std::sqrt( (a*a) + (b*b) );
}
}
else
{
const uword n_rows = P.get_n_rows();
const uword n_cols = P.get_n_cols();
if(n_rows == 1)
{
for(uword col=0; col<n_cols; ++col)
{
const std::complex<T>& X = P.at(0,col);
const T a = X.real();
const T b = X.imag();
acc += std::sqrt( (a*a) + (b*b) );
}
}
else
{
for(uword col=0; col<n_cols; ++col)
for(uword row=0; row<n_rows; ++row)
{
const std::complex<T>& X = P.at(row,col);
const T a = X.real();
const T b = X.imag();
acc += std::sqrt( (a*a) + (b*b) );
}
}
}
if( (acc != T(0)) && arma_isfinite(acc) )
{
return acc;
}
else
{
arma_extra_debug_print("arma_vec_norm_1(): detected possible underflow
or overflow");
const quasi_unwrap<typename Proxy<T1>::stored_type> R(P.Q);
const uword N = R.M.n_elem;
const eT* R_mem = R.M.memptr();
T max_val = priv::most_neg<T>();
for(uword i=0; i<N; ++i)
{
const std::complex<T>& X = R_mem[i];
const T a = std::abs(X.real());
const T b = std::abs(X.imag());
if(a > max_val) { max_val = a; }
if(b > max_val) { max_val = b; }
}
if(max_val == T(0)) { return T(0); }
T alt_acc = T(0);
for(uword i=0; i<N; ++i)
{
const std::complex<T>& X = R_mem[i];
const T a = X.real() / max_val;
const T b = X.imag() / max_val;
alt_acc += std::sqrt( (a*a) + (b*b) );
}
return ( alt_acc * max_val );
}
}
template<typename T1>
arma_hot
inline
typename T1::pod_type
arma_vec_norm_2 arma_vec_norm_2
( (
const Proxy<T1>& P, const Proxy<T1>& P,
const typename arma_not_cx<typename T1::elem_type>::result* junk = 0 const typename arma_not_cx<typename T1::elem_type>::result* junk = 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;
skipping to change at line 258 skipping to change at line 378
T acc = T(0); T acc = T(0);
if(Proxy<T1>::prefer_at_accessor == false) if(Proxy<T1>::prefer_at_accessor == false)
{ {
typename Proxy<T1>::ea_type A = P.get_ea(); typename Proxy<T1>::ea_type A = P.get_ea();
const uword N = P.get_n_elem(); const uword N = P.get_n_elem();
for(uword i=0; i<N; ++i) for(uword i=0; i<N; ++i)
{ {
const T tmp = std::abs(A[i]); const std::complex<T>& X = A[i];
acc += tmp*tmp;
const T a = X.real();
const T b = X.imag();
acc += (a*a) + (b*b);
} }
} }
else else
{ {
const uword n_rows = P.get_n_rows(); const uword n_rows = P.get_n_rows();
const uword n_cols = P.get_n_cols(); const uword n_cols = P.get_n_cols();
if(n_rows == 1) if(n_rows == 1)
{ {
for(uword col=0; col<n_cols; ++col) for(uword col=0; col<n_cols; ++col)
{ {
const T tmp = std::abs(P.at(0,col)); const std::complex<T>& X = P.at(0,col);
acc += tmp*tmp;
const T a = X.real();
const T b = X.imag();
acc += (a*a) + (b*b);
} }
} }
else else
{ {
for(uword col=0; col<n_cols; ++col) for(uword col=0; col<n_cols; ++col)
for(uword row=0; row<n_rows; ++row) for(uword row=0; row<n_rows; ++row)
{ {
const T tmp = std::abs(P.at(row,col)); const std::complex<T>& X = P.at(row,col);
acc += tmp*tmp;
const T a = X.real();
const T b = X.imag();
acc += (a*a) + (b*b);
} }
} }
} }
const T sqrt_acc = std::sqrt(acc); const T sqrt_acc = std::sqrt(acc);
if( (sqrt_acc != T(0)) && arma_isfinite(sqrt_acc) ) if( (sqrt_acc != T(0)) && arma_isfinite(sqrt_acc) )
{ {
return sqrt_acc; return sqrt_acc;
} }
 End of changes. 10 change blocks. 
10 lines changed or deleted 143 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/