65.14 WeightCodeword

WeightCodeword( c )

WeightCodeword returns the weight of a codeword c, the number of non-zero entries in c. As a result, WeightCodeword always returns an integer between zero and the word length of the codeword.

    gap> WeightCodeword(Codeword("22222"));
    5
    gap> WeightCodeword(NullWord(3));
    0
    gap> C := HammingCode(3);
    a linear [7,4,3]1 Hamming (3,2) code over GF(2)
    gap> Minimum(List(Elements(C){[2..Size(C)]}, WeightCodeword ) );
    3 

Previous Up Top Next
Index

GAP 3.4.4
April 1997