hmmer-3.3/easel/esl_gev.c
/* gev_func():
 * Returns the neg log likelihood of a complete or censored GEV data sample;
 * in the API of the conjugate gradient descent optimizer in esl_minimizer.
 */
Returns the neg log likelihood of a complete or censored GEV data sample;
in the API of the conjugate gradient descent optimizer in esl_minimizer.
Returns the neg log likelihood of a complete or censored GEV data sample ; in the API of the conjugate gradient descent optimizer in esl_minimizer .
static double
gev_func(double *p, int nparam, void *dptr)
{
  double mu, w, lambda, alpha;
  struct gev_data *data;
  double logL;
  int    i; 
  mu     = p[0];
  w      = p[1];   
  lambda = exp(w);
  alpha  = p[2];
  data   = (struct gev_data *) dptr;
  logL = 0.;
  for (i = 0; i < data->n; i++)
    logL += esl_gev_logpdf(data->x[i], mu, lambda, alpha);
  if (data->is_censored)
    logL += data->z * esl_gev_logcdf(data->phi, mu, lambda, alpha);
  return -logL;			
}
static double gev_func ( double * p , int nparam , void * dptr ) { double mu , w , lambda , alpha ; struct gev_data * data ; double logL ; int i ; mu = p [ 0 ] ; w = p [ 1 ] ; lambda = exp ( w ) ; alpha = p [ 2 ] ; data = ( struct gev_data * ) dptr ; logL = 0. ; for ( i = 0 ; i < data -> n ; i ++ ) logL += esl_gev_logpdf ( data -> x [ i ] , mu , lambda , alpha ) ; if ( data -> is_censored ) logL += data -> z * esl_gev_logcdf ( data -> phi , mu , lambda , alpha ) ; return - logL ; }
gev_func():
 Returns the neg log likelihood of a complete or censored GEV data sample;
 in the API of the conjugate gradient descent optimizer in esl_minimizer.
gev_func () : Returns the neg log likelihood of a complete or censored GEV data sample ; in the API of the conjugate gradient descent optimizer in esl_minimizer .
/* Unpack what the optimizer gave us.
   */ /* w is a c.o.v. to allow unconstrained opt of lambda>0 */ /* goal: minimize NLL */