CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
108 lines
2.4 KiB
C
108 lines
2.4 KiB
C
/*
|
|
* Copyright 2008-2009 Katholieke Universiteit Leuven
|
|
*
|
|
* Use of this software is governed by the MIT license
|
|
*
|
|
* Written by Sven Verdoolaege, K.U.Leuven, Departement
|
|
* Computerwetenschappen, Celestijnenlaan 200A, B-3001 Leuven, Belgium
|
|
*/
|
|
|
|
#include <assert.h>
|
|
#include <isl_map_private.h>
|
|
#include "isl_equalities.h"
|
|
#include <isl_seq.h>
|
|
#include "isl_scan.h"
|
|
#include <isl_mat_private.h>
|
|
#include <isl_vec_private.h>
|
|
|
|
/* The input of this program is the same as that of the "polytope_scan"
|
|
* program from the barvinok distribution.
|
|
*
|
|
* Constraints of set is PolyLib format.
|
|
*
|
|
* The input set is assumed to be bounded.
|
|
*/
|
|
|
|
struct scan_samples {
|
|
struct isl_scan_callback callback;
|
|
struct isl_mat *samples;
|
|
};
|
|
|
|
static isl_stat scan_samples_add_sample(struct isl_scan_callback *cb,
|
|
__isl_take isl_vec *sample)
|
|
{
|
|
struct scan_samples *ss = (struct scan_samples *)cb;
|
|
|
|
ss->samples = isl_mat_extend(ss->samples, ss->samples->n_row + 1,
|
|
ss->samples->n_col);
|
|
if (!ss->samples)
|
|
goto error;
|
|
|
|
isl_seq_cpy(ss->samples->row[ss->samples->n_row - 1],
|
|
sample->el, sample->size);
|
|
|
|
isl_vec_free(sample);
|
|
return isl_stat_ok;
|
|
error:
|
|
isl_vec_free(sample);
|
|
return isl_stat_error;
|
|
}
|
|
|
|
static __isl_give isl_mat *isl_basic_set_scan_samples(
|
|
__isl_take isl_basic_set *bset)
|
|
{
|
|
isl_ctx *ctx;
|
|
isl_size dim;
|
|
struct scan_samples ss;
|
|
|
|
ctx = isl_basic_set_get_ctx(bset);
|
|
dim = isl_basic_set_dim(bset, isl_dim_all);
|
|
if (dim < 0)
|
|
goto error;
|
|
ss.callback.add = scan_samples_add_sample;
|
|
ss.samples = isl_mat_alloc(ctx, 0, 1 + dim);
|
|
if (!ss.samples)
|
|
goto error;
|
|
|
|
if (isl_basic_set_scan(bset, &ss.callback) < 0) {
|
|
isl_mat_free(ss.samples);
|
|
return NULL;
|
|
}
|
|
|
|
return ss.samples;
|
|
error:
|
|
isl_basic_set_free(bset);
|
|
return NULL;
|
|
}
|
|
|
|
static __isl_give isl_mat *isl_basic_set_samples(__isl_take isl_basic_set *bset)
|
|
{
|
|
struct isl_mat *T;
|
|
struct isl_mat *samples;
|
|
|
|
if (!bset)
|
|
return NULL;
|
|
|
|
if (bset->n_eq == 0)
|
|
return isl_basic_set_scan_samples(bset);
|
|
|
|
bset = isl_basic_set_remove_equalities(bset, &T, NULL);
|
|
samples = isl_basic_set_scan_samples(bset);
|
|
return isl_mat_product(samples, isl_mat_transpose(T));
|
|
}
|
|
|
|
int main(int argc, char **argv)
|
|
{
|
|
struct isl_ctx *ctx = isl_ctx_alloc();
|
|
struct isl_basic_set *bset;
|
|
struct isl_mat *samples;
|
|
|
|
bset = isl_basic_set_read_from_file(ctx, stdin);
|
|
samples = isl_basic_set_samples(bset);
|
|
isl_mat_print_internal(samples, stdout, 0);
|
|
isl_mat_free(samples);
|
|
isl_ctx_free(ctx);
|
|
|
|
return 0;
|
|
}
|