GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||
GeezerVison is showing github.com — For Eigen 5.0 add a missing element-wise pow() by eddelbuettel · Pull Request #9 · tsmodels/tsgarch Conversation
Contributor
Hi Alexios, Eigen 5.0.0, which we are trying to bring to CRAN in an updated RcppEigen, apparently did away with a (scalar) With assistance from Deepseek v4 flash-0731, a simple workaround was found. I have tested the workaround with both the CRAN version of RcppEigen (0.3.4.0.2, containing Eigen 3.4.0.2) and the 'release candidate' from our repo / from our r-universe (0.4.9.9.2, containing Eigen 5.0.1). I also ran a full R CMD check with all suggested packages against both RcppEigen versions. As the initial failure was plain installation / compilation, this should be sufficient. Feel free to alter / adjust the PR as you see fit. I am not familiar with TMB and INLA and others using it may have found similar workaround. For your perusal I also include the summary from the large language model below. So if you could apply this PR and get the update to CRAN before we update, a new RcppEigen would not break your package. If you don't update it we would get breakage 😞 but this PR overcomes this. We have been at this update for a long time as there were other issues in affected packages so the upload is not really imminent -- but getting closer. If you can get this to CRAN over the next few weeks we would appreciate it. 'Some time' in the near future will work, you can see at RcppEigen issue 151 how the other changes come in. Thanks! Summary for tsgarch changesPorting Project summary
The Eigen 5.0 API break (same as SpatialGEV)SymptomTMB compilation of affecting the array-base
CauseEigen 5.0 added a hard GlobalUnaryPowReturnType = std::enable_if_t< !is_arithmetic<NumTraits<Derived>::Real> && is_arithmetic<NumTraits<ScalarExponent>::Real>, // CppAD::AD<double> is NOT CwiseUnaryOp<scalar_unary_pow_op<...>>>; For a TMB FixAdded an elementwise template <class Derived, class ExponentScalar> inline Eigen::CwiseUnaryOp<Eigen::internal::scalar_unary_pow_op<typename Derived::Scalar, ExponentScalar>, const Derived> pow_cwise(const Eigen::ArrayBase<Derived>& x, const ExponentScalar& e) { typedef typename Derived::Scalar Scalar; return Eigen::CwiseUnaryOp<Eigen::internal::scalar_unary_pow_op<Scalar, ExponentScalar>, const Derived>( x.derived(), Eigen::internal::scalar_unary_pow_op<Scalar, ExponentScalar>(e)); } Then replaced the 6 affected call sites in Portability fix (IMPORTANT, do not regress)The FIRST version of There are TWO RcppEigen installs on this machine and the choice depends on the
So template <class Derived, class ExponentScalar> inline auto pow_cwise(const Eigen::ArrayBase<Derived>& x, const ExponentScalar& e) { typedef typename Derived::Scalar Scalar; return x.derived().unaryExpr([e](const Scalar& v) { return Eigen::numext::pow(v, e); }); }
Verification
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
44 of 50 tasks
|
There was an error while loading. Please reload this page.
|
I just learned in the other PR also suffering from the PS "Lucky us" -- it doesn't affect is here so there may have been an additional issue with the other package only. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Thanks Dirk! Much appreciated. This should also save me time on a new package I am writing which also uses RcppEigen. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Awesome, thanks for the two merged. I hope to get to CRAN "soon" but I may well be November given that a few other maintainers need to be nudged. But should hopefully be before the end of the year. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.