Skip to content
Snippets Groups Projects
Commit 5cd3ebe8 authored by Ivan Kondov's avatar Ivan Kondov
Browse files

some refactoring of __init__()

parent 4debee1c
No related branches found
No related tags found
1 merge request!2WIP: Polynomial propagators with variable time step
......@@ -269,6 +269,8 @@ class SymmetricPolynomialPropagator(PolynomialPropagator):
self.numeric = self.syst.numeric
validate_numeric(self.fpprec, self.numeric)
if self.fpprec == 'fixed':
self.prec = np.finfo(float).precision
tool = self.numeric['tool']
assert tool in ['subs', 'lambdify', 'theano']
......@@ -282,9 +284,10 @@ class SymmetricPolynomialPropagator(PolynomialPropagator):
if tool == 'theano':
self.linalg = 'numpy'
if self.fpprec == 'fixed':
self.prec = np.finfo(float).precision
self.set_util_funcs()
def set_util_funcs(self):
""" utility functions depending on numeric backend and type of q """
if self.linalg == 'sympy':
self.matrix = sp.Matrix
self.matmul = lambda x, y: x*y
......@@ -302,12 +305,6 @@ class SymmetricPolynomialPropagator(PolynomialPropagator):
self.normf = np.linalg.norm
if isinstance(self.q, Iterable):
assert isinstance(self.p, Iterable)
assert isinstance(self.syst.q, Iterable)
assert isinstance(self.syst.p, Iterable)
assert len(self.q) == len(self.p)
assert len(self.q) == len(self.syst.q)
assert len(self.syst.q) == len(self.syst.p)
self.concat = lambda a, b: (*a, *b)
self.split = lambda x: (x[:len(x)//2], x[len(x)//2:])
else:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment