Package esys :: Package escript :: Module util
[show private | hide private]
[frames | no frames]

Module esys.escript.util

Utility functions for escript
Classes
Abs_Symbol Symbol representing the result of the absolute value function
Acos_Symbol Symbol representing the result of the inverse cosine function
Acosh_Symbol Symbol representing the result of the inverse hyperolic cosine function
Add_Symbol Symbol representing the sum of two arguments.
Asin_Symbol Symbol representing the result of the inverse sine function
Asinh_Symbol Symbol representing the result of the inverse hyperbolic sine function
Atan_Symbol Symbol representing the result of the inverse tangent function
Atanh_Symbol Symbol representing the result of the inverse hyperbolic tangent function
Cos_Symbol Symbol representing the result of the cosine function
Cosh_Symbol Symbol representing the result of the hyperbolic cosine function
DependendSymbol DependendSymbol extents L{Symbol} by modifying the == operator to allow two instances to be equal.
Exp_Symbol Symbol representing the result of the exponential function
GeneralTensorProduct_Symbol Symbol representing the quotient of two arguments.
GetSlice_Symbol Symbol representing getting a slice for a Symbol
Grad_Symbol Symbol representing the result of the gradient operator
Integrate_Symbol Symbol representing the result of the spatial integration operator
Interpolate_Symbol Symbol representing the result of the interpolation operator
Inverse_Symbol Symbol representing the result of the inverse function
Log_Symbol Symbol representing the result of the natural logarithm function
Maxval_Symbol Symbol representing the result of the maximum value function
Minval_Symbol Symbol representing the result of the minimum value function
Mult_Symbol Symbol representing the product of two arguments.
Power_Symbol Symbol representing the first argument to the power of the second argument.
Quotient_Symbol Symbol representing the quotient of two arguments.
Sin_Symbol Symbol representing the result of the sine function
Sinh_Symbol Symbol representing the result of the hyperbolic sine function
Sqrt_Symbol Symbol representing the result of the square root function
Symbol Symbol class.
Tan_Symbol Symbol representing the result of the tangent function
Tanh_Symbol Symbol representing the result of the hyperbolic tangent function
Trace_Symbol Symbol representing the result of the trace function
Transpose_Symbol Symbol representing the result of the transpose function
WhereNegative_Symbol Symbol representing the result of the mask of positive values function
WherePositive_Symbol Symbol representing the result of the mask of positive values function
WhereZero_Symbol Symbol representing the result of the mask of zero entries function

Function Summary
  acos(arg)
returns inverse cosine of argument arg
  acosh(arg)
returns inverse hyperolic cosine of argument arg
escript.Symbol, float, int, escript.Data, numarray.NumArray. add(arg0, arg1)
adds arg0 and arg1 together.
  asin(arg)
returns inverse sine of argument arg
  asinh(arg)
returns inverse hyperbolic sine of argument arg
  atan(arg)
returns inverse tangent of argument arg
  atanh(arg)
returns inverse hyperbolic tangent of argument arg
numarray.NumArray, escript.Data, Symbol, int or float depending on the input clip(arg, minval, maxval)
cuts the values of arg between minval and maxval
int or None commonDim(*args)
identifies, if possible, the spatial dimension across a set of objects which may or my not have a spatial dimension.
tuple of int commonShape(arg0, arg1)
returns a shape to which arg0 can be extendent from the right and arg1 can be extended from the left.
  cos(arg)
returns cosine of argument arg
  cosh(arg)
returns hyperbolic cosine of argument arg
escript.Data or Symbol div(arg, where)
returns the divergence of arg at where.
numarray.NumArray,escript.Data, Symbol depending on the input. eigenvalues(arg)
returns the eigenvalues of the square matrix arg.
tuple of escript.Data. eigenvalues_and_eigenvectors(arg)
returns the eigenvalues and eigenvectors of the square matrix arg.
  escript_generalTensorProduct(arg0, arg1, axis_offset)
arg0 and arg1 are both Data objects but not neccesrily on the same function space.
  escript_inverse(arg)
arg is a Data objects!!!
  escript_nonsymmetric(arg)
  escript_symmetric(arg)
  escript_trace(arg, axis_offset)
arg si a Data objects!!!
  escript_transpose(arg, axis_offset)
arg si a Data objects!!!
  exp(arg)
returns exponential of argument arg
  generalTensorProduct(arg0, arg1, axis_offset)
generalized tensor product out[s,t]=S{Sigma}_r arg0[s,r]*arg1[r,t] where s runs through arg0.Shape[:arg0.Rank-axis_offset] r runs trough arg0.Shape[:axis_offset] t runs through arg1.Shape[axis_offset:] In the first case the the second dimension of arg0 and the length of arg1 must match and in the second case the two last dimensions of arg0 must match the shape of arg1.
escript.Data or Symbol grad(arg, where)
Returns the spatial gradient of arg at where.
numarray.NumArray of rank 1, rankk 2 or rank 4. identity(shape)
return the shape x shape identity tensor
  identityTensor(d)
return the dxd identity matrix
  identityTensor4(d)
return the dxdxdxd identity tensor
float inf(arg)
returns the maximum value over all data points.
numarray.NumArray, escript.Data, Symbol, float depending on the input inner(arg0, arg1)
inner product of the two argument:
float, numarray.NumArray or Symbol integrate(arg, where)
Return the integral of the function arg over its domain.
escript.Data or Symbol interpolate(arg, where)
interpolates the function into the FunctionSpace where.
numarray.NumArray, escript.Data, Symbol depending on the input inverse(arg)
returns the inverse of the square matrix arg.
escript.Data or Symbol jump(arg, domain)
returns the jump of arg across the continuity of the domain
  kronecker(d)
return the kronecker δ-symbol
float or Symbol L2(arg)
returns the L2 norm of arg at where
  length(arg)
returns length/Euclidean norm of argument arg at each data point
  log(arg)
returns natural logarithm of argument arg
  log10(arg)
returns base-10 logarithm of argument arg
float Lsup(arg)
returns the Lsup-norm of argument arg.
list of int matchShape(arg0, arg1)
If shape is not given the shape "largest" shape of args is used.
tuple of two numarray.NumArray, two escript.Data, a Symbol and one of the types numarray.NumArray or escript.Data. matchType(arg0, arg1)
converting arg0 and arg1 both to the same type numarray.NumArray or escript.Data or, if one of arg0 or arg1 is of type Symbol, the other one to be of type numarray.NumArray or escript.Data.
  matrixmult(arg0, arg1)
matrix-matrix or matrix-vector product of the two argument: out[s0]=S{Sigma}_{r0} arg0[s0,r0]*arg1[r0] or out[s0,s1]=S{Sigma}_{r0} arg0[s0,r0]*arg1[r0,s1] The second dimension of arg0 and the length of arg1 must match.
numarray.NumArray, escript.Data, Symbol, int or float depending on the input maximum(*args)
the maximum over arguments args
  maxval(arg)
returns maximum value over all components of arg at each data point
numarray.NumArray, escript.Data, Symbol, int or float depending on the input minimum(*args)
the minimum over arguments args
  minval(arg)
returns minimum value over all components of arg at each data point
escript.Symbol, float, int, escript.Data, numarray.NumArray. mult(arg0, arg1)
product of arg0 and arg1
numarray.NumArray, escript.Data, Symbol depending on the input nonsymmetric(arg)
returns the nonsymmetric part of the square matrix arg.
  outer(arg0, arg1)
the outer product of the two argument:...
int or None pokeDim(arg)
identifies the spatial dimension of its argument
tuple of int pokeShape(arg)
identifies the shape of its argument
escript.Symbol, float, int, escript.Data, numarray.NumArray. power(arg0, arg1)
raises arg0 to the power of arg1
escript.Symbol, float, int, escript.Data, numarray.NumArray. quotient(arg0, arg1)
quotient of arg0 and arg1
  reorderComponents(arg, index)
resorts the component of arg according to index
  saveDX(filename, domain, **data)
writes a L{Data} objects into a files using the the DX file format.
  saveVTK(filename, domain, **data)
writes a L{Data} objects into a files using the the VTK XML file format.
  sign(arg)
returns sign of argument arg
  sin(arg)
returns sine of argument arg
  sinh(arg)
returns hyperbolic sine of argument arg
  sqrt(arg)
returns square root of argument arg
float sup(arg)
returns the maximum value over all data points.
numarray.NumArray, escript.Data, Symbol depending on the input symmetric(arg)
returns the symmetric part of the square matrix arg.
  tan(arg)
returns tangent of argument arg
  tanh(arg)
returns hyperbolic tangent of argument arg
  tensormult(arg0, arg1)
the tensor product of the two argument: for arg0 of rank 2 this is out[s0]=S{Sigma}_{r0} arg0[s0,r0]*arg1[r0] or out[s0,s1]=S{Sigma}_{r0} arg0[s0,r0]*arg1[r0,s1] and for arg0 of rank 4 this is out[s0,s1,s2,s3]=S{Sigma}_{r0,r1} arg0[s0,s1,r0,r1]*arg1[r0,r1,s2,s3] or out[s0,s1,s2]=S{Sigma}_{r0,r1} arg0[s0,s1,r0,r1]*arg1[r0,r1,s2] or out[s0,s1]=S{Sigma}_{r0,r1} arg0[s0,s1,r0,r1]*arg1[r0,r1] In the first case the the second dimension of arg0 and the length of arg1 must match and in the second case the two last dimensions of arg0 must match the shape of arg1.
  testForZero(arg)
test the argument for being identical to Zero
escript.Data, Symbol, numarray.NumArray depending on the type of arg. trace(arg, axis_offset)
returns the trace of arg which the sum of arg[k,k] over k.
escript.Data, Symbol, numarray.NumArray,float, int depending on the type of arg. transpose(arg, axis_offset)
returns the transpose of arg by swaping the first axis_offset and the last rank-axis_offset components.
  unitVector(i, d)
return a unit vector u of dimension d with nonzero index i:
  whereNegative(arg)
returns mask of positive values of argument arg
  whereNonNegative(arg)
returns mask of non-negative values of argument arg
  whereNonPositive(arg)
returns mask of non-positive values of argument arg
  whereNonZero(arg, tol)
returns mask of values different from zero of argument arg
  wherePositive(arg)
returns mask of positive values of argument arg
  whereZero(arg, tol)
returns mask of zero entries of argument arg

Variable Summary
str __author__: name of author
str __copyright__: copyrights
str __date__: date of the version
str __license__: licence agreement
str __url__: url entry point on documentation
str __version__: version

Function Details

acos(arg)

returns inverse cosine of argument arg
Parameters:
arg - argument
           (type=float, escript.Data, Symbol, numarray.NumArray. @rtype:float, escript.Data, Symbol, numarray.NumArray depending on the type of arg.)
Raises:
TypeError - if the type of the argument is not expected.

acosh(arg)

returns inverse hyperolic cosine of argument arg
Parameters:
arg - argument
           (type=float, escript.Data, Symbol, numarray.NumArray. @rtype:float, escript.Data, Symbol, numarray.NumArray depending on the type of arg.)
Raises:
TypeError - if the type of the argument is not expected.

add(arg0, arg1)

adds arg0 and arg1 together.
Parameters:
arg0 - first term
           (type=escript.Symbol, float, int, escript.Data, numarray.NumArray.)
arg1 - second term
           (type=escript.Symbol, float, int, escript.Data, numarray.NumArray.)
Returns:
the some of arg0 and arg1
           (type=escript.Symbol, float, int, escript.Data, numarray.NumArray.)

Note: The shape of both arguments is matched according to the rules in used in matchShape

asin(arg)

returns inverse sine of argument arg
Parameters:
arg - argument
           (type=float, escript.Data, Symbol, numarray.NumArray. @rtype:float, escript.Data, Symbol, numarray.NumArray depending on the type of arg.)
Raises:
TypeError - if the type of the argument is not expected.

asinh(arg)

returns inverse hyperbolic sine of argument arg
Parameters:
arg - argument
           (type=float, escript.Data, Symbol, numarray.NumArray. @rtype:float, escript.Data, Symbol, numarray.NumArray depending on the type of arg.)
Raises:
TypeError - if the type of the argument is not expected.

atan(arg)

returns inverse tangent of argument arg
Parameters:
arg - argument
           (type=float, escript.Data, Symbol, numarray.NumArray. @rtype:float, escript.Data, Symbol, numarray.NumArray depending on the type of arg.)
Raises:
TypeError - if the type of the argument is not expected.

atanh(arg)

returns inverse hyperbolic tangent of argument arg
Parameters:
arg - argument
           (type=float, escript.Data, Symbol, numarray.NumArray. @rtype:float, escript.Data, Symbol, numarray.NumArray depending on the type of arg.)
Raises:
TypeError - if the type of the argument is not expected.

clip(arg, minval=0.0, maxval=1.0)

cuts the values of arg between minval and maxval
Parameters:
arg - argument
           (type=float)
minval - lower range
maxval - upper range
Returns:
is on object with all its value between minval and maxval. value of the argument that greater then minval and less then maxval are unchanged.
           (type=numarray.NumArray, escript.Data, Symbol, int or float depending on the input)
Raises:
ValueError - if minval>maxval

commonDim(*args)

identifies, if possible, the spatial dimension across a set of objects which may or my not have a spatial dimension.
Returns:
the spatial dimension of the objects with identifiable dimension (see pokeDim). If none the objects has a spatial dimension None is returned.
           (type=int or None)
Raises:
ValueError - if the objects with identifiable dimension don't have the same spatial dimension.

commonShape(arg0, arg1)

returns a shape to which arg0 can be extendent from the right and arg1 can be extended from the left.
Parameters:
arg0 - an object with a shape (see pokeShape)
arg1 - an object with a shape (see pokeShape)
Returns:
the shape of arg0 or arg1 such that the left port equals the shape of arg0 and the right end equals the shape of arg1.
           (type=tuple of int)
Raises:
ValueError - if no shape can be found.

cos(arg)

returns cosine of argument arg
Parameters:
arg - argument
           (type=float, escript.Data, Symbol, numarray.NumArray. @rtype:float, escript.Data, Symbol, numarray.NumArray depending on the type of arg.)
Raises:
TypeError - if the type of the argument is not expected.

cosh(arg)

returns hyperbolic cosine of argument arg
Parameters:
arg - argument
           (type=float, escript.Data, Symbol, numarray.NumArray. @rtype:float, escript.Data, Symbol, numarray.NumArray depending on the type of arg.)
Raises:
TypeError - if the type of the argument is not expected.

div(arg, where=None)

returns the divergence of arg at where.
Parameters:
arg - function which divergence to be calculated. Its shape has to be (d,) where d is the spatial dimension.
           (type=escript.Data or Symbol)
