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