Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
tsoc
openmm
Commits
f6d90066
"platforms/vscode:/vscode.git/clone" did not exist on "a4673043ad80d68e59f6edbbb7a94f1b3cd97c98"
Commit
f6d90066
authored
Oct 06, 2014
by
Jason Swails
Browse files
Possible speedup for unit_math.sum function.
parent
9c38d980
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
0 deletions
+4
-0
wrappers/python/simtk/unit/unit_math.py
wrappers/python/simtk/unit/unit_math.py
+4
-0
No files found.
wrappers/python/simtk/unit/unit_math.py
View file @
f6d90066
...
...
@@ -156,6 +156,10 @@ def sum(val):
>>> sum((2.0*meter, 30.0*centimeter))
Quantity(value=2.3, unit=meter)
"""
try
:
return
val
.
sum
()
except
AttributeError
:
pass
if
len
(
val
)
==
0
:
return
0
result
=
val
[
0
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment