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
68411b8d
Commit
68411b8d
authored
Oct 15, 2014
by
peastman
Browse files
Merge pull request #656 from peastman/sum
Fixed bug in Quantity.sum()
parents
05030307
9184c372
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
1 deletion
+6
-1
wrappers/python/simtk/unit/quantity.py
wrappers/python/simtk/unit/quantity.py
+6
-1
No files found.
wrappers/python/simtk/unit/quantity.py
View file @
68411b8d
...
...
@@ -467,7 +467,12 @@ class Quantity(object):
# This will be much faster for numpy arrays
mysum
=
self
.
_value
.
sum
()
except
AttributeError
:
mysum
=
sum
(
self
.
_value
)
if
len
(
self
.
_value
)
==
0
:
mysum
=
0
else
:
mysum
=
self
.
_value
[
0
]
for
i
in
range
(
1
,
len
(
self
.
_value
)):
mysum
+=
self
.
_value
[
i
]
return
Quantity
(
mysum
,
self
.
unit
)
def
mean
(
self
):
...
...
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