This module provides a collection of Krylov-based factorizations forming the
computational core of LightKrylov. It also provides a set of utility functions
to operate on arrays of abstract_vector. The most important ones are:
arnoldi(A, X, H, info): Arnoldi factorization for general square matrices.lanczos(A, X, H, info): Lanczos factorization for general symmetric/hermitian matrices.bidiagonalization(A, U, V, B): Lanczos bidiagonalization for arbitrary matrices.qr(X, R, perm, info): QR factorization (with and without column pivoting) of an array of abstract_vector.Given a square linear operator , find matrices and such that
where is an orthogonal basis and is upper Hessenberg.
Algorithmic Features
References
    call arnoldi(A, X, H, info [, kstart] [, kend] [, tol] [, transpose] [, blksize])
A : Linear operator derived from one the base types provided by the AbstractLinops
        module. The operator needs to be square, i.e. the dimension of its domain and
        co-domain is the same. It is an intent(inout) argument.
X : Array of types derived from one the base types provided by the AbstractVectors
        module. It needs to be consistent with the type of A. On exit, it contains the
        the computed Krylov vectors. The first entry X(1) is the starting vector for
        the Arnoldi factorization. Additionally, the maximum number of Arnoldi steps
        is equal to size(X) - 1. It is an intent(inout) argument.
-H : real or complex rank-2 array. On exit, it contains the 
        upper Hessenberg matrix computed from the Arnoldi factorization. It is an
        intent(inout) argument.
-info :   integer variable. It is the LightKrylov information flag. On exit, if
            info > 0, the Arnoldi factorization experienced a lucky breakdown. 
            The array of Krylov vectors X spans an -invariant subpsace of
            dimension info.
kstart (optional) :   integer value determining the index of the first Arnoldi
                            step to be computed. By default, kstart = 1. It is an
                            optional intent(in) argument.
kend (optional)   :   integer value determining the index of the last Arnoldi step
                            to be computed. It is an optional intent(in) argument. 
                            By default, kend = size(X) - 1.
tol (optional)    :   Numerical tolerance below which a subspace is considered
                            to be -invariant. It is an optional intent(in) argument.
                            By default tol = atol_sp or tol = atol_rp depending on the 
                            kind of A.
transpose (optional)  :   logical flag determining whether the Arnoldi factorization
                                is applied to  or . It is an optional intent(in)
                                argument. Default transpose = .false.
blksize (optional)    :   integer value determining the dimension of a block for the
                                block Arnoldi factorization. It is an optional intent(in) 
                                argument. Default is blksize=1.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(abstract_linop_cdp), | intent(inout) | :: | A | Linear operator to be factorized. | ||
