Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
vinci_lass.c File Reference
#include "vinci.h"
Include dependency graph for vinci_lass.c:

Go to the source code of this file.

Macros

#define MAXIMUM   1.0e150 /* define the maximum used for testing infinity */
 
#define EPSILON_LASS   EPSILON /* Numbers smaller than this are treated as zero in rhs*/
 
#define EPS1   EPSILON /* Numbers smaller than this are treated as zero in coefficient */
 
#define EPS_NORM   EPSILON /* EPSILON used for constraint normalization*/
 
#define LaShiftLevel   0 /* Shifting is possible if d>=LaShiftLevel */
 
#define LaShift
 
#define verboseFirstLevel   /* output the intermediate volume of the first level */
 

Functions

void * my_malloc (long int size)
 
void my_free (void *pointer, long int size)
 
void create_key (T_Key *key, int key_choice)
 
void free_key (T_Key key, int key_choice)
 
void add_hypervar (T_LassInt hyperplane, T_LassInt variable, T_Key *key)
 
void delete_hypervar (T_LassInt hyperplane, T_LassInt variable, T_Key *key)
 
int * create_int_vector (n)
 
void free_int_vector (int *v, int n)
 
static T_LassInt add_reduced_index (T_LassInt red, T_LassInt *indices, T_LassInt *ref_indices)
 
static void del_original_indices (T_LassInt *indices, T_LassInt *org_indices)
 
static void del_original (T_LassInt base, T_LassInt *indices)
 
static void rm_original_inElAll_index (T_LassInt baserow)
 
static void rm_constraint (rational *A, int *LastPlane_, int d, int rm_index)
 
static rationalcompact ()
 
static int notInPivot (int *pivot, int col, int i)
 
static void shift_P (rational *A, int LastPlane_, int d)
 
static int norm_and_clean_constraints (rational *A, int *LastPlane_, int d, T_LassInt *Del_index, int Index_needed)
 
static rational lass (rational *A, int LastPlane_, int d)
 
void VOLUME_LASSERRE_FILE (double planes2[7][4], rational *volume)
 
void volume_lasserre_file (double planes2[7][4], rational *volume)
 
void VOLUME_LASSERRE_FILE_ (double planes2[7][4], rational *volume)
 
void volume_lasserre_file_ (double planes2[7][4], rational *volume)
 
static int compare_key (T_Key key1, T_Key key2, int key_choice)
 
void tree_out (T_Tree **ppr, int *pi_balance, T_Key key, rational **volume, T_Key **keyfound, int key_choice)
 
T_VertexSet duplicate_set (T_VertexSet s)
 

Variables

int G_d
 
int G_m
 
real ** G_Hyperplanes = NULL
 
T_VertexSetG_Incidence = NULL
 
T_VertexSet G_Vertices
 
int G_Precomp = 0
 
int G_Storage = -1
 
int G_RandomSeed = 4
 
boolean G_OutOfMem = TRUE
 
void * G_MemRes = NULL
 
rational G_Minus1 = -1
 
rationalA
 
rationalpivotrow
 
T_LassIntAll_index
 
T_LassIntPivot
 
int ** p2c
 
rationalplanescopy
 
static T_Key key
 
static T_Keykeyfound
 
static T_Treetree_volumes
 
static T_VertexSetface
 

Macro Definition Documentation

#define EPS1   EPSILON /* Numbers smaller than this are treated as zero in coefficient */

Definition at line 27 of file vinci_lass.c.

Referenced by norm_and_clean_constraints().

#define EPS_NORM   EPSILON /* EPSILON used for constraint normalization*/

Definition at line 28 of file vinci_lass.c.

Referenced by norm_and_clean_constraints().

#define EPSILON_LASS   EPSILON /* Numbers smaller than this are treated as zero in rhs*/

Definition at line 26 of file vinci_lass.c.

Referenced by lass().

#define LaShift
Value:
1 /* shift polytope to make at least d components of
the rhs zero if there are less than d-LaShift zeros */

Definition at line 30 of file vinci_lass.c.

Referenced by lass().

#define LaShiftLevel   0 /* Shifting is possible if d>=LaShiftLevel */

Definition at line 29 of file vinci_lass.c.

Referenced by lass().

#define MAXIMUM   1.0e150 /* define the maximum used for testing infinity */
#define verboseFirstLevel   /* output the intermediate volume of the first level */

Definition at line 34 of file vinci_lass.c.

Function Documentation

void add_hypervar ( T_LassInt  hyperplane,
T_LassInt  variable,
T_Key key 
)

Definition at line 168 of file vinci_lass.c.

176 { int i, j;
177 
178  if (hyperplane != G_m+1)
179  {
180  for (i = 0; (*key).hypervar.hyperplanes [i] < hyperplane; i++);
181  if ((*key).hypervar.hyperplanes [i] != hyperplane)
182  { /* insert index */
183  for (j = G_d; j > i; j--)
184  (*key).hypervar.hyperplanes [j] = (*key).hypervar.hyperplanes [j-1];
185  (*key).hypervar.hyperplanes [i] = hyperplane;
186  }
187  }
188 
189  if (variable != G_d+1)
190  {
191  for (i = 0; (*key).hypervar.variables [i] < variable; i++);
192  if ((*key).hypervar.variables [i] != variable)
193  { /* insert index */
194  for (j = G_d; j > i; j--)
195  (*key).hypervar.variables [j] = (*key).hypervar.variables [j-1];
196  (*key).hypervar.variables [i] = variable;
197  }
198  }
199 }
int G_m
Definition: vinci_lass.c:51
blockLoc i
Definition: read.cpp:79
j indices j
Definition: Indexing.h:6
int G_d
Definition: vinci_lass.c:50
static T_LassInt add_reduced_index ( T_LassInt  red,
T_LassInt indices,
T_LassInt ref_indices 
)
static

Definition at line 258 of file vinci_lass.c.

References G_m, and i.

Referenced by lass(), and norm_and_clean_constraints().

264 { register int i;
265  T_LassInt xch, base;
266 
267  for (i=0; red>=ref_indices[i]; i++) red++; /* reduced index -> original index */
268  base=red;
269  while (ref_indices[i]<=G_m) {
270  xch=ref_indices[i];
271  ref_indices[i]=red;
272  red=xch;
273  i++;
274  };
275  ref_indices[i]=red;
276  ref_indices[i+1]=G_m+2;
277  if (indices==NULL) return base;
278  red=base;
279  for (i=0; base>indices[i]; i++);
280  while (indices[i]<=G_m) {
281  xch=indices[i];
282  indices[i]=red;
283  red=xch;
284  i++;
285  };
286  indices[i]=red;
287  indices[i+1]=G_m+2;
288  return base;
289 }
int G_m
Definition: vinci_lass.c:51
blockLoc i
Definition: read.cpp:79
unsigned char T_LassInt
Definition: vinci.h:184

Here is the caller graph for this function:

static rational* compact ( )
static

Definition at line 345 of file vinci_lass.c.

References G_d, G_Hyperplanes, G_m, i, j, and my_malloc().

Referenced by VOLUME_LASSERRE_FILE().

346 { register int i, j;
347  register rational *po,*pc;
348 
349  if (!(pc = (rational *) my_malloc (G_m*(G_d+1)*sizeof(rational)))) {
350  fprintf (stderr, "\n***** ERROR: Out of memory in 'compact.*pc'");
351  exit(0);
352  }
353  po=pc;
354  for (i=0; i<G_m; i++) {
355  for (j=0; j<=G_d; j++,pc++) *pc= G_Hyperplanes [i][j];
356  };
357  return po;
358 }
real rational
Definition: vinci.h:189
void * my_malloc(long int size)
Definition: vinci_lass.c:90
int G_m
Definition: vinci_lass.c:51
real ** G_Hyperplanes
Definition: vinci_lass.c:53
blockLoc i
Definition: read.cpp:79
j indices j
Definition: Indexing.h:6
int G_d
Definition: vinci_lass.c:50

Here is the call graph for this function:

Here is the caller graph for this function:

static int compare_key ( T_Key  key1,
T_Key  key2,
int  key_choice 
)
static

Definition at line 818 of file vinci_lass.c.

References T_Key::d, G_m, T_Key::hyperplanes, T_Key::hypervar, i, KEY_PLANES, KEY_PLANES_VAR, KEY_VERTICES, T_VertexSet::lastel, T_VertexSet::loe, p1, T_Key::set, and T_Key::vertices.

Referenced by tree_out().

823 { int i;
824  T_LassInt *p1, *p2;
825 
826  switch (key_choice)
827  {
828  case KEY_PLANES:
829  for (i=0; ; i++)
830  if (key1.hyperplanes [i] < key2.hyperplanes [i]) return -1;
831  else if (key1.hyperplanes [i] > key2.hyperplanes [i]) return 1;
832  else if (key1.hyperplanes [i] > G_m) return 0;
833  break;
834  case KEY_VERTICES:
835  if (key1.vertices.d < key2.vertices.d) return -1;
836  else if (key1.vertices.d > key2.vertices.d) return 1;
837  else /* both volumes are for the same dimension */
838  if (key1.vertices.set.lastel < key2.vertices.set.lastel) return -1;
839  else if (key1.vertices.set.lastel > key2.vertices.set.lastel) return 1;
840  else
841  { /* both sets have the same cardinality */
842  for (i=0; i <= key1.vertices.set.lastel; i++)
843  if (key1.vertices.set.loe [i] -> no < key2.vertices.set.loe [i] -> no)
844  return -1;
845  else if (key1.vertices.set.loe [i] -> no > key2.vertices.set.loe [i] -> no)
846  return 1;
847  }
848  return 0;
849  break;
850  case KEY_PLANES_VAR:
851 /*
852  for (i=0; ; i++)
853  if (key1.hypervar.hyperplanes [i] < key2.hypervar.hyperplanes [i])
854  return -1;
855  else if (key1.hypervar.hyperplanes [i] > key2.hypervar.hyperplanes [i])
856  return 1;
857  else if (key1.hypervar.hyperplanes [i] > G_m) return 0;
858 */
859  for (p1 = key1.hypervar.hyperplanes, p2 = key2.hypervar.hyperplanes;;
860  p1++, p2++)
861  if ((*p1) < (*p2)) return -1;
862  else if ((*p1) > (*p2)) return 1;
863  else if ((*p1) > G_m) return 0;
864  break;
865  }
866 }
T_Vertex ** loe
Definition: vinci.h:204
NT p1
struct T_Key::@39 vertices
#define KEY_VERTICES
Definition: vinci.h:160
int G_m
Definition: vinci_lass.c:51
blockLoc i
Definition: read.cpp:79
struct T_Key::@40 hypervar
#define KEY_PLANES_VAR
Definition: vinci.h:161
int d
Definition: vinci.h:228
#define KEY_PLANES
Definition: vinci.h:159
int lastel
Definition: vinci.h:202
int * hyperplanes
Definition: vinci.h:224
T_VertexSet set
Definition: vinci.h:227
unsigned char T_LassInt
Definition: vinci.h:184

Here is the caller graph for this function:

int* create_int_vector ( n  )

Definition at line 236 of file vinci_lass.c.

References my_malloc(), n, and v.

239 { int *v;
240 
241  v = (int *) my_malloc (n * sizeof (int));
242 
243  return v;
244 }
void * my_malloc(long int size)
Definition: vinci_lass.c:90
*********************************************************************Illinois Open Source License ****University of Illinois NCSA **Open Source License University of Illinois All rights reserved ****Developed free of to any person **obtaining a copy of this software and associated documentation to deal with the Software without including without limitation the rights to and or **sell copies of the and to permit persons to whom the **Software is furnished to do subject to the following this list of conditions and the following disclaimers ****Redistributions in binary form must reproduce the above **copyright this list of conditions and the following **disclaimers in the documentation and or other materials **provided with the distribution ****Neither the names of the Center for Simulation of Advanced the University of nor the names of its **contributors may be used to endorse or promote products derived **from this Software without specific prior written permission ****THE SOFTWARE IS PROVIDED AS WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **ARISING OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE v
Definition: roccomf90.h:20
const NT & n

Here is the call graph for this function:

void create_key ( T_Key key,
int  key_choice 
)

Definition at line 131 of file vinci_lass.c.

134 {
135  switch (key_choice)
136  {
137  case KEY_PLANES:
138  key -> hyperplanes = create_int_vector (G_d + 1);
139  break;
140  case KEY_PLANES_VAR:
141  key -> hypervar.hyperplanes =
142  (T_LassInt *) my_malloc ((G_Storage + 2) * sizeof (T_LassInt));
143  key -> hypervar.variables =
144  (T_LassInt *) my_malloc ((G_Storage + 2) * sizeof (T_LassInt));
145  break;
146  }
147 }
int * create_int_vector(int n)
void * my_malloc(long int size)
Definition: vinci_lass.c:90
#define KEY_PLANES_VAR
Definition: vinci.h:161
int G_Storage
Definition: vinci_lass.c:58
#define KEY_PLANES
Definition: vinci.h:159
int G_d
Definition: vinci_lass.c:50
T_LassInt * variables
Definition: vinci.h:232
int * hyperplanes
Definition: vinci.h:224
unsigned char T_LassInt
Definition: vinci.h:184
static void del_original ( T_LassInt  base,
T_LassInt indices 
)
static

Definition at line 308 of file vinci_lass.c.

References G_m, and i.

Referenced by lass(), and rm_original_inElAll_index().

312 { int i;
313 
314  for (i=0; ((base!=indices[i])&&(indices[i]<=G_m)); i++); /* search original index */
315  if (base!=indices[i]) {
316  fprintf(stderr, "ERROR: Deletion index not found!\n");
317  exit(0);
318  };
319  for (;indices[i]<=G_m;i++) indices[i]=indices[i+1];
320 }
int G_m
Definition: vinci_lass.c:51
blockLoc i
Definition: read.cpp:79

Here is the caller graph for this function:

static void del_original_indices ( T_LassInt indices,
T_LassInt org_indices 
)
static

Definition at line 292 of file vinci_lass.c.

References G_m, and i.

Referenced by lass().

297 { register int i, cnt;
298 
299  i=cnt=0;
300  while (org_indices[i]<=G_m) {
301  while ((org_indices[cnt+i]==indices[cnt])&&(indices[cnt]<=G_m)) cnt++;
302  org_indices[i]=org_indices[i+cnt];
303  i++;
304  }
305 }
int G_m
Definition: vinci_lass.c:51
blockLoc i
Definition: read.cpp:79

Here is the caller graph for this function:

void delete_hypervar ( T_LassInt  hyperplane,
T_LassInt  variable,
T_Key key 
)

Definition at line 204 of file vinci_lass.c.

209 { int i, j;
210 
211  if (hyperplane != G_m+1)
212  {
213  for (i = 0; i <= G_d && (*key).hypervar.hyperplanes [i] != hyperplane; i++);
214  if (i != G_d + 1)
215  { /* index found, delete it */
216  for (j = i; (*key).hypervar.hyperplanes [j] != G_m + 1; j++)
217  (*key).hypervar.hyperplanes [j] = (*key).hypervar.hyperplanes [j+1];
218  }
219  }
220 
221  if (variable != G_d+1)
222  {
223  for (i = 0; i <= G_d && (*key).hypervar.variables [i] != variable; i++);
224  if (i != G_d + 1)
225  { /* index found, delete it */
226  for (j = i; (*key).hypervar.variables [j] != G_d + 1; j++)
227  (*key).hypervar.variables [j] = (*key).hypervar.variables [j+1];
228  }
229  }
230 }
int G_m
Definition: vinci_lass.c:51
blockLoc i
Definition: read.cpp:79
j indices j
Definition: Indexing.h:6
int G_d
Definition: vinci_lass.c:50
T_VertexSet duplicate_set ( T_VertexSet  s)

Definition at line 1028 of file vinci_lass.c.

1031 { T_VertexSet newset;
1032 
1033  newset.maxel = s.lastel;
1034  newset.lastel = s.lastel;
1035  newset.loe = (T_Vertex **) my_malloc ((s.lastel + 1) * sizeof (T_Vertex *));
1036  memcpy (newset.loe, s.loe, (s.lastel + 1) * sizeof (T_Vertex *));
1037  return newset;
1038 }
T_Vertex ** loe
Definition: vinci.h:204
void * my_malloc(long int size)
Definition: vinci_lass.c:90
int maxel
Definition: vinci.h:201
int lastel
Definition: vinci.h:202
void free_int_vector ( int *  v,
int  n 
)

Definition at line 248 of file vinci_lass.c.

251 {
252  my_free (v, n * sizeof (int));
253 }
void my_free(void *pointer, long int size)
Definition: vinci_lass.c:121
*********************************************************************Illinois Open Source License ****University of Illinois NCSA **Open Source License University of Illinois All rights reserved ****Developed free of to any person **obtaining a copy of this software and associated documentation to deal with the Software without including without limitation the rights to and or **sell copies of the and to permit persons to whom the **Software is furnished to do subject to the following this list of conditions and the following disclaimers ****Redistributions in binary form must reproduce the above **copyright this list of conditions and the following **disclaimers in the documentation and or other materials **provided with the distribution ****Neither the names of the Center for Simulation of Advanced the University of nor the names of its **contributors may be used to endorse or promote products derived **from this Software without specific prior written permission ****THE SOFTWARE IS PROVIDED AS WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **ARISING OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE v
Definition: roccomf90.h:20
const NT & n
void free_key ( T_Key  key,
int  key_choice 
)

Definition at line 151 of file vinci_lass.c.

154 {
155  switch (key_choice)
156  {
157  case KEY_PLANES:
158  free_int_vector (key.hyperplanes, G_d + 1);
159  break;
160  case KEY_PLANES_VAR:
161  my_free (key.hypervar.hyperplanes, (G_Storage + 2) * sizeof (T_LassInt));
162  my_free (key.hypervar.variables, (G_Storage + 2) * sizeof (T_LassInt));
163  break;
164  }
165 }
void my_free(void *pointer, long int size)
Definition: vinci_lass.c:121
void free_int_vector(int *v, int n)
Definition: vinci_lass.c:248
struct T_Key::@40 hypervar
#define KEY_PLANES_VAR
Definition: vinci.h:161
int G_Storage
Definition: vinci_lass.c:58
#define KEY_PLANES
Definition: vinci.h:159
int G_d
Definition: vinci_lass.c:50
T_LassInt * variables
Definition: vinci.h:232
int * hyperplanes
Definition: vinci.h:224
unsigned char T_LassInt
Definition: vinci.h:184
static rational lass ( rational A,
int  LastPlane_,
int  d 
)
static

Definition at line 572 of file vinci_lass.c.

References A, add_hypervar(), add_reduced_index(), All_index, d, del_original(), del_original_indices(), delete_hypervar(), EPSILON_LASS, FALSE, G_d, G_m, G_MemRes, G_OutOfMem, G_Storage, i, j, KEY_PLANES_VAR, LaShift, LaShiftLevel, MAXIMUM, MIN_PIVOT_LASS, my_free(), my_malloc(), norm_and_clean_constraints(), p2c, Pivot, pivotrow, rm_original_inElAll_index(), shift_P(), tree_out(), TRUE, and volume().

Referenced by VOLUME_LASSERRE_FILE().

576 { rational * redA; /* A reduced by one dimension and constraint */
577  int i, j;
578  T_LassInt baserow, basecol, col;
579  int dimdiff, row; /* dimension difference and boolean */
580  int i_balance = FALSE;
581  rational ma, mi, *volume, *realp1, *realp2;
582  int Index_needed; /* Boolean, if index operations are needed */
583  T_LassInt * Del_index; /* contains the indices of the deleted planes */
584 
585  /* test if volume is already known and return it if so */
586 
587  dimdiff = G_d-d;
588  if ((G_Storage > (dimdiff-2)) && (dimdiff >= 2)) {
589  tree_out (&tree_volumes, &i_balance, key, &volume, &keyfound, KEY_PLANES_VAR);
590  if ((*volume)>=0) { /* this volume has already been computed */
591  printf("\nNeed Scale routine!\n");
592  }
593  if (!G_OutOfMem) {
594  (*volume)=0; /* initialize */
595  dimdiff=TRUE;
596  }
597  else dimdiff=FALSE;
598  }
599  else dimdiff=FALSE;
600 
601  /* if d==1 compute the volume and give it back */
602 
603  if (d == 1) {
604  ma=-MAXIMUM;
605  mi= MAXIMUM;
606  for (i=0; i<=LastPlane_; i++,A+=2) {
607  if (*A>EPSILON_LASS) { if ((*(A+1)/ *A)<mi) mi=(*(A+1)/ *A); }
608  else if (*A<-EPSILON_LASS) { if ((*(A+1)/ *A)>ma) ma=*(A+1)/ *A; }
609  else if ((*(A+1))<-(100000*EPSILON_LASS)) return 0;
610  }
611  if ((ma<-.5*MAXIMUM)||(mi>.5*MAXIMUM)) {
612  printf("\nVolume is unbounded!\n");
613  exit(0);
614  }
615  if ((mi-ma)>EPSILON_LASS) {
616  if (dimdiff) (*volume)=mi-ma;
617  return mi-ma;
618  }
619  return 0;
620  }
621 
622  /* if d>1 apply the recursive scheme by fixing constraints. */
623 
624  Index_needed = (G_Storage>(G_d-d-1));
625  if (Index_needed){
626  if (!(Del_index = (T_LassInt *) my_malloc ((LastPlane_ + 2) * sizeof (T_LassInt)))){
627  fprintf (stderr, "\n***** ERROR/WARNING: Out of memory in 'lass'\n");
628  if (G_OutOfMem) exit(0);
629  G_OutOfMem = TRUE;
630  free(G_MemRes);
631  Del_index = (T_LassInt *) malloc ((LastPlane_ + 2) * sizeof (T_LassInt));
632  };
633  Del_index[0]=G_m+2; /* initialize: mark end */
634  }
635  ma=0; /* used to sum up the summands */
636  if (norm_and_clean_constraints(A, &LastPlane_, d, Del_index, Index_needed)!=0)
637  goto label2;
638 
639  /* if appropriate shift polytope */
640 
641  if (d>=LaShiftLevel) {
642  realp1=A+d;
643  realp2=realp1+LastPlane_*(d+1);
644  j=0;
645  while (realp1<=realp2) {
646  if (fabs(*realp1)<EPSILON_LASS) j++;
647  realp1+=d+1;
648  }
649  if (d-j>=LaShift) shift_P(A, LastPlane_, d);
650  }
651 
652 
653  redA = (rational *) my_malloc (LastPlane_* d*sizeof(rational));
654  if (redA == NULL) {
655  fprintf (stderr, "\n***** ERROR/WARNING: Out of memory in 'lass.*redA'\n");
656  if (G_OutOfMem) exit(0);
657  G_OutOfMem = TRUE;
658  free(G_MemRes);
659  redA = (rational *) malloc (LastPlane_* d*sizeof(rational));
660  }
661 #ifdef ReverseLass
662  for (row=LastPlane_; row>=0; row--) {
663 #else
664  for (row=0; row<=LastPlane_; row++) {
665 #endif
666  if (fabs(*(A+row*(d+1)+d))<EPSILON_LASS)
667  continue; /* skip this constraint if b_row == 0 */
668  if (Index_needed)
669  { baserow=add_reduced_index(row, NULL, All_index);
670  p2c[G_d-d][1] = baserow;
671  add_hypervar (baserow, G_d+1, &key);
672  }
673  memcpy(&pivotrow[0], A+row*(d+1), sizeof(rational)*(d+1));
674  col=0; /* search for pivot column */
675  for (i=0; i<d; i++) {
676 #if PIVOTING_LASS == 0
677  if (fabs(pivotrow[i])>=MIN_PIVOT_LASS) {col=i; break;};
678 #endif
679  if (fabs(pivotrow[i])>fabs(pivotrow[col])) col=i;
680  };
681  if (G_Storage>(G_d-d-1))
682  { basecol=add_reduced_index(col, NULL, Pivot);
683  p2c[G_d-d][0] = basecol;
684  add_hypervar (G_m+1, basecol, &key);
685  }
686 
687  /* copy A onto redA and at the same time perform pivoting */
688 
689  mi=1.0/pivotrow[col];
690  for (i=0; i<=d; i++) pivotrow[i]*=mi;
691  realp1=A;
692  realp2=redA;
693  for (i=0; i<=LastPlane_; i++) {
694  if (i==row) {
695  realp1+=d+1;
696  continue;
697  };
698  mi=*(A+(i*(d+1))+col);
699  for (j=0; j<=d; j++) {
700  if (j==col) {
701  realp1++;
702  continue;
703  };
704  *realp2=(*realp1)-pivotrow[j]*mi;
705  realp1++;
706  realp2++;
707  };
708  };
709  ma+= *(A+row*(d+1)+d)/(d*fabs(*(A+row*(d+1)+col)))
710  *lass(redA, LastPlane_-1, d-1);
711  if (Index_needed)
712  { rm_original_inElAll_index(baserow);
713  delete_hypervar (baserow, G_d+1, &key);
714  }
715  if (G_Storage>(G_d-d-1))
716  { del_original(basecol, Pivot);
717  delete_hypervar (G_m+1, basecol, &key);
718  }
719  /*$#ifdef verboseFirstLevel
720  if (d==G_d)
721  printf("\nVolume accumulated to iteration %i is %20.12f",row,ma );
722  #endif$*/
723  };
724  my_free (redA, LastPlane_* d * sizeof (rational));
725  label2:
726  if (Index_needed) {
727  del_original_indices(Del_index, All_index);
728  my_free (Del_index, (LastPlane_ + 2) * sizeof (T_LassInt));
729  };
730  if (dimdiff)(*volume)=ma;
731  return ma;
732 }
void my_free(void *pointer, long int size)
Definition: vinci_lass.c:121
#define FALSE
Definition: vinci.h:133
real rational
Definition: vinci.h:189
static T_Key * keyfound
Definition: vinci_lass.c:76
rational * pivotrow
Definition: vinci_lass.c:68
const NT & d
void delete_hypervar(T_LassInt hyperplane, T_LassInt variable, T_Key *key)
Definition: vinci_lass.c:204
T_LassInt * All_index
Definition: vinci_lass.c:69
static int norm_and_clean_constraints(rational *A, int *LastPlane_, int d, T_LassInt *Del_index, int Index_needed)
Definition: vinci_lass.c:483
void * my_malloc(long int size)
Definition: vinci_lass.c:90
#define MAXIMUM
Definition: vinci_lass.c:25
T_LassInt * Pivot
Definition: vinci_lass.c:70
static T_Tree * tree_volumes
Definition: vinci_lass.c:78
static void del_original_indices(T_LassInt *indices, T_LassInt *org_indices)
Definition: vinci_lass.c:292
void tree_out(T_Tree **ppr, int *pi_balance, T_Key key, rational **volume, T_Key **keyfound, int key_choice)
Definition: vinci_lass.c:870
static void del_original(T_LassInt base, T_LassInt *indices)
Definition: vinci_lass.c:308
int G_m
Definition: vinci_lass.c:51
rational * A
Definition: vinci_lass.c:67
static void rm_original_inElAll_index(T_LassInt baserow)
Definition: vinci_lass.c:323
int volume(const block *b)
Definition: split.cpp:181
static rational lass(rational *A, int LastPlane_, int d)
Definition: vinci_lass.c:572
#define EPSILON_LASS
Definition: vinci_lass.c:26
blockLoc i
Definition: read.cpp:79
boolean G_OutOfMem
Definition: vinci_lass.c:61
#define TRUE
Definition: vinci.h:134
#define KEY_PLANES_VAR
Definition: vinci.h:161
static T_LassInt add_reduced_index(T_LassInt red, T_LassInt *indices, T_LassInt *ref_indices)
Definition: vinci_lass.c:258
#define MIN_PIVOT_LASS
Definition: vinci.h:73
int ** p2c
Definition: vinci_lass.c:71
static void shift_P(rational *A, int LastPlane_, int d)
Definition: vinci_lass.c:374
#define LaShiftLevel
Definition: vinci_lass.c:29
#define LaShift
Definition: vinci_lass.c:30
j indices j
Definition: Indexing.h:6
void add_hypervar(T_LassInt hyperplane, T_LassInt variable, T_Key *key)
Definition: vinci_lass.c:168
int G_Storage
Definition: vinci_lass.c:58
int G_d
Definition: vinci_lass.c:50
static T_Key key
Definition: vinci_lass.c:76
void * G_MemRes
Definition: vinci_lass.c:62
unsigned char T_LassInt
Definition: vinci.h:184

Here is the call graph for this function:

Here is the caller graph for this function:

void my_free ( void *  pointer,
long int  size 
)

Definition at line 121 of file vinci_lass.c.

125 {
126  free (pointer);
127 }
void* my_malloc ( long int  size)

Definition at line 90 of file vinci_lass.c.

94 { void *pointer;
95 
96  pointer = malloc (size);
97 
98  if (pointer == NULL)
99  if (!G_OutOfMem)
100  {
101  fprintf (stderr, "\n***** WARNING: Out of memory; freeing memory reserve\n");
102  free (G_MemRes);
103  G_OutOfMem = TRUE;
104  pointer = my_malloc (size);
105  }
106  else
107  {
108  fprintf (stderr, "\n***** ERROR: Out of memory\n");
109  exit (0);
110  }
111  else
112  {
113 
114  }
115 
116  return pointer;
117 }
void * my_malloc(long int size)
Definition: vinci_lass.c:90
boolean G_OutOfMem
Definition: vinci_lass.c:61
#define TRUE
Definition: vinci.h:134
void * G_MemRes
Definition: vinci_lass.c:62
static int norm_and_clean_constraints ( rational A,
int *  LastPlane_,
int  d,
T_LassInt Del_index,
int  Index_needed 
)
static

Definition at line 483 of file vinci_lass.c.

References A, add_reduced_index(), All_index, d, EPS1, EPS_NORM, i, j, p1, rm_constraint(), and sqrt().

Referenced by lass().

491 { register int i, j, row = 0;
492  register rational r0, *p1, *p2;
493 
494  /* find nonzero[][] and maximal elements and normalize */
495 
496  p1=A; /* begin of first constraint */
497  while (row<=(*LastPlane_)) { /* remove zeros and normalize */
498  r0=0.0; /* norm of vector */
499  for (j=0; j<d; j++,p1++)
500  r0+=(*p1)*(*p1); /* compute euclidean norm */
501  r0=sqrt(r0);
502  if (r0<EPS_NORM) {
503  if ((*p1)<-100000*EPS1){ /* if negative rhs */
504  return 1; /* infeasible constraint */
505  }
506  rm_constraint(A, LastPlane_, d,row);
507  if (Index_needed) add_reduced_index(row, Del_index, All_index);
508  p1-=d;
509  }
510  else {
511  r0=1.0/r0;
512  p1-=d;
513  for (j=0; j<=d; j++,p1++)
514  (*p1)*=r0;
515  row++;
516  }
517  }
518 
519  /* detect identical or reverse constraints */
520 
521  for (row=0; row<(*LastPlane_); row++) {
522  i=row+1;
523  while (i<=*LastPlane_) { /* test all subsequent rows i if equal to row */
524  r0=0.0;
525  p1=A+row*(d+1);
526  p2=A+i*(d+1);
527  for (j=0;j<d;j++,p1++,p2++)
528  r0+=(*p1)*(*p2); /* cosinus of arc among those two vectors */
529  if (r0>0) {
530  /* NEW VERSION of removing constraints */
531  if (fabs(r0-1.0)<EPS_NORM) {
532  if ((*p1)>(*p2)){
533  if (Index_needed) add_reduced_index(row, Del_index, All_index);
534  rm_constraint(A, LastPlane_, d,row);
535  i=row+1;
536  }
537  else {
538  if (Index_needed) add_reduced_index(i, Del_index, All_index);
539  if (i<(*LastPlane_))
540  rm_constraint(A, LastPlane_, d,i);
541  else (*LastPlane_)--;
542  }
543  }
544  else i++;
545 
546  /* OLD VERSION :
547  if ((fabs(r0-1.0)<EPS_NORM) && (fabs((*p1)-(*p2))<EPS1)){
548  if (Index_needed) add_reduced_index(i, Del_index, All_index);
549  if (i<(*LastPlane_))
550  rm_constraint(A, LastPlane_, d,i);
551  else (*LastPlane_)--;
552  }
553  else i++;
554  */
555  }
556  else {
557  if (fabs(r0+1.0)<EPS_NORM){
558  if ((*p1)>0){
559  if ((*p2)<(EPS1-(*p1))) return 1;
560  }
561  else {
562  if ((*p1)<(EPS1-(*p2))) return 1;
563  }
564  }
565  i++;
566  }
567  }
568  }
569  return 0; /* elimination succesful */
570 }
real rational
Definition: vinci.h:189
const NT & d
T_LassInt * All_index
Definition: vinci_lass.c:69
NT p1
#define EPS_NORM
Definition: vinci_lass.c:28
double sqrt(double d)
Definition: double.h:73
#define EPS1
Definition: vinci_lass.c:27
static void rm_constraint(rational *A, int *LastPlane_, int d, int rm_index)
Definition: vinci_lass.c:328
rational * A
Definition: vinci_lass.c:67
blockLoc i
Definition: read.cpp:79
static T_LassInt add_reduced_index(T_LassInt red, T_LassInt *indices, T_LassInt *ref_indices)
Definition: vinci_lass.c:258
j indices j
Definition: Indexing.h:6

Here is the call graph for this function:

Here is the caller graph for this function:

static int notInPivot ( int *  pivot,
int  col,
int  i 
)
static

Definition at line 366 of file vinci_lass.c.

References FALSE, and TRUE.

Referenced by shift_P().

367 { register int h;
368  for (h=0;h<col;h++)
369  if (pivot[h]==i) return FALSE;
370  return TRUE;
371 }
#define FALSE
Definition: vinci.h:133
blockLoc i
Definition: read.cpp:79
#define TRUE
Definition: vinci.h:134

Here is the caller graph for this function:

static void rm_constraint ( rational A,
int *  LastPlane_,
int  d,
int  rm_index 
)
static

Definition at line 328 of file vinci_lass.c.

References i, and p1.

Referenced by norm_and_clean_constraints().

331 { register rational *p1, *p2;
332  register int i;
333 
334  p1=A+rm_index*(d+1);
335  p2=A+(rm_index+1)*(d+1);
336  for (i=0; i<(((*LastPlane_)-rm_index)*(d+1)); i++) {
337  *p1=*p2;
338  p1++;
339  p2++;
340  };
341  (*LastPlane_)--;
342 }
real rational
Definition: vinci.h:189
const NT & d
NT p1
rational * A
Definition: vinci_lass.c:67
blockLoc i
Definition: read.cpp:79

Here is the caller graph for this function:

static void rm_original_inElAll_index ( T_LassInt  baserow)
static

Definition at line 323 of file vinci_lass.c.

References All_index, and del_original().

Referenced by lass().

325 { del_original(baserow, All_index); }
T_LassInt * All_index
Definition: vinci_lass.c:69
static void del_original(T_LassInt base, T_LassInt *indices)
Definition: vinci_lass.c:308

Here is the call graph for this function:

Here is the caller graph for this function:

static void shift_P ( rational A,
int  LastPlane_,
int  d 
)
static

Definition at line 374 of file vinci_lass.c.

References A, create_int_vector(), d, G_d, i, j, MIN_PIVOT_LASS, notInPivot(), p1, and planescopy.

Referenced by lass().

378 { register rational *p1, *p2, *p3, d1, d2, d3;
379  register int col, i, j;
380  static int *pivot = NULL;
381  /* contains the pivot row of each column */
382 
383 
384 
385  if (pivot == NULL) pivot = create_int_vector (G_d + 1);
386 
387  p1=A; /* search pivot of first column */
388  pivot[0]=0;
389  d3=fabs(d1=*p1);
390  for (i=0; i<=LastPlane_; i++) {
391  d2=fabs(*p1);
392 #if PIVOTING_LASS == 0
393  if (d2>=MIN_PIVOT_LASS) {pivot[0]=i; d1=*p1; break;};
394 #endif
395  if (d2>d3) { pivot[0]=i; d1=*p1; d3=d2; };
396  p1+=(d+1);
397  }
398  /* copy pivot row into planescopy */
399  p1=A+pivot[0]*(d+1)+1;
400  p2=planescopy+pivot[0]*(d+1)+1;
401  for (i=1,d2=1.0/d1; i<=d; i++,p1++,p2++) *p2 = (*p1)*d2;
402  /* complete first pivoting and copying */
403  p1=A+1;
404  p2=planescopy+1;
405  for (i=0; i<=LastPlane_; i++, p1++, p2++) {
406  if (i==pivot[0]) {
407  p1+=d;
408  p2+=d;
409  continue; /* pivot row already done */
410  }
411  d1=*(p1-1);
412  p3=planescopy+pivot[0]*(d+1)+1;
413  for (j=1; j<=d; j++, p1++, p2++, p3++) (*p2)=(*p1)-d1*(*p3);
414  }
415 
416  /* subsequent elimination below */
417 
418  for (col=1;col<d;col++) {
419  for (i=0;i<=LastPlane_;i++) /* search first row not already used as pivot row*/
420  if (notInPivot(pivot,col,i)) {
421  pivot[col]=i;
422  break;
423  }
424  p1=planescopy+i*(d+1)+col; /* search subsequent pivot row */
425  d3=fabs(d1=*p1);
426  for (; i<=LastPlane_; i++, p1+=(d+1))
427  if (notInPivot(pivot,col,i)) {
428  d2=fabs(*(p1));
429 #if PIVOTING_LASS == 0
430  if (d2>=MIN_PIVOT_LASS) {
431  pivot[col]=i;
432  d1=*p1;
433  break;
434  }
435 #endif
436  if (d2>d3) {
437  pivot[col]=i;
438  d1=*p1;
439  d3=d2;
440  }
441  };
442  /* update pivot row */
443  p1=planescopy+pivot[col]*(d+1)+col+1;
444  d2=1.0/d1;
445  for (j=col+1; j<=d; j++, p1++) (*p1) *= d2;
446  if (col==(d-1)) break; /* the rest is not needed in the last case */
447  /* update rest of rows */
448  p1=planescopy+col+1;
449  p2=planescopy+pivot[col]*(d+1)+col+1;
450  for (i=0; i<=LastPlane_; i++, p1+=(col+1)) {
451  if (!notInPivot(pivot,col+1,i)) {
452  p1+=d-col;
453  continue;
454  }
455  d1=*(p1-1);
456  for (j=col+1; j<=d; j++, p1++, p2++) *p1=(*p1)-d1*(*p2);
457  p2-=d-col;
458  }
459  };
460 
461  /* compute x* by backward substitution; result goes into rhs of planescopy */
462 
463  for (i=d-2; 0<=i; i--){
464  p1=planescopy+pivot[i]*(d+1)+d;
465  p2=p1-d+i+1;
466  for (j=i+1; j<d; j++, p2++)
467  *(p1)-= (*p2)*(*(planescopy+pivot[j]*(d+1)+d));
468  }
469 
470  /* compute shifted b */
471 
472  for (i=0; i<=LastPlane_; i++) {
473  p1=A+i*(d+1);
474  p2=p1+d;
475  if (notInPivot(pivot,d,i))
476  for (j=0; j<d; j++,p1++) {
477  *p2 -= (*p1)*(*(planescopy+pivot[j]*(d+1)+d));
478  }
479  else *p2=0;
480  }
481 }
real rational
Definition: vinci.h:189
const NT & d
NT p1
int * create_int_vector(int n)
rational * A
Definition: vinci_lass.c:67
blockLoc i
Definition: read.cpp:79
#define MIN_PIVOT_LASS
Definition: vinci.h:73
j indices j
Definition: Indexing.h:6
rational * planescopy
Definition: vinci_lass.c:75
static int notInPivot(int *pivot, int col, int i)
Definition: vinci_lass.c:366
int G_d
Definition: vinci_lass.c:50

Here is the call graph for this function:

Here is the caller graph for this function:

void tree_out ( T_Tree **  ppr,
int *  pi_balance,
T_Key  key,
rational **  volume,
T_Key **  keyfound,
int  key_choice 
)

Definition at line 870 of file vinci_lass.c.

883 { T_Tree *p1, *p2;
884  int cmp;
885 
886  /* Are we grounded? If so, add the node here and set the rebalance flag, then exit. */
887  if (!*ppr)
888  {
889  if (G_OutOfMem)
890  { /* don't allocate if out of memory */
891  *volume = &G_Minus1;
892  }
893  else
894  { (*ppr) = (T_Tree *) my_malloc (sizeof (T_Tree));
895  (*ppr) -> tree_l = NULL;
896  (*ppr) -> tree_r = NULL;
897  (*ppr) -> tree_b = 0;
898  /* copy the key into the new node */
899  create_key (&((*ppr) -> key), key_choice);
900  switch (key_choice)
901  {
902  case KEY_PLANES:
903  memcpy ((*ppr) -> key.hyperplanes, key.hyperplanes,
904  (G_d + 1) * sizeof (int));
905  break;
906  case KEY_VERTICES:
907  (*ppr) -> key.vertices.set = duplicate_set (key.vertices.set);
908  (*ppr) -> key.vertices.d = key.vertices.d;
909  break;
910  case KEY_PLANES_VAR:
911  memcpy ((*ppr) -> key.hypervar.hyperplanes, key.hypervar.hyperplanes,
912  (G_Storage + 2) * sizeof (T_LassInt));
913  memcpy ((*ppr) -> key.hypervar.variables, key.hypervar.variables,
914  (G_Storage + 2) * sizeof (T_LassInt));
915  break;
916  }
917  (*ppr) -> vol = -1; /* to recognise that element is newly created */
918  *volume = &((*ppr) -> vol);
919  *pi_balance = TRUE;
920  }
921  return;
922  }
923 
924  cmp = compare_key ((*ppr) -> key, key, key_choice);
925 
926  /* if LESS, prepare to move to the left. */
927  if (cmp < 0)
928  {
929  tree_out (&((*ppr) -> tree_l), pi_balance, key, volume, keyfound, key_choice);
930  if (*pi_balance)
931  { /* left branch has grown longer */
932  switch ((*ppr) -> tree_b)
933  {
934  case 1: /* right branch WAS longer; balance is ok now */
935  /* LESS: case 1.. balance restored implicitly */
936  (*ppr) -> tree_b = 0;
937  *pi_balance = FALSE;
938  break;
939  case 0: /* balance WAS okay; now left branch longer */
940  /* LESS: case 0.. balance bad but still ok */
941  (*ppr) -> tree_b = -1;
942  break;
943  case -1: /* left branch was already too long. rebalance */
944  p1 = (*ppr) -> tree_l;
945  if (p1 -> tree_b == -1)
946  { /* LESS: single LL */
947  (*ppr) -> tree_l = p1->tree_r;
948  p1 -> tree_r = (*ppr);
949  (*ppr) -> tree_b = 0;
950  (*ppr) = p1;
951  }
952  else
953  { /* LESS: real LR */
954  p2 = p1 -> tree_r;
955  p1 -> tree_r = p2 -> tree_l;
956  p2 -> tree_l = p1;
957  (*ppr) -> tree_l = p2 -> tree_r;
958  p2 -> tree_r = (*ppr);
959  if (p2 -> tree_b == -1)
960  (*ppr) -> tree_b = 1;
961  else (*ppr) -> tree_b = 0;
962  if (p2->tree_b == 1)
963  p1 -> tree_b = -1;
964  else p1 -> tree_b = 0;
965  (*ppr) = p2;
966  }
967  (*ppr) -> tree_b = 0;
968  *pi_balance = FALSE;
969  } /* switch */
970  } /* if */
971  } /* cmp < 0 */
972 
973  /* if MORE, prepare to move to the right. */
974  else if (cmp > 0)
975  {
976  tree_out (&((*ppr) -> tree_r), pi_balance, key, volume, keyfound, key_choice);
977  if (*pi_balance)
978  { /* right branch has grown longer */
979  switch ((*ppr) -> tree_b)
980  {
981  case -1: /* MORE: balance was off, fixed implicitly */
982  (*ppr) -> tree_b = 0;
983  *pi_balance = FALSE;
984  break;
985  case 0: /* MORE: balance was okay, now off but ok */
986  (*ppr)->tree_b = 1;
987  break;
988  case 1: /* MORE: balance was off, need to rebalance */
989  p1 = (*ppr) -> tree_r;
990  if (p1 -> tree_b == 1)
991  { /* MORE: single RR */
992  (*ppr) -> tree_r = p1 -> tree_l;
993  p1 -> tree_l = (*ppr);
994  (*ppr) -> tree_b = 0;
995  (*ppr) = p1;
996  }
997  else
998  { /* MORE: real RL */
999  p2 = p1 -> tree_l;
1000  p1 -> tree_l = p2 -> tree_r;
1001  p2 -> tree_r = p1;
1002  (*ppr) -> tree_r = p2 -> tree_l;
1003  p2 -> tree_l = (*ppr);
1004  if (p2 -> tree_b == 1)
1005  (*ppr) -> tree_b = -1;
1006  else (*ppr) -> tree_b = 0;
1007  if (p2 -> tree_b == -1)
1008  p1 -> tree_b = 1;
1009  else p1 -> tree_b = 0;
1010  (*ppr) = p2;
1011  }
1012  (*ppr) -> tree_b = 0;
1013  *pi_balance = FALSE;
1014  } /* switch */
1015  } /* if */
1016  } /* cmp > 0 */
1017 
1018  /* not less, not more: this is the same key! give volume back! */
1019  else
1020  {
1021  *pi_balance = FALSE;
1022  *volume = &((*ppr) -> vol);
1023  *keyfound = &((*ppr) -> key);
1024  }
1025 }
#define FALSE
Definition: vinci.h:133
if(dy > dx)
struct T_Tree * tree_r
Definition: vinci.h:239
Definition: vinci.h:238
NT p1
struct T_Key::@39 vertices
#define KEY_VERTICES
Definition: vinci.h:160
void * my_malloc(long int size)
Definition: vinci_lass.c:90
void tree_out(T_Tree **ppr, int *pi_balance, T_Key key, rational **volume, T_Key **keyfound, int key_choice)
Definition: vinci_lass.c:870
rational G_Minus1
Definition: vinci_lass.c:63
T_VertexSet duplicate_set(T_VertexSet s)
Definition: vinci_lass.c:1028
int volume(const block *b)
Definition: split.cpp:181
boolean G_OutOfMem
Definition: vinci_lass.c:61
#define TRUE
Definition: vinci.h:134
struct T_Key::@40 hypervar
#define KEY_PLANES_VAR
Definition: vinci.h:161
void create_key(T_Key *key, int key_choice)
Definition: vinci_lass.c:131
int tree_b
Definition: vinci.h:240
int d
Definition: vinci.h:228
int G_Storage
Definition: vinci_lass.c:58
#define KEY_PLANES
Definition: vinci.h:159
static int compare_key(T_Key key1, T_Key key2, int key_choice)
Definition: vinci_lass.c:818
int G_d
Definition: vinci_lass.c:50
static T_Key key
Definition: vinci_lass.c:76
T_LassInt * variables
Definition: vinci.h:232
int * hyperplanes
Definition: vinci.h:224
T_VertexSet set
Definition: vinci.h:227
unsigned char T_LassInt
Definition: vinci.h:184
void VOLUME_LASSERRE_FILE ( double  planes2[7][4],
rational volume 
)

Definition at line 737 of file vinci_lass.c.

References All_index, compact(), create_key(), FALSE, free_key(), G_d, G_Hyperplanes, G_m, G_MemRes, G_OutOfMem, G_Storage, T_Key::hyperplanes, T_Key::hypervar, i, j, KEY_PLANES_VAR, lass(), my_malloc(), p2c, Pivot, pivotrow, planescopy, and T_Key::variables.

Referenced by volume_lasserre_file(), VOLUME_LASSERRE_FILE_(), and volume_lasserre_file_().

739  { int i, j;
740 
741  G_d = 3;
742  G_m = 7;
743  G_Storage = 0;
744 
745  /* reserves memory space for the global variable G_Hyperplanes; G_m and G_d must be */
746  /* set correctly */
747 
748  G_Hyperplanes = (real **) my_malloc (G_m * sizeof (real *));
749 
750  for (i = 0; i < G_m; i++)
751  G_Hyperplanes [i] = (real *) my_malloc ((G_d + 1) * sizeof (real));
752  /* The last entry is needed for the right hand side. */
753 
754  /* Transfer input from Fortran to C array */
755 
756  for( i = 0; i <= G_d; i++)
757  for( j= 0; j < G_m; j++){
758  G_Hyperplanes [j][i] = planes2[j][i];
759  /* printf("\n%10.3e",planes2[j][i]); */
760  }
761 
762 /* fprintf (stderr, "\n****** Hyperplanes are: ******\n"); */
763 /* for (j = 0; j < G_m; j++) */
764 /* { fprintf (stderr, " Hyperplane [%i]: ", j); */
765 /* for (i=0; i < G_d; i++) fprintf (stderr, "%10.3lf", G_Hyperplanes [j] [i]); */
766 /* fprintf (stderr,"\n"); */
767 /* fprintf (stderr, " :%10.3lf", G_Hyperplanes [j] [G_d]); */
768 /* fprintf (stderr,"\n"); */
769 /* } */
770 
771 /* if (G_Storage > G_d - 3) */
772 /* G_Storage = G_d - 3; */
773  /* necessary to prevent memory waste because in the tree arrays of length */
774  /* G_Storage + 2 are allocated */
775 
776  pivotrow = (rational *) my_malloc ((G_d + 1) * sizeof (rational));
777  All_index = (T_LassInt *) my_malloc ((G_m + 1) * sizeof (T_LassInt));
778  Pivot = (T_LassInt *) my_malloc ((G_d + 1) * sizeof (T_LassInt));
779  p2c = (int **) my_malloc (G_d * sizeof (int *));
780  for (i=0; i<G_d; i++){
781  p2c[i] = (int *) my_malloc (2 * sizeof (int));
782  }
784  G_MemRes=malloc(G_d*G_d*G_m*sizeof(rational)); /* memory reserve; */
785 
786  A=compact();
788  tree_volumes = NULL;
790  key.hypervar.hyperplanes [0] = G_m + 1;
791  key.hypervar.variables [0] = G_d + 1;
792  All_index[0]=G_m+2; /* initialization (end mark) */
793  Pivot[0]=G_m+2; /* initialization (end mark) */
794  *volume = lass (A, G_m-1, G_d);
795 
796  if (!G_OutOfMem) free (G_MemRes);
798 }
#define FALSE
Definition: vinci.h:133
real rational
Definition: vinci.h:189
rational * pivotrow
Definition: vinci_lass.c:68
float real
Definition: gridutil.h:70
T_LassInt * All_index
Definition: vinci_lass.c:69
void * my_malloc(long int size)
Definition: vinci_lass.c:90
T_LassInt * Pivot
Definition: vinci_lass.c:70
static T_Tree * tree_volumes
Definition: vinci_lass.c:78
void free_key(T_Key key, int key_choice)
Definition: vinci_lass.c:151
int G_m
Definition: vinci_lass.c:51
real ** G_Hyperplanes
Definition: vinci_lass.c:53
rational * A
Definition: vinci_lass.c:67
int volume(const block *b)
Definition: split.cpp:181
static rational lass(rational *A, int LastPlane_, int d)
Definition: vinci_lass.c:572
blockLoc i
Definition: read.cpp:79
boolean G_OutOfMem
Definition: vinci_lass.c:61
struct T_Key::@40 hypervar
#define KEY_PLANES_VAR
Definition: vinci.h:161
void create_key(T_Key *key, int key_choice)
Definition: vinci_lass.c:131
int ** p2c
Definition: vinci_lass.c:71
j indices j
Definition: Indexing.h:6
static rational * compact()
Definition: vinci_lass.c:345
int G_Storage
Definition: vinci_lass.c:58
rational * planescopy
Definition: vinci_lass.c:75
int G_d
Definition: vinci_lass.c:50
static T_Key key
Definition: vinci_lass.c:76
T_LassInt * variables
Definition: vinci.h:232
int * hyperplanes
Definition: vinci.h:224
void * G_MemRes
Definition: vinci_lass.c:62
unsigned char T_LassInt
Definition: vinci.h:184

Here is the call graph for this function:

Here is the caller graph for this function:

void volume_lasserre_file ( double  planes2[7][4],
rational volume 
)

Definition at line 800 of file vinci_lass.c.

800  {
801  VOLUME_LASSERRE_FILE( planes2, volume);
802 }
int volume(const block *b)
Definition: split.cpp:181
void VOLUME_LASSERRE_FILE(double planes2[7][4], rational *volume)
Definition: vinci_lass.c:737
void VOLUME_LASSERRE_FILE_ ( double  planes2[7][4],
rational volume 
)

Definition at line 804 of file vinci_lass.c.

References VOLUME_LASSERRE_FILE().

804  {
805  VOLUME_LASSERRE_FILE( planes2, volume);
806 }
int volume(const block *b)
Definition: split.cpp:181
void VOLUME_LASSERRE_FILE(double planes2[7][4], rational *volume)
Definition: vinci_lass.c:737

Here is the call graph for this function:

void volume_lasserre_file_ ( double  planes2[7][4],
rational volume 
)

Definition at line 808 of file vinci_lass.c.

References VOLUME_LASSERRE_FILE().

808  {
809  VOLUME_LASSERRE_FILE( planes2, volume);
810 }
int volume(const block *b)
Definition: split.cpp:181
void VOLUME_LASSERRE_FILE(double planes2[7][4], rational *volume)
Definition: vinci_lass.c:737

Here is the call graph for this function:

Variable Documentation

int G_d

Definition at line 50 of file vinci_lass.c.

real** G_Hyperplanes = NULL

Definition at line 53 of file vinci_lass.c.

T_VertexSet* G_Incidence = NULL

Definition at line 54 of file vinci_lass.c.

int G_m

Definition at line 51 of file vinci_lass.c.

void* G_MemRes = NULL

Definition at line 62 of file vinci_lass.c.

rational G_Minus1 = -1

Definition at line 63 of file vinci_lass.c.

boolean G_OutOfMem = TRUE

Definition at line 61 of file vinci_lass.c.

int G_Precomp = 0

Definition at line 57 of file vinci_lass.c.

int G_RandomSeed = 4

Definition at line 59 of file vinci_lass.c.

int G_Storage = -1

Definition at line 58 of file vinci_lass.c.

T_VertexSet G_Vertices

Definition at line 55 of file vinci_lass.c.

T_Key * keyfound
static

Definition at line 76 of file vinci_lass.c.

int** p2c

Definition at line 71 of file vinci_lass.c.

Referenced by lass(), and VOLUME_LASSERRE_FILE().

T_LassInt* Pivot

Definition at line 70 of file vinci_lass.c.

Referenced by lass(), and VOLUME_LASSERRE_FILE().

rational* pivotrow

Definition at line 68 of file vinci_lass.c.

Referenced by lass(), and VOLUME_LASSERRE_FILE().

rational* planescopy

Definition at line 75 of file vinci_lass.c.

Referenced by shift_P(), and VOLUME_LASSERRE_FILE().

T_Tree* tree_volumes
static

Definition at line 78 of file vinci_lass.c.