1
0
mirror of https://github.com/kalmarek/PropertyT.jl.git synced 2024-12-25 02:15:29 +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
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

View File

@ -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