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

Type DependendSymbol

object --+    
         |    
    Symbol --+
             |
            DependendSymbol

Known Subclasses:
Abs_Symbol, Acos_Symbol, Acosh_Symbol, Add_Symbol, Asin_Symbol, Asinh_Symbol, Atan_Symbol, Atanh_Symbol, Cos_Symbol, Cosh_Symbol, Exp_Symbol, GeneralTensorProduct_Symbol, GetSlice_Symbol, Grad_Symbol, Integrate_Symbol, Interpolate_Symbol, Inverse_Symbol, Log_Symbol, Maxval_Symbol, Minval_Symbol, Mult_Symbol, Power_Symbol, Quotient_Symbol, Sin_Symbol, Sinh_Symbol, Sqrt_Symbol, Tan_Symbol, Tanh_Symbol, Trace_Symbol, Transpose_Symbol, WhereNegative_Symbol, WherePositive_Symbol, WhereZero_Symbol

DependendSymbol extents L{Symbol} by modifying the == operator to allow two instances to be equal. 
Two DependendSymbol are equal if they have the same shape, the same arguments and one of them has an unspecified spatial dimension or the spatial dimension is identical  

Example: 

u1=Symbol(shape=(3,4),dim=2,args=[4.])
u2=Symbol(shape=(3,4),dim=2,args=[4.])
print u1==u2
False

   but   

u1=DependendSymbol(shape=(3,4),dim=2,args=[4.])
u2=DependendSymbol(shape=(3,4),dim=2,args=[4.])
u3=DependendSymbol(shape=(2,),dim=2,args=[4.])   
print u1==u2, u1==u3
True False

@note: DependendSymbol should be used as return value of functions with L{Symbol} arguments. This will allow the optimizer to remove redundant function calls.

Method Summary
bool __eq__(self, other)
checks if other equals self
bool __ne__(self, other)
checks if other equals self
    Inherited from Symbol
  __init__(self, shape, args, dim)
Creates an instance of a symbol of a given shape.
  __abs__(self)
returns a S{Symbol} representing the absolute value of the object.
  __add__(self, other)
add another object to this object @param other: object to be added to this object @type other: L{escript.Symbol}, C{float}, L{escript.Data}, L{numarray.NumArray}.
  __div__(self, other)
divides this object by other object @param other: object dividing this object @type other: L{escript.Symbol}, C{float}, L{escript.Data}, L{numarray.NumArray}.
  __getitem__(self, index)
returns the slice defined by index...
  __mul__(self, other)
multiplies this object with other object @param other: object to be mutiplied by this object @type other: L{escript.Symbol}, C{float}, L{escript.Data}, L{numarray.NumArray}.
  __neg__(self)
returns -self.
  __pos__(self)
returns +self.
  __pow__(self, other)
raises this object to the power of other @param other: exponent @type other: L{escript.Symbol}, C{float}, L{escript.Data}, L{numarray.NumArray}.
  __radd__(self, other)
add this object to another object @param other: object this object is added to @type other: L{escript.Symbol}, C{float}, L{escript.Data}, L{numarray.NumArray}.
  __rdiv__(self, other)
divides this object by other object @param other: object dividing this object @type other: L{escript.Symbol}, C{float}, L{escript.Data}, L{numarray.NumArray}.
  __rmul__(self, other)
multiplies this object with other object @param other: object this object is multiplied with @type other: L{escript.Symbol}, C{float}, L{escript.Data}, L{numarray.NumArray}.
  __rpow__(self, other)
raises an object to the power of this object @param other: basis @type other: L{escript.Symbol}, C{float}, L{escript.Data}, L{numarray.NumArray}.
  __rsub__(self, other)
subtracts this object from another object @param other: object this object is been subtracted from @type other: L{escript.Symbol}, C{float}, L{escript.Data}, L{numarray.NumArray}.
str __str__(self)
a string representation of the symbol.
  __sub__(self, other)
subtracts another object from this object @param other: object to be subtracted from this object @type other: L{escript.Symbol}, C{float}, L{escript.Data}, L{numarray.NumArray}.
typically escript.Symbol but other types such as float, escript.Data, numarray.NumArray are possible. diff(self, arg)
returns the derivative of the symbol with respect to Symbol arg
a single object or a list of objects getArgument(self, i)
returns the i-th argument of the symbol
list of objects getDifferentiatedArguments(self, arg)
applifies differentials to the arguments of this object and returns the result as a list.
int if the dimension is defined. Otherwise None is returned. getDim(self)
the spatial dimension
str getMyCode(self, argstrs, format)
returns a program code that can be used to evaluate the symbol.
int getRank(self)
the rank of the symbol
tuple of int getShape(self)
the shape of the symbol.
list of objects getSubstitutedArguments(self, argvals)
substitutes symbols in the arguments of this object and returns the result as a list.
bool isAppropriateValue(self, arg)
checks if the given argument arg can be used as a substitution of this object.
escript.Symbol, float, escript.Data, numarray.NumArray depending on the degree of substitution substitute(self, argvals)
assigns new values to symbols in the definition of the symbol.
    Inherited from object
  __delattr__(...)
x.__delattr__('name') <==> del x.name
  __getattribute__(...)
x.__getattribute__('name') <==> x.name
  __hash__(x)
x.__hash__() <==> hash(x)
  __new__(T, S, ...)
T.__new__(S, ...) -> a new object with type S, a subtype of T
  __reduce__(...)
helper for pickle
  __reduce_ex__(...)
helper for pickle
  __repr__(x)
x.__repr__() <==> repr(x)
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value

Method Details

__eq__(self, other)
(Equality operator)

checks if other equals self
Parameters:
other - any object
Returns:
True if other has the same class like self, and the shape, the spatial diemsnion and the arguments are equal.
           (type=bool)

__ne__(self, other)

checks if other equals self
Parameters:
other - any object
Returns:
Flase if other has the same class like self, and the shape, the spatial diemsnion and the arguments are equal.
           (type=bool)

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