From 7c54abdb275f260ad4005afa3d025316fafb3446 Mon Sep 17 00:00:00 2001 From: Martin Holters Date: Fri, 26 Feb 2016 09:50:25 +0100 Subject: [PATCH] Add test for squeeze on sparse matrices. --- test/sparsedir/sparse.jl | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/sparsedir/sparse.jl b/test/sparsedir/sparse.jl index 61daeccb638df..30ac264e89af1 100644 --- a/test/sparsedir/sparse.jl +++ b/test/sparsedir/sparse.jl @@ -74,6 +74,18 @@ a116[p, p] = reshape(1:9, 3, 3) s116[p, p] = reshape(1:9, 3, 3) @test a116 == s116 +# squeeze +for i = 1:5 + am = sprand(20, 1, 0.2) + av = squeeze(am, 2) + @test ndims(av) == 1 + @test all(av.==am) + am = sprand(1, 20, 0.2) + av = squeeze(am, 1) + @test ndims(av) == 1 + @test all(av.'.==am) +end + # matrix-vector multiplication (non-square) for i = 1:5 a = sprand(10, 5, 0.5)