mirror of
https://github.com/kalmarek/PropertyT.jl.git
synced 2024-11-19 07:20:28 +01:00
move orbit_constraint
This commit is contained in:
parent
b0d39b33d4
commit
36fbaa5393
@ -39,14 +39,6 @@ function orbit_spvector(vect::AbstractVector, orbits)
|
||||
return orb_vector
|
||||
end
|
||||
|
||||
function orbit_constraint(constraints::Vector{Vector{Int}}, n)
|
||||
result = spzeros(n,n)
|
||||
for cnstr in constraints
|
||||
result[cnstr] += 1.0/length(constraints)
|
||||
end
|
||||
return result
|
||||
end
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# Matrix-, Permutation- and C*-representations
|
||||
|
13
src/SDPs.jl
13
src/SDPs.jl
@ -7,14 +7,15 @@ function constraints(pm::Matrix{I}, total_length=maximum(pm)) where {I<:Integer}
|
||||
return cnstrs
|
||||
end
|
||||
|
||||
function constraint(pm::Matrix{I}, k) where {I<:Integer}
|
||||
cnstr = Vector{I}()
|
||||
for i in eachindex(pm)
|
||||
if pm[i] == k
|
||||
push!(cnstr, i)
|
||||
function orbit_constraint!(result::SparseMatrixCSC, cnstrs, orbit; val=1.0/length(orbit))
|
||||
result .= zero(eltype(result))
|
||||
dropzeros!(result)
|
||||
for constraint in cnstr_orbit
|
||||
for idx in constraint
|
||||
result[idx] = val
|
||||
end
|
||||
end
|
||||
return cnstr
|
||||
return result
|
||||
end
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user