-
Notifications
You must be signed in to change notification settings - Fork 109
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
Sparse matrices should be range-checked #202
Comments
We have bunch of methods in the vector interface like: interface Vector {
double get(int i, int j);
double set(int i, int j, double value);
...
} Simply speaking: all the methods that takes indices should perform an explicit range check before doing a job. Something like this: double get(int i, int j) {\
makeSureIndicesAreGood(i, j); // I believe we already have similar method
... // do the reset of the job
} |
I assume you would like these methods to throw some sort of exception from them. Is the standard to make a custom library exception or would a general |
Right. We have to keep the behavior unchanged from a dense version that throws |
Right. Sparse matrices as well as sparse vectors have the same issue. |
BTW, we probably have the same issue with |
Compiling a list of the Vector and Matrix implementations that need index range checks:
Does this list look about right to you? Also, I'm not sure if you care to implement range checks on a test only classes:
|
I'm pretty sure there is nothing to do with
|
Ok, I see what you mean about those 2 that just wrap the array and getting the check automatically. And I found how the abstract(s) "loop back" to the interface which then go to the specific implementations. That was my confusion. However, it still seems CompressedVector needs the range check, unless I'm mis-understanding that comment. |
Right. I misstyped it: |
Ok, I'll work on adding those range checks to the following then:
|
Awesome! Thanks! |
I'd like to help out on this project? Do you have any suggestions where I should start? It seems like this task is in progress. |
Hi @anubiann00b! That is great! You can start with this low landing fruit: #182. Feel free to ask any questions in that issue. |
I believe we could avoid big changes if we just add throwing |
@vkostyukov based on the conversation above, why do we need range checks on |
@DWiechert I believe so. Array implementation gives us range check out of the box, so we really need a range check only in CCS and CRS. |
@vkostyukov, I'd be happy to work on another issue for this project if you wouldn't mind pointing out a few with higher priority. |
@DWiechert, please take a look at this ticket: #172. Feel free to start the discussion there. And thanks for the help! |
Marko Batic found this issue. La4j can't rely on IndexOutOfBoundException anymore.
The text was updated successfully, but these errors were encountered: