From b7fc345fa3da5a4a66196f4cd6e3773efd5bf69b Mon Sep 17 00:00:00 2001 From: Chris Rackauckas Date: Thu, 28 Nov 2019 08:27:46 -0500 Subject: [PATCH] =?UTF-8?q?=CE=94t=20to=20dt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Allows for non-unicode interface --- examples/DMD_Examples.jl | 2 +- src/exact_dmd.jl | 16 ++++++++-------- src/extended_dmd.jl | 10 +++++----- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/examples/DMD_Examples.jl b/examples/DMD_Examples.jl index 701f3353b..933c3ba69 100644 --- a/examples/DMD_Examples.jl +++ b/examples/DMD_Examples.jl @@ -65,7 +65,7 @@ sol_cont = solve(prob_cont, saveat = 0.1) plot(sol_cont) -approx_cont = ExactDMD(sol_cont[:,:], Δt = 0.1) +approx_cont = ExactDMD(sol_cont[:,:], dt = 0.1) test = dynamics(approx_cont, discrete = false) diff --git a/src/exact_dmd.jl b/src/exact_dmd.jl index d462ff26d..411de4fed 100644 --- a/src/exact_dmd.jl +++ b/src/exact_dmd.jl @@ -17,11 +17,11 @@ mutable struct ExactDMD{M,L,W,F, Q, P} <: abstractKoopmanOperator end -function ExactDMD(X::AbstractArray; Δt::Float64 = 0.0) - return ExactDMD(X[:, 1:end-1], X[:, 2:end], Δt = Δt) +function ExactDMD(X::AbstractArray; dt::Float64 = 0.0) + return ExactDMD(X[:, 1:end-1], X[:, 2:end], dt = dt) end -function ExactDMD(X::AbstractArray, Y::AbstractArray; Δt::Float64 = 0.0) +function ExactDMD(X::AbstractArray, Y::AbstractArray; dt::Float64 = 0.0) @assert size(X)[2] .== size(Y)[2] @assert size(Y)[1] .<= size(Y)[2] @@ -30,9 +30,9 @@ function ExactDMD(X::AbstractArray, Y::AbstractArray; Δt::Float64 = 0.0) # Eigen Decomposition for solution Λ, W = eigen(Ã) - if Δt > 0.0 + if dt > 0.0 # Casting Complex enforces results - ω = log.(Complex.(Λ)) / Δt + ω = log.(Complex.(Λ)) / dt else ω = [] end @@ -75,7 +75,7 @@ end # Update with new measurements -function update!(m::ExactDMD, x::AbstractArray, y::AbstractArray; Δt::Float64 = 0.0, threshold::Float64 = 1e-3) +function update!(m::ExactDMD, x::AbstractArray, y::AbstractArray; dt::Float64 = 0.0, threshold::Float64 = 1e-3) # Check the error ϵ = norm(y - m.Ã*x, 2) @@ -88,9 +88,9 @@ function update!(m::ExactDMD, x::AbstractArray, y::AbstractArray; Δt::Float64 = m.Ã = m.Qₖ*inv(m.Pₖ) m.λ, m.ϕ = eigen(m.Ã) - if Δt > 0.0 + if dt > 0.0 # Casting Complex enforces results - ω = log.(Complex.(m.λ)) / Δt + ω = log.(Complex.(m.λ)) / dt else ω = [] end diff --git a/src/extended_dmd.jl b/src/extended_dmd.jl index b0ea90b9b..b656ca418 100644 --- a/src/extended_dmd.jl +++ b/src/extended_dmd.jl @@ -16,11 +16,11 @@ eigen(m::ExtendedDMD) = eigen(m.koopman) eigvals(m::ExtendedDMD) = eigvals(m.koopman) eigvecs(m::ExtendedDMD) = eigvecs(m.koopman) -function ExtendedDMD(X::AbstractArray, Ψ::abstractBasis; p::AbstractArray = [], B::AbstractArray = reshape([], 0,0), Δt::Float64 = 1.0) - return ExtendedDMD(X[:, 1:end-1], X[:, 2:end], Ψ, p = p, B = B, Δt = Δt) +function ExtendedDMD(X::AbstractArray, Ψ::abstractBasis; p::AbstractArray = [], B::AbstractArray = reshape([], 0,0), dt::Float64 = 1.0) + return ExtendedDMD(X[:, 1:end-1], X[:, 2:end], Ψ, p = p, B = B, dt = dt) end -function ExtendedDMD(X::AbstractArray, Y::AbstractArray, Ψ::abstractBasis; p::AbstractArray = [], B::AbstractArray = reshape([], 0,0), Δt::Float64 = 1.0) +function ExtendedDMD(X::AbstractArray, Y::AbstractArray, Ψ::abstractBasis; p::AbstractArray = [], B::AbstractArray = reshape([], 0,0), dt::Float64 = 1.0) @assert size(X)[2] .== size(Y)[2] @assert size(Y)[1] .<= size(Y)[2] @@ -43,10 +43,10 @@ function ExtendedDMD(X::AbstractArray, Y::AbstractArray, Ψ::abstractBasis; p::A return ExtendedDMD(Op, B, Ψ) end -function update!(m::ExtendedDMD, x::AbstractArray, y::AbstractArray; p::AbstractArray = [], Δt::Float64 = 0.0, threshold::Float64 = 1e-3) +function update!(m::ExtendedDMD, x::AbstractArray, y::AbstractArray; p::AbstractArray = [], dt::Float64 = 0.0, threshold::Float64 = 1e-3) Ψ₀ = m.basis(x, p = p) Ψ₁ = m.basis(y, p = p) - update!(m.koopman, Ψ₀, Ψ₁, Δt = Δt, threshold = threshold) + update!(m.koopman, Ψ₀, Ψ₁, dt = dt, threshold = threshold) return end