Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
| Download
GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it
Project: cocalc-sagemath-dev-slelievre
Views: 4183461[1X3 [33X[0;0Y[5XGaussForHomalg[105X[101X[1X methods and functions[133X[101X234[1X3.1 [33X[0;0YThe Tools[133X[101X56[33X[0;0YPlease note that there are more tool functions you can define,7[5XGaussForHomalg[105X just provides homalg with a sufficient subset. This varies8with the type and complexity of the rings you want to define. On the other9hand, [2XImportMatrix[102X ([14X3.1-4[114X) is a function specifically designed for10[5XGaussForHomalg[105X.[133X1112[1X3.1-1 ZeroMatrix[101X1314[29X[2XZeroMatrix[102X( [3XC[103X ) [32X function15[6XReturns:[106X [33X[0;10Ya sparse matrix[133X1617[33X[0;0YThis returns a sparse matrix with the same dimensions and base ring as the18[5Xhomalg[105X matrix [3XC[103X.[133X1920[1X3.1-2 IdentityMatrix[101X2122[29X[2XIdentityMatrix[102X( [3XC[103X ) [32X function23[6XReturns:[106X [33X[0;10Ya sparse matrix[133X2425[33X[0;0YThis returns a sparse [22Xn × n[122X identity matrix with the same ring as the [5Xhomalg[105X26matrix [3XC[103X, [22Xn[122X being the number of rows of [3XC[103X.[133X2728[1X3.1-3 CopyMatrix[101X2930[29X[2XCopyMatrix[102X( [3XC[103X ) [32X function31[6XReturns:[106X [33X[0;10Ya sparse matrix[133X3233[33X[0;0YThis returns a sparse matrix which is a shallow copy of the sparse matrix34stored in the [10XEval[110X attribute of the [5Xhomalg[105X matrix [3XC[103X.[133X3536[1X3.1-4 ImportMatrix[101X3738[29X[2XImportMatrix[102X( [3XM[103X, [3XR[103X ) [32X function39[6XReturns:[106X [33X[0;10Ya sparse matrix[133X4041[33X[0;0YThis returns the sparse version of the [5XGAP[105X matrix [3XM[103X over the ring [3XR[103X. It42prevents [5Xhomalg[105X from calling sparse matrix algorithms on dense [5XGAP[105X matrices.43Note that this is not a "standard" tool but neccessary because of the new44data type.[133X4546[1X3.1-5 Involution[101X4748[29X[2XInvolution[102X( [3XM[103X ) [32X function49[6XReturns:[106X [33X[0;10Ya sparse matrix[133X5051[33X[0;0YThis returns a sparse matrix which is the transpose of the sparse matrix52stored in the [10XEval[110X attribute of the [5Xhomalg[105X matrix [3XM[103X.[133X5354[1X3.1-6 CertainRows[101X5556[29X[2XCertainRows[102X( [3XM[103X, [3Xplist[103X ) [32X function57[6XReturns:[106X [33X[0;10Ya sparse matrix[133X5859[33X[0;0YThis returns the rows in [3Xplist[103X of the sparse matrix stored in the [10XEval[110X60attribute of the [5Xhomalg[105X matrix [3XM[103X as a new matrix.[133X6162[1X3.1-7 CertainColumns[101X6364[29X[2XCertainColumns[102X( [3XM[103X, [3Xplist[103X ) [32X function65[6XReturns:[106X [33X[0;10Ya sparse matrix[133X6667[33X[0;0YThis returns the columns in [3Xplist[103X of the sparse matrix stored in the [10XEval[110X68attribute of the [5Xhomalg[105X matrix [3XM[103X as a new matrix.[133X6970[1X3.1-8 UnionOfRows[101X7172[29X[2XUnionOfRows[102X( [3XA[103X, [3XB[103X ) [32X function73[6XReturns:[106X [33X[0;10Ya sparse matrix[133X7475[33X[0;0YThis returns the sparse matrix created by concatenating the rows of the76sparse matrices stored in the [10XEval[110X attributes of the [5Xhomalg[105X matrices [3XA[103X and77[3XB[103X.[133X7879[1X3.1-9 UnionOfColumns[101X8081[29X[2XUnionOfColumns[102X( [3XA[103X, [3XB[103X ) [32X function82[6XReturns:[106X [33X[0;10Ya sparse matrix[133X8384[33X[0;0YThis returns the sparse matrix created by concatenating the columns of the85sparse matrices stored in the [10XEval[110X attributes of the [5Xhomalg[105X matrices [3XA[103X and86[3XB[103X.[133X8788[1X3.1-10 DiagMat[101X8990[29X[2XDiagMat[102X( [3Xe[103X ) [32X function91[6XReturns:[106X [33X[0;10Ya sparse matrix[133X9293[33X[0;0YThis method takes a list [3Xe[103X of [5Xhomalg[105X matrices and returns the sparse block94matrix of the matrices stored in the [10XEval[110X attributes of the matrices in [3Xe[103X.[133X9596[1X3.1-11 KroneckerMat[101X9798[29X[2XKroneckerMat[102X( [3XA[103X, [3XB[103X ) [32X function99[6XReturns:[106X [33X[0;10Ya sparse matrix[133X100101[33X[0;0YThis returns the sparse Kronecker matrix of the matrices stored in the [10XEval[110X102attributes of the [5Xhomalg[105X matrices [3XA[103X and [3XB[103X.[133X103104[1X3.1-12 Compose[101X105106[29X[2XCompose[102X( [3XA[103X, [3XB[103X ) [32X function107[6XReturns:[106X [33X[0;10Ya sparse matrix[133X108109[33X[0;0YThis returns the matrix product of the sparse matrices stored in the [10XEval[110X110attributes of the [5Xhomalg[105X matrices [3XA[103X and [3XB[103X.[133X111112[1X3.1-13 NrRows[101X113114[29X[2XNrRows[102X( [3XC[103X ) [32X function115[6XReturns:[106X [33X[0;10Yan integer[133X116117[33X[0;0YThis returns the number of rows of the sparse matrix stored in the [10XEval[110X118attribute of the [5Xhomalg[105X matrix [3XC[103X.[133X119120[1X3.1-14 NrColumns[101X121122[29X[2XNrColumns[102X( [3XC[103X ) [32X function123[6XReturns:[106X [33X[0;10Yan integer[133X124125[33X[0;0YThis returns the number of columns of the sparse matrix stored in the [10XEval[110X126attribute of the [5Xhomalg[105X matrix [3XC[103X.[133X127128[1X3.1-15 IsZeroMatrix[101X129130[29X[2XIsZeroMatrix[102X( [3XC[103X ) [32X function131[6XReturns:[106X [33X[0;10Y[12Xtrue[112X or [12Xfalse[112X[133X132133[33X[0;0YThis returns [12Xtrue[112X if the sparse matrix stored in the [10XEval[110X attribute of the134[5Xhomalg[105X matrix [3XC[103X is a zero matrix, and [12Xfalse[112X otherwise.[133X135136[1X3.1-16 IsDiagonalMatrix[101X137138[29X[2XIsDiagonalMatrix[102X( [3XC[103X ) [32X function139[6XReturns:[106X [33X[0;10Y[12Xtrue[112X or [12Xfalse[112X[133X140141[33X[0;0YThis returns [12Xtrue[112X if the sparse matrix stored in the [10XEval[110X attribute of the142[5Xhomalg[105X matrix [3XC[103X is a diagonal matrix, and [12Xfalse[112X otherwise.[133X143144[1X3.1-17 ZeroRows[101X145146[29X[2XZeroRows[102X( [3XC[103X ) [32X function147[6XReturns:[106X [33X[0;10Ya list[133X148149[33X[0;0YThis returns the list of zero rows of the sparse matrix stored in the [10XEval[110X150attribute of the [5Xhomalg[105X matrix [3XC[103X.[133X151152[1X3.1-18 ZeroColumns[101X153154[29X[2XZeroColumns[102X( [3XC[103X ) [32X function155[6XReturns:[106X [33X[0;10Ya list[133X156157[33X[0;0YThis returns the list of zero columns of the sparse matrix stored in the158[10XEval[110X attribute of the [5Xhomalg[105X matrix [3XC[103X.[133X159160161[1X3.2 [33X[0;0YThe Basic Functions and [5Xhomalg[105X[101X[1X table creation[133X[101X162163[1X3.2-1 DecideZeroRows[101X164165[29X[2XDecideZeroRows[102X( [3XA[103X, [3XB[103X ) [32X function166[6XReturns:[106X [33X[0;10Ya [5Xhomalg[105X matrix[133X167168[33X[0;0YThis returns the [5Xhomalg[105X matrix you get by row reducing the [5Xhomalg[105X matrix [3XA[103X169with the [5Xhomalg[105X matrix [3XB[103X.[133X170171[1X3.2-2 DecideZeroRowsEffectively[101X172173[29X[2XDecideZeroRowsEffectively[102X( [3XA[103X, [3XB[103X, [3XT[103X ) [32X function174[6XReturns:[106X [33X[0;10Ya [5Xhomalg[105X matrix [3XM[103X[133X175176[33X[0;0YThis returns the [5Xhomalg[105X matrix [3XM[103X you get by row reducing the [5Xhomalg[105X matrix [3XA[103X177with the [5Xhomalg[105X matrix [3XB[103X. The transformation matrix is stored in the void178[5Xhomalg[105X matrix [3XT[103X as a side effect. The matrices satisfy [22XM = A + T * B[122X.[133X179180[1X3.2-3 SyzygiesGeneratorsOfRows[101X181182[29X[2XSyzygiesGeneratorsOfRows[102X( [3XM[103X ) [32X function183[6XReturns:[106X [33X[0;10Ya [5Xhomalg[105X matrix[133X184185[33X[0;0YThis returns the row syzygies of the [5Xhomalg[105X matrix [3XM[103X, again as a [5Xhomalg[105X186matrix.[133X187188[1X3.2-4 RelativeSyzygiesGeneratorsOfRows[101X189190[29X[2XRelativeSyzygiesGeneratorsOfRows[102X( [3XM[103X, [3XN[103X ) [32X function191[6XReturns:[106X [33X[0;10Ya [5Xhomalg[105X matrix[133X192193[33X[0;0YThe row syzygies of [3XM[103X are returned, but now the computation interpretes the194rows of the [5Xhomalg[105X matrix [3XN[103X as additional zero relations.[133X195196[1X3.2-5 RowReducedEchelonForm[101X197198[29X[2XRowReducedEchelonForm[102X( [3XM[103X[, [3XU[103X] ) [32X function199[6XReturns:[106X [33X[0;10Ya [5Xhomalg[105X matrix [3XN[103X[133X200201[33X[0;0YIf one argument is given, this returns the triangular basis (reduced row202echelon form) of the [5Xhomalg[105X matrix [3XM[103X, again as a [5Xhomalg[105X matrix. In case of203two arguments, still only the triangular basis of [3XM[103X is returned, but the204transformation matrix is stored in the void [5Xhomalg[105X matrix [3XU[103X as a side205effect. The matrices satisfy [22XN = U * M[122X.[133X206207[1X3.2-6 CreateHomalgTable[101X208209[29X[2XCreateHomalgTable[102X( [3XR[103X ) [32X function210[6XReturns:[106X [33X[0;10Ya [5Xhomalg[105X table[133X211212[33X[0;0YThis returns the [5Xhomalg[105X table of what will become the [5Xhomalg[105X ring [3XR[103X (at this213point [3XR[103X is just a [5Xhomalg[105X object with some properties for the method214selection of [10XCreateHomalgTable[110X). This method includes the needed functions215stored in the global variables [10XCommonHomalgTableForGaussTools[110X and216[10XCommonHomalgTableForGaussBasic[110X, and can add some more to the record that217will become the [5Xhomalg[105X table.[133X218219220[1X3.3 [33X[0;0YMatrix entry manipulation[133X[101X221222[33X[0;0YThis is just support for the sparse matrix data type.[133X223224[1X3.3-1 MatElm[101X225226[29X[2XMatElm[102X( [3XM[103X, [3Xr[103X, [3Xc[103X, [3XR[103X ) [32X method227[6XReturns:[106X [33X[0;10Y[3XM[103X[[3Xr[103X,[3Xc[103X][133X228229[33X[0;0YIf the Eval attribute of the homalg matrix [3XM[103X over the [5Xhomalg[105X ring [3XR[103X is230sparse, this calls the corresponding [5XGauss[105X command [10XGetEntry[110X.[133X231232[1X3.3-2 SetMatElm[101X233234[29X[2XSetMatElm[102X( [3XM[103X, [3Xr[103X, [3Xc[103X, [3Xe[103X, [3XR[103X ) [32X method235[6XReturns:[106X [33X[0;10Ynothing[133X236237[33X[0;0YIf the Eval attribute of the homalg matrix [3XM[103X over the [5Xhomalg[105X ring [3XR[103X is238sparse, this calls the corresponding [5XGauss[105X command [10XGetEntry[110X, to achieve239[10X[3XM[103X[10X[[3Xr[103X[10X,[3Xc[103X[10X]:=[3Xe[103X[10X[110X.[133X240241[1X3.3-3 AddToMatElm[101X242243[29X[2XAddToMatElm[102X( [3XM[103X, [3Xr[103X, [3Xc[103X, [3Xe[103X, [3XR[103X ) [32X method244[6XReturns:[106X [33X[0;10Ynothing[133X245246[33X[0;0YIf the Eval attribute of the homalg matrix [3XM[103X over the [5Xhomalg[105X ring [3XR[103X is247sparse, this calls the corresponding [5XGauss[105X command [10XAddToEntry[110X, to achieve248[10X[3XM[103X[10X[[3Xr[103X[10X,[3Xc[103X[10X] := [3XM[103X[10X[[3Xr[103X[10X,[3Xc[103X[10X] + [3Xe[103X[10X[110X.[133X249250251252