Spectral Integral Suite in C++
Ex_10.cpp
Go to the documentation of this file.
1 #define SIS_USE_LAPACK
16 #include <fstream> // To output data to files
17 #include <iostream>
18 #include <sis.hpp>
19 
20 using namespace std;
21 typedef complex<double> Cd_t;
22 
23 int main() {
24  using namespace sis;
25  N = 63; // sis::N, Defined in sis.hpp. This specifies no. of Chebyshev
26  // coefficients
27  sis_setup();
28 
29  LinopMat<Cd_t> Lmat(1, 1), Mmat(1,1);
30  Linop<double> D2(2), D1(1), D0(0); // Linops with highest order 2, 1 and 0.
31  Cd_t ii(0.0,1.0);
32 
33  D2.coef << 1.0, 0.0, 0.0; // for (1.0 * D2 + 0.0 * D1 + (0.0) )v
34  D1.coef << 1.0, 0.0;
35  D0.coef << 1.0;
36 
37 
38 
39 
40  // for operator D2v - 4 v
41  Lmat << D2 - 0.0001 * D0;
42  Mmat << 1.0;
43 
44  double omega = 0.0;
45  // Specify boundary conditions via BcMat, lbc and rbc separately:
46  BcMat<Cd_t> lbcs(1, 1), rbcs(1,1);
47 
48  lbcs.L << D1;
49  rbcs.L << D1;
50  lbcs.eval << -1.0, // evaluate bcs.L right end
51  rbcs.eval << 1.0; // evaluate bcs.L at 0.5, must be a value in domain [-1, 1]
52 
54 
55  LinopMat<Cd_t> A(1,1), B(1,1), C(1,1);
56  A = (ii*omega*Mmat) - Lmat;
57  B(0,0) = 1.0;
58  C(0,0) = 1.0;
59  // Compute first 12 singular values
60  svds.compute(A, B, C, lbcs, rbcs, 12);
61 
62  cout << "Singular Values: \n" << svds.eigenvalues << '\n';
63  cout << "Power Spectral Density: \n" << svds.PowerSpectralDensity(A,B,C,lbcs,rbcs) << '\n';
64  // cout << "H infinity norm: \n" << svds.HinfNorm() << "\n";
65  return 0;
66 }
void sis_setup()
Definition: sis.hpp:954
BcMat will hold general Boundary conditions as LinopMats at evealuation points, as given by operator ...
Definition: sis.hpp:529
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > eval
Definition: sis.hpp:8832
Linop This class creates a Linear operator to solve TPBVPs.
Definition: sis.hpp:2560
Definition: sis.hpp:260
complex< double > ii(0.0, 1.0)
Eigen::Matrix< std::complex< T >, Eigen::Dynamic, 1 > eigenvalues
Definition: sis.hpp:3257
This class represents a block matrix operator. It is a matrix of operators.
Definition: sis.hpp:528
Definition: sis.hpp:461
void compute(const LinopMat< T > &A_, const BcMat< T > &Lbc_, const BcMat< T > &Rbc_, int num_vals)
Computes the singular values/functions of a Linear block matrix operator.
Definition: sis.hpp:9139
Eigen::Matrix< T, Eigen::Dynamic, 1 > coef
Stores the coefficients in the differential equation.
Definition: sis.hpp:2569
LinopMat< T > L
Definition: sis.hpp:8831
int main()
Definition: Ex_10.cpp:23
This class computes various SingularValues of a differential block matrix operator using using it&#39;s a...
Definition: sis.hpp:531
int N
Specifies number of Chebyshev polynomials, default N = 31.
Definition: sis.hpp:472
complex< double > Cd_t
Definition: Ex_10.cpp:21
complex< double > Cd_t
Definition: Ex_05.cpp:17