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 2 | #define ARMA_VERSION_MAJOR 2 | |||
#define ARMA_VERSION_MINOR 2 | #define ARMA_VERSION_MINOR 2 | |||
#define ARMA_VERSION_PATCH 2 | #define ARMA_VERSION_PATCH 3 | |||
#define ARMA_VERSION_NAME "Blue Skies Debauchery" | #define ARMA_VERSION_NAME "Blue Skies Debauchery" | |||
struct arma_version | struct arma_version | |||
{ | { | |||
static const unsigned int major = ARMA_VERSION_MAJOR; | static const unsigned int major = ARMA_VERSION_MAJOR; | |||
static const unsigned int minor = ARMA_VERSION_MINOR; | static const unsigned int minor = ARMA_VERSION_MINOR; | |||
static const unsigned int patch = ARMA_VERSION_PATCH; | static const unsigned int patch = ARMA_VERSION_PATCH; | |||
static | static | |||
inline | inline | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
fn_as_scalar.hpp | fn_as_scalar.hpp | |||
---|---|---|---|---|
skipping to change at line 107 | skipping to change at line 107 | |||
typedef typename strip_inv <T2 >::stored_type T2_stripped_1; | typedef typename strip_inv <T2 >::stored_type T2_stripped_1; | |||
typedef typename strip_diagmat<T2_stripped_1>::stored_type T2_stripped_2; | typedef typename strip_diagmat<T2_stripped_1>::stored_type T2_stripped_2; | |||
const strip_inv <T2> strip1(X.A.B); | const strip_inv <T2> strip1(X.A.B); | |||
const strip_diagmat<T2_stripped_1> strip2(strip1.M); | const strip_diagmat<T2_stripped_1> strip2(strip1.M); | |||
const bool tmp2_do_inv = strip1.do_inv; | const bool tmp2_do_inv = strip1.do_inv; | |||
const bool tmp2_do_diagmat = strip2.do_diagmat; | const bool tmp2_do_diagmat = strip2.do_diagmat; | |||
const partial_unwrap<T1> tmp1(X.A.A); | ||||
const partial_unwrap<T2_stripped_2> tmp2(strip2.M); | ||||
const partial_unwrap<T3> tmp3(X.B); | ||||
const Mat<eT>& A = tmp1.M; | ||||
const Mat<eT>& B = tmp2.M; | ||||
const Mat<eT>& C = tmp3.M; | ||||
if(tmp2_do_diagmat == false) | if(tmp2_do_diagmat == false) | |||
{ | { | |||
const u32 A_n_rows = (tmp1.do_trans == false) ? A.n_rows : A.n_cols; | const Mat<eT> tmp(X); | |||
const u32 A_n_cols = (tmp1.do_trans == false) ? A.n_cols : A.n_rows; | ||||
const u32 B_n_rows = (tmp2.do_trans == false) ? B.n_rows : B.n_cols; | ||||
const u32 B_n_cols = (tmp2.do_trans == false) ? B.n_cols : B.n_rows; | ||||
const u32 C_n_rows = (tmp3.do_trans == false) ? C.n_rows : C.n_cols; | arma_debug_check( (tmp.n_elem != 1), "as_scalar(): expression doesn't e | |||
const u32 C_n_cols = (tmp3.do_trans == false) ? C.n_cols : C.n_rows; | valuate to exactly one element" ); | |||
const eT val = tmp1.get_val() * tmp2.get_val() * tmp3.get_val(); | return tmp[0]; | |||
arma_debug_check | ||||
( | ||||
(A_n_rows != 1) || | ||||
(C_n_cols != 1) || | ||||
(A_n_cols != B_n_rows) || | ||||
(B_n_cols != C_n_rows) | ||||
, | ||||
"as_scalar(): incompatible dimensions" | ||||
); | ||||
if(tmp2_do_inv == true) | ||||
{ | ||||
arma_debug_check( (B.is_square() == false), "as_scalar(): incompatibl | ||||
e dimensions" ); | ||||
Mat<eT> B_inv; | ||||
if(tmp2.do_trans == false) | ||||
{ | ||||
op_inv::apply(B_inv, B); | ||||
} | ||||
else | ||||
{ | ||||
const Mat<eT> B_trans = trans(B); | ||||
op_inv::apply(B_inv, B_trans); | ||||
} | ||||
return val * op_dotext::direct_rowvec_mat_colvec(A.mem, B_inv, C.mem) | ||||
; | ||||
} | ||||
else | ||||
{ | ||||
if(tmp2.do_trans == false) | ||||
{ | ||||
return val * op_dotext::direct_rowvec_mat_colvec(A.mem, B, C.mem); | ||||
} | ||||
else | ||||
{ | ||||
return val * op_dotext::direct_rowvec_transmat_colvec(A.mem, B, C.m | ||||
em); | ||||
} | ||||
} | ||||
} | } | |||
else | else | |||
{ | { | |||
const partial_unwrap<T1> tmp1(X.A.A); | ||||
const partial_unwrap<T2_stripped_2> tmp2(strip2.M); | ||||
const partial_unwrap<T3> tmp3(X.B); | ||||
const Mat<eT>& A = tmp1.M; | ||||
const Mat<eT>& B = tmp2.M; | ||||
const Mat<eT>& C = tmp3.M; | ||||
const u32 A_n_rows = (tmp1.do_trans == false) ? A.n_rows : A.n_cols; | const u32 A_n_rows = (tmp1.do_trans == false) ? A.n_rows : A.n_cols; | |||
const u32 A_n_cols = (tmp1.do_trans == false) ? A.n_cols : A.n_rows; | const u32 A_n_cols = (tmp1.do_trans == false) ? A.n_cols : A.n_rows; | |||
const bool B_is_vec = B.is_vec(); | const bool B_is_vec = B.is_vec(); | |||
const u32 B_n_rows = (B_is_vec == true) ? B.n_elem : ( (tmp2.do_trans = = false) ? B.n_rows : B.n_cols ); | const u32 B_n_rows = (B_is_vec == true) ? B.n_elem : ( (tmp2.do_trans = = false) ? B.n_rows : B.n_cols ); | |||
const u32 B_n_cols = (B_is_vec == true) ? B.n_elem : ( (tmp2.do_trans = = false) ? B.n_cols : B.n_rows ); | const u32 B_n_cols = (B_is_vec == true) ? B.n_elem : ( (tmp2.do_trans = = false) ? B.n_cols : B.n_rows ); | |||
const u32 C_n_rows = (tmp3.do_trans == false) ? C.n_rows : C.n_cols; | const u32 C_n_rows = (tmp3.do_trans == false) ? C.n_rows : C.n_cols; | |||
const u32 C_n_cols = (tmp3.do_trans == false) ? C.n_cols : C.n_rows; | const u32 C_n_cols = (tmp3.do_trans == false) ? C.n_cols : C.n_rows; | |||
End of changes. 5 change blocks. | ||||
59 lines changed or deleted | 12 lines changed or added | |||
fn_svd.hpp | fn_svd.hpp | |||
---|---|---|---|---|
skipping to change at line 107 | skipping to change at line 107 | |||
V.reset(); | V.reset(); | |||
arma_bad("svd(): failed to converge", false); | arma_bad("svd(): failed to converge", false); | |||
} | } | |||
return status; | return status; | |||
} | } | |||
template<typename T1> | template<typename T1> | |||
inline | inline | |||
bool | bool | |||
svd_thin | svd_econ | |||
( | ( | |||
Mat<typename T1::elem_type>& U, | Mat<typename T1::elem_type>& U, | |||
Col<typename T1::pod_type >& S, | Col<typename T1::pod_type >& S, | |||
Mat<typename T1::elem_type>& V, | Mat<typename T1::elem_type>& V, | |||
const Base<typename T1::elem_type,T1>& X, | const Base<typename T1::elem_type,T1>& X, | |||
const char mode = 'b', | const char mode = 'b', | |||
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(); | |||
arma_ignore(junk); | arma_ignore(junk); | |||
typedef typename T1::elem_type eT; | typedef typename T1::elem_type eT; | |||
arma_debug_check | arma_debug_check | |||
( | ( | |||
( ((void*)(&U) == (void*)(&S)) || (&U == &V) || ((void*)(&S) == (void*) (&V)) ), | ( ((void*)(&U) == (void*)(&S)) || (&U == &V) || ((void*)(&S) == (void*) (&V)) ), | |||
"svd_thin(): two or more output objects are the same object" | "svd_econ(): two or more output objects are the same object" | |||
); | ); | |||
arma_debug_check | arma_debug_check | |||
( | ( | |||
( (mode != 'l') && (mode != 'r') && (mode != 'b') ), | ( (mode != 'l') && (mode != 'r') && (mode != 'b') ), | |||
"svd_thin(): parameter 'mode' is incorrect" | "svd_econ(): parameter 'mode' is incorrect" | |||
); | ); | |||
// auxlib::svd_thin() makes an internal copy of X | // auxlib::svd_thin() makes an internal copy of X | |||
const bool status = auxlib::svd_thin(U, S, V, X, mode); | const bool status = auxlib::svd_thin(U, S, V, X, mode); | |||
if(status == false) | if(status == false) | |||
{ | { | |||
U.reset(); | U.reset(); | |||
S.reset(); | S.reset(); | |||
V.reset(); | V.reset(); | |||
arma_bad("svd_thin(): failed to converge", false); | arma_bad("svd_econ(): failed to converge", false); | |||
} | } | |||
return status; | return status; | |||
} | } | |||
template<typename T1> | ||||
inline | ||||
bool | ||||
svd_thin | ||||
( | ||||
Mat<typename T1::elem_type>& U, | ||||
Col<typename T1::pod_type >& S, | ||||
Mat<typename T1::elem_type>& V, | ||||
const Base<typename T1::elem_type,T1>& X, | ||||
const char mode = 'b', | ||||
const typename arma_blas_type_only<typename T1::elem_type>::result* junk | ||||
= 0 | ||||
) | ||||
{ | ||||
arma_ignore(junk); | ||||
return svd_econ(U,S,V,X,mode); | ||||
} | ||||
//! @} | //! @} | |||
End of changes. 5 change blocks. | ||||
4 lines changed or deleted | 23 lines changed or added | |||