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

Get Sub Matrix returning NAN #2324

Closed
jab0707 opened this issue Oct 4, 2021 · 2 comments
Closed

Get Sub Matrix returning NAN #2324

jab0707 opened this issue Oct 4, 2021 · 2 comments

Comments

@jab0707
Copy link

jab0707 commented Oct 4, 2021

I ran into a weird bug using get submatrix. In the module below if I set get matrix slice to 0 (which will generate volume indices [0,1,2] the output matrix is full of nan/really high values. If I change to any other slice (any other set of three columns) then I get the expected output. Network attached for reference. Does not require external data.

image

image

image

version v5.0-beta.Z
WeirdBug.srn5.zip

@jab0707 jab0707 added the Bug label Oct 4, 2021
@dcwhite dcwhite added this to the 5.0-beta.ϴ [Internal] milestone Oct 6, 2021
@dcwhite
Copy link
Member

dcwhite commented Oct 6, 2021

I replicated this, it's reading from uninitialized memory so you'll get NaNs and garbage out. Very odd that it's a simple function of SelectSubMatrix that does this, as there are plenty of tests written for that module (not by me though :). It will be an easy fix.

Also, the "WeirdBug.srn5" reminds me of the "one weird trick" ads around the web: https://en.wikipedia.org/wiki/One_weird_trick_advertisements

@dcwhite
Copy link
Member

dcwhite commented Oct 6, 2021

This line is the culprit:
https://github.com/SCIInstitute/SCIRun/blob/master/src/Core/Algorithms/Math/SelectSubMatrix.cc#L349
It's only selecting columns when the index is > 0, so the 0th column in the output is random garbage. This sort of copy-paste bug is the result of the heavily-nested code of the algorithm, trying to handle too many cases in a simplistic manner.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Software Development Stuff
  
Awaiting triage
Development

No branches or pull requests

2 participants