BF-MATH - Basic Mathematics
Ver. 2.2.3 (2023-05-06)
This module provides basic mathematical classes.
- class mlpro.bf.math.basics.Dimension(p_name_short, p_base_set='R', p_name_long='', p_name_latex='', p_unit='', p_unit_latex='', p_boundaries: list = [], p_description='', p_symmetrical: bool = False, p_logging=False, **p_kwargs)
Bases:
EventManager
Objects of this type specify properties of a dimension of a set.
Parameters:
- p_name_shortstr
Short name of dimension
- p_base_set
Base set of dimension. See constants C_BASE_SET_*. Default = C_BASE_SET_R.
- p_name_long :str
Long name of dimension (optional)
- p_name_latexstr
LaTeX name of dimension (optional)
- p_unitstr
Unit (optional)
- p_unit_latexstr
LaTeX code of unit (optional)
- p_boundarieslist
List with minimum and maximum value (optional)
- p_descriptionstr
Description of dimension (optional)
- p_symmetricalbool
Information about the symmetry of the dimension (optional, default is False)
- p_logging
Log level (see constants of class Log). Default: Log.C_LOG_ALL
- p_kwargsdict
Further optional keyword parameters.
- C_TYPE = 'Dimension'
- C_BASE_SET_R = 'R'
- C_BASE_SET_N = 'N'
- C_BASE_SET_Z = 'Z'
- C_BASE_SET_DO = 'DO'
- C_EVENT_BOUNDARIES = 'BOUNDARIES'
- get_id()
- get_name_short()
- get_base_set()
- get_name_long()
- get_name_latex()
- get_unit()
- get_unit_latex()
- get_boundaries()
- set_boundaries(p_boundaries: list)
Sets new boundaries with respect to the symmmetry and raises event C_EVENT_BOUNDARIES.
- Parameters:
p_boundaries (list) – New boundaries (lower and upper value)
- get_description()
- get_symmetrical() bool
- get_kwargs() dict
- copy()
- class mlpro.bf.math.basics.Set
Bases:
object
Objects of this type describe a (multivariate) set in a mathematical sense.
- C_NUMERIC_BASE_SETS = ['N', 'Z', 'R']
- add_dim(p_dim: Dimension, p_ignore_duplicates: bool = False)
Raises the dimensionality of the set by adding a new dimension.
- Parameters:
p_dim (Dimension) – Dimension to be added.
p_ignore_duplicates (bool) – If True, duplicated short names of dimensions are accepted. Default = False.
- is_numeric() bool
Returns True if the set consists of numeric dimensions only.
- get_dims() list
” Returns all dimensions.
- get_num_dim()
Returns the dimensionality of the set (=number of dimensions of the set).
- get_dim_ids()
Returns the unique ids of the related dimensions.
- spawn(p_id_list: list)
Spawns a new class with same type and a subset of dimensions specified by an index list.
- Parameters:
adopted (p_id_list List of indices of dimensions to be)
- Returns:
New object with subset of dimensions
- copy(p_new_dim_ids: bool = True)
- append(p_set, p_new_dim_ids: bool = True, p_ignore_duplicates: bool = False)
- class mlpro.bf.math.basics.DataObject(p_data, *p_meta_data)
Bases:
object
Container class for (big) data objects of any type with optional additional meta data.
- get_data()
- get_meta_data() tuple
- class mlpro.bf.math.basics.Element(p_set: Set)
Bases:
object
Element of a (multivariate) set.
- Parameters:
p_set (Set) – Underlying set.
- get_dim_ids() list
- get_values() list | ndarray
- set_values(p_values: list | ndarray)
Overwrites the values of all components of the element.
- Parameters:
dimensions. (p_values Something iterable with same length as number of element)
- get_value(p_dim_id)
- set_value(p_dim_id, p_value)
- copy()
- class mlpro.bf.math.basics.ElementList
Bases:
object
List of Element objects.
- add_elem(p_id, p_elem: Element)
Adds an element object under it’s id in the internal element list.
- Parameters:
element (p_id Unique id of the)
added (p_elem Element object to be)
- get_elem_ids() list
- class mlpro.bf.math.basics.MSpace
Bases:
Set
Objects of this type represent a metric space. The method distance implements the metric of the space.
- class mlpro.bf.math.basics.ESpace
Bases:
MSpace
Objects of this type represent an Euclidian space. The distance method implements the Euclidian norm.
- class mlpro.bf.math.basics.Function(p_input_space: ~mlpro.bf.math.basics.MSpace, p_output_space: ~mlpro.bf.math.basics.MSpace, p_output_elem_cls=<class 'mlpro.bf.math.basics.Element'>)
Bases:
object
Model class for an elementary bi-multivariate mathematical function that maps elements of a multivariate input space to elements of a multivariate output space.