Skip to content

Commit 9f8b3a5

Browse files
committed
put optimization error back in solve.jl
1 parent 83fe6b9 commit 9f8b3a5

File tree

2 files changed

+34
-34
lines changed

2 files changed

+34
-34
lines changed

src/errors.jl

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -300,40 +300,6 @@ function Base.showerror(io::IO, e::DirectAutodiffError)
300300
println(io, TruncatedStacktraces.VERBOSE_MSG)
301301
end
302302

303-
const NONCONCRETE_ELTYPE_MESSAGE = """
304-
Non-concrete element type inside of an `Array` detected.
305-
Arrays with non-concrete element types, such as
306-
`Array{Union{Float32,Float64}}`, are not supported by the
307-
differential equation solvers. Anyways, this is bad for
308-
performance so you don't want to be doing this!
309-
310-
If this was a mistake, promote the element types to be
311-
all the same. If this was intentional, for example,
312-
using Unitful.jl with different unit values, then use
313-
an array type which has fast broadcast support for
314-
heterogeneous values such as the ArrayPartition
315-
from RecursiveArrayTools.jl. For example:
316-
317-
```julia
318-
using RecursiveArrayTools
319-
x = ArrayPartition([1.0,2.0],[1f0,2f0])
320-
y = ArrayPartition([3.0,4.0],[3f0,4f0])
321-
x .+ y # fast, stable, and usable as u0 into DiffEq!
322-
```
323-
324-
Element type:
325-
"""
326-
327-
struct NonConcreteEltypeError <: Exception
328-
eltype::Any
329-
end
330-
331-
function Base.showerror(io::IO, e::NonConcreteEltypeError)
332-
print(io, NONCONCRETE_ELTYPE_MESSAGE)
333-
print(io, e.eltype)
334-
println(io, TruncatedStacktraces.VERBOSE_MSG)
335-
end
336-
337303
const NONNUMBER_ELTYPE_MESSAGE = """
338304
Non-Number element type inside of an `Array` detected.
339305
Arrays with non-number element types, such as

src/solve.jl

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,37 @@
1+
const NONCONCRETE_ELTYPE_MESSAGE = """
2+
Non-concrete element type inside of an `Array` detected.
3+
Arrays with non-concrete element types, such as
4+
`Array{Union{Float32,Float64}}`, are not supported by the
5+
differential equation solvers. Anyways, this is bad for
6+
performance so you don't want to be doing this!
7+
8+
If this was a mistake, promote the element types to be
9+
all the same. If this was intentional, for example,
10+
using Unitful.jl with different unit values, then use
11+
an array type which has fast broadcast support for
12+
heterogeneous values such as the ArrayPartition
13+
from RecursiveArrayTools.jl. For example:
14+
15+
```julia
16+
using RecursiveArrayTools
17+
x = ArrayPartition([1.0,2.0],[1f0,2f0])
18+
y = ArrayPartition([3.0,4.0],[3f0,4f0])
19+
x .+ y # fast, stable, and usable as u0 into DiffEq!
20+
```
21+
22+
Element type:
23+
"""
24+
25+
struct NonConcreteEltypeError <: Exception
26+
eltype::Any
27+
end
28+
29+
function Base.showerror(io::IO, e::NonConcreteEltypeError)
30+
print(io, NONCONCRETE_ELTYPE_MESSAGE)
31+
print(io, e.eltype)
32+
println(io, TruncatedStacktraces.VERBOSE_MSG)
33+
end
34+
135
# Skip the DiffEqBase handling
236

337
struct IncompatibleOptimizerError <: Exception

0 commit comments

Comments
 (0)