Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix to #3848 : Added a check on Moran inputs consistency #3849

Merged
merged 1 commit into from
Aug 18, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions msi.gama.core/src/msi/gaml/operators/Spatial.java
Original file line number Diff line number Diff line change
Expand Up @@ -7261,6 +7261,8 @@ public static double moranIndex(final IScope scope, final IList<Double> vals, fi
if (weightMatrix == null || weightMatrix.numCols != weightMatrix.numRows) throw GamaRuntimeException
.error("A squared weight matrix should be given for the moran index computation", scope);
final int N = vals.size();
if (N != weightMatrix.numRows * weightMatrix.numCols) throw GamaRuntimeException
.error("The lengths of the value list and of the weight matrix do not match", scope);
double I = 0.0;
double sumWeights = 0.0;
double sumXi = 0;
Expand Down