Exemplo n.º 1
0
std::vector<std::string> f4(FLYLIB_OPAQUE _in_params) {
  FlyLib_Multi in_params (_in_params);
  int nrows (in_params.num_rows ());
  int ncols (in_params.num_cols ());

    std::vector<std::string> ret;
if (ncols>1) return ret;
  for (int col = 0; col < ncols; col ++) {
    for (int row = 0; row < nrows; row++) {
      ACE_TString cur_name;
      if (in_params.get_cell (cur_name, row, col) == 0) {
            ret.push_back(std::string(cur_name.c_str()));
      }
    }
  }
    return ret;
}
Exemplo n.º 2
0
std::vector<QuantLib::Date> f5(FLYLIB_OPAQUE _in_params) {
  FlyLib_Multi in_params (_in_params);
  int nrows (in_params.num_rows ());
  int ncols (in_params.num_cols ());

    std::vector<QuantLib::Date> ret;
if (ncols>1) return ret;
  for (int col = 0; col < ncols; col ++) {
    for (int row = 0; row < nrows; row++) {
      ACE_TString cur_name;
      if (in_params.get_cell (cur_name, row, col) == 0) {
         long d = FlyLib_Double::to_long (cur_name.c_str ());
            ret.push_back(QuantLib::Date(d));
      }
    }
  }
    return ret;
}
Exemplo n.º 3
0
int CreateCalibration( DoubleArray& Nexp, DoubleArray& teta, CalibrationParams& cal )
{
	CalibrationFuncParams in_params(Nexp.GetSize(), Nexp, teta, cal.n_p, cal.n_s, cal.alfa );
	CalibrationSolver FindFI( in_params );
	if( (cal.status=FindFI.Run(-45*DEGREE, 45*DEGREE, 1e-12))==GSL_SUCCESS ) 
	{
		double *A = FindFI.fparams.GetA(), *B = FindFI.fparams.GetB(), *N = FindFI.fparams.N;

		cal.fi0=FindFI.root;
		cal.L =	((N[1] - N[3])*(A[0] - A[3]) - (N[0] - N[3])*(A[1] - A[3])) / 
			((B[0] - B[3])*(A[1] - A[3]) - (B[1] - B[3])*(A[0] - A[3])); 
		cal.d0 = ((N[3] - N[0]) - cal.L*(B[0] - B[3]))/(A[0] - A[3]);
		cal.N0 = N[0] + cal.d0*A[0] + cal.L*B[0];

		cal.dt=FindFI.dt;
		cal.func_call_cntr=CalibrationSolver::func_call_cntr;
		cal.epsabs=FindFI.epsabs; cal.epsrel=FindFI.epsrel;
		cal.Nexp.RemoveAll(); cal.teta.RemoveAll();
		for(int i=0;i<Nexp.GetSize();i++) cal.Nexp.Add(N[i]);
		for(int i=0;i<teta.GetSize();i++) cal.teta.Add(teta[i]);
	}	
	return cal.status;
}