/[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 585 by gross, Thu Mar 9 23:47:42 2006 UTC revision 587 by gross, Fri Mar 10 02:26:50 2006 UTC
# Line 3607  def eigenvalues(arg): Line 3607  def eigenvalues(arg):
3607        return float(arg)        return float(arg)
3608      else:      else:
3609        raise TypeError,"eigenvalues: Unknown argument type."        raise TypeError,"eigenvalues: Unknown argument type."
3610    
3611    def eigenvalues_and_eigenvectors(arg):
3612        """
3613        returns the eigenvalues of the square matrix arg.
3614    
3615        @param arg: square matrix. Must have rank 2 and the first and second dimension must be equal.
3616                    arg must be symmetric, ie. transpose(arg)==arg (this is not checked).
3617        @type arg: L{numarray.NumArray}, L{escript.Data}, L{Symbol}
3618        @return: the eigenvalues in increasing order.
3619        @rtype: L{numarray.NumArray},L{escript.Data}, L{Symbol} depending on the input.
3620        @remark: for L{escript.Data} and L{Symbol} objects the dimension is restricted to 3.
3621        """
3622        if isinstance(arg,numarray.NumArray):
3623          raise TypeError,"eigenvalues_and_eigenvectors is not supporting numarray arguments"
3624        elif isinstance(arg,escript.Data):
3625          return arg._eigenvalues_and_eigenvectors()
3626        elif isinstance(arg,Symbol):
3627          raise TypeError,"eigenvalues_and_eigenvectors is not supporting Symbol arguments"
3628        elif isinstance(arg,float):
3629          return (numarray.array([[arg]],numarray.Float),numarray.ones((1,1),numarray.Float))
3630        elif isinstance(arg,int):
3631          return (numarray.array([[arg]],numarray.Float),numarray.ones((1,1),numarray.Float))
3632        else:
3633          raise TypeError,"eigenvalues: Unknown argument type."
3634  #=======================================================  #=======================================================
3635  #  Binary operations:  #  Binary operations:
3636  #=======================================================  #=======================================================

Legend:
Removed from v.585  
changed lines
  Added in v.587

  ViewVC Help
Powered by ViewVC 1.1.26