Add IsSquareMat and IsAntisymmetricMat#6268
Add IsSquareMat and IsAntisymmetricMat#6268limakzi wants to merge 1 commit intogap-system:masterfrom
IsSquareMat and IsAntisymmetricMat#6268Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds new matrix properties to the matrix subsystem, improving reuse and consistency across related predicates.
Changes:
- Introduces
IsSquareMatrix/IsSquareMatand adds test coverage for square vs. non-square matrices. - Introduces
IsAntisymmetricMatrix/IsAntisymmetricMat(with documentation and tests). - Refactors
IsSymmetricMatrixto useIsSquareMatrix, and installs implications that symmetric/antisymmetric matrices are square.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
tst/testinstall/matrix.tst |
Adds tests for IsSquareMat and IsAntisymmetricMat. |
lib/matrix.gi |
Implements IsSquareMatrix and IsAntisymmetricMatrix; simplifies IsSymmetricMatrix square-check. |
lib/matrix.gd |
Declares new properties/synonyms, adds GAPDoc entries, and installs implications to IsSquareMatrix. |
doc/ref/matrix.xml |
Includes the new GAPDoc sections in the reference manual. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
IsSquareMat and IsAntisymmetricMat
| return NrRows( mat ) = NrCols( mat ); | ||
| end ); | ||
|
|
||
| InstallTrueMethod( IsSquareMatrix, IsMatrixOrMatrixObj and IsEmptyMatrix ); |
There was a problem hiding this comment.
Hmm... is a
| fi; | ||
| zero := ZeroOfBaseDomain( mat ); | ||
| for i in [ 1 .. NrRows( mat ) ] do | ||
| if mat[i,i] <> zero then |
There was a problem hiding this comment.
This is the wrong condition in characteristic 0, isn't it?
There was a problem hiding this comment.
In characteristic 2, you mean?
There was a problem hiding this comment.
argh, yes (actually: in even positive characteristic, not just 2.
But the solution is the same: just remove this special case
Add
IsSquareMatrix/IsSquareMatto check whether a matrix is square.Add
IsAntisymmetricMatrix/IsAntisymmetricMatto check whethermat[i,j] = -mat[j,i]for all entries.Both symmetric and antisymmetric matrices imply
IsSquareMatrixviaInstallTrueMethod.IsSymmetricMatrixis simplified to useIsSquareMatrixinstead of an inline dimension check.Fixes #6264.