32
32
@test unsafe_load (pointer (V)) == 46
33
33
@test unsafe_load (pointer (V) + stride (V,2 )* sizeof (Float64)) == 53
34
34
35
- x = randn (size (A,2 ))
36
- @test A* x == (similar (x) .= Mul (A,x)) ≈ Matrix (A)* x
35
+ x = randn (size (A,2 ))
36
+ @test A* x == (similar (x) .= Mul (A,x)) ≈ Matrix (A)* x
37
37
38
- z = randn (size (A,2 )) + im* randn (size (A,2 ))
39
- A* z == (similar (z) .= Mul (A,z)) ≈ Matrix (A)* z
38
+ z = randn (size (A,2 )) + im* randn (size (A,2 ))
39
+ A* z == (similar (z) .= Mul (A,z)) ≈ Matrix (A)* z
40
40
41
- Matrix (A)* z
42
- z[1 ]
43
- view (A,Block (1 ,1 )) * z[1 ] + view (A,Block (1 ,2 ))* z[2 : 3 ]
41
+ Matrix (A)* z
42
+ z[1 ]
43
+ view (A,Block (1 ,1 )) * z[1 ] + view (A,Block (1 ,2 ))* z[2 : 3 ]
44
44
45
- A* z
45
+ A* z
46
46
47
- X = randn (size (A))
48
- @test A* X == (similar (X) .= Mul (A,X)) ≈ Matrix (A)* X
49
- @test X* A == (similar (X) .= Mul (X,A)) ≈ Matrix (X)* A
47
+ X = randn (size (A))
48
+ @test A* X == (similar (X) .= Mul (A,X)) ≈ Matrix (A)* X
49
+ @test X* A == (similar (X) .= Mul (X,A)) ≈ Matrix (X)* A
50
50
51
51
52
- Z = randn (size (A)) + im* randn (size (A))
52
+ Z = randn (size (A)) + im* randn (size (A))
53
53
54
- A* Z
54
+ A* Z
55
55
56
56
57
- v = fill (1.0 ,4 )
57
+ v = fill (1.0 ,4 )
58
58
U = UpperTriangular (view (A, Block (N,N)))
59
59
@test Matrix (U) == U
60
60
w = Matrix (U) \ v
@@ -72,8 +72,6 @@ v = fill(1.0,4)
72
72
@test v == fill (1.0 ,size (A,1 ))
73
73
@test ldiv! (U, v) === v
74
74
@test v ≈ w
75
-
76
-
77
75
end
78
76
79
77
@testset " BandedBlockBandedMatrix linear algebra" begin
155
153
@time BLAS. axpy! (1.0 , A, B)
156
154
@test B ≈ AB
157
155
end
156
+
157
+ @testset " Rectangular block *" begin
158
+ A = BlockBandedMatrix {Float64} (undef, (Ones {Int} (2 ), Ones {Int} (2 )), (0 ,2 ))
159
+ A. data .= randn .()
160
+ B = BlockBandedMatrix {Float64} (undef, (Ones {Int} (2 ), Ones {Int} (3 )), (0 ,2 ))
161
+ B. data .= randn .()
162
+
163
+ @test A* B ≈ Matrix (A)* Matrix (B)
164
+
165
+
166
+ rows = rand (1 : 10 , 5 )
167
+ l = rand (0 : 2 , 5 )
168
+ u = rand (0 : 2 , 5 )
169
+
170
+ m = sum (rows)
171
+
172
+ A = BlockSkylineMatrix (Zeros (m,m), (rows,rows), (l,u))
173
+ A. data .= randn .()
174
+
175
+ B = BlockSkylineMatrix (Zeros (m,m+ 1 ), (rows,[rows;1 ]), ([l;1 ],[u;1 ]))
176
+ B. data .= randn .()
177
+ @test A* B ≈ Matrix (A)* Matrix (B)
178
+ end
0 commit comments