Changeset 7409:dd3e113563fb


Ignore:
Timestamp:
11/24/07 10:30:36 (5 years ago)
Author:
William Stein <wstein@…>
Branch:
default
Message:

Slightly change behavior of hadamard_matrix in case the matrix isn't implemented or doesn't exist.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sage/combinat/combinat.py

    r7408 r7409  
    211211def hadamard_matrix(n): 
    212212    """ 
    213     Returns an nxn Hadamard matrix of order if the construction 
    214     is implemented in GUAVA.  
     213    Returns an n x n Hadamard matrix of order $n$, if possible. 
     214 
     215    If the construction of this matrix is not implemented in GUAVA or there is 
     216    no such matrix, raises a NotImplementedError. 
    215217 
    216218    EXAMPLES: 
     
    221223        [ 1 -1 -1  1] 
    222224        sage: hadamard_matrix(6) 
    223         Hadamard matrix of order  6  does not exist or is not implemented yet. 
    224  
     225        Traceback (most recent call last): 
     226        ... 
     227        NotImplementedError: Hadamard matrix of order 6 does not exist or is not implemented yet. 
    225228    """ 
    226229    try: 
    227        ans = gap("HadamardMat(%s)"%ZZ(n)) 
    228        return ans._matrix_(ZZ) 
     230        ans = gap("HadamardMat(%s)"%ZZ(n)) 
     231        return ans._matrix_(ZZ) 
    229232    except: 
    230        print "Hadamard matrix of order ",n," does not exist or is not implemented yet." 
     233        raise NotImplementedError, "Hadamard matrix of order %s does not exist or is not implemented yet."%n 
    231234 
    232235def bell_number(n): 
Note: See TracChangeset for help on using the changeset viewer.