Statistics
| Revision:

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

History | View | Annotate | Download (947 Bytes)

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

    
4
#include <fvar.hpp>
5
#include "mixture.h"
6

    
7
dvariable reset(ivector& control,dvar_vector& x,dvar_vector& p, dvar_vector& mu,
8
    dvar_vector& sd,dvector& mumin, dvector& mumax, dvector& sdmin,
9
    dvector& sdmax)
10
{
11
  dvariable zpen=0.;
12
  int ngroups=p.size();
13
  int ii=1;
14
  if (control(1)>0) // control(1) determines whether the p's are active
15
  {
16
    for (int j=1;j<=ngroups;j++)
17
    {
18
      p(j)=boundp(x(ii++),0.,1.,zpen);
19
    }
20
  }
21
  if (control(2)>0) // control(2) determines whether the mu's are active
22
  {
23
    for (int j=1;j<=ngroups;j++)
24
    {
25
      mu(j)=boundp(x(ii++),mumin(j),mumax(j),zpen);
26
    }
27
  }
28
  if (control(3)>0) // control(3) determines whether the sd's are active
29
  {
30
    for (int j=1;j<=ngroups;j++)
31
    {
32
      sd(j)=boundp(x(ii++),sdmin(j),sdmax(j),zpen);
33
    }
34
  }
35
  return(zpen); // Return zpen so it can be added to the function being
36
                // minimized
37
}
38
\end{lstlisting}