[PPL-devel] PPL Query

Roberto Bagnara bagnara at cs.unipr.it
Mon Jun 12 16:34:35 CEST 2006


Vishal Lahoti wrote:
> I did send the attatchment. It is a tar ball of files. Perhaps the 
> mailing list did not accept the attatchment I suppose. So I am resending 
> the mail to your account. The changes were made in PPL 0.9. Other 
> information
> 
> Archietecture iX86
> OS Fedora Core 4
> GCC version 4.0.2
> GMP version 4.1.4
> 
> Please find the file attatched. Once again, Thanks for your response.

Dear Vishal,

the files you sent look strange:

1) new2.cc uses the same macros used by the PPL tests and is based
    on exactly the same assumptions.  So it should be added to
    tests/Makefile.am to be compiled and linked properly.

2) makefile suggests that the intention is to use it as a stand-alone
    program.

Assuming that 2) is what you want, I have edited new2.cc so as to
obtain new3.cc (below the signature).  It can be compiled and executed
as follows:

$ g++ -W -Wall new3.cc -lppl -lgmpxx -lgmp
$ a.out
*** ph1 ***
A - B + C + E >= 0, A - B + D >= 0, C - D >= 0, -D + E >= 0, D >= 0
*** ph1 after one affine image ***
A - B + 2*C + E >= 2, A - B + C + D >= 2, C - D >= 0, -D + E >= 0, D >= 0
*** ph1 after two affine image ***
A - B + 3*C + E >= 4, A - B + 2*C + D >= 4, C - D >= 0, -D + E >= 0, D >= 0

extrapolation failed

You will have to add the needed -L and -I options to the compilation command,
if you install GMP and/or the PPL into a non standard place.
All the best,

     Roberto

-- 
Prof. Roberto Bagnara
Computer Science Group
Department of Mathematics, University of Parma, Italy
http://www.cs.unipr.it/~bagnara/
mailto:bagnara at cs.unipr.it

#include <ppl.hh>
#include <iostream>

using namespace Parma_Polyhedra_Library;
using namespace Parma_Polyhedra_Library::IO_Operators;
using namespace std;

int main() {
  Variable A(0);
  Variable B(1);
  Variable C(2);
  Variable M(3);
  Variable N(4);

  C_Polyhedron ph1(5);
   ph1.add_constraint(A-B+C+N >= 0);
   ph1.add_constraint(A-B+M >= 0);
   ph1.add_constraint(C >= M);
   ph1.add_constraint(N >= M);
   ph1.add_constraint(M >= 0);

   C_Polyhedron ph2(ph1);

   cout << "*** ph1 ***\n" << ph1.constraints() << endl;

   ph2.affine_image(A,A+2,1);
   ph2.affine_image(B,B+C,1);


   cout << "*** ph1 after one affine image ***\n" << ph2.constraints() << endl;

   C_Polyhedron ph3(ph2);
   ph3.affine_image(A,A+2,1);
   ph3.affine_image(B,B+C,1);
   cout << "*** ph1 after two affine image ***\n" << ph3.constraints() << endl;

   if(ph1.translation_extrapolation(3,ph2,ph3))
     cout<<endl<<"hoooray";
   else
     cout<<endl<<"extrapolation failed";

  return 0;
}



More information about the PPL-devel mailing list