Пример #1
0
void ada_read_sols ( PolySys& start_sys, PolySolSet& sols )
{
   int fail, len;

   fail = solcon_number_of_dobldobl_solutions(&len);
   // printf("Number of start solutions : %d\n",len);
   int dim=start_sys.dim;
   sols.dim = dim;
   double sol[4*dim+10];

   for(int sol_idx=1; sol_idx<len+1; sol_idx++)
   {
      int mm,k,pos;
      T1 dd_sol[2*dim];
      T1 t_real,t_imag,err,rco,res;

      solcon_retrieve_next_dobldobl_solution(dim,&k,&mm,sol);
      //solcon_retrieve_solution(dim,sol_idx,&mm,sol);
      /*std::cout << sol[0] << " " << sol[1] << std::endl;
      for(int var_idx=0; var_idx<4; var_idx++)
         std::cout << sol[2+2*var_idx] << " " << sol[2+2*var_idx] << std::endl;
      std::cout << sol[2+2*dim] 
                << " " << sol[3+2*dim]
                << " " << sol[4+2*dim] << std::endl;*/
      t_real.x[0] = sol[0];
      t_real.x[1] = sol[1];
      t_imag.x[0] = sol[2];
      t_imag.x[1] = sol[3];
      pos = 4;
      for(int dd_sol_idx=0; dd_sol_idx<2*dim; dd_sol_idx++)
      {
         T1 sol_real,sol_imag;
         sol_real.x[0] = sol[pos++];
         sol_real.x[1] = sol[pos++];
         sol_imag.x[0] = sol[pos++];
         sol_imag.x[1] = sol[pos++];
         dd_sol[dd_sol_idx++] = sol_real;
         dd_sol[dd_sol_idx] = sol_imag;
      }
      err.x[0] = sol[4*dim+4];
      err.x[1] = sol[4*dim+5];
      rco.x[0] = sol[4*dim+6];
      rco.x[1] = sol[4*dim+7];
      res.x[0] = sol[4*dim+8];
      res.x[1] = sol[4*dim+9];
      PolySol* tmp_sol = new PolySol(dim,t_real,t_imag,dd_sol,err,rco,res);
      //tmp_sol->print_info(start_sys.pos_var);
      sols.add_sol(tmp_sol);
   }

   // std::cout << "sol finished" << std::endl;
}
Пример #2
0
void ada_read_sols ( PolySys& start_sys, PolySolSet& sols )
{
    int fail, len;

    fail = solcon_number_of_quaddobl_solutions(&len);
    // printf("Number of start solutions : %d\n",len);
    int dim=start_sys.dim;
    sols.dim = dim;
    double sol[8*dim+20];

    for(int sol_idx=1; sol_idx<len+1; sol_idx++)
    {
        int mm,k,pos;
        // T1 qd_sol[4*dim];
        T1* qd_sol;
        T1 t_real,t_imag,err,rco,res;

        qd_sol = (T1*)calloc(4*dim,sizeof(T1));

        solcon_retrieve_next_quaddobl_solution(dim,&k,&mm,sol);
        //solcon_retrieve_solution(dim,sol_idx,&mm,sol);
        /*std::cout << sol[0] << " " << sol[1] << std::endl;
        for(int var_idx=0; var_idx<4; var_idx++)
           std::cout << sol[2+2*var_idx] << " " << sol[2+2*var_idx] << std::endl;
        std::cout << sol[2+2*dim]
                  << " " << sol[3+2*dim]
                  << " " << sol[4+2*dim] << std::endl;*/
        t_real.x[0] = sol[0];
        t_real.x[1] = sol[1];
        t_real.x[2] = sol[2];
        t_real.x[3] = sol[3];
        t_imag.x[0] = sol[4];
        t_imag.x[1] = sol[5];
        t_imag.x[2] = sol[6];
        t_imag.x[3] = sol[7];
        pos = 8;
        for(int qd_sol_idx=0; qd_sol_idx<4*dim; qd_sol_idx++)
        {
            T1 sol_real,sol_imag;
            sol_real.x[0] = sol[pos++];
            sol_real.x[1] = sol[pos++];
            sol_real.x[2] = sol[pos++];
            sol_real.x[3] = sol[pos++];
            sol_imag.x[0] = sol[pos++];
            sol_imag.x[1] = sol[pos++];
            sol_imag.x[2] = sol[pos++];
            sol_imag.x[3] = sol[pos++];
            qd_sol[qd_sol_idx++] = sol_real;
            qd_sol[qd_sol_idx] = sol_imag;
        }
        err.x[0] = sol[8*dim+8];
        err.x[1] = sol[8*dim+9];
        err.x[2] = sol[8*dim+10];
        err.x[3] = sol[8*dim+11];
        rco.x[0] = sol[8*dim+12];
        rco.x[1] = sol[8*dim+13];
        rco.x[2] = sol[8*dim+14];
        rco.x[3] = sol[8*dim+15];
        res.x[0] = sol[8*dim+16];
        res.x[1] = sol[8*dim+17];
        res.x[2] = sol[8*dim+18];
        res.x[3] = sol[8*dim+19];
        PolySol* tmp_sol = new PolySol(dim,t_real,t_imag,qd_sol,err,rco,res);
        // tmp_sol->print_info(start_sys.pos_var);
        sols.add_sol(tmp_sol);
    }
    // sols.print_info(start_sys.pos_var);
    // std::cout << "sol finished" << std::endl;
}