| class(abstract_vector_cdp), | intent(inout) | :: | X(:) | Orthogonal basis for the generated Krylov subspace. | ||
| complex(kind=dp), | intent(inout) | :: | H(:,:) | Upper Hessenberg matrix. | ||
| integer, | intent(out) | :: | info | Information flag. | ||
| integer, | intent(in), | optional | :: | kstart | Starting index for the Arnoldi factorization (default 1). | |
| integer, | intent(in), | optional | :: | kend | Final index for the Arnoldi factorization (default  | |
| real(kind=dp), | intent(in), | optional | :: | tol | Tolerance to determine whether an invariant subspace has been computed or not. | |
| logical, | intent(in), | optional | :: | transpose | Whether  is being transposed or not (default  | |
| integer, | intent(in), | optional | :: | blksize | Block size for block Arnoldi (default 1). | 
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(abstract_linop_csp), | intent(inout) | :: | A | Linear operator to be factorized. | ||
| class(abstract_vector_csp), | intent(inout) | :: | X(:) | Orthogonal basis for the generated Krylov subspace. | ||
| complex(kind=sp), | intent(inout) | :: | H(:,:) | Upper Hessenberg matrix. | ||
| integer, | intent(out) | :: | info | Information flag. | ||
| integer, | intent(in), | optional | :: | kstart | Starting index for the Arnoldi factorization (default 1). | |
| integer, | intent(in), | optional | :: | kend | Final index for the Arnoldi factorization (default  | |
| real(kind=sp), | intent(in), | optional | :: | tol | Tolerance to determine whether an invariant subspace has been computed or not. | |
| logical, | intent(in), | optional | :: | transpose | Whether  is being transposed or not (default  | |
| integer, | intent(in), | optional | :: | blksize | Block size for block Arnoldi (default 1). | 
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(abstract_linop_rdp), | intent(inout) | :: | A | Linear operator to be factorized. | ||
| class(abstract_vector_rdp), | intent(inout) | :: | X(:) | Orthogonal basis for the generated Krylov subspace. | ||
| real(kind=dp), | intent(inout) | :: | H(:,:) | Upper Hessenberg matrix. | ||
| integer, | intent(out) | :: | info | Information flag. | ||
| integer, | intent(in), | optional | :: | kstart | Starting index for the Arnoldi factorization (default 1). | |
| integer, | intent(in), | optional | :: | kend | Final index for the Arnoldi factorization (default  | |
| real(kind=dp), | intent(in), | optional | :: | tol | Tolerance to determine whether an invariant subspace has been computed or not. | |
| logical, | intent(in), | optional | :: | transpose | Whether  is being transposed or not (default  | |
| integer, | intent(in), | optional | :: | blksize | Block size for block Arnoldi (default 1). | 
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(abstract_linop_rsp), | intent(inout) | :: | A | Linear operator to be factorized. | ||
| class(abstract_vector_rsp), | intent(inout) | :: | X(:) | Orthogonal basis for the generated Krylov subspace. | ||
| real(kind=sp), | intent(inout) | :: | H(:,:) | Upper Hessenberg matrix. | ||
| integer, | intent(out) | :: | info | Information flag. | ||
| integer, | intent(in), | optional | :: | kstart | Starting index for the Arnoldi factorization (default 1). | |
| integer, | intent(in), | optional | :: | kend | Final index for the Arnoldi factorization (default  | |
| real(kind=sp), | intent(in), | optional | :: | tol | Tolerance to determine whether an invariant subspace has been computed or not. | |
| logical, | intent(in), | optional | :: | transpose | Whether  is being transposed or not (default  | |
| integer, | intent(in), | optional | :: | blksize | Block size for block Arnoldi (default 1). | 
Given a general linear operator , find matrices , and such that
where and are orthogonal bases for the column span and row span of , respectively, and is a bidiagonal matrix.
Algorithmic Features
References
    call bidiagonalization(A, U, V, B, info [, kstart] [, kend] [, tol])
A   :   Linear operator derived from one the base types provided by the 
            AbstractLinops module. It is an intent(inout) argument.
U   :   Array of types derived from one the base types provided by the AbstractVectors
            module. It needs to be consistent with the type of A. On exit, it contains the
            the computed Krylov vectors for the column span of A. The first entry U(1) 
            is the starting vector for the Lanczos factorization. Additionally, the 
            maximum number of Lanczos steps is equal to size(X) - 1. 
            It is an intent(inout) argument.
V   :   Array of types derived from one the base types provided by the AbstractVectors
            module. It needs to be consistent with the type of A. On exit, it contains the
            the computed Krylov vectors for the row span of A. It is an intent(inout) 
            argument.
B   :   real or complex rank-2 array. On exit, it contains the 
            bidiagonal matrix computed from the Lanczos factorization. It is an intent(inout) 
            argument.
info    :   integer variable. It is the LightKrylov information flag. On exit, if
                info > 0, the Lanczos factorization experienced a lucky breakdown. 
kstart (optional) :   integer value determining the index of the first Lanczos
                            step to be computed. It is an optional intent(in) argument.
                            By default, kstart = 1.
kend (optional)   :   integer value determining the index of the last Lanczos step
                            to be computed. It is an optional intent(in) argument. 
                            By default, kend = size(X) - 1.
tol (optional)    :   Numerical tolerance below which a subspace is considered
                            to be -invariant. It is an optional intent(in) argument.
                            By default tol = atol_sp or tol = atol_rp depending on the 
                            kind of A.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(abstract_linop_cdp), | intent(inout) | :: | A | Linear operator to be factorized. | ||
| class(abstract_vector_cdp), | intent(inout) | :: | U(:) | Orthonormal basis for the column span of . On entry,  | ||
| class(abstract_vector_cdp), | intent(inout) | :: | V(:) | Orthonormal basis for the row span of . | ||
| complex(kind=dp), | intent(inout) | :: | B(:,:) | Bidiagonal matrix. | ||
| integer, | intent(out) | :: | info | Information flag. | ||
| integer, | intent(in), | optional | :: | kstart | Starting index for the Lanczos factorization (default 1). | |
| integer, | intent(in), | optional | :: | kend | Final index for the Lanczos factorization (default 1). | |
| real(kind=dp), | intent(in), | optional | :: | tol | Tolerance to determine whether invariant subspaces have been computed or not. | 
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(abstract_linop_csp), | intent(inout) | :: | A | Linear operator to be factorized. | ||
| class(abstract_vector_csp), | intent(inout) | :: | U(:) | Orthonormal basis for the column span of . On entry,  | ||
| class(abstract_vector_csp), | intent(inout) | :: | V(:) | Orthonormal basis for the row span of . | ||
| complex(kind=sp), | intent(inout) | :: | B(:,:) | Bidiagonal matrix. | ||
| integer, | intent(out) | :: | info | Information flag. | ||
| integer, | intent(in), | optional | :: | kstart | Starting index for the Lanczos factorization (default 1). | |
| integer, | intent(in), | optional | :: | kend | Final index for the Lanczos factorization (default 1). | |
| real(kind=sp), | intent(in), | optional | :: | tol | Tolerance to determine whether invariant subspaces have been computed or not. | 
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(abstract_linop_rdp), | intent(inout) | :: | A | Linear operator to be factorized. | ||
| class(abstract_vector_rdp), | intent(inout) | :: | U(:) | Orthonormal basis for the column span of . On entry,  | ||
| class(abstract_vector_rdp), | intent(inout) | :: | V(:) | Orthonormal basis for the row span of . | ||
| real(kind=dp), | intent(inout) | :: | B(:,:) | Bidiagonal matrix. | ||
| integer, | intent(out) | :: | info | Information flag. | ||
| integer, | intent(in), | optional | :: | kstart | Starting index for the Lanczos factorization (default 1). | |
| integer, | intent(in), | optional | :: | kend | Final index for the Lanczos factorization (default 1). | |
| real(kind=dp), | intent(in), | optional | :: | tol | Tolerance to determine whether invariant subspaces have been computed or not. | 
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(abstract_linop_rsp), | intent(inout) | :: | A | Linear operator to be factorized. | ||
| class(abstract_vector_rsp), | intent(inout) | :: | U(:) | Orthonormal basis for the column span of . On entry,  | ||
| class(abstract_vector_rsp), | intent(inout) | :: | V(:) | Orthonormal basis for the row span of . | ||
| real(kind=sp), | intent(inout) | :: | B(:,:) | Bidiagonal matrix. | ||
| integer, | intent(out) | :: | info | Information flag. | ||
| integer, | intent(in), | optional | :: | kstart | Starting index for the Lanczos factorization (default 1). | |
| integer, | intent(in), | optional | :: | kend | Final index for the Lanczos factorization (default 1). | |
| real(kind=sp), | intent(in), | optional | :: | tol | Tolerance to determine whether invariant subspaces have been computed or not. | 
Given an array  of abstract_vector and an abstract_vector 
(or array of abstract_vectors) , this subroutine returns a modified 
vector  orthogonal to all columns of , i.e.
using a double Gram-Schmidt process. On exit, is orthogonal to but does not have unit norm. Note moreover that is assumed to be an orthonormal set of vectors. The function can also return the projection coefficients .
    call double_gram_schmidt_step(y, X, info [, if_chk_orthonormal] [, beta])
y   :   abstract_vector (or array of abstract_vector) that needs to be
            orthogonalize in-place against . It is an intent(inout) argument.
X   :   Array of abstract_vector against which  needs to be orthogonalized.
            Note the function assumes that  is an orthonormal set of vectors, i.e.
            . If it this is not the case, the result is meaningless. 
            It is an intent(in) argument.
info    :   integer Information flag.
if_chk_orthonormal (optional) :   logical flag to check whether 
                                         is an orthonormal set of vectors or not. 
                                        If the orthonormality returns .false., the function raises
                                        an error. Note that this check is computationally expensive 
                                        and should be disabled in production unless required
                                        for better performance. Is is an optional intent(in) 
                                        argument. Default .true..
beta (optional)   :   real or complex array containing the coefficients .
                            Is is an optional intent(out) argument.
Computes one step of the double Gram-Schmidt orthogonalization process of the
abstract_vector y against the abstract_vector basis X
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(abstract_vector_cdp), | intent(inout) | :: | Y(:) | Input  | ||
| class(abstract_vector_cdp), | intent(in) | :: | X(:) | Input  | ||
| integer, | intent(out) | :: | info | Information flag. | ||
| logical, | intent(in), | optional | :: | if_chk_orthonormal | Check that input Krylov vectors  | |
| complex(kind=dp), | intent(out), | optional | :: | beta(:,:) | Projection coefficients if requested | 
Computes one step of the double Gram-Schmidt orthogonalization process of the
abstract_vector y against the abstract_vector basis X
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(abstract_vector_csp), | intent(inout) | :: | Y(:) | Input  | ||
| class(abstract_vector_csp), | intent(in) | :: | X(:) | Input  | ||
| integer, | intent(out) | :: | info | Information flag. | ||
| logical, | intent(in), | optional | :: | if_chk_orthonormal | Check that input Krylov vectors  | |
| complex(kind=sp), | intent(out), | optional | :: | beta(:,:) | Projection coefficients if requested | 
Computes one step of the double Gram-Schmidt orthogonalization process of the
abstract_vector y against the abstract_vector basis X
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(abstract_vector_rdp), | intent(inout) | :: | Y(:) | Input  | ||
| class(abstract_vector_rdp), | intent(in) | :: | X(:) | Input  | ||
| integer, | intent(out) | :: | info | Information flag. | ||
| logical, | intent(in), | optional | :: | if_chk_orthonormal | Check that input Krylov vectors  | |
| real(kind=dp), | intent(out), | optional | :: | beta(:,:) | Projection coefficients if requested | 
Computes one step of the double Gram-Schmidt orthogonalization process of the
abstract_vector y against the abstract_vector basis X
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(abstract_vector_rsp), | intent(inout) | :: | Y(:) | Input  | ||
| class(abstract_vector_rsp), | intent(in) | :: | X(:) | Input  | ||
| integer, | intent(out) | :: | info | Information flag. | ||
| logical, | intent(in), | optional | :: | if_chk_orthonormal | Check that input Krylov vectors  | |
| real(kind=sp), | intent(out), | optional | :: | beta(:,:) | Projection coefficients if requested | 
Computes one step of the double Gram-Schmidt orthogonalization process of the
abstract_vector y against the abstract_vector basis X
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(abstract_vector_cdp), | intent(inout) | :: | y | Input  | ||
| class(abstract_vector_cdp), | intent(in) | :: | X(:) | Input  | ||
| integer, | intent(out) | :: | info | Information flag. | ||
| logical, | intent(in), | optional | :: | if_chk_orthonormal | Check that input Krylov vectors  | |
| complex(kind=dp), | intent(out), | optional | :: | beta(:) | Projection coefficients if requested | 
Computes one step of the double Gram-Schmidt orthogonalization process of the
abstract_vector y against the abstract_vector basis X
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(abstract_vector_csp), | intent(inout) | :: | y | Input  | ||
| class(abstract_vector_csp), | intent(in) | :: | X(:) | Input  | ||
| integer, | intent(out) | :: | info | Information flag. | ||
| logical, | intent(in), | optional | :: | if_chk_orthonormal | Check that input Krylov vectors  | |
| complex(kind=sp), | intent(out), | optional | :: | beta(:) | Projection coefficients if requested | 
Computes one step of the double Gram-Schmidt orthogonalization process of the
abstract_vector y against the abstract_vector basis X
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(abstract_vector_rdp), | intent(inout) | :: | y | Input  | ||
| class(abstract_vector_rdp), | intent(in) | :: | X(:) | Input  | ||
| integer, | intent(out) | :: | info | Information flag. | ||
| logical, | intent(in), | optional | :: | if_chk_orthonormal | Check that input Krylov vectors  | |
| real(kind=dp), | intent(out), | optional | :: | beta(:) | Projection coefficients if requested | 
Computes one step of the double Gram-Schmidt orthogonalization process of the
abstract_vector y against the abstract_vector basis X
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(abstract_vector_rsp), | intent(inout) | :: | y | Input  | ||
| class(abstract_vector_rsp), | intent(in) | :: | X(:) | Input  | ||
| integer, | intent(out) | :: | info | Information flag. | ||
| logical, | intent(in), | optional | :: | if_chk_orthonormal | Check that input Krylov vectors  | |
| real(kind=sp), | intent(out), | optional | :: | beta(:) | Projection coefficients if requested | 
Utility function to initialize a basis for a Krylov subspace.
    call initialize_krylov_subspace(X [, X0])
X   :   Array of vectors that needs to be initialized. It is an intent(inout)
            argument. Note that the first action in the subroutine is
            call zero_basis(X), effectively zeroing-out any data stored.
X0 (optional) :   Collection of vectors which will form the first few
                        Krylov vectors. Note that X0 need not be an orthonormal
                        basis as this subroutine includes a call qr(X0). It is an
                        optional intent(in) argument.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(abstract_vector_cdp), | intent(inout) | :: | X(:) | |||
| class(abstract_vector_cdp), | intent(in), | optional | :: | X0(:) | 
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(abstract_vector_csp), | intent(inout) | :: | X(:) | |||
| class(abstract_vector_csp), | intent(in), | optional | :: | X0(:) | 
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(abstract_vector_rdp), | intent(inout) | :: | X(:) | |||
| class(abstract_vector_rdp), | intent(in), | optional | :: | X0(:) | 
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(abstract_vector_rsp), | intent(inout) | :: | X(:) | |||
| class(abstract_vector_rsp), | intent(in), | optional | :: | X0(:) | 
Given a permutation vector , this function computes the vector representation of the inverse permutation matrix.
    inv_perm = invperm(perm)
perm    :   Rank-1 array of integer corresponding to the desired permutation vector.
                It is an intent(in) argument.| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | perm(:) | 
Utility function returning a logical .true. if the set of vectors stored in  form
an orthonormal set of vectors and .false. otherwise.
    out = is_orthonormal(X)
X   :   Array of derived types extended from the base types provided in the
            AbstractVectors module. It is an intent(in) argument.| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(abstract_vector_cdp), | intent(in) | :: | X(:) | 
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(abstract_vector_csp), | intent(in) | :: | X(:) | 
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(abstract_vector_rdp), | intent(in) | :: | X(:) | 
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(abstract_vector_rsp), | intent(in) | :: | X(:) | 
Given a partial Krylov decomposition
this subroutine implements the Krylov-Schur restarting strategy proposed by Stewart [1].
References
    call krylov_schur(n, X, H, select_eigs)
n   :   Number of selected eigenvalues moved to the upper left-block of the 
            Schur matrix. It is an intent(out) argument.
X   :   On entry, array of abstract_vector computed using the Arnoldi process.
            On exit, the first n columns form an orthonormal basis for the eigenspace
            associated with eigenvalues moved to the upper left-block of the Schur matrix.
            It is an intent(inout) argument.
H   :   On entry, real of complex upper Hessenberg matrix computed using the
            Arnoldi process. On exit, the leading  block contains the
             block of the re-ordered Schur matrix containing the selected
            eigenvalues. It is an intent(inout) argument.
select_eigs :   Procedure to select which eigenvalues to move in the upper-left
                block. It is an intent(inout) argument.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(out) | :: | n | Number eigenvalues that have been moved to the upper
left block of the Schur factorization of  | ||
| class(abstract_vector_rsp), | intent(inout) | :: | X(:) | Krylov basis. | ||
| real(kind=sp), | intent(inout) | :: | H(:,:) | Upper Hessenberg matrix. | ||
| procedure(eigvals_select_sp) | :: | select_eigs | Procedure to select the eigenvalues to move in the upper left-block. | 
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(out) | :: | n | Number eigenvalues that have been moved to the upper
left block of the Schur factorization of  | ||
| class(abstract_vector_rdp), | intent(inout) | :: | X(:) | Krylov basis. | ||
| real(kind=dp), | intent(inout) | :: | H(:,:) | Upper Hessenberg matrix. | ||
| procedure(eigvals_select_dp) | :: | select_eigs | Procedure to select the eigenvalues to move in the upper left-block. | 
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(out) | :: | n | Number eigenvalues that have been moved to the upper
left block of the Schur factorization of  | ||
| class(abstract_vector_csp), | intent(inout) | :: | X(:) | Krylov basis. | ||
| complex(kind=sp), | intent(inout) | :: | H(:,:) | Upper Hessenberg matrix. | ||
| procedure(eigvals_select_sp) | :: | select_eigs | Procedure to select the eigenvalues to move in the upper left-block. | 
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(out) | :: | n | Number eigenvalues that have been moved to the upper
left block of the Schur factorization of  | ||
| class(abstract_vector_cdp), | intent(inout) | :: | X(:) | Krylov basis. | ||
| complex(kind=dp), | intent(inout) | :: | H(:,:) | Upper Hessenberg matrix. | ||
| procedure(eigvals_select_dp) | :: | select_eigs | Procedure to select the eigenvalues to move in the upper left-block. | 
Given a symmetric or Hermitian linear operator , find matrices and such that
where is an orthogonal basis and is symmetric tridiagonal.
Algorithmic Features
References
    call lanczos(A, X, T, info [, kstart] [, kend] [, tol])
A   :   Symmetric or Hermitian linear operator derived from one the base types 
            provided by the AbstractLinops module. It is an intent(inout) argument.
X   :   Array of types derived from one the base types provided by the AbstractVectors
            module. It needs to be consistent with the type of A. On exit, it contains the
            the computed Krylov vectors. The first entry X(1) is the starting vector for
            the Lanczos factorization. Additionally, the maximum number of Lanczos steps
            is equal to size(X) - 1. It is an intent(inout) argument.
T   :   real or complex rank-2 array. On exit, it contains the 
            symmetric tridiagonal matrix computed from the Arnoldi factorization. It is an
            intent(inout) argument.
info    :   integer variable. It is the LightKrylov information flag. On exit, if
                info > 0, the Lanczos factorization experienced a lucky breakdown. 
                The array of Krylov vectors X spans an -invariant subpsace of
                dimension info.
kstart (optional) :   integer value determining the index of the first Lanczos
                            step to be computed. It is an optional intent(in) argument.
                            By default, kstart = 1.
kend (optional)   :   integer value determining the index of the last Lanczos step
                            to be computed. It is an optional intent(in) argument. 
                            By default, kend = size(X) - 1.
tol (optional)    :   Numerical tolerance below which a subspace is considered
                            to be -invariant. It is an optional intent(in) argument.
                            By default tol = atol_sp or tol = atol_rp depending on the 
                            kind of A.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(abstract_hermitian_linop_cdp), | intent(inout) | :: | A | |||
| class(abstract_vector_cdp), | intent(inout) | :: | X(:) | |||
| complex(kind=dp), | intent(inout) | :: | T(:,:) | |||
| integer, | intent(out) | :: | info | |||
| integer, | intent(in), | optional | :: | kstart | ||
| integer, | intent(in), | optional | :: | kend | ||
| real(kind=dp), | intent(in), | optional | :: | tol | 
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(abstract_hermitian_linop_csp), | intent(inout) | :: | A | |||
| class(abstract_vector_csp), | intent(inout) | :: | X(:) | |||
| complex(kind=sp), | intent(inout) | :: | T(:,:) | |||
| integer, | intent(out) | :: | info | |||
| integer, | intent(in), | optional | :: | kstart | ||
| integer, | intent(in), | optional | :: | kend | ||
| real(kind=sp), | intent(in), | optional | :: | tol | 
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(abstract_sym_linop_rdp), | intent(inout) | :: | A | |||
| class(abstract_vector_rdp), | intent(inout) | :: | X(:) | |||
| real(kind=dp), | intent(inout) | :: | T(:,:) | |||
| integer, | intent(out) | :: | info | |||
| integer, | intent(in), | optional | :: | kstart | ||
| integer, | intent(in), | optional | :: | kend | ||
| real(kind=dp), | intent(in), | optional | :: | tol | 
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(abstract_sym_linop_rsp), | intent(inout) | :: | A | |||
| class(abstract_vector_rsp), | intent(inout) | :: | X(:) | |||
| real(kind=sp), | intent(inout) | :: | T(:,:) | |||
| integer, | intent(out) | :: | info | |||
| integer, | intent(in), | optional | :: | kstart | ||
| integer, | intent(in), | optional | :: | kend | ||
| real(kind=sp), | intent(in), | optional | :: | tol | 
Orthogonalizes the abstract_vector basis Y against a basis X of abstract_vector.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(abstract_vector_cdp), | intent(inout) | :: | Y(:) | Input  | ||
| class(abstract_vector_cdp), | intent(in) | :: | X(:) | Input  | ||
| integer, | intent(out) | :: | info | Information flag. | ||
| logical, | intent(in), | optional | :: | if_chk_orthonormal | Check that input Krylov vectors  | |
| complex(kind=dp), | intent(out), | optional | :: | beta(:,:) | Projection coefficients if requested | 
Orthogonalizes the abstract_vector basis Y against a basis X of abstract_vector.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(abstract_vector_csp), | intent(inout) | :: | Y(:) | Input  | ||
| class(abstract_vector_csp), | intent(in) | :: | X(:) | Input  | ||
| integer, | intent(out) | :: | info | Information flag. | ||
| logical, | intent(in), | optional | :: | if_chk_orthonormal | Check that input Krylov vectors  | |
| complex(kind=sp), | intent(out), | optional | :: | beta(:,:) | Projection coefficients if requested | 
Orthogonalizes the abstract_vector basis Y against a basis X of abstract_vector.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(abstract_vector_rdp), | intent(inout) | :: | Y(:) | Input  | ||
| class(abstract_vector_rdp), | intent(in) | :: | X(:) | Input  | ||
| integer, | intent(out) | :: | info | Information flag. | ||
| logical, | intent(in), | optional | :: | if_chk_orthonormal | Check that input Krylov vectors  | |
| real(kind=dp), | intent(out), | optional | :: | beta(:,:) | Projection coefficients if requested | 
Orthogonalizes the abstract_vector basis Y against a basis X of abstract_vector.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(abstract_vector_rsp), | intent(inout) | :: | Y(:) | Input  | ||
| class(abstract_vector_rsp), | intent(in) | :: | X(:) | Input  | ||
| integer, | intent(out) | :: | info | Information flag. | ||
| logical, | intent(in), | optional | :: | if_chk_orthonormal | Check that input Krylov vectors  | |
| real(kind=sp), | intent(out), | optional | :: | beta(:,:) | Projection coefficients if requested | 
Orthogonalizes the abstract_vector y against a basis X of abstract_vector.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(abstract_vector_cdp), | intent(inout) | :: | y | Input  | ||
| class(abstract_vector_cdp), | intent(in) | :: | X(:) | Input  | ||
| integer, | intent(out) | :: | info | Information flag. | ||
| logical, | intent(in), | optional | :: | if_chk_orthonormal | Check that input Krylov vectors  | |
| complex(kind=dp), | intent(out), | optional | :: | beta(:) | Projection coefficients if requested | 
Orthogonalizes the abstract_vector y against a basis X of abstract_vector.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(abstract_vector_csp), | intent(inout) | :: | y | Input  | ||
| class(abstract_vector_csp), | intent(in) | :: | X(:) | Input  | ||
| integer, | intent(out) | :: | info | Information flag. | ||
| logical, | intent(in), | optional | :: | if_chk_orthonormal | Check that input Krylov vectors  | |
| complex(kind=sp), | intent(out), | optional | :: | beta(:) | Projection coefficients if requested | 
Orthogonalizes the abstract_vector y against a basis X of abstract_vector.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(abstract_vector_rdp), | intent(inout) | :: | y | Input  | ||
| class(abstract_vector_rdp), | intent(in) | :: | X(:) | Input  | ||
| integer, | intent(out) | :: | info | Information flag. | ||
| logical, | intent(in), | optional | :: | if_chk_orthonormal | Check that input Krylov vectors  | |
| real(kind=dp), | intent(out), | optional | :: | beta(:) | Projection coefficients if requested | 
Orthogonalizes the abstract_vector y against a basis X of abstract_vector.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(abstract_vector_rsp), | intent(inout) | :: | y | Input  | ||
| class(abstract_vector_rsp), | intent(in) | :: | X(:) | Input  | ||
| integer, | intent(out) | :: | info | Information flag. | ||
| logical, | intent(in), | optional | :: | if_chk_orthonormal | Check that input Krylov vectors  | |
| real(kind=sp), | intent(out), | optional | :: | beta(:) | Projection coefficients if requested | 
Given an array  of vectors, it computes an orthonormal basis for its
column-span using the double_gram_schmidt process. All computations are done
in-place.
    call orthonormalize_basis(X)
X   :   Array of abstract_vector to orthonormalize. Note that this process is done
            in-place. It is an intent(inout) argument.Orthonormalizes the abstract_vector basis X
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(abstract_vector_cdp), | intent(inout) | :: | X(:) | Input  | 
Orthonormalizes the abstract_vector basis X
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(abstract_vector_csp), | intent(inout) | :: | X(:) | Input  | 
Orthonormalizes the abstract_vector basis X
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(abstract_vector_rdp), | intent(inout) | :: | X(:) | Input  | 
Orthonormalizes the abstract_vector basis X
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(abstract_vector_rsp), | intent(inout) | :: | X(:) | Input  | 
Given an array and a permutation vector , this function computes in-place the column-permuted matrix
where is the column-permutation matrix constructed from the permutation vector .
    call permcols(X, perm)
X   :   Array of vectors derived from the base types defined in the AbstractVectors
            module. On entry, it is the original array. On exit, it contains the
            column-permuted version computed in-place. It is an intent(inout) argument.
perm    :   Rank-1 array of integer corresponding to the desired permutation vector.
                It is an intent(in) argument.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| complex(kind=dp), | intent(inout) | :: | Q(:,:) | Basis vectors to be permuted. | ||
| integer, | intent(in) | :: | perm(:) | 
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| complex(kind=sp), | intent(inout) | :: | Q(:,:) | Basis vectors to be permuted. | ||
| integer, | intent(in) | :: | perm(:) | 
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=dp), | intent(inout) | :: | Q(:,:) | Basis vectors to be permuted. | ||
| integer, | intent(in) | :: | perm(:) | 
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=sp), | intent(inout) | :: | Q(:,:) | Basis vectors to be permuted. | ||
| integer, | intent(in) | :: | perm(:) | 
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(abstract_vector_cdp), | intent(inout) | :: | Q(:) | Basis vectors to be permuted. | ||
| integer, | intent(in) | :: | perm(:) | 
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(abstract_vector_csp), | intent(inout) | :: | Q(:) | Basis vectors to be permuted. | ||
| integer, | intent(in) | :: | perm(:) | 
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(abstract_vector_rdp), | intent(inout) | :: | Q(:) | Basis vectors to be permuted. | ||
| integer, | intent(in) | :: | perm(:) | 
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(abstract_vector_rsp), | intent(inout) | :: | Q(:) | Basis vectors to be permuted. | ||
| integer, | intent(in) | :: | perm(:) | 
Given an array  of types derived from abstract_vector, it computes the
in-place QR factorization of , i.e.
where is an orthonormal arrays of vectors such that and is upper triangular. Note that it can also perform the QR factorization with column pivoting
where is a permutation matrix ensuring that the diagonal entries of have non-increasing absolute values. This amounts to using the pivoting QR as a rank-revealing factorization.
References
    call qr(Q [, R] [, perm], info [, tol])
Q   :   Array of types derived from one of the base types provided in the
            AbstractVectors module. On entry, it contains the original array.
            On exit, it is overwritten by the orthogonal basis for its span.
            It is an intent(inout) argument.
R   :   real or complex rank-2 array. On exit, its contains the upper triangular
            matrix resulting from the QR factorization. It is an intent(out) argument.
perm (optional)   :   Rank-1 array of integer corresponding to the indices of
                            permuted columns. If perm is absent, the naive QR factorization
                            is being computed. In is an optional intent(in) argument.
info    :   integer information flag.
tol (optional)    :   Numerical tolerance to determine whether two vectors are colinear
                            or not. It is an optional intent(in) argument. Default tol = atol_sp or 
                            tol = atol_dp.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(abstract_vector_cdp), | intent(inout) | :: | Q(:) | Array of  | ||
| complex(kind=dp), | intent(out) | :: | R(:,:) | Upper triangular matrix resulting from the QR factorization. | ||
| integer, | intent(out) | :: | info | Information flag. | ||
| real(kind=dp), | intent(in), | optional | :: | tol | 
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(abstract_vector_csp), | intent(inout) | :: | Q(:) | Array of  | ||
| complex(kind=sp), | intent(out) | :: | R(:,:) | Upper triangular matrix resulting from the QR factorization. | ||
| integer, | intent(out) | :: | info | Information flag. | ||
| real(kind=sp), | intent(in), | optional | :: | tol | 
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(abstract_vector_rdp), | intent(inout) | :: | Q(:) | Array of  | ||
| real(kind=dp), | intent(out) | :: | R(:,:) | Upper triangular matrix resulting from the QR factorization. | ||
| integer, | intent(out) | :: | info | Information flag. | ||
| real(kind=dp), | intent(in), | optional | :: | tol | 
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(abstract_vector_rsp), | intent(inout) | :: | Q(:) | Array of  | ||
| real(kind=sp), | intent(out) | :: | R(:,:) | Upper triangular matrix resulting from the QR factorization. | ||
| integer, | intent(out) | :: | info | Information flag. | ||
| real(kind=sp), | intent(in), | optional | :: | tol | 
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(abstract_vector_cdp), | intent(inout) | :: | Q(:) | Array of  | ||
| complex(kind=dp), | intent(out) | :: | R(:,:) | Upper triangular matrix resulting from the QR factorization. | ||
| integer, | intent(out) | :: | perm(size(Q)) | Permutation matrix. | ||
| integer, | intent(out) | :: | info | Information flag. | ||
| real(kind=dp), | intent(in), | optional | :: | tol | 
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(abstract_vector_csp), | intent(inout) | :: | Q(:) | Array of  | ||
| complex(kind=sp), | intent(out) | :: | R(:,:) | Upper triangular matrix resulting from the QR factorization. | ||
| integer, | intent(out) | :: | perm(size(Q)) | Permutation matrix. | ||
| integer, | intent(out) | :: | info | Information flag. | ||
| real(kind=sp), | intent(in), | optional | :: | tol | 
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(abstract_vector_rdp), | intent(inout) | :: | Q(:) | Array of  | ||
| real(kind=dp), | intent(out) | :: | R(:,:) | Upper triangular matrix resulting from the QR factorization. | ||
| integer, | intent(out) | :: | perm(size(Q)) | Permutation matrix. | ||
| integer, | intent(out) | :: | info | Information flag. | ||
| real(kind=dp), | intent(in), | optional | :: | tol | 
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(abstract_vector_rsp), | intent(inout) | :: | Q(:) | Array of  | ||
| real(kind=sp), | intent(out) | :: | R(:,:) | Upper triangular matrix resulting from the QR factorization. | ||
| integer, | intent(out) | :: | perm(size(Q)) | Permutation matrix. | ||
| integer, | intent(out) | :: | info | Information flag. | ||
| real(kind=sp), | intent(in), | optional | :: | tol |