1
0
mirror of https://github.com/kalmarek/Groups.jl.git synced 2024-08-08 07:53:53 +02:00

use tuples in evaluation of AutSymbols

This commit is contained in:
kalmarek 2018-03-17 05:08:42 +01:00
parent 6a59c53c8f
commit acb1dbe6c8

View File

@ -56,23 +56,23 @@ parent_type(::AutGroupElem) = AutGroup
# #
############################################################################### ###############################################################################
function (ϱ::RTransvect)(v, pow=1::Int) function (ϱ::RTransvect)(v::NTuple{N, T}, pow=1::Int) where {N, T}
return [(k==ϱ.i ? v[ϱ.i]*v[ϱ.j]^pow : v[k]) for k in eachindex(v)] return ntuple(k -> (k==ϱ.i ? v[ϱ.i]*v[ϱ.j]^pow : v[k]), N)::NTuple{N, T}
end end
function (λ::LTransvect)(v, pow=1::Int) function (λ::LTransvect)(v::NTuple{N, T}, pow=1::Int) where {N, T}
return [(k==λ.i ? v[λ.j]^pow*v[λ.i] : v[k]) for k in eachindex(v)] return ntuple(k -> (k==λ.i ? v[λ.j]^pow*v[λ.i] : v[k]), N)::NTuple{N, T}
end end
function (σ::PermAut)(v, pow=1::Int) function (σ::PermAut)(v::NTuple{N, T}, pow=1::Int) where {N, T}
return v[(σ.p^pow).d] return ntuple(k -> v[(σ.p^pow).d[k]], N)::NTuple{N, T}
end end
function (ɛ::FlipAut)(v, pow=1::Int) function (ɛ::FlipAut)(v::NTuple{N, T}, pow=1::Int) where {N, T}
return [(k==ɛ.i ? v[k]^(-1^pow) : v[k]) for k in eachindex(v)] return ntuple(k -> (k==ɛ.i ? v[k]^(-1^pow) : v[k]), N)::NTuple{N, T}
end end
(::Identity)(v, pow=1::Int) = v (::Identity)(v::NTuple{N, T}, pow=1::Int) where {N, T} = v::NTuple{N, T}
# taken from ValidatedNumerics, under under the MIT "Expat" License: # taken from ValidatedNumerics, under under the MIT "Expat" License:
# https://github.com/JuliaIntervals/ValidatedNumerics.jl/blob/master/LICENSE.md # https://github.com/JuliaIntervals/ValidatedNumerics.jl/blob/master/LICENSE.md
@ -177,18 +177,18 @@ end
# #
############################################################################### ###############################################################################
function (f::AutSymbol){T}(v::Vector{GWord{T}}) function (f::AutSymbol)(v::NTuple{N, T}) where {N, T}
if f.pow == 0 if f.pow == 0
nothing nothing
else else
v = f.typ(v, f.pow) v = f.typ(v, f.pow)::NTuple{N, T}
end end
return v return v
end end
function (F::AutGroupElem)(v::Vector) function (F::AutGroupElem)(v::NTuple{N, T}) where {N, T}
for f in F.symbols for f in F.symbols
v = f(v) v = f(v)::NTuple{N, T}
end end
return v return v
end end