where - FunctionSpace in which the divergence will be calculated. If not present or None an appropriate default is used.
           (type=None or escript.FunctionSpace)
Returns:
divergence of arg.
           (type=escript.Data or Symbol)

eigenvalues(arg)

returns the eigenvalues of the square matrix arg.
Parameters:
arg - square matrix. Must have rank 2 and the first and second dimension must be equal. arg must be symmetric, ie. transpose(arg)==arg (this is not checked).
           (type=numarray.NumArray, escript.Data, Symbol)
Returns:
the eigenvalues in increasing order.
           (type=numarray.NumArray,escript.Data, Symbol depending on the input.)

eigenvalues_and_eigenvectors(arg)

returns the eigenvalues and eigenvectors of the square matrix arg.
Parameters:
arg - square matrix. Must have rank 2 and the first and second dimension must be equal. arg must be symmetric, ie. transpose(arg)==arg (this is not checked).
           (type=escript.Data)
Returns:
the eigenvalues and eigenvectors. The eigenvalues are ordered by increasing value. The eigenvectors are orthogonal and normalized. If V are the eigenvectors than V[:,i] is the eigenvector coresponding to the i-th eigenvalue.
           (type=tuple of escript.Data.)

escript_generalTensorProduct(arg0, arg1, axis_offset)

arg0 and arg1 are both Data objects but not neccesrily on the same function space. they could be identical!!!

escript_inverse(arg)

arg is a Data objects!!!

escript_trace(arg, axis_offset)

arg si a Data objects!!!

escript_transpose(arg, axis_offset)

arg si a Data objects!!!

exp(arg)

returns exponential of argument arg
Parameters:
arg - argument
           (type=float, escript.Data, Symbol, numarray.NumArray. @rtype:float, escript.Data, Symbol, numarray.NumArray depending on the type of arg.)
Raises:
TypeError - if the type of the argument is not expected.

generalTensorProduct(arg0, arg1, axis_offset=0)

generalized tensor product 

out[s,t]=S{Sigma}_r arg0[s,r]*arg1[r,t]

where s runs through arg0.Shape[:arg0.Rank-axis_offset]
      r runs trough arg0.Shape[:axis_offset]
      t runs through arg1.Shape[axis_offset:]

In the first case the the second dimension of arg0 and the length of arg1 must match and  
in the second case the two last dimensions of arg0 must match the shape of arg1.

@param arg0: first argument
@type arg0: L{numarray.NumArray}, L{escript.Data}, L{Symbol}, C{float}, C{int}
@param arg1: second argument of shape greater of 1 or 2 depending on rank of arg0
@type arg1: L{numarray.NumArray}, L{escript.Data}, L{Symbol}, C{float}, C{int}
@return: the general tensor product of arg0 and arg1 at each data point. 
@rtype: L{numarray.NumArray}, L{escript.Data}, L{Symbol} depending on the input

grad(arg, where=None)

Returns the spatial gradient of arg at where.

If g is the returned object, then
  • if arg is rank 0 g[s] is the derivative of arg with respect to the s-th spatial dimension.
  • if arg is rank 1 g[i,s] is the derivative of arg[i] with respect to the s-th spatial dimension.
  • if arg is rank 2 g[i,j,s] is the derivative of arg[i,j] with respect to the s-th spatial dimension.
  • if arg is rank 3 g[i,j,k,s] is the derivative of arg[i,j,k] with respect to the s-th spatial dimension.
Parameters:
arg - function which gradient to be calculated. Its rank has to be less than 3.
           (type=escript.Data or Symbol)
where - FunctionSpace in which the gradient will be calculated. If not present or None an appropriate default is used.
           (type=None or escript.FunctionSpace)
Returns:
gradient of arg.
           (type=escript.Data or Symbol)

identity(shape=())

return the shape x shape identity tensor
Parameters:
shape - input shape for the identity tensor
           (type=tuple of int)
Returns:
array of shape shape x shape with u[i,k]=1 for i=k and u[i,k]=0 otherwise for len(shape)=1 and, for len(shape)=2: u[i,j,k,l]=1 for i=k and j=l and u[i,j,k,l]=0 otherwise.
           (type=numarray.NumArray of rank 1, rankk 2 or rank 4.)
Raises:
ValueError - if len(shape)>2.

identityTensor(d=3)

return the dxd identity matrix
Parameters:
d - dimension or an object that has the getDim method defining the dimension
           (type=int, escript.Domain or escript.FunctionSpace)
Returns:
the object u of rank 2 with u[i,j]=1 for i=j and u[i,j]=0 otherwise

identityTensor4(d=3)

return the dxdxdxd identity tensor
Parameters:
d - dimension or an object that has the getDim method defining the dimension
           (type=int or any object with a getDim method)
Returns:
the object u of rank 4 with u[i,j,k,l]=1 for i=k and j=l and u[i,j,k,l]=0 otherwise

inf(arg)

returns the maximum value over all data points.
Parameters:
arg - argument
           (type=float, int, escript.Data, numarray.NumArray. @return : minimum value of arg over all components and all data points)
Returns:
float
Raises:
TypeError - if type of arg cannot be processed

inner(arg0, arg1)

inner product of the two argument:

out=Σ_s arg0[s]*arg1[s]

where s runs through arg0.Shape.

arg0 and arg1 must have the same shape.
Parameters:
arg0 - first argument
           (type=numarray.NumArray, escript.Data, Symbol, float, int)
arg1 - second argument
           (type=numarray.NumArray, escript.Data, Symbol, float, int @return : the inner product of arg0 and arg1 at each data point)
Returns:
numarray.NumArray, escript.Data, Symbol, float depending on the input
Raises:
ValueError - if the shapes of the arguments are not identical

integrate(arg, where=None)

Return the integral of the function arg over its domain. If where is present arg is interpolated to where before integration.
Parameters:
arg - the function which is integrated.
           (type=escript.Data or Symbol)
where - FunctionSpace in which the integral is calculated. If not present or None an appropriate default is used.
           (type=None or escript.FunctionSpace)
Returns:
integral of arg.
           (type=float, numarray.NumArray or Symbol)

interpolate(arg, where)

interpolates the function into the FunctionSpace where.
Parameters:
arg - interpolant
           (type=escript.Data or Symbol)
where - FunctionSpace to be interpolated to
           (type=escript.FunctionSpace)
Returns:
interpolated argument
           (type=escript.Data or Symbol)

inverse(arg)

returns the inverse of the square matrix arg.
Parameters:
arg - square matrix. Must have rank 2 and the first and second dimension must be equal.
           (type=numarray.NumArray, escript.Data, Symbol)
Returns:
inverse arg_inv of the argument. It will be matrixmul(inverse(arg),arg) almost equal to kronecker(arg.getShape()[0])
           (type=numarray.NumArray, escript.Data, Symbol depending on the input)

jump(arg, domain=None)

returns the jump of arg across the continuity of the domain
Parameters:
arg - argument
           (type=escript.Data or Symbol)
domain - the domain where the discontinuity is located. If domain is not present or equal to None the domain of arg is used. If arg is a Symbol the domain must be present.
           (type=None or escript.Domain)
Returns:
jump of arg
           (type=escript.Data or Symbol)

kronecker(d=3)

return the kronecker δ-symbol
Parameters:
d - dimension or an object that has the getDim method defining the dimension
           (type=int, escript.Domain or escript.FunctionSpace)
Returns:
the object u of rank 2 with u[i,j]=1 for i=j and u[i,j]=0 otherwise

L2(arg)

returns the L2 norm of arg at where
Parameters:
arg - function which L2 to be calculated.
           (type=escript.Data or Symbol)
Returns:
L2 norm of arg.
           (type=float or Symbol)

Note: L2(arg) is equivalent to sqrt(integrate(inner(arg,arg)))

length(arg)

returns length/Euclidean norm of argument arg at each data point
Parameters:
arg - argument
           (type=float, escript.Data, Symbol, numarray.NumArray. @rtype:float, escript.Data, Symbol depending on the type of arg.)

log(arg)

returns natural logarithm of argument arg
Parameters:
arg - argument
           (type=float, escript.Data, Symbol, numarray.NumArray. @rtype:float, escript.Data, Symbol, numarray.NumArray depending on the type of arg.)
Raises:
TypeError - if the type of the argument is not expected.

log10(arg)

returns base-10 logarithm of argument arg
Parameters:
arg - argument
           (type=float, escript.Data, Symbol, numarray.NumArray. @rtype:float, escript.Data, Symbol, numarray.NumArray depending on the type of arg.)
Raises:
TypeError - if the type of the argument is not expected.

Lsup(arg)

returns the Lsup-norm of argument arg. This is the maximum absolute value over all data points. This function is equivalent to sup(abs(arg)).
Parameters:
arg - argument
           (type=float, int, escript.Data, numarray.NumArray.)
Returns:
maximum value of the absolute value of arg over all components and all data points
           (type=float)
Raises:
TypeError - if type of arg cannot be processed

matchShape(arg0, arg1)

If shape is not given the shape "largest" shape of args is used.
Returns:
True if the argument is identical to zero.
           (type=list of int)

matchType(arg0=0.0, arg1=0.0)

converting arg0 and arg1 both to the same type numarray.NumArray or escript.Data or, if one of arg0 or arg1 is of type Symbol, the other one to be of type numarray.NumArray or escript.Data.
Parameters:
arg0 - first argument
           (type=

numarray.NumArray,escript.Data,float, int, Symbol)

arg1 - second argument
           (type=

numarray.NumArray,escript.Data,float, int, Symbol)

Returns:
a tuple representing arg0 and arg1 with the same type or with one of them being a Symbol
           (type=tuple of two numarray.NumArray, two escript.Data, a Symbol and one of the types numarray.NumArray or escript.Data.)
Raises:
TypeError - if type of arg0 or arg1 cannot be processed

matrixmult(arg0, arg1)

matrix-matrix or matrix-vector product of the two argument:

