@@ -441,10 +441,20 @@ end
441441 fullBB = copyto! (Matrix {Matrix{T}} (undef, 2 , 2 ), BB)
442442 for (transform1, transform2) in ((identity, identity),
443443 (identity, adjoint ), (adjoint, identity ), (adjoint, adjoint ),
444- (identity, transpose), (transpose, identity ), (transpose, transpose) )
444+ (identity, transpose), (transpose, identity ), (transpose, transpose),
445+ (identity, Adjoint ), (Adjoint, identity ), (Adjoint, Adjoint ),
446+ (identity, Transpose), (Transpose, identity ), (Transpose, Transpose))
445447 @test * (transform1 (D), transform2 (B)):: typeof (D) ≈ * (transform1 (Matrix (D)), transform2 (Matrix (B))) atol= 2 * eps ()
446448 @test * (transform1 (DD), transform2 (BB)):: typeof (DD) == * (transform1 (fullDD), transform2 (fullBB))
447449 end
450+ M = randn (T, 5 , 5 )
451+ MM = [randn (T, 2 , 2 ) for _ in 1 : 2 , _ in 1 : 2 ]
452+ for transform in (identity, adjoint, transpose, Adjoint, Transpose)
453+ @test lmul! (transform (D), copy (M)) == * (transform (Matrix (D)), M)
454+ @test rmul! (copy (M), transform (D)) == * (M, transform (Matrix (D)))
455+ @test lmul! (transform (DD), copy (MM)) == * (transform (fullDD), MM)
456+ @test rmul! (copy (MM), transform (DD)) == * (MM, transform (fullDD))
457+ end
448458 end
449459end
450460
@@ -454,10 +464,16 @@ end
454464end
455465
456466@testset " Multiplication with Adjoint and Transpose vectors (#26863)" begin
457- x = rand (5 )
458- D = Diagonal (rand (5 ))
459- @test x' * D* x == (x' * D)* x == (x' * Array (D))* x
460- @test Transpose (x)* D* x == (Transpose (x)* D)* x == (Transpose (x)* Array (D))* x
467+ x = collect (1 : 2 )
468+ xt = transpose (x)
469+ A = reshape ([[1 2 ; 3 4 ], zeros (Int,2 ,2 ), zeros (Int, 2 , 2 ), [5 6 ; 7 8 ]], 2 , 2 )
470+ D = Diagonal (A)
471+ @test x' * D == x' * A == copy (x' )* D == copy (x' )* A
472+ @test xt* D == xt* A == copy (xt)* D == copy (xt)* A
473+ y = [x, x]
474+ yt = transpose (y)
475+ @test y' * D* y == (y' * D)* y == (y' * A)* y
476+ @test yt* D* y == (yt* D)* y == (yt* A)* y
461477end
462478
463479@testset " Triangular division by Diagonal #27989" begin
0 commit comments