Skip to content

Unable to create a sparse matrix from the host #189

Description

@elbehery95

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 ?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions