@@ -461,10 +461,20 @@ end
461
461
fullBB = copyto! (Matrix {Matrix{T}} (undef, 2 , 2 ), BB)
462
462
for (transform1, transform2) in ((identity, identity),
463
463
(identity, adjoint ), (adjoint, identity ), (adjoint, adjoint ),
464
- (identity, transpose), (transpose, identity ), (transpose, transpose) )
464
+ (identity, transpose), (transpose, identity ), (transpose, transpose),
465
+ (identity, Adjoint ), (Adjoint, identity ), (Adjoint, Adjoint ),
466
+ (identity, Transpose), (Transpose, identity ), (Transpose, Transpose))
465
467
@test * (transform1 (D), transform2 (B)):: typeof (D) ≈ * (transform1 (Matrix (D)), transform2 (Matrix (B))) atol= 2 * eps ()
466
468
@test * (transform1 (DD), transform2 (BB)):: typeof (DD) == * (transform1 (fullDD), transform2 (fullBB))
467
469
end
470
+ M = randn (T, 5 , 5 )
471
+ MM = [randn (T, 2 , 2 ) for _ in 1 : 2 , _ in 1 : 2 ]
472
+ for transform in (identity, adjoint, transpose, Adjoint, Transpose)
473
+ @test lmul! (transform (D), copy (M)) == * (transform (Matrix (D)), M)
474
+ @test rmul! (copy (M), transform (D)) == * (M, transform (Matrix (D)))
475
+ @test lmul! (transform (DD), copy (MM)) == * (transform (fullDD), MM)
476
+ @test rmul! (copy (MM), transform (DD)) == * (MM, transform (fullDD))
477
+ end
468
478
end
469
479
end
470
480
@@ -474,10 +484,16 @@ end
474
484
end
475
485
476
486
@testset " Multiplication with Adjoint and Transpose vectors (#26863)" begin
477
- x = rand (5 )
478
- D = Diagonal (rand (5 ))
479
- @test x' * D* x == (x' * D)* x == (x' * Array (D))* x
480
- @test Transpose (x)* D* x == (Transpose (x)* D)* x == (Transpose (x)* Array (D))* x
487
+ x = collect (1 : 2 )
488
+ xt = transpose (x)
489
+ A = reshape ([[1 2 ; 3 4 ], zeros (Int,2 ,2 ), zeros (Int, 2 , 2 ), [5 6 ; 7 8 ]], 2 , 2 )
490
+ D = Diagonal (A)
491
+ @test x' * D == x' * A == copy (x' )* D == copy (x' )* A
492
+ @test xt* D == xt* A == copy (xt)* D == copy (xt)* A
493
+ y = [x, x]
494
+ yt = transpose (y)
495
+ @test y' * D* y == (y' * D)* y == (y' * A)* y
496
+ @test yt* D* y == (yt* D)* y == (yt* A)* y
481
497
end
482
498
483
499
@testset " Triangular division by Diagonal #27989" begin
0 commit comments