mirror of
https://github.com/kalmarek/PropertyT.jl.git
synced 2024-11-19 07:20:28 +01:00
Slightly faster algebra multiplication
This commit is contained in:
parent
a696205d6e
commit
48645a7b5c
@ -61,12 +61,12 @@ end
|
|||||||
|
|
||||||
function algebra_multiplication{T<:Number}(X::AbstractVector{T}, Y::AbstractVector{T}, pm::Array{Int,2})
|
function algebra_multiplication{T<:Number}(X::AbstractVector{T}, Y::AbstractVector{T}, pm::Array{Int,2})
|
||||||
result = zeros(X)
|
result = zeros(X)
|
||||||
for (i,x) in enumerate(X)
|
for (j,y) in enumerate(Y)
|
||||||
if x != 0
|
if y != zero(T)
|
||||||
for (j, index) in enumerate(pm[i,:])
|
for (i, index) in enumerate(pm[:,j])
|
||||||
if Y[j] != 0
|
if X[i] != zero(T)
|
||||||
index == 0 && throw(ArgumentError("The product don't seem to belong to the span of basis!"))
|
index == 0 && throw(ArgumentError("The product don't seem to belong to the span of basis!"))
|
||||||
result[index] += x*Y[j]
|
result[index] += X[i]*y
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user