Skip to content

Commit

Permalink
Test degenrate matmul cases
Browse files Browse the repository at this point in the history
  • Loading branch information
nickrobinson251 committed Oct 22, 2019
1 parent ce7c422 commit 829034c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/base_maths.jl
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ using Test
end # Addition

@testset "Multiplication" begin

@testset "BlockDiagonal * BlockDiagonal" begin
@test b1 * b1 isa BlockDiagonal
@test Matrix(b1 * b1) Matrix(b1) * Matrix(b1)
Expand Down Expand Up @@ -96,6 +97,13 @@ using Test
@test A′ * b1 isa Matrix
@test A′ * b1 A′ * Matrix(b1)
@test_throws DimensionMismatch A * b1

# degenerate cases
m = rand(0, 0)
@test m * BlockDiagonal([m]) == m * m == m
m = rand(5, 0)
@test m' * BlockDiagonal([m]) == m' * m == rand(0, 0)
@test m * BlockDiagonal([m']) == m * m' == zeros(5, 5)
end

@testset "BlockDiagonal * Diagonal" begin
Expand Down

0 comments on commit 829034c

Please sign in to comment.