1258945Sroberto/* 2258945Sroberto * Copyright 2012 Ecole Normale Superieure 3258945Sroberto * 4258945Sroberto * Use of this software is governed by the MIT license 5258945Sroberto * 6258945Sroberto * Written by Sven Verdoolaege, 7258945Sroberto * Ecole Normale Superieure, 45 rue d'Ulm, 75230 Paris, France 8258945Sroberto */ 9258945Sroberto 10258945Sroberto#include <isl/space.h> 11258945Sroberto#include <isl/local_space.h> 12258945Sroberto 13258945Sroberto#include <isl_multi_macro.h> 14258945Sroberto 15258945Sroberto/* Construct a multi expression in the given space with value zero in 16258945Sroberto * each of the output dimensions. 17258945Sroberto */ 18258945Sroberto__isl_give MULTI(BASE) *FN(MULTI(BASE),zero)(__isl_take isl_space *space) 19258945Sroberto{ 20258945Sroberto isl_size n; 21258945Sroberto MULTI(BASE) *multi; 22258945Sroberto 23258945Sroberto n = isl_space_dim(space , isl_dim_out); 24258945Sroberto if (n < 0) 25258945Sroberto goto error; 26258945Sroberto 27258945Sroberto multi = FN(MULTI(BASE),alloc)(isl_space_copy(space)); 28258945Sroberto 29258945Sroberto if (!n) 30258945Sroberto isl_space_free(space); 31258945Sroberto else { 32258945Sroberto int i; 33258945Sroberto isl_local_space *ls; 34258945Sroberto EL *el; 35280849Scy 36280849Scy space = isl_space_domain(space); 37280849Scy ls = isl_local_space_from_space(space); 38280849Scy el = FN(EL,zero_on_domain)(ls); 39280849Scy 40280849Scy for (i = 0; i < n; ++i) 41280849Scy multi = FN(FN(MULTI(BASE),set),BASE)(multi, i, 42280849Scy FN(EL,copy)(el)); 43258945Sroberto 44258945Sroberto FN(EL,free)(el); 45258945Sroberto } 46258945Sroberto 47258945Sroberto return multi; 48258945Srobertoerror: 49258945Sroberto isl_space_free(space); 50258945Sroberto return NULL; 51258945Sroberto} 52258945Sroberto 53258945Sroberto#include "isl_multi_zero_space_templ.c" 54258945Sroberto