Skip to content

Commit 8441e2c

Browse files
author
Matthias Koeppe
committed
./sage -fixdoctests --distribution 'sagemath-graphs[modules]' --probe all --only-tags src/sage/combinat/designs/*.{py,pyx}
1 parent cacb502 commit 8441e2c

File tree

10 files changed

+698
-665
lines changed

10 files changed

+698
-665
lines changed

src/sage/combinat/designs/bibd.py

Lines changed: 75 additions & 72 deletions
Large diffs are not rendered by default.

src/sage/combinat/designs/database.py

Lines changed: 162 additions & 162 deletions
Large diffs are not rendered by default.

src/sage/combinat/designs/designs_pyx.pyx

Lines changed: 68 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -36,38 +36,40 @@ def is_orthogonal_array(OA, int k, int n, int t=2, verbose=False, terminology="O
3636
3737
EXAMPLES::
3838
39+
sage: # needs sage.schemes
3940
sage: from sage.combinat.designs.designs_pyx import is_orthogonal_array
40-
sage: OA = designs.orthogonal_arrays.build(8,9) # optional - sage.schemes
41-
sage: is_orthogonal_array(OA,8,9) # optional - sage.schemes
41+
sage: OA = designs.orthogonal_arrays.build(8,9)
42+
sage: is_orthogonal_array(OA,8,9)
4243
True
43-
sage: is_orthogonal_array(OA,8,10) # optional - sage.schemes
44+
sage: is_orthogonal_array(OA,8,10)
4445
False
45-
sage: OA[4][3] = 1 # optional - sage.schemes
46-
sage: is_orthogonal_array(OA,8,9) # optional - sage.schemes
46+
sage: OA[4][3] = 1
47+
sage: is_orthogonal_array(OA,8,9)
4748
False
48-
sage: is_orthogonal_array(OA,8,9,verbose=True) # optional - sage.schemes
49+
sage: is_orthogonal_array(OA,8,9,verbose=True)
4950
Columns 0 and 3 are not orthogonal
5051
False
51-
sage: is_orthogonal_array(OA,8,9, verbose=True, terminology="MOLS") # optional - sage.schemes
52+
sage: is_orthogonal_array(OA,8,9, verbose=True, terminology="MOLS")
5253
Squares 0 and 3 are not orthogonal
5354
False
5455
5556
TESTS::
5657
57-
sage: is_orthogonal_array(OA,8,9, t=3) # optional - sage.schemes
58+
sage: # needs sage.schemes
59+
sage: is_orthogonal_array(OA,8,9, t=3)
5860
Traceback (most recent call last):
5961
...
6062
NotImplementedError: only implemented for t=2
61-
sage: is_orthogonal_array([[3]*8],8,9, verbose=True) # optional - sage.schemes
63+
sage: is_orthogonal_array([[3]*8],8,9, verbose=True)
6264
The number of rows is 1 instead of 9^2=81
6365
False
64-
sage: is_orthogonal_array([[3]*8],8,9, verbose=True, terminology="MOLS") # optional - sage.schemes
66+
sage: is_orthogonal_array([[3]*8],8,9, verbose=True, terminology="MOLS")
6567
All squares do not have dimension n^2=9^2
6668
False
67-
sage: is_orthogonal_array([[3]*7],8,9, verbose=True) # optional - sage.schemes
69+
sage: is_orthogonal_array([[3]*7],8,9, verbose=True)
6870
Some row does not have length 8
6971
False
70-
sage: is_orthogonal_array([[3]*7],8,9, verbose=True, terminology="MOLS") # optional - sage.schemes
72+
sage: is_orthogonal_array([[3]*7],8,9, verbose=True, terminology="MOLS")
7173
The number of squares is not 6
7274
False
7375
@@ -183,16 +185,16 @@ def is_group_divisible_design(groups,blocks,v,G=None,K=None,lambd=1,verbose=Fals
183185
EXAMPLES::
184186
185187
sage: from sage.combinat.designs.designs_pyx import is_group_divisible_design
186-
sage: TD = designs.transversal_design(4,10) # optional - sage.modules
187-
sage: groups = [list(range(i*10,(i+1)*10)) for i in range(4)] # optional - sage.modules
188-
sage: is_group_divisible_design(groups,TD,40,lambd=1) # optional - sage.modules
188+
sage: TD = designs.transversal_design(4,10) # needs sage.modules
189+
sage: groups = [list(range(i*10,(i+1)*10)) for i in range(4)] # needs sage.modules
190+
sage: is_group_divisible_design(groups,TD,40,lambd=1) # needs sage.modules
189191
True
190192
191193
TESTS::
192194
193-
sage: TD = designs.transversal_design(4,10) # optional - sage.modules
194-
sage: groups = [list(range(i*10,(i+1)*10)) for i in range(4)] # optional - sage.modules
195-
sage: is_group_divisible_design(groups, TD, 40, lambd=2, verbose=True) # optional - sage.modules
195+
sage: TD = designs.transversal_design(4,10) # needs sage.modules
196+
sage: groups = [list(range(i*10,(i+1)*10)) for i in range(4)] # needs sage.modules
197+
sage: is_group_divisible_design(groups, TD, 40, lambd=2, verbose=True) # needs sage.modules
196198
the pair (0,10) has been seen 1 times but lambda=2
197199
False
198200
sage: is_group_divisible_design([[1,2],[3,4]],[[1,2]],40,lambd=1,verbose=True)
@@ -214,13 +216,14 @@ def is_group_divisible_design(groups,blocks,v,G=None,K=None,lambd=1,verbose=Fals
214216
a block has size 2 while K=[1]
215217
False
216218
217-
sage: p = designs.projective_plane(3) # optional - sage.schemes
218-
sage: is_group_divisible_design(None, p.blocks(), 13) # optional - sage.schemes
219+
sage: # needs sage.schemes
220+
sage: p = designs.projective_plane(3)
221+
sage: is_group_divisible_design(None, p.blocks(), 13)
219222
(True, [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12]])
220-
sage: is_group_divisible_design(None, p.blocks()*2, 13, verbose=True) # optional - sage.schemes
223+
sage: is_group_divisible_design(None, p.blocks()*2, 13, verbose=True)
221224
the pair (0,1) has been seen 2 times but lambda=1
222225
False
223-
sage: is_group_divisible_design(None, p.blocks()*2, 13, lambd=2) # optional - sage.schemes
226+
sage: is_group_divisible_design(None, p.blocks()*2, 13, lambd=2)
224227
(True, [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12]])
225228
"""
226229
cdef int n = v
@@ -362,18 +365,18 @@ def is_pairwise_balanced_design(blocks,v,K=None,lambd=1,verbose=False):
362365
sage: sts = designs.steiner_triple_system(9)
363366
sage: is_pairwise_balanced_design(sts,9,[3],1)
364367
True
365-
sage: TD = designs.transversal_design(4,10).blocks() # optional - sage.modules
366-
sage: groups = [list(range(i*10,(i+1)*10)) for i in range(4)] # optional - sage.modules
367-
sage: is_pairwise_balanced_design(TD + groups, 40, [4,10], 1, verbose=True) # optional - sage.modules
368+
sage: TD = designs.transversal_design(4,10).blocks() # needs sage.modules
369+
sage: groups = [list(range(i*10,(i+1)*10)) for i in range(4)] # needs sage.modules
370+
sage: is_pairwise_balanced_design(TD + groups, 40, [4,10], 1, verbose=True) # needs sage.modules
368371
True
369372
370373
TESTS::
371374
372375
sage: from sage.combinat.designs.designs_pyx import is_pairwise_balanced_design
373-
sage: is_pairwise_balanced_design(TD + groups, 40, [4,10], 2, verbose=True) # optional - sage.modules
376+
sage: is_pairwise_balanced_design(TD + groups, 40, [4,10], 2, verbose=True) # needs sage.modules
374377
the pair (0,1) has been seen 1 times but lambda=2
375378
False
376-
sage: is_pairwise_balanced_design(TD + groups, 40, [10], 1, verbose=True) # optional - sage.modules
379+
sage: is_pairwise_balanced_design(TD + groups, 40, [10], 1, verbose=True) # needs sage.modules
377380
a block has size 4 while K=[10]
378381
False
379382
sage: is_pairwise_balanced_design([[2,2]], 40, [2], 1, verbose=True)
@@ -415,17 +418,18 @@ def is_projective_plane(blocks, verbose=False):
415418
EXAMPLES::
416419
417420
sage: from sage.combinat.designs.designs_pyx import is_projective_plane
418-
sage: p = designs.projective_plane(4) # optional - sage.schemes
419-
sage: b = p.blocks() # optional - sage.schemes
420-
sage: is_projective_plane(b, verbose=True) # optional - sage.schemes
421+
sage: p = designs.projective_plane(4) # needs sage.schemes
422+
sage: b = p.blocks() # needs sage.schemes
423+
sage: is_projective_plane(b, verbose=True) # needs sage.schemes
421424
True
422425
423-
sage: p = designs.projective_plane(2) # optional - sage.schemes
424-
sage: b = p.blocks() # optional - sage.schemes
425-
sage: is_projective_plane(b) # optional - sage.schemes
426+
sage: # needs sage.schemes
427+
sage: p = designs.projective_plane(2)
428+
sage: b = p.blocks()
429+
sage: is_projective_plane(b)
426430
True
427-
sage: b[0][2] = 5 # optional - sage.schemes
428-
sage: is_projective_plane(b, verbose=True) # optional - sage.schemes
431+
sage: b[0][2] = 5
432+
sage: is_projective_plane(b, verbose=True)
429433
the pair (0,5) has been seen 2 times but lambda=1
430434
False
431435
@@ -437,10 +441,11 @@ def is_projective_plane(blocks, verbose=False):
437441
First block has less than 3 points.
438442
False
439443
440-
sage: p = designs.projective_plane(2) # optional - sage.schemes
441-
sage: b = p.blocks() # optional - sage.schemes
442-
sage: b[2].append(4) # optional - sage.schemes
443-
sage: is_projective_plane(b, verbose=True) # optional - sage.schemes
444+
sage: # needs sage.schemes
445+
sage: p = designs.projective_plane(2)
446+
sage: b = p.blocks()
447+
sage: b[2].append(4)
448+
sage: is_projective_plane(b, verbose=True)
444449
a block has size 4 while K=[3]
445450
False
446451
"""
@@ -486,38 +491,39 @@ def is_difference_matrix(M,G,k,lmbda=1,verbose=False):
486491
487492
sage: from sage.combinat.designs.designs_pyx import is_difference_matrix
488493
sage: q = 3**3
489-
sage: F = GF(q,'x') # optional - sage.rings.finite_rings
490-
sage: M = [[x*y for y in F] for x in F] # optional - sage.rings.finite_rings
491-
sage: is_difference_matrix(M,F,q,verbose=1) # optional - sage.rings.finite_rings
494+
sage: F = GF(q,'x') # needs sage.rings.finite_rings
495+
sage: M = [[x*y for y in F] for x in F] # needs sage.rings.finite_rings
496+
sage: is_difference_matrix(M,F,q,verbose=1) # needs sage.rings.finite_rings
492497
True
493498
494499
sage: B = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
495500
....: [0, 1, 2, 3, 4, 2, 3, 4, 0, 1],
496501
....: [0, 2, 4, 1, 3, 3, 0, 2, 4, 1]]
497-
sage: G = GF(5) # optional - sage.rings.finite_rings
498-
sage: B = [[G(b) for b in R] for R in B] # optional - sage.rings.finite_rings
499-
sage: is_difference_matrix(list(zip(*B)),G,3,2) # optional - sage.rings.finite_rings
502+
sage: G = GF(5)
503+
sage: B = [[G(b) for b in R] for R in B]
504+
sage: is_difference_matrix(list(zip(*B)),G,3,2)
500505
True
501506
502507
Bad input::
503508
504-
sage: for R in M: R.append(None) # optional - sage.rings.finite_rings
505-
sage: is_difference_matrix(M,F,q,verbose=1) # optional - sage.rings.finite_rings
509+
sage: # needs sage.rings.finite_rings
510+
sage: for R in M: R.append(None)
511+
sage: is_difference_matrix(M,F,q,verbose=1)
506512
The matrix has 28 columns but k=27
507513
False
508-
sage: for R in M: _=R.pop(-1) # optional - sage.rings.finite_rings
509-
sage: M.append([None]*3**3) # optional - sage.rings.finite_rings
510-
sage: is_difference_matrix(M,F,q,verbose=1) # optional - sage.rings.finite_rings
514+
sage: for R in M: _=R.pop(-1)
515+
sage: M.append([None]*3**3)
516+
sage: is_difference_matrix(M,F,q,verbose=1)
511517
The matrix has 28 rows instead of lambda(|G|-1+2u)+mu=1(27-1+2.0)+1=27
512518
False
513-
sage: _= M.pop(-1) # optional - sage.rings.finite_rings
514-
sage: for R in M: R[-1] = 0 # optional - sage.rings.finite_rings
515-
sage: is_difference_matrix(M,F,q,verbose=1) # optional - sage.rings.finite_rings
519+
sage: _= M.pop(-1)
520+
sage: for R in M: R[-1] = 0
521+
sage: is_difference_matrix(M,F,q,verbose=1)
516522
Columns 0 and 26 generate 0 exactly 27 times instead of the expected mu(=1)
517523
False
518-
sage: for R in M: R[-1] = 1 # optional - sage.rings.finite_rings
519-
sage: M[-1][-1] = 0 # optional - sage.rings.finite_rings
520-
sage: is_difference_matrix(M,F,q,verbose=1) # optional - sage.rings.finite_rings
524+
sage: for R in M: R[-1] = 1
525+
sage: M[-1][-1] = 0
526+
sage: is_difference_matrix(M,F,q,verbose=1)
521527
Columns 0 and 26 do not generate all elements of G exactly lambda(=1) times.
522528
The element x appeared 0 times as a difference.
523529
False
@@ -560,17 +566,17 @@ def is_quasi_difference_matrix(M,G,int k,int lmbda,int mu,int u,verbose=False):
560566
561567
sage: from sage.combinat.designs.designs_pyx import is_quasi_difference_matrix
562568
sage: q = 3**3
563-
sage: F = GF(q,'x') # optional - sage.rings.finite_rings
564-
sage: M = [[x*y for y in F] for x in F] # optional - sage.rings.finite_rings
565-
sage: is_quasi_difference_matrix(M,F,q,1,1,0,verbose=1) # optional - sage.rings.finite_rings
569+
sage: F = GF(q,'x') # needs sage.rings.finite_rings
570+
sage: M = [[x*y for y in F] for x in F] # needs sage.rings.finite_rings
571+
sage: is_quasi_difference_matrix(M,F,q,1,1,0,verbose=1) # needs sage.rings.finite_rings
566572
True
567573
568574
sage: B = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
569575
....: [0, 1, 2, 3, 4, 2, 3, 4, 0, 1],
570576
....: [0, 2, 4, 1, 3, 3, 0, 2, 4, 1]]
571-
sage: G = GF(5) # optional - sage.rings.finite_rings
572-
sage: B = [[G(b) for b in R] for R in B] # optional - sage.rings.finite_rings
573-
sage: is_quasi_difference_matrix(list(zip(*B)),G,3,2,2,0) # optional - sage.rings.finite_rings
577+
sage: G = GF(5)
578+
sage: B = [[G(b) for b in R] for R in B]
579+
sage: is_quasi_difference_matrix(list(zip(*B)),G,3,2,2,0)
574580
True
575581
576582
A quasi-difference matrix from the database::

0 commit comments

Comments
 (0)