Skip to content

Commit 2e7e3b0

Browse files
authored
Merge pull request #79 from control-toolbox/auto-juliaformatter-pr
[AUTO] JuliaFormatter.jl run
2 parents a03bb1d + a9b1fb2 commit 2e7e3b0

6 files changed

Lines changed: 23 additions & 24 deletions

File tree

ext/plot.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,9 @@ function __initial_plot(
255255
pp = Plots.plot() # costate
256256
pu = Plots.plot() # control
257257
pn = Plots.plot() # control norm
258-
return Plots.plot(px, pp, pu, pn; layout=(2, 2), bottommargin=5mm, kwargs...)
258+
return Plots.plot(
259+
px, pp, pu, pn; layout=(2, 2), bottommargin=5mm, kwargs...
260+
)
259261
end
260262
_ => throw(
261263
CTBase.IncorrectArgument(

profiling/interpolate.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ begin
77
using Profile
88

99
function make_interpolation()
10-
1110
T = [0, 1]
1211

1312
A = [

src/default.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,4 +101,4 @@ $(TYPEDSIGNATURES)
101101
Used to set the default value of the storage of elements in a matrix.
102102
The default value is `1`.
103103
"""
104-
__matrix_dimension_storage() = 1
104+
__matrix_dimension_storage() = 1

src/solution.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ function build_solution(
7979
end
8080

8181
# variables: remove additional state for lagrange objective
82-
x = if TX <: Function
83-
X
82+
x = if TX <: Function
83+
X
8484
else
8585
V = matrix2vec(X[:, 1:dim_x], 1)
8686
ctinterpolate(T, V)
@@ -93,7 +93,7 @@ function build_solution(
9393
V = matrix2vec(P[:, 1:dim_x], 1)
9494
ctinterpolate(T[1:(end - 1)], V)
9595
end
96-
u = if TU <: Function
96+
u = if TU <: Function
9797
U
9898
else
9999
V = matrix2vec(U[:, 1:dim_u], 1)
@@ -145,7 +145,7 @@ function build_solution(
145145
V = matrix2vec(control_constraints_lb_dual[:, 1:dim_u], 1)
146146
t -> ctinterpolate(T, V)(t)
147147
end
148-
148+
149149
control_constraints_ub_dual_fun = if isnothing(control_constraints_ub_dual)
150150
nothing
151151
else

src/utils.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ Transforms `A` to a Vector{<:Vector{<:ctNumber}}.
1717
function matrix2vec(
1818
A::Matrix{<:ctNumber}, dim::Int=__matrix_dimension_storage()
1919
)::Vector{<:Vector{<:ctNumber}}
20-
return dim==1 ? [A[i,:] for i in 1:size(A,1)] : [A[:,i] for i in 1:size(A,2)]
20+
return dim==1 ? [A[i, :] for i in 1:size(A, 1)] : [A[:, i] for i in 1:size(A, 2)]
2121
end

test/test_utils.jl

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
11
function test_utils()
2+
A = [
3+
0 1
4+
2 3
5+
]
26

3-
A = [
4-
0 1
5-
2 3
6-
]
7+
V = CTModels.matrix2vec(A)
8+
@test V[1] == [0, 1]
9+
@test V[2] == [2, 3]
710

8-
V = CTModels.matrix2vec(A)
9-
@test V[1] == [0, 1]
10-
@test V[2] == [2, 3]
11+
V = CTModels.matrix2vec(A, 1)
12+
@test V[1] == [0, 1]
13+
@test V[2] == [2, 3]
1114

12-
V = CTModels.matrix2vec(A, 1)
13-
@test V[1] == [0, 1]
14-
@test V[2] == [2, 3]
15-
16-
W = CTModels.matrix2vec(A, 2)
17-
@test W[1] == [0, 2]
18-
@test W[2] == [1, 3]
19-
20-
end
15+
W = CTModels.matrix2vec(A, 2)
16+
@test W[1] == [0, 2]
17+
@test W[2] == [1, 3]
18+
end

0 commit comments

Comments
 (0)