updates for vector and matrix objects over residue class rings and large finite fields#6342
updates for vector and matrix objects over residue class rings and large finite fields#6342ThomasBreuer wants to merge 13 commits intogap-system:masterfrom
Conversation
in order to catch `fail` results
Recommend calling `Objectify` only in one helper function.
Test that the input is square, as for list-of-lists matrices.
- check the input list for `IsPlistRep` in `MakeIsPlistVectorRep`, let `NewVector` turn the input to `IsPlistRep` if necessary - forbid assignments into a `IsPlistVectorRep` vector beyond its length
and reactivate them as the default representations for vector/matrix objects over residue class rings and large prime fields
Conceptually, the solution must be in the same representation as the given vector. (Let us see which other bugs will come to the surface now.)
Use the same format as for `IsPlistVectorRep`, `IsPlistMatrixRep`.
|
The failures in the first attempt had various reasons.
|
|
Essentially only one failure in the second attempt, but this is not easy to fix. |
Happy to look at this -- what call should be used to extract a matrix row in vector (or list) form ? |
This was intended as a temporary fallback -- there were situations when a vector arose not in the proper format but as a plist, and this otherwise would have started to unravel all objects to go back to plists. What would be needed as a second step (and I never got to) is to instrument this with an error trigger to identify all cases when it is actually needed (and to fix the code that ends up calling it).
As far as I recall not. Probably the extra filter was accidentally left out. |
|
Thanks @hulpke.
How shall we proceed then?
I think currently we do not have a function for that. However, perhaps the real question behind this is whether functions that take a matrix For example (this is the place where the first error occurs in
I understand. Concerning an error trigger, a similar issue arises with
O.k., I can make the method installations more restrictive. |
Currently some GAP library code works only with row list matrices.
The main part of this pull request is to rewrite the code for
IsZmodnZVectorRep,IsZmodnZMatrixRepaccording to the current rules and recommendations for vector and matrix objects, and to reactivate these filters as the default representations for vector/matrix objects over residue class rings and large prime fields. (Thus this resolves #4988.)In particular, the internal data of an
IsZmodnZMatrixRepobject is now a plain list of plain lists of integers, no longer a plain list ofIsZmodnZVectorRepobjects.(That is, the code for
IsZmodnZMatrixRepis analogous to that forIsGenericMatrixRep(see pull request #6322) not to that forIsPlistMatrixRep. However,IsZmodnZVectorRepis analogous toIsPlistVectorRep.)Besides that, this pull request proposes some fixes for other objects:
NewVector,NewMatrixfor the GF(2) and 8 bit representations, in order to catchfailresults,Stringmethod for the ringsIntegers mod n,OneMutablemethod forIsMatrixObj(test that the input is square, as for list-of-lists matrices),IsPlistRepinMakeIsPlistVectorRep, and letNewVectorturn the input toIsPlistRepif necessary (in fact, it had been possible to cause a segmentation fault by callingAddRowVectorwith two input vectors created from ranges),IsPlistVectorRepvector beyond its length,Objectifyonly in one helper function.Concerning the documentation, there is now a description of the main differences between
IsZmodnZVectorRep/IsZmodnZMatrixRepand other representations.This is quite technical, currently it is not part of the manual.
Perhaps somebody has an idea how to make such descriptions of matrix object types available in general.
The documentation of the two filters now contains a description for which base domains these filters are chosen as the defaults by
VectorandMatrix, respectively.This description could be simplified if the functions
DefaultVectorRepForBaseDomainandDefaultMatrixRepForBaseDomainwould become documented.(Perhaps we should think about an "extendible" mechanism, for example via lists of functions, such that adding new types of vector or matrix objects does not require changes in global GAP functions.)
Two open questions (perhaps @hulpke can help answering them):
IsZmodnZVectorRepobjects and plain lists ofIsZmodnZObjobjects, the same for matrices. I have kept this code, but do we really want to have it? If yes then several methods are missing, and more checks of the arguments should be added.MinimalPolynomialandCharacteristicPolynomialMatrixNCmethods that are installed without explicit requirements forIsZmodnZMatrixRep. Are they intended as generic methods for matrix objects?