Statistics
| Revision:

root / branches / pthreads-737 / docs / manuals / autodif / fcomp_s.cpp @ 765

History | View | Annotate | Download (247 Bytes)

1
\begin{lstlisting}
2
// file: fcomp_s.cpp
3

    
4
#include <fvar.hpp>
5

    
6
double fcomp(int n, dvar_vector x)
7
{
8
  dvariable z;
9
  dvariable tmp;
10
  int i;
11
  z=0;
12
  for (i=1;i<=n;i++)
13
  {
14
    tmp=x[i]-1;
15
    z=z+tmp*tmp;
16
  }
17
  return(value(z));
18
}
19
\end{lstlisting}