Skip to content

Commit

Permalink
Renamed "state" to "states" when it's a matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholaskl97 committed Apr 3, 2024
1 parent 8376ad3 commit 7e1a4c6
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/numerical_lyapunov_functions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function get_numerical_lyapunov_function(
# V is the numerical form of Lyapunov function
V = let V_structure = structure.V, net = network_func, x0 = fixed_point
V(state::AbstractVector) = V_structure(net, state, x0)
V(state::AbstractMatrix) = mapslices(V, state, dims = [1])
V(states::AbstractMatrix) = mapslices(V, states, dims = [1])
end

if use_V̇_structure
Expand All @@ -68,7 +68,7 @@ function get_numerical_lyapunov_function(

# Numerical time derivative of Lyapunov function
(state::AbstractVector) = V̇_structure(net, _J_net, f, state, params, 0.0, x0)
(state::AbstractMatrix) = mapslices(V̇, state, dims = [1])
(states::AbstractMatrix) = mapslices(V̇, states, dims = [1])

return _V, V̇
end
Expand All @@ -81,7 +81,7 @@ function get_numerical_lyapunov_function(
(δt) -> _V(state + δt * f_call(f, net, state, params, 0.0)),
0.0
)
(state::AbstractMatrix) = mapslices(V̇, state, dims = [1])
(states::AbstractMatrix) = mapslices(V̇, states, dims = [1])

return _V, V̇
end
Expand All @@ -95,8 +95,8 @@ Return the network as a function of state alone.
# Arguments
- `phi`: the neural network, represented as `phi(state, θ)` if the neural network has a
single output, or a `Vector` of the same with one entry per neural network output.
- `phi`: the neural network, represented as `phi(x, θ)` if the neural network has a single
output, or a `Vector` of the same with one entry per neural network output.
- `θ`: the parameters of the neural network; `θ[:φ1]` should be the parameters of the first
neural network output (even if there is only one), `θ[:φ2]` the parameters of the
second (if there are multiple), and so on.
Expand All @@ -105,7 +105,7 @@ Return the network as a function of state alone.
"""
function phi_to_net(phi, θ)
let= θ, φ = phi
return (state) -> φ(state, _θ[:φ1])
return (x) -> φ(x, _θ[:φ1])

Check warning on line 108 in src/numerical_lyapunov_functions.jl

View check run for this annotation

Codecov / codecov/patch

src/numerical_lyapunov_functions.jl#L106-L108

Added lines #L106 - L108 were not covered by tests
end
end

Expand Down

0 comments on commit 7e1a4c6

Please sign in to comment.