move inv and add parent inheritance
This commit is contained in:
parent
ae1dac76fc
commit
528228e46e
|
@ -46,14 +46,6 @@ function length(W::GWord)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function inv{T}(W::GWord{T})
|
|
||||||
if length(W) == 0
|
|
||||||
return W
|
|
||||||
else
|
|
||||||
w = GWord{T}(reverse([inv(s) for s in W.symbols]))
|
|
||||||
w.modified = true
|
|
||||||
return w
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function join_free_symbols!(W::GWord)
|
function join_free_symbols!(W::GWord)
|
||||||
|
@ -170,6 +162,17 @@ end
|
||||||
(^)(x::GWord, n::Integer) = power_by_squaring(x,n)
|
(^)(x::GWord, n::Integer) = power_by_squaring(x,n)
|
||||||
(^){T<:GSymbol}(x::T, n::Integer) = GWord(x)^n
|
(^){T<:GSymbol}(x::T, n::Integer) = GWord(x)^n
|
||||||
|
|
||||||
|
function inv{T}(W::GWord{T})
|
||||||
|
if length(W) == 0
|
||||||
|
return W
|
||||||
|
else
|
||||||
|
G = parent(W)
|
||||||
|
w = GWord{T}(reverse([inv(s) for s in W.symbols]))
|
||||||
|
w.modified = true
|
||||||
|
return G(w)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
is_subsymbol(s::GSymbol, t::GSymbol) =
|
is_subsymbol(s::GSymbol, t::GSymbol) =
|
||||||
s.gen == t.gen && (0 ≤ s.pow ≤ t.pow || 0 ≥ s.pow ≥ t.pow)
|
s.gen == t.gen && (0 ≤ s.pow ≤ t.pow || 0 ≥ s.pow ≥ t.pow)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue