Compare commits

...
18 Commits
Author SHA1 Message Date
conradsnicta ced84a1a58 Merge branch '14.0.x' into '14.0.x'
arma_ignore Xst backport

See merge request conradsnicta/armadillo-code!146
2025-07-16 00:53:32 +00:00
Seb James 81a513640b arma_ignore Xst backport 2025-07-15 15:49:04 +01:00
conrad 27b1c5f59f fix 2025-06-30 12:42:02 +10:00
conrad 26e69d1e3a backport fix for FFTW3 threading issue 2025-03-26 00:38:22 +10:00
conrad efab35fc57 backport fix 2025-02-19 12:27:56 +10:00
conrad 928e5d497f patch bump 2024-11-18 11:32:48 +10:00
conrad ef95c25d2f workaround 2024-11-06 13:40:28 +10:00
conrad 2b606b139c add bug note 2024-11-06 13:27:37 +10:00
conrad c7a284cb86 patch bump 2024-10-09 13:05:00 +10:00
conrad ac6156edab simpler wording 2024-10-05 19:06:51 +10:00
conrad e5b38c4d25 change http to https 2024-10-04 11:43:10 +10:00
conrad f9e28e2761 deprecate ill-designed forms of pow() 2024-10-03 13:56:36 +10:00
conrad 0acc48af3c simplifications 2024-10-03 11:36:17 +10:00
conrad 70c64fabc0 add explanatory notes 2024-10-03 11:14:24 +10:00
conrad e0a25e5936 undeprecate; simplify implementation in next version 2024-10-02 13:12:48 +10:00
conrad 54bfbe711b deprecate seldom used forms of pow() 2024-10-02 12:50:54 +10:00
conrad b499e8f460 simplification: remove docs for seldom used forms of pow() 2024-10-02 12:39:51 +10:00
conrad ac08d9b0cc stats_fns: clarify caveat and add example for integer vector 2024-09-25 11:04:36 +10:00
10 changed files with 78 additions and 27 deletions
+19 -13
View File
@@ -543,7 +543,7 @@ Conrad Sanderson and Ryan Curtin.
<tr style="background-color: #F5F5F5;"><td><a href="#running_stat">running_stat</a></td><td>&nbsp;</td><td>running statistics of scalars (one dimensional process/signal)</td></tr>
<tr style="background-color: #F5F5F5;"><td><a href="#running_stat_vec">running_stat_vec</a></td><td>&nbsp;</td><td>running statistics of vectors (multi-dimensional process/signal)</td></tr>
<tr><td><a href="#kmeans">kmeans</a></td><td>&nbsp;</td><td>cluster data into disjoint sets</td></tr>
<tr><td><a href="#gmm_diag">gmm_diag/gmm_full</a></td><td>&nbsp;</td><td>probabilistic clustering and likelihood calculation via Gaussian mixture models</td></tr>
<tr><td><a href="#gmm_diag">gmm_diag/gmm_full</a></td><td>&nbsp;</td><td>probabilistic clustering and likelihood calculation via mixture of Gaussians</td></tr>
</tbody>
</table>
</ul>
@@ -4218,7 +4218,6 @@ See also:
<li><a href="#submat">submatrix views</a></li>
<li><a href="#diag">diagonal views</a></li>
<li><a href="#repmat">repmat()</a></li>
<li><a href="#pow">pow()</a></li>
<li><a href="#for_each">.for_each()</a></li>
<li><a href="#each_slice">.each_slice()</a></li>
</ul>
@@ -4323,7 +4322,6 @@ See also:
<ul>
<li><a href="#operators">math &amp; relational operators</a></li>
<li><a href="#subcube">subcube views</a></li>
<li><a href="#pow">pow()</a></li>
<li><a href="#for_each">.for_each()</a></li>
<li><a href="#each_colrow">.each_col() &amp; .each_row()</a> &nbsp;</li>
<li><a href="https://www.cprogramming.com/c++11/c++11-lambda-closures.html">lambda function</a> at cprogramming.com</li>
@@ -10757,9 +10755,11 @@ See also:
<tbody>
<tr><td><b>pow( A, scalar )</b></td><td>&nbsp;&nbsp;&nbsp;</td><td>(form&nbsp;1)</td></tr>
<tr><td><b>pow( A, B )</b></td><td>&nbsp;&nbsp;&nbsp;</td><td>(form&nbsp;2)</td></tr>
<!--
<tr><td><b>pow( M.each_col(), C )</b></td><td>&nbsp;&nbsp;&nbsp;</td><td>(form&nbsp;3)</td></tr>
<tr><td><b>pow( M.each_row(), R )</b></td><td>&nbsp;&nbsp;&nbsp;</td><td>(form&nbsp;4)</td></tr>
<tr><td><b>pow( Q.each_slice(), M )</b></td><td>&nbsp;&nbsp;&nbsp;</td><td>(form&nbsp;5)</td></tr>
-->
</tbody>
</table>
<ul>
@@ -10767,9 +10767,9 @@ See also:
<br>
<li>form 1: raise all elements in <i>A</i> to the power denoted by the given scalar</li>
<br>
<li>form 2: raise each element in <i>A</i> to the power denoted by the corresponding element in <i>B</i>;
<br>the sizes of <i>A</i> and <i>B</i> must be the same</li>
<li>form 2: raise each element in <i>A</i> to the power denoted by the corresponding element in <i>B</i>; sizes of <i>A</i> and <i>B</i> must be the same</li>
<br>
<!--
<li>form 3: for each column vector of matrix <i>M</i>, raise each element to the power denoted by the corresponding element in column vector <i>C</i>;
<br>the number of rows in <i>M</i> and <i>C</i> must be the same</li>
<br>
@@ -10779,6 +10779,7 @@ See also:
<li>form 5: for each slice of cube <i>Q</i>, raise each element to the power denoted by the corresponding element in matrix <i>M</i>;
<br>the number of rows and columns in <i>Q</i> and <i>M</i> must be the same</li>
<br>
-->
<li><b>Caveats</b>:
<ul>
<li>to raise all elements to the power 2, use <a href="#misc_fns">square()</a> instead</li>
@@ -10794,13 +10795,14 @@ mat B(5, 6, fill::randu);
mat X = pow(A, 3.45);
mat Y = pow(A, B);
</pre>
<!--
vec C(5, fill::randu);
rowvec R(6, fill::randu);
mat Z1 = pow(A.each_col(), C);
mat Z2 = pow(A.each_row(), R);
</pre>
-->
</ul>
</li>
<br>
@@ -10808,10 +10810,11 @@ mat Z2 = pow(A.each_row(), R);
See also:
<ul>
<li><a href="#powmat">powmat()</a></li>
<li><a href="#abs">abs()</a></li>
<li><a href="#misc_fns">miscellaneous element-wise functions</a></li>
<!--
<li><a href="#each_colrow">.each_col() &amp; .each_row()</a></li>
<li><a href="#each_slice">.each_slice()</a></li>
-->
</ul>
</li>
<br>
@@ -15359,8 +15362,8 @@ For the <i>var()</i> and <i>stddev()</i> functions:
<br>
<li>
<b>Caveat:</b>
to obtain statistics for integer matrices/vectors (eg. <a href="#Mat">umat</a>, <a href="#Mat">imat</a>, <a href="#Col">uvec</a>, <a href="#Col">ivec</a>),
convert to a matrix/vector with floating point values (eg. <a href="#Mat">mat</a>, <a href="#Col">vec</a>) using the <a href="#conv_to">conv_to()</a> function
to obtain statistics for an integer vector or matrix (eg. <a href="#Col">uvec</a>, <a href="#Col">ivec</a>),
first use the <a href="#conv_to">conv_to()</a> function to obtain a floating point representation (eg. <a href="#Col">vec</a>)
</li>
<br>
<li>
@@ -15375,6 +15378,9 @@ double m = mean(mean(A));
vec v(5, fill::randu);
double x = var(v);
ivec w = {1, 2, 3, 4}; // integer vector
double y = mean( conv_to&lt;vec&gt;::from(w) );
</pre>
</ul>
</li>
@@ -19116,7 +19122,7 @@ Armadillo extensively uses template meta-programming,
so it's recommended to enable optimisation when compiling programs (eg. use the -O2 or -O3 options for GCC or clang)
</li>
<br>
<li>See the <a href="http://arma.sourceforge.net/faq.html">Questions</a> page for more info on compiling and linking</li>
<li>See the <a href="https://arma.sourceforge.net/faq.html">Questions</a> page for more info on compiling and linking</li>
<br>
<li>See also the example program that comes with the Armadillo archive</li>
</ul>
@@ -20212,7 +20218,7 @@ List of additions and changes for each version:
<a name="version_114"></a>
<li>Version 11.4:
<ul>
<li>extended <a href="#pow">pow()</a> with various forms of element-wise power operations</li>
<li>extended <a href="#pow">pow()</a> with secondary element-wise form</li>
<li>added <a href="#find_nan">find_nan()</a> to find indices of NaN elements</li>
<li>faster handling of compound expressions by <a href="#sum">sum()</a></li>
</ul>
@@ -20589,7 +20595,7 @@ this requires a C++11/C++14 compiler with OpenMP 3.1+ support
<ul>
<li>
changed license to the permissive <a href="https://opensource.org/licenses/Apache-2.0">Apache License 2.0</a>;
see the <a href="http://arma.sourceforge.net/faq.html#license">Questions page</a> for more info
see the <a href="https://arma.sourceforge.net/faq.html#license">Questions page</a> for more info
</li>
</ul>
</li>
+1 -1
View File
@@ -23,7 +23,7 @@
#define ARMA_VERSION_MAJOR 14
#define ARMA_VERSION_MINOR 0
#define ARMA_VERSION_PATCH 2
#define ARMA_VERSION_PATCH 4
#define ARMA_VERSION_NAME "Stochastic Parrot"
+29 -1
View File
@@ -50,7 +50,8 @@ class fft_engine_fftw3
podarray<cx_type> Y_work; // for storing output
inline
~fft_engine_fftw3()
void
finish()
{
arma_debug_sigprint();
@@ -59,6 +60,33 @@ class fft_engine_fftw3
// fftw3::cleanup<cx_type>(); // NOTE: this also removes any wisdom acquired by FFTW3
}
inline
~fft_engine_fftw3()
{
arma_debug_sigprint();
#if defined(ARMA_USE_OPENMP)
{
#pragma omp critical (arma_fft_engine_fftw3)
{
(*this).finish();
}
}
#elif defined(ARMA_USE_STD_MUTEX)
{
std::mutex& plan_mutex = fft_engine_fftw3_aux::get_plan_mutex();
const std::lock_guard<std::mutex> lock(plan_mutex);
(*this).finish();
}
#else
{
(*this).finish();
}
#endif
}
inline
fft_engine_fftw3(const uword in_N)
: N (in_N )
+2
View File
@@ -993,6 +993,8 @@ accu(const SpGlue<T1,T2,spglue_schur>& expr)
const SpProxy<T1> px(expr.A);
const SpProxy<T2> py(expr.B);
arma_conform_assert_same_size(px.get_n_rows(), px.get_n_cols(), py.get_n_rows(), py.get_n_cols(), "element-wise multiplication");
typename SpProxy<T1>::const_iterator_type x_it = px.begin();
typename SpProxy<T1>::const_iterator_type x_it_end = px.end();
+8 -8
View File
@@ -23,7 +23,7 @@
template<typename T1, typename T2>
arma_warn_unused
arma_inline
inline
typename
enable_if2
<
@@ -44,7 +44,7 @@ pow
template<typename parent, unsigned int mode, typename T2>
arma_warn_unused
arma_deprecated
inline
Mat<typename parent::elem_type>
pow
@@ -62,7 +62,7 @@ pow
template<typename T1, typename T2>
arma_warn_unused
arma_inline
inline
const GlueCube<T1, T2, glue_powext>
pow
(
@@ -78,7 +78,7 @@ pow
template<typename eT, typename T2>
arma_warn_unused
arma_deprecated
inline
Cube<eT>
pow
@@ -100,7 +100,7 @@ pow
template<typename T1, typename T2>
arma_warn_unused
arma_inline
inline
typename
enable_if2
<
@@ -121,7 +121,7 @@ pow
template<typename parent, unsigned int mode, typename T2>
arma_warn_unused
arma_deprecated
inline
typename
enable_if2
@@ -144,7 +144,7 @@ pow
template<typename T1, typename T2>
arma_warn_unused
arma_inline
inline
const mtGlueCube<typename T1::elem_type, T1, T2, glue_powext_cx>
pow
(
@@ -160,7 +160,7 @@ pow
template<typename T, typename T2>
arma_warn_unused
arma_deprecated
inline
Cube< std::complex<T> >
pow
+1 -1
View File
@@ -41,7 +41,7 @@ op_median::apply(Mat<typename T1::elem_type>& out, const Op<T1,op_median>& expr)
{
Mat<eT> tmp;
op_median::apply_noalias(out, U.M, dim);
op_median::apply_noalias(tmp, U.M, dim);
out.steal_mem(tmp);
}
+13 -1
View File
@@ -216,7 +216,19 @@ op_powmat_cx::apply_direct(Mat< std::complex<typename T1::pod_type> >& out, cons
Col<in_T> eigval;
Mat<in_eT> eigvec;
const bool eig_status = eig_sym(eigval, eigvec, A);
bool eig_status = eig_sym(eigval, eigvec, A);
if(eig_status)
{
// NOTE: when in_eT is real, pow(eigval, y) will produce NaN for negative eigenvalues and non-integer exponent;
// NOTE: the all_pos check is a workaround
bool all_pos = true;
for(uword i=0; i < eigval.n_elem; ++i) { all_pos = (eigval[i] <= in_T(0)) ? false : all_pos; }
if(all_pos == false) { eig_status = false; }
}
if(eig_status)
{
@@ -2027,6 +2027,7 @@ sp_auxlib::run_aupd_plain
arma_ignore(n_eigvals);
arma_ignore(which);
arma_ignore(X);
arma_ignore(Xst);
arma_ignore(sym);
arma_ignore(n);
arma_ignore(tol);
@@ -43,7 +43,7 @@ class subview_cube_each_common
// NOTE: deliberately not derived from BaseCube
template<typename eT>
class subview_cube_each1 : public subview_cube_each_common<eT>
{
@@ -71,6 +71,7 @@ class subview_cube_each1 : public subview_cube_each_common<eT>
// NOTE: deliberately not derived from BaseCube
template<typename eT, typename TB>
class subview_cube_each2 : public subview_cube_each_common<eT>
{
@@ -50,7 +50,7 @@ class subview_each_common
// NOTE: deliberately not derived from Base
template<typename parent, unsigned int mode>
class subview_each1 : public subview_each_common<parent, mode>
{
@@ -80,6 +80,7 @@ class subview_each1 : public subview_each_common<parent, mode>
// NOTE: deliberately not derived from Base
template<typename parent, unsigned int mode, typename TB>
class subview_each2 : public subview_each_common<parent, mode>
{