From ee3b4e0761ed74b349482cf31d979a933ee69ae9 Mon Sep 17 00:00:00 2001 From: kalmar Date: Wed, 12 Jul 2017 20:43:12 +0200 Subject: [PATCH] allocation-free multiplication! --- src/GroupRings.jl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/GroupRings.jl b/src/GroupRings.jl index dad9466..029d79a 100644 --- a/src/GroupRings.jl +++ b/src/GroupRings.jl @@ -318,12 +318,12 @@ end function mul!{T}(result::AbstractVector{T}, X::AbstractVector, Y::AbstractVector, pm::Array{Int,2}) z = zero(T) result .= z - for (j,y) in enumerate(Y) - if y != z - for (i, index) in enumerate(pm[:,j]) + for j in eachindex(Y) + if Y[j] != z + for i in 1:size(pm,1) if X[i] != z - index == 0 && throw(ArgumentError("The product don't seem to be supported on basis!")) - result[index] += X[i]*y + pm[i,j] == 0 && throw(ArgumentError("The product don't seem to be supported on basis!")) + result[pm[i,j]] += X[i]*Y[j] end end end