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 100 | #define ARMA_VERSION_MINOR 100 | |||
#define ARMA_VERSION_PATCH 0 | #define ARMA_VERSION_PATCH 1 | |||
#define ARMA_VERSION_NAME "Dirt Cruiser" | #define ARMA_VERSION_NAME "Dirt Cruiser" | |||
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 | |||
op_normalise_meat.hpp | op_normalise_meat.hpp | |||
---|---|---|---|---|
skipping to change at line 18 | skipping to change at line 18 | |||
//! \addtogroup op_normalise | //! \addtogroup op_normalise | |||
//! @{ | //! @{ | |||
template<typename T1> | template<typename T1> | |||
inline | inline | |||
void | void | |||
op_normalise_colvec::apply(Mat<typename T1::elem_type>& out, const Op<T1,op _normalise_colvec>& in) | op_normalise_colvec::apply(Mat<typename T1::elem_type>& out, const Op<T1,op _normalise_colvec>& in) | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
typedef typename T1::pod_type T; | ||||
const uword p = in.aux_uword_a; | const uword p = in.aux_uword_a; | |||
arma_debug_check( (p == 0), "normalise(): p must be greater than zero" ); | arma_debug_check( (p == 0), "normalise(): p must be greater than zero" ); | |||
const quasi_unwrap<T1> tmp(in.m); | const quasi_unwrap<T1> tmp(in.m); | |||
out = tmp.M / norm(tmp.M, p); | const T norm_val_a = norm(tmp.M, p); | |||
const T norm_val_b = (norm_val_a != T(0)) ? norm_val_a : T(1); | ||||
out = tmp.M / norm_val_b; | ||||
} | } | |||
template<typename T1> | template<typename T1> | |||
inline | inline | |||
void | void | |||
op_normalise_rowvec::apply(Mat<typename T1::elem_type>& out, const Op<T1,op _normalise_rowvec>& in) | op_normalise_rowvec::apply(Mat<typename T1::elem_type>& out, const Op<T1,op _normalise_rowvec>& in) | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
typedef typename T1::pod_type T; | ||||
const uword p = in.aux_uword_a; | const uword p = in.aux_uword_a; | |||
arma_debug_check( (p == 0), "normalise(): p must be greater than zero" ); | arma_debug_check( (p == 0), "normalise(): p must be greater than zero" ); | |||
const unwrap<T1> tmp(in.m); | const unwrap<T1> tmp(in.m); | |||
out = tmp.M / norm(tmp.M, p); | const T norm_val_a = norm(tmp.M, p); | |||
const T norm_val_b = (norm_val_a != T(0)) ? norm_val_a : T(1); | ||||
out = tmp.M / norm_val_b; | ||||
} | } | |||
template<typename T1> | template<typename T1> | |||
inline | inline | |||
void | void | |||
op_normalise_mat::apply(Mat<typename T1::elem_type>& out, const Op<T1,op_no rmalise_mat>& in) | op_normalise_mat::apply(Mat<typename T1::elem_type>& out, const Op<T1,op_no rmalise_mat>& in) | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
typedef typename T1::elem_type eT; | typedef typename T1::elem_type eT; | |||
skipping to change at line 84 | skipping to change at line 94 | |||
} | } | |||
} | } | |||
template<typename eT> | template<typename eT> | |||
inline | inline | |||
void | void | |||
op_normalise_mat::apply(Mat<eT>& out, const Mat<eT>& A, const uword p, cons t uword dim) | op_normalise_mat::apply(Mat<eT>& out, const Mat<eT>& A, const uword p, cons t uword dim) | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
typedef typename get_pod_type<eT>::result T; | ||||
out.copy_size(A); | out.copy_size(A); | |||
if(A.n_elem == 0) { return; } | if(A.n_elem == 0) { return; } | |||
if(dim == 0) | if(dim == 0) | |||
{ | { | |||
const uword n_cols = A.n_cols; | const uword n_cols = A.n_cols; | |||
for(uword i=0; i<n_cols; ++i) | for(uword i=0; i<n_cols; ++i) | |||
{ | { | |||
out.col(i) = A.col(i) / norm(A.col(i), p); | const T norm_val_a = norm(A.col(i), p); | |||
const T norm_val_b = (norm_val_a != T(0)) ? norm_val_a : T(1); | ||||
out.col(i) = A.col(i) / norm_val_b; | ||||
} | } | |||
} | } | |||
else | else | |||
{ | { | |||
// better-than-nothing implementation | // better-than-nothing implementation | |||
const uword n_rows = A.n_rows; | const uword n_rows = A.n_rows; | |||
for(uword i=0; i<n_rows; ++i) | for(uword i=0; i<n_rows; ++i) | |||
{ | { | |||
out.row(i) = A.row(i) / norm(A.row(i), p); | const T norm_val_a = norm(A.row(i), p); | |||
const T norm_val_b = (norm_val_a != T(0)) ? norm_val_a : T(1); | ||||
out.row(i) = A.row(i) / norm_val_b; | ||||
} | } | |||
} | } | |||
} | } | |||
//! @} | //! @} | |||
End of changes. 7 change blocks. | ||||
4 lines changed or deleted | 22 lines changed or added | |||