Spectral Integral Suite in C++
Ex_05.cpp
Go to the documentation of this file.
1 
12 #include <fstream> // To output data to files
13 #include <iostream>
14 #include <sis.hpp>
15 
16 using namespace std;
17 typedef complex<double> Cd_t;
18 
19 int main() {
20  using namespace sis;
21  N = 63; // sis::N, Defined in sis.hpp. This specifies no. of Chebyshev
22  // coefficients
23  sis_setup();
24 
25  LinopMat<complex<double> > Lmat(1, 1);
26  Linop<double> D2(2), D1(1), D0(0); // Linops with highest order 2, 1 and 0.
27 
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  // for operator D2v - 4 v
33  Lmat << D2 - 4.0 * D0;
34 
35  // Specify boundary conditions via BcMat:
37  2, 1); // Two boundary conditions in total, on one variable
38 
39  bcs.L << D0,//
40  D0;
41  bcs.eval << -1.0, // evaluate bcs.L right end
42  1.0; // evaluate bcs.L at 0.5, must be a value in domain [-1, 1]
43 
45 
46  // Compute first 6 eigenvalues
47  eigs.compute(Lmat, 6, bcs);
48 
49  std::cout << "Eigenvalues: \n" << eigs.eigenvalues << '\n';
50 
51  return 0;
52 }
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
int main()
Definition: Ex_05.cpp:19
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
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
complex< double > Cd_t
Definition: Ex_05.cpp:17