out[s0]=S{Sigma}_{r0} arg0[s0,r0]*arg1[r0] 

      or 

out[s0,s1]=S{Sigma}_{r0} arg0[s0,r0]*arg1[r0,s1] 

The second dimension of arg0 and the length of arg1 must match.

@param arg0: first argument of rank 2
@type arg0: L{numarray.NumArray}, L{escript.Data}, L{Symbol}
@param arg1: second argument of at least rank 1
@type arg1: L{numarray.NumArray}, L{escript.Data}, L{Symbol}
@return: the matrix-matrix or matrix-vector product of arg0 and arg1 at each data point
@rtype: L{numarray.NumArray}, L{escript.Data}, L{Symbol} depending on the input
@raise ValueError: if the shapes of the arguments are not appropriate

maximum(*args)

the maximum over arguments args
Parameters:
args - arguments
           (type=numarray.NumArray, escript.Data, Symbol, int or float)
Returns:
is on object which gives at each entry the maximum of the coresponding values all args
           (type=numarray.NumArray, escript.Data, Symbol, int or float depending on the input)

maxval(arg)

returns maximum value over all components of arg at each data point
Parameters:
arg - argument
           (type=float, escript.Data, Symbol, numarray.NumArray. @rtype:float, escript.Data, Symbol depending on the type of arg.)
Raises:
TypeError - if the type of the argument is not expected.

minimum(*args)

the minimum over arguments args
Parameters:
args - arguments
           (type=numarray.NumArray, escript.Data, Symbol, int or float)
Returns:
is on object which gives at each entry the minimum of the coresponding values all args
           (type=numarray.NumArray, escript.Data, Symbol, int or float depending on the input)

minval(arg)

returns minimum value over all components of arg at each data point
Parameters:
arg - argument
           (type=float, escript.Data, Symbol, numarray.NumArray. @rtype:float, escript.Data, Symbol depending on the type of arg.)
Raises:
TypeError - if the type of the argument is not expected.

mult(arg0, arg1)

product of arg0 and arg1
Parameters:
arg0 - first term
           (type=escript.Symbol, float, int, escript.Data, numarray.NumArray.)
arg1 - second term
           (type=escript.Symbol, float, int, escript.Data, numarray.NumArray.)
Returns:
the some of arg0 and arg1
           (type=escript.Symbol, float, int, escript.Data, numarray.NumArray.)

Note: The shape of both arguments is matched according to the rules in used in matchShape

nonsymmetric(arg)

returns the nonsymmetric part of the square matrix arg. This is (arg-transpose(arg))/2
Parameters:
arg - square matrix. Must have rank 2 or 4 and be square.
           (type=numarray.NumArray, escript.Data, Symbol)
Returns:
nonsymmetric part of arg
           (type=numarray.NumArray, escript.Data, Symbol depending on the input)

outer(arg0, arg1)

the outer product of the two argument:

out[t,s]=arg0[t]*arg1[s]

where s runs through arg0.Shape
      t runs through arg1.Shape

@param arg0: first argument 
@type arg0: L{numarray.NumArray}, L{escript.Data}, L{Symbol}, C{float}, C{int}
@param arg1: second argument 
@type arg1: L{numarray.NumArray}, L{escript.Data}, L{Symbol}, C{float}, C{int}
@return: the outer product of arg0 and arg1 at each data point
@rtype: L{numarray.NumArray}, L{escript.Data}, L{Symbol} depending on the input

pokeDim(arg)

identifies the spatial dimension of its argument
Parameters:
arg - a given object
           (type=any)
Returns:
the spatial dimension of the argument, if available, or None
           (type=int or None)

pokeShape(arg)

identifies the shape of its argument
Parameters:
arg - a given object
           (type=

numarray.NumArray,escript.Data,float, int, Symbol)

Returns:
the shape of the argument
           (type=tuple of int)
Raises:
TypeError - if type of arg cannot be processed

power(arg0, arg1)

raises arg0 to the power of arg1
Parameters:
arg0 - basis
           (type=escript.Symbol, float, int, escript.Data, numarray.NumArray.)
arg1 - exponent
           (type=escript.Symbol, float, int, escript.Data, numarray.NumArray.)
Returns:
of arg0 and arg1
           (type=escript.Symbol, float, int, escript.Data, numarray.NumArray.)

Note: The shape of both arguments is matched according to the rules in used in matchShape

quotient(arg0, arg1)

quotient of arg0 and arg1
Parameters:
arg0 - numerator
           (type=escript.Symbol, float, int, escript.Data, numarray.NumArray.)
arg1 - denominator
           (type=escript.Symbol, float, int, escript.Data, numarray.NumArray.)
Returns:
the some of arg0 and arg1
           (type=escript.Symbol, float, int, escript.Data, numarray.NumArray.)

Note: The shape of both arguments is matched according to the rules in used in matchShape

reorderComponents(arg, index)

resorts the component of arg according to index

saveDX(filename, domain=None, **data)

writes a L{Data} objects into a files using the the DX file format.

