mirror of
https://github.com/kalmarek/PropertyT.jl.git
synced 2024-10-15 08:05:35 +02:00
Merge pull request #3 from kalmarek/perf/faster_actions
Perf/faster actions
This commit is contained in:
commit
da54d140fd
@ -14,6 +14,10 @@ matrix:
|
|||||||
allow_failures:
|
allow_failures:
|
||||||
- julia: nightly
|
- julia: nightly
|
||||||
- os: osx
|
- os: osx
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- hdf5-tools
|
||||||
|
|
||||||
## uncomment the following lines to override the default test
|
## uncomment the following lines to override the default test
|
||||||
# script:
|
# script:
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
[[AbstractAlgebra]]
|
[[AbstractAlgebra]]
|
||||||
deps = ["InteractiveUtils", "LinearAlgebra", "Markdown", "Random", "SparseArrays", "Test"]
|
deps = ["InteractiveUtils", "LinearAlgebra", "Markdown", "Random", "SparseArrays", "Test"]
|
||||||
git-tree-sha1 = "56bdd9e9bb2cfdf0876d0846b337c8f395d9a4b7"
|
git-tree-sha1 = "c0d57a3f0618bfbb214005860b9b5e5bceafa61c"
|
||||||
uuid = "c3fe647b-3220-5bb0-a1ea-a7954cac585d"
|
uuid = "c3fe647b-3220-5bb0-a1ea-a7954cac585d"
|
||||||
version = "0.4.6"
|
version = "0.5.0"
|
||||||
|
|
||||||
[[Base64]]
|
[[Base64]]
|
||||||
uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
|
uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
|
||||||
@ -16,10 +16,10 @@ uuid = "9e28174c-4ba2-5203-b857-d8d62c4213ee"
|
|||||||
version = "0.8.10"
|
version = "0.8.10"
|
||||||
|
|
||||||
[[BinaryProvider]]
|
[[BinaryProvider]]
|
||||||
deps = ["Libdl", "Pkg", "SHA", "Test"]
|
deps = ["Libdl", "SHA"]
|
||||||
git-tree-sha1 = "055eb2690182ebc31087859c3dd8598371d3ef9e"
|
git-tree-sha1 = "c7361ce8a2129f20b0e05a89f7070820cfed6648"
|
||||||
uuid = "b99e7846-7c00-51b0-8f62-c81ae34c0232"
|
uuid = "b99e7846-7c00-51b0-8f62-c81ae34c0232"
|
||||||
version = "0.5.3"
|
version = "0.5.4"
|
||||||
|
|
||||||
[[Blosc]]
|
[[Blosc]]
|
||||||
deps = ["BinaryProvider", "CMakeWrapper", "Compat", "Libdl"]
|
deps = ["BinaryProvider", "CMakeWrapper", "Compat", "Libdl"]
|
||||||
@ -34,19 +34,16 @@ uuid = "e1450e63-4bb3-523b-b2a4-4ffa8c0fd77d"
|
|||||||
version = "1.0.0"
|
version = "1.0.0"
|
||||||
|
|
||||||
[[CMake]]
|
[[CMake]]
|
||||||
deps = ["BinDeps", "Libdl", "Test"]
|
deps = ["BinDeps"]
|
||||||
git-tree-sha1 = "6e39bef3cbb8321e8a464b18a5c20d7cef813938"
|
git-tree-sha1 = "c67a8689dc5444adc5eb2be7d837100340ecba11"
|
||||||
uuid = "631607c0-34d2-5d66-819e-eb0f9aa2061a"
|
uuid = "631607c0-34d2-5d66-819e-eb0f9aa2061a"
|
||||||
version = "1.1.1"
|
version = "1.1.2"
|
||||||
|
|
||||||
[[CMakeWrapper]]
|
[[CMakeWrapper]]
|
||||||
deps = ["BinDeps", "CMake", "Libdl", "Parameters", "Test"]
|
deps = ["BinDeps", "CMake", "Libdl", "Parameters", "Test"]
|
||||||
git-tree-sha1 = "2b43d451639984e3571951cc687b8509b0a86c6d"
|
git-tree-sha1 = "16d4acb3d37dc05b714977ffefa8890843dc8985"
|
||||||
uuid = "d5fb7624-851a-54ee-a528-d3f3bac0b4a0"
|
uuid = "d5fb7624-851a-54ee-a528-d3f3bac0b4a0"
|
||||||
version = "0.2.2"
|
version = "0.2.3"
|
||||||
|
|
||||||
[[CRC32c]]
|
|
||||||
uuid = "8bf52ea8-c179-5cab-976a-9e18b702a9bc"
|
|
||||||
|
|
||||||
[[CRlibm]]
|
[[CRlibm]]
|
||||||
deps = ["Libdl", "Test"]
|
deps = ["Libdl", "Test"]
|
||||||
@ -103,10 +100,9 @@ deps = ["Random", "Serialization", "Sockets"]
|
|||||||
uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b"
|
uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b"
|
||||||
|
|
||||||
[[ErrorfreeArithmetic]]
|
[[ErrorfreeArithmetic]]
|
||||||
deps = ["Test"]
|
git-tree-sha1 = "a2b7d5a7962e5bfaab0e2e87c9cde7d3087f4e2c"
|
||||||
git-tree-sha1 = "e38834f24946eb8c7dcf2bb00580e087faa60c44"
|
|
||||||
uuid = "90fa49ef-747e-5e6f-a989-263ba693cf1a"
|
uuid = "90fa49ef-747e-5e6f-a989-263ba693cf1a"
|
||||||
version = "0.3.2"
|
version = "0.4.0"
|
||||||
|
|
||||||
[[FastRounding]]
|
[[FastRounding]]
|
||||||
deps = ["ErrorfreeArithmetic", "Test"]
|
deps = ["ErrorfreeArithmetic", "Test"]
|
||||||
@ -115,10 +111,10 @@ uuid = "fa42c844-2597-5d31-933b-ebd51ab2693f"
|
|||||||
version = "0.2.0"
|
version = "0.2.0"
|
||||||
|
|
||||||
[[FileIO]]
|
[[FileIO]]
|
||||||
deps = ["Pkg", "Random", "Test"]
|
deps = ["Pkg"]
|
||||||
git-tree-sha1 = "da32159d4a2e526338506685e280e39ed2f18961"
|
git-tree-sha1 = "351f001a78aa1b7ad2696e386e110b5abd071c71"
|
||||||
uuid = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549"
|
uuid = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549"
|
||||||
version = "1.0.6"
|
version = "1.0.7"
|
||||||
|
|
||||||
[[ForwardDiff]]
|
[[ForwardDiff]]
|
||||||
deps = ["CommonSubexpressions", "DiffResults", "DiffRules", "InteractiveUtils", "LinearAlgebra", "NaNMath", "Random", "SparseArrays", "SpecialFunctions", "StaticArrays", "Test"]
|
deps = ["CommonSubexpressions", "DiffResults", "DiffRules", "InteractiveUtils", "LinearAlgebra", "NaNMath", "Random", "SparseArrays", "SpecialFunctions", "StaticArrays", "Test"]
|
||||||
@ -128,25 +124,25 @@ version = "0.10.3"
|
|||||||
|
|
||||||
[[GroupRings]]
|
[[GroupRings]]
|
||||||
deps = ["AbstractAlgebra", "LinearAlgebra", "Markdown", "SparseArrays"]
|
deps = ["AbstractAlgebra", "LinearAlgebra", "Markdown", "SparseArrays"]
|
||||||
git-tree-sha1 = "0d259b2e2254cc22c526938f37936618784fd03d"
|
git-tree-sha1 = "30ed912be2eb74523699bfdaaefd5d5426c43afa"
|
||||||
repo-rev = "enh/julia-v0.7"
|
repo-rev = "master"
|
||||||
repo-url = "https://github.com/kalmarek/GroupRings.jl"
|
repo-url = "https://github.com/kalmarek/GroupRings.jl"
|
||||||
uuid = "0befed6a-bd73-11e8-1e41-a1190947c2f5"
|
uuid = "0befed6a-bd73-11e8-1e41-a1190947c2f5"
|
||||||
version = "0.2.0"
|
version = "0.2.0"
|
||||||
|
|
||||||
[[Groups]]
|
[[Groups]]
|
||||||
deps = ["AbstractAlgebra", "LinearAlgebra", "Markdown"]
|
deps = ["AbstractAlgebra", "LinearAlgebra", "Markdown"]
|
||||||
git-tree-sha1 = "35b712a91e9910bbf150ef1d20d78393e244deaf"
|
git-tree-sha1 = "64dcaa46affb4568501d35e6fae36a71a7ae5cbb"
|
||||||
repo-rev = "enh/julia-v0.7"
|
repo-rev = "master"
|
||||||
repo-url = "https://github.com/kalmarek/Groups.jl"
|
repo-url = "https://github.com/kalmarek/Groups.jl"
|
||||||
uuid = "5d8bd718-bd84-11e8-3b40-ad14f4a32557"
|
uuid = "5d8bd718-bd84-11e8-3b40-ad14f4a32557"
|
||||||
version = "0.2.0"
|
version = "0.2.1"
|
||||||
|
|
||||||
[[HDF5]]
|
[[HDF5]]
|
||||||
deps = ["BinDeps", "Blosc", "CRC32c", "Distributed", "Homebrew", "Libdl", "LinearAlgebra", "Mmap", "Pkg", "Test", "WinRPM"]
|
deps = ["BinDeps", "Blosc", "Homebrew", "Libdl", "Mmap", "WinRPM"]
|
||||||
git-tree-sha1 = "dd83e1e9c72e44e3a156438b552cf75dbdda722f"
|
git-tree-sha1 = "e6f0c154d01faef0d0831d075aa8f279f95946da"
|
||||||
uuid = "f67ccb44-e63f-5c2f-98bd-6dc0ccc4ba2f"
|
uuid = "f67ccb44-e63f-5c2f-98bd-6dc0ccc4ba2f"
|
||||||
version = "0.11.0"
|
version = "0.11.1"
|
||||||
|
|
||||||
[[HTTPClient]]
|
[[HTTPClient]]
|
||||||
deps = ["Compat", "LibCURL"]
|
deps = ["Compat", "LibCURL"]
|
||||||
@ -183,10 +179,10 @@ uuid = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
|
|||||||
version = "0.20.0"
|
version = "0.20.0"
|
||||||
|
|
||||||
[[JuMP]]
|
[[JuMP]]
|
||||||
deps = ["Calculus", "DataStructures", "ForwardDiff", "LinearAlgebra", "MathOptInterface", "NaNMath", "Random", "SparseArrays", "Statistics", "Test"]
|
deps = ["Calculus", "DataStructures", "ForwardDiff", "LinearAlgebra", "MathOptInterface", "NaNMath", "Random", "SparseArrays", "Statistics"]
|
||||||
git-tree-sha1 = "db9f08540c1a23269acbae5d520c79f4722899f4"
|
git-tree-sha1 = "a37fdb14ee3a04b4df44c20a73da89c57035bdf2"
|
||||||
uuid = "4076af6c-e467-56ae-b986-b466b2749572"
|
uuid = "4076af6c-e467-56ae-b986-b466b2749572"
|
||||||
version = "0.19.0"
|
version = "0.19.2"
|
||||||
|
|
||||||
[[LegacyStrings]]
|
[[LegacyStrings]]
|
||||||
deps = ["Compat"]
|
deps = ["Compat"]
|
||||||
@ -195,10 +191,10 @@ uuid = "1b4a561d-cfcb-5daf-8433-43fcf8b4bea3"
|
|||||||
version = "0.4.1"
|
version = "0.4.1"
|
||||||
|
|
||||||
[[LibCURL]]
|
[[LibCURL]]
|
||||||
deps = ["BinaryProvider", "Libdl", "Printf", "Test"]
|
deps = ["BinaryProvider", "Libdl"]
|
||||||
git-tree-sha1 = "d051c8057512ca38a273aaa514145a0b25f24d46"
|
git-tree-sha1 = "5ee138c679fa202ebe211b2683d1eee2a87b3dbe"
|
||||||
uuid = "b27032c2-a3e7-50c8-80cd-2d36dbcbfd21"
|
uuid = "b27032c2-a3e7-50c8-80cd-2d36dbcbfd21"
|
||||||
version = "0.5.0"
|
version = "0.5.1"
|
||||||
|
|
||||||
[[LibExpat]]
|
[[LibExpat]]
|
||||||
deps = ["Compat"]
|
deps = ["Compat"]
|
||||||
@ -252,15 +248,15 @@ version = "0.3.2"
|
|||||||
|
|
||||||
[[Nemo]]
|
[[Nemo]]
|
||||||
deps = ["AbstractAlgebra", "BinaryProvider", "InteractiveUtils", "Libdl", "LinearAlgebra", "Markdown", "Test"]
|
deps = ["AbstractAlgebra", "BinaryProvider", "InteractiveUtils", "Libdl", "LinearAlgebra", "Markdown", "Test"]
|
||||||
git-tree-sha1 = "a152b26c888fbe3c191424938243552935ca2f51"
|
git-tree-sha1 = "b359c25b708c3edcc2f17345d59da7169c207385"
|
||||||
uuid = "2edaba10-b0f1-5616-af89-8c11ac63239a"
|
uuid = "2edaba10-b0f1-5616-af89-8c11ac63239a"
|
||||||
version = "0.13.1"
|
version = "0.14.0"
|
||||||
|
|
||||||
[[OrderedCollections]]
|
[[OrderedCollections]]
|
||||||
deps = ["Random", "Serialization", "Test"]
|
deps = ["Random", "Serialization", "Test"]
|
||||||
git-tree-sha1 = "85619a3f3e17bb4761fe1b1fd47f0e979f964d5b"
|
git-tree-sha1 = "c4c13474d23c60d20a67b217f1d7f22a40edf8f1"
|
||||||
uuid = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"
|
uuid = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"
|
||||||
version = "1.0.2"
|
version = "1.1.0"
|
||||||
|
|
||||||
[[Parameters]]
|
[[Parameters]]
|
||||||
deps = ["Markdown", "OrderedCollections", "REPL", "Test"]
|
deps = ["Markdown", "OrderedCollections", "REPL", "Test"]
|
||||||
@ -289,10 +285,9 @@ deps = ["Serialization"]
|
|||||||
uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
|
uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
|
||||||
|
|
||||||
[[RecipesBase]]
|
[[RecipesBase]]
|
||||||
deps = ["Random", "Test"]
|
git-tree-sha1 = "7bdce29bc9b2f5660a6e5e64d64d91ec941f6aa2"
|
||||||
git-tree-sha1 = "0b3cb370ee4dc00f47f1193101600949f3dcf884"
|
|
||||||
uuid = "3cdcf5f2-1ef4-517c-9805-6587b60abb01"
|
uuid = "3cdcf5f2-1ef4-517c-9805-6587b60abb01"
|
||||||
version = "0.6.0"
|
version = "0.7.0"
|
||||||
|
|
||||||
[[SHA]]
|
[[SHA]]
|
||||||
uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce"
|
uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce"
|
||||||
@ -324,10 +319,10 @@ uuid = "276daf66-3868-5448-9aa4-cd146d93841b"
|
|||||||
version = "0.7.2"
|
version = "0.7.2"
|
||||||
|
|
||||||
[[StaticArrays]]
|
[[StaticArrays]]
|
||||||
deps = ["InteractiveUtils", "LinearAlgebra", "Random", "Statistics", "Test"]
|
deps = ["LinearAlgebra", "Random", "Statistics"]
|
||||||
git-tree-sha1 = "3841b39ed5f047db1162627bf5f80a9cd3e39ae2"
|
git-tree-sha1 = "db23bbf50064c582b6f2b9b043c8e7e98ea8c0c6"
|
||||||
uuid = "90137ffa-7385-5640-81b9-e52037218182"
|
uuid = "90137ffa-7385-5640-81b9-e52037218182"
|
||||||
version = "0.10.3"
|
version = "0.11.0"
|
||||||
|
|
||||||
[[Statistics]]
|
[[Statistics]]
|
||||||
deps = ["LinearAlgebra", "SparseArrays"]
|
deps = ["LinearAlgebra", "SparseArrays"]
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
name = "PropertyT"
|
name = "PropertyT"
|
||||||
uuid = "03b72c93-0167-51e2-8a1e-eb4ff1fb940d"
|
uuid = "03b72c93-0167-51e2-8a1e-eb4ff1fb940d"
|
||||||
authors = ["Marek Kaluba <kalmar@amu.edu.pl>"]
|
authors = ["Marek Kaluba <kalmar@amu.edu.pl>"]
|
||||||
version = "0.2.0"
|
version = "0.2.1"
|
||||||
|
|
||||||
[deps]
|
[deps]
|
||||||
AbstractAlgebra = "c3fe647b-3220-5bb0-a1ea-a7954cac585d"
|
AbstractAlgebra = "c3fe647b-3220-5bb0-a1ea-a7954cac585d"
|
||||||
@ -20,7 +20,7 @@ SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
|
|||||||
|
|
||||||
[compat]
|
[compat]
|
||||||
GroupRings = "^0.2.0"
|
GroupRings = "^0.2.0"
|
||||||
Groups = "^0.2.0"
|
Groups = "^0.2.1"
|
||||||
JuMP = "^0.19.0"
|
JuMP = "^0.19.0"
|
||||||
|
|
||||||
[extras]
|
[extras]
|
||||||
|
@ -37,7 +37,7 @@ function compute_SOS(RG::GroupRing, Q::AbstractMatrix{<:Real})
|
|||||||
return GroupRingElem(result, RG)
|
return GroupRingElem(result, RG)
|
||||||
end
|
end
|
||||||
|
|
||||||
function compute_SOS_square(pm::AbstractMatrix{<:Integer}, Q::AbstractMatrix{<:Real})
|
function compute_SOS_square(pm::AbstractMatrix{<:Integer}, Q::AbstractMatrix)
|
||||||
result = zeros(eltype(Q), maximum(pm));
|
result = zeros(eltype(Q), maximum(pm));
|
||||||
|
|
||||||
for i in 1:size(Q,2)
|
for i in 1:size(Q,2)
|
||||||
@ -47,12 +47,12 @@ function compute_SOS_square(pm::AbstractMatrix{<:Integer}, Q::AbstractMatrix{<:R
|
|||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
|
|
||||||
function compute_SOS_square(RG::GroupRing, Q::AbstractMatrix{<:Real})
|
function compute_SOS_square(RG::GroupRing, Q::AbstractMatrix)
|
||||||
return GroupRingElem(compute_SOS_square(RG.pm, Q), RG)
|
return GroupRingElem(compute_SOS_square(RG.pm, Q), RG)
|
||||||
end
|
end
|
||||||
|
|
||||||
function augIdproj(Q::AbstractMatrix{T}) where {T<:Real}
|
function augIdproj(Q::AbstractMatrix{T}) where T
|
||||||
result = zeros(size(Q))
|
result = zeros(T, size(Q))
|
||||||
l = size(Q, 2)
|
l = size(Q, 2)
|
||||||
Threads.@threads for j in 1:l
|
Threads.@threads for j in 1:l
|
||||||
col = sum(view(Q, :,j))/l
|
col = sum(view(Q, :,j))/l
|
||||||
|
123
src/orbitdata.jl
123
src/orbitdata.jl
@ -58,9 +58,9 @@ function orthSVD(M::AbstractMatrix{T}) where {T<:AbstractFloat}
|
|||||||
return fact.U[:,1:M_rank]
|
return fact.U[:,1:M_rank]
|
||||||
end
|
end
|
||||||
|
|
||||||
function orbit_decomposition(G::Group, E::Vector, rdict=GroupRings.reverse_dict(E))
|
orbit_decomposition(G::Group, E::AbstractVector, rdict=GroupRings.reverse_dict(E)) = orbit_decomposition(collect(G), E, rdict)
|
||||||
|
|
||||||
elts = collect(G)
|
function orbit_decomposition(elts::AbstractVector{<:GroupElem}, E::AbstractVector, rdict=GroupRings.reverse_dict(E))
|
||||||
|
|
||||||
tovisit = trues(size(E));
|
tovisit = trues(size(E));
|
||||||
orbits = Vector{Vector{Int}}()
|
orbits = Vector{Vector{Int}}()
|
||||||
@ -178,13 +178,47 @@ end
|
|||||||
#
|
#
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
function (p::perm)(A::GroupRingElem)
|
function (g::GroupRingElem)(y::GroupRingElem)
|
||||||
RG = parent(A)
|
res = parent(y)()
|
||||||
result = zero(RG, eltype(A.coeffs))
|
for elt in GroupRings.supp(g)
|
||||||
|
res += g[elt]*elt(y)
|
||||||
|
end
|
||||||
|
return res
|
||||||
|
end
|
||||||
|
|
||||||
for (idx, c) in enumerate(A.coeffs)
|
###############################################################################
|
||||||
if c!= zero(eltype(A.coeffs))
|
#
|
||||||
result[p(RG.basis[idx])] = c
|
# perm actions
|
||||||
|
#
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
function (g::perm)(y::GroupRingElem)
|
||||||
|
RG = parent(y)
|
||||||
|
result = zero(RG, eltype(y.coeffs))
|
||||||
|
|
||||||
|
for (idx, c) in enumerate(y.coeffs)
|
||||||
|
if c!= zero(eltype(y.coeffs))
|
||||||
|
result[g(RG.basis[idx])] = c
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return result
|
||||||
|
end
|
||||||
|
|
||||||
|
function (g::perm)(y::GroupRingElem{T, <:SparseVector}) where T
|
||||||
|
RG = parent(y)
|
||||||
|
index = [RG.basis_dict[g(RG.basis[idx])] for idx in y.coeffs.nzind]
|
||||||
|
|
||||||
|
result = GroupRingElem(sparsevec(index, y.coeffs.nzval, y.coeffs.n), RG)
|
||||||
|
|
||||||
|
return result
|
||||||
|
end
|
||||||
|
|
||||||
|
function (p::perm)(A::MatElem)
|
||||||
|
length(p.d) == size(A, 1) == size(A,2) || throw("Can't act via $p on matrix of size $(size(A))")
|
||||||
|
result = similar(A)
|
||||||
|
@inbounds for i in 1:size(A, 1)
|
||||||
|
for j in 1:size(A, 2)
|
||||||
|
result[i, j] = A[p[i], p[j]] # action by permuting rows and colums/conjugation
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return result
|
return result
|
||||||
@ -192,45 +226,35 @@ end
|
|||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
#
|
#
|
||||||
# Action of WreathProductElems on Nemo.MatElem
|
# WreathProductElems action on Nemo.MatElem
|
||||||
#
|
#
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
function matrix_emb(n::DirectPowerGroupElem, p::perm)
|
function (g::WreathProductElem)(y::GroupRingElem)
|
||||||
Id = parent(n.elts[1])()
|
RG = parent(y)
|
||||||
elt = Diagonal([(-1)^(el == Id ? 0 : 1) for el in n.elts])
|
result = zero(RG, eltype(y.coeffs))
|
||||||
return elt[:, p.d]
|
|
||||||
end
|
|
||||||
|
|
||||||
function (g::WreathProductElem)(A::MatElem)
|
for (idx, c) in enumerate(y.coeffs)
|
||||||
g_inv = inv(g)
|
if c!= zero(eltype(y.coeffs))
|
||||||
G = matrix_emb(g.n, g_inv.p)
|
result[g(RG.basis[idx])] = c
|
||||||
G_inv = matrix_emb(g_inv.n, g.p)
|
|
||||||
M = parent(A)
|
|
||||||
return M(G)*A*M(G_inv)
|
|
||||||
end
|
|
||||||
|
|
||||||
import Base.*
|
|
||||||
|
|
||||||
@doc doc"""
|
|
||||||
*(x::AbstractAlgebra.MatElem, P::Generic.perm)
|
|
||||||
> Apply the pemutation $P$ to the rows of the matrix $x$ and return the result.
|
|
||||||
"""
|
|
||||||
function *(x::AbstractAlgebra.MatElem, P::Generic.perm)
|
|
||||||
z = similar(x)
|
|
||||||
m = nrows(x)
|
|
||||||
n = ncols(x)
|
|
||||||
for i = 1:m
|
|
||||||
for j = 1:n
|
|
||||||
z[i, j] = x[i,P[j]]
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return z
|
return result
|
||||||
end
|
end
|
||||||
|
|
||||||
function (p::perm)(A::MatElem)
|
function (g::WreathProductElem{N})(A::MatElem) where N
|
||||||
length(p.d) == A.r == A.c || throw("Can't act via $p on matrix of size ($(A.r), $(A.c))")
|
# @assert N == size(A,1) == size(A,2)
|
||||||
return p*A*inv(p)
|
flips = ntuple(i->(g.n[i].d[1]==1 && g.n[i].d[2]==2 ? 1 : -1), N)
|
||||||
|
result = similar(A)
|
||||||
|
@inbounds for i = 1:size(A,1)
|
||||||
|
for j = 1:size(A,2)
|
||||||
|
x = A[g.p[i], g.p[j]]
|
||||||
|
result[i, j] = x*(flips[i]*flips[j])
|
||||||
|
# result[i, j] = AbstractAlgebra.mul!(x, x, flips[i]*flips[j])
|
||||||
|
# this mul! needs to be separately defined, but is 2x faster
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return result
|
||||||
end
|
end
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
@ -250,23 +274,18 @@ function AutFG_emb(A::AutGroup, g::WreathProductElem)
|
|||||||
return elt
|
return elt
|
||||||
end
|
end
|
||||||
|
|
||||||
function AutFG_emb(A::AutGroup, p::perm)
|
|
||||||
isa(A.objectGroup, FreeGroup) || throw("Not an Aut(Fₙ)")
|
|
||||||
parent(p).n == length(A.objectGroup.gens) || throw("No natural embedding of $(parent(p)) into $A")
|
|
||||||
return A(Groups.perm_autsymbol(p))
|
|
||||||
end
|
|
||||||
|
|
||||||
function (g::WreathProductElem)(a::Groups.Automorphism)
|
function (g::WreathProductElem)(a::Groups.Automorphism)
|
||||||
A = parent(a)
|
A = parent(a)
|
||||||
g = AutFG_emb(A,g)
|
g_emb = AutFG_emb(A,g)
|
||||||
res = A()
|
res = deepcopy(g_emb)
|
||||||
Groups.r_multiply!(res, g.symbols, reduced=false)
|
res = Groups.r_multiply!(res, a.symbols, reduced=false)
|
||||||
Groups.r_multiply!(res, a.symbols, reduced=false)
|
res = Groups.r_multiply!(res, [inv(s) for s in reverse!(g_emb.symbols)])
|
||||||
Groups.r_multiply!(res, [inv(s) for s in reverse!(g.symbols)])
|
|
||||||
return res
|
return res
|
||||||
end
|
end
|
||||||
|
|
||||||
function (p::perm)(a::Groups.Automorphism)
|
function (p::perm)(a::Groups.Automorphism)
|
||||||
g = AutFG_emb(parent(a),p)
|
res = parent(a)(Groups.perm_autsymbol(p))
|
||||||
return g*a*inv(g)
|
res = Groups.r_multiply!(res, a.symbols, reduced=false)
|
||||||
|
res = Groups.r_multiply!(res, [Groups.perm_autsymbol(inv(p))])
|
||||||
|
return res
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user