# Optimizing Sparse Matrix Exponential Computation in Julia

**URL:** <https://discourse.julialang.org/t/optimizing-sparse-matrix-exponential-computation-in-julia/119584>\
**Category:** General Usage\
**Tags:** question, package\
**Created:** [September 19, 2024, 4:32am UTC](https://discourse.julialang.org/t/optimizing-sparse-matrix-exponential-computation-in-julia/119584 "2024-09-19T04:32:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ZACK\_Z](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/zack_z/32/212045_2.png) [@ZACK\_Z](https://discourse.julialang.org/u/ZACK_Z)\
**Post date:** [September 19, 2024, 4:32am UTC](https://discourse.julialang.org/t/optimizing-sparse-matrix-exponential-computation-in-julia/119584/1 "2024-09-19T04:32:02Z")

</div>

I’m trying to compute the sparse matrix exponential of large matrices (at least 10,000 x 10,000) using Julia packages like Expokit, FastExp, and ExpmV. However, I’m finding that the computation time is significantly longer compared to using Python’s `scipy.sparse.linalg.expm_multiply`.

For example, I’m using the function `expmv(1.0, M, rho_vectorized)`, where `M` is a sparse matrix.

What methods or strategies can I use to speed up the computation of the sparse matrix exponential in Julia? Any advice or tips would be greatly appreciated!

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [September 19, 2024, 6:56am UTC](https://discourse.julialang.org/t/optimizing-sparse-matrix-exponential-computation-in-julia/119584/2 "2024-09-19T06:56:18Z")

</div>

Have you tried using ExponentialUtilities.jl? That’s the standard package for this.

---

<div class="post-metadata">

**Author:** ![ZACK\_Z](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/zack_z/32/212045_2.png) [@ZACK\_Z](https://discourse.julialang.org/u/ZACK_Z)\
**Post date:** [September 19, 2024, 7:35am UTC](https://discourse.julialang.org/t/optimizing-sparse-matrix-exponential-computation-in-julia/119584/3 "2024-09-19T07:35:08Z")

</div>

Thank you for your response. I found a bug in my code that caused it to run slower than Python. However, when I use [ExponentialUtilities.jl](https://juliahub.com/ui/Packages/General/ExponentialUtilities), it is very quick, but the result is incorrect. Maybe I use a wrong function. I will check it again. Thx.
