"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "include/armadillo_bits/op_hist_meat.hpp" between
armadillo-10.2.0.tar.xz and armadillo-10.2.1.tar.xz

About: Armadillo is a C++ linear algebra library (matrix maths) aiming towards a good balance between speed and ease of use.

op_hist_meat.hpp  (armadillo-10.2.0.tar.xz):op_hist_meat.hpp  (armadillo-10.2.1.tar.xz)
skipping to change at line 57 skipping to change at line 57
} }
if(i < A_n_elem) if(i < A_n_elem)
{ {
const eT val_i = A_mem[i]; const eT val_i = A_mem[i];
if(min_val > val_i) { min_val = val_i; } if(min_val > val_i) { min_val = val_i; }
if(max_val < val_i) { max_val = val_i; } if(max_val < val_i) { max_val = val_i; }
} }
if(min_val == max_val)
{
min_val -= (n_bins/2);
max_val += (n_bins/2);
}
if(arma_isfinite(min_val) == false) { min_val = priv::most_neg<eT>(); } if(arma_isfinite(min_val) == false) { min_val = priv::most_neg<eT>(); }
if(arma_isfinite(max_val) == false) { max_val = priv::most_pos<eT>(); } if(arma_isfinite(max_val) == false) { max_val = priv::most_pos<eT>(); }
Col<eT> c(n_bins); Col<eT> c(n_bins);
eT* c_mem = c.memptr(); eT* c_mem = c.memptr();
for(uword ii=0; ii < n_bins; ++ii) for(uword ii=0; ii < n_bins; ++ii)
{ {
c_mem[ii] = (0.5 + ii) / double(n_bins); // TODO: may need to be modified for integer matrices c_mem[ii] = (0.5 + ii) / double(n_bins);
} }
c = ((max_val - min_val) * c) + min_val; c = ((max_val - min_val) * c) + min_val;
glue_hist::apply_noalias(out, A, c, dim); glue_hist::apply_noalias(out, A, c, dim);
} }
template<typename T1> template<typename T1>
inline inline
void void
op_hist::apply(Mat<uword>& out, const mtOp<uword, T1, op_hist>& X) op_hist::apply(Mat<uword>& out, const mtOp<uword, T1, op_hist>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
const uword n_bins = X.aux_uword_a; const uword n_bins = X.aux_uword_a;
const quasi_unwrap<T1> U(X.m); const quasi_unwrap<T1> U(X.m);
const uword dim = (T1::is_xvec) ? uword(U.M.is_rowvec() ? 1 : 0) : uword((T1:: is_row) ? 1 : 0); const uword dim = (T1::is_xvec) ? uword(U.M.is_rowvec() ? 1 : 0) : uword((T1:: is_row) ? 1 : 0);
if(U.is_alias(out)) if(is_non_integral<typename T1::elem_type>::value)
{ {
Mat<uword> tmp; if(U.is_alias(out))
{
op_hist::apply_noalias(tmp, U.M, n_bins, dim); Mat<uword> tmp;
out.steal_mem(tmp); op_hist::apply_noalias(tmp, U.M, n_bins, dim);
out.steal_mem(tmp);
}
else
{
op_hist::apply_noalias(out, U.M, n_bins, dim);
}
} }
else else
{ {
op_hist::apply_noalias(out, U.M, n_bins, dim); Mat<double> converted = conv_to< Mat<double> >::from(U.M);
op_hist::apply_noalias(out, converted, n_bins, dim);
} }
} }
//! @} //! @}
 End of changes. 5 change blocks. 
8 lines changed or deleted 23 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)