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 300 #define ARMA_VERSION_MINOR 300
#define ARMA_VERSION_PATCH 3 #define ARMA_VERSION_PATCH 5
#define ARMA_VERSION_NAME "Medieval Cornea Scraper" #define ARMA_VERSION_NAME "Medieval Cornea Scraper"
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_dot.hpp   fn_dot.hpp 
skipping to change at line 53 skipping to change at line 53
const T1& A, const T1& A,
const T2& B const T2& B
) )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return op_dot_mixed::apply(A,B); return op_dot_mixed::apply(A,B);
} }
template<typename T1, typename T2> template<typename T1, typename T2>
arma_inline inline
arma_warn_unused arma_warn_unused
typename typename
enable_if2 enable_if2
< <
is_arma_type<T1>::value && is_arma_type<T2>::value && is_same_type<typena me T1::elem_type, typename T2::elem_type>::value && is_cx<typename T1::elem _type>::no, is_arma_type<T1>::value && is_arma_type<T2>::value && is_same_type<typena me T1::elem_type, typename T2::elem_type>::value,
typename T1::elem_type typename T1::elem_type
>::result >::result
norm_dot norm_dot
( (
const T1& A, const T1& A,
const T2& B const T2& B
) )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return op_norm_dot::apply(A,B); return op_norm_dot::apply(A,B);
} }
template<typename T1, typename T2>
arma_inline
arma_warn_unused
typename
enable_if2
<
is_arma_type<T1>::value && is_arma_type<T2>::value && is_same_type<typena
me T1::elem_type, typename T2::elem_type>::value && is_complex_strict<typen
ame T1::elem_type>::value,
typename T1::elem_type
>::result
norm_dot
(
const T1& A,
const T2& B
)
{
arma_extra_debug_sigprint();
return op_norm_dot_slow::apply(A,B);
}
// //
// cdot // cdot
template<typename T1, typename T2> template<typename T1, typename T2>
arma_inline arma_inline
arma_warn_unused arma_warn_unused
typename typename
enable_if2 enable_if2
< <
is_arma_type<T1>::value && is_arma_type<T2>::value && is_same_type<typena me T1::elem_type, typename T2::elem_type>::value && is_not_complex<typename T1::elem_type>::value, is_arma_type<T1>::value && is_arma_type<T2>::value && is_same_type<typena me T1::elem_type, typename T2::elem_type>::value && is_not_complex<typename T1::elem_type>::value,
 End of changes. 3 change blocks. 
24 lines changed or deleted 2 lines changed or added


 fn_norm.hpp   fn_norm.hpp 
