Compare commits

...
9 Commits
Author SHA1 Message Date
conrad c358e46131 fix link 2023-07-28 11:22:25 +10:00
conrad dc9e127236 fix link 2023-07-28 11:18:59 +10:00
conrad f5a704ea76 add linebreak 2023-07-25 19:18:29 +10:00
conrad 6a512862dc patch bump 2023-07-24 13:19:48 +10:00
conrad bf0abf0aec backport fix 2023-07-24 11:50:31 +10:00
conrad fed05b42c8 backport fixes 2023-07-24 11:34:18 +10:00
conrad 11d22721ed add link to Bandicoot 2023-07-21 16:18:27 +10:00
conrad 519dab5612 comment out expensive optimisation 2023-07-21 11:29:18 +10:00
conrad a9b6cdaa6f layout fix 2023-07-21 11:27:49 +10:00
8 changed files with 136 additions and 83 deletions
+5 -5
View File
@@ -461,18 +461,18 @@ Octave/Matlab with C++ code that uses Armadillo matrices.
### 16: Related Software Using Armadillo
* Bandicoot: C++ library for accelerated linear algebra on GPUs
https://coot.sourceforge.io
* ensmallen: fast library for non-linear numerical optimisation
https://ensmallen.org/
* MLPACK: extensive library of machine learning algorithms
https://mlpack.org
* CARMA: bidirectional interface between Python and Armadillo
https://github.com/RUrlus/carma
* RcppArmadillo: integration of Armadillo with R
https://dirk.eddelbuettel.com/code/rcpp.armadillo.html
* PyArmadillo: streamlined linear algebra library for Python
https://pyarma.sourceforge.io
* CARMA: bidirectional interface between Python and Armadillo
https://github.com/RUrlus/carma
+3 -2
View File
@@ -14135,7 +14135,7 @@ See also:
<li><a href="#svds">svds()</a></li>
<li><a href="#is_symmetric">.is_symmetric()</a></li>
<!-- <li><a href="https://www.caam.rice.edu/software/ARPACK/UG/node33.html">shift-invert mode in ARPACK</a></li> -->
<a href="https://li.mit.edu/Archive/Activities/Archive/CourseWork/Ju_Li/MITCourses/18.335/Doc/ARPACK/Lehoucq97.pdf">shift-invert mode in ARPACK</a>
<li><a href="http://li.mit.edu/Archive/Activities/Archive/CourseWork/Ju_Li/MITCourses/18.335/Doc/ARPACK/Lehoucq97.pdf">shift-invert mode in ARPACK</a></li>
<li><a href="https://mathworld.wolfram.com/EigenDecomposition.html">eigen decomposition in MathWorld</a></li>
<li><a href="https://en.wikipedia.org/wiki/Eigenvalues_and_eigenvectors">eigenvalues &amp; eigenvectors in Wikipedia</a></li>
</ul>
@@ -14263,7 +14263,8 @@ See also:
<li><a href="#eigs_sym">eigs_sym()</a></li>
<li><a href="#eig_gen">eig_gen()</a></li>
<li><a href="#svds">svds()</a></li>
<li><a href="https://www.caam.rice.edu/software/ARPACK/UG/node33.html">shift-invert mode in ARPACK</a></li>
<!-- <li><a href="https://www.caam.rice.edu/software/ARPACK/UG/node33.html">shift-invert mode in ARPACK</a></li> -->
<li><a href="http://li.mit.edu/Archive/Activities/Archive/CourseWork/Ju_Li/MITCourses/18.335/Doc/ARPACK/Lehoucq97.pdf">shift-invert mode in ARPACK</a></li>
<li><a href="https://mathworld.wolfram.com/EigenDecomposition.html">eigen decomposition in MathWorld</a></li>
<li><a href="https://en.wikipedia.org/wiki/Eigenvalues_and_eigenvectors">eigenvalues &amp; eigenvectors in Wikipedia</a></li>
</ul>
+44 -26
View File
@@ -2882,18 +2882,11 @@ Cube<eT>::operator=(const eOpCube<T1, eop_type>& X)
const bool bad_alias = ( X.P.has_subview && X.P.is_alias(*this) );
if(bad_alias == false)
{
init_warm(X.get_n_rows(), X.get_n_cols(), X.get_n_slices());
eop_type::apply(*this, X);
}
else
{
Cube<eT> tmp(X);
steal_mem(tmp);
}
if(bad_alias) { Cube<eT> tmp(X); steal_mem(tmp); return *this; }
init_warm(X.get_n_rows(), X.get_n_cols(), X.get_n_slices());
eop_type::apply(*this, X);
return *this;
}
@@ -2911,6 +2904,10 @@ Cube<eT>::operator+=(const eOpCube<T1, eop_type>& X)
arma_type_check(( is_same_type< eT, typename T1::elem_type >::no ));
const bool bad_alias = ( X.P.has_subview && X.P.is_alias(*this) );
if(bad_alias) { const Cube<eT> tmp(X); return (*this).operator+=(tmp); }
eop_type::apply_inplace_plus(*this, X);
return *this;
@@ -2929,6 +2926,10 @@ Cube<eT>::operator-=(const eOpCube<T1, eop_type>& X)
arma_type_check(( is_same_type< eT, typename T1::elem_type >::no ));
const bool bad_alias = ( X.P.has_subview && X.P.is_alias(*this) );
if(bad_alias) { const Cube<eT> tmp(X); return (*this).operator-=(tmp); }
eop_type::apply_inplace_minus(*this, X);
return *this;
@@ -2946,7 +2947,11 @@ Cube<eT>::operator%=(const eOpCube<T1, eop_type>& X)
arma_extra_debug_sigprint();
arma_type_check(( is_same_type< eT, typename T1::elem_type >::no ));
const bool bad_alias = ( X.P.has_subview && X.P.is_alias(*this) );
if(bad_alias) { const Cube<eT> tmp(X); return (*this).operator%=(tmp); }
eop_type::apply_inplace_schur(*this, X);
return *this;
@@ -2964,7 +2969,11 @@ Cube<eT>::operator/=(const eOpCube<T1, eop_type>& X)
arma_extra_debug_sigprint();
arma_type_check(( is_same_type< eT, typename T1::elem_type >::no ));
const bool bad_alias = ( X.P.has_subview && X.P.is_alias(*this) );
if(bad_alias) { const Cube<eT> tmp(X); return (*this).operator/=(tmp); }
eop_type::apply_inplace_div(*this, X);
return *this;
@@ -3222,18 +3231,11 @@ Cube<eT>::operator=(const eGlueCube<T1, T2, eglue_type>& X)
const bool bad_alias = ( (X.P1.has_subview && X.P1.is_alias(*this)) || (X.P2.has_subview && X.P2.is_alias(*this)) );
if(bad_alias == false)
{
init_warm(X.get_n_rows(), X.get_n_cols(), X.get_n_slices());
eglue_type::apply(*this, X);
}
else
{
Cube<eT> tmp(X);
steal_mem(tmp);
}
if(bad_alias) { Cube<eT> tmp(X); steal_mem(tmp); return *this; }
init_warm(X.get_n_rows(), X.get_n_cols(), X.get_n_slices());
eglue_type::apply(*this, X);
return *this;
}
@@ -3252,6 +3254,10 @@ Cube<eT>::operator+=(const eGlueCube<T1, T2, eglue_type>& X)
arma_type_check(( is_same_type< eT, typename T1::elem_type >::no ));
arma_type_check(( is_same_type< eT, typename T2::elem_type >::no ));
const bool bad_alias = ( (X.P1.has_subview && X.P1.is_alias(*this)) || (X.P2.has_subview && X.P2.is_alias(*this)) );
if(bad_alias) { const Cube<eT> tmp(X); return (*this).operator+=(tmp); }
eglue_type::apply_inplace_plus(*this, X);
return *this;
@@ -3271,6 +3277,10 @@ Cube<eT>::operator-=(const eGlueCube<T1, T2, eglue_type>& X)
arma_type_check(( is_same_type< eT, typename T1::elem_type >::no ));
arma_type_check(( is_same_type< eT, typename T2::elem_type >::no ));
const bool bad_alias = ( (X.P1.has_subview && X.P1.is_alias(*this)) || (X.P2.has_subview && X.P2.is_alias(*this)) );
if(bad_alias) { const Cube<eT> tmp(X); return (*this).operator-=(tmp); }
eglue_type::apply_inplace_minus(*this, X);
return *this;
@@ -3290,6 +3300,10 @@ Cube<eT>::operator%=(const eGlueCube<T1, T2, eglue_type>& X)
arma_type_check(( is_same_type< eT, typename T1::elem_type >::no ));
arma_type_check(( is_same_type< eT, typename T2::elem_type >::no ));
const bool bad_alias = ( (X.P1.has_subview && X.P1.is_alias(*this)) || (X.P2.has_subview && X.P2.is_alias(*this)) );
if(bad_alias) { const Cube<eT> tmp(X); return (*this).operator%=(tmp); }
eglue_type::apply_inplace_schur(*this, X);
return *this;
@@ -3309,6 +3323,10 @@ Cube<eT>::operator/=(const eGlueCube<T1, T2, eglue_type>& X)
arma_type_check(( is_same_type< eT, typename T1::elem_type >::no ));
arma_type_check(( is_same_type< eT, typename T2::elem_type >::no ));
const bool bad_alias = ( (X.P1.has_subview && X.P1.is_alias(*this)) || (X.P2.has_subview && X.P2.is_alias(*this)) );
if(bad_alias) { const Cube<eT> tmp(X); return (*this).operator/=(tmp); }
eglue_type::apply_inplace_div(*this, X);
return *this;
+1 -1
View File
@@ -118,7 +118,7 @@ class Mat : public Base< eT, Mat<eT> >
template<typename T1, typename T2>
inline explicit Mat(const Base<pod_type,T1>& A, const Base<pod_type,T2>& B);
inline explicit Mat(const subview<eT>& X, const bool use_colmem); // only to be used by the quasi_unwrap class
inline explicit Mat(const subview<eT>& X, const bool use_colmem); // only to be used by the quasi_unwrap class
inline Mat(const subview<eT>& X);
inline Mat& operator= (const subview<eT>& X);
+62 -28
View File
@@ -5084,20 +5084,11 @@ Mat<eT>::operator=(const eOp<T1, eop_type>& X)
const bool bad_alias = (eOp<T1, eop_type>::proxy_type::has_subview && X.P.is_alias(*this));
if(bad_alias == false)
{
init_warm(X.get_n_rows(), X.get_n_cols());
eop_type::apply(*this, X);
}
else
{
arma_extra_debug_print("bad_alias = true");
Mat<eT> tmp(X);
steal_mem(tmp);
}
if(bad_alias) { Mat<eT> tmp(X); steal_mem(tmp); return *this; }
init_warm(X.get_n_rows(), X.get_n_cols());
eop_type::apply(*this, X);
return *this;
}
@@ -5114,6 +5105,10 @@ Mat<eT>::operator+=(const eOp<T1, eop_type>& X)
arma_type_check(( is_same_type< eT, typename T1::elem_type >::no ));
const bool bad_alias = (eOp<T1, eop_type>::proxy_type::has_subview && X.P.is_alias(*this));
if(bad_alias) { const Mat<eT> tmp(X); return (*this).operator+=(tmp); }
eop_type::apply_inplace_plus(*this, X);
return *this;
@@ -5131,6 +5126,10 @@ Mat<eT>::operator-=(const eOp<T1, eop_type>& X)
arma_type_check(( is_same_type< eT, typename T1::elem_type >::no ));
const bool bad_alias = (eOp<T1, eop_type>::proxy_type::has_subview && X.P.is_alias(*this));
if(bad_alias) { const Mat<eT> tmp(X); return (*this).operator-=(tmp); }
eop_type::apply_inplace_minus(*this, X);
return *this;
@@ -5165,6 +5164,10 @@ Mat<eT>::operator%=(const eOp<T1, eop_type>& X)
arma_type_check(( is_same_type< eT, typename T1::elem_type >::no ));
const bool bad_alias = (eOp<T1, eop_type>::proxy_type::has_subview && X.P.is_alias(*this));
if(bad_alias) { const Mat<eT> tmp(X); return (*this).operator%=(tmp); }
eop_type::apply_inplace_schur(*this, X);
return *this;
@@ -5182,6 +5185,10 @@ Mat<eT>::operator/=(const eOp<T1, eop_type>& X)
arma_type_check(( is_same_type< eT, typename T1::elem_type >::no ));
const bool bad_alias = (eOp<T1, eop_type>::proxy_type::has_subview && X.P.is_alias(*this));
if(bad_alias) { const Mat<eT> tmp(X); return (*this).operator/=(tmp); }
eop_type::apply_inplace_div(*this, X);
return *this;
@@ -5761,20 +5768,11 @@ Mat<eT>::operator=(const eGlue<T1, T2, eglue_type>& X)
(eGlue<T1, T2, eglue_type>::proxy2_type::has_subview && X.P2.is_alias(*this))
);
if(bad_alias == false)
{
init_warm(X.get_n_rows(), X.get_n_cols());
eglue_type::apply(*this, X);
}
else
{
arma_extra_debug_print("bad_alias = true");
Mat<eT> tmp(X);
steal_mem(tmp);
}
if(bad_alias) { Mat<eT> tmp(X); steal_mem(tmp); return *this; }
init_warm(X.get_n_rows(), X.get_n_cols());
eglue_type::apply(*this, X);
return *this;
}
@@ -5793,6 +5791,15 @@ Mat<eT>::operator+=(const eGlue<T1, T2, eglue_type>& X)
arma_type_check(( is_same_type< eT, typename T1::elem_type >::no ));
arma_type_check(( is_same_type< eT, typename T2::elem_type >::no ));
const bool bad_alias =
(
(eGlue<T1, T2, eglue_type>::proxy1_type::has_subview && X.P1.is_alias(*this))
||
(eGlue<T1, T2, eglue_type>::proxy2_type::has_subview && X.P2.is_alias(*this))
);
if(bad_alias) { const Mat<eT> tmp(X); return (*this).operator+=(tmp); }
eglue_type::apply_inplace_plus(*this, X);
return *this;
@@ -5812,6 +5819,15 @@ Mat<eT>::operator-=(const eGlue<T1, T2, eglue_type>& X)
arma_type_check(( is_same_type< eT, typename T1::elem_type >::no ));
arma_type_check(( is_same_type< eT, typename T2::elem_type >::no ));
const bool bad_alias =
(
(eGlue<T1, T2, eglue_type>::proxy1_type::has_subview && X.P1.is_alias(*this))
||
(eGlue<T1, T2, eglue_type>::proxy2_type::has_subview && X.P2.is_alias(*this))
);
if(bad_alias) { const Mat<eT> tmp(X); return (*this).operator-=(tmp); }
eglue_type::apply_inplace_minus(*this, X);
return *this;
@@ -5848,6 +5864,15 @@ Mat<eT>::operator%=(const eGlue<T1, T2, eglue_type>& X)
arma_type_check(( is_same_type< eT, typename T1::elem_type >::no ));
arma_type_check(( is_same_type< eT, typename T2::elem_type >::no ));
const bool bad_alias =
(
(eGlue<T1, T2, eglue_type>::proxy1_type::has_subview && X.P1.is_alias(*this))
||
(eGlue<T1, T2, eglue_type>::proxy2_type::has_subview && X.P2.is_alias(*this))
);
if(bad_alias) { const Mat<eT> tmp(X); return (*this).operator%=(tmp); }
eglue_type::apply_inplace_schur(*this, X);
return *this;
@@ -5866,6 +5891,15 @@ Mat<eT>::operator/=(const eGlue<T1, T2, eglue_type>& X)
arma_type_check(( is_same_type< eT, typename T1::elem_type >::no ));
arma_type_check(( is_same_type< eT, typename T2::elem_type >::no ));
const bool bad_alias =
(
(eGlue<T1, T2, eglue_type>::proxy1_type::has_subview && X.P1.is_alias(*this))
||
(eGlue<T1, T2, eglue_type>::proxy2_type::has_subview && X.P2.is_alias(*this))
);
if(bad_alias) { const Mat<eT> tmp(X); return (*this).operator/=(tmp); }
eglue_type::apply_inplace_div(*this, X);
return *this;
+1 -1
View File
@@ -23,7 +23,7 @@
#define ARMA_VERSION_MAJOR 12
#define ARMA_VERSION_MINOR 4
#define ARMA_VERSION_PATCH 1
#define ARMA_VERSION_PATCH 2
#define ARMA_VERSION_NAME "Cortisol Profusion Redux"
+4 -4
View File
@@ -3962,8 +3962,6 @@ auxlib::solve_square_fast(Mat<typename T1::elem_type>& out, Mat<typename T1::ele
{
arma_extra_debug_sigprint();
typedef typename T1::elem_type eT;
out = B_expr.get_ref();
const uword B_n_rows = out.n_rows;
@@ -3975,6 +3973,8 @@ auxlib::solve_square_fast(Mat<typename T1::elem_type>& out, Mat<typename T1::ele
#if defined(ARMA_USE_LAPACK)
{
typedef typename T1::elem_type eT;
arma_debug_assert_blas_size(A);
blas_int n = blas_int(A.n_rows); // assuming A is square
@@ -4291,8 +4291,6 @@ auxlib::solve_sympd_fast_common(Mat<typename T1::elem_type>& out, Mat<typename T
{
arma_extra_debug_sigprint();
typedef typename T1::elem_type eT;
out = B_expr.get_ref();
const uword B_n_rows = out.n_rows;
@@ -4304,6 +4302,8 @@ auxlib::solve_sympd_fast_common(Mat<typename T1::elem_type>& out, Mat<typename T
#if defined(ARMA_USE_LAPACK)
{
typedef typename T1::elem_type eT;
arma_debug_assert_blas_size(A, out);
char uplo = 'L';
+16 -16
View File
@@ -313,14 +313,14 @@ spglue_times_misc::sparse_times_dense(Mat<typename T1::elem_type>& out, const T1
const SpMat<eT>& A = UA.M;
const Mat<eT>& B = UB.M;
if( (resolves_to_vector<T2>::no) && (B.is_vec() == false) && B.is_diagmat() )
{
const SpMat<eT> tmp(diagmat(B));
out = A * tmp;
return;
}
// if( (resolves_to_vector<T2>::no) && (B.is_vec() == false) && B.is_diagmat() )
// {
// const SpMat<eT> tmp(diagmat(B));
//
// out = A * tmp;
//
// return;
// }
const uword A_n_rows = A.n_rows;
const uword A_n_cols = A.n_cols;
@@ -403,14 +403,14 @@ spglue_times_misc::dense_times_sparse(Mat<typename T1::elem_type>& out, const T1
const Mat<eT>& A = UA.M;
const SpMat<eT>& B = UB.M;
if( (resolves_to_vector<T1>::no) && (A.is_vec() == false) && A.is_diagmat() )
{
const SpMat<eT> tmp(diagmat(A));
out = tmp * B;
return;
}
// if( (resolves_to_vector<T1>::no) && (A.is_vec() == false) && A.is_diagmat() )
// {
// const SpMat<eT> tmp(diagmat(A));
//
// out = tmp * B;
//
// return;
// }
arma_debug_assert_mul_size(A.n_rows, A.n_cols, B.n_rows, B.n_cols, "matrix multiplication");