diff options
Diffstat (limited to 'polymatrix/expression/init/initevalexpr.py')
-rw-r--r-- | polymatrix/expression/init/initevalexpr.py | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/polymatrix/expression/init/initevalexpr.py b/polymatrix/expression/init/initevalexpr.py deleted file mode 100644 index 29359d6..0000000 --- a/polymatrix/expression/init/initevalexpr.py +++ /dev/null @@ -1,37 +0,0 @@ -import typing -import numpy as np -from polymatrix.expression.init.initsubstituteexpr import format_substitutions -from polymatrix.expression.mixins.expressionbasemixin import ExpressionBaseMixin -import polymatrix.expression.impl.impl - - -def init_eval_expr( - underlying: ExpressionBaseMixin, - variables: typing.Union[typing.Any, tuple, dict], - values: typing.Union[float, tuple] = None, -): - - substitutions = format_substitutions( - variables=variables, - values=values, - ) - - def formatted_values(value): - if isinstance(value, np.ndarray): - return tuple(value.reshape(-1)) - - elif isinstance(value, tuple): - return value - - elif isinstance(value, int) or isinstance(value, float): - return (value,) - - else: - return (float(value),) - - substitutions = tuple((variable, formatted_values(value)) for variable, value in substitutions) - - return polymatrix.expression.impl.impl.EvalExprImpl( - underlying=underlying, - substitutions=substitutions, - ) |