/** * Description not yet available. * \param */ dvariable mean(const dvar_vector& v) { dvariable tmp; RETURN_ARRAYS_INCREMENT(); tmp=sum(v)/double(v.size()); RETURN_ARRAYS_DECREMENT(); return(tmp); }
/** * Description not yet available. * \param */ dvariable std_dev(const dvar_vector& v) { dvariable tmp; RETURN_ARRAYS_INCREMENT(); tmp=norm(v)/sqrt(double(v.size())); dvariable tmp1; tmp1=mean(v); RETURN_ARRAYS_DECREMENT(); return(sqrt(tmp*tmp-tmp1*tmp1)); }
void save_pars(dvar_vector& p,dvar_vector& mu,dvar_vector& sd, dvector& mumin, dvector& mumax,dvector& sdmin, dvector& sdmax, ivector& control) { ofstream outfile("mixture.par"); outfile << p.size() << "\n"; // The number of groups outfile << control << "\n"; outfile << p << "\n\n"; outfile << mu << "\n\n"; outfile << sd << "\n\n"; outfile << mumin << "\n\n"; outfile << mumax << "\n\n"; outfile << sdmin << "\n\n"; outfile << sdmax; }