Skip to content

Commit db1a3d8

Browse files
committed
minor printing improve
1 parent 430dbc5 commit db1a3d8

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

src/dynamicalsystem/discrete.jl

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -281,10 +281,10 @@ Base.summary(ds::MDI{true, S}) where {S<:Vector{<:AbstractArray}} =
281281
function Base.show(io::IO, ds::MDI)
282282
ps = 3
283283
text = summary(ds)
284-
print(io, text*"\n",
285-
rpad(" t: ", ps)*"$(ds.t)\n",
286-
rpad(" u: ", ps)*"$(ds.u)\n"
287-
)
284+
println(io, text)
285+
println(io, rpad(" t: ", ps)*"$(ds.t)")
286+
prefix = rpad(" u: ", ps)
287+
print(io, prefix); printlimited(io, get_state(ds)', Δx = length(prefix)); print(io, "\n")
288288
end
289289
function Base.show(io::IO, ds::MDI{true, S}) where {S<:Vector{<:AbstractArray}}
290290
ps = 3
@@ -300,16 +300,17 @@ function Base.show(io::IO, ds::MDI{true, S}) where {S<:Vector{<:AbstractArray}}
300300
end
301301

302302
Base.summary(ds::TDI) =
303-
"Discrete tangent-space integrator
304-
(e.o.m.: $(eomstring(ds.f)), jacobian: $(eomstring(ds.jacobian)))"
303+
"Discrete tangent-space integrator "*
304+
"(e.o.m.: $(eomstring(ds.f)), jacobian: $(eomstring(ds.jacobian)))"
305305

306306
function Base.show(io::IO, ds::TDI)
307307
ps = 3
308308
text = summary(ds)
309-
print(io, text*"\n",
310-
rpad(" t: ", ps)*"$(ds.t)\n",
311-
rpad(" u: ", ps)*"$(get_state(ds))\n",
312-
" deviation vectors:\n")
309+
println(io, text)
310+
println(io, rpad(" t: ", ps)*"$(ds.t)")
311+
prefix = rpad(" u: ", ps)
312+
print(io, prefix); printlimited(io, get_state(ds)', Δx = length(prefix)); print(io, "\n")
313+
println(io, " deviation vectors:")
313314
s = sprint(io -> show(IOContext(io, :limit=>true),
314315
MIME"text/plain"(), get_deviations(ds)))
315316
s = join(split(s, '\n')[2:end], '\n')

src/dynamicalsystem/dynamicalsystem.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ for the out-of-place version and `jacobian!(xnew, x, p, n)` for the in-place ver
6565
6666
If `jacobian` is not given, it is constructed automatically using
6767
the module [`ForwardDiff`](http://www.juliadiff.org/ForwardDiff.jl/stable/).
68+
It is **heavily** advised to provide a Jacobian function, as it gives *multiple*
69+
orders of magnitude speedup.
6870
6971
### Interface to DifferentialEquations.jl
7072
Continuous systems are solved using

0 commit comments

Comments
 (0)