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
Input checking in af::sparse #2134
Comments
@rstub short of going through the entire For example the following is both valid COO and CSR:
That said, forcing the user to choose the format may be the better solution instead of arrayfire making assumptions. @umar456 This change does not break ABI but breaks C++ API. I think that should be OK ? |
While there are cases that are valid for different sparse matrix representations, there are some necessary conditions for the different formats:
These necessary (but not sufficient) conditions should be checked within |
@rstub Ok I did not realize this was broken. Do you want to send in a patch to fix this ? |
@pavanky I have created test cases and parameter validation here: https://github.com/RInstitute/arrayfire/tree/sparse
Do you know what's going on here? Or should I open a PR anyway to discuss this? |
@rstub you will need to destroy the Also why not use the C++ API for the tests instead? |
@rstub If you want to test for the failure cases, use |
@pavanky Thanks, using |
* Add test cases for input checking in af_create_sparse_array These three tests create a sparse array from array data. In each test the array data is valid for one storage type. The test checks that the correct storage type succeeds while the other storage types fail. * Add checks for length of rowIdx and colIdx * Update length of rowIdx array to size nRow +1
* Add test cases for input checking in af_create_sparse_array These three tests create a sparse array from array data. In each test the array data is valid for one storage type. The test checks that the correct storage type succeeds while the other storage types fail. * Add checks for length of rowIdx and colIdx * Update length of rowIdx array to size nRow +1
This report is motivated by https://stackoverflow.com/questions/49867065/arrayfire-sparse-matrix-issues. In that SO post the OP used input in effectively COO format to create a sparse matrix in CSR format:
One can fix this by either using the correct row indices:
or the correct format:
But why did the OP not get an error when trying to create a CSR matrix with incorrect input?
The text was updated successfully, but these errors were encountered: