Spectral Integral Suite in C++
Ex_07.cpp
Go to the documentation of this file.
1 
39 #include <fstream> // To output data to files
40 #include <iostream>
41 #include <sis.hpp>
42 
43 using namespace std;
44 
45 typedef complex<double> Cd_t;
46 typedef valarray<double> Vd_t;
47 
48 int main() {
49  using namespace sis;
50  N = 63; // sis::N, Defined in sis.hpp. This specifies no. of Chebyshev
51  // coefficients
52  sis_setup();
53  ChebfunMat<complex<double> > forc(1,1);
54 
55  Linop<double> D0(0), D1(1), D2(2), D3(3), D4(4);
56  D4.coef << 1.0, 0.0, 0.0, 0.0, 0.0;
57  D3.coef << 1.0, 0.0, 0.0, 0.0;
58  D2.coef << 1.0, 0.0, 0.0; // for (1.0 * D2 + 0.0 * D1 + (0.0) )v
59  D1.coef << 1.0, 0.0;
60  D0.coef << 1.0;
61 
62  LinopMat<Cd_t> Lmat(2,2), Mmat(2,2);
63  Lmat << D4/16.0 + Vd_t(2.0*y), 1.0,//
64  sin(2.0*y), D2/4.0;
65 
66  Mmat << D2/4.0 , 0.0,//
67  0.0, 1.0;
68  BcMat<Cd_t> bcs(6,2);
69  bcs.L << D0, 0.0,//
70  D1, 0.0, //
71  D0, 0.0,//
72  D1, 0.0,//
73  0.0, D0,//
74  0.0, D0;
75  bcs.eval << -1.0, 0.0,//
76  -1.0, 0.0,//
77  1.0, 0.0,//
78  1.0, 0.0,//
79  0.0, 1.0,//
80  0.0, -1.0;
81 
83 
84  eigs.compute(Lmat, Mmat, 6, bcs);
85  std::cout << "Eigenvalues: \n" << '\n';
86  std::cout << eigs.eigenvalues << '\n';
87  return 0;
88 }
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
valarray< double > Vd_t
Definition: Ex_07.cpp:46
Eigen::Matrix< std::complex< T >, Eigen::Dynamic, 1 > eigenvalues
Definition: sis.hpp:3257
int main()
Definition: Ex_07.cpp:48
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
LinopMat< T > L
Definition: sis.hpp:8831
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 N
Specifies number of Chebyshev polynomials, default N = 31.
Definition: sis.hpp:472
This class will solve the generalized eigenvalue problem for two linear operators. One of them can be singular.
Definition: sis.hpp:3253
std::valarray< SIS_TYPE > y(N+1)
This class holds a matrix of Chebfuns.
Definition: sis.hpp:2004
complex< double > Cd_t
Definition: Ex_07.cpp:45