Skip to content

Commit

Permalink
Δt to dt
Browse files Browse the repository at this point in the history
Allows for non-unicode interface
  • Loading branch information
ChrisRackauckas committed Nov 28, 2019
1 parent 7d35054 commit b7fc345
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion examples/DMD_Examples.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
16 changes: 8 additions & 8 deletions src/exact_dmd.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand All @@ -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
Expand Down Expand Up @@ -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)

Expand All @@ -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
Expand Down
10 changes: 5 additions & 5 deletions src/extended_dmd.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand All @@ -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

Expand Down

0 comments on commit b7fc345

Please sign in to comment.