From 082f709cc9309761cbd5e0f24e5aa0af017216fd Mon Sep 17 00:00:00 2001 From: ChrisRackauckas Date: Mon, 21 Aug 2017 23:00:30 -0700 Subject: [PATCH] fix A_mul_B! --- src/strang.jl | 2 +- test/strang.jl | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/strang.jl b/src/strang.jl index e9e5ce7..3b3f2de 100644 --- a/src/strang.jl +++ b/src/strang.jl @@ -11,7 +11,7 @@ function getindex{T}(S::Strang{T}, i, j) abs(i - j) == 1 && return -1 0 end -getindex{T}(S::Strang{T}, I...) = getindex(S,ind2sub(size(S),I)...) +getindex{T}(S::Strang{T}, I...) = getindex(S,ind2sub(size(S),I...)...) size(S::Strang, r::Int) = r==1 || r==2 ? S.n : throw(ArgumentError("Invalid dimension $r")) size(S::Strang) = S.n, S.n full{T}(S::Strang{T}) = full(strang(T, S.n)) diff --git a/test/strang.jl b/test/strang.jl index 8fe0882..1c374b9 100644 --- a/test/strang.jl +++ b/test/strang.jl @@ -10,6 +10,12 @@ for i in 1:n, j in 1:n abs(i-j)>1 && @test Z[i,j] == 0 end +A = Strang(10) +u = ones(10) +v = similar(u) +A_mul_B!(v,A,u) +@test v == [1.0;zeros(8);1.0] + #Matvec product b = randn(n) @test_approx_eq Z*b full(Z)*b