Skip to content

Commit

Permalink
Merge pull request #20 from ChrisRackauckas/a_mul_b
Browse files Browse the repository at this point in the history
fix A_mul_B!
  • Loading branch information
jiahao authored Aug 22, 2017
2 parents c59afab + 082f709 commit 0df1421
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/strang.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
6 changes: 6 additions & 0 deletions test/strang.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0df1421

Please sign in to comment.