Cube_meat.hpp | Cube_meat.hpp | |||
---|---|---|---|---|
skipping to change at line 2104 | skipping to change at line 2104 | |||
template<typename eT> | template<typename eT> | |||
inline | inline | |||
const Cube<eT>& | const Cube<eT>& | |||
Cube<eT>::randn() | Cube<eT>::randn() | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
const u32 N = n_elem; | const u32 N = n_elem; | |||
eT* ptr = memptr(); | eT* ptr = memptr(); | |||
u32 i,j; | for(u32 i=0; i<N; ++i) | |||
for(i=0, j=1; j<N; i+=2, j+=2) | ||||
{ | ||||
ptr[i] = eT(eop_aux_randn<eT>()); | ||||
ptr[j] = eT(eop_aux_randn<eT>()); | ||||
} | ||||
if(i < N) | ||||
{ | { | |||
ptr[i] = eT(eop_aux_randn<eT>()); | ptr[i] = eT(eop_aux_randn<eT>()); | |||
} | } | |||
return *this; | return *this; | |||
} | } | |||
template<typename eT> | template<typename eT> | |||
inline | inline | |||
const Cube<eT>& | const Cube<eT>& | |||
skipping to change at line 2166 | skipping to change at line 2158 | |||
void | void | |||
Cube<eT>::set_imag(const BaseCube<typename Cube<eT>::pod_type,T1>& X) | Cube<eT>::set_imag(const BaseCube<typename Cube<eT>::pod_type,T1>& X) | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
Cube_aux::set_imag(*this, X); | Cube_aux::set_imag(*this, X); | |||
} | } | |||
template<typename eT> | template<typename eT> | |||
inline | inline | |||
arma_warn_unused | ||||
eT | eT | |||
Cube<eT>::min() const | Cube<eT>::min() const | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
arma_debug_check( (n_elem == 0), "min(): object has no elements" ); | arma_debug_check( (n_elem == 0), "min(): object has no elements" ); | |||
return op_min::direct_min(memptr(), n_elem); | return op_min::direct_min(memptr(), n_elem); | |||
} | } | |||
template<typename eT> | template<typename eT> | |||
inline | inline | |||
arma_warn_unused | ||||
eT | eT | |||
Cube<eT>::max() const | Cube<eT>::max() const | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
arma_debug_check( (n_elem == 0), "max(): object has no elements" ); | arma_debug_check( (n_elem == 0), "max(): object has no elements" ); | |||
return op_max::direct_max(memptr(), n_elem); | return op_max::direct_max(memptr(), n_elem); | |||
} | } | |||
End of changes. 3 change blocks. | ||||
9 lines changed or deleted | 3 lines changed or added | |||
Cube_proto.hpp | Cube_proto.hpp | |||
---|---|---|---|---|
skipping to change at line 219 | skipping to change at line 219 | |||
inline const Cube& randu(const u32 in_rows, const u32 in_cols, const u32 in_slices); | inline const Cube& randu(const u32 in_rows, const u32 in_cols, const u32 in_slices); | |||
inline const Cube& randn(); | inline const Cube& randn(); | |||
inline const Cube& randn(const u32 in_rows, const u32 in_cols, const u32 in_slices); | inline const Cube& randn(const u32 in_rows, const u32 in_cols, const u32 in_slices); | |||
inline void reset(); | inline void reset(); | |||
template<typename T1> inline void set_real(const BaseCube<pod_type,T1>& X ); | template<typename T1> inline void set_real(const BaseCube<pod_type,T1>& X ); | |||
template<typename T1> inline void set_imag(const BaseCube<pod_type,T1>& X ); | template<typename T1> inline void set_imag(const BaseCube<pod_type,T1>& X ); | |||
inline eT min() const; | inline arma_warn_unused eT min() const; | |||
inline eT max() const; | inline arma_warn_unused eT max() const; | |||
inline eT min(u32& index_of_min_val) const; | inline eT min(u32& index_of_min_val) const; | |||
inline eT max(u32& index_of_max_val) const; | inline eT max(u32& index_of_max_val) const; | |||
inline eT min(u32& row_of_min_val, u32& col_of_min_val, u32& slice_of_min _val) const; | inline eT min(u32& row_of_min_val, u32& col_of_min_val, u32& slice_of_min _val) const; | |||
inline eT max(u32& row_of_max_val, u32& col_of_max_val, u32& slice_of_max _val) const; | inline eT max(u32& row_of_max_val, u32& col_of_max_val, u32& slice_of_max _val) const; | |||
inline bool save(const std::string name, const file_type type = arma_bi nary, const bool print_status = true) const; | inline bool save(const std::string name, const file_type type = arma_bi nary, const bool print_status = true) const; | |||
inline bool save( std::ostream& os, const file_type type = arma_bi nary, const bool print_status = true) const; | inline bool save( std::ostream& os, const file_type type = arma_bi nary, const bool print_status = true) const; | |||
End of changes. 1 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
Mat_meat.hpp | Mat_meat.hpp | |||
---|---|---|---|---|
skipping to change at line 3742 | skipping to change at line 3742 | |||
void | void | |||
Mat<eT>::set_imag(const Base<typename Mat<eT>::pod_type,T1>& X) | Mat<eT>::set_imag(const Base<typename Mat<eT>::pod_type,T1>& X) | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
Mat_aux::set_imag(*this, X); | Mat_aux::set_imag(*this, X); | |||
} | } | |||
template<typename eT> | template<typename eT> | |||
inline | inline | |||
arma_warn_unused | ||||
eT | eT | |||
Mat<eT>::min() const | Mat<eT>::min() const | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
arma_debug_check( (n_elem == 0), "min(): object has no elements" ); | arma_debug_check( (n_elem == 0), "min(): object has no elements" ); | |||
return op_min::direct_min(memptr(), n_elem); | return op_min::direct_min(memptr(), n_elem); | |||
} | } | |||
template<typename eT> | template<typename eT> | |||
inline | inline | |||
arma_warn_unused | ||||
eT | eT | |||
Mat<eT>::max() const | Mat<eT>::max() const | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
arma_debug_check( (n_elem == 0), "max(): object has no elements" ); | arma_debug_check( (n_elem == 0), "max(): object has no elements" ); | |||
return op_max::direct_max(memptr(), n_elem); | return op_max::direct_max(memptr(), n_elem); | |||
} | } | |||
End of changes. 2 change blocks. | ||||
0 lines changed or deleted | 2 lines changed or added | |||
Mat_proto.hpp | Mat_proto.hpp | |||
---|---|---|---|---|
skipping to change at line 306 | skipping to change at line 306 | |||
inline const Mat& randn(const u32 in_rows, const u32 in_cols); | inline const Mat& randn(const u32 in_rows, const u32 in_cols); | |||
inline const Mat& eye(); | inline const Mat& eye(); | |||
inline const Mat& eye(const u32 in_rows, const u32 in_cols); | inline const Mat& eye(const u32 in_rows, const u32 in_cols); | |||
inline void reset(); | inline void reset(); | |||
template<typename T1> inline void set_real(const Base<pod_type,T1>& X); | template<typename T1> inline void set_real(const Base<pod_type,T1>& X); | |||
template<typename T1> inline void set_imag(const Base<pod_type,T1>& X); | template<typename T1> inline void set_imag(const Base<pod_type,T1>& X); | |||
inline eT min() const; | inline arma_warn_unused eT min() const; | |||
inline eT max() const; | inline arma_warn_unused eT max() const; | |||
inline eT min(u32& index_of_min_val) const; | inline eT min(u32& index_of_min_val) const; | |||
inline eT max(u32& index_of_max_val) const; | inline eT max(u32& index_of_max_val) const; | |||
inline eT min(u32& row_of_min_val, u32& col_of_min_val) const; | inline eT min(u32& row_of_min_val, u32& col_of_min_val) const; | |||
inline eT max(u32& row_of_max_val, u32& col_of_max_val) const; | inline eT max(u32& row_of_max_val, u32& col_of_max_val) const; | |||
inline bool save(const std::string name, const file_type type = arma_bi nary, const bool print_status = true) const; | inline bool save(const std::string name, const file_type type = arma_bi nary, const bool print_status = true) const; | |||
inline bool save( std::ostream& os, const file_type type = arma_bi nary, const bool print_status = true) const; | inline bool save( std::ostream& os, const file_type type = arma_bi nary, const bool print_status = true) const; | |||
End of changes. 1 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
arma_version.hpp | arma_version.hpp | |||
---|---|---|---|---|
skipping to change at line 18 | skipping to change at line 18 | |||
// 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 arma_version | //! \addtogroup arma_version | |||
//! @{ | //! @{ | |||
#define ARMA_VERSION_MAJOR 1 | #define ARMA_VERSION_MAJOR 1 | |||
#define ARMA_VERSION_MINOR 1 | #define ARMA_VERSION_MINOR 1 | |||
#define ARMA_VERSION_PATCH 90 | #define ARMA_VERSION_PATCH 92 | |||
#define ARMA_VERSION_NAME "Inside Job" | #define ARMA_VERSION_NAME "Jurassic Barbecue" | |||
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 | |||
std::string | std::string | |||
End of changes. 1 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
glue_cor_meat.hpp | glue_cor_meat.hpp | |||
---|---|---|---|---|
// Copyright (C) 2009-2010 NICTA (www.nicta.com.au) | // Copyright (C) 2009-2011 NICTA (www.nicta.com.au) | |||
// Copyright (C) 2009-2010 Conrad Sanderson | // Copyright (C) 2009-2011 Conrad Sanderson | |||
// Copyright (C) 2009-2010 Dimitrios Bouzas | // Copyright (C) 2009-2010 Dimitrios Bouzas | |||
// | // | |||
// 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 26 | skipping to change at line 26 | |||
template<typename eT> | template<typename eT> | |||
inline | inline | |||
void | void | |||
glue_cor::direct_cor(Mat<eT>& out, const Mat<eT>& A, const Mat<eT>& B, cons t u32 norm_type) | glue_cor::direct_cor(Mat<eT>& out, const Mat<eT>& A, const Mat<eT>& B, cons t u32 norm_type) | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
if(A.is_vec() && B.is_vec()) | if(A.is_vec() && B.is_vec()) | |||
{ | { | |||
arma_debug_check( (A.n_elem != B.n_elem), "cor(): the number of element s in A and B must match" ); | arma_debug_check( (A.n_elem != B.n_elem), "cor(): the number of element s in the two vectors must match" ); | |||
const eT* A_ptr = A.memptr(); | const eT* A_ptr = A.memptr(); | |||
const eT* B_ptr = B.memptr(); | const eT* B_ptr = B.memptr(); | |||
eT A_acc = eT(0); | eT A_acc = eT(0); | |||
eT B_acc = eT(0); | eT B_acc = eT(0); | |||
eT out_acc = eT(0); | eT out_acc = eT(0); | |||
const u32 N = A.n_elem; | const u32 N = A.n_elem; | |||
skipping to change at line 55 | skipping to change at line 55 | |||
out_acc += A_tmp * B_tmp; | out_acc += A_tmp * B_tmp; | |||
} | } | |||
out_acc -= (A_acc * B_acc)/eT(N); | out_acc -= (A_acc * B_acc)/eT(N); | |||
const eT norm_val = (norm_type == 0) ? ( (N > 1) ? eT(N-1) : eT(1) ) : eT(N); | const eT norm_val = (norm_type == 0) ? ( (N > 1) ? eT(N-1) : eT(1) ) : eT(N); | |||
out.set_size(1,1); | out.set_size(1,1); | |||
out[0] = out_acc/norm_val; | out[0] = out_acc/norm_val; | |||
const Mat<eT> stddev_A = (A.n_rows == 1) ? stddev(trans(A)) : stddev(A) | const Mat<eT> stddev_A = (A.n_rows == 1) ? Mat<eT>(stddev(trans(A))) : | |||
; | Mat<eT>(stddev(A)); | |||
const Mat<eT> stddev_B = (B.n_rows == 1) ? stddev(trans(B)) : stddev(B) | const Mat<eT> stddev_B = (B.n_rows == 1) ? Mat<eT>(stddev(trans(B))) : | |||
; | Mat<eT>(stddev(B)); | |||
out /= stddev_A * stddev_B; | out /= stddev_A * stddev_B; | |||
} | } | |||
else | else | |||
{ | { | |||
arma_debug_assert_same_size(A, B, "cor()"); | arma_debug_assert_same_size(A, B, "cor()"); | |||
const u32 N = A.n_rows; | const u32 N = A.n_rows; | |||
const eT norm_val = (norm_type == 0) ? ( (N > 1) ? eT(N-1) : eT(1) ) : eT(N); | const eT norm_val = (norm_type == 0) ? ( (N > 1) ? eT(N-1) : eT(1) ) : eT(N); | |||
skipping to change at line 85 | skipping to change at line 85 | |||
inline | inline | |||
void | void | |||
glue_cor::direct_cor(Mat< std::complex<T> >& out, const Mat< std::complex<T > >& A, const Mat< std::complex<T> >& B, const u32 norm_type) | glue_cor::direct_cor(Mat< std::complex<T> >& out, const Mat< std::complex<T > >& A, const Mat< std::complex<T> >& B, const u32 norm_type) | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
typedef typename std::complex<T> eT; | typedef typename std::complex<T> eT; | |||
if(A.is_vec() && B.is_vec()) | if(A.is_vec() && B.is_vec()) | |||
{ | { | |||
arma_debug_check( (A.n_elem != B.n_elem), "cor(): the number of element s in A and B must match" ); | arma_debug_check( (A.n_elem != B.n_elem), "cor(): the number of element s in the two vectors must match" ); | |||
const eT* A_ptr = A.memptr(); | const eT* A_ptr = A.memptr(); | |||
const eT* B_ptr = B.memptr(); | const eT* B_ptr = B.memptr(); | |||
eT A_acc = eT(0); | eT A_acc = eT(0); | |||
eT B_acc = eT(0); | eT B_acc = eT(0); | |||
eT out_acc = eT(0); | eT out_acc = eT(0); | |||
const u32 N = A.n_elem; | const u32 N = A.n_elem; | |||
skipping to change at line 114 | skipping to change at line 114 | |||
out_acc += std::conj(A_tmp) * B_tmp; | out_acc += std::conj(A_tmp) * B_tmp; | |||
} | } | |||
out_acc -= (std::conj(A_acc) * B_acc)/eT(N); | out_acc -= (std::conj(A_acc) * B_acc)/eT(N); | |||
const eT norm_val = (norm_type == 0) ? ( (N > 1) ? eT(N-1) : eT(1) ) : eT(N); | const eT norm_val = (norm_type == 0) ? ( (N > 1) ? eT(N-1) : eT(1) ) : eT(N); | |||
out.set_size(1,1); | out.set_size(1,1); | |||
out[0] = out_acc/norm_val; | out[0] = out_acc/norm_val; | |||
const Mat<T> stddev_A = (A.n_rows == 1) ? stddev(trans(A)) : stddev(A); | const Mat<T> stddev_A = (A.n_rows == 1) ? Mat<T>(stddev(trans(A))) : Ma | |||
const Mat<T> stddev_B = (B.n_rows == 1) ? stddev(trans(B)) : stddev(B); | t<T>(stddev(A)); | |||
const Mat<T> stddev_B = (B.n_rows == 1) ? Mat<T>(stddev(trans(B))) : Ma | ||||
t<T>(stddev(B)); | ||||
out /= conv_to< Mat<eT> >::from( stddev_A * stddev_B ); | out /= conv_to< Mat<eT> >::from( stddev_A * stddev_B ); | |||
} | } | |||
else | else | |||
{ | { | |||
arma_debug_assert_same_size(A, B, "cor()"); | arma_debug_assert_same_size(A, B, "cor()"); | |||
const u32 N = A.n_rows; | const u32 N = A.n_rows; | |||
const eT norm_val = (norm_type == 0) ? ( (N > 1) ? eT(N-1) : eT(1) ) : eT(N); | const eT norm_val = (norm_type == 0) ? ( (N > 1) ? eT(N-1) : eT(1) ) : eT(N); | |||
skipping to change at line 158 | skipping to change at line 158 | |||
const u32 norm_type = X.aux_u32; | const u32 norm_type = X.aux_u32; | |||
if(&A != &B) | if(&A != &B) | |||
{ | { | |||
glue_cor::direct_cor(out, A, B, norm_type); | glue_cor::direct_cor(out, A, B, norm_type); | |||
} | } | |||
else | else | |||
{ | { | |||
op_cor::direct_cor(out, A, norm_type); | op_cor::direct_cor(out, A, norm_type); | |||
} | } | |||
} | } | |||
//! @} | //! @} | |||
End of changes. 6 change blocks. | ||||
11 lines changed or deleted | 12 lines changed or added | |||