\section{utils.h File Reference}
\label{utils_h}\index{utils.h@{utils.h}}
{\tt \#include $<$math.h$>$}\par


Include dependency graph for utils.h:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=36pt]{utils_h_incl}
\end{center}
\end{figure}


This graph shows which files directly or indirectly include this file:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=420pt]{utils_h_dep_incl}
\end{center}
\end{figure}
\subsection*{Defines}
\begin{CompactItemize}
\item 
\#define {\bf ERROR}(X)
\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\item 
void {\bf util\_\-swap} (T \&t1, T \&t2)
\item 
T {\bf util\_\-max} (const T \&t1, const T \&t2)
\item 
T {\bf util\_\-min} (const T \&t1, const T \&t2)
\item 
T {\bf bound} (const T \&t, const T \&t1, const T \&t2)
\item 
bool {\bf bounded} (const T \&t, const T \&t1, const T \&t2)
\item 
bool {\bf bounds\_\-compare} (const T \&t, const T \&t1, const T \&t2)
\item 
double {\bf mod\_\-dist} (double x, double y, double m)
\item 
int {\bf bit\_\-count} (unsigned char uc)
\item 
int {\bf odd} (int n)
\item 
T {\bf sq} (T \&t1)
\end{CompactItemize}
\subsection*{Variables}
\begin{CompactItemize}
\item 
const int {\bf bit\_\-count\_\-array} [256]
\item 
const double {\bf sqrt2}
\item 
const double {\bf sqrt2\_\-2}
\item 
const double {\bf sqrt3}
\item 
const double {\bf sqrt3\_\-2}
\item 
const double {\bf sqrt5}
\item 
const double {\bf sqrt5\_\-2}
\item 
const double {\bf pi}
\item 
const double {\bf pi2}
\item 
const double {\bf pi\_\-2}
\item 
const double {\bf o\_\-sqrt2}
\item 
const double {\bf o\_\-sqrt2\_\-2}
\item 
const double {\bf o\_\-sqrt3}
\item 
const double {\bf o\_\-sqrt3\_\-2}
\item 
const double {\bf o\_\-pi}
\item 
const double {\bf o\_\-pi2}
\item 
const double {\bf o\_\-pi\_\-2}
\item 
const double {\bf rad\_\-to\_\-deg}
\item 
const double {\bf deg\_\-to\_\-rad}
\end{CompactItemize}


