Spectral Integral Suite in C++
trySlicot.cpp
Go to the documentation of this file.
1 
2 #include <fstream> // To output data to files
3 #include <iostream>
4 #include <stdio.h>
5 #include <sis.hpp>
6 
7 
8 using namespace std;
9 
10 extern "C" {
11  void sb04od_(char *REDUCE, char *TRANS, char *JOBD, int *M, int *N, double *A, int *LDA, double *B, int *LDB, double *C, int *LDC, double *D, int *LDD, double *E, int *LDE, double *F, int *LDF, double *SCALE, double *DIF, double *P, int *LDP, double *Q, int *LDQ, double *U, int *LDU, double *V, int *LDV, int* IWORK, double* DWORK, int* LDWORK, int* INFO);
12 }
13 
14 
15 typedef complex<double> Cd_t;
16 
17 int main()
18 {
19  cout<< "Hi! I am here!!" << endl;
20  Eigen::MatrixXd A(4,4), B(4,4), C(4,4), D(4,4), E(4,4), F(4,4), P(4,4), Q(4,4), U(4,4), V(4,4), A1(4,4), B1(4,4), C1(4,4), D1(4,4), E1(4,4), F1(4,4);
21  A = Eigen::MatrixXd::Random(4,4);
22  B = Eigen::MatrixXd::Random(4, 4);
23  C = Eigen::MatrixXd::Random(4, 4);
24  D = Eigen::MatrixXd::Random(4, 4);
25  E = Eigen::MatrixXd::Random(4, 4);
26  F = Eigen::MatrixXd::Random(4, 4);
27 
28  A1 = A;
29  B1 = B;
30  C1 = C;
31  D1 = D;
32  E1 = E;
33  F1 = F;
34 
35 
36  int sizeA = A.rows();
37  int lwork = -1; // set lwork to -1 to estimate workspace.
38  char reduce = 'R';
39  char trans = 'N';
40  char jobd = 'N';
41  int M = 4;
42  int N = 4;
43  int ldA = A.outerStride(); // ld for leading dimension
44  int ldB = B.outerStride();
45  int ldC = C.outerStride();
46  int ldD = D.outerStride();
47  int ldE = E.outerStride();
48  int ldF = F.outerStride();
49  int ldP = P.outerStride();
50  int ldQ = Q.outerStride();
51  int ldU = U.outerStride();
52  int ldV = V.outerStride();
53  double scale = 1.0;
54  double dif;
55  int* iwork;
56  iwork = new int[M+N+6];
57  double* dwork;
58  dwork = new double[1];
59  int ldwork = -1;
60  int info;
61 
62  // call this to estimate workspace
63  sb04od_(&reduce, &trans, &jobd, &M, &N, A.data(), &ldA, B.data(), &ldB, C.data(), &ldC, D.data(), &ldD, E.data(), &ldE, F.data(), &ldF, &scale, &dif, P.data(), &ldP, Q.data(), &ldQ, U.data(), &ldU, V.data(), &ldV, iwork, dwork, &ldwork, &info);
64 
65 
66  ldwork = dwork[0];
67  cout << "ldwork: "<< ldwork << endl;
68  sb04od_(&reduce, &trans, &jobd, &M, &N, A.data(), &ldA, B.data(), &ldB, C.data(), &ldC, D.data(), &ldD, E.data(), &ldE, F.data(), &ldF, &scale, &dif, P.data(), &ldP, Q.data(), &ldQ, U.data(), &ldU, V.data(), &ldV, iwork, dwork, &ldwork, &info);
69 
70 cout << "Scale = " << scale << endl;
71 cout << "A = " << A << endl;
72 cout << "B = " << B << endl;
73 cout << "C = " << C << endl;
74 cout << "E = " << E << endl;
75 cout << "F = " << F << endl;
76 cout << "P = " << P << endl;
77 cout << "Q = " << Q << endl;
78 
79 cout << "First equation: " << A1*C - F*B1 - scale*C1 << endl;
80 cout << "Second equation: " << D1*C - F*E1 - scale * F1 << endl;
81 return 0;
82 }
Definition: sis.hpp:260
void sb04od_(char *REDUCE, char *TRANS, char *JOBD, int *M, int *N, double *A, int *LDA, double *B, int *LDB, double *C, int *LDC, double *D, int *LDD, double *E, int *LDE, double *F, int *LDF, double *SCALE, double *DIF, double *P, int *LDP, double *Q, int *LDQ, double *U, int *LDU, double *V, int *LDV, int *IWORK, double *DWORK, int *LDWORK, int *INFO)
int N
Specifies number of Chebyshev polynomials, default N = 31.
Definition: sis.hpp:472
int main()
Definition: trySlicot.cpp:17
complex< double > Cd_t
Definition: trySlicot.cpp:15