/[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 785 by gross, Tue Jul 25 03:48:10 2006 UTC revision 795 by ksteube, Mon Jul 31 01:23:58 2006 UTC
# Line 3253  def inverse(arg): Line 3253  def inverse(arg):
3253    
3254      @param arg: square matrix. Must have rank 2 and the first and second dimension must be equal.      @param arg: square matrix. Must have rank 2 and the first and second dimension must be equal.
3255      @type arg: L{numarray.NumArray}, L{escript.Data}, L{Symbol}      @type arg: L{numarray.NumArray}, L{escript.Data}, L{Symbol}
3256      @return: inverse arg_inv of the argument. It will be matrixmul(inverse(arg),arg) almost equal to kronecker(arg.getShape()[0])      @return: inverse arg_inv of the argument. It will be matrix_mult(inverse(arg),arg) almost equal to kronecker(arg.getShape()[0])
3257      @rtype: L{numarray.NumArray}, L{escript.Data}, L{Symbol} depending on the input      @rtype: L{numarray.NumArray}, L{escript.Data}, L{Symbol} depending on the input
3258      @note: for L{escript.Data} objects the dimension is restricted to 3.      @note: for L{escript.Data} objects the dimension is restricted to 3.
3259      """      """
# Line 3998  def outer(arg0,arg1): Line 3998  def outer(arg0,arg1):
3998      """      """
3999      return generalTensorProduct(arg0,arg1,axis_offset=0)      return generalTensorProduct(arg0,arg1,axis_offset=0)
4000    
4001  def matrixmul(arg0,arg1):  def matrixmult(arg0,arg1):
4002      """      """
4003      see L{matrix_mult}      see L{matrix_mult}
4004      """      """
# Line 4196  class GeneralTensorProduct_Symbol(Depend Line 4196  class GeneralTensorProduct_Symbol(Depend
4196           args=self.getSubstitutedArguments(argvals)           args=self.getSubstitutedArguments(argvals)
4197           return generalTensorProduct(args[0],args[1],args[2])           return generalTensorProduct(args[0],args[1],args[2])
4198    
4199    def escript_generalTensorProductNew(arg0,arg1,axis_offset):
4200        "arg0 and arg1 are both Data objects but not neccesrily on the same function space. they could be identical!!!"
4201        # calculate the return shape:
4202        shape0=arg0.getShape()[:arg0.getRank()-axis_offset]
4203        shape01=arg0.getShape()[arg0.getRank()-axis_offset:]
4204        shape10=arg1.getShape()[:axis_offset]
4205        shape1=arg1.getShape()[axis_offset:]
4206        if not shape01==shape10:
4207            raise ValueError,"dimensions of last %s components in left argument don't match the first %s components in the right argument."%(axis_offset,axis_offset)
4208        # Figure out which functionspace to use (look at where operator+ is defined maybe in BinaryOp.h to get the logic for this)
4209        # fs=(escript.Scalar(0.,arg0.getFunctionSpace())+escript.Scalar(0.,arg1.getFunctionSpace())).getFunctionSpace()
4210        out=GeneralTensorProduct(arg0, arg1, axis_offset)
4211        return out
4212    
4213  def escript_generalTensorProduct(arg0,arg1,axis_offset): # this should be escript._generalTensorProduct  def escript_generalTensorProduct(arg0,arg1,axis_offset): # this should be escript._generalTensorProduct
4214      "arg0 and arg1 are both Data objects but not neccesrily on the same function space. they could be identical!!!"      "arg0 and arg1 are both Data objects but not neccesrily on the same function space. they could be identical!!!"
4215      # calculate the return shape:      # calculate the return shape:

Legend:
Removed from v.785  
changed lines
  Added in v.795

  ViewVC Help
Powered by ViewVC 1.1.26