Spectral Integral Suite in C++
Ex_04.cpp
Go to the documentation of this file.
1 
31 #include <fstream>
32 #include <iostream>
33 #include <sis.hpp>
34 
35 using namespace std;
36 typedef complex<double> Cd_t;
37 typedef valarray<double> Vd_t;
38 
39 
40 int main() {
41  using namespace sis;
42  N = 63;
43  sis_setup();
44  ChebfunMat<Cd_t> forc(1,1); // 1 by 1 ChebfunMat
45  Linop<double> D2(2), D1(1), D0(0); // Linops with highest order 2, 1 and 0.
46  Cd_t ii(0.0, 1.0);
47 
48  D2.coef << 1.0, 0.0, 0.0; // for (1.0 * D2 + 0.0 * D1 + (0.0) )v
49  D1.coef << 1.0, 0.0;
50  D0.coef << 1.0;
51 
52  LinopMat<Cd_t> Lmat(2,2);
53  Lmat << D2/4.0 + Vd_t(2*y), 1.0,//
54  sin(2*y), D2/4.0;
55 
56  // Specify boundary conditions using BcMat, 4 bcs on 2 variables:
57  BcMat<Cd_t> bcs(4,2);
58  bcs.L << D0, 0.0,//
59  0.0, D0,//
60  D0, 0.0,//
61  0.0, D0;
62  bcs.eval << -1.0, 0.0,//
63  0.0, -1.0,//
64  1.0, 0.0, //
65  0.0, 1.0;
66 
68 
69  eigs.compute(Lmat, 6, bcs);
70  std::cout << "Eigenvalues: \n" << '\n';
71  std::cout << eigs.eigenvalues << '\n';
72  return 0;
73 }
complex< double > Cd_t
Definition: Ex_04.cpp:36
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)
int main()
Definition: Ex_04.cpp:40
Eigen::Matrix< std::complex< T >, Eigen::Dynamic, 1 > eigenvalues
Definition: sis.hpp:3257
valarray< double > Vd_t
Definition: Ex_04.cpp:37
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_05.cpp:17