1
0
mirror of https://github.com/kalmarek/SmallHyperbolic synced 2024-11-27 16:35:26 +01:00

delegate parsing hyperbolicity et al to a function

This commit is contained in:
Marek Kaluba 2022-01-18 11:23:11 +01:00
parent 9d6415dcb8
commit 791295f33c
No known key found for this signature in database
GPG Key ID: 8BF1A3855328FC15

View File

@ -24,21 +24,34 @@ grp_name(nt::NamedTuple) = _name(nt)
latex_name(G::TriangleGrp) = "\$G^{$(G.order1),$(G.order2),$(G.order3)}_$(G.index)" latex_name(G::TriangleGrp) = "\$G^{$(G.order1),$(G.order2),$(G.order3)}_$(G.index)"
function TriangleGrp(type::NTuple{3,Int}, generators, relations, nt::NamedTuple) function _ishyperbolic(half_girth_type, nt::NamedTuple)
# @assert fieldnames(SmallHyperbolicGrp) == propertynames(nt) a, b, c = half_girth_type
hyperbolic, witness = if hasproperty(nt, :hyperbolic) if 1 // a + 1 // b + 1 // c < 1
h = _tf_missing(nt.hyperbolic) return true, missing
nh_w = nt.witnesses_for_non_hyperbolicity elseif hasproperty(nt, :hyperbolic)
w = isempty(strip(nh_w)) ? missing : parse_vec(String, '[' * nh_w * ']') hyperbolic = _tf_missing(nt.hyperbolic)
h, w nh_witnesses = let w = strip(nt.witnesses_for_non_hyperbolicity)
elseif 1 // nt.order1 + 1 // nt.order2 + 1 // nt.order3 < 1 isempty(w) ? missing : parse_vec(String, '[' * w * ']')
true, missing
else
missing, missing
end end
@debug "$(nt.hyperbolic) was parsed as $hyperbolic" nh_witnesses
if hyperbolic isa Bool && hyperbolic
@assert ismissing(nh_witnesses)
end
if !ismissing(nh_witnesses)
@assert !hyperbolic
end
return hyperbolic, nh_witnesses
else
return missing, missing
end
end
function TriangleGrp(half_girth_type::NTuple{3,Int}, generators, relations, nt::NamedTuple)
# @assert fieldnames(SmallHyperbolicGrp) == propertynames(nt)
hyperbolic, witness = _ishyperbolic(half_girth_type, nt)
TriangleGrp( TriangleGrp(
type, half_girth_type,
convert(Vector{String}, generators), convert(Vector{String}, generators),
convert(Vector{String}, relations), convert(Vector{String}, relations),
convert(Int, nt.order1), convert(Int, nt.order1),