Package esys :: Package escript :: Module pdetools :: Class ArithmeticTuple
[hide private]
[frames] | no frames]

Class ArithmeticTuple

object --+
         |
        ArithmeticTuple

Tuple supporting inplace update x+=y and scaling x=a*y where x,y is an ArithmeticTuple and a is a float.

Example of usage:

   from esys.escript import Data
   from numpy import array
   a=Data(...)
   b=array([1.,4.])
   x=ArithmeticTuple(a,b)
   y=5.*x
Instance Methods [hide private]
 
__add__(self, other)
Adds other to self.
ArithmeticTuple
__div__(self, other)
Scales by (1/other) from the right.
 
__getitem__(self, index)
Returns item at specified position.
 
__iadd__(self, other)
Inplace addition of other to self.
 
__init__(self, *args)
Initializes object with elements args.
 
__isub__(self, other)
Inplace subtraction of other from self.
int
__len__(self)
Returns the number of items.
ArithmeticTuple
__mul__(self, other)
Scales by other from the right.
 
__neg__(self)
Negates values.
ArithmeticTuple
__rdiv__(self, other)
Scales by (1/other) from the left.
ArithmeticTuple
__rmul__(self, other)
Scales by other from the left.
 
__sub__(self, other)
Subtracts other from self.

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__add__(self, other)
(Addition operator)

 

Adds other to self.

Parameters:
  • other (ArithmeticTuple) - increment

__div__(self, other)

 

Scales by (1/other) from the right.

Parameters:
  • other (float) - scaling factor
Returns: ArithmeticTuple
itemwise self/other

__getitem__(self, index)
(Indexing operator)

 

Returns item at specified position.

Parameters:
  • index (int) - index of item to be returned
Returns:
item with index index

__iadd__(self, other)

 

Inplace addition of other to self.

Parameters:
  • other (ArithmeticTuple) - increment

__init__(self, *args)
(Constructor)

 

Initializes object with elements args.

Parameters:
  • args - tuple of objects that support inplace add (x+=y) and scaling (x=a*y)
Overrides: object.__init__

__isub__(self, other)

 

Inplace subtraction of other from self.

Parameters:
  • other (ArithmeticTuple) - decrement

__len__(self)
(Length operator)

 

Returns the number of items.

Returns: int
number of items

__mul__(self, other)

 

Scales by other from the right.

Parameters:
  • other (float) - scaling factor
Returns: ArithmeticTuple
itemwise self*other

__rdiv__(self, other)

 

Scales by (1/other) from the left.

Parameters:
  • other (float) - scaling factor
Returns: ArithmeticTuple
itemwise other/self

__rmul__(self, other)

 

Scales by other from the left.

Parameters:
  • other (float) - scaling factor
Returns: ArithmeticTuple
itemwise other*self

__sub__(self, other)
(Subtraction operator)

 

Subtracts other from self.

Parameters:
  • other (ArithmeticTuple) - decrement