Proxy.hpp   Proxy.hpp 
skipping to change at line 81 skipping to change at line 81
arma_aligned const Col<eT>& Q; arma_aligned const Col<eT>& Q;
inline explicit Proxy(const Col<eT>& A) inline explicit Proxy(const Col<eT>& A)
: Q(A) : Q(A)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
} }
arma_inline u32 get_n_rows() const { return Q.n_rows; } arma_inline u32 get_n_rows() const { return Q.n_rows; }
arma_inline u32 get_n_cols() const { return Q.n_cols; } arma_inline u32 get_n_cols() const { return 1; }
arma_inline u32 get_n_elem() const { return Q.n_elem; } arma_inline u32 get_n_elem() const { return Q.n_elem; }
arma_inline elem_type operator[] (const u32 i) const { r eturn Q[i]; } arma_inline elem_type operator[] (const u32 i) const { r eturn Q[i]; }
arma_inline elem_type at (const u32 row, const u32 col) const { r eturn Q.at(row, col); } arma_inline elem_type at (const u32 row, const u32 col) const { r eturn Q.at(row, col); }
arma_inline ea_type get_ea() const { return Q.memptr(); } arma_inline ea_type get_ea() const { return Q.memptr(); }
arma_inline bool is_alias(const Mat<eT>& X) const { return (&Q == &X); } arma_inline bool is_alias(const Mat<eT>& X) const { return (&Q == &X); }
}; };
template<typename eT> template<typename eT>
skipping to change at line 111 skipping to change at line 111
static const bool prefer_at_accessor = false; static const bool prefer_at_accessor = false;
arma_aligned const Row<eT>& Q; arma_aligned const Row<eT>& Q;
inline explicit Proxy(const Row<eT>& A) inline explicit Proxy(const Row<eT>& A)
: Q(A) : Q(A)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
} }
arma_inline u32 get_n_rows() const { return Q.n_rows; } arma_inline u32 get_n_rows() const { return 1; }
arma_inline u32 get_n_cols() const { return Q.n_cols; } arma_inline u32 get_n_cols() const { return Q.n_cols; }
arma_inline u32 get_n_elem() const { return Q.n_elem; } arma_inline u32 get_n_elem() const { return Q.n_elem; }
arma_inline elem_type operator[] (const u32 i) const { r eturn Q[i]; } arma_inline elem_type operator[] (const u32 i) const { r eturn Q[i]; }
arma_inline elem_type at (const u32 row, const u32 col) const { r eturn Q.at(row, col); } arma_inline elem_type at (const u32 row, const u32 col) const { r eturn Q.at(row, col); }
arma_inline ea_type get_ea() const { return Q.memptr(); } arma_inline ea_type get_ea() const { return Q.memptr(); }
arma_inline bool is_alias(const Mat<eT>& X) const { return (&Q == &X); } arma_inline bool is_alias(const Mat<eT>& X) const { return (&Q == &X); }
}; };
skipping to change at line 236 skipping to change at line 236
arma_aligned const Mat<eT> Q; arma_aligned const Mat<eT> Q;
inline explicit Proxy(const subview_elem1<eT,T1>& A) inline explicit Proxy(const subview_elem1<eT,T1>& A)
: Q(A) : Q(A)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
} }
arma_inline u32 get_n_rows() const { return Q.n_rows; } arma_inline u32 get_n_rows() const { return Q.n_rows; }
arma_inline u32 get_n_cols() const { return Q.n_cols; } arma_inline u32 get_n_cols() const { return 1; }
arma_inline u32 get_n_elem() const { return Q.n_elem; } arma_inline u32 get_n_elem() const { return Q.n_elem; }
arma_inline elem_type operator[] (const u32 i) const { r eturn Q[i]; } arma_inline elem_type operator[] (const u32 i) const { r eturn Q[i]; }
arma_inline elem_type at (const u32 row, const u32 col) const { r eturn Q.at(row, col); } arma_inline elem_type at (const u32 row, const u32 col) const { r eturn Q.at(row, col); }
arma_inline ea_type get_ea() const { return Q.memptr(); } arma_inline ea_type get_ea() const { return Q.memptr(); }
arma_inline bool is_alias(const Mat<eT>&) const { return false; } arma_inline bool is_alias(const Mat<eT>&) const { return false; }
}; };
template<typename eT> template<typename eT>
skipping to change at line 267 skipping to change at line 267
arma_aligned const diagview<eT>& Q; arma_aligned const diagview<eT>& Q;
inline explicit Proxy(const diagview<eT>& A) inline explicit Proxy(const diagview<eT>& A)
: Q(A) : Q(A)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
} }
arma_inline u32 get_n_rows() const { return Q.n_rows; } arma_inline u32 get_n_rows() const { return Q.n_rows; }
arma_inline u32 get_n_cols() const { return Q.n_cols; } arma_inline u32 get_n_cols() const { return 1; }
arma_inline u32 get_n_elem() const { return Q.n_elem; } arma_inline u32 get_n_elem() const { return Q.n_elem; }
arma_inline elem_type operator[] (const u32 i) const { r eturn Q[i]; } arma_inline elem_type operator[] (const u32 i) const { r eturn Q[i]; }
arma_inline elem_type at (const u32 row, const u32 col) const { r eturn Q.at(row, col); } arma_inline elem_type at (const u32 row, const u32 col) const { r eturn Q.at(row, col); }
arma_inline ea_type get_ea() const { return Q; } arma_inline ea_type get_ea() const { return Q; }
arma_inline bool is_alias(const Mat<eT>& X) const { return (&(Q.m) == &X); } arma_inline bool is_alias(const Mat<eT>& X) const { return (&(Q.m) == &X); }
}; };
template<typename T1, typename eop_type> template<typename T1, typename eop_type>
 End of changes. 4 change blocks. 
4 lines changed or deleted 4 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 99 #define ARMA_VERSION_MINOR 99
#define ARMA_VERSION_PATCH 3 #define ARMA_VERSION_PATCH 4
#define ARMA_VERSION_NAME "v2.0 beta 3" #define ARMA_VERSION_NAME "v2.0 beta 4"
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


 auxlib_bones.hpp   auxlib_bones.hpp 
skipping to change at line 35 skipping to change at line 35
{ {
static const u32 n2 = row + col*2; static const u32 n2 = row + col*2;
static const u32 n3 = row + col*3; static const u32 n3 = row + col*3;
static const u32 n4 = row + col*4; static const u32 n4 = row + col*4;
}; };
// //
// inv // inv
template<typename eT, typename T1> template<typename eT, typename T1>
inline static bool inv(Mat<eT>& out, const Base<eT,T1>& X); inline static bool inv(Mat<eT>& out, const Base<eT,T1>& X, const bool slo w = false);
template<typename eT> template<typename eT>
inline static bool inv(Mat<eT>& out, const Mat<eT>& A); inline static bool inv(Mat<eT>& out, const Mat<eT>& A, const bool slow = false);
template<typename eT> template<typename eT>
inline static bool inv_noalias_tinymat(Mat<eT>& out, const Mat<eT>& X, co nst u32 N); inline static bool inv_noalias_tinymat(Mat<eT>& out, const Mat<eT>& X, co nst u32 N);
template<typename eT> template<typename eT>
inline static bool inv_inplace_tinymat(Mat<eT>& out, const u32 N); inline static bool inv_inplace_tinymat(Mat<eT>& out, const u32 N);
template<typename eT> template<typename eT>
inline static bool inv_inplace_lapack(Mat<eT>& out); inline static bool inv_inplace_lapack(Mat<eT>& out);
skipping to change at line 65 skipping to change at line 65
// //
// inv_sym // inv_sym
template<typename eT, typename T1> template<typename eT, typename T1>
inline static bool inv_sym(Mat<eT>& out, const Base<eT,T1>& X, const u32 layout); inline static bool inv_sym(Mat<eT>& out, const Base<eT,T1>& X, const u32 layout);
// //
// det // det
template<typename eT, typename T1> template<typename eT, typename T1>
inline static eT det(const Base<eT,T1>& X); inline static eT det(const Base<eT,T1>& X, const bool slow = false);
template<typename eT> template<typename eT>
inline static eT det_tinymat(const Mat<eT>& X, const u32 N); inline static eT det_tinymat(const Mat<eT>& X, const u32 N);
template<typename eT> template<typename eT>
inline static eT det_lapack(const Mat<eT>& X, const bool make_copy); inline static eT det_lapack(const Mat<eT>& X, const bool make_copy);
// //
// log_det // log_det
skipping to change at line 149 skipping to change at line 149
template<typename eT, typename T1> template<typename eT, typename T1>
inline static bool svd(Mat<eT>& U, Col<eT>& S, Mat<eT>& V, const Base<eT, T1>& X); inline static bool svd(Mat<eT>& U, Col<eT>& S, Mat<eT>& V, const Base<eT, T1>& X);
template<typename T, typename T1> template<typename T, typename T1>
inline static bool svd(Mat< std::complex<T> >& U, Col<T>& S, Mat< std::co mplex<T> >& V, const Base< std::complex<T>, T1>& X); inline static bool svd(Mat< std::complex<T> >& U, Col<T>& S, Mat< std::co mplex<T> >& V, const Base< std::complex<T>, T1>& X);
// //
// solve // solve
template<typename eT> template<typename eT>
inline static bool solve (Mat<eT>& out, Mat<eT>& A, const Mat<eT>& B); inline static bool solve (Mat<eT>& out, Mat<eT>& A, const Mat<eT>& B, c onst bool slow = false);
template<typename eT> template<typename eT>
inline static bool solve_od(Mat<eT>& out, Mat<eT>& A, const Mat<eT>& B); inline static bool solve_od(Mat<eT>& out, Mat<eT>& A, const Mat<eT>& B);
template<typename eT> template<typename eT>
inline static bool solve_ud(Mat<eT>& out, Mat<eT>& A, const Mat<eT>& B); inline static bool solve_ud(Mat<eT>& out, Mat<eT>& A, const Mat<eT>& B);
// //
// solve_tr // solve_tr
 End of changes. 4 change blocks. 
4 lines changed or deleted 4 lines changed or added


 auxlib_meat.hpp   auxlib_meat.hpp 
skipping to change at line 22 skipping to change at line 22
// 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 auxlib //! \addtogroup auxlib
//! @{ //! @{
//! immediate matrix inverse //! immediate matrix inverse
template<typename eT, typename T1> template<typename eT, typename T1>
inline inline
bool bool
auxlib::inv(Mat<eT>& out, const Base<eT,T1>& X) auxlib::inv(Mat<eT>& out, const Base<eT,T1>& X, const bool slow)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
bool status = false;
out = X.get_ref(); out = X.get_ref();
arma_debug_check( (out.is_square() == false), "inv(): given matrix is not square" ); arma_debug_check( (out.is_square() == false), "inv(): given matrix is not square" );
bool status = false;
const u32 N = out.n_rows; const u32 N = out.n_rows;
if(N <= 4) if( (N <= 4) && (slow == false) )
{ {
status = auxlib::inv_inplace_tinymat(out, N); status = auxlib::inv_inplace_tinymat(out, N);
} }
if( (N > 4) || (status == false) ) if( (N > 4) || (status == false) )
{ {
status = auxlib::inv_inplace_lapack(out); status = auxlib::inv_inplace_lapack(out);
} }
if(status == false) if(status == false)
skipping to change at line 56 skipping to change at line 56
arma_print("inv(): matrix appears to be singular" ); arma_print("inv(): matrix appears to be singular" );
out.reset(); out.reset();
} }
return status; return status;
} }
template<typename eT> template<typename eT>
inline inline
bool bool
auxlib::inv(Mat<eT>& out, const Mat<eT>& X) auxlib::inv(Mat<eT>& out, const Mat<eT>& X, const bool slow)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( (X.is_square() == false), "inv(): given matrix is not s quare" ); arma_debug_check( (X.is_square() == false), "inv(): given matrix is not s quare" );
bool status = false; bool status = false;
const u32 N = X.n_rows; const u32 N = X.n_rows;
if(N <= 4) if( (N <= 4) && (slow == false) )
{ {
status = (&out != &X) ? auxlib::inv_noalias_tinymat(out, X, N) : auxlib ::inv_inplace_tinymat(out, N); status = (&out != &X) ? auxlib::inv_noalias_tinymat(out, X, N) : auxlib ::inv_inplace_tinymat(out, N);
} }
if( (N > 4) || (status == false) ) if( (N > 4) || (status == false) )
{ {
out = X; out = X;
status = auxlib::inv_inplace_lapack(out); status = auxlib::inv_inplace_lapack(out);
} }
skipping to change at line 416 skipping to change at line 416
} }
lapack::getri(&n_rows, out.memptr(), &n_rows, ipiv.memptr(), work.mem ptr(), &work_len, &info); lapack::getri(&n_rows, out.memptr(), &n_rows, ipiv.memptr(), work.mem ptr(), &work_len, &info);
} }
return (info == 0); return (info == 0);
} }
#else #else
{ {
arma_ignore(out); arma_ignore(out);
arma_stop("inv(): use of ATLAS or LAPACK needs to enabled"); arma_stop("inv(): use of ATLAS or LAPACK needs to be enabled");
return false; return false;
} }
#endif #endif
} }
template<typename eT, typename T1> template<typename eT, typename T1>
inline inline
bool bool
auxlib::inv_tr(Mat<eT>& out, const Base<eT,T1>& X, const u32 layout) auxlib::inv_tr(Mat<eT>& out, const Base<eT,T1>& X, const u32 layout)
{ {
skipping to change at line 454 skipping to change at line 454
blas_int n = blas_int(out.n_rows); blas_int n = blas_int(out.n_rows);
blas_int info = 0; blas_int info = 0;
lapack::trtri(&uplo, &diag, &n, out.memptr(), &n, &info); lapack::trtri(&uplo, &diag, &n, out.memptr(), &n, &info);
status = (info == 0); status = (info == 0);
} }
#else #else
{ {
arma_ignore(layout); arma_ignore(layout);
arma_stop("inv(): use of LAPACK needs to enabled"); arma_stop("inv(): use of LAPACK needs to be enabled");
status = false; status = false;
} }
#endif #endif
if(status == false) if(status == false)
{ {
arma_print("inv(): matrix appears to be singular" ); arma_print("inv(): matrix appears to be singular" );
out.reset(); out.reset();
} }
else else
skipping to change at line 515 skipping to change at line 515
lapack::potrf(&uplo, &n, out.memptr(), &n, &info); lapack::potrf(&uplo, &n, out.memptr(), &n, &info);
lapack::potri(&uplo, &n, out.memptr(), &n, &info); lapack::potri(&uplo, &n, out.memptr(), &n, &info);
out = (layout == 0) ? symmatu(out) : symmatl(out); out = (layout == 0) ? symmatu(out) : symmatl(out);
status = (info == 0); status = (info == 0);
} }
#else #else
{ {
arma_ignore(layout); arma_ignore(layout);
arma_stop("inv(): use of LAPACK needs to enabled"); arma_stop("inv(): use of LAPACK needs to be enabled");
status = false; status = false;
} }
#endif #endif
if(status == false) if(status == false)
{ {
arma_print("inv(): matrix appears to be singular" ); arma_print("inv(): matrix appears to be singular" );
out.reset(); out.reset();
} }
return status; return status;
} }
template<typename eT, typename T1> template<typename eT, typename T1>
inline inline
eT eT
auxlib::det(const Base<eT,T1>& X) auxlib::det(const Base<eT,T1>& X, const bool slow)
{ {
const unwrap<T1> tmp(X.get_ref()); const unwrap<T1> tmp(X.get_ref());
const Mat<eT>& A = tmp.M; const Mat<eT>& A = tmp.M;
arma_debug_check( !A.is_square(), "det(): matrix is not square" ); arma_debug_check( (A.is_square() == false), "det(): matrix is not square" );
const bool make_copy = (is_Mat<T1>::value == true) ? true : false; const bool make_copy = (is_Mat<T1>::value == true) ? true : false;
const u32 N = A.n_rows; if(slow == false)
switch(N)
{ {
case 0: const u32 N = A.n_rows;
case 1:
case 2:
return auxlib::det_tinymat(A, N);
break;
case 3: switch(N)
case 4:
{ {
const eT tmp_det = auxlib::det_tinymat(A, N); case 0:
return (tmp_det != eT(0)) ? tmp_det : auxlib::det_lapack(A, make_copy case 1:
); case 2:
} return auxlib::det_tinymat(A, N);
break; break;
default: case 3:
return auxlib::det_lapack(A, make_copy); case 4:
} {
const eT tmp_det = auxlib::det_tinymat(A, N);
return (tmp_det != eT(0)) ? tmp_det : auxlib::det_lapack(A, make_co
py);
}
break;
return eT(0); // prevent compiler warnings default:
return auxlib::det_lapack(A, make_copy);
}
}
else
{
return auxlib::det_lapack(A, make_copy);
}
} }
template<typename eT> template<typename eT>
inline inline
eT eT
auxlib::det_tinymat(const Mat<eT>& X, const u32 N) auxlib::det_tinymat(const Mat<eT>& X, const u32 N)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
switch(N) switch(N)
skipping to change at line 678 skipping to change at line 683
Mat<eT> X_copy; Mat<eT> X_copy;
if(make_copy == true) if(make_copy == true)
{ {
X_copy = X; X_copy = X;
} }
Mat<eT>& tmp = (make_copy == true) ? X_copy : const_cast< Mat<eT>& >(X); Mat<eT>& tmp = (make_copy == true) ? X_copy : const_cast< Mat<eT>& >(X);
if(tmp.is_empty())
{
return eT(1);
}
#if defined(ARMA_USE_ATLAS) #if defined(ARMA_USE_ATLAS)
{ {
podarray<int> ipiv(tmp.n_rows); podarray<int> ipiv(tmp.n_rows);
atlas::clapack_getrf(atlas::CblasColMajor, tmp.n_rows, tmp.n_cols, tmp. memptr(), tmp.n_rows, ipiv.memptr()); 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
eT val = tmp.at(0,0); eT val = tmp.at(0,0);
for(u32 i=1; i < tmp.n_rows; ++i) for(u32 i=1; i < tmp.n_rows; ++i)
{ {
skipping to change at line 735 skipping to change at line 745
} }
} }
return ( (sign < 0) ? -val : val ); return ( (sign < 0) ? -val : val );
} }
#else #else
{ {
arma_ignore(X); arma_ignore(X);
arma_ignore(make_copy); arma_ignore(make_copy);
arma_ignore(tmp); arma_ignore(tmp);
arma_stop("det(): use of ATLAS or LAPACK needs to enabled"); arma_stop("det(): use of ATLAS or LAPACK needs to be enabled");
return eT(0); return eT(0);
} }
#endif #endif
} }
//! immediate log determinant of a matrix using ATLAS or LAPACK //! immediate log determinant of a matrix using ATLAS or LAPACK
template<typename eT, typename T1> template<typename eT, typename T1>
inline inline
void void
auxlib::log_det(eT& out_val, typename get_pod_type<eT>::result& out_sign, c onst Base<eT,T1>& X) auxlib::log_det(eT& out_val, typename get_pod_type<eT>::result& out_sign, c onst Base<eT,T1>& X)
skipping to change at line 837 skipping to change at line 847
{ {
sign *= -1; sign *= -1;
} }
} }
out_val = val; out_val = val;
out_sign = T(sign); out_sign = T(sign);
} }
#else #else
{ {
arma_stop("log_det(): use of ATLAS or LAPACK needs to enabled"); arma_stop("log_det(): use of ATLAS or LAPACK needs to be enabled");
out_val = eT(0); out_val = eT(0);
out_sign = T(0); out_sign = T(0);
} }
#endif #endif
} }
//! immediate LU decomposition of a matrix using ATLAS or LAPACK //! immediate LU decomposition of a matrix using ATLAS or LAPACK
template<typename eT, typename T1> template<typename eT, typename T1>
inline inline
skipping to change at line 916 skipping to change at line 926
{ {
L.at(row,col) = U.at(row,col); L.at(row,col) = U.at(row,col);
U.at(row,col) = eT(0); U.at(row,col) = eT(0);
} }
} }
} }
#else #else
{ {
arma_ignore(U_n_rows); arma_ignore(U_n_rows);
arma_ignore(U_n_cols); arma_ignore(U_n_cols);
arma_stop("lu(): use of ATLAS or LAPACK needs to enabled"); arma_stop("lu(): use of ATLAS or LAPACK needs to be enabled");
} }
#endif #endif
} }
template<typename eT, typename T1> template<typename eT, typename T1>
inline inline
void void
auxlib::lu(Mat<eT>& L, Mat<eT>& U, Mat<eT>& P, const Base<eT,T1>& X) auxlib::lu(Mat<eT>& L, Mat<eT>& U, Mat<eT>& P, const Base<eT,T1>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
skipping to change at line 1075 skipping to change at line 1085
arma_extra_debug_print("lapack::syev()"); arma_extra_debug_print("lapack::syev()");
lapack::syev(&jobz, &uplo, &n_rows, A.memptr(), &n_rows, eigval.memptr( ), work.memptr(), &lwork, &info); lapack::syev(&jobz, &uplo, &n_rows, A.memptr(), &n_rows, eigval.memptr( ), work.memptr(), &lwork, &info);
return (info == 0); return (info == 0);
} }
#else #else
{ {
arma_ignore(eigval); arma_ignore(eigval);
arma_ignore(X); arma_ignore(X);
arma_stop("eig_sym(): use of LAPACK needs to enabled"); arma_stop("eig_sym(): use of LAPACK needs to be enabled");
return false; return false;
} }
#endif #endif
} }
//! immediate eigenvalues of a hermitian complex matrix using LAPACK //! immediate eigenvalues of a hermitian complex matrix using LAPACK
template<typename T, typename T1> template<typename T, typename T1>
inline inline
bool bool
auxlib::eig_sym(Col<T>& eigval, const Base<std::complex<T>,T1>& X) auxlib::eig_sym(Col<T>& eigval, const Base<std::complex<T>,T1>& X)
skipping to change at line 1125 skipping to change at line 1135
arma_extra_debug_print("lapack::heev()"); arma_extra_debug_print("lapack::heev()");
lapack::heev(&jobz, &uplo, &n_rows, A.memptr(), &lda, eigval.memptr(), work.memptr(), &lwork, rwork.memptr(), &info); lapack::heev(&jobz, &uplo, &n_rows, A.memptr(), &lda, eigval.memptr(), work.memptr(), &lwork, rwork.memptr(), &info);
return (info == 0); return (info == 0);
} }
#else #else
{ {
arma_ignore(eigval); arma_ignore(eigval);
arma_ignore(X); arma_ignore(X);
arma_stop("eig_sym(): use of LAPACK needs to enabled"); arma_stop("eig_sym(): use of LAPACK needs to be enabled");
return false; return false;
} }
#endif #endif
} }
//! immediate eigenvalues and eigenvectors of a symmetric real matrix using LAPACK //! immediate eigenvalues and eigenvectors of a symmetric real matrix using LAPACK
template<typename eT, typename T1> template<typename eT, typename T1>
inline inline
bool bool
auxlib::eig_sym(Col<eT>& eigval, Mat<eT>& eigvec, const Base<eT,T1>& X) auxlib::eig_sym(Col<eT>& eigval, Mat<eT>& eigvec, const Base<eT,T1>& X)
skipping to change at line 1175 skipping to change at line 1185
arma_extra_debug_print("lapack::syev()"); arma_extra_debug_print("lapack::syev()");
lapack::syev(&jobz, &uplo, &n_rows, eigvec.memptr(), &n_rows, eigval.me mptr(), work.memptr(), &lwork, &info); lapack::syev(&jobz, &uplo, &n_rows, eigvec.memptr(), &n_rows, eigval.me mptr(), work.memptr(), &lwork, &info);
return (info == 0); return (info == 0);
} }
#else #else
{ {
arma_ignore(eigval); arma_ignore(eigval);
arma_ignore(eigvec); arma_ignore(eigvec);
arma_stop("eig_sym(): use of LAPACK needs to enabled"); arma_stop("eig_sym(): use of LAPACK needs to be enabled");
return false; return false;
} }
#endif #endif
} }
//! immediate eigenvalues and eigenvectors of a hermitian complex matrix us ing LAPACK //! immediate eigenvalues and eigenvectors of a hermitian complex matrix us ing LAPACK
template<typename T, typename T1> template<typename T, typename T1>
inline inline
bool bool
skipping to change at line 1229 skipping to change at line 1239
arma_extra_debug_print("lapack::heev()"); arma_extra_debug_print("lapack::heev()");
lapack::heev(&jobz, &uplo, &n_rows, eigvec.memptr(), &lda, eigval.mempt r(), work.memptr(), &lwork, rwork.memptr(), &info); lapack::heev(&jobz, &uplo, &n_rows, eigvec.memptr(), &lda, eigval.mempt r(), work.memptr(), &lwork, rwork.memptr(), &info);
return (info == 0); return (info == 0);
} }
#else #else
{ {
arma_ignore(eigval); arma_ignore(eigval);
arma_ignore(eigvec); arma_ignore(eigvec);
arma_ignore(X); arma_ignore(X);
arma_stop("eig_sym(): use of LAPACK needs to enabled"); arma_stop("eig_sym(): use of LAPACK needs to be enabled");
return false; return false;
} }
#endif #endif
} }
//! Eigenvalues and eigenvectors of a general square real matrix using LAPA CK. //! Eigenvalues and eigenvectors of a general square real matrix using LAPA CK.
//! The argument 'side' specifies which eigenvectors should be calculated //! The argument 'side' specifies which eigenvectors should be calculated
//! (see code for mode details). //! (see code for mode details).
template<typename T, typename T1> template<typename T, typename T1>
inline inline
skipping to change at line 1332 skipping to change at line 1342
return (info == 0); return (info == 0);
} }
#else #else
{ {
arma_ignore(eigval); arma_ignore(eigval);
arma_ignore(l_eigvec); arma_ignore(l_eigvec);
arma_ignore(r_eigvec); arma_ignore(r_eigvec);
arma_ignore(X); arma_ignore(X);
arma_ignore(side); arma_ignore(side);
arma_stop("eig_gen(): use of LAPACK needs to enabled"); arma_stop("eig_gen(): use of LAPACK needs to be enabled");
return false; return false;
} }
#endif #endif
} }
//! Eigenvalues and eigenvectors of a general square complex matrix using L APACK //! Eigenvalues and eigenvectors of a general square complex matrix using L APACK
//! The argument 'side' specifies which eigenvectors should be calculated //! The argument 'side' specifies which eigenvectors should be calculated
//! (see code for mode details). //! (see code for mode details).
template<typename T, typename T1> template<typename T, typename T1>
inline inline
skipping to change at line 1427 skipping to change at line 1437
return (info == 0); return (info == 0);
} }
#else #else
{ {
arma_ignore(eigval); arma_ignore(eigval);
arma_ignore(l_eigvec); arma_ignore(l_eigvec);
arma_ignore(r_eigvec); arma_ignore(r_eigvec);
arma_ignore(X); arma_ignore(X);
arma_ignore(side); arma_ignore(side);
arma_stop("eig_gen(): use of LAPACK needs to enabled"); arma_stop("eig_gen(): use of LAPACK needs to be enabled");
return false; return false;
} }
#endif #endif
} }
template<typename eT, typename T1> template<typename eT, typename T1>
inline inline
bool bool
auxlib::chol(Mat<eT>& out, const Base<eT,T1>& X) auxlib::chol(Mat<eT>& out, const Base<eT,T1>& X)
{ {
skipping to change at line 1474 skipping to change at line 1484
{ {
colptr[row] = eT(0); colptr[row] = eT(0);
} }
} }
return (info == 0); return (info == 0);
} }
#else #else
{ {
arma_ignore(out); arma_ignore(out);
arma_stop("chol(): use of LAPACK needs to enabled"); arma_stop("chol(): use of LAPACK needs to be enabled");
return false; return false;
} }
#endif #endif
} }
template<typename eT, typename T1> template<typename eT, typename T1>
inline inline
bool bool
auxlib::qr(Mat<eT>& Q, Mat<eT>& R, const Base<eT,T1>& X) auxlib::qr(Mat<eT>& Q, Mat<eT>& R, const Base<eT,T1>& X)
{ {
skipping to change at line 1575 skipping to change at line 1585
lapack::ungqr(&m, &m, &k, Q.memptr(), &m, tau.memptr(), work.memptr() , &work_len, &info); lapack::ungqr(&m, &m, &k, Q.memptr(), &m, tau.memptr(), work.memptr() , &work_len, &info);
} }
return (info == 0); return (info == 0);
} }
#else #else
{ {
arma_ignore(Q); arma_ignore(Q);
arma_ignore(R); arma_ignore(R);
arma_ignore(X); arma_ignore(X);
arma_stop("qr(): use of LAPACK needs to enabled"); arma_stop("qr(): use of LAPACK needs to be enabled");
return false; return false;
} }
#endif #endif
} }
template<typename eT, typename T1> template<typename eT, typename T1>
inline inline
bool bool
auxlib::svd(Col<eT>& S, const Base<eT,T1>& X, u32& X_n_rows, u32& X_n_cols) auxlib::svd(Col<eT>& S, const Base<eT,T1>& X, u32& X_n_rows, u32& X_n_cols)
{ {
skipping to change at line 1667 skipping to change at line 1677
} }
return (info == 0); return (info == 0);
} }
#else #else
{ {
arma_ignore(S); arma_ignore(S);
arma_ignore(X); arma_ignore(X);
arma_ignore(X_n_rows); arma_ignore(X_n_rows);
arma_ignore(X_n_cols); arma_ignore(X_n_cols);
arma_stop("svd(): use of LAPACK needs to enabled"); arma_stop("svd(): use of LAPACK needs to be enabled");
return false; return false;
} }
#endif #endif
} }
template<typename T, typename T1> template<typename T, typename T1>
inline inline
bool bool
auxlib::svd(Col<T>& S, const Base<std::complex<T>, T1>& X, u32& X_n_rows, u 32& X_n_cols) auxlib::svd(Col<T>& S, const Base<std::complex<T>, T1>& X, u32& X_n_rows, u 32& X_n_cols)
{ {
skipping to change at line 1764 skipping to change at line 1774
return (info == 0); return (info == 0);
} }
#else #else
{ {
arma_ignore(S); arma_ignore(S);
arma_ignore(X); arma_ignore(X);
arma_ignore(X_n_rows); arma_ignore(X_n_rows);
arma_ignore(X_n_cols); arma_ignore(X_n_cols);
arma_stop("svd(): use of LAPACK needs to enabled"); arma_stop("svd(): use of LAPACK needs to be enabled");
return false; return false;
} }
#endif #endif
} }
template<typename eT, typename T1> template<typename eT, typename T1>
inline inline
bool bool
auxlib::svd(Col<eT>& S, const Base<eT,T1>& X) auxlib::svd(Col<eT>& S, const Base<eT,T1>& X)
{ {
skipping to change at line 1875 skipping to change at line 1885
} }
return (info == 0); return (info == 0);
} }
#else #else
{ {
arma_ignore(U); arma_ignore(U);
arma_ignore(S); arma_ignore(S);
arma_ignore(V); arma_ignore(V);
arma_ignore(X); arma_ignore(X);
arma_stop("svd(): use of LAPACK needs to enabled"); arma_stop("svd(): use of LAPACK needs to be enabled");
return false; return false;
} }
#endif #endif
} }
template<typename T, typename T1> template<typename T, typename T1>
inline inline
bool bool
auxlib::svd(Mat< std::complex<T> >& U, Col<T>& S, Mat< std::complex<T> >& V , const Base< std::complex<T>, T1>& X) auxlib::svd(Mat< std::complex<T> >& U, Col<T>& S, Mat< std::complex<T> >& V , const Base< std::complex<T>, T1>& X)
{ {
skipping to change at line 1969 skipping to change at line 1979
} }
return (info == 0); return (info == 0);
} }
#else #else
{ {
arma_ignore(U); arma_ignore(U);
arma_ignore(S); arma_ignore(S);
arma_ignore(V); arma_ignore(V);
arma_ignore(X); arma_ignore(X);
arma_stop("svd(): use of LAPACK needs to enabled"); arma_stop("svd(): use of LAPACK needs to be enabled");
return false; return false;
} }
#endif #endif
} }
//! Solve a system of linear equations. //! Solve a system of linear equations.
//! Assumes that A.n_rows = A.n_cols and B.n_rows = A.n_rows //! Assumes that A.n_rows = A.n_cols and B.n_rows = A.n_rows
template<typename eT> template<typename eT>
inline inline
bool bool
auxlib::solve(Mat<eT>& out, Mat<eT>& A, const Mat<eT>& B) auxlib::solve(Mat<eT>& out, Mat<eT>& A, const Mat<eT>& B, const bool slow)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
if(A.is_empty() || B.is_empty()) if(A.is_empty() || B.is_empty())
{ {
out.reset(); out.reset();
A.reset(); A.reset();
return true; return true;
} }
else else
{ {
const u32 A_n_rows = A.n_rows; const u32 A_n_rows = A.n_rows;
bool status = false; bool status = false;
if(A_n_rows <= 4) if( (A_n_rows <= 4) && (slow == false) )
{ {
Mat<eT> A_inv; Mat<eT> A_inv;
status = auxlib::inv_noalias_tinymat(A_inv, A, A_n_rows); status = auxlib::inv_noalias_tinymat(A_inv, A, A_n_rows);
if(status == true) if(status == true)
{ {
out.set_size(A_n_rows, B.n_cols); out.set_size(A_n_rows, B.n_cols);
gemm_emul<false,false,false,false>::apply(out, A_inv, B); gemm_emul<false,false,false,false>::apply(out, A_inv, B);
skipping to change at line 2033 skipping to change at line 2043
podarray<blas_int> ipiv(A_n_rows); podarray<blas_int> ipiv(A_n_rows);
out = B; out = B;
lapack::gesv<eT>(&n, &nrhs, A.memptr(), &lda, ipiv.memptr(), out.me mptr(), &ldb, &info); lapack::gesv<eT>(&n, &nrhs, A.memptr(), &lda, ipiv.memptr(), out.me mptr(), &ldb, &info);
return (info == 0); return (info == 0);
} }
#else #else
{ {
arma_stop("solve(): use of LAPACK needs to enabled"); arma_stop("solve(): use of LAPACK needs to be enabled");
return false; return false;
} }
#endif #endif
} }
} }
return true; return true;
} }
//! Solve an over-determined system. //! Solve an over-determined system.
skipping to change at line 2104 skipping to change at line 2114
arrayops::copy( out.colptr(col), tmp.colptr(col), A.n_cols ); arrayops::copy( out.colptr(col), tmp.colptr(col), A.n_cols );
} }
return (info == 0); return (info == 0);
} }
#else #else
{ {
arma_ignore(out); arma_ignore(out);
arma_ignore(A); arma_ignore(A);
arma_ignore(B); arma_ignore(B);
arma_stop("solve(): use of LAPACK needs to enabled"); arma_stop("solve(): use of LAPACK needs to be enabled");
return false; return false;
} }
#endif #endif
} }
//! Solve an under-determined system. //! Solve an under-determined system.
//! Assumes that A.n_rows < A.n_cols and B.n_rows = A.n_rows //! Assumes that A.n_rows < A.n_cols and B.n_rows = A.n_rows
template<typename eT> template<typename eT>
inline inline
bool bool
skipping to change at line 2184 skipping to change at line 2194
arrayops::copy( out.colptr(col), tmp.colptr(col), A.n_cols ); arrayops::copy( out.colptr(col), tmp.colptr(col), A.n_cols );
} }
return (info == 0); return (info == 0);
} }
#else #else
{ {
arma_ignore(out); arma_ignore(out);
arma_ignore(A); arma_ignore(A);
arma_ignore(B); arma_ignore(B);
arma_stop("solve(): use of LAPACK needs to enabled"); arma_stop("solve(): use of LAPACK needs to be enabled");
return false; return false;
} }
#endif #endif
} }
// //
// solve_tr // solve_tr
template<typename eT> template<typename eT>
inline inline
skipping to change at line 2227 skipping to change at line 2237
lapack::trtrs<eT>(&uplo, &trans, &diag, &n, &nrhs, A.memptr(), &n, out. memptr(), &n, &info); lapack::trtrs<eT>(&uplo, &trans, &diag, &n, &nrhs, A.memptr(), &n, out. memptr(), &n, &info);
return (info == 0); return (info == 0);
} }
#else #else
{ {
arma_ignore(out); arma_ignore(out);
arma_ignore(A); arma_ignore(A);
arma_ignore(B); arma_ignore(B);
arma_ignore(layout); arma_ignore(layout);
arma_stop("solve(): use of LAPACK needs to enabled"); arma_stop("solve(): use of LAPACK needs to be enabled");
return false; return false;
} }
#endif #endif
} }
// //
// Schur decomposition // Schur decomposition
template<typename eT> template<typename eT>
inline inline
 End of changes. 39 change blocks. 
51 lines changed or deleted 61 lines changed or added


 fn_det.hpp   fn_det.hpp 
skipping to change at line 21 skipping to change at line 21
// (see http://www.opensource.org/licenses for more info) // (see http://www.opensource.org/licenses for more info)
//! \addtogroup fn_det //! \addtogroup fn_det
//! @{ //! @{
//! determinant of mat //! determinant of mat
template<typename T1> template<typename T1>
inline inline
arma_warn_unused arma_warn_unused
typename T1::elem_type typename T1::elem_type
det(const Base<typename T1::elem_type,T1>& X, const typename arma_blas_type det
_only<typename T1::elem_type>::result* junk = 0) (
const Base<typename T1::elem_type,T1>& X,
const bool slow = false,
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);
return auxlib::det(X); return auxlib::det(X, slow);
} }
//! determinant of diagmat //! determinant of diagmat
template<typename T1> template<typename T1>
inline inline
arma_warn_unused arma_warn_unused
typename T1::elem_type typename T1::elem_type
det(const Op<T1, op_diagmat>& X) det
(
const Op<T1, op_diagmat>& X,
const bool slow = false
)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_ignore(slow);
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
const diagmat_proxy<T1> A(X.m); const diagmat_proxy<T1> A(X.m);
const u32 A_n_elem = A.n_elem; const u32 A_n_elem = A.n_elem;
if(A_n_elem == 0) eT val = eT(1);
{
return eT(1);
}
eT val = A[0];
for(u32 i=1; i<A_n_elem; ++i) for(u32 i=0; i<A_n_elem; ++i)
{ {
val *= A[i]; val *= A[i];
} }
return val; return val;
} }
//! determinant of inv(A), without doing the inverse operation //! determinant of inv(A), without doing the inverse operation
template<typename T1> template<typename T1>
inline inline
arma_warn_unused arma_warn_unused
typename T1::elem_type typename T1::elem_type
det(const Op<T1,op_inv>& in, const typename arma_blas_type_only<typename T1 det
::elem_type>::result* junk = 0) (
const Op<T1,op_inv>& in,
const bool slow = false,
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;
eT tmp = det(in.m); eT tmp = det(in.m, slow);
arma_warn( (tmp == eT(0)), "det(): warning: denominator is zero" ); arma_warn( (tmp == eT(0)), "det(): warning: denominator is zero" );
return eT(1) / tmp; return eT(1) / tmp;
} }
//! determinant of trans(A) //! determinant of trans(A)
template<typename T1> template<typename T1>
inline inline
arma_warn_unused arma_warn_unused
typename T1::elem_type typename T1::elem_type
det(const Op<T1,op_htrans>& in, const typename arma_blas_type_only<typename det
T1::elem_type>::result* junk = 0) (
const Op<T1,op_htrans>& in,
const bool slow = false,
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;
const unwrap<T1> tmp(in.m); const unwrap<T1> tmp(in.m);
const Mat<eT>& X = tmp.M; const Mat<eT>& X = tmp.M;
return det(X); return det(X, slow);
} }
//! @} //! @}
 End of changes. 12 change blocks. 
19 lines changed or deleted 31 lines changed or added


 fn_inv.hpp   fn_inv.hpp 
// Copyright (C) 2008-2010 NICTA (www.nicta.com.au) // Copyright (C) 2008-2011 NICTA (www.nicta.com.au)
// Copyright (C) 2008-2010 Conrad Sanderson // Copyright (C) 2008-2011 Conrad Sanderson
// //
// 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)
//! \addtogroup fn_inv //! \addtogroup fn_inv
//! @{ //! @{
//! delayed matrix inverse (general matrices) //! delayed matrix inverse (general matrices)
template<typename T1> template<typename T1>
arma_inline arma_inline
const Op<T1, op_inv> const Op<T1, op_inv>
inv inv
( (
const Base<typename T1::elem_type,T1>& X, const Base<typename T1::elem_type,T1>& X,
const bool slow = false,
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);
return Op<T1, op_inv>(X.get_ref()); return Op<T1, op_inv>(X.get_ref(), ((slow == false) ? 0 : 1), 0);
} }
//! remove the inverse operation if applied twice consecutively //! remove the inverse operation if applied twice consecutively
template<typename T1> template<typename T1>
arma_inline arma_inline
const T1& const T1&
inv(const Op<T1, op_inv>& X) inv(const Op<T1, op_inv>& X, const bool slow = false)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_ignore(slow);
return X.m; return X.m;
} }
//! delayed matrix inverse (triangular matrices) //! delayed matrix inverse (triangular matrices)
template<typename T1> template<typename T1>
arma_inline arma_inline
const Op<T1, op_inv_tr> const Op<T1, op_inv_tr>
inv inv
( (
const Op<T1, op_trimat>& X, const Op<T1, op_trimat>& X,
const bool slow = false,
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(slow);
arma_ignore(junk); arma_ignore(junk);
return Op<T1, op_inv_tr>(X.m, X.aux_u32_a, 0); return Op<T1, op_inv_tr>(X.m, X.aux_u32_a, 0);
} }
//! delayed matrix inverse (symmetric matrices) //! delayed matrix inverse (symmetric matrices)
template<typename T1> template<typename T1>
arma_inline arma_inline
const Op<T1, op_inv_sym> const Op<T1, op_inv_sym>
inv inv
( (
const Op<T1, op_symmat>& X, const Op<T1, op_symmat>& X,
const bool slow = false,
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(slow);
arma_ignore(junk); arma_ignore(junk);
return Op<T1, op_inv_sym>(X.m, X.aux_u32_a, 0); return Op<T1, op_inv_sym>(X.m, X.aux_u32_a, 0);
} }
//! @} //! @}
 End of changes. 9 change blocks. 
