1
0
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:
kalmarek 2018-09-05 10:37:39 +02:00
parent b0d39b33d4
commit 36fbaa5393
2 changed files with 7 additions and 14 deletions

View File

@ -39,14 +39,6 @@ function orbit_spvector(vect::AbstractVector, orbits)
return orb_vector return orb_vector
end 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 # Matrix-, Permutation- and C*-representations

View File

@ -7,14 +7,15 @@ function constraints(pm::Matrix{I}, total_length=maximum(pm)) where {I<:Integer}
return cnstrs return cnstrs
end end
function constraint(pm::Matrix{I}, k) where {I<:Integer} function orbit_constraint!(result::SparseMatrixCSC, cnstrs, orbit; val=1.0/length(orbit))
cnstr = Vector{I}() result .= zero(eltype(result))
for i in eachindex(pm) dropzeros!(result)
if pm[i] == k for constraint in cnstr_orbit
push!(cnstr, i) for idx in constraint
result[idx] = val
end end
end end
return cnstr return result
end end