Ejemplo n.º 1
0
void supports_broadcast ( int myid, int nspt, int dim )
{
   int mix[nspt];
   int fail,i,j;
   double point[dim];
 
   if(myid == 0)
   { 
      fail = celcon_type_of_mixture(&nspt,mix);  
      if(v>0) printf("The number of occurrences of supports is: ");
      if(v>0) Print_Integer_Array(nspt,mix);
   }
    
   MPI_Bcast(mix,nspt,MPI_INT,0,MPI_COMM_WORLD);
   if(myid != 0)
      fail = celcon_set_type_of_mixture(nspt,mix);  

   if(myid == 0)
   {
      fail = celcon_length_of_supports(&nspt,mix); 
      /* get #different supports and #points of each support. */
      if(v>0) printf("The number of points in root supports is: ");
      if(v>0) Print_Integer_Array(nspt,mix);
   }
   MPI_Bcast(mix,nspt,MPI_INT,0,MPI_COMM_WORLD);
    
   for(i=0;i<nspt;i++)
      for(j=0;j<mix[i];j++)
      {
         if(myid==0) fail = celcon_get_lifted_point(dim,i+1,j+1,point);
         MPI_Bcast(point,dim,MPI_DOUBLE,0,MPI_COMM_WORLD);
         if(myid!=0) fail = celcon_append_lifted_point(dim,i+1,point);
      }
}
Ejemplo n.º 2
0
int write_lifted_supports ( int n )
{
   int fail,a,b,r,i,j,k;
   int nl[n];
   double *c,pt[n];
 
   fail = celcon_length_of_supports(&r,nl);
   printf("\nlength of the lifted support lists :");
   for(i=0; i<r; i++) printf(" %d",nl[i]); printf("\n");
   printf("the lifted supports:\n");
   for(i=0; i<r; i++)
   {
      for(j=0; j<nl[i]; j++)
      {
        /* printf("retrieving point %d from list %d ...\n",j+1,i+1); */
         fail = celcon_get_lifted_point(n,i+1,j+1,pt);
         for(k=0; k<n-1; k++) printf(" %d",(int) pt[k]);
         printf(" %.15le\n", pt[n-1]);
      }
      printf("\n");
   }
   return fail;
}
Ejemplo n.º 3
0
int write_inner_products ( int n, int r, int k )
{
    int fail,i,j,kk;
    int nl[r];
    double normal[n],point[n],prod,minprod;
    char ch;

    fail = celcon_get_inner_normal(n,k,normal);
    if (fail==1)
        printf("an error happened...\n");
    else
    {
        printf("inner normal for cell %d :\n", k);
        for(i=0; i<n; i++) printf("%.15le\n", normal[i]);
        printf("Hit enter to continue.");
        scanf("%c",&ch);
        printf("\ncomputing the inner products with all points ...\n");
        fail = celcon_length_of_supports(&r,nl);
        for(i=0; i<r; i++)
        {
            printf("support %d :\n", i);
            for(j=0; j<nl[i]; j++)
            {
                fail = celcon_get_lifted_point(n,i+1,j+1,point);
                for(kk=0; kk<n-1; kk++) printf(" %d",(int) point[kk]);
                prod = inner_product(n,normal,point);
                printf(" : %.15le\n", prod);
                if(j == 0)
                    minprod = prod;
                else if(prod < minprod) minprod = prod;
            }
            printf("-> support %d has minimal product : %.15le\n", i, minprod);
        }
    }
    return fail;
}