[PPL-devel] integer versus rational solutions (fwd)

P M Hill hill at comp.leeds.ac.uk
Thu Jul 9 10:31:16 CEST 2009



---------- Forwarded message ----------
Date: Thu, 9 Jul 2009 09:17:25 +0100
From: Michael Classen <michael.classen at uni-passau.de>
To: P M Hill <hill at comp.leeds.ac.uk>
Subject: Re: [PPL-devel] integer versus rational solutions (fwd)

Hello Patricia,

thanks for the effort! I just have a simple technical question: I just
tried to check out the latest snapshot of the "products" branch from
the GIT web access:
http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=shortlog;h=refs/heads/products

But it seems that the resulting .tar.gz file is somehow not in any
format that gzip can handle:

2677> tar xvzf ppl-a648638a1c5f2b288e03625b5dc07a2bc69d9bd8.tar.gz
gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error exit delayed from previous errors

Is there anything obvious wrong with what I'm doing here? I also tried
a few other snapshots and also some graphical archive program, but to
the same result...

greetings,
Michael

On Thu, Jul 9, 2009 at 10:09 AM, P M Hill<hill at comp.leeds.ac.uk> wrote:
> Resending to ppl-devel.
>
> ---------- Forwarded message ----------
> Date: Wed, 8 Jul 2009 14:24:15 +0100 (BST)
> From: P M Hill <hill at comp.leeds.ac.uk>
> To: Tobias Grosser <grosser at fim.uni-passau.de>
> Cc: "gcc-graphite at googlegroups.com" <gcc-graphite at googlegroups.com>,
>    ppl-devel <ppl-devel at cs.unipr.it>
> Subject: Re: [PPL-devel] integer versus rational solutions
>
> On Wed, 8 Jul 2009, Tobias Grosser wrote:
>
>> Hi,
>>
>> I just tried to use the ppl to work with integer polyhedron, however I
>> am stuck with the examples in the documentation for the
>> Partial_Reduced_Product:
>>
>>
>> http://www.cs.unipr.it/ppl/Documentation/user/ppl-user-0.10.2-html/classParma__Polyhedra__Library_1_1Partially__Reduced__Product.html#_details
>>
>> ---------------------------------------------------------------------
>> In all the examples it is assumed that the template R is the
>> No_Reduction<D1, D2> class and that variables x and y are defined (where
>> they are used) as follows:
>>         Variable x(0);
>>         Variable y(1);
>>
>> Example 1
>>       The following code builds a direct product of a Grid and NNC
>>       Polyhedron, corresponding to the positive even integer pairs in
>>       R^2, given as a system of congruences:
>>
>>         Congruence_System cgs;
>>         cgs.insert((x %= 0) / 2);
>>         cgs.insert((y %= 0) / 2);
>>         Partially_Reduced_Product<Grid, NNC_Polyhedron, No_Reduction<D1,
>> D2> >
>>           dp(cgs);
>>         dp.add_constraint(x >= 0);
>>         dp.add_constraint(y >= 0);
>>
>> Example 2
>>       The following code builds the same product in R^2:
>>       Partially_Reduced_Product<Grid, NNC_Polyhedron, No_Reduction<D1, D2>
>>> dp(2);
>>         dp.add_constraint(x >= 0);
>>         dp.add_constraint(y >= 0);
>>         dp.add_congruence((x %= 0) / 2);
>>         dp.add_congruence((y %= 0) / 2);
>> ---------------------------------------------------------------------
>
> Hi Tobias,
>
>>
>> I would like to create the set of even positive integer pairs, so I
>> tried Example 1 and 2. With both I have the same problems.
>>
>> 1. D1 and D2 are not defined:
>>
>> test.cpp:9: error: 'D1' was not declared in this scope
>> test.cpp:9: error: 'D2' was not declared in this scope
>>
>> So I replace D1 with "Grid" and D2 with "NNC_Polyhedron"
>
> That is correct. They have to be specified.
>
>>
>> 2. An exception when adding constrains:
>
> Only equalities can be added to a product of a grid and polyhedron,
> best to use refine_with-...() methods here.
>
>>
>> terminate called after throwing an instance of 'std::invalid_argument'
>>  what():  PPL::Grid::add_constraint(c):
>> c is not an equality constraint.
>>
>> So I removed the positive constraints.
>>
>> 3. An exception when adding congruences:
>>
>> terminate called after throwing an instance of 'std::invalid_argument'
>>  what():  PPL::NNC_Polyhedron::add_congruence(cg):
>> cg is a non-trivial, proper congruence.
>>
>> Do you have any idea what I did wrong?
>
> Yes, you have to use refiine_with_constraint()
> and refine_with_congruence();
>
> The add methods cannot be used here unless the constraint/congruence is an
> equality.
>
> There is also another problem in your code in that you cannot build the
> product directly from the congruences as they cannot be add'ed to the
> NNC_Polyhedron component. Instead, first build a grid from the congruences
> and then build the product using the grid.
>
> Here is my code, based on your examples, that works here:
>
> -------------------------------------------------
>
>  /*
>   Example 1
>  */
>
>          Congruence_System cgs;
>          cgs.insert((x %= 0) / 2);
>          cgs.insert((y %= 0) / 2);
>          Grid gr(cgs);
>          Partially_Reduced_Product<Grid, NNC_Polyhedron,
>                                    No_Reduction<Grid, NNC_Polyhedron> >
>            dp(gr);
>          dp.refine_with_constraint(x >= 0);
>          dp.refine_with_constraint(y >= 0);
>
> --------------------------------------------------
>
>  /*
> Example 2
>  */
>
>       Partially_Reduced_Product<Grid, NNC_Polyhedron,
>                                 No_Reduction<Grid, NNC_Polyhedron> >
>         dp(2);
>
>       dp.refine_with_constraint(x >= 0);
>       dp.refine_with_constraint(y >= 0);
>       dp.refine_with_congruence((x %= 0) / 2);
>       dp.refine_with_congruence((y %= 0) / 2);
>
> --------------------------------------------------
>
> I used here the master branch of the git repository head version. The latest
> developments for the PPL domain for partially reduced products are in the
> products branch.
>
> HTH. Let me know if you have further queries wrt this domain, we will glad
> to help.
>
> Pat
> _______________________________________________
> PPL-devel mailing list
> PPL-devel at cs.unipr.it
> http://www.cs.unipr.it/mailman/listinfo/ppl-devel
>


More information about the PPL-devel mailing list