RV_Missing_t_walk_observed_normal::RV_Missing_t_walk_observed_normal(
		double const & x1_,
		double 			 & X,
		double const & x3_,
		double const & os1_,
		double const & os2_,
		double const & p1_,   // degrees of freedom 1
		double const & p2_,   // degrees of freedom 2
		double const & s1_,   // scale 1
		double const & s2_,   // scale 2
		double const & Xobs_, // observed location
		double const & so2_,
		trng::yarn2 & R_
) :	RV_Missing_t_walk_core(x1_, X, x3_, os1_, os2_, p1_, p2_, s1_, s2_, R_),
		Xobs(Xobs_), so2(so2_)
{
	// Companion matrix for eigenvalue peak-finding.
	companion.set_size(5,5);
	companion.zeros();
	companion(1,0) = 1.0;
	companion(2,1) = 1.0;
	companion(3,2) = 1.0;
	companion(4,3) = 1.0;

	// Reserve sizes, is this important?
	peaks.reserve(3);
	peak_bound_lr.reserve(3);
	intervals.reserve(2);
}
Beispiel #2
0
Local void processOneBar(struct LOC_musicParagraph *LINK)
{
  paragraph_index0 m, cm;
  voice_index voice, cvoice;
  boolean ignore_voice;
  boolean wrote_repeat = false;
  boolean alone;
  Char STR2[256];
  Char STR3[256];

  if (bar_of_line > 1) {
    sprintf(STR3, "%cBar %s", comment, toString(STR2, bar_no));
    putLine(STR3);
  }
  last_bar = (bar_of_line == nbars && final_paragraph);
  if (last_bar && !strcmp(repeat_sign, "|"))
    *repeat_sign = '\0';
  writeRepeat(repeat_sign);
  *LINK->new_meter = '\0';
  for (voice = nvoices; voice >= 1; voice--) {
    if (musicLineNo(voice) > 0) {
      gotoBar(voice, bar_of_line);
      getMeterChange(voice, LINK->new_meter);
    }
  }
  if (last_bar && *LINK->new_meter == '\0' && nleft > pickup && meternum > 0)
    meterChange(LINK->new_meter, nleft, 64, true);
  if (*LINK->new_meter != '\0')
    putLine(LINK->new_meter);
  for (voice = nvoices; voice >= 1; voice--) {
    ignore_voice = !selected[voice-1];
    cvoice = companion(voice);
    m = musicLineNo(voice);
    cm = musicLineNo(cvoice);
    alone = (voice == cvoice || m > 0 && cm == 0 ||
	     m == 0 && cm == 0 && voice < cvoice || !selected[cvoice-1]);
    if (selected[voice-1]) {
      if (m > 0)
	processLine(voice, bar_of_line);
      else if (alone)
	supplyRests(voice);
      else
	ignore_voice = true;
      if (last_bar && *repeat_sign != '\0' && !wrote_repeat) {
	writeRepeat(repeat_sign);
	wrote_repeat = true;
      }
      if (!ignore_voice) {
	if (alone || voicePos(voice) == 1)
	  putLine(" /");
	else
	  putLine(" //");
      }
    }
  }
  bar_no++;
  pickup = 0;
  putLine("");
}
void RV_Missing_t_walk_observed_normal::derivative_poly() {

	double A1 = 2*( (os2-x3) - (os1+x1) );
  double A2 = ( 
		pow(x3-os2,2) + p2*pow(s2,2) +
    pow(x1+os1,2) + p1*pow(s1,2) +
   -4*(os1+x1)*(os2-x3) 
	);
  double A3 = (
		2*( (os2-x3)*(pow(x1+os1,2)+p1*pow(s1,2)) - 
        (os1+x1)*(pow(x3-os2,2)+p2*pow(s2,2)) 
		)
	);
  double A4 = ( 
		(pow(x3-os2,2) + p2*pow(s2,2)) * 
    (pow(x1+os1,2) + p1*pow(s1,2)) 
	);

	double B1 = ( -1*(p1+1) - (p2+1) );
  double B2 = ( (p1+1)*(x1+os1+2*x3-2*os2) +
          (p2+1)*(x3-os2+2*x1+2*os1)  );
  double B3 = (
	  -1*(p1+1)*(
		p2*pow(s2,2) + pow(x3-os2,2) + 
			2*(x1+os1)*(x3-os2)
		) -
		 1*(p2+1)*(
		p1*pow(s1,2) + pow(x1+os1,2) + 
			2*(x3-os2)*(x1+os1)) 
	);
  double B4 = ( 
		(p1+1)*(x1+os1)*
			(p2*pow(s2,2)+pow(x3-os2,2)) +
    (p2+1)*(x3-os2)*
			(p1*pow(s1,2)+pow(x1+os1,2)) 
	);

	companion(0,4) = A4*Xobs           + B4*pow(so2,2);
	companion(1,4) = A3*Xobs - A4      + B3*pow(so2,2);
	companion(2,4) = A2*Xobs - A3      + B2*pow(so2,2);
	companion(3,4) = A1*Xobs - A2      + B1*pow(so2,2);
	companion(4,4) =    Xobs - A1							 ;
}