OpCube_meat.hpp   OpCube_meat.hpp 
skipping to change at line 63 skipping to change at line 63
: m(in_m.get_ref()) : m(in_m.get_ref())
, aux(aux) , aux(aux)
, aux_u32_a(in_aux_u32_a) , aux_u32_a(in_aux_u32_a)
, aux_u32_b(in_aux_u32_b) , aux_u32_b(in_aux_u32_b)
, aux_u32_c(in_aux_u32_c) , aux_u32_c(in_aux_u32_c)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
} }
template<typename T1, typename op_type> template<typename T1, typename op_type>
OpCube<T1, op_type>::OpCube(const BaseCube<typename T1::elem_type, T1>& in_
m, const typename T1::elem_type in_aux, const u32 in_aux_u32_a, const u32 i
n_aux_u32_b, const u32 in_aux_u32_c)
: m(in_m.get_ref())
, aux(in_aux)
, aux_u32_a(in_aux_u32_a)
, aux_u32_b(in_aux_u32_b)
, aux_u32_c(in_aux_u32_c)
{
arma_extra_debug_sigprint();
}
template<typename T1, typename op_type>
OpCube<T1, op_type>::OpCube(const u32 in_aux_u32_a, const u32 in_aux_u32_b, const u32 in_aux_u32_c) OpCube<T1, op_type>::OpCube(const u32 in_aux_u32_a, const u32 in_aux_u32_b, const u32 in_aux_u32_c)
: m(m) : m(m)
, aux(aux) , aux(aux)
, aux_u32_a(in_aux_u32_a) , aux_u32_a(in_aux_u32_a)
, aux_u32_b(in_aux_u32_b) , aux_u32_b(in_aux_u32_b)
, aux_u32_c(in_aux_u32_c) , aux_u32_c(in_aux_u32_c)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
} }
 End of changes. 1 change blocks. 
0 lines changed or deleted 13 lines changed or added


 OpCube_proto.hpp   OpCube_proto.hpp 
skipping to change at line 32 skipping to change at line 32
{ {
public: public:
typedef typename T1::elem_type elem_type; typedef typename T1::elem_type elem_type;
typedef typename get_pod_type<elem_type>::pod_type pod_type; typedef typename get_pod_type<elem_type>::pod_type pod_type;
inline explicit OpCube(const BaseCube<typename T1::elem_type, T1>& in_m); inline explicit OpCube(const BaseCube<typename T1::elem_type, T1>& in_m);
inline OpCube(const BaseCube<typename T1::elem_type, T1>& in_m, const elem_type in_aux); inline OpCube(const BaseCube<typename T1::elem_type, T1>& in_m, const elem_type in_aux);
inline OpCube(const BaseCube<typename T1::elem_type, T1>& in_m, const u32 in_aux_u32_a, const u32 in_aux_u32_b); inline OpCube(const BaseCube<typename T1::elem_type, T1>& in_m, const u32 in_aux_u32_a, const u32 in_aux_u32_b);
inline OpCube(const BaseCube<typename T1::elem_type, T1>& in_m, const u32 in_aux_u32_a, const u32 in_aux_u32_b, const u32 in_aux_u32_c); inline OpCube(const BaseCube<typename T1::elem_type, T1>& in_m, const u32 in_aux_u32_a, const u32 in_aux_u32_b, const u32 in_aux_u32_c);
inline OpCube(const BaseCube<typename T1::elem_type, T1>& in_m, const elem_type in_aux, const u32 in_aux_u32_a, const u32 in_aux_u32_b, con st u32 in_aux_u32_c);
inline OpCube(const u32 in_aux_u32_a, const u32 in_aux_u32_b, co nst u32 in_aux_u32_c); inline OpCube(const u32 in_aux_u32_a, const u32 in_aux_u32_b, co nst u32 in_aux_u32_c);
inline ~OpCube(); inline ~OpCube();
// TODO:MAT: if the restriction to inputs of type BaseCube works, the use of the "junk" parameter may no longer be necessary // TODO:MAT: if the restriction to inputs of type BaseCube works, the use of the "junk" parameter may no longer be necessary
const T1& m; //!< storage of reference to the operand (e.g . a cube) const T1& m; //!< storage of reference to the operand (e.g . a cube)
const elem_type aux; //!< storage of auxiliary data, user defined format const elem_type aux; //!< storage of auxiliary data, user defined format
const u32 aux_u32_a; //!< storage of auxiliary data, u32 format const u32 aux_u32_a; //!< storage of auxiliary data, u32 format
const u32 aux_u32_b; //!< storage of auxiliary data, u32 format const u32 aux_u32_b; //!< storage of auxiliary data, u32 format
const u32 aux_u32_c; //!< storage of auxiliary data, u32 format const u32 aux_u32_c; //!< storage of auxiliary data, u32 format
 End of changes. 1 change blocks. 
0 lines changed or deleted 1 lines changed or added


 Op_meat.hpp   Op_meat.hpp 
skipping to change at line 39 skipping to change at line 39
Op<T1, op_type>::Op(const T1& in_m, const typename T1::elem_type in_aux) Op<T1, op_type>::Op(const T1& in_m, const typename T1::elem_type in_aux)
: m(in_m) : m(in_m)
, aux(in_aux) , aux(in_aux)
, aux_u32_a(aux_u32_a) , aux_u32_a(aux_u32_a)
, aux_u32_b(aux_u32_b) , aux_u32_b(aux_u32_b)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
} }
template<typename T1, typename op_type> template<typename T1, typename op_type>
//Op<T1, op_type>::Op(const T1& in_m, const u32 in_aux_u32_a, const u32 in_ aux_u32_b = 0)
Op<T1, op_type>::Op(const T1& in_m, const u32 in_aux_u32_a, const u32 in_au x_u32_b) Op<T1, op_type>::Op(const T1& in_m, const u32 in_aux_u32_a, const u32 in_au x_u32_b)
: m(in_m) : m(in_m)
, aux(aux) , aux(aux)
, aux_u32_a(in_aux_u32_a) , aux_u32_a(in_aux_u32_a)
, aux_u32_b(in_aux_u32_b) , aux_u32_b(in_aux_u32_b)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
} }
template<typename T1, typename op_type> template<typename T1, typename op_type>
Op<T1, op_type>::Op(const T1& in_m, const typename T1::elem_type in_aux, co
nst u32 in_aux_u32_a, const u32 in_aux_u32_b)
: m(in_m)
, aux(in_aux)
, aux_u32_a(in_aux_u32_a)
, aux_u32_b(in_aux_u32_b)
{
arma_extra_debug_sigprint();
}
template<typename T1, typename op_type>
Op<T1, op_type>::Op(const u32 in_aux_u32_a, const u32 in_aux_u32_b, const c har junk) Op<T1, op_type>::Op(const u32 in_aux_u32_a, const u32 in_aux_u32_b, const c har junk)
: m(m) : m(m)
, aux(aux) , aux(aux)
, aux_u32_a(in_aux_u32_a) , aux_u32_a(in_aux_u32_a)
, aux_u32_b(in_aux_u32_b) , aux_u32_b(in_aux_u32_b)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
} }
template<typename T1, typename op_type> template<typename T1, typename op_type>
 End of changes. 2 change blocks. 
1 lines changed or deleted 11 lines changed or added


 Op_proto.hpp   Op_proto.hpp 
skipping to change at line 39 skipping to change at line 39
class Op : public Base<typename T1::elem_type, Op<T1, op_type> > class Op : public Base<typename T1::elem_type, Op<T1, op_type> >
{ {
public: public:
typedef typename T1::elem_type elem_type; typedef typename T1::elem_type elem_type;
typedef typename get_pod_type<elem_type>::pod_type pod_type; typedef typename get_pod_type<elem_type>::pod_type pod_type;
inline explicit Op(const T1& in_m); inline explicit Op(const T1& in_m);
inline Op(const T1& in_m, const elem_type in_aux); inline Op(const T1& in_m, const elem_type in_aux);
inline Op(const T1& in_m, const u32 in_aux_u32_a, const u32 in_a ux_u32_b); inline Op(const T1& in_m, const u32 in_aux_u32_a, const u32 in_a ux_u32_b);
inline Op(const T1& in_m, const elem_type in_aux, const u32 in_a ux_u32_a, const u32 in_aux_u32_b);
inline Op(const u32 in_aux_u32_a, const u32 in_aux_u32_b, const char junk); inline Op(const u32 in_aux_u32_a, const u32 in_aux_u32_b, const char junk);
inline ~Op(); inline ~Op();
const T1& m; //!< storage of reference to the operand (e.g . a matrix) const T1& m; //!< storage of reference to the operand (e.g . a matrix)
const elem_type aux; //!< storage of auxiliary data, user defined format const elem_type aux; //!< storage of auxiliary data, user defined format
const u32 aux_u32_a; //!< storage of auxiliary data, u32 format const u32 aux_u32_a; //!< storage of auxiliary data, u32 format
const u32 aux_u32_b; //!< storage of auxiliary data, u32 format const u32 aux_u32_b; //!< storage of auxiliary data, u32 format
}; };
 End of changes. 1 change blocks. 
0 lines changed or deleted 1 lines changed or added


 armadillo   armadillo 
skipping to change at line 177 skipping to change at line 177
#include "armadillo_bits/op_randn_proto.hpp" #include "armadillo_bits/op_randn_proto.hpp"
#include "armadillo_bits/op_scalar_misc_proto.hpp" #include "armadillo_bits/op_scalar_misc_proto.hpp"
#include "armadillo_bits/op_sort_proto.hpp" #include "armadillo_bits/op_sort_proto.hpp"
#include "armadillo_bits/op_sum_proto.hpp" #include "armadillo_bits/op_sum_proto.hpp"
#include "armadillo_bits/op_stddev_proto.hpp" #include "armadillo_bits/op_stddev_proto.hpp"
#include "armadillo_bits/op_trig_proto.hpp" #include "armadillo_bits/op_trig_proto.hpp"
#include "armadillo_bits/op_trans_proto.hpp" #include "armadillo_bits/op_trans_proto.hpp"
#include "armadillo_bits/op_var_proto.hpp" #include "armadillo_bits/op_var_proto.hpp"
#include "armadillo_bits/op_zeros_proto.hpp" #include "armadillo_bits/op_zeros_proto.hpp"
#include "armadillo_bits/op_repmat_proto.hpp" #include "armadillo_bits/op_repmat_proto.hpp"
#include "armadillo_bits/op_reshape_proto.hpp"
#include "armadillo_bits/op_cov_proto.hpp"
#include "armadillo_bits/op_cor_proto.hpp"
#include "armadillo_bits/glue_plus_proto.hpp" #include "armadillo_bits/glue_plus_proto.hpp"
#include "armadillo_bits/glue_minus_proto.hpp" #include "armadillo_bits/glue_minus_proto.hpp"
#include "armadillo_bits/glue_times_proto.hpp" #include "armadillo_bits/glue_times_proto.hpp"
#include "armadillo_bits/glue_schur_proto.hpp" #include "armadillo_bits/glue_schur_proto.hpp"
#include "armadillo_bits/glue_div_proto.hpp" #include "armadillo_bits/glue_div_proto.hpp"
#include "armadillo_bits/glue_cov_proto.hpp"
#include "armadillo_bits/glue_cor_proto.hpp"
#include "armadillo_bits/glue_cube_plus_proto.hpp" #include "armadillo_bits/glue_cube_plus_proto.hpp"
#include "armadillo_bits/glue_cube_minus_proto.hpp" #include "armadillo_bits/glue_cube_minus_proto.hpp"
#include "armadillo_bits/glue_cube_schur_proto.hpp" #include "armadillo_bits/glue_cube_schur_proto.hpp"
#include "armadillo_bits/glue_cube_div_proto.hpp" #include "armadillo_bits/glue_cube_div_proto.hpp"
// //
// debugging functions // debugging functions
#include "armadillo_bits/debug.hpp" #include "armadillo_bits/debug.hpp"
skipping to change at line 269 skipping to change at line 275
#include "armadillo_bits/fn_stddev.hpp" #include "armadillo_bits/fn_stddev.hpp"
#include "armadillo_bits/fn_var.hpp" #include "armadillo_bits/fn_var.hpp"
#include "armadillo_bits/fn_sort.hpp" #include "armadillo_bits/fn_sort.hpp"
#include "armadillo_bits/fn_sort_index.hpp" #include "armadillo_bits/fn_sort_index.hpp"
#include "armadillo_bits/fn_htrans.hpp" #include "armadillo_bits/fn_htrans.hpp"
#include "armadillo_bits/fn_chol.hpp" #include "armadillo_bits/fn_chol.hpp"
#include "armadillo_bits/fn_qr.hpp" #include "armadillo_bits/fn_qr.hpp"
#include "armadillo_bits/fn_svd.hpp" #include "armadillo_bits/fn_svd.hpp"
#include "armadillo_bits/fn_solve.hpp" #include "armadillo_bits/fn_solve.hpp"
#include "armadillo_bits/fn_repmat.hpp" #include "armadillo_bits/fn_repmat.hpp"
#include "armadillo_bits/fn_reshape.hpp"
#include "armadillo_bits/fn_cov.hpp"
#include "armadillo_bits/fn_cor.hpp"
// //
// class meat // class meat
#include "armadillo_bits/gemm.hpp" #include "armadillo_bits/gemm.hpp"
#include "armadillo_bits/gemv.hpp" #include "armadillo_bits/gemv.hpp"
#include "armadillo_bits/gemm_mixed.hpp" #include "armadillo_bits/gemm_mixed.hpp"
#include "armadillo_bits/podarray_meat.hpp" #include "armadillo_bits/podarray_meat.hpp"
#include "armadillo_bits/auxlib_meat.hpp" #include "armadillo_bits/auxlib_meat.hpp"
skipping to change at line 316 skipping to change at line 325
#include "armadillo_bits/op_randn_meat.hpp" #include "armadillo_bits/op_randn_meat.hpp"
#include "armadillo_bits/op_scalar_misc_meat.hpp" #include "armadillo_bits/op_scalar_misc_meat.hpp"
#include "armadillo_bits/op_sort_meat.hpp" #include "armadillo_bits/op_sort_meat.hpp"
#include "armadillo_bits/op_sum_meat.hpp" #include "armadillo_bits/op_sum_meat.hpp"
#include "armadillo_bits/op_stddev_meat.hpp" #include "armadillo_bits/op_stddev_meat.hpp"
#include "armadillo_bits/op_trans_meat.hpp" #include "armadillo_bits/op_trans_meat.hpp"
#include "armadillo_bits/op_trig_meat.hpp" #include "armadillo_bits/op_trig_meat.hpp"
#include "armadillo_bits/op_var_meat.hpp" #include "armadillo_bits/op_var_meat.hpp"
#include "armadillo_bits/op_zeros_meat.hpp" #include "armadillo_bits/op_zeros_meat.hpp"
#include "armadillo_bits/op_repmat_meat.hpp" #include "armadillo_bits/op_repmat_meat.hpp"
#include "armadillo_bits/op_reshape_meat.hpp"
#include "armadillo_bits/op_cov_meat.hpp"
#include "armadillo_bits/op_cor_meat.hpp"
#include "armadillo_bits/glue_plus_meat.hpp" #include "armadillo_bits/glue_plus_meat.hpp"
#include "armadillo_bits/glue_minus_meat.hpp" #include "armadillo_bits/glue_minus_meat.hpp"
#include "armadillo_bits/glue_times_meat.hpp" #include "armadillo_bits/glue_times_meat.hpp"
#include "armadillo_bits/glue_schur_meat.hpp" #include "armadillo_bits/glue_schur_meat.hpp"
#include "armadillo_bits/glue_div_meat.hpp" #include "armadillo_bits/glue_div_meat.hpp"
#include "armadillo_bits/glue_cov_meat.hpp"
#include "armadillo_bits/glue_cor_meat.hpp"
#include "armadillo_bits/glue_cube_plus_meat.hpp" #include "armadillo_bits/glue_cube_plus_meat.hpp"
#include "armadillo_bits/glue_cube_minus_meat.hpp" #include "armadillo_bits/glue_cube_minus_meat.hpp"
#include "armadillo_bits/glue_cube_schur_meat.hpp" #include "armadillo_bits/glue_cube_schur_meat.hpp"
#include "armadillo_bits/glue_cube_div_meat.hpp" #include "armadillo_bits/glue_cube_div_meat.hpp"
} }
#endif #endif
 End of changes. 5 change blocks. 
0 lines changed or deleted 15 lines changed or added


 auxlib_meat.hpp   auxlib_meat.hpp 
