示例#1
0
struct ug_Predictions ug_predict(struct ug_Corpus * corpus,
                  struct ug_Gram prefix,
                  size_t min,
                  size_t max,
                  struct ug_Gram postfix
                 ) {
  A((corpus->open));
  struct ug_Predictions predictions = {
    .nPredictions = 0,
    .predictions = NULL
  };
  return predictions;
}

static void ug_parallelProperties(
  struct ug_Corpus * corpus,
  struct ug_GramWeighted text,
  struct ug_Feature (* lists)[corpus->nAttributes][text.length],
  double (* weights)[text.length]
) {
    size_t i;
    size_t j;
    for (i = 0; i < text.length; i++) {
      for (j = 0; j < text.words[i].nAttributes; j++) {
        Au(( text.words[i].nAttributes == corpus->nAttributes ));
        (*lists)[j][i] = text.words[i].values[j];
      }
      (*weights)[i] = text.words[i].weight;
    }
}
示例#2
0
	void optimiseTransformationMatrixContinuous()
	{
		// Get coordinates of all pairs:
		Matrix2D<double> Au, Bt;
	    Au.initZeros(3, 3);
	    Bt.initZeros(3, 3);
	    Pass.initZeros(4,4);

	    // Add all pairs to dependent matrices (adapted from add_point in Xmipps micrograph_mark main_widget_mark.cpp)
		for (int t = 0; t < pairs_t2u.size(); t++)
		{
			int u = pairs_t2u[t];
			if (u >= 0)
	        {
				Au(0, 0) += (double)(p_unt[2*u] * p_unt[2*u]);
				Au(0, 1) += (double)(p_unt[2*u] * p_unt[2*u+1]);
				Au(0, 2) += (double)(p_unt[2*u]);
				Au(1, 0) = Au(0, 1);
				Au(1, 1) += (double)(p_unt[2*u+1] * p_unt[2*u+1]);
				Au(1, 2) += (double)(p_unt[2*u+1]);
				Au(2, 0) = Au(0, 2);
				Au(2, 1) = Au(1, 2);
				Au(2, 2) += 1.;

				Bt(0, 0) += (double)(p_til[2*t] * p_unt[2*u]);
				Bt(0, 1) += (double)(p_til[2*t+1] * p_unt[2*u]);
				Bt(0, 2) = Au(0, 2);
				Bt(1, 0) += (double)(p_til[2*t] * p_unt[2*u+1]);
				Bt(1, 1) += (double)(p_til[2*t+1] * p_unt[2*u+1]);
				Bt(1, 2) = Au(1, 2);
				Bt(2, 0) += (double)(p_til[2*t]);
				Bt(2, 1) += (double)(p_til[2*t+1]);
				Bt(2,2) += 1.;
	        }
	    }

	    // Solve equations
	    solve(Au, Bt, Pass);
	    Pass = Pass.transpose();
	    std::cout << " Optimised passing matrix= " << Pass << std::endl;
	    //These values can be complete CRAP. Better not show them at all....
	    //double rotp, tiltp, psip;
	    //tiltp = acos(Pass(1,1));
	    //rotp = acos(Pass(1,0)/sin(tiltp));
	    //psip = acos(Pass(0,1)/-sin(tiltp));
	    //std::cout << " Optimised tilt angle= " << RAD2DEG(tiltp) << std::endl;
	    //std::cout << " Optimised in-plane rot angles= " << RAD2DEG(rotp) <<" and "<< RAD2DEG(psip) << std::endl;
	    // Map using the new matrix
	    mapOntoTilt();

	}