mirror of
https://github.com/kalmarek/PropertyT.jl.git
synced 2024-11-26 17:05:27 +01:00
Revert "Thread.@threads compute_SOS (better precision!)"
This reverts commit ad1b11f10d
.
This commit is contained in:
parent
ad1b11f10d
commit
2602d0a181
@ -3,34 +3,20 @@ using IntervalArithmetic
|
|||||||
IntervalArithmetic.setrounding(Interval, :tight)
|
IntervalArithmetic.setrounding(Interval, :tight)
|
||||||
IntervalArithmetic.setformat(sigfigs=12)
|
IntervalArithmetic.setformat(sigfigs=12)
|
||||||
|
|
||||||
function compute_SOS(pm::AbstractMatrix{<:Integer}, Q::AbstractMatrix{<:Real})
|
function compute_SOS(pm::Array{I,2}, Q) where I<:Integer
|
||||||
thr_count = Threads.nthreads()
|
result = zeros(eltype(Q), maximum(pm));
|
||||||
|
for i in 1:size(Q,2)
|
||||||
|
GroupRings.fmac!(result, view(Q,:,i), view(Q,:,i), pm)
|
||||||
d, r = divrem(size(Q,2), thr_count)
|
|
||||||
batch_result = [zeros(eltype(Q), maximum(pm)) for _ in 1:thr_count]
|
|
||||||
|
|
||||||
Threads.@threads for k in 1:Threads.nthreads()
|
|
||||||
for i in 1:d
|
|
||||||
idx = d*(k-1)+i
|
|
||||||
GroupRings.fmac!(batch_result[k], view(Q,:,idx), view(Q,:,idx), pm)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
result = sum(batch_result)
|
|
||||||
for idx in thr_count*d+1:(thr_count*d + r)
|
|
||||||
GroupRings.fmac!(result, view(Q,:,idx), view(Q,:,idx), pm)
|
|
||||||
end
|
|
||||||
|
|
||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
|
|
||||||
function compute_SOS(RG::GroupRing, Q::AbstractMatrix)
|
function compute_SOS(RG::GroupRing, Q::AbstractArray)
|
||||||
result = compute_SOS(RG.pm, Q)
|
result = compute_SOS(RG.pm, Q)
|
||||||
return GroupRingElem(result, RG)
|
return GroupRingElem(result, RG)
|
||||||
end
|
end
|
||||||
|
|
||||||
function augIdproj(Q::AbstractMatrix{<:Real})
|
function augIdproj(Q::AbstractMatrix{T}) where {T<:Real}
|
||||||
result = zeros(size(Q))
|
result = zeros(size(Q))
|
||||||
l = size(Q, 2)
|
l = size(Q, 2)
|
||||||
Threads.@threads for j in 1:l
|
Threads.@threads for j in 1:l
|
||||||
|
Loading…
Reference in New Issue
Block a user