Skip to content

Commit

Permalink
Merge pull request #597 from mohamed-barakat/devel
Browse files Browse the repository at this point in the history
RowEchelonForm now supported in Singular and Maple
  • Loading branch information
mohamed-barakat authored Nov 2, 2023
2 parents 3468c04 + c2583a1 commit 228ca28
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 5 deletions.
2 changes: 1 addition & 1 deletion MatricesForHomalg/PackageInfo.g
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ SetPackageInfo( rec(

PackageName := "MatricesForHomalg",
Subtitle := "Matrices for the homalg project",
Version := "2023.10-01",
Version := "2023.11-01",
Date := (function ( ) if IsBound( GAPInfo.SystemEnvironment.GAP_PKG_RELEASE_DATE ) then return GAPInfo.SystemEnvironment.GAP_PKG_RELEASE_DATE; else return Concatenation( ~.Version{[ 1 .. 4 ]}, "-", ~.Version{[ 6, 7 ]}, "-01" ); fi; end)( ),
License := "GPL-2.0-or-later",

Expand Down
12 changes: 9 additions & 3 deletions MatricesForHomalg/gap/Service.gi
Original file line number Diff line number Diff line change
Expand Up @@ -172,15 +172,19 @@ InstallMethod( RowEchelonForm,

B := RP!.RowEchelonForm( M );

ColoredInfoForService( t, "RowEchelonForm", Length( NonZeroRows( B ) ) );
B := CertainRows( B, NonZeroRows( B ) );

ColoredInfoForService( t, "RowEchelonForm", NumberRows( B ) );

return B;

elif IsBound(RP!.ColumnEchelonForm) then

B := Involution( RP!.ColumnEchelonForm( Involution( M ) ) );

ColoredInfoForService( t, "RowEchelonForm", Length( NonZeroRows( B ) ) );
B := CertainRows( B, NonZeroRows( B ) );

ColoredInfoForService( t, "RowEchelonForm", NumberRows( B ) );

return B;

Expand Down Expand Up @@ -252,7 +256,9 @@ InstallMethod( ColumnEchelonForm,

B := RP!.ColumnEchelonForm( M );

ColoredInfoForService( t, "ColumnEchelonForm", Length( NonZeroColumns( B ) ) );
B := CertainColumns( B, NonZeroColumns( B ) );

ColoredInfoForService( t, "ColumnEchelonForm", NumberColumns( B ) );

return B;

Expand Down
2 changes: 1 addition & 1 deletion RingsForHomalg/PackageInfo.g
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ SetPackageInfo( rec(

PackageName := "RingsForHomalg",
Subtitle := "Dictionaries of external rings",
Version := "2023.09-01",
Version := "2023.11-01",
Date := (function ( ) if IsBound( GAPInfo.SystemEnvironment.GAP_PKG_RELEASE_DATE ) then return GAPInfo.SystemEnvironment.GAP_PKG_RELEASE_DATE; else return Concatenation( ~.Version{[ 1 .. 4 ]}, "-", ~.Version{[ 6, 7 ]}, "-01" ); fi; end)( ),
License := "GPL-2.0-or-later",

Expand Down
14 changes: 14 additions & 0 deletions RingsForHomalg/gap/MapleHomalgBasic.gi
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,20 @@ BindGlobal( "CommonHomalgTableForMapleHomalgBasic",
## Must only then be provided by the RingPackage in case the default
## "service" function does not match the Ring

RowEchelonForm :=
function( M )
local R, N;

R := HomalgRing( M );

N := HomalgVoidMatrix( "unknown_number_of_rows", NumberColumns( M ), R );

homalgSendBlocking( [ N, " := ", R, "[-1][matrix](LinearAlgebra[GaussianElimination](Matrix(", M, "), 'method' = 'FractionFree'))" ], "need_command", "ReducedEchelonForm" );

return N;

end,

BasisOfRowModule :=
function( M )
local R, N;
Expand Down
24 changes: 24 additions & 0 deletions RingsForHomalg/gap/SingularBasic.gi
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,30 @@ BindGlobal( "CommonHomalgTableForSingularBasic",
## Must only then be provided by the RingPackage in case the default
## "service" function does not match the Ring

RowEchelonForm :=
function( M )
local R, v, N;

R := HomalgRing( M );

v := homalgStream( R ).variable_name;

N := HomalgVoidMatrix( "unknown_number_of_rows", NumberColumns( M ), R );

homalgSendBlocking( [ "intvec ", v, "option = option(get); option(none); option(prompt); option(intStrategy)" ], R, "need_command", "initialize" );

homalgSendBlocking(
[ "matrix ", N, " = BasisOfRowModule(", M, ")" ],
"need_command",
"ReducedEchelonForm"
);

homalgSendBlocking( [ "option(set,", v, "option)" ], R, "need_command", "initialize" );

return CertainRows( N, Reversed( [ 1 .. NumberRows( N ) ] ) );

end,

## <#GAPDoc Label="BasisOfRowModule:Singular">
## <ManSection>
## <Func Arg="M" Name="BasisOfRowModule" Label="in the homalg table for Singular"/>
Expand Down

0 comments on commit 228ca28

Please sign in to comment.