20#include "../Utils_Fill.h"
28 cout <<
"=== EVP: Harmonic equation solved using LAPACK =====\n";
29 cout <<
"=== with a manually assembled matrix problem.\n";
33 cout <<
" Number of nodal points : Leading eigenvalue error : Total CPU time taken (ms) \n";
39 for (
int i = 2; i < 11; ++i )
41 N = ( size_t ) ( std::pow( 2., i ) );
42 const double delta = 1. / ( N - 1 );
43 const double delta2 = delta * delta;
54 a( N - 1, N - 1 ) = 1.0;
55 a( N - 1, N - 2 ) = 0.0;
62 b( N - 1, N - 1 ) = 0.0;
74 catch (
const std::runtime_error &error )
76 cout <<
" \033[1;31;48m * FAILED THROUGH EXCEPTION BEING RAISED \033[0m\n";
82 cout <<
" " << N <<
" : " << lambdas[ 0 ].real() - M_PI * M_PI
83 <<
" : " << timer.
get_time() <<
"\n";
87 const double tol = 1.e-4;
88 if ( abs( lambdas[ 0 ].real() - M_PI * M_PI ) > tol )
93 cout <<
"\033[1;31;48m * FAILED \033[0m\n";
94 cout <<
" Final error = " << abs( lambdas[ 0 ].real() - M_PI * M_PI ) <<
"\n";
98 cout <<
"\033[1;32;48m * PASSED \033[0m\n";
A shorter bundled include file for ODE_EVP and general eigenvalue problems.
A spec for a collection of utility functions.
A linear Nth-order generalised eigensystem class.
void tag_eigenvalues_disc(const int &val, const double &radius)
Tag those eigenvalues that are within a disc centred at a point in the complex plane.
DenseVector< D_complex > get_tagged_eigenvalues() const
Get the the tagged eigenvalues.
void eigensolve()
Solve the matrix linear eigensystem.
DenseMatrix< D_complex > get_tagged_eigenvectors() const
Get the the tagged eigenvectors.
A matrix class that constructs a DENSE matrix as a row major std::vector of DenseVectors.
void scale(const _Type &mult)
Scale all matrix elements by a scalar.
An DenseVector class – a dense vector object.
void set_calc_eigenvectors(bool flag)
Compute the eigenvectors in any eigenvalue computation.
A simple CPU-clock-tick timer for timing metods.
double get_time() const
Return the time.
void start()
Start the timer & reset stored time to zero.
void stop()
Stop the clock & add the current time interval to the previously stored values ready for printing.
A collection of OO numerical routines aimed at simple (typical) applied problems in continuum mechani...
void fill_identity(CppNoddy::Sequential_Matrix_base< _Type > &A)
Fill diagonal with unit values.
void fill_band(CppNoddy::Sequential_Matrix_base< _Type > &A, const int &offset, const _Type &value)
Fill a diagonal band of a matrix.