Skip to content

Conversation

@ChrisRackauckas-Claude
Copy link

Summary

  • Add type parameters to POD struct (POD{S, T <: AbstractFloat}) for improved type stability
  • Add type parameters to SVD and TSVD structs for proper kwargs typing (using NamedTuple)
  • Add return type annotations to key functions for better static analysis
  • Add JET.jl tests to verify type stability of core functions

Changes Made

Type Parameter Improvements

  • POD struct: Changed from Any typed fields to properly parameterized types
    • snapshots::S (parameterized by snapshot type)
    • min_renergy::T, renergy::T (parameterized by element type)
    • rbasis::Union{Missing, Matrix{T}}, spectrum::Union{Missing, Vector{T}}
  • SVD/TSVD structs: Changed kwargs::Any to kwargs::K where K <: NamedTuple

Return Type Annotations

  • matricize(VoV::Vector{Vector{T}})::Matrix{T}
  • determine_truncation(...)::Tuple{Int, T}
  • reduce!(...)::Nothing
  • only_dvs(...)::Bool
  • Base.show(::IO, ::POD)::Nothing

JET.jl Tests

Added new test file test/jet.jl that verifies type stability of:

  • deim_interpolation_indices
  • matricize
  • POD constructors (Matrix and Vector{Vector})
  • reduce! with SVD algorithm

Type Stability Before/After

Before (@code_warntype reduce!(pod, TSVD())):

u::ANY
s::ANY
v::ANY
n_max::ANY

After:

u::Matrix{Float64}
s::Vector{Float64}
v::Matrix{Float64}
n_max::Int64

Test plan

  • Run Pkg.test() - all tests pass
  • Runic formatting check passes
  • JET.jl analysis passes for core functions

CC: @ChrisRackauckas

🤖 Generated with Claude Code

- Add type parameters to POD struct (POD{S, T <: AbstractFloat}) for type stability
- Add type parameters to SVD and TSVD structs for proper kwargs typing
- Add return type annotations to key functions:
  - matricize, determine_truncation, reduce!, only_dvs, Base.show(::IO, ::POD)
- Add JET.jl tests to verify type stability of core functions:
  - deim_interpolation_indices
  - matricize
  - POD constructors
  - reduce! with SVD

The POD struct now properly propagates element types through all operations,
eliminating type instabilities where variables were previously inferred as Any.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants