gap-packages / guava

GAP package guava - computations relative to error-correcting codes
https://gap-packages.github.io/guava
Other
13 stars 7 forks source link

PutStandardForm does not work as expected #53

Closed ManuelAFDelgado closed 2 years ago

ManuelAFDelgado commented 4 years ago

I am using GAP 4.11.0 and GUAVA 3.15 (as distributed with GAP 4.11.0)

The function PutStandardForm does not work as expected. Even the examples in the manual cannot be reproduced. When I tried, I got the following:

gap> M := Z(2)*[[1,0,0,1],[0,0,1,1]];; PrintArray(M);
[ [  Z(2)^0,  0*Z(2),  0*Z(2),  Z(2)^0 ],
  [  0*Z(2),  0*Z(2),  Z(2)^0,  Z(2)^0 ] ]
gap> PutStandardForm(M);
(2,3)
gap> PrintArray(M);
[ [  Z(2)^0,  0*Z(2),  0*Z(2),  Z(2)^0 ],
  [  0*Z(2),  0*Z(2),  Z(2)^0,  Z(2)^0 ] ]
gap> PutStandardForm(M, false);
()
gap> PrintArray(M);
[ [  Z(2)^0,  0*Z(2),  Z(2)^0,  0*Z(2) ],
  [  Z(2)^0,  0*Z(2),  0*Z(2),  Z(2)^0 ] ]
gap> C := BestKnownLinearCode( 23, 12, GF(2) );
a linear [23,12,7]3 punctured code
gap> G:=MutableCopyMat(GeneratorMat(C));;
gap> PutStandardForm(G);
()
gap> Display(G);
 . 1 . 1 1 1 . . . 1 1 . . . . . . . . . . . 1
 1 . 1 . 1 1 1 . . . 1 1 . . . . . . . . . . 1
 . . . . 1 . 1 1 . 1 1 1 1 . . . . . . . . . .
 . . 1 . . . . . 1 1 1 1 . 1 . . . . . . . . 1
 . . . 1 . 1 . 1 1 1 . . . 1 1 . . . . . . . 1
 . . . . . . . 1 1 . . 1 1 . 1 1 . . . . . . 1
 . . . . . 1 . . 1 1 1 . 1 . 1 . 1 . . . . . .
 . . . . . . 1 . 1 . 1 1 1 . . . 1 1 . . . . 1
 . . . . . . . . 1 1 . . . 1 1 1 . 1 1 . . . .
 . . . . . . . . . 1 1 . 1 . . 1 . 1 . 1 . . 1
 . . . . . . . . . . 1 1 1 1 1 . . 1 . . 1 . .
 . . . . . . . . . . . 1 . 1 . 1 1 1 . . . 1 1
gap> 
pranshugaba commented 4 years ago

I believe this error is due to commit 8474420b5faf7469e841e6e3674bed0e050db0c6. This commit changed TriangulizeMat(mat) to mat:=TriangulizedMat(mat) in lib/Matrices.gi

TriangulizeMat(mat) changes the matrix mat itself, whereas mat:=TriangulizedMat(mat) creates a new object. This new object only exists in the scope of the function and is lost once the function is returned.

As a result, PutStandardForm does not change the input matrix. It only returns a permutation. Reverting this change back fixes PutStandardForm.

@osj1961 Could you please review this? Thanks.

TriangulizeMat page for reference.