Skip to content

Commit b52cd7b

Browse files
committed
add tests for rqr
1 parent f3eecbb commit b52cd7b

2 files changed

Lines changed: 35 additions & 1 deletion

File tree

test/test_extendedstatespace.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ w1 = :r^3
5454
connections = [K.y .=> G.u; G.y .=> G.y; K.u .=> K.u]
5555
Gcl2 = connect([G, K, S], connections; z1, w1)
5656

57-
@test linfnorm(minreal(Gcl1 - Gcl2.sys))[1] < 1e-10
57+
@test linfnorm(minreal(Gcl1 - Gcl2.sys))[1] < sqrt(eps())
5858

5959

6060
##

test/test_hinf_design.jl

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,40 @@ using LinearAlgebra
55
using Random
66

77

8+
using RobustAndOptimalControl: rqr
9+
10+
@testset "rqr" begin
11+
@info "Testing rqr"
12+
13+
e = sqrt(eps())
14+
D = [1 1; e 0; 0 e]
15+
γ = 0.00001
16+
b = randn(2)
17+
18+
bD = big.(D)
19+
bb = big.(b)
20+
hp = (bD'bD + big(γ)*I)\bb
21+
22+
@test norm(rqr(D, γ)\b - hp) < 1e-10
23+
@test norm(rqr(D, γ)\b - hp) < norm((D'D + γ*I)\b - hp)
24+
25+
@test rqr(D, γ)*b (D'D + γ*I)*b
26+
27+
28+
γ = 0.00001
29+
b = randn(3,2)
30+
bb = big.(b)
31+
hp = bb/(bD'bD + big(γ)*I)
32+
33+
@test norm(b/rqr(D, γ) - hp) < 1e-10
34+
@test norm(b/rqr(D, γ) - hp) < norm(b/(D'D + γ*I) - hp)
35+
36+
@test b*rqr(D, γ) b*(D'D + γ*I)
37+
38+
display(rqr(D, γ))
39+
end
40+
41+
842
"""
943
Tests for the public and private methods of the hInfSynthesis function. This
1044
function utilizes the preexisting ControlSystems toolbox, and performs a

0 commit comments

Comments
 (0)