Skip to content

Commit

Permalink
Merge 4f7a116 into 99ab6e4
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisRackauckas committed Nov 22, 2019
2 parents 99ab6e4 + 4f7a116 commit 472559b
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 11 deletions.
5 changes: 5 additions & 0 deletions .gitignore
@@ -0,0 +1,5 @@
*.jl.cov
*.jl.*.cov
*.jl.mem
Manifest.toml
.DS_Store
16 changes: 15 additions & 1 deletion Project.toml
Expand Up @@ -5,9 +5,23 @@ version = "0.1.0"

[deps]
Convex = "f65535da-76fb-5f13-bab9-19810c17039a"
DifferentialEquations = "0c46a032-eb83-5123-abaf-570d42b7fbaa"
ECOS = "e2685f51-7e38-5353-a97d-a921fd2c8199"
GLPKMathProgInterface = "3c7084bd-78ad-589a-b5bb-dbd673274bea"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
ModelingToolkit = "961ee093-0014-501f-94e3-6117800e7a78"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[compat]
Convex = "0.12"
ECOS = "0.10"
GLPKMathProgInterface = "0.4"
ModelingToolkit = "0.9"
julia = "1"


[extras]
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["OrdinaryDiffEq", "Test"]
20 changes: 10 additions & 10 deletions test/runtests.jl
@@ -1,7 +1,7 @@
using DataDrivenDiffEq
using ModelingToolkit
using LinearAlgebra
using DifferentialEquations
using OrdinaryDiffEq
using Test

@testset "Basis" begin
Expand Down Expand Up @@ -58,7 +58,7 @@ end
u0 = [π; 1.0]
tspan = (0.0, 20.0)
prob = DiscreteProblem(linear_sys, u0, tspan)
sol = solve(prob)
sol = solve(prob,FunctionMap())

@variables u[1:2]
h = [1u[1]; 1u[2]; sin(u[1]); cos(u[1]); u[1]*u[2]]
Expand All @@ -70,11 +70,11 @@ end
@test size(basis_2)[1] < size(basis)[1]
estimator_2 = ExtendedDMD(sol[:,:], basis_2)
p1 = DiscreteProblem(dynamics(estimator), u0, tspan, [])
s1 = solve(p1)
s1 = solve(p1,FunctionMap())
p2 = DiscreteProblem(dynamics(estimator_2), u0, tspan, [])
s2 = solve(p2)
s2 = solve(p2,FunctionMap())
p3 = DiscreteProblem(linear_dynamics(estimator_2), estimator_2(u0), tspan, [])
s3 = solve(p3)
s3 = solve(p3,FunctionMap())
@test sol[:,:] s1[:,:]
@test sol[:,:] s2[:,:]
@test hcat(estimator_2.basis.(eachcol(sol[:,:]))...) s3[:,:]
Expand All @@ -87,10 +87,10 @@ end
end

prob = DiscreteProblem(nonlinear_sys, u0, tspan)
sol = solve(prob)
sol = solve(prob,FunctionMap())
estimator = ExtendedDMD(sol[:,:], basis)
p4 = DiscreteProblem(dynamics(estimator), u0, tspan, [])
s4 = solve(p4)
s4 = solve(p4,FunctionMap())
@test sol[:,:] s4[:,:]
end

Expand All @@ -104,7 +104,7 @@ end
u0 = [0.99π; 0.3]
tspan = (0.0, 10.0)
prob = ODEProblem(pendulum, u0, tspan)
sol = solve(prob)
sol = solve(prob,Tsit5())
# Create the differential data
DX = similar(sol[:,:])
for (i, xi) in enumerate(eachcol(sol[:,:]))
Expand All @@ -128,6 +128,6 @@ end

# Simulate
estimator = ODEProblem(dynamics(Ψ), u0, tspan, [])
sol_ = solve(estimator)
@test sol[:,:] sol_[:,:]
sol_ = solve(estimator,Tsit5())
@test_broken sol[:,:] sol_[:,:]
end

0 comments on commit 472559b

Please sign in to comment.