The implementation of the Morris function at _MorrisSensitivity.py is wrong:
Let us detail these problems.
The index k is not updated to initialize b2 from gamma
At:
the index k is used, but never updated.
The code should write:
k = 0
for i in range(6, 20):
for j in range(20):
self.b2[i][j] = gamma[k]
k = k + 1
The value y is overwritten by a dot product instead of being updated
At:
the value of y is overwritten, instead of being updated.
The correct code is:
The variable b2 is initialized from a shallow copy
At:
|
self.b2 = [[0.0] * 20] * 20 |
the value of b2 is wrongly defined because it is a shallow copy: many entries share the same memory!
The correct code is:
b2 = [[0.0 for _ in range(20)] for _ in range(20)]
The variable b3 is initialized from a shallow copy
At:
|
self.b3 = [[[0.0] * 20] * 20] * 20 |
the same happens for b3. The correct code is:
self.b3 = [[[0.0 for _ in range(20)] for _ in range(20)] for _ in range(20)]
The variable b4 is initialized from a shallow copy
And so for b4 at:
|
self.b4 = [[[[0.0] * 20] * 20] * 20] * 20 |
where the correct code is:
self.b4 = [
[[[0.0 for _ in range(20)] for _ in range(20)] for _ in range(20)]
for _ in range(20)
]
The implementation of the Morris function at _MorrisSensitivity.py is wrong:
Let us detail these problems.
The index k is not updated to initialize b2 from gamma
At:
otbenchmark/otbenchmark/_MorrisSensitivity.py
Line 77 in ce6d551
the index k is used, but never updated.
The code should write:
The value y is overwritten by a dot product instead of being updated
At:
otbenchmark/otbenchmark/_MorrisSensitivity.py
Line 105 in ce6d551
the value of y is overwritten, instead of being updated.
The correct code is:
The variable b2 is initialized from a shallow copy
At:
otbenchmark/otbenchmark/_MorrisSensitivity.py
Line 63 in ce6d551
the value of b2 is wrongly defined because it is a shallow copy: many entries share the same memory!
The correct code is:
The variable b3 is initialized from a shallow copy
At:
otbenchmark/otbenchmark/_MorrisSensitivity.py
Line 80 in ce6d551
the same happens for b3. The correct code is:
The variable b4 is initialized from a shallow copy
And so for b4 at:
otbenchmark/otbenchmark/_MorrisSensitivity.py
Line 86 in ce6d551
where the correct code is: