Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions doc/guava.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3199,9 +3199,7 @@ gap> F := Factors(x^n-1);;
gap> v := NullVector(n,GF(3));;
gap> v := v + ShallowCopy(VectorCodeword( Codeword(F[2]) ));;
gap> G := CirculantMatrix(24, v);;
gap> for i in [1..Size(G)] do s:=Zero(GF(3));
> for j in [1..Size(G[i])] do s:=s+G[i][j]; od; Add(G[i], s);
> od;;
gap> for i in [1..Size(G)] do Add(G[i], Sum(G[i])); od;;
gap> C := GeneratorMatCodeNC(G, GF(3));
a [48,24,?] randomly generated code over GF(3)
gap> MinimumWeight(C);
Expand Down
6 changes: 1 addition & 5 deletions lib/codegen.gi
Original file line number Diff line number Diff line change
Expand Up @@ -1864,11 +1864,7 @@ function(n, d)
G := MutableCopyMat( GeneratorMat(C) );
TriangulizeMat(G);
for i in [1..Size(G)] do
s := 0;
for j in [1..Size(G[i])] do
s := s + G[i][j];
od;
Add(G[i], -s);
Add(G[i], -Sum(G[i]));
od;
Ce := GeneratorMatCodeNC(G, LeftActingDomain(C));
Ce!.name := "extended Reed Solomon code";
Expand Down
27 changes: 9 additions & 18 deletions lib/codeman.gi
Original file line number Diff line number Diff line change
Expand Up @@ -1858,12 +1858,12 @@ function( C, A )
K, S, GC, GA, GX, CX, ZeroVec;

# Make sure list C contains all linear codes
if (PositionNot( List([1..Size(C)], i->IsLinearCode(C[i])), true ) < Size(C)) then
if not ForAll(C, IsLinearCode) then
Error("The list C contains non linear code(s)");
fi;

# Make sure list A contains all linear codes
if (PositionNot( List([1..Size(A)], i->IsLinearCode(A[i])), true ) < Size(A)) then
if not ForAll(A, IsLinearCode) then
Error("The list A contains non linear code(s)");
fi;

Expand All @@ -1881,21 +1881,15 @@ function( C, A )
fi;

# Ensure that Dimension(C[1]) < Dimension(C[2]) < ... < Dimension(C[j]), i.e. we need to sort them
K:=List([1..Size(C)], i->Dimension(C[i]));
S:=List([1..Size(C)], i->Dimension(C[i]));
Sort(S);
C:=List([1..Size(K)], i->C[Position(K, S[i])]);
SortBy(C, Dimension);

# Need to make sure that C[1] < C[2] < ... < C[j], i.e. subset
if (PositionNot(List([0..Size(C)-2], i->IsSubset(C[Size(C)-i], C[Size(C)-i-1])), true) < Size(C)-1) then
if not ForAll(List([0..Size(C)-2], i->IsSubset(C[Size(C)-i], C[Size(C)-i-1]))) then
Error("Inappropriate chain of codes");
fi;

# Now, ensure that codes in A are sorted such that their dimensions are in ascending order
K:=List([1..Size(A)], i->Dimension(A[i]));
S:=List([1..Size(A)], i->Dimension(A[i]));
Sort(S);
A:=List([1..Size(K)], i->A[Position(K, S[i])]);
SortBy(A, Dimension);

# Number codes in A should be 1 less than that in C
if (Size(A) <> Size(C)-1) then
Expand All @@ -1911,8 +1905,8 @@ function( C, A )
od;

# Generator matrices of the chain codes
GC:=List([1..Size(C)], i->ShallowCopy(GeneratorMat(C[i])));
GA:=List([1..Size(A)], i->ShallowCopy(GeneratorMat(A[i])));
GC:=List(C, x->ShallowCopy(GeneratorMat(x)));
GA:=List(A, x->ShallowCopy(GeneratorMat(x)));

# Generator matrix of the largest code in chain format
GX:=GC[Size(C)];
Expand Down Expand Up @@ -2166,7 +2160,7 @@ __G_BZCode := function(O, I)
fi;

# Need to make sure that I[1] < I[2] < ... < I[s], i.e. subset
if (PositionNot(List([0..Size(I)-2], i->IsSubset(I[Size(I)-i], I[Size(I)-i-1])), true) < Size(I)-1) then
if not ForAll(List([0..Size(I)-2], i->IsSubset(I[Size(I)-i], I[Size(I)-i-1]))) then
Error("Inappropriate chain of inner codes");
fi;

Expand Down Expand Up @@ -2206,10 +2200,7 @@ __G_BZCode := function(O, I)
k := Sum(List([1..Size(O)], i->(Dimension(O[i]) * (ik[i+1] - ik[i]))));

