Matrix classes in c++

2019-04-11 04:17发布

I'm doing some linear algebra math, and was looking for some really lightweight and simple to use matrix class that could handle different dimensions: 2x2, 2x1, 3x1 and 1x2 basically. I presume such class could be implemented with templates and using some specialization in some cases, for performance. Anybody know of any simple implementation available for use? I don't want "bloated" implementations, as I'll running this in an embedded environment where memory is constrained.

Thanks

8条回答
家丑人穷心不美
2楼-- · 2019-04-11 04:52

How about just store the matrix in an array, like

2x3 matrix = {2,3,val1,val2,...,val6}

This is really simple, and addition operations are trivial. However, you need to write your own multiplication function.

查看更多
啃猪蹄的小仙女
3楼-- · 2019-04-11 04:54

Another option, altough may be too late is:

https://launchpad.net/lwmatrix

查看更多
登录 后发表回答