DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   C++ (http://www.daniweb.com/forums/forum8.html)
-   -   Library to solve matrix determinant c++ (http://www.daniweb.com/forums/thread163074.html)

35nando Dec 19th, 2008 12:10 pm
Library to solve matrix determinant c++
 
Hi, i'm looking for some library that provides solving matrix determinant. My matrix contains complex numbers (complex.h).
Please write me some hints

Lerner Dec 19th, 2008 12:30 pm
Re: Library to solve matrix determinant c++
 
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.

cikara21 Dec 19th, 2008 1:30 pm
Re: Library to solve matrix determinant c++
 
see...Cramers rule...then u can create your own library...

ArkM Dec 19th, 2008 1:42 pm
Re: Library to solve matrix determinant c++
 
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...

35nando Jan 5th, 2009 7:40 am
Re: Library to solve matrix determinant c++
 
Quote:

Originally Posted by cikara21 (Post 760915)
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.

Quote:

Originally Posted by ArkM (Post 760918)
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 :)


All times are GMT -4. The time now is 2:47 pm.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC