Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a more natural way to represent a matrix of T than a vector< vector< T>>?

Context:

I am trying to learn C++ (while reading some of the stackoverflow community recommended books) and I decided to try and make a cellular automata program with basic functionality just for the sake of learning (and because it's interesting to me).

Question:

Is there a more natural way to represent a matrix of Cell elements than using a vector< vector< Cell>>? I am looking for potential alternatives in the standard libraries or in some other popular libraries. Commentary regarding the performance would be appreciated.

I didn't have trouble using the vector of vectors, nor trouble with the syntax, I would just like to know alternatives. And because since I'm inexperienced, every time I write some code I imagine that probably there are a lot more straightforward ways to do it that I would not find by myself.

This is my first question so if I did something against the guidelines for questions I would appreciate a lot that you pointed it out.

Useful related question for future reference: Is a vector<vector<double>> a good way to make a make a matrix class?

like image 776
arthropod Avatar asked Sep 20 '14 02:09

arthropod


1 Answers

 Matrix<double, 13, 3> 

From the Eigen3 library http://eigen.tuxfamily.org/dox/group__QuickRefPage.html Eigen3 provides pretty much every operation you'll need for linear algebra, and is well tested and used by a wide base of users.

like image 104
OllieB Avatar answered Oct 10 '22 19:10

OllieB