Statistics
| Revision:

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

History | View | Annotate | Download (267 Bytes)

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

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

    
7
dvariable normalize_p(dvar_vector& p)
8
{
9
  dvariable psum=sum(p);
10
  p=p/psum; // Now the p's will sum to 1
11
  dvariable zpen=1000.*log(psum)*log(psum);
12
  return(zpen);
13
}
14
\end{lstlisting}