oILAB
Loading...
Searching...
No Matches
Function.h
Go to the documentation of this file.
1//
2// Created by Nikhil Chandra Admal on 7/9/23.
3//
4
5#ifndef OILAB_POLYNOMIAL_H
6#define OILAB_POLYNOMIAL_H
7
8#include <deque>
9#include <cmath>
10#include "Eigen/Dense"
11#include "unsupported/Eigen/CXX11/Tensor"
12#include <array>
13
14namespace oILAB {
15
16template <typename Scalar, int dim> class LatticeFunction;
17
18template <typename Scalar, int dim> class PeriodicFunction;
19
20template <typename Derived, typename Scalar> class Function {
21 using dcomplex = std::complex<double>;
22
23private:
24 const Derived &derivedFunction;
25
26public:
27 double domainSize;
28 explicit Function(
29 double _domainSize = std::numeric_limits<double>::infinity());
30 Scalar operator()(const Eigen::Vector<double, Eigen::Dynamic> &vec) const;
31
32 /*
33 template<int dim>
34 LatticeFunction<dcomplex,dim> fft(const std::array<Eigen::Index,dim>& n, const
35 Eigen::Matrix<double,Eigen::Dynamic,dim>& basisVectors) const;
36 */
37 };
38
39 /* ******************************************** */
40 class Exponential : public Function<Exponential,std::complex<double>>
41 {
42 private:
43 const Eigen::Vector<double,Eigen::Dynamic>& x;
44 public:
45 explicit Exponential(const Eigen::Vector<double,Eigen::Dynamic>& _x);
46 std::complex<double> operator()(const Eigen::Vector<double,Eigen::Dynamic>& vec) const;
47 };
48
49 /* ******************************************** */
50 // it is a 2d scalar function that takes 3d input
51 template<typename T, typename Scalar>
52 class Shift : public Function<Shift<T,Scalar>, Scalar>
53 {
54 public:
56 Eigen::Vector<double,Eigen::Dynamic> t;
57 Shift(const Eigen::Vector<double,Eigen::Dynamic>& t, const Function<T,Scalar>& fun);
58 Scalar operator()(const Eigen::Vector<double,Eigen::Dynamic>& y) const;
59 };
60 } // namespace oILAB
61
63#endif //OILAB_POLYNOMIAL_H
std::complex< double > operator()(const Eigen::Vector< double, Eigen::Dynamic > &vec) const
const Eigen::Vector< double, Eigen::Dynamic > & x
Definition Function.h:43
Scalar operator()(const Eigen::Vector< double, Eigen::Dynamic > &vec) const
std::complex< double > dcomplex
Definition Function.h:21
const Derived & derivedFunction
Definition Function.h:24
double domainSize
Definition Function.h:27
const Function< T, Scalar > & fun
Definition Function.h:55
Scalar operator()(const Eigen::Vector< double, Eigen::Dynamic > &y) const
Eigen::Vector< double, Eigen::Dynamic > t
Definition Function.h:56