\doxysubsection{Lookup\+Table\+Generator\texorpdfstring{$<$}{<} TIN, TOUT, TERR \texorpdfstring{$>$}{>} Class Template Reference}
\hypertarget{classfunc_1_1LookupTableGenerator}{}\label{classfunc_1_1LookupTableGenerator}\index{LookupTableGenerator$<$ TIN, TOUT, TERR $>$@{LookupTableGenerator$<$ TIN, TOUT, TERR $>$}}


Generate a FunC \doxylink{classfunc_1_1LookupTable}{Lookup\+Table} from a given name and one of the following\+: stepsize, tolerance, memory size limit, or filename with generate\+\_\+by\+\_\+step, generate\+\_\+by\+\_\+tol, generate\+\_\+by\+\_\+impl\+\_\+size, and generate\+\_\+by\+\_\+file respectively. This class is also equipped to compute the error in a LUT built with any given stepsize and plot a LUT against its exact function.  




{\ttfamily \#include $<$Lookup\+Table\+Generator.\+hpp$>$}

\doxysubsubsubsection*{Classes}
\begin{DoxyCompactItemize}
\item 
struct \mbox{\hyperlink{structfunc_1_1LookupTableGenerator_1_1LookupTableErrorFunctor}{Lookup\+Table\+Error\+Functor}}
\item 
struct \mbox{\hyperlink{structfunc_1_1LookupTableGenerator_1_1OptimalStepSizeFunctor}{Optimal\+Step\+Size\+Functor}}
\end{DoxyCompactItemize}
\doxysubsubsubsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\Hypertarget{classfunc_1_1LookupTableGenerator_af38a966b08cab3c40f31388c634ab3d4}\label{classfunc_1_1LookupTableGenerator_af38a966b08cab3c40f31388c634ab3d4} 
{\bfseries Lookup\+Table\+Generator} (const \mbox{\hyperlink{classfunc_1_1FunctionContainer}{Function\+Container}}$<$ TIN, TOUT $>$ \&fc, const \mbox{\hyperlink{structfunc_1_1LookupTableParameters}{Lookup\+Table\+Parameters}}$<$ TIN $>$ \&par)
\item 
\Hypertarget{classfunc_1_1LookupTableGenerator_a6892d1f263e8857113a76c4fed6f5db5}\label{classfunc_1_1LookupTableGenerator_a6892d1f263e8857113a76c4fed6f5db5} 
{\bfseries Lookup\+Table\+Generator} (const \mbox{\hyperlink{classfunc_1_1FunctionContainer}{Function\+Container}}$<$ TIN, TOUT $>$ \&fc, TIN min\+Arg, TIN max\+Arg)
\item 
std\+::unique\+\_\+ptr$<$ \mbox{\hyperlink{classfunc_1_1LookupTable}{Lookup\+Table}}$<$ TIN, TOUT $>$ $>$ \mbox{\hyperlink{classfunc_1_1LookupTableGenerator_afb28c318243d92959b2ea9e67df90d17}{generate\+\_\+by\+\_\+file}} (std\+::string filename, std\+::string table\+Key="{}"{})
\item 
std\+::unique\+\_\+ptr$<$ \mbox{\hyperlink{classfunc_1_1LookupTable}{Lookup\+Table}}$<$ TIN, TOUT $>$ $>$ \mbox{\hyperlink{classfunc_1_1LookupTableGenerator_a345f75c3b365203e3c926549ff818626}{generate\+\_\+by\+\_\+step}} (std\+::string table\+Key, TIN step\+Size, std\+::string filename="{}"{})
\item 
std\+::unique\+\_\+ptr$<$ \mbox{\hyperlink{classfunc_1_1LookupTable}{Lookup\+Table}}$<$ TIN, TOUT $>$ $>$ \mbox{\hyperlink{classfunc_1_1LookupTableGenerator_a160cdb5df9656c3cb9e1918f33d7500c}{generate\+\_\+by\+\_\+tol}} (std\+::string table\+Key, TIN a\+\_\+tol, TIN r\+\_\+tol, std\+::string filename="{}"{})
\item 
\Hypertarget{classfunc_1_1LookupTableGenerator_a2b480ecc06ca21b67db363b6bae1b0b5}\label{classfunc_1_1LookupTableGenerator_a2b480ecc06ca21b67db363b6bae1b0b5} 
std\+::unique\+\_\+ptr$<$ \mbox{\hyperlink{classfunc_1_1LookupTable}{Lookup\+Table}}$<$ TIN, TOUT $>$ $>$ {\bfseries generate\+\_\+by\+\_\+tol} (std\+::string table\+Key, TIN desired\+Err, std\+::string filename="{}"{})
\item 
std\+::unique\+\_\+ptr$<$ \mbox{\hyperlink{classfunc_1_1LookupTable}{Lookup\+Table}}$<$ TIN, TOUT $>$ $>$ \mbox{\hyperlink{classfunc_1_1LookupTableGenerator_a980922d2ca0f29086bc943882d3062da}{generate\+\_\+by\+\_\+impl\+\_\+size}} (std\+::string table\+Key, unsigned long desired\+Size, std\+::string filename="{}"{})
\item 
long double \mbox{\hyperlink{classfunc_1_1LookupTableGenerator_a6f6c0aa76a663bd5bde5b8107e263ea3}{error\+\_\+at\+\_\+step\+\_\+size}} (std\+::string table\+Key, TIN step\+Size, TIN rel\+Tol=static\+\_\+cast$<$ TIN $>$(1.\+0))
\item 
\Hypertarget{classfunc_1_1LookupTableGenerator_a0ea2447b8d7f487d04a4eae2a0c0cbce}\label{classfunc_1_1LookupTableGenerator_a0ea2447b8d7f487d04a4eae2a0c0cbce} 
long double {\bfseries error\+\_\+of\+\_\+table} (const \mbox{\hyperlink{classfunc_1_1LookupTable}{Lookup\+Table}}$<$ TIN, TOUT $>$ \&L, TIN rel\+Tol=static\+\_\+cast$<$ TIN $>$(1.\+0))
\item 
void \mbox{\hyperlink{classfunc_1_1LookupTableGenerator_afd52ffd040f68c015568e1ffafec22a2}{plot\+\_\+implementation\+\_\+at\+\_\+step\+\_\+size}} (std\+::string table\+Key, TIN table\+\_\+step, TIN plot\+\_\+step)
\item 
\Hypertarget{classfunc_1_1LookupTableGenerator_a11f52877eee86005e20bf4e3c8533f1e}\label{classfunc_1_1LookupTableGenerator_a11f52877eee86005e20bf4e3c8533f1e} 
TIN {\bfseries min\+\_\+arg} ()
\item 
\Hypertarget{classfunc_1_1LookupTableGenerator_a5d5c329dcc872285e31b7d94efd01758}\label{classfunc_1_1LookupTableGenerator_a5d5c329dcc872285e31b7d94efd01758} 
TIN {\bfseries max\+\_\+arg} ()
\end{DoxyCompactItemize}


\doxysubsubsection{Detailed Description}
\subsubsection*{template$<$typename TIN, typename TOUT = TIN, typename TERR = long double$>$\newline
class func\+::\+Lookup\+Table\+Generator$<$ TIN, TOUT, TERR $>$}
Generate a FunC \doxylink{classfunc_1_1LookupTable}{Lookup\+Table} from a given name and one of the following\+: stepsize, tolerance, memory size limit, or filename with generate\+\_\+by\+\_\+step, generate\+\_\+by\+\_\+tol, generate\+\_\+by\+\_\+impl\+\_\+size, and generate\+\_\+by\+\_\+file respectively. This class is also equipped to compute the error in a LUT built with any given stepsize and plot a LUT against its exact function. 

\begin{DoxyNote}{Note}
If {\ttfamily generate\+\_\+by\+\_\+\+XXX} is given a nonempty filename then it will generate a table once and save that output to to {\ttfamily filename}. Future runs will build the LUT from filename instead of generating that LUT from scratch. 

filenames are relative to the cwd unless users provide an absolute path.

Many architectures (including Apples arm chips) typedef long double as double (truly horrendous)

If Boost is not available then users can only use this class to build LUTs by file or by step.

\doxylink{classfunc_1_1LookupTableGenerator}{Lookup\+Table\+Generator} is header only because it is templated on the error precision TERR. We MUST be able to cast TERR to TIN and vice versa. Ideally TERR satisfies\+: $\sqrt(\epsilon_{\mathrm{TERR}}) <= \epsilon_{\mathrm{TOUT}}$.
\end{DoxyNote}
\begin{DoxyRefDesc}{Todo}
\item[\mbox{\hyperlink{todo__todo000012}{Todo}}]Newton\textquotesingle{}s iterations are currently unused because sometimes it\textquotesingle{}ll try building a LUT so large it\textquotesingle{}ll kill mortal computers. There must be a way to use it, but I\textquotesingle{}m not sure how. \end{DoxyRefDesc}


\label{doc-func-members}
\Hypertarget{classfunc_1_1LookupTableGenerator_doc-func-members}
\doxysubsubsection{Member Function Documentation}
\Hypertarget{classfunc_1_1LookupTableGenerator_a6f6c0aa76a663bd5bde5b8107e263ea3}\index{LookupTableGenerator$<$ TIN, TOUT, TERR $>$@{LookupTableGenerator$<$ TIN, TOUT, TERR $>$}!error\_at\_step\_size@{error\_at\_step\_size}}
\index{error\_at\_step\_size@{error\_at\_step\_size}!LookupTableGenerator$<$ TIN, TOUT, TERR $>$@{LookupTableGenerator$<$ TIN, TOUT, TERR $>$}}
\doxyparagraph{\texorpdfstring{error\_at\_step\_size()}{error\_at\_step\_size()}}
{\footnotesize\ttfamily \label{classfunc_1_1LookupTableGenerator_a6f6c0aa76a663bd5bde5b8107e263ea3} 
template$<$typename TIN, typename TOUT, typename TERR$>$ \\
long double error\+\_\+at\+\_\+step\+\_\+size (\begin{DoxyParamCaption}\item[{std\+::string}]{table\+Key}{, }\item[{TIN}]{step\+Size}{, }\item[{TIN}]{rel\+Tol}{ = {\ttfamily static\+\_\+cast$<$TIN$>$(1.0)}}\end{DoxyParamCaption})}

Return the approx error in table\+Key at step\+Size
\begin{DoxyItemize}
\item rel\+Tol is a parameter which determines how much effect small f(x) values have on the error calculation 
\end{DoxyItemize}\Hypertarget{classfunc_1_1LookupTableGenerator_afb28c318243d92959b2ea9e67df90d17}\index{LookupTableGenerator$<$ TIN, TOUT, TERR $>$@{LookupTableGenerator$<$ TIN, TOUT, TERR $>$}!generate\_by\_file@{generate\_by\_file}}
\index{generate\_by\_file@{generate\_by\_file}!LookupTableGenerator$<$ TIN, TOUT, TERR $>$@{LookupTableGenerator$<$ TIN, TOUT, TERR $>$}}
\doxyparagraph{\texorpdfstring{generate\_by\_file()}{generate\_by\_file()}}
{\footnotesize\ttfamily \label{classfunc_1_1LookupTableGenerator_afb28c318243d92959b2ea9e67df90d17} 
template$<$typename TIN, typename TOUT = TIN, typename TERR = long double$>$ \\
std\+::unique\+\_\+ptr$<$ \mbox{\hyperlink{classfunc_1_1LookupTable}{Lookup\+Table}}$<$ TIN, TOUT $>$ $>$ generate\+\_\+by\+\_\+file (\begin{DoxyParamCaption}\item[{std\+::string}]{filename}{, }\item[{std\+::string}]{table\+Key}{ = {\ttfamily "{}"{}}}\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}

A wrapper for the \doxylink{classfunc_1_1LookupTableFactory}{Lookup\+Table\+Factory$<$std\+::string$>$} which builds tables from a file table\+Key arg only exists as a sanity check (it\textquotesingle{}s pointless otherwise) \Hypertarget{classfunc_1_1LookupTableGenerator_a980922d2ca0f29086bc943882d3062da}\index{LookupTableGenerator$<$ TIN, TOUT, TERR $>$@{LookupTableGenerator$<$ TIN, TOUT, TERR $>$}!generate\_by\_impl\_size@{generate\_by\_impl\_size}}
\index{generate\_by\_impl\_size@{generate\_by\_impl\_size}!LookupTableGenerator$<$ TIN, TOUT, TERR $>$@{LookupTableGenerator$<$ TIN, TOUT, TERR $>$}}
\doxyparagraph{\texorpdfstring{generate\_by\_impl\_size()}{generate\_by\_impl\_size()}}
{\footnotesize\ttfamily \label{classfunc_1_1LookupTableGenerator_a980922d2ca0f29086bc943882d3062da} 
template$<$typename TIN, typename TOUT, typename TERR$>$ \\
std\+::unique\+\_\+ptr$<$ \mbox{\hyperlink{classfunc_1_1LookupTable}{Lookup\+Table}}$<$ TIN, TOUT $>$ $>$ generate\+\_\+by\+\_\+impl\+\_\+size (\begin{DoxyParamCaption}\item[{std\+::string}]{table\+Key}{, }\item[{unsigned long}]{desired\+Size}{, }\item[{std\+::string}]{filename}{ = {\ttfamily "{}"{}}}\end{DoxyParamCaption})}

Generate a table takes up desired\+Size bytes \Hypertarget{classfunc_1_1LookupTableGenerator_a345f75c3b365203e3c926549ff818626}\index{LookupTableGenerator$<$ TIN, TOUT, TERR $>$@{LookupTableGenerator$<$ TIN, TOUT, TERR $>$}!generate\_by\_step@{generate\_by\_step}}
\index{generate\_by\_step@{generate\_by\_step}!LookupTableGenerator$<$ TIN, TOUT, TERR $>$@{LookupTableGenerator$<$ TIN, TOUT, TERR $>$}}
\doxyparagraph{\texorpdfstring{generate\_by\_step()}{generate\_by\_step()}}
{\footnotesize\ttfamily \label{classfunc_1_1LookupTableGenerator_a345f75c3b365203e3c926549ff818626} 
template$<$typename TIN, typename TOUT = TIN, typename TERR = long double$>$ \\
std\+::unique\+\_\+ptr$<$ \mbox{\hyperlink{classfunc_1_1LookupTable}{Lookup\+Table}}$<$ TIN, TOUT $>$ $>$ generate\+\_\+by\+\_\+step (\begin{DoxyParamCaption}\item[{std\+::string}]{table\+Key}{, }\item[{TIN}]{step\+Size}{, }\item[{std\+::string}]{filename}{ = {\ttfamily "{}"{}}}\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}

A wrapper for the \doxylink{classfunc_1_1LookupTableFactory}{Lookup\+Table\+Factory} \Hypertarget{classfunc_1_1LookupTableGenerator_a160cdb5df9656c3cb9e1918f33d7500c}\index{LookupTableGenerator$<$ TIN, TOUT, TERR $>$@{LookupTableGenerator$<$ TIN, TOUT, TERR $>$}!generate\_by\_tol@{generate\_by\_tol}}
\index{generate\_by\_tol@{generate\_by\_tol}!LookupTableGenerator$<$ TIN, TOUT, TERR $>$@{LookupTableGenerator$<$ TIN, TOUT, TERR $>$}}
\doxyparagraph{\texorpdfstring{generate\_by\_tol()}{generate\_by\_tol()}}
{\footnotesize\ttfamily \label{classfunc_1_1LookupTableGenerator_a160cdb5df9656c3cb9e1918f33d7500c} 
template$<$typename TIN, typename TOUT, typename TERR$>$ \\
std\+::unique\+\_\+ptr$<$ \mbox{\hyperlink{classfunc_1_1LookupTable}{Lookup\+Table}}$<$ TIN, TOUT $>$ $>$ generate\+\_\+by\+\_\+tol (\begin{DoxyParamCaption}\item[{std\+::string}]{table\+Key}{, }\item[{TIN}]{a\+\_\+tol}{, }\item[{TIN}]{r\+\_\+tol}{, }\item[{std\+::string}]{filename}{ = {\ttfamily "{}"{}}}\end{DoxyParamCaption})}

Generate a table that has the largest possible stepsize such that the error is less than desired\+Err \Hypertarget{classfunc_1_1LookupTableGenerator_afd52ffd040f68c015568e1ffafec22a2}\index{LookupTableGenerator$<$ TIN, TOUT, TERR $>$@{LookupTableGenerator$<$ TIN, TOUT, TERR $>$}!plot\_implementation\_at\_step\_size@{plot\_implementation\_at\_step\_size}}
\index{plot\_implementation\_at\_step\_size@{plot\_implementation\_at\_step\_size}!LookupTableGenerator$<$ TIN, TOUT, TERR $>$@{LookupTableGenerator$<$ TIN, TOUT, TERR $>$}}
\doxyparagraph{\texorpdfstring{plot\_implementation\_at\_step\_size()}{plot\_implementation\_at\_step\_size()}}
{\footnotesize\ttfamily \label{classfunc_1_1LookupTableGenerator_afd52ffd040f68c015568e1ffafec22a2} 
template$<$typename TIN, typename TOUT, typename TERR$>$ \\
void plot\+\_\+implementation\+\_\+at\+\_\+step\+\_\+size (\begin{DoxyParamCaption}\item[{std\+::string}]{table\+Key}{, }\item[{TIN}]{table\+\_\+step}{, }\item[{TIN}]{plot\+\_\+step}{}\end{DoxyParamCaption})}

compare table\+Key to the original function at step\+Size 

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