Code Monkey home page Code Monkey logo

Comments (13)

bradbell avatar bradbell commented on September 28, 2024

You have a function y = f(x) and some of the components of y are nan, perhaps you are not using these components (for a particular case). You can disable this check with
https://cppad.readthedocs.io/en/latest/check_for_nan.html

from cppad.

a-jp avatar a-jp commented on September 28, 2024

My usage of CppAD is via the IPopt wrapper, and the error comes as a results of a call to solve within IPOPT. I wouldn't really therefore know where to put this?

Would you have any views on the NDEBUG type questions that brought this to my attention?

from cppad.

bradbell avatar bradbell commented on September 28, 2024

Now I understand.
We would have to add a true/false check_for_nan option to ipopt_solve (similar to the reteape opotion); see options on
https://cppad.readthedocs.io/en/latest/ipopt_solve.html#options
and
https://github.com/coin-or/CppAD/blob/master/include/cppad/ipopt/solve.hpp

Then we would use this option value to set check_for_nan at line 242 beginning of the solve_callback constructor;

      adfun_.check_for_nan( check_for_nan )

see
https://github.com/coin-or/CppAD/blob/master/include/cppad/ipopt/solve_callback.hpp

I am currently busy with other things, and would appreciate it if you would give this a try and see if it solves your problem.

from cppad.

a-jp avatar a-jp commented on September 28, 2024

Ok, I'll give it ago thanks for your help.

If you have a minute just to consider whether the behaviour that I've found with NDEBUG is expected in terms of using a release-compiled version of CppAD in another project that is also compiled in release-mode, that would be most helpful. My expectation would be that debug checks are not trigger from a release build of CppAD - which they are with my current cmake-usage above.

from cppad.

bradbell avatar bradbell commented on September 28, 2024

If you have a minute just to consider whether the behaviour that I've found with NDEBUG is expected in terms of using a release-compiled version of CppAD in another project that is also compiled in release-mode, that would be most helpful.

If you look at
https://github.com/coin-or/CppAD/blob/master/include/cppad/core/forward/forward.hpp
and search for check_for_nan, you will see that the error message in question is inside a

# ifndef NDEBUG
...
# endif

block. So I do not know how it is getting printed if the CppAD code is being built with NDEBUG defined ? Please inform me if you figure this out.

from cppad.

a-jp avatar a-jp commented on September 28, 2024

So I do not know how it is getting printed if the CppAD code is being built with NDEBUG defined ? Please inform me if you figure this out.

-- Like I say above, that's kind of my whole point, I've no idea how it's getting in there, but it does...

from cppad.

bradbell avatar bradbell commented on September 28, 2024

Are you using the cmake_build_type option to configure CppAD ?; see
https://cppad.readthedocs.io/en/latest/cmake.html#cmake-build-type

It may also help to check the value of CMAKE_BUILD_TYPE output by the cmake command; i.e., it should be
-- CMAKE_BUILD_TYPE = Release

from cppad.

a-jp avatar a-jp commented on September 28, 2024

yep, that's the one I use. As far as I can work out the problem is that on make install the include files put into the include dir of the install location still have these # ifndef NDEBUG within them. When you then include CppAD in your own project as I tried to explain above using PkgConfig, NDEBUG is not defined since it's nothing to do with my project. So these parts get triggered. I think that's what's happening.

from cppad.

bradbell avatar bradbell commented on September 28, 2024

This is just a side issue that may be relevant to you. If you are building a library that may use both debug and release CppAD code, you need to define CPPAD_DEBUG_AND_RELEASE
https://cppad.readthedocs.io/en/latest/preprocessor.html#cppad-debug-and-release

from cppad.

a-jp avatar a-jp commented on September 28, 2024

Ok thanks. Good to know. At the moment it's just release CppAD and release my own code base that includes and links to CppAD.

from cppad.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.