Spectral Integral Suite in C++
sis::Linop< std::complex< T > > Class Template Reference

Overloads the Linop class to complex type. More...

#include <sis.hpp>

Collaboration diagram for sis::Linop< std::complex< T > >:

Public Member Functions

 Linop ()
 A null-constructor for Linop. More...
 
 Linop (const int &n_)
 Makes a Linop by specifying the order n_ of the differential equation. More...
 
 Linop (const Linop< std::complex< T > > &in)
 Copy constructor. More...
 
void operator= (const Linop< std::complex< T > > &in)
 
void operator= (const Linop< T > &in)
 
void operator+= (const Linop< T > &in)
 
Chebfun< std::complex< T > > operator() (Chebfun< std::complex< T > > in)
 Apply the operator on a Chebfun. More...
 
void operator+= (const Linop< std::complex< T > > &in)
 
void operator= (const std::complex< T > &in)
 Assignment operator for constant input. More...
 
void operator= (T in)
 Assignment operator for constant input. More...
 
void operator= (const Eigen::Array< std::complex< T >, Eigen::Dynamic, 1 > &in)
 Assignment operator for function input, through Eigen array. More...
 
void operator= (const std::valarray< T > &in)
 Assignment operator for function input, through valarray. More...
 
void operator= (const std::valarray< std::complex< T > > &in)
 
void operator= (Chebfun< T > in)
 
void operator= (Chebfun< std::complex< T > > in)
 
Linop< std::complex< T > > operator/ (T in)
 Dividing Linop by scalar. More...
 
Linop< std::complex< T > > operator/ (std::complex< T > in)
 Dividing Linop by scalar. More...
 
Linop< std::complex< T > > operator* (T in)
 Multiplying Linop by scalar. More...
 
Linop< std::complex< T > > operator* (std::complex< T > in)
 Multiplying Linop by scalar. More...
 
void set ()
 Sets the the size of coefficient array based on the order of differential equation. Suppose order is 3, then the size of array needed is 4. More...
 
void set (int n_)
 Sets the the size of coefficient array based on the order of differential equation. Suppose order is 3, then the size of array needed is 4. More...
 
void ncc ()
 Sets the the size of non-constant coefficient array based on the order of differential equation. Suppose order is 3, then the size of array needed is 4. This must be called before assigning non-constant coefficients. More...
 
void ncc (int n_)
 Sets the the size of non-constant coefficient array based on the order of differential equation. Suppose order is 3, then the size of array needed is 4. This must be called before assigning non-constant coefficients. More...
 
sis::Linop< T > real ()
 
sis::Linop< T > imag ()
 
Chebfun< std::complex< T > > solve (Chebfun< std::complex< T > > in)
 This function solves the differential equation. See solve for details. More...
 

Public Attributes

int NCC
 Flag to set (value 1) for enabling nonconstant coefficients. More...
 
int n
 
Eigen::Matrix< std::complex< T >, Eigen::Dynamic, 1 > coef
 Stores the coefficients in the differential equation. More...
 
ChebfunMat< std::complex< T > > coefFun
 Use this to input all non-constant coefficients. See coefFun for details. More...
 
Eigen::Matrix< std::complex< T >, Eigen::Dynamic, 1 > solution
 Stores the solution. More...
 

Detailed Description

template<class T>
class sis::Linop< std::complex< T > >

Overloads the Linop class to complex type.

Definition at line 2768 of file sis.hpp.

Constructor & Destructor Documentation

◆ Linop() [1/3]

template<class T >
sis::Linop< std::complex< T > >::Linop ( )
inline

A null-constructor for Linop.

Definition at line 2823 of file sis.hpp.

References sis::Linop< T >::NCC.

◆ Linop() [2/3]

template<class T >
sis::Linop< std::complex< T > >::Linop ( const int &  n_)
inline

Makes a Linop by specifying the order n_ of the differential equation.

Definition at line 2826 of file sis.hpp.

References sis::Linop< T >::coef, sis::Linop< T >::n, and sis::Linop< T >::NCC.

◆ Linop() [3/3]

template<class T >
sis::Linop< std::complex< T > >::Linop ( const Linop< std::complex< T > > &  in)
inline

Member Function Documentation

◆ imag()

template<class T >
sis::Linop<T> sis::Linop< std::complex< T > >::imag ( )
inline

◆ ncc() [1/2]

template<class T >
void sis::Linop< std::complex< T > >::ncc ( )
inline