Example:

   tmp=Scalar(..)
   v=Vector(..)
   saveDX("solution.dx",temperature=tmp,velovity=v)

tmp and v are written into "solution.dx" where tmp is named "temperature" and v is named "velovity".

@param filename: file name of the output file
@type filename: C{str}
@param domain: domain of the L{Data} object. If not specified, the domain of the given L{Data} objects is used.
@type domain: L{escript.Domain}
@keyword <name>: writes the assigned value to the DX file using <name> as identifier. The identifier can be used to select the data set when data are imported into DX.
@type <name>: L{Data} object.
@note: The data objects have to be defined on the same domain. They may not be in the same L{FunctionSpace} but one cannot expect that all L{FunctionSpace} can be mixed. Typically, data on the boundary and data on the interior cannot be mixed.

saveVTK(filename, domain=None, **data)

writes a L{Data} objects into a files using the the VTK XML file format.

Example:

   tmp=Scalar(..)
   v=Vector(..)
   saveVTK("solution.xml",temperature=tmp,velovity=v)

tmp and v are written into "solution.xml" where tmp is named "temperature" and v is named "velovity"

@param filename: file name of the output file
@type filename: C{str}
@param domain: domain of the L{Data} object. If not specified, the domain of the given L{Data} objects is used.
@type domain: L{escript.Domain}
@keyword <name>: writes the assigned value to the VTK file using <name> as identifier.
@type <name>: L{Data} object.
@note: The data objects have to be defined on the same domain. They may not be in the same L{FunctionSpace} but one cannot expect that all L{FunctionSpace} can be mixed. Typically, data on the boundary and data on the interior cannot be mixed.

sign(arg)

returns sign of argument arg
Parameters:
arg - argument
           (type=float, escript.Data, Symbol, numarray.NumArray. @rtype:float, escript.Data, Symbol, numarray.NumArray depending on the type of arg.)
Raises:
TypeError - if the type of the argument is not expected.

sin(arg)

returns sine of argument arg
Parameters:
arg - argument
           (type=float, escript.Data, Symbol, numarray.NumArray. @rtype:float, escript.Data, Symbol, numarray.NumArray depending on the type of arg.)
Raises:
TypeError - if the type of the argument is not expected.

sinh(arg)

returns hyperbolic sine of argument arg
Parameters:
arg - argument
           (type=float, escript.Data, Symbol, numarray.NumArray. @rtype:float, escript.Data, Symbol, numarray.NumArray depending on the type of arg.)
Raises:
TypeError - if the type of the argument is not expected.

sqrt(arg)

returns square root of argument arg
Parameters:
arg - argument
           (type=float, escript.Data, Symbol, numarray.NumArray. @rtype:float, escript.Data, Symbol, numarray.NumArray depending on the type of arg.)
Raises:
TypeError - if the type of the argument is not expected.

sup(arg)

returns the maximum value over all data points.
Parameters:
arg - argument
           (type=float, int, escript.Data, numarray.NumArray.)
Returns:
maximum value of arg over all components and all data points
           (type=float)
Raises:
TypeError - if type of arg cannot be processed

symmetric(arg)

returns the symmetric part of the square matrix arg. This is (arg+transpose(arg))/2
Parameters:
arg - square matrix. Must have rank 2 or 4 and be square.
           (type=numarray.NumArray, escript.Data, Symbol)
Returns:
symmetric part of arg
           (type=numarray.NumArray, escript.Data, Symbol depending on the input)

tan(arg)

returns tangent of argument arg
Parameters:
arg - argument
           (type=float, escript.Data, Symbol, numarray.NumArray. @rtype:float, escript.Data, Symbol, numarray.NumArray depending on the type of arg.)
Raises:
TypeError - if the type of the argument is not expected.

tanh(arg)

returns hyperbolic tangent of argument arg
Parameters:
arg - argument
           (type=float, escript.Data, Symbol, numarray.NumArray. @rtype:float, escript.Data, Symbol, numarray.NumArray depending on the type of arg.)
Raises:
TypeError - if the type of the argument is not expected.

tensormult(arg0, arg1)

the tensor product of the two argument:


for arg0 of rank 2 this is

out[s0]=S{Sigma}_{r0} arg0[s0,r0]*arg1[r0]  

             or 

out[s0,s1]=S{Sigma}_{r0} arg0[s0,r0]*arg1[r0,s1] 


and for arg0 of rank 4 this is 

out[s0,s1,s2,s3]=S{Sigma}_{r0,r1} arg0[s0,s1,r0,r1]*arg1[r0,r1,s2,s3] 
          
             or

out[s0,s1,s2]=S{Sigma}_{r0,r1} arg0[s0,s1,r0,r1]*arg1[r0,r1,s2] 

             or 

out[s0,s1]=S{Sigma}_{r0,r1} arg0[s0,s1,r0,r1]*arg1[r0,r1] 

In the first case the the second dimension of arg0 and the length of arg1 must match and  
in the second case the two last dimensions of arg0 must match the shape of arg1.

