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

revision 353 by gross, Wed Dec 14 04:13:59 2005 UTC revision 378 by gross, Fri Dec 16 09:02:28 2005 UTC
# Line 45  import os Line 45  import os
45
46  # def maximum(arg0,arg1):  # def maximum(arg0,arg1):
47  # def minimum(arg0,arg1):  # def minimum(arg0,arg1):
48    # def clip(arg,minval,maxval)
49
50  # def transpose(arg,axis=None):  # def transpose(arg,axis=None):
51  # def trace(arg,axis0=0,axis1=1):  # def trace(arg,axis0=0,axis1=1):
# Line 3325  def minimum(*arg): Line 3326  def minimum(*arg):
3326            m=whereNegative(out-a)            m=whereNegative(out-a)
3327            out=m*out+(1.-m)*a            out=m*out+(1.-m)*a
3328      return out      return out
3329
3330    def clip(arg,minval=0.,maxval=1.):
3331        """
3332        cuts the values of arg between minval and maxval
3333
3334        @param arg: argument
3335        @type arg: L{numarray.NumArray}, L{escript.Data}, L{Symbol}, C{int} or C{float}
3336        @param minval: lower range
3337        @type arg: C{float}
3338        @param maxval: uper range
3339        @type arg: C{float}
3340        @return: is on object with all its value between minval and maxval. value of the argument that greater then minval and
3341                 less then maxval are unchanged.
3342        @rtype: L{numarray.NumArray}, L{escript.Data}, L{Symbol}, C{int} or C{float} depending on the input
3343        """
3344        if minval>maxval:
3345           raise ValueError,"minval = %s must be less then maxval %s"%(minval,maxval)
3346        return minimum(maximum(minval,arg),maxval)
3347
3348
3349  def inner(arg0,arg1):  def inner(arg0,arg1):
3350      """      """

Legend:
 Removed from v.353 changed lines Added in v.378