# Transfer a Sparse Matrix to a C Function

**URL:** <https://discourse.julialang.org/t/transfer-a-sparse-matrix-to-a-c-function/67883>\
**Category:** General Usage\
**Tags:** linearalgebra, sparse, c\
**Created:** [September 8, 2021, 6:04pm UTC](https://discourse.julialang.org/t/transfer-a-sparse-matrix-to-a-c-function/67883 "2021-09-08T18:04:15Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

**Author:** ![RoyiAvital](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/royiavital/32/571_2.png) [@RoyiAvital](https://discourse.julialang.org/u/RoyiAvital)\
**Post date:** [September 10, 2021, 11:07am UTC](https://discourse.julialang.org/t/transfer-a-sparse-matrix-to-a-c-function/67883/9 "2021-09-10T11:07:36Z")

</div>

There are 2 optimizations I’m after:

1. How to send the `C` function a pointer to `colptr`, `rowval` and `nzval`.
2. How to make my whole Julia setup work with `32 Bit` indices for the sparse matrix (See [Convert a Current Installation of Julia to Use `BlasInt = `Int32`](https://discourse.julialang.org/t/convert-a-current-installation-of-julia-to-use-blasint-int32/67915)).

In (2) the problem I have is that most non trivial algorithms on Sparse Matrix (Decomposition) will gain from having indices in `32 Bit` yet I don’t know about the other eco system (`MKL Sparse`, `Suite Sparse`, etc…). If I set my matrix to be `32 Bit`, does it mean any call to a function of those libraries will create a conversion step?

I hope we have / we’ll have a way to configure all to be coherent. At the moment I don’t see a way to set `MKL`, `MKL Sparse`, `Pardiso` and other Intel based libraries to use `LP64` mode (Some has but it will go away with Julia 1.7). I have no idea about `SuiteSparse`. It seems some of the algorithms support `32 Bit` indices but it is not system wide.

---

_[View the full topic](https://discourse.julialang.org/t/transfer-a-sparse-matrix-to-a-c-function/67883)._
