Spectral Integral Suite in C++
Ex_06.cpp
Go to the documentation of this file.
1 #include <fstream> // To output data to files
10 #include <iostream>
11 #include <sis.hpp>
12 
13 using namespace std;
14 
15 typedef complex<double> Cd_t;
16 typedef valarray<double> Vd_t;
17 
18 int main() {
19  using namespace sis;
20  N = 63; // sis::N, Defined in sis.hpp. This specifies no. of Chebyshev
21  // coefficients
22  sis_setup();
23  ChebfunMat<complex<double> > forc(1,1);
24 
25  Linop<double> D0(0), D1(1), D2(2), D3(3), D4(4);
26  D4.coef << 1.0, 0.0, 0.0, 0.0, 0.0;
27  D3.coef << 1.0, 0.0, 0.0, 0.0;
28  D2.coef << 1.0, 0.0, 0.0; // for (1.0 * D2 + 0.0 * D1 + (0.0) )v
29  D1.coef << 1.0, 0.0;
30  D0.coef << 1.0;
31 
32  LinopMat<Cd_t> Lmat(1,1), Mmat(1,1);
33  Lmat << D4 - (8.0 * D2) + (16.0 * D0);
34  Mmat << D2 - (4.0 * D0);
35  BcMat<Cd_t> bcs(4,1);
36  bcs.L << D0,//
37  D2,//
38  D0,//
39  D2;
40  bcs.eval << -1.0,//
41  -1.0,//
42  1.0,//
43  1.0;
44 
46 
47  eigs.compute(Lmat, Mmat, 6, bcs);
48  std::cout << "Eigenvalues: \n" << '\n';
49  std::cout << eigs.eigenvalues << '\n';
50  return 0;
51 }
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
Linop This class creates a Linear operator to solve TPBVPs.
Definition: sis.hpp:2560
Definition: sis.hpp:260
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
Eigen::Matrix< T, Eigen::Dynamic, 1 > coef
Stores the coefficients in the differential equation.
Definition: sis.hpp:2569
void compute(Linop< T > L, Linop< T > M, int num_vals)
Call this with an input Linear operator to solve for eigenvalues and vectors. The number of Eigen val...
Definition: sis.hpp:3267
int main()
Definition: Ex_06.cpp:18
int N
Specifies number of Chebyshev polynomials, default N = 31.
Definition: sis.hpp:472
valarray< double > Vd_t
Definition: Ex_06.cpp:16
This class will solve the generalized eigenvalue problem for two linear operators. One of them can be singular.
Definition: sis.hpp:3253
This class holds a matrix of Chebfuns.
Definition: sis.hpp:2004
complex< double > Cd_t
Definition: Ex_06.cpp:15