### Install KrylovKit.jl using Pkg API Source: https://github.com/jutho/krylovkit.jl/blob/master/README.md Alternatively, add KrylovKit.jl programmatically using the Pkg API in Julia. ```julia julia> import Pkg; Pkg.add("KrylovKit.jl") ``` -------------------------------- ### Install KrylovKit.jl using Pkg REPL Source: https://github.com/jutho/krylovkit.jl/blob/master/README.md Use this command in the Julia Pkg REPL to add KrylovKit.jl to your project. ```julia pkg> add KrylovKit ``` -------------------------------- ### Load KrylovKit.jl Module Source: https://github.com/jutho/krylovkit.jl/blob/master/docs/src/man/intro.md Load the KrylovKit module into your Julia session to start using its functionalities. ```julia using KrylovKit ``` -------------------------------- ### Install KrylovKit.jl Package Source: https://github.com/jutho/krylovkit.jl/blob/master/docs/src/man/intro.md Use the Julia package manager to add the KrylovKit package. This package has no external dependencies beyond the standard Julia library. ```julia using Pkg Pkg.add("KrylovKit") ``` -------------------------------- ### Documentation for lssolve Source: https://github.com/jutho/krylovkit.jl/blob/master/docs/src/man/leastsquares.md Displays the documentation for the `lssolve` function, which is used to solve least squares problems. ```julia #src using KrylovKit lssolve #end ``` -------------------------------- ### Manipulating Krylov Factorizations Source: https://github.com/jutho/krylovkit.jl/blob/master/docs/src/man/implementation.md Functions for manipulating Krylov iterative processes and their factorizations. ```julia expand! ``` ```julia shrink! ``` ```julia initialize ``` ```julia initialize! ``` -------------------------------- ### Block QR Factorization Source: https://github.com/jutho/krylovkit.jl/blob/master/docs/src/man/implementation.md Orthonormalizes a block of vectors using QR factorization. ```julia KrylovKit.block_qr! ``` -------------------------------- ### Common Interface for KrylovKit Solvers Source: https://github.com/jutho/krylovkit.jl/blob/master/docs/src/man/intro.md High-level functions like linsolve, eigsolve, etc., follow a common interface. The linear map can be provided directly or using Julia's 'do' block syntax. ```julia results..., info = problemsolver(A, args...; kwargs...) ``` ```julia results..., info = problemsolver(args...; kwargs...) do x y = # implement linear map on x return y end ``` -------------------------------- ### Accessing Krylov Factorization Components Source: https://github.com/jutho/krylovkit.jl/blob/master/docs/src/man/implementation.md Functions to access defining components of a KrylovFactorization or GKLFactorization. ```julia basis ``` ```julia rayleighquotient ``` ```julia residual ``` ```julia normres ``` ```julia rayleighextension ``` -------------------------------- ### Project Vector onto Orthonormal Basis Source: https://github.com/jutho/krylovkit.jl/blob/master/docs/src/man/implementation.md Calculates the expansion coefficients of a vector in terms of a given orthonormal basis. ```julia KrylovKit.project!! ``` -------------------------------- ### Solving Linear Systems with Real Linear Maps Source: https://github.com/jutho/krylovkit.jl/blob/master/docs/src/man/reallinear.md Use `reallinsolve` to solve linear systems Ax=b where A is a real linear map. This function requires specifying the Krylov algorithm (e.g., GMRES or BiCGStab). ```julia reallinsolve ``` -------------------------------- ### In-place Orthogonalize and Orthonormalize Source: https://github.com/jutho/krylovkit.jl/blob/master/docs/src/man/implementation.md In-place versions for orthogonalizing or orthonormalizing a vector. ```julia KrylovKit.orthogonalize!! ``` ```julia KrylovKit.orthonormalize!! ``` -------------------------------- ### Krylov Factorization Types Source: https://github.com/jutho/krylovkit.jl/blob/master/docs/src/man/implementation.md Abstract and concrete types representing Krylov factorizations. ```julia KrylovKit.KrylovFactorization ``` ```julia KrylovKit.LanczosFactorization ``` ```julia KrylovKit.BlockLanczosFactorization ``` ```julia KrylovKit.ArnoldiFactorization ``` ```julia KrylovKit.GKLFactorization ``` -------------------------------- ### Solving Eigenvalue Systems with Real Linear Maps Source: https://github.com/jutho/krylovkit.jl/blob/master/docs/src/man/reallinear.md Use `realeigsolve` to find real eigenvalues and eigenvectors of a real linear map. This function requires specifying the Krylov algorithm (e.g., Arnoldi) and only considers real eigenvalues. ```julia realeigsolve ``` -------------------------------- ### Golub-Kahan-Lanczos Iterator Source: https://github.com/jutho/krylovkit.jl/blob/master/docs/src/man/implementation.md Iterator for the Golub-Kahan-Lanczos bidiagonalization process. ```julia KrylovKit.GKLIterator ``` -------------------------------- ### Krylov Iterator Types Source: https://github.com/jutho/krylovkit.jl/blob/master/docs/src/man/implementation.md Iterator types for generating Krylov factorizations. ```julia KrylovKit.KrylovIterator ``` ```julia KrylovKit.LanczosIterator ``` ```julia KrylovKit.BlockLanczosIterator ``` ```julia KrylovKit.ArnoldiIterator ``` -------------------------------- ### Compute Real Eigenvalues with realeigsolve Source: https://github.com/jutho/krylovkit.jl/blob/master/docs/src/man/eig.md Use `realeigsolve` when you need to compute several eigenvalues of a real linear map, and you know that all of them, along with their associated eigenvectors, will be real-valued. This method avoids unnecessary complex number computations. ```julia using KrylovKit A = rand(10,10) x0 = rand(10) n = 3 # Compute real eigenvalues and eigenvectors for a real map vals, vecs, info = realeigsolve(A, x0, n, :LM) ``` -------------------------------- ### Exponential Integrator Function Source: https://github.com/jutho/krylovkit.jl/blob/master/docs/src/man/matfun.md Use `expintegrator` for computing exponential integrators, which are used for linear non-homogeneous ODEs. This function approximates `f(A) * b` where `f` is a generalized exponential function. ```julia using KrylovKit expintegrator(A, b) ``` -------------------------------- ### Compute Singular Values and Vectors with svdsolve Source: https://github.com/jutho/krylovkit.jl/blob/master/docs/src/man/svd.md Use the `svdsolve` function to iteratively compute a few singular values and their corresponding left and right singular vectors. This function is the primary tool for SVD-related computations in KrylovKit.jl. ```julia using KrylovKit # Example usage (assuming A is a matrix or linear operator) # vals, vecs = svdsolve(A, nev=3, tol=1e-6, maxiter=1000) # For documentation purposes, the actual call is not shown here, but the function signature is: # svdsolve(A, [x0]; nev = 1, tol = sqrt(eps(realtype(A))), maxiter = default_maxiter, v0 = false, kryloviter = default_kryloviter, verbosity = 1, kwargs...) ``` -------------------------------- ### Compute Partial Schur Factorization with schursolve Source: https://github.com/jutho/krylovkit.jl/blob/master/docs/src/man/eig.md Use `schursolve` to compute a partial Schur factorization, which can be used to find eigenvalues without necessarily computing eigenvectors directly. This is efficient when only eigenvalues are needed or for specific real-valued problems. ```julia using KrylovKit A = rand(10,10) x0 = rand(10) n = 1 # Compute partial Schur factorization for largest magnitude eigenvalues T, vecs, vals, info = schursolve(A, x0, n, :LM) ``` -------------------------------- ### KrylovKit.OrthonormalBasis Type Source: https://github.com/jutho/krylovkit.jl/blob/master/docs/src/man/implementation.md Concrete implementation for an orthonormal basis of vectors. ```julia KrylovKit.OrthonormalBasis ``` -------------------------------- ### Solve Linear Systems Source: https://github.com/jutho/krylovkit.jl/blob/master/docs/src/man/linear.md Use the `linsolve` function to solve linear systems of the form A*x=b. Ensure that the linear map `A` has the same output and input types as the right-hand side `b`. ```julia linsolve ``` -------------------------------- ### Solving Least Squares Problems with Real Linear Maps Source: https://github.com/jutho/krylovkit.jl/blob/master/docs/src/man/reallinear.md Use `reallssolve` to solve least squares problems Ax=b where A is a real linear map. This function requires specifying the Krylov algorithm (e.g., LSMR). ```julia reallssolve ``` -------------------------------- ### Orthogonalize and Orthonormalize Vectors Source: https://github.com/jutho/krylovkit.jl/blob/master/docs/src/man/implementation.md Functions to orthogonalize or orthonormalize a vector against another vector or an orthonormal basis. ```julia KrylovKit.orthogonalize ``` ```julia KrylovKit.orthonormalize ``` -------------------------------- ### Unproject Vector from Orthonormal Basis Source: https://github.com/jutho/krylovkit.jl/blob/master/docs/src/man/implementation.md Performs the inverse calculation of projecting a vector onto an orthonormal basis. ```julia KrylovKit.unproject!! ``` -------------------------------- ### Basis Transformation (Rotation) Source: https://github.com/jutho/krylovkit.jl/blob/master/docs/src/man/implementation.md Computes a rotation of an orthonormal basis without changing the spanned subspace. ```julia KrylovKit.basistransform! ``` -------------------------------- ### Geneigsolve Function Signature Source: https://github.com/jutho/krylovkit.jl/blob/master/docs/src/man/eig.md This snippet shows the signature of the `geneigsolve` function, which is used to solve generalized eigenvalue problems. Note that automatic differentiation is not currently supported. ```julia geneigsolve ``` -------------------------------- ### KrylovKit.Block Type Source: https://github.com/jutho/krylovkit.jl/blob/master/docs/src/man/implementation.md Data structure for storing a block of vectors, used in block Krylov methods. ```julia KrylovKit.Block ``` -------------------------------- ### Block Reorthogonalization Source: https://github.com/jutho/krylovkit.jl/blob/master/docs/src/man/implementation.md Performs reorthogonalization on a block of vectors. ```julia KrylovKit.block_reorthogonalize! ``` -------------------------------- ### Exponentiate Function Source: https://github.com/jutho/krylovkit.jl/blob/master/docs/src/man/matfun.md Use `exponentiate` for solving linear homogeneous ODEs, which involves computing the exponential of a matrix or linear operator. ```julia using KrylovKit exponentiate(A, b) ``` -------------------------------- ### Rank-1 Update for Orthonormal Basis Source: https://github.com/jutho/krylovkit.jl/blob/master/docs/src/man/implementation.md Transforms an orthonormal basis using a rank-1 update, modifying the spanned subspace. ```julia KrylovKit.rank1update! ``` -------------------------------- ### KrylovKit.Basis Type Source: https://github.com/jutho/krylovkit.jl/blob/master/docs/src/man/implementation.md Represents a basis of vectors, used for parameterizing Krylov subspaces. ```julia KrylovKit.Basis ``` -------------------------------- ### Solve Eigenvalue Problems with eigsolve Source: https://github.com/jutho/krylovkit.jl/blob/master/docs/src/man/eig.md Use `eigsolve` to find a selection of eigenvalues and corresponding right eigenvectors of a linear map. Specify targeted eigenvalues using symbols like :LM, :LR, :SR, :LI, :SI, or a custom `EigSorter`. ```julia using KrylovKit A = rand(10,10) x0 = rand(10) n = 1 # Largest magnitude eigenvalues and eigenvectors vals, vecs, info = eigsolve(A, x0, n, :LM) # Smallest imaginary part eigenvalues and eigenvectors vals, vecs, info = eigsolve(A, x0, n, :SI) # Using a custom EigSorter sorter = EigSorter(x -> real(x), :SR) # Smallest real part vals, vecs, info = eigsolve(A, x0, n, sorter) ``` -------------------------------- ### Real Eigenvector from schursolve for Real Maps Source: https://github.com/jutho/krylovkit.jl/blob/master/docs/src/man/eig.md When dealing with a real linear map known to have a unique eigenvalue of largest magnitude, `schursolve` can yield a real-valued eigenvector. The first Schur vector may coincide with this eigenvector. ```julia using KrylovKit A = rand(10,10) x0 = rand(10) T, vecs, vals, info = schursolve(A, x0, 1, :LM, Arnoldi()) # Use vecs[1] as the real valued eigenvector if info.converged is true ``` -------------------------------- ### Solve Eigenvalue Problems with bieigsolve Source: https://github.com/jutho/krylovkit.jl/blob/master/docs/src/man/eig.md Use `bieigsolve` to compute associated 'left' eigenvectors for general linear maps, which satisfy $A^\dagger w = \bar{\lambda} w$. This is particularly useful when dealing with complex eigenvalues and eigenvectors. ```julia using KrylovKit A = rand(10,10) x0 = rand(10) y0 = rand(10) n = 1 # Compute left and right eigenvectors vals, vecs, leftvecs, info = bieigsolve(A, x0, y0, n, :LM) ``` -------------------------------- ### KrylovKit.SimpleBasisVector Type Source: https://github.com/jutho/krylovkit.jl/blob/master/docs/src/man/implementation.md A dedicated type to represent a simple basis vector, often the Rayleigh extension. ```julia KrylovKit.SimpleBasisVector ``` -------------------------------- ### KrylovKit.PackedHessenberg Type Source: https://github.com/jutho/krylovkit.jl/blob/master/docs/src/man/implementation.md Custom matrix type to store the Hessenberg matrix in a packed format without zeros. ```julia KrylovKit.PackedHessenberg ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.