Home My Page Projects Code Snippets Project Openings diderot

# SCM Repository

[diderot] Diff of /branches/ein16/synth/d2/obj_ty.py
 [diderot] / branches / ein16 / synth / d2 / obj_ty.py

# Diff of /branches/ein16/synth/d2/obj_ty.py

revision 4458, Sat Aug 27 19:52:38 2016 UTC revision 4459, Mon Aug 29 15:57:31 2016 UTC
# Line 141  Line 141
141  ty_noneT = mkTensor(id,[])  ty_noneT = mkTensor(id,[])
142  # distinctive features of lifted tensors or NoneFields  # distinctive features of lifted tensors or NoneFields
143  # are dim=0 and k=-1  # are dim=0 and k=-1
144  def mkNoneField(id, outputtensor):  def mkNoneField(id, _, outputtensor):
145      #print "id",str(id)      #print "id",str(id)
146      shape = outputtensor.shape      shape = outputtensor.shape
147      name = "T_"+shapeToStr(shape)      name = "T_"+shapeToStr(shape)
# Line 158  Line 158
158  def get_Tshape(ty):  def get_Tshape(ty):
159      return ty.shape      return ty.shape
160
161  #tensors  # define possible tensor types
162  id=0  # vector types
163    def mkVecT(id):
164  ty_scalarT = mkTensor(id,[])  ty_scalarT = mkTensor(id,[])
165  ty_vec1T = mkTensor(id+1,[1])      ty_vec2T = mkTensor(id+1, [2])
166  ty_vec2T = mkTensor(id+2,[2])      ty_vec3T = mkTensor(id+2, [3])
167  ty_vec3T = mkTensor(id+3,[3])      ty_vec4T = mkTensor(id+3,[4])
168  ty_vec4T = mkTensor(id+4,[4])      return [ty_scalarT, ty_vec2T, ty_vec3T, ty_vec4T]
169  ty_mat1x1T = mkTensor(id+5,[1,1])  def mkMatT(id):
170  ty_mat2x2T = mkTensor(id+6,[2,2])      id += 10
171  ty_mat3x3T = mkTensor(id+7,[3,3])      ty_mat2x2T = mkTensor(id, [2,2])
172        ty_mat2x3T = mkTensor(id+1, [2,3])
173        ty_mat2x4T = mkTensor(id+2, [2,4])
174        ty_mat3x2T = mkTensor(id+3, [3,2])
175        ty_mat3x3T = mkTensor(id+4, [3,3])
176        ty_mat3x4T = mkTensor(id+5, [3,4])
177        ty_mat4x2T = mkTensor(id+6, [4,2])
178        ty_mat4x3T = mkTensor(id+7, [4,3])
179  ty_mat4x4T = mkTensor(id+8,[4,4])  ty_mat4x4T = mkTensor(id+8,[4,4])
180  ty_mat2x3T = mkTensor(id+9,[2,3])      return [ty_mat2x2T,ty_mat2x3T,ty_mat2x4T,ty_mat3x2T,ty_mat3x3T,ty_mat3x4T,ty_mat4x2T,ty_mat4x3T,ty_mat4x4T]
181  ty_mat3x2T = mkTensor(id+10,[3,2])  # second-order tensor types leading 2
182  ty_ten2x2x2T = mkTensor(id+11,[2,2,2])  def mkTen2T(id):
183  ty_ten3x3x3T = mkTensor(id+12,[3,3,3])      id += 25
184        ty_ten2x2x2T = mkTensor(id, [2,2,2])
185  ty_ten2x3x2T = mkTensor(id+13,[2,3,2])      ty_ten2x2x3T = mkTensor(id+1, [2,2,3])
186  ty_ten3x2x2T = mkTensor(id+14,[3,2,2])      ty_ten2x2x4T = mkTensor(id+2, [2,2,4])
187  ty_ten3x3x2T = mkTensor(id+15,[3,3,2])      ty_ten2x3x2T = mkTensor(id+3, [2,3,2])
188        ty_ten2x3x3T = mkTensor(id+4, [2,3,3])
189  ty_ten2x3x3T = mkTensor(id+16,[2,3,3])      ty_ten2x3x4T = mkTensor(id+5, [2,3,4])
190  ty_ten3x2x3T = mkTensor(id+17,[3,2,3])      ty_ten2x4x2T = mkTensor(id+6, [2,4,2])
191  ty_ten2x2x3T = mkTensor(id+18,[2,2,3])      ty_ten2x4x3T = mkTensor(id+7, [2,4,3])
192        ty_ten2x4x4T = mkTensor(id+8, [2,4,4])
193        return [ty_ten2x2x2T, ty_ten2x2x3T,ty_ten2x2x4T, ty_ten2x3x2T,ty_ten2x3x3T, ty_ten2x3x4T,ty_ten2x4x2T,ty_ten2x4x3T,ty_ten2x4x4T]
194    # second-order tensor types leading 3
195    def mkTen3T(id):
196        id += 50
197        ty_ten3x2x2T = mkTensor(id, [3,2,2])
198        ty_ten3x2x3T = mkTensor(id+1, [3,2,3])
199        ty_ten3x2x4T = mkTensor(id+2, [3,2,4])
200        ty_ten3x3x2T = mkTensor(id+3, [3,3,2])
201        ty_ten3x3x3T = mkTensor(id+4, [3,3,3])
202        ty_ten3x3x4T = mkTensor(id+5, [3,3,4])
203        ty_ten3x4x2T = mkTensor(id+6, [3,4,2])
204        ty_ten3x4x3T = mkTensor(id+7, [3,4,3])
205        ty_ten3x4x4T = mkTensor(id+8, [3,4,4])
206        return [ty_ten3x2x2T, ty_ten3x2x3T,ty_ten3x2x4T, ty_ten3x3x2T,ty_ten3x3x3T, ty_ten3x3x4T,ty_ten3x4x2T,ty_ten3x4x3T,ty_ten3x4x4T]
207    # second-order tensor types leading 4
208    def mkTen4T(id):
209        id += 75
210        ty_ten4x2x2T = mkTensor(id, [4,2,2])
211        ty_ten4x2x3T = mkTensor(id+1, [4,2,3])
212        ty_ten4x2x4T = mkTensor(id+2, [4,2,4])
213        ty_ten4x3x2T = mkTensor(id+3, [4,3,2])
214        ty_ten4x3x3T = mkTensor(id+4, [4,3,3])
215        ty_ten4x3x4T = mkTensor(id+5, [4,3,4])
216        ty_ten4x4x2T = mkTensor(id+6, [4,4,2])
217        ty_ten4x4x3T = mkTensor(id+7, [4,4,3])
218        ty_ten4x4x4T = mkTensor(id+8, [4,4,4])
219        return [ty_ten4x2x2T, ty_ten4x2x3T,ty_ten4x2x4T, ty_ten4x3x2T,ty_ten4x3x3T, ty_ten4x3x4T,ty_ten4x4x2T,ty_ten4x4x3T,ty_ten4x4x4T]
220
221    #tensors
222  id=0  id=0
223  #lift tensor to field level  [ty_scalarT, ty_vec2T, ty_vec3T, ty_vec4T] =  mkVecT(id)
224  ty_scalarFT = mkNoneField(id, ty_scalarT)  [ty_mat2x2T, ty_mat2x3T,ty_mat2x4T,ty_mat3x2T,ty_mat3x3T,ty_mat3x4T,ty_mat4x2T,ty_mat4x3T,ty_mat4x4T] = mkMatT(id)
225  ty_vec1FT = mkNoneField(id+1, ty_vec1T)  [ty_ten2x2x2T, ty_ten2x2x3T,ty_ten2x2x4T, ty_ten2x3x2T,ty_ten2x3x3T, ty_ten2x3x4T,ty_ten2x4x2T,ty_ten2x4x3T,ty_ten2x4x4T] = mkTen2T(id)
226  ty_vec2FT = mkNoneField(id+2, ty_vec2T)  [ty_ten3x2x2T, ty_ten3x2x3T,ty_ten3x2x4T, ty_ten3x3x2T,ty_ten3x3x3T, ty_ten3x3x4T,ty_ten3x4x2T,ty_ten3x4x3T,ty_ten3x4x4T] = mkTen3T(id)
227  ty_vec3FT = mkNoneField(id+3, ty_vec3T)  [ty_ten4x2x2T, ty_ten4x2x3T,ty_ten4x2x4T, ty_ten4x3x2T,ty_ten4x3x3T, ty_ten4x3x4T,ty_ten4x4x2T,ty_ten4x4x3T,ty_ten4x4x4T] = mkTen4T(id)
228  ty_mat2x2FT = mkNoneField(id+4, ty_mat2x2T)
229  ty_mat3x3FT =mkNoneField(id+5, ty_mat3x3T)
230  ty_mat2x3FT = mkNoneField(id+6, ty_mat2x3T)  # define possible tensor types
231  ty_mat3x2FT = mkNoneField(id+7, ty_mat3x2T)  # vector types
232  ty_ten2x2x2FT = mkNoneField(id+8, ty_ten2x2x2T)  def mkVecF(f, id, dim):
233  ty_ten3x3x3FT = mkNoneField(id+9, ty_ten3x3x3T)      ty_scalarF = f(id, dim, ty_scalarT)
234        ty_vec2F = f(id+1, dim, ty_vec2T)
235        ty_vec3F = f(id+2, dim, ty_vec3T)
236        ty_vec4F = f(id+3, dim, ty_vec4T)
237        return [ty_scalarF, ty_vec2F, ty_vec3F, ty_vec4F]
238    # matrix types
239    def mkMatF(f, id, dim):
240        id += 10
241        ty_mat2x2F = f(id, dim, ty_mat2x2T)
242        ty_mat2x3F = f(id+1, dim, ty_mat2x3T)
243        ty_mat2x4F = f(id+2, dim, ty_mat2x4T)
244        ty_mat3x2F = f(id+3, dim, ty_mat3x2T)
245        ty_mat3x3F = f(id+4, dim, ty_mat3x3T)
246        ty_mat3x4F = f(id+5, dim, ty_mat3x4T)
247        ty_mat4x2F = f(id+6, dim, ty_mat4x2T)
248        ty_mat4x3F = f(id+7, dim, ty_mat4x3T)
249        ty_mat4x4F = f(id+8, dim, ty_mat4x4T)
250        return [ty_mat2x2F,ty_mat2x3F,ty_mat2x4F,ty_mat3x2F,ty_mat3x3F,ty_mat3x4F,ty_mat4x2F,ty_mat4x3F,ty_mat4x4F]
251    # second-order tensor types leading 2
252    def mkTen2F(f, id, dim):
253        id += 25
254        ty_ten2x2x2F = f(id, dim, ty_ten2x2x2T)
255        ty_ten2x2x3F = f(id+1, dim, ty_ten2x2x3T)
256        ty_ten2x2x4F = f(id+2, dim, ty_ten2x2x4T)
257        ty_ten2x3x2F = f(id+3, dim, ty_ten2x3x2T)
258        ty_ten2x3x3F = f(id+4, dim, ty_ten2x3x3T)
259        ty_ten2x3x4F = f(id+5, dim, ty_ten2x3x4T)
260        ty_ten2x4x2F = f(id+6, dim, ty_ten2x4x2T)
261        ty_ten2x4x3F = f(id+7, dim, ty_ten2x4x3T)
262        ty_ten2x4x4F = f(id+8, dim, ty_ten2x4x4T)
263        return [ty_ten2x2x2F, ty_ten2x2x3F, ty_ten2x2x4F,  ty_ten2x3x2F, ty_ten2x3x3F,  ty_ten2x3x4F, ty_ten2x4x2F, ty_ten2x4x3F, ty_ten2x4x4F]
264    # second-order tensor types leading 3
265    def mkTen3F(f, id, dim):
266        id += 50
267        ty_ten3x2x2F = f(id, dim, ty_ten3x2x2T)
268        ty_ten3x2x3F = f(id+1, dim, ty_ten3x2x3T)
269        ty_ten3x2x4F = f(id+2, dim, ty_ten3x2x4T)
270        ty_ten3x3x2F = f(id+3, dim, ty_ten3x3x2T)
271        ty_ten3x3x3F = f(id+4, dim, ty_ten3x3x3T)
272        ty_ten3x3x4F = f(id+5, dim, ty_ten3x3x4T)
273        ty_ten3x4x2F = f(id+6, dim, ty_ten3x4x2T)
274        ty_ten3x4x3F = f(id+7, dim, ty_ten3x4x3T)
275        ty_ten3x4x4F = f(id+8, dim, ty_ten3x4x4T)
276        return [ty_ten3x2x2F, ty_ten3x2x3F, ty_ten3x2x4F,  ty_ten3x3x2F, ty_ten3x3x3F,  ty_ten3x3x4F, ty_ten3x4x2F, ty_ten3x4x3F, ty_ten3x4x4F]
277    # second-order tensor types leading 4
278    def mkTen4F(f, id, dim):
279        id +=75
280        ty_ten4x2x2F = f(id, dim, ty_ten4x2x2T)
281        ty_ten4x2x3F = f(id+1, dim, ty_ten4x2x3T)
282        ty_ten4x2x4F = f(id+2, dim, ty_ten4x2x4T)
283        ty_ten4x3x2F = f(id+3, dim, ty_ten4x3x2T)
284        ty_ten4x3x3F = f(id+4, dim, ty_ten4x3x3T)
285        ty_ten4x3x4F = f(id+5, dim, ty_ten4x3x4T)
286        ty_ten4x4x2F = f(id+6, dim, ty_ten4x4x2T)
287        ty_ten4x4x3F = f(id+7, dim, ty_ten4x4x3T)
288        ty_ten4x4x4F = f(id+8, dim, ty_ten4x4x4T)
289        return [ty_ten4x2x2F, ty_ten4x2x3F, ty_ten4x2x4F,  ty_ten4x3x2F, ty_ten4x3x3F,  ty_ten4x3x4F, ty_ten4x4x2F, ty_ten4x4x3F, ty_ten4x4x4F]
290
291
292    #lift tensor to field level
293    id = 0
294    dim = 0
295    vecFT=  mkVecF(mkNoneField, id, dim)
296    matFT = mkMatF(mkNoneField, id, dim)
297    ten2FT = mkTen2F(mkNoneField, id, dim)
298    ten3FT = mkTen3F(mkNoneField, id, dim)
299    ten4FT = mkTen4F(mkNoneField, id, dim)
300    [ty_scalarFT, ty_vec2FT, ty_vec3FT, ty_vec4FT] = vecFT
301    [ty_mat2x2FT, ty_mat2x3FT,ty_mat2x4FT,ty_mat3x2FT,ty_mat3x3FT,ty_mat3x4FT,ty_mat4x2FT,ty_mat4x3FT,ty_mat4x4FT]  = matFT
302    [ty_ten2x2x2FT,  ty_ten2x2x3FT, ty_ten2x2x4FT,  ty_ten2x3x2FT, ty_ten2x3x3FT,  ty_ten2x3x4FT, ty_ten2x4x2FT, ty_ten2x4x3FT, ty_ten2x4x4FT] = ten2FT
303    [ty_ten3x2x2FT,  ty_ten3x2x3FT, ty_ten3x2x4FT,  ty_ten3x3x2FT, ty_ten3x3x3FT,  ty_ten3x3x4FT, ty_ten3x4x2FT, ty_ten3x4x3FT, ty_ten3x4x4FT] = ten3FT
304    [ty_ten4x2x2FT,  ty_ten4x2x3FT, ty_ten4x2x4FT,  ty_ten4x3x2FT, ty_ten4x3x3FT,  ty_ten4x3x4FT, ty_ten4x4x2FT, ty_ten4x4x3FT, ty_ten4x4x4FT] = ten4FT
305  #dimension 1  #dimension 1
306  id=10  id = 100
307  dim = 1  dim = 1
308  ty_scalarF_d1 = mkField(id, dim, ty_scalarT)  [ty_scalarF_d1, ty_vec2F_d1, ty_vec3F_d1, ty_vec4F_d1] =  mkVecF(mkField, id, dim)
309  ty_vec2F_d1 = mkField(id+1, dim, ty_vec2T)  [ty_mat2x2F_d1, ty_mat2x3F_d1,ty_mat2x4F_d1,ty_mat3x2F_d1,ty_mat3x3F_d1,ty_mat3x4F_d1,ty_mat4x2F_d1,ty_mat4x3F_d1,ty_mat4x4F_d1] = mkMatF( mkField, id, dim)
310  ty_vec3F_d1 = mkField(id+2, dim, ty_vec3T)  [ty_ten2x2x2F_d1,  ty_ten2x2x3F_d1, ty_ten2x2x4F_d1,  ty_ten2x3x2F_d1, ty_ten2x3x3F_d1,  ty_ten2x3x4F_d1, ty_ten2x4x2F_d1, ty_ten2x4x3F_d1, ty_ten2x4x4F_d1] = mkTen2F(mkField, id, dim)
311  ty_vec4F_d1 = mkField(id+3, dim, ty_vec4T)  [ty_ten3x2x2F_d1,  ty_ten3x2x3F_d1, ty_ten3x2x4F_d1,  ty_ten3x3x2F_d1, ty_ten3x3x3F_d1,  ty_ten3x3x4F_d1, ty_ten3x4x2F_d1, ty_ten3x4x3F_d1, ty_ten3x4x4F_d1] = mkTen3F(mkField, id, dim)
312  ty_mat2x2F_d1 = mkField(id+4, dim, ty_mat2x2T)  [ty_ten4x2x2F_d1,  ty_ten4x2x3F_d1, ty_ten4x2x4F_d1,  ty_ten4x3x2F_d1, ty_ten4x3x3F_d1,  ty_ten4x3x4F_d1, ty_ten4x4x2F_d1, ty_ten4x4x3F_d1, ty_ten4x4x4F_d1] = mkTen4F(mkField, id, dim)
ty_mat3x3F_d1 = mkField(id+5, dim, ty_mat3x3T)
ty_mat2x3F_d1 = mkField(id+6, dim, ty_mat2x3T)
ty_mat3x2F_d1 = mkField(id+7, dim, ty_mat3x2T)
ty_ten2x2x2F_d1 = mkField(id+8, dim, ty_ten2x2x2T)
ty_ten3x3x3F_d1 = mkField(id+9, dim, ty_ten3x3x3T)
313  #dimension 2  #dimension 2
314  id=20  id = 200
315  dim=2  dim=2
316  ty_scalarF_d2 = mkField(id, dim, ty_scalarT)  [ty_scalarF_d2, ty_vec2F_d2, ty_vec3F_d2, ty_vec4F_d2] =  mkVecF(mkField, id, dim)
317  ty_vec2F_d2 = mkField(id+1, dim, ty_vec2T)  [ty_mat2x2F_d2, ty_mat2x3F_d2,ty_mat2x4F_d2,ty_mat3x2F_d2,ty_mat3x3F_d2,ty_mat3x4F_d2,ty_mat4x2F_d2,ty_mat4x3F_d2,ty_mat4x4F_d2] = mkMatF( mkField, id, dim)
318  ty_vec3F_d2 = mkField(id+2, dim, ty_vec3T)  [ty_ten2x2x2F_d2,  ty_ten2x2x3F_d2, ty_ten2x2x4F_d2,  ty_ten2x3x2F_d2, ty_ten2x3x3F_d2,  ty_ten2x3x4F_d2, ty_ten2x4x2F_d2, ty_ten2x4x3F_d2, ty_ten2x4x4F_d2] = mkTen2F(mkField, id, dim)
319  ty_vec4F_d2 = mkField(id+3, dim, ty_vec4T)  [ty_ten3x2x2F_d2,  ty_ten3x2x3F_d2, ty_ten3x2x4F_d2,  ty_ten3x3x2F_d2, ty_ten3x3x3F_d2,  ty_ten3x3x4F_d2, ty_ten3x4x2F_d2, ty_ten3x4x3F_d2, ty_ten3x4x4F_d2] = mkTen3F(mkField, id, dim)
320  ty_mat2x2F_d2 = mkField(id+4, dim, ty_mat2x2T)  [ty_ten4x2x2F_d2,  ty_ten4x2x3F_d2, ty_ten4x2x4F_d2,  ty_ten4x3x2F_d2, ty_ten4x3x3F_d2,  ty_ten4x3x4F_d2, ty_ten4x4x2F_d2, ty_ten4x4x3F_d2, ty_ten4x4x4F_d2] = mkTen4F(mkField, id, dim)
321  ty_mat3x3F_d2 = mkField(id+5, dim, ty_mat3x3T)
ty_mat2x3F_d2 = mkField(id+6, dim, ty_mat2x3T)
ty_mat3x2F_d2 = mkField(id+7, dim, ty_mat3x2T)
ty_ten2x2x2F_d2 = mkField(id+8, dim, ty_ten2x2x2T)
ty_ten3x3x3F_d2 = mkField(id+9, dim, ty_ten3x3x3T)
322  #dimension 3  #dimension 3
323  id=30  id = 300
324  dim=3  dim=3
325  ty_scalarF_d3 = mkField(id, dim, ty_scalarT)  [ty_scalarF_d3, ty_vec2F_d3, ty_vec3F_d3, ty_vec4F_d3] =  mkVecF(mkField, id, dim)
326  ty_vec2F_d3 = mkField(id+1, dim, ty_vec2T)  (ty_mat2x2F_d3, ty_mat2x3F_d3,ty_mat2x4F_d3,ty_mat3x2F_d3,ty_mat3x3F_d3,ty_mat3x4F_d3,ty_mat4x2F_d3,ty_mat4x3F_d3,ty_mat4x4F_d3) = mkMatF( mkField, id, dim)
327  ty_vec3F_d3 = mkField(id+2, dim, ty_vec3T)  [ty_ten2x2x2F_d3,  ty_ten2x2x3F_d3, ty_ten2x2x4F_d3,  ty_ten2x3x2F_d3, ty_ten2x3x3F_d3,  ty_ten2x3x4F_d3, ty_ten2x4x2F_d3, ty_ten2x4x3F_d3, ty_ten2x4x4F_d3] = mkTen2F(mkField, id, dim)
328  ty_vec4F_d3 = mkField(id+3, dim, ty_vec4T)  [ty_ten3x2x2F_d3,  ty_ten3x2x3F_d3, ty_ten3x2x4F_d3,  ty_ten3x3x2F_d3, ty_ten3x3x3F_d3,  ty_ten3x3x4F_d3, ty_ten3x4x2F_d3, ty_ten3x4x3F_d3, ty_ten3x4x4F_d3] = mkTen3F(mkField, id, dim)
329  ty_mat2x2F_d3 = mkField(id+4, dim, ty_mat2x2T)  [ty_ten4x2x2F_d3,  ty_ten4x2x3F_d3, ty_ten4x2x4F_d3,  ty_ten4x3x2F_d3, ty_ten4x3x3F_d3,  ty_ten4x3x4F_d3, ty_ten4x4x2F_d3, ty_ten4x4x3F_d3, ty_ten4x4x4F_d3] = mkTen4F(mkField, id, dim)
ty_mat3x3F_d3 = mkField(id+5, dim, ty_mat3x3T)
ty_mat4x4F_d3 = mkField(id+6, dim, ty_mat4x4T)
ty_mat2x3F_d3 = mkField(id+7, dim, ty_mat2x3T)
ty_mat3x2F_d3 = mkField(id+8, dim, ty_mat3x2T)
ty_ten2x2x2F_d3 = mkField(id+9, dim, ty_ten2x2x2T)
ty_ten3x3x3F_d3 = mkField(id+10, dim, ty_ten3x3x3T)

330
331    # fields that can be synthesized with template
332  l_all_d1F = [ty_scalarF_d1, ty_vec2F_d1, ty_vec3F_d1, ty_vec4F_d1, ty_mat2x2F_d1, ty_mat3x3F_d1]  l_all_d1F = [ty_scalarF_d1, ty_vec2F_d1, ty_vec3F_d1, ty_vec4F_d1, ty_mat2x2F_d1, ty_mat3x3F_d1]
333  l_all_d2F = [ty_scalarF_d2, ty_vec2F_d2, ty_vec3F_d2, ty_vec4F_d2, ty_mat2x2F_d2, ty_mat3x3F_d2]  l_all_d2F = [ty_scalarF_d2, ty_vec2F_d2, ty_vec3F_d2, ty_vec4F_d2, ty_mat2x2F_d2, ty_mat3x3F_d2]
334  l_all_d3F = [ty_scalarF_d3, ty_vec2F_d3, ty_vec3F_d3, ty_vec4F_d3, ty_mat2x2F_d3, ty_mat3x3F_d3]  l_all_d3F = [ty_scalarF_d3, ty_vec2F_d3, ty_vec3F_d3, ty_vec4F_d3, ty_mat2x2F_d3, ty_mat3x3F_d3]

335  l_all_F1 =  l_all_d1F +l_all_d2F +l_all_d3F  l_all_F1 =  l_all_d1F +l_all_d2F +l_all_d3F
336  l_all_T1 = [ty_scalarFT, ty_vec2FT, ty_vec3FT, ty_mat2x2FT, ty_mat3x3FT, ty_mat2x3FT , ty_mat3x2FT, ty_ten2x2x2FT, ty_ten3x3x3FT]  #tensors that can eb created
337    l_all_T1 = vecFT+matFT+ten2FT+ten3FT+ten4FT
338  l_all1 =  l_all_T1+l_all_F1  l_all1 =  l_all_T1+l_all_F1
339
340  def print_tys(str, es):  def print_tys(str, es):
# Line 348  Line 438
438      if (dim==nonefield_dim):      if (dim==nonefield_dim):
439          if (shapeout==[]):          if (shapeout==[]):
440              return (True, ty_scalarFT)              return (True, ty_scalarFT)
elif (shapeout==[1]):
return (True, ty_vec1FT)
441          elif (shapeout==[2]):          elif (shapeout==[2]):
442              return  (True,  ty_vec2FT)              return  (True,  ty_vec2FT)
443          elif (shapeout==[3]):          elif (shapeout==[3]):
444              return  (True,  ty_vec3FT)              return  (True,  ty_vec3FT)
elif(shapeout==[1,1]):
return (True, ty_mat1x1FT)
445          elif(shapeout==[2,2]):          elif(shapeout==[2,2]):
446              return (True, ty_mat2x2FT)              return (True, ty_mat2x2FT)
elif(shapeout==[3,3]):
return (True, ty_mat3x3FT)
447          elif(shapeout==[2,3]):          elif(shapeout==[2,3]):
448              return (True, ty_mat2x3FT)              return (True, ty_mat2x3FT)
449            elif(shapeout==[2,4]):
450                return (True, ty_mat2x4FT)
451          elif(shapeout==[3,2]):          elif(shapeout==[3,2]):
452              return (True, ty_mat3x2FT)              return (True, ty_mat3x2FT)
453            elif(shapeout==[3,3]):
454                return (True, ty_mat3x3FT)
455            elif(shapeout==[3,4]):
456                return (True, ty_mat3x4FT)
457            elif(shapeout==[4,2]):
458                return (True, ty_mat4x2FT)
459            elif(shapeout==[4,3]):
460                return (True, ty_mat4x3FT)
461            elif(shapeout==[4,4]):
462                return (True, ty_mat4x4FT)
463          elif (shapeout==[2,2,2]):          elif (shapeout==[2,2,2]):
464              return (True, ty_ten2x2x2FT)              return (True, ty_ten2x2x2FT)
465            elif (shapeout==[2,2,3]):
466                return (True, ty_ten2x2x3FT)
467            elif (shapeout==[2,2,4]):
468                return (True, ty_ten2x2x4FT)
469            elif(shapeout==[3,3, 2]):
470                return (True, ty_ten3x3x2FT)
471          elif(shapeout==[3,3, 3]):          elif(shapeout==[3,3, 3]):
472              return (True, ty_ten3x3x3FT)              return (True, ty_ten3x3x3FT)
473            elif(shapeout==[3,3, 4]):
474                return (True, ty_ten3x3x4FT)
475            elif(shapeout==[4,4, 2]):
476                return (True, ty_ten4x4x2FT)
477            elif(shapeout==[4,4, 3]):
478                return (True, ty_ten4x4x3FT)
479            elif(shapeout==[4,4, 4]):
480                return (True, ty_ten4x4x4FT)
481          else:          else:
482              #print "shapeout",shapeout,"dim", dim              #print "shapeout",shapeout,"dim", dim
483              return (False, ("unsupported shapeout dim-1 "+ str(shapeout)))              return (False, ("unsupported shapeout dim-1 "+ str(shapeout)))
484      elif (dim==1):      elif (dim==1):
485          if (shapeout==[]):          if (shapeout==[]):
486              return (True, ty_scalarF_d1)              return (True, ty_scalarF_d1)
elif (shapeout==[1]):
return (True, ty_vec1F_d1)
487          elif (shapeout==[2]):          elif (shapeout==[2]):
488              return  (True,  ty_vec2F_d1)              return  (True,  ty_vec2F_d1)
489          elif (shapeout==[3]):          elif (shapeout==[3]):
490              return  (True,  ty_vec3F_d1)              return  (True,  ty_vec3F_d1)
elif(shapeout==[1,1]):
return (True, ty_mat1x1F_d1)
491          elif(shapeout==[2,2]):          elif(shapeout==[2,2]):
492              return (True, ty_mat2x2F_d1)              return (True, ty_mat2x2F_d1)
elif(shapeout==[3,3]):
return (True, ty_mat3x3F_d1)
493          elif(shapeout==[2,3]):          elif(shapeout==[2,3]):
494              return (True, ty_mat2x3F_d1)              return (True, ty_mat2x3F_d1)
495            elif(shapeout==[2,4]):
496                return (True, ty_mat2x4F_d1)
497          elif(shapeout==[3,2]):          elif(shapeout==[3,2]):
498              return (True, ty_mat3x2F_d1)              return (True, ty_mat3x2F_d1)
499            elif(shapeout==[3,3]):
500                return (True, ty_mat3x3F_d1)
501            elif(shapeout==[3,4]):
502                return (True, ty_mat3x4F_d1)
503            elif(shapeout==[4,2]):
504                return (True, ty_mat4x2F_d1)
505            elif(shapeout==[4,3]):
506                return (True, ty_mat4x3F_d1)
507            elif(shapeout==[4,4]):
508                return (True, ty_mat4x4F_d1)
509          elif (shapeout==[2,2,2]):          elif (shapeout==[2,2,2]):
510              return (True, ty_ten2x2x2F_d1)              return (True, ty_ten2x2x2F_d1)
511            elif(shapeout==[2, 2, 3]):
512                return (True, ty_ten2x2x3F_d1)
513            elif(shapeout==[2, 2, 4]):
514                return (True, ty_ten2x2x4F_d1)
515            elif (shapeout==[2, 3,2]):
516                return (True, ty_ten2x3x2F_d1)
517            elif(shapeout==[2, 3, 3]):
518                return (True, ty_ten2x3x3F_d1)
519            elif(shapeout==[2, 3, 4]):
520                return (True, ty_ten2x3x4F_d1)
521            elif (shapeout==[2, 4,2]):
522                return (True, ty_ten2x4x2F_d1)
523            elif(shapeout==[2, 4, 3]):
524                return (True, ty_ten2x4x3F_d1)
525            elif(shapeout==[2, 4, 4]):
526                return (True, ty_ten2x4x4F_d1)
527            elif (shapeout==[3, 2,2]):
528                return (True, ty_ten3x2x2F_d1)
529            elif(shapeout==[3, 2, 3]):
530                return (True, ty_ten3x2x3F_d1)
531            elif(shapeout==[3, 2, 4]):
532                return (True, ty_ten3x2x4F_d1)
533            elif (shapeout==[3, 3,2]):
534                return (True, ty_ten3x3x2F_d1)
535          elif(shapeout==[3,3, 3]):          elif(shapeout==[3,3, 3]):
536              return (True, ty_ten3x3x3F_d1)              return (True, ty_ten3x3x3F_d1)
537            elif(shapeout==[3, 3, 4]):
538                return (True, ty_ten3x3x4F_d1)
539            elif (shapeout==[3, 4,2]):
540                return (True, ty_ten3x4x2F_d1)
541            elif(shapeout==[3, 4, 3]):
542                return (True, ty_ten3x4x3F_d1)
543            elif(shapeout==[3, 4, 4]):
544                return (True, ty_ten3x4x4F_d1)
545            elif (shapeout==[4, 2,2]):
546                return (True, ty_ten4x2x2F_d1)
547            elif(shapeout==[4, 2, 3]):
548                return (True, ty_ten4x2x3F_d1)
549            elif(shapeout==[4, 2, 4]):
550                return (True, ty_ten4x2x4F_d1)
551            elif (shapeout==[4, 3,2]):
552                return (True, ty_ten4x3x2F_d1)
553            elif(shapeout==[4, 3, 3]):
554                return (True, ty_ten4x3x3F_d1)
555            elif(shapeout==[4, 3, 4]):
556                return (True, ty_ten4x3x4F_d1)
557            elif (shapeout==[4, 4,2]):
558                return (True, ty_ten4x4x2F_d1)
559            elif(shapeout==[4, 4, 3]):
560                return (True, ty_ten4x4x3F_d1)
561            elif(shapeout==[4, 4, 4]):
562                return (True, ty_ten4x4x4F_d1)
563          else:          else:
564              #print "shapeout",shapeout,"dim", dim              #print "shapeout",shapeout,"dim", dim
565              return (False, ("unsupported shapeout dim-1 "+ str(shapeout)))              return (False, ("unsupported shapeout dim-1 "+ str(shapeout)))
# Line 406  Line 572
572              return (True, ty_vec3F_d2)              return (True, ty_vec3F_d2)
573          elif (shapeout==[2,2]):          elif (shapeout==[2,2]):
574              return (True, ty_mat2x2F_d2)              return (True, ty_mat2x2F_d2)
elif (shapeout==[3,3]):
return (True, ty_mat3x3F_d2)
575          elif (shapeout==[2,3]):          elif (shapeout==[2,3]):
576              return (True, ty_mat2x3F_d2)              return (True, ty_mat2x3F_d2)
577            elif(shapeout==[2,4]):
578                return (True, ty_mat2x4F_d2)
579          elif (shapeout==[3,2]):          elif (shapeout==[3,2]):
580              return (True, ty_mat3x2F_d2)              return (True, ty_mat3x2F_d2)
581            elif(shapeout==[3,3]):
582                return (True, ty_mat3x3F_d2)
583            elif(shapeout==[3,4]):
584                return (True, ty_mat3x4F_d2)
585            elif(shapeout==[4,2]):
586                return (True, ty_mat4x2F_d2)
587            elif(shapeout==[4,3]):
588                return (True, ty_mat4x3F_d2)
589            elif(shapeout==[4,4]):
590                return (True, ty_mat4x4F_d2)
591          elif (shapeout==[2,2,2]):          elif (shapeout==[2,2,2]):
592              return (True,  ty_ten2x2x2F_d2)              return (True,  ty_ten2x2x2F_d2)
593            elif(shapeout==[2, 2, 3]):
594                return (True, ty_ten2x2x3F_d2)
595            elif(shapeout==[2, 2, 4]):
596                return (True, ty_ten2x2x4F_d2)
597            elif (shapeout==[2, 3,2]):
598                return (True, ty_ten2x3x2F_d2)
599            elif(shapeout==[2, 3, 3]):
600                return (True, ty_ten2x3x3F_d2)
601            elif(shapeout==[2, 3, 4]):
602                return (True, ty_ten2x3x4F_d2)
603            elif (shapeout==[2, 4,2]):
604                return (True, ty_ten2x4x2F_d2)
605            elif(shapeout==[2, 4, 3]):
606                return (True, ty_ten2x4x3F_d2)
607            elif(shapeout==[2, 4, 4]):
608                return (True, ty_ten2x4x4F_d2)
609            elif (shapeout==[3, 2,2]):
610                return (True, ty_ten3x2x2F_d2)
611            elif(shapeout==[3, 2, 3]):
612                return (True, ty_ten3x2x3F_d2)
613            elif(shapeout==[3, 2, 4]):
614                return (True, ty_ten3x2x4F_d2)
615            elif (shapeout==[3, 3,2]):
616                return (True, ty_ten3x3x2F_d2)
617          elif(shapeout==[3,3, 3]):          elif(shapeout==[3,3, 3]):
618              return (True, ty_ten3x3x3F_d2)              return (True, ty_ten3x3x3F_d2)
619            elif(shapeout==[3, 3, 4]):
620                return (True, ty_ten3x3x4F_d2)
621            elif (shapeout==[3, 4,2]):
622                return (True, ty_ten3x4x2F_d2)
623            elif(shapeout==[3, 4, 3]):
624                return (True, ty_ten3x4x3F_d2)
625            elif(shapeout==[3, 4, 4]):
626                return (True, ty_ten3x4x4F_d2)
627            elif (shapeout==[4, 2,2]):
628                return (True, ty_ten4x2x2F_d2)
629            elif(shapeout==[4, 2, 3]):
630                return (True, ty_ten4x2x3F_d2)
631            elif(shapeout==[4, 2, 4]):
632                return (True, ty_ten4x2x4F_d2)
633            elif (shapeout==[4, 3,2]):
634                return (True, ty_ten4x3x2F_d2)
635            elif(shapeout==[4, 3, 3]):
636                return (True, ty_ten4x3x3F_d2)
637            elif(shapeout==[4, 3, 4]):
638                return (True, ty_ten4x3x4F_d2)
639            elif (shapeout==[4, 4,2]):
640                return (True, ty_ten4x4x2F_d2)
641            elif(shapeout==[4, 4, 3]):
642                return (True, ty_ten4x4x3F_d2)
643            elif(shapeout==[4, 4, 4]):
644                return (True, ty_ten4x4x4F_d2)
645          else:          else:
646              #print "shapeout",shapeout,"dim", dim              #print "shapeout",shapeout,"dim", dim
647              return(False, "unsupported shapeout dim-2 "+str(shapeout))              return(False, "unsupported shapeout dim-2 "+str(shapeout))
648      elif (dim==3):      elif (dim==3):
649          if (shapeout==[]):          if (shapeout==[]):
650              return (True, ty_scalarF_d3)              return (True, ty_scalarF_d3)
elif(shapeout==[3]):
return (True, ty_vec3F_d3)
elif(shapeout==[3,3]):
return (True, ty_mat3x3F_d3)
elif(shapeout==[3,3, 3]):
return(True,  ty_ten3x3x3F_d3)
651          elif(shapeout==[2]):          elif(shapeout==[2]):
652              return (True,  ty_vec2F_d3)              return (True,  ty_vec2F_d3)
653            elif (shapeout==[3]):
654                return  (True,  ty_vec3F_d3)
655          elif(shapeout==[2,2]):          elif(shapeout==[2,2]):
656              return (True, ty_mat2x2F_d3)              return (True, ty_mat2x2F_d3)
657          elif(shapeout==[2,3]):          elif(shapeout==[2,3]):
658              return (True, ty_mat2x3F_d3)              return (True, ty_mat2x3F_d3)
659            elif(shapeout==[2,4]):
660                return (True, ty_mat2x4F_d3)
661          elif(shapeout==[3,2]):          elif(shapeout==[3,2]):
662              return (True, ty_mat3x2F_d3)              return (True, ty_mat3x2F_d3)
663            elif(shapeout==[3,3]):
664                return (True, ty_mat3x3F_d3)
665            elif(shapeout==[3, 4]):
666                return (True, ty_mat3x4F_d3)
667            elif(shapeout==[4, 2]):
668                return (True, ty_mat4x2F_d3)
669            elif(shapeout==[4, 3]):
670                return (True, ty_mat4x3F_d3)
671            elif(shapeout==[4, 4]):
672                return (True, ty_mat4x4F_d3)
673          elif(shapeout==[2,2,2]):          elif(shapeout==[2,2,2]):
674              return (True, ty_ten2x2x2F_d3)              return (True, ty_ten2x2x2F_d3)
675            elif(shapeout==[2, 2, 3]):
676                return (True, ty_ten2x2x3F_d3)
677            elif(shapeout==[2, 2, 4]):
678                return (True, ty_ten2x2x4F_d3)
679            elif (shapeout==[2, 3,2]):
680                return (True, ty_ten2x3x2F_d3)
681            elif(shapeout==[2, 3, 3]):
682                return (True, ty_ten2x3x3F_d3)
683            elif(shapeout==[2, 3, 4]):
684                return (True, ty_ten2x3x4F_d3)
685            elif (shapeout==[2, 4,2]):
686                return (True, ty_ten2x4x2F_d3)
687            elif(shapeout==[2, 4, 3]):
688                return (True, ty_ten2x4x3F_d3)
689            elif(shapeout==[2, 4, 4]):
690                return (True, ty_ten2x4x4F_d3)
691            elif (shapeout==[3, 2,2]):
692                return (True, ty_ten3x2x2F_d3)
693            elif(shapeout==[3, 2, 3]):
694                return (True, ty_ten3x2x3F_d3)
695            elif(shapeout==[3, 2, 4]):
696                return (True, ty_ten3x2x4F_d3)
697            elif (shapeout==[3, 3,2]):
698                return (True, ty_ten3x3x2F_d3)
699            elif(shapeout==[3, 3, 3]):
700                return (True, ty_ten3x3x3F_d3)
701            elif(shapeout==[3, 3, 4]):
702                return (True, ty_ten3x3x4F_d3)
703            elif (shapeout==[3, 4,2]):
704                return (True, ty_ten3x4x2F_d3)
705            elif(shapeout==[3, 4, 3]):
706                return (True, ty_ten3x4x3F_d3)
707            elif(shapeout==[3, 4, 4]):
708                return (True, ty_ten3x4x4F_d3)
709            elif (shapeout==[4, 2,2]):
710                return (True, ty_ten4x2x2F_d3)
711            elif(shapeout==[4, 2, 3]):
712                return (True, ty_ten4x2x3F_d3)
713            elif(shapeout==[4, 2, 4]):
714                return (True, ty_ten4x2x4F_d3)
715            elif (shapeout==[4, 3,2]):
716                return (True, ty_ten4x3x2F_d3)
717            elif(shapeout==[4, 3, 3]):
718                return (True, ty_ten4x3x3F_d3)
719            elif(shapeout==[4, 3, 4]):
720                return (True, ty_ten4x3x4F_d3)
721            elif (shapeout==[4, 4,2]):
722                return (True, ty_ten4x4x2F_d3)
723            elif(shapeout==[4, 4, 3]):
724                return (True, ty_ten4x4x3F_d3)
725            elif(shapeout==[4, 4, 4]):
726                return (True, ty_ten4x4x4F_d3)
727          else:          else:
728              return (False, "unsupported shapeout dim-3"+str(shapeout))              return (False, "unsupported shapeout dim-3"+str(shapeout))
729      else:      else:

Legend:
 Removed from v.4458 changed lines Added in v.4459