{"id":15057742,"url":"https://github.com/dgleich/genericarpack.jl","last_synced_at":"2025-04-10T05:11:35.058Z","repository":{"id":43796995,"uuid":"362934733","full_name":"dgleich/GenericArpack.jl","owner":"dgleich","description":"A pure Julia translation of the Arpack library for eigenvalues and eigenvectors but for any numeric types. (Symmetric only right now)","archived":false,"fork":false,"pushed_at":"2023-11-10T21:20:40.000Z","size":738,"stargazers_count":25,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-10T05:11:32.898Z","etag":null,"topics":["julia","julialang"],"latest_commit_sha":null,"homepage":"","language":"Julia","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dgleich.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-04-29T20:07:34.000Z","updated_at":"2025-02-07T19:24:30.000Z","dependencies_parsed_at":"2025-02-16T14:38:25.803Z","dependency_job_id":"993332f1-8ac6-4bf1-8152-db1915da85ad","html_url":"https://github.com/dgleich/GenericArpack.jl","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dgleich%2FGenericArpack.jl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dgleich%2FGenericArpack.jl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dgleich%2FGenericArpack.jl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dgleich%2FGenericArpack.jl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dgleich","download_url":"https://codeload.github.com/dgleich/GenericArpack.jl/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248161276,"owners_count":21057555,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["julia","julialang"],"created_at":"2024-09-24T22:11:01.334Z","updated_at":"2025-04-10T05:11:35.025Z","avatar_url":"https://github.com/dgleich.png","language":"Julia","funding_links":[],"categories":[],"sub_categories":[],"readme":"GenericArpack.jl\n===============\n\n[![](https://img.shields.io/badge/docs-dev-blue.svg)](https://dgleich.github.io/GenericArpack.jl/dev)\n[![Build Status](https://github.com/dgleich/GenericArpack.jl/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/dgleich/GenericArpack.jl/actions/workflows/test.yml?query=branch%3Amain)\n[![codecov](https://codecov.io/gh/dgleich/GenericArpack.jl/branch/main/graph/badge.svg?token=6RCYCW95FX)](https://codecov.io/gh/dgleich/GenericArpack.jl)\n\nThis is a pure-Julia translation of the Arpack library. As such, it works\nwith generic real-valued types in Julia. It's only dependency is `LinearAlgebra.jl`\nin the standard library and includes self-contained BLAS routines for the generic\ntools it requires. **Currently, only the symmetric Arpack solver is implemented.**\n\n```\nusing GenericArpack\nusing DoubleFloats\nA = Symmetric(sprand(Double64, 100000, 100000, 5/100000) |\u003e A -\u003e A + A')\n... \njulia\u003e eigs(A, 2; ncv=12)\nGenericArpack.ArpackEigen{...}\neigenspace: LM\nvalues:\n2-element Vector{Double64}:\n -4.156547290415474\n  5.757828927650802\n...\n```\n\nThe library also supports mixed precision, although, this needs to be used carefully. \n```\njulia\u003e eigs(Float16, Float64, A, 2; ncv=12) # use Float16 for vectors, Float64 for Arnoldi info, Double64 for A\nvalues:\n2-element Vector{Float64}:\n -5.043265045062479\n  6.522275837391058\n```\nThe library is better used with use higher precision types, like Double64, although Float32 work okay. \nSee below for some notes on using higher-precision types. \n\nBecause it was fairly trivial to do in Julia, `GenericArpack.jl` also has a specialized Hermitian eigensolver.\nThis has had more limited testing, but should work for many cases. This is useful because it gives a\ncomplex-valued SVD without using the non-symmetric solver as in `Arpack.jl`.\n\nSee also the packages\n- [Arpack.jl](https://github.com/JuliaLinearAlgebra/Arpack.jl)\n- [KrylovKit.jl](https://github.com/Jutho/KrylovKit.jl)\n- [ArnoldiMethod.jl](https://github.com/haampie/ArnoldiMethod.jl)\n\nRationale\n=========\nThe compiled Arpack library has been wrapped in Julia for a long time. Why do we need this _translation_ \nof the library into Julia? Here's the rationale: \n- available with minimal dependencies; no need for a Fortran compiler on a new platform\n- multithread safe (the Fortran Arpack code will segfault if called from multiple threads because\n  it uses static variables that are not allocated to each thread )\n\nOf course, the downside at the moment is that the non-symmetric and non-Hermitian cases aren't yet translated.\nThis will require a fair amount of dedicated effort, although everything has been prototyped and there is\na path do it. \n\nKey Functionality\n=================\n\nArpack has a tremendous amount of functionality. Right now, only the symmetric (and by Julia magic, the new Hermitian)\nsolvers are implemented. See below for more on the list of functionality. Not everything has been testing, but\n- Real Symmetric, Generalized Symmetric, Shift and Invert, with mixed/high precision\n- Complex Hermitian, Generalized Symmetric, Shift and Invert, with mixed/high precision\n- Real and Complex SVD via the Normal equations with mixed/high precision. \n- Smallest singular subspace estimation. \n\nMore details on functionality\n-----------------------------\n\nThe Arpack symmetric eigensolver functionality is all here and this is ported \nin its entirety. No work has yet been done on the non-symmetric eigensolver (yet).\nRight now, \n\n|\tStatus\t|\tInformation\t|\n|\t--------\t|\t--------\t|\n|\tpost-beta\t|\tMost cases should work, there may be edge cases\t|\n|\tbeta\t|\tA few edges cases are likely to appear\t|\n|\talpha\t|\tLimited testing, simple things will probably work\t|\n|\tpre-alpha\t|\tLimited or virtually no testing, likely to have issues\t|\n|\tcoded\t|\tNo idea, but the code is there. \t|\n\n\n|\tFunctionality\t|\tTypes\t|\tStatus\t|\tNotes\t|\n|\t--------\t|\t--------\t|\t--------\t|\t--------\t|\n|\tsimple real symmetric eigenvalues\t|\tFloat64\t|\tpost-beta\t|\tBitwise matches arpack_jll\t|\n|\tgeneralized real symmetric eigenvalues \t|\tFloat64\t|\tbeta\t|\tBitwise matches arpack_jll\t|\n|\tsingular value decomposition \t|\tFloat64\t|\tbeta\t|\tUses normal equations, sorry Gene\t|\n|\tsimple shift-invert symmetric eigenvalues\t|\tFloat64\t|\tpre-alpha\t|\tnot yet tested\t|\n|\tgeneralized shift-invert symmetric eigenvalues\t|\tFloat64\t|\tpre-alpha\t|\tnot yet tested\t|\n|\tgeneralized buckle symmetric eigenvalues\t|\tFloat64\t|\tpre-alpha\t|\tnot yet tested\t|\n|\tgeneralized cayley symmetric eigenvalues \t|\tFloat64\t|\tpre-alpha\t|\tnot yet tested\t|\n|\t**Complex**\t|\t\t|\t\t|\t\t|\n|\tsimple complex hermitian eigenvalues\t|\tComplexF64\t|\talpha \t|\tno specialized solver in Arpack.jl\t|\n|\tgeneralized complex hermitian eigenvalues \t|\tComplexF64\t|\talpha \t|\t\t|\n|\tcomplex singular value decomposition\t|\tComplexF64\t|\talpha \t|\t\t|\n|\t**High precision**\t|\t\t|\t\t|\t\t|\n|\tsimple real symmetric eigenvalues\t|\tDouble64, Float64x2, etc\t|\talpha \t|\tno specialized solver in Arpack.jl\t|\n|\tgeneralized real symmetric eigenvalues \t|\tDouble64, Float64x2, etc\t|\talpha \t|\t\t|\n|\tsingular value decomposition \t|\tDouble64, Float64x2, etc\t|\talpha \t|\t\t|\n|\t**Mixed type**\t|\t\t|\t\t|\t\t|\n| \tall previous cases\t|\tAllows Mixed Types\t|\talpha \t|\tno specialized solver in Arpack.jl\t|\n|\t**Exotic features**\t|\t\t|\t--------\t|\t\t|\n|\tuser-computed shifts\t|\t \t|\tcoded\t|\t\t|\n|\tshift invert, buckling, cayley\t|\tComplexF64, Float64\t|\tcoded\t|\t\t|\n|\tshift invert, buckling, cayley\t|\thigh-precision\t|\tcoded\t|\t\t|\n\nUsing high-precision types\n--------------------------\n`GenericArpack.jl` is taxing in the extensive use of floating point thresholds. Sometimes these\nare not always perfectly supported by auxilary packages. \n\n### `Quadmath.jl`\n\nThis works directly without modification for `Quadmath.jl`, although note that\nmany operations in `Quadmath.jl` allocate whereas those in the libraries below\ndo not. For instance, `generic_matvecmul!` on a matrix with `Float128` will allocate in some\ncalls. \n\n### `DoubleFloats.jl`\n\nYou can make using `Double64` types about 1.5x faster by giving it two constants. This is what our fix does. \n```\nusing DoubleFloats\nGenericArpack.@fix_doublefloats\n```\n\nTo see what is executed, run `@macroexpand GenericArpack.@fix_doublefloats`. This defines:\n- `LinearAlgebra.floatmin2` and\n- `maxit` for the eigenvalue computation\n\n### `MultiFloats.jl`\n\nMake sure to execute\n```\nusing MultiFloats\nGenericArpack.@fix_multifloats\n```\n\nTo see what is executed, run `@macroexpand GenericArpack.@fix_multifloats`. This defines:\n- `_eps23` for each `MultiFloat` type.\n- `maxit` for the eigenvalue computation\n- `Int(x::MultiFloat)`\n\nHistory\n-------\nThis started as a \"me-project\" to work on to I can learn something and see how various ideas work.\n\nThe goal of this exercise is to port the double-precision ARPACK\nfor symmetric matrices in Julia. Including all ARPACK stuff. So this should\ngive \"exactly\" what ARPACK does but be a pure Julia implementation.\n(Where exactly is ... it should be executing roughly the same sequence of\nfloating point operations and can differ on levels that would be expected\nfor different compilers compiling the same code.)\n\n- not a goal to \"Julia-ize\" the package; I want to keep as close to the FORTRAN\n  as possible so that I might be able to replace calls to Julia's Arpack.saupd /\n  Arpack.seupd (which call the Fortran library) with this code; \n  while this is possible, it was easier to use new features from `GenericArpack.jl`\n  to implement superior interfaces.\n- small internal function changes are okay, e.g. ARPACK has various debugging\n  and timing stuff that would need to be done differently in Julia.\n- small simplifications, e.g. if a function computes a single Int, we can\n  rewrite that to return the Int rather than writing it into an array like in\n  FORTRAN.\n- Why? Why not implement my own ImplicitRestart/Eigensolver/Etc.? Simple: I trust\n  ARPACK. Also, I want to understand exactly what the symmetric ARPACK solver is doing.\n- Why not use a Fortran-\u003eJulia compiler? Well, I could. But I could also do\n  this and learn intimate details of how it works to help out in teaching :)\n- I want to document some of the cool stuff in ARPACK!\n\nAlong the way, it seemed like in many cases it was possible to get\n_bitwise equivalent floating point_ results for Float64 types. So \nwe seek to do that or understand why it is not possible. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdgleich%2Fgenericarpack.jl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdgleich%2Fgenericarpack.jl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdgleich%2Fgenericarpack.jl/lists"}