mirror of
https://github.com/kalmarek/GroupRings.jl.git
synced 2025-01-01 11:45:28 +01:00
allocation-free multiplication!
This commit is contained in:
parent
6e95eae583
commit
ee3b4e0761
@ -318,12 +318,12 @@ end
|
|||||||
function mul!{T}(result::AbstractVector{T}, X::AbstractVector, Y::AbstractVector, pm::Array{Int,2})
|
function mul!{T}(result::AbstractVector{T}, X::AbstractVector, Y::AbstractVector, pm::Array{Int,2})
|
||||||
z = zero(T)
|
z = zero(T)
|
||||||
result .= z
|
result .= z
|
||||||
for (j,y) in enumerate(Y)
|
for j in eachindex(Y)
|
||||||
if y != z
|
if Y[j] != z
|
||||||
for (i, index) in enumerate(pm[:,j])
|
for i in 1:size(pm,1)
|
||||||
if X[i] != z
|
if X[i] != z
|
||||||
index == 0 && throw(ArgumentError("The product don't seem to be supported on basis!"))
|
pm[i,j] == 0 && throw(ArgumentError("The product don't seem to be supported on basis!"))
|
||||||
result[index] += X[i]*y
|
result[pm[i,j]] += X[i]*Y[j]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user