File size: 1,923 Bytes
c711202
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
module GPFiniteVolume

using PrecompileTools: @setup_workload, @compile_workload

# Core utilities
include("utils.jl")

# Named slices for spacetime indexing (needed by sparse_precision.jl)
include("named_slices.jl")

# Functional type classification
include("functional_types.jl")

# Sparse precision construction
include("sparse_precision.jl")

# Efficient conditioning (skip intermediate GMRF construction)
include("condition_precision.jl")

# Time evolution (SDEs and SSMs)
include("linear_sdes.jl")
include("block_tridiagonal_prec.jl")
include("linear_ssm.jl")

# EKF-style sequential solver
include("ekf_solver.jl")

# ------------------------------------------------------------------------------
# Precompilation Workloads
# ------------------------------------------------------------------------------

@setup_workload begin
    using FunctionalGPs
    import FunctionalGPs: ⊗

    @compile_workload begin
        # 1D problem (non-Kronecker blocks, tests fallback path)
        xs_1d = range(0.0, 1.0, length=15)
        intervals_1d = intervals_from_endpoints(collect(xs_1d))
        k_1d = HalfIntegerMaternKernel(2, [0.2])

        sparse_precision([
            :f => EvaluationFunctional(xs_1d),
            :f_int => VectorizedLebesgueIntegral(intervals_1d),
        ], k_1d; ρ=2.0)

        # 2D tensor product problem (Kronecker blocks, tests FastBlockMatrix)
        xs_2d = range(0.0, 1.0, length=8)
        ys_2d = range(0.0, 1.0, length=8)
        xi_2d = intervals_from_endpoints(collect(xs_2d))
        yi_2d = intervals_from_endpoints(collect(ys_2d))
        grid_2d = FactorizedGrid(xs_2d, ys_2d)
        k_2d = HalfIntegerMaternKernel(2, [0.2]) ⊗ HalfIntegerMaternKernel(2, [0.2])

        sparse_precision([
            :c => EvaluationFunctional(grid_2d),
            :c_vert => EvaluationFunctional(xs_2d) ⊗ VectorizedLebesgueIntegral(yi_2d),
        ], k_2d; ρ=2.0)
    end
end

end