/[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 587 by gross, Fri Mar 10 02:26:50 2006 UTC revision 608 by elspeth, Tue Mar 21 09:46:06 2006 UTC
# Line 1  Line 1 
1  # $Id$  # $Id$
 #  
 #      COPYRIGHT ACcESS 2004 -  All Rights Reserved  
 #  
 #   This software is the property of ACcESS.  No part of this code  
 #   may be copied in any form or by any means without the expressed written  
 #   consent of ACcESS.  Copying, use or modification of this software  
 #   by any unauthorised person is illegal unless that  
 #   person has a software license agreement with ACcESS.  
 #  
2    
3  """  """
4  Utility functions for escript  Utility functions for escript
# Line 22  Utility functions for escript Line 13  Utility functions for escript
13  """  """
14                                                                                                                                                                                                                                                                                                                                                                                                            
15  __author__="Lutz Gross, l.gross@uq.edu.au"  __author__="Lutz Gross, l.gross@uq.edu.au"
16  __licence__="contact: esys@access.uq.edu.au"  __copyright__="""  Copyright (c) 2006 by ACcESS MNRF
17                        http://www.access.edu.au
18                    Primary Business: Queensland, Australia"""
19    __licence__="""Licensed under the Open Software License version 3.0
20                 http://www.opensource.org/licences/osl-3.0.php"""
21  __url__="http://www.iservo.edu.au/esys/escript"  __url__="http://www.iservo.edu.au/esys/escript"
22  __version__="$Revision$"  __version__="$Revision$"
23  __date__="$Date$"  __date__="$Date$"
# Line 30  __date__="$Date$" Line 25  __date__="$Date$"
25    
26  import math  import math
27  import numarray  import numarray
 import numarray.linear_algebra  
28  import escript  import escript
29  import os  import os
30    
# Line 3407  def inverse(arg): Line 3401  def inverse(arg):
3401      @remark: for L{escript.Data} objects the dimension is restricted to 3.      @remark: for L{escript.Data} objects the dimension is restricted to 3.
3402      """      """
3403      if isinstance(arg,numarray.NumArray):      if isinstance(arg,numarray.NumArray):
3404          import numarray.linear_algebra
3405        return numarray.linear_algebra.inverse(arg)        return numarray.linear_algebra.inverse(arg)
3406      elif isinstance(arg,escript.Data):      elif isinstance(arg,escript.Data):
3407        return escript_inverse(arg)        return escript_inverse(arg)
# Line 3610  def eigenvalues(arg): Line 3605  def eigenvalues(arg):
3605    
3606  def eigenvalues_and_eigenvectors(arg):  def eigenvalues_and_eigenvectors(arg):
3607      """      """
3608      returns the eigenvalues of the square matrix arg.      returns the eigenvalues and eigenvectors of the square matrix arg.
3609    
3610      @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.
3611                  arg must be symmetric, ie. transpose(arg)==arg (this is not checked).                  arg must be symmetric, ie. transpose(arg)==arg (this is not checked).
3612      @type arg: L{numarray.NumArray}, L{escript.Data}, L{Symbol}      @type arg: L{escript.Data}
3613      @return: the eigenvalues in increasing order.      @return: the eigenvalues and eigenvectors. The eigenvalues are ordered by increasing value. The
3614      @rtype: L{numarray.NumArray},L{escript.Data}, L{Symbol} depending on the input.               eigenvectors are orthogonal and normalized. If V are the eigenvectors than V[:,i] is
3615      @remark: for L{escript.Data} and L{Symbol} objects the dimension is restricted to 3.               the eigenvector coresponding to the i-th eigenvalue.
3616        @rtype: L{tuple} of L{escript.Data}.
3617        @remark: The dimension is restricted to 3.
3618      """      """
3619      if isinstance(arg,numarray.NumArray):      if isinstance(arg,numarray.NumArray):
3620        raise TypeError,"eigenvalues_and_eigenvectors is not supporting numarray arguments"        raise TypeError,"eigenvalues_and_eigenvectors is not supporting numarray arguments"

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

  ViewVC Help
Powered by ViewVC 1.1.26