From 2ee768a407c23e00182d2cb814417067a2936bc2 Mon Sep 17 00:00:00 2001 From: Ferdinand Fischer <ferdinand.fischer@uni-ulm.de> Date: Thu, 3 Sep 2020 13:34:34 +0200 Subject: [PATCH] simplification of quantity.Discrete/changeDomain In the old version it was verified if the newDomain is the same as the old domain to avoid unnecassary calls of .on(). This is not requried because .on() it self checks if the domain is equal. --- +quantity/Discrete.m | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/+quantity/Discrete.m b/+quantity/Discrete.m index d4bc333..03fde3a 100644 --- a/+quantity/Discrete.m +++ b/+quantity/Discrete.m @@ -1491,15 +1491,9 @@ classdef (InferiorClasses = {?quantity.Symbolic}) Discrete ... 'rearranging grids failed'); end - if obj(1).domain.isequal(newDomain) - % if the new domain is the same as the old one; the copy of the object can be - % returned and do not do a recalculation of the values. - return - else - [newObj.domain] = deal(newDomain); - for it = 1 : numel(obj) - newObj(it).valueDiscrete = obj(it).on(newDomain); - end + [newObj.domain] = deal(newDomain); + for it = 1 : numel(obj) + newObj(it).valueDiscrete = obj(it).on(newDomain); end end % changeGrid() -- GitLab