MatricesForHomalg
Documentation for MatricesForHomalg.
MatricesForHomalg.MatricesForHomalg
Base.:*
MatricesForHomalg.BasisOfColumns
MatricesForHomalg.BasisOfRows
MatricesForHomalg.CertainColumns
MatricesForHomalg.CertainRows
MatricesForHomalg.ColumnRankOfMatrix
MatricesForHomalg.ConvertMatrixToColumn
MatricesForHomalg.ConvertMatrixToRow
MatricesForHomalg.DecideZeroColumns
MatricesForHomalg.DecideZeroRows
MatricesForHomalg.FirstZeroColumn
MatricesForHomalg.FirstZeroRow
MatricesForHomalg.HomalgColumnVector
MatricesForHomalg.HomalgColumnVector
MatricesForHomalg.HomalgDiagonalMatrix
MatricesForHomalg.HomalgFieldOfRationals
MatricesForHomalg.HomalgIdentityMatrix
MatricesForHomalg.HomalgMatrix
MatricesForHomalg.HomalgRing
MatricesForHomalg.HomalgRingOfIntegers
MatricesForHomalg.HomalgRowVector
MatricesForHomalg.HomalgRowVector
MatricesForHomalg.HomalgZeroMatrix
MatricesForHomalg.IsEmptyMatrix
MatricesForHomalg.IsOne
MatricesForHomalg.IsSymmetricMatrix
MatricesForHomalg.IsZero
MatricesForHomalg.KroneckerMat
MatricesForHomalg.LeftDivide
MatricesForHomalg.LeftDivide
MatricesForHomalg.NumberColumns
MatricesForHomalg.NumberRows
MatricesForHomalg.RightDivide
MatricesForHomalg.RightDivide
MatricesForHomalg.RingName
MatricesForHomalg.RowRankOfMatrix
MatricesForHomalg.RowReducedEchelonForm
MatricesForHomalg.SafeLeftDivide
MatricesForHomalg.SafeLeftDivide
MatricesForHomalg.SafeRightDivide
MatricesForHomalg.SafeRightDivide
MatricesForHomalg.StringDisplay
MatricesForHomalg.SyzygiesOfColumns
MatricesForHomalg.SyzygiesOfColumns
MatricesForHomalg.SyzygiesOfRows
MatricesForHomalg.SyzygiesOfRows
MatricesForHomalg.TransposedMatrix
MatricesForHomalg.UnionOfColumns
MatricesForHomalg.UnionOfRows
MatricesForHomalg.UniqueLeftDivide
MatricesForHomalg.UniqueRightDivide
MatricesForHomalg.ZeroColumns
MatricesForHomalg.ZeroRows
MatricesForHomalg.MatricesForHomalg
— ModuleMatrices for the homalg project
Base.:*
— MethodR * mat
Rewrite the matrix mat over the ring R (if possible)
julia> mat = HomalgMatrix([1,2,3,4,5,6], 2, 3, ZZ)
[1 2 3]
[4 5 6]
julia> QQ * mat
[1 2 3]
[4 5 6]
julia> qmat = QQ * mat
[1 2 3]
[4 5 6]
julia> ZZ * qmat == mat
true
MatricesForHomalg.BasisOfColumns
— MethodBasisOfColumns(mat)
Return the triangular form of mat
julia> mat = HomalgMatrix(1:9, 3, 3, ZZ)
[1 2 3]
[4 5 6]
[7 8 9]
julia> BasisOfColumns(mat)
[1 0]
[1 3]
[1 6]
julia> mat = HomalgMatrix(1:9, 3, 3, QQ)
[1 2 3]
[4 5 6]
[7 8 9]
julia> BasisOfColumns(mat)
[ 1 0]
[ 0 1]
[-1 2]
MatricesForHomalg.BasisOfRows
— MethodBasisOfRows(mat)
Return the triangular form of mat
julia> mat = HomalgMatrix(1:9, 3, 3, ZZ)
[1 2 3]
[4 5 6]
[7 8 9]
julia> BasisOfRows(mat)
[1 2 3]
[0 3 6]
julia> mat = HomalgMatrix(1:9, 3, 3, QQ)
[1 2 3]
[4 5 6]
[7 8 9]
julia> BasisOfRows(mat)
[1 0 -1]
[0 1 2]
MatricesForHomalg.CertainColumns
— MethodCertainColumns(mat, list)
Return the matrix of which the i-th column is the k-th column of the homalg matrix M, where k=list[i].
julia> mat = HomalgMatrix(1:6, 2, 3, ZZ)
[1 2 3]
[4 5 6]
julia> CertainColumns(mat, [2, 2, 1])
[2 2 1]
[5 5 4]
julia> CertainColumns(mat, [])
2 by 0 empty matrix
julia> CertainColumns(mat, 4:3)
2 by 0 empty matrix
MatricesForHomalg.CertainRows
— MethodCertainRows(mat, list)
Return the matrix of which the i-th row is the k-th row of the homalg matrix M, where k=list[i].
julia> mat = HomalgMatrix(2:7, 3, 2, ZZ)
[2 3]
[4 5]
[6 7]
julia> CertainRows(mat, [2, 2, 1])
[4 5]
[4 5]
[2 3]
julia> CertainRows(mat, [])
0 by 2 empty matrix
julia> CertainRows(mat, 4:3)
0 by 2 empty matrix
MatricesForHomalg.ColumnRankOfMatrix
— MethodColumnRankOfMatrix(mat)
Returns the column rank of the matrix mat as a nonnegative integer.
julia> mat1 = TransposedMatrix(HomalgMatrix(4:9, 3, 2, ZZ))
[4 6 8]
[5 7 9]
julia> ColumnRankOfMatrix(mat1)
2
julia> mat2 = HomalgIdentityMatrix(3, ZZ)
[1 0 0]
[0 1 0]
[0 0 1]
julia> ColumnRankOfMatrix(mat2)
3
MatricesForHomalg.ConvertMatrixToColumn
— MethodConvertMatrixToColumn(mat)
Unfold the matrix M column-wise into a column.
julia> mat = HomalgMatrix(2:7, 3, 2, ZZ)
[2 3]
[4 5]
[6 7]
julia> ConvertMatrixToColumn(mat)
[2]
[4]
[6]
[3]
[5]
[7]
MatricesForHomalg.ConvertMatrixToRow
— MethodConvertMatrixToRow(mat)
Unfold the matrix M row-wise into a row.
julia> mat = HomalgMatrix(2:7, 3, 2, ZZ)
[2 3]
[4 5]
[6 7]
julia> ConvertMatrixToRow(mat)
[2 3 4 5 6 7]
MatricesForHomalg.DecideZeroColumns
— MethodDecideZeroColumns(B, A)
Returns: a homalg matrix
Let B and A be matrices having the same number of rows and defined over the same ring R and S be the column span of A, i.e. the R-submodule of the free right module R(NrRows(A)×1) spanned by the columns of A. The result is a matrix B′ having the same shape as B, for which the i-th column B′i is equivalent to the i-th column Bi of B modulo S, i.e. B′i−Bi is an element of the column span S of A. Moreover, the column B′i is zero, if and only if the column Bi is an element of S. So DecideZeroColumns decides which columns of B are zero modulo the columns of A.
julia> A = HomalgMatrix(1:6, 3, 2, ZZ)
[1 2]
[3 4]
[5 6]
julia> B = HomalgMatrix([3, 1, 7, 1, 11, 1], 3, 2, ZZ)
[ 3 1]
[ 7 1]
[11 1]
julia> DecideZeroColumns(B, A)
[0 0]
[0 0]
[0 0]
MatricesForHomalg.DecideZeroRows
— MethodDecideZeroRows(B, A)
Returns: a homalg matrix
Let B and A be matrices having the same number of columns and defined over the same ring R and S be the row span of A, i.e. the R-submodule of the free left module R(1×NrColumns(A)) spanned by the rows of A. The result is a matrix B′ having the same shape as B, for which the i-th row B′^i is equivalent to the i-th row B^i of B modulo S, i.e. B′^i−B^i is an element of the row span S of A. Moreover, the row B′^i is zero, if and only if the row B^i is an element of S. So DecideZeroRows decides which rows of B are zero modulo the rows of A.
julia> A = HomalgMatrix(1:6, 3, 2, ZZ)
[1 2]
[3 4]
[5 6]
julia> B = HomalgMatrix(2:7, 3, 2, ZZ)
[2 3]
[4 5]
[6 7]
julia> A′ = DecideZeroRows(B, A)
[0 1]
[0 1]
[0 1]
julia> RightDivide(B, A)
"fail"
julia> RightDivide(B - A′, A)
[0 -1 1]
[0 -2 2]
[0 -3 3]
julia> DecideZeroRows(A, A)
[0 0]
[0 0]
[0 0]
julia> C = HomalgMatrix([4, 6, 2, 2], 2, 2, ZZ)
[4 6]
[2 2]
julia> DecideZeroRows(C, A)
[0 0]
[0 0]
julia> DecideZeroRows(A, C)
[1 0]
[1 0]
[1 0]
MatricesForHomalg.FirstZeroColumn
— MethodFirstZeroColumn(mat)
Return a positive integer of the first zero column.
julia> mat = HomalgMatrix(4:9, 2, 3, ZZ)
[4 5 6]
[7 8 9]
julia> FirstZeroColumn(mat)
4
julia> mat = HomalgMatrix([0, 2, 0, 0, 0, 0], 2, 3, ZZ)
[0 2 0]
[0 0 0]
julia> FirstZeroColumn(mat)
1
julia> mat = HomalgZeroMatrix(3,3,ZZ)
[0 0 0]
[0 0 0]
[0 0 0]
julia> FirstZeroColumn(mat)
1
MatricesForHomalg.FirstZeroRow
— MethodFirstZeroRow(mat)
Return a positive integer of the first zero row.
julia> mat = HomalgMatrix(4:9, 3, 2, ZZ)
[4 5]
[6 7]
[8 9]
julia> FirstZeroRow(mat)
4
julia> mat = HomalgMatrix([0, 2, 6, 0, 0, 0], 3, 2, ZZ)
[0 2]
[6 0]
[0 0]
julia> FirstZeroRow(mat)
3
julia> mat = HomalgMatrix([0, 0, 6, 0, 0, 0], 3, 2, ZZ)
[0 0]
[6 0]
[0 0]
julia> FirstZeroRow(mat)
1
MatricesForHomalg.HomalgColumnVector
— MethodHomalgColumnVector(L, r, R)
Construct a (r x 1)-matrix over the ring R with entries in the list L
julia> mat = HomalgColumnVector(1:5, 5, ZZ)
[1]
[2]
[3]
[4]
[5]
MatricesForHomalg.HomalgColumnVector
— MethodHomalgColumnVector(L, r, R)
Construct a (r x 1)-matrix over the ring R with entries in the list L, where r = length(L)
julia> mat = HomalgColumnVector(1:5, ZZ)
[1]
[2]
[3]
[4]
[5]
MatricesForHomalg.HomalgDiagonalMatrix
— MethodHomalgDiagonalMatrix(L, R)
Construct a diagonal matrix over the ring R using the list L of diagonal entries
julia> mat = HomalgDiagonalMatrix(1:5, ZZ)
[1 0 0 0 0]
[0 2 0 0 0]
[0 0 3 0 0]
[0 0 0 4 0]
[0 0 0 0 5]
MatricesForHomalg.HomalgFieldOfRationals
— MethodHomalgFieldOfRationals()
Returns the field of rationals.
julia> field = HomalgFieldOfRationals()
Rational field
MatricesForHomalg.HomalgIdentityMatrix
— MethodHomalgIdentityMatrix(r, R)
Construct a (r x r)-identity matrix over the ring R
julia> mat = HomalgIdentityMatrix(3, ZZ)
[1 0 0]
[0 1 0]
[0 0 1]
MatricesForHomalg.HomalgMatrix
— MethodHomalgMatrix(L, r, c, R)
Construct a (r x c)-matrix over the ring R with L as list of entries
julia> mat1 = HomalgMatrix([1,2,3,4,5,6], 2, 3, ZZ)
[1 2 3]
[4 5 6]
julia> mat2 = HomalgMatrix([[1,2,3],[4,5,6]], 2, 3, ZZ)
[1 2 3]
[4 5 6]
julia> mat1 == mat2
true
MatricesForHomalg.HomalgRing
— MethodHomalgRing(mat)
Return the ring underlying the matrix mat.
julia> mat = HomalgMatrix(1:6, 2, 3, ZZ)
[1 2 3]
[4 5 6]
julia> HomalgRing(mat)
Integer ring
julia> mat = HomalgMatrix(1:6, 2, 3, QQ)
[1 2 3]
[4 5 6]
julia> HomalgRing(mat)
Rational field
MatricesForHomalg.HomalgRingOfIntegers
— MethodHomalgRingOfIntegers()
Returns the ring of (rational) integers.
julia> ring = HomalgRingOfIntegers()
Integer ring
MatricesForHomalg.HomalgRowVector
— MethodHomalgRowVector(L, c, R)
Construct a (1 x c)-matrix over the ring R with entries in the list L
julia> mat = HomalgRowVector(1:5, 5, ZZ)
[1 2 3 4 5]
MatricesForHomalg.HomalgRowVector
— MethodHomalgRowVector(L, R)
Construct a (1 x c)-matrix over the ring R with entries in the list L, where c = length(L)
julia> mat = HomalgRowVector(1:5, ZZ)
[1 2 3 4 5]
MatricesForHomalg.HomalgZeroMatrix
— MethodHomalgZeroMatrix(r, c, R)
Construct a (r x c)-zero matrix over the ring R
julia> mat = HomalgZeroMatrix(3, 2, ZZ)
[0 0]
[0 0]
[0 0]
MatricesForHomalg.IsEmptyMatrix
— MethodIsEmptyMatrix(mat)
Return true if mat does not contain any entry, otherwise false
julia> mat = HomalgMatrix([], 0, 0, ZZ)
0 by 0 empty matrix
julia> IsEmptyMatrix(mat)
true
MatricesForHomalg.IsOne
— MethodIsOne(mat)
Return true if mat is an identity matrix, otherwise false
julia> mat = HomalgIdentityMatrix(3, ZZ)
[1 0 0]
[0 1 0]
[0 0 1]
julia> IsOne(mat)
true
MatricesForHomalg.IsSymmetricMatrix
— MethodIsSymmetricMatrix(mat)
Return true if the matrix mat is symmetric with respect to its main diagonal, otherwise false
julia> mat = HomalgMatrix([1,2,3,2,4,5,3,5,6], 3, 3, ZZ)
[1 2 3]
[2 4 5]
[3 5 6]
julia> IsSymmetricMatrix(mat)
true
MatricesForHomalg.IsZero
— MethodIsZero(mat)
Return true if mat is a zero matrix, otherwise false
julia> mat = HomalgZeroMatrix(3, 2, ZZ)
[0 0]
[0 0]
[0 0]
julia> IsZero(mat)
true
MatricesForHomalg.KroneckerMat
— MethodKroneckerMat(mat1, mat2)
Return the Kronecker (or tensor) product of the two homalg matrices mat1 and mat2.
julia> mat1 = HomalgMatrix(1:6, 2, 3, ZZ)
[1 2 3]
[4 5 6]
julia> mat2 = HomalgMatrix(2:7, 3, 2, ZZ)
[2 3]
[4 5]
[6 7]
julia> KroneckerMat(mat1, mat2)
[ 2 3 4 6 6 9]
[ 4 5 8 10 12 15]
[ 6 7 12 14 18 21]
[ 8 12 10 15 12 18]
[16 20 20 25 24 30]
[24 28 30 35 36 42]
julia> KroneckerMat(mat2, mat1)
[ 2 4 6 3 6 9]
[ 8 10 12 12 15 18]
[ 4 8 12 5 10 15]
[16 20 24 20 25 30]
[ 6 12 18 7 14 21]
[24 30 36 28 35 42]
MatricesForHomalg.LeftDivide
— MethodLeftDivide(A, B, L)
Returns: a homalg matrix or fail
Let A, B and L be matrices having the same number of columns and defined over the same ring. The matrix LeftDivide( A, B, L ) is a particular solution of the inhomogeneous (one sided) linear system of equations AX+LY=B in case it is solvable (for some Y which is forgotten). Otherwise fail is returned. The name LeftDivide suggests "X=A−1B modulo L"
julia> A = HomalgMatrix(1:6, 3, 2, ZZ)
[1 2]
[3 4]
[5 6]
julia> L = HomalgMatrix(2:7, 3, 2, ZZ)
[2 3]
[4 5]
[6 7]
julia> B = HomalgMatrix([5, 5, 11, 9, 17, 13], 3, 2, ZZ)
[ 5 5]
[11 9]
[17 13]
julia> LeftDivide(A, B, L)
[0 0]
[0 0]
julia> B = HomalgMatrix([3, 5, 0, 9, 11, 13], 3, 2, ZZ)
[ 3 5]
[ 0 9]
[11 13]
julia> LeftDivide(A, B, L)
"fail"
MatricesForHomalg.LeftDivide
— MethodLeftDivide(A, B)
Returns: a homalg matrix or fail
Let A and B be matrices having the same number of rows and defined over the same ring. The matrix LeftDivide(A, B) is a particular solution of the inhomogeneous (one sided) linear system of equations AX=B in case it is solvable. Otherwise fail is returned. The name LeftDivide suggests "X=A^{-1}B".
julia> A = HomalgMatrix(1:6, 3, 2, ZZ)
[1 2]
[3 4]
[5 6]
julia> B = HomalgMatrix(2:7, 3, 2, ZZ)
[2 3]
[4 5]
[6 7]
julia> C = HomalgMatrix([1,0,0,0,0,0], 3, 2, ZZ)
[1 0]
[0 0]
[0 0]
julia> LeftDivide(B, B)
[1 0]
[0 1]
julia> LeftDivide(A, B)
[0 -1]
[1 2]
julia> LeftDivide(C, B)
"fail"
MatricesForHomalg.NumberColumns
— MethodNumberColumns(mat)
The number of columns of the matrix mat
julia> mat = HomalgMatrix(1:6, 2, 3, ZZ)
[1 2 3]
[4 5 6]
julia> NumberColumns(mat)
3
MatricesForHomalg.NumberRows
— MethodNumberRows(mat)
The number of rows of the matrix mat
julia> mat = HomalgMatrix(1:6, 2, 3, ZZ)
[1 2 3]
[4 5 6]
julia> NumberRows(mat)
2
MatricesForHomalg.RightDivide
— MethodRightDivide(B, A, L)
Returns: a homalg matrix or fail
Let B, A and L be matrices having the same number of columns and defined over the same ring. The matrix RightDivide( B, A, L ) is a particular solution of the inhomogeneous (one sided) linear system of equations XA+YL=B in case it is solvable (for some Y which is forgotten). Otherwise fail is returned. The name RightDivide suggests "X=BA−1 modulo L".
julia> A = HomalgMatrix(1:9, 3, 3, ZZ)
[1 2 3]
[4 5 6]
[7 8 9]
julia> B = HomalgMatrix([3, 5, 7, 13, 16, 19, 29, 33, 37], 3, 3, ZZ)
[ 3 5 7]
[13 16 19]
[29 33 37]
julia> L = HomalgMatrix(2:10, 3, 3, ZZ)
[2 3 4]
[5 6 7]
[8 9 10]
julia> X = RightDivide(B, A, L)
[0 0 -2]
[0 0 -1]
[0 0 0]
julia> B = HomalgMatrix([3, 5, 7, 0, 16, 19, 0, 33, 37], 3, 3, ZZ)
[3 5 7]
[0 16 19]
[0 33 37]
julia> RightDivide(B, A, L)
"fail"
MatricesForHomalg.RightDivide
— MethodRightDivide(B, A)
Returns: a homalg matrix or fail
Let B and A be matrices having the same number of columns and defined over the same ring. The matrix RightDivide(B, A) is a particular solution of the inhomogeneous (one sided) linear system of equations XA=B in case it is solvable. Otherwise fail is returned. The name RightDivide suggests "X=BA^-1".
julia> A = HomalgMatrix(1:6, 3, 2, ZZ)
[1 2]
[3 4]
[5 6]
julia> B = HomalgMatrix(3:8, 3, 2, ZZ)
[3 4]
[5 6]
[7 8]
julia> RightDivide(B, A)
[0 1 0]
[0 0 1]
[0 -1 2]
julia> RightDivide(A, B)
[0 3 -2]
[0 2 -1]
[0 1 0]
julia> C = HomalgMatrix(4:9, 3, 2, ZZ)
[4 5]
[6 7]
[8 9]
julia> RightDivide(A, C)
"fail"
julia> RightDivide(C, A)
"fail"
MatricesForHomalg.RingName
— MethodRingName(ring)
Returns the name of the ring as a string.
julia> ring = HomalgRingOfIntegers()
Integer ring
julia> RingName(ring)
"Z"
julia> field = HomalgFieldOfRationals()
Rational field
julia> RingName(field)
"Q"
MatricesForHomalg.RowRankOfMatrix
— MethodRowRankOfMatrix(mat)
Returns the row rank of the matrix mat as a nonnegative integer.
julia> mat1 = HomalgMatrix(4:9, 3, 2, ZZ)
[4 5]
[6 7]
[8 9]
julia> RowRankOfMatrix(mat1)
2
julia> mat2 = HomalgIdentityMatrix(3, ZZ)
[1 0 0]
[0 1 0]
[0 0 1]
julia> RowRankOfMatrix(mat2)
3
MatricesForHomalg.RowReducedEchelonForm
— MethodRowReducedEchelonForm(mat)
Return the reduced row-echelon form and the rank of the matrix mat.
```jldoctest julia> mat = HomalgMatrix(reverse(1:9), 3, 3, ZZ) [9 8 7] [6 5 4] [3 2 1]
julia> RowReducedEchelonForm(mat) ([3 0 -3; 0 1 2; 0 0 0], 2)
julia> mat = HomalgMatrix(reverse(1:9), 3, 3, QQ) [9 8 7] [6 5 4] [3 2 1]
julia> RowReducedEchelonForm(mat) ([1 0 -1; 0 1 2; 0 0 0], 2)
MatricesForHomalg.SafeLeftDivide
— MethodSafeLeftDivide(A, B, L)
Returns: a homalg matrix
Same as LeftDivide, but asserts that the result is not fail.
julia> A = HomalgMatrix(1:6, 3, 2, ZZ)
[1 2]
[3 4]
[5 6]
julia> L = HomalgMatrix(2:7, 3, 2, ZZ)
[2 3]
[4 5]
[6 7]
julia> B = HomalgMatrix([5, 5, 11, 9, 17, 13], 3, 2, ZZ)
[ 5 5]
[11 9]
[17 13]
julia> SafeLeftDivide(A, B, L)
[0 0]
[0 0]
julia> B = HomalgMatrix([3, 5, 0, 9, 11, 13], 3, 2, ZZ)
[ 3 5]
[ 0 9]
[11 13]
julia> SafeLeftDivide(A, B, L)
ERROR: Unable to solve linear system
MatricesForHomalg.SafeLeftDivide
— MethodSafeLeftDivide(A, B)
Returns: a homalg matrix
Same as LeftDivide, but asserts that the result is not fail.
julia> A = HomalgMatrix(1:6, 3, 2, ZZ)
[1 2]
[3 4]
[5 6]
julia> B = HomalgMatrix(2:7, 3, 2, ZZ)
[2 3]
[4 5]
[6 7]
julia> C = HomalgMatrix([1,0,0,0,0,0], 3, 2, ZZ)
[1 0]
[0 0]
[0 0]
julia> SafeLeftDivide(B, B)
[1 0]
[0 1]
julia> SafeLeftDivide(A, B)
[0 -1]
[1 2]
julia> SafeLeftDivide(C, B)
ERROR: Unable to solve linear system
MatricesForHomalg.SafeRightDivide
— MethodSafeRightDivide(B, A, L)
Returns: a homalg matrix
Same as RightDivide, but asserts that the result is not fail.
julia> A = HomalgMatrix(1:9, 3, 3, ZZ)
[1 2 3]
[4 5 6]
[7 8 9]
julia> B = HomalgMatrix([3, 5, 7, 13, 16, 19, 29, 33, 37], 3, 3, ZZ)
[ 3 5 7]
[13 16 19]
[29 33 37]
julia> L = HomalgMatrix(2:10, 3, 3, ZZ)
[2 3 4]
[5 6 7]
[8 9 10]
julia> X = SafeRightDivide(B, A, L)
[0 0 -2]
[0 0 -1]
[0 0 0]
julia> Y = HomalgMatrix([1, 3, 0, 0, 4, 0, -3, 7, 0], 3, 3, ZZ)
[ 1 3 0]
[ 0 4 0]
[-3 7 0]
julia> X*A+Y*L
[ 3 5 7]
[13 16 19]
[29 33 37]
julia> B = HomalgMatrix([3, 5, 7, 0, 16, 19, 0, 33, 37], 3, 3, ZZ)
[3 5 7]
[0 16 19]
[0 33 37]
julia> SafeRightDivide(B, A, L)
ERROR: Unable to solve linear system
MatricesForHomalg.SafeRightDivide
— MethodSafeRightDivide(B, A)
Returns: a homalg matrix
Same as RightDivide, but asserts that the result is not fail.
julia> A = HomalgMatrix(1:6, 3, 2, ZZ)
[1 2]
[3 4]
[5 6]
julia> B = HomalgMatrix(3:8, 3, 2, ZZ)
[3 4]
[5 6]
[7 8]
julia> SafeRightDivide(B, A)
[0 1 0]
[0 0 1]
[0 -1 2]
julia> SafeRightDivide(A, B)
[0 3 -2]
[0 2 -1]
[0 1 0]
julia> SafeRightDivide(B, B)
[0 2 -1]
[0 1 0]
[0 0 1]
julia> B = HomalgMatrix(4:9, 3, 2, ZZ)
[4 5]
[6 7]
[8 9]
julia> SafeRightDivide(A, B)
ERROR: Unable to solve linear system
MatricesForHomalg.StringDisplay
— MethodStringDisplay(mat)
Returns the matrix mat as a string.
julia> mat = HomalgMatrix(4:9, 3, 2, ZZ)
[4 5]
[6 7]
[8 9]
julia> StringDisplay(mat)
"[4 5; 6 7; 8 9]"
MatricesForHomalg.SyzygiesOfColumns
— MethodSyzygiesOfColumns(A, N)
Returns: a homalg matrix
Let R be the ring over which M is defined. The matrix of relative column syzygies SyzygiesOfColumns(A,N) is a matrix whose columns span the right kernel of A modulo N, i.e. the R-submodule of the free right module R(NrColumns(A)×1)consisting of all columns K satisfying AK+NL=0 for some column L∈R(NrColumns(N)×1).
julia> A = HomalgMatrix(1:6, 3, 2, ZZ)
[1 2]
[3 4]
[5 6]
julia> N = HomalgMatrix(2:7, 3, 2, ZZ)
[2 3]
[4 5]
[6 7]
julia> SyzygiesOfColumns(A, N)
[1 0]
[0 1]
MatricesForHomalg.SyzygiesOfColumns
— MethodSyzygiesOfColumns(A)
Return a homalg matrix. Let R be the ring over which A is defined (R:=HomalgRing(A)). The matrix of column syzygies SyzygiesGeneratorsOfColumns(A) is a matrix whose columns span the right kernel of A, i.e. the R-submodule of the free right module R(NrColumns(A)x1) consisting of all columns X satisfying AX=0
julia> A = TransposedMatrix(HomalgMatrix(4:9, 3, 2, ZZ))
[4 6 8]
[5 7 9]
julia> S = SyzygiesOfColumns(A)
[ 1]
[-2]
[ 1]
julia> A*S
[0]
[0]
MatricesForHomalg.SyzygiesOfRows
— MethodSyzygiesOfRows(A, N)
Returns: a homalg matrix
Let R be the ring over which A is defined. The matrix of relative row syzygies SyzygiesOfRows(A, N) is a matrix whose rows span the left kernel of A modulo N, i.e. the R-submodule of the free left module R(1×NrRows(A)) consisting of all rows K satisfying KA+LN=0 for some row L∈R(1×NrRows(N)).
julia> A = HomalgMatrix(1:9, 3, 3, ZZ)
[1 2 3]
[4 5 6]
[7 8 9]
julia> N = HomalgMatrix(2:10, 3, 3, ZZ)
[2 3 4]
[5 6 7]
[8 9 10]
julia> SyzygiesOfRows(A, N)
[1 0 2]
[0 1 2]
[0 0 3]
julia> SyzygiesOfRows(A,A)
[1 0 0]
[0 1 0]
[0 0 1]
MatricesForHomalg.SyzygiesOfRows
— MethodSyzygiesOfRows(A)
Return a homalg matrix. Let R be the ring over which A is defined (R:= HomalgRing(A)). The matrix of row syzygies SyzygiesGeneratorsOfRows(A) is a matrix whose rows span the left kernel of A, i.e. the R-submodule of the free left module R(1xNrRows(A)) consisting of all rows X satisfying XA=0
julia> A = HomalgMatrix(4:9, 3, 2, ZZ)
[4 5]
[6 7]
[8 9]
julia> S = SyzygiesOfRows(A)
[1 -2 1]
julia> S*A
[0 0]
MatricesForHomalg.TransposedMatrix
— MethodTransposedMatrix(mat)
Return the transposed matrix of mat
julia> mat = HomalgMatrix(1:6, 2, 3, ZZ)
[1 2 3]
[4 5 6]
julia> TransposedMatrix(mat)
[1 4]
[2 5]
[3 6]
MatricesForHomalg.UnionOfColumns
— MethodUnionOfColumns(R, nr_rows, list)
Return the matrices in list augmented, where all of them have same number of rows nr_rows. .
julia> UnionOfColumns(ZZ, 2, [])
2 by 0 empty matrix
julia> mat = HomalgMatrix(1:6, 2, 3, ZZ)
[1 2 3]
[4 5 6]
julia> UnionOfColumns(ZZ, 2, [mat, mat])
[1 2 3 1 2 3]
[4 5 6 4 5 6]
MatricesForHomalg.UnionOfRows
— MethodUnionOfRows(R, nr_cols, list)
Return the matrices in list stacked, where all of them have same number of columns nr_cols.
julia> UnionOfRows(ZZ, 3, [])
0 by 3 empty matrix
julia> mat = HomalgMatrix(1:6, 2, 3, ZZ)
[1 2 3]
[4 5 6]
julia> UnionOfRows(ZZ, 3, [mat, mat])
[1 2 3]
[4 5 6]
[1 2 3]
[4 5 6]
MatricesForHomalg.UniqueLeftDivide
— MethodUniqueLeftDivide(A, B)
Returns: a homalg matrix
Same as SafeLeftDivide, but asserts that the solution is unique.
julia> A = HomalgMatrix(1:6, 3, 2, ZZ)
[1 2]
[3 4]
[5 6]
julia> B = HomalgMatrix(2:7, 3, 2, ZZ)
[2 3]
[4 5]
[6 7]
julia> UniqueLeftDivide(B, B)
[1 0]
[0 1]
julia> A = HomalgMatrix([1,2,3,0,5,6,0,0,0], 3, 3, ZZ)
[1 2 3]
[0 5 6]
[0 0 0]
julia> B = HomalgMatrix([1,2,0], 3, 1, ZZ)
[1]
[2]
[0]
julia> UniqueLeftDivide(A, B)
ERROR: The inhomogeneous linear system of equations AX=B has no unique solution
MatricesForHomalg.UniqueRightDivide
— MethodUniqueRightDivide(B, A)
Returns: a homalg matrix
Same as SafeRightDivide, but asserts that the solution is unique.
julia> A = HomalgMatrix(1:6, 3, 2, ZZ)
[1 2]
[3 4]
[5 6]
julia> B = HomalgMatrix(3:8, 3, 2, ZZ)
[3 4]
[5 6]
[7 8]
julia> RightDivide(B, A)
[0 1 0]
[0 0 1]
[0 -1 2]
julia> UniqueRightDivide(B, A)
ERROR: The inhomogeneous linear system of equations XA=B has no unique solution
julia> mat = HomalgIdentityMatrix(3, ZZ)
[1 0 0]
[0 1 0]
[0 0 1]
julia> UniqueRightDivide(mat, mat)
[1 0 0]
[0 1 0]
[0 0 1]
MatricesForHomalg.ZeroColumns
— MethodZeroColumns(mat)
Return a (possibly empty) list of positive integers. The list of zero columns of the matrix A.
julia> mat = HomalgMatrix(4:9, 2, 3, ZZ)
[4 5 6]
[7 8 9]
julia> ZeroColumns(mat)
Int64[]
julia> mat = HomalgMatrix([0, 2, 6, 0, 0, 0], 2, 3, ZZ)
[0 2 6]
[0 0 0]
julia> ZeroColumns(mat)
1-element Vector{Int64}:
1
julia> mat = HomalgZeroMatrix(3,3,ZZ)
[0 0 0]
[0 0 0]
[0 0 0]
julia> ZeroColumns(mat)
3-element Vector{Int64}:
1
2
3
MatricesForHomalg.ZeroRows
— MethodZeroRows(mat)
Return a (possibly empty) list of positive integers. The list of zero rows of the matrix A.
julia> mat = HomalgMatrix(4:9, 3, 2, ZZ)
[4 5]
[6 7]
[8 9]
julia> ZeroRows(mat)
Int64[]
julia> mat = HomalgMatrix([0, 2, 6, 0, 0, 0], 3, 2, ZZ)
[0 2]
[6 0]
[0 0]
julia> ZeroRows(mat)
1-element Vector{Int64}:
3
julia> mat = HomalgZeroMatrix(3,3,ZZ)
[0 0 0]
[0 0 0]
[0 0 0]
julia> ZeroRows(mat)
3-element Vector{Int64}:
1
2
3