# How to do high precision linear algebra with \`exp\` related functions?

**URL:** <https://discourse.julialang.org/t/how-to-do-high-precision-linear-algebra-with-exp-related-functions/122114>\
**Category:** General Usage\
**Tags:** linearalgebra, precision\
**Created:** [November 1, 2024, 7:12am UTC](https://discourse.julialang.org/t/how-to-do-high-precision-linear-algebra-with-exp-related-functions/122114 "2024-11-01T07:12:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![singularitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/singularitti/32/17678_2.png) [@singularitti](https://discourse.julialang.org/u/singularitti)\
**Post date:** [November 1, 2024, 7:12am UTC](https://discourse.julialang.org/t/how-to-do-high-precision-linear-algebra-with-exp-related-functions/122114/1 "2024-11-01T07:12:07Z")

</div>

Is there a library that supports `exp`, `sin`, `cos`, etc., on matrices with precisions higher than `Float64`? Here’s my test code:

```julia
julia> A = rand(BigFloat, 10, 10);

julia> exp(A)
ERROR: MethodError: no method matching exp!(::Matrix{BigFloat})
The function `exp!` exists, but no method is defined for this combination of argument types.

Closest candidates are:
  exp!(::StridedMatrix{T}) where T<:Union{Float32, Float64, ComplexF64, ComplexF32}
   @ LinearAlgebra ~/.asdf/installs/julia/1.11.1/share/julia/stdlib/v1.11/LinearAlgebra/src/dense.jl:677

Stacktrace:
 [1] exp(A::Matrix{BigFloat})
   @ LinearAlgebra ~/.asdf/installs/julia/1.11.1/share/julia/stdlib/v1.11/LinearAlgebra/src/dense.jl:622
 [2] top-level scope
   @ REPL[26]:1

julia> using GenericLinearAlgebra

julia> exp(A)
ERROR: MethodError: no method matching exp!(::Matrix{BigFloat})
The function `exp!` exists, but no method is defined for this combination of argument types.

Closest candidates are:
  exp!(::StridedMatrix{T}) where T<:Union{Float32, Float64, ComplexF64, ComplexF32}
  @ LinearAlgebra ~/.asdf/installs/julia/1.11.1/share/julia/stdlib/v1.11/LinearAlgebra/src/dense.jl:677

Stacktrace:
[1] exp(A::Matrix{BigFloat})
  @ LinearAlgebra ~/.asdf/installs/julia/1.11.1/share/julia/stdlib/v1.11/LinearAlgebra/src/dense.jl:622
[2] top-level scope
  @ REPL[28]:1

julia> using Quadmath

julia> A = rand(Float128, 10, 10);

julia> exp(A)
ERROR: MethodError: no method matching exp!(::Matrix{Float128})
The function `exp!` exists, but no method is defined for this combination of argument types.

Closest candidates are:
  exp!(::StridedMatrix{T}) where T<:Union{Float32, Float64, ComplexF64, ComplexF32}
  @ LinearAlgebra ~/.asdf/installs/julia/1.11.1/share/julia/stdlib/v1.11/LinearAlgebra/src/dense.jl:677

Stacktrace:
[1] exp(A::Matrix{Float128})
  @ LinearAlgebra ~/.asdf/installs/julia/1.11.1/share/julia/stdlib/v1.11/LinearAlgebra/src/dense.jl:622
[2] top-level scope
  @ REPL[31]:1

```

---

<div class="post-metadata">

**Author:** ![gdalle](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gdalle/32/27854_2.png) [@gdalle](https://discourse.julialang.org/u/gdalle)\
**Post date:** [November 1, 2024, 7:45am UTC](https://discourse.julialang.org/t/how-to-do-high-precision-linear-algebra-with-exp-related-functions/122114/2 "2024-11-01T07:45:51Z")

</div>

Maybe this one?

> **[GitHub - SciML/ExponentialUtilities.jl: Fast and differentiable implementations of matrix...](https://github.com/SciML/ExponentialUtilities.jl)**
>
> Fast and differentiable implementations of matrix exponentials, Krylov exponential matrix-vector multiplications ("expmv"), KIOPS, ExpoKit functions, and more. All your exponential needs in SciML form.

---

<div class="post-metadata">

**Author:** ![singularitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/singularitti/32/17678_2.png) [@singularitti](https://discourse.julialang.org/u/singularitti)\
**Post date:** [November 1, 2024, 9:21am UTC](https://discourse.julialang.org/t/how-to-do-high-precision-linear-algebra-with-exp-related-functions/122114/3 "2024-11-01T09:21:18Z")

</div>

It’s working! Thanks!
