Skip to content

Commit 7dc79ee

Browse files
committed
Small speedup
1 parent b92f41c commit 7dc79ee

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

ecmtool/helpers.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,6 @@ def process_all_from_mplrs(network, linearities=None, make_unique=True, output_f
647647
# Prepare some variables for parsing
648648
parsedRayCount = 0
649649
zeroRay = np.repeat(to_fractions(np.zeros(shape=(1, 1))), d)
650-
zeroFrac = Fraction(0)
651650
if make_unique:
652651
ecmsHashSet = set()
653652
ecmsHashSet.add(hash(','.join([str(float(num)) for num in zeroRay]) + '\n'))
@@ -691,17 +690,14 @@ def process_all_from_mplrs(network, linearities=None, make_unique=True, output_f
691690

692691
# We intialize the ecms with all zeros
693692
ecm = zeroRay.copy()
694-
# For normalizing we keep track of the sum of absolute values
695-
sumEcm = zeroFrac
696693
# First column of mplrs-output is useless
697694
croppedLine = line.replace('\n', '').split()[1:]
698695

699696
for column, value in enumerate(croppedLine):
700697
if value != '0':
701698
fracVal = Fraction(value)
702699
ecm[metabIndToNewInd[column]] += fracVal
703-
for value in ecm:
704-
sumEcm += abs(value)
700+
sumEcm = np.sum(np.abs(ecm))
705701

706702
# Normalise row
707703
nonZero = sumEcm > 0

0 commit comments

Comments
 (0)