Statistics
| Revision:

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

History | View | Annotate | Download (804 Bytes)

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

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

    
7
void xinit(ivector& control,independent_variables& x,dvector& p,dvector& mu,
8
      dvector& sd,dvector& mumin,dvector& mumax,dvector& sdmin,dvector& sdmax)
9
{
10
  int ngroups=p.size();
11
  int ii=1;
12
  if (control(1)>0) // control(1) determines whether the p's are active
13
  {
14
    for (int j=1;j<=ngroups;j++)
15
    {
16
      x(ii++)=boundpin(p(j),0.,1.);
17
    }
18
  }
19
  if (control(2)>0) // control(2) determines whether the mu's are active
20
  {
21
    for (int j=1;j<=ngroups;j++)
22
    {
23
      x(ii++)=boundpin(mu(j),mumin(j),mumax(j));
24
    }
25
  }
26
  if (control(3)>0) // control(3) determines whether the sd's are active
27
  {
28
    for (int j=1;j<=ngroups;j++)
29
    {
30
      x(ii++)=boundpin(sd(j),sdmin(j),sdmax(j));
31
    }
32
  }
33
}
34
\end{lstlisting}