From 52f9071ed0e1e8ce5282bb7c7b0536c89a533041 Mon Sep 17 00:00:00 2001 From: Daniel Bruegmann Date: Mon, 1 Mar 2021 17:53:01 +0100 Subject: [PATCH] LinearAlgebra: Add test "matrix x matrix with negative stride". (#39849) (Made while looking at #39836, which is matrix x vector. Matrix x matrix with negative stride is fine as it is, because it uses the Julia implementation of matrix multiplication.) --- stdlib/LinearAlgebra/test/matmul.jl | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/stdlib/LinearAlgebra/test/matmul.jl b/stdlib/LinearAlgebra/test/matmul.jl index f0b8cff9f5379..6eed61f901aed 100644 --- a/stdlib/LinearAlgebra/test/matmul.jl +++ b/stdlib/LinearAlgebra/test/matmul.jl @@ -205,6 +205,14 @@ end @test *(Asub, adjoint(Asub)) == *(Aref, adjoint(Aref)) end +@testset "matrix x matrix with negative stride" begin + M = reshape(map(Float64,1:77),7,11) + N = reshape(map(Float64,1:63),9,7) + U = view(M,7:-1:1,11:-2:1) + V = view(N,7:-1:2,7:-1:1) + @test U*V ≈ Matrix(U) * Matrix(V) +end + @testset "dot product of subarrays of vectors (floats, negative stride, issue #37767)" begin for T in (Float32, Float64, ComplexF32, ComplexF64) a = Vector{T}(3:2:7)