Exemplo n.º 1
0
void solve_quaddobl_start_system ( int len ) 
{
   int fail,nb,tnb,k,tmv,mv,i;

   printf("solving a random coefficient system with quad doubles ...\n");

   fail = celcon_quaddobl_random_coefficient_system();
   fail = celcon_quaddobl_polyhedral_homotopy();

   printf("solving the binomial start systems ...\n");
   tnb = 0; tmv = 0;
   for(k=1; k<=len; k++)
   {
      fail = celcon_solve_quaddobl_start_system(k,&nb);
      printf(" -> found %d start solutions from cell %d\n",nb,k);
      fail = celcon_mixed_volume(k,&mv);
      if (nb == mv)
         printf("#start solutions equals mixed volume %d, OK\n",mv);
      else
         printf("#start solutions does not equal mixed volume %d!!!\n",mv);
      tnb += nb; tmv += mv;
   }
   if (tnb == tmv)
      printf("Total #start solutions : %d = %d mixed volume, OK.\n",tnb,tmv);
   else
      printf("Total #start solutions : %d /= %d mixed volume!!!\n",tnb,tmv);

   printf("tracking the solution paths ...\n");
   for(k=1; k<=len; k++)
   {
      fail = celcon_mixed_volume(k,&mv);
      for(i=1; i<=mv; i++)
      {
         printf("Tracking path %d corresponding to cell %d ...\n",i,k);
         fail = celcon_track_quaddobl_solution_path(k,i,0);
      }
   }
   printf("copying the target solutions to the solution container ...\n");
   for(k=1; k<=len; k++)
   {
      fail = celcon_mixed_volume(k,&mv);
      for(i=1; i<=mv; i++)
         fail = celcon_copy_target_quaddobl_solution_to_container(k,i);
   }
   printf("writing random coefficient system and its solutions to file ...\n");
   fail = celcon_write_quaddobl_random_coefficient_system();
   fail = solcon_write_quaddobl_solutions();
}
Exemplo n.º 2
0
void quaddobl_test ( void )
{
   int fail,max,nit;
   const double eps = 1.0e-48;

   fail = syscon_read_quaddobl_system();
   fail = syscon_write_quaddobl_system();
   
   printf("\nGive the maximum number of iterations : ");
   scanf("%d",&max);
   
   fail = solve_with_quad_doubles(max,eps,&nit);

   printf("\nNumber of iterations : %d\n",nit);
   fail = solcon_write_quaddobl_solutions();
}
Exemplo n.º 3
0
void test_quaddobl_Newton_Laurent_step ( void )
{
   int fail,dim,len;

   printf("\nRunning Newton step with quad double arithmetic ...\n");
   fail = syscon_read_quaddobl_Laurent_system();
   fail = syscon_number_of_quaddobl_Laurentials(&dim);
   printf("The system container has %d Laurent polynomials.\n",dim);
   fail = solcon_read_quaddobl_solutions();
   fail = solcon_number_of_quaddobl_solutions(&len);
   printf("The solution container has size %d.\n",len);
   fail = solcon_dimension_of_quaddobl_solutions(&dim);
   printf("The solutions in the container have dimension %d.\n",dim);
   fail = quaddobl_Newton_Laurent_step();
   printf("The solutions after the Newton step :\n");
   fail = solcon_write_quaddobl_solutions();
}
Exemplo n.º 4
0
int quaddobl_membership_test ( void )
{
   int fail,n,dim,deg,nv;
   char ans;

   printf("\nReading a witness set ...\n");
   fail = read_quaddobl_witness_set(&n,&dim,&deg);
   nv = n - dim;

   if(verbose>0)  /* only in verbose mode */
   {
      printf("\nThe ambient dimension : %d.\n",n);
      printf("The dimension of the solution set : %d.\n",dim);
      printf("The degree of the solution set : %d.\n",deg);
      printf("\nDo you want to see the embedded system ? (y/n) ");
      scanf("%c",&ans);
      if(ans == 'y')
      {
         printf("\nThe system read :\n");
         fail = syscon_write_quaddobl_system();
      }
      scanf("%c",&ans); /* skip end of line character */
      printf("\nDo you want to see the solutions ? (y/n) ");
      scanf("%c",&ans);
      if(ans == 'y')
      {
         printf("\nThe solutions read :\n");
         fail = solcon_write_quaddobl_solutions();
      }
      scanf("%c",&ans); /* skip end of line character */
   }
   {
      int fail,onsys,onset;
      double tpt[8*nv];
      const double restol = 1.0e-6;
      const double homtol = 1.0e-10;
      printf("\nReading the coordinates of the test point x ...\n");
      quaddobl_read_point(nv,tpt);
      fail = quaddobl_homotopy_membership_test
               (1,nv,dim,restol,homtol,tpt,&onsys,&onset);
   }


   return 0;
}
Exemplo n.º 5
0
int input_output_on_files ( int precision )
{
   int fail,rc,nbtasks;

   if(precision == 0)
   {
      fail = syscon_read_standard_system();
      printf("\nThe system in the container : \n");
      fail = syscon_write_standard_system();
      printf("\nGive the number of tasks : "); scanf("%d",&nbtasks);
      fail = solve_system(&rc,nbtasks);
      printf("\nThe root count : %d\n",rc);
      printf("\nThe solutions :\n");
      fail = solcon_write_standard_solutions();
   }
   else if(precision == 1)
   {
      fail = syscon_read_dobldobl_system();
      printf("\nThe system in the container : \n");
      fail = syscon_write_dobldobl_system();
      printf("\nGive the number of tasks : "); scanf("%d",&nbtasks);
      fail = solve_dobldobl_system(&rc,nbtasks);
      printf("\nThe root count : %d\n",rc);
      printf("\nThe solutions :\n");
      fail = solcon_write_dobldobl_solutions();
   }
   else if(precision == 2)
   {
      fail = syscon_read_quaddobl_system();
      printf("\nThe system in the container : \n");
      fail = syscon_write_quaddobl_system();
      printf("\nGive the number of tasks : "); scanf("%d",&nbtasks);
      fail = solve_quaddobl_system(&rc,nbtasks);
      printf("\nThe root count : %d\n",rc);
      printf("\nThe solutions :\n");
      fail = solcon_write_quaddobl_solutions();
   }

   return fail;
}