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

Support dgRMatrix, dgCMatrix and dgTMatrix #9

Merged
merged 15 commits into from
Sep 25, 2018
Merged

Conversation

kafku
Copy link
Contributor

@kafku kafku commented Sep 23, 2018

This PR includes the following features.

  • new typed_sparray<af::dtype, af::storage> class
  • Exporter and wrap fucntion that support dgRMatrix, dgCMatrix and dgTMatrix in Matrix package

@kafku
Copy link
Contributor Author

kafku commented Sep 23, 2018

I'll add Expoter for lgCMatrix and lgRMtarix. So, please wait till it's done.

@kafku kafku changed the title Support dgRMatrix and dgCMatrix [WIP] Support dgRMatrix and dgCMatrix Sep 23, 2018
@kafku
Copy link
Contributor Author

kafku commented Sep 23, 2018

I found that af_create_sparse_arry only works with f64/f32/c64/c32. So this PR does not support lgCMatrix and lgRMatrix.

@kafku kafku changed the title [WIP] Support dgRMatrix and dgCMatrix Support dgRMatrix, dgCMatrix and dgTMatrix Sep 23, 2018
@rstub
Copy link
Member

rstub commented Sep 24, 2018

Thanks a lot! For reference, the data type limitation for sparse arrays is documented at http://arrayfire.org/docs/group__sparse__func.htm

Do you have an idea for a good unit test?

@kafku
Copy link
Contributor Author

kafku commented Sep 24, 2018

Do you have an idea for a good unit test?

How about defining a function that returns given typed_sparray without doing anything to check if it returns the same matrix? If it is okay, I'll add some tests to this PR in this way.

By the way, I have a question. In this PR, I added typed_sparray<af::dtype, af::storage>. However, it is also possible to define typed_array<af::dtype, af::storage> (with AF_STORAGE_DENSE as its defulat value), and then I replace old typed_array<af::dtype> with typed_array<af::dtype, AF_STORAGE_DENSE>. Which do you think is better?

@rstub
Copy link
Member

rstub commented Sep 24, 2018

How about defining a function that returns given typed_sparray without doing anything to check if it returns the same matrix? If it is okay, I'll add some tests to this PR in this way.

Sounds excellent (we don't need to test AF capability after all). Just go ahead.

By the way, I have a question. In this PR, I added typed_sparray<af::dtype, af::storage>. However, it is also possible to define typed_array<af::dtype, af::storage> (with AF_STORAGE_DENSE as its defulat value), and then I replace old typed_array<af::dtype> with typed_array<af::dtype, AF_STORAGE_DENSE>. Which do you think is better?

Good question. My gut feeling would be the latter approach, since there is only one af::array and typed_array<> is meant as a thin rapper around it. How is it w.r.t. implementation? Would it be more complicated this way?

@kafku
Copy link
Contributor Author

kafku commented Sep 25, 2018

Would it be more complicated this way?

I don't think it would be that complicated. I'll fix this PR with the latter approach.

@kafku kafku changed the title Support dgRMatrix, dgCMatrix and dgTMatrix [WIP] Support dgRMatrix, dgCMatrix and dgTMatrix Sep 25, 2018
@kafku
Copy link
Contributor Author

kafku commented Sep 25, 2018

update:

  • use typed_array<af::dtype, af::storage> instead of typed_sparray
  • added simple tests to check the Exporter and the wrap function for sparse array.

@kafku kafku changed the title [WIP] Support dgRMatrix, dgCMatrix and dgTMatrix Support dgRMatrix, dgCMatrix and dgTMatrix Sep 25, 2018
@rstub rstub merged commit 17b36aa into daqana:master Sep 25, 2018
@rstub rstub mentioned this pull request Sep 25, 2018
@dselivanov
Copy link

Thank you gents for this! super curios to try to port some of matrix factorizations from my rsparse pkg.

@kafku kafku deleted the sparse branch March 24, 2019 07:34
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

Successfully merging this pull request may close these issues.

3 participants