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

possible bug in PutStandardForm #89

Closed qodesign closed 1 year ago

qodesign commented 1 year ago

It looks like PutStandardForm(M,true) has a problem. This would transform a matrix M to a form {I|P}; "true" is the default for the second argument. PutStandardFrom(M,false) is ok; this puts M into a form {P|I}. Both options used to work in older versions of gap/guava (a year or two ago...didn't keep track of when exactly this was broken).

┌───────┐ GAP 4.12.0 of 2022-08-18 │ GAP │ https://www.gap-system.org └───────┘ Architecture: x86_64-pc-cygwin-default64-kv8 Configuration: gmp 6.2.1, GASMAN, readline Loading the library and packages ... Packages: AClib 1.3.2, Alnuth 3.2.1, AtlasRep 2.1.4, AutoDoc 2022.07.10, AutPGrp 1.11, Browse 1.8.14, CaratInterface 2.3.4, CRISP 1.4.5, Cryst 4.1.25, CrystCat 1.1.10, CTblLib 1.3.4, FactInt 1.6.3, FGA 1.4.0, Forms 1.2.8, GAPDoc 1.6.6, genss 1.6.7, IO 4.7.2, IRREDSOL 1.4.3, LAGUNA 3.9.5, orb 4.8.5, Polenta 1.3.10, Polycyclic 2.16, PrimGrp 3.4.2, RadiRoot 2.9, recog 1.3.2, ResClasses 4.7.3, SmallGrp 1.5, Sophus 1.27, SpinSym 1.5.2, TomLib 1.2.9, TransGrp 3.6.3, utils 0.76 Try '??help' for help. See also '?copyright', '?cite' and '?authors'

gap> LoadPackage("guava");

I You may wish to install the xgap package

I and enjoy the graphic capabilities of SONATA.


/ || / \ /\ Version 2.9.4 || || || |\ | / \ /\ Erhard Aichinger \ || || |\ | /_____/\ Franz Binder \ || || | \ | / \ || / \ Juergen Ecker || _/ | \ | / \ || / \ Peter Mayr || | \| / \ || Christof Noebauer ___/ | | ||

System Of Nearrings And Their Applications Info: https://gap-packages.github.io/sonata/

_ | / \ / --+-- Version 3.16 / | | |\ //| | | | | | \ // | the GUAVA Group | \ | | |--\ //--|
\ || | | \ // |
_
/ ___/ | \// |

true

gap> M:=[List([1..6],x->1)*Z(2)]; [ [ Z(2)^0, Z(2)^0, Z(2)^0, Z(2)^0, Z(2)^0, Z(2)^0 ] ]

this works

gap> PutStandardForm(M,false); ()

this doesn't

gap> PutStandardForm(M,true); Error, Function Calls: must return a value in TriangulizeMat( mat ) at /opt/gap-4.12.0/.libs/../pkg/guava/lib/matrices.gi:640 called from PutStandardForm( Mat, F ) at /opt/gap-4.12.0/.libs/../pkg/guava/lib/matrices.gi:592 called from PutStandardForm( M, idleft, DefaultField( Flat( M ) ) ) at /opt/gap-4.12.0/.libs/../pkg/guava/lib/matrices.gi:660 called from <function "PutStandardForm method for matrix and idleft">( ) called from read-eval loop at stdin:6 type 'quit;' to quit to outer loop brk> quit;

osj1961 commented 1 year ago

This example works fine in 3.18, but see below. __ | / \ / --+-- Version 3.18 / | | |\ \ / /| | | | | | \ \ / / | the GUAVA Group | | | | |--\ \ / /--| \ | | | | \ \ / / | _/ _/ | \ \/ / |

Homepage: https://gap-packages.github.io/guava Report issues at https://github.com/gap-packages/guava/issues true gap> M:=[List([1..6],x->1)*Z(2)]; [ [ Z(2)^0, Z(2)^0, Z(2)^0, Z(2)^0, Z(2)^0, Z(2)^0 ] ] gap> PutStandardForm(M, true); ()

A slightly more extended example fails with a different issue:

gap> C:=HammingCode(3); a linear [7,4,3]1 Hamming (3,2) code over GF(2) gap> G:=GeneratorMat(C); [ <an immutable GF2 vector of length 7>, <an immutable GF2 vector of length 7>, <an immutable GF2 vector of length 7>, <an immutable GF2 vector of length 7> ] gap> Display(G); 1 1 1 . . . . 1 . . 1 1 . . . 1 . 1 . 1 . 1 1 . 1 . . 1 gap> PutStandardForm(G, true); Error, no method found! For debugging hints type ?Recovery from NoMethodFound Error, no 1st choice method found for `TriangulizeMat' on 1 arguments at /Users/joefields/Desktop/gap-4.12.2/lib/methsel2.g:249 called from TriangulizeMat( mat ); at /Users/joefields/Desktop/gap-4.12.2/pkg/guava/lib/matrices.gi:640 called from PutStandardForm( Mat, F ) at /Users/joefields/Desktop/gap-4.12.2/pkg/guava/lib/matrices.gi:592 called from PutStandardForm( M, idleft, DefaultField( Flat( M ) ) ) at /Users/joefields/Desktop/gap-4.12.2/pkg/guava/lib/matrices.gi:660 called from <function "PutStandardForm method for matrix and idleft">( ) called from read-eval loop at stdin:13 type 'quit;' to quit to outer loop brk>

osj1961 commented 1 year ago

The problem in 3.18 seems to have to do with whether the matrix is mutable. When the matrix is mutable PutStandardForm() works as intended, but when not (as is the case for e.g. the generator matrices of codes from standard constructions) it doesn't.

gap> C:=HammingCode(3); a linear [7,4,3]1 Hamming (3,2) code over GF(2) gap> G:=GeneratorMat(C); [ <an immutable GF2 vector of length 7>, <an immutable GF2 vector of length 7>, <an immutable GF2 vector of length 7>, <an immutable GF2 vector of length 7> ] gap> PutStandardForm(G, true); Error, no method found! For debugging hints type ?Recovery from NoMethodFound Error, no 1st choice method found for `TriangulizeMat' on 1 arguments at /Users/joefields/Desktop/gap-4.12.2/lib/methsel2.g:249 called from TriangulizeMat( mat ); at /Users/joefields/Desktop/gap-4.12.2/pkg/guava/lib/matrices.gi:641 called from PutStandardForm( Mat, F ) at /Users/joefields/Desktop/gap-4.12.2/pkg/guava/lib/matrices.gi:592 called from PutStandardForm( M, idleft, DefaultField( Flat( M ) ) ) at /Users/joefields/Desktop/gap-4.12.2/pkg/guava/lib/matrices.gi:661 called from <function "PutStandardForm method for matrix and idleft">( ) called from read-eval loop at stdin:4 type 'quit;' to quit to outer loop brk>

But, OTOH:

gap> M:=MutableCopyMat(G); [ <a GF2 vector of length 7>, <a GF2 vector of length 7>, <a GF2 vector of length 7>, <a GF2 vector of length 7> ] gap> PutStandardForm(M, true); () gap> Display(M); 1 . . . . 1 1 . 1 . . 1 . 1 . . 1 . 1 1 . . . . 1 1 1 1 gap> PutStandardForm(M, false); (1,7) gap> Display(M);
1 . 1 1 . . . 1 1 . . 1 . . 1 1 1 . . 1 . . 1 1 . . . 1 gap>

qodesign commented 1 year ago

Thanks for the comment. I upgraded guava to 3.18 and this did fix the problem.