arma_version.hpp | arma_version.hpp | |||
---|---|---|---|---|
skipping to change at line 16 | skipping to change at line 16 | |||
// 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 arma_version | //! \addtogroup arma_version | |||
//! @{ | //! @{ | |||
#define ARMA_VERSION_MAJOR 1 | #define ARMA_VERSION_MAJOR 2 | |||
#define ARMA_VERSION_MINOR 99 | #define ARMA_VERSION_MINOR 0 | |||
#define ARMA_VERSION_PATCH 5 | #define ARMA_VERSION_PATCH 1 | |||
#define ARMA_VERSION_NAME "v2.0 beta 5" | #define ARMA_VERSION_NAME "Carnivorous Sugar Glider" | |||
// http://en.wikipedia.org/wiki/Sugar_glider | ||||
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. | ||||
4 lines changed or deleted | 5 lines changed or added | |||
auxlib_meat.hpp | auxlib_meat.hpp | |||
---|---|---|---|---|
skipping to change at line 815 | skipping to change at line 815 | |||
#if defined(ARMA_USE_ATLAS) | #if defined(ARMA_USE_ATLAS) | |||
{ | { | |||
Mat<eT> tmp(X.get_ref()); | Mat<eT> tmp(X.get_ref()); | |||
arma_debug_check( (tmp.is_square() == false), "log_det(): given matrix is not square" ); | arma_debug_check( (tmp.is_square() == false), "log_det(): given matrix is not square" ); | |||
if(tmp.is_empty()) | if(tmp.is_empty()) | |||
{ | { | |||
out_val = eT(0); | out_val = eT(0); | |||
out_sign = T(1); | out_sign = T(1); | |||
return; | return true; | |||
} | } | |||
podarray<int> ipiv(tmp.n_rows); | podarray<int> ipiv(tmp.n_rows); | |||
const int info = atlas::clapack_getrf(atlas::CblasColMajor, tmp.n_rows, tmp.n_cols, tmp.memptr(), tmp.n_rows, ipiv.memptr()); | const int info = atlas::clapack_getrf(atlas::CblasColMajor, tmp.n_rows, tmp.n_cols, tmp.memptr(), tmp.n_rows, ipiv.memptr()); | |||
// on output tmp appears to be L+U_alt, where U_alt is U with the main diagonal set to zero | // on output tmp appears to be L+U_alt, where U_alt is U with the main diagonal set to zero | |||
s32 sign = (is_complex<eT>::value == false) ? ( (access::tmp_real( tmp. at(0,0) ) < T(0)) ? -1 : +1 ) : +1; | s32 sign = (is_complex<eT>::value == false) ? ( (access::tmp_real( tmp. at(0,0) ) < T(0)) ? -1 : +1 ) : +1; | |||
eT val = (is_complex<eT>::value == false) ? std::log( (access::tmp_re al( tmp.at(0,0) ) < T(0)) ? tmp.at(0,0)*T(-1) : tmp.at(0,0) ) : std::log( t mp.at(0,0) ); | eT val = (is_complex<eT>::value == false) ? std::log( (access::tmp_re al( tmp.at(0,0) ) < T(0)) ? tmp.at(0,0)*T(-1) : tmp.at(0,0) ) : std::log( t mp.at(0,0) ); | |||
skipping to change at line 857 | skipping to change at line 857 | |||
} | } | |||
#elif defined(ARMA_USE_LAPACK) | #elif defined(ARMA_USE_LAPACK) | |||
{ | { | |||
Mat<eT> tmp(X.get_ref()); | Mat<eT> tmp(X.get_ref()); | |||
arma_debug_check( (tmp.is_square() == false), "log_det(): given matrix is not square" ); | arma_debug_check( (tmp.is_square() == false), "log_det(): given matrix is not square" ); | |||
if(tmp.is_empty()) | if(tmp.is_empty()) | |||
{ | { | |||
out_val = eT(0); | out_val = eT(0); | |||
out_sign = T(1); | out_sign = T(1); | |||
return; | return true; | |||
} | } | |||
podarray<blas_int> ipiv(tmp.n_rows); | podarray<blas_int> ipiv(tmp.n_rows); | |||
blas_int info = 0; | blas_int info = 0; | |||
blas_int n_rows = blas_int(tmp.n_rows); | blas_int n_rows = blas_int(tmp.n_rows); | |||
blas_int n_cols = blas_int(tmp.n_cols); | blas_int n_cols = blas_int(tmp.n_cols); | |||
lapack::getrf(&n_rows, &n_cols, tmp.memptr(), &n_rows, ipiv.memptr(), & info); | lapack::getrf(&n_rows, &n_cols, tmp.memptr(), &n_rows, ipiv.memptr(), & info); | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
diagmat_proxy.hpp | diagmat_proxy.hpp | |||
---|---|---|---|---|
skipping to change at line 42 | skipping to change at line 42 | |||
( | ( | |||
(P_is_vec == false) && (P.get_n_rows() != P.get_n_cols()), | (P_is_vec == false) && (P.get_n_rows() != P.get_n_cols()), | |||
"diagmat(): only vectors and square matrices are accepted" | "diagmat(): only vectors and square matrices are accepted" | |||
); | ); | |||
} | } | |||
arma_inline | arma_inline | |||
elem_type | elem_type | |||
operator[](const u32 i) const | operator[](const u32 i) const | |||
{ | { | |||
if( (Proxy<T1>::prefer_at_operator == true) || (P_is_vec == false) ) | if( (Proxy<T1>::prefer_at_accessor == true) || (P_is_vec == false) ) | |||
{ | { | |||
return P.at(i,i); | return P.at(i,i); | |||
} | } | |||
else | else | |||
{ | { | |||
return P[i]; | return P[i]; | |||
} | } | |||
} | } | |||
arma_inline | arma_inline | |||
elem_type | elem_type | |||
at(const u32 row, const u32 col) const | at(const u32 row, const u32 col) const | |||
{ | { | |||
if(row == col) | if(row == col) | |||
{ | { | |||
if( (Proxy<T1>::prefer_at_operator == true) || (P_is_vec == false) ) | if( (Proxy<T1>::prefer_at_accessor == true) || (P_is_vec == false) ) | |||
{ | { | |||
return P.at(row,row); | return P.at(row,row); | |||
} | } | |||
else | else | |||
{ | { | |||
return P[row]; | return P[row]; | |||
} | } | |||
} | } | |||
else | else | |||
{ | { | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
fn_misc.hpp | fn_misc.hpp | |||
---|---|---|---|---|
skipping to change at line 27 | skipping to change at line 27 | |||
//! Generate a vector with 'num' elements. | //! Generate a vector with 'num' elements. | |||
//! The values of the elements linearly increase from 'start' upto (and inc luding) 'end'. | //! The values of the elements linearly increase from 'start' upto (and inc luding) 'end'. | |||
template<typename vec_type> | template<typename vec_type> | |||
inline | inline | |||
vec_type | vec_type | |||
linspace | linspace | |||
( | ( | |||
const typename vec_type::pod_type start, | const typename vec_type::pod_type start, | |||
const typename vec_type::pod_type end, | const typename vec_type::pod_type end, | |||
const u32 num, | const u32 num = 100u, | |||
const typename arma_Mat_Col_Row_only<vec_type>::result* junk = 0 | const typename arma_Mat_Col_Row_only<vec_type>::result* junk = 0 | |||
) | ) | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
arma_ignore(junk); | arma_ignore(junk); | |||
arma_debug_check( (num < 2), "linspace(): num must be >= 2"); | ||||
typedef typename vec_type::elem_type eT; | typedef typename vec_type::elem_type eT; | |||
typedef typename vec_type::pod_type T; | typedef typename vec_type::pod_type T; | |||
const u32 n_rows = (is_Row<vec_type>::value == true) ? 1 : num; | vec_type x; | |||
const u32 n_cols = (is_Row<vec_type>::value == true) ? num : 1; | ||||
Mat<eT> x(n_rows, n_cols); | if(num >= 2) | |||
eT* x_mem = x.memptr(); | { | |||
x.set_size(num); | ||||
const u32 num_m1 = num - 1; | eT* x_mem = x.memptr(); | |||
if(is_non_integral<T>::value == true) | const u32 num_m1 = num - 1; | |||
{ | ||||
const T delta = (end-start)/T(num_m1); | ||||
for(u32 i=0; i<num_m1; ++i) | if(is_non_integral<T>::value == true) | |||
{ | { | |||
x_mem[i] = eT(start + i*delta); | const T delta = (end-start)/T(num_m1); | |||
for(u32 i=0; i<num_m1; ++i) | ||||
{ | ||||
x_mem[i] = eT(start + i*delta); | ||||
} | ||||
x_mem[num_m1] = eT(end); | ||||
} | } | |||
else | ||||
{ | ||||
const double delta = (end >= start) ? double(end-start)/double(num_m1 | ||||
) : -double(start-end)/double(num_m1); | ||||
x_mem[num_m1] = eT(end); | for(u32 i=0; i<num_m1; ++i) | |||
{ | ||||
x_mem[i] = eT(double(start) + i*delta); | ||||
} | ||||
x_mem[num_m1] = eT(end); | ||||
} | ||||
return x; | ||||
} | } | |||
else | else | |||
{ | { | |||
const double delta = (end >= start) ? double(end-start)/double(num_m1) | x.set_size(1); | |||
: -double(start-end)/double(num_m1); | ||||
for(u32 i=0; i<num_m1; ++i) | ||||
{ | ||||
x_mem[i] = eT(double(start) + i*delta); | ||||
} | ||||
x_mem[num_m1] = eT(end); | x[0] = eT(end); | |||
} | } | |||
return x; | return x; | |||
} | } | |||
inline | inline | |||
mat | mat | |||
linspace(const double start, const double end, const u32 num) | linspace(const double start, const double end, const u32 num = 100u) | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
return linspace<mat>(start, end, num); | return linspace<mat>(start, end, num); | |||
} | } | |||
// | // | |||
// log_add | // log_add | |||
template<typename eT> | template<typename eT> | |||
inline | inline | |||
End of changes. 14 change blocks. | ||||
24 lines changed or deleted | 32 lines changed or added | |||
fn_princomp.hpp | fn_princomp.hpp | |||
---|---|---|---|---|
skipping to change at line 136 | skipping to change at line 136 | |||
} | } | |||
return status; | return status; | |||
} | } | |||
//! \brief | //! \brief | |||
//! principal component analysis -- 1 argument version | //! principal component analysis -- 1 argument version | |||
//! coeff_out -> principal component coefficients | //! coeff_out -> principal component coefficients | |||
template<typename T1> | template<typename T1> | |||
inline | inline | |||
bool | ||||
princomp | ||||
( | ||||
Mat<typename T1::elem_type>& coeff_out, | ||||
const Base<typename T1::elem_type,T1>& X, | ||||
const typename arma_blas_type_only<typename T1::elem_type>::result* junk | ||||
= 0 | ||||
) | ||||
{ | ||||
arma_extra_debug_sigprint(); | ||||
typedef typename T1::elem_type eT; | ||||
const unwrap<T1> tmp(X.get_ref()); | ||||
const Mat<eT>& A = tmp.M; | ||||
const bool status = op_princomp::direct_princomp(coeff_out, A); | ||||
if(status == false) | ||||
{ | ||||
coeff_out.reset(); | ||||
arma_bad("princomp(): failed to converge", false); | ||||
} | ||||
return status; | ||||
} | ||||
template<typename T1> | ||||
inline | ||||
const Op<T1, op_princomp> | const Op<T1, op_princomp> | |||
princomp | princomp | |||
( | ( | |||
const Base<typename T1::elem_type,T1>& X, | const Base<typename T1::elem_type,T1>& X, | |||
const typename arma_blas_type_only<typename T1::elem_type>::result* junk = 0 | const typename arma_blas_type_only<typename T1::elem_type>::result* junk = 0 | |||
) | ) | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
return Op<T1, op_princomp>(X.get_ref()); | return Op<T1, op_princomp>(X.get_ref()); | |||
End of changes. 1 change blocks. | ||||
0 lines changed or deleted | 30 lines changed or added | |||
subview_meat.hpp | subview_meat.hpp | |||
---|---|---|---|---|
skipping to change at line 1283 | skipping to change at line 1283 | |||
return ( (outside_rows == false) && (outside_cols == false) ); | return ( (outside_rows == false) && (outside_cols == false) ); | |||
} | } | |||
} | } | |||
} | } | |||
template<typename eT> | template<typename eT> | |||
inline | inline | |||
bool | bool | |||
subview<eT>::is_vec() const | subview<eT>::is_vec() const | |||
{ | { | |||
return ( (n_rows <= 1) || (n_cols <= 1) ); | return ( (n_rows == 1) || (n_cols == 1) ); | |||
} | } | |||
//! X = Y.submat(...) | //! X = Y.submat(...) | |||
template<typename eT> | template<typename eT> | |||
inline | inline | |||
void | void | |||
subview<eT>::extract(Mat<eT>& actual_out, const subview<eT>& in) | subview<eT>::extract(Mat<eT>& actual_out, const subview<eT>& in) | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||