// Copyright (C) 2008-2012 Conrad Sanderson // Copyright (C) 2008-2014 Conrad Sanderson
// Copyright (C) 2008-2012 NICTA (www.nicta.com.au) // Copyright (C) 2008-2014 NICTA (www.nicta.com.au)
// //
// 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 fn_norm //! \addtogroup fn_norm
//! @{ //! @{
template<typename T1> template<typename T1>
arma_hot arma_hot
skipping to change at line 94 skipping to change at line 94
typename T1::pod_type 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::pod_type T; typedef typename T1::elem_type eT;
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();
T acc1 = T(0); T acc1 = T(0);
skipping to change at line 165 skipping to change at line 166
if(i < n_rows) if(i < n_rows)
{ {
const T tmp_i = P.at(i,col); const T tmp_i = P.at(i,col);
acc += tmp_i * tmp_i; acc += tmp_i * tmp_i;
} }
} }
} }
} }
return std::sqrt(acc); const T sqrt_acc = std::sqrt(acc);
if( (sqrt_acc != T(0)) && arma_isfinite(sqrt_acc) )
{
return sqrt_acc;
}
else
{
arma_extra_debug_print("arma_vec_norm_2(): 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();
eT max_val = priv::most_neg<eT>();
uword i,j;
for(i=0, j=1; j<N; i+=2, j+=2)
{
eT val_i = R_mem[i];
eT val_j = R_mem[j];
val_i = std::abs(val_i);
val_j = std::abs(val_j);
if(val_i > max_val) { max_val = val_i; }
if(val_j > max_val) { max_val = val_j; }
}
if(i < N)
{
const eT val_i = std::abs(R_mem[i]);
if(val_i > max_val) { max_val = val_i; }
}
if(max_val == eT(0)) { return eT(0); }
eT alt_acc1 = eT(0);
eT alt_acc2 = eT(0);
for(i=0, j=1; j<N; i+=2, j+=2)
{
eT val_i = R_mem[i];
eT val_j = R_mem[j];
val_i /= max_val;
val_j /= max_val;
alt_acc1 += val_i * val_i;
alt_acc2 += val_j * val_j;
}
if(i < N)
{
const eT val_i = R_mem[i] / max_val;
alt_acc1 += val_i*val_i;
}
return ( std::sqrt(alt_acc1 + alt_acc2) * max_val );
}
} }
template<typename T1> template<typename T1>
arma_hot arma_hot
inline inline
typename T1::pod_type typename T1::pod_type
arma_vec_norm_2 arma_vec_norm_2
( (
const Proxy<T1>& P, const Proxy<T1>& P,
const typename arma_cx_only<typename T1::elem_type>::result* junk = 0 const typename arma_cx_only<typename T1::elem_type>::result* junk = 0
) )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_ignore(junk); arma_ignore(junk);
typedef typename T1::pod_type T; typedef typename T1::elem_type eT;
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();
for(uword i=0; i<N; ++i) for(uword i=0; i<N; ++i)
skipping to change at line 221 skipping to change at line 286
{ {
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 T tmp = std::abs(P.at(row,col));
acc += tmp*tmp; acc += tmp*tmp;
} }
} }
} }
return std::sqrt(acc); const T sqrt_acc = std::sqrt(acc);
if( (sqrt_acc != T(0)) && arma_isfinite(sqrt_acc) )
{
return sqrt_acc;
}
else
{
arma_extra_debug_print("arma_vec_norm_2(): 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 T val_i = std::abs(R_mem[i]);
if(val_i > max_val) { max_val = val_i; }
}
if(max_val == T(0)) { return T(0); }
T alt_acc = T(0);
for(uword i=0; i<N; ++i)
{
const T val_i = std::abs(R_mem[i]) / max_val;
alt_acc += val_i * val_i;
}
return ( std::sqrt(alt_acc) * max_val );
}
} }
template<typename T1> template<typename T1>
arma_hot arma_hot
inline inline
typename T1::pod_type typename T1::pod_type
arma_vec_norm_k arma_vec_norm_k
( (
const Proxy<T1>& P, const Proxy<T1>& P,
const int k const int k
 End of changes. 5 change blocks. 
6 lines changed or deleted 109 lines changed or added


 op_dot_bones.hpp   op_dot_bones.hpp 
skipping to change at line 64 skipping to change at line 64
}; };
//! \brief //! \brief
//! normalised dot product operation //! normalised dot product operation
class op_norm_dot class op_norm_dot
{ {
public: public:
template<typename T1, typename T2> template<typename T1, typename T2>
arma_hot inline static typename T1::elem_type apply (const T1& X, c
onst T2& Y);
template<typename T1, typename T2>
arma_hot inline static typename T1::elem_type apply_unwrap(const T1& X, c
onst T2& Y);
};
class op_norm_dot_slow
{
public:
template<typename T1, typename T2>
arma_hot inline static typename T1::elem_type apply(const T1& X, const T2 & Y); arma_hot inline static typename T1::elem_type apply(const T1& X, const T2 & Y);
}; };
//! \brief //! \brief
//! complex conjugate dot product operation //! complex conjugate dot product operation
class op_cdot class op_cdot
{ {
public: public:
 End of changes. 1 change blocks. 
13 lines changed or deleted 0 lines changed or added


 op_dot_meat.hpp   op_dot_meat.hpp 
// Copyright (C) 2008-2013 Conrad Sanderson // Copyright (C) 2008-2014 Conrad Sanderson
// Copyright (C) 2008-2013 NICTA (www.nicta.com.au) // Copyright (C) 2008-2014 NICTA (www.nicta.com.au)
// //
// 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 op_dot //! \addtogroup op_dot
//! @{ //! @{
//! for two arrays, generic version for non-complex values //! for two arrays, generic version for non-complex values
template<typename eT> template<typename eT>
skipping to change at line 349 skipping to change at line 349
// op_norm_dot // op_norm_dot
template<typename T1, typename T2> template<typename T1, typename T2>
arma_hot arma_hot
inline inline
typename T1::elem_type typename T1::elem_type
op_norm_dot::apply(const T1& X, const T2& Y) op_norm_dot::apply(const T1& X, const T2& Y)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT;
typedef typename Proxy<T1>::ea_type ea_type1;
typedef typename Proxy<T2>::ea_type ea_type2;
const bool prefer_at_accessor = (Proxy<T1>::prefer_at_accessor) && (Proxy
<T2>::prefer_at_accessor);
if(prefer_at_accessor == false)
{
const Proxy<T1> PA(X);
const Proxy<T2> PB(Y);
const uword N = PA.get_n_elem();
arma_debug_check( (N != PB.get_n_elem()), "norm_dot(): objects must hav
e the same number of elements" );
ea_type1 A = PA.get_ea();
ea_type2 B = PB.get_ea();
eT acc1 = eT(0);
eT acc2 = eT(0);
eT acc3 = eT(0);
for(uword i=0; i<N; ++i)
{
const eT tmpA = A[i];
const eT tmpB = B[i];
acc1 += tmpA * tmpA;
acc2 += tmpB * tmpB;
acc3 += tmpA * tmpB;
}
return acc3 / ( std::sqrt(acc1 * acc2) );
}
else
{
return op_norm_dot::apply_unwrap(X, Y);
}
}
template<typename T1, typename T2>
arma_hot
inline
typename T1::elem_type
op_norm_dot::apply_unwrap(const T1& X, const T2& Y)
{
arma_extra_debug_sigprint();
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
typedef typename T1::pod_type T;
const unwrap<T1> tmp1(X); const quasi_unwrap<T1> tmp1(X);
const unwrap<T2> tmp2(Y); const quasi_unwrap<T2> tmp2(Y);
const Mat<eT>& A = tmp1.M;
const Mat<eT>& B = tmp2.M;
arma_debug_check( (A.n_elem != B.n_elem), "norm_dot(): objects must have
the same number of elements" );
const uword N = A.n_elem;
const eT* A_mem = A.memptr();
const eT* B_mem = B.memptr();
eT acc1 = eT(0);
eT acc2 = eT(0);
eT acc3 = eT(0);
for(uword i=0; i<N; ++i)
{
const eT tmpA = A_mem[i];
const eT tmpB = B_mem[i];
acc1 += tmpA * tmpA;
acc2 += tmpB * tmpB;
acc3 += tmpA * tmpB;
}
return acc3 / ( std::sqrt(acc1 * acc2) );
}
//
// op_norm_dot_slow
template<typename T1, typename T2>
arma_hot
inline
typename T1::elem_type
op_norm_dot_slow::apply(const T1& X, const T2& Y)
{
arma_extra_debug_sigprint();
typedef typename T1::elem_type eT;
const unwrap<T1> tmp1(X);
const unwrap<T2> tmp2(Y);
const Col<eT> A( const_cast<eT*>(tmp1.M.memptr()), tmp1.M.n_elem, false ) ; const Col<eT> A( const_cast<eT*>(tmp1.M.memptr()), tmp1.M.n_elem, false ) ;
const Col<eT> B( const_cast<eT*>(tmp2.M.memptr()), tmp2.M.n_elem, false ) ; const Col<eT> B( const_cast<eT*>(tmp2.M.memptr()), tmp2.M.n_elem, false ) ;
arma_debug_check( (A.n_elem != B.n_elem), "norm_dot(): objects must have the same number of elements" ); arma_debug_check( (A.n_elem != B.n_elem), "norm_dot(): objects must have the same number of elements" );
return ( op_dot::apply(A,B) / (norm(A,2) * norm(B,2)) ); const T denom = norm(A,2) * norm(B,2);
return (denom != T(0)) ? ( op_dot::apply(A,B) / denom ) : eT(0);
} }
// //
// op_cdot // op_cdot
template<typename eT> template<typename eT>
arma_hot arma_hot
arma_pure arma_pure
inline inline
eT eT
 End of changes. 5 change blocks. 
99 lines changed or deleted 8 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/