How can I store the return value of 'derivativex' as a double? #147
Answered
by
allanleal
GaffaSnobb
asked this question in
Q&A
-
I wish to store the result of the numerical differentiation as a double in an armadillo matrix, as illustrated in the code below:
If I run the code I get the error
How can I achieve this? The examples on your website only |
Beta Was this translation helpful? Give feedback.
Answered by
allanleal
Mar 23, 2021
Replies: 1 comment 1 reply
-
This is because M(i, 0) = double(ux[0]); // This is what I want to do.
M(i, 1) = double(uxx[0]); // This is what I want to do. or M(i, 0) = autodiff::val(ux[0]); // This is what I want to do.
M(i, 1) = autodiff::val(uxx[0]); // This is what I want to do. |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
GaffaSnobb
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is because
var
cannot be converted todouble
implicitly. Try:or