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 5 #define ARMA_VERSION_MAJOR 5
#define ARMA_VERSION_MINOR 200 #define ARMA_VERSION_MINOR 200
#define ARMA_VERSION_PATCH 1 #define ARMA_VERSION_PATCH 2
#define ARMA_VERSION_NAME "Boston Tea Smuggler" #define ARMA_VERSION_NAME "Boston Tea Smuggler"
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_interp1.hpp   fn_interp1.hpp 
skipping to change at line 90 skipping to change at line 90
eT* YI_mem = YI.memptr(); eT* YI_mem = YI.memptr();
const uword NG = XG.n_elem; const uword NG = XG.n_elem;
const uword NI = XI.n_elem; const uword NI = XI.n_elem;
uword a_best_j = 0; uword a_best_j = 0;
uword b_best_j = 0; uword b_best_j = 0;
for(uword i=0; i<NI; ++i) for(uword i=0; i<NI; ++i)
{ {
eT a_best_err = Datum<eT>::inf;
eT b_best_err = Datum<eT>::inf;
const eT XI_val = XI_mem[i]; const eT XI_val = XI_mem[i];
arma_debug_check( ((XI_val < XG_min) || (XI_val > XG_max)), "interp1(): extrapolation not supported" ); arma_debug_check( ((XI_val < XG_min) || (XI_val > XG_max)), "interp1(): extrapolation not supported" );
// XG and XI are guaranteed to be sorted in ascending manner, // XG and XI are guaranteed to be sorted in ascending manner,
// so start searching XG from last known optimum position // so start searching XG from last known optimum position
eT a_best_err = Datum<eT>::inf;
eT b_best_err = Datum<eT>::inf;
for(uword j=a_best_j; j<NG; ++j) for(uword j=a_best_j; j<NG; ++j)
{ {
const eT tmp = XG_mem[j] - XI_val; const eT tmp = XG_mem[j] - XI_val;
const eT err = (tmp >= eT(0)) ? tmp : -tmp; const eT err = (tmp >= eT(0)) ? tmp : -tmp;
if(err >= a_best_err) if(err >= a_best_err)
{ {
if(err < b_best_err)
{
b_best_err = err;
b_best_j = j;
}
break; break;
} }
else else
{ {
b_best_err = a_best_err;
b_best_j = a_best_j;
a_best_err = err; a_best_err = err;
a_best_j = j; a_best_j = j;
} }
} }
if( (XG_mem[a_best_j] - XI_val) <= eT(0) )
{
// a_best_j is to the left of the interpolated position
b_best_j = ( (a_best_j+1) < NG) ? (a_best_j+1) : a_best_j;
}
else
{
// a_best_j is to the right of the interpolated position
b_best_j = (a_best_j >= 1) ? (a_best_j-1) : a_best_j;
}
b_best_err = std::abs( XG_mem[b_best_j] - XI_val );
if(a_best_j > b_best_j) if(a_best_j > b_best_j)
{ {
std::swap(a_best_j, b_best_j ); std::swap(a_best_j, b_best_j );
std::swap(a_best_err, b_best_err); std::swap(a_best_err, b_best_err);
} }
const eT weight = a_best_err / (a_best_err + b_best_err); const eT weight = (a_best_err > eT(0)) ? (a_best_err / (a_best_err + b_ best_err)) : eT(0);
YI_mem[i] = (eT(1) - weight)*YG_mem[a_best_j] + (weight)*YG_mem[b_best_ j]; YI_mem[i] = (eT(1) - weight)*YG_mem[a_best_j] + (weight)*YG_mem[b_best_ j];
} }
} }
template<typename eT> template<typename eT>
inline inline
void void
interp1_helper(const Mat<eT>& X, const Mat<eT>& Y, const Mat<eT>& XI, Mat<e T>& YI, const uword sig) interp1_helper(const Mat<eT>& X, const Mat<eT>& Y, const Mat<eT>& XI, Mat<e T>& YI, const uword sig)
{ {
 End of changes. 6 change blocks. 
13 lines changed or deleted 19 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/