#include "ray_dte.h"#include "sg.h"
Go to the source code of this file.
Functions | |
| Psysteme | sc_enveloppe_chernikova_ofl_ctrl (Psysteme, Psysteme, int) |
| Warning! Do not modify this file that is automatically generated! | |
| Psysteme | sc_enveloppe_chernikova (Psysteme, Psysteme) |
| Psysteme | elementary_convex_union (Psysteme, Psysteme) |
| implements FC basic idea of simple fast cases. | |
| Psysteme | sc_cute_convex_hull (Psysteme, Psysteme) |
| returns s1 v s2. | |
| void | catch_alarm_SC_CONVEX_HULL (int) |
| Ptsg | sc_to_sg_chernikova (Psysteme) |
| Fonction de conversion d'un systeme lineaire a un systeme generateur par chenikova. | |
| Psysteme | sg_to_sc_chernikova (Ptsg) |
| Fonction de conversion d'un systeme generateur a un systeme lineaire. | |
| Psysteme | sc_convex_hull (Psysteme, Psysteme) |
Variables | |
| boolean | SC_CONVEX_HULL_timeout |
| chernikova.c | |
| void catch_alarm_SC_CONVEX_HULL | ( | int | ) |
implements FC basic idea of simple fast cases.
.. returns s1 v s2. s1 and s2 are not touched. The bases should be minimum for best efficiency! otherwise useless columns are allocated and computed. a common base is rebuilt in actual_convex_union. other fast cases may be added?
| s1 | 1 | |
| s2 | 2 |
Definition at line 169 of file sc_enveloppe.c.
References actual_convex_union(), b, b1, b2, base_rm, base_union(), s, sc_base, sc_dup(), sc_empty(), sc_empty_p(), sc_rn(), sc_rn_p(), and vect_common_variables_p().
Referenced by sc_cute_convex_hull().
00170 { 00171 boolean 00172 b1 = sc_empty_p(s1), 00173 b2 = sc_empty_p(s2); 00174 00175 if (b1 && b2) 00176 return sc_empty(base_union(sc_base(s1), sc_base(s2))); 00177 00178 if (b1) { 00179 Psysteme s = sc_dup(s2); 00180 Pbase b = base_union(sc_base(s1), sc_base(s2)); 00181 base_rm(sc_base(s)); 00182 sc_base(s) = b; 00183 return s; 00184 } 00185 00186 if (b2) { 00187 Psysteme s = sc_dup(s1); 00188 Pbase b = base_union(sc_base(s1), sc_base(s2)); 00189 base_rm(sc_base(s)); 00190 sc_base(s) = b; 00191 return s; 00192 } 00193 00194 if (sc_rn_p(s1) || sc_rn_p(s2) || 00195 !vect_common_variables_p(sc_base(s1), sc_base(s2))) 00196 return sc_rn(base_union(sc_base(s1), sc_base(s2))); 00197 00198 /* 00199 if (sc_dimension(s1)==1 && sc_dimension(s2)==1 && 00200 sc_base(s1)->var == sc_base(s2)->var) 00201 { 00202 // fast computation... 00203 } 00204 */ 00205 00206 return actual_convex_union(s1, s2); 00207 }


Automatic variables read in a CATCH block need to be declared volatile as specified by the documentation
need to install sc before to run, because of Production/Include/sc.h ifscprint(4) { char * filename; char * label; if print to stderr fprintf(stderr, "Timeout [sc_convex_hull] considering:\n"); sc_default_dump(sc1) sc_default_dump(sc2) filename = "convex_hull_fail_sc_dump.out"; label = "LABEL - Timeout with sc_convex_hull considering: *** * *** SC "; sc_default_dump_to_file(sc1,label,1,filename); label = " *** * *** SC "; sc_default_dump_to_file(sc2,label,2,filename); }
comme on il ne faut pas que les structures irisa apparaissent dans le fichier polyedre.h, une sous-routine renvoyant un polyhedron n'est pas envisageable. Le code est duplique
Tri des contraintes de A1->Ray et A2->Ray, pour former l'union de ces contraintes dans un meme format Line , Ray , vertex
end TRY
Definition at line 558 of file chernikova.c.
References any_exception_error, assert, base_dup(), CATCH, catch_alarm_SC_CONVEX_HULL(), contrainte_make(), cp, FALSE, fprintf(), ifscdebug, matrix_to_sc(), MAX_NB_RAYS, my_Matrix_Free(), my_Polyhedron_Free(), NULL, RETHROW, SC_CONVEX_HULL_TIMEOUT, SC_CONVEX_HULL_timeout, sc_default_dump(), sc_dimension, sc_make(), sc_new(), sc_normalize(), sc_rm(), sc_to_matrix(), SC_UNDEFINED_P, TCST, TRY, UNCATCH, VALUE_ONE, vect_new(), and vect_size().
Referenced by main(), and sc_enveloppe_chernikova_ofl_ctrl().
00559 { 00560 int nbrows1 = 0; 00561 int nbcolumns1 = 0; 00562 int nbrows2 = 0; 00563 int nbcolumns2 = 0; 00564 00565 /* Automatic variables read in a CATCH block need to be declared volatile as 00566 * specified by the documentation*/ 00567 Matrix * volatile a1 = NULL; 00568 Matrix * volatile a2 = NULL; 00569 Polyhedron * volatile A1 = NULL; 00570 Polyhedron * volatile A2 = NULL; 00571 Matrix * volatile a = NULL; 00572 Psysteme volatile sc = NULL; 00573 Polyhedron * volatile A = NULL; 00574 00575 unsigned int i1, i2; 00576 int j; 00577 int Dimension,cp; 00578 00579 CATCH(any_exception_error) 00580 { 00581 00582 if (a) my_Matrix_Free(&a); 00583 if (a1) my_Matrix_Free(&a1); 00584 if (a2) my_Matrix_Free(&a2); 00585 if (A) my_Polyhedron_Free(&A); 00586 if (A1) my_Polyhedron_Free(&A1); 00587 if (A2) my_Polyhedron_Free(&A2); 00588 if (sc) sc_rm(sc); 00589 00590 alarm(0);//clear the alarm. 00591 //There's maybe exceptions rethrown by polylib. 00592 //So clear alarm in catch_alarm_sc_convex_hull is not enough 00593 00594 if (SC_CONVEX_HULL_timeout) { 00595 00596 SC_CONVEX_HULL_timeout = FALSE; 00597 00598 //fprintf(stderr,"\n *** * *** Timeout from polyedre/chernikova : sc_convex_hull !!! \n"); 00599 00600 //We can change to print to stderr by using sc_default_dump(sc). duong 00601 00602 /* need to install sc before to run, because of Production/Include/sc.h 00603 ifscprint(4) { 00604 char * filename; 00605 char * label; 00606 // if print to stderr 00607 //fprintf(stderr, "Timeout [sc_convex_hull] considering:\n"); 00608 //sc_default_dump(sc1) 00609 //sc_default_dump(sc2) 00610 filename = "convex_hull_fail_sc_dump.out"; 00611 label = "LABEL - Timeout with sc_convex_hull considering: *** * *** SC "; 00612 sc_default_dump_to_file(sc1,label,1,filename); 00613 label = " *** * *** SC "; 00614 sc_default_dump_to_file(sc2,label,2,filename); 00615 } 00616 */ 00617 } 00618 00619 //fprintf(stderr,"\nThis is an exception rethrown from sc_convex_hull(): \n "); 00620 RETHROW(); 00621 } 00622 TRY 00623 { 00624 00625 assert(!SC_UNDEFINED_P(sc1) && (sc_dimension(sc1) != 0)); 00626 assert(!SC_UNDEFINED_P(sc2) && (sc_dimension(sc2) != 0)); 00627 00628 00629 00630 //start the alarm 00631 signal(SIGALRM, catch_alarm_SC_CONVEX_HULL); 00632 alarm(SC_CONVEX_HULL_TIMEOUT); 00633 00634 ifscdebug(7) { 00635 fprintf(stderr, "[sc_convex_hull] considering:\n"); 00636 sc_default_dump(sc1); 00637 sc_default_dump(sc2); 00638 } 00639 00640 /* comme on il ne faut pas que les structures irisa 00641 apparaissent dans le fichier polyedre.h, une sous-routine 00642 renvoyant un polyhedron n'est pas envisageable. 00643 Le code est duplique */ 00644 00645 nbrows1 = sc1->nb_eq + sc1->nb_ineq + 1; 00646 nbcolumns1 = sc1->dimension +2; 00647 a1 = Matrix_Alloc(nbrows1, nbcolumns1); 00648 sc_to_matrix(sc1,a1); 00649 00650 nbrows2 = sc2->nb_eq + sc2->nb_ineq + 1; 00651 nbcolumns2 = sc2->dimension +2; 00652 a2 = Matrix_Alloc(nbrows2, nbcolumns2); 00653 sc_to_matrix(sc2,a2); 00654 00655 ifscdebug(8) { 00656 fprintf(stderr, "[sc_convex_hull]\na1 ="); 00657 Matrix_Print(stderr, "%4d",a1); 00658 fprintf(stderr, "\na2 ="); 00659 Matrix_Print(stderr, "%4d",a2); 00660 } 00661 00662 A1 = Constraints2Polyhedron(a1, MAX_NB_RAYS); 00663 00664 my_Matrix_Free(&a1); 00665 00666 A2 = Constraints2Polyhedron(a2, MAX_NB_RAYS); 00667 00668 my_Matrix_Free(&a2); 00669 00670 ifscdebug(8) { 00671 fprintf(stderr, "[sc_convex_hull]\nA1 (%p %p)=", A1, a1); 00672 Polyhedron_Print(stderr, "%4d",A1); 00673 fprintf(stderr, "\nA2 (%p %p) =", A2, a2); 00674 Polyhedron_Print(stderr, "%4d",A2); 00675 } 00676 00677 sc = sc_new(); 00678 sc->base = base_dup(sc1->base); 00679 //replace base_dup, which changes the pointer given as parameter 00680 sc->dimension = vect_size(sc->base); 00681 00682 if (A1->NbRays == 0) { 00683 a= Polyhedron2Constraints(A2); 00684 } else if (A2->NbRays == 0) { 00685 a= Polyhedron2Constraints(A1); 00686 } else { 00687 int i1p; 00688 int cpp; 00689 00690 Dimension = A1->Dimension+2; 00691 a = Matrix_Alloc(A1->NbRays + A2->NbRays,Dimension); 00692 00693 /* Tri des contraintes de A1->Ray et A2->Ray, pour former 00694 l'union de ces contraintes dans un meme format 00695 Line , Ray , vertex */ 00696 cp = 0; 00697 i1 = 0; 00698 i2 = 0; 00699 while (i1 < A1->NbRays && A1->Ray[i1][0] ==0) { 00700 for (j=0; j < Dimension ; j++) 00701 a->p[cp][j] = A1->Ray[i1][j]; 00702 cp++; i1++; 00703 } 00704 00705 while (i2 < A2->NbRays && A2->Ray[i2][0] ==0) { 00706 for (j=0 ; j < Dimension ; j++) 00707 a->p[cp][j] = A2->Ray[i2][j]; 00708 cp++; i2++; 00709 } 00710 00711 i1p = i1; 00712 cpp = cp; 00713 while (i1 < A1->NbRays && A1->Ray[i1][0] ==1 00714 && A1->Ray[i1][Dimension-1]==0) { 00715 for (j=0; j < Dimension ; j++) 00716 a->p[cp][j] = A1->Ray[i1][j]; 00717 cp++; i1++; 00718 } 00719 00720 while (i2 < A2->NbRays && A2->Ray[i2][0] == 1 00721 && A2->Ray[i2][Dimension-1]==0) { 00722 for (j=0; j < Dimension ; j++) 00723 a->p[cp][j] = A2->Ray[i2][j]; 00724 cp++; i2++; 00725 } 00726 00727 i1p = i1; 00728 cpp = cp; 00729 while (i1 < A1->NbRays && A1->Ray[i1][0] == 1 00730 && A1->Ray[i1][Dimension-1]!= 0) { 00731 for (j=0; j < Dimension ; j++) 00732 a->p[cp][j] = A1->Ray[i1][j]; 00733 cp++; i1++; 00734 } 00735 00736 while (i2 < A2->NbRays && A2->Ray[i2][0] == 1 00737 && A2->Ray[i2][Dimension-1]!=0) { 00738 for (j=0; j < Dimension ; j++) 00739 a->p[cp][j] = A2->Ray[i2][j]; 00740 cp++; i2++; 00741 } 00742 00743 my_Polyhedron_Free(&A1); 00744 my_Polyhedron_Free(&A2); 00745 00746 A = Rays2Polyhedron(a, MAX_NB_RAYS); 00747 my_Matrix_Free(&a); 00748 00749 a = Polyhedron2Constraints(A); 00750 my_Polyhedron_Free(&A); 00751 } 00752 00753 matrix_to_sc(a,sc); 00754 my_Matrix_Free(&a); 00755 00756 sc = sc_normalize(sc); 00757 00758 if (sc == NULL) { 00759 Pcontrainte pc = contrainte_make(vect_new(TCST, VALUE_ONE)); 00760 sc = sc_make(pc, CONTRAINTE_UNDEFINED); 00761 sc->base = base_dup(sc1->base); 00762 //replace base_dup, which changes the pointer given as parameter 00763 sc->dimension = vect_size(sc->base); 00764 } 00765 00766 } /* end TRY */ 00767 00768 alarm(0); //clear the alarm 00769 00770 UNCATCH(any_exception_error); 00771 00772 return sc; 00773 }


returns s1 v s2.
initial systems are not changed.
v convex union u union n intersection T orthogonality
(1) CA:
P1 v P2 = (P n X1) v (P n X2) = let P = P' n P'' so that P' T X1 and P' T X2 and P' T P'' built by transitive closure, then P1 v P2 = (P' n (P'' n X1)) v (P' n (P'' n X2)) = P' n ((P'' n X1) v (P'' n X2))
Proof by considering generating systems: Def: A T B <=> var(A) n var(B) = 0 Prop: A n B if A T B Let A = (x,v,l), B = (y,w,m) A n B = { z | z = (x) + (v) d + (l) e + (0) f (0) + (0) + (0) (I) and z = (0) + (0) g + (0) h + (I) f' (y) + (w) + (m) (0) with >0, >0, =1, =1, d>0, g>0 } we can always find f and f' equals to the other part (by extension) so A n B = { z | z = (x 0) + (v 0) d + (l 0) e (0 y) (0 w) g (0 m) h with d g constraints... } It is a convex : ((xi) , (v 0), (l 0)) (yj)ij, (0 w), (0 m) we just need to prove that Cmn == Cg defined as (x 0) == (xi) with >0 and = 1 (0 y) (yj)ij . Cg in a convex. . Cg Cmn since ((xi)\(yj) ij) in Cmn with = i, = j . Cmn Cg by chosing = , which >0 and = 1 Prop: A T B and A T C => A T (B v C) and A T (B n C) Theo: A T B and A T C => (A n B) v (A n C) = A n (B v C) compute both generating systems with above props. they are equal.
(2) FI:
perform exact projections of common equalities. no proof at the time. It looks ok anyway.
(3) FC:
base(P) n base(Q) = 0 => P u Q = Rn and some other very basic simplifications... which are not really interesting if no decomposition is performed?
on overflows FI suggested.
1/ we want to compute : (A n B1) u (A n B2) 2/ we chose to approximate it as : (A n B1) v (A n B2) 3/ we try Corinne's factorization with transitive closure A' n ((A'' n B1) v (A'' n B2)) 4/ on overflow, we can try A n (B1 v B2) // NOT IMPLEMENTED YET 5/ if we have one more overflow, then A looks good as an approximation.
CA: extract common disjoint part.
FI: in sc_common_projection_convex_hull note that equalities are not that big a burden to chernikova?
fast sc_append
usually we use V (convex hull) as a U (set union) approximation. as we have : (A n B1) U (A n B2) A the common part of both systems is an approximation of the union! sc_rn is returned on overflows (and some other case). I don't think that the result is improved apart when actual overflow occurs. FC/CA.
dead. either rm or moved as sc.
better compatibility with previous version, as the convex union normalizes the system and removes redundancy, what is not done if part of the system is separated. Other calls may be considered here?
ok, it will look better.
misleading... not really projected. { x==y, y==3 } => { x==3, y==3 }
sc, su: fast union of disjoint.
regenerate the expected base.
| is1 | s1 | |
| is2 | s2 |
Definition at line 367 of file sc_enveloppe.c.
References base_rm, base_union(), elementary_convex_union(), extract_common_syst(), linear_number_of_exception_thrown, NULL, s1, sc_base, sc_dimension, sc_dup(), sc_extract_exact_common_equalities(), sc_fix(), sc_fusion(), sc_project_very_simple_equalities(), sc_rm(), sc_rn(), sc_transform_ineg_in_eg(), transitive_closure_from_two_bases(), and vect_size().
Referenced by cute_convex_union().
00368 { 00369 Psysteme s1, s2, sc, stc, su, scsaved; 00370 int current_overflow_count; 00371 00372 s1 = sc_dup(is1); 00373 s2 = sc_dup(is2); 00374 00375 /* CA: extract common disjoint part. 00376 */ 00377 sc = extract_common_syst(s1, s2); 00378 scsaved = sc_dup(sc); 00379 stc = transitive_closure_from_two_bases(sc, s1->base, s2->base); 00380 00381 /* FI: in sc_common_projection_convex_hull 00382 note that equalities are not that big a burden to chernikova? 00383 */ 00384 sc_extract_exact_common_equalities(stc, sc, s1, s2); 00385 00386 /* fast sc_append */ 00387 s1 = sc_fusion(s1, sc_dup(stc)); 00388 sc_fix(s1); 00389 00390 s2 = sc_fusion(s2, stc); 00391 sc_fix(s2); 00392 00393 stc = NULL; 00394 00395 current_overflow_count = linear_number_of_exception_thrown; 00396 00397 su = elementary_convex_union(s1, s2); 00398 00399 /* usually we use V (convex hull) as a U (set union) approximation. 00400 * as we have : (A n B1) U (A n B2) \in A 00401 * the common part of both systems is an approximation of the union! 00402 * sc_rn is returned on overflows (and some other case). 00403 * I don't think that the result is improved apart 00404 * when actual overflow occurs. FC/CA. 00405 */ 00406 if (current_overflow_count!=linear_number_of_exception_thrown) 00407 { 00408 if (su) sc_rm(su), su = NULL; 00409 if (sc) sc_rm(sc), sc = NULL; 00410 sc = scsaved; 00411 } 00412 else 00413 { 00414 sc_rm(scsaved); 00415 } 00416 00417 scsaved = NULL; /* dead. either rm or moved as sc. */ 00418 sc_rm(s1); 00419 sc_rm(s2); 00420 00421 /* better compatibility with previous version, as the convex union 00422 * normalizes the system and removes redundancy, what is not done 00423 * if part of the system is separated. Other calls may be considered here? 00424 */ 00425 sc_transform_ineg_in_eg(sc); /* ok, it will look better. */ 00426 /* misleading... not really projected. { x==y, y==3 } => { x==3, y==3 } */ 00427 sc_project_very_simple_equalities(sc); 00428 00429 /* sc, su: fast union of disjoint. */ 00430 sc = sc_fusion(sc, su); 00431 00432 /* regenerate the expected base. */ 00433 if (sc) 00434 { 00435 sc_fix(sc); 00436 if (sc_base(sc)) base_rm(sc_base(sc)); 00437 } 00438 else 00439 { 00440 sc = sc_rn(NULL); 00441 } 00442 sc_base(sc) = base_union(sc_base(is1), sc_base(is2)); 00443 sc_dimension(sc) = vect_size(sc_base(sc)); 00444 00445 return sc; 00446 }


Definition at line 125 of file sc_enveloppe.c.
References OFL_CTRL, and sc_enveloppe_chernikova_ofl_ctrl().
Referenced by actual_convex_union(), and dependence_cone_positive().
00126 { 00127 return sc_enveloppe_chernikova_ofl_ctrl((s1), (s2), OFL_CTRL); 00128 }


Warning! Do not modify this file that is automatically generated!
Modify src/Libs/polyedre/polyedre-local.h instead, to add your own modifications. header file built by cprotopackage sur les polyedres poly Malik Imadache, Corinne Ancourt, Neil Butler, Francois Irigoin
Modifications:
Warning! Do not modify this file that is automatically generated!
Ce module est range dans le package polyedre bien qu'il soit utilisable en n'utilisant que des systemes lineaires (package sc) parce qu'il utilise lui-meme des routines sur les polyedres.
Francois Irigoin, Janvier 1990 Corinne Ancourt, Fabien Coelho from time to time (1999/2000)Psysteme sc_enveloppe_chernikova_ofl_ctrl(Psysteme s1, s2, int ofl_ctrl) input : output : modifies : s1 and s2 are NOT modified. comment : s1 and s2 must have a basis.
s = enveloppe(s1, s2); return s;
calcul d'une representation par systeme lineaire de l'enveloppe convexe des polyedres definis par les systemes lineaires s1 et s2
PLEASE do not remove this warning.
BC 24/07/95
calcul de l'enveloppe convexe
printf("systeme final \n"); sc_dump(s);
mem_spy_end("sc_enveloppe_chernikova_ofl_ctrl");
| s1 | 1 | |
| s2 | 2 | |
| ofl_ctrl | fl_ctrl |
Definition at line 64 of file sc_enveloppe.c.
References assert, base_dup(), CATCH, FALSE, fprintf(), FWD_OFL_CTRL, OFL_CTRL, overflow_error, s, sc_base, sc_convex_hull(), sc_dimension, sc_dup(), sc_elim_redond, sc_empty(), sc_empty_p(), sc_faisabilite_ofl, sc_rn(), sc_rn_p(), SC_RN_P, SC_UNDEFINED, SC_UNDEFINED_P, timeout_error, TRUE, and UNCATCH.
Referenced by sc_enveloppe_chernikova().
00068 { 00069 Psysteme s = SC_UNDEFINED; 00070 boolean catch_performed = FALSE; 00071 /* mem_spy_begin(); */ 00072 00073 assert(!SC_UNDEFINED_P(s1) && !SC_UNDEFINED_P(s2)); 00074 00075 switch (ofl_ctrl) 00076 { 00077 case OFL_CTRL : 00078 ofl_ctrl = FWD_OFL_CTRL; 00079 catch_performed = TRUE; 00080 CATCH(overflow_error|timeout_error) { 00081 //CATCH(overflow_error) { 00082 /* 00083 * PLEASE do not remove this warning. 00084 * 00085 * BC 24/07/95 00086 */ 00087 fprintf(stderr, "[sc_enveloppe_chernikova_ofl_ctrl] " 00088 "arithmetic error occured\n" ); 00089 s = sc_rn(base_dup(sc_base(s1))); 00090 break; 00091 } 00092 default: { 00093 00094 if (SC_RN_P(s2) || sc_rn_p(s2) || sc_dimension(s2)==0 00095 || sc_empty_p(s1) || !sc_faisabilite_ofl(s1)) 00096 { 00097 Psysteme sc2 = sc_dup(s2); 00098 sc2 = sc_elim_redond(sc2); 00099 s = SC_UNDEFINED_P(sc2)? sc_empty(base_dup(sc_base(s2))): 00100 sc2; 00101 } 00102 else 00103 if (SC_RN_P(s1) ||sc_rn_p(s1) || sc_dimension(s1)==0 00104 || sc_empty_p(s2) || !sc_faisabilite_ofl(s2)) 00105 { 00106 Psysteme sc1 = sc_dup(s1); 00107 sc1 = sc_elim_redond(sc1); 00108 s = SC_UNDEFINED_P(sc1)? 00109 sc_empty(base_dup(sc_base(s1))): sc1; 00110 } 00111 else 00112 { 00113 /* calcul de l'enveloppe convexe */ 00114 s = sc_convex_hull(s1,s2); 00115 /* printf("systeme final \n"); sc_dump(s); */ 00116 } 00117 if (catch_performed) 00118 UNCATCH(overflow_error|timeout_error); 00119 } 00120 } 00121 /* mem_spy_end("sc_enveloppe_chernikova_ofl_ctrl"); */ 00122 return s; 00123 }


Fonction de conversion d'un systeme lineaire a un systeme generateur par chenikova.
Automatic variables read in a CATCH block need to be declared volatile as specified by the documentation
end TRY
Definition at line 450 of file chernikova.c.
References any_exception_error, assert, base_dup(), CATCH, MAX_NB_RAYS, my_Matrix_Free(), my_Polyhedron_Free(), NULL, polyhedron_to_sg(), RETHROW, sc_dimension, sc_to_matrix(), SC_UNDEFINED_P, sg, sg_new(), sg_rm(), TRY, and UNCATCH.
Referenced by dependence_cone_positive(), main(), and unimodular().
00451 { 00452 /* Automatic variables read in a CATCH block need to be declared volatile as 00453 * specified by the documentation*/ 00454 Polyhedron * volatile A = NULL; 00455 Matrix * volatile a = NULL; 00456 Ptsg volatile sg = NULL; 00457 00458 int nbrows = 0; 00459 int nbcolumns = 0; 00460 00461 CATCH(any_exception_error) 00462 { 00463 if (A) my_Polyhedron_Free(&A); 00464 if (a) my_Matrix_Free(&a); 00465 if (sg) sg_rm(sg); 00466 00467 RETHROW(); 00468 } 00469 TRY 00470 { 00471 assert(!SC_UNDEFINED_P(sc) && (sc_dimension(sc) != 0)); 00472 00473 sg = sg_new(); 00474 nbrows = sc->nb_eq + sc->nb_ineq + 1; 00475 nbcolumns = sc->dimension +2; 00476 sg->base = base_dup(sc->base); 00477 //replace base_dup, which changes the pointer given as parameter 00478 a = Matrix_Alloc(nbrows, nbcolumns); 00479 sc_to_matrix(sc,a); 00480 00481 A = Constraints2Polyhedron(a, MAX_NB_RAYS); 00482 my_Matrix_Free(&a); 00483 00484 polyhedron_to_sg(A,sg); 00485 my_Polyhedron_Free(&A); 00486 } /* end TRY */ 00487 00488 UNCATCH(any_exception_error); 00489 00490 return sg; 00491 }


Fonction de conversion d'un systeme generateur a un systeme lineaire.
par chernikova
Automatic variables read in a CATCH block need to be declared volatile as specified by the documentation
end TRY
| sg | g |
Definition at line 496 of file chernikova.c.
References any_exception_error, base_dimension, base_dup(), CATCH, contrainte_make(), matrix_to_sc(), MAX_NB_RAYS, my_Matrix_Free(), my_Polyhedron_Free(), NULL, RETHROW, sc_make(), sc_new(), sc_normalize(), sc_rm(), sg_nbre_droites, sg_nbre_rayons, sg_nbre_sommets, sg_to_polyhedron(), TCST, TRY, UNCATCH, VALUE_ONE, vect_new(), and vect_size().
Referenced by main(), prettyprint_dependence_graph(), prettyprint_dependence_graph_view(), and whole_loop_parallelize().
00497 { 00498 int nbrows = sg_nbre_droites(sg)+ sg_nbre_rayons(sg)+sg_nbre_sommets(sg); 00499 int nbcolumns = base_dimension(sg->base)+2; 00500 /* Automatic variables read in a CATCH block need to be declared volatile as 00501 * specified by the documentation*/ 00502 Matrix * volatile a = NULL; 00503 Psysteme volatile sc = NULL; 00504 Polyhedron * volatile A = NULL; 00505 00506 CATCH(any_exception_error) 00507 { 00508 if (sc) sc_rm(sc); 00509 if (a) my_Matrix_Free(&a); 00510 if (A) my_Polyhedron_Free(&A); 00511 00512 RETHROW(); 00513 } 00514 TRY 00515 { 00516 00517 sc = sc_new(); 00518 sc->base = base_dup(sg->base); 00519 //replace base_dup, which changes the pointer given as parameter 00520 sc->dimension = vect_size(sc->base); 00521 00522 if (sg_nbre_droites(sg)+sg_nbre_rayons(sg)+sg_nbre_sommets(sg)) { 00523 00524 a = Matrix_Alloc(nbrows, nbcolumns); 00525 sg_to_polyhedron(sg,a); 00526 00527 A = Rays2Polyhedron(a, MAX_NB_RAYS); 00528 my_Matrix_Free(&a); 00529 00530 a = Polyhedron2Constraints(A); 00531 my_Polyhedron_Free(&A); 00532 00533 matrix_to_sc(a,sc); 00534 my_Matrix_Free(&a); 00535 00536 sc=sc_normalize(sc); 00537 00538 if (sc == NULL) { 00539 Pcontrainte pc = contrainte_make(vect_new(TCST, VALUE_ONE)); 00540 sc = sc_make(pc, CONTRAINTE_UNDEFINED); 00541 sc->base = base_dup(sg->base); 00542 //replace base_dup, which changes the pointer given as parameter 00543 sc->dimension = vect_size(sc->base); } 00544 00545 } 00546 else { 00547 sc->egalites = contrainte_make(vect_new(TCST,VALUE_ONE)); 00548 sc->nb_eq ++; 00549 } 00550 } /* end TRY */ 00551 00552 UNCATCH(any_exception_error); 00553 00554 return sc; 00555 }


Definition at line 71 of file chernikova.c.
Referenced by catch_alarm_SC_CONVEX_HULL(), and sc_convex_hull().
1.6.2-20100208