/[escript]/trunk/escript/py_src/util.py
ViewVC logotype

Diff of /trunk/escript/py_src/util.py

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

revision 400 by gross, Wed Dec 21 23:13:39 2005 UTC revision 413 by gross, Tue Jan 3 08:27:19 2006 UTC
# Line 3568  def escript_generalTensorProduct(arg0,ar Line 3568  def escript_generalTensorProduct(arg0,ar
3568      if not shape01==shape10:      if not shape01==shape10:
3569          raise ValueError,"dimensions of last %s components in left argument don't match the first %s components in the right argument."%(offset,offset)          raise ValueError,"dimensions of last %s components in left argument don't match the first %s components in the right argument."%(offset,offset)
3570    
3571        # whatr function space should be used? (this here is not good!)
3572        fs=(escript.Scalar(0.,arg0.getFunctionSpace())+escript.Scalar(0.,arg1.getFunctionSpace())).getFunctionspace()
3573      # create return value:      # create return value:
3574      out=escript.Data(0.,tuple(shape0+shape1),arg0.getFunctionSpace())      out=escript.Data(0.,tuple(shape0+shape1),fs)
3575      #      #
3576      s0=[[]]      s0=[[]]
3577      for k in shape0:      for k in shape0:
# Line 3592  def escript_generalTensorProduct(arg0,ar Line 3594  def escript_generalTensorProduct(arg0,ar
3594    
3595      for i0 in s0:      for i0 in s0:
3596         for i1 in s1:         for i1 in s1:
3597           s=escript.Scalar(0.,arg0.getFunctionSpace())           s=escript.Scalar(0.,fs)
3598           for i01 in s01:           for i01 in s01:
3599              s+=arg0.__getitem__(tuple(i0+i01))*arg1.__getitem__(tuple(i01+i1))              s+=arg0.__getitem__(tuple(i0+i01))*arg1.__getitem__(tuple(i01+i1))
3600           out.__setitem__(tuple(i0+i1),s)           out.__setitem__(tuple(i0+i1),s)

Legend:
Removed from v.400  
changed lines
  Added in v.413

  ViewVC Help
Powered by ViewVC 1.1.26