\doxysection{Exponential.\+h}
\hypertarget{_exponential_8h_source}{}\label{_exponential_8h_source}\index{Exponential/Exponential.h@{Exponential/Exponential.h}}

\begin{DoxyCode}{0}
\DoxyCodeLine{00001\ \textcolor{preprocessor}{\#pragma\ once}}
\DoxyCodeLine{00002\ \textcolor{preprocessor}{\#ifndef\ JONATHAN\_RAMPERSAD\_EXPONENTIAL\_H\_}}
\DoxyCodeLine{00003\ \textcolor{preprocessor}{\#define\ JONATHAN\_RAMPERSAD\_EXPONENTIAL\_H\_}}
\DoxyCodeLine{00004\ }
\DoxyCodeLine{00005\ \textcolor{preprocessor}{\#include\ <ostream>}}
\DoxyCodeLine{00006\ \textcolor{preprocessor}{\#include\ <vector>}}
\DoxyCodeLine{00007\ \textcolor{preprocessor}{\#include\ <float.h>}}
\DoxyCodeLine{00008\ \textcolor{preprocessor}{\#include\ <random>}}
\DoxyCodeLine{00009\ \textcolor{preprocessor}{\#include\ <algorithm>}}
\DoxyCodeLine{00010\ \textcolor{preprocessor}{\#include\ <execution>}}
\DoxyCodeLine{00011\ \textcolor{preprocessor}{\#include\ <exception>}}
\DoxyCodeLine{00012\ }
\DoxyCodeLine{00013\ \textcolor{keyword}{namespace\ }JRAMPERSAD}
\DoxyCodeLine{00014\ \{}
\DoxyCodeLine{00015\ \ \ \ \ \textcolor{keyword}{namespace\ }EXPONENTIAL}
\DoxyCodeLine{00016\ \ \ \ \ \{}
\DoxyCodeLine{00020\ \ \ \ \ \ \ \ \ \textcolor{keyword}{struct\ }\mbox{\hyperlink{struct_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_g_a___options}{GA\_Options}}}
\DoxyCodeLine{00021\ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00023\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{double}\ \mbox{\hyperlink{struct_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_g_a___options_a316979973a2a6b70b00520c2f753a43c}{min\_range}}\ =\ -\/100;}
\DoxyCodeLine{00025\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{double}\ \mbox{\hyperlink{struct_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_g_a___options_a9b8f1e5367f6b0d8b16eecaea53b40e2}{max\_range}}\ =\ 100;}
\DoxyCodeLine{00027\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{int}\ \mbox{\hyperlink{struct_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_g_a___options_a4a67bad303f8a4fca40020a0802524c5}{num\_of\_generations}}\ =\ 10;}
\DoxyCodeLine{00029\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{int}\ \mbox{\hyperlink{struct_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_g_a___options_ad133af29dbbc26b8c3d507d359c03326}{sample\_size}}\ =\ 1000;}
\DoxyCodeLine{00031\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{int}\ \mbox{\hyperlink{struct_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_g_a___options_a6ec95fe6cc95dc32727659cf5bb1be12}{data\_size}}\ =\ 100000;}
\DoxyCodeLine{00033\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{double}\ \mbox{\hyperlink{struct_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_g_a___options_a736488b3cfeebda7b93b3e8c6f576bf8}{mutation\_percentage}}\ =\ 0.01;}
\DoxyCodeLine{00034\ \ \ \ \ \ \ \ \ \};}
\DoxyCodeLine{00035\ }
\DoxyCodeLine{00036\ \ \ \ \ \ \ \ \ \textcolor{keyword}{namespace\ }detail}
\DoxyCodeLine{00037\ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00038\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{template}<\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00039\ \ \ \ \ \ \ \ \ \ \ \ \ [[nodiscard(\textcolor{stringliteral}{"{}MATH::ABS(T)\ returns\ a\ value\ of\ type\ T"{}})]]\ T\ ABS(\textcolor{keyword}{const}\ T\&\ n)\ \textcolor{keyword}{noexcept}}
\DoxyCodeLine{00040\ \ \ \ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00041\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ n\ <\ 0\ ?\ n\ *\ -\/1\ :\ n;}
\DoxyCodeLine{00042\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00043\ }
\DoxyCodeLine{00044\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{template}<\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00045\ \ \ \ \ \ \ \ \ \ \ \ \ [[nodiscard(\textcolor{stringliteral}{"{}MATH::NEGATE(T)\ returns\ a\ value\ of\ type\ T"{}})]]\ T\ NEGATE(\textcolor{keyword}{const}\ T\&\ n)\ \textcolor{keyword}{noexcept}}
\DoxyCodeLine{00046\ \ \ \ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00047\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ n\ *\ -\/1;}
\DoxyCodeLine{00048\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00049\ }
\DoxyCodeLine{00050\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{template}<\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00051\ \ \ \ \ \ \ \ \ \ \ \ \ [[nodiscard(\textcolor{stringliteral}{"{}MATH::POW(T,\ int)\ returns\ a\ value\ of\ type\ T"{}})]]\ T\ POW(\textcolor{keyword}{const}\ T\&\ n,\ \textcolor{keyword}{const}\ \textcolor{keywordtype}{int}\&\ exp)\ \textcolor{keyword}{noexcept}}
\DoxyCodeLine{00052\ \ \ \ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00053\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (exp\ ==\ 0)}
\DoxyCodeLine{00054\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ 1;}
\DoxyCodeLine{00055\ }
\DoxyCodeLine{00056\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ T\ res\ =\ n;}
\DoxyCodeLine{00057\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keywordtype}{int}\ i\ =\ 1;\ i\ <\ exp;\ i++)}
\DoxyCodeLine{00058\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00059\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ res\ *=\ n;}
\DoxyCodeLine{00060\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00061\ }
\DoxyCodeLine{00062\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ res;}
\DoxyCodeLine{00063\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00064\ }
\DoxyCodeLine{00065\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{template}<\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00066\ \ \ \ \ \ \ \ \ \ \ \ \ [[nodiscard(\textcolor{stringliteral}{"{}MATH::SUM(std::vector<T>)\ returns\ a\ value\ of\ type\ T"{}})]]\ T\ SUM(\textcolor{keyword}{const}\ std::vector<T>\&\ vec)\ \textcolor{keyword}{noexcept}}
\DoxyCodeLine{00067\ \ \ \ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00068\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ T\ res\{\};}
\DoxyCodeLine{00069\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keyword}{auto}\&\ val\ :\ vec)}
\DoxyCodeLine{00070\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ res\ +=\ val;}
\DoxyCodeLine{00071\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ res;}
\DoxyCodeLine{00072\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00073\ }
\DoxyCodeLine{00074\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{template}<\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00075\ \ \ \ \ \ \ \ \ \ \ \ \ [[nodiscard]]\ T\ MEDIAN(std::vector<T>\ vec)\ \textcolor{keyword}{noexcept}}
\DoxyCodeLine{00076\ \ \ \ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00077\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ std::sort(}
\DoxyCodeLine{00078\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ vec.begin(),}
\DoxyCodeLine{00079\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ vec.end(),}
\DoxyCodeLine{00080\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ [](\textcolor{keyword}{const}\ \textcolor{keyword}{auto}\&\ lhs,\ \textcolor{keyword}{const}\ \textcolor{keyword}{auto}\&\ rhs)\ \{}
\DoxyCodeLine{00081\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ return\ lhs\ <\ rhs;}
\DoxyCodeLine{00082\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \});}
\DoxyCodeLine{00083\ }
\DoxyCodeLine{00084\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ vec[vec.size()\ /\ 2];}
\DoxyCodeLine{00085\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00086\ }
\DoxyCodeLine{00087\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{template}<\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00088\ \ \ \ \ \ \ \ \ \ \ \ \ [[nodiscard]]\ \textcolor{keywordtype}{double}\ MEAN(\textcolor{keyword}{const}\ std::vector<T>\&\ vec)\ \textcolor{keyword}{noexcept}}
\DoxyCodeLine{00089\ \ \ \ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00090\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ SUM(vec)\ /\ vec.size();}
\DoxyCodeLine{00091\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00092\ }
\DoxyCodeLine{00093\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{template}<\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00094\ \ \ \ \ \ \ \ \ \ \ \ \ [[noreturn]]\ \textcolor{keywordtype}{void}\ SortASC(std::vector<T>\&\ vec)}
\DoxyCodeLine{00095\ \ \ \ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00096\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ std::sort(}
\DoxyCodeLine{00097\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ std::execution::par,}
\DoxyCodeLine{00098\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ vec.begin(),\ vec.end(),}
\DoxyCodeLine{00099\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ [](\textcolor{keyword}{const}\ \textcolor{keyword}{auto}\&\ lhs,\ \textcolor{keyword}{const}\ \textcolor{keyword}{auto}\&\ rhs)\ \{}
\DoxyCodeLine{00100\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ return\ lhs\ <\ rhs;}
\DoxyCodeLine{00101\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \});}
\DoxyCodeLine{00102\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00103\ }
\DoxyCodeLine{00104\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{template}<\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00105\ \ \ \ \ \ \ \ \ \ \ \ \ [[noreturn]]\ \textcolor{keywordtype}{void}\ SortDESC(std::vector<T>\&\ vec)}
\DoxyCodeLine{00106\ \ \ \ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00107\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ std::sort(}
\DoxyCodeLine{00108\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ std::execution::par,}
\DoxyCodeLine{00109\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ vec.begin(),\ vec.end(),}
\DoxyCodeLine{00110\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ [](\textcolor{keyword}{const}\ \textcolor{keyword}{auto}\&\ lhs,\ \textcolor{keyword}{const}\ \textcolor{keyword}{auto}\&\ rhs)\ \{}
\DoxyCodeLine{00111\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ return\ lhs\ >\ rhs;}
\DoxyCodeLine{00112\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \});}
\DoxyCodeLine{00113\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00114\ }
\DoxyCodeLine{00115\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ Genetic\ Algorithm\ helper\ struct}}
\DoxyCodeLine{00116\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{struct\ }GA\_Solution}
\DoxyCodeLine{00117\ \ \ \ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00118\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{short}\ lrgst\_expo;}
\DoxyCodeLine{00119\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{double}\ rank,\ x,\ y\_val;}
\DoxyCodeLine{00120\ }
\DoxyCodeLine{00121\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ GA\_Solution()\ :\ lrgst\_expo(0),\ rank(0),\ x(0),\ y\_val(0)\ \{\}}
\DoxyCodeLine{00122\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ GA\_Solution(\textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{short}\ Lrgst\_expo,\ \textcolor{keywordtype}{double}\ Rank,\ \textcolor{keywordtype}{double}\ x\_val,\ \textcolor{keywordtype}{double}\ y\ =\ 0)\ :\ lrgst\_expo(Lrgst\_expo),\ rank(Rank),\ x(x\_val),\ y\_val(y)\ \{\}}
\DoxyCodeLine{00123\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{virtual}\ \string~GA\_Solution()\ =\ \textcolor{keywordflow}{default};}
\DoxyCodeLine{00124\ }
\DoxyCodeLine{00125\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ fitness(\textcolor{keyword}{const}\ std::vector<int64\_t>\&\ constants)}
\DoxyCodeLine{00126\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00127\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{double}\ ans\ =\ 0;}
\DoxyCodeLine{00128\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keywordtype}{int}\ i\ =\ lrgst\_expo;\ i\ >=\ 0;\ i-\/-\/)}
\DoxyCodeLine{00129\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ans\ +=\ constants[i]\ *\ POW(x,\ (lrgst\_expo\ -\/\ i));}
\DoxyCodeLine{00130\ }
\DoxyCodeLine{00131\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ans\ -\/=\ y\_val;}
\DoxyCodeLine{00132\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ rank\ =\ (ans\ ==\ 0)\ ?\ DBL\_MAX\ :\ ABS(1\ /\ ans);}
\DoxyCodeLine{00133\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00134\ \ \ \ \ \ \ \ \ \ \ \ \ \};}
\DoxyCodeLine{00135\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00136\ }
\DoxyCodeLine{00137\ \ \ \ \ \ \ \ \ \textcolor{keyword}{using\ namespace\ }detail;}
\DoxyCodeLine{00141\ \ \ \ \ \ \ \ \ \textcolor{keyword}{class\ }\mbox{\hyperlink{class_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_function}{Function}}}
\DoxyCodeLine{00142\ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00143\ \ \ \ \ \ \ \ \ \textcolor{keyword}{private}:}
\DoxyCodeLine{00144\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{const}\ \textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{short}\ lrgst\_expo;\ }
\DoxyCodeLine{00145\ \ \ \ \ \ \ \ \ \ \ \ \ std::vector<int64\_t>\ constants;}
\DoxyCodeLine{00146\ }
\DoxyCodeLine{00147\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{bool}\ bInitialized;}
\DoxyCodeLine{00148\ }
\DoxyCodeLine{00149\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ CanPerform()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{if}\ (!bInitialized)\ \textcolor{keywordflow}{throw}\ std::logic\_error(\textcolor{stringliteral}{"{}Function\ object\ not\ initialized\ fully!\ Please\ call\ .SetConstants()\ to\ initialize"{}});\ \}}
\DoxyCodeLine{00150\ }
\DoxyCodeLine{00151\ \ \ \ \ \ \ \ \ \textcolor{keyword}{public}:}
\DoxyCodeLine{00152\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ Speicialty\ function\ to\ get\ the\ real\ roots\ of\ a\ Quadratic\ Function\ without\ relying\ on\ a\ Genetic\ Algorithm\ to\ approximate}}
\DoxyCodeLine{00153\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{friend}\ std::vector<double>\ \mbox{\hyperlink{class_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_function_a9d14c1b8a7401565a054837df5708ac8}{QuadraticSolve}}(\textcolor{keyword}{const}\ \mbox{\hyperlink{class_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_function}{Function}}\&\ f);}
\DoxyCodeLine{00154\ }
\DoxyCodeLine{00155\ \ \ \ \ \ \ \ \ \textcolor{keyword}{public}:}
\DoxyCodeLine{00160\ \ \ \ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_function_a771e5f172d0738a6b56a3406ddea5779}{Function}}(\textcolor{keyword}{const}\ \textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{short}\&\ Lrgst\_expo)\ :\ lrgst\_expo(Lrgst\_expo),\ bInitialized(false)}
\DoxyCodeLine{00161\ \ \ \ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00162\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (lrgst\_expo\ <\ 0)}
\DoxyCodeLine{00163\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{throw}\ std::logic\_error(\textcolor{stringliteral}{"{}Function\ template\ argument\ must\ not\ be\ less\ than\ 0"{}});\ }
\DoxyCodeLine{00164\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ constants.reserve(Lrgst\_expo);\ }
\DoxyCodeLine{00165\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00167\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{virtual}\ \mbox{\hyperlink{class_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_function_afc95333a173bc120f6f9519dae853b3a}{\string~Function}}();}
\DoxyCodeLine{00169\ \ \ \ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_function_a2d7ac0d79af16746f89309f758adf40c}{Function}}(\textcolor{keyword}{const}\ \mbox{\hyperlink{class_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_function}{Function}}\&\ other)\ =\ \textcolor{keywordflow}{default};}
\DoxyCodeLine{00171\ \ \ \ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_function_a2f4cd78e5a95d1862b4389e81ef136da}{Function}}(\mbox{\hyperlink{class_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_function}{Function}}\&\&\ other)\ \textcolor{keyword}{noexcept}\ =\ \textcolor{keywordflow}{default};}
\DoxyCodeLine{00173\ \ \ \ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_function}{Function}}\&\ \mbox{\hyperlink{class_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_function_a450305ad4a40a262d378b3781d87a043}{operator=}}(\textcolor{keyword}{const}\ \mbox{\hyperlink{class_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_function}{Function}}\&\ other)\ =\ \textcolor{keywordflow}{default};}
\DoxyCodeLine{00175\ \ \ \ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_function}{Function}}\&\ \mbox{\hyperlink{class_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_function_af58e47ffa93dc7dd6b336327058731ff}{operator=}}(\mbox{\hyperlink{class_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_function}{Function}}\&\&\ other)\ \textcolor{keyword}{noexcept}\ =\ \textcolor{keywordflow}{default};}
\DoxyCodeLine{00176\ }
\DoxyCodeLine{00181\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{class_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_function_ac27a8c4c7a6b39d087c8c20a63756cb3}{SetConstants}}(\textcolor{keyword}{const}\ std::vector<int64\_t>\&\ constnts);}
\DoxyCodeLine{00186\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{class_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_function_ac27a8c4c7a6b39d087c8c20a63756cb3}{SetConstants}}(std::vector<int64\_t>\&\&\ constnts);}
\DoxyCodeLine{00187\ }
\DoxyCodeLine{00188\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{friend}\ std::ostream\&\ \mbox{\hyperlink{class_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_function_a9715ead4f7565aea73b2b956d32a8c2e}{operator<<}}(std::ostream\&\ os,\ \textcolor{keyword}{const}\ \mbox{\hyperlink{class_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_function}{Function}}\ func);}
\DoxyCodeLine{00189\ \ \ \ \ \ \ \ \ }
\DoxyCodeLine{00190\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{friend}\ \mbox{\hyperlink{class_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_function}{Function}}\ \mbox{\hyperlink{class_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_function_ac67d5be3dac9ab01eca47b11aaadb786}{operator+}}(\textcolor{keyword}{const}\ \mbox{\hyperlink{class_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_function}{Function}}\&\ f1,\ \textcolor{keyword}{const}\ \mbox{\hyperlink{class_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_function}{Function}}\&\ f2);}
\DoxyCodeLine{00191\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{friend}\ \mbox{\hyperlink{class_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_function}{Function}}\ \mbox{\hyperlink{class_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_function_a5e5034306a381d48ef50cce10f8f76c8}{operator-\/}}(\textcolor{keyword}{const}\ \mbox{\hyperlink{class_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_function}{Function}}\&\ f1,\ \textcolor{keyword}{const}\ \mbox{\hyperlink{class_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_function}{Function}}\&\ f2);}
\DoxyCodeLine{00192\ }
\DoxyCodeLine{00193\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{friend}\ \mbox{\hyperlink{class_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_function}{Function}}\ \mbox{\hyperlink{class_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_function_a5bb4eeaf7c3f6efe1c4eb1cd128d0d5e}{operator*}}(\textcolor{keyword}{const}\ \mbox{\hyperlink{class_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_function}{Function}}\&\ f,\ \textcolor{keyword}{const}\ int64\_t\&\ c);}
\DoxyCodeLine{00194\ \ \ \ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_function}{Function}}\&\ \mbox{\hyperlink{class_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_function_a24f53f18a66c4911c9ec89f98b2f6781}{operator*=}}(\textcolor{keyword}{const}\ int64\_t\&\ c);}
\DoxyCodeLine{00195\ }
\DoxyCodeLine{00200\ \ \ \ \ \ \ \ \ \ \ \ \ [[nodiscard(\textcolor{stringliteral}{"{}MATH::EXP::Function::differential()\ returns\ the\ differential,\ the\ calling\ object\ is\ not\ changed"{}})]]}
\DoxyCodeLine{00201\ \ \ \ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_function}{Function}}\ \mbox{\hyperlink{class_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_function_af05a7be6e85e4879185a84dc32cdf79c}{differential}}()\ \textcolor{keyword}{const};}
\DoxyCodeLine{00202\ }
\DoxyCodeLine{00208\ \ \ \ \ \ \ \ \ \ \ \ \ [[nodiscard]]\ std::vector<double>\ \mbox{\hyperlink{class_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_function_a2fe7e79ec57cb7160c783c20870fe855}{get\_real\_roots}}(\textcolor{keyword}{const}\ \mbox{\hyperlink{struct_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_g_a___options}{GA\_Options}}\&\ options\ =\ \mbox{\hyperlink{struct_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_g_a___options}{GA\_Options}}())\ \textcolor{keyword}{const};}
\DoxyCodeLine{00209\ }
\DoxyCodeLine{00215\ \ \ \ \ \ \ \ \ \ \ \ \ [[nodiscard]]\ \textcolor{keywordtype}{double}\ \mbox{\hyperlink{class_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_function_a3df87946deead508714d3d6da50231ef}{solve\_y}}(\textcolor{keyword}{const}\ \textcolor{keywordtype}{double}\&\ x\_val)\ \textcolor{keyword}{const};}
\DoxyCodeLine{00216\ }
\DoxyCodeLine{00223\ \ \ \ \ \ \ \ \ \ \ \ \ [[nodiscard]]\ std::vector<double>\ \mbox{\hyperlink{class_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_function_ac6f66aef23d97a47707796a9891fda80}{solve\_x}}(\textcolor{keyword}{const}\ \textcolor{keywordtype}{double}\&\ y\_val,\ \textcolor{keyword}{const}\ \mbox{\hyperlink{struct_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_g_a___options}{GA\_Options}}\&\ options\ =\ \mbox{\hyperlink{struct_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_g_a___options}{GA\_Options}}())\ \textcolor{keyword}{const};}
\DoxyCodeLine{00224\ }
\DoxyCodeLine{00226\ \ \ \ \ \ \ \ \ \ \ \ \ [[nodiscard]]\ \textcolor{keyword}{auto}\ \mbox{\hyperlink{class_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_function_a8e355925ec8a283ad7a74a5c4832d4a8}{GetWhatIsTheLargestExponent}}()\textcolor{keyword}{\ const\ }\{\ \textcolor{keywordflow}{return}\ lrgst\_expo;\ \}}
\DoxyCodeLine{00227\ \ \ \ \ \ \ \ \ \};}
\DoxyCodeLine{00228\ }
\DoxyCodeLine{00234\ \ \ \ \ \ \ \ \ std::vector<double>\ QuadraticSolve(\textcolor{keyword}{const}\ \mbox{\hyperlink{class_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_function}{Function}}\&\ f)}
\DoxyCodeLine{00235\ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00236\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{try}}
\DoxyCodeLine{00237\ \ \ \ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00238\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (f.lrgst\_expo\ !=\ 2)\ \textcolor{keywordflow}{throw}\ std::logic\_error(\textcolor{stringliteral}{"{}Function\ f\ is\ not\ a\ quadratic\ function"{}});}
\DoxyCodeLine{00239\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ f.CanPerform();}
\DoxyCodeLine{00240\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00241\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{catch}\ (\textcolor{keyword}{const}\ std::exception\&\ e)}
\DoxyCodeLine{00242\ \ \ \ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00243\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{throw}\ e;}
\DoxyCodeLine{00244\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00245\ }
\DoxyCodeLine{00246\ \ \ \ \ \ \ \ \ \ \ \ \ std::vector<double>\ res;}
\DoxyCodeLine{00247\ }
\DoxyCodeLine{00248\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{const}\ \textcolor{keyword}{auto}\&\ a\ =\ f.constants[0];}
\DoxyCodeLine{00249\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{const}\ \textcolor{keyword}{auto}\&\ b\ =\ f.constants[1];}
\DoxyCodeLine{00250\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{const}\ \textcolor{keyword}{auto}\&\ c\ =\ f.constants[2];}
\DoxyCodeLine{00251\ }
\DoxyCodeLine{00252\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{const}\ \textcolor{keywordtype}{double}\ sqr\_val\ =\ \textcolor{keyword}{static\_cast<}\textcolor{keywordtype}{double}\textcolor{keyword}{>}(POW(b,\ 2)\ -\/\ (4\ *\ a\ *\ c));}
\DoxyCodeLine{00253\ }
\DoxyCodeLine{00254\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (sqr\_val\ <\ 0)}
\DoxyCodeLine{00255\ \ \ \ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00256\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ res;}
\DoxyCodeLine{00257\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00258\ }
\DoxyCodeLine{00259\ \ \ \ \ \ \ \ \ \ \ \ \ res.push\_back(((NEGATE(b)\ +\ sqrt(sqr\_val))\ /\ 2\ *\ a));}
\DoxyCodeLine{00260\ \ \ \ \ \ \ \ \ \ \ \ \ res.push\_back(((NEGATE(b)\ -\/\ sqrt(sqr\_val))\ /\ 2\ *\ a));}
\DoxyCodeLine{00261\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ res;}
\DoxyCodeLine{00262\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00263\ \ \ \ \ }
\DoxyCodeLine{00264\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_function_afc95333a173bc120f6f9519dae853b3a}{Function::\string~Function}}()}
\DoxyCodeLine{00265\ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00266\ \ \ \ \ \ \ \ \ \ \ \ \ constants.clear();}
\DoxyCodeLine{00267\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00268\ }
\DoxyCodeLine{00269\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{class_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_function_ac27a8c4c7a6b39d087c8c20a63756cb3}{Function::SetConstants}}(\textcolor{keyword}{const}\ std::vector<int64\_t>\&\ constnts)}
\DoxyCodeLine{00270\ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00271\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (constnts.size()\ !=\ lrgst\_expo\ +\ 1)}
\DoxyCodeLine{00272\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{throw}\ std::logic\_error(\textcolor{stringliteral}{"{}Function<n>\ must\ be\ created\ with\ (n+1)\ integers\ in\ vector\ object"{}});}
\DoxyCodeLine{00273\ }
\DoxyCodeLine{00274\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (constnts[0]\ ==\ 0)}
\DoxyCodeLine{00275\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{throw}\ std::logic\_error(\textcolor{stringliteral}{"{}First\ value\ should\ not\ be\ 0"{}});}
\DoxyCodeLine{00276\ }
\DoxyCodeLine{00277\ \ \ \ \ \ \ \ \ \ \ \ \ constants\ =\ constnts;}
\DoxyCodeLine{00278\ \ \ \ \ \ \ \ \ \ \ \ \ bInitialized\ =\ \textcolor{keyword}{true};}
\DoxyCodeLine{00279\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00280\ }
\DoxyCodeLine{00281\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{class_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_function_ac27a8c4c7a6b39d087c8c20a63756cb3}{Function::SetConstants}}(std::vector<int64\_t>\&\&\ constnts)}
\DoxyCodeLine{00282\ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00283\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (constnts.size()\ !=\ lrgst\_expo\ +\ 1)}
\DoxyCodeLine{00284\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{throw}\ std::logic\_error(\textcolor{stringliteral}{"{}Function<n>\ must\ be\ created\ with\ (n+1)\ integers\ in\ vector\ object"{}});}
\DoxyCodeLine{00285\ }
\DoxyCodeLine{00286\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (constnts[0]\ ==\ 0)}
\DoxyCodeLine{00287\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{throw}\ std::logic\_error(\textcolor{stringliteral}{"{}First\ value\ should\ not\ be\ 0"{}});}
\DoxyCodeLine{00288\ }
\DoxyCodeLine{00289\ \ \ \ \ \ \ \ \ \ \ \ \ constants\ =\ std::move(constnts);}
\DoxyCodeLine{00290\ \ \ \ \ \ \ \ \ \ \ \ \ bInitialized\ =\ \textcolor{keyword}{true};}
\DoxyCodeLine{00291\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00292\ }
\DoxyCodeLine{00294\ \ \ \ \ \ \ \ \ std::ostream\&\ operator<<(std::ostream\&\ os,\ \textcolor{keyword}{const}\ \mbox{\hyperlink{class_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_function}{Function}}\ func)}
\DoxyCodeLine{00295\ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00296\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{try}}
\DoxyCodeLine{00297\ \ \ \ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00298\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ func.CanPerform();}
\DoxyCodeLine{00299\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00300\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{catch}\ (\textcolor{keyword}{const}\ std::exception\&\ e)}
\DoxyCodeLine{00301\ \ \ \ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00302\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{throw}\ e;}
\DoxyCodeLine{00303\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00304\ }
\DoxyCodeLine{00305\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (func.lrgst\_expo\ ==\ 0)}
\DoxyCodeLine{00306\ \ \ \ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00307\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ os\ <<\ func.constants[0];}
\DoxyCodeLine{00308\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ os;}
\DoxyCodeLine{00309\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00310\ }
\DoxyCodeLine{00311\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (func.constants[0]\ ==\ 1)}
\DoxyCodeLine{00312\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ os\ <<\ \textcolor{stringliteral}{"{}x"{}};}
\DoxyCodeLine{00313\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}\ (func.constants[0]\ ==\ -\/1)}
\DoxyCodeLine{00314\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ os\ <<\ \textcolor{stringliteral}{"{}-\/x"{}};}
\DoxyCodeLine{00315\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{else}}
\DoxyCodeLine{00316\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ os\ <<\ func.constants[0]\ <<\ \textcolor{stringliteral}{"{}x"{}};}
\DoxyCodeLine{00317\ }
\DoxyCodeLine{00318\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (func.lrgst\_expo\ !=\ 1)}
\DoxyCodeLine{00319\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ os\ <<\ \textcolor{stringliteral}{"{}\string^"{}}\ <<\ func.lrgst\_expo;}
\DoxyCodeLine{00320\ }
\DoxyCodeLine{00321\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keyword}{auto}\ i\ =\ func.lrgst\_expo\ -\/\ 1;\ i\ >\ 0;\ i-\/-\/)}
\DoxyCodeLine{00322\ \ \ \ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00323\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{auto}\ n\ =\ func.constants[func.lrgst\_expo\ -\/\ i];}
\DoxyCodeLine{00324\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (n\ ==\ 0)\ \textcolor{keywordflow}{continue};}
\DoxyCodeLine{00325\ }
\DoxyCodeLine{00326\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{auto}\ s\ =\ n\ >\ 0\ ?\ \textcolor{stringliteral}{"{}\ +\ "{}}\ :\ \textcolor{stringliteral}{"{}\ -\/\ "{}};}
\DoxyCodeLine{00327\ }
\DoxyCodeLine{00328\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (n\ !=\ 1)}
\DoxyCodeLine{00329\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ os\ <<\ s\ <<\ ABS(n)\ <<\ \textcolor{stringliteral}{"{}x"{}};}
\DoxyCodeLine{00330\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{else}}
\DoxyCodeLine{00331\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ os\ <<\ s\ <<\ \textcolor{stringliteral}{"{}x"{}};}
\DoxyCodeLine{00332\ }
\DoxyCodeLine{00333\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (i\ !=\ 1)}
\DoxyCodeLine{00334\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ os\ <<\ \textcolor{stringliteral}{"{}\string^"{}}\ <<\ i;}
\DoxyCodeLine{00335\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00336\ }
\DoxyCodeLine{00337\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{auto}\ n\ =\ func.constants[func.lrgst\_expo];}
\DoxyCodeLine{00338\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (n\ ==\ 0)\ \textcolor{keywordflow}{return}\ os;}
\DoxyCodeLine{00339\ }
\DoxyCodeLine{00340\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{auto}\ s\ =\ n\ >\ 0\ ?\ \textcolor{stringliteral}{"{}\ +\ "{}}\ :\ \textcolor{stringliteral}{"{}\ -\/\ "{}};}
\DoxyCodeLine{00341\ \ \ \ \ \ \ \ \ \ \ \ \ os\ <<\ s;}
\DoxyCodeLine{00342\ }
\DoxyCodeLine{00343\ \ \ \ \ \ \ \ \ \ \ \ \ os\ <<\ ABS(n);}
\DoxyCodeLine{00344\ }
\DoxyCodeLine{00345\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ os;}
\DoxyCodeLine{00346\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00347\ }
\DoxyCodeLine{00349\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_function}{Function}}\ operator+(\textcolor{keyword}{const}\ \mbox{\hyperlink{class_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_function}{Function}}\&\ f1,\ \textcolor{keyword}{const}\ \mbox{\hyperlink{class_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_function}{Function}}\&\ f2)}
\DoxyCodeLine{00350\ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00351\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{try}}
\DoxyCodeLine{00352\ \ \ \ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00353\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ f1.CanPerform();}
\DoxyCodeLine{00354\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ f2.CanPerform();}
\DoxyCodeLine{00355\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00356\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{catch}\ (\textcolor{keyword}{const}\ std::exception\&\ e)}
\DoxyCodeLine{00357\ \ \ \ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00358\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{throw}\ e;}
\DoxyCodeLine{00359\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00360\ }
\DoxyCodeLine{00361\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{auto}\ e1\ =\ f1.lrgst\_expo;}
\DoxyCodeLine{00362\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{auto}\ e2\ =\ f2.lrgst\_expo;}
\DoxyCodeLine{00363\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{auto}\ r\ =\ e1\ >\ e2\ ?\ e1\ :\ e2;}
\DoxyCodeLine{00364\ }
\DoxyCodeLine{00365\ \ \ \ \ \ \ \ \ \ \ \ \ std::vector<int64\_t>\ res;}
\DoxyCodeLine{00366\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (e1\ >\ e2)}
\DoxyCodeLine{00367\ \ \ \ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00368\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keyword}{auto}\&\ val\ :\ f1.constants)}
\DoxyCodeLine{00369\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ res.push\_back(val);}
\DoxyCodeLine{00370\ }
\DoxyCodeLine{00371\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{auto}\ i\ =\ e1\ -\/\ e2;}
\DoxyCodeLine{00372\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keyword}{auto}\&\ val\ :\ f2.constants)}
\DoxyCodeLine{00373\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00374\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ res[i]\ +=\ val;}
\DoxyCodeLine{00375\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ i++;}
\DoxyCodeLine{00376\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00377\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00378\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{else}}
\DoxyCodeLine{00379\ \ \ \ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00380\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keyword}{auto}\&\ val\ :\ f2.constants)}
\DoxyCodeLine{00381\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ res.push\_back(val);}
\DoxyCodeLine{00382\ }
\DoxyCodeLine{00383\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{int}\ i\ =\ e2\ -\/\ e1;}
\DoxyCodeLine{00384\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keyword}{auto}\&\ val\ :\ f1.constants)}
\DoxyCodeLine{00385\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00386\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ res[i]\ +=\ val;}
\DoxyCodeLine{00387\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ i++;}
\DoxyCodeLine{00388\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00389\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00390\ }
\DoxyCodeLine{00391\ \ \ \ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_function}{Function}}\ f(r);}
\DoxyCodeLine{00392\ \ \ \ \ \ \ \ \ \ \ \ \ f.\mbox{\hyperlink{class_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_function_ac27a8c4c7a6b39d087c8c20a63756cb3}{SetConstants}}(res);}
\DoxyCodeLine{00393\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ f;}
\DoxyCodeLine{00394\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00395\ \ \ \ \ }
\DoxyCodeLine{00397\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_function}{Function}}\ operator-\/(\textcolor{keyword}{const}\ \mbox{\hyperlink{class_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_function}{Function}}\&\ f1,\ \textcolor{keyword}{const}\ \mbox{\hyperlink{class_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_function}{Function}}\&\ f2)}
\DoxyCodeLine{00398\ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00399\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{try}}
\DoxyCodeLine{00400\ \ \ \ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00401\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ f1.CanPerform();}
\DoxyCodeLine{00402\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ f2.CanPerform();}
\DoxyCodeLine{00403\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00404\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{catch}\ (\textcolor{keyword}{const}\ std::exception\&\ e)}
\DoxyCodeLine{00405\ \ \ \ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00406\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{throw}\ e;}
\DoxyCodeLine{00407\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00408\ }
\DoxyCodeLine{00409\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{auto}\ e1\ =\ f1.lrgst\_expo;}
\DoxyCodeLine{00410\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{auto}\ e2\ =\ f2.lrgst\_expo;}
\DoxyCodeLine{00411\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{auto}\ r\ =\ e1\ >\ e2\ ?\ e1\ :\ e2;}
\DoxyCodeLine{00412\ }
\DoxyCodeLine{00413\ \ \ \ \ \ \ \ \ \ \ \ \ std::vector<int64\_t>\ res;}
\DoxyCodeLine{00414\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (e1\ >\ e2)}
\DoxyCodeLine{00415\ \ \ \ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00416\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keyword}{auto}\&\ val\ :\ f1.constants)}
\DoxyCodeLine{00417\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ res.push\_back(val);}
\DoxyCodeLine{00418\ }
\DoxyCodeLine{00419\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{auto}\ i\ =\ e1\ -\/\ e2;}
\DoxyCodeLine{00420\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keyword}{auto}\&\ val\ :\ f2.constants)}
\DoxyCodeLine{00421\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00422\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ res[i]\ -\/=\ val;}
\DoxyCodeLine{00423\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ i++;}
\DoxyCodeLine{00424\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00425\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00426\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{else}}
\DoxyCodeLine{00427\ \ \ \ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00428\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keyword}{auto}\&\ val\ :\ f2.constants)}
\DoxyCodeLine{00429\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ res.push\_back(val);}
\DoxyCodeLine{00430\ }
\DoxyCodeLine{00431\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{int}\ i\ =\ e2\ -\/\ e1;}
\DoxyCodeLine{00432\ }
\DoxyCodeLine{00433\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keywordtype}{int}\ j\ =\ 0;\ j\ <\ i;\ j++)}
\DoxyCodeLine{00434\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ res[j]\ *=\ -\/1;}
\DoxyCodeLine{00435\ }
\DoxyCodeLine{00436\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keyword}{auto}\&\ val\ :\ f1.constants)}
\DoxyCodeLine{00437\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00438\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ res[i]\ =\ val\ -\/\ res[i];}
\DoxyCodeLine{00439\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ i++;}
\DoxyCodeLine{00440\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00441\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00442\ }
\DoxyCodeLine{00443\ \ \ \ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_function}{Function}}\ f(r);}
\DoxyCodeLine{00444\ \ \ \ \ \ \ \ \ \ \ \ \ f.\mbox{\hyperlink{class_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_function_ac27a8c4c7a6b39d087c8c20a63756cb3}{SetConstants}}(res);}
\DoxyCodeLine{00445\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ f;}
\DoxyCodeLine{00446\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00447\ }
\DoxyCodeLine{00449\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_function}{Function}}\ operator*(\textcolor{keyword}{const}\ \mbox{\hyperlink{class_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_function}{Function}}\&\ f,\ \textcolor{keyword}{const}\ int64\_t\&\ c)}
\DoxyCodeLine{00450\ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00451\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{try}}
\DoxyCodeLine{00452\ \ \ \ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00453\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ f.CanPerform();}
\DoxyCodeLine{00454\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00455\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{catch}\ (\textcolor{keyword}{const}\ std::exception\&\ e)}
\DoxyCodeLine{00456\ \ \ \ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00457\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{throw}\ e;}
\DoxyCodeLine{00458\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00459\ }
\DoxyCodeLine{00460\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (c\ ==\ 1)\ \textcolor{keywordflow}{return}\ f;}
\DoxyCodeLine{00461\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (c\ ==\ 0)\ \textcolor{keywordflow}{throw}\ std::logic\_error(\textcolor{stringliteral}{"{}Cannot\ multiply\ a\ function\ by\ 0"{}});}
\DoxyCodeLine{00462\ }
\DoxyCodeLine{00463\ \ \ \ \ \ \ \ \ \ \ \ \ std::vector<int64\_t>\ res;}
\DoxyCodeLine{00464\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keyword}{auto}\&\ val\ :\ f.constants)}
\DoxyCodeLine{00465\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ res.push\_back(c\ *\ val);}
\DoxyCodeLine{00466\ }
\DoxyCodeLine{00467\ \ \ \ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_function}{Function}}\ f\_res(f.lrgst\_expo);}
\DoxyCodeLine{00468\ \ \ \ \ \ \ \ \ \ \ \ \ f\_res.\mbox{\hyperlink{class_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_function_ac27a8c4c7a6b39d087c8c20a63756cb3}{SetConstants}}(res);}
\DoxyCodeLine{00469\ }
\DoxyCodeLine{00470\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ f\_res;}
\DoxyCodeLine{00471\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00472\ }
\DoxyCodeLine{00474\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_function}{Function}}\&\ \mbox{\hyperlink{class_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_function_a24f53f18a66c4911c9ec89f98b2f6781}{Function::operator*=}}(\textcolor{keyword}{const}\ int64\_t\&\ c)}
\DoxyCodeLine{00475\ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00476\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{try}}
\DoxyCodeLine{00477\ \ \ \ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00478\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ this-\/>CanPerform();}
\DoxyCodeLine{00479\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00480\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{catch}\ (\textcolor{keyword}{const}\ std::exception\&\ e)}
\DoxyCodeLine{00481\ \ \ \ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00482\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{throw}\ e;}
\DoxyCodeLine{00483\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00484\ }
\DoxyCodeLine{00485\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (c\ ==\ 1)\ \textcolor{keywordflow}{return}\ *\textcolor{keyword}{this};}
\DoxyCodeLine{00486\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (c\ ==\ 0)\ \textcolor{keywordflow}{throw}\ std::logic\_error(\textcolor{stringliteral}{"{}Cannot\ multiply\ a\ function\ by\ 0"{}});}
\DoxyCodeLine{00487\ }
\DoxyCodeLine{00488\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keyword}{auto}\&\ val\ :\ this-\/>constants)}
\DoxyCodeLine{00489\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ val\ *=\ c;}
\DoxyCodeLine{00490\ }
\DoxyCodeLine{00491\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ *\textcolor{keyword}{this};}
\DoxyCodeLine{00492\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00493\ \ \ \ \ \ \ \ \ }
\DoxyCodeLine{00494\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_function}{Function}}\ \mbox{\hyperlink{class_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_function_af05a7be6e85e4879185a84dc32cdf79c}{Function::differential}}()\textcolor{keyword}{\ const}}
\DoxyCodeLine{00495\ \textcolor{keyword}{\ \ \ \ \ \ \ \ }\{}
\DoxyCodeLine{00496\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{try}}
\DoxyCodeLine{00497\ \ \ \ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00498\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ this-\/>CanPerform();}
\DoxyCodeLine{00499\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00500\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{catch}\ (\textcolor{keyword}{const}\ std::exception\&\ e)}
\DoxyCodeLine{00501\ \ \ \ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00502\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{throw}\ e;}
\DoxyCodeLine{00503\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00504\ }
\DoxyCodeLine{00505\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (lrgst\_expo\ ==\ 0)}
\DoxyCodeLine{00506\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{throw}\ std::logic\_error(\textcolor{stringliteral}{"{}Cannot\ differentiate\ a\ number\ (Function<0>)"{}});}
\DoxyCodeLine{00507\ }
\DoxyCodeLine{00508\ \ \ \ \ \ \ \ \ \ \ \ \ std::vector<int64\_t>\ result;}
\DoxyCodeLine{00509\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keywordtype}{int}\ i\ =\ 0;\ i\ <\ lrgst\_expo;\ i++)}
\DoxyCodeLine{00510\ \ \ \ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00511\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ result.push\_back(constants[i]\ *\ (lrgst\_expo\ -\/\ i));}
\DoxyCodeLine{00512\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00513\ }
\DoxyCodeLine{00514\ \ \ \ \ \ \ \ \ \ \ \ \ \mbox{\hyperlink{class_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_function}{Function}}\ f\{\ (\textcolor{keywordtype}{unsigned}\ short)(lrgst\_expo\ -\/\ 1)\ \};}
\DoxyCodeLine{00515\ \ \ \ \ \ \ \ \ \ \ \ \ f.\mbox{\hyperlink{class_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_function_ac27a8c4c7a6b39d087c8c20a63756cb3}{SetConstants}}(result);}
\DoxyCodeLine{00516\ }
\DoxyCodeLine{00517\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ f;}
\DoxyCodeLine{00518\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00519\ }
\DoxyCodeLine{00520\ \ \ \ \ \ \ \ \ std::vector<double>\ \mbox{\hyperlink{class_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_function_a2fe7e79ec57cb7160c783c20870fe855}{Function::get\_real\_roots}}(\textcolor{keyword}{const}\ \mbox{\hyperlink{struct_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_g_a___options}{GA\_Options}}\&\ options)\textcolor{keyword}{\ const}}
\DoxyCodeLine{00521\ \textcolor{keyword}{\ \ \ \ \ \ \ \ }\{}
\DoxyCodeLine{00522\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{try}}
\DoxyCodeLine{00523\ \ \ \ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00524\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ this-\/>CanPerform();}
\DoxyCodeLine{00525\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00526\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{catch}\ (\textcolor{keyword}{const}\ std::exception\&\ e)}
\DoxyCodeLine{00527\ \ \ \ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00528\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{throw}\ e;}
\DoxyCodeLine{00529\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00530\ }
\DoxyCodeLine{00531\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ Create\ initial\ random\ solutions}}
\DoxyCodeLine{00532\ \ \ \ \ \ \ \ \ \ \ \ \ std::random\_device\ device;}
\DoxyCodeLine{00533\ \ \ \ \ \ \ \ \ \ \ \ \ std::uniform\_real\_distribution<double>\ unif(options.\mbox{\hyperlink{struct_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_g_a___options_a316979973a2a6b70b00520c2f753a43c}{min\_range}},\ options.\mbox{\hyperlink{struct_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_g_a___options_a9b8f1e5367f6b0d8b16eecaea53b40e2}{max\_range}});}
\DoxyCodeLine{00534\ \ \ \ \ \ \ \ \ \ \ \ \ std::vector<GA\_Solution>\ solutions;}
\DoxyCodeLine{00535\ }
\DoxyCodeLine{00536\ \ \ \ \ \ \ \ \ \ \ \ \ solutions.resize(options.\mbox{\hyperlink{struct_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_g_a___options_a6ec95fe6cc95dc32727659cf5bb1be12}{data\_size}});}
\DoxyCodeLine{00537\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{int}\ i\ =\ 0;\ i\ <\ options.\mbox{\hyperlink{struct_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_g_a___options_ad133af29dbbc26b8c3d507d359c03326}{sample\_size}};\ i++)}
\DoxyCodeLine{00538\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ solutions[i]\ =\ (GA\_Solution\{lrgst\_expo,\ 0,\ unif(device)\});}
\DoxyCodeLine{00539\ }
\DoxyCodeLine{00540\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{float}\ timer\{\ 0\ \};}
\DoxyCodeLine{00541\ }
\DoxyCodeLine{00542\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{int}\ count\ =\ 0;\ count\ <\ options.\mbox{\hyperlink{struct_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_g_a___options_a4a67bad303f8a4fca40020a0802524c5}{num\_of\_generations}};\ count++)}
\DoxyCodeLine{00543\ \ \ \ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00544\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ std::generate(std::execution::par,\ solutions.begin()\ +\ options.\mbox{\hyperlink{struct_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_g_a___options_ad133af29dbbc26b8c3d507d359c03326}{sample\_size}},\ solutions.end(),\ [\textcolor{keyword}{this},\ \&unif,\ \&device]()\ \{}
\DoxyCodeLine{00545\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ return\ GA\_Solution\{lrgst\_expo,\ 0,\ unif(device)\};}
\DoxyCodeLine{00546\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \});}
\DoxyCodeLine{00547\ }
\DoxyCodeLine{00548\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ Run\ our\ fitness\ function}}
\DoxyCodeLine{00549\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keyword}{auto}\&\ s\ :\ solutions)\ \{\ s.fitness(constants);\ \}}
\DoxyCodeLine{00550\ }
\DoxyCodeLine{00551\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ Sort\ our\ solutions\ by\ rank}}
\DoxyCodeLine{00552\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ std::sort(std::execution::par,\ solutions.begin(),\ solutions.end(),}
\DoxyCodeLine{00553\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ [](\textcolor{keyword}{const}\ \textcolor{keyword}{auto}\&\ lhs,\ \textcolor{keyword}{const}\ \textcolor{keyword}{auto}\&\ rhs)\ \{}
\DoxyCodeLine{00554\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ return\ lhs.rank\ >\ rhs.rank;}
\DoxyCodeLine{00555\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \});}
\DoxyCodeLine{00556\ }
\DoxyCodeLine{00557\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ Take\ top\ solutions}}
\DoxyCodeLine{00558\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ std::vector<GA\_Solution>\ sample;}
\DoxyCodeLine{00559\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ std::copy(}
\DoxyCodeLine{00560\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ solutions.begin(),}
\DoxyCodeLine{00561\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ solutions.begin()\ +\ options.\mbox{\hyperlink{struct_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_g_a___options_ad133af29dbbc26b8c3d507d359c03326}{sample\_size}},}
\DoxyCodeLine{00562\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ std::back\_inserter(sample)}
\DoxyCodeLine{00563\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ );}
\DoxyCodeLine{00564\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ solutions.clear();}
\DoxyCodeLine{00565\ }
\DoxyCodeLine{00566\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (count\ +\ 1\ ==\ options.\mbox{\hyperlink{struct_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_g_a___options_a4a67bad303f8a4fca40020a0802524c5}{num\_of\_generations}})}
\DoxyCodeLine{00567\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00568\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ std::copy(}
\DoxyCodeLine{00569\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ sample.begin(),}
\DoxyCodeLine{00570\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ sample.end(),}
\DoxyCodeLine{00571\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ std::back\_inserter(solutions)}
\DoxyCodeLine{00572\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ );}
\DoxyCodeLine{00573\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ sample.clear();}
\DoxyCodeLine{00574\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{break};}
\DoxyCodeLine{00575\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00576\ }
\DoxyCodeLine{00577\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ Mutate\ the\ top\ solutions\ by\ \%}}
\DoxyCodeLine{00578\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ std::uniform\_real\_distribution<double>\ m((1\ -\/\ options.\mbox{\hyperlink{struct_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_g_a___options_a736488b3cfeebda7b93b3e8c6f576bf8}{mutation\_percentage}}),\ (1\ +\ options.\mbox{\hyperlink{struct_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_g_a___options_a736488b3cfeebda7b93b3e8c6f576bf8}{mutation\_percentage}}));}
\DoxyCodeLine{00579\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ std::for\_each(sample.begin(),\ sample.end(),\ [\&m,\ \&device](\textcolor{keyword}{auto}\&\ s)\ \{}
\DoxyCodeLine{00580\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ s.x\ *=\ m(device);}
\DoxyCodeLine{00581\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \});}
\DoxyCodeLine{00582\ }
\DoxyCodeLine{00583\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ Cross\ over\ not\ needed\ as\ it's\ only\ one\ value}}
\DoxyCodeLine{00584\ }
\DoxyCodeLine{00585\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ std::copy(}
\DoxyCodeLine{00586\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ sample.begin(),}
\DoxyCodeLine{00587\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ sample.end(),}
\DoxyCodeLine{00588\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ std::back\_inserter(solutions)}
\DoxyCodeLine{00589\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ );}
\DoxyCodeLine{00590\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ sample.clear();}
\DoxyCodeLine{00591\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ solutions.resize(options.\mbox{\hyperlink{struct_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_g_a___options_a6ec95fe6cc95dc32727659cf5bb1be12}{data\_size}});}
\DoxyCodeLine{00592\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00593\ }
\DoxyCodeLine{00594\ \ \ \ \ \ \ \ \ \ \ \ \ std::sort(solutions.begin(),\ solutions.end(),}
\DoxyCodeLine{00595\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ [](\textcolor{keyword}{const}\ \textcolor{keyword}{auto}\&\ lhs,\ \textcolor{keyword}{const}\ \textcolor{keyword}{auto}\&\ rhs)\ \{}
\DoxyCodeLine{00596\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ return\ lhs.x\ <\ rhs.x;}
\DoxyCodeLine{00597\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \});}
\DoxyCodeLine{00598\ }
\DoxyCodeLine{00599\ \ \ \ \ \ \ \ \ \ \ \ \ std::vector<double>\ ans;}
\DoxyCodeLine{00600\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keyword}{auto}\&\ s\ :\ solutions)}
\DoxyCodeLine{00601\ \ \ \ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00602\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ans.push\_back(s.x);}
\DoxyCodeLine{00603\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00604\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ ans;}
\DoxyCodeLine{00605\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00606\ }
\DoxyCodeLine{00607\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{double}\ Function::solve\_y(\textcolor{keyword}{const}\ \textcolor{keywordtype}{double}\&\ x\_val)\textcolor{keyword}{\ const}}
\DoxyCodeLine{00608\ \textcolor{keyword}{\ \ \ \ \ \ \ \ }\{}
\DoxyCodeLine{00609\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{try}}
\DoxyCodeLine{00610\ \ \ \ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00611\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ this-\/>CanPerform();}
\DoxyCodeLine{00612\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00613\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{catch}\ (\textcolor{keyword}{const}\ std::exception\&\ e)}
\DoxyCodeLine{00614\ \ \ \ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00615\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{throw}\ e;}
\DoxyCodeLine{00616\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00617\ }
\DoxyCodeLine{00618\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{double}\ ans\{\ 0\ \};}
\DoxyCodeLine{00619\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keywordtype}{int}\ i\ =\ lrgst\_expo;\ i\ >=\ 0;\ i-\/-\/)}
\DoxyCodeLine{00620\ \ \ \ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00621\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ans\ +=\ constants[i]\ *\ POW(x\_val,\ (lrgst\_expo\ -\/\ i));}
\DoxyCodeLine{00622\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00623\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ ans;}
\DoxyCodeLine{00624\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00625\ }
\DoxyCodeLine{00626\ \ \ \ \ \ \ \ \ \textcolor{keyword}{inline}\ std::vector<double>\ Function::solve\_x(\textcolor{keyword}{const}\ \textcolor{keywordtype}{double}\&\ y\_val,\ \textcolor{keyword}{const}\ \mbox{\hyperlink{struct_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_g_a___options}{GA\_Options}}\&\ options)\textcolor{keyword}{\ const}}
\DoxyCodeLine{00627\ \textcolor{keyword}{\ \ \ \ \ \ \ \ }\{}
\DoxyCodeLine{00628\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{try}}
\DoxyCodeLine{00629\ \ \ \ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00630\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ this-\/>CanPerform();}
\DoxyCodeLine{00631\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00632\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{catch}\ (\textcolor{keyword}{const}\ std::exception\&\ e)}
\DoxyCodeLine{00633\ \ \ \ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00634\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{throw}\ e;}
\DoxyCodeLine{00635\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00636\ }
\DoxyCodeLine{00637\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ Create\ initial\ random\ solutions}}
\DoxyCodeLine{00638\ \ \ \ \ \ \ \ \ \ \ \ \ std::random\_device\ device;}
\DoxyCodeLine{00639\ \ \ \ \ \ \ \ \ \ \ \ \ std::uniform\_real\_distribution<double>\ unif(options.\mbox{\hyperlink{struct_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_g_a___options_a316979973a2a6b70b00520c2f753a43c}{min\_range}},\ options.\mbox{\hyperlink{struct_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_g_a___options_a9b8f1e5367f6b0d8b16eecaea53b40e2}{max\_range}});}
\DoxyCodeLine{00640\ \ \ \ \ \ \ \ \ \ \ \ \ std::vector<GA\_Solution>\ solutions;}
\DoxyCodeLine{00641\ }
\DoxyCodeLine{00642\ \ \ \ \ \ \ \ \ \ \ \ \ solutions.resize(options.\mbox{\hyperlink{struct_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_g_a___options_a6ec95fe6cc95dc32727659cf5bb1be12}{data\_size}});}
\DoxyCodeLine{00643\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{int}\ i\ =\ 0;\ i\ <\ options.\mbox{\hyperlink{struct_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_g_a___options_ad133af29dbbc26b8c3d507d359c03326}{sample\_size}};\ i++)}
\DoxyCodeLine{00644\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ solutions[i]\ =\ (GA\_Solution\{lrgst\_expo,\ 0,\ unif(device),\ y\_val\});}
\DoxyCodeLine{00645\ }
\DoxyCodeLine{00646\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{int}\ count\ =\ 0;\ count\ <\ options.\mbox{\hyperlink{struct_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_g_a___options_a4a67bad303f8a4fca40020a0802524c5}{num\_of\_generations}};\ count++)}
\DoxyCodeLine{00647\ \ \ \ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00648\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ std::generate(std::execution::par,\ solutions.begin()\ +\ options.\mbox{\hyperlink{struct_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_g_a___options_ad133af29dbbc26b8c3d507d359c03326}{sample\_size}},\ solutions.end(),\ [\textcolor{keyword}{this},\ \&unif,\ \&device,\ \&y\_val]()\ \{}
\DoxyCodeLine{00649\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ return\ GA\_Solution\{lrgst\_expo,\ 0,\ unif(device),\ y\_val\};}
\DoxyCodeLine{00650\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \});}
\DoxyCodeLine{00651\ }
\DoxyCodeLine{00652\ }
\DoxyCodeLine{00653\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ Run\ our\ fitness\ function}}
\DoxyCodeLine{00654\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keyword}{auto}\&\ s\ :\ solutions)\ \{\ s.fitness(constants);\ \}}
\DoxyCodeLine{00655\ }
\DoxyCodeLine{00656\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ Sort\ our\ solutions\ by\ rank}}
\DoxyCodeLine{00657\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ std::sort(std::execution::par,\ solutions.begin(),\ solutions.end(),}
\DoxyCodeLine{00658\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ [](\textcolor{keyword}{const}\ \textcolor{keyword}{auto}\&\ lhs,\ \textcolor{keyword}{const}\ \textcolor{keyword}{auto}\&\ rhs)\ \{}
\DoxyCodeLine{00659\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ return\ lhs.rank\ >\ rhs.rank;}
\DoxyCodeLine{00660\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \});}
\DoxyCodeLine{00661\ }
\DoxyCodeLine{00662\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ Take\ top\ solutions}}
\DoxyCodeLine{00663\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ std::vector<GA\_Solution>\ sample;}
\DoxyCodeLine{00664\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ std::copy(}
\DoxyCodeLine{00665\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ solutions.begin(),}
\DoxyCodeLine{00666\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ solutions.begin()\ +\ options.\mbox{\hyperlink{struct_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_g_a___options_ad133af29dbbc26b8c3d507d359c03326}{sample\_size}},}
\DoxyCodeLine{00667\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ std::back\_inserter(sample)}
\DoxyCodeLine{00668\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ );}
\DoxyCodeLine{00669\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ solutions.clear();}
\DoxyCodeLine{00670\ }
\DoxyCodeLine{00671\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (count\ +\ 1\ ==\ options.\mbox{\hyperlink{struct_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_g_a___options_a4a67bad303f8a4fca40020a0802524c5}{num\_of\_generations}})}
\DoxyCodeLine{00672\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00673\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ std::copy(}
\DoxyCodeLine{00674\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ sample.begin(),}
\DoxyCodeLine{00675\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ sample.end(),}
\DoxyCodeLine{00676\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ std::back\_inserter(solutions)}
\DoxyCodeLine{00677\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ );}
\DoxyCodeLine{00678\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ sample.clear();}
\DoxyCodeLine{00679\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{break};}
\DoxyCodeLine{00680\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00681\ }
\DoxyCodeLine{00682\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ Mutate\ the\ top\ solutions\ by\ \%}}
\DoxyCodeLine{00683\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ std::uniform\_real\_distribution<double>\ m((1\ -\/\ options.\mbox{\hyperlink{struct_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_g_a___options_a736488b3cfeebda7b93b3e8c6f576bf8}{mutation\_percentage}}),\ (1\ +\ options.\mbox{\hyperlink{struct_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_g_a___options_a736488b3cfeebda7b93b3e8c6f576bf8}{mutation\_percentage}}));}
\DoxyCodeLine{00684\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ std::for\_each(sample.begin(),\ sample.end(),\ [\&m,\ \&device](\textcolor{keyword}{auto}\&\ s)\ \{}
\DoxyCodeLine{00685\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ s.x\ *=\ m(device);}
\DoxyCodeLine{00686\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \});}
\DoxyCodeLine{00687\ }
\DoxyCodeLine{00688\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ Cross\ over\ not\ needed\ as\ it's\ only\ one\ value}}
\DoxyCodeLine{00689\ }
\DoxyCodeLine{00690\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ std::copy(}
\DoxyCodeLine{00691\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ sample.begin(),}
\DoxyCodeLine{00692\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ sample.end(),}
\DoxyCodeLine{00693\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ std::back\_inserter(solutions)}
\DoxyCodeLine{00694\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ );}
\DoxyCodeLine{00695\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ sample.clear();}
\DoxyCodeLine{00696\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ solutions.resize(options.\mbox{\hyperlink{struct_j_r_a_m_p_e_r_s_a_d_1_1_e_x_p_o_n_e_n_t_i_a_l_1_1_g_a___options_a6ec95fe6cc95dc32727659cf5bb1be12}{data\_size}});}
\DoxyCodeLine{00697\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00698\ }
\DoxyCodeLine{00699\ \ \ \ \ \ \ \ \ \ \ \ \ std::sort(solutions.begin(),\ solutions.end(),}
\DoxyCodeLine{00700\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ [](\textcolor{keyword}{const}\ \textcolor{keyword}{auto}\&\ lhs,\ \textcolor{keyword}{const}\ \textcolor{keyword}{auto}\&\ rhs)\ \{}
\DoxyCodeLine{00701\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ return\ lhs.x\ <\ rhs.x;}
\DoxyCodeLine{00702\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \});}
\DoxyCodeLine{00703\ }
\DoxyCodeLine{00704\ \ \ \ \ \ \ \ \ \ \ \ \ std::vector<double>\ ans;}
\DoxyCodeLine{00705\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (\textcolor{keyword}{auto}\&\ s\ :\ solutions)}
\DoxyCodeLine{00706\ \ \ \ \ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00707\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ans.push\_back(s.x);}
\DoxyCodeLine{00708\ \ \ \ \ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00709\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ ans;}
\DoxyCodeLine{00710\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00711\ \ \ \ \ \}}
\DoxyCodeLine{00712\ \}}
\DoxyCodeLine{00713\ }
\DoxyCodeLine{00714\ \textcolor{preprocessor}{\#define\ INITIALIZE\_EXPO\_FUNCTION(func,\ ...)\ \(\backslash\)}}
\DoxyCodeLine{00715\ \textcolor{preprocessor}{func.SetConstants(\_\_VA\_ARGS\_\_)}}
\DoxyCodeLine{00716\ }
\DoxyCodeLine{00717\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\ !JONATHAN\_RAMPERSAD\_EXPONENTIAL\_H\_}}

\end{DoxyCode}
