Skip to content

Functionals

Linear functionals are the core abstraction in FunctionalGPs.jl. A linear functional maps a function to a finite-dimensional vector. The most common examples are:

  • Point evaluation: Evaluate a function at specific input locations

  • Integration: Integrate a function over specified domains

  • Derivative evaluation: Evaluate derivatives at specific locations (via composition with differential operators)

Creating Functionals

Point Evaluation

julia
using FunctionalGPs

# Evaluate at three points
X = [0.0, 0.5, 1.0]
δ = EvaluationFunctional(X)

Integration

julia
using FunctionalGPs

# Integrate over an interval
= VectorizedLebesgueIntegral(Interval(0.0, 1.0))

# Integrate over multiple intervals
intervals = [Interval(0.0, 1.0), Interval(1.0, 2.0)]
∫_vec = VectorizedLebesgueIntegral(intervals)

# `IntegralFunctional` is a shorter alias for the same type
= IntegralFunctional(Interval(0.0, 1.0))

Derivative Evaluation

Compose an evaluation functional with a differential operator:

julia
using FunctionalGPs

δ = EvaluationFunctional([0.0, 0.5, 1.0])
∂x = PartialDerivative((1,))
δ_dx = δ  ∂x  # Evaluate the first derivative

Combining Functionals

Functionals can be combined using three operators:

OperatorDescriptionExample
+Sum of functionals (same output shape required)δ1 + δ2
Composition with differential operatorsδ ∘ ∂x
Tensor product for separable domainsδ_x ⊗ ∫_y

Stacking Functionals

Use StackedLinearFunctional to combine functionals with different output shapes:

julia
δ = EvaluationFunctional(X)
∂x = PartialDerivative((1,))
δ_dx = δ  ∂x

# Stack function values and derivative observations
stacked = StackedLinearFunctional(δ, δ_dx)

Tensor Products

Use for multi-dimensional domains with separable structure:

julia
# Evaluate at x, integrate over y (axis-aligned line integrals)
k = k_x  k_y  # Tensor product kernel
δ_x = EvaluationFunctional(x_points)
∫_y = VectorizedLebesgueIntegral(y_intervals)
= δ_x  ∫_y

API Reference

Point Evaluation

FunctionalGPs.EvaluationFunctional Type
julia
EvaluationFunctional <: AbstractLinearFunctional

Point evaluation functional that evaluates a function at specified input locations.

When applied to a GP kernel, this produces the standard covariance matrix between evaluation points. This is the most common functional used in GP regression.

Fields

  • X::AbstractVector: Input locations where the function is evaluated

  • output_shape::Tuple: Shape of the output (automatically set to size(X))

Example

julia
# Evaluate at three points
X = [0.0, 0.5, 1.0]
δ = EvaluationFunctional(X)

# Compose with differentiation to get derivative observations
∂x = PartialDerivative((1,))
δ_dx = δ  ∂x  # Evaluates the derivative at X

See also

source

Integration

FunctionalGPs.VectorizedLebesgueIntegral Type
julia
VectorizedLebesgueIntegral{T <: Domain} <: AbstractLinearFunctional

Integration functional that computes integrals over one or more domains.

This functional represents the Lebesgue integral ∫_D f(x) dx for each domain D in the provided collection. It is useful for Bayesian quadrature, cell-averaged observations, and integral constraints.

Fields

  • domains::AbstractArray{T}: Array of domains to integrate over

Example

julia
using FunctionalGPs

# Single interval integration
= VectorizedLebesgueIntegral(Interval(0.0, 1.0))

# Multiple intervals (vectorized)
intervals = [Interval(0.0, 1.0), Interval(1.0, 2.0), Interval(2.0, 3.0)]
∫_vec = VectorizedLebesgueIntegral(intervals)

# 2D box integration
box = BoxDomain((0.0, 1.0), (0.0, 1.0))
∫_2d = VectorizedLebesgueIntegral(box)

See also

source
FunctionalGPs.IntegralFunctional Type
julia
IntegralFunctional

Alias for VectorizedLebesgueIntegral. The shorter name reads better alongside EvaluationFunctional and PartialDerivative in narrative code.

source

Differential Operators

FunctionalGPs.PartialDerivative Type
julia
PartialDerivative(multi_idx::NTuple{M, Integer})
PartialDerivative{N}(output_idx, multi_idx)

A partial derivative operator specified by a multi-index.

The multi-index (i₁, i₂, ...) represents the operator ∂^(i₁+i₂+...)/∂x₁^i₁∂x₂^i₂....

Examples

julia
∂x = PartialDerivative((1,))      # ∂/∂x (first derivative in 1D)
∂xx = PartialDerivative((2,))     # ∂²/∂x² (second derivative in 1D)
∂xy = PartialDerivative((1, 1))   # ∂²/∂x∂y (mixed partial in 2D)

Composing with functionals

julia
δ = EvaluationFunctional([0.0, 0.5, 1.0])
∂x = PartialDerivative((1,))
δ_dx = δ  ∂x  # Evaluate the first derivative at the given points
source
FunctionalGPs.AbstractLinearFunctionOperator Type
julia
AbstractLinearFunctionOperator

Abstract supertype for linear operators that act on functions (e.g., differentiation).

Operators can be composed with functionals using to create new functionals. For example, EvaluationFunctional(X) ∘ PartialDerivative((1,)) creates a functional that evaluates the first derivative at points X.

Subtypes

  • PartialDerivative: Partial differentiation operator

  • LinearDifferentialOperator: Linear combinations of partial derivatives

source

Combining Functionals

FunctionalGPs.StackedLinearFunctional Type
julia
StackedLinearFunctional <: AbstractLinearFunctional

A linear functional that stacks multiple linear functionals together. When applied to a kernel from both sides, it creates a symmetric block matrix where each block represents the cross-covariance between pairs of functionals.

Fields

  • linfunctionals::Tuple: A tuple of linear functionals to stack

Example

julia
δ1 = EvaluationFunctional(X1)
δ2 = EvaluationFunctional(X2)
stacked = StackedLinearFunctional(δ1, δ2)  # or StackedLinearFunctional([δ1, δ2])

# Apply to kernel to create StackedPVCrosscov
pv_stack = stacked(kernel)

# Apply again to create block matrix
block_matrix = stacked(pv_stack)  # Creates [[δ1∘δ1, δ1∘δ2], [δ2∘δ1, δ2∘δ2]]
source
FunctionalGPs.TensorProductFunctional Type
julia
TensorProductFunctional{N, F}

A tensor product of N linear functionals, where each functional operates on a separate dimension of a tensor product kernel.

For a tensor product kernel k = k₁ ⊗ k₂ ⊗ ... ⊗ kₙ, applying a TensorProductFunctional with functionals ℒ = ℒ₁ ⊗ ℒ₂ ⊗ ... ⊗ ℒₙ produces ℒ₁(k₁) ⊗ ℒ₂(k₂) ⊗ ... ⊗ ℒₙ(kₙ).

This is particularly useful for axis-aligned line integrals on 2D domains:

julia
k = k_x  k_y
eval_x = EvaluationFunctional(x_points)
∫_y = VectorizedLebesgueIntegral(y_intervals)
= eval_x  ∫_y  # Line integral: evaluate at x points, integrate over y

Type Parameters

  • N: Number of factors

  • F <: NTuple{N, AbstractLinearFunctional}: Concrete tuple type for type stability

source
FunctionalGPs.SumLinearFunctional Type
julia
SumLinearFunctional{N} <: AbstractSumLinearFunctional{N}

A sum of N linear functionals, typically created using the + operator.

The sum functional applies each summand and adds the results. All summands must have the same output shape.

Fields

  • summands::NTuple{N, AbstractLinearFunctional}: The functionals being summed

Example

julia
δ1 = EvaluationFunctional([0.0, 0.5])
δ2 = EvaluationFunctional([1.0, 1.5])
sum_fctl = δ1 + δ2  # Creates SumLinearFunctional
source
FunctionalGPs.LinFctlLinFuncOpConcat Type
julia
LinFctlLinFuncOpConcat{N} <: AbstractLinFctlLinFuncOpConcat{N}

Composition of a linear functional with N function operators, created using .

This represents the operation ℒ ∘ D₁ ∘ D₂ ∘ ... ∘ Dₙ, where ℒ is a functional and Dᵢ are operators like differentiation. Used for derivative observations and physics-informed constraints.

Fields

  • linfctl::AbstractLinearFunctional: The base functional

  • linfuncops::NTuple{N, AbstractLinearFunctionOperator}: The operators to apply

Example

julia
# Evaluate the first derivative at specific points
δ = EvaluationFunctional([0.0, 0.5, 1.0])
∂x = PartialDerivative((1,))
δ_dx = δ  ∂x

# Evaluate the second derivative
δ_d2x = δ  ∂x  ∂x

# Use in GP conditioning
obs = LinearObservation(δ_dx, derivative_values, noise)

See also

source

Abstract Types

FunctionalGPs.AbstractLinearFunctional Type
julia
AbstractLinearFunctional

Abstract supertype for all linear functionals on functions.

A linear functional is a linear map from a function space to a finite-dimensional vector space. Common examples include point evaluation, integration over domains, and compositions with differential operators.

Linear functionals can be combined using:

  • + : Sum of functionals (must have same output shape)

  • : Composition with a AbstractLinearFunctionOperator (e.g., differentiation)

  • : Tensor product for multi-dimensional domains

Implementing a new functional

Custom functionals should subtype AbstractLinearFunctional and implement:

  • output_shape(ℒ): Return a tuple specifying the output dimensions

See also

source
FunctionalGPs.AbstractSumLinearFunctional Type
julia
AbstractSumLinearFunctional{N} <: AbstractLinearFunctional

Abstract type for sums of linear functionals.

Sums are created using the + operator on functionals. All summands must have the same output shape.

See also

source
FunctionalGPs.AbstractLinFctlLinFuncOpConcat Type
julia
AbstractLinFctlLinFuncOpConcat{N} <: AbstractLinearFunctional

Abstract type for a linear functional composed with function operators.

Compositions are created using the operator, e.g., δ ∘ ∂x for evaluating the derivative.

See also

source