In GAP, IsMatrix objects are collections. Thus a common way to install a function that only works for matrices over finite fields is to use IsMatrix and IsFFECollColl. And we also do this:
DeclareSynonym( "IsMatrixGroup", IsRingElementCollCollColl and IsGroup );
...
DeclareSynonym( "IsFFEMatrixGroup", IsFFECollCollColl and IsMatrixGroup );
But for IsMatrixObj, it seems unreasonably to me to require them to be collections.
UPDATE: Besides fundamental objections to this, I also think that the only sensible way to do that would be to consider them as collections of their entries (as we explicitly do not want to require all matrices to be lists of row vectors). But then Size (which must be implemented for collection) should return NrCols(mat) * NrRows(mat); but that would be incompatible with existing IsMatrix objects, where Size returns the number of rows.
END UPDATE
UPDATE 2: I just discovered this text in lib/matobj1.gd:
The family of an object in IsMatrixObj is the collections family of the family of its base domain.
So it seems this was an explicit goal. It still seems problematic to me. Of course we could agree to follow this, but then this still leaves the question how to deal with the requirement that collections must implement Size but also should support enumerators and iterators. Perhaps we just document that IsMatrixObj are exempt from this rule?
END UPDATE 2
I would therefore suggest that we add special filters to replace the use of IsFFECollColl and also IsCyclotomicCollColl for matrices and vectors.
Indeed, I already see these two in the library:
DeclareFilter( "IsIntVector" );
DeclareFilter( "IsFFEVector" );
Although only the former is used... anyway, we could add a few filters (whether they should be pure filters, categories, properties, ... I don't know / care too much about) and then start converting existing code to use them... Say like this:
DeclareCategory( "IsFFEMatrixObj", IsMatrixObj );
DeclareCategory( "IsCyclotomicMatrixObj", IsMatrixObj );
DeclareCategory( "IsFFEVectorObj", IsVectorObj );
DeclareCategory( "IsCyclotomicVectorObj", IsVectorObj );
DeclareCategory( "IsMatrixGroup", IsGroup );
DeclareCategory( "IsFFEMatrixGroup", IsMatrixGroup );
# TODO: perhaps we also need an `IsMatrixObjGroup` category???? seems too technical to me, though
...
InstallTrueMethod( IsFFEMatrixObj, IsFFECollColl and IsMatrixObj );
InstallTrueMethod( IsMatrixGroup, IsRingElementCollCollColl and IsGroup );
InstallTrueMethod( IsFFEMatrixGroup, IsFFECollCollColl and IsMatrixGroup );
Perhaps we can also have an IsMatrixObjCollection, and then do this?
InstallTrueMethod( IsMatrixGroup, IsMatrixObjCollection and IsGroup );
And then of course code should be added to set these filters in further situations.
In GAP,
IsMatrixobjects are collections. Thus a common way to install a function that only works for matrices over finite fields is to useIsMatrix and IsFFECollColl. And we also do this:But for
IsMatrixObj, it seems unreasonably to me to require them to be collections.UPDATE: Besides fundamental objections to this, I also think that the only sensible way to do that would be to consider them as collections of their entries (as we explicitly do not want to require all matrices to be lists of row vectors). But then
Size(which must be implemented for collection) should returnNrCols(mat) * NrRows(mat); but that would be incompatible with existingIsMatrixobjects, whereSizereturns the number of rows.END UPDATE
UPDATE 2: I just discovered this text in
lib/matobj1.gd:So it seems this was an explicit goal. It still seems problematic to me. Of course we could agree to follow this, but then this still leaves the question how to deal with the requirement that collections must implement
Sizebut also should support enumerators and iterators. Perhaps we just document thatIsMatrixObjare exempt from this rule?END UPDATE 2
I would therefore suggest that we add special filters to replace the use of
IsFFECollColland alsoIsCyclotomicCollCollfor matrices and vectors.Indeed, I already see these two in the library:
Although only the former is used... anyway, we could add a few filters (whether they should be pure filters, categories, properties, ... I don't know / care too much about) and then start converting existing code to use them... Say like this:
Perhaps we can also have an
IsMatrixObjCollection, and then do this?InstallTrueMethod( IsMatrixGroup, IsMatrixObjCollection and IsGroup );And then of course code should be added to set these filters in further situations.