Skip to content

Unable to create a sparse matrix from the host #189

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

Closed
elbehery95 opened this issue Aug 10, 2018 · 1 comment
Closed

Unable to create a sparse matrix from the host #189

elbehery95 opened this issue Aug 10, 2018 · 1 comment

Comments

@elbehery95
Copy link

I was trying to follow the documentation in order to create a sparse matrix of type csr

import arrayfire as af

x = af.sparse.create_sparse_from_host([1,2], [1, 2], [1, 2], nrows=int(123), ncols=int(123))

though i am having this error

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "G:\behery_tools\Python36\lib\site-packages\arrayfire\sparse.py", line 93, in create_sparse_from_host
    return create_sparse(to_array(values), to_array(row_idx), to_array(col_idx), nrows, ncols, storage)
  File "G:\behery_tools\Python36\lib\site-packages\arrayfire\sparse.py", line 60, in create_sparse
    values.arr, row_idx.arr, col_idx.arr, storage.value))
  File "G:\behery_tools\Python36\lib\site-packages\arrayfire\util.py", line 79, in safe_call
    raise RuntimeError(to_str(err_str))
RuntimeError: In function af_err __cdecl af_create_sparse_array(void **,const __int64,const __int64,void *const ,void *const ,void *const ,const af_storage)
In file src\api\c\sparse.cpp:85
Invalid argument at index 4
Expected: rInfo.getType() == s32

I am not sure what is the main cause of the error here; as much as i know i am passing the correct types for all the args. Can anyone provide an example ?

mlloreda added a commit to mlloreda/arrayfire-python that referenced this issue Oct 22, 2018
Casted row and column index arrays to be of s32 type prior to passing in to
lib call. Previously failing due to failing assertions.
mlloreda added a commit to mlloreda/arrayfire-python that referenced this issue Oct 22, 2018
Casted row and column index arrays to be of s32 type prior to passing in to
lib call. Previously failing due to failing assertions.
@mlloreda
Copy link
Member

Thank you for reporting this, @ELBe7ery.

Incorrect array types were being passed in to ArrayFire. PR #198 contains fix.

pavanky pushed a commit that referenced this issue Oct 23, 2018
Casted row and column index arrays to be of s32 type prior to passing in to
lib call. Previously failing due to failing assertions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants