@@ -32,7 +32,8 @@ function ISINDy(X::AbstractArray, Ẋ::AbstractArray, Ψ::Basis, opt::T = ADM();
32
32
@assert size (X)[end ] == size (Ẋ)[end ]
33
33
34
34
# Compute the library and the corresponding nullspace
35
- θ = Ψ (X, p, t)
35
+ θ = zeros (eltype (X), length (Ψ), size (X, 2 ))
36
+ Ψ (θ, X, p, t)
36
37
37
38
# Init for sweep over the differential variables
38
39
Ξ = zeros (eltype (θ), length (Ψ)* 2 , size (Ẋ, 1 ))
@@ -47,7 +48,9 @@ function ISINDy(X::AbstractArray, Ẋ::AbstractArray, Ψ::Basis, opt::T; f::Func
47
48
@assert size (X)[end ] == size (Ẋ)[end ]
48
49
49
50
# Compute the library and the corresponding nullspace
50
- θ = Ψ (X, p, t)
51
+ θ = zeros (eltype (X), length (Ψ), size (X, 2 ))
52
+ Ψ (θ, X, p, t)
53
+
51
54
dθ = zeros (eltype (θ), size (θ, 1 )* 2 , size (θ, 2 ))
52
55
dθ[size (θ, 1 )+ 1 : end , :] .= θ
53
56
77
80
78
81
function ISINDy (X:: AbstractArray , Ẋ:: AbstractArray , Ψ:: Basis , thresholds:: AbstractVector , opt:: T = STRRidge (); f:: Function = (xi, theta)-> [norm (xi, 0 ); norm (theta' * xi, 2 )], g:: Function = x-> norm (x), maxiter:: Int64 = 10 , rtol:: Float64 = 0.99 , p:: AbstractArray = [], t:: AbstractVector = [], convergence_error = eps (), normalize:: Bool = true , denoise:: Bool = false ) where T <: DataDrivenDiffEq.Optimize.AbstractOptimizer
79
82
@assert size (X)[end ] == size (Ẋ)[end ]
80
-
83
+
81
84
# Compute the library and the corresponding nullspace
82
- θ = Ψ (X, p, t)
85
+ θ = zeros (eltype (X), length (Ψ), size (X, 2 ))
86
+ Ψ (θ, X, p, t)
87
+
83
88
dθ = zeros (eltype (θ), size (θ, 1 )* 2 , size (θ, 2 ))
84
89
dθ[size (θ, 1 )+ 1 : end , :] .= θ
85
90
0 commit comments