Add IsSquareMat and IsAntisymmetricMat#6268
Add IsSquareMat and IsAntisymmetricMat#6268limakzi wants to merge 5 commits 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
lib/matrix.gi
Outdated
| @@ -274,6 +288,35 @@ InstallMethod( IsSymmetricMatrix, | |||
| InstallTrueMethod( IsSymmetricMatrix, IsMatrixOrMatrixObj and IsEmptyMatrix ); | |||
There was a problem hiding this comment.
This should also go, and tests be added.
Luckily, it doesn't actually work for e.g. IsPlistMatrixRep (not sure why, but I also did not try to investigate).
But the following could also be basis for a test.
gap> a := NewZeroMatrix(IsPlistMatrixRep, Integers, 0, 2);
<0x2-matrix over Integers>
gap> b := NewZeroMatrix(IsPlistMatrixRep, Integers, 2, 0);
<2x0-matrix over Integers>
gap> c := NewZeroMatrix(IsPlistMatrixRep, Integers, 0, 0);
<0x0-matrix over Integers>
gap>
gap> IsEmptyMatrix(a);
true
gap> IsEmptyMatrix(b);
true
gap> IsEmptyMatrix(c);
true
gap>
gap> IsSymmetricMatrix(a);
false
gap> IsSymmetricMatrix(b);
false
gap> IsSymmetricMatrix(c);
true
Co-authored-by: Max Horn <max@quendi.de>
939933a to
99c3007
Compare
|
I've applied my suggestions and added a bunch of test with "empty" matrices / MatrixObj |
|
Fails because the HAPcryst package also defines |
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.