1
0
mirror of https://github.com/kalmarek/Groups.jl.git synced 2024-11-19 06:30:29 +01:00

add AbstractAlgebra.mul!

This commit is contained in:
kalmarek 2019-06-05 10:58:44 +02:00
parent 12886fe7f2
commit 54825b4964
No known key found for this signature in database
GPG Key ID: 8BF1A3855328FC15
2 changed files with 15 additions and 3 deletions

View File

@ -1,7 +1,7 @@
name = "Groups"
uuid = "5d8bd718-bd84-11e8-3b40-ad14f4a32557"
authors = ["Marek Kaluba <kalmar@amu.edu.pl>"]
version = "0.2.0"
version = "0.2.1"
[deps]
AbstractAlgebra = "c3fe647b-3220-5bb0-a1ea-a7954cac585d"
@ -13,5 +13,3 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
[targets]
test = ["Test"]
[compat]

View File

@ -233,6 +233,20 @@ end
#
###############################################################################
function AbstractAlgebra.mul!(out::GWord, x::GWord, y::GWord; reduced::Bool=true)
resize!(out.symbols, length(x.symbols)+length(y.symbols))
for i in eachindex(x.symbols)
out.symbols[i] = x.symbols[i]
end
for i in eachindex(y.symbols)
out.symbols[length(x.symbols)+i] = y.symbols[i]
end
if reduced
reduce!(out)
end
return out
end
function r_multiply!(W::GWord, x; reduced::Bool=true)
if length(x) > 0
append!(W.symbols, x)