mikegashler / waffles

A toolkit of machine learning algorithms.
http://gashler.com/mike/waffles/
86 stars 33 forks source link

Adding support for Eigen #1

Closed skn123 closed 8 years ago

skn123 commented 8 years ago

Mike, Would it be possible to add support for Eigen? I think the fundamental data structure would be a change in GMatrix, but that would involve a lot of changes in the code. A short-term solution would be to interface an Eigen matrix with Waffles.

mikegashler commented 8 years ago

It looks like it would be pretty simple to write functions that would convert a GVec instance to/from an Eigen Array, and functions that would convert a GMatrix instance to/from and Eigen Matrix. Is that approximately what you have in mind? (Disclaimer: I have never used Eigen before--I just took a quick glance at their API docs.)

skn123 commented 8 years ago

Mike, indeed, that is what would be ideal for a start. Eigen supports all linear algebra routines that Waffles would need. So, in the long run, it would be pertinent to make GMatrix derive all utilities from Eigen/Dense and Eigen/Sparse. If you need to add GPU compatibility to Waffles, then ViennaCl can also be considered as it mimics most of the functionality of Eigen (and even more vis-a-vis by way of adding GPU support).

mikegashler commented 8 years ago

I added a very simple demo, waffles/demos/eigen, which links to both libraries. It converts a matrix back and forth. It is not much, but it is a starting point. I have not yet ported it to Windows, but that should be pretty simple. Since I am not currently using Eigen for anything, this is about as far as I plan to take this effort, for now.

If you feel inclined to drive it a little further, that would be fine with me. The GClasses library does not depend on any non-standard libraries, and I intend to keep it that way, but I would be happy to add another library to the Waffles suite that depends on Eigen. (I have been putting libraries with external dependencies in the waffles/src/depends folder.)

skn123 commented 8 years ago

Mike, I updated the code, but could not find this file, Can you please indicate where this file is located or has it been checked in?

mikegashler commented 8 years ago

It's in waffles/demos/eigen/src. This page shows that it is in the GitHub repository: https://github.com/mikegashler/waffles/tree/master/demos/eigen/src