Ejemplo n.º 1
0
void read_data_system ( int n, int m, int monsum, int moncnt[m] )
{
   int dimsup = n*monsum;
   int dimcff = 2*monsum;
   int sup[dimsup];
   double cff[dimcff];
   int i,j,k,indsup,indcff;

   indsup = 0;
   indcff = 0;
   for(i=0; i<m; i++)
   {
      printf("Reading the support and coefficients");
      printf(" of polynomial %d ...\n", i+1);
      for(j=0; j<moncnt[i]; j++)
      {
         printf("  give exponents of monomial %d : ", j+1);
         for(k=0; k<n; k++) scanf("%d", &sup[indsup++]);
         printf("  give two doubles : ");
         scanf("%lf", &cff[indcff++]);
         scanf("%lf", &cff[indcff++]); 
      }
   }

   adainit();
   _ada_phc_solver(n,m,moncnt,dimsup,sup,dimcff,cff);
   adafinal();

}
Ejemplo n.º 2
0
int main(void)
{
   int choice;

   printf("\nMENU for testing the systems containers :\n");
   printf("  0. show a random polynomial system;\n");
   printf("  1. test with standard double coefficients;\n");
   printf("  2. test with double double coefficients;\n");
   printf("  3. test with quad double coefficients;\n");
   printf("  4. test with multiprecision coefficients.\n");
   printf("Type 1, 2, 3, or 4 to select the precision : ");
   scanf("%d",&choice);

   adainit();
   if(choice == 0)
      show_random_system();
   else if(choice == 1)
      test_standard_container();
   else if(choice == 2)
      test_dobldobl_container();
   else if(choice == 3)
      test_quaddobl_container();
   else if(choice == 4)
      test_multprec_container();
   else
      printf("invalid choice, please try again...\n");
   adafinal();

   return 0;
}
Ejemplo n.º 3
0
int main ( int argc, char *argv[] )
{
   char ans;
   int precision,fail;
   int seed = time(NULL);

   adainit();
   srand(seed); /* monodromy loops are probabilistic ! */

   printf("Seed for the random number generators : %d.\n",seed);

   printf("\nMENU for the working precision :\n");
   printf("  0. standard double precision;\n");
   printf("  1. double double precision;\n");
   printf("  2. quad double precision.\n");
   printf("Type 0, 1, or 2 to make a choice : ");
   scanf("%d",&precision);

   scanf("%c",&ans); /* skip end of line character */

   if(precision == 0)
      fail = standard_test();
   else if(precision == 1)
      fail = dobldobl_test();
   else if(precision == 2)
      fail = quaddobl_test();
   else
      printf("Selected precision level is not supported.\n");

   adafinal();

   return 0;
}
Ejemplo n.º 4
0
int main ( int argc, char *argv[] )
{
   char ans;
   int precision,fail;

   adainit();

   printf("\nMENU for the working precision :\n");
   printf("  0. standard double precision;\n");
   printf("  1. double double precision;\n");
   printf("  2. quad double precision.\n");
   printf("Type 0, 1, or 2 to make a choice : ");
   scanf("%d",&precision);
   scanf("%c",&ans); /* skip end of line character */

   if(precision == 0)
      fail = standard_membership_test();
   else if(precision == 1)
      fail = dobldobl_membership_test();
   else if(precision == 2)
      fail = quaddobl_membership_test();
   else
      printf("Selected precision level is not supported.\n");

   adafinal();

   return 0;
}
Ejemplo n.º 5
0
int main()
{
    printf("[C Code] Running test\n");
    adainit();
    orchestrator_initStates();
    return 0;
}
Ejemplo n.º 6
0
int main ( int argc, char *argv[] )
{
   int myid,numprocs,n,nbsols,mysolnum;
   MPI_Status status; 

   adainit();
   MPI_Init(&argc,&argv);
   MPI_Comm_size(MPI_COMM_WORLD,&numprocs);
   MPI_Comm_rank(MPI_COMM_WORLD,&myid);

   dimension_broadcast(myid,&n);
   monomials_broadcast(myid,n);
   copy_broadcast(myid); 
   start_system_broadcast(myid,n,&nbsols);

   MPI_Bcast(&nbsols,1,MPI_INT,0,MPI_COMM_WORLD);
   solutions_distribute(myid,nbsols,n,numprocs,&mysolnum);

  // if(myid == 1) print_homotopy();  

   MPI_Finalize();
   adafinal();

   return 0;
}
Ejemplo n.º 7
0
int main ( void )
{
   int r;

   printf("\nTesting linear-product root counts and systems...\n");

   adainit();

   printf("MENU for computing Bezout bounds :\n");
   printf("  1. test m-homogeneous Bezout numbers;\n");
   printf("  2. test general linear-product root counts.\n");
   printf("Type 1 or 2 to make your choice : ");
   scanf("%d",&r);

   if(r == 1) 
   {
      compute_m_homogeneous_Bezout_number(&r);
   }
   else if(r == 2)
   {
      compute_root_count(&r);
      construct_start_system(r);
      clear_set_structure();
   }
   else
      printf("Wrong choice, please try again...\n");

   adafinal();

   return 0;
}
Ejemplo n.º 8
0
int main(void)
{
   int option;
   char ch;

   printf("\nMENU to test operations in solutions container :\n");
   printf("  1. test main operations in the container;\n");
   printf("  2. incremental read/write of solutions from/to file;\n");
   printf("  3. test container for double double solutions;\n");
   printf("  4. test container for quad double solutions.\n");
   printf("Type 1, 2, 3, or 4 to make your choice : "); 
   scanf("%d",&option);
   scanf("%c",&ch); /* skip new line character */
   printf("\n");

   adainit();
   if(option == 1)
      test_standard_solution_container();
   else if(option == 2)
      test_incremental_read_and_write();
   else if(option == 3)
      test_dobldobl_solution_container();
   else if(option == 4)
      test_quaddobl_solution_container();
   else
      printf("%d is wrong choice.  Please try again...\n");
   adafinal();

   return 0;
}
Ejemplo n.º 9
0
int main(void)
{
   int choice;

   printf("\nMENU for testing univariate root finding :\n");
   printf("  0. in standard double precision;\n");
   printf("  1. in double double precision;\n");
   printf("  2. in quad double precision.\n");
   printf("  3. in arbitrary multiprecision.\n");
   printf("Type 0, 1, 2, or 3 to select the precision : ");
   scanf("%d",&choice);

   adainit();

   if(choice == 0)
      standard_test();
   else if(choice == 1)
      dobldobl_test();
   else if(choice == 2)
      quaddobl_test();
   else if(choice == 3)
      multprec_test();
   else
      printf("invalid choice, please try again...\n");

   adafinal();

   return 0;
}
Ejemplo n.º 10
0
int main()
{
    printf("[C Code] Running test\n");
    adainit();
    
    return 0;
}
Ejemplo n.º 11
0
int main ( int argc, char *argv[] )
{
   int choice,fail,prec;

   adainit();

   greetings();

   prec = prompt_for_precision();
 
   printf("\nWelcome to the blackbox solver in PHCpack :\n");
   printf("  1. the input polynomial system will be typed in; or\n");
   printf("  2. the system typed in is a Laurent polynomial system; or\n");
   printf("  3. an input file contains the input polynomial system; or\n");
   printf("  4. the input Laurent system is on an input file.\n");
   printf("Type 1, 2, 3, or 4 to make your choice : ");
   scanf("%d",&choice);
   if(choice == 1)
      fail = interactive_input_output(prec);
   else if (choice == 2)
      fail = interactive_Laurent_input_output(prec);
   else if (choice == 3)
      fail = input_output_on_files(prec);
   else
      fail = Laurent_input_output_on_files(prec);

   adafinal();

   return 0;
}
Ejemplo n.º 12
0
int main ( int argc, char *argv[] )
{
   int fail,choice;

   adainit();

   printf("\nMENU for the precision and type of system :\n");
   printf("  0. standard double precision on a polynomial system\n");
   printf("  1. standard double precision on a Laurent polynomial system\n");
   printf("  2. double double precision on a polynomial system\n");
   printf("  3. double double precision on a Laurent polynomial system\n");
   printf("  4. quad double precision on a polynomial system\n");
   printf("  5. quad double precision on a Laurent polynomial system\n");
   printf("Type 0, 1, 2, 3, 4, or 5 : "); scanf("%d", &choice);

   if(choice == 0)
      fail = standard_polysys_solver();
   else if(choice == 1)
      fail = standard_laursys_solver();
   else if(choice == 2)
      fail = dobldobl_polysys_solver();
   else if(choice == 3)
      fail = dobldobl_laursys_solver();
   else if(choice == 4)
      fail = quaddobl_polysys_solver();
   else if(choice == 5)
      fail = quaddobl_laursys_solver();
   else
      printf("invalid choice\n");

   adafinal();

   return 0;
}
Ejemplo n.º 13
0
int main ( int argc, char *argv[] )
{
   const int verbose = 0; // set to 1 for more info
   int myid,numprocs,precision,fail,ns;
   char* filename;
 
   adainit();
   MPI_Init(&argc,&argv);
   MPI_Comm_size(MPI_COMM_WORLD,&numprocs);
   MPI_Comm_rank(MPI_COMM_WORLD,&myid);

   if(verbose > 0)
   {
       printf("\nHello from process %d!\n", myid);
       MPI_Barrier(MPI_COMM_WORLD);
   }
   if(myid == 0) precision = prompt_for_precision();

   MPI_Bcast(&precision,1,MPI_INT,0,MPI_COMM_WORLD);
   if(verbose > 0)
       printf("\nProcess %d has %d as precision.\n", myid, precision);

   MPI_Barrier(MPI_COMM_WORLD);

   filename = (char*)calloc(80,sizeof(char));
   if(myid == 0)
   {
      char nl;

      printf("\nReading the name of the output file ...");
      printf("\nGive a string of characters : "); scanf("%s",filename);
      scanf("%c",&nl); /* skip newline symbol for next reading ...*/
      if(verbose > 0) printf("\nThe output file is \"%s\".\n", filename);
      ns = strlen(filename);
      fail = define_output_file_with_string(ns,filename);
   }
   MPI_Bcast(&ns,1,MPI_INT,0,MPI_COMM_WORLD);
   MPI_Bcast(filename,ns,MPI_CHAR,0,MPI_COMM_WORLD);

   if(verbose > 0)
       printf("\nNode %d has filename \"%s\".\n", myid, filename);

   MPI_Barrier(MPI_COMM_WORLD);

   switch(precision)
   {
      case 0: fail = standard_run(myid,numprocs,ns,filename,verbose); break;
      case 1: fail = dobldobl_run(myid,numprocs,ns,filename,verbose); break;
      case 2: fail = quaddobl_run(myid,numprocs,ns,filename,verbose); break;
      default: printf("Invalid choice of precision.\n");
   }

   MPI_Finalize();
   adafinal();

   return 0;
}
Ejemplo n.º 14
0
int main()
{
    asn1SccT_Int32 test = 5;

    printf("[C Code] Running test\n");
    adainit();
    myfunction_initStates();
    myfunction_PI_start_something(&test);
    return 0;
}
Ejemplo n.º 15
0
void main(void)
{
	adainit();
	int i = 0;
	while (NULL != someStrings[i])
	{
		printf("%s ", someStrings[i]);
		i++;
	}
	adafinal();
};
Ejemplo n.º 16
0
int main ( int argc, char *argv[] )
{
   adainit();

   // input_argument_free();
   named_input_files();

   adafinal();

   return 0;
}
Ejemplo n.º 17
0
int main ( void )
{
    printf("\nComputing the powers of t in a polyhedral homotopy...\n");

    adainit();

    compute_mixed_volume();
    read_and_retrieve();

    adafinal();

    return 0;
}
Ejemplo n.º 18
0
static void
gnat_parse_file ()
{
  /* call the target specific initializations */
  __gnat_initialize();

  /* Call the front-end elaboration procedures */
  adainit ();

  immediate_size_expand = 1;

  /* Call the front end */
  _ada_gnat1drv ();
}
Ejemplo n.º 19
0
int main ( int argc, char *argv[] )
{
   int choice;
   char ch;

   adainit();

   printf("\nMENU to run Newton's method : \n");
   printf("  0. test plain validation on a start system;\n");
   printf("  1. run Newton step with standard double arithmetic;\n");
   printf("  2. run Newton step with double double arithmetic;\n");
   printf("  3. run Newton step with quad double arithmetic;\n");
   printf("  4. run Newton step with multiprecision arithmetic;\n");
   printf("  5. standard double precision deflation with defaults;\n");
   printf("  6. standard double Newton step on Laurent system;\n");
   printf("  7.   double double Newton step on Laurent system;\n");
   printf("  8.     quad double Newton step on Laurent system;\n");
   printf("  9.  multiprecision Newton step on Laurent system.\n");
   printf("Type 0, 1, 2, 3, 4, 5, 6, 7, 8, or 9 to select : ");
   scanf("%d",&choice);
   scanf("%c",&ch); /* skip newline symbol */

   if(choice == 0)
      test_validate();
   else if(choice == 1)
      test_standard_Newton_step();
   else if(choice == 2)
      test_dobldobl_Newton_step();
   else if(choice == 3)
      test_quaddobl_Newton_step();
   else if(choice == 4)
      test_multprec_Newton_step();
   else if(choice == 5)
      test_deflate();
   else if(choice == 6)
      test_standard_Newton_Laurent_step();
   else if(choice == 7)
      test_dobldobl_Newton_Laurent_step();
   else if(choice == 8)
      test_quaddobl_Newton_Laurent_step();
   else if(choice == 9)
      test_multprec_Newton_Laurent_step();
   else
      printf("invalid selection, please try again\n");

   adafinal();

   return 0;
}
Ejemplo n.º 20
0
int main ( void )
{
   char ans;

   printf("\nTesting the Operations in the Cells Container...\n\n");

   adainit();

   printf("Choose one of the following testing options :\n");
   printf("  0. read a polynomial system and compute its mixed volume;\n");
   printf("  1. read a mixed-cell configuration, test retrievals;\n");
   printf("  2. create a mixed-cell configuration interactively;\n");
   printf("  3. read a mixed-cell configuration and create start system;\n");
   printf("  4. polyhedral homotopies solve a random coefficient system;\n");
   printf("  5. test operations on integer cells container.\n");
   printf("Type 1, 2, 3, 4, or 5 to make your choice : "); 
   ans = getchar();

   if(ans == '0')
      compute_mixed_volume();
   else if(ans == '1')
   {
      scanf("%c",&ans);        /* skip end of line symbol */
      read_and_retrieve();
   }
   else if(ans == '2')
      read_and_construct();
   else if(ans == '3')
   {
      scanf("%c",&ans);
      read_cells_and_create_start_system();
   }
   else if(ans == '4')
   {
      scanf("%c",&ans);
      read_cells_and_solve_start_system();
   }
   else if(ans == '5')
   {
      scanf("%c",&ans);
      test_intcelcon();
   }
   else
      printf("\nOption %c unknown.  Please come again.\n\n", ans);

   adafinal();

   return 0;
}
Ejemplo n.º 21
0
int main()
{
  int m,p,q;
  int root_number;

  printf("Give the dimension of the input planes : "); scanf("%d",&m);
  printf("Give the dimension of the output planes : "); scanf("%d",&p);
  printf("Give the degree of the maps : "); scanf("%d",&q);

  adainit();
  root_number = _ada_pieri_count(m,p,q);
  adafinal();

  printf("The number of the roots : %d\n", root_number);

  return 0;
}
Ejemplo n.º 22
0
int main()
{
  int m,p,q,nb,level,n,dimpts,dimpla,i,nbsols;
  double *points,*planes;
  char filename[80];

  printf("\nTesting the call to Pieri homotopies...\n\n");

  printf("Give the name of the output file : ");
  scanf("%s", filename);
  printf("The output file name is %s.\n", filename);

  printf("Give the dimension of the input planes : "); scanf("%d",&m);
  printf("Give the dimension of the output planes : "); scanf("%d",&p);
  printf("Give the degree of the maps : "); scanf("%d",&q);
  printf("Give the number of maps wanted (<0 for all) : "); scanf("%d",&nb);

  printf("Give the amount of intermediate output : \n");
  printf("  0. no intermediate output;\n");
  printf("  1. only final determinant validation;\n");
  printf("  2. + validation of all intermediate determinants;\n");
  printf("  3. + intermediate output of all path trackers.\n");
  printf("Type 0, 1, 2, or 3 to select output level : ");
  scanf("%d", &level);

  n = m*p + q*(m+p);

  dimpts = 2*n;
  points = (double*) calloc(dimpts,sizeof(double));
  for(i=0; i<dimpts; i++)
     points[i] = cos(rand());

  dimpla = 2*n*m*p;
  planes = (double*) calloc(dimpla,sizeof(double)); 
  for(i=0; i<dimpla; i++)
     planes[i] = cos(rand());

  adainit();
  nbsols = _ada_pieri_solver(m,p,q,nb,level,points,planes,filename);
  adafinal();

  printf("The number of solutions : %d\n", nbsols);

  return 0;
}
Ejemplo n.º 23
0
int main ( int argc, char *argv[] )
{
   int fail,i;
   double v[34],x;

   adainit();

   printf("\nTuning the Continuation parameters in PHCpack...\n");
   /* fail = tune_continuation_parameters(); */
   printf("\n");
   do
   {
      fail = retrieve_continuation_parameters(v);
      write_continuation_parameters(v);
      printf("Give index of parameter to change (0 to quit) : ");
      scanf("%d",&i);
      if (i > 0)
      {
         printf("Give value for parameter %d : ",i); scanf("%lf",&x);
         v[i-1] = x;
         set_continuation_parameters(v);
         {
            char ans = 'y';
            do
            {
               fail = get_value_of_continuation_parameter(i,&x);
               printf("-> the value for parameter %d : %.3e.\n",i,x);
               printf("-> change value of index ? (y/n) ");
               scanf("%d",&ans); /* skip previous newline symbol */
               scanf("%c",&ans);
               if(ans != 'y') break;
               scanf("%c",&ans); /* skip the new line */
               printf("-> give value for index %d : ",i);
               scanf("%lf",&x);
               fail = set_value_of_continuation_parameter(i,&x);
            }
            while (ans != 0);
         }
      }
   } while ( i > 0);

   adafinal();

   return 0;
}
Ejemplo n.º 24
0
int main(void)
{
   printf("\nTesting Reading of Polynomial Systems\n");

   adainit();
   {
      int i;
      double *p;
      double *s = (double*) calloc(buffer_size,sizeof(double));
      s = _ada_phc_sys_rw(0,buffer_size,s);
      fflush(stdout);
      printf("\nHere is the system :\n");
      p = _ada_phc_sys_rw(1,buffer_size,s);
   }
   adafinal();

   return 0;
}
Ejemplo n.º 25
0
int main(void)
{
   printf("\nTesting Reading of Solution Lists\n");

   adainit();
   {
      int i;
      double *p;
      double *s = (double*) calloc(buffer_size,sizeof(double));
      s = _ada_phc_sol_rw(0,buffer_size,s);
      fflush(stdout);
      printf("\nHere is the solution list :\n");
      p = _ada_phc_sol_rw(1,buffer_size,s);
   }
   adafinal();

   return 0;
}
Ejemplo n.º 26
0
static void
gnat_parse_file (void)
{
  int seh[2];

  /* Call the target specific initializations.  */
  __gnat_initialize (NULL);

  /* ??? Call the SEH initialization routine.  This is to workaround
  a bootstrap path problem.  The call below should be removed at some
  point and the SEH pointer passed to __gnat_initialize() above.  */
  __gnat_install_SEH_handler((void *)seh);

  /* Call the front-end elaboration procedures.  */
  adainit ();

  /* Call the front end.  */
  _ada_gnat1drv ();
}
Ejemplo n.º 27
0
int main ( int argc, char *argv[] )
{
   double *c;
   int fail,choice,i;
   char skip_newline,ch;

   printf("\nTesting if phc can C strings...\n");

   adainit();
   {
      int n,*s;
      do
      { 
         printf("Give the number of elements : "); scanf("%d",&n);
         s = (int*)calloc(n,sizeof(int));
         skip_newline = getchar();
         printf("Give %d characters : ",n);
         for(i=0; i<n; i++)
         {
            scanf("%c",&ch);
            s[i] = (int) ch;
         }
         printf("The array of integers : ");
         for(i=0; i<n; i++) printf(" %d",s[i]); printf("\n");
         printf("The array of characters : ");
         for(i=0; i<n; i++)
         {
            ch = (char) s[i];
            printf(" %c",ch);
         }
         printf("\n");
         fail = _ada_use_c2phc(158,&n,s,c);
         printf("use_c2phc returned %d as fail value\n",fail);
         printf("Give a number (1 to continue, 0 to exit) : ");
         scanf("%d",&choice);
         skip_newline = getchar();
         free(s);
      } while (choice > 0);
   }
   adafinal();

   return 0;
}
Ejemplo n.º 28
0
int main ( int argc, char *argv[] )
{
   int fail,nbsol;

   adainit();

   int level = prompt_for_precision();
   if(level == 0)
   {
      fail = call_initialize_standard_homotopy(&nbsol);
      fail = call_standard_path_tracker(nbsol);
      fail = clear_standard_tracker();
   }
   else if(level == 1)
   {
      fail = call_initialize_dobldobl_homotopy(&nbsol);
      fail = call_dobldobl_path_tracker(nbsol);
      fail = clear_dobldobl_tracker();
   }
   else if(level == 2)
   {
      fail = call_initialize_quaddobl_homotopy(&nbsol);
      fail = call_quaddobl_path_tracker(nbsol);
      fail = clear_quaddobl_tracker();
   }
   else if(level == 3)
   {
      fail = call_initialize_multprec_homotopy(&nbsol);
      fail = call_multprec_path_tracker(nbsol);
      fail = clear_multprec_tracker();
   }
   else
   {
      fail = call_initialize_varbprec_homotopy(&nbsol);
      fail = call_varbprec_path_tracker();
      fail = clear_varbprec_tracker();
   }

   adafinal();

   return 0;
}
Ejemplo n.º 29
0
int main(void)
{
   printf("\nTesting C to PHCpack...\n");

   adainit();
   {
      int fail,choice = 0;
      char skip_newline;
      do
      { 
         fail = _ada_c_to_phcpack(choice);
         printf("Give a number (0 for menu, -1 to exit) : ");
         scanf("%d",&choice);
         skip_newline = getchar();
      } while (choice >= 0);
   }
   adafinal();

   return 0;
}
Ejemplo n.º 30
0
int main ( int argc, char *argv[] )
{
   int np,myid,dim,nspt,nbpaths,*mysol;
   double startwtime,endwtime,wtime,*time;
   MPI_Status status;

   adainit();
   MPI_Init(&argc,&argv);
   MPI_Comm_size(MPI_COMM_WORLD,&np);
   MPI_Comm_rank(MPI_COMM_WORLD,&myid);
   
   if(myid == 0)
   {
      time = (double*)calloc(np,sizeof(double));
      mysol = (int*)calloc(np,sizeof(int));
      startwtime = MPI_Wtime();
   }
   else
      startwtime = MPI_Wtime();
 
   retrieve_dimensions(myid,&nspt,&dim);
   supports_broadcast(myid,nspt,dim);
   system_broadcast(myid,dim-1);
   distribute_cells(myid,np,nspt,dim,&nbpaths);
   
   endwtime = MPI_Wtime();
   wtime = endwtime-startwtime;
   MPI_Gather(&wtime,1,MPI_DOUBLE,time,1,MPI_DOUBLE,0,MPI_COMM_WORLD);
   MPI_Gather(&nbpaths,1,MPI_INT,mysol,1,MPI_INT,0,MPI_COMM_WORLD);
   if(myid == 0)
   {
      printf("\nTotal wall time = %lf seconds on %d processors\n",
             time[0],np);
      write_time_and_paths_to_defined_output_file(np,time,mysol);
      free(time); free(mysol);
   }
    
   MPI_Finalize();
   adafinal();
   return 0;
}