Skip to content

Commit

Permalink
fix bounds error bug (#26)
Browse files Browse the repository at this point in the history
* fix bounds error bu

* Update test/linalg.jl
  • Loading branch information
GiggleLiu authored and Roger-luo committed Oct 28, 2019
1 parent af024b1 commit a52bce4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/linalg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ function *(A::PermMatrix, X::SparseMatrixCSC)
perm = fast_invperm(A.perm)
nzval = similar(X.nzval)
rowval = similar(X.rowval)
@inbounds for j = 1:nA
@inbounds @simd for k = X.colptr[j]:X.colptr[j+1]-1
@inbounds for j = 1:nX
@inbounds for k = X.colptr[j]:X.colptr[j+1]-1
r = perm[X.rowval[k]]
nzval[k] = X.nzval[k]*A.vals[r]
rowval[k] = r
Expand Down
7 changes: 7 additions & 0 deletions test/linalg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,10 @@ end
@test !(zm zeros(T,5,5))
end
end

@testset "multiply rectangular matrix" begin
pm = pmrand(4)
sp = sparse(reshape([1.0 2 3 4], 4, 1))
res = pm * sp
@test res Matrix(pm) * Matrix(sp)
end

0 comments on commit a52bce4

Please sign in to comment.