Skip to content

Commit

Permalink
trac #16361: Merged with #16388
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanncohen committed Jun 13, 2014
2 parents 8704b9c + 79178b6 commit 02ecf51
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 16 deletions.
9 changes: 4 additions & 5 deletions src/sage/combinat/designs/bibd.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def BalancedIncompleteBlockDesign(v,k,existence=False,use_LJCR=False):
sage: designs.BalancedIncompleteBlockDesign(16,6)
Traceback (most recent call last):
...
NotImplementedError: I don't know how to build this design.
NotImplementedError: I don't know how to build a (16,6,1)-BIBD!
TESTS::
Expand Down Expand Up @@ -222,7 +222,7 @@ def BalancedIncompleteBlockDesign(v,k,existence=False,use_LJCR=False):
if existence:
return Unknown
else:
raise NotImplementedError("I don't know how to build this design.")
raise NotImplementedError("I don't know how to build a ({},{},1)-BIBD!".format(v,k))

def steiner_triple_system(n):
r"""
Expand Down Expand Up @@ -383,7 +383,7 @@ def BIBD_from_TD(v,k,existence=False):
sage: BIBD_from_TD(20,5)
Traceback (most recent call last):
...
NotImplementedError: I do not know how to build this BIBD!
NotImplementedError: I do not know how to build a (20,5,1)-BIBD!
"""
from orthogonal_arrays import transversal_design

Expand Down Expand Up @@ -446,10 +446,9 @@ def BIBD_from_TD(v,k,existence=False):
# No idea ...
else:
if existence:
from sage.misc.unknown import Unknown
return Unknown
else:
raise NotImplementedError("I do not know how to build this BIBD!")
raise NotImplementedError("I do not know how to build a ({},{},1)-BIBD!".format(v,k))

return BIBD

Expand Down
6 changes: 3 additions & 3 deletions src/sage/combinat/designs/latin_squares.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ def mutually_orthogonal_latin_squares(n,k, partitions = False, check = True, exi
sage: designs.mutually_orthogonal_latin_squares(6, 4)
Traceback (most recent call last):
...
NotImplementedError: I don't know how to build these MOLS!
NotImplementedError: I don't know how to build 4 MOLS of order 6
TESTS:
Expand Down Expand Up @@ -339,7 +339,7 @@ def mutually_orthogonal_latin_squares(n,k, partitions = False, check = True, exi
else:
if existence:
return False
raise EmptySetError("These MOLS do not exist!")
raise EmptySetError("There does not exist {} MOLS of order {}!".format(k,n))

OA = orthogonal_array(k+2,n,check=False, who_asked = who_asked+(mutually_orthogonal_latin_squares,))
OA.sort() # make sure that the first two columns are "11, 12, ..., 1n, 21, 22, ..."
Expand All @@ -357,7 +357,7 @@ def mutually_orthogonal_latin_squares(n,k, partitions = False, check = True, exi
else:
if existence:
return Unknown
raise NotImplementedError("I don't know how to build these MOLS!")
raise NotImplementedError("I don't know how to build {} MOLS of order {}".format(k,n))

if check:
assert are_mutually_orthogonal_latin_squares(matrices)
Expand Down
16 changes: 8 additions & 8 deletions src/sage/combinat/designs/orthogonal_arrays.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,11 @@ def transversal_design(k,n,check=True,existence=False, who_asked=tuple()):
sage: designs.transversal_design(47, 100)
Traceback (most recent call last):
...
NotImplementedError: I don't know how to build this Transversal Design!
NotImplementedError: I don't know how to build a TD(47,100)!
sage: designs.transversal_design(55, 54)
Traceback (most recent call last):
...
EmptySetError: There exists no TD(55, 54)!
EmptySetError: There exists no TD(55,54)!
Those two errors correspond respectively to the cases where Sage answer
``Unknown`` or ``False`` when the parameter ``existence`` is set to
Expand Down Expand Up @@ -319,15 +319,15 @@ def transversal_design(k,n,check=True,existence=False, who_asked=tuple()):
else:
if existence:
return False
raise EmptySetError("There exists no TD"+str((k,n))+"!")
raise EmptySetError("There exists no TD({},{})!".format(k,n))

OA = orthogonal_array(k,n, check = False, who_asked = who_asked + (transversal_design,))
TD = [[i*n+c for i,c in enumerate(l)] for l in OA]

else:
if existence:
return Unknown
raise NotImplementedError("I don't know how to build this Transversal Design!")
raise NotImplementedError("I don't know how to build a TD({},{})!".format(k,n))

if check:
assert is_transversal_design(TD,k,n)
Expand Down Expand Up @@ -789,7 +789,7 @@ def orthogonal_array(k,n,t=2,check=True,existence=False,who_asked=tuple()):
sage: designs.orthogonal_array(12,20)
Traceback (most recent call last):
...
NotImplementedError: I don't know how to build this orthogonal array!
NotImplementedError: I don't know how to build an OA(12,20)!
Note that these errors correspond respectively to the answers ``False`` and
``Unknown`` when the parameter ``existence`` is set to ``True``::
Expand Down Expand Up @@ -902,7 +902,7 @@ def orthogonal_array(k,n,t=2,check=True,existence=False,who_asked=tuple()):
else:
if existence:
return False
raise EmptySetError("There exists no OA"+str((k,n))+"!")
raise EmptySetError("There exists no OA({},{})!".format(k,n))

# Section 6.5.1 from [Stinson2004]
elif (t == 2 and mutually_orthogonal_latin_squares not in who_asked and
Expand All @@ -920,12 +920,12 @@ def orthogonal_array(k,n,t=2,check=True,existence=False,who_asked=tuple()):
else:
if existence:
return False
raise EmptySetError("There exists no OA"+str((k,n))+"!")
raise EmptySetError("There exists no OA({},{})!".format(k,n))

else:
if existence:
return Unknown
raise NotImplementedError("I don't know how to build this orthogonal array!")
raise NotImplementedError("I don't know how to build an OA({},{})!".format(k,n))

if check:
assert is_orthogonal_array(OA,k,n,t)
Expand Down

0 comments on commit 02ecf51

Please sign in to comment.