Closed
Description
Hi,
Describe the bug
If a value list longer than the weight matrix dimensions is given to the moran
function, it skews the result, as no check for that exists.
To Reproduce
- Load
Moran Index.gaml
from the library. - Optional : run the model and change the parameter to checkerboard pattern to check that the value of Moran I is indeed -1.
- Add one or more values to the
vals
list, e.g. by adding something likevals <+ 100.0;
before line 49. - Run the model with checkerboard. No error is thrown, yet an I value different of -1 is given (about -0.008 in the example above).
Expected behavior
An error to be returned whenever the sizes of the inputs of the function are the same (length of the list and width and height of the weight matrix).
Proposed fix
Add a check in the moranIndex
function that vals.size()
must be equal to weightMatrix.numCols * weightMatrix.numRows
.
Desktop (please complete the following information):
- OS: Linux (any)
- GAMA version: bfa98eb
Metadata
Metadata
Assignees
Labels
No labels