JuliaLinearAlgebra / ArnoldiMethod.jl

The Arnoldi Method with Krylov-Schur restart, natively in Julia.
https://julialinearalgebra.github.io/ArnoldiMethod.jl/dev
MIT License
102 stars 18 forks source link

BigFloat compatibility #105

Closed fgerick closed 3 years ago

fgerick commented 3 years ago

This makes the use of "arbitrary" number types available for Julia >=v1.5 (due to mul! interface). This is also why the build fails on v1.0, not sure if this is something that needs to be supported.

I've updated also StaticArrays and included SizedArrays for non-isbitstypes in lu. I added the tests for many cases, but there are a few missing, as randn(BigFloat,n,n) does not yet exist in Julia.

closes #94

haampie commented 3 years ago

Thanks! This is great! mul! should be available since julia 1.3, were you hitting problems on 1.3/1.4? I'll test it when I have time

fgerick commented 3 years ago

Ah my bad mul! was already in 1.3, time flies... I quickly checked with 1.3.1 and most tests work, just that there seems to be a tiny (4e-78) difference in the BigFloat precision:

Zero eigenvalues & low-rank matrices: Test Failed at /Users/felixger/.julia/dev/ArnoldiMethod/test/partial_schur.jl:24
  Expression: norm(B * schur.Q - schur.Q * schur.R) < 100 * eps(real(T))
   Evaluated: 1.731313276802366659169719086885007092791536617145785506261475248523890470176717e-75 < 1.727233711018888925077270372560079914223200072887256277004740694033718360632485e-75
Stacktrace:
 [1] top-level scope at /Users/felixger/.julia/dev/ArnoldiMethod/test/partial_schur.jl:24
 [2] top-level scope at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.3/Test/src/Test.jl:1107
 [3] top-level scope at /Users/felixger/.julia/dev/ArnoldiMethod/test/partial_schur.jl:13
Test Summary:                        | Pass  Fail  Total
Zero eigenvalues & low-rank matrices |   19     1     20
ERROR: LoadError: LoadError: Some tests did not pass: 19 passed, 1 failed, 0 errored, 0 broken.
in expression starting at /Users/felixger/.julia/dev/ArnoldiMethod/test/partial_schur.jl:6
in expression starting at /Users/felixger/.julia/dev/ArnoldiMethod/test/runtests.jl:16
ERROR: Package ArnoldiMethod errored during testing
haampie commented 3 years ago

Let's see if those spurious errors persist or not, right now CI is fine.

haampie commented 3 years ago

how do i get rid of travis...

haampie commented 3 years ago

Thanks for the contribution! A new version is pending.

I can highly recommend MultiFloats.jl over BigFloat by the way since it works in-place

fgerick commented 3 years ago

Cool! I didn't know about that package, thanks :) I've been using DoubleFloats.jl mostly. I'll check out if the advertised 2x performance improvement holds!

haampie commented 3 years ago

I think the 2x speedup is mostly due to avoiding the machinery for NaNs