From 33ea0b0fbb195936b79f146ddb060af4f47884d5 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Tue, 3 Dec 2013 14:51:35 +0100 Subject: [PATCH] add isl_union_pw_multi_aff_pullback_union_pw_multi_aff Signed-off-by: Sven Verdoolaege --- doc/user.pod | 4 ++++ include/isl/aff.h | 5 +++++ isl_aff.c | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+) diff --git a/doc/user.pod b/doc/user.pod index 21aeabab..bf7eeb2c 100644 --- a/doc/user.pod +++ b/doc/user.pod @@ -5439,6 +5439,10 @@ into the set description or into the domain/range of the map. isl_multi_pw_aff_pullback_multi_pw_aff( __isl_take isl_multi_pw_aff *mpa1, __isl_take isl_multi_pw_aff *mpa2); + __isl_give isl_union_pw_multi_aff * + isl_union_pw_multi_aff_pullback_union_pw_multi_aff( + __isl_take isl_union_pw_multi_aff *upma1, + __isl_take isl_union_pw_multi_aff *upma2); These functions precompose the first expression by the second function. In other words, the second function is plugged diff --git a/include/isl/aff.h b/include/isl/aff.h index e8728f25..d4a7b601 100644 --- a/include/isl/aff.h +++ b/include/isl/aff.h @@ -575,6 +575,11 @@ __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_gist( __isl_take isl_union_pw_multi_aff *upma, __isl_take isl_union_set *context); +__isl_give isl_union_pw_multi_aff * +isl_union_pw_multi_aff_pullback_union_pw_multi_aff( + __isl_take isl_union_pw_multi_aff *upma1, + __isl_take isl_union_pw_multi_aff *upma2); + __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_align_params( __isl_take isl_union_pw_multi_aff *upma, __isl_take isl_space *model); diff --git a/isl_aff.c b/isl_aff.c index 55e48b1d..7ad04657 100644 --- a/isl_aff.c +++ b/isl_aff.c @@ -6839,3 +6839,36 @@ __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_multi_val_on_domain( isl_multi_val_free(mv); return data.res; } + +/* Compute the pullback of data->pma by the function represented by "pma2", + * provided the spaces match, and add the results to data->res. + */ +static int pullback_entry(void **entry, void *user) +{ + struct isl_union_pw_multi_aff_bin_data *data = user; + isl_pw_multi_aff *pma2 = *entry; + + if (!isl_space_tuple_is_equal(data->pma->dim, isl_dim_in, + pma2->dim, isl_dim_out)) + return 0; + + pma2 = isl_pw_multi_aff_pullback_pw_multi_aff( + isl_pw_multi_aff_copy(data->pma), + isl_pw_multi_aff_copy(pma2)); + + data->res = isl_union_pw_multi_aff_add_pw_multi_aff(data->res, pma2); + if (!data->res) + return -1; + + return 0; +} + +/* Compute the pullback of "upma1" by the function represented by "upma2". + */ +__isl_give isl_union_pw_multi_aff * +isl_union_pw_multi_aff_pullback_union_pw_multi_aff( + __isl_take isl_union_pw_multi_aff *upma1, + __isl_take isl_union_pw_multi_aff *upma2) +{ + return bin_op(upma1, upma2, &pullback_entry); +} -- 2.11.4.GIT