\section{jvector.C File Reference}
\label{jvector_C}\index{jvector.C@{jvector.C}}
{\tt \#include "jvector.h"}\par
{\tt \#include "dllist.h"}\par


Include dependency graph for jvector.C:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=345pt]{jvector_C_incl}
\end{center}
\end{figure}
\subsection*{Functions}
\begin{CompactItemize}
\item 
{\bf j\-Vector} {\bf operator-} ({\bf j\-Vector} x, const {\bf j\-Vector} \&y)
\item 
{\bf j\-Vector} {\bf operator+} ({\bf j\-Vector} x, const {\bf j\-Vector} \&y)
\item 
double {\bf operator $\ast$} ({\bf j\-Vector} x, const {\bf j\-Vector} \&y)
\item 
{\bf j\-Vector} {\bf operator\%} ({\bf j\-Vector} x, const {\bf j\-Vector} \&y)
\item 
{\bf j\-Vector} {\bf operator $\ast$} ({\bf j\-Vector} y, double d)
\item 
{\bf j\-Vector} {\bf operator $\ast$} (double d, {\bf j\-Vector} y)
\item 
{\bf j\-Vector} {\bf operator/} ({\bf j\-Vector} y, double d)
\item 
{\bf j\-Vector} {\bf operator\%} ({\bf j\-Vector} x, double d)
\item 
double {\bf JVAngle} (const {\bf j\-Vector} \&x, const {\bf j\-Vector} \&y)
\item 
double {\bf euclid} (const {\bf j\-Vector} \&x, const {\bf j\-Vector} \&y)
\item 
ostream\& {\bf VBPrint\-Line} (ostream \&os, const {\bf j\-Vector} \&x, const {\bf j\-Vector} \&y, const {\bf Dyn\-String} \&color)
\item 
ostream\& {\bf VBPrint\-Point} (ostream \&os, const {\bf j\-Vector} \&x, const {\bf Dyn\-String} \&color)
\item 
ostream\& {\bf VBPrint\-Circle} (ostream \&os, const {\bf j\-Vector} \&x, const double \&radius, const {\bf Dyn\-String} \&color)
\item 
double {\bf Covariance} (const {\bf j\-Vector} \&x, const {\bf j\-Vector} \&y)
\end{CompactItemize}


\subsection{Function Documentation}
\index{jvector.C@{jvector.C}!Covariance@{Covariance}}
\index{Covariance@{Covariance}!jvector.C@{jvector.C}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}double Covariance (const {\bf j\-Vector} \& {\em x}, const {\bf j\-Vector} \& {\em y})}\label{jvector_C_a13}




Definition at line 326 of file jvector.C.\footnotesize\begin{verbatim}00327   {
00328     if(x.L != y.L || x.L == 0)
00329         return INF;
00330     
00331     double x_mean = x.mean();
00332     double y_mean = y.mean();
00333     double cov = 0.0;
00334 
00335     for(int i=0; i<x.L; ++i)
00336         cov += (x[i] - x_mean)*(y[i] - y_mean);
00337     cov /= (x.L-1);
00338 
00339     return cov;
00340 \end{verbatim}\normalsize 
\index{jvector.C@{jvector.C}!JVAngle@{JVAngle}}
\index{JVAngle@{JVAngle}!jvector.C@{jvector.C}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}double JVAngle (const {\bf j\-Vector} \& {\em x}, const {\bf j\-Vector} \& {\em y})}\label{jvector_C_a8}




Definition at line 152 of file jvector.C.\footnotesize\begin{verbatim}00153   { return acos( (x*y) / x.mag() / y.mag() ); }
00154 \end{verbatim}\normalsize 
\index{jvector.C@{jvector.C}!VBPrintCircle@{VBPrintCircle}}
\index{VBPrintCircle@{VBPrintCircle}!jvector.C@{jvector.C}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}ostream \& VBPrint\-Circle (ostream \& {\em os}, const {\bf j\-Vector} \& {\em x}, const double \& {\em radius}, const {\bf Dyn\-String} \& {\em color})}\label{jvector_C_a12}




Definition at line 264 of file jvector.C.\footnotesize\begin{verbatim}00266   {
00267     
00268     if((x.L>3) || (x.L<2)) return os;
00269     char old_delim = jVector::IODelimiter;
00270     jVector::IODelimiter = ',';
00271 
00272     if(x.L==3)
00273       os << "circle (" << x << ") " << radius << " :" << color;
00274     else if(x.L==2)
00275       os << "circle (" << x << ",0) " << radius << " :" << color;
00276     os << '\n';
00277     jVector::IODelimiter = old_delim;
00278     return os;
00279 \end{verbatim}\normalsize 
\index{jvector.C@{jvector.C}!VBPrintLine@{VBPrintLine}}
\index{VBPrintLine@{VBPrintLine}!jvector.C@{jvector.C}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}ostream \& VBPrint\-Line (ostream \& {\em os}, const {\bf j\-Vector} \& {\em x}, const {\bf j\-Vector} \& {\em y}, const {\bf Dyn\-String} \& {\em color})}\label{jvector_C_a10}




Definition at line 226 of file jvector.C.\footnotesize\begin{verbatim}00228   {
00229     if((x.L != y.L) || (x.L>3) || (y.L>3) || (x.L<1) || (y.L<1)) return os;
00230 
00231     char old_delim = jVector::IODelimiter;
00232     jVector::IODelimiter = ',';
00233 
00234     if(x.L==3)
00235       os << "line (" << x << ") (" << y << ") :" << color;
00236     else if(x.L==2)
00237       os << "line (" << x << ",0) (" << y << ",0) :" << color;
00238     else if(x.L==1)
00239       os << "line (" << x << "0,0) (" << y << "0,0) :" << color;
00240     os << '\n';
00241     jVector::IODelimiter = old_delim;
00242     return os;
00243 \end{verbatim}\normalsize 
\index{jvector.C@{jvector.C}!VBPrintPoint@{VBPrintPoint}}
\index{VBPrintPoint@{VBPrintPoint}!jvector.C@{jvector.C}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}ostream \& VBPrint\-Point (ostream \& {\em os}, const {\bf j\-Vector} \& {\em x}, const {\bf Dyn\-String} \& {\em color})}\label{jvector_C_a11}




Definition at line 245 of file jvector.C.\footnotesize\begin{verbatim}00246   {
00247     
00248     if((x.L>3) || (x.L<1)) return os;
00249     char old_delim = jVector::IODelimiter;
00250     jVector::IODelimiter = ',';
00251 
00252     if(x.L==3)
00253       os << "point " << x << " :" << color;
00254     else if(x.L==2)
00255       os << "point " << x << ",0 :" << color;
00256     else if(x.L==1)
00257       os << "point " << x << ",0,0 :" << color;
00258     os << '\n';
00259     jVector::IODelimiter = old_delim;
00260     return os;
00261 \end{verbatim}\normalsize 
\index{jvector.C@{jvector.C}!euclid@{euclid}}
\index{euclid@{euclid}!jvector.C@{jvector.C}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}double euclid (const {\bf j\-Vector} \& {\em x}, const {\bf j\-Vector} \& {\em y})}\label{jvector_C_a9}




Definition at line 155 of file jvector.C.

Referenced by gw\-Numerics::add\-VDWSegments(), Distance\-Constraint::compute\-Abs\-Res(), Distance\-Constraint::compute\-Stress(), Position\-Constraint::d\-Stress(), Distance\-Constraint::d\-Stress(), main(), and jd\-Err\_\-Eval::run().\footnotesize\begin{verbatim}00156   {
00157     if(x.L != y.L) return -1.0;
00158     double sumproducts = 0.0;
00159     for(int i=0; i<x.L; ++i) sumproducts += pow(x.V[i]-y.V[i], 2.0);
00160     return sqrt(sumproducts);
00161 \end{verbatim}\normalsize 
\index{jvector.C@{jvector.C}!operator *@{operator $\ast$}}
\index{operator *@{operator $\ast$}!jvector.C@{jvector.C}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf j\-Vector} operator $\ast$ (double {\em d}, {\bf j\-Vector} {\em y})}\label{jvector_C_a5}




Definition at line 141 of file jvector.C.\footnotesize\begin{verbatim}00141                                          { return y*=d; }
00142 \end{verbatim}\normalsize 
\index{jvector.C@{jvector.C}!operator *@{operator $\ast$}}
\index{operator *@{operator $\ast$}!jvector.C@{jvector.C}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf j\-Vector} operator $\ast$ ({\bf j\-Vector} {\em y}, double {\em d})}\label{jvector_C_a4}




Definition at line 140 of file jvector.C.\footnotesize\begin{verbatim}00140                                          { return y*=d; }
00141 \end{verbatim}\normalsize 
\index{jvector.C@{jvector.C}!operator *@{operator $\ast$}}
\index{operator *@{operator $\ast$}!jvector.C@{jvector.C}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}double operator $\ast$ ({\bf j\-Vector} {\em x}, const {\bf j\-Vector} \& {\em y})}\label{jvector_C_a2}




Definition at line 124 of file jvector.C.\footnotesize\begin{verbatim}00125 {
00126   double product_sum=0.0;
00127   if(x.L == y.L) for(int i=0; i<x.L; ++i) product_sum += x.V[i]*y.V[i];
00128   return product_sum;
00129 \end{verbatim}\normalsize 
\index{jvector.C@{jvector.C}!operator\%@{operator\%}}
\index{operator\%@{operator\%}!jvector.C@{jvector.C}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf j\-Vector} operator\% ({\bf j\-Vector} {\em x}, double {\em d})}\label{jvector_C_a7}




Definition at line 149 of file jvector.C.\footnotesize\begin{verbatim}00150   { return x%=d; }
00151 \end{verbatim}\normalsize 
\index{jvector.C@{jvector.C}!operator\%@{operator\%}}
\index{operator\%@{operator\%}!jvector.C@{jvector.C}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf j\-Vector} operator\% ({\bf j\-Vector} {\em x}, const {\bf j\-Vector} \& {\em y})}\label{jvector_C_a3}




Definition at line 134 of file jvector.C.\footnotesize\begin{verbatim}00134                                                   { return x %= y; }
00135 \end{verbatim}\normalsize 
\index{jvector.C@{jvector.C}!operator+@{operator+}}
\index{operator+@{operator+}!jvector.C@{jvector.C}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf j\-Vector} operator+ ({\bf j\-Vector} {\em x}, const {\bf j\-Vector} \& {\em y})}\label{jvector_C_a1}




Definition at line 121 of file jvector.C.\footnotesize\begin{verbatim}00121                                                  { return (x += y); }
00122 \end{verbatim}\normalsize 
\index{jvector.C@{jvector.C}!operator-@{operator-}}
\index{operator-@{operator-}!jvector.C@{jvector.C}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf j\-Vector} operator- ({\bf j\-Vector} {\em x}, const {\bf j\-Vector} \& {\em y})}\label{jvector_C_a0}




Definition at line 117 of file jvector.C.\footnotesize\begin{verbatim}00117                                                  { return (x -= y); }
00118 \end{verbatim}\normalsize 
\index{jvector.C@{jvector.C}!operator/@{operator/}}
\index{operator/@{operator/}!jvector.C@{jvector.C}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf j\-Vector} operator/ ({\bf j\-Vector} {\em y}, double {\em d})}\label{jvector_C_a6}




Definition at line 145 of file jvector.C.\footnotesize\begin{verbatim}00145                                          { return y/=d; }
00146 \end{verbatim}\normalsize 
