@@ -14,11 +14,11 @@ using BlockBandedMatrices, LinearAlgebra, MatrixFactorizations
14
14
Q̃,R̃ = qr (Matrix (A))
15
15
@test R ≈ R̃
16
16
@test Q ≈ Q̃
17
-
17
+
18
18
b = randn (size (A,1 ))
19
19
@test Q' b ≈ Q̃' b
20
20
@test Q* b ≈ Q̃* b
21
-
21
+
22
22
@test F\ b ≈ ldiv! (F, copy (b)) ≈ Matrix (A)\ b ≈ A\ b
23
23
end
24
24
@@ -35,13 +35,13 @@ using BlockBandedMatrices, LinearAlgebra, MatrixFactorizations
35
35
Q̃,R̃ = qr (Matrix (A))
36
36
@test R ≈ R̃
37
37
@test Q ≈ Q̃
38
-
38
+
39
39
b = randn (size (A,1 ))
40
40
@test Q' b ≈ Q̃' b
41
41
@test Q* b ≈ Q̃* b
42
42
43
43
@test Q' b ≈ lmul! (Q' , copy (b)) ≈ Q̃' * b
44
-
44
+
45
45
@test F\ b ≈ ldiv! (F, copy (b))[1 : 15 ] ≈ Matrix (A)\ b ≈ A\ b
46
46
end
47
47
@@ -58,13 +58,13 @@ using BlockBandedMatrices, LinearAlgebra, MatrixFactorizations
58
58
Q̃,R̃ = qr (Matrix (A))
59
59
@test R ≈ R̃
60
60
@test Q ≈ Q̃
61
-
61
+
62
62
b = randn (size (A,1 ))
63
63
@test Q' b ≈ Q̃' b
64
64
@test Q* b ≈ Q̃* b
65
65
Q' b
66
66
# @test_broken DimensionMismatch ldiv!(F, copy(b))
67
-
67
+
68
68
@test_broken F\ b ≈ ldiv! (F, copy (b)) ≈ Matrix (A)\ b ≈ A\ b
69
69
end
70
70
@@ -81,7 +81,7 @@ using BlockBandedMatrices, LinearAlgebra, MatrixFactorizations
81
81
Q̃,L̃ = ql (Matrix (A))
82
82
@test L ≈ L̃
83
83
@test Q ≈ Q̃
84
-
84
+
85
85
b = randn (size (A,1 ))
86
86
@test Q' b ≈ Q̃' b
87
87
@test Q* b ≈ Q̃* b
@@ -103,7 +103,7 @@ using BlockBandedMatrices, LinearAlgebra, MatrixFactorizations
103
103
# Q̃,L̃ = ql(Matrix(A))
104
104
# @test L ≈ L̃
105
105
# @test Q ≈ Q̃
106
-
106
+
107
107
# b = randn(size(A,1))
108
108
# @test Q'b ≈ Q̃'b
109
109
# @test Q*b ≈ Q̃*b
@@ -120,13 +120,31 @@ using BlockBandedMatrices, LinearAlgebra, MatrixFactorizations
120
120
@test_throws ArgumentError ql (A)
121
121
end
122
122
123
- @testset " Complex QR" begin
124
- A= BlockBandedMatrix {Float64} (I, ([1 ,1 ],[1 ,1 ]), (0 ,0 ))
125
- Af= qr (A)
126
- B= BlockBandedMatrix {ComplexF64} (I, ([1 ,1 ],[1 ,1 ]), (0 ,0 ))
127
- Bf= qr (B)
128
- @test Af. factors == Bf. factors
129
- @test Af. τ == Bf. τ
123
+ @testset " Complex QR/QL" begin
124
+ @testset " Simple" begin
125
+ A= BlockBandedMatrix {Float64} (I, ([1 ,1 ],[1 ,1 ]), (0 ,0 ))
126
+ Af= qr (A)
127
+ B= BlockBandedMatrix {ComplexF64} (I, ([1 ,1 ],[1 ,1 ]), (0 ,0 ))
128
+ Bf= qr (B)
129
+ @test Af. factors == Bf. factors
130
+ @test Af. τ == Bf. τ
131
+ end
132
+
133
+ @testset " Off-diagonals" begin
134
+ for qrl in [qr,ql]
135
+ for T in [Float64, ComplexF64]
136
+ A = BlockBandedMatrix {T} (undef, ([3 ,2 ,1 ,3 ],[3 ,2 ,1 ,3 ]), (1 ,1 ))
137
+ A. data .= rand (T, size (A. data))
138
+ Af = qrl (A)
139
+ @test Af. factors isa BlockBandedMatrix
140
+
141
+ Am = Matrix (A)
142
+ Amf = qrl (Am)
143
+
144
+ @test Af. factors ≈ Amf. factors
145
+ end
146
+ end
147
+ end
130
148
end
131
149
end
132
150
138
156
# @time F = qr(A); # 11s
139
157
# b = randn(size(A,1));
140
158
# @time F\b; # 0.6s
141
-
0 commit comments