From 21160842138e7ec9879a4fe6daf479f6458bde3d Mon Sep 17 00:00:00 2001 From: Matteo Cati Date: Sun, 22 Jan 2023 14:02:33 +0000 Subject: [PATCH] Fix trailing whitespaces in hadamard_matrix.py --- src/sage/combinat/matrices/hadamard_matrix.py | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/sage/combinat/matrices/hadamard_matrix.py b/src/sage/combinat/matrices/hadamard_matrix.py index 9c23edd957a..0131eeca985 100644 --- a/src/sage/combinat/matrices/hadamard_matrix.py +++ b/src/sage/combinat/matrices/hadamard_matrix.py @@ -1101,8 +1101,8 @@ def turyn_type_hadamard_matrix_smallcases(n, existence=False, check=True): def hadamard_matrix_spence_construction(n, existence=False, check=True): r"""Create an Hadamard matrix of order `n` using Spence construction. - This construction (detailed in [Spe1975]_), uses supplementary difference sets implemented in - :func:`sage.combinat.designs.difference_family.supplementary_difference_set` to create the + This construction (detailed in [Spe1975]_), uses supplementary difference sets implemented in + :func:`sage.combinat.designs.difference_family.supplementary_difference_set` to create the desired matrix. INPUT: @@ -1154,10 +1154,10 @@ def hadamard_matrix_spence_construction(n, existence=False, check=True): assert n%4 == 0 and n > 0 q = n//4 - - if existence: + + if existence: return supplementary_difference_set(q, existence=True) - + if not supplementary_difference_set(q, existence=True): raise ValueError(f'The order {n} is not covered by Spence construction.') @@ -1167,7 +1167,7 @@ def hadamard_matrix_spence_construction(n, existence=False, check=True): A2 = matrix.circulant([1 if j in S4 else -1 for j in range(q-1)]) A3 = matrix.circulant([1 if j in S3 else -1 for j in range(q-1)]) A4 = matrix.circulant([1 if j in S2 else -1 for j in range(q-1)]) - + P = matrix(ZZ, [[1 if (i + j)%(q-1) == 0 else 0 for i in range(1, q)] for j in range(1, q)]) e = matrix([1]*(q-1)) @@ -2020,8 +2020,8 @@ def GS_skew_hadamard_smallcases(n, existence=False, check=True): * `n=236`: [FKS2004]_ * `n=276`: [Djo2023]_ - Additional data is obtained from skew supplementary difference sets contained in - :func:`sage.combinat.designs.difference_family.skew_supplementary_difference_set`, using the + Additional data is obtained from skew supplementary difference sets contained in + :func:`sage.combinat.designs.difference_family.skew_supplementary_difference_set`, using the construction described in [Djo1992a]_. INPUT: @@ -2097,12 +2097,12 @@ def skew_hadamard_matrix_whiteman_construction(n, existence=False, check=True): - ``existence`` -- boolean (default False). If True, only return whether the Hadamard matrix can be constructed. - - ``check`` -- boolean: if True (default), check the the result is a skew Hadamard matrix + - ``check`` -- boolean: if True (default), check the the result is a skew Hadamard matrix before returning it. OUTPUT: - If ``existence`` is false, returns the skew Hadamard matrix of order `n`. It raises an error if `n` does + If ``existence`` is false, returns the skew Hadamard matrix of order `n`. It raises an error if `n` does not satisfy the required conditions. If ``existence`` is true, returns a boolean representing whether the matrix can be constructed or not. @@ -2112,8 +2112,8 @@ def skew_hadamard_matrix_whiteman_construction(n, existence=False, check=True): sage: skew_hadamard_matrix_whiteman_construction(52) 52 x 52 dense matrix over Integer Ring... sage: skew_hadamard_matrix_whiteman_construction(52, existence=True) - True - + True + TESTS:: sage: from sage.combinat.matrices.hadamard_matrix import is_hadamard_matrix @@ -2132,14 +2132,14 @@ def skew_hadamard_matrix_whiteman_construction(n, existence=False, check=True): sage: skew_hadamard_matrix_whiteman_construction(100, existence=True) False """ - + q = n // 2 - 1 p, t = is_prime_power(q, get_data=True) is_order_valid = n % 4 == 0 and t > 0 and p % 8 == 5 and t % 4 == 2 if existence: return is_order_valid - + if not is_order_valid: raise ValueError(f'The order {n} is not covered by the Whiteman construction.') @@ -2175,7 +2175,7 @@ def skew_hadamard_matrix_whiteman_construction(n, existence=False, check=True): if check: assert is_hadamard_matrix(H, skew=True) return H - + def skew_hadamard_matrix_324(): r""" @@ -2407,10 +2407,10 @@ def pm_to_good_matrix(s, sign=1): if existence: return l in E_sequences - + if l not in E_sequences: - raise ValueError("The Good matrices of order %s are not yet implemented." % m) - + raise ValueError("The Good matrices of order %s are not yet implemented." % m) + e1, e2, e3, e4 = E_sequences[l] a = pm_to_good_matrix(e1, sign=-1) b = pm_to_good_matrix(e2) @@ -2539,11 +2539,11 @@ def true(): return true() M = hadamard_matrix_paleyI(n, normalize=False) elif is_prime_power(n//2 -1) and (n//2 -1)%8 == 5: - if existence: + if existence: return true() M = skew_hadamard_matrix_spence_construction(n, check=False) elif skew_hadamard_matrix_whiteman_construction(n, existence=True): - if existence: + if existence: return true() M = skew_hadamard_matrix_whiteman_construction(n, check=False) elif n % 8 == 0: