From 24dea3eccd022663de221724a6d4f031244d64a5 Mon Sep 17 00:00:00 2001 From: Mridul Seth Date: Thu, 26 Sep 2019 16:24:57 -0500 Subject: [PATCH] flatten dimensions when calculating distance b/w 2 --- HARK/core.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/HARK/core.py b/HARK/core.py index 119db0143..941ead370 100644 --- a/HARK/core.py +++ b/HARK/core.py @@ -62,7 +62,8 @@ def distanceMetric(thing_A, thing_B): if thing_A.shape == thing_B.shape: distance = np.max(abs(thing_A - thing_B)) else: - distance = np.max(abs(thing_A.shape - thing_B.shape)) + # Flatten arrays so there are in the same dimensions + distance = np.max(abs(thing_A.flatten().shape[0] - thing_B.flatten().shape[0])) # If none of the above cases, but the objects are of the same class, call # the distance method of one on the other elif thing_A.__class__.__name__ == thing_B.__class__.__name__: