tomstewart89 / BasicLinearAlgebra

A library for using matrices and linear algebra on Arduino
MIT License
187 stars 38 forks source link

Adds GetRowCount and GetColCount #8

Closed keithmgould closed 7 years ago

keithmgould commented 7 years ago

adds:

  1. matrix.GetRowCount
  2. matrix.GetColCount

and augments HowToUse showing the functionality.

keithmgould commented 7 years ago

PS: looks like my editor caught (and removed) a few stray spaces. If you want to keep them, lemme know and I'll figure out how to save without automatically truncating :)

PPS: Here is where I'm using the new methods: https://github.com/keithmgould/kalman-cpp

tomstewart89 commented 7 years ago

Hey Keith, thanks for the PR and nice Kalman Filter library!

GetRow/ColCount is a good idea, I'd be happy to add that in. For the record, at the moment the Matrix class defines a pair of static constants called Row and Col so if you wanted to access the Row/Col through the class you could use Matrix<N,M>::Rows / Matrix<N,M>::Cols.

For SetIdentity, I actually had this method in the library not too long ago but in the end I opted to remove it and instead set matrices to identity by simply assigning them with the Identity matrix customization like so:

Matrix<3,3> A = Identity<3>();

That stuff admittedly isn't very well documented but there's some more information about it in the CustomMatrix example if you're interested.

Assuming that syntax suits you would you be able to modify your PR to omit the SetIdentity method? It'd be good to get rid of that whitespace so by all means leave those changes in there.

keithmgould commented 7 years ago

Hey Tom,

Updated!

PS: I had to do a Matrix<3,3> A = Identity<3,3,int>(); to get the customization to work.