\hypertarget{math_2utility_8h}{\section{meowpp/math/utility.h File Reference} \label{math_2utility_8h}\index{meowpp/math/utility.\-h@{meowpp/math/utility.\-h}} } {\ttfamily \#include $<$cstdlib$>$}\\* {\ttfamily \#include $<$vector$>$}\\* {\ttfamily \#include $<$algorithm$>$}\\* {\ttfamily \#include $<$cmath$>$}\\* \subsection*{Namespaces} \begin{DoxyCompactItemize} \item namespace \hyperlink{namespacemeow}{meow} \end{DoxyCompactItemize} \subsection*{Functions} \begin{DoxyCompactItemize} \item {\footnotesize template$<$class T $>$ }\\T \hyperlink{namespacemeow_ab9456533c0ae85fba812bfb5b017c8d2}{meow\-::no\-E\-P\-S} (T value, T eps=1e-\/9) \begin{DoxyCompactList}\small\item\em 如果abs(輸入的數值) $<$ eps, 則回傳0, 否則回傳輸入的數值 \end{DoxyCompactList}\item {\footnotesize template$<$class T $>$ }\\T \hyperlink{namespacemeow_aebe1ad335556790c578c4cf7836fd9ca}{meow\-::normalize} (T lower, T upper, T value) \begin{DoxyCompactList}\small\item\em {\ttfamily }(value-\/lower)/(upper-\/lower) \end{DoxyCompactList}\item {\footnotesize template$<$class T $>$ }\\T \hyperlink{namespacemeow_af95cfca15ad7a51ed4d07b06e1296080}{meow\-::denormalize} (T lower, T upper, T \-\_\-ratio) \begin{DoxyCompactList}\small\item\em {\ttfamily }(lower+\-\_\-ratio$\ast$(upper-\/lower)) \end{DoxyCompactList}\item {\footnotesize template$<$class T $>$ }\\T \hyperlink{namespacemeow_a3b01a91eb4a02909a61a35e406fa5732}{meow\-::ratio\-Mapping} (T l1, T u1, T m1, T l2, T u2) \begin{DoxyCompactList}\small\item\em {\ttfamily denormalize}(l2,u2,normalize(l1,u1,m1)) \end{DoxyCompactList}\item {\footnotesize template$<$class T $>$ }\\T \hyperlink{namespacemeow_a98d838d338a3e6f3c57e94562fab3fa7}{meow\-::in\-Range} (T const \&mn, T const \&mx, T const \&v) \begin{DoxyCompactList}\small\item\em {\ttfamily std\-::min}(mx,std\-::max(mn,v)) \end{DoxyCompactList}\item {\footnotesize template$<$class T $>$ }\\T \hyperlink{namespacemeow_ae8486a6227b6ed69d5ff666fe67ebf4e}{meow\-::is\-In\-Range} (T const \&mn, T const \&mx, T const \&x) \begin{DoxyCompactList}\small\item\em (mn $<$= x \&\& x $<$= mx) \end{DoxyCompactList}\item {\footnotesize template$<$class T $>$ }\\T \hyperlink{namespacemeow_a1954e235973a2ac79a7a72a4b7d25573}{meow\-::squ} (T const \&x) \begin{DoxyCompactList}\small\item\em {\ttfamily x$\ast$x} \end{DoxyCompactList}\item {\footnotesize template$<$class T $>$ }\\T \hyperlink{namespacemeow_a10a8cca705773b7d9f6f91d3fb08c104}{meow\-::cub} (T const \&x) \begin{DoxyCompactList}\small\item\em {\ttfamily x$\ast$x$\ast$x} \end{DoxyCompactList}\item {\footnotesize template$<$class T $>$ }\\\hyperlink{classdouble}{double} \hyperlink{namespacemeow_ad4d1e5fa951e5534204a0ee3eee22777}{meow\-::average} (T const \&beg, T const \&end, \hyperlink{classdouble}{double} sigs) \begin{DoxyCompactList}\small\item\em 只將 {\ttfamily sigs} 個標準差以內的數據拿來取平均 \end{DoxyCompactList}\item {\footnotesize template$<$class T $>$ }\\\hyperlink{classdouble}{double} \hyperlink{namespacemeow_a6ae78e60d507c85de003f8fa8423b650}{meow\-::average} (T const \&beg, T const \&end, T const \&p, \hyperlink{classdouble}{double} sigs) \begin{DoxyCompactList}\small\item\em 只將 {\ttfamily sigs} 個標準差以內的數據拿來取平均, 不過這次用 {\ttfamily p} 來加權平均 \end{DoxyCompactList}\item {\footnotesize template$<$class T $>$ }\\T \hyperlink{namespacemeow_ae880337dfdcc67984a0dccdb50e5c5d0}{meow\-::t\-Abs} (T const \&t) \begin{DoxyCompactList}\small\item\em 就只是個取絕對值 \end{DoxyCompactList}\end{DoxyCompactItemize} \subsection*{Variables} \begin{DoxyCompactItemize} \item static const \hyperlink{classdouble}{double} \hyperlink{namespacemeow_aa86d5920087a4e73078b759bc3996f76}{meow\-::\-P\-I} = 3.\-14159265358979323846264338327950288 \begin{DoxyCompactList}\small\item\em 圓周率... \end{DoxyCompactList}\end{DoxyCompactItemize}