Skip to content

Commit 872dace

Browse files
Fix isinplace detection for Basis types (#554)
Implement `DiffEqBase.isinplace` for `Basis` to correctly report whether the basis supports in-place evaluation based on the `IMPL` type parameter. The issue was that when creating an `ODEProblem` from a `Basis` with controls but without implicit variables (Basis{false, true}), SciMLBase would incorrectly detect it as in-place compatible. This caused a MethodError because: - Basis{false, CTRLS} only supports out-of-place signatures: (u, p, t) or (u, p, t, c) - Basis{true, CTRLS} supports in-place signatures: (du, u, p, t) or (du, u, p, t, c) The fix adds: ```julia DiffEqBase.isinplace(::Basis{IMPL, CTRLS}, n) where {IMPL, CTRLS} = IMPL ``` This ensures that `isinplace` returns `true` only when the basis has implicit variables (IMPL=true) and supports in-place evaluation, and `false` otherwise. Fixes #554 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 46d8a0e commit 872dace

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/basis/type.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -605,3 +605,8 @@ end
605605
function Base.show(io::IO, ::MIME"text/plain", b::AbstractBasis)
606606
Base.print(io, b)
607607
end
608+
609+
# SciMLBase interface - declare whether this is an in-place function
610+
# IMPL=true means the basis has implicit variables and supports in-place evaluation
611+
# IMPL=false means the basis is out-of-place only
612+
DiffEqBase.isinplace(::Basis{IMPL, CTRLS}, n) where {IMPL, CTRLS} = IMPL

0 commit comments

Comments
 (0)