Question

I'm looking for a library that can handle matrix math on the Arduino. I know that there is one library featured on the Arduino Playground, but I've found it to be a little lackluster in it's inability to handle poorly conditioned matrices, as well as its user interface is a little kludgy.

Are there any alternatives? Preferably ones that have some sort of reputation, like Armadillo or PETsc? I'd love to use one of the big ones, but it seems they've all moved on to C++11, which isn't yet supported by the Arduino IDE. My other option is to update avr-gcc to the latest, use Atmel Studio/Visual Studio, and build things myself. Then I should be able to use one of these other, mature libraries. I'd prefer not to have to go down that rabbit hole, especially since the Arduino core isn't guaranteed to work with C++11.

Was it helpful?

Solution

BAM!

eigen the best c++ matrix library has an arduino port!

https://github.com/vancegroup/EigenArduino

OTHER TIPS

It works! Ran through a simple program this AM to test:

#include <stlport.h>
#include <Eigen30.h>

using Eigen::MatrixXd;

MatrixXd m(2, 2);

void setup()
{
     Serial.begin(115200);

  /* add setup code here */
     m(0, 0) = 3;
     m(1, 0) = 2.5;
     m(0, 1) = -1;
     m(1, 1) = m(1, 0) + m(0, 1);

}

void loop()
{

  /* add main program code here */
     Serial.println(m(1,1));
     delay(2000);
}

You're right about bloat, though, as this sketch was >5 KB.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top