Goto Chapter: Top 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 A B C D E F G H I Bib Ind
Top of Book Previous Chapter Next Chapter

6 Matrices
6.1 Matrices: Category and Representations
6.1-1 IsHomalgMatrix
6.1-2 IsHomalgInternalMatrixRep
6.2 Matrices: Constructors
6.2-1 HomalgInitialMatrix
6.2-2 HomalgInitialIdentityMatrix
6.2-3 HomalgZeroMatrix
6.2-4 HomalgIdentityMatrix
6.2-5 HomalgVoidMatrix
6.2-6 HomalgMatrix
6.2-7 HomalgDiagonalMatrix
6.2-8 \*
6.3 Matrices: Properties
6.3-1 IsZero
6.3-2 IsIdentityMatrix
6.3-3 IsPermutationMatrix
6.3-4 IsSpecialSubidentityMatrix
6.3-5 IsSubidentityMatrix
6.3-6 IsLeftRegularMatrix
6.3-7 IsRightRegularMatrix
6.3-8 IsInvertibleMatrix
6.3-9 IsLeftInvertibleMatrix
6.3-10 IsRightInvertibleMatrix
6.3-11 IsEmptyMatrix
6.3-12 IsDiagonalMatrix
6.3-13 IsScalarlMatrix
6.3-14 IsUpperTriangularMatrix
6.3-15 IsLowerTriangularMatrix
6.3-16 IsStrictUpperTriangularMatrix
6.3-17 IsStrictLowerTriangularMatrix
6.3-18 IsUpperStairCaseMatrix
6.3-19 IsLowerStairCaseMatrix
6.3-20 IsTriangularMatrix
6.3-21 IsBasisOfRowsMatrix
6.3-22 IsBasisOfColumnsMatrix
6.3-23 IsReducedBasisOfRowsMatrix
6.3-24 IsReducedBasisOfColumnsMatrix
6.3-25 IsMutableMatrix
6.3-26 IsInitialMatrix
6.3-27 IsInitialIdentityMatrix
6.3-28 IsVoidMatrix
6.4 Matrices: Attributes
6.4-1 NrRows
6.4-2 NrColumns
6.4-3 DeterminantMat
6.4-4 ZeroRows
6.4-5 ZeroColumns
6.4-6 NonZeroRows
6.4-7 NonZeroColumns
6.4-8 PositionOfFirstNonZeroEntryPerRow
6.4-9 PositionOfFirstNonZeroEntryPerColumn
6.4-10 DegreesOfEntries
6.4-11 RowRankOfMatrix
6.4-12 ColumnRankOfMatrix
6.4-13 LeftInverse
6.4-14 RightInverse
6.5 Matrices: Operations and Functions
6.5-1 HomalgRing
6.5-2 Involution
6.5-3 CertainRows
6.5-4 CertainColumns
6.5-5 UnionOfRows
6.5-6 UnionOfColumns
6.5-7 DiagMat
6.5-8 KroneckerMat
6.5-9 \*
6.5-10 \+
6.5-11 \-
6.5-12 \*
6.5-13 \=
6.5-14 GetColumnIndependentUnitPositions
6.5-15 GetRowIndependentUnitPositions
6.5-16 GetUnitPosition
6.5-17 BasisOfRowModule
6.5-18 BasisOfColumnModule
6.5-19 DecideZeroRows
6.5-20 DecideZeroColumns
6.5-21 SyzygiesGeneratorsOfRows
6.5-22 SyzygiesGeneratorsOfColumns
6.5-23 SyzygiesGeneratorsOfRows
6.5-24 SyzygiesGeneratorsOfColumns
6.5-25 ReducedBasisOfRowModule
6.5-26 ReducedBasisOfColumnModule
6.5-27 ReducedSyzygiesGeneratorsOfRows
6.5-28 ReducedSyzygiesGeneratorsOfColumns
6.5-29 BasisOfRowsCoeff
6.5-30 BasisOfColumnsCoeff
6.5-31 DecideZeroRowsEffectively
6.5-32 DecideZeroColumnsEffectively
6.5-33 BasisOfRows
6.5-34 BasisOfColumns
6.5-35 DecideZero
6.5-36 SyzygiesOfRows
6.5-37 SyzygiesOfColumns
6.5-38 ReducedSyzygiesOfRows
6.5-39 ReducedSyzygiesOfColumns
6.5-40 RightDivide
6.5-41 LeftDivide
6.5-42 RightDivide
6.5-43 LeftDivide
6.5-44 GenerateSameRowModule
6.5-45 GenerateSameColumnModule

### 6 Matrices

#### 6.1 Matrices: Category and Representations

##### 6.1-1 IsHomalgMatrix

`> IsHomalgMatrix`( A ) | ( category )

Returns: `true` or `false`

The GAP category of homalg matrices.

##### 6.1-2 IsHomalgInternalMatrixRep

`> IsHomalgInternalMatrixRep`( A ) | ( representation )

Returns: `true` or `false`

The internal representation of homalg matrices.

(It is a representation of the GAP category `IsHomalgMatrix` (6.1-1).)

#### 6.2 Matrices: Constructors

##### 6.2-1 HomalgInitialMatrix

`> HomalgInitialMatrix`( m, n, R ) | ( function )

Returns: a homalg matrix

A mutable unevaluated initial m x n homalg matrix filled with zeros over the homalg ring R. This construction is useful in case one wants to define a matrix by assigning its nonzero entries. Avoid asking about properties or attributes of the matrix until you finish filling it, since already computed values of properties and attributes will be cached and not recomputed unless the values are explicitly reset (--> `ResetFilterObj` (Prg Tutorial 3.4)).

    gap> ZZ := HomalgRingOfIntegers( );
    <A homalg internal ring>
    gap> z := HomalgInitialMatrix( 2, 3, ZZ );
    <An initial homalg internal 2 by 3 matrix>
    gap> HasIsZero( z );
    false
    gap> IsZero( z );
    true
    gap> z;
    <A homalg internal 2 by 3 zero matrix>

    gap> n := HomalgInitialMatrix( 2, 3, ZZ );
    <An initial homalg internal 2 by 3 matrix>
    gap> SetEntryOfHomalgMatrix( n, 1, 1, "1" );
    gap> SetEntryOfHomalgMatrix( n, 2, 3, "1" );
    gap> ResetFilterObj( n, IsMutableMatrix );
    gap> Display( n );
    [ [  1,  0,  0 ],
      [  0,  0,  1 ] ]
    gap> IsZero( n );
    false
    gap> n;
    <A non-zero homalg internal 2 by 3 matrix>

##### 6.2-2 HomalgInitialIdentityMatrix

`> HomalgInitialIdentityMatrix`( m, R ) | ( function )

Returns: a homalg matrix

A mutable unevaluated initial m x m homalg quadratic matrix with ones on the diagonal over the homalg ring R. This construction is useful in case one wants to define an elementary matrix by assigning its off-diagonal nonzero entries. Avoid asking about properties or attributes of the matrix until you finish filling it, since already computed values of properties and attributes will be cached and not recomputed unless the values are explicitly reset (--> `ResetFilterObj` (Prg Tutorial 3.4)).

    gap> ZZ := HomalgRingOfIntegers( );
    <A homalg internal ring>
    gap> id := HomalgInitialIdentityMatrix( 3, ZZ );
    <An initial identity homalg internal 3 by 3 matrix>
    gap> HasIsIdentityMatrix( id );
    false
    gap> IsIdentityMatrix( id );
    true
    gap> id;
    <A homalg internal 3 by 3 identity matrix>

    gap> e := HomalgInitialIdentityMatrix( 3, ZZ );
    <An initial identity homalg internal 3 by 3 matrix>
    gap> SetEntryOfHomalgMatrix( e, 1, 2, "1" );
    gap> SetEntryOfHomalgMatrix( e, 2, 1, "-1" );
    gap> ResetFilterObj( e, IsMutableMatrix );
    gap> Display( e );
    [ [   1,   1,   0 ],
      [  -1,   1,   0 ],
      [   0,   0,   1 ] ]
    gap> IsIdentityMatrix( e );
    false
    gap> e;
    <A homalg internal 3 by 3 matrix>

##### 6.2-3 HomalgZeroMatrix

`> HomalgZeroMatrix`( m, n, R ) | ( function )

Returns: a homalg matrix

An immutable unevaluated m x n homalg zero matrix over the homalg ring R.

    gap> ZZ := HomalgRingOfIntegers( );
    <A homalg internal ring>
    gap> z := HomalgZeroMatrix( 2, 3, ZZ );
    <An unevaluated homalg internal 2 by 3 zero matrix>
    gap> Display( z );
    [ [  0,  0,  0 ],
      [  0,  0,  0 ] ]
    gap> z;
    <A homalg internal 2 by 3 zero matrix>

##### 6.2-4 HomalgIdentityMatrix

`> HomalgIdentityMatrix`( m, R ) | ( function )

Returns: a homalg matrix

An immutable unevaluated m x m homalg identity matrix over the homalg ring R.

    gap> ZZ := HomalgRingOfIntegers( );
    <A homalg internal ring>
    gap> id := HomalgIdentityMatrix( 3, ZZ );
    <An unevaluated homalg internal 3 by 3 identity matrix>
    gap> Display( id );
    [ [  1,  0,  0 ],
      [  0,  1,  0 ],
      [  0,  0,  1 ] ]
    gap> id;
    <A homalg internal 3 by 3 identity matrix>

##### 6.2-5 HomalgVoidMatrix

`> HomalgVoidMatrix`( [m, ][n, ]R ) | ( function )

Returns: a homalg matrix

A void m x n homalg matrix.

##### 6.2-6 HomalgMatrix

`> HomalgMatrix`( llist, R ) | ( function )

`> HomalgMatrix`( list, m, n, R ) | ( function )

`> HomalgMatrix`( str_llist, R ) | ( function )

`> HomalgMatrix`( str_list, m, n, R ) | ( function )

Returns: a homalg matrix

An immutable evaluated m x n homalg matrix over the homalg ring R.

    gap> ZZ := HomalgRingOfIntegers( );
    <A homalg internal ring>
    gap> m := HomalgMatrix( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], ZZ );
    <A homalg internal 2 by 3 matrix>
    gap> Display( m );
    [ [  1,  2,  3 ],
      [  4,  5,  6 ] ]

    gap> m := HomalgMatrix( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ], 2, 3, ZZ );
    <A homalg internal 2 by 3 matrix>
    gap> Display( m );
    [ [  1,  2,  3 ],
      [  4,  5,  6 ] ]

    gap> m := HomalgMatrix( [ 1, 2, 3,   4, 5, 6 ], 2, 3, ZZ );
    <A homalg internal 2 by 3 matrix>
    gap> Display( m );
    [ [  1,  2,  3 ],
      [  4,  5,  6 ] ]

    gap> m := HomalgMatrix( "[ [ 1, 2, 3 ], [ 4, 5, 6 ] ]", ZZ );
    <A homalg internal 2 by 3 matrix>
    gap> Display( m );
    [ [  1,  2,  3 ],
      [  4,  5,  6 ] ]

    gap> m := HomalgMatrix( "[ [ 1, 2, 3 ], [ 4, 5, 6 ] ]", 2, 3, ZZ );
    <A homalg internal 2 by 3 matrix>
    gap> Display( m );
    [ [  1,  2,  3 ],
      [  4,  5,  6 ] ]

It is nevertheless recommended to use the following form to create homalg matrices. This form can also be used to define external matrices. Since whitespaces (--> Reference: Whitespaces) are ignored, they can be used as optical delimiters:

    gap> m := HomalgMatrix( "[ 1, 2, 3,   4, 5, 6 ]", 2, 3, ZZ );
    <A homalg internal 2 by 3 matrix>
    gap> Display( m );
    [ [  1,  2,  3 ],
      [  4,  5,  6 ] ]

One can split the input string over several lines using the backslash character '\' to end each line

    gap> m := HomalgMatrix( "[ \
    > 1, 2, 3, \
    > 4, 5, 6  \
    > ]", 2, 3, ZZ );
    <A homalg internal 2 by 3 matrix>
    gap> Display( m );
    [ [  1,  2,  3 ],
      [  4,  5,  6 ] ]

##### 6.2-7 HomalgDiagonalMatrix

`> HomalgDiagonalMatrix`( diag, R ) | ( function )

Returns: a homalg matrix

An immutable unevaluated diagonal homalg matrix over the homalg ring R. The diagonal consists of the entries of the list diag.

    gap> ZZ := HomalgRingOfIntegers( );
    <A homalg internal ring>
    gap> d := HomalgDiagonalMatrix( [ 1, 2, 3 ], ZZ );
    <An unevaluated diagonal homalg internal 3 by 3 matrix>
    gap> Display( d );
    [ [  1,  0,  0 ],
      [  0,  2,  0 ],
      [  0,  0,  3 ] ]
    gap> d;
    <A diagonal homalg internal 3 by 3 matrix>

##### 6.2-8 \*

`> \*`( R, mat ) | ( operation )

`> \*`( mat, R ) | ( operation )

Returns: a homalg matrix

An immutable evaluated homalg matrix over the homalg ring R having the same entries as the matrix mat. Syntax: R `*` mat or mat `*` R

    gap> ZZ := HomalgRingOfIntegers( );
    <A homalg internal ring>
    gap> Z4 := ZZ / 4;
    <A homalg residue class ring>
    gap> Display( Z4 );
    Z/( 4 )
    gap> d := HomalgDiagonalMatrix( [ 2 .. 4 ], ZZ );
    <An unevaluated diagonal homalg internal 3 by 3 matrix>
    gap> d2 := Z4 * d; ## or d2 := d * Z4;
    <A homalg residue class 3 by 3 matrix>
    gap> Display( d2 );
    [ [  2,  0,  0 ],
      [  0,  3,  0 ],
      [  0,  0,  4 ] ]

    modulo [ 4 ]
    gap> d;
    <A diagonal homalg internal 3 by 3 matrix>
    gap> ZeroRows( d );
    [  ]
    gap> ZeroRows( d2 );
    [ 3 ]
    gap> d;
    <A non-zero diagonal homalg internal 3 by 3 matrix>
    gap> d2;
    <A non-zero homalg residue class 3 by 3 matrix>

#### 6.3 Matrices: Properties

##### 6.3-1 IsZero

`> IsZero`( A ) | ( property )

Returns: `true` or `false`

Check if the homalg matrix A is a zero matrix, taking possible ring relations into account.

(for the installed standard method see `IsZeroMatrix` (D.1-16))

    gap> ZZ := HomalgRingOfIntegers( );
    <A homalg internal ring>
    gap> A := HomalgMatrix( "[ 2 ]", ZZ );
    <A homalg internal 1 by 1 matrix>
    gap> Z2 := ZZ / 2;
    <A homalg residue class ring>
    gap> A := Z2 * A;
    <A homalg residue class 1 by 1 matrix>
    gap> Display( A );
    [ [  2 ] ]

    modulo [ 2 ]
    gap> IsZero( A );
    true

##### 6.3-2 IsIdentityMatrix

`> IsIdentityMatrix`( A ) | ( property )

Returns: `true` or `false`

Check if the homalg matrix A is an identity matrix, taking possible ring relations into account.

(for the installed standard method see `IsIdentityMatrix` (D.2-2))

##### 6.3-3 IsPermutationMatrix

`> IsPermutationMatrix`( A ) | ( property )

Returns: `true` or `false`

A is a homalg matrix.

##### 6.3-4 IsSpecialSubidentityMatrix

`> IsSpecialSubidentityMatrix`( A ) | ( property )

Returns: `true` or `false`

A is a homalg matrix.

##### 6.3-5 IsSubidentityMatrix

`> IsSubidentityMatrix`( A ) | ( property )

Returns: `true` or `false`

A is a homalg matrix.

##### 6.3-6 IsLeftRegularMatrix

`> IsLeftRegularMatrix`( A ) | ( property )

Returns: `true` or `false`

A is a homalg matrix.

##### 6.3-7 IsRightRegularMatrix

`> IsRightRegularMatrix`( A ) | ( property )

Returns: `true` or `false`

A is a homalg matrix.

##### 6.3-8 IsInvertibleMatrix

`> IsInvertibleMatrix`( A ) | ( property )

Returns: `true` or `false`

A is a homalg matrix.

##### 6.3-9 IsLeftInvertibleMatrix

`> IsLeftInvertibleMatrix`( A ) | ( property )

Returns: `true` or `false`

A is a homalg matrix.

##### 6.3-10 IsRightInvertibleMatrix

`> IsRightInvertibleMatrix`( A ) | ( property )

Returns: `true` or `false`

A is a homalg matrix.

##### 6.3-11 IsEmptyMatrix

`> IsEmptyMatrix`( A ) | ( property )

Returns: `true` or `false`

A is a homalg matrix.

##### 6.3-12 IsDiagonalMatrix

`> IsDiagonalMatrix`( A ) | ( property )

Returns: `true` or `false`

Check if the homalg matrix A is an identity matrix, taking possible ring relations into account.

(for the installed standard method see `IsDiagonalMatrix` (D.2-3))

##### 6.3-13 IsScalarlMatrix

`> IsScalarlMatrix`( A ) | ( property )

Returns: `true` or `false`

A is a homalg matrix.

##### 6.3-14 IsUpperTriangularMatrix

`> IsUpperTriangularMatrix`( A ) | ( property )

Returns: `true` or `false`

A is a homalg matrix.

##### 6.3-15 IsLowerTriangularMatrix

`> IsLowerTriangularMatrix`( A ) | ( property )

Returns: `true` or `false`

A is a homalg matrix.

##### 6.3-16 IsStrictUpperTriangularMatrix

