Skip to content

Commit

Permalink
Add IsEmptyMatrix property
Browse files Browse the repository at this point in the history
  • Loading branch information
Dominik Bernhardt authored and wilfwilson committed Aug 19, 2019
1 parent 25b5167 commit 3667249
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
1 change: 1 addition & 0 deletions doc/ref/matrix.xml
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ see&nbsp;<Ref Sect="Mutability and Copyability"/>.
<#Include Label="DeterminantMat">
<#Include Label="DeterminantMatDestructive">
<#Include Label="DeterminantMatDivFree">
<#Include Label="MatObj_IsEmptyMatrix">
<#Include Label="IsMonomialMatrix">
<#Include Label="IsDiagonalMat">
<#Include Label="IsUpperTriangularMat">
Expand Down
9 changes: 9 additions & 0 deletions lib/matobj.gi
Original file line number Diff line number Diff line change
Expand Up @@ -645,3 +645,12 @@ InstallOtherMethod( NumberColumns, "for a matrix",
#
InstallOtherMethod( DimensionsMat, "for a matrix in IsMatrixObj",
[ IsMatrixObj ], m -> [ NumberRows( m ), NumberColumns( m ) ] );

############################################################################
##
#M IsEmptyMatrix( <matobj> )
##
InstallMethod( IsEmptyMatrix,
[ IsMatrixObj ],
mat -> NrRows(mat) = 0 or NrCols(mat) = 0
);
18 changes: 18 additions & 0 deletions lib/matobj2.gd
Original file line number Diff line number Diff line change
Expand Up @@ -1289,6 +1289,24 @@ DeclareOperation( "^", [ IsVectorObj, IsMatrixObj ] );
# AddCoeffs


#############################################################################
##
## IsEmptyMatrix( <matobj> )
##
## <#GAPDoc Label="MatObj_IsEmptyMatrix">
## <ManSection>
## <Prop Name="IsEmptyMatrix" Arg='M' Label="for matrices"/>
## <Returns>A boolean</Returns>
## <Description>
## Is <K>true</K> if <A>M</A> either has zero columns or zero rows and
## <K>false</K> otherwise.
## In other words, a matrix is empty if it has no entries.
## </Description>
## </ManSection>
## <#/GAPDoc>
##
DeclareProperty( "IsEmptyMatrix", IsMatrixObj );


# while we are at it also make the naming of following more uniform ???

Expand Down

0 comments on commit 3667249

Please sign in to comment.