Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coordinating required changes for (Rcpp)Armadillo 14.4.0(-0) #462

Open
6 of 8 tasks
eddelbuettel opened this issue Feb 17, 2025 · 4 comments
Open
6 of 8 tasks

Coordinating required changes for (Rcpp)Armadillo 14.4.0(-0) #462

eddelbuettel opened this issue Feb 17, 2025 · 4 comments

Comments

@eddelbuettel
Copy link
Member

eddelbuettel commented Feb 17, 2025

Armadillo 14.4.0 has been released, and it brings the usual set of incremental improvements.

@conradsnicta and I have been examining a series of reverse-dependency checks leading up to it. Relative to the by-now rather large number of over 1200 reverse-dependencies, we found a fairly small number of packages requiring minor changes to accomodate both 14.2.* and 14.4.0. We plan link a set of pull requests or patches here allowing those packages to update at CRAN before we start publishing the 14.4.* series there. We will edit and update this issue to track this.

  • circlus no public repo repo, mirror, patch to version 0.0.1 below, emailed 2025-02-17, committed 2025-02-17, version 0.0.2 on CRAN 2025-02-19
  • fdasrvf repo, pull request fdasrvf_R/#56 made 2025-02-17, merged 2025-02-17, new version 2.3.6 on CRAN 2025-02-17
  • MSTest repo, pull request MSTest/#2 made 2025-02-17, pr closed 2025-02-24, version 0.1.5 on CRAN 2025-02-24
  • OSFD no public repo, mirror, patch to version 3.0 below, emailed 2025-02-17
  • PAGFL repo, pull request PAGLF/#1 made 2025-02-17, merged 2025-02-18, release 1.1.3 on CRAN 2025-02-20
  • TSLA no public repo, mirror, patch to version 0.1.1 below, emailed 2025-02-17
  • UComp no public repo, mirror, patch to version 5.0.5 below. emailed 2025-02-17, release 5.0.6 on CRAN 2025-02-28
  • watson repo, fix committed 2025-02-17, release 0.6.0 on CRAN 2025-02-19

Patch for circlus

diff -ru circlus.orig/src/rpkbd.cpp circlus/src/rpkbd.cpp
--- circlus.orig/src/rpkbd.cpp	2024-09-30 16:01:01.000000000 +0200
+++ circlus/src/rpkbd.cpp	2025-02-17 15:05:12.670055188 +0100
@@ -17,7 +17,7 @@
 // [[Rcpp::export]]
 arma::mat rPKBD_ACG(int n, double rho, arma::vec &mu){
   double lambda = 2*rho/(1+rho*rho);
-  double norm = as_scalar(sum(pow(mu,2)));
+  double norm = arma::as_scalar(sum(pow(mu,2)));
   int p = mu.n_elem;
   arma::mat A(n, p);
   if(lambda == 0 || norm == 0){/*uniform*/
diff -ru circlus.orig/src/sCauchy.cpp circlus/src/sCauchy.cpp
--- circlus.orig/src/sCauchy.cpp	2024-10-07 16:45:02.000000000 +0200
+++ circlus/src/sCauchy.cpp	2025-02-17 15:05:58.904572081 +0100
@@ -85,7 +85,7 @@
 //' @export
 // [[Rcpp::export]]
 arma::mat rspcauchy(int n, double rho, arma::vec &mu){
-  double norm = as_scalar(sum(pow(mu,2)));
+  double norm = arma::as_scalar(sum(pow(mu,2)));
   int p = mu.n_elem;
   arma::mat A(n, p);
   A = normalise(A.randn(),2,1);

Patch for OSFD

diff -ru OSFD.orig/src/OSFD.cpp OSFD/src/OSFD.cpp
--- OSFD.orig/src/OSFD.cpp	2025-01-13 05:09:45.000000000 +0100
+++ OSFD/src/OSFD.cpp	2025-02-17 18:05:05.733625385 +0100
@@ -183,7 +183,7 @@
     Z_norm(i) = arma::norm(Z.row(i));// the norm of the Z vector
   }
   Z = Z / (Z_norm * Ones);
-  U = pow(U, 1./p);
+  U = arma::pow(U, 1./p);
   out = (U * Ones) % Z;
   return (out);
 }
@@ -414,9 +414,7 @@
   int intrinsic_dim = std::min(p, q);
   // double out_vol = arma::sum(arma::pow(filldist_out, intrinsic_dim)) * 
   //   std::pow(M_PI, intrinsic_dim/2.0) / std::tgamma(intrinsic_dim/2.0 + 1);
-  double alpha = arma::as_scalar(arma::pow(arma::mean(arma::pow(filldist_out, intrinsic_dim)), 1.0/intrinsic_dim)) /
-    arma::as_scalar(arma::pow(arma::mean(arma::pow(filldist_in, p)), 1.0/p));
-  
+  double alpha = std::pow(arma::as_scalar(arma::mean(arma::pow(filldist_out, intrinsic_dim))), 1.0/intrinsic_dim) / std::pow(arma::as_scalar(arma::mean(arma::pow(filldist_in, p))), 1.0/p);
   arma::vec balance_cri = lambda * filldist_in + (1-lambda) * filldist_out / alpha;
   
   // Find the index with the maximum balance criterion

Patch for TSLA

diff -ru TSLA.orig/src/SPGlinear.cpp TSLA/src/SPGlinear.cpp
--- TSLA.orig/src/SPGlinear.cpp	2023-11-30 17:01:35.000000000 +0100
+++ TSLA/src/SPGlinear.cpp	2025-02-17 18:58:22.419621673 +0100
@@ -20,7 +20,7 @@
   int V = g_idx.n_rows;
   for(int v = 0; v < V; v ++) {
     arma::vec idx = g_idx.row(v).cols(0, 1).t();
-    arma::vec unorm = max(ones(1), sqrt(sum(pow(u.rows(idx(0) - 1, idx(1) - 1), 2))));
+    arma::vec unorm = max(ones(1), arma::vec{ sqrt(sum(pow(u.rows(idx(0) - 1, idx(1) - 1), 2))) } );
     R.rows(idx(0) - 1, idx(1) - 1) = u.rows(idx(0) - 1, idx(1) - 1) / as_scalar(unorm);
   }
   return(R);

Patch for UComp

diff -ru UComp.orig/src/stats.h UComp/src/stats.h
--- UComp.orig/src/stats.h	2024-07-07 12:05:45.000000000 +0200
+++ UComp/src/stats.h	2025-02-17 19:12:12.180827684 +0100
@@ -404,9 +404,9 @@
   int nNan, n = y.n_elem;
   vec yn = removeNans(y, nNan);
   yn = yn - mean(yn);
-  vec media3 = mean(pow(yn, 3));
-  vec media4 = mean(pow(yn, 4));
-  vec stdb = sqrt(mean(pow(yn, 2)));
+  vec media3; media3 = mean(pow(yn, 3));
+  vec media4; media4 = mean(pow(yn, 4));
+  vec stdb; stdb = sqrt(mean(pow(yn, 2)));
   vec skew = media3 / pow(stdb, 3);
   vec kurto = media4 / pow(stdb, 4) - 3;
   bj = (n - nNan) / 6 * (pow(as_scalar(skew), 2) + pow(as_scalar(kurto), 2) / 4);
@lsablica
Copy link

circlus now updated

same fix was performed also to watson

both updates should go to CRAN soon (this week).

@eddelbuettel
Copy link
Member Author

Awesome! Now I wonder why I did not find your repo here... Maybe follow common standard (even if not formally Writing R Extensions or CRAN Policy endorsed/required) and add fields URL and BugReports? I eventually did too for all my packages, it helps e.g. with the source repo identication at r-universe. And, of course, makes it easier to find the repo.

And thanks for the help with watson. As you can see I go in (lexiocographic) order ...

@roga11
Copy link

roga11 commented Feb 24, 2025

MSTest is now updated

The pull request only included changes for one line and I had already made changes to multiple other lines that required this change on my local repo.

Thanks for your help with this.

New version of MSTest is now on CRAN.

@eddelbuettel
Copy link
Member Author

eddelbuettel commented Feb 24, 2025

Perfect and thanks so much. I just noticed via CRANberries (and posted to the PR).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants