-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
modified: src/PermPlain.jl modified: test/runtests.jl modified: test/test1.jl
- Loading branch information
Showing
3 changed files
with
46 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,44 @@ | ||
using PermPlain | ||
using Test | ||
using PermPlain: permcycles, cycstoperm | ||
|
||
include("test1.jl") | ||
makec() = [[1, 6, 14, 7, 3, 11], [2, 8, 12, 9, 10, 5, 15, 4]] | ||
makep() = [3,7,2,4,8,10,1,6,9,5] | ||
|
||
@testset "permcycles cyclestoperm" begin | ||
c = makec() | ||
@test permcycles(cycstoperm(c)) == c | ||
end | ||
|
||
@testset "permpower canoncycles" begin | ||
np = 3 | ||
c = makec() | ||
p = PermPlain.cycstoperm(c) | ||
pp = PermPlain.permpower(p,np); | ||
pp1 = PermPlain.permpower2(p,np); | ||
c1 = PermPlain.permpower(c,np); | ||
p2 = PermPlain.cycstoperm(c1); | ||
@test pp == p2 | ||
@test pp1 == p2 | ||
@test PermPlain.permcycles(pp) == PermPlain.canoncycles(c1) | ||
@test PermPlain.cyc_pow_perm(c,np) == pp | ||
end | ||
|
||
@testset "permsparse" begin | ||
p = makep() | ||
s,max = permsparse(permmatrix(p)) | ||
@test permlist(permcycles(s)) == p | ||
|
||
s,max = permsparse(permcycles(p)) | ||
@test permlist(permmatrix(s)) == p | ||
end | ||
|
||
@testset "isperm" begin | ||
p = makep() | ||
s,max = permsparse(p) | ||
@test permlist(permcycles(permmatrix(s))) == p | ||
@test isperm(s) | ||
@test isperm(permcycles(s)) | ||
@test isperm(permmatrix(s)) | ||
@test isperm(permlist(s)) # defined in Base | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +0,0 @@ | ||
using PermPlain: permcycles, cycstoperm | ||
|
||
c = [ [1,6,14,7,3,11], [2,8,12,9,10,5,15,4]] | ||
|
||
@test permcycles(cycstoperm(c)) == c | ||
np = 3 | ||
p = PermPlain.cycstoperm(c) | ||
pp = PermPlain.permpower(p,np); | ||
pp1 = PermPlain.permpower2(p,np); | ||
c1 = PermPlain.permpower(c,np); | ||
p2 = PermPlain.cycstoperm(c1); | ||
@test pp == p2 | ||
@test pp1 == p2 | ||
@test PermPlain.permcycles(pp) == PermPlain.canoncycles(c1) | ||
@test PermPlain.cyc_pow_perm(c,np) == pp | ||
|
||
p = [3,7,2,4,8,10,1,6,9,5]; | ||
s,max = permsparse(permmatrix(p)) | ||
@test permlist(permcycles(s)) == p | ||
|
||
# FIXME: all sparse stuff broke in Julia v1.0 upgrade. | ||
# It should not be hard to fix | ||
|
||
# s,max = permsparse(permcycles(p)) | ||
# @test permlist(permmatrix(s)) == p | ||
|
||
#s,max = permsparse(p) | ||
# @test permlist(permcycles(permmatrix(s))) == p | ||
# @test isperm(s) | ||
# @test isperm(permcycles(s)) | ||
# @test isperm(permmatrix(s)) | ||
# @test isperm(permlist(s)) # defined in Base | ||
|
||
true | ||