Skip to content

Commit

Permalink
Fix for scalar bounds in SymbolicSys
Browse files Browse the repository at this point in the history
  • Loading branch information
bjodah committed Sep 14, 2017
1 parent 65e0030 commit 0323d8a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
v0.10.3
=======
- Fix for scalar bounds in SymbolicSys

v0.10.2
=======
- Softer bounds checking
Expand Down
9 changes: 7 additions & 2 deletions pyodesys/symbolic.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,9 @@ def __init__(self, dep_exprs, indep=None, params=None, jac=True, dfdx=True, firs
kwargs['param_names'] = [p.name for p in self.params]

self.band = kwargs.get('band', None) # needed by get_j_ty_callback
self.lower_bounds = None if lower_bounds is None else np.array(lower_bounds) # needed by get_f_ty_callback
self.upper_bounds = None if upper_bounds is None else np.array(upper_bounds) # needed by get_f_ty_callback
# bounds needed by get_f_ty_callback:
self.lower_bounds = None if lower_bounds is None else np.array(lower_bounds)*np.ones(self.ny)
self.upper_bounds = None if upper_bounds is None else np.array(upper_bounds)*np.ones(self.ny)

super(SymbolicSys, self).__init__(
self.get_f_ty_callback(),
Expand Down Expand Up @@ -727,7 +728,11 @@ def __init__(self, dep_exprs, indep=None, dep_transf=None,
list(kwargs.get('nonlinear_invariant_names') or ())))

lower_b = kwargs.pop('lower_bounds', None)
if lower_b is not None:
lower_b *= np.ones(len(dep))
upper_b = kwargs.pop('upper_bounds', None)
if upper_b is not None:
upper_b *= np.ones(len(dep))
pre_processors = kwargs.pop('pre_processors', [])
post_processors = kwargs.pop('post_processors', [])
super(TransformedSys, self).__init__(
Expand Down

0 comments on commit 0323d8a

Please sign in to comment.