Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Gauss] Error when computing the rank of a sparse matrix over GF(3) with zero entries #605

Open
jdobben opened this issue Apr 12, 2024 · 3 comments

Comments

@jdobben
Copy link

jdobben commented Apr 12, 2024

Are sparse matrices from the gauss package not allowed to have zero entries? Because I get an error when trying to compute the rank of such a matrix; for example:

LoadPackage("gauss");
SN := SparseMatrix( 2, 3, [ [ 2 ], [ 1, 3 ] ], [ [ 1 ], [ 3, 2 ] ] * One( GF(3) ) );
Rank(SN);

This gives the following error:

 ┌───────┐   GAP 4.13.0 of 2024-03-15
 │  GAP  │   https://www.gap-system.org
 └───────┘   Architecture: x86_64-pc-linux-gnu-default64-kv9
 Configuration:  gmp 6.2.1, GASMAN, readline
 Loading the library and packages ...
 Packages:   AClib 1.3.2, Alnuth 3.2.1, AtlasRep 2.1.8, AutPGrp 1.11, 
             Browse 1.8.21, CaratInterface 2.3.6, CRISP 1.4.6, Cryst 4.1.27, 
             CrystCat 1.1.10, CTblLib 1.3.9, FactInt 1.6.3, FGA 1.5.0, 
             Forms 1.2.9, GAPDoc 1.6.7, genss 1.6.8, IO 4.8.2, IRREDSOL 1.4.4, 
             LAGUNA 3.9.6, orb 4.9.0, Polenta 1.3.10, Polycyclic 2.16, 
             PrimGrp 3.4.4, RadiRoot 2.9, recog 1.4.2, ResClasses 4.7.3, 
             SmallGrp 1.5.3, Sophus 1.27, SpinSym 1.5.2, StandardFF 1.0, 
             TomLib 1.2.11, TransGrp 3.6.5, utils 0.85
 Try '??help' for help. See also '?copyright', '?cite' and '?authors'
gap> LoadPackage("gauss");
─────────────────────────────────────────────────────────────────────────────
Loading Gauss 2023.02-04 (Extended Gauss functionality for GAP)
by Simon Görtzen (https://www.linkedin.com/in/simongoertzen/).
maintained by:
   Mohamed Barakat (https://mohamed-barakat.github.io) and
   Sebastian Gutsche (https://sebasguts.github.io).
Homepage: https://homalg-project.github.io/pkg/Gauss
Report issues at https://github.com/homalg-project/homalg_project/issues
─────────────────────────────────────────────────────────────────────────────
true
gap> SN := SparseMatrix( 2, 3, [ [ 2 ], [ 1, 3 ] ], [ [ 1 ], [ 3, 2 ] ] * One( GF(3) ) );
<a 2 x 3 sparse matrix over GF(3)>
gap> Rank(SN);
Error, no method found! For debugging hints type ?Recovery from NoMethodFound
Error, no 2nd choice method found for `RankDestructive' on 2 arguments at $(GAPPATH)/lib/
methsel2.g:250 called from
RankDestructive( CopyMat( mat ), mat!.ncols 
 ) at $(GAPPATH)/pkg/gauss/gap/Sparse.gi:396 called from
<function "Rank method for sparse matrices">( <arguments> )
 called from read-eval loop at *stdin*:3
type 'quit;' to quit to outer loop
brk> 

It would be nice if gauss could handle this more gracefully. Moreover, if zero entries are not permitted, then I would recommend stating this more clearly in the documentation. (In my opinion, it would be better if gauss automatically processed such entries so that it doesn't have any problems with it later on.)

@mohamed-barakat
Copy link
Member

Yes, in your example 3 is zero in GF(3) and you are only allowed to specify the nonzero entries.

@jdobben
Copy link
Author

jdobben commented Apr 14, 2024

Oh, I see. Could this be added to the documentation?

Even better would be the following (which I'll leave as a feature request): it would be nice if gauss could automatically ignore zero entries in the input. It already seems to do this when constructing from a GAP matrix and when calling SetEntry or AddToEntry, but not when calling SparseMatrix( nrows, ncols, indices, entries[, R] ).

@mohamed-barakat
Copy link
Member

Yes, this should be added to the documentation. PR are welcome :)

Yes, SparseMatrix is a low-level computational interface. It is not meant for direct user interaction. We use Gauss through GaussForHomalg. So SparseMatrix is already a SparseMatrixNC.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants