\doxysubsection{Cheby\+Interp\+Table\texorpdfstring{$<$}{<} N, TIN, TOUT, GT \texorpdfstring{$>$}{>} Class Template Reference}
\hypertarget{classfunc_1_1ChebyInterpTable}{}\label{classfunc_1_1ChebyInterpTable}\index{ChebyInterpTable$<$ N, TIN, TOUT, GT $>$@{ChebyInterpTable$<$ N, TIN, TOUT, GT $>$}}


LUT using degree 1 to 7 polynomial interpolation over Chebyshev nodes on each subinterval.  




{\ttfamily \#include $<$Cheby\+Interp\+Table.\+hpp$>$}

Inheritance diagram for Cheby\+Interp\+Table\texorpdfstring{$<$}{<} N, TIN, TOUT, GT \texorpdfstring{$>$}{>}\+:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[height=3.000000cm]{classfunc_1_1ChebyInterpTable}
\end{center}
\end{figure}
\doxysubsubsubsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\Hypertarget{classfunc_1_1ChebyInterpTable_a66a3661f6523807338d137f421c3b6de}\label{classfunc_1_1ChebyInterpTable_a66a3661f6523807338d137f421c3b6de} 
{\bfseries Cheby\+Interp\+Table} (const \mbox{\hyperlink{classfunc_1_1MetaTable}{Meta\+Table}}$<$ N+1, TIN, TOUT, GT $>$ \&L)
\item 
\Hypertarget{classfunc_1_1ChebyInterpTable_a87181191eae371ce41255f1a1ce4ea80}\label{classfunc_1_1ChebyInterpTable_a87181191eae371ce41255f1a1ce4ea80} 
{\bfseries Cheby\+Interp\+Table} (const \mbox{\hyperlink{classfunc_1_1FunctionContainer}{Function\+Container}}$<$ TIN, TOUT $>$ \&func\+\_\+container, const \mbox{\hyperlink{structfunc_1_1LookupTableParameters}{Lookup\+Table\+Parameters}}$<$ TIN $>$ \&par, const nlohmann\+::json \&json\+Stats=nlohmann\+::json())
\end{DoxyCompactItemize}
\doxyparagraph*{Public Member Functions inherited from \mbox{\hyperlink{classfunc_1_1MetaTable}{Meta\+Table$<$ N+1, TIN, TIN, Grid\+Types\+::\+UNIFORM $>$}}}
\begin{DoxyCompactItemize}
\item 
\mbox{\hyperlink{classfunc_1_1MetaTable_a4b85e9ba4451023fa921e2be31acfbc1}{Meta\+Table}} ()=default
\item 
\mbox{\hyperlink{classfunc_1_1MetaTable}{Meta\+Table}}$<$ N, TIN, TIN, GT $>$ \& \mbox{\hyperlink{classfunc_1_1MetaTable_a097a4e8415badeb0468a7b432e3d2741}{operator=}} (\mbox{\hyperlink{classfunc_1_1MetaTable}{Meta\+Table}}$<$ N, TIN, TIN, GT $>$ L)
\item 
std\+::string \mbox{\hyperlink{classfunc_1_1MetaTable_accba19b44801ed79bb97513319885f31}{name}} () const final
\item 
TIN \mbox{\hyperlink{classfunc_1_1MetaTable_a0476b531891a0e1e33696d1a737661d0}{min\+\_\+arg}} () const final
\item 
TIN \mbox{\hyperlink{classfunc_1_1MetaTable_a546555a620601a06a71c12a15f7a2769}{max\+\_\+arg}} () const final
\item 
TIN {\bfseries tablemax\+\_\+arg} () const
\item 
unsigned int \mbox{\hyperlink{classfunc_1_1MetaTable_a001c4e4c752e91195b970be3edee0b6d}{order}} () const final
\item 
std\+::size\+\_\+t \mbox{\hyperlink{classfunc_1_1MetaTable_a5e82e200bee26238c342218d6d4f7042}{size}} () const final
\item 
unsigned int \mbox{\hyperlink{classfunc_1_1MetaTable_a269a97d89895944456f32f2be1d37109}{num\+\_\+subintervals}} () const final
\item 
TIN \mbox{\hyperlink{classfunc_1_1MetaTable_a0b483cc80497aa809bead8161f14a284}{step\+\_\+size}} () const final
\item 
std\+::pair$<$ TIN, TIN $>$ \mbox{\hyperlink{classfunc_1_1MetaTable_aea8465ad30b6260a0948d4305d984d9d}{bounds\+\_\+of\+\_\+subinterval}} (unsigned int interval\+Number) const final
\item 
void \mbox{\hyperlink{classfunc_1_1MetaTable_a16138bbe5fe761854a353362ba7d9b2f}{print\+\_\+json}} (std\+::ostream \&out) const final
\item 
unsigned int {\bfseries num\+\_\+table\+\_\+entries} () const
\item 
unsigned int {\bfseries ncoefs\+\_\+per\+\_\+entry} () const
\item 
TIN {\bfseries table\+\_\+entry} (unsigned int i, unsigned int j) const
\item 
std\+::array$<$ TIN, 4 $>$ {\bfseries transfer\+\_\+function\+\_\+coefs} () const
\item 
\mbox{\hyperlink{classfunc_1_1MetaTable}{Meta\+Table}}$<$ N, TIN, TIN, GT $>$ \& \mbox{\hyperlink{classfunc_1_1MetaTable_a9b1baea31c64bd1a64a89343eb41f909}{operator+=}} (const \mbox{\hyperlink{classfunc_1_1MetaTable}{Meta\+Table}}$<$ N, TIN, TIN, GT $>$ \&other)
\item 
\mbox{\hyperlink{classfunc_1_1MetaTable}{Meta\+Table}}$<$ N, TIN, TIN, GT $>$ \& {\bfseries operator-\/=} (const \mbox{\hyperlink{classfunc_1_1MetaTable}{Meta\+Table}}$<$ N, TIN, TIN, GT $>$ \&other)
\item 
\mbox{\hyperlink{classfunc_1_1MetaTable}{Meta\+Table}}$<$ N, TIN, TIN, GT $>$ \& {\bfseries operator\texorpdfstring{$\ast$}{*}=} (const TIN \&a)
\item 
\mbox{\hyperlink{classfunc_1_1MetaTable}{Meta\+Table}}$<$ N, TIN, TIN, GT $>$ \& {\bfseries operator/=} (const TIN \&a)
\item 
std\+::pair$<$ unsigned int, TIN $>$ \mbox{\hyperlink{classfunc_1_1MetaTable_aea0019b0ae25e0e8d8530ebc28002cf1}{hash}} (TIN x) const
\item 
TIN \mbox{\hyperlink{classfunc_1_1MetaTable_a19a1de294ffbb53d7d95c3044b220d1c}{operator()}} (TIN x) const override
\item 
TIN \mbox{\hyperlink{classfunc_1_1MetaTable_ad6406f15f1b656dcde38acd434d0d3ce}{diff}} (unsigned int s, TIN x) const
\begin{DoxyCompactList}\small\item\em Return the $s$th derivative of $L$ at $x$\+: ie return $p_k^{(s)}(x)$. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxyparagraph*{Public Member Functions inherited from \mbox{\hyperlink{classfunc_1_1LookupTable}{Lookup\+Table$<$ TIN, TIN $>$}}}
\begin{DoxyCompactItemize}
\item 
\mbox{\hyperlink{classfunc_1_1LookupTable_acd94ebee613378fb31e86a83d34eaf4c}{Lookup\+Table}} ()=default
\end{DoxyCompactItemize}
\doxysubsubsubsection*{Additional Inherited Members}
\doxyparagraph*{Public Types inherited from \mbox{\hyperlink{classfunc_1_1LookupTable}{Lookup\+Table$<$ TIN, TIN $>$}}}
\begin{DoxyCompactItemize}
\item 
using {\bfseries input\+\_\+type}
\item 
using {\bfseries output\+\_\+type}
\end{DoxyCompactItemize}
\doxyparagraph*{Protected Member Functions inherited from \mbox{\hyperlink{classfunc_1_1MetaTable}{Meta\+Table$<$ N+1, TIN, TIN, Grid\+Types\+::\+UNIFORM $>$}}}
\begin{DoxyCompactItemize}
\item 
void \mbox{\hyperlink{classfunc_1_1MetaTable_a06026ce7da697d94db6418e29fb1ef87}{swap}} (\mbox{\hyperlink{classfunc_1_1MetaTable}{Meta\+Table}}$<$ N, TIN, TIN, GT $>$ \&L) noexcept
\begin{DoxyCompactList}\small\item\em Copy-\/swap pattern, necessary for {\ttfamily operator=} \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxyparagraph*{Protected Attributes inherited from \mbox{\hyperlink{classfunc_1_1MetaTable}{Meta\+Table$<$ N+1, TIN, TIN, Grid\+Types\+::\+UNIFORM $>$}}}
\begin{DoxyCompactItemize}
\item 
std\+::string {\bfseries m\+\_\+name}
\begin{DoxyCompactList}\small\item\em name of implementation type \end{DoxyCompactList}\item 
TIN {\bfseries m\+\_\+min\+Arg}
\item 
TIN {\bfseries m\+\_\+max\+Arg}
\begin{DoxyCompactList}\small\item\em bounds of evaluation \end{DoxyCompactList}\item 
TIN {\bfseries m\+\_\+step\+Size}
\item 
TIN {\bfseries m\+\_\+step\+Size\+\_\+inv}
\begin{DoxyCompactList}\small\item\em fixed grid spacing (and its inverse) \end{DoxyCompactList}\item 
TIN {\bfseries m\+\_\+table\+Max\+Arg}
\begin{DoxyCompactList}\small\item\em \texorpdfstring{$>$}{>} m\+\_\+max\+Arg if (m\+\_\+max\+Arg-\/m\+\_\+min\+Arg)/m\+\_\+step\+Size is non-\/integer \end{DoxyCompactList}\item 
unsigned int {\bfseries m\+\_\+order}
\begin{DoxyCompactList}\small\item\em order of accuracy of implementation \end{DoxyCompactList}\item 
std\+::size\+\_\+t {\bfseries m\+\_\+data\+Size}
\begin{DoxyCompactList}\small\item\em size of relevant data for impl evaluation \end{DoxyCompactList}\item 
unsigned int {\bfseries m\+\_\+num\+Intervals}
\begin{DoxyCompactList}\small\item\em = (m\+\_\+table\+Max\+Arg -\/ m\+\_\+min\+Arg)/m\+\_\+step\+Size; \end{DoxyCompactList}\item 
unsigned int {\bfseries m\+\_\+num\+Table\+Entries}
\begin{DoxyCompactList}\small\item\em length of m\+\_\+table (usually = m\+\_\+num\+Intervals + 1) \end{DoxyCompactList}\item 
\+\_\+\+\_\+attribute\+\_\+\+\_\+((aligned)) std \mbox{\hyperlink{classfunc_1_1TransferFunction}{Transfer\+Function}}$<$ TIN $>$ \mbox{\hyperlink{classfunc_1_1MetaTable_aa1f66ead8e037b26b9e72a47dd7d7c3f}{m\+\_\+transfer\+Function}}
\begin{DoxyCompactList}\small\item\em \texorpdfstring{$<$}{<} holds polynomials coefficients \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsubsection{Detailed Description}
\subsubsection*{template$<$unsigned int N, typename TIN, typename TOUT = TIN, Grid\+Types GT = Grid\+Types\+::\+UNIFORM$>$\newline
class func\+::\+Cheby\+Interp\+Table$<$ N, TIN, TOUT, GT $>$}
LUT using degree 1 to 7 polynomial interpolation over Chebyshev nodes on each subinterval. 

Chebyshev nodes are a partition of the interval $[a,b]$ such that \[ t_s = (a+b)/2 + (b-a)\cos\left(\frac{2s-1}{2n}\pi\right)/2, \quad s=1,...,n. \]

Example usage 
\begin{DoxyCode}{0}
\DoxyCodeLine{\textcolor{comment}{//\ return\ x\string^9}}
\DoxyCodeLine{\textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{T\ foo(T\ x)\{\ \textcolor{keywordflow}{return}\ (x*x*x)*(x*x*x)*(x*x*x);\ \}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keywordtype}{int}\ main()\{}
\DoxyCodeLine{\ \ \textcolor{keyword}{auto}\ min\ =\ -\/1.0;\ \textcolor{keyword}{auto}\ max\ =\ 1.0;\ \textcolor{keyword}{auto}\ step\ =\ 0.001;}
\DoxyCodeLine{\ \ UniformChebyInterpTable<1,double>\ L1(\{\mbox{\hyperlink{FunctionContainer_8hpp_af3f31bcf88f2eb106cc78940a7282fd2}{FUNC\_SET\_F}}(foo,\textcolor{keywordtype}{double})\},\ \{min,\ max,\ step\});\ \textcolor{comment}{//\ degree\ 1}}
\DoxyCodeLine{\ \ UniformChebyInterpTable<2,double>\ L2(\{\mbox{\hyperlink{FunctionContainer_8hpp_af3f31bcf88f2eb106cc78940a7282fd2}{FUNC\_SET\_F}}(foo,\textcolor{keywordtype}{double})\},\ \{min,\ max,\ step\});\ \textcolor{comment}{//\ degree\ 2}}
\DoxyCodeLine{\ \ UniformChebyInterpTable<3,double>\ L3(\{\mbox{\hyperlink{FunctionContainer_8hpp_af3f31bcf88f2eb106cc78940a7282fd2}{FUNC\_SET\_F}}(foo,\textcolor{keywordtype}{double})\},\ \{min,\ max,\ step\});}
\DoxyCodeLine{\ \ UniformChebyInterpTable<4,double>\ L4(\{\mbox{\hyperlink{FunctionContainer_8hpp_af3f31bcf88f2eb106cc78940a7282fd2}{FUNC\_SET\_F}}(foo,\textcolor{keywordtype}{double})\},\ \{min,\ max,\ step\});}
\DoxyCodeLine{\ \ UniformChebyInterpTable<5,double>\ L5(\{\mbox{\hyperlink{FunctionContainer_8hpp_af3f31bcf88f2eb106cc78940a7282fd2}{FUNC\_SET\_F}}(foo,\textcolor{keywordtype}{double})\},\ \{min,\ max,\ step\});}
\DoxyCodeLine{\ \ UniformChebyInterpTable<6,double>\ L6(\{\mbox{\hyperlink{FunctionContainer_8hpp_af3f31bcf88f2eb106cc78940a7282fd2}{FUNC\_SET\_F}}(foo,\textcolor{keywordtype}{double})\},\ \{min,\ max,\ step\});}
\DoxyCodeLine{\ \ UniformChebyInterpTable<7,double>\ L7(\{\mbox{\hyperlink{FunctionContainer_8hpp_af3f31bcf88f2eb106cc78940a7282fd2}{FUNC\_SET\_F}}(foo,\textcolor{keywordtype}{double})\},\ \{min,\ max,\ step\});}
\DoxyCodeLine{\ \ \textcolor{comment}{//\ similar\ for\ nonuniform\ case:}}
\DoxyCodeLine{\ \ NonUniformChebyInterpTable<1,double>\ L7(\{\mbox{\hyperlink{FunctionContainer_8hpp_af3f31bcf88f2eb106cc78940a7282fd2}{FUNC\_SET\_F}}(foo,\textcolor{keywordtype}{double})\},\ \{min,\ max,\ step\});\ \textcolor{comment}{//\ deg\ 1\ nonuniform}}
\DoxyCodeLine{\ \ NonUniformChebyInterpTable<4,double>\ L7(\{\mbox{\hyperlink{FunctionContainer_8hpp_af3f31bcf88f2eb106cc78940a7282fd2}{FUNC\_SET\_F}}(foo,\textcolor{keywordtype}{double})\},\ \{min,\ max,\ step\});}
\DoxyCodeLine{\ \ \textcolor{keywordtype}{double}\ val\ =\ look(0.87354);}
\DoxyCodeLine{\ \ \textcolor{comment}{//\ The\ following\ preserves\ the\ root\ of\ \$f\$\ at\ \$x=0\$.}}
\DoxyCodeLine{\ \ UniformChebyInterpTable<2,double>\ L2(\{\mbox{\hyperlink{FunctionContainer_8hpp_af3f31bcf88f2eb106cc78940a7282fd2}{FUNC\_SET\_F}}(foo,\textcolor{keywordtype}{double})\},\ \{min,\ max,\ step,\ \{\{0,\ 0,\ 0.0\}\}\};}
\DoxyCodeLine{\}}

\end{DoxyCode}


\begin{DoxyNote}{Note}
The template implementation is only registered in the factory for $N=1,2,3,4,5,6,7$ but users could construct this class with larger $N$ if they wish. We make no promises on convergence/error in this case. 

Cheby\+Table only works if we can cast both TOUT and TIN to double. This requirement exists because Armadillo {\ttfamily Mat\texorpdfstring{$<$}{<}T\texorpdfstring{$>$}{>}}\textquotesingle{}s {\ttfamily is\+\_\+supported\+\_\+elem\+\_\+type\texorpdfstring{$<$}{<}T\texorpdfstring{$>$}{>}} will only let us do arithmetic with float or double (not even long double!). You might think "{}generic types   is what arma\+::field is made for"{} but I can\textquotesingle{}t get that class to work for our purposes. 

This is currently the only Lookup\+Table\+Implementation using the special\+\_\+points field in \doxylink{structfunc_1_1LookupTableParameters}{Lookup\+Table\+Parameters} -- a vector of 3-\/tuples\+: \[{(x_1,s_1,f^{(s_1)}(x_1)),...,(x_n,s_n,f^{(s_n)}(x_n))}.\] Then, Chebyshev nodes are replaced with the nearest nodes ${x_k}$ in this list, and $f$ (or its derivate) is exact at those nodes. Doing this can reduce the relative error in $f$ and/or its derivatives. 
\end{DoxyNote}
\begin{DoxyWarning}{Warning}
Attempting to make $f$\textquotesingle{}s derivatives exact at some given special points can result in a singular Vandermonde matrix. We don\textquotesingle{}t have a way to handle this issue at the moment. 
\end{DoxyWarning}


The documentation for this class was generated from the following file\+:\begin{DoxyCompactItemize}
\item 
Cheby\+Interp\+Table.\+hpp\end{DoxyCompactItemize}