# Construct the generator matrix of the BZ code
v := [];
for i in [1..Size(O)] do
Add(v, List([1..Dimension(O[i])], x->Zero(LeftActingDomain(O[i]))));
od;
v := List(O, u -> List([1..Dimension(u)], x->Zero(LeftActingDomain(u))));
G := [];
for i in [1..Size(O)] do
F := LeftActingDomain(O[i]);
Expand Down
9 changes: 4 additions & 5 deletions lib/curves.gi
Original file line number Diff line number Diff line change
Expand Up @@ -747,16 +747,15 @@ end);
##
InstallMethod(DivisorOfRationalFunctionP1, true, [IsRationalFunction,IsRing], 0,
function(f,R)
local crv,vars,y,n1,n2,suppdiv,coeffdiv,i,divf,rootsd,rootsn,den,num;
local crv,vars,y,suppdiv,coeffdiv,i,divf,rootsd,rootsn,den,num;
vars:=IndeterminatesOfPolynomialRing(R); y:=vars[1];
num:=NumeratorOfRationalFunction(f);
rootsn:=RootsOfUPol(num);
den:=DenominatorOfRationalFunction(f);
rootsd:=RootsOfUPol(den);
n1:=Length(Set(rootsn)); n2:=Length(Set(rootsd));
coeffdiv:=Concatenation(List([1..n1],
i->MultiplicityInList(rootsn, Set(rootsn)[i])),
List([1..n2],i->-MultiplicityInList(rootsd, Set(rootsd)[i])));
coeffdiv:=Concatenation(
List(Set(rootsn), a-> MultiplicityInList(rootsn, a)),
List(Set(rootsd), b->-MultiplicityInList(rootsd, b)));
suppdiv:=Concatenation(Set(rootsn),Set(rootsd));
crv:=AffineCurve(y,R);
divf:=rec(coeffs:=coeffdiv,support:=suppdiv,curve:=crv);
Expand Down
22 changes: 11 additions & 11 deletions lib/matrices.gi
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ function(n,q)
fi;
res := NullMat(n+1,n+1);
for k in [0..n] do
res[1][k+1]:=1;
res[1,k+1]:=1;
od;
for k in [0..n] do
res[k+1][1] := Binomial(n,k)*(q-1)^k;
res[k+1,1] := Binomial(n,k)*(q-1)^k;
od;
for i in [2..n+1] do
for k in [2..n+1] do
res[k][i] := res[k][i-1] - (q-1)*res[k-1][i] - res[k-1][i-1];
res[k,i] := res[k,i-1] - (q-1)*res[k-1,i] - res[k-1,i-1];
od;
od;
return res;
Expand Down Expand Up @@ -62,9 +62,9 @@ function(n, F)
for line in [1..q^(n-column)] do
row:=row+1;
if goingup then
result[row][column]:= elem[elementnr];
result[row,column]:= elem[elementnr];
else
result[row][column]:= elem[q+1-elementnr];
result[row,column]:= elem[q+1-elementnr];
fi;
od;
od;
Expand Down Expand Up @@ -375,8 +375,8 @@ function(q, n)
res := NullMat(q,q)+1;
for i in [1..q] do
for j in [1..q] do
while els[res[i][j]] <> M[i][j] do
res[i][j]:=res[i][j]+1;
while els[res[i,j]] <> M[i,j] do
res[i,j]:=res[i,j]+1;
od;
od;
od;
Expand All @@ -390,11 +390,11 @@ function(q, n)
for i in [1..q] do
for j in [1..q] do
for k in [1..n] do
res[k][i][j] := els[i] + els[k+1] * els[j];
res[k][i,j] := els[i] + els[k+1] * els[j];
od;
od;
od;
return List([1..n],x -> ToInt(res[x]));
return List(res, ToInt);
end;

Merged := function(A, B)
Expand All @@ -404,8 +404,8 @@ function(q, n)
res:=KroneckerProduct(A,NullMat(q2,q2)+1);
for i in [1 .. q1*q2] do
for j in [1 .. q1*q2] do
res[i][j]:= res[i][j] + q1 *
B[((i-1) mod q2)+1][((j-1) mod q2)+1];
res[i,j]:= res[i,j] + q1 *
B[((i-1) mod q2)+1,((j-1) mod q2)+1];
od;
od;
return res;
Expand Down
21 changes: 3 additions & 18 deletions lib/util2.gi
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ end;

SortedGaloisFieldElements := function ( size )

local field, els, sortlist, alpha;
local field, els, alpha;

if IsInt( size ) then
field := GF( size );
Expand All @@ -232,23 +232,8 @@ SortedGaloisFieldElements := function ( size )
size := Size( field );
fi;
alpha:=PrimitiveRoot( field );
# this line was moved from immed after the local statement 9-2004
els := ShallowCopy(AsSSortedList( field ));
sortlist := NullVector( size );
# log 1 = 0, so we add one to each log to avoid
# conflicts with the 0 for zero.

sortlist := List( els, function( x )
if x = Zero(field) then
return 0;
else
return LogFFE( x, alpha ) + 1;
fi;
end );

sortlist{ [ 2 .. size ] } := List( els { [ 2 .. size ] },
x -> LogFFE( x, alpha ) + 1 );
SortParallel( sortlist, els );
els:=[Zero(field)];
Append(els, List([0..size-2], i->alpha^i));

return els;
end;
Expand Down