About

Matrix.h is a C++ template with several matrix operations. The template design is such that the matrix can be of any number type, be it floating point, complex, rational, ext. The library contains several common matrix functions, such as determinant, row echelon reductions, and LU decomposition.

This library is the result of a linear algebra class and written mostly to put my comprehension of what I learned to work. It was written more to be a clear demonstration of the techniques than the most efficient implementation.

The second part of this library is a rational number template class. Matrix math involving integer numbers can often be done more accurately with rational numbers than floating-point. This rational number template can use any input type; integer, long, or even arbitrary precession classes assuming the class has all the basic math operators overloaded.

欢迎来自中国的朋友!

Download

Download 'matrix.h'
Download 'rational.h'

User comments

From Andrew Que (http://www.DrQue.net/)

Middleton, WI, USA

April 22, 2014 at 9:49 PM

Please leave a comment if you find this library useful.

From Tran Hoang Duong

Hanoi, Vietnam

October 03, 2014 at 12:19 PM

thank you very much. Very useful :)

From Jiandong Lu (http://blog.chinaunix.net/uid/12023855.html)

Beijing, PRC

May 10, 2016 at 3:58 AM

The codes you wrote are great ! very clear, easy to understand.Thanks very much !

But I found a word spelled wrong:

function name reducedRowEcholon() should be reducedRowEchelon()

From houwenbin (http://www.weibo.com/u/1662894873)

Hangzhou,China.

July 19, 2016 at 3:46 AM

Thanks a lot!

From WEIXING ZHAO (http://www.lenstek.com)

Nanjing China

September 06, 2020 at 7:49 PM

Very good resource, thank you!

Copyright

Matrix.h is is free, open-source software released under the GNU license.

Author

Matrix.h was written by Andrew Que. To get in touch with Andrew Que, visit his contact page.