We distinguish two types of operator :
- irreducible : one elementary block operator, that cannot be decomposed into a product, addition, etc ... of other block operators. For instance,
FandGin Parareal. - composite : built from the multiplication, addition, etc ... of several block operators. For instance,
F-Gin the Parareal iteration.
Both types are represented by the following class :
class BlockOperator(object):
# Attributes used for representation and performance analysis
symbol # sympy symbol
cost # real number
components # dictionnary
# Attributes used for evaluation and error analysis
matrix # numpy 2D array
invert # numpy 2D arraysymbol: is a symbolic representation of the operator, used for representation and performance analysis. For composite block operators, it becomes a sympy expression that can be broken down into symbolic operations and symbols.cost: is a theoretical cost for this operator. It is relevant only for irreducible block operators, and isNonefor any composite block operator,components: a dictionnary withkey=nameandvalue=BlockOperatorcontaining all irreducible block operators composing the block operator. For an irreducible block operator, it only contains a reference to itself.
For any vector
where
- Solve
$By=u$ usingnumpy.linalg.solve(better numerical accuracy), - Compute evaluated solution
$u_{eval} = Ay$ usingnumpy.dotmatrix-vector product.
The matrix attribute, while the invert attribute stores the invert attribute is set to None, and vice-versa.
By default, when both invert and matrix are set to None, it means that the BlockOperator represent the identity.
Arithmetic operation between block operator are allowed, and their matrix and invert attributes are modified accordingly.
🔔 For now, addition and substraction between BlockOperators having an invert attribute not set to None is not allowed.