Skip to content

Commit

Permalink
Change lmbda to lambda
Browse files Browse the repository at this point in the history
  • Loading branch information
gmou3 committed Jun 4, 2024
1 parent 50059b4 commit a3cee27
Show file tree
Hide file tree
Showing 10 changed files with 153 additions and 153 deletions.
14 changes: 7 additions & 7 deletions src/sage/combinat/designs/block_design.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,23 +91,23 @@ def tdesign_params(t, v, k, L):
r = integer_floor(L * x/y)
return (t, v, b, r, k, L)

def are_hyperplanes_in_projective_geometry_parameters(v, k, lmbda, return_parameters=False):
def are_hyperplanes_in_projective_geometry_parameters(v, k, lambda, return_parameters=False):
r"""
Return ``True`` if the parameters ``(v,k,lmbda)`` are the one of hyperplanes in
Return ``True`` if the parameters ``(v,k,lambda)`` are the one of hyperplanes in
a (finite Desarguesian) projective space.
In other words, test whether there exists a prime power ``q`` and an integer
``d`` greater than two such that:
- `v = (q^{d+1}-1)/(q-1) = q^d + q^{d-1} + ... + 1`
- `k = (q^d - 1)/(q-1) = q^{d-1} + q^{d-2} + ... + 1`
- `lmbda = (q^{d-1}-1)/(q-1) = q^{d-2} + q^{d-3} + ... + 1`
- `lambda = (q^{d-1}-1)/(q-1) = q^{d-2} + q^{d-3} + ... + 1`
If it exists, such a pair ``(q,d)`` is unique.
INPUT:
- ``v``, ``k``, ``lmbda`` -- integers
- ``v``, ``k``, ``lambda`` -- integers
OUTPUT:
Expand Down Expand Up @@ -149,9 +149,9 @@ def are_hyperplanes_in_projective_geometry_parameters(v, k, lmbda, return_parame
import sage.arith.all as arith

q1 = Integer(v - k)
q2 = Integer(k - lmbda)
q2 = Integer(k - lambda)

if (lmbda <= 0 or q1 < 4 or q2 < 2 or
if (lambda <= 0 or q1 < 4 or q2 < 2 or
not q1.is_prime_power() or
not q2.is_prime_power()):
return (False,(None,None)) if return_parameters else False
Expand All @@ -162,7 +162,7 @@ def are_hyperplanes_in_projective_geometry_parameters(v, k, lmbda, return_parame
k = arith.gcd(e1,e2)
d = e1//k
q = p1**k
if e2//k != d-1 or lmbda != (q**(d-1)-1)//(q-1):
if e2//k != d-1 or lambda != (q**(d-1)-1)//(q-1):
return (False,(None,None)) if return_parameters else False

return (True, (q,d)) if return_parameters else True
Expand Down
28 changes: 14 additions & 14 deletions src/sage/combinat/designs/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -2452,14 +2452,14 @@ def QDM_57_9_1_1_8():
# The syntax of the dictionary is
#
# QDM = {
# (n+u,lmbda): { # QDM with mu<=lmbda=1 yields a OA(k,n+u)-OA(k,u)
# (n,lmbda,mu,u): (k,qdm_constructor),
# (n+u,lambda): { # QDM with mu<=lambda=1 yields a OA(k,n+u)-OA(k,u)
# (n,lambda,mu,u): (k,qdm_constructor),
# }
# }


QDM: dict[tuple[int, int], dict] = {}
for ((n,k,lmbda,mu,u),f) in [((19,6,1,1,1), QDM_19_6_1_1_1),
for ((n,k,lambda,mu,u),f) in [((19,6,1,1,1), QDM_19_6_1_1_1),
((21,5,1,1,1), QDM_21_5_1_1_1),
((21,6,1,1,5), QDM_21_6_1_1_5),
((25,6,1,1,5), QDM_25_6_1_1_5),
Expand All @@ -2469,15 +2469,15 @@ def QDM_57_9_1_1_8():
((45,7,1,1,9), QDM_45_7_1_1_9),
((54,7,1,1,8), QDM_54_7_1_1_8),
((57,9,1,1,8), QDM_57_9_1_1_8)]:
if (n+u,lmbda) not in QDM:
QDM[n+u,lmbda] = {}
QDM[n+u,lmbda][n,lmbda,mu,u] = (k,f)
if (n+u,lambda) not in QDM:
QDM[n+u,lambda] = {}
QDM[n+u,lambda][n,lambda,mu,u] = (k,f)

# Create the list of QDM matrices for the doc
LIST_OF_QDM = ", ".join("`({},{};{},{};{})`".format(n,k,lmbda,mu,u)
for n,k,lmbda,mu,u in
sorted((n,k,lmbda,mu,u) for entry in QDM.values()
for (n,lmbda,mu,u),(k,_) in sorted(entry.items())))
LIST_OF_QDM = ", ".join("`({},{};{},{};{})`".format(n,k,lambda,mu,u)
for n,k,lambda,mu,u in
sorted((n,k,lambda,mu,u) for entry in QDM.values()
for (n,lambda,mu,u),(k,_) in sorted(entry.items())))

_ref_Handbook = """Handbook of Combinatorial Designs (2ed),
C. Colbourn, J. Dinitz, 2010 CRC Press"""
Expand Down Expand Up @@ -2700,10 +2700,10 @@ def QDM_57_9_1_1_8():
}
# Translate all V(m,t) into (mt+1,m+2;1,0;t)-QDM constructors
for (m,t),(vec,source) in Vmt_vectors.items():
n,k,lmbda,mu,u = (m*t+1,m+2,1,0,t)
if (n+u,lmbda) not in QDM:
QDM[n+u,lmbda] = {}
QDM[n+u,lmbda][n,lmbda,mu,u] = (k,lambda m=m,t=t,vec=vec:QDM_from_Vmt(m,t,vec))
n,k,lambda,mu,u = (m*t+1,m+2,1,0,t)
if (n+u,lambda) not in QDM:
QDM[n+u,lambda] = {}
QDM[n+u,lambda][n,lambda,mu,u] = (k,lambda m=m,t=t,vec=vec:QDM_from_Vmt(m,t,vec))

# Create the list of V(m,t) vectors for the doc
_all_m = sorted(set(m for m,_ in Vmt_vectors.keys()))
Expand Down
36 changes: 18 additions & 18 deletions src/sage/combinat/designs/designs_pyx.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ def is_projective_plane(blocks, verbose=False):
verbose=verbose)


def is_difference_matrix(M,G,k,lmbda=1,verbose=False):
def is_difference_matrix(M,G,k,lambda=1,verbose=False):
r"""
Test if `M` is a `(G,k,\lambda)`-difference matrix.
Expand All @@ -681,7 +681,7 @@ def is_difference_matrix(M,G,k,lmbda=1,verbose=False):
- ``k`` -- integer
- ``lmbda`` (integer) -- set to `1` by default.
- ``lambda`` (integer) -- set to `1` by default.
- ``verbose`` (boolean) -- whether to print some information when the answer
is ``False``.
Expand Down Expand Up @@ -727,10 +727,10 @@ def is_difference_matrix(M,G,k,lmbda=1,verbose=False):
The element x appeared 0 times as a difference.
False
"""
return is_quasi_difference_matrix(M,G,k,lmbda=lmbda,mu=lmbda,u=0,verbose=verbose)
return is_quasi_difference_matrix(M,G,k,lambda=lambda,mu=lambda,u=0,verbose=verbose)


def is_quasi_difference_matrix(M,G,int k,int lmbda,int mu,int u,verbose=False):
def is_quasi_difference_matrix(M,G,int k,int lambda,int mu,int u,verbose=False):
r"""
Test if the matrix is a `(G,k;\lambda,\mu;u)`-quasi-difference matrix
Expand All @@ -755,7 +755,7 @@ def is_quasi_difference_matrix(M,G,int k,int lmbda,int mu,int u,verbose=False):
- ``G`` -- a group
- ``k``, ``lmbda``, ``mu``, ``u`` -- integers
- ``k``, ``lambda``, ``mu``, ``u`` -- integers
- ``verbose`` (boolean) -- whether to print some information when the answer
is ``False``.
Expand Down Expand Up @@ -783,31 +783,31 @@ def is_quasi_difference_matrix(M,G,int k,int lmbda,int mu,int u,verbose=False):
sage: from sage.combinat.designs.database import QDM
sage: G,M = QDM[38,1][37,1,1,1][1]()
sage: is_quasi_difference_matrix(M,G,k=6,lmbda=1,mu=1,u=1)
sage: is_quasi_difference_matrix(M,G,k=6,lambda=1,mu=1,u=1)
True
Bad input::
sage: is_quasi_difference_matrix(M,G,k=6,lmbda=1,mu=1,u=3,verbose=1)
sage: is_quasi_difference_matrix(M,G,k=6,lambda=1,mu=1,u=3,verbose=1)
The matrix has 39 rows instead of lambda(|G|-1+2u)+mu=1(37-1+2.3)+1=43
False
sage: is_quasi_difference_matrix(M,G,k=6,lmbda=1,mu=2,u=1,verbose=1)
sage: is_quasi_difference_matrix(M,G,k=6,lambda=1,mu=2,u=1,verbose=1)
The matrix has 39 rows instead of lambda(|G|-1+2u)+mu=1(37-1+2.1)+2=40
False
sage: M[3][1] = None
sage: is_quasi_difference_matrix(M,G,k=6,lmbda=1,mu=1,u=1,verbose=1)
sage: is_quasi_difference_matrix(M,G,k=6,lambda=1,mu=1,u=1,verbose=1)
Row 3 contains more than one empty entry
False
sage: M[3][1] = 1
sage: M[6][1] = None
sage: is_quasi_difference_matrix(M,G,k=6,lmbda=1,mu=1,u=1,verbose=1)
sage: is_quasi_difference_matrix(M,G,k=6,lambda=1,mu=1,u=1,verbose=1)
Column 1 contains 2 empty entries instead of the expected lambda.u=1.1=1
False
"""
from sage.combinat.designs.difference_family import group_law

assert k>=2
assert lmbda >=1
assert lambda >=1
assert mu>=0
assert u>=0

Expand All @@ -817,9 +817,9 @@ def is_quasi_difference_matrix(M,G,int k,int lmbda,int mu,int u,verbose=False):
cdef bint bit

# Height of the matrix
if lmbda*(n-1+2*u)+mu != M_nrows:
if lambda*(n-1+2*u)+mu != M_nrows:
if verbose:
print("The matrix has {} rows instead of lambda(|G|-1+2u)+mu={}({}-1+2.{})+{}={}".format(M_nrows,lmbda,n,u,mu,lmbda*(n-1+2*u)+mu))
print("The matrix has {} rows instead of lambda(|G|-1+2u)+mu={}({}-1+2.{})+{}={}".format(M_nrows,lambda,n,u,mu,lambda*(n-1+2*u)+mu))
return False

# Width of the matrix
Expand Down Expand Up @@ -892,16 +892,16 @@ def is_quasi_difference_matrix(M,G,int k,int lmbda,int mu,int u,verbose=False):
return False
bit = True

# Each column contains lmbda*u empty entries
# Each column contains lambda*u empty entries
for j in range(k):
ii = 0
for i in range(M_nrows):
if M_c[i*k+j] == n:
ii += 1
if ii!=lmbda*u:
if ii!=lambda*u:
if verbose:
print("Column {} contains {} empty entries instead of the expected "
"lambda.u={}.{}={}".format(j, ii, lmbda, u, lmbda*u))
"lambda.u={}.{}={}".format(j, ii, lambda, u, lambda*u))
sig_free(x_minus_y_data)
sig_free(x_minus_y)
sig_free(G_seen)
Expand All @@ -926,11 +926,11 @@ def is_quasi_difference_matrix(M,G,int k,int lmbda,int mu,int u,verbose=False):
return False

for ii in range(1,n): # bad number of g_ii\in G
if G_seen[ii] != lmbda:
if G_seen[ii] != lambda:
if verbose:
print("Columns {} and {} do not generate all elements of G "
"exactly lambda(={}) times. The element {} appeared {} "
"times as a difference.".format(i,j,lmbda,int_to_group[ii],G_seen[ii]))
"times as a difference.".format(i,j,lambda,int_to_group[ii],G_seen[ii]))
sig_free(x_minus_y_data)
sig_free(x_minus_y)
sig_free(G_seen)
Expand Down
Loading

0 comments on commit a3cee27

Please sign in to comment.