• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2012      Ecole Normale Superieure
3  *
4  * Use of this software is governed by the MIT license
5  *
6  * Written by Sven Verdoolaege,
7  * Ecole Normale Superieure, 45 rue d'Ulm, 75230 Paris, France
8  */
9 
10 #include <isl/space.h>
11 #include <isl/local_space.h>
12 
13 #include <isl_multi_macro.h>
14 
15 /* Construct a multi expression in the given space with value zero in
16  * each of the output dimensions.
17  */
MULTI(BASE)18 __isl_give MULTI(BASE) *FN(MULTI(BASE),zero)(__isl_take isl_space *space)
19 {
20 	isl_size n;
21 	MULTI(BASE) *multi;
22 
23 	n = isl_space_dim(space , isl_dim_out);
24 	if (n < 0)
25 		goto error;
26 
27 	multi = FN(MULTI(BASE),alloc)(isl_space_copy(space));
28 
29 	if (!n)
30 		isl_space_free(space);
31 	else {
32 		int i;
33 		isl_local_space *ls;
34 		EL *el;
35 
36 		space = isl_space_domain(space);
37 		ls = isl_local_space_from_space(space);
38 		el = FN(EL,zero_on_domain)(ls);
39 
40 		for (i = 0; i < n; ++i)
41 			multi = FN(FN(MULTI(BASE),set),BASE)(multi, i,
42 							    FN(EL,copy)(el));
43 
44 		FN(EL,free)(el);
45 	}
46 
47 	return multi;
48 error:
49 	isl_space_free(space);
50 	return NULL;
51 }
52