Coder Social home page Coder Social logo

cannot build it with eigen about optim HOT 12 CLOSED

kthohr avatar kthohr commented on May 20, 2024
cannot build it with eigen

from optim.

Comments (12)

kthohr avatar kthohr commented on May 20, 2024

You need to set EIGEN_INCLUDE_PATH. I've updated the configure script to throw an error if this is not found.

from optim.

Horizon-42 avatar Horizon-42 commented on May 20, 2024

thank you, now it can compile, but throw an error:
./include/misc/matrix_ops/access.hpp:35:50: error: ‘all’ is not a member of ‘Eigen’
#define OPTIM_MATOPS_ROWS(x, v) (x)(v,Eigen::all) // v is a vector
^
./include/misc/matrix_ops/eval.hpp:30:35: note: in definition of macro ‘OPTIM_MATOPS_EVAL’
#define OPTIM_MATOPS_EVAL(x) (x).eval()
^
src/unconstrained/nm.cpp:149:44: note: in expansion of macro ‘OPTIM_MATOPS_ROWS’
simplex_points = OPTIM_MATOPS_EVAL(OPTIM_MATOPS_ROWS(simplex_points, sort_vec));
^~~~~~~~~~~~~~~~~

I use eigen3, don't know if it's ik

from optim.

kthohr avatar kthohr commented on May 20, 2024

When you ran configure what was the output under OPTIM_MATLIB_INCLUDE_PATH set to:

from optim.

Horizon-42 avatar Horizon-42 commented on May 20, 2024

OPTIM_MATLIB_INCLUDE_PATH set to:
/usr/include/eigen3

/usr/include/eigen3 is EIGEN_INCLUDE_PATH

from optim.

Horizon-42 avatar Horizon-42 commented on May 20, 2024

compile failed when it run:
g++ -std=c++11 -Wall -fPIC -O3 -march=native -ffp-contract=fast -flto -DNDEBUG -fopenmp -DOPTIM_ENABLE_EIGEN_WRAPPERS -I/usr/include/eigen3 -I./include src/unconstrained/nm.cpp -c -o src/unconstrained/nm.o

from optim.

kthohr avatar kthohr commented on May 20, 2024

Sounds like an issue with your installation of Eigen.

I just pulled the latest version of Eigen from GitLab:

https://gitlab.com/libeigen/eigen

And the library compiled without issue.

As a sanity check, you could try the following:

cd ~/Desktop
git clone https://gitlab.com/libeigen/eigen.git
export EIGEN_INCLUDE_PATH="${PWD}/eigen"

Then change back to the directory where you've pulled OptimLib and run ./configure -l eigen && make again.

from optim.

Horizon-42 avatar Horizon-42 commented on May 20, 2024

finally it build success
but when i use the lib to compile example, it throw a lot of errors, like:
/include/misc/matrix_ops/get_sort_index.hpp:22:1: error: ‘VecInt_t’ does not name a type; did you mean ‘uint_t’?
VecInt_t
I don't know what wrong?

from optim.

kthohr avatar kthohr commented on May 20, 2024

You need to include an example of what you're trying to compile, along with the compiler options.

from optim.

kthohr avatar kthohr commented on May 20, 2024

Try the same example again with

#define OPTIM_ENABLE_EIGEN_WRAPPERS
#include "optim.hpp"

from optim.

Horizon-42 avatar Horizon-42 commented on May 20, 2024

thank you, it worked.
thank you for you patient, I should read the docs first.

from optim.

kthohr avatar kthohr commented on May 20, 2024

No worries; thanks for pointing out some gaps in the build process and docs. Feel free to reopen if you encounter any other build-related errors.

from optim.

Horizon-42 avatar Horizon-42 commented on May 20, 2024

and i found a small iusse when build test
it throw error when i build test like this:

newton_logit_reg.cpp:115:67: error: ‘std::chrono’ has not been declared

I just add #include to fix it.

from optim.

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.