From 367e9001ffa87f068353c29567da6b12a462ab21 Mon Sep 17 00:00:00 2001 From: Marcell Vazquez-Chanlatte Date: Sun, 19 Mar 2017 14:00:10 -0700 Subject: [PATCH] max coeff for lipschitz --- stl/utils.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/stl/utils.py b/stl/utils.py index c5fa732..2d4a7e4 100644 --- a/stl/utils.py +++ b/stl/utils.py @@ -122,12 +122,12 @@ def from_mtl(phi:MTL, ap_map:Dict[AtomicPred, LinEq]) -> STL: return focus.modify(ap_map.get) -def lineq_lipschitz(lineq): - """1 norm lipschitz bound of linear inequality predicate.""" - return sum(map(abs, lens(lineq).terms.each_().coeff.get_all())) - def linear_stl_lipschitz(phi): - return max(map(lineq_lipschitz, lineq_lens(phi).get_all())) + r = max(abs(c) for c in terms_lens(phi).coeff.get_all()) + try: + return float(r) + except TypeError: + return r # EDSL