4 lines changed or deleted 10 lines changed or added


 fn_solve.hpp   fn_solve.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
// //
// 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
//! This function will also try to provide approximate solutions //! This function will also try to provide approximate solutions
//! to under-determined as well as over-determined systems (non-square A ma trices). //! to under-determined as well as over-determined systems (non-square A ma trices).
template<typename T1, typename T2> template<typename T1, typename T2>
inline inline
const Glue<T1, T2, glue_solve> const Glue<T1, T2, glue_solve>
solve solve
( (
const Base<typename T1::elem_type,T1>& A, const Base<typename T1::elem_type,T1>& A,
const Base<typename T1::elem_type,T2>& B, const Base<typename T1::elem_type,T2>& B,
const bool slow = false,
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);
return Glue<T1, T2, glue_solve>(A.get_ref(), B.get_ref()); return Glue<T1, T2, glue_solve>(A.get_ref(), B.get_ref(), ((slow == false ) ? 0 : 1) );
} }
template<typename T1, typename T2> template<typename T1, typename T2>
inline inline
const Glue<T1, T2, glue_solve_tr> const Glue<T1, T2, glue_solve_tr>
solve solve
( (
const Op<T1, op_trimat>& A, const Op<T1, op_trimat>& A,
const Base<typename T1::elem_type,T2>& B, const Base<typename T1::elem_type,T2>& B,
const bool slow = false,
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(slow);
arma_ignore(junk); arma_ignore(junk);
return Glue<T1, T2, glue_solve_tr>(A.m, B.get_ref(), A.aux_u32_a); return Glue<T1, T2, glue_solve_tr>(A.m, B.get_ref(), A.aux_u32_a);
} }
template<typename T1, typename T2> template<typename T1, typename T2>
inline inline
bool bool
solve solve
( (
Mat<typename T1::elem_type>& out, Mat<typename T1::elem_type>& out,
const Base<typename T1::elem_type,T1>& A, const Base<typename T1::elem_type,T1>& A,
const Base<typename T1::elem_type,T2>& B, const Base<typename T1::elem_type,T2>& B,
const bool slow = false,
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);
out = solve( A.get_ref(), B.get_ref() ); out = solve( A.get_ref(), B.get_ref(), slow );
return (out.n_elem == 0) ? false : true; return (out.n_elem == 0) ? false : true;
} }
//! @} //! @}
 End of changes. 7 change blocks. 
4 lines changed or deleted 8 lines changed or added


 fn_strans.hpp   fn_strans.hpp 
skipping to change at line 27 skipping to change at line 27
arma_inline arma_inline
const Op<T1, op_strans> const Op<T1, op_strans>
strans(const Base<typename T1::elem_type,T1>& X, const typename arma_cx_onl y<typename T1::elem_type>::result* junk = 0) strans(const Base<typename T1::elem_type,T1>& X, const typename arma_cx_onl y<typename T1::elem_type>::result* junk = 0)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_ignore(junk); arma_ignore(junk);
return Op<T1, op_strans>(X.get_ref()); return Op<T1, op_strans>(X.get_ref());
} }
template<typename T1>
arma_inline
const Op<T1, op_htrans>
strans(const Base<typename T1::elem_type,T1>& X, const typename arma_not_cx
<typename T1::elem_type>::result* junk = 0)
{
arma_extra_debug_sigprint();
arma_ignore(junk);
return Op<T1, op_htrans>(X.get_ref());
}
//! two consecutive transpose operations cancel each other //! two consecutive transpose operations cancel each other
template<typename T1> template<typename T1>
arma_inline arma_inline
const T1& const T1&
strans(const Op<T1, op_strans>& X) strans(const Op<T1, op_strans>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_extra_debug_print("strans(): removing op_strans"); arma_extra_debug_print("strans(): removing op_strans");
return X.m; return X.m;
 End of changes. 1 change blocks. 
0 lines changed or deleted 12 lines changed or added


 gemm.hpp   gemm.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 gemm //! \addtogroup gemm
//! @{ //! @{
//! for small square matrices with n_rows <= 4 //! for tiny square matrices, size <= 4x4
template<const bool do_trans_A=false, const bool use_alpha=false, const boo l use_beta=false> template<const bool do_trans_A=false, const bool use_alpha=false, const boo l use_beta=false>
class gemm_emul_tinysq class gemm_emul_tinysq
{ {
public: public:
template<typename eT> template<typename eT>
arma_hot arma_hot
inline inline
static static
void void
skipping to change at line 41 skipping to change at line 41
const Mat<eT>& B, const Mat<eT>& B,
const eT alpha = eT(1), const eT alpha = eT(1),
const eT beta = eT(0) const eT beta = eT(0)
) )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
switch(A.n_rows) switch(A.n_rows)
{ {
case 4: case 4:
gemv_emul_tiny<do_trans_A, use_alpha, use_beta>::apply( C.colptr(3) , A, B.colptr(3), alpha, beta ); gemv_emul_tinysq<do_trans_A, use_alpha, use_beta>::apply( C.colptr( 3), A, B.colptr(3), alpha, beta );
case 3: case 3:
gemv_emul_tiny<do_trans_A, use_alpha, use_beta>::apply( C.colptr(2) , A, B.colptr(2), alpha, beta ); gemv_emul_tinysq<do_trans_A, use_alpha, use_beta>::apply( C.colptr( 2), A, B.colptr(2), alpha, beta );
case 2: case 2:
gemv_emul_tiny<do_trans_A, use_alpha, use_beta>::apply( C.colptr(1) , A, B.colptr(1), alpha, beta ); gemv_emul_tinysq<do_trans_A, use_alpha, use_beta>::apply( C.colptr( 1), A, B.colptr(1), alpha, beta );
case 1: case 1:
gemv_emul_tiny<do_trans_A, use_alpha, use_beta>::apply( C.colptr(0) , A, B.colptr(0), alpha, beta ); gemv_emul_tinysq<do_trans_A, use_alpha, use_beta>::apply( C.colptr( 0), A, B.colptr(0), alpha, beta );
default: default:
; ;
} }
} }
}; };
template<const bool do_trans_A=false, const bool do_trans_B=false, const bo ol use_alpha=false, const bool use_beta=false> template<const bool do_trans_A=false, const bool do_trans_B=false, const bo ol use_alpha=false, const bool use_beta=false>
class gemm_emul_large class gemm_emul_large
 End of changes. 5 change blocks. 
5 lines changed or deleted 5 lines changed or added


 gemv.hpp   gemv.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 gemv //! \addtogroup gemv
//! @{ //! @{
//! for tiny square matrices with n_rows <= 4 //! for tiny square matrices, size <= 4x4
template<const bool do_trans_A=false, const bool use_alpha=false, const boo l use_beta=false> template<const bool do_trans_A=false, const bool use_alpha=false, const boo l use_beta=false>
class gemv_emul_tiny class gemv_emul_tinysq
{ {
public: public:
template<const u32 row, const u32 col> template<const u32 row, const u32 col>
struct pos struct pos
{ {
static const u32 n2 = (do_trans_A == false) ? (row + col*2) : (col + ro w*2); static const u32 n2 = (do_trans_A == false) ? (row + col*2) : (col + ro w*2);
static const u32 n3 = (do_trans_A == false) ? (row + col*3) : (col + ro w*3); static const u32 n3 = (do_trans_A == false) ? (row + col*3) : (col + ro w*3);
static const u32 n4 = (do_trans_A == false) ? (row + col*4) : (col + ro w*4); static const u32 n4 = (do_trans_A == false) ? (row + col*4) : (col + ro w*4);
}; };
skipping to change at line 148 skipping to change at line 148
void void
apply( eT* y, const Mat<eT>& A, const eT* x, const eT alpha = eT(1), cons t eT beta = eT(0) ) apply( eT* y, const Mat<eT>& A, const eT* x, const eT alpha = eT(1), cons t eT beta = eT(0) )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
const u32 A_n_rows = A.n_rows; const u32 A_n_rows = A.n_rows;
const u32 A_n_cols = A.n_cols; const u32 A_n_cols = A.n_cols;
if(do_trans_A == false) if(do_trans_A == false)
{ {
if(A_n_rows == 1)
{
const eT acc = op_dot::direct_dot_arma(A_n_cols, A.mem, x);
if( (use_alpha == false) && (use_beta == false) )
{
y[0] = acc;
}
else
if( (use_alpha == true) && (use_beta == false) )
{
y[0] = alpha * acc;
}
else
if( (use_alpha == false) && (use_beta == true) )
{
y[0] = acc + beta*y[0];
}
else
if( (use_alpha == true) && (use_beta == true) )
{
y[0] = alpha*acc + beta*y[0];
}
}
else
for(u32 row=0; row < A_n_rows; ++row) for(u32 row=0; row < A_n_rows; ++row)
{ {
eT acc = eT(0); eT acc = eT(0);
for(u32 i=0; i < A_n_cols; ++i) for(u32 i=0; i < A_n_cols; ++i)
{ {
acc += A.at(row,i) * x[i]; acc += A.at(row,i) * x[i];
} }
if( (use_alpha == false) && (use_beta == false) ) if( (use_alpha == false) && (use_beta == false) )
skipping to change at line 236 skipping to change at line 261
template<typename eT> template<typename eT>
arma_hot arma_hot
inline inline
static static
void void
apply( eT* y, const Mat<eT>& A, const eT* x, const eT alpha = eT(1), cons t eT beta = eT(0), const typename arma_not_cx<eT>::result* junk = 0 ) apply( eT* y, const Mat<eT>& A, const eT* x, const eT alpha = eT(1), cons t eT beta = eT(0), const typename arma_not_cx<eT>::result* junk = 0 )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_ignore(junk); arma_ignore(junk);
if( A.n_rows > 4 ) const u32 A_n_rows = A.n_rows;
const u32 A_n_cols = A.n_cols;
if( (A_n_rows <= 4) && (A_n_rows == A_n_cols) )
{ {
gemv_emul_large<do_trans_A, use_alpha, use_beta>::apply(y, A, x, alph a, beta); gemv_emul_tinysq<do_trans_A, use_alpha, use_beta>::apply(y, A, x, alp ha, beta);
} }
else else
{ {
gemv_emul_tiny<do_trans_A, use_alpha, use_beta>::apply(y, A, x, alpha , beta); gemv_emul_large<do_trans_A, use_alpha, use_beta>::apply(y, A, x, alph a, beta);
} }
} }
template<typename eT> template<typename eT>
arma_hot arma_hot
inline inline
static static
void void
apply( eT* y, const Mat<eT>& A, const eT* x, const eT alpha = eT(1), cons t eT beta = eT(0), const typename arma_cx_only<eT>::result* junk = 0 ) apply( eT* y, const Mat<eT>& A, const eT* x, const eT alpha = eT(1), cons t eT beta = eT(0), const typename arma_cx_only<eT>::result* junk = 0 )
{ {
skipping to change at line 264 skipping to change at line 292
Mat<eT> tmp_A; Mat<eT> tmp_A;
if(do_trans_A) if(do_trans_A)
{ {
op_htrans::apply_noalias(tmp_A, A); op_htrans::apply_noalias(tmp_A, A);
} }
const Mat<eT>& AA = (do_trans_A == false) ? A : tmp_A; const Mat<eT>& AA = (do_trans_A == false) ? A : tmp_A;
if( AA.n_rows > 4 ) const u32 AA_n_rows = AA.n_rows;
const u32 AA_n_cols = AA.n_cols;
if( (AA_n_rows <= 4) && (AA_n_rows == AA_n_cols) )
{ {
gemv_emul_large<false, use_alpha, use_beta>::apply(y, AA, x, alpha, b eta); gemv_emul_tinysq<false, use_alpha, use_beta>::apply(y, AA, x, alpha, beta);
} }
else else
{ {
gemv_emul_tiny<false, use_alpha, use_beta>::apply(y, AA, x, alpha, be ta); gemv_emul_large<false, use_alpha, use_beta>::apply(y, AA, x, alpha, b eta);
} }
} }
}; };
//! \brief //! \brief
//! Wrapper for ATLAS/BLAS gemv function, using template arguments to contr ol the arguments passed to gemv. //! Wrapper for ATLAS/BLAS gemv function, using template arguments to contr ol the arguments passed to gemv.
//! 'y' is assumed to have been set to the correct size (i.e. taking into a ccount the transpose) //! 'y' is assumed to have been set to the correct size (i.e. taking into a ccount the transpose)
template<const bool do_trans_A=false, const bool use_alpha=false, const boo l use_beta=false> template<const bool do_trans_A=false, const bool use_alpha=false, const boo l use_beta=false>
class gemv class gemv
 End of changes. 9 change blocks. 
8 lines changed or deleted 39 lines changed or added


 glue_solve_meat.hpp   glue_solve_meat.hpp 
skipping to change at line 36 skipping to change at line 36
const unwrap_check<T2> B_tmp(X.B, out); const unwrap_check<T2> B_tmp(X.B, out);
const Mat<eT>& B = B_tmp.M; const Mat<eT>& B = B_tmp.M;
arma_debug_check( (A.n_rows != B.n_rows), "solve(): number of rows in A a nd B must be the same" ); arma_debug_check( (A.n_rows != B.n_rows), "solve(): number of rows in A a nd B must be the same" );
bool status; bool status;
if(A.n_rows == A.n_cols) if(A.n_rows == A.n_cols)
{ {
status = auxlib::solve(out, A, B); const u32 mode = X.aux_u32;
if(mode == 0)
{
status = auxlib::solve(out, A, B);
}
else
{
status = auxlib::solve(out, A, B, true);
}
} }
else else
if(A.n_rows > A.n_cols) if(A.n_rows > A.n_cols)
{ {
arma_extra_debug_print("solve(): detected over-determined system"); arma_extra_debug_print("solve(): detected over-determined system");
status = auxlib::solve_od(out, A, B); status = auxlib::solve_od(out, A, B);
} }
else else
{ {
arma_extra_debug_print("solve(): detected under-determined system"); arma_extra_debug_print("solve(): detected under-determined system");
skipping to change at line 72 skipping to change at line 81
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
const unwrap_check<T1> A_tmp(X.A, out); const unwrap_check<T1> A_tmp(X.A, out);
const unwrap_check<T2> B_tmp(X.B, out); const unwrap_check<T2> B_tmp(X.B, out);
const Mat<eT>& A = A_tmp.M; const Mat<eT>& A = A_tmp.M;
const Mat<eT>& B = B_tmp.M; const Mat<eT>& B = B_tmp.M;
arma_debug_check( ( (&A) == (&B) ), "solve(): A is an alias of B" bool err_state = false;
); char* err_msg = 0;
arma_debug_check( (A.n_rows != B.n_rows), "solve(): number of rows in A
and B must be the same" ); arma_debug_set_error( err_state, err_msg, ((&A) == (&B)), "solv
arma_debug_check( (A.is_square() == false), "solve(): A is not a square m e(): A is an alias of B" );
atrix" ); arma_debug_set_error( err_state, err_msg, (A.n_rows != B.n_rows), "solv
e(): number of rows in A and B must be the same" );
arma_debug_set_error( err_state, err_msg, (A.is_square() == false), "solv
e(): A is not a square matrix" );
arma_debug_check(err_state, err_msg);
const bool status = auxlib::solve_tr(out, A, B, X.aux_u32); const bool status = auxlib::solve_tr(out, A, B, X.aux_u32);
if(status == false) if(status == false)
{ {
out.reset(); out.reset();
arma_print("solve(): solution not found"); arma_print("solve(): solution not found");
} }
} }
 End of changes. 2 change blocks. 
7 lines changed or deleted 21 lines changed or added


 op_inv_bones.hpp   op_inv_bones.hpp 
// Copyright (C) 2008-2010 NICTA (www.nicta.com.au) // Copyright (C) 2008-2011 NICTA (www.nicta.com.au)
// Copyright (C) 2008-2010 Conrad Sanderson // Copyright (C) 2008-2011 Conrad Sanderson
// //
// 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)
//! \addtogroup op_inv //! \addtogroup op_inv
//! @{ //! @{
//! 'invert matrix' operation (general matrices) //! 'invert matrix' operation (general matrices)
class op_inv class op_inv
{ {
public: public:
template<typename eT> template<typename eT>
inline static void apply(Mat<eT>& out, const Mat<eT>& A); inline static void apply(Mat<eT>& out, const Mat<eT>& A, const bool slow = false);
template<typename T1> template<typename T1>
inline static void apply(Mat<typename T1::elem_type>& out, const Op<T1,op _inv>& in); inline static void apply(Mat<typename T1::elem_type>& out, const Op<T1,op _inv>& in);
template<typename T1> template<typename T1>
inline static void apply_diag(Mat<typename T1::elem_type>& out, const Bas e<typename T1::elem_type, T1>& X); inline static void apply_diag(Mat<typename T1::elem_type>& out, const Bas e<typename T1::elem_type, T1>& X);
}; };
//! 'invert matrix' operation (triangular matrices) //! 'invert matrix' operation (triangular matrices)
class op_inv_tr class op_inv_tr
{ {
public: public:
template<typename T1> template<typename T1>
inline static void apply(Mat<typename T1::elem_type>& out, const Op<T1,op _inv_tr>& in); inline static void apply(Mat<typename T1::elem_type>& out, const Op<T1,op _inv_tr>& in);
}; };
 End of changes. 3 change blocks. 
4 lines changed or deleted 3 lines changed or added


 op_inv_meat.hpp   op_inv_meat.hpp 
// Copyright (C) 2008-2010 NICTA (www.nicta.com.au) // Copyright (C) 2008-2011 NICTA (www.nicta.com.au)
// Copyright (C) 2008-2010 Conrad Sanderson // Copyright (C) 2008-2011 Conrad Sanderson
// //
// 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)
//! \addtogroup op_inv //! \addtogroup op_inv
//! @{ //! @{
//! immediate inverse of a matrix, storing the result in a dense matrix //! immediate inverse of a matrix, storing the result in a dense matrix
template<typename eT> template<typename eT>
inline inline
void void
op_inv::apply(Mat<eT>& out, const Mat<eT>& A) op_inv::apply(Mat<eT>& out, const Mat<eT>& A, const bool slow)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
// no need to check for aliasing, due to: // no need to check for aliasing, due to:
// - auxlib::inv() copies A to out before inversion // - auxlib::inv() copies A to out before inversion
// - for 2x2 and 3x3 matrices the code is alias safe // - for 2x2 and 3x3 matrices the code is alias safe
auxlib::inv(out, A); auxlib::inv(out, A, slow);
} }
//! immediate inverse of T1, storing the result in a dense matrix //! immediate inverse of T1, storing the result in a dense matrix
template<typename T1> template<typename T1>
inline inline
void void
op_inv::apply(Mat<typename T1::elem_type>& out, const Op<T1,op_inv>& X) op_inv::apply(Mat<typename T1::elem_type>& out, const Op<T1,op_inv>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
const strip_diagmat<T1> strip(X.m); const strip_diagmat<T1> strip(X.m);
if(strip.do_diagmat == true) if(strip.do_diagmat == true)
{ {
op_inv::apply_diag(out, strip.M); op_inv::apply_diag(out, strip.M);
} }
else else
{ {
auxlib::inv(out, X.m); const u32 mode = X.aux_u32_a;
if(mode == 0)
{
auxlib::inv(out, X.m);
}
else
{
auxlib::inv(out, X.m, true);
}
} }
} }
template<typename T1> template<typename T1>
inline inline
void void
op_inv::apply_diag(Mat<typename T1::elem_type>& out, const Base<typename T1 ::elem_type, T1>& X) op_inv::apply_diag(Mat<typename T1::elem_type>& out, const Base<typename T1 ::elem_type, T1>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
 End of changes. 4 change blocks. 
5 lines changed or deleted 14 lines changed or added


 op_strans_bones.hpp   op_strans_bones.hpp 
skipping to change at line 34 skipping to change at line 34
{ {
static const u32 n2 = (do_flip == false) ? (row + col*2) : (col + row*2 ); static const u32 n2 = (do_flip == false) ? (row + col*2) : (col + row*2 );
static const u32 n3 = (do_flip == false) ? (row + col*3) : (col + row*3 ); static const u32 n3 = (do_flip == false) ? (row + col*3) : (col + row*3 );
static const u32 n4 = (do_flip == false) ? (row + col*4) : (col + row*4 ); static const u32 n4 = (do_flip == false) ? (row + col*4) : (col + row*4 );
}; };
template<typename eT> template<typename eT>
inline static void apply_noalias_tinysq(Mat<eT>& out, const Mat<eT>& A); inline static void apply_noalias_tinysq(Mat<eT>& out, const Mat<eT>& A);
template<typename eT> template<typename eT>
inline static void apply_noalias(Mat<eT>& out, const Mat<eT>& A, const ty inline static void apply_noalias(Mat<eT>& out, const Mat<eT>& A);
pename arma_not_cx<eT>::result* junk = 0);
template<typename eT>
inline static void apply_noalias(Mat<eT>& out, const Mat<eT>& A, const ty
pename arma_cx_only<eT>::result* junk = 0);
template<typename eT> template<typename eT>
inline static void apply(Mat<eT>& out, const Mat<eT>& A); inline static void apply(Mat<eT>& out, const Mat<eT>& A);
template<typename T1> template<typename T1>
inline static void apply(Mat<typename T1::elem_type>& out, const Op<T1,op _strans>& in); inline static void apply(Mat<typename T1::elem_type>& out, const Op<T1,op _strans>& in);
// inline static void apply_inplace(mat &out); // inline static void apply_inplace(mat &out);
}; };
 End of changes. 1 change blocks. 
6 lines changed or deleted 1 lines changed or added


 op_strans_meat.hpp   op_strans_meat.hpp 
skipping to change at line 93 skipping to change at line 93
default: default:
; ;
} }
} }
//! Immediate transpose of a dense matrix //! Immediate transpose of a dense matrix
template<typename eT> template<typename eT>
inline inline
void void
op_strans::apply_noalias(Mat<eT>& out, const Mat<eT>& A, const typename arm a_not_cx<eT>::result* junk) op_strans::apply_noalias(Mat<eT>& out, const Mat<eT>& A)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_ignore(junk);
const u32 A_n_cols = A.n_cols; const u32 A_n_cols = A.n_cols;
const u32 A_n_rows = A.n_rows; const u32 A_n_rows = A.n_rows;
out.set_size(A_n_cols, A_n_rows); out.set_size(A_n_cols, A_n_rows);
if( (A_n_cols == 1) || (A_n_rows == 1) ) if( (A_n_cols == 1) || (A_n_rows == 1) )
{ {
arrayops::copy( out.memptr(), A.mem, A.n_elem ); arrayops::copy( out.memptr(), A.mem, A.n_elem );
} }
skipping to change at line 129 skipping to change at line 128
for(u32 in_col = 0; in_col<A_n_cols; ++in_col) for(u32 in_col = 0; in_col<A_n_cols; ++in_col)
{ {
const u32 out_row = in_col; const u32 out_row = in_col;
out.at(out_row, out_col) = A.at(in_row, in_col); out.at(out_row, out_col) = A.at(in_row, in_col);
} }
} }
} }
} }
} }
//! Immediate transpose of a dense matrix
template<typename eT>
inline
void
op_strans::apply_noalias(Mat<eT>& out, const Mat<eT>& A, const typename arm
a_cx_only<eT>::result* junk)
{
arma_extra_debug_sigprint();
arma_ignore(junk);
const u32 A_n_cols = A.n_cols;
const u32 A_n_rows = A.n_rows;
out.set_size(A_n_cols, A_n_rows);
if( (A_n_cols == 1) || (A_n_rows == 1) )
{
arrayops::copy( out.memptr(), A.mem, A.n_elem );
}
else
{
for(u32 in_row = 0; in_row<A_n_rows; ++in_row)
{
const u32 out_col = in_row;
for(u32 in_col = 0; in_col<A_n_cols; ++in_col)
{
const u32 out_row = in_col;
out.at(out_row, out_col) = A.at(in_row, in_col);
}
}
}
}
template<typename eT> template<typename eT>
inline inline
void void
op_strans::apply(Mat<eT>& out, const Mat<eT>& A) op_strans::apply(Mat<eT>& out, const Mat<eT>& A)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
if(&out != &A) if(&out != &A)
{ {
op_strans::apply_noalias(out, A); op_strans::apply_noalias(out, A);
 End of changes. 3 change blocks. 
36 lines changed or deleted 1 lines changed or added


 subview_elem1_meat.hpp   subview_elem1_meat.hpp 
skipping to change at line 529 skipping to change at line 529
const eT* m_mem = m_local.memptr(); const eT* m_mem = m_local.memptr();
const u32 m_n_elem = m_local.n_elem; const u32 m_n_elem = m_local.n_elem;
const bool alias = (&actual_out == &m_local); const bool alias = (&actual_out == &m_local);
arma_extra_debug_warn(alias, "subview_elem1::extract(): aliasing detected "); arma_extra_debug_warn(alias, "subview_elem1::extract(): aliasing detected ");
Mat<eT>* tmp_out = alias ? new Mat<eT>() : 0; Mat<eT>* tmp_out = alias ? new Mat<eT>() : 0;
Mat<eT>& out = alias ? *tmp_out : actual_out; Mat<eT>& out = alias ? *tmp_out : actual_out;
out.set_size(aa_n_elem); out.set_size(aa_n_elem, 1);
eT* out_mem = out.memptr(); eT* out_mem = out.memptr();
u32 i,j; u32 i,j;
for(i=0, j=1; j<aa_n_elem; i+=2, j+=2) for(i=0, j=1; j<aa_n_elem; i+=2, j+=2)
{ {
const u32 ii = aa_mem[i]; const u32 ii = aa_mem[i];
const u32 jj = aa_mem[j]; const u32 jj = aa_mem[j];
arma_debug_check( ( (ii >= m_n_elem) || (jj >= m_n_elem) ), "Mat::elem( ): index out of bounds" ); arma_debug_check( ( (ii >= m_n_elem) || (jj >= m_n_elem) ), "Mat::elem( ): index out of bounds" );
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 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/