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

revision 2236 by jfenwick, Thu Jan 8 23:55:40 2009 UTC revision 2237 by gross, Tue Feb 3 06:14:19 2009 UTC
# Line 4650  def maximum(*args): Line 4650  def maximum(*args):
4650      out=None      out=None
4651      for a in args:      for a in args:
4652         if out==None:         if out==None:
4653            out=a            out=a*1.
4654         else:         else:
4655            diff=add(a,-out)            if isinstance(out,escript.Data) and isinstance(a,escript.Data):
4656            out=add(out,mult(wherePositive(diff),diff))               out.copyWithMask(a,wherePositive(a-out))
4657              else:
4658                 diff=add(a-out)
4659                 out=add(out,wherePositive(diff),diff)
4660      return out      return out
4661
4662  def minimum(*args):  def minimum(*args):
# Line 4671  def minimum(*args): Line 4674  def minimum(*args):
4674      out=None      out=None
4675      for a in args:      for a in args:
4676         if out==None:         if out==None:
4677            out=a            out=a*1.
4678         else:         else:
4679            diff=add(a,-out)            if isinstance(out,escript.Data) and isinstance(a,escript.Data):
4680            out=add(out,mult(whereNegative(diff),diff))               out.copyWithMask(a,whereNegative(a-out))
4681              else:
4682                 diff=add(a,-out)
4683                 out=add(out,mult(whereNegative(diff),diff))
4684      return out      return out
4685
4686  def clip(arg,minval=None,maxval=None):  def clip(arg,minval=None,maxval=None):

Legend:
 Removed from v.2236 changed lines Added in v.2237

 ViewVC Help Powered by ViewVC 1.1.26