GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it
1[1X5 [33X[0;0YMatrices[133X[101X234[1X5.1 [33X[0;0YMatrices: Category and Representations[133X[101X56[1X5.1-1 IsHomalgMatrix[101X78[29X[2XIsHomalgMatrix[102X( [3XA[103X ) [32X Category9[6XReturns:[106X [33X[0;10Y[10Xtrue[110X or [10Xfalse[110X[133X1011[33X[0;0YThe [5XGAP[105X category of [5Xhomalg[105X matrices.[133X1213[4X[32X Code [32X[104X14[4XDeclareCategory( "IsHomalgMatrix",[104X15[4X IsMatrixObj and[104X16[4X IsAttributeStoringRep );[104X17[4X[32X[104X1819[1X5.1-2 IsHomalgInternalMatrixRep[101X2021[29X[2XIsHomalgInternalMatrixRep[102X( [3XA[103X ) [32X Representation22[6XReturns:[106X [33X[0;10Y[10Xtrue[110X or [10Xfalse[110X[133X2324[33X[0;0YThe internal representation of [5Xhomalg[105X matrices.[133X2526[33X[0;0Y(It is a representation of the [5XGAP[105X category [2XIsHomalgMatrix[102X ([14X5.1-1[114X).)[133X272829[1X5.2 [33X[0;0YMatrices: Constructors[133X[101X3031[1X5.2-1 HomalgInitialMatrix[101X3233[29X[2XHomalgInitialMatrix[102X( [3Xm[103X, [3Xn[103X, [3XR[103X ) [32X function34[6XReturns:[106X [33X[0;10Ya [5Xhomalg[105X matrix[133X3536[33X[0;0YA mutable unevaluated initial [22X[3Xm[103X × [3Xn[103X[122X [5Xhomalg[105X matrix filled with zeros over the37[5Xhomalg[105X ring [3XR[103X. This construction is useful in case one wants to define a38matrix by assigning its nonzero entries. The property [2XIsInitialMatrix[102X39([14X5.3-26[114X) is reset as soon as the matrix is evaluated. New computed40properties or attributes of the matrix won't be cached, until the matrix is41explicitly made immutable using (--> [2XMakeImmutable[102X ([14XReference:42MakeImmutable[114X)).[133X4344[4X[32X Example [32X[104X45[4X[25Xgap>[125X [27XZZ := HomalgRingOfIntegers( );[127X[104X46[4X[28XZ[128X[104X47[4X[25Xgap>[125X [27Xz := HomalgInitialMatrix( 2, 3, ZZ );[127X[104X48[4X[28X<An initial 2 x 3 matrix over an internal ring>[128X[104X49[4X[25Xgap>[125X [27XHasIsZero( z );[127X[104X50[4X[28Xfalse[128X[104X51[4X[25Xgap>[125X [27XIsZero( z );[127X[104X52[4X[28Xtrue[128X[104X53[4X[25Xgap>[125X [27Xz;[127X[104X54[4X[28X<A 2 x 3 mutable matrix over an internal ring>[128X[104X55[4X[25Xgap>[125X [27XHasIsZero( z );[127X[104X56[4X[28Xfalse[128X[104X57[4X[32X[104X5859[4X[32X Example [32X[104X60[4X[25Xgap>[125X [27Xn := HomalgInitialMatrix( 2, 3, ZZ );[127X[104X61[4X[28X<An initial 2 x 3 matrix over an internal ring>[128X[104X62[4X[25Xgap>[125X [27XSetMatElm( n, 1, 1, "1" );[127X[104X63[4X[25Xgap>[125X [27XSetMatElm( n, 2, 3, "1" );[127X[104X64[4X[25Xgap>[125X [27XMakeImmutable( n );[127X[104X65[4X[28X<A 2 x 3 matrix over an internal ring>[128X[104X66[4X[25Xgap>[125X [27XDisplay( n );[127X[104X67[4X[28X[ [ 1, 0, 0 ],[128X[104X68[4X[28X [ 0, 0, 1 ] ][128X[104X69[4X[25Xgap>[125X [27XIsZero( n );[127X[104X70[4X[28Xfalse[128X[104X71[4X[25Xgap>[125X [27Xn;[127X[104X72[4X[28X<A non-zero 2 x 3 matrix over an internal ring>[128X[104X73[4X[32X[104X7475[1X5.2-2 HomalgInitialIdentityMatrix[101X7677[29X[2XHomalgInitialIdentityMatrix[102X( [3Xm[103X, [3XR[103X ) [32X function78[6XReturns:[106X [33X[0;10Ya [5Xhomalg[105X matrix[133X7980[33X[0;0YA mutable unevaluated initial [22X[3Xm[103X × [3Xm[103X[122X [5Xhomalg[105X quadratic matrix with ones on the81diagonal over the [5Xhomalg[105X ring [3XR[103X. This construction is useful in case one82wants to define an elementary matrix by assigning its off-diagonal nonzero83entries. The property [2XIsInitialIdentityMatrix[102X ([14X5.3-27[114X) is reset as soon as84the matrix is evaluated. New computed properties or attributes of the matrix85won't be cached, until the matrix is explicitly made immutable using (-->86[2XMakeImmutable[102X ([14XReference: MakeImmutable[114X)).[133X8788[4X[32X Example [32X[104X89[4X[25Xgap>[125X [27XZZ := HomalgRingOfIntegers( );[127X[104X90[4X[28XZ[128X[104X91[4X[25Xgap>[125X [27Xid := HomalgInitialIdentityMatrix( 3, ZZ );[127X[104X92[4X[28X<An initial identity 3 x 3 matrix over an internal ring>[128X[104X93[4X[25Xgap>[125X [27XHasIsOne( id );[127X[104X94[4X[28Xfalse[128X[104X95[4X[25Xgap>[125X [27XIsOne( id );[127X[104X96[4X[28Xtrue[128X[104X97[4X[25Xgap>[125X [27Xid;[127X[104X98[4X[28X<A 3 x 3 mutable matrix over an internal ring>[128X[104X99[4X[25Xgap>[125X [27XHasIsOne( id );[127X[104X100[4X[28Xfalse[128X[104X101[4X[32X[104X102103[4X[32X Example [32X[104X104[4X[25Xgap>[125X [27Xe := HomalgInitialIdentityMatrix( 3, ZZ );[127X[104X105[4X[28X<An initial identity 3 x 3 matrix over an internal ring>[128X[104X106[4X[25Xgap>[125X [27XSetMatElm( e, 1, 2, "1" );[127X[104X107[4X[25Xgap>[125X [27XSetMatElm( e, 2, 1, "-1" );[127X[104X108[4X[25Xgap>[125X [27XMakeImmutable( e );[127X[104X109[4X[28X<A 3 x 3 matrix over an internal ring>[128X[104X110[4X[25Xgap>[125X [27XDisplay( e );[127X[104X111[4X[28X[ [ 1, 1, 0 ],[128X[104X112[4X[28X [ -1, 1, 0 ],[128X[104X113[4X[28X [ 0, 0, 1 ] ][128X[104X114[4X[25Xgap>[125X [27XIsOne( e );[127X[104X115[4X[28Xfalse[128X[104X116[4X[25Xgap>[125X [27Xe;[127X[104X117[4X[28X<A 3 x 3 matrix over an internal ring>[128X[104X118[4X[32X[104X119120[1X5.2-3 HomalgZeroMatrix[101X121122[29X[2XHomalgZeroMatrix[102X( [3Xm[103X, [3Xn[103X, [3XR[103X ) [32X function123[6XReturns:[106X [33X[0;10Ya [5Xhomalg[105X matrix[133X124125[33X[0;0YAn immutable unevaluated [22X[3Xm[103X × [3Xn[103X[122X [5Xhomalg[105X zero matrix over the [5Xhomalg[105X ring [3XR[103X.[133X126127[4X[32X Example [32X[104X128[4X[25Xgap>[125X [27XZZ := HomalgRingOfIntegers( );[127X[104X129[4X[28XZ[128X[104X130[4X[25Xgap>[125X [27Xz := HomalgZeroMatrix( 2, 3, ZZ );[127X[104X131[4X[28X<An unevaluated 2 x 3 zero matrix over an internal ring>[128X[104X132[4X[25Xgap>[125X [27XDisplay( z );[127X[104X133[4X[28X[ [ 0, 0, 0 ],[128X[104X134[4X[28X [ 0, 0, 0 ] ][128X[104X135[4X[25Xgap>[125X [27Xz;[127X[104X136[4X[28X<A 2 x 3 zero matrix over an internal ring>[128X[104X137[4X[32X[104X138139[1X5.2-4 HomalgIdentityMatrix[101X140141[29X[2XHomalgIdentityMatrix[102X( [3Xm[103X, [3XR[103X ) [32X function142[6XReturns:[106X [33X[0;10Ya [5Xhomalg[105X matrix[133X143144[33X[0;0YAn immutable unevaluated [22X[3Xm[103X × [3Xm[103X[122X [5Xhomalg[105X identity matrix over the [5Xhomalg[105X ring145[3XR[103X.[133X146147[4X[32X Example [32X[104X148[4X[25Xgap>[125X [27XZZ := HomalgRingOfIntegers( );[127X[104X149[4X[28XZ[128X[104X150[4X[25Xgap>[125X [27Xid := HomalgIdentityMatrix( 3, ZZ );[127X[104X151[4X[28X<An unevaluated 3 x 3 identity matrix over an internal ring>[128X[104X152[4X[25Xgap>[125X [27XDisplay( id );[127X[104X153[4X[28X[ [ 1, 0, 0 ],[128X[104X154[4X[28X [ 0, 1, 0 ],[128X[104X155[4X[28X [ 0, 0, 1 ] ][128X[104X156[4X[25Xgap>[125X [27Xid;[127X[104X157[4X[28X<A 3 x 3 identity matrix over an internal ring>[128X[104X158[4X[32X[104X159160[1X5.2-5 HomalgVoidMatrix[101X161162[29X[2XHomalgVoidMatrix[102X( [[3Xm[103X, ][[3Xn[103X, ][3XR[103X ) [32X function163[6XReturns:[106X [33X[0;10Ya [5Xhomalg[105X matrix[133X164165[33X[0;0YA void [22X[3Xm[103X × [3Xn[103X[122X [5Xhomalg[105X matrix.[133X166167[1X5.2-6 HomalgMatrix[101X168169[29X[2XHomalgMatrix[102X( [3Xllist[103X, [3XR[103X ) [32X function170[29X[2XHomalgMatrix[102X( [3Xlist[103X, [3Xm[103X, [3Xn[103X, [3XR[103X ) [32X function171[29X[2XHomalgMatrix[102X( [3Xstr_llist[103X, [3XR[103X ) [32X function172[29X[2XHomalgMatrix[102X( [3Xstr_list[103X, [3Xm[103X, [3Xn[103X, [3XR[103X ) [32X function173[6XReturns:[106X [33X[0;10Ya [5Xhomalg[105X matrix[133X174175[33X[0;0YAn immutable evaluated [22X[3Xm[103X × [3Xn[103X[122X [5Xhomalg[105X matrix over the [5Xhomalg[105X ring [3XR[103X.[133X176177[4X[32X Example [32X[104X178[4X[25Xgap>[125X [27XZZ := HomalgRingOfIntegers( );[127X[104X179[4X[28XZ[128X[104X180[4X[25Xgap>[125X [27Xm := HomalgMatrix( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], ZZ );[127X[104X181[4X[28X<A 2 x 3 matrix over an internal ring>[128X[104X182[4X[25Xgap>[125X [27XDisplay( m );[127X[104X183[4X[28X[ [ 1, 2, 3 ],[128X[104X184[4X[28X [ 4, 5, 6 ] ][128X[104X185[4X[32X[104X186187[4X[32X Example [32X[104X188[4X[25Xgap>[125X [27Xm := HomalgMatrix( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], 2, 3, ZZ );[127X[104X189[4X[28X<A 2 x 3 matrix over an internal ring>[128X[104X190[4X[25Xgap>[125X [27XDisplay( m );[127X[104X191[4X[28X[ [ 1, 2, 3 ],[128X[104X192[4X[28X [ 4, 5, 6 ] ][128X[104X193[4X[32X[104X194195[4X[32X Example [32X[104X196[4X[25Xgap>[125X [27Xm := HomalgMatrix( [ 1, 2, 3, 4, 5, 6 ], 2, 3, ZZ );[127X[104X197[4X[28X<A 2 x 3 matrix over an internal ring>[128X[104X198[4X[25Xgap>[125X [27XDisplay( m );[127X[104X199[4X[28X[ [ 1, 2, 3 ],[128X[104X200[4X[28X [ 4, 5, 6 ] ][128X[104X201[4X[32X[104X202203[4X[32X Example [32X[104X204[4X[25Xgap>[125X [27Xm := HomalgMatrix( "[ [ 1, 2, 3 ], [ 4, 5, 6 ] ]", ZZ );[127X[104X205[4X[28X<A 2 x 3 matrix over an internal ring>[128X[104X206[4X[25Xgap>[125X [27XDisplay( m );[127X[104X207[4X[28X[ [ 1, 2, 3 ],[128X[104X208[4X[28X [ 4, 5, 6 ] ][128X[104X209[4X[32X[104X210211[4X[32X Example [32X[104X212[4X[25Xgap>[125X [27Xm := HomalgMatrix( "[ [ 1, 2, 3 ], [ 4, 5, 6 ] ]", 2, 3, ZZ );[127X[104X213[4X[28X<A 2 x 3 matrix over an internal ring>[128X[104X214[4X[25Xgap>[125X [27XDisplay( m );[127X[104X215[4X[28X[ [ 1, 2, 3 ],[128X[104X216[4X[28X [ 4, 5, 6 ] ][128X[104X217[4X[32X[104X218219[33X[0;0YIt is nevertheless recommended to use the following form to create [5Xhomalg[105X220matrices. This form can also be used to define external matrices. Since221whitespaces (--> [14XReference: Whitespaces[114X) are ignored, they can be used as222optical delimiters:[133X223224[4X[32X Example [32X[104X225[4X[25Xgap>[125X [27Xm := HomalgMatrix( "[ 1, 2, 3, 4, 5, 6 ]", 2, 3, ZZ );[127X[104X226[4X[28X<A 2 x 3 matrix over an internal ring>[128X[104X227[4X[25Xgap>[125X [27XDisplay( m );[127X[104X228[4X[28X[ [ 1, 2, 3 ],[128X[104X229[4X[28X [ 4, 5, 6 ] ][128X[104X230[4X[32X[104X231232[33X[0;0YOne can split the input string over several lines using the backslash233character '\' to end each line[133X234235[4X[32X Example [32X[104X236[4X[25Xgap>[125X [27Xm := HomalgMatrix( "[ \[127X[104X237[4X[25X>[125X [27X1, 2, 3, \[127X[104X238[4X[25X>[125X [27X4, 5, 6 \[127X[104X239[4X[25X>[125X [27X]", 2, 3, ZZ );[127X[104X240[4X[28X<A 2 x 3 matrix over an internal ring>[128X[104X241[4X[25Xgap>[125X [27XDisplay( m );[127X[104X242[4X[28X[ [ 1, 2, 3 ],[128X[104X243[4X[28X [ 4, 5, 6 ] ][128X[104X244[4X[32X[104X245246[1X5.2-7 HomalgDiagonalMatrix[101X247248[29X[2XHomalgDiagonalMatrix[102X( [3Xdiag[103X, [3XR[103X ) [32X function249[6XReturns:[106X [33X[0;10Ya [5Xhomalg[105X matrix[133X250251[33X[0;0YAn immutable unevaluated diagonal [5Xhomalg[105X matrix over the [5Xhomalg[105X ring [3XR[103X. The252diagonal consists of the entries of the list [3Xdiag[103X.[133X253254[4X[32X Example [32X[104X255[4X[25Xgap>[125X [27XZZ := HomalgRingOfIntegers( );[127X[104X256[4X[28XZ[128X[104X257[4X[25Xgap>[125X [27Xd := HomalgDiagonalMatrix( [ 1, 2, 3 ], ZZ );[127X[104X258[4X[28X<An unevaluated diagonal 3 x 3 matrix over an internal ring>[128X[104X259[4X[25Xgap>[125X [27XDisplay( d );[127X[104X260[4X[28X[ [ 1, 0, 0 ],[128X[104X261[4X[28X [ 0, 2, 0 ],[128X[104X262[4X[28X [ 0, 0, 3 ] ][128X[104X263[4X[25Xgap>[125X [27Xd;[127X[104X264[4X[28X<A diagonal 3 x 3 matrix over an internal ring>[128X[104X265[4X[32X[104X266267[1X5.2-8 \*[101X268269[29X[2X\*[102X( [3XR[103X, [3Xmat[103X ) [32X operation270[29X[2X\*[102X( [3Xmat[103X, [3XR[103X ) [32X operation271[6XReturns:[106X [33X[0;10Ya [5Xhomalg[105X matrix[133X272273[33X[0;0YAn immutable evaluated [5Xhomalg[105X matrix over the [5Xhomalg[105X ring [3XR[103X having the same274entries as the matrix [3Xmat[103X. Syntax: [3XR[103X [10X*[110X [3Xmat[103X or [3Xmat[103X [10X*[110X [3XR[103X[133X275276[4X[32X Example [32X[104X277[4X[25Xgap>[125X [27XZZ := HomalgRingOfIntegers( );[127X[104X278[4X[28XZ[128X[104X279[4X[25Xgap>[125X [27XZ4 := ZZ / 4;[127X[104X280[4X[28XZ/( 4 )[128X[104X281[4X[25Xgap>[125X [27XDisplay( Z4 );[127X[104X282[4X[28X<A residue class ring>[128X[104X283[4X[25Xgap>[125X [27Xd := HomalgDiagonalMatrix( [ 2 .. 4 ], ZZ );[127X[104X284[4X[28X<An unevaluated diagonal 3 x 3 matrix over an internal ring>[128X[104X285[4X[25Xgap>[125X [27Xd2 := Z4 * d; ## or d2 := d * Z4;[127X[104X286[4X[28X<A 3 x 3 matrix over a residue class ring>[128X[104X287[4X[25Xgap>[125X [27XDisplay( d2 );[127X[104X288[4X[28X[ [ 2, 0, 0 ],[128X[104X289[4X[28X [ 0, 3, 0 ],[128X[104X290[4X[28X [ 0, 0, 4 ] ][128X[104X291[4X[28X[128X[104X292[4X[28Xmodulo [ 4 ][128X[104X293[4X[25Xgap>[125X [27Xd;[127X[104X294[4X[28X<A diagonal 3 x 3 matrix over an internal ring>[128X[104X295[4X[25Xgap>[125X [27XZeroRows( d );[127X[104X296[4X[28X[ ][128X[104X297[4X[25Xgap>[125X [27XZeroRows( d2 );[127X[104X298[4X[28X[ 3 ][128X[104X299[4X[25Xgap>[125X [27Xd;[127X[104X300[4X[28X<A non-zero diagonal 3 x 3 matrix over an internal ring>[128X[104X301[4X[25Xgap>[125X [27Xd2;[127X[104X302[4X[28X<A non-zero 3 x 3 matrix over a residue class ring>[128X[104X303[4X[32X[104X304305306[1X5.3 [33X[0;0YMatrices: Properties[133X[101X307308[1X5.3-1 IsZero[101X309310[29X[2XIsZero[102X( [3XA[103X ) [32X property311[6XReturns:[106X [33X[0;10Y[10Xtrue[110X or [10Xfalse[110X[133X312313[33X[0;0YCheck if the [5Xhomalg[105X matrix [3XA[103X is a zero matrix, taking possible ring314relations into account.[133X315316[33X[0;0Y(for the installed standard method see [2XIsZeroMatrix[102X ([14XB.1-16[114X))[133X317318[4X[32X Example [32X[104X319[4X[25Xgap>[125X [27XZZ := HomalgRingOfIntegers( );[127X[104X320[4X[28XZ[128X[104X321[4X[25Xgap>[125X [27XA := HomalgMatrix( "[ 2 ]", ZZ );[127X[104X322[4X[28X<A 1 x 1 matrix over an internal ring>[128X[104X323[4X[25Xgap>[125X [27XZ2 := ZZ / 2;[127X[104X324[4X[28XZ/( 2 )[128X[104X325[4X[25Xgap>[125X [27XA := Z2 * A;[127X[104X326[4X[28X<A 1 x 1 matrix over a residue class ring>[128X[104X327[4X[25Xgap>[125X [27XDisplay( A );[127X[104X328[4X[28X[ [ 2 ] ][128X[104X329[4X[28X[128X[104X330[4X[28Xmodulo [ 2 ][128X[104X331[4X[25Xgap>[125X [27XIsZero( A );[127X[104X332[4X[28Xtrue[128X[104X333[4X[32X[104X334335[1X5.3-2 IsOne[101X336337[29X[2XIsOne[102X( [3XA[103X ) [32X property338[6XReturns:[106X [33X[0;10Y[10Xtrue[110X or [10Xfalse[110X[133X339340[33X[0;0YCheck if the [5Xhomalg[105X matrix [3XA[103X is an identity matrix, taking possible ring341relations into account.[133X342343[33X[0;0Y(for the installed standard method see [2XIsIdentityMatrix[102X ([14XB.2-2[114X))[133X344345[1X5.3-3 IsUnitFree[101X346347[29X[2XIsUnitFree[102X( [3XA[103X ) [32X property348[6XReturns:[106X [33X[0;10Y[10Xtrue[110X or [10Xfalse[110X[133X349350[33X[0;0Y[3XA[103X is a [5Xhomalg[105X matrix.[133X351352[1X5.3-4 IsPermutationMatrix[101X353354[29X[2XIsPermutationMatrix[102X( [3XA[103X ) [32X property355[6XReturns:[106X [33X[0;10Y[10Xtrue[110X or [10Xfalse[110X[133X356357[33X[0;0Y[3XA[103X is a [5Xhomalg[105X matrix.[133X358359[1X5.3-5 IsSpecialSubidentityMatrix[101X360361[29X[2XIsSpecialSubidentityMatrix[102X( [3XA[103X ) [32X property362[6XReturns:[106X [33X[0;10Y[10Xtrue[110X or [10Xfalse[110X[133X363364[33X[0;0Y[3XA[103X is a [5Xhomalg[105X matrix.[133X365366[1X5.3-6 IsSubidentityMatrix[101X367368[29X[2XIsSubidentityMatrix[102X( [3XA[103X ) [32X property369[6XReturns:[106X [33X[0;10Y[10Xtrue[110X or [10Xfalse[110X[133X370371[33X[0;0Y[3XA[103X is a [5Xhomalg[105X matrix.[133X372373[1X5.3-7 IsLeftRegular[101X374375[29X[2XIsLeftRegular[102X( [3XA[103X ) [32X property376[6XReturns:[106X [33X[0;10Y[10Xtrue[110X or [10Xfalse[110X[133X377378[33X[0;0Y[3XA[103X is a [5Xhomalg[105X matrix.[133X379380[1X5.3-8 IsRightRegular[101X381382[29X[2XIsRightRegular[102X( [3XA[103X ) [32X property383[6XReturns:[106X [33X[0;10Y[10Xtrue[110X or [10Xfalse[110X[133X384385[33X[0;0Y[3XA[103X is a [5Xhomalg[105X matrix.[133X386387[1X5.3-9 IsInvertibleMatrix[101X388389[29X[2XIsInvertibleMatrix[102X( [3XA[103X ) [32X property390[6XReturns:[106X [33X[0;10Y[10Xtrue[110X or [10Xfalse[110X[133X391392[33X[0;0Y[3XA[103X is a [5Xhomalg[105X matrix.[133X393394[1X5.3-10 IsLeftInvertibleMatrix[101X395396[29X[2XIsLeftInvertibleMatrix[102X( [3XA[103X ) [32X property397[6XReturns:[106X [33X[0;10Y[10Xtrue[110X or [10Xfalse[110X[133X398399[33X[0;0Y[3XA[103X is a [5Xhomalg[105X matrix.[133X400401[1X5.3-11 IsRightInvertibleMatrix[101X402403[29X[2XIsRightInvertibleMatrix[102X( [3XA[103X ) [32X property404[6XReturns:[106X [33X[0;10Y[10Xtrue[110X or [10Xfalse[110X[133X405406[33X[0;0Y[3XA[103X is a [5Xhomalg[105X matrix.[133X407408[1X5.3-12 IsEmptyMatrix[101X409410[29X[2XIsEmptyMatrix[102X( [3XA[103X ) [32X property411[6XReturns:[106X [33X[0;10Y[10Xtrue[110X or [10Xfalse[110X[133X412413[33X[0;0Y[3XA[103X is a [5Xhomalg[105X matrix.[133X414415[1X5.3-13 IsDiagonalMatrix[101X416417[29X[2XIsDiagonalMatrix[102X( [3XA[103X ) [32X property418[6XReturns:[106X [33X[0;10Y[10Xtrue[110X or [10Xfalse[110X[133X419420[33X[0;0YCheck if the [5Xhomalg[105X matrix [3XA[103X is an identity matrix, taking possible ring421relations into account.[133X422423[33X[0;0Y(for the installed standard method see [2XIsDiagonalMatrix[102X ([14XB.2-3[114X))[133X424425[1X5.3-14 IsScalarlMatrix[101X426427[29X[2XIsScalarlMatrix[102X( [3XA[103X ) [32X property428[6XReturns:[106X [33X[0;10Y[10Xtrue[110X or [10Xfalse[110X[133X429430[33X[0;0Y[3XA[103X is a [5Xhomalg[105X matrix.[133X431432[1X5.3-15 IsUpperTriangularMatrix[101X433434[29X[2XIsUpperTriangularMatrix[102X( [3XA[103X ) [32X property435[6XReturns:[106X [33X[0;10Y[10Xtrue[110X or [10Xfalse[110X[133X436437[33X[0;0Y[3XA[103X is a [5Xhomalg[105X matrix.[133X438439[1X5.3-16 IsLowerTriangularMatrix[101X440441[29X[2XIsLowerTriangularMatrix[102X( [3XA[103X ) [32X property442[6XReturns:[106X [33X[0;10Y[10Xtrue[110X or [10Xfalse[110X[133X443444[33X[0;0Y[3XA[103X is a [5Xhomalg[105X matrix.[133X445446[1X5.3-17 IsStrictUpperTriangularMatrix[101X447448[29X[2XIsStrictUpperTriangularMatrix[102X( [3XA[103X ) [32X property449[6XReturns:[106X [33X[0;10Y[10Xtrue[110X or [10Xfalse[110X[133X450451[33X[0;0Y[3XA[103X is a [5Xhomalg[105X matrix.[133X452453[1X5.3-18 IsStrictLowerTriangularMatrix[101X454455[29X[2XIsStrictLowerTriangularMatrix[102X( [3XA[103X ) [32X property456[6XReturns:[106X [33X[0;10Y[10Xtrue[110X or [10Xfalse[110X[133X457458[33X[0;0Y[3XA[103X is a [5Xhomalg[105X matrix.[133X459460[1X5.3-19 IsUpperStairCaseMatrix[101X461462[29X[2XIsUpperStairCaseMatrix[102X( [3XA[103X ) [32X property463[6XReturns:[106X [33X[0;10Y[10Xtrue[110X or [10Xfalse[110X[133X464465[33X[0;0Y[3XA[103X is a [5Xhomalg[105X matrix.[133X466467[1X5.3-20 IsLowerStairCaseMatrix[101X468469[29X[2XIsLowerStairCaseMatrix[102X( [3XA[103X ) [32X property470[6XReturns:[106X [33X[0;10Y[10Xtrue[110X or [10Xfalse[110X[133X471472[33X[0;0Y[3XA[103X is a [5Xhomalg[105X matrix.[133X473474[1X5.3-21 IsTriangularMatrix[101X475476[29X[2XIsTriangularMatrix[102X( [3XA[103X ) [32X property477[6XReturns:[106X [33X[0;10Y[10Xtrue[110X or [10Xfalse[110X[133X478479[33X[0;0Y[3XA[103X is a [5Xhomalg[105X matrix.[133X480481[1X5.3-22 IsBasisOfRowsMatrix[101X482483[29X[2XIsBasisOfRowsMatrix[102X( [3XA[103X ) [32X property484[6XReturns:[106X [33X[0;10Y[10Xtrue[110X or [10Xfalse[110X[133X485486[33X[0;0Y[3XA[103X is a [5Xhomalg[105X matrix.[133X487488[1X5.3-23 IsBasisOfColumnsMatrix[101X489490[29X[2XIsBasisOfColumnsMatrix[102X( [3XA[103X ) [32X property491[6XReturns:[106X [33X[0;10Y[10Xtrue[110X or [10Xfalse[110X[133X492493[33X[0;0Y[3XA[103X is a [5Xhomalg[105X matrix.[133X494495[1X5.3-24 IsReducedBasisOfRowsMatrix[101X496497[29X[2XIsReducedBasisOfRowsMatrix[102X( [3XA[103X ) [32X property498[6XReturns:[106X [33X[0;10Y[10Xtrue[110X or [10Xfalse[110X[133X499500[33X[0;0Y[3XA[103X is a [5Xhomalg[105X matrix.[133X501502[1X5.3-25 IsReducedBasisOfColumnsMatrix[101X503504[29X[2XIsReducedBasisOfColumnsMatrix[102X( [3XA[103X ) [32X property505[6XReturns:[106X [33X[0;10Y[10Xtrue[110X or [10Xfalse[110X[133X506507[33X[0;0Y[3XA[103X is a [5Xhomalg[105X matrix.[133X508509[1X5.3-26 IsInitialMatrix[101X510511[29X[2XIsInitialMatrix[102X( [3XA[103X ) [32X property512[6XReturns:[106X [33X[0;10Y[10Xtrue[110X or [10Xfalse[110X[133X513514[33X[0;0Y[3XA[103X is a [5Xhomalg[105X matrix.[133X515516[1X5.3-27 IsInitialIdentityMatrix[101X517518[29X[2XIsInitialIdentityMatrix[102X( [3XA[103X ) [32X property519[6XReturns:[106X [33X[0;10Y[10Xtrue[110X or [10Xfalse[110X[133X520521[33X[0;0Y[3XA[103X is a [5Xhomalg[105X matrix.[133X522523[1X5.3-28 IsVoidMatrix[101X524525[29X[2XIsVoidMatrix[102X( [3XA[103X ) [32X property526[6XReturns:[106X [33X[0;10Y[10Xtrue[110X or [10Xfalse[110X[133X527528[33X[0;0Y[3XA[103X is a [5Xhomalg[105X matrix.[133X529530531[1X5.4 [33X[0;0YMatrices: Attributes[133X[101X532533[1X5.4-1 NrRows[101X534535[29X[2XNrRows[102X( [3XA[103X ) [32X attribute536[6XReturns:[106X [33X[0;10Ya nonnegative integer[133X537538[33X[0;0YThe number of rows of the matrix [3XA[103X.[133X539540[33X[0;0Y(for the installed standard method see [2XNrRows[102X ([14XB.1-17[114X))[133X541542[1X5.4-2 NrColumns[101X543544[29X[2XNrColumns[102X( [3XA[103X ) [32X attribute545[6XReturns:[106X [33X[0;10Ya nonnegative integer[133X546547[33X[0;0YThe number of columns of the matrix [3XA[103X.[133X548549[33X[0;0Y(for the installed standard method see [2XNrColumns[102X ([14XB.1-18[114X))[133X550551[1X5.4-3 DeterminantMat[101X552553[29X[2XDeterminantMat[102X( [3XA[103X ) [32X attribute554[6XReturns:[106X [33X[0;10Ya ring element[133X555556[33X[0;0YThe determinant of the quadratic matrix [3XA[103X.[133X557558[33X[0;0YYou can invoke it with [10XDeterminant[110X( [3XA[103X ).[133X559560[33X[0;0Y(for the installed standard method see [2XDeterminant[102X ([14XB.1-19[114X))[133X561562[1X5.4-4 ZeroRows[101X563564[29X[2XZeroRows[102X( [3XA[103X ) [32X attribute565[6XReturns:[106X [33X[0;10Ya (possibly empty) list of positive integers[133X566567[33X[0;0YThe list of zero rows of the matrix [3XA[103X.[133X568569[33X[0;0Y(for the installed standard method see [2XZeroRows[102X ([14XB.2-4[114X))[133X570571[1X5.4-5 ZeroColumns[101X572573[29X[2XZeroColumns[102X( [3XA[103X ) [32X attribute574[6XReturns:[106X [33X[0;10Ya (possibly empty) list of positive integers[133X575576[33X[0;0YThe list of zero columns of the matrix [3XA[103X.[133X577578[33X[0;0Y(for the installed standard method see [2XZeroColumns[102X ([14XB.2-5[114X))[133X579580[1X5.4-6 NonZeroRows[101X581582[29X[2XNonZeroRows[102X( [3XA[103X ) [32X attribute583[6XReturns:[106X [33X[0;10Ya (possibly empty) list of positive integers[133X584585[33X[0;0YThe list of nonzero rows of the matrix [3XA[103X.[133X586587[1X5.4-7 NonZeroColumns[101X588589[29X[2XNonZeroColumns[102X( [3XA[103X ) [32X attribute590[6XReturns:[106X [33X[0;10Ya (possibly empty) list of positive integers[133X591592[33X[0;0YThe list of nonzero columns of the matrix [3XA[103X.[133X593594[1X5.4-8 PositionOfFirstNonZeroEntryPerRow[101X595596[29X[2XPositionOfFirstNonZeroEntryPerRow[102X( [3XA[103X ) [32X attribute597[6XReturns:[106X [33X[0;10Ya list of nonnegative integers[133X598599[33X[0;0YThe list of positions of the first nonzero entry per row of the matrix [3XA[103X,600else zero.[133X601602[1X5.4-9 PositionOfFirstNonZeroEntryPerColumn[101X603604[29X[2XPositionOfFirstNonZeroEntryPerColumn[102X( [3XA[103X ) [32X attribute605[6XReturns:[106X [33X[0;10Ya list of nonnegative integers[133X606607[33X[0;0YThe list of positions of the first nonzero entry per column of the matrix [3XA[103X,608else zero.[133X609610[1X5.4-10 RowRankOfMatrix[101X611612[29X[2XRowRankOfMatrix[102X( [3XA[103X ) [32X attribute613[6XReturns:[106X [33X[0;10Ya nonnegative integer[133X614615[33X[0;0YThe row rank of the matrix [3XA[103X.[133X616617[1X5.4-11 ColumnRankOfMatrix[101X618619[29X[2XColumnRankOfMatrix[102X( [3XA[103X ) [32X attribute620[6XReturns:[106X [33X[0;10Ya nonnegative integer[133X621622[33X[0;0YThe column rank of the matrix [3XA[103X.[133X623624[1X5.4-12 LeftInverse[101X625626[29X[2XLeftInverse[102X( [3XM[103X ) [32X attribute627[6XReturns:[106X [33X[0;10Ya [5Xhomalg[105X matrix[133X628629[33X[0;0YA left inverse [22XC[122X of the matrix [3XM[103X. If no left inverse exists then [10Xfalse[110X is630returned. (--> [2XRightDivide[102X ([14X5.5-45[114X))[133X631632[33X[0;0Y(for the installed standard method see [2XLeftInverse[102X ([14X5.5-2[114X))[133X633634[1X5.4-13 RightInverse[101X635636[29X[2XRightInverse[102X( [3XM[103X ) [32X attribute637[6XReturns:[106X [33X[0;10Ya [5Xhomalg[105X matrix[133X638639[33X[0;0YA right inverse [22XC[122X of the matrix [3XM[103X. If no right inverse exists then [10Xfalse[110X is640returned. (--> [2XLeftDivide[102X ([14X5.5-46[114X))[133X641642[33X[0;0Y(for the installed standard method see [2XRightInverse[102X ([14X5.5-3[114X))[133X643644[1X5.4-14 CoefficientsOfUnreducedNumeratorOfHilbertPoincareSeries[101X645646[29X[2XCoefficientsOfUnreducedNumeratorOfHilbertPoincareSeries[102X( [3XA[103X ) [32X attribute647[6XReturns:[106X [33X[0;10Ya list of integers[133X648649[33X[0;0Y[3XA[103X is a [5Xhomalg[105X matrix (row convention).[133X650651[1X5.4-15 CoefficientsOfNumeratorOfHilbertPoincareSeries[101X652653[29X[2XCoefficientsOfNumeratorOfHilbertPoincareSeries[102X( [3XA[103X ) [32X attribute654[6XReturns:[106X [33X[0;10Ya list of integers[133X655656[33X[0;0Y[3XA[103X is a [5Xhomalg[105X matrix (row convention).[133X657658[1X5.4-16 UnreducedNumeratorOfHilbertPoincareSeries[101X659660[29X[2XUnreducedNumeratorOfHilbertPoincareSeries[102X( [3XA[103X ) [32X attribute661[6XReturns:[106X [33X[0;10Ya univariate polynomial with rational coefficients[133X662663[33X[0;0Y[3XA[103X is a [5Xhomalg[105X matrix (row convention).[133X664665[1X5.4-17 NumeratorOfHilbertPoincareSeries[101X666667[29X[2XNumeratorOfHilbertPoincareSeries[102X( [3XA[103X ) [32X attribute668[6XReturns:[106X [33X[0;10Ya univariate polynomial with rational coefficients[133X669670[33X[0;0Y[3XA[103X is a [5Xhomalg[105X matrix (row convention).[133X671672[1X5.4-18 HilbertPoincareSeries[101X673674[29X[2XHilbertPoincareSeries[102X( [3XA[103X ) [32X attribute675[6XReturns:[106X [33X[0;10Ya univariate rational function with rational coefficients[133X676677[33X[0;0Y[3XA[103X is a [5Xhomalg[105X matrix (row convention).[133X678679[1X5.4-19 HilbertPolynomial[101X680681[29X[2XHilbertPolynomial[102X( [3XA[103X ) [32X attribute682[6XReturns:[106X [33X[0;10Ya univariate polynomial with rational coefficients[133X683684[33X[0;0Y[3XA[103X is a [5Xhomalg[105X matrix (row convention).[133X685686[1X5.4-20 AffineDimension[101X687688[29X[2XAffineDimension[102X( [3XA[103X ) [32X attribute689[6XReturns:[106X [33X[0;10Ya nonnegative integer[133X690691[33X[0;0Y[3XA[103X is a [5Xhomalg[105X matrix (row convention).[133X692693[1X5.4-21 AffineDegree[101X694695[29X[2XAffineDegree[102X( [3XA[103X ) [32X attribute696[6XReturns:[106X [33X[0;10Ya nonnegative integer[133X697698[33X[0;0Y[3XA[103X is a [5Xhomalg[105X matrix (row convention).[133X699700[1X5.4-22 ProjectiveDegree[101X701702[29X[2XProjectiveDegree[102X( [3XA[103X ) [32X attribute703[6XReturns:[106X [33X[0;10Ya nonnegative integer[133X704705[33X[0;0Y[3XA[103X is a [5Xhomalg[105X matrix (row convention).[133X706707[1X5.4-23 ConstantTermOfHilbertPolynomialn[101X708709[29X[2XConstantTermOfHilbertPolynomialn[102X( [3XA[103X ) [32X attribute710[6XReturns:[106X [33X[0;10Yan integer[133X711712[33X[0;0Y[3XA[103X is a [5Xhomalg[105X matrix (row convention).[133X713714[1X5.4-24 MatrixOfSymbols[101X715716[29X[2XMatrixOfSymbols[102X( [3XA[103X ) [32X attribute717[6XReturns:[106X [33X[0;10Yan integer[133X718719[33X[0;0Y[3XA[103X is a [5Xhomalg[105X matrix.[133X720721722[1X5.5 [33X[0;0YMatrices: Operations and Functions[133X[101X723724[1X5.5-1 HomalgRing[101X725726[29X[2XHomalgRing[102X( [3Xmat[103X ) [32X operation727[6XReturns:[106X [33X[0;10Ya [5Xhomalg[105X ring[133X728729[33X[0;0YThe [5Xhomalg[105X ring of the [5Xhomalg[105X matrix [3Xmat[103X.[133X730731[4X[32X Example [32X[104X732[4X[25Xgap>[125X [27XZZ := HomalgRingOfIntegers( );[127X[104X733[4X[28XZ[128X[104X734[4X[25Xgap>[125X [27Xd := HomalgDiagonalMatrix( [ 2 .. 4 ], ZZ );[127X[104X735[4X[28X<An unevaluated diagonal 3 x 3 matrix over an internal ring>[128X[104X736[4X[25Xgap>[125X [27XR := HomalgRing( d );[127X[104X737[4X[28XZ[128X[104X738[4X[25Xgap>[125X [27XIsIdenticalObj( R, ZZ );[127X[104X739[4X[28Xtrue[128X[104X740[4X[32X[104X741742[1X5.5-2 LeftInverse[101X743744[29X[2XLeftInverse[102X( [3XRI[103X ) [32X method745[6XReturns:[106X [33X[0;10Ya [5Xhomalg[105X matrix or fail[133X746747[33X[0;0YThe left inverse of the matrix [3XRI[103X. The lazy version of this operation is748[2XLeftInverseLazy[102X ([14X5.5-4[114X). (--> [2XRightDivide[102X ([14X5.5-45[114X))[133X749750[4X[32X Code [32X[104X751[4XInstallMethod( LeftInverse,[104X752[4X "for homalg matrices",[104X753[4X [ IsHomalgMatrix ],[104X754[4X [104X755[4X function( RI )[104X756[4X local Id, LI;[104X757[4X [104X758[4X Id := HomalgIdentityMatrix( NrColumns( RI ), HomalgRing( RI ) );[104X759[4X [104X760[4X LI := RightDivide( Id, RI ); ## ( cf. [BR08, Subsection 3.1.3] )[104X761[4X [104X762[4X ## CAUTION: for the following SetXXX RightDivide is assumed[104X763[4X ## NOT to be lazy evaluated!!![104X764[4X [104X765[4X SetIsLeftInvertibleMatrix( RI, IsHomalgMatrix( LI ) );[104X766[4X [104X767[4X if IsBool( LI ) then[104X768[4X return fail;[104X769[4X fi;[104X770[4X [104X771[4X if HasIsInvertibleMatrix( RI ) and IsInvertibleMatrix( RI ) then[104X772[4X SetIsInvertibleMatrix( LI, true );[104X773[4X else[104X774[4X SetIsRightInvertibleMatrix( LI, true );[104X775[4X fi;[104X776[4X [104X777[4X SetRightInverse( LI, RI );[104X778[4X [104X779[4X SetNrColumns( LI, NrRows( RI ) );[104X780[4X [104X781[4X if NrRows( RI ) = NrColumns( RI ) then[104X782[4X ## a left inverse of a ring element is unique[104X783[4X ## and coincides with the right inverse[104X784[4X SetRightInverse( RI, LI );[104X785[4X SetLeftInverse( LI, RI );[104X786[4X fi;[104X787[4X [104X788[4X return LI;[104X789[4X [104X790[4Xend );[104X791[4X[32X[104X792793[1X5.5-3 RightInverse[101X794795[29X[2XRightInverse[102X( [3XLI[103X ) [32X method796[6XReturns:[106X [33X[0;10Ya [5Xhomalg[105X matrix or fail[133X797798[33X[0;0YThe right inverse of the matrix [3XLI[103X. The lazy version of this operation is799[2XRightInverseLazy[102X ([14X5.5-5[114X). (--> [2XLeftDivide[102X ([14X5.5-46[114X))[133X800801[4X[32X Code [32X[104X802[4XInstallMethod( RightInverse,[104X803[4X "for homalg matrices",[104X804[4X [ IsHomalgMatrix ],[104X805[4X [104X806[4X function( LI )[104X807[4X local Id, RI;[104X808[4X [104X809[4X Id := HomalgIdentityMatrix( NrRows( LI ), HomalgRing( LI ) );[104X810[4X [104X811[4X RI := LeftDivide( LI, Id ); ## ( cf. [BR08, Subsection 3.1.3] )[104X812[4X [104X813[4X ## CAUTION: for the following SetXXX LeftDivide is assumed[104X814[4X ## NOT to be lazy evaluated!!![104X815[4X [104X816[4X SetIsRightInvertibleMatrix( LI, IsHomalgMatrix( RI ) );[104X817[4X [104X818[4X if IsBool( RI ) then[104X819[4X return fail;[104X820[4X fi;[104X821[4X [104X822[4X if HasIsInvertibleMatrix( LI ) and IsInvertibleMatrix( LI ) then[104X823[4X SetIsInvertibleMatrix( RI, true );[104X824[4X else[104X825[4X SetIsLeftInvertibleMatrix( RI, true );[104X826[4X fi;[104X827[4X [104X828[4X SetLeftInverse( RI, LI );[104X829[4X [104X830[4X SetNrRows( RI, NrColumns( LI ) );[104X831[4X [104X832[4X if NrRows( LI ) = NrColumns( LI ) then[104X833[4X ## a right inverse of a ring element is unique[104X834[4X ## and coincides with the left inverse[104X835[4X SetLeftInverse( LI, RI );[104X836[4X SetRightInverse( RI, LI );[104X837[4X fi;[104X838[4X [104X839[4X return RI;[104X840[4X [104X841[4Xend );[104X842[4X[32X[104X843844[1X5.5-4 LeftInverseLazy[101X845846[29X[2XLeftInverseLazy[102X( [3XM[103X ) [32X operation847[6XReturns:[106X [33X[0;10Ya [5Xhomalg[105X matrix[133X848849[33X[0;0YA lazy evaluated left inverse [22XC[122X of the matrix [3XM[103X. If no left inverse exists850then [10XEval[110X( [3XC[103X ) will issue an error.[133X851852[33X[0;0Y(for the installed standard method see [2XEval[102X ([14XC.4-5[114X))[133X853854[1X5.5-5 RightInverseLazy[101X855856[29X[2XRightInverseLazy[102X( [3XM[103X ) [32X operation857[6XReturns:[106X [33X[0;10Ya [5Xhomalg[105X matrix[133X858859[33X[0;0YA lazy evaluated right inverse [22XC[122X of the matrix [3XM[103X. If no right inverse exists860then [10XEval[110X( [3XC[103X ) will issue an error.[133X861862[33X[0;0Y(for the installed standard method see [2XEval[102X ([14XC.4-6[114X))[133X863864[1X5.5-6 Involution[101X865866[29X[2XInvolution[102X( [3XM[103X ) [32X method867[6XReturns:[106X [33X[0;10Ya [5Xhomalg[105X matrix[133X868869[33X[0;0YThe twisted transpose of the [5Xhomalg[105X matrix [3XM[103X.[133X870871[33X[0;0Y(for the installed standard method see [2XEval[102X ([14XC.4-7[114X))[133X872873[1X5.5-7 CertainRows[101X874875[29X[2XCertainRows[102X( [3XM[103X, [3Xplist[103X ) [32X method876[6XReturns:[106X [33X[0;10Ya [5Xhomalg[105X matrix[133X877878[33X[0;0YThe matrix of which the [22Xi[122X-th row is the [22Xk[122X-th row of the [5Xhomalg[105X matrix [3XM[103X,879where [22Xk=[122X[3Xplist[103X[22X[i][122X.[133X880881[33X[0;0Y(for the installed standard method see [2XEval[102X ([14XC.4-8[114X))[133X882883[1X5.5-8 CertainColumns[101X884885[29X[2XCertainColumns[102X( [3XM[103X, [3Xplist[103X ) [32X method886[6XReturns:[106X [33X[0;10Ya [5Xhomalg[105X matrix[133X887888[33X[0;0YThe matrix of which the [22Xj[122X-th column is the [22Xl[122X-th column of the [5Xhomalg[105X matrix889[3XM[103X, where [22Xl=[122X[3Xplist[103X[22X[i][122X.[133X890891[33X[0;0Y(for the installed standard method see [2XEval[102X ([14XC.4-9[114X))[133X892893[1X5.5-9 UnionOfRows[101X894895[29X[2XUnionOfRows[102X( [3XA[103X, [3XB[103X ) [32X method896[6XReturns:[106X [33X[0;10Ya [5Xhomalg[105X matrix[133X897898[33X[0;0YStack the two [5Xhomalg[105X matrices [3XA[103X and [3XB[103X.[133X899900[33X[0;0Y(for the installed standard method see [2XEval[102X ([14XC.4-10[114X))[133X901902[1X5.5-10 UnionOfColumns[101X903904[29X[2XUnionOfColumns[102X( [3XA[103X, [3XB[103X ) [32X method905[6XReturns:[106X [33X[0;10Ya [5Xhomalg[105X matrix[133X906907[33X[0;0YAugment the two [5Xhomalg[105X matrices [3XA[103X and [3XB[103X.[133X908909[33X[0;0Y(for the installed standard method see [2XEval[102X ([14XC.4-11[114X))[133X910911[1X5.5-11 DiagMat[101X912913[29X[2XDiagMat[102X( [3Xlist[103X ) [32X method914[6XReturns:[106X [33X[0;10Ya [5Xhomalg[105X matrix[133X915916[33X[0;0YBuild the block diagonal matrix out of the [5Xhomalg[105X matrices listed in [3Xlist[103X.917An error is issued if [3Xlist[103X is empty or if one of the arguments is not a918[5Xhomalg[105X matrix.[133X919920[33X[0;0Y(for the installed standard method see [2XEval[102X ([14XC.4-12[114X))[133X921922[1X5.5-12 KroneckerMat[101X923924[29X[2XKroneckerMat[102X( [3XA[103X, [3XB[103X ) [32X method925[6XReturns:[106X [33X[0;10Ya [5Xhomalg[105X matrix[133X926927[33X[0;0YThe Kronecker (or tensor) product of the two [5Xhomalg[105X matrices [3XA[103X and [3XB[103X.[133X928929[33X[0;0Y(for the installed standard method see [2XEval[102X ([14XC.4-13[114X))[133X930931[1X5.5-13 \*[101X932933[29X[2X\*[102X( [3Xa[103X, [3XA[103X ) [32X method934[6XReturns:[106X [33X[0;10Ya [5Xhomalg[105X matrix[133X935936[33X[0;0YThe product of the ring element [3Xa[103X with the [5Xhomalg[105X matrix [3XA[103X (enter: [3Xa[103X [10X*[110X [3XA[103X;).[133X937938[33X[0;0Y(for the installed standard method see [2XEval[102X ([14XC.4-14[114X))[133X939940[1X5.5-14 \+[101X941942[29X[2X\+[102X( [3XA[103X, [3XB[103X ) [32X method943[6XReturns:[106X [33X[0;10Ya [5Xhomalg[105X matrix[133X944945[33X[0;0YThe sum of the two [5Xhomalg[105X matrices [3XA[103X and [3XB[103X (enter: [3XA[103X [10X+[110X [3XB[103X;).[133X946947[33X[0;0Y(for the installed standard method see [2XEval[102X ([14XC.4-15[114X))[133X948949[1X5.5-15 \-[101X950951[29X[2X\-[102X( [3XA[103X, [3XB[103X ) [32X method952[6XReturns:[106X [33X[0;10Ya [5Xhomalg[105X matrix[133X953954[33X[0;0YThe difference of the two [5Xhomalg[105X matrices [3XA[103X and [3XB[103X (enter: [3XA[103X [10X-[110X [3XB[103X;).[133X955956[33X[0;0Y(for the installed standard method see [2XEval[102X ([14XC.4-16[114X))[133X957958[1X5.5-16 \*[101X959960[29X[2X\*[102X( [3XA[103X, [3XB[103X ) [32X method961[6XReturns:[106X [33X[0;10Ya [5Xhomalg[105X matrix[133X962963[33X[0;0YThe matrix product of the two [5Xhomalg[105X matrices [3XA[103X and [3XB[103X (enter: [3XA[103X [10X*[110X [3XB[103X;).[133X964965[33X[0;0Y(for the installed standard method see [2XEval[102X ([14XC.4-17[114X))[133X966967[1X5.5-17 \=[101X968969[29X[2X\=[102X( [3XA[103X, [3XB[103X ) [32X operation970[6XReturns:[106X [33X[0;10Y[10Xtrue[110X or [10Xfalse[110X[133X971972[33X[0;0YCheck if the [5Xhomalg[105X matrices [3XA[103X and [3XB[103X are equal (enter: [3XA[103X [10X=[110X [3XB[103X;), taking973possible ring relations into account.[133X974975[33X[0;0Y(for the installed standard method see [2XAreEqualMatrices[102X ([14XB.2-1[114X))[133X976977[4X[32X Example [32X[104X978[4X[25Xgap>[125X [27XZZ := HomalgRingOfIntegers( );[127X[104X979[4X[28XZ[128X[104X980[4X[25Xgap>[125X [27XA := HomalgMatrix( "[ 1 ]", ZZ );[127X[104X981[4X[28X<A 1 x 1 matrix over an internal ring>[128X[104X982[4X[25Xgap>[125X [27XB := HomalgMatrix( "[ 3 ]", ZZ );[127X[104X983[4X[28X<A 1 x 1 matrix over an internal ring>[128X[104X984[4X[25Xgap>[125X [27XZ2 := ZZ / 2;[127X[104X985[4X[28XZ/( 2 )[128X[104X986[4X[25Xgap>[125X [27XA := Z2 * A;[127X[104X987[4X[28X<A 1 x 1 matrix over a residue class ring>[128X[104X988[4X[25Xgap>[125X [27XB := Z2 * B;[127X[104X989[4X[28X<A 1 x 1 matrix over a residue class ring>[128X[104X990[4X[25Xgap>[125X [27XDisplay( A );[127X[104X991[4X[28X[ [ 1 ] ][128X[104X992[4X[28X[128X[104X993[4X[28Xmodulo [ 2 ][128X[104X994[4X[25Xgap>[125X [27XDisplay( B );[127X[104X995[4X[28X[ [ 3 ] ][128X[104X996[4X[28X[128X[104X997[4X[28Xmodulo [ 2 ][128X[104X998[4X[25Xgap>[125X [27XA = B;[127X[104X999[4X[28Xtrue[128X[104X1000[4X[32X[104X10011002[1X5.5-18 GetColumnIndependentUnitPositions[101X10031004[29X[2XGetColumnIndependentUnitPositions[102X( [3XA[103X, [3Xposlist[103X ) [32X operation1005[6XReturns:[106X [33X[0;10Ya (possibly empty) list of pairs of positive integers[133X10061007[33X[0;0YThe list of column independet unit position of the matrix [3XA[103X. We say that a1008unit [3XA[103X[22X[i,k][122X is column independet from the unit [3XA[103X[22X[l,j][122X if [22Xi>l[122X and [3XA[103X[22X[l,k]=0[122X.1009The rows are scanned from top to bottom and within each row the columns are1010scanned from right to left searching for new units, column independent from1011the preceding ones. If [3XA[103X[22X[i,k][122X is a new column independent unit then [22X[i,k][122X is1012added to the output list. If [3XA[103X has no units the empty list is returned.[133X10131014[33X[0;0Y(for the installed standard method see [2XGetColumnIndependentUnitPositions[102X1015([14XB.2-6[114X))[133X10161017[1X5.5-19 GetRowIndependentUnitPositions[101X10181019[29X[2XGetRowIndependentUnitPositions[102X( [3XA[103X, [3Xposlist[103X ) [32X operation1020[6XReturns:[106X [33X[0;10Ya (possibly empty) list of pairs of positive integers[133X10211022[33X[0;0YThe list of row independet unit position of the matrix [3XA[103X. We say that a unit1023[3XA[103X[22X[k,j][122X is row independet from the unit [3XA[103X[22X[i,l][122X if [22Xj>l[122X and [3XA[103X[22X[k,l]=0[122X. The1024columns are scanned from left to right and within each column the rows are1025scanned from bottom to top searching for new units, row independent from the1026preceding ones. If [3XA[103X[22X[k,j][122X is a new row independent unit then [22X[j,k][122X (yes1027[22X[j,k][122X) is added to the output list. If [3XA[103X has no units the empty list is1028returned.[133X10291030[33X[0;0Y(for the installed standard method see [2XGetRowIndependentUnitPositions[102X1031([14XB.2-7[114X))[133X10321033[1X5.5-20 GetUnitPosition[101X10341035[29X[2XGetUnitPosition[102X( [3XA[103X, [3Xposlist[103X ) [32X operation1036[6XReturns:[106X [33X[0;10Ya (possibly empty) list of pairs of positive integers[133X10371038[33X[0;0YThe position [22X[i,j][122X of the first unit [3XA[103X[22X[i,j][122X in the matrix [3XA[103X, where the rows1039are scanned from top to bottom and within each row the columns are scanned1040from left to right. If [3XA[103X[22X[i,j][122X is the first occurrence of a unit then the1041position pair [22X[i,j][122X is returned. Otherwise [10Xfail[110X is returned.[133X10421043[33X[0;0Y(for the installed standard method see [2XGetUnitPosition[102X ([14XB.2-8[114X))[133X10441045[1X5.5-21 Eliminate[101X10461047[29X[2XEliminate[102X( [3Xrel[103X, [3Xindets[103X ) [32X operation1048[6XReturns:[106X [33X[0;10Ya [5Xhomalg[105X matrix[133X10491050[33X[0;0YEliminate the independents [3Xindets[103X from the matrix (or list of ring elements)1051[3Xrel[103X, i.e. compute a generating set of the ideal defined as the intersection1052of the ideal generated by the entries of the list [3Xrel[103X with the subring1053generated by all indeterminates except those in [3Xindets[103X. by the list of1054indeterminates [3Xindets[103X.[133X10551056[1X5.5-22 BasisOfRowModule[101X10571058[29X[2XBasisOfRowModule[102X( [3XM[103X ) [32X operation1059[6XReturns:[106X [33X[0;10Ya [5Xhomalg[105X matrix[133X10601061[33X[0;0YLet [22XR[122X be the ring over which [3XM[103X is defined ([22XR:=[122X[10XHomalgRing[110X( [3XM[103X )) and [22XS[122X be the1062row span of [3XM[103X, i.e. the [22XR[122X-submodule of the free module [22XR^(1 × NrColumns( [3XM[103X1063))[122X spanned by the rows of [3XM[103X. A solution to the [21Xsubmodule membership problem[121X1064is an algorithm which can decide if an element [22Xm[122X in [22XR^(1 × NrColumns( [3XM[103X ))[122X1065is contained in [22XS[122X or not. And exactly like the Gaussian (resp. Hermite)1066normal form when [22XR[122X is a field (resp. principal ideal ring), the row span of1067the resulting matrix [22XB[122X coincides with the row span [22XS[122X of [3XM[103X, and computing [22XB[122X1068is typically the first step of such an algorithm. (--> Appendix [14XA[114X)[133X10691070[1X5.5-23 BasisOfColumnModule[101X10711072[29X[2XBasisOfColumnModule[102X( [3XM[103X ) [32X operation1073[6XReturns:[106X [33X[0;10Ya [5Xhomalg[105X matrix[133X10741075[33X[0;0YLet [22XR[122X be the ring over which [3XM[103X is defined ([22XR:=[122X[10XHomalgRing[110X( [3XM[103X )) and [22XS[122X be the1076column span of [3XM[103X, i.e. the [22XR[122X-submodule of the free module [22XR^(NrRows( [3XM[103X ) ×10771)[122X spanned by the columns of [3XM[103X. A solution to the [21Xsubmodule membership1078problem[121X is an algorithm which can decide if an element [22Xm[122X in [22XR^(NrRows( [3XM[103X ) ×10791)[122X is contained in [22XS[122X or not. And exactly like the Gaussian (resp. Hermite)1080normal form when [22XR[122X is a field (resp. principal ideal ring), the column span1081of the resulting matrix [22XB[122X coincides with the column span [22XS[122X of [3XM[103X, and1082computing [22XB[122X is typically the first step of such an algorithm. (--> Appendix1083[14XA[114X)[133X10841085[1X5.5-24 DecideZeroRows[101X10861087[29X[2XDecideZeroRows[102X( [3XA[103X, [3XB[103X ) [32X operation1088[6XReturns:[106X [33X[0;10Ya [5Xhomalg[105X matrix[133X10891090[33X[0;0YLet [3XA[103X and [3XB[103X be matrices having the same number of columns and defined over1091the same ring [22XR[122X ([22X:=[122X[10XHomalgRing[110X( [3XA[103X )) and [22XS[122X be the row span of [3XB[103X, i.e. the1092[22XR[122X-submodule of the free module [22XR^(1 × NrColumns( [3XB[103X ))[122X spanned by the rows of1093[3XB[103X. The result is a matrix [22XC[122X having the same shape as [3XA[103X, for which the [22Xi[122X-th1094row [22X[3XC[103X^i[122X is equivalent to the [22Xi[122X-th row [22X[3XA[103X^i[122X of [3XA[103X modulo [22XS[122X, i.e. [22X[3XC[103X^i-[3XA[103X^i[122X is an1095element of the row span [22XS[122X of [3XB[103X. Moreover, the row [22X[3XC[103X^i[122X is zero, if and only1096if the row [22X[3XA[103X^i[122X is an element of [22XS[122X. So [10XDecideZeroRows[110X decides which rows of [3XA[103X1097are zero modulo the rows of [3XB[103X. (--> Appendix [14XA[114X)[133X10981099[1X5.5-25 DecideZeroColumns[101X11001101[29X[2XDecideZeroColumns[102X( [3XA[103X, [3XB[103X ) [32X operation1102[6XReturns:[106X [33X[0;10Ya [5Xhomalg[105X matrix[133X11031104[33X[0;0YLet [3XA[103X and [3XB[103X be matrices having the same number of rows and defined over the1105same ring [22XR[122X ([22X:=[122X[10XHomalgRing[110X( [3XA[103X )) and [22XS[122X be the column span of [3XB[103X, i.e. the1106[22XR[122X-submodule of the free module [22XR^(NrRows( [3XB[103X ) × 1)[122X spanned by the columns of1107[3XB[103X. The result is a matrix [22XC[122X having the same shape as [3XA[103X, for which the [22Xi[122X-th1108column [22X[3XC[103X_i[122X is equivalent to the [22Xi[122X-th column [22X[3XA[103X_i[122X of [3XA[103X modulo [22XS[122X, i.e. [22X[3XC[103X_i-[3XA[103X_i[122X1109is an element of the column span [22XS[122X of [3XB[103X. Moreover, the column [22X[3XC[103X_i[122X is zero,1110if and only if the column [22X[3XA[103X_i[122X is an element of [22XS[122X. So [10XDecideZeroColumns[110X1111decides which columns of [3XA[103X are zero modulo the columns of [3XB[103X. (--> Appendix1112[14XA[114X)[133X11131114[1X5.5-26 SyzygiesGeneratorsOfRows[101X11151116[29X[2XSyzygiesGeneratorsOfRows[102X( [3XM[103X ) [32X operation1117[6XReturns:[106X [33X[0;10Ya [5Xhomalg[105X matrix[133X11181119[33X[0;0YLet [22XR[122X be the ring over which [3XM[103X is defined ([22XR:=[122X[10XHomalgRing[110X( [3XM[103X )). The matrix1120of row syzygies [10XSyzygiesGeneratorsOfRows[110X( [3XM[103X ) is a matrix whose rows span1121the left kernel of [3XM[103X, i.e. the [22XR[122X-submodule of the free module [22XR^(1 × NrRows(1122[3XM[103X ))[122X consisting of all rows [22XX[122X satisfying [22XX[3XM[103X=0[122X. (--> Appendix [14XA[114X)[133X11231124[1X5.5-27 SyzygiesGeneratorsOfColumns[101X11251126[29X[2XSyzygiesGeneratorsOfColumns[102X( [3XM[103X ) [32X operation1127[6XReturns:[106X [33X[0;10Ya [5Xhomalg[105X matrix[133X11281129[33X[0;0YLet [22XR[122X be the ring over which [3XM[103X is defined ([22XR:=[122X[10XHomalgRing[110X( [3XM[103X )). The matrix1130of column syzygies [10XSyzygiesGeneratorsOfColumns[110X( [3XM[103X ) is a matrix whose1131columns span the right kernel of [3XM[103X, i.e. the [22XR[122X-submodule of the free module1132[22XR^(NrColumns( [3XM[103X ) × 1)[122X consisting of all columns [22XX[122X satisfying [22X[3XM[103XX=0[122X. (-->1133Appendix [14XA[114X)[133X11341135[1X5.5-28 SyzygiesGeneratorsOfRows[101X11361137[29X[2XSyzygiesGeneratorsOfRows[102X( [3XM[103X, [3XM2[103X ) [32X operation1138[6XReturns:[106X [33X[0;10Ya [5Xhomalg[105X matrix[133X11391140[33X[0;0YLet [22XR[122X be the ring over which [3XM[103X is defined ([22XR:=[122X[10XHomalgRing[110X( [3XM[103X )). The matrix1141of [13Xrelative[113X row syzygies [10XSyzygiesGeneratorsOfRows[110X( [3XM[103X, [3XM2[103X ) is a matrix whose1142rows span the left kernel of [3XM[103X modulo [3XM2[103X, i.e. the [22XR[122X-submodule of the free1143module [22XR^(1 × NrRows( [3XM[103X ))[122X consisting of all rows [22XX[122X satisfying [22XX[3XM[103X+Y[3XM2[103X=0[122X for1144some row [22XY ∈ R^(1 × NrRows( [3XM2[103X ))[122X. (--> Appendix [14XA[114X)[133X11451146[1X5.5-29 SyzygiesGeneratorsOfColumns[101X11471148[29X[2XSyzygiesGeneratorsOfColumns[102X( [3XM[103X, [3XM2[103X ) [32X operation1149[6XReturns:[106X [33X[0;10Ya [5Xhomalg[105X matrix[133X11501151[33X[0;0YLet [22XR[122X be the ring over which [3XM[103X is defined ([22XR:=[122X[10XHomalgRing[110X( [3XM[103X )). The matrix1152of [13Xrelative[113X column syzygies [10XSyzygiesGeneratorsOfColumns[110X( [3XM[103X, [3XM2[103X ) is a matrix1153whose columns span the right kernel of [3XM[103X modulo [3XM2[103X, i.e. the [22XR[122X-submodule of1154the free module [22XR^(NrColumns( [3XM[103X ) × 1)[122X consisting of all columns [22XX[122X1155satisfying [22X[3XM[103XX+[3XM2[103XY=0[122X for some column [22XY ∈ R^(NrColumns( [3XM2[103X ) × 1)[122X. (-->1156Appendix [14XA[114X)[133X11571158[1X5.5-30 ReducedBasisOfRowModule[101X11591160[29X[2XReducedBasisOfRowModule[102X( [3XM[103X ) [32X operation1161[6XReturns:[106X [33X[0;10Ya [5Xhomalg[105X matrix[133X11621163[33X[0;0YLike [10XBasisOfRowModule[110X( [3XM[103X ) but where the matrix [10XSyzygiesGeneratorsOfRows[110X(1164[10XReducedBasisOfRowModule[110X( [3XM[103X ) ) contains no units. This can easily be1165achieved starting from [22XB:=[122X[10XBasisOfRowModule[110X( [3XM[103X ) (and using1166[2XGetColumnIndependentUnitPositions[102X ([14X5.5-18[114X) applied to the matrix of row1167syzygies of [22XB[122X, etc). (--> Appendix [14XA[114X)[133X11681169[1X5.5-31 ReducedBasisOfColumnModule[101X11701171[29X[2XReducedBasisOfColumnModule[102X( [3XM[103X ) [32X operation1172[6XReturns:[106X [33X[0;10Ya [5Xhomalg[105X matrix[133X11731174[33X[0;0YLike [10XBasisOfColumnModule[110X( [3XM[103X ) but where the matrix1175[10XSyzygiesGeneratorsOfColumns[110X( [10XReducedBasisOfColumnModule[110X( [3XM[103X ) ) contains no1176units. This can easily be achieved starting from [22XB:=[122X[10XBasisOfColumnModule[110X( [3XM[103X )1177(and using [2XGetRowIndependentUnitPositions[102X ([14X5.5-19[114X) applied to the matrix of1178column syzygies of [22XB[122X, etc.). (--> Appendix [14XA[114X)[133X11791180[1X5.5-32 ReducedSyzygiesGeneratorsOfRows[101X11811182[29X[2XReducedSyzygiesGeneratorsOfRows[102X( [3XM[103X ) [32X operation1183[6XReturns:[106X [33X[0;10Ya [5Xhomalg[105X matrix[133X11841185[33X[0;0YLike [10XSyzygiesGeneratorsOfRows[110X( [3XM[103X ) but where the matrix1186[10XSyzygiesGeneratorsOfRows[110X( [10XReducedSyzygiesGeneratorsOfRows[110X( [3XM[103X ) ) contains no1187units. This can easily be achieved starting from1188[22XC:=[122X[10XSyzygiesGeneratorsOfRows[110X( [3XM[103X ) (and using1189[2XGetColumnIndependentUnitPositions[102X ([14X5.5-18[114X) applied to the matrix of row1190syzygies of [22XC[122X, etc.). (--> Appendix [14XA[114X)[133X11911192[1X5.5-33 ReducedSyzygiesGeneratorsOfColumns[101X11931194[29X[2XReducedSyzygiesGeneratorsOfColumns[102X( [3XM[103X ) [32X operation1195[6XReturns:[106X [33X[0;10Ya [5Xhomalg[105X matrix[133X11961197[33X[0;0YLike [10XSyzygiesGeneratorsOfColumns[110X( [3XM[103X ) but where the matrix1198[10XSyzygiesGeneratorsOfColumns[110X( [10XReducedSyzygiesGeneratorsOfColumns[110X( [3XM[103X ) )1199contains no units. This can easily be achieved starting from1200[22XC:=[122X[10XSyzygiesGeneratorsOfColumns[110X( [3XM[103X ) (and using1201[2XGetRowIndependentUnitPositions[102X ([14X5.5-19[114X) applied to the matrix of column1202syzygies of [22XC[122X, etc.). (--> Appendix [14XA[114X)[133X12031204[1X5.5-34 BasisOfRowsCoeff[101X12051206[29X[2XBasisOfRowsCoeff[102X( [3XM[103X, [3XT[103X ) [32X operation1207[6XReturns:[106X [33X[0;10Ya [5Xhomalg[105X matrix[133X12081209[33X[0;0YReturns [22XB:=[122X[10XBasisOfRowModule[110X( [3XM[103X ) and assigns the [13Xvoid[113X matrix [3XT[103X (-->1210[2XHomalgVoidMatrix[102X ([14X5.2-5[114X)) such that [22XB = [3XT[103X [3XM[103X[122X. (--> Appendix [14XA[114X)[133X12111212[1X5.5-35 BasisOfColumnsCoeff[101X12131214[29X[2XBasisOfColumnsCoeff[102X( [3XM[103X, [3XT[103X ) [32X operation1215[6XReturns:[106X [33X[0;10Ya [5Xhomalg[105X matrix[133X12161217[33X[0;0YReturns [22XB:=[122X[10XBasisOfRowModule[110X( [3XM[103X ) and assigns the [13Xvoid[113X matrix [3XT[103X (-->1218[2XHomalgVoidMatrix[102X ([14X5.2-5[114X)) such that [22XB = [3XM[103X [3XT[103X[122X. (--> Appendix [14XA[114X)[133X12191220[1X5.5-36 DecideZeroRowsEffectively[101X12211222[29X[2XDecideZeroRowsEffectively[102X( [3XA[103X, [3XB[103X, [3XT[103X ) [32X operation1223[6XReturns:[106X [33X[0;10Ya [5Xhomalg[105X matrix[133X12241225[33X[0;0YReturns [22XM:=[122X[10XDecideZeroRows[110X( [3XA[103X, [3XB[103X ) and assigns the [13Xvoid[113X matrix [3XT[103X (-->1226[2XHomalgVoidMatrix[102X ([14X5.2-5[114X)) such that [22XM = [3XA[103X + [3XT[103X[3XB[103X[122X. (--> Appendix [14XA[114X)[133X12271228[1X5.5-37 DecideZeroColumnsEffectively[101X12291230[29X[2XDecideZeroColumnsEffectively[102X( [3XA[103X, [3XB[103X, [3XT[103X ) [32X operation1231[6XReturns:[106X [33X[0;10Ya [5Xhomalg[105X matrix[133X12321233[33X[0;0YReturns [22XM:=[122X[10XDecideZeroColumns[110X( [3XA[103X, [3XB[103X ) and assigns the [13Xvoid[113X matrix [3XT[103X (-->1234[2XHomalgVoidMatrix[102X ([14X5.2-5[114X)) such that [22XM = [3XA[103X + [3XB[103X[3XT[103X[122X. (--> Appendix [14XA[114X)[133X12351236[1X5.5-38 BasisOfRows[101X12371238[29X[2XBasisOfRows[102X( [3XM[103X ) [32X operation1239[29X[2XBasisOfRows[102X( [3XM[103X, [3XT[103X ) [32X operation1240[6XReturns:[106X [33X[0;10Ya [5Xhomalg[105X matrix[133X12411242[33X[0;0YWith one argument it is a synonym of [2XBasisOfRowModule[102X ([14X5.5-22[114X). with two1243arguments it is a synonym of [2XBasisOfRowsCoeff[102X ([14X5.5-34[114X).[133X12441245[1X5.5-39 BasisOfColumns[101X12461247[29X[2XBasisOfColumns[102X( [3XM[103X ) [32X operation1248[29X[2XBasisOfColumns[102X( [3XM[103X, [3XT[103X ) [32X operation1249[6XReturns:[106X [33X[0;10Ya [5Xhomalg[105X matrix[133X12501251[33X[0;0YWith one argument it is a synonym of [2XBasisOfColumnModule[102X ([14X5.5-23[114X). with two1252arguments it is a synonym of [2XBasisOfColumnsCoeff[102X ([14X5.5-35[114X).[133X12531254[1X5.5-40 DecideZero[101X12551256[29X[2XDecideZero[102X( [3Xmat[103X, [3Xrel[103X ) [32X operation1257[6XReturns:[106X [33X[0;10Ya [5Xhomalg[105X matrix[133X12581259[4X[32X Code [32X[104X1260[4XInstallMethod( DecideZero,[104X1261[4X "for sets of ring relations",[104X1262[4X [ IsHomalgMatrix, IsHomalgRingRelations ],[104X1263[4X [104X1264[4X function( mat, rel )[104X1265[4X [104X1266[4X return DecideZero( mat, MatrixOfRelations( rel ) );[104X1267[4X [104X1268[4Xend );[104X1269[4X[32X[104X12701271[1X5.5-41 SyzygiesOfRows[101X12721273[29X[2XSyzygiesOfRows[102X( [3XM[103X ) [32X operation1274[29X[2XSyzygiesOfRows[102X( [3XM[103X, [3XM2[103X ) [32X operation1275[6XReturns:[106X [33X[0;10Ya [5Xhomalg[105X matrix[133X12761277[33X[0;0YWith one argument it is a synonym of [2XSyzygiesGeneratorsOfRows[102X ([14X5.5-26[114X). with1278two arguments it is a synonym of [2XSyzygiesGeneratorsOfRows[102X ([14X5.5-28[114X).[133X12791280[1X5.5-42 SyzygiesOfColumns[101X12811282[29X[2XSyzygiesOfColumns[102X( [3XM[103X ) [32X operation1283[29X[2XSyzygiesOfColumns[102X( [3XM[103X, [3XM2[103X ) [32X operation1284[6XReturns:[106X [33X[0;10Ya [5Xhomalg[105X matrix[133X12851286[33X[0;0YWith one argument it is a synonym of [2XSyzygiesGeneratorsOfColumns[102X ([14X5.5-27[114X).1287with two arguments it is a synonym of [2XSyzygiesGeneratorsOfColumns[102X ([14X5.5-29[114X).[133X12881289[1X5.5-43 ReducedSyzygiesOfRows[101X12901291[29X[2XReducedSyzygiesOfRows[102X( [3XM[103X ) [32X operation1292[29X[2XReducedSyzygiesOfRows[102X( [3XM[103X, [3XM2[103X ) [32X operation1293[6XReturns:[106X [33X[0;10Ya [5Xhomalg[105X matrix[133X12941295[33X[0;0YWith one argument it is a synonym of [2XReducedSyzygiesGeneratorsOfRows[102X1296([14X5.5-32[114X). With two arguments it calls [10XReducedBasisOfRowModule[110X(1297[10XSyzygiesGeneratorsOfRows[110X( [3XM[103X, [3XM2[103X ) ). (--> [2XReducedBasisOfRowModule[102X ([14X5.5-30[114X)1298and [2XSyzygiesGeneratorsOfRows[102X ([14X5.5-28[114X))[133X12991300[1X5.5-44 ReducedSyzygiesOfColumns[101X13011302[29X[2XReducedSyzygiesOfColumns[102X( [3XM[103X ) [32X operation1303[29X[2XReducedSyzygiesOfColumns[102X( [3XM[103X, [3XM2[103X ) [32X operation1304[6XReturns:[106X [33X[0;10Ya [5Xhomalg[105X matrix[133X13051306[33X[0;0YWith one argument it is a synonym of [2XReducedSyzygiesGeneratorsOfColumns[102X1307([14X5.5-33[114X). With two arguments it calls [10XReducedBasisOfColumnModule[110X(1308[10XSyzygiesGeneratorsOfColumns[110X( [3XM[103X, [3XM2[103X ) ). (--> [2XReducedBasisOfColumnModule[102X1309([14X5.5-31[114X) and [2XSyzygiesGeneratorsOfColumns[102X ([14X5.5-29[114X))[133X13101311[1X5.5-45 RightDivide[101X13121313[29X[2XRightDivide[102X( [3XB[103X, [3XA[103X ) [32X operation1314[6XReturns:[106X [33X[0;10Ya [5Xhomalg[105X matrix or fail[133X13151316[33X[0;0YLet [3XB[103X and [3XA[103X be matrices having the same number of columns and defined over1317the same ring. The matrix [10XRightDivide[110X( [3XB[103X, [3XA[103X ) is a particular solution of1318the inhomogeneous (one sided) linear system of equations [22XX[3XA[103X=[3XB[103X[122X in case it is1319solvable. Otherwise [10Xfail[110X is returned. The name [10XRightDivide[110X suggests [21X[22XX=[3XB[103X[3XA[103X^-1[122X[121X.1320This generalizes [2XLeftInverse[102X ([14X5.5-2[114X) for which [3XB[103X becomes the identity1321matrix. (--> [2XSyzygiesGeneratorsOfRows[102X ([14X5.5-26[114X))[133X13221323[1X5.5-46 LeftDivide[101X13241325[29X[2XLeftDivide[102X( [3XA[103X, [3XB[103X ) [32X operation1326[6XReturns:[106X [33X[0;10Ya [5Xhomalg[105X matrix or fail[133X13271328[33X[0;0YLet [3XA[103X and [3XB[103X be matrices having the same number of rows and defined over the1329same ring. The matrix [10XLeftDivide[110X( [3XA[103X, [3XB[103X ) is a particular solution of the1330inhomogeneous (one sided) linear system of equations [22X[3XA[103XX=[3XB[103X[122X in case it is1331solvable. Otherwise [10Xfail[110X is returned. The name [10XLeftDivide[110X suggests [21X[22XX=[3XA[103X^-1[3XB[103X[122X[121X.1332This generalizes [2XRightInverse[102X ([14X5.5-3[114X) for which [3XB[103X becomes the identity1333matrix. (--> [2XSyzygiesGeneratorsOfColumns[102X ([14X5.5-27[114X))[133X13341335[1X5.5-47 RightDivide[101X13361337[29X[2XRightDivide[102X( [3XB[103X, [3XA[103X, [3XL[103X ) [32X operation1338[6XReturns:[106X [33X[0;10Ya [5Xhomalg[105X matrix or fail[133X13391340[33X[0;0YLet [3XB[103X, [3XA[103X and [3XL[103X be matrices having the same number of columns and defined1341over the same ring. The matrix [10XRightDivide[110X( [3XB[103X, [3XA[103X, [3XL[103X ) is a particular1342solution of the inhomogeneous (one sided) linear system of equations [22XX[3XA[103X+Y[3XL[103X=[3XB[103X[122X1343in case it is solvable (for some [22XY[122X which is forgotten). Otherwise [10Xfail[110X is1344returned. The name [10XRightDivide[110X suggests [21X[22XX=[3XB[103X[3XA[103X^-1[122X modulo [3XL[103X[121X. (Cf. [BR08,1345Subsection 3.1.1])[133X13461347[4X[32X Code [32X[104X1348[4XInstallMethod( RightDivide,[104X1349[4X "for homalg matrices",[104X1350[4X [ IsHomalgMatrix, IsHomalgMatrix, IsHomalgMatrix ],[104X1351[4X [104X1352[4X function( B, A, L ) ## CAUTION: Do not use lazy evaluation here!!![104X1353[4X local R, BL, ZA, AL, CA, IAL, ZB, CB, NF, X;[104X1354[4X [104X1355[4X R := HomalgRing( B );[104X1356[4X [104X1357[4X BL := BasisOfRows( L );[104X1358[4X [104X1359[4X ## first reduce A modulo L[104X1360[4X ZA := DecideZeroRows( A, BL );[104X1361[4X [104X1362[4X AL := UnionOfRows( ZA, BL );[104X1363[4X [104X1364[4X ## CA * AL = IAL[104X1365[4X CA := HomalgVoidMatrix( R );[104X1366[4X IAL := BasisOfRows( AL, CA );[104X1367[4X [104X1368[4X ## also reduce B modulo L[104X1369[4X ZB := DecideZeroRows( B, BL );[104X1370[4X [104X1371[4X ## knowing this will avoid computations[104X1372[4X IsOne( IAL );[104X1373[4X [104X1374[4X ## IsSpecialSubidentityMatrix( IAL ); ## does not increase performance[104X1375[4X [104X1376[4X ## NF = ZB + CB * IAL[104X1377[4X CB := HomalgVoidMatrix( R );[104X1378[4X NF := DecideZeroRowsEffectively( ZB, IAL, CB );[104X1379[4X [104X1380[4X ## NF <> 0[104X1381[4X if not IsZero( NF ) then[104X1382[4X return fail;[104X1383[4X fi;[104X1384[4X [104X1385[4X ## CD = -CB * CA => CD * A = B[104X1386[4X X := -CB * CertainColumns( CA, [ 1 .. NrRows( A ) ] );[104X1387[4X [104X1388[4X ## check assertion[104X1389[4X Assert( 5, IsZero( DecideZeroRows( X * A - B, BL ) ) );[104X1390[4X [104X1391[4X return X;[104X1392[4X [104X1393[4X ## technical: -CB * CA := (-CB) * CA and COLEM should take over[104X1394[4X ## since CB := -matrix[104X1395[4X [104X1396[4Xend );[104X1397[4X[32X[104X13981399[1X5.5-48 LeftDivide[101X14001401[29X[2XLeftDivide[102X( [3XA[103X, [3XB[103X, [3XL[103X ) [32X operation1402[6XReturns:[106X [33X[0;10Ya [5Xhomalg[105X matrix or fail[133X14031404[33X[0;0YLet [3XA[103X, [3XB[103X and [3XL[103X be matrices having the same number of columns and defined1405over the same ring. The matrix [10XLeftDivide[110X( [3XA[103X, [3XB[103X, [3XL[103X ) is a particular1406solution of the inhomogeneous (one sided) linear system of equations [22X[3XA[103XX+[3XL[103XY=[3XB[103X[122X1407in case it is solvable (for some [22XY[122X which is forgotten). Otherwise [10Xfail[110X is1408returned. The name [10XLeftDivide[110X suggests [21X[22XX=[3XA[103X^-1[3XB[103X[122X modulo [3XL[103X[121X. (Cf. [BR08,1409Subsection 3.1.1])[133X14101411[4X[32X Code [32X[104X1412[4XInstallMethod( LeftDivide,[104X1413[4X "for homalg matrices",[104X1414[4X [ IsHomalgMatrix, IsHomalgMatrix, IsHomalgMatrix ],[104X1415[4X [104X1416[4X function( A, B, L ) ## CAUTION: Do not use lazy evaluation here!!![104X1417[4X local R, BL, ZA, AL, CA, IAL, ZB, CB, NF, X;[104X1418[4X [104X1419[4X R := HomalgRing( B );[104X1420[4X [104X1421[4X BL := BasisOfColumns( L );[104X1422[4X [104X1423[4X ## first reduce A modulo L[104X1424[4X ZA := DecideZeroColumns( A, BL );[104X1425[4X [104X1426[4X AL := UnionOfColumns( ZA, BL );[104X1427[4X [104X1428[4X ## AL * CA = IAL[104X1429[4X CA := HomalgVoidMatrix( R );[104X1430[4X IAL := BasisOfColumns( AL, CA );[104X1431[4X [104X1432[4X ## also reduce B modulo L[104X1433[4X ZB := DecideZeroColumns( B, BL );[104X1434[4X [104X1435[4X ## knowing this will avoid computations[104X1436[4X IsOne( IAL );[104X1437[4X [104X1438[4X ## IsSpecialSubidentityMatrix( IAL ); ## does not increase performance[104X1439[4X [104X1440[4X ## NF = ZB + IAL * CB[104X1441[4X CB := HomalgVoidMatrix( R );[104X1442[4X NF := DecideZeroColumnsEffectively( ZB, IAL, CB );[104X1443[4X [104X1444[4X ## NF <> 0[104X1445[4X if not IsZero( NF ) then[104X1446[4X return fail;[104X1447[4X fi;[104X1448[4X [104X1449[4X ## CD = CA * -CB => A * CD = B[104X1450[4X X := CertainRows( CA, [ 1 .. NrColumns( A ) ] ) * -CB;[104X1451[4X [104X1452[4X ## check assertion[104X1453[4X Assert( 5, IsZero( DecideZeroColumns( A * X - B, BL ) ) );[104X1454[4X [104X1455[4X return X;[104X1456[4X [104X1457[4X ## technical: CA * -CB := CA * (-CB) and COLEM should take over since[104X1458[4X ## CB := -matrix[104X1459[4X [104X1460[4Xend );[104X1461[4X[32X[104X14621463[1X5.5-49 GenerateSameRowModule[101X14641465[29X[2XGenerateSameRowModule[102X( [3XM[103X, [3XN[103X ) [32X operation1466[6XReturns:[106X [33X[0;10Y[10Xtrue[110X or [10Xfalse[110X[133X14671468[33X[0;0YCheck if the row span of [3XM[103X and of [3XN[103X are identical or not (--> [2XRightDivide[102X1469([14X5.5-45[114X)).[133X14701471[1X5.5-50 GenerateSameColumnModule[101X14721473[29X[2XGenerateSameColumnModule[102X( [3XM[103X, [3XN[103X ) [32X operation1474[6XReturns:[106X [33X[0;10Y[10Xtrue[110X or [10Xfalse[110X[133X14751476[33X[0;0YCheck if the column span of [3XM[103X and of [3XN[103X are identical or not (--> [2XLeftDivide[102X1477([14X5.5-46[114X)).[133X1478147914801481