A Julia package collecting a number of Krylov-based algorithms for linear problems, singular value and eigenvalue problems and the application of functions of linear maps or operators to vectors.
Documentation | Build Status | Digital Object Idenitifier | License |
---|---|---|---|
KrylovKit v0.9 adds to new sets of functionality:
- The function
lssolve
can be used to solve linear least squares problems, i.e. problems of the formx = argmin(norm(A*x - b))
for a given linear mapA
and vectorb
. Currently, only one algorithm is implemented, namely the LSMR algorithm of Fong and Saunders. - There are now two new functions
reallinsolve
andrealeigsolve
, which are useful when using vectors with complex arithmetic, but where the linear map (implemented as a functionf
) acts as a real linear map, meaning that it only satisfiesf(α*x) = α*f(x)
whenα
is a real number. This occurs for example when computing the Jacobian of a complex function that is not holomorphic, e.g. in the context of automatic differentation. This is implemented by simply wrapping the vector asRealVec
, which is a specificInnerProductVec
type where the redefined inner product forgets about the imaginary part of the originalinner
function, thereby effectively treating the vector as living in a real vector space. Furthermore, in this setting, only real linear combinations of vectors are allowed, so that for the case ofeigsolve
, only real eigenvalues and eigenvectors are computed. An error will be thrown if the requested list of eigenvalues contains complex eigenvalues.
KrylovKit.jl accepts general functions or callable objects as linear maps, and general Julia objects with vector like behavior (as defined in the docs) as vectors.
The high level interface of KrylovKit is provided by the following functions:
linsolve
: solve linear systemslssolve
: solve least squares problemseigsolve
: find a few eigenvalues and corresponding eigenvectorsgeneigsolve
: find a few generalized eigenvalues and corresponding vectorssvdsolve
: find a few singular values and corresponding left and right singular vectorsexponentiate
: apply the exponential of a linear map to a vectorexpintegrator
: exponential integrator for a linear non-homogeneous ODE, computes a linear combination of theϕⱼ
functions which generalizeϕ₀(z) = exp(z)
.
KrylovKit.jl
can be installed with the Julia package manager.
From the Julia REPL, type ]
to enter the Pkg REPL mode and run:
pkg> add KrylovKit
Or, equivalently, via the Pkg
API:
julia> import Pkg; Pkg.add("KrylovKit.jl")
- STABLE - documentation of the most recently tagged version.
- DEVEL - documentation of the in-development version.
The package is tested against Julia 1.6
, the long-term stable release (1.10), the current stable release as well
as nightly builds of the Julia master
branch on Linux, macOS, and Windows 64-bit architecture and with 1
and 4
threads.
Contributions are very welcome, as are feature requests and suggestions. Please open an issue if you encounter any problems.