Coder Social home page Coder Social logo

Comments (4)

eudoxos avatar eudoxos commented on August 18, 2024

Hi, I'm the author of minieigen.

A big issue is that in Eigen, all intermediary results are expression templates, thus each of them is a new type. That's why many operators need to wrapped so that they return the expression template evaluated. If you have some initial implementation of how to go header-only, that would be great.

Also note that minieigen is almost entirely header-only (and templated), it just has a few small .cpp files which register the wrappers in python.

from python.

nevion avatar nevion commented on August 18, 2024

Hi @eudoxos , I am aware of your work on minieigen and I remember when you announced it on the eigen ML a while back :-)

After having to do alot of bindings between C++ and eigen in function signatures, I found the path of least resistance, though still required a decent amount of registration calls, was to implicitly map eigen types to/from numpy arrays. This means that operations are performed based on numpy code and it's like a shared memory communication. The bad thing is that now there will be subtle floating point differences between eigen implemented functions and numpy's. On the other hand, it drastically reduced the complexity of Eigen's soup of expression templates and other compile time/type issues. Perhaps the functions we'd want to export for using eigen to implement some operations on numpy ndimages would then provide the way to use Eigen to provide the implementation when needed.

I think this actually might be the best path forward, especially if Boost.Numpy gets integrated - what do you think?

from python.

eudoxos avatar eudoxos commented on August 18, 2024

Hi @nevion, that sounds like a very good idea, one will have numpy or eigen use the same chunk of memory as input for its ops. I am not very familiar with numpy on the memory level, can't help much unfortunately. Is Eigen's alignment a possible issue, or that is handled fine by numpy?

The only drawback which I see is that people will have hard(er) time transitioning from numpy to eigen (from python in c++) -- the advantage of minieigen is that you can prototype the code in python and almost cut&paste into c++ and it will do the same thing.

By all means, go forward.

from python.

eudoxos avatar eudoxos commented on August 18, 2024

Recommended: http://pybind11.readthedocs.org/en/latest/, a c++11-only lighter, header-only evolution of good old boost::python. Especiall the chapter on buffer protocol and numpy arrays.

from python.

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.