skipping to change at line 596 skipping to change at line 596
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( ( (&P == &L) || (&P == &U) ), "auxlib::lu(): P is the s ame object as L or U" ); arma_debug_check( ( (&P == &L) || (&P == &U) ), "auxlib::lu(): P is the s ame object as L or U" );
podarray<int> ipiv; podarray<int> ipiv;
auxlib::lu(L, U, ipiv, X); auxlib::lu(L, U, ipiv, X);
const u32 n = ipiv.n_elem; const u32 n = ipiv.n_elem;
P.set_size(n,n); Mat<u32> P_tmp(n,n);
Mat<eT> ident = eye(n,n); Mat<u32> ident = eye< Mat<u32> >(n,n);
for(u32 i=n; i>0; --i) for(u32 i=n; i>0; --i)
{ {
const u32 j = i-1; const u32 j = i-1;
const u32 k = ipiv[j]; const u32 k = ipiv[j];
ident.swap_rows(j,k); ident.swap_rows(j,k);
if(i == n) if(i == n)
{ {
P = ident; P_tmp = ident;
} }
else else
{ {
P *= ident; P_tmp *= ident;
} }
ident.swap_rows(j,k); ident.swap_rows(j,k);
} }
P = conv_to< Mat<eT> >::from(P_tmp);
} }
template<typename eT> template<typename eT>
inline inline
void void
auxlib::lu(Mat<eT>& L, Mat<eT>& U, const Mat<eT>& X) auxlib::lu(Mat<eT>& L, Mat<eT>& U, const Mat<eT>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
podarray<int> ipiv; podarray<int> ipiv;
 End of changes. 4 change blocks. 
4 lines changed or deleted 5 lines changed or added


 config.hpp   config.hpp 
skipping to change at line 43 skipping to change at line 43
#if !defined(ARMA_ATLAS_INCLUDE_DIR) #if !defined(ARMA_ATLAS_INCLUDE_DIR)
#define ARMA_ATLAS_INCLUDE_DIR /usr/include #define ARMA_ATLAS_INCLUDE_DIR /usr/include
#endif #endif
#endif #endif
#if defined(__CUDACC__) #if defined(__CUDACC__)
#undef ARMA_HAVE_STD_ISFINITE #undef ARMA_HAVE_STD_ISFINITE
#undef ARMA_HAVE_STD_ISINF #undef ARMA_HAVE_STD_ISINF
#undef ARMA_HAVE_STD_ISNAN #undef ARMA_HAVE_STD_ISNAN
#endif #endif
#if defined(__INTEL_COMPILER)
#if (__INTEL_COMPILER <= 1110)
#undef ARMA_HAVE_STD_ISFINITE
#endif
#endif
 End of changes. 1 change blocks. 
0 lines changed or deleted 0 lines changed or added


 constants.hpp   constants.hpp 
skipping to change at line 158 skipping to change at line 158
typedef Math<float> fmath; typedef Math<float> fmath;
typedef Math<double> math; typedef Math<double> math;
typedef Phy<float> fphy; typedef Phy<float> fphy;
typedef Phy<double> phy; typedef Phy<double> phy;
struct arma_version struct arma_version
{ {
static const unsigned int major = 0; static const unsigned int major = 0;
static const unsigned int minor = 7; static const unsigned int minor = 7;
static const unsigned int patch = 0; static const unsigned int patch = 2;
}; };
struct arma_config struct arma_config
{ {
#if defined(ARMA_USE_ATLAS) #if defined(ARMA_USE_ATLAS)
static const bool atlas = true; static const bool atlas = true;
#else #else
static const bool atlas = false; static const bool atlas = false;
#endif #endif
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 fn_misc.hpp   fn_misc.hpp 
skipping to change at line 63 skipping to change at line 63
inline inline
mat mat
linspace(const double start, const double end, const u32 num, const u32 dim = 0) linspace(const double start, const double end, const u32 num, const u32 dim = 0)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return linspace<double>(start, end, num, dim); return linspace<double>(start, end, num, dim);
} }
// //
// reshape
template<typename T1>
inline
Mat<typename T1::elem_type>
reshape(const Base<typename T1::elem_type,T1>& X, const u32 in_n_rows, cons
t u32 in_n_cols, const u32 dim = 0)
{
arma_extra_debug_sigprint();
typedef typename T1::elem_type eT;
const unwrap<T1> A_tmp(X.get_ref());
const Mat<eT>& A = A_tmp.M;
const u32 in_n_elem = in_n_rows * in_n_cols;
arma_debug_check( (A.n_elem != in_n_elem), "reshape(): incompatible dimen
sions");
arma_debug_check( (dim > 1), "reshape(): dim must be 0 or 1");
if(dim == 0)
{
return Mat<eT>(A.mem, in_n_rows, in_n_cols);
}
else
{
Mat<eT> out(in_n_rows, in_n_cols);
eT* out_mem = out.memptr();
u32 i = 0;
for(u32 row=0; row<A.n_rows; ++row)
{
for(u32 col=0; col<A.n_cols; ++col)
{
out_mem[i] = A.at(row,col);
++i;
}
}
return out;
}
}
template<typename T1>
inline
Cube<typename T1::elem_type>
reshape(const BaseCube<typename T1::elem_type,T1>& X, const u32 in_n_rows,
const u32 in_n_cols, const u32 in_n_slices, const u32 dim = 0)
{
arma_extra_debug_sigprint();
typedef typename T1::elem_type eT;
const unwrap_cube<T1> A_tmp(X.get_ref());
const Cube<eT>& A = A_tmp.M;
const u32 in_n_elem = in_n_rows * in_n_cols * in_n_slices;
arma_debug_check( (A.n_elem != in_n_elem), "reshape(): incompatible dimen
sions");
arma_debug_check( (dim > 1), "reshape(): dim must be 0 or 1");
if(dim == 0)
{
return Cube<eT>(A.mem, in_n_rows, in_n_cols, in_n_slices);
}
else
{
Cube<eT> out(in_n_rows, in_n_cols, in_n_slices);
eT* out_mem = out.memptr();
u32 i = 0;
for(u32 slice=0; slice<A.n_slices; ++slice)
{
for(u32 row=0; row<A.n_rows; ++row)
{
for(u32 col=0; col<A.n_cols; ++col)
{
out_mem[i] = A.at(row,col,slice);
++i;
}
}
}
return out;
}
}
//
// real // real
template<typename T, typename T1> template<typename T, typename T1>
inline inline
Mat<T> Mat<T>
real(const Base<std::complex<T>, T1>& X) real(const Base<std::complex<T>, T1>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef std::complex<T> eT; typedef std::complex<T> eT;
 End of changes. 1 change blocks. 
92 lines changed or deleted 0 lines changed or added


 fn_repmat.hpp   fn_repmat.hpp 
// Copyright (C) 2009 Dimitrios Bouzas
// Copyright (C) 2009 NICTA // Copyright (C) 2009 NICTA
// Copyright (C) 2009 Dimitrios Bouzas
// //
// Authors: // Authors:
// - Dimitrios Bouzas (dimitris dot mpouzas at gmail dot com)
// - Conrad Sanderson (conradsand at ieee dot org) // - Conrad Sanderson (conradsand at ieee dot org)
// - Dimitrios Bouzas (dimitris dot mpouzas at gmail dot com)
// //
// This file is part of the Armadillo C++ library. // This file is part of the Armadillo C++ library.
// It is provided without any warranty of fitness // It is provided without any warranty of fitness
// for any purpose. You can redistribute this file // for any purpose. You can redistribute this file
// and/or modify it under the terms of the GNU // and/or modify it under the terms of the GNU
// Lesser General Public License (LGPL) as published // Lesser General Public License (LGPL) as published
// by the Free Software Foundation, either version 3 // by the Free Software Foundation, either version 3
// of the License or (at your option) any later version. // of the License or (at your option) any later version.
// (see http://www.opensource.org/licenses for more info) // (see http://www.opensource.org/licenses for more info)
 End of changes. 4 change blocks. 
2 lines changed or deleted 2 lines changed or added


 glue_cube_div_meat.hpp   glue_cube_div_meat.hpp 
skipping to change at line 33 skipping to change at line 33
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_assert_same_size(A, B, "element-wise cube division"); arma_debug_assert_same_size(A, B, "element-wise cube division");
// no aliasing problem // no aliasing problem
//out.set_size(A.n_rows, A.n_cols, A.n_slices); //out.set_size(A.n_rows, A.n_cols, A.n_slices);
out.copy_size(A); out.copy_size(A);
const u32 n_elem = A.n_elem; const u32 n_elem = A.n_elem;
eT* out_mem = out.memptr();
const eT* A_mem = A.mem;
const eT* B_mem = B.mem;
for(u32 i=0; i<n_elem; ++i) for(u32 i=0; i<n_elem; ++i)
{ {
out[i] = A.mem[i] / B.mem[i]; out_mem[i] = A_mem[i] / B_mem[i];
} }
} }
template<typename eT> template<typename eT>
inline inline
void void
glue_cube_div::apply(Cube<eT>& out, const Cube<eT>& A, const Cube<eT>& B, c onst Cube<eT>& C) glue_cube_div::apply(Cube<eT>& out, const Cube<eT>& A, const Cube<eT>& B, c onst Cube<eT>& C)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_assert_same_size(A, B, "element-wise cube division"); arma_debug_assert_same_size(A, B, "element-wise cube division");
arma_debug_assert_same_size(B, C, "element-wise cube division"); arma_debug_assert_same_size(B, C, "element-wise cube division");
// no aliasing problem // no aliasing problem
//out.set_size(A.n_rows, A.n_cols, A.n_slices); //out.set_size(A.n_rows, A.n_cols, A.n_slices);
out.copy_size(A); out.copy_size(A);
const u32 n_elem = A.n_elem; const u32 n_elem = A.n_elem;
for(u32 i=0; i != n_elem; ++i)
eT* out_mem = out.memptr();
const eT* A_mem = A.mem;
const eT* B_mem = B.mem;
const eT* C_mem = C.mem;
for(u32 i=0; i<n_elem; ++i)
{ {
out[i] = A.mem[i] / B.mem[i] / C.mem[i]; out_mem[i] = A_mem[i] / B_mem[i] / C_mem[i];
} }
} }
template<typename eT> template<typename eT>
inline inline
void void
glue_cube_div::apply(Cube<eT>& out, const GlueCube<Cube<eT>,Cube<eT>,glue_c ube_div>& X) glue_cube_div::apply(Cube<eT>& out, const GlueCube<Cube<eT>,Cube<eT>,glue_c ube_div>& X)
{ {
glue_cube_div::apply(out, X.A, X.B); glue_cube_div::apply(out, X.A, X.B);
skipping to change at line 157 skipping to change at line 167
inline inline
void void
glue_cube_div::apply_inplace(Cube<eT>& out, const Cube<eT>& B) glue_cube_div::apply_inplace(Cube<eT>& out, const Cube<eT>& B)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_assert_same_size(out, B, "element-wise cube division"); arma_debug_assert_same_size(out, B, "element-wise cube division");
const u32 n_elem = out.n_elem; const u32 n_elem = out.n_elem;
eT* out_mem = out.memptr();
const eT* B_mem = B.mem;
for(u32 i=0; i<n_elem; ++i) for(u32 i=0; i<n_elem; ++i)
{ {
out[i] /= B.mem[i]; out_mem[i] /= B_mem[i];
} }
} }
template<typename T1, typename op_cube_type> template<typename T1, typename op_cube_type>
inline inline
void void
glue_cube_div::apply_inplace(Cube<typename T1::elem_type>& out, const OpCub e<T1, op_cube_type>& X) glue_cube_div::apply_inplace(Cube<typename T1::elem_type>& out, const OpCub e<T1, op_cube_type>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
const Cube<eT> tmp(X); const Cube<eT> tmp(X);
glue_cube_div::apply(out, out, tmp); glue_cube_div::apply_inplace(out, tmp);
} }
template<typename T1, typename T2, typename glue_cube_type> template<typename T1, typename T2, typename glue_cube_type>
inline inline
void void
glue_cube_div::apply_inplace(Cube<typename T1::elem_type>& out, const GlueC ube<T1, T2, glue_cube_type>& X) glue_cube_div::apply_inplace(Cube<typename T1::elem_type>& out, const GlueC ube<T1, T2, glue_cube_type>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
const Cube<eT> tmp(X); const Cube<eT> tmp(X);
glue_cube_div::apply(out, X, out); glue_cube_div::apply_inplace(out, tmp);
} }
// //
// element-wise division with different element types // element-wise division with different element types
template<typename eT1, typename eT2> template<typename eT1, typename eT2>
inline inline
void void
glue_cube_div::apply_mixed(Cube<typename promote_type<eT1,eT2>::result>& ou t, const Cube<eT1>& X, const Cube<eT2>& Y) glue_cube_div::apply_mixed(Cube<typename promote_type<eT1,eT2>::result>& ou t, const Cube<eT1>& X, const Cube<eT2>& Y)
{ {
 End of changes. 8 change blocks. 
6 lines changed or deleted 19 lines changed or added


 glue_cube_div_proto.hpp   glue_cube_div_proto.hpp 
skipping to change at line 18 skipping to change at line 18
// for any purpose. You can redistribute this file // for any purpose. You can redistribute this file
// and/or modify it under the terms of the GNU // and/or modify it under the terms of the GNU
// Lesser General Public License (LGPL) as published // Lesser General Public License (LGPL) as published
// by the Free Software Foundation, either version 3 // by the Free Software Foundation, either version 3
// of the License or (at your option) any later version. // of the License or (at your option) any later version.
// (see http://www.opensource.org/licenses for more info) // (see http://www.opensource.org/licenses for more info)
//! \addtogroup glue_cube_div //! \addtogroup glue_cube_div
//! @{ //! @{
//! Class which implements the immediate element-wise division of two or mo re matrices //! Class which implements the immediate element-wise division of two or mo re cubes
class glue_cube_div class glue_cube_div
{ {
public: public:
template<typename eT> template<typename eT>
inline static void apply(Cube<eT>& out, const Cube<eT>& A, const Cube<eT> & B); inline static void apply(Cube<eT>& out, const Cube<eT>& A, const Cube<eT> & B);
template<typename eT> template<typename eT>
inline static void apply(Cube<eT>& out, const Cube<eT>& A, const Cube<eT> & B, const Cube<eT>& C); inline static void apply(Cube<eT>& out, const Cube<eT>& A, const Cube<eT> & B, const Cube<eT>& C);
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 glue_cube_minus_meat.hpp   glue_cube_minus_meat.hpp 
skipping to change at line 194 skipping to change at line 194
template<typename T1, typename op_cube_type> template<typename T1, typename op_cube_type>
inline inline
void void
glue_cube_minus::apply_inplace(Cube<typename T1::elem_type>& out, const OpC ube<T1, op_cube_type>& X) glue_cube_minus::apply_inplace(Cube<typename T1::elem_type>& out, const OpC ube<T1, op_cube_type>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
const Cube<eT> tmp(X); const Cube<eT> tmp(X);
glue_cube_minus::apply(out, out, tmp); glue_cube_minus::apply_inplace(out, tmp);
} }
template<typename T1, typename T2, typename glue_cube_type> template<typename T1, typename T2, typename glue_cube_type>
inline inline
void void
glue_cube_minus::apply_inplace(Cube<typename T1::elem_type>& out, const Glu eCube<T1, T2, glue_cube_type>& X) glue_cube_minus::apply_inplace(Cube<typename T1::elem_type>& out, const Glu eCube<T1, T2, glue_cube_type>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 glue_cube_minus_proto.hpp   glue_cube_minus_proto.hpp 
skipping to change at line 18 skipping to change at line 18
// for any purpose. You can redistribute this file // for any purpose. You can redistribute this file
// and/or modify it under the terms of the GNU // and/or modify it under the terms of the GNU
// Lesser General Public License (LGPL) as published // Lesser General Public License (LGPL) as published
// by the Free Software Foundation, either version 3 // by the Free Software Foundation, either version 3
// of the License or (at your option) any later version. // of the License or (at your option) any later version.
// (see http://www.opensource.org/licenses for more info) // (see http://www.opensource.org/licenses for more info)
//! \addtogroup glue_cube_minus //! \addtogroup glue_cube_minus
//! @{ //! @{
//! Class for the minus operation, where the result is always a dense matri x //! Class which implements the immediate subtraction of cubes
class glue_cube_minus class glue_cube_minus
{ {
public: public:
// cube // cube
template<typename eT> template<typename eT>
inline static void apply(Cube<eT>& out, const Cube<eT>& A, const Cube<eT> & B); inline static void apply(Cube<eT>& out, const Cube<eT>& A, const Cube<eT> & B);
template<typename eT> template<typename eT>
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 glue_cube_schur_meat.hpp   glue_cube_schur_meat.hpp 
skipping to change at line 167 skipping to change at line 167
inline inline
void void
glue_cube_schur::apply_inplace(Cube<eT>& out, const Cube<eT>& B) glue_cube_schur::apply_inplace(Cube<eT>& out, const Cube<eT>& B)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_assert_same_size(out, B, "cube schur product"); arma_debug_assert_same_size(out, B, "cube schur product");
const u32 n_elem = out.n_elem; const u32 n_elem = out.n_elem;
eT* out_mem = out.memptr();
const eT* B_mem = B.mem;
for(u32 i=0; i<n_elem; ++i) for(u32 i=0; i<n_elem; ++i)
{ {
out[i] *= B.mem[i]; out_mem[i] *= B_mem[i];
} }
} }
template<typename T1, typename op_cube_type> template<typename T1, typename op_cube_type>
inline inline
void void
glue_cube_schur::apply_inplace(Cube<typename T1::elem_type>& out, const OpC ube<T1, op_cube_type>& X) glue_cube_schur::apply_inplace(Cube<typename T1::elem_type>& out, const OpC ube<T1, op_cube_type>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
const Cube<eT> tmp(X); const Cube<eT> tmp(X);
glue_cube_schur::apply(out, out, tmp); glue_cube_schur::apply_inplace(out, tmp);
} }
template<typename T1, typename T2, typename glue_cube_type> template<typename T1, typename T2, typename glue_cube_type>
inline inline
void void
glue_cube_schur::apply_inplace(Cube<typename T1::elem_type>& out, const Glu eCube<T1, T2, glue_cube_type>& X) glue_cube_schur::apply_inplace(Cube<typename T1::elem_type>& out, const Glu eCube<T1, T2, glue_cube_type>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
// out = X % out; // out = X % out;
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
const Cube<eT> tmp(X); const Cube<eT> tmp(X);
glue_cube_schur::apply(out, out, tmp); glue_cube_schur::apply_inplace(out, tmp);
} }
// //
// cube schur product with different element types // cube schur product with different element types
template<typename eT1, typename eT2> template<typename eT1, typename eT2>
inline inline
void void
glue_cube_schur::apply_mixed(Cube<typename promote_type<eT1,eT2>::result>& out, const Cube<eT1>& X, const Cube<eT2>& Y) glue_cube_schur::apply_mixed(Cube<typename promote_type<eT1,eT2>::result>& out, const Cube<eT1>& X, const Cube<eT2>& Y)
{ {
 End of changes. 4 change blocks. 
3 lines changed or deleted 6 lines changed or added


 glue_cube_schur_proto.hpp   glue_cube_schur_proto.hpp 
skipping to change at line 18 skipping to change at line 18
// for any purpose. You can redistribute this file // for any purpose. You can redistribute this file
// and/or modify it under the terms of the GNU // and/or modify it under the terms of the GNU
// Lesser General Public License (LGPL) as published // Lesser General Public License (LGPL) as published
// by the Free Software Foundation, either version 3 // by the Free Software Foundation, either version 3
// of the License or (at your option) any later version. // of the License or (at your option) any later version.
// (see http://www.opensource.org/licenses for more info) // (see http://www.opensource.org/licenses for more info)
//! \addtogroup glue_cube_schur //! \addtogroup glue_cube_schur
//! @{ //! @{
//! Class which implements the immediate Schur product (element-wise multip lication) of two or more matrices //! Class which implements the immediate Schur product (element-wise multip lication) of two or more cubes
class glue_cube_schur class glue_cube_schur
{ {
public: public:
// mat // mat
template<typename eT> template<typename eT>
inline static void apply(Cube<eT>& out, const Cube<eT>& A, const Cube<eT> & B); inline static void apply(Cube<eT>& out, const Cube<eT>& A, const Cube<eT> & B);
template<typename eT> template<typename eT>
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 glue_div_meat.hpp   glue_div_meat.hpp 
skipping to change at line 33 skipping to change at line 33
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_assert_same_size(A, B, "element-wise matrix division"); arma_debug_assert_same_size(A, B, "element-wise matrix division");
// no aliasing problem // no aliasing problem
//out.set_size(A.n_rows, A.n_cols); //out.set_size(A.n_rows, A.n_cols);
out.copy_size(A); out.copy_size(A);
const u32 n_elem = A.n_elem; const u32 n_elem = A.n_elem;
eT* out_mem = out.memptr();
const eT* A_mem = A.mem;
const eT* B_mem = B.mem;
for(u32 i=0; i<n_elem; ++i) for(u32 i=0; i<n_elem; ++i)
{ {
out[i] = A.mem[i] / B.mem[i]; out_mem[i] = A_mem[i] / B_mem[i];
} }
} }
template<typename eT> template<typename eT>
inline inline
void void
glue_div::apply(Mat<eT>& out, const Mat<eT>& A, const Mat<eT>& B, const Mat <eT>& C) glue_div::apply(Mat<eT>& out, const Mat<eT>& A, const Mat<eT>& B, const Mat <eT>& C)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_assert_same_size(A, B, "element-wise matrix division"); arma_debug_assert_same_size(A, B, "element-wise matrix division");
arma_debug_assert_same_size(B, C, "element-wise matrix division"); arma_debug_assert_same_size(B, C, "element-wise matrix division");
// no aliasing problem // no aliasing problem
//out.set_size(A.n_rows, A.n_cols); //out.set_size(A.n_rows, A.n_cols);
out.copy_size(A); out.copy_size(A);
const u32 n_elem = A.n_elem; const u32 n_elem = A.n_elem;
for(u32 i=0; i != n_elem; ++i)
eT* out_mem = out.memptr();
const eT* A_mem = A.mem;
const eT* B_mem = B.mem;
const eT* C_mem = C.mem;
for(u32 i=0; i<n_elem; ++i)
{ {
out[i] = A.mem[i] / B.mem[i] / C.mem[i]; out_mem[i] = A_mem[i] / B_mem[i] / C_mem[i];
} }
} }
template<typename eT> template<typename eT>
inline inline
void void
glue_div::apply(Mat<eT>& out, const Glue<Mat<eT>,Mat<eT>,glue_div>& X) glue_div::apply(Mat<eT>& out, const Glue<Mat<eT>,Mat<eT>,glue_div>& X)
{ {
glue_div::apply(out, X.A, X.B); glue_div::apply(out, X.A, X.B);
skipping to change at line 157 skipping to change at line 167
inline inline
void void
glue_div::apply_inplace(Mat<eT>& out, const Mat<eT>& B) glue_div::apply_inplace(Mat<eT>& out, const Mat<eT>& B)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_assert_same_size(out, B, "element-wise matrix division"); arma_debug_assert_same_size(out, B, "element-wise matrix division");
const u32 n_elem = out.n_elem; const u32 n_elem = out.n_elem;
eT* out_mem = out.memptr();
const eT* B_mem = B.mem;
for(u32 i=0; i<n_elem; ++i) for(u32 i=0; i<n_elem; ++i)
{ {
out[i] /= B.mem[i]; out_mem[i] /= B_mem[i];
} }
} }
template<typename T1, typename op_type> template<typename T1, typename op_type>
inline inline
void void
glue_div::apply_inplace(Mat<typename T1::elem_type>& out, const Op<T1, op_t ype>& X) glue_div::apply_inplace(Mat<typename T1::elem_type>& out, const Op<T1, op_t ype>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
const Mat<eT> tmp(X); const Mat<eT> tmp(X);
glue_div::apply(out, out, tmp); glue_div::apply_inplace(out, tmp);
} }
template<typename T1, typename T2, typename glue_type> template<typename T1, typename T2, typename glue_type>
inline inline
void void
glue_div::apply_inplace(Mat<typename T1::elem_type>& out, const Glue<T1, T2 , glue_type>& X) glue_div::apply_inplace(Mat<typename T1::elem_type>& out, const Glue<T1, T2 , glue_type>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
const Mat<eT> tmp(X); const Mat<eT> tmp(X);
glue_div::apply(out, X, out); glue_div::apply_inplace(out, tmp);
} }
// //
// element-wise division with different element types // element-wise division with different element types
template<typename eT1, typename eT2> template<typename eT1, typename eT2>
inline inline
void void
glue_div::apply_mixed(Mat<typename promote_type<eT1,eT2>::result>& out, con st Mat<eT1>& X, const Mat<eT2>& Y) glue_div::apply_mixed(Mat<typename promote_type<eT1,eT2>::result>& out, con st Mat<eT1>& X, const Mat<eT2>& Y)
{ {
 End of changes. 8 change blocks. 
6 lines changed or deleted 19 lines changed or added


 glue_minus_meat.hpp   glue_minus_meat.hpp 
skipping to change at line 194 skipping to change at line 194
template<typename T1, typename op_type> template<typename T1, typename op_type>
inline inline
void void
glue_minus::apply_inplace(Mat<typename T1::elem_type>& out, const Op<T1, op _type>& X) glue_minus::apply_inplace(Mat<typename T1::elem_type>& out, const Op<T1, op _type>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
const Mat<eT> tmp(X); const Mat<eT> tmp(X);
glue_minus::apply(out, out, tmp); glue_minus::apply_inplace(out, tmp);
} }
template<typename T1, typename T2, typename glue_type> template<typename T1, typename T2, typename glue_type>
inline inline
void void
glue_minus::apply_inplace(Mat<typename T1::elem_type>& out, const Glue<T1, T2, glue_type>& X) glue_minus::apply_inplace(Mat<typename T1::elem_type>& out, const Glue<T1, T2, glue_type>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 glue_plus_meat.hpp   glue_plus_meat.hpp 
skipping to change at line 349 skipping to change at line 349
template<typename T1, typename op_type> template<typename T1, typename op_type>
inline inline
void void
glue_plus::apply_inplace(Mat<typename T1::elem_type>& out, const Op<T1, op_ type>& X) glue_plus::apply_inplace(Mat<typename T1::elem_type>& out, const Op<T1, op_ type>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
const Mat<eT> tmp(X); const Mat<eT> tmp(X);
glue_plus::apply(out, out, tmp); glue_plus::apply_inplace(out, tmp);
} }
template<typename T1> template<typename T1>
inline inline
void void
glue_plus::apply_inplace(Mat<typename T1::elem_type>& out, const Op<T1, op_ square>& X) glue_plus::apply_inplace(Mat<typename T1::elem_type>& out, const Op<T1, op_ square>& X)
{ {
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 409 skipping to change at line 409
const Mat<eT>& A = tmp1.M; const Mat<eT>& A = tmp1.M;
const Mat<eT>& B = tmp2.M; const Mat<eT>& B = tmp2.M;
arma_debug_assert_mul_size(A, B, "matrix multiplication"); arma_debug_assert_mul_size(A, B, "matrix multiplication");
arma_debug_assert_same_size(out.n_rows, out.n_cols, A.n_rows, B.n_cols, " matrix addition"); arma_debug_assert_same_size(out.n_rows, out.n_cols, A.n_rows, B.n_cols, " matrix addition");
gemm<false,false,false,true>::apply(out, A, B, eT(1), eT(1)); gemm<false,false,false,true>::apply(out, A, B, eT(1), eT(1));
} }
template<typename T1, typename T2>
inline
void
glue_plus::apply_inplace(Mat<typename T1::elem_type>& out, const Glue<Op<T1
, op_trans>, T2, glue_times>& X)
{
arma_extra_debug_sigprint();
typedef typename T1::elem_type eT;
const unwrap_check<T1> tmp1(X.A.m, out);
const unwrap_check<T2> tmp2(X.B, out);
const Mat<eT>& A = tmp1.M;
const Mat<eT>& B = tmp2.M;
// we need to remember that A deliberately hasn't been transposed
arma_debug_assert_mul_size(A.n_cols, A.n_rows, B.n_rows, B.n_cols, "matri
x multiplication");
arma_debug_assert_same_size(out.n_rows, out.n_cols, A.n_cols, B.n_cols, "
matrix addition");
gemm<true,false,false,true>::apply(out, A, B, eT(1), eT(1));
}
template<typename T1, typename T2>
inline
void
glue_plus::apply_inplace(Mat<typename T1::elem_type>& out, const Glue<T1, O
p<T2, op_trans>, glue_times>& X)
{
arma_extra_debug_sigprint();
typedef typename T1::elem_type eT;
const unwrap_check<T1> tmp1(X.A, out);
const unwrap_check<T2> tmp2(X.B.m, out);
const Mat<eT>& A = tmp1.M;
const Mat<eT>& B = tmp2.M;
// we need to remember that B deliberately hasn't been transposed
arma_debug_assert_mul_size(A.n_rows, A.n_cols, B.n_cols, B.n_rows, "matri
x multiplication");
arma_debug_assert_same_size(out.n_rows, out.n_cols, A.n_rows, B.n_rows, "
matrix addition");
gemm<false,true,false,true>::apply(out, A, B, eT(1), eT(1));
}
template<typename T1, typename T2>
inline
void
glue_plus::apply_inplace(Mat<typename T1::elem_type>& out, const Glue<Op<T1
, op_trans>, Op<T2, op_trans>, glue_times>& X)
{
arma_extra_debug_sigprint();
typedef typename T1::elem_type eT;
const unwrap_check<T1> tmp1(X.A.m, out);
const unwrap_check<T2> tmp2(X.B.m, out);
const Mat<eT>& A = tmp1.M;
const Mat<eT>& B = tmp2.M;
// we need to remember that A and B deliberately haven't been transposed
arma_debug_assert_mul_size(A.n_cols, A.n_rows, B.n_cols, B.n_rows, "matri
x multiplication");
arma_debug_assert_same_size(out.n_rows, out.n_cols, A.n_cols, B.n_rows, "
matrix addition");
gemm<true,true,false,true>::apply(out, A, B, eT(1), eT(1));
}
template<typename T1, typename T2>
inline
void
glue_plus::apply_inplace(Mat<typename T1::elem_type>& out, const Glue<T1, T
2, glue_times_vec>& X)
{
arma_extra_debug_sigprint();
typedef typename T1::elem_type eT;
const unwrap_check<T1> tmp1(X.A, out);
const unwrap_check<T2> tmp2(X.B, out);
const Mat<eT>& A = tmp1.M;
const Mat<eT>& B = tmp2.M;
arma_debug_assert_mul_size(A, B, "vector multiplication");
arma_debug_assert_same_size(out.n_rows, out.n_cols, A.n_rows, B.n_cols, "
matrix addition");
if(A.is_vec() && B.is_vec())
{
if(A.n_cols == 1) // column * row (i.e. outer product)
{
glue_times_vec::mul_col_row_inplace_add(out, A.mem, B.mem);
}
else // row * column (i.e. inner product)
{
out[0] += op_dot::direct_dot(A.n_elem, A.mem, B.mem);
}
}
else // one of the arguments is a matrix
{
if(A.is_vec() == false) // A is a matrix, B is a vector
{
gemv<false,false,true>::apply(out.memptr(), A, B.mem, eT(1), eT(1));
}
else // A is a vector, B is a matrix
{
gemm<false,false,false,true>::apply(out, A, B, eT(1), eT(1));
}
}
}
template<typename T1, typename T2>
inline
void
glue_plus::apply_inplace(Mat<typename T1::elem_type>& out, const Glue<Op<T1
, op_trans>, T2, glue_times_vec>& X)
{
arma_extra_debug_sigprint();
typedef typename T1::elem_type eT;
const unwrap_check<T1> tmp1(X.A.m, out);
const unwrap_check<T2> tmp2(X.B, out);
const Mat<eT>& A = tmp1.M;
const Mat<eT>& B = tmp2.M;
// we need to remember that A deliberately hasn't been transposed
arma_debug_assert_mul_size(A.n_cols, A.n_rows, B.n_rows, B.n_cols, "vecto
r multiplication");
arma_debug_assert_same_size(out.n_rows, out.n_cols, A.n_cols, B.n_cols, "
matrix addition");
if(A.is_vec() && B.is_vec())
{
if(A.n_rows == 1) // trans(row) * row, equivalent to column * row (i.
e. outer product)
{
glue_times_vec::mul_col_row_inplace_add(out, A.mem, B.mem);
}
else // trans(column) * column, equivalent to row * column (i.e. inn
er product)
{
out[0] += op_dot::direct_dot(A.n_elem, A.mem, B.mem);
}
}
else // one of the arguments is a matrix
{
if(A.is_vec() == false) // A is a matrix, B is a vector
{
gemv<true,false,true>::apply(out.memptr(), A, B.mem, eT(1), eT(1));
}
else // A is a vector, B is a matrix
{
gemm<true,false,false,true>::apply(out, A, B, eT(1), eT(1));
}
}
}
// //
// //
// //
template<typename T1, typename T2> template<typename T1, typename T2>
inline inline
void void
glue_plus::apply glue_plus::apply
( (
Mat<typename T1::elem_type>& out, Mat<typename T1::elem_type>& out,
 End of changes. 2 change blocks. 
1 lines changed or deleted 173 lines changed or added


 glue_plus_proto.hpp   glue_plus_proto.hpp 
skipping to change at line 66 skipping to change at line 66
template<typename T1> template<typename T1>
inline static void apply_inplace(Mat<typename T1::elem_type>& out, const Op<T1, op_square>& X); inline static void apply_inplace(Mat<typename T1::elem_type>& out, const Op<T1, op_square>& X);
template<typename T1, typename T2, typename glue_type> template<typename T1, typename T2, typename glue_type>
inline static void apply_inplace(Mat<typename T1::elem_type>& out, const Glue<T1, T2, glue_type>& X); inline static void apply_inplace(Mat<typename T1::elem_type>& out, const Glue<T1, T2, glue_type>& X);
template<typename T1, typename T2> template<typename T1, typename T2>
inline static void apply_inplace(Mat<typename T1::elem_type>& out, const Glue<T1, T2, glue_times>& X); inline static void apply_inplace(Mat<typename T1::elem_type>& out, const Glue<T1, T2, glue_times>& X);
template<typename T1, typename T2>
inline static void apply_inplace(Mat<typename T1::elem_type>& out, const
Glue<Op<T1, op_trans>, T2, glue_times>& X);
template<typename T1, typename T2>
inline static void apply_inplace(Mat<typename T1::elem_type>& out, const
Glue<T1, Op<T2, op_trans>, glue_times>& X);
template<typename T1, typename T2>
inline static void apply_inplace(Mat<typename T1::elem_type>& out, const
Glue<Op<T1, op_trans>, Op<T2, op_trans>, glue_times>& X);
template<typename T1, typename T2>
inline static void apply_inplace(Mat<typename T1::elem_type>& out, const
Glue<T1, T2, glue_times_vec>& X);
template<typename T1, typename T2>
inline static void apply_inplace(Mat<typename T1::elem_type>& out, const
Glue<Op<T1, op_trans>, T2, glue_times_vec>& X);
// TODO:MAT: add handling for:
// Glue<T1, Op<T2, op_trans>, glue_times_vec>
// Glue<Op<T1,op_trans>. Op<T2, op_trans>, glue_times_Vec>
// mat, special // mat, special
template<typename T1, typename T2> template<typename T1, typename T2>
inline static void apply(Mat<typename T1::elem_type>& out, const Glue< Gl ue<T1, Col<typename T1::elem_type>, glue_times_vec>, T2, glue_plus>& in); inline static void apply(Mat<typename T1::elem_type>& out, const Glue< Gl ue<T1, Col<typename T1::elem_type>, glue_times_vec>, T2, glue_plus>& in);
template<typename T1, typename T2> template<typename T1, typename T2>
inline static void apply(Mat<typename T1::elem_type>& out, const Glue< Gl ue<Row<typename T1::elem_type>, T1, glue_times_vec>, T2, glue_plus>& in); inline static void apply(Mat<typename T1::elem_type>& out, const Glue< Gl ue<Row<typename T1::elem_type>, T1, glue_times_vec>, T2, glue_plus>& in);
template<typename T1, typename T2> template<typename T1, typename T2>
inline static void apply(Mat<typename T1::elem_type>& out, const Glue<Op< T1, op_scalar_times>, Op<T2, op_scalar_times>, glue_plus>& in); inline static void apply(Mat<typename T1::elem_type>& out, const Glue<Op< T1, op_scalar_times>, Op<T2, op_scalar_times>, glue_plus>& in);
 End of changes. 1 change blocks. 
0 lines changed or deleted 24 lines changed or added


 glue_schur_meat.hpp   glue_schur_meat.hpp 
skipping to change at line 167 skipping to change at line 167
inline inline
void void
glue_schur::apply_inplace(Mat<eT>& out, const Mat<eT>& B) glue_schur::apply_inplace(Mat<eT>& out, const Mat<eT>& B)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_assert_same_size(out, B, "matrix schur product"); arma_debug_assert_same_size(out, B, "matrix schur product");
const u32 n_elem = out.n_elem; const u32 n_elem = out.n_elem;
eT* out_mem = out.memptr();
const eT* B_mem = B.mem;
for(u32 i=0; i<n_elem; ++i) for(u32 i=0; i<n_elem; ++i)
{ {
out[i] *= B.mem[i]; out_mem[i] *= B_mem[i];
} }
} }
template<typename T1, typename op_type> template<typename T1, typename op_type>
inline inline
void void
glue_schur::apply_inplace(Mat<typename T1::elem_type>& out, const Op<T1, op _type>& X) glue_schur::apply_inplace(Mat<typename T1::elem_type>& out, const Op<T1, op _type>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
const Mat<eT> tmp(X); const Mat<eT> tmp(X);
glue_schur::apply(out, out, tmp); glue_schur::apply_inplace(out, tmp);
} }
template<typename T1, typename T2, typename glue_type> template<typename T1, typename T2, typename glue_type>
inline inline
void void
glue_schur::apply_inplace(Mat<typename T1::elem_type>& out, const Glue<T1, T2, glue_type>& X) glue_schur::apply_inplace(Mat<typename T1::elem_type>& out, const Glue<T1, T2, glue_type>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
// out = X % out; // out = X % out;
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
const Mat<eT> tmp(X); const Mat<eT> tmp(X);
glue_schur::apply(out, out, tmp); glue_schur::apply_inplace(out, tmp);
} }
// //
// matrix schur product with different element types // matrix schur product with different element types
template<typename eT1, typename eT2> template<typename eT1, typename eT2>
inline inline
void void
glue_schur::apply_mixed(Mat<typename promote_type<eT1,eT2>::result>& out, c onst Mat<eT1>& X, const Mat<eT2>& Y) glue_schur::apply_mixed(Mat<typename promote_type<eT1,eT2>::result>& out, c onst Mat<eT1>& X, const Mat<eT2>& Y)
{ {
 End of changes. 4 change blocks. 
3 lines changed or deleted 6 lines changed or added


 glue_times_meat.hpp   glue_times_meat.hpp 
skipping to change at line 875 skipping to change at line 875
eT* out_coldata = out.colptr(col); eT* out_coldata = out.colptr(col);
for(u32 row=0; row < n_rows; ++row) for(u32 row=0; row < n_rows; ++row)
{ {
out_coldata[row] = A[row] * val; out_coldata[row] = A[row] * val;
} }
} }
} }
template<typename eT>
inline
void
glue_times_vec::mul_col_row_inplace_add(Mat<eT>& out, const eT* A, const eT
* B)
{
const u32 n_rows = out.n_rows;
const u32 n_cols = out.n_cols;
for(u32 col=0; col < n_cols; ++col)
{
const eT val = B[col];
eT* out_coldata = out.colptr(col);
for(u32 row=0; row < n_rows; ++row)
{
out_coldata[row] += A[row] * val;
}
}
}
template<typename T1> template<typename T1>
inline inline
void void
glue_times_vec::apply(Mat<typename T1::elem_type>& out, const Glue<T1, Col< typename T1::elem_type>,glue_times_vec>& X) glue_times_vec::apply(Mat<typename T1::elem_type>& out, const Glue<T1, Col< typename T1::elem_type>,glue_times_vec>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
unwrap_check< T1 > tmp1(X.A, out); unwrap_check< T1 > tmp1(X.A, out);
 End of changes. 1 change blocks. 
0 lines changed or deleted 23 lines changed or added


 glue_times_proto.hpp   glue_times_proto.hpp 
skipping to change at line 115 skipping to change at line 115
}; };
class glue_times_vec class glue_times_vec
{ {
public: public:
template<typename eT> template<typename eT>
inline static void mul_col_row(Mat<eT>& out, const eT* A_mem, const eT* B _mem); inline static void mul_col_row(Mat<eT>& out, const eT* A_mem, const eT* B _mem);
template<typename eT>
inline static void mul_col_row_inplace_add(Mat<eT>& out, const eT* A_mem,
const eT* B_mem);
template<typename T1> template<typename T1>
inline static void apply(Mat<typename T1::elem_type>& out, const Glue<T1, Col<typename T1::elem_type>, glue_times_vec>& X); inline static void apply(Mat<typename T1::elem_type>& out, const Glue<T1, Col<typename T1::elem_type>, glue_times_vec>& X);
template<typename T1> template<typename T1>
inline static void apply(Mat<typename T1::elem_type>& out, const Glue<T1, Row<typename T1::elem_type>, glue_times_vec>& X); inline static void apply(Mat<typename T1::elem_type>& out, const Glue<T1, Row<typename T1::elem_type>, glue_times_vec>& X);
template<typename T1> template<typename T1>
inline static void apply(Mat<typename T1::elem_type>& out, const Glue<Col <typename T1::elem_type>, T1, glue_times_vec>& X); inline static void apply(Mat<typename T1::elem_type>& out, const Glue<Col <typename T1::elem_type>, T1, glue_times_vec>& X);
template<typename T1> template<typename T1>
 End of changes. 1 change blocks. 
0 lines changed or deleted 4 lines changed or added


 op_repmat_meat.hpp   op_repmat_meat.hpp 
// Copyright (C) 2009 Dimitrios Bouzas
// Copyright (C) 2009 NICTA // Copyright (C) 2009 NICTA
// Copyright (C) 2009 Dimitrios Bouzas
// //
// Authors: // Authors:
// - Dimitrios Bouzas (dimitris dot mpouzas at gmail dot com)
// - Conrad Sanderson (conradsand at ieee dot org) // - Conrad Sanderson (conradsand at ieee dot org)
// - Dimitrios Bouzas (dimitris dot mpouzas at gmail dot com)
// //
// This file is part of the Armadillo C++ library. // This file is part of the Armadillo C++ library.
// It is provided without any warranty of fitness // It is provided without any warranty of fitness
// for any purpose. You can redistribute this file // for any purpose. You can redistribute this file
// and/or modify it under the terms of the GNU // and/or modify it under the terms of the GNU
// Lesser General Public License (LGPL) as published // Lesser General Public License (LGPL) as published
// by the Free Software Foundation, either version 3 // by the Free Software Foundation, either version 3
// of the License or (at your option) any later version. // of the License or (at your option) any later version.
// (see http://www.opensource.org/licenses for more info) // (see http://www.opensource.org/licenses for more info)
skipping to change at line 31 skipping to change at line 31
//! implementation of the 'repeat matrix' operation, used for constructing matrices //! implementation of the 'repeat matrix' operation, used for constructing matrices
template<typename T1> template<typename T1>
inline inline
void void
op_repmat::apply(Mat<typename T1::elem_type>& out, const Op<T1,op_repmat>& in) op_repmat::apply(Mat<typename T1::elem_type>& out, const Op<T1,op_repmat>& in)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
const unwrap<T1> tmp(in.m); const unwrap_check<T1> tmp(in.m, out);
const Mat<eT>& X = tmp.M;
const Mat<eT>& X = tmp.M;
const u32 r = in.aux_u32_a;
const u32 c = in.aux_u32_b;
arma_debug_check( (X.n_elem == 0), "op_repmat::apply(): given object has no elements" ); arma_debug_check( (X.n_elem == 0), "op_repmat::apply(): given object has no elements" );
if(X.n_elem == 1) // Element matrix const u32 copies_per_row = in.aux_u32_a;
{ const u32 copies_per_col = in.aux_u32_b;
out.set_size(r,c);
out.fill(X[0]);
}
else
{
if( X.n_cols == 1 ) // Column vector
{
Col<eT> Xc_tmp;
Xc_tmp.zeros(X.n_rows * r);
u32 counter = 0; out.set_size(X.n_rows * copies_per_row, X.n_cols * copies_per_col);
for(u32 i = 0; i < r * X.n_rows; i += X.n_rows )
{
Xc_tmp.rows(i, (X.n_rows*(counter+1))-1) = X;
++counter;
}
out = diagmat(Xc_tmp) * ones< Mat<eT> >(Xc_tmp.n_rows, c); for(u32 col = 0; col < out.n_cols; col += X.n_cols)
} {
else for(u32 row = 0; row < out.n_rows; row += X.n_rows)
{ {
if(X.n_rows == 1) // Row vector out.submat(row, col, row+X.n_rows-1, col+X.n_cols-1) = X;
{
Row<eT> Xr_tmp;
Xr_tmp.zeros(X.n_cols * c);
u32 counter = 0;
for(u32 i = 0; i < c * X.n_cols; i += X.n_cols)
{
Xr_tmp.cols(i, (X.n_cols * (counter+1)) - 1) = X;
++counter;
}
out = ones< Mat<eT> >(r, X.n_cols * c) * diagmat(Xr_tmp);
}
else // 2D matrix
{
Mat<eT> mr;
mr.zeros(r * X.n_rows, X.n_cols);
for(u32 i = 0; i < r; ++i)
{
mr.rows(i * X.n_rows, ((i+1) * X.n_rows) - 1) = X;
}
out.zeros(r*X.n_rows, c*X.n_cols);
for(u32 i = 0; i < c; ++i)
{
out.cols(i * X.n_cols, ((i+1) * X.n_cols) - 1) = mr;
}
}
} }
} }
} }
//! @} //! @}
 End of changes. 9 change blocks. 
58 lines changed or deleted 11 lines changed or added


 op_repmat_proto.hpp   op_repmat_proto.hpp 
// Copyright (C) 2009 NICTA // Copyright (C) 2009 NICTA
// Copyright (C) 2009 Dimitrios Bouzas
// //
// Authors: // Authors:
// - Conrad Sanderson (conradsand at ieee dot org) // - Conrad Sanderson (conradsand at ieee dot org)
// - Dimitrios Bouzas (dimitris dot mpouzas at gmail dot com)
// //
// This file is part of the Armadillo C++ library. // This file is part of the Armadillo C++ library.
// It is provided without any warranty of fitness // It is provided without any warranty of fitness
// for any purpose. You can redistribute this file // for any purpose. You can redistribute this file
// and/or modify it under the terms of the GNU // and/or modify it under the terms of the GNU
// Lesser General Public License (LGPL) as published // Lesser General Public License (LGPL) as published
// by the Free Software Foundation, either version 3 // by the Free Software Foundation, either version 3
// of the License or (at your option) any later version. // of the License or (at your option) any later version.
// (see http://www.opensource.org/licenses for more info) // (see http://www.opensource.org/licenses for more info)
 End of changes. 2 change blocks. 
0 lines changed or deleted 2 lines changed or added


 op_stddev_meat.hpp   op_stddev_meat.hpp 
skipping to change at line 52 skipping to change at line 52
out[col] = std::sqrt( op_var::direct_var( X.colptr(col), X.n_rows, no rm_type ) ); out[col] = std::sqrt( op_var::direct_var( X.colptr(col), X.n_rows, no rm_type ) );
} }
} }
else else
if(dim == 1) if(dim == 1)
{ {
arma_extra_debug_print("op_stddev::apply(), dim = 1"); arma_extra_debug_print("op_stddev::apply(), dim = 1");
out.set_size(X.n_rows, 1); out.set_size(X.n_rows, 1);
const eT norm_val = (norm_type == 0) ? eT(X.n_cols-1) : eT(X.n_cols); const eT norm_val = (norm_type == 0) ? ( (X.n_cols > 1) ? eT(X.n_cols-1 ) : eT(1) ) : eT(X.n_cols);
for(u32 row=0; row<X.n_rows; ++row) for(u32 row=0; row<X.n_rows; ++row)
{ {
eT acc1 = eT(0); eT acc1 = eT(0);
eT acc2 = eT(0); eT acc2 = eT(0);
for(u32 col=0; col<X.n_cols; ++col) for(u32 col=0; col<X.n_cols; ++col)
{ {
const eT tmp_val = X.at(row,col); const eT tmp_val = X.at(row,col);
acc1 += tmp_val; acc1 += tmp_val;
skipping to change at line 108 skipping to change at line 108
out[col] = std::sqrt( op_var::direct_var( X.colptr(col), X.n_rows, no rm_type ) ); out[col] = std::sqrt( op_var::direct_var( X.colptr(col), X.n_rows, no rm_type ) );
} }
} }
else else
if(dim == 1) if(dim == 1)
{ {
arma_extra_debug_print("op_stddev::apply(), dim = 1"); arma_extra_debug_print("op_stddev::apply(), dim = 1");
out.set_size(X.n_rows, 1); out.set_size(X.n_rows, 1);
const T norm_val = (norm_type == 0) ? T(X.n_cols-1) : T(X.n_cols); const T norm_val = (norm_type == 0) ? ( (X.n_cols > 1) ? T(X.n_cols-1) : T(1) ) : T(X.n_cols);
for(u32 row=0; row<X.n_rows; ++row) for(u32 row=0; row<X.n_rows; ++row)
{ {
eT acc1 = eT(0); eT acc1 = eT(0);
T acc2 = T(0); T acc2 = T(0);
for(u32 col=0; col<X.n_cols; ++col) for(u32 col=0; col<X.n_cols; ++col)
{ {
acc1 += X.at(row,col); acc1 += X.at(row,col);
acc2 += std::norm(X.at(row,col)); acc2 += std::norm(X.at(row,col));
 End of changes. 2 change blocks. 
2 lines changed or deleted 2 lines changed or added


 op_var_meat.hpp   op_var_meat.hpp 
skipping to change at line 36 skipping to change at line 36
eT acc1 = eT(0); eT acc1 = eT(0);
eT acc2 = eT(0); eT acc2 = eT(0);
for(u32 i=0; i<n_elem; ++i) for(u32 i=0; i<n_elem; ++i)
{ {
const eT tmp_val = X[i]; const eT tmp_val = X[i];
acc1 += tmp_val; acc1 += tmp_val;
acc2 += tmp_val*tmp_val; acc2 += tmp_val*tmp_val;
} }
const eT norm_val = (norm_type == 0) ? eT(n_elem-1) : eT(n_elem); const eT norm_val = (norm_type == 0) ? ( (n_elem > 1) ? eT(n_elem-1) : eT (1) ) : eT(n_elem);
const eT var_val = (acc2 - acc1*acc1/eT(n_elem)) / norm_val; const eT var_val = (acc2 - acc1*acc1/eT(n_elem)) / norm_val;
return var_val; return var_val;
} }
//! find the variance of an array (version for complex numbers) //! find the variance of an array (version for complex numbers)
template<typename T> template<typename T>
inline inline
T T
op_var::direct_var(const std::complex<T>* const X, const u32 n_elem, const u32 norm_type) op_var::direct_var(const std::complex<T>* const X, const u32 n_elem, const u32 norm_type)
skipping to change at line 61 skipping to change at line 61
eT acc1 = eT(0); eT acc1 = eT(0);
T acc2 = T(0); T acc2 = T(0);
for(u32 i=0; i<n_elem; ++i) for(u32 i=0; i<n_elem; ++i)
{ {
acc1 += X[i]; acc1 += X[i];
acc2 += std::norm(X[i]); acc2 += std::norm(X[i]);
} }
const T norm_val = (norm_type == 0) ? T(n_elem-1) : T(n_elem); const T norm_val = (norm_type == 0) ? ( (n_elem > 1) ? T(n_elem-1) : T(1) ) : T(n_elem);
const T var_val = (acc2 - std::norm(acc1)/T(n_elem)) / norm_val; const T var_val = (acc2 - std::norm(acc1)/T(n_elem)) / norm_val;
return var_val; return var_val;
} }
//! \brief //! \brief
//! For each row or for each column, find the variance. //! For each row or for each column, find the variance.
//! The result is stored in a dense matrix that has either one column or on e row. //! The result is stored in a dense matrix that has either one column or on e row.
//! The dimension, for which the variances are found, is set via the var() function. //! The dimension, for which the variances are found, is set via the var() function.
template<typename eT> template<typename eT>
skipping to change at line 101 skipping to change at line 101
out[col] = op_var::direct_var( X.colptr(col), X.n_rows, norm_type ); out[col] = op_var::direct_var( X.colptr(col), X.n_rows, norm_type );
} }
} }
else else
if(dim == 1) if(dim == 1)
{ {
arma_extra_debug_print("op_var::apply(), dim = 1"); arma_extra_debug_print("op_var::apply(), dim = 1");
out.set_size(X.n_rows, 1); out.set_size(X.n_rows, 1);
const eT norm_val = (norm_type == 0) ? eT(X.n_cols-1) : eT(X.n_cols); const eT norm_val = (norm_type == 0) ? ( (X.n_cols > 1) ? eT(X.n_cols-1 ) : eT(1) ) : eT(X.n_cols);
for(u32 row=0; row<X.n_rows; ++row) for(u32 row=0; row<X.n_rows; ++row)
{ {
eT acc1 = eT(0); eT acc1 = eT(0);
eT acc2 = eT(0); eT acc2 = eT(0);
for(u32 col=0; col<X.n_cols; ++col) for(u32 col=0; col<X.n_cols; ++col)
{ {
const eT tmp_val = X.at(row,col); const eT tmp_val = X.at(row,col);
acc1 += tmp_val; acc1 += tmp_val;
skipping to change at line 157 skipping to change at line 157
out[col] = op_var::direct_var( X.colptr(col), X.n_rows, norm_type ); out[col] = op_var::direct_var( X.colptr(col), X.n_rows, norm_type );
} }
} }
else else
if(dim == 1) if(dim == 1)
{ {
arma_extra_debug_print("op_var::apply(), dim = 1"); arma_extra_debug_print("op_var::apply(), dim = 1");
out.set_size(X.n_rows, 1); out.set_size(X.n_rows, 1);
const T norm_val = (norm_type == 0) ? T(X.n_cols-1) : T(X.n_cols); const T norm_val = (norm_type == 0) ? ( (X.n_cols > 1) ? T(X.n_cols-1) : T(1) ) : T(X.n_cols);
for(u32 row=0; row<X.n_rows; ++row) for(u32 row=0; row<X.n_rows; ++row)
{ {
eT acc1 = eT(0); eT acc1 = eT(0);
T acc2 = T(0); T acc2 = T(0);
for(u32 col=0; col<X.n_cols; ++col) for(u32 col=0; col<X.n_cols; ++col)
{ {
acc1 += X.at(row,col); acc1 += X.at(row,col);
acc2 += std::norm(X.at(row,col)); acc2 += std::norm(X.at(row,col));
skipping to change at line 199 skipping to change at line 199
eT acc1 = eT(0); eT acc1 = eT(0);
eT acc2 = eT(0); eT acc2 = eT(0);
for(u32 i=0; i<n_elem; ++i) for(u32 i=0; i<n_elem; ++i)
{ {
const eT tmp_val = X[i]; const eT tmp_val = X[i];
acc1 += tmp_val; acc1 += tmp_val;
acc2 += tmp_val*tmp_val; acc2 += tmp_val*tmp_val;
} }
const eT norm_val = (norm_type == 0) ? eT(n_elem-1) : eT(n_elem); const eT norm_val = (norm_type == 0) ? ( (n_elem > 1) ? eT(n_elem-1) : eT (1) ) : eT(n_elem);
const eT var_val = (acc2 - acc1*acc1/eT(n_elem)) / norm_val; const eT var_val = (acc2 - acc1*acc1/eT(n_elem)) / norm_val;
return var_val; return var_val;
} }
//! find the variance of a subview (version for complex numbers) //! find the variance of a subview (version for complex numbers)
template<typename T> template<typename T>
inline inline
T T
op_var::direct_var(const subview< std::complex<T> >& X, const u32 norm_type ) op_var::direct_var(const subview< std::complex<T> >& X, const u32 norm_type )
skipping to change at line 226 skipping to change at line 226
eT acc1 = eT(0); eT acc1 = eT(0);
T acc2 = T(0); T acc2 = T(0);
for(u32 i=0; i<n_elem; ++i) for(u32 i=0; i<n_elem; ++i)
{ {
acc1 += X[i]; acc1 += X[i];
acc2 += std::norm(X[i]); acc2 += std::norm(X[i]);
} }
const T norm_val = (norm_type == 0) ? T(n_elem-1) : T(n_elem); const T norm_val = (norm_type == 0) ? ( (n_elem > 1) ? T(n_elem-1) : T(1) ) : T(n_elem);
const T var_val = (acc2 - std::norm(acc1)/T(n_elem)) / norm_val; const T var_val = (acc2 - std::norm(acc1)/T(n_elem)) / norm_val;
return var_val; return var_val;
} }
//! find the variance of a diagview //! find the variance of a diagview
template<typename eT> template<typename eT>
inline inline
eT eT
op_var::direct_var(const diagview<eT>& X, const u32 norm_type) op_var::direct_var(const diagview<eT>& X, const u32 norm_type)
skipping to change at line 252 skipping to change at line 252
eT acc1 = eT(0); eT acc1 = eT(0);
eT acc2 = eT(0); eT acc2 = eT(0);
for(u32 i=0; i<n_elem; ++i) for(u32 i=0; i<n_elem; ++i)
{ {
const eT tmp_val = X[i]; const eT tmp_val = X[i];
acc1 += tmp_val; acc1 += tmp_val;
acc2 += tmp_val*tmp_val; acc2 += tmp_val*tmp_val;
} }
const eT norm_val = (norm_type == 0) ? eT(n_elem-1) : eT(n_elem); const eT norm_val = (norm_type == 0) ? ( (n_elem > 1) ? eT(n_elem-1) : eT (1) ) : eT(n_elem);
const eT var_val = (acc2 - acc1*acc1/eT(n_elem)) / norm_val; const eT var_val = (acc2 - acc1*acc1/eT(n_elem)) / norm_val;
return var_val; return var_val;
} }
//! find the variance of a diagview (version for complex numbers) //! find the variance of a diagview (version for complex numbers)
template<typename T> template<typename T>
inline inline
T T
op_var::direct_var(const diagview< std::complex<T> >& X, const u32 norm_typ e) op_var::direct_var(const diagview< std::complex<T> >& X, const u32 norm_typ e)
skipping to change at line 279 skipping to change at line 279
eT acc1 = eT(0); eT acc1 = eT(0);
T acc2 = T(0); T acc2 = T(0);
for(u32 i=0; i<n_elem; ++i) for(u32 i=0; i<n_elem; ++i)
{ {
acc1 += X[i]; acc1 += X[i];
acc2 += std::norm(X[i]); acc2 += std::norm(X[i]);
} }
const T norm_val = (norm_type == 0) ? T(n_elem-1) : T(n_elem); const T norm_val = (norm_type == 0) ? ( (n_elem > 1) ? T(n_elem-1) : T(1) ) : T(n_elem);
const T var_val = (acc2 - std::norm(acc1)/T(n_elem)) / norm_val; const T var_val = (acc2 - std::norm(acc1)/T(n_elem)) / norm_val;
return var_val; return var_val;
} }
//! @} //! @}
 End of changes. 8 change blocks. 
8 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/