1 | #include "intflapack.h"
|
---|
2 |
|
---|
3 | extern "C" {
|
---|
4 | void sgesv_(int_4* n, int_4* nrhs, r_4* a, int_4* lda,
|
---|
5 | int_4* ipiv, r_4* b, int_4* ldb, int_4* info);
|
---|
6 | void dgesv_(int_4* n, int_4* nrhs, r_8* a, int_4* lda,
|
---|
7 | int_4* ipiv, r_8* b, int_4* ldb, int_4* info);
|
---|
8 | void cgesv_(int_4* n, int_4* nrhs, complex<r_4>* a, int_4* lda,
|
---|
9 | int_4* ipiv, complex<r_4>* b, int_4* ldb, int_4* info);
|
---|
10 | void zgesv_(int_4* n, int_4* nrhs, complex<r_8>* a, int_4* lda,
|
---|
11 | int_4* ipiv, complex<r_8>* b, int_4* ldb, int_4* info);
|
---|
12 | }
|
---|
13 |
|
---|
14 | void rztest_lapack(TArray<r_4>& aa, TArray<r_4>& bb)
|
---|
15 | {
|
---|
16 | if ( aa.NbDimensions() != 2 ) throw(SzMismatchError("rztest_lapack(TMatrix<r_4> A Not a Matrix"));
|
---|
17 | if ( aa.SizeX() != aa.SizeY()) throw(SzMismatchError("rztest_lapack(TMatrix<r_4> A Not a square Matrix"));
|
---|
18 | if ( bb.NbDimensions() != 2 ) throw(SzMismatchError("rztest_lapack(TMatrix<r_4> A Not a Matrix"));
|
---|
19 | if ( bb.SizeY() != aa.SizeY() ) throw(SzMismatchError("rztest_lapack(TMatrix<r_4> A <> B "));
|
---|
20 | if ( !bb.IsPacked() || !bb.IsPacked() )
|
---|
21 | throw(SzMismatchError("rztest_lapack(TMatrix<r_4> Not packed A or B "));
|
---|
22 |
|
---|
23 | int_4 n = aa.SizeY();
|
---|
24 | int_4 nrhs = bb.SizeX();
|
---|
25 | int_4 lda = n;
|
---|
26 | int_4 ldb = bb.SizeY();
|
---|
27 | int_4 info;
|
---|
28 | int_4* ipiv = new int_4[n];
|
---|
29 | sgesv_(&n, &nrhs, aa.Data(), &lda, ipiv, bb.Data(), &ldb, &info);
|
---|
30 | cout << "rztest_lapack/Info= " << info << endl;
|
---|
31 | cout << aa << "\n" << bb << endl;
|
---|
32 | return;
|
---|
33 | }
|
---|