Hi, i'm looking for some library that provides solving matrix determinant. My matrix contains complex numbers (complex.h).
Please write me some hints
Hi, i'm looking for some library that provides solving matrix determinant. My matrix contains complex numbers (complex.h).
Please write me some hints
Hint: google search using C++ matrix determinant. It provided 12,000 hits. One of them, probably early on in the list, probably/may have something to help.
For example, download free Matrix TCL Lite 1.13 by Techsoft:
http://www.techsoftpl.com/matrix/download.htm
(it's not a recommendation, I never use this library but it's compact and simple;) ).
Comment 5 lines of abs definitions in downloaded matrix.h:
/* Do that, you can't compile it with VC++ when <complex> included
#if ( defined(__BORLANDC__) || _MSC_VER ) && !defined( __GNUG__ )
inline float abs (float v) { return (float)fabs( v); }
inline double abs (double v) { return fabs( v); }
inline long double abs (long double v) { return fabsl( v); }
#endif
*/
Now
#include <complex>
using namespace std;
#include "matrix.h"
typedef complex<double> Complex;
typedef math::matrix<Complex> CMat;
int main()
{
CMat m(2,2);
m(0,0) = Complex(0,1);
m(0,1) = m(1,0) = 0.0;
m(1,1) = Complex(0,1);
cout << m.Det() << endl;
return 0;
}
// prints (-1,0)
Read package manual in pro_doc directory...
see...Cramers rule...then u can create your own library...
Cramer's rule is useful to fing solution of a system of linear equations, not solving determinant.
For example, download free Matrix TCL Lite 1.13 by Techsoft:
http://www.techsoftpl.com/matrix/download.htm ...
Thanks, that library is simple and solves determinants quickly :)