Solvers and FPCA

Functions for solving linear systems and performing functional principal component analysis.

CovIterSolvers.conj_lanczosFunction
conj_lanczos(b0, D, C; ...)

Performs the C-Lanczos algorithm for the generalized eigenvalue problem D*C*q = λ*q.

This iterative method generates a C-orthonormal basis Q for the Krylov subspace and a symmetric tridiagonal matrix T that represents the projection of the operator D*C onto that subspace.

Arguments

  • b0::AbstractBlockVector{T}: The starting vector for the iteration.
  • D::BlockDiagonal{T}: A block-diagonal matrix to factorize.
  • C::AbstractBlockMatrix{T}: A symmetric, positive-definite matrix defining the inner product (C-inner product).

Keyword Arguments

  • itmax::Int=100: Maximum number of iterations.
  • tol::Float64=1e-8: Tolerance for the C-norm of the residual to determine convergence.
  • history::Bool=false: If true, the history of residual C-norms is stored and returned.
  • reortho_level::Symbol=:full: Level of reorthogonalization. Use :full for numerical stability, or :none to observe loss of orthogonality.

Returns

  • NamedTuple: A named tuple (T, Q, history) containing:
    • T: A SymTridiagonal matrix.
    • Q: A matrix whose columns are the C-orthonormal Lanczos basis vectors.
    • history: A vector of residual C-norms, or nothing if history=false.
source
CovIterSolvers.fpcaFunction
fpca(k, E, A, myspline)
fpca(k, E, A, K; itmax=50)

Performs Functional Principal Component Analysis (FPCA) to find the evaluation of leading k eigenfunctions and their corresponding eigenvalues.

This function solves the generalized eigenvalue problem A*v = λ*G*v or A*v = λ*K*v using one of two methods:

  1. Direct B-spline Method: When provided with a BSplineMethod, it solves the problem directly using a Cholesky and eigenvalue decomposition. This is suitable for smaller, well-behaved systems where the Galerkin matrix G can be formed.
  2. Iterative Krylov Method: When provided with a covariance matrix K, it uses the Conjugate Lanczos algorithm (conj_lanczos) to iteratively find the eigenvalues. This is suitable for large, sparse, or matrix-free problems.

Arguments

  • k::Int: The number of principal components to compute.
  • E::BlockMatrix: The evaluation matrix that maps coefficients to function values.
  • A::BlockDiagonal: A block-diagonal matrix representing the prior covariance of the coefficients (the A matrix in the eigenproblem).
  • myspline::BSplineMethod: A B-spline method object defining the basis.
  • K::BlockMatrix: A Gram matrix representing the inner product for the eigenproblem.

Keyword Arguments

  • itmax::Int=50: (Iterative method only) The maximum number of iterations for the Lanczos algorithm.

Returns

  • Tuple{Vector, Matrix}: A tuple containing:
    1. A vector of the k largest eigenvalues (PC variances).
    2. A matrix whose columns are the corresponding k eigenfunctions (PC vectors).
source