rework balls generation for AutFN
This commit is contained in:
parent
88d2e2549b
commit
dc9cd4c9ac
41
AutFN.jl
41
AutFN.jl
@ -115,7 +115,7 @@ function hashed_product{T}(image::T, B, images_dict::Dict{T, Int})
|
||||
return column
|
||||
end
|
||||
|
||||
function create_product_matrix(basis::Vector{AutWord}, images)
|
||||
function create_product_matrix(images, basis::Vector{AutWord})
|
||||
n = length(basis)
|
||||
product_matrix = zeros(Int, (n, n));
|
||||
print("Creating hashtable of images...")
|
||||
@ -129,41 +129,36 @@ function create_product_matrix(basis::Vector{AutWord}, images)
|
||||
return product_matrix
|
||||
end
|
||||
|
||||
function ΔandSDPconstraints(identity::AutWord, S::Vector{AutWord})
|
||||
|
||||
println("Generating Balls of increasing radius...")
|
||||
@time B₁ = vcat([identity], S)
|
||||
@time B₂ = products(B₁,B₁);
|
||||
@show length(B₂)
|
||||
if length(B₂) != length(B₁)
|
||||
@time B₃ = products(B₁, B₂)
|
||||
@show length(B₃)
|
||||
if length(B₃) != length(B₂)
|
||||
@time B₄_images = products_images(B₁, B₃)
|
||||
else
|
||||
B₄_images = unique([f(domain) for f in B₃])
|
||||
function generate_balls{T}(S::Vector{T}, Id::T; radius=4)
|
||||
sizes = Vector{Int}()
|
||||
S = vcat([Id], S)
|
||||
B = [Id]
|
||||
for i in 1:radius
|
||||
B = products(B, S);
|
||||
push!(sizes, length(B))
|
||||
end
|
||||
else
|
||||
B₃ = B₂
|
||||
B₄ = B₂
|
||||
B₄_images = unique([f(domain) for f in B₃])
|
||||
return B, sizes
|
||||
end
|
||||
|
||||
@show length(B₄_images)
|
||||
|
||||
function ΔandSDPconstraints(Id::AutWord, S::Vector{AutWord}, r::Int=2)
|
||||
B, sizes = generate_balls(S, Id, radius=2*r)
|
||||
basis = B[1:sizes[r]]
|
||||
B_images = unique([f(domain) for f in B])
|
||||
|
||||
println("Generated balls of sizes $sizes")
|
||||
|
||||
println("Creating product matrix...")
|
||||
@time pm = create_product_matrix(B₂, B₄_images)
|
||||
@time pm = create_product_matrix(B_images, basis)
|
||||
println("Creating sdp_constratints...")
|
||||
@time sdp_constraints = PropertyT.constraints_from_pm(pm)
|
||||
|
||||
L_coeff = PropertyT.splaplacian_coeff(S, B₂, length(B₄_images))
|
||||
L_coeff = PropertyT.splaplacian_coeff(S, basis, length(B_images))
|
||||
Δ = PropertyT.GroupAlgebraElement(L_coeff, Array{Int,2}(pm))
|
||||
|
||||
return Δ, sdp_constraints
|
||||
end
|
||||
|
||||
ΔandSDPconstraints(identity::AutWord, S::Vector{AutWord}, r::Int) = ΔandSDPconstraints(identity, S)
|
||||
|
||||
const symbols = [FGSymbol("x₁",1), FGSymbol("x₂",1), FGSymbol("x₃",1), FGSymbol("x₄",1), FGSymbol("x₅",1), FGSymbol("x₆",1)]
|
||||
|
||||
const TOL=1e-8
|
||||
|
Loading…
Reference in New Issue
Block a user