Sets the the size of non-constant coefficient array based on the order of differential equation. Suppose order is 3, then the size of array needed is 4. This must be called before assigning non-constant coefficients.

Definition at line 3054 of file sis.hpp.

References sis::Linop< T >::coefFun, sis::Linop< T >::n, and sis::Linop< T >::NCC.

◆ ncc() [2/2]

template<class T >
void sis::Linop< std::complex< T > >::ncc ( int  n_)
inline

Sets the the size of non-constant coefficient array based on the order of differential equation. Suppose order is 3, then the size of array needed is 4. This must be called before assigning non-constant coefficients.

Definition at line 3063 of file sis.hpp.

References sis::Linop< T >::coefFun, sis::Linop< T >::n, and sis::Linop< T >::NCC.

◆ operator()()

template<class T >
Chebfun<std::complex<T> > sis::Linop< std::complex< T > >::operator() ( Chebfun< std::complex< T > >  in)
inline

◆ operator*() [1/2]

template<class T >
Linop<std::complex<T> > sis::Linop< std::complex< T > >::operator* ( in)
inline

Multiplying Linop by scalar.

Definition at line 2973 of file sis.hpp.

References sis::Linop< T >::coef, sis::Linop< T >::coefFun, sis::Linop< T >::n, and sis::Linop< T >::NCC.

◆ operator*() [2/2]

template<class T >
Linop<std::complex<T> > sis::Linop< std::complex< T > >::operator* ( std::complex< T >  in)
inline

Multiplying Linop by scalar.

Definition at line 3023 of file sis.hpp.

References sis::Linop< T >::coef, sis::Linop< T >::coefFun, sis::Linop< T >::n, and sis::Linop< T >::NCC.

◆ operator+=() [1/2]

template<class T >
void sis::Linop< std::complex< T > >::operator+= ( const Linop< T > &  in)
inline

Definition at line 2860 of file sis.hpp.

References sis::Linop< T >::operator=().

◆ operator+=() [2/2]

template<class T >
void sis::Linop< std::complex< T > >::operator+= ( const Linop< std::complex< T > > &  in)
inline

Definition at line 2884 of file sis.hpp.

References sis::Linop< T >::operator=().

◆ operator/() [1/2]

template<class T >
Linop<std::complex<T> > sis::Linop< std::complex< T > >::operator/ ( in)
inline

Dividing Linop by scalar.

Definition at line 2947 of file sis.hpp.

References sis::Linop< T >::coef, sis::Linop< T >::coefFun, sis::Linop< T >::n, and sis::Linop< T >::NCC.

◆ operator/() [2/2]

template<class T >
Linop<std::complex<T> > sis::Linop< std::complex< T > >::operator/ ( std::complex< T >  in)
inline

Dividing Linop by scalar.

Definition at line 2960 of file sis.hpp.

References sis::Linop< T >::coef, sis::Linop< T >::coefFun, sis::Linop< T >::n, and sis::Linop< T >::NCC.

◆ operator=() [1/9]

template<class T >
void sis::Linop< std::complex< T > >::operator= ( const Linop< std::complex< T > > &  in)
inline

◆ operator=() [2/9]

template<class T >
void sis::Linop< std::complex< T > >::operator= ( const Linop< T > &  in)
inline

◆ operator=() [3/9]

template<class T >
void sis::Linop< std::complex< T > >::operator= ( const std::complex< T > &  in)
inline

Assignment operator for constant input.

Definition at line 2891 of file sis.hpp.

References sis::Linop< T >::coef, sis::Linop< T >::n, and sis::Linop< T >::NCC.

◆ operator=() [4/9]

template<class T >
void sis::Linop< std::complex< T > >::operator= ( in)
inline

Assignment operator for constant input.

Definition at line 2899 of file sis.hpp.

References sis::Linop< T >::coef, sis::Linop< T >::n, and sis::Linop< T >::NCC.

◆ operator=() [5/9]

template<class T >
void sis::Linop< std::complex< T > >::operator= ( const Eigen::Array< std::complex< T >, Eigen::Dynamic, 1 > &  in)
inline

Assignment operator for function input, through Eigen array.

Definition at line 2907 of file sis.hpp.

References sis::Linop< T >::coefFun, sis::Linop< T >::n, and sis::Linop< T >::ncc().

◆ operator=() [6/9]

template<class T >
void sis::Linop< std::complex< T > >::operator= ( const std::valarray< T > &  in)
inline

Assignment operator for function input, through valarray.

Definition at line 2914 of file sis.hpp.

References sis::Linop< T >::coefFun, sis::Linop< T >::n, and sis::Linop< T >::ncc().

◆ operator=() [7/9]

template<class T >
void sis::Linop< std::complex< T > >::operator= ( const std::valarray< std::complex< T > > &  in)
inline

Definition at line 2920 of file sis.hpp.

References sis::Linop< T >::coefFun, sis::Linop< T >::n, and sis::Linop< T >::ncc().

◆ operator=() [8/9]

template<class T >
void sis::Linop< std::complex< T > >::operator= ( Chebfun< T >  in)
inline

◆ operator=() [9/9]

template<class T >
void sis::Linop< std::complex< T > >::operator= ( Chebfun< std::complex< T > >  in)
inline

Definition at line 2936 of file sis.hpp.

References sis::Linop< T >::operator=(), and SIS_PHYS_SPACE.

◆ real()

template<class T >
sis::Linop<T> sis::Linop< std::complex< T > >::real ( )
inline

◆ set() [1/2]

template<class T >
void sis::Linop< std::complex< T > >::set ( )
inline

Sets the the size of coefficient array based on the order of differential equation. Suppose order is 3, then the size of array needed is 4.

Definition at line 3037 of file sis.hpp.

References sis::Linop< T >::coef, sis::Linop< T >::n, and sis::Linop< T >::NCC.

◆ set() [2/2]

template<class T >
void sis::Linop< std::complex< T > >::set ( int  n_)
inline

Sets the the size of coefficient array based on the order of differential equation. Suppose order is 3, then the size of array needed is 4.

Definition at line 3045 of file sis.hpp.

References sis::Linop< T >::coef, sis::Linop< T >::n, and sis::Linop< T >::NCC.

◆ solve()

template<class T >
Chebfun<std::complex<T> > sis::Linop< std::complex< T > >::solve ( Chebfun< std::complex< T > >  in)
inline

This function solves the differential equation. See solve for details.

Definition at line 3099 of file sis.hpp.

Member Data Documentation

◆ coef

template<class T >
Eigen::Matrix<std::complex<T>, Eigen::Dynamic, 1> sis::Linop< std::complex< T > >::coef

Stores the coefficients in the differential equation.

For instance, for the differential operator \(2i\,\partial_y + 3\), coef \( [0]= 2i\) and coef \([1] = 3\). One can also use the Eigen format to input coefficients:

coef << std::complex<double>(0.0,2.0), std::complex<double>(3,0.0);

Definition at line 2783 of file sis.hpp.

◆ coefFun

template<class T >
ChebfunMat<std::complex<T> > sis::Linop< std::complex< T > >::coefFun

Use this to input all non-constant coefficients. See coefFun for details.

The solution here involves storing the Chebyshev coeefficients of the highest derivative in the differential equation, and also the constants of integration. This can be used to construct all other lower derivatives using integration.

First N+1 elements of sol hold the Chebyshev coefficients and the remaining elements store the integration constantsAdditional details are as follows. Although C++ is type specific, coefFun allows inputs to be real, by assuming that the imaginary part is zero. in addition to what is written in coefFun, consider the following operator: \(2i\partial_{yy}u(y) \,+\, 4\partial_yu(y)\,+\,y^2u(y)\), then the following code can be used to input the nonconstant coefficients:

int main(){
typedef std::complex<double> dc;
Linop<dc> L(2); // Linop of 2nd order.
Eigen::ArrayXd y;
L.ncc();
dc ii = dc(0.0,1);
L.coefFun << 2.0*ii, 4.0, pow(y,2.0);
return 0;
}

Note that in the above input to coefFun has mixed types, like double and complex<double>. This feature is allowed only coefFun. For coef, one has to be type specific, that is all inputs have to be complex<double> type, or double type, depending on what template is used to intiate the Linop.

Definition at line 2818 of file sis.hpp.

◆ n

template<class T >
int sis::Linop< std::complex< T > >::n

the order of the equation

Definition at line 2774 of file sis.hpp.

◆ NCC

template<class T >
int sis::Linop< std::complex< T > >::NCC

Flag to set (value 1) for enabling nonconstant coefficients.

Definition at line 2773 of file sis.hpp.

◆ solution

template<class T >
Eigen::Matrix<std::complex<T>, Eigen::Dynamic, 1> sis::Linop< std::complex< T > >::solution

Stores the solution.

Definition at line 2820 of file sis.hpp.


The documentation for this class was generated from the following file: