Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ version = "0.1.3"
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
ModelingToolkit = "961ee093-0014-501f-94e3-6117800e7a78"
PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
RandomizedLinAlg = "0448d7d9-159c-5637-8537-fd72090fea46"
Setfield = "efcf1570-3423-57d1-acb7-fd33fddbac46"
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
Expand All @@ -16,6 +17,7 @@ TSVD = "9449cd9e-2762-5aa3-a617-5413e99d722e"
DocStringExtensions = "0.8, 0.9"
LinearAlgebra = "1"
ModelingToolkit = "10"
PrecompileTools = "1"
RandomizedLinAlg = "0.1"
Setfield = "0.8, 1"
SparseArrays = "1"
Expand Down
2 changes: 2 additions & 0 deletions src/ModelOrderReduction.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,6 @@ export POD, reduce!
include("deim.jl")
export deim

include("precompilation.jl")

end
25 changes: 25 additions & 0 deletions src/precompilation.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using PrecompileTools

@setup_workload begin
using LinearAlgebra: qr

@compile_workload begin
# Precompile POD with matrix input (most common use case)
mat_snapshots = randn(20, 10)
pod_mat = POD(mat_snapshots, 3)
reduce!(pod_mat, SVD())

# Precompile POD with Vector{Vector} input
vec_snapshots = [randn(20) for _ in 1:10]
pod_vec = POD(vec_snapshots, 3)
reduce!(pod_vec, TSVD())

# Precompile RSVD algorithm
pod_rsvd = POD(mat_snapshots, 3)
reduce!(pod_rsvd, RSVD(2))

# Precompile deim_interpolation_indices
basis = Matrix(qr(randn(20, 5)).Q)
deim_interpolation_indices(basis)
end
end
Loading