@@ -792,10 +792,13 @@ def hadamard_matrix_cooper_wallis_smallcases(n, check=True, existence=False):
792
792
r"""
793
793
Construct hadamard matrices using the Cooper-Wallis construction for some small values of `n`.
794
794
795
- This functions uses the data from :func:`sage.combinat.T_sequences.T_sequences_smallcases`
796
- and :func:`williamson_type_quadruples_smallcases`
797
- to construct an hadamard matrix of order `n` using the Cooper-Wallis construction
798
- detailed at :func:`hadamard_matrix_cooper_wallis_construction`.
795
+ This function calls the function :func:`hadamard_matrix_cooper_wallis_construction`
796
+ with the appropriate arguments.
797
+ It constructs the matrices `X_1`, `X_2`, `X_3`, `X_4` using either
798
+ T-matrices or the T-sequences from :func:`sage.combinat.T_sequences.T_sequences_smallcases`.
799
+ The matrices `A`, `B`, `C`, `D` are taken from :func:`williamson_type_quadruples_smallcases`.
800
+
801
+ Data for T-matrices of order 67 is taken from [Saw1985]_.
799
802
800
803
INPUT:
801
804
@@ -846,14 +849,28 @@ def hadamard_matrix_cooper_wallis_smallcases(n, check=True, existence=False):
846
849
"""
847
850
assert n % 4 == 0 and n > 0
848
851
852
+ db = {
853
+ 67 : (
854
+ [1 , 0 , 0 , 0 , - 1 , 0 , 0 , 0 , - 1 , 0 , 0 , 0 , - 1 , - 1 , - 1 , 0 , 0 , - 1 , 0 , 0 , 0 , 0 , 0 , 0 , - 1 , 0 , - 1 , 0 , - 1 , 0 , 1 , - 1 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , - 1 , 0 , 0 , 0 , 0 , 0 , 0 , - 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 ],
855
+ [0 , 1 , 0 , 0 , 0 , 0 , 0 , - 1 , 0 , 0 , 0 , - 1 , 0 , 0 , 0 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - 1 , 1 , 1 , 0 , 0 , - 1 , - 1 , - 1 , 0 , 0 , 0 , 0 , 0 , - 1 , 1 , 0 , - 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 1 , 0 ],
856
+ [0 , 0 , 0 , 0 , 0 , - 1 , 1 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 1 , - 1 , 0 , 0 , 1 , 0 , - 1 , 0 , - 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , - 1 , 1 , 0 , 0 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , - 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , - 1 , - 1 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 ],
857
+ [0 , 0 , - 1 , - 1 , 0 , 0 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 0 , 0 , - 1 , 1 , - 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 0 , 0 , 1 , - 1 , 0 , 0 , - 1 , 0 , 0 , 0 , 0 , - 1 , 0 , - 1 , 1 , 1 , 0 , 0 , 0 ]
858
+ )
859
+ }
860
+
849
861
for T_seq_len in divisors (n // 4 ):
850
862
will_size = n // (4 * T_seq_len )
851
- if T_sequences_smallcases (T_seq_len , existence = True ) and williamson_type_quadruples_smallcases (will_size , existence = True ):
863
+ if ( T_seq_len in db or T_sequences_smallcases (T_seq_len , existence = True ) ) and williamson_type_quadruples_smallcases (will_size , existence = True ):
852
864
if existence :
853
865
return True
854
866
855
- e1 , e2 , e3 , e4 = T_sequences_smallcases (T_seq_len , check = False )
856
- will_matrices = williamson_type_quadruples_smallcases (will_size )
867
+ e1 , e2 , e3 , e4 = None , None , None , None
868
+ if T_seq_len in db :
869
+ e1 , e2 , e3 , e4 = db [T_seq_len ]
870
+ else :
871
+ e1 , e2 , e3 , e4 = T_sequences_smallcases (T_seq_len , check = False )
872
+
873
+ will_matrices = williamson_type_quadruples_smallcases (will_size )
857
874
A , B , C , D = map (matrix .circulant , will_matrices )
858
875
M = hadamard_matrix_cooper_wallis_construction (e1 , e2 , e3 , e4 , A , B , C , D , check = False )
859
876
0 commit comments