Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Diff of /branches/ein16/synth/d2/obj_apply.py
ViewVC logotype

Diff of /branches/ein16/synth/d2/obj_apply.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 4235, Tue Jul 19 22:26:44 2016 UTC revision 4236, Wed Jul 20 03:02:00 2016 UTC
# Line 175  Line 175 
175      if (op_probe==op1) or (op_negation==op1):      if (op_probe==op1) or (op_negation==op1):
176          return (true, ityp1) #type unaffected by operation          return (true, ityp1) #type unaffected by operation
177      elif (op_gradient==op1):      elif (op_gradient==op1):
   
178          if (not isDifferentiable(ityp1)):          if (not isDifferentiable(ityp1)):
   
179              return (false , "can not differentiate")              return (false , "can not differentiate")
180          elif (fty.isEq_id(ityp1, ty_scalarF_d1)):          elif (fty.isEq_id(ityp1, ty_scalarF_d1)):
181              k=ityp1.k              k=ityp1.k
# Line 264  Line 262 
262              [n, m] = fty.get_shape(ityp1)              [n, m] = fty.get_shape(ityp1)
263              if(n!=m):              if(n!=m):
264                   return (false, "non-symmetrical matrix")                   return (false, "non-symmetrical matrix")
265              # only handle n-d  nxn              # can handle dim1=  n
266              if((dim==2) and (n==2)):              if(dim==2):
267                  return (true, fty.convertTy(ty_scalarF_d2, k))                  return (true, fty.convertTy(ty_scalarF_d2, k))
268              elif((dim==3) and (n==3)):              elif(dim==3):
269                  return (true, fty.convertTy(ty_scalarF_d3, k))                  return (true, fty.convertTy(ty_scalarF_d3, k))
270              else:              else:
271                  return (false, " can not apply trace to nonmatrix")                  return (false, " can not apply trace to this field")
272          else:          else:
273              return (false, "apply trace to non-matrix")              return (false, "apply trace to non-matrix")
274      elif(op_transpose==op1):            # apply op_tranpose      elif(op_transpose==op1):            # apply op_tranpose

Legend:
Removed from v.4235  
changed lines
  Added in v.4236

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0