`> IsStrictUpperTriangularMatrix`( A ) | ( property )

Returns: `true` or `false`

A is a homalg matrix.

##### 6.3-17 IsStrictLowerTriangularMatrix

`> IsStrictLowerTriangularMatrix`( A ) | ( property )

Returns: `true` or `false`

A is a homalg matrix.

##### 6.3-18 IsUpperStairCaseMatrix

`> IsUpperStairCaseMatrix`( A ) | ( property )

Returns: `true` or `false`

A is a homalg matrix.

##### 6.3-19 IsLowerStairCaseMatrix

`> IsLowerStairCaseMatrix`( A ) | ( property )

Returns: `true` or `false`

A is a homalg matrix.

##### 6.3-20 IsTriangularMatrix

`> IsTriangularMatrix`( A ) | ( property )

Returns: `true` or `false`

A is a homalg matrix.

##### 6.3-21 IsBasisOfRowsMatrix

`> IsBasisOfRowsMatrix`( A ) | ( property )

Returns: `true` or `false`

A is a homalg matrix.

##### 6.3-22 IsBasisOfColumnsMatrix

`> IsBasisOfColumnsMatrix`( A ) | ( property )

Returns: `true` or `false`

A is a homalg matrix.

##### 6.3-23 IsReducedBasisOfRowsMatrix

`> IsReducedBasisOfRowsMatrix`( A ) | ( property )

Returns: `true` or `false`

A is a homalg matrix.

##### 6.3-24 IsReducedBasisOfColumnsMatrix

`> IsReducedBasisOfColumnsMatrix`( A ) | ( property )

Returns: `true` or `false`

A is a homalg matrix.

##### 6.3-25 IsMutableMatrix

`> IsMutableMatrix`( A ) | ( filter )

Returns: `true` or `false`

A is a homalg matrix.

##### 6.3-26 IsInitialMatrix

`> IsInitialMatrix`( A ) | ( property )

Returns: `true` or `false`

A is a homalg matrix.

##### 6.3-27 IsInitialIdentityMatrix

`> IsInitialIdentityMatrix`( A ) | ( property )

Returns: `true` or `false`

A is a homalg matrix.

##### 6.3-28 IsVoidMatrix

`> IsVoidMatrix`( A ) | ( property )

Returns: `true` or `false`

A is a homalg matrix.

#### 6.4 Matrices: Attributes

##### 6.4-1 NrRows

`> NrRows`( A ) | ( attribute )

Returns: a nonnegative integer

The number of rows of the matrix A.

(for the installed standard method see `NrRows` (D.1-17))

##### 6.4-2 NrColumns

`> NrColumns`( A ) | ( attribute )

Returns: a nonnegative integer

The number of columns of the matrix A.

(for the installed standard method see `NrColumns` (D.1-18))

##### 6.4-3 DeterminantMat

`> DeterminantMat`( A ) | ( attribute )

Returns: a ring element

The determinant of the quadratic matrix A.

You can invoke it with `Determinant`( A ).

(for the installed standard method see `Determinant` (D.1-19))

##### 6.4-4 ZeroRows

`> ZeroRows`( A ) | ( attribute )

Returns: a (possibly empty) list of positive integers

The list of zero rows of the matrix A.

(for the installed standard method see `ZeroRows` (D.2-4))

##### 6.4-5 ZeroColumns

`> ZeroColumns`( A ) | ( attribute )

Returns: a (possibly empty) list of positive integers

The list of zero columns of the matrix A.

(for the installed standard method see `ZeroColumns` (D.2-5))

##### 6.4-6 NonZeroRows

`> NonZeroRows`( A ) | ( attribute )

Returns: a (possibly empty) list of positive integers

The list of nonzero rows of the matrix A.

##### 6.4-7 NonZeroColumns

`> NonZeroColumns`( A ) | ( attribute )

Returns: a (possibly empty) list of positive integers

The list of nonzero columns of the matrix A.

##### 6.4-8 PositionOfFirstNonZeroEntryPerRow

`> PositionOfFirstNonZeroEntryPerRow`( A ) | ( attribute )

Returns: a list of nonnegative integers

The list of positions of the first nonzero entry per row of the matrix A, else zero.

##### 6.4-9 PositionOfFirstNonZeroEntryPerColumn

`> PositionOfFirstNonZeroEntryPerColumn`( A ) | ( attribute )

Returns: a list of nonnegative integers

The list of positions of the first nonzero entry per column of the matrix A, else zero.

##### 6.4-10 DegreesOfEntries

`> DegreesOfEntries`( A ) | ( attribute )

Returns: a listlist of degrees/multi-degrees

The matrix of degrees of the matrix A.

(for the installed standard method see `DegreesOfEntries` (D.2-9))

##### 6.4-11 RowRankOfMatrix

`> RowRankOfMatrix`( A ) | ( attribute )

Returns: a nonnegative integer

The row rank of the matrix A.

##### 6.4-12 ColumnRankOfMatrix

`> ColumnRankOfMatrix`( A ) | ( attribute )

Returns: a nonnegative integer

The column rank of the matrix A.

##### 6.4-13 LeftInverse

`> LeftInverse`( M ) | ( method )

Returns: a homalg matrix

A (lazy evaluated) left inverse C of the matrix M. If no left inverse exists then `Eval`( C ) = `false`. (--> `RightDivide` (6.5-40))

(for the installed standard method see `Eval` (E.4-16))

##### 6.4-14 RightInverse

`> RightInverse`( M ) | ( attribute )

Returns: a homalg matrix

A (lazy evaluated) right inverse C of the matrix M. If no right inverse exists then `Eval`( C ) = `false`. (--> `LeftDivide` (6.5-41))

(for the installed standard method see `Eval` (E.4-17))

#### 6.5 Matrices: Operations and Functions

##### 6.5-1 HomalgRing

`> HomalgRing`( mat ) | ( operation )

Returns: a homalg ring

The homalg ring of the homalg matrix mat.

    gap> ZZ := HomalgRingOfIntegers( );
    <A homalg internal ring>
    gap> d := HomalgDiagonalMatrix( [ 2 .. 4 ], ZZ );
    <An unevaluated diagonal homalg internal 3 by 3 matrix>
    gap> R := HomalgRing( d );
    <A homalg internal ring>
    gap> IsIdenticalObj( R, ZZ );
    true

##### 6.5-2 Involution

`> Involution`( M ) | ( method )

Returns: a homalg matrix

The twisted transpose of the homalg matrix M.

(for the installed standard method see `Eval` (E.4-5))

##### 6.5-3 CertainRows

`> CertainRows`( M, plist ) | ( method )

Returns: a homalg matrix

The matrix of which the i-th row is the k-th row of the homalg matrix M, where k=plist[i].

(--> `Eval` (E.4-6))

##### 6.5-4 CertainColumns

`> CertainColumns`( M, plist ) | ( method )

Returns: a homalg matrix

The matrix of which the j-th column is the l-th column of the homalg matrix M, where l=plist[i].

(for the installed standard method see `Eval` (E.4-7))

##### 6.5-5 UnionOfRows

`> UnionOfRows`( A, B ) | ( method )

Returns: a homalg matrix

Stack the two homalg matrices A and B.

(for the installed standard method see `Eval` (E.4-8))

##### 6.5-6 UnionOfColumns

`> UnionOfColumns`( A, B ) | ( method )

Returns: a homalg matrix

Augment the two homalg matrices A and B.

(for the installed standard method see `Eval` (E.4-9))

##### 6.5-7 DiagMat

`> DiagMat`( list ) | ( method )

Returns: a homalg matrix

Build the block diagonal matrix out of the homalg matrices listed in list. An error is issued if list is empty or if one of the arguments is not a homalg matrix.

(for the installed standard method see `Eval` (E.4-10))

##### 6.5-8 KroneckerMat

`> KroneckerMat`( A, B ) | ( method )

Returns: a homalg matrix

The Kronecker (or tensor) product of the two homalg matrices A and B.

(for the installed standard method see `Eval` (E.4-11))

##### 6.5-9 \*

`> \*`( a, A ) | ( method )

Returns: a homalg matrix

The product of the ring element a with the homalg matrix A (enter: a `*` A;).

(for the installed standard method see `Eval` (E.4-12))

##### 6.5-10 \+

`> \+`( A, B ) | ( method )

Returns: a homalg matrix

The sum of the two homalg matrices A and B (enter: A `+` B;).

(for the installed standard method see `Eval` (E.4-13))

##### 6.5-11 \-

`> \-`( A, B ) | ( method )

Returns: a homalg matrix

The difference of the two homalg matrices A and B (enter: A `-` B;).

(for the installed standard method see `Eval` (E.4-14))

##### 6.5-12 \*

`> \*`( A, B ) | ( method )

Returns: a homalg matrix

The matrix product of the two homalg matrices A and B (enter: A `*` B;).

(for the installed standard method see `Eval` (E.4-15))

##### 6.5-13 \=

`> \=`( A, B ) | ( operation )

Returns: `true` or `false`

Check if the homalg matrices A and B are equal (enter: A `=` B;), taking possible ring relations into account.

(for the installed standard method see `AreEqualMatrices` (D.2-1))

    gap> ZZ := HomalgRingOfIntegers( );
    <A homalg internal ring>
    gap> A := HomalgMatrix( "[ 1 ]", ZZ );
    <A homalg internal 1 by 1 matrix>
    gap> B := HomalgMatrix( "[ 3 ]", ZZ );
    <A homalg internal 1 by 1 matrix>
    gap> Z2 := ZZ / 2;
    <A homalg residue class ring>
    gap> A := Z2 * A;
    <A homalg residue class 1 by 1 matrix>
    gap> B := Z2 * B;
    <A homalg residue class 1 by 1 matrix>
    gap> Display( A );
    [ [  1 ] ]

    modulo [ 2 ]
    gap> Display( B );
    [ [  3 ] ]

    modulo [ 2 ]
    gap> A = B;
    true

##### 6.5-14 GetColumnIndependentUnitPositions

`> GetColumnIndependentUnitPositions`( A, poslist ) | ( operation )

Returns: a (possibly empty) list of pairs of positive integers

The list of column independet unit position of the matrix A. We say that a unit A[i,k] is column independet from the unit A[l,j] if i>l and A[l,k]=0. The rows are scanned from top to bottom and within each row the columns are scanned from right to left searching for new units, column independent from the preceding ones. If A[i,k] is a new column independent unit then [i,k] is added to the output list. If A has no units the empty list is returned.

(for the installed standard method see `GetColumnIndependentUnitPositions` (D.2-6))

##### 6.5-15 GetRowIndependentUnitPositions

`> GetRowIndependentUnitPositions`( A, poslist ) | ( operation )

Returns: a (possibly empty) list of pairs of positive integers

The list of row independet unit position of the matrix A. We say that a unit A[k,j] is row independet from the unit A[i,l] if j>l and A[k,l]=0. The columns are scanned from left to right and within each column the rows are scanned from bottom to top searching for new units, row independent from the preceding ones. If A[k,j] is a new row independent unit then [j,k] (yes [j,k]) is added to the output list. If A has no units the empty list is returned.

(for the installed standard method see `GetRowIndependentUnitPositions` (D.2-7))

##### 6.5-16 GetUnitPosition

`> GetUnitPosition`( A, poslist ) | ( operation )

Returns: a (possibly empty) list of pairs of positive integers

The position [i,j] of the first unit A[i,j] in the matrix A, where the rows are scanned from top to bottom and within each row the columns are scanned from left to right. If A[i,j] is the first occurrence of a unit then the position pair [i,j] is returned. Otherwise `fail` is returned.

(for the installed standard method see `GetUnitPosition` (D.2-8))

##### 6.5-17 BasisOfRowModule

`> BasisOfRowModule`( M ) | ( operation )

Returns: a homalg matrix

Let R be the ring over which M is defined (R:=`HomalgRing`( M )) and S be the row span of M, i.e. the R-submodule of the free module R^(1 x NrColumns( M )) spanned by the rows of M. A solution to the "submodule membership problem" is an algorithm which can decide if an element m in R^(1 x NrColumns( M )) is contained in S or not. And exactly like the Gaussian (resp. Hermite) normal form when R is a field (resp. principal ideal ring), the row span of the resulting matrix B coincides with the row span S of M, and computing B is typically the first step of such an algorithm. (--> Appendix B)

##### 6.5-18 BasisOfColumnModule

`> BasisOfColumnModule`( M ) | ( operation )

Returns: a homalg matrix

Let R be the ring over which M is defined (R:=`HomalgRing`( M )) and S be the column span of M, i.e. the R-submodule of the free module R^(NrRows( M ) x 1) spanned by the columns of M. A solution to the "submodule membership problem" is an algorithm which can decide if an element m in R^(NrRows( M ) x 1) is contained in S or not. And exactly like the Gaussian (resp. Hermite) normal form when R is a field (resp. principal ideal ring), the column span of the resulting matrix B coincides with the column span S of M, and computing B is typically the first step of such an algorithm. (--> Appendix B)

##### 6.5-19 DecideZeroRows

`> DecideZeroRows`( A, B ) | ( operation )

Returns: a homalg matrix

Let A and B be matrices having the same number of columns and defined over the same ring R (:=`HomalgRing`( A )) and S be the row span of B, i.e. the R-submodule of the free module R^(1 x NrColumns( B )) spanned by the rows of B. The result is a matrix C having the same shape as A, for which the i-th row C^i is equivalent to the i-th row A^i of A modulo S, i.e. C^i-A^i is an element of the row span S of B. Moreover, the row C^i is zero, if and only if the row A^i is an element of S. So `DecideZeroRows` decides which rows of A are zero modulo the rows of B. (--> Appendix B)

##### 6.5-20 DecideZeroColumns

`> DecideZeroColumns`( A, B ) | ( operation )

Returns: a homalg matrix

Let A and B be matrices having the same number of rows and defined over the same ring R (:=`HomalgRing`( A )) and S be the column span of B, i.e. the R-submodule of the free module R^(NrRows( B ) x 1) spanned by the columns of B. The result is a matrix C having the same shape as A, for which the i-th column C_i is equivalent to the i-th column A_i of A modulo S, i.e. C_i-A_i is an element of the column span S of B. Moreover, the column C_i is zero, if and only if the column A_i is an element of S. So `DecideZeroColumns` decides which columns of A are zero modulo the columns of B. (--> Appendix B)

##### 6.5-21 SyzygiesGeneratorsOfRows

`> SyzygiesGeneratorsOfRows`( M ) | ( operation )

Returns: a homalg matrix

Let R be the ring over which M is defined (R:=`HomalgRing`( M )). The matrix of row syzygies `SyzygiesGeneratorsOfRows`( M ) is a matrix whose rows span the left kernel of M, i.e. the R-submodule of the free module R^(1 x NrRows( M )) consisting of all rows X satisfying XM=0. (--> Appendix B)

##### 6.5-22 SyzygiesGeneratorsOfColumns

`> SyzygiesGeneratorsOfColumns`( M ) | ( operation )

Returns: a homalg matrix

Let R be the ring over which M is defined (R:=`HomalgRing`( M )). The matrix of column syzygies `SyzygiesGeneratorsOfColumns`( M ) is a matrix whose columns span the right kernel of M, i.e. the R-submodule of the free module R^(NrColumns( M ) x 1) consisting of all columns X satisfying MX=0. (--> Appendix B)

##### 6.5-23 SyzygiesGeneratorsOfRows

`> SyzygiesGeneratorsOfRows`( M, M2 ) | ( operation )

Returns: a homalg matrix

Let R be the ring over which M is defined (R:=`HomalgRing`( M )). The matrix of relative row syzygies `SyzygiesGeneratorsOfRows`( M, M2 ) is a matrix whose rows span the left kernel of M modulo M2, i.e. the R-submodule of the free module R^(1 x NrRows( M )) consisting of all rows X satisfying XM+YM2=0 for some row Y in R^(1 x NrRows( M2 )). (--> Appendix B)

##### 6.5-24 SyzygiesGeneratorsOfColumns

`> SyzygiesGeneratorsOfColumns`( M, M2 ) | ( operation )

Returns: a homalg matrix

Let R be the ring over which M is defined (R:=`HomalgRing`( M )). The matrix of relative column syzygies `SyzygiesGeneratorsOfColumns`( M, M2 ) is a matrix whose columns span the right kernel of M modulo M2, i.e. the R-submodule of the free module R^(NrColumns( M ) x 1) consisting of all columns X satisfying MX+M2Y=0 for some column Y in R^(NrColumns( M2 ) x 1). (--> Appendix B)

##### 6.5-25 ReducedBasisOfRowModule

`> ReducedBasisOfRowModule`( M ) | ( operation )

Returns: a homalg matrix

Like `BasisOfRowModule`( M ) but where the matrix `SyzygiesGeneratorsOfRows`( `ReducedBasisOfRowModule`( M ) ) contains no units. This can easily be achieved starting from B:=`BasisOfRowModule`( M ) (and using `GetColumnIndependentUnitPositions` (6.5-14) applied to the matrix of row syzygies of B, etc). (--> Appendix B)

##### 6.5-26 ReducedBasisOfColumnModule

`> ReducedBasisOfColumnModule`( M ) | ( operation )

Returns: a homalg matrix

Like `BasisOfColumnModule`( M ) but where the matrix `SyzygiesGeneratorsOfColumns`( `ReducedBasisOfColumnModule`( M ) ) contains no units. This can easily be achieved starting from B:=`BasisOfColumnModule`( M ) (and using `GetRowIndependentUnitPositions` (6.5-15) applied to the matrix of column syzygies of B, etc.). (--> Appendix B)

##### 6.5-27 ReducedSyzygiesGeneratorsOfRows

`> ReducedSyzygiesGeneratorsOfRows`( M ) | ( operation )

Returns: a homalg matrix

Like `SyzygiesGeneratorsOfRows`( M ) but where the matrix `SyzygiesGeneratorsOfRows`( `ReducedSyzygiesGeneratorsOfRows`( M ) ) contains no units. This can easily be achieved starting from C:=`SyzygiesGeneratorsOfRows`( M ) (and using `GetColumnIndependentUnitPositions` (6.5-14) applied to the matrix of row syzygies of C, etc.). (--> Appendix B)

##### 6.5-28 ReducedSyzygiesGeneratorsOfColumns

`> ReducedSyzygiesGeneratorsOfColumns`( M ) | ( operation )

Returns: a homalg matrix

Like `SyzygiesGeneratorsOfColumns`( M ) but where the matrix `SyzygiesGeneratorsOfColumns`( `ReducedSyzygiesGeneratorsOfColumns`( M ) ) contains no units. This can easily be achieved starting from C:=`SyzygiesGeneratorsOfColumns`( M ) (and using `GetRowIndependentUnitPositions` (6.5-15) applied to the matrix of column syzygies of C, etc.). (--> Appendix B)

##### 6.5-29 BasisOfRowsCoeff

`> BasisOfRowsCoeff`( M, T ) | ( operation )

Returns: a homalg matrix

Returns B:=`BasisOfRowModule`( M ) and assigns the void matrix T (--> `HomalgVoidMatrix` (6.2-5)) such that B = T M. (--> Appendix B)

##### 6.5-30 BasisOfColumnsCoeff

`> BasisOfColumnsCoeff`( M, T ) | ( operation )

Returns: a homalg matrix

Returns B:=`BasisOfRowModule`( M ) and assigns the void matrix T (--> `HomalgVoidMatrix` (6.2-5)) such that B = M T. (--> Appendix B)

##### 6.5-31 DecideZeroRowsEffectively

`> DecideZeroRowsEffectively`( A, B, T ) | ( operation )

Returns: a homalg matrix

Returns M:=`DecideZeroRows`( A, B ) and assigns the void matrix T (--> `HomalgVoidMatrix` (6.2-5)) such that M = A + TB. (--> Appendix B)

##### 6.5-32 DecideZeroColumnsEffectively

`> DecideZeroColumnsEffectively`( A, B, T ) | ( operation )

Returns: a homalg matrix

Returns M:=`DecideZeroColumns`( A, B ) and assigns the void matrix T (--> `HomalgVoidMatrix` (6.2-5)) such that M = A + BT. (--> Appendix B)

##### 6.5-33 BasisOfRows

`> BasisOfRows`( M ) | ( operation )

`> BasisOfRows`( M, T ) | ( operation )

Returns: a homalg matrix

With one argument it is a synonym of `BasisOfRowModule` (6.5-17). with two arguments it is a synonym of `BasisOfRowsCoeff` (6.5-29).

##### 6.5-34 BasisOfColumns

`> BasisOfColumns`( M ) | ( operation )

`> BasisOfColumns`( M, T ) | ( operation )

Returns: a homalg matrix

With one argument it is a synonym of `BasisOfColumnModule` (6.5-18). with two arguments it is a synonym of `BasisOfColumnsCoeff` (6.5-30).

##### 6.5-35 DecideZero

`> DecideZero`( mat, rel ) | ( operation )

Returns: a homalg matrix

    InstallMethod( DecideZero,
            "for sets of relations of homalg modules",
            [ IsHomalgMatrix, IsHomalgRelations ],

      function( mat, rel )
        local rel_mat;

        rel_mat := MatrixOfRelations( BasisOfModule( rel ) );

        if IsHomalgRelationsOfLeftModule( rel ) then
            return DecideZeroRows( mat, rel_mat );
        else
            return DecideZeroColumns( mat, rel_mat );
        fi;

    end );

##### 6.5-36 SyzygiesOfRows

`> SyzygiesOfRows`( M ) | ( operation )

`> SyzygiesOfRows`( M, M2 ) | ( operation )

Returns: a homalg matrix

With one argument it is a synonym of `SyzygiesGeneratorsOfRows` (6.5-21). with two arguments it is a synonym of `SyzygiesGeneratorsOfRows` (6.5-23).

##### 6.5-37 SyzygiesOfColumns

`> SyzygiesOfColumns`( M ) | ( operation )

`> SyzygiesOfColumns`( M, M2 ) | ( operation )

Returns: a homalg matrix

With one argument it is a synonym of `SyzygiesGeneratorsOfColumns` (6.5-22). with two arguments it is a synonym of `SyzygiesGeneratorsOfColumns` (6.5-24).

##### 6.5-38 ReducedSyzygiesOfRows

`> ReducedSyzygiesOfRows`( M ) | ( operation )

`> ReducedSyzygiesOfRows`( M, M2 ) | ( operation )

Returns: a homalg matrix

With one argument it is a synonym of `ReducedSyzygiesGeneratorsOfRows` (6.5-27). With two arguments it calls `ReducedBasisOfRowModule`( `SyzygiesGeneratorsOfRows`( M, M2 ) ). (--> `ReducedBasisOfRowModule` (6.5-25) and `SyzygiesGeneratorsOfRows` (6.5-23))

##### 6.5-39 ReducedSyzygiesOfColumns

`> ReducedSyzygiesOfColumns`( M ) | ( operation )

`> ReducedSyzygiesOfColumns`( M, M2 ) | ( operation )

Returns: a homalg matrix

With one argument it is a synonym of `ReducedSyzygiesGeneratorsOfColumns` (6.5-28). With two arguments it calls `ReducedBasisOfColumnModule`( `SyzygiesGeneratorsOfColumns`( M, M2 ) ). (--> `ReducedBasisOfColumnModule` (6.5-26) and `SyzygiesGeneratorsOfColumns` (6.5-24))

##### 6.5-40 RightDivide

`> RightDivide`( B, A ) | ( operation )

Returns: a homalg matrix or false

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 `false` is returned. The name `RightDivide` suggests "X=BA^-1". This generalizes `LeftInverse` (6.4-13) for which B becomes the identity matrix. (--> `SyzygiesGeneratorsOfRows` (6.5-21))

##### 6.5-41 LeftDivide

`> LeftDivide`( A, B ) | ( operation )

Returns: a homalg matrix or false

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 `false` is returned. The name `LeftDivide` suggests "X=A^-1B". This generalizes `RightInverse` (6.4-14) for which B becomes the identity matrix. (--> `SyzygiesGeneratorsOfColumns` (6.5-22))

##### 6.5-42 RightDivide

`> RightDivide`( B, A, L ) | ( operation )

`> RightDivide`( B, A, L ) | ( operation )

Returns: a homalg matrix or false

Let B, A and L be matrices having the same number of columns and defined over the same ring (L might also be a set of relations for a left module with `NrGenerators`( L ) = `NrColumns`( B ) ). 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 `false` is returned. The name `RightDivide` suggests "X=BA^-1 modulo L". (Cf. [BR08, Subsection 3.1.1])

    InstallMethod( RightDivide,
            "for homalg matrices",
            [ IsHomalgMatrix, IsHomalgMatrix, IsHomalgRelationsOfLeftModule ],

      function( B, A, L )	## CAUTION: Do not use lazy evaluation here!!!
        local R, BL, ZA, AL, CA, IAL, ZB, CB, NF, X;

        R := HomalgRing( B );

        BL := BasisOfModule( L );

        ## first reduce A modulo L
        ZA := DecideZero( A, BL );

        AL := UnionOfRows( ZA, MatrixOfRelations( BL ) );

        ## CA * AL = IAL
        CA := HomalgVoidMatrix( R );
        IAL := BasisOfRows( AL, CA );

        ## also reduce B modulo L
        ZB := DecideZero( B, BL );

        ## knowing this will avoid computations
        IsIdentityMatrix( IAL );

        ## IsSpecialSubidentityMatrix( IAL );	## does not increase performance

        ## NF = ZB + CB * IAL
        CB := HomalgVoidMatrix( R );
        NF := DecideZeroRowsEffectively( ZB, IAL, CB );

        ## NF <> 0
        if not IsZero( NF ) then
            return false;
        fi;

        ## CD = -CB * CA => CD * A = B
        X := -CB * CertainColumns( CA, [ 1 .. NrRows( A ) ] );

        ## check assertion
        Assert( 3, IsZero( DecideZero( X * A - B, L ) ) );

        return X;

        ## technical: -CB * CA := (-CB) * CA and COLEM should take over
        ## since CB := -matrix

    end );

    InstallMethod( RightDivide,
            "for homalg matrices",
            [ IsHomalgMatrix, IsHomalgMatrix, IsHomalgMatrix ],

      function( B, A, L )

        return RightDivide( B, A, HomalgRelationsForLeftModule( L ) );

    end );

##### 6.5-43 LeftDivide

`> LeftDivide`( A, B, L ) | ( operation )

`> LeftDivide`( A, B, L ) | ( operation )

Returns: a homalg matrix or false

Let A, B and L be matrices having the same number of columns and defined over the same ring (L might also be a set of relations for a right module with `NrGenerators`( L ) = `NrRows`( B ) ). 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 `false` is returned. The name `LeftDivide` suggests "X=A^-1B modulo L". (Cf. [BR08, Subsection 3.1.1])

    InstallMethod( LeftDivide,
            "for homalg matrices",
            [ IsHomalgMatrix, IsHomalgMatrix, IsHomalgRelationsOfRightModule ],

      function( A, B, L )	## CAUTION: Do not use lazy evaluation here!!!
        local R, BL, ZA, AL, CA, IAL, ZB, CB, NF, X;

        R := HomalgRing( B );

        BL := BasisOfModule( L );

        ## first reduce A modulo L
        ZA := DecideZero( A, BL );

        AL := UnionOfColumns( ZA, MatrixOfRelations( BL ) );

        ## AL * CA = IAL
        CA := HomalgVoidMatrix( R );
        IAL := BasisOfColumns( AL, CA );

        ## also reduce B modulo L
        ZB := DecideZero( B, BL );

        ## knowing this will avoid computations
        IsIdentityMatrix( IAL );

        ## IsSpecialSubidentityMatrix( IAL );	## does not increase performance

        ## NF = ZB + IAL * CB
        CB := HomalgVoidMatrix( R );
        NF := DecideZeroColumnsEffectively( ZB, IAL, CB );

        ## NF <> 0
        if not IsZero( NF ) then
            return false;
        fi;

        ## CD = CA * -CB => A * CD = B
        X := CertainRows( CA, [ 1 .. NrColumns( A ) ] ) * -CB;

        ## check assertion
        Assert( 3, IsZero( DecideZero( A * X - B, L ) ) );

        return X;

        ## technical: CA * -CB := CA * (-CB) and COLEM should take over since
        ## CB := -matrix

    end );

    InstallMethod( LeftDivide,
            "for homalg matrices",
            [ IsHomalgMatrix, IsHomalgMatrix, IsHomalgMatrix ],

      function( A, B, L )

        return LeftDivide( A, B, HomalgRelationsForRightModule( L ) );

    end );

##### 6.5-44 GenerateSameRowModule

`> GenerateSameRowModule`( M, N ) | ( operation )

Returns: `true` or `false`

Check if the row span of M and of N are identical or not (--> `RightDivide` (6.5-40)).

##### 6.5-45 GenerateSameColumnModule

`> GenerateSameColumnModule`( M, N ) | ( operation )

Returns: `true` or `false`

Check if the column span of M and of N are identical or not (--> `LeftDivide` (6.5-41)).

Top of Book Previous Chapter Next Chapter
Goto Chapter: Top 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 A B C D E F G H I Bib Ind

generated by GAPDoc2HTML