pFq with Matrix argument
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
Research direction
Start by reviewing the existing pFq implementation and the shown pFqdrummond method for Matrix{BigFloat} arguments. Compare its matrix operations and convergence check with the scalar rational algorithms. Done means the relevant pFq call accepts matrix arguments and produces results consistent with matrix exponential behavior in the provided example.
Written by the indexing model from the issue text.
Description
This could be pretty useful. In Base, exp(z::Matrix{BigFloat}) doesn't exist but we could support it with some minor modifications of the rational algorithms
julia> using LinearAlgebra
julia> @inline errcheck(x::Matrix, y::Matrix, tol) = (norm(x-y) > max(norm(x), norm(y))*tol)
errcheck (generic function with 1 method)
julia> function pFqdrummond(::Tuple{}, ::Tuple{}, z::Matrix{T}; kmax::Int = 10_000) where T
if norm(z) < eps(real(T))
return Matrix{T}(I, size(z, 1), size(z, 2))
end
ζ = inv(z)
Nlo = Matrix{T}(I, size(z, 1), size(z, 2))
Dlo = Matrix{T}(I, size(z, 1), size(z, 2))
Tlo = Nlo/Dlo
Nhi = (2I - z)*Nlo + 2z
Dhi = (2I - z)*Dlo
Thi = Nhi/Dhi
k = 1
Nhi, Nlo = ((k+2)*I-z)*Nhi + k*z*Nlo + z*z, Nhi
Dhi, Dlo = ((k+2)*I-z)*Dhi + k*z*Dlo, Dhi
Thi, Tlo = Nhi/Dhi, Thi
k += 1
while k < kmax && errcheck(Tlo, Thi, 10eps(real(T)))
Nhi, Nlo = ((k+2)*I-z)*Nhi + k*z*Nlo, Nhi
Dhi, Dlo = ((k+2)*I-z)*Dhi + k*z*Dlo, Dhi
Thi, Tlo = Nhi/Dhi, Thi
k += 1
end
return Thi
end
pFqdrummond (generic function with 1 method)
julia> Z = big.(rand(2, 2))
2×2 Matrix{BigFloat}:
0.82811 0.0613331
0.449884 0.073366
julia> pFqdrummond((), (), Z)
2×2 Matrix{BigFloat}:
2.31398 0.0990111
0.726256 1.09558
julia> exp(Float64.(Z))
2×2 Matrix{Float64}:
2.31398 0.0990111
0.726256 1.09558
julia> pFqdrummond((), (), Z) - exp(Float64.(Z))
2×2 Matrix{BigFloat}:
6.85325e-16 3.73548e-17
2.05869e-16 -7.37797e-17
julia> exp(Z)
ERROR: MethodError: no method matching exp(::Matrix{BigFloat})
Closest candidates are:
exp(::Union{Float16, Float32, Float64}) at /Applications/Julia-1.7.app/Contents/Resources/julia/share/julia/base/special/exp.jl:296
exp(::StridedMatrix{var"#s859"} where var"#s859"<:Union{Float32, Float64, ComplexF32, ComplexF64}) at /Applications/Julia-1.7.app/Contents/Resources/julia/share/julia/stdlib/v1.7/LinearAlgebra/src/dense.jl:560
exp(::StridedMatrix{var"#s859"} where var"#s859"<:Union{Integer, Complex{<:Integer}}) at /Applications/Julia-1.7.app/Contents/Resources/julia/share/julia/stdlib/v1.7/LinearAlgebra/src/dense.jl:561
...
Stacktrace:
[1] top-level scope
@ REPL[7]:1
julia>
- Dominant language
- Julia
- Stars
- 76
- Forks
- 12
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from JuliaMath/HypergeometricFunctions.jl
-
tagbot-manual
Difficulty 1/5 Under an hour Newbie friendliness 78/100
-
Difficulty 4/5 3-5 days Newbie friendliness 42/100
JuliaMath/HypergeometricFunctions.jl#89 · 1 comment ·
-
3F2 returns NaNsPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 4/5 3-5 days Newbie friendliness 35/100
JuliaMath/HypergeometricFunctions.jl#79 · 2 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
pFq falsely evaluates to NaNPossibly taken @AshtonSBradley claimed this 185 days ago. Open
Difficulty 4/5 3-5 days Newbie friendliness 45/100
JuliaMath/HypergeometricFunctions.jl#73 · 2 comments ·
All issues in JuliaMath/HypergeometricFunctions.jl
Similar issues
-
R_to_gamma and R_to_v are wrong for |Z| != 1 (e.g. heavy ions)Possibly taken @DavidSagan claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
bmad-sim/BeamTracking.jl#366 ·
Maintainers usually reply within 1 day
-
TSDAE's docstring implies a theta argument it does not takePossibly taken @singhharsh1708 claimed this today. Opendocumentation
Difficulty 1/5 Under an hour Newbie friendliness 74/100
SciML/PETScDiffEq.jl#282 ·
Maintainers usually reply within 1 day
-
enhancement good first issue help wanted
Difficulty 2/5 Half a day Newbie friendliness 82/100
-
SavedSubsystem with an integer save_idxs maps the index the wrong way roundPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
SciML/SciMLBase.jl#1643 ·
Maintainers usually reply within 2 days
-
authority-vechtstromen ready-for-agent
Difficulty 1/5 Under an hour Newbie friendliness 75/100
Deltares/Ribasim-NL#890 ·
Maintainers usually reply within 1 day