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

simplify asDouble and avoid the need for WITH_LIBTMB with by using #311

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

boennecd
Copy link

@boennecd boennecd commented Apr 15, 2020

inline

change loop order in asSEXP and asMatrix (R matrices are in column major order)
fix #309

Notice that there is still a value function here:

/* FIXME: "Value" should be "var2par" I guess
kasper: Why not use asDouble defined previously? */
/** @name Value Functions
Overloaded functions to extract the value from objects of various types;
generally wrappers for CppAD::Value(x).
@{
*/
/** Extracts the value of from TMB objects.
\param x The variable to be extracted.
\return Object of type double containing the value of the argument.
*/
double value(double x){return x;}
double value(AD<double> x){return CppAD::Value(x);}
double value(AD<AD<double> > x){return CppAD::Value(CppAD::Value(x));}
double value(AD<AD<AD<double> > > x){return CppAD::Value(CppAD::Value(CppAD::Value(x)));}
/** @} */

which can be changed to

template<class T>
double value(T const x)
{
  return asDouble(x); 
}

…line

change loop order in asSEXP and asMatrix (R matrices a in column major order)
fix kaskr#309
@boennecd boennecd changed the title simplify asDouble and avoid the need for WITH_LIBTMB with by using in… simplify asDouble and avoid the need for WITH_LIBTMB with by using Apr 15, 2020
@kaskr
Copy link
Owner

kaskr commented Apr 15, 2020

Thanks for the PR - your changes make sense.

In case you make other changes I would kindly ask to split in many small commits.
Reason: There's a major restructure coming up (new AD framework - branch 'TMBad') and merging could become non-trivial if too much is done at once...

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

Successfully merging this pull request may close these issues.

Typo in error message
2 participants