1
0
mirror of https://github.com/kalmarek/PropertyT.jl.git synced 2024-12-24 02:00:30 +01:00

cut on allocations in compute_SOS

This commit is contained in:
kalmarek 2017-11-03 16:54:41 +01:00
parent fba2464a80
commit c0dc6937a5

View File

@ -18,25 +18,27 @@ EOI{T<:Number}(Δ::GroupRingElem{T}, λ::T) = Δ*Δ - λ*Δ
function groupring_square(vect::AbstractVector, l, pm)
zzz = zeros(eltype(vect), l)
zzz[1:length(vect)] .= vect
return GroupRings.mul!(similar(zzz), zzz, zzz, pm)
return GroupRings.mul!(zzz, vect, vect, pm)
end
function compute_SOS(Q::AbstractArray, pm::Array{Int,2}, l::Int)
n = size(Q,2)
# result = zeros(eltype(Q), l)
# for i in 1:n
# result .+= groupring_square(view(Q,:,i), l, pm)
# r = similar(result)
# for i in 1:size(Q,2)
# print(" $i")
# result += GroupRings.mul!(r, view(Q,:,i), view(Q,:,i), pm)
# end
@everywhere groupring_square = PropertyT.groupring_square
result = @parallel (+) for i in 1:n
result = @parallel (+) for i in 1:size(Q,2)
print(" $i")
groupring_square(view(Q,:,i), l, pm)
end
println("")
return result
end