use a single zero object to compare

This commit is contained in:
kalmar 2017-07-10 19:25:52 +02:00
parent 56a0964f30
commit 3b9e405565
1 changed files with 3 additions and 2 deletions

View File

@ -311,10 +311,11 @@ end
function mul!{T}(X::AbstractVector{T}, Y::AbstractVector{T},
pm::Array{Int,2}, result::AbstractVector{T})
z = zero(T)
for (j,y) in enumerate(Y)
if y != zero(eltype(Y))
if y != z
for (i, index) in enumerate(pm[:,j])
if X[i] != zero(eltype(X))
if X[i] != z
index == 0 && throw(ArgumentError("The product don't seem to belong to the span of basis!"))
result[index] += X[i]*y
end