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

Class DependendSymbol

object --+    
         |    
    Symbol --+
             |
            DependendSymbol
Known Subclasses:

DependendSymbol extents Symbol by modifying the == operator to allow two instances to be equal. Two DependendSymbol s 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 Symbol arguments. This will allow the optimizer to remove redundant function calls.

Instance Methods [hide private]
bool
__eq__(self, other)
Checks if other equals self.
 
__hash__(self)
hash(x)
bool
__ne__(self, other)
Checks if other is not equal to self.

Inherited from Symbol: __abs__, __add__, __div__, __getitem__, __init__, __mul__, __neg__, __pos__, __pow__, __radd__, __rdiv__, __rmul__, __rpow__, __rsub__, __rtruediv__, __str__, __sub__, __truediv__, diff, getArgument, getDifferentiatedArguments, getDim, getMyCode, getRank, getShape, getSubstitutedArguments, isAppropriateValue, substitute

Inherited from object: __delattr__, __format__, __getattribute__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__eq__(self, other)
(Equality operator)

 
Checks if other equals self.
Parameters:
  • other - any object
Returns: bool
True if other has the same class as self and the shape, the spatial dimension and the arguments are equal, False otherwise

__hash__(self)
(Hashing function)

 
hash(x)
Overrides: object.__hash__
(inherited documentation)

__ne__(self, other)

 
Checks if other is not equal to self.
Parameters:
  • other - any object
Returns: bool
False if other has the same class as self and the shape, the spatial dimension and the arguments are equal, True otherwise