TBTK
Need a break? Support the development by playing Polarity Puzzles
PadeApproximator.h
1 /* Copyright 2018 Kristofer Björnson
2  *
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
17 
24 #ifndef COM_DAFER45_TBTK_PADE_APPROXIMATOR
25 #define COM_DAFER45_TBTK_PADE_APPROXIMATOR
26 
27 #include "TBTK/Polynomial.h"
28 #include "TBTK/TBTKMacros.h"
29 
30 #include <complex>
31 #include <vector>
32 
33 namespace TBTK{
34 
35 class PadeApproximator{
36 public:
40  void setNumeratorDegree(unsigned int numeratorDegree);
41 
45  void setDenominatorDegree(unsigned int denominatorDegree);
46 
54  std::vector<
55  Polynomial<std::complex<double>, std::complex<double>, int>
56  > approximate(
57  const std::vector<std::complex<double>> &values,
58  const std::vector<std::complex<double>> &arguments
59  );
60 private:
62  unsigned int numeratorDegree;
63 
65  unsigned int denominatorDegree;
66 
68  void executeLeastSquare(
69  std::complex<double> *matrix,
70  std::complex<double> *vector,
71  unsigned int numRows,
72  unsigned int numColumns
73  );
74 };
75 
76 inline void PadeApproximator::setNumeratorDegree(unsigned int numeratorDegree){
77  this->numeratorDegree = numeratorDegree;
78 }
79 
80 inline void PadeApproximator::setDenominatorDegree(
81  unsigned int denominatorDegree
82 ){
83  this->denominatorDegree = denominatorDegree;
84 }
85 
86 }; //End of namespace TBTK
87 
88 #endif
89 
Precompiler macros.
Definition: Boolean.h:32