Dear all,
I have a question. Simply speaking, I have a Fortran module, in it I define a type (dual number for example, for automatic differentiation), and create the computation rules among this type of variable. Of course, operators like ± * / , etc are all overloaded to support this type’s computations. Now, in a C++ code, can I still use this Fortran module?
I know I can define a similar struct in C++, and Fortran can recognize this struct as the type defined in the Fortran module. But, in the C++ code, can I use the overloaded operator (defined in this Fortran module) such as ± * / ? ChatGpt said yes we can.
Just curious, has anyone successfully did something like this? Many thanks!
PS. For example, the Fortran module I am talking about is the dnad module from joddlehod, link is below. I am just try to use it directly in a C++ code. If I cannot directly use it, looks like I need to write its C++ version for it to be used in C++ code.
A newer module by fpenunuri which can calculate higher order derivatives can be found here,
fpenunuri/DNAOAD: Fortran implementation of dual numbers for arbitrary order automatic differentiation