3.1.15. c3po.DataManager module
Contain the class DataManager.
- class c3po.DataManager.DataManager
Bases:
objectDataManageris a class interface (to be implemented) which standardizes methods to handle data outside of codes.They are mainly mathematical operators needed for some coupling algorithms.
- __add__(other)
Return
self + other.Use
"+"to call it. For examplea = b + c.- Parameters:
other (DataManager) – A
DataManagerwith the same list of data thenself.- Returns:
A new (consistent with self)
DataManagerwhere the data are added.- Return type:
- Raises:
Exception – If
selfandotherare not consistent.
- __iadd__(other)
Add
otherinself(in place addition).Use
"+="to call it. For examplea += b.- Parameters:
other (DataManager) – A
DataManagerwith the same list of data thenself.- Returns:
self.- Return type:
- Raises:
Exception – If
selfandotherare not consistent.
- __imul__(scalar)
Multiply
selfbyscalar(in place multiplication).Use
"*="to call it. For examplea *= b.- Parameters:
scalar – A scalar value.
- Returns:
self.- Return type:
- __isub__(other)
Substract
othertoself(in place subtraction).Use
"-="to call it. For examplea -= b.- Parameters:
other (DataManager) – A
DataManagerwith the same list of data thenself.- Returns:
self.- Return type:
- Raises:
Exception – If
selfandotherare not consistent.
- __mul__(scalar)
Return
scalar * self.Use
"*"to call it. For examplea = b * c. The scalar first.- Parameters:
scalar – A scalar value.
- Returns:
A new (consistent with self)
DataManagerwhere the data are multiplied byscalar.- Return type:
- __sub__(other)
Return
self - other.Use
"-"to call it. For examplea = b - c.- Parameters:
other (DataManager) – A
DataManagerwith the same list of data thenself.- Returns:
A new (consistent with self)
DataManagerwhere the data are substracted.- Return type:
- Raises:
Exception – If
selfandotherare not consistent.
- clone()
Return a clone of
self.- Returns:
A clone of
self. Data are copied.- Return type:
- cloneEmpty()
Return a clone of
selfwithout copying the data.- Returns:
An empty clone of
self.- Return type:
- copy(other)
Copy data of
otherinself.- Parameters:
other (DataManager) – A
DataManagerwith the same list of data thanself.- Raises:
Exception – If
selfandotherare not consistent.
- dot(other)
Return the scalar product of
selfwithother.- Parameters:
other (DataManager) – A
DataManagerwith the same list of data thenself.- Return type:
The scalar product of
selfwithother.- Raises:
Exception – If
selfandotherare not consistent.
- imuladd(scalar, other)
Add in
selfscalar * other(in place operation).In order to do so,
other *= scalarandother *= 1./scalarare done.For example
a.imuladd(b, c).- Parameters:
scalar – A scalar value.
other (DataManager) – A
DataManagerwith the same list of data thenself.
- Returns:
self.- Return type:
- Raises:
Exception – If
selfandotherare not consistent.
- norm2()
Return the norm 2.
- Return type:
sqrt(sum_i(val[i] * val[i]))whereval[i]stands for each scalar and each component of stored data.
- normMax()
Return the infinite norm.
- Return type:
The infinite norm of all data.