return homalgSendBlocking( [ "GreatestCommonDivisor(", a, b, ")" ], "CancelGcd" );
end,
CancelGcd := function( a, b )
local a_g, b_g;
homalgSendBlocking( [ "g:=GreatestCommonDivisor(", a, b, ")" ], "need_command", "Gcd" );
a_g := homalgSendBlocking( [ "(", a, ") div g" ], "CancelGcd" );
b_g := homalgSendBlocking( [ "(", b, ") div g" ], "CancelGcd" );
return [ a_g, b_g ];
end,
# CopyElement := # function( r, R )
# return homalgSendBlocking( [ R, "!", r ], HomalgRing( r ), "CopyElement" );
# end,
ShallowCopy := C -> homalgSendBlocking( [ C ], "CopyMatrix" ),
CopyMatrix := function( C, R )
local S;
S := HomalgRing( C );
if HasRelativeIndeterminatesOfPolynomialRing( R ) and
HasCoefficientsRing( S ) and
HasIsFieldForHomalg( CoefficientsRing( S ) ) and IsFieldForHomalg( CoefficientsRing( S ) ) then
return Eval( ConvertHomalgMatrixViaFile( C, R ) ); fi;
PositionOfFirstNonZeroEntryPerRow := function( M )
local L;
L := homalgSendBlocking( [ "PositionOfFirstNonZeroEntryPerRow( ", M, " )" ], "need_output", "PositionOfFirstNonZeroEntryPerRow" );
L := StringToIntList( L );
if Length( L ) = 1then
return ListWithIdenticalEntries( NumberRows( M ), L[1] ); fi;
return L;
end,
PositionOfFirstNonZeroEntryPerColumn := function( M )
local L;
L := homalgSendBlocking( [ "PositionOfFirstNonZeroEntryPerColumn( ", M, " )" ], "need_output", "PositionOfFirstNonZeroEntryPerColumn" );
L := StringToIntList( L );
if Length( L ) = 1then
return ListWithIdenticalEntries( NumberColumns( M ), L[1] ); fi;
return L;
end,
DivideRowByUnit := function( M, i, u, j )
homalgSendBlocking( [ "DivideRowByUnit(~", M, i, u, j, ")" ], "need_command", "DivideRowByUnit" );
end,
DivideColumnByUnit := function( M, j, u, i )
homalgSendBlocking( [ "DivideColumnByUnit(~", M, j, u, i, ")" ], "need_command", "DivideColumnByUnit" );
end,
CopyRowToIdentityMatrix := function( M, i, L, j )
local l;
l := Length( L );
if l > 1 and ForAll( L, IsHomalgMatrix ) then
homalgSendBlocking( [ "CopyRowToIdentityMatrix2(", M, i, ",~", L[1], ",~", L[2], j, ")" ], "need_command", "CopyRowToIdentityMatrix" ); elif l > 0 and IsHomalgMatrix( L[1] ) then
homalgSendBlocking( [ "CopyRowToIdentityMatrix(", M, i, ",~", L[1], j, -1, ")" ], "need_command", "CopyRowToIdentityMatrix" ); elif l > 1 and IsHomalgMatrix( L[2] ) then
homalgSendBlocking( [ "CopyRowToIdentityMatrix(", M, i, ",~", L[2], j, 1, ")" ], "need_command", "CopyRowToIdentityMatrix" ); fi;
end,
CopyColumnToIdentityMatrix := function( M, j, L, i )
local l;
l := Length( L );
if l > 1 and ForAll( L, IsHomalgMatrix ) then
homalgSendBlocking( [ "CopyColumnToIdentityMatrix2(", M, j, ",~", L[1], ",~", L[2], i, ")"], "need_command", "CopyColumnToIdentityMatrix" ); elif l > 0 and IsHomalgMatrix( L[1] ) then
homalgSendBlocking( [ "CopyColumnToIdentityMatrix(", M, j, ",~", L[1], i, -1, ")" ], "need_command", "CopyColumnToIdentityMatrix" ); elif l > 1 and IsHomalgMatrix( L[2] ) then
homalgSendBlocking( [ "CopyColumnToIdentityMatrix(", M, j, ",~", L[2], i, 1, ")" ], "need_command", "CopyColumnToIdentityMatrix" ); fi;
end,
SetColumnToZero := function( M, i, j )
homalgSendBlocking( [ "SetColumnToZero(~", M, i, j, ")" ], "need_command", "SetColumnToZero" );
end,
ConvertRowToMatrix := function( M, r, c )
return homalgSendBlocking( [ "ConvertRowToMatrix(", M, r, c, HomalgRing( M ), ")" ], "ConvertRowToMatrix" );
end,
GetCleanRowsPositions := function( M, clean_columns )
local list_string;
## do not add CoefficientsOf(Unreduced)NumeratorOfHilbertPoincareSeries ## since MAGMA does not support Hilbert* for non-graded modules
CoefficientsOfUnreducedNumeratorOfWeightedHilbertPoincareSeries := function( mat, weights, degrees )
local R, v, hilb;
if Set( weights ) <> [ 1 ] then
Error( "the homalgTable entry CoefficientsOfUnreducedNumeratorOfWeightedHilbertPoincareSeries for MAGMA does not yet support weights\n" ); fi;
Coefficients := function( poly, var )
local R, y, vars, coeffs, d;
R := HomalgRing( poly );
if HasRelativeIndeterminatesOfPolynomialRing( R ) then
y := RelativeIndeterminatesOfPolynomialRing( R ); if y <> var then
Error( "the list of given variables does not coincide with the list of relative indeterminates\n" ); elif Length( y ) > 1then
Error( "this table entry can only handle univariate polynomial rings over some base ring\n" ); fi;
y := y[1];
vars := homalgSendBlocking( [ "Reverse(MonomialsUnivariate(", poly, y, "))" ], R, "Coefficients" );
coeffs := homalgSendBlocking( [ "Reverse(Coefficients(", poly, y, "))" ], R, "Coefficients" );
if HasRelativeIndeterminatesOfPolynomialRing( R ) then
y := RelativeIndeterminatesOfPolynomialRing( R ); if Length( y ) > 1then
Error( "this table entry can only handle univariate polynomial rings over some base ring\n" ); fi;
y := y[1];
CoefficientsOfUnivariatePolynomial := function( r, var )
local R, y, coeffs, d;
R := HomalgRing( r );
if HasRelativeIndeterminatesOfPolynomialRing( R ) then
y := RelativeIndeterminatesOfPolynomialRing( R ); if y <> [ var ] then
Error( "the list of given variables does not coincide with the list of relative indeterminates\n" ); elif Length( y ) > 1then
Error( "this table entry can only handle univariate polynomial rings over some base ring\n" ); fi;
y := y[1]; else
y := var; fi;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.