25 #define MAXIMUM 1.0e150
26 #define EPSILON_LASS EPSILON
28 #define EPS_NORM EPSILON
29 #define LaShiftLevel 0
34 #define verboseFirstLevel
96 pointer = malloc (size);
101 fprintf (stderr,
"\n***** WARNING: Out of memory; freeing memory reserve\n");
108 fprintf (stderr,
"\n***** ERROR: Out of memory\n");
178 if (hyperplane !=
G_m+1)
180 for (i = 0; (*key).hypervar.hyperplanes [
i] < hyperplane; i++);
181 if ((*key).hypervar.hyperplanes [i] != hyperplane)
183 for (j =
G_d; j >
i; j--)
184 (*key).hypervar.hyperplanes [j] = (*key).hypervar.hyperplanes [j-1];
185 (*key).hypervar.hyperplanes [i] = hyperplane;
189 if (variable !=
G_d+1)
191 for (i = 0; (*key).hypervar.variables [
i] < variable; i++);
192 if ((*key).hypervar.variables [i] != variable)
194 for (j =
G_d; j >
i; j--)
195 (*key).hypervar.variables [j] = (*key).hypervar.variables [j-1];
196 (*key).hypervar.variables [i] = variable;
211 if (hyperplane !=
G_m+1)
213 for (i = 0; i <=
G_d && (*key).hypervar.hyperplanes [
i] != hyperplane; i++);
216 for (j = i; (*key).hypervar.hyperplanes [
j] !=
G_m + 1; j++)
217 (*key).hypervar.hyperplanes [j] = (*key).hypervar.hyperplanes [j+1];
221 if (variable !=
G_d+1)
223 for (i = 0; i <=
G_d && (*key).hypervar.variables [
i] != variable; i++);
226 for (j = i; (*key).hypervar.variables [
j] !=
G_d + 1; j++)
227 (*key).hypervar.variables [j] = (*key).hypervar.variables [j+1];
267 for (i=0; red>=ref_indices[
i]; i++) red++;
269 while (ref_indices[i]<=
G_m) {
276 ref_indices[i+1]=
G_m+2;
277 if (indices==NULL)
return base;
279 for (i=0; base>indices[
i]; i++);
280 while (indices[i]<=
G_m) {
297 {
register int i, cnt;
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];
314 for (i=0; ((base!=indices[
i])&&(indices[i]<=
G_m)); i++);
315 if (base!=indices[i]) {
316 fprintf(stderr,
"ERROR: Deletion index not found!\n");
319 for (;indices[
i]<=
G_m;i++) indices[i]=indices[i+1];
335 p2=A+(rm_index+1)*(d+1);
336 for (i=0; i<(((*LastPlane_)-rm_index)*(d+1)); i++) {
350 fprintf (stderr,
"\n***** ERROR: Out of memory in 'compact.*pc'");
354 for (i=0; i<
G_m; i++) {
369 if (pivot[h]==i)
return FALSE;
378 {
register rational *
p1, *p2, *p3, d1, d2, d3;
379 register int col,
i,
j;
380 static int *pivot = NULL;
390 for (i=0; i<=LastPlane_; i++) {
392 #if PIVOTING_LASS == 0
395 if (d2>d3) { pivot[0]=
i; d1=*
p1; d3=d2; };
399 p1=A+pivot[0]*(d+1)+1;
401 for (i=1,d2=1.0/d1; i<=
d; i++,p1++,p2++) *p2 = (*p1)*d2;
405 for (i=0; i<=LastPlane_; i++, p1++, p2++) {
413 for (j=1; j<=
d; j++, p1++, p2++, p3++) (*p2)=(*p1)-d1*(*p3);
418 for (col=1;col<
d;col++) {
419 for (i=0;i<=LastPlane_;i++)
426 for (; i<=LastPlane_; i++, p1+=(d+1))
429 #if PIVOTING_LASS == 0
445 for (j=col+1; j<=
d; j++, p1++) (*p1) *= d2;
446 if (col==(d-1))
break;
450 for (i=0; i<=LastPlane_; i++, p1+=(col+1)) {
456 for (j=col+1; j<=
d; j++, p1++, p2++) *p1=(*p1)-d1*(*p2);
463 for (i=d-2; 0<=
i; i--){
466 for (j=i+1; j<
d; j++, p2++)
472 for (i=0; i<=LastPlane_; i++) {
476 for (j=0; j<
d; j++,p1++) {
491 {
register int i,
j, row = 0;
497 while (row<=(*LastPlane_)) {
499 for (j=0; j<
d; j++,p1++)
503 if ((*p1)<-100000*
EPS1){
513 for (j=0; j<=
d; j++,p1++)
521 for (row=0; row<(*LastPlane_); row++) {
523 while (i<=*LastPlane_) {
527 for (j=0;j<
d;j++,p1++,p2++)
541 else (*LastPlane_)--;
559 if ((*p2)<(
EPS1-(*p1)))
return 1;
562 if ((*p1)<(
EPS1-(*p2)))
return 1;
580 int i_balance =
FALSE;
588 if ((
G_Storage > (dimdiff-2)) && (dimdiff >= 2)) {
591 printf(
"\nNeed Scale routine!\n");
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; }
612 printf(
"\nVolume is unbounded!\n");
616 if (dimdiff) (*volume)=mi-ma;
627 fprintf (stderr,
"\n***** ERROR/WARNING: Out of memory in 'lass'\n");
643 realp2=realp1+LastPlane_*(d+1);
645 while (realp1<=realp2) {
655 fprintf (stderr,
"\n***** ERROR/WARNING: Out of memory in 'lass.*redA'\n");
662 for (row=LastPlane_; row>=0; row--) {
664 for (row=0; row<=LastPlane_; row++) {
675 for (i=0; i<
d; i++) {
676 #if PIVOTING_LASS == 0
693 for (i=0; i<=LastPlane_; i++) {
698 mi=*(A+(i*(d+1))+col);
699 for (j=0; j<=
d; j++) {
709 ma+= *(A+row*(d+1)+d)/(d*fabs(*(A+row*(d+1)+col)))
710 *
lass(redA, LastPlane_-1, d-1);
730 if (dimdiff)(*volume)=ma;
750 for (i = 0; i <
G_m; i++)
756 for( i = 0; i <=
G_d; i++)
757 for( j= 0; j <
G_m; j++){
780 for (i=0; i<
G_d; i++){
794 *volume =
lass (A, G_m-1, G_d);
861 if ((*p1) < (*p2))
return -1;
862 else if ((*p1) > (*p2))
return 1;
863 else if ((*p1) >
G_m)
return 0;
871 T_Key **keyfound,
int key_choice)
904 (
G_d + 1) * sizeof (
int));
918 *volume = &((*ppr) ->
vol);
924 cmp =
compare_key ((*ppr) -> key, key, key_choice);
929 tree_out (&((*ppr) ->
tree_l), pi_balance, key, volume, keyfound, key_choice);
961 else (*ppr) ->
tree_b = 0;
976 tree_out (&((*ppr) ->
tree_r), pi_balance, key, volume, keyfound, key_choice);
1006 else (*ppr) ->
tree_b = 0;
1013 *pi_balance =
FALSE;
1021 *pi_balance =
FALSE;
1022 *volume = &((*ppr) ->
vol);
1023 *keyfound = &((*ppr) ->
key);
void my_free(void *pointer, long int size)
void delete_hypervar(T_LassInt hyperplane, T_LassInt variable, T_Key *key)
int * create_int_vector(int n)
struct T_Key::@39 vertices
static int norm_and_clean_constraints(rational *A, int *LastPlane_, int d, T_LassInt *Del_index, int Index_needed)
void * my_malloc(long int size)
static T_Tree * tree_volumes
static void del_original_indices(T_LassInt *indices, T_LassInt *org_indices)
void free_key(T_Key key, int key_choice)
T_VertexSet * G_Incidence
static void rm_constraint(rational *A, int *LastPlane_, int d, int rm_index)
void tree_out(T_Tree **ppr, int *pi_balance, T_Key key, rational **volume, T_Key **keyfound, int key_choice)
void free_int_vector(int *v, int n)
*********************************************************************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
static void del_original(T_LassInt base, T_LassInt *indices)
T_VertexSet duplicate_set(T_VertexSet s)
static void rm_original_inElAll_index(T_LassInt baserow)
int volume(const block *b)
static rational lass(rational *A, int LastPlane_, int d)
void VOLUME_LASSERRE_FILE_(double planes2[7][4], rational *volume)
struct T_Key::@40 hypervar
static T_LassInt add_reduced_index(T_LassInt red, T_LassInt *indices, T_LassInt *ref_indices)
void create_key(T_Key *key, int key_choice)
static void shift_P(rational *A, int LastPlane_, int d)
static T_VertexSet * face
static rational * compact()
void volume_lasserre_file_(double planes2[7][4], rational *volume)
void VOLUME_LASSERRE_FILE(double planes2[7][4], rational *volume)
void add_hypervar(T_LassInt hyperplane, T_LassInt variable, T_Key *key)
static int compare_key(T_Key key1, T_Key key2, int key_choice)
static int notInPivot(int *pivot, int col, int i)
void volume_lasserre_file(double planes2[7][4], rational *volume)