\subsection{Define Documentation}
\index{utils.h@{utils.h}!ERROR@{ERROR}}
\index{ERROR@{ERROR}!utils.h@{utils.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define ERROR(X)}\label{utils_h_a0}


{\bf Value:}\footnotesize\begin{verbatim}        cerr << "Error: " << __FILE__ << " (" << __LINE__ << ')' \
             << "\t" #X " = " << (X) \
             << endl;
\end{verbatim}\normalsize 


Definition at line 133 of file utils.h.

\subsection{Function Documentation}
\index{utils.h@{utils.h}!bit_count@{bit\_\-count}}
\index{bit_count@{bit\_\-count}!utils.h@{utils.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int bit\_\-count (unsigned char {\em uc})\hspace{0.3cm}{\tt  [inline]}}\label{utils_h_a27}




Definition at line 88 of file utils.h.

Referenced by ABit\-Set::Count().\footnotesize\begin{verbatim}00089 {
00090         return bit_count_array[uc];
00091 \end{verbatim}\normalsize 
\index{utils.h@{utils.h}!bound@{bound}}
\index{bound@{bound}!utils.h@{utils.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}T bound (const T \& {\em t}, const T \& {\em t1}, const T \& {\em t2})\hspace{0.3cm}{\tt  [static]}}\label{utils_h_a23}




Definition at line 45 of file utils.h.\footnotesize\begin{verbatim}00046 {
00047         return util_min(util_max(t1,t2), util_max(util_min(t1,t2),t));
00048 \end{verbatim}\normalsize 
\index{utils.h@{utils.h}!bounded@{bounded}}
\index{bounded@{bounded}!utils.h@{utils.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool bounded (const T \& {\em t}, const T \& {\em t1}, const T \& {\em t2})\hspace{0.3cm}{\tt  [static]}}\label{utils_h_a24}




Definition at line 52 of file utils.h.\footnotesize\begin{verbatim}00053 {
00054         return (t <= util_max(t1,t2)) && (t >= util_min(t1,t2));
00055 \end{verbatim}\normalsize 
\index{utils.h@{utils.h}!bounds_compare@{bounds\_\-compare}}
\index{bounds_compare@{bounds\_\-compare}!utils.h@{utils.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool bounds\_\-compare (const T \& {\em t}, const T \& {\em t1}, const T \& {\em t2})\hspace{0.3cm}{\tt  [static]}}\label{utils_h_a25}




Definition at line 59 of file utils.h.\footnotesize\begin{verbatim}00060 {
00061         return
00062                 (t > util_max(t1,t2))
00063                         ? +1
00064                         : ((t < min(t1,t2))
00065                                 ? -1
00066                                 : 0);
00067 \end{verbatim}\normalsize 
\index{utils.h@{utils.h}!mod_dist@{mod\_\-dist}}
\index{mod_dist@{mod\_\-dist}!utils.h@{utils.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}double mod\_\-dist (double {\em x}, double {\em y}, double {\em m})\hspace{0.3cm}{\tt  [inline]}}\label{utils_h_a26}




Definition at line 70 of file utils.h.\footnotesize\begin{verbatim}00071 {
00072         double  d = x-y;
00073         if (m == 0.0)
00074                 return d<0.0 ? -d : d;
00075 
00076         if (d<0.0)
00077                 d = -d;
00078 
00079         const double  p = fmod(d, m);
00080         const double  n = fmod(-p+m, m);
00081         return util_min(p,n);
00082 \end{verbatim}\normalsize 
\index{utils.h@{utils.h}!odd@{odd}}
\index{odd@{odd}!utils.h@{utils.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int odd (int {\em n})\hspace{0.3cm}{\tt  [inline]}}\label{utils_h_a28}




Definition at line 139 of file utils.h.

Referenced by Matrix::det().\footnotesize\begin{verbatim}00140 {
00141   return (n % 2);
00142 
00143 \end{verbatim}\normalsize 
\index{utils.h@{utils.h}!sq@{sq}}
\index{sq@{sq}!utils.h@{utils.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}T sq (T \& {\em t1})\hspace{0.3cm}{\tt  [static]}}\label{utils_h_a29}




Definition at line 147 of file utils.h.

Referenced by Matrix::find\-Eigen\-Vectors().\footnotesize\begin{verbatim}00148 {
00149   return (t1 * t1);
00150 \end{verbatim}\normalsize 
\index{utils.h@{utils.h}!util_max@{util\_\-max}}
\index{util_max@{util\_\-max}!utils.h@{utils.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}T util\_\-max (const T \& {\em t1}, const T \& {\em t2})\hspace{0.3cm}{\tt  [static]}}\label{utils_h_a21}




Definition at line 31 of file utils.h.

Referenced by bound(), bounds\_\-compare(), and Bin\-Envelope\-Constraint::compute\-Stress().\footnotesize\begin{verbatim}00032 {
00033         return t1>t2 ? t1 : t2;
00034 \end{verbatim}\normalsize 
\index{utils.h@{utils.h}!util_min@{util\_\-min}}
\index{util_min@{util\_\-min}!utils.h@{utils.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}T util\_\-min (const T \& {\em t1}, const T \& {\em t2})\hspace{0.3cm}{\tt  [static]}}\label{utils_h_a22}




Definition at line 38 of file utils.h.

Referenced by ABit\-Set::Resize(), bound(), bounded(), mod\_\-dist(), ABit\-Set::operator \&=(), ABit\-Set::operator-=(), ABit\-Set::operator$^\wedge$=(), and ABit\-Set::operator$|$=().\footnotesize\begin{verbatim}00039 {
00040         return t1<t2 ? t1 : t2;
00041 \end{verbatim}\normalsize 
\index{utils.h@{utils.h}!util_swap@{util\_\-swap}}
\index{util_swap@{util\_\-swap}!utils.h@{utils.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void util\_\-swap (T \& {\em t1}, T \& {\em t2})\hspace{0.3cm}{\tt  [static]}}\label{utils_h_a20}




Definition at line 22 of file utils.h.

Referenced by ABit\-Set::Clear(), ABit\-Set::Invert(), ABit\-Set::Set(), Matrix::swap\-Cols(), and Matrix::swap\-Rows().\footnotesize\begin{verbatim}00023 {
00024         T t = t1;
00025         t1 = t2;
00026         t2 = t;
00027 \end{verbatim}\normalsize 


\subsection{Variable Documentation}
\index{utils.h@{utils.h}!bit_count_array@{bit\_\-count\_\-array}}
\index{bit_count_array@{bit\_\-count\_\-array}!utils.h@{utils.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}const int bit\_\-count\_\-array[256]}\label{utils_h_a1}


{\bf Initial value:}\footnotesize\begin{verbatim} 
{
0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4, 
1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 
1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 
2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 
1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 
2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 
2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 
3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 
1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 
2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 
2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 
3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 
2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 
3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 
3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 
4, 5, 5, 6, 5, 6, 6, 7, 5, 6, 6, 7, 6, 7, 7, 8, 
}\end{verbatim}\normalsize 


Definition at line 5 of file utils.C.\index{utils.h@{utils.h}!deg_to_rad@{deg\_\-to\_\-rad}}
\index{deg_to_rad@{deg\_\-to\_\-rad}!utils.h@{utils.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}const double deg\_\-to\_\-rad}\label{utils_h_a19}


{\bf Initial value:}\footnotesize\begin{verbatim}
        0.017453292519943295769236907684886127134428718\end{verbatim}\normalsize 


Definition at line 129 of file utils.h.\index{utils.h@{utils.h}!o_pi@{o\_\-pi}}
\index{o_pi@{o\_\-pi}!utils.h@{utils.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}const double o\_\-pi}\label{utils_h_a15}


{\bf Initial value:}\footnotesize\begin{verbatim}
        0.318309886183790671537767526745028724068919291\end{verbatim}\normalsize 


Definition at line 120 of file utils.h.\index{utils.h@{utils.h}!o_pi2@{o\_\-pi2}}
\index{o_pi2@{o\_\-pi2}!utils.h@{utils.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}const double o\_\-pi2}\label{utils_h_a16}


{\bf Initial value:}\footnotesize\begin{verbatim}
         0.15915494309189533576888376337251436203445964\end{verbatim}\normalsize 


Definition at line 122 of file utils.h.\index{utils.h@{utils.h}!o_pi_2@{o\_\-pi\_\-2}}
\index{o_pi_2@{o\_\-pi\_\-2}!utils.h@{utils.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}const double o\_\-pi\_\-2}\label{utils_h_a17}


{\bf Initial value:}\footnotesize\begin{verbatim}
        0.636619772367581343075535053490057448137838582\end{verbatim}\normalsize 


Definition at line 124 of file utils.h.\index{utils.h@{utils.h}!o_sqrt2@{o\_\-sqrt2}}
\index{o_sqrt2@{o\_\-sqrt2}!utils.h@{utils.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}const double o\_\-sqrt2}\label{utils_h_a11}


{\bf Initial value:}\footnotesize\begin{verbatim}
        0.707106781186547524400844362104849039284835937\end{verbatim}\normalsize 


Definition at line 112 of file utils.h.\index{utils.h@{utils.h}!o_sqrt2_2@{o\_\-sqrt2\_\-2}}
\index{o_sqrt2_2@{o\_\-sqrt2\_\-2}!utils.h@{utils.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}const double o\_\-sqrt2\_\-2}\label{utils_h_a12}


{\bf Initial value:}\footnotesize\begin{verbatim}
        1.414213562373095048801688724209698078569671875\end{verbatim}\normalsize 


Definition at line 114 of file utils.h.\index{utils.h@{utils.h}!o_sqrt3@{o\_\-sqrt3}}
\index{o_sqrt3@{o\_\-sqrt3}!utils.h@{utils.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}const double o\_\-sqrt3}\label{utils_h_a13}


{\bf Initial value:}\footnotesize\begin{verbatim}
        0.577350269189625764509148780501957455647601751\end{verbatim}\normalsize 


Definition at line 116 of file utils.h.\index{utils.h@{utils.h}!o_sqrt3_2@{o\_\-sqrt3\_\-2}}
\index{o_sqrt3_2@{o\_\-sqrt3\_\-2}!utils.h@{utils.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}const double o\_\-sqrt3\_\-2}\label{utils_h_a14}


{\bf Initial value:}\footnotesize\begin{verbatim}
        1.154700538379251529018297561003914911295203502\end{verbatim}\normalsize 


Definition at line 118 of file utils.h.\index{utils.h@{utils.h}!pi@{pi}}
\index{pi@{pi}!utils.h@{utils.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}const double pi}\label{utils_h_a8}


{\bf Initial value:}\footnotesize\begin{verbatim}
        3.141592653589793238462643383279502884197169399\end{verbatim}\normalsize 


Definition at line 105 of file utils.h.\index{utils.h@{utils.h}!pi2@{pi2}}
\index{pi2@{pi2}!utils.h@{utils.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}const double pi2}\label{utils_h_a9}


{\bf Initial value:}\footnotesize\begin{verbatim}
        6.283185307179586476925286766559005768394338798\end{verbatim}\normalsize 


Definition at line 107 of file utils.h.\index{utils.h@{utils.h}!pi_2@{pi\_\-2}}
\index{pi_2@{pi\_\-2}!utils.h@{utils.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}const double pi\_\-2}\label{utils_h_a10}


{\bf Initial value:}\footnotesize\begin{verbatim}
        1.570796326794896619231321691639751442098584699\end{verbatim}\normalsize 


Definition at line 109 of file utils.h.\index{utils.h@{utils.h}!rad_to_deg@{rad\_\-to\_\-deg}}
\index{rad_to_deg@{rad\_\-to\_\-deg}!utils.h@{utils.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}const double rad\_\-to\_\-deg}\label{utils_h_a18}


{\bf Initial value:}\footnotesize\begin{verbatim} 
        57.29577951308232087679815481410517033240547246\end{verbatim}\normalsize 


Definition at line 127 of file utils.h.\index{utils.h@{utils.h}!sqrt2@{sqrt2}}
\index{sqrt2@{sqrt2}!utils.h@{utils.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}const double sqrt2}\label{utils_h_a2}


{\bf Initial value:}\footnotesize\begin{verbatim}
        1.414213562373095048801688724209698078569671875\end{verbatim}\normalsize 


Definition at line 93 of file utils.h.\index{utils.h@{utils.h}!sqrt2_2@{sqrt2\_\-2}}
\index{sqrt2_2@{sqrt2\_\-2}!utils.h@{utils.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}const double sqrt2\_\-2}\label{utils_h_a3}


{\bf Initial value:}\footnotesize\begin{verbatim}
        0.707106781186547524400844362104849039284835937\end{verbatim}\normalsize 


Definition at line 95 of file utils.h.\index{utils.h@{utils.h}!sqrt3@{sqrt3}}
\index{sqrt3@{sqrt3}!utils.h@{utils.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}const double sqrt3}\label{utils_h_a4}


{\bf Initial value:}\footnotesize\begin{verbatim}
        1.732050807568877293527446341505872366942805253\end{verbatim}\normalsize 


Definition at line 97 of file utils.h.\index{utils.h@{utils.h}!sqrt3_2@{sqrt3\_\-2}}
\index{sqrt3_2@{sqrt3\_\-2}!utils.h@{utils.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}const double sqrt3\_\-2}\label{utils_h_a5}


{\bf Initial value:}\footnotesize\begin{verbatim}
        0.866025403784438646763723170752936183471402626\end{verbatim}\normalsize 


Definition at line 99 of file utils.h.\index{utils.h@{utils.h}!sqrt5@{sqrt5}}
\index{sqrt5@{sqrt5}!utils.h@{utils.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}const double sqrt5}\label{utils_h_a6}


{\bf Initial value:}\footnotesize\begin{verbatim}
        2.236067977499789696409173668731276235440618359\end{verbatim}\normalsize 


Definition at line 101 of file utils.h.\index{utils.h@{utils.h}!sqrt5_2@{sqrt5\_\-2}}
\index{sqrt5_2@{sqrt5\_\-2}!utils.h@{utils.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}const double sqrt5\_\-2}\label{utils_h_a7}


{\bf Initial value:}\footnotesize\begin{verbatim}
        1.118033988749894848204586834365638117720309179\end{verbatim}\normalsize 


Definition at line 103 of file utils.h.