Skip to content

Commit 3036215

Browse files
tam724kshyatt
authored andcommitted
add zero dim matmat/matvec-mul tests
1 parent 7ddeb3f commit 3036215

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

test/testsuite/linalg.jl

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,16 @@ end
420420
@test compare(mul!, AT, rand(T, 2,2), rand(T, 2,1), f(rand(T, 2)))
421421
end
422422
end
423+
424+
@testset "$T gemv zero-dim" for T in eltypes
425+
y, A, x = rand(T, 4), rand(T, 4, 0), rand(T, 0)
426+
427+
@test compare(*, AT, A, x)
428+
@test compare(mul!, AT, y, A, x)
429+
430+
y = rand(T, 4)
431+
@test compare(mul!, AT, y, A, x, Ref(T(4)), Ref(T(5)))
432+
end
423433
end
424434

425435
@testsuite "linalg/mul!/matrix-matrix" (AT, eltypes)->begin
@@ -434,6 +444,16 @@ end
434444
@test compare(mul!, AT, C, f(A), g(B), Ref(T(4)), Ref(T(5)))
435445
@test typeof(AT(rand(T, 3, 3)) * AT(rand(T, 3, 3))) <: AbstractMatrix
436446
end
447+
448+
@testset "$T gemm zero-dim" for T in eltypes
449+
A, B, C = rand(T, 4, 0), rand(T, 0, 4), rand(T, 4, 4)
450+
451+
@test compare(*, AT, A, B)
452+
@test compare(mul!, AT, C, A, B)
453+
454+
C = rand(T, 4, 4)
455+
@test compare(mul!, AT, C, A, B, Ref(T(4)), Ref(T(5)))
456+
end
437457
end
438458

439459
@testsuite "linalg/norm" (AT, eltypes)->begin

0 commit comments

Comments
 (0)