@param arg0: first argument of rank 2 or 4
@type arg0: L{numarray.NumArray}, L{escript.Data}, L{Symbol}
@param arg1: second argument of shape greater of 1 or 2 depending on rank of arg0
@type arg1: L{numarray.NumArray}, L{escript.Data}, L{Symbol}
@return: the tensor product of arg0 and arg1 at each data point
@rtype: L{numarray.NumArray}, L{escript.Data}, L{Symbol} depending on the input

testForZero(arg)

test the argument for being identical to Zero
Parameters:
arg - a given object
           (type=typically numarray.NumArray,escript.Data,float, int @return : True if the argument is identical to zero. @rtype : bool)

trace(arg, axis_offset=0)

returns the trace of arg which the sum of arg[k,k] over k.
Parameters:
arg - argument
           (type=escript.Data, Symbol, numarray.NumArray.)
axis_offset - axis_offset to components to sum over. axis_offset must be non-negative and less than the rank of arg +1. The dimensions on component axis_offset and axis_offset+1 must be equal.
           (type=int)
Returns:
trace of arg. The rank of the returned object is minus 2 of the rank of arg.
           (type=escript.Data, Symbol, numarray.NumArray depending on the type of arg.)

transpose(arg, axis_offset=None)

returns the transpose of arg by swaping the first axis_offset and the last rank-axis_offset components.
Parameters:
arg - argument
           (type=escript.Data, Symbol, numarray.NumArray, float, int)
axis_offset - the first axis_offset components are swapped with rest. If axis_offset must be non-negative and less or equal the rank of arg. if axis_offset is not present int(r/2) where r is the rank of arg is used.
           (type=int)
Returns:
transpose of arg
           (type=escript.Data, Symbol, numarray.NumArray,float, int depending on the type of arg.)

unitVector(i=0, d=3)

return a unit vector u of dimension d with nonzero index i:
Parameters:
i - index
           (type=int)
d - dimension or an object that has the getDim method defining the dimension
           (type=int, escript.Domain or escript.FunctionSpace)
Returns:
the object u of rank 1 with u[j]=1 for j=i and u[i]=0 otherwise

whereNegative(arg)

returns mask of positive values of argument arg
Parameters:
arg - argument
           (type=float, escript.Data, Symbol, numarray.NumArray. @rtype:float, escript.Data, Symbol, numarray.NumArray depending on the type of arg.)
Raises:
TypeError - if the type of the argument is not expected.

whereNonNegative(arg)

returns mask of non-negative values of argument arg
Parameters:
arg - argument
           (type=float, escript.Data, Symbol, numarray.NumArray. @rtype:float, escript.Data, Symbol, numarray.NumArray depending on the type of arg.)
Raises:
TypeError - if the type of the argument is not expected.

whereNonPositive(arg)

returns mask of non-positive values of argument arg
Parameters:
arg - argument
           (type=float, escript.Data, Symbol, numarray.NumArray. @rtype:float, escript.Data, Symbol, numarray.NumArray depending on the type of arg.)
Raises:
TypeError - if the type of the argument is not expected.

whereNonZero(arg, tol=0.0)

returns mask of values different from zero of argument arg
Parameters:
arg - argument
           (type=float, escript.Data, Symbol, numarray.NumArray. @rtype:float, escript.Data, Symbol, numarray.NumArray depending on the type of arg.)
Raises:
TypeError - if the type of the argument is not expected.

wherePositive(arg)

returns mask of positive values of argument arg
Parameters:
arg - argument
           (type=float, escript.Data, Symbol, numarray.NumArray. @rtype:float, escript.Data, Symbol, numarray.NumArray depending on the type of arg.)
Raises:
TypeError - if the type of the argument is not expected.

whereZero(arg, tol=0.0)

returns mask of zero entries of argument arg
Parameters:
arg - argument
           (type=float, escript.Data, Symbol, numarray.NumArray.)
tol - tolerance. values with absolute value less then tol are accepted as zero.
           (type=float @rtype:float, escript.Data, Symbol, numarray.NumArray depending on the type of arg.)
Raises:
TypeError - if the type of the argument is not expected.

Variable Details

__author__

name of author
Type:
str
Value:
'Lutz Gross, l.gross@uq.edu.au'                                        

__copyright__

copyrights
Type:
str
Value:
'''  Copyright (c) 2006 by ACcESS MNRF
                    http://www.access.edu.au
                Primary Business: Queensland, Australia'''             

__date__

date of the version
Type:
str
Value:
'$Date: 2006-03-31 14:52:55 +1000 (Fri, 31 Mar 2006) $'                

__license__

licence agreement
Type:
str
Value:
'''Licensed under the Open Software License version 3.0
             http://www.opensource.org/licenses/osl-3.0.php'''         

__url__

url entry point on documentation
Type:
str
Value:
'http://www.iservo.edu.au/esys/escript'                                

__version__

version
Type:
str
Value:
'$Revision: 698 $'                                                     

Generated by Epydoc 2.1 on Thu Apr 27 11:16:20 2006 http://epydoc.sf.net