Skip to content
This repository was archived by the owner on May 12, 2026. It is now read-only.

Interface compatibility: Fix type genericity for SDE noise generation#168

Merged
ChrisRackauckas merged 1 commit into
SciML:masterfrom
ChrisRackauckas-Claude:interface-check-20251230-001716
Dec 30, 2025
Merged

Interface compatibility: Fix type genericity for SDE noise generation#168
ChrisRackauckas merged 1 commit into
SciML:masterfrom
ChrisRackauckas-Claude:interface-check-20251230-001716

Conversation

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Contributor

Summary

  • Fix zeros() and randn() calls in SDE functions to respect eltype(prob.u0) instead of defaulting to Float64
  • Enables BigFloat-precision SDE convergence testing
  • Improves adherence to SciML's array/number interface

Changes

In src/convergence.jl and src/benchmark.jl:

  • Extract T = eltype(prob.u0) for type inference
  • Use zeros(T, size(prob.u0)) instead of zeros(size(prob.u0))
  • Use randn(T, size(prob.u0)) instead of randn(size(prob.u0))

Interface Testing Performed

  1. BigFloat support: Verified that tableaus work with constructEuler(BigFloat) and stability_region preserves precision
  2. JLArrays testing: Confirmed the package doesn't use problematic scalar indexing patterns
  3. All existing tests pass: Full test suite completed successfully

Test plan

  • Run Pkg.test() - all tests pass
  • Verify BigFloat precision is maintained in noise generation
  • Check that existing Float64 behavior is unchanged

cc @ChrisRackauckas

🤖 Generated with Claude Code

The `zeros()` and `randn()` calls in `analyticless_test_convergence` and
related functions were creating Float64 arrays regardless of the element
type of `prob.u0`. This prevented proper BigFloat support for SDE
convergence testing.

Changes:
- Use `zeros(T, size(prob.u0))` instead of `zeros(size(prob.u0))`
- Use `randn(T, size(prob.u0))` instead of `randn(size(prob.u0))`
- Extract `T = eltype(prob.u0)` for consistent type inference

This enables:
- BigFloat-precision SDE convergence testing
- Proper type preservation for custom numeric types
- Better adherence to SciML's array/number interface

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@ChrisRackauckas ChrisRackauckas merged commit b11a781 into SciML:master Dec 30, 2025
4 of 6 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants