mirror of
https://github.com/kalmarek/PropertyT.jl.git
synced 2024-08-15 01:40:39 +02:00
cut on allocations in compute_SOS
This commit is contained in:
parent
fba2464a80
commit
c0dc6937a5
@ -18,25 +18,27 @@ EOI{T<:Number}(Δ::GroupRingElem{T}, λ::T) = Δ*Δ - λ*Δ
|
|||||||
|
|
||||||
function groupring_square(vect::AbstractVector, l, pm)
|
function groupring_square(vect::AbstractVector, l, pm)
|
||||||
zzz = zeros(eltype(vect), l)
|
zzz = zeros(eltype(vect), l)
|
||||||
zzz[1:length(vect)] .= vect
|
return GroupRings.mul!(zzz, vect, vect, pm)
|
||||||
return GroupRings.mul!(similar(zzz), zzz, zzz, pm)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function compute_SOS(Q::AbstractArray, pm::Array{Int,2}, l::Int)
|
function compute_SOS(Q::AbstractArray, pm::Array{Int,2}, l::Int)
|
||||||
n = size(Q,2)
|
|
||||||
|
|
||||||
# result = zeros(eltype(Q), l)
|
# result = zeros(eltype(Q), l)
|
||||||
# for i in 1:n
|
# r = similar(result)
|
||||||
# result .+= groupring_square(view(Q,:,i), l, pm)
|
# for i in 1:size(Q,2)
|
||||||
|
# print(" $i")
|
||||||
|
# result += GroupRings.mul!(r, view(Q,:,i), view(Q,:,i), pm)
|
||||||
# end
|
# end
|
||||||
|
|
||||||
@everywhere groupring_square = PropertyT.groupring_square
|
@everywhere groupring_square = PropertyT.groupring_square
|
||||||
|
|
||||||
result = @parallel (+) for i in 1:n
|
result = @parallel (+) for i in 1:size(Q,2)
|
||||||
print(" $i")
|
print(" $i")
|
||||||
groupring_square(view(Q,:,i), l, pm)
|
groupring_square(view(Q,:,i), l, pm)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
println("")
|
||||||
|
|
||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user