1
0
mirror of https://github.com/kalmarek/PropertyT.jl.git synced 2024-11-19 15:25:29 +01:00
PropertyT.jl/SL(3,Z).jl

105 lines
3.0 KiB
Julia
Raw Normal View History

function SL₃_generatingset()
2017-01-09 01:03:46 +01:00
function E(i::Int, j::Int, N::Int=3)
@assert i≠j
k = eye(N)
k[i,j] = 1
return k
end
2017-01-09 01:03:46 +01:00
S = [E(1,2), E(1,3), E(2,3)];
S = vcat(S, [x' for x in S]);
S = vcat(S, [inv(x) for x in S]);
return S
end
function generate_B₂_and_B₄(B₁)
B₂ = products(B₁, B₁);
B₃ = products(B₁, B₂);
B₄ = products(B₁, B₃);
2017-01-13 18:41:21 +01:00
@assert B₄[1:length(B₂)] == B₂
return B₂, B₄;
end
2017-01-09 01:03:46 +01:00
function prepare_Laplacian_and_constraints(S, identity)
2017-01-09 01:03:46 +01:00
B₂, B₄ = generate_B₂_and_B₄(vcat([identity], S))
product_matrix = create_product_matrix(B₄,length(B₂));
sdp_constraints = constraints_from_pm(product_matrix, length(B₄))
L_coeff = splaplacian_coeff(S, B₄);
2017-01-09 01:03:46 +01:00
return GroupAlgebraElement(L_coeff, product_matrix), sdp_constraints
end
2017-01-09 01:03:46 +01:00
function prepare_Δ_sdp_constraints(name::String;cached=true)
f₁ = isfile("$name.product_matrix")
f₂ = isfile("$name.delta.coefficients")
if cached && f₁ && f₂
println("Loading precomputed pm, Δ, sdp_constraints...")
product_matrix = readdlm("$name.product_matrix", Int)
L = readdlm("$name.delta.coefficients")[:, 1]
Δ = GroupAlgebraElement(L, product_matrix)
sdp_constraints = constraints_from_pm(product_matrix)
else
println("Computing pm, Δ, sdp_constraints...")
ID = eye(Int, 3)
S₁ = SL₃_generatingset()
Δ, sdp_constraints = prepare_Laplacian_and_constraints(S₁, ID)
writedlm("$name.delta.coefficients", Δ.coefficients)
writedlm("$name.product_matrix", Δ.product_matrix)
end
return Δ, sdp_constraints
end
2017-01-09 01:03:46 +01:00
function compute_κ_A(name::String, Δ, sdp_constraints;
cached = true,
tol = TOL,
verbose = VERBOSE,
solver = MosekSolver(INTPNT_CO_TOL_REL_GAP=tol, QUIET=!verbose))
# solver = SCSSolver(eps=TOL, max_iters=ITERATIONS, verbose=VERBOSE))
f₁ = isfile("$name.kappa")
f₂ = isfile("$name.SDPmatrixA")
if cached && f₁ && f₂
println("Loading precomputed κ, A...")
A = readdlm("$name.SDPmatrixA")
κ = readdlm("$name.kappa")[1]
else
println("Solving SDP problem maximizing κ...")
κ, A = solve_SDP(sdp_constraints, Δ, solver, verbose=verbose)
writedlm("$name.kappa", kappa)
writedlm("$name.SDPmatrixA", A)
end
return κ, A
end
2017-01-09 01:03:46 +01:00
workers_processes = addprocs()
@everywhere push!(LOAD_PATH, "./")
using GroupAlgebras
@everywhere include("property(T).jl")
2017-01-13 18:41:21 +01:00
const NAME = "SL3Z"
const VERBOSE = true
const TOL=1e-7
const Δ, sdp_constraints = prepare_Δ_sdp_constraints(NAME)
const κ, A = compute_κ_A(NAME, Δ, sdp_constraints)
2017-01-14 15:24:16 +01:00
if κ > 0
@time T = _distance_to_positive_cone(Δ, κ, A, tol=TOL, verbose=VERBOSE)
2017-01-14 15:24:16 +01:00
if T < 0
println("$NAME HAS property (T)!")
else
println("$NAME may NOT HAVE property (T)!")
end
2017-01-14 15:24:16 +01:00
else
println(" < 0: $NAME may NOT HAVE property (T)!")
end
2017-01-13 18:41:21 +01:00
2017-01-14 15:24:16 +01:00
rmprocs(workers_processes)