Changeset 7752:79a9f901e372


Ignore:
Timestamp:
12/15/07 15:22:53 (5 years ago)
Author:
William Stein <wstein@…>
Branch:
default
Message:

Trac 1258 -- referee changes and OPTIMIZATIONS

Location:
sage/coding
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sage/coding/code_constructions.py

    r6439 r7752  
    133133        sage: C 
    134134        Linear code of length 24, dimension 12 over Finite Field of size 2 
    135         sage: C.minimum_distance()               # long time 
     135        sage: C.minimum_distance()               
    136136        8 
    137137 
    138138    AUTHOR: David Joyner (2007-05) 
    139139    """ 
    140     C = BinaryGolayCode() 
    141     return C.extended_code() 
     140    v = [[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1], [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0], [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1], [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 1, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1], [0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1], [0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1]] 
     141    V = span(GF(2), v) 
     142    return LinearCodeFromVectorSpace(V) 
     143    #C = BinaryGolayCode() 
     144    #return C.extended_code() 
    142145 
    143146def TernaryGolayCode(): 
    144147    """ 
    145     TernaryGolayCode returns a ternary Golay code. This is a perfect [11,6,5] code. 
    146     It is also equivalenet to a cyclic code, with generator polynomial $g(x)=2+x^2+2x^3+x^4+x^5$.  
     148    TernaryGolayCode returns a ternary Golay code. This is a perfect 
     149    [11,6,5] code.  It is also equivalenet to a cyclic code, with 
     150    generator polynomial $g(x)=2+x^2+2x^3+x^4+x^5$. 
    147151     
    148152    EXAMPLES: 
     
    178182    AUTHOR: David Joyner (11-2005) 
    179183    """ 
    180     C = TernaryGolayCode() 
    181     return C.extended_code() 
     184    v = [[1, 0, 0, 0, 0, 0, 2, 0, 1, 2, 1, 2], [0, 1, 0, 0, 0, 0, 1, 2, 2, 2, 1, 0], [0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 1, 1], [0, 0, 0, 1, 0, 0, 1, 1, 0, 2, 2, 2], [0, 0, 0, 0, 1, 0, 2, 1, 2, 2, 0, 1], [0, 0, 0, 0, 0, 1, 0, 2, 1, 2, 2, 1]] 
     185    V = span(GF(3), v) 
     186    return LinearCodeFromVectorSpace(V) 
     187    #C = TernaryGolayCode() 
     188    #return C.extended_code() 
    182189 
    183190def RandomLinearCode(n,k,F): 
  • sage/coding/linear_code.py

    r7751 r7752  
    350350        sage: best_known_linear_code(10,5,GF(2))    # long time 
    351351        Linear code of length 10, dimension 5 over Finite Field of size 2 
    352         sage: gap.eval("C:=BestKnownLinearCode(10,5,GF(2))") 
     352        sage: gap.eval("C:=BestKnownLinearCode(10,5,GF(2))")     # long time 
    353353        'a linear [10,5,4]2..4 shortened code' 
    354354 
     
    767767            sage: Cx 
    768768            Linear code of length 22, dimension 18 over Finite Field in a of size 2^2 
    769   
    770769        """ 
    771770        G = self.gen_mat() 
     
    774773        n = len(G.columns()) 
    775774        k = len(G.rows()) 
    776         Gstr = str(gap(G)) 
    777         gap.eval( "G:="+Gstr ) 
     775        g = gap(G) 
     776        gap.eval( "G:="+g.name()) 
    778777        C = gap("GeneratorMatCode(G,GF("+str(q)+"))") 
    779778        Cx = C.ExtendedCode() 
    780779        Gx = Cx.GeneratorMat() 
    781         Gxs = Gx._matrix_(F) 
     780        Gxs = Gx._matrix_(F)           # this is the killer 
    782781        MS = MatrixSpace(F,k,n+1) 
    783782        return LinearCode(MS(Gxs)) 
     
    10601059            sage: G  = MS([[1,0,0,0,1,1,1,0],[0,1,1,1,0,0,0,0],[0,0,0,0,0,0,0,1],[0,0,0,0,0,1,0,0]]) 
    10611060            sage: C  = LinearCode(G) 
    1062             sage: gp = C.permutation_automorphism_group() 
     1061            sage: gp = C.permutation_automorphism_group()    # long time 
    10631062 
    10641063        Now type "C.module_composition_factors(gp)" to get the record printed. 
     
    12781277            sage: C.zeta_polynomial() 
    12791278            2/5*T^2 + 2/5*T + 1/5 
    1280             sage: C = best_known_linear_code(6,3,GF(2)) 
    1281             sage: C.minimum_distance() 
     1279            sage: C = best_known_linear_code(6,3,GF(2))  # long time 
     1280            sage: C.minimum_distance()                   # long time (because of above) 
    12821281            3 
    1283             sage: C.zeta_polynomial() 
     1282            sage: C.zeta_polynomial()                    # long time (because of above) 
    12841283            2/5*T^2 + 2/5*T + 1/5 
    12851284            sage: C = HammingCode(4,GF(2)) 
     
    13311330        EXAMPLES: 
    13321331            sage: C = HammingCode(3,GF(2)) 
    1333             sage: C.chinen_polynomial()  
     1332            sage: C.chinen_polynomial()       # long time 
    13341333            (2*sqrt(2)*t^3/5 + 2*sqrt(2)*t^2/5 + 2*t^2/5 + sqrt(2)*t/5 + 2*t/5 + 1/5)/(sqrt(2) + 1) 
    13351334            sage: C = TernaryGolayCode() 
    1336             sage: C.chinen_polynomial() 
     1335            sage: C.chinen_polynomial()       # long time 
    13371336            (6*sqrt(3)*t^3/7 + 6*sqrt(3)*t^2/7 + 6*t^2/7 + 2*sqrt(3)*t/7 + 6*t/7 + 2/7)/(2*sqrt(3) + 2) 
    13381337 
     
    13931392 
    13941393        EXAMPLES: 
    1395  
     1394            sage: C = HammingCode(3,GF(2)) 
     1395            sage: C.zeta_function()  
     1396            (2/5*T^2 + 2/5*T + 1/5)/(2*T^2 - 3*T + 1) 
    13961397        """ 
    13971398        P =  self.zeta_polynomial() 
Note: See TracChangeset for help on using the changeset viewer.