Goto Chapter: Top 1 2 3 4 5 A Bib Ind
 [Top of Book]  [Contents]   [Previous Chapter]   [Next Chapter] 

4 Matrices
 4.1 Constructors
 4.2 Operations

4 Matrices

4.1 Constructors

In this section we discuss constructors for Singular matrices. We also treat the three datatypes ideal, module, and vector in this section as they are in first approximation sparse representations of Singular matrices.

4.1-1 SI_matrix
‣ SI_matrix( r, rows, columns, str )( operation )
‣ SI_matrix( rows, columns, polys )( operation )

Construct a matrix over the Singular ring r using the string str. TODO: describe variants

gap> r := SI_ring( 32003, "x,y,z" );
<singular ring, 3 indeterminates>
gap> m := SI_matrix( r, 2, 3, "x,y,z,x^2,y^2,z^2" );
<singular matrix, 2x3>
gap> Display( m );
x, y, z,
x^2,y^2,z^2
gap> x := SI_var( r, 1 );; y := SI_var( r, 2 );; z := SI_var( r, 3 );;
gap> m := SI_matrix( 2, 3, [x,y,z,x^2,y^2,z^2] );
<singular matrix, 2x3>
gap> Display( m );
x, y, z,
x^2,y^2,z^2

4.1-2 SI_ideal
‣ SI_ideal( r, str )( operation )
‣ SI_ideal( polys )( operation )

Construct an "ideal" in the Singular ring r using the string str. TODO: describe variants The datatype ideal in Singular is in first approximation a specialized data structure for matrices consisting of a single row. However, the print method in Singular prints them as a single column.

gap> r := SI_ring( ); ## = SI_ring( 32003, "x,y,z" );
<singular ring, 3 indeterminates>
gap> x := SI_var( r, 1 );; y := SI_var( r, 2 );; z := SI_var( r, 3 );;
gap> I := SI_ideal( [x^2,x*y,z^2] );
<singular ideal, 3 gens>
gap> Display( I );
x^2,
x*y,
z^2

4.1-3 SI_module
‣ SI_module( mat )( operation )

Convert the Singular matrix mat into a Singular "module". The datatype module in Singular is in first approximation a specialized sparse data structure for column oriented matrices with compressed columns. Each column has the Singular datatype vector.

gap> r := SI_ring( 32003, "x,y,z" );
<singular ring, 3 indeterminates>
gap> x := SI_var( r, 1 );; y := SI_var( r, 2 );; z := SI_var( r, 3 );;
gap> m := SI_matrix( 2, 3, [x,y,z,x^2,y^2,z^2] );
<singular matrix, 2x3>
gap> M := SI_module( m );
<singular module, 3 vectors in free module of rank 2>
gap> Display( M );
x, y, z,
x^2,y^2,z^2

4.1-4 SI_vector
‣ SI_vector( r, str )( operation )

Construct a "vector" over the Singular ring r using the string str. The datatype vector in Singular is in first approximation a specialized sparse data structure for matrices consisting of a single column. However, the print method in Singular prints them as a single row or rather a list.

4.2 Operations

4.2-1 SI_nrows
‣ SI_nrows( mat )( function )
‣ SI_ncols( mat )( function )

Compute the number of rows (resp. columns) of the matrix/ideal/module mat.

gap> r := SI_ring( );
<singular ring, 3 indeterminates>
gap> m := SI_matrix( r, 2, 3, "x,y,z,x^2,y^2,z^2" );
<singular matrix, 2x3>
gap> Display( m );
x, y, z,
x^2,y^2,z^2
gap> SI_nrows( m );
2
gap> SI_ncols( m );
3
gap> I := SI_ideal( m );
<singular ideal, 6 gens>
gap> Display( I );
x,
y,
z,
x^2,
y^2,
z^2
gap> SI_nrows( I );
1
gap> SI_ncols( I );
6
gap> i := SI_matrix( I );
<singular matrix, 1x6>
gap> Display( i );
x,y,z,x^2,y^2,z^2
gap> M := SI_module( m );
<singular module, 3 vectors in free module of rank 2>
gap> Display( M );
x, y, z,
x^2,y^2,z^2
gap> SI_nrows( M );
2
gap> SI_ncols( M );
3
gap> v0 := SI_vector( r, "0,0,0,0" );
<singular vector, 0 entries>
gap> Display( v0 );
[0]
gap> v2 := SI_vector( r, "0,x,0,0" );
<singular vector, 2 entries>
gap> Display( v2 );
[0,x]
gap> v3 := SI_vector( r, "0,x,y^2,0" );
<singular vector, 3 entries>
gap> Display( v3 );
[0,x,y^2]
gap> v4 := SI_vector( r, "0,x,y^2,z^3" );
<singular vector, 4 entries>
gap> Display( v4 );
[0,x,y^2,z^3]
gap> SI_ncols( v0 ); SI_ncols( v2 ); SI_ncols( v3 ); SI_ncols( v4 );
1
1
1
1
gap> SI_nrows( v0 ); SI_nrows( v2 ); SI_nrows( v3 ); SI_nrows( v4 );
0
2
3
4
gap> bim := SI_bigintmat( [[1,2,3],[4,5,6]] );
<singular bigintmat:[ [ 1, 2, 3 ], [ 4, 5, 6 ] ]>
gap> Display( bim );
1,2,3,
4,5,6
gap> SI_nrows( bim );
2
gap> SI_ncols( bim );
3
gap> iv := SI_intvec( [ 1, 2, 3, 0 ] );
<singular intvec:[ 1, 2, 3, 0 ]>
gap> Display( iv );
1,
2,
3,
0
gap> SI_nrows( iv );
4
gap> SI_ncols( iv );
fail

4.2-2 SI_transpose
‣ SI_transpose( mat )( function )
‣ TransposedMat( mat )( attribute )

Return the transposed matrix of the matrix mat.

gap> r := SI_ring( );
<singular ring, 3 indeterminates>
gap> m := SI_matrix( r, 2, 3, "x,y,z,x^2,y^2,z^2" );
<singular matrix, 2x3>
gap> Display( m );
x, y, z,
x^2,y^2,z^2
gap> t := SI_transpose( m );
<singular matrix, 3x2>
gap> Display( t );
x,x^2,
y,y^2,
z,z^2
gap> I := SI_ideal( m );
<singular ideal, 6 gens>
gap> Display( I );
x,
y,
z,
x^2,
y^2,
z^2
gap> i := SI_matrix( I );
<singular matrix, 1x6>
gap> Display( i );
x,y,z,x^2,y^2,z^2
gap> SI_transpose( I );
<singular matrix, 6x1>
gap> M := SI_module( m );
<singular module, 3 vectors in free module of rank 2>
gap> Display( M );
x, y, z,
x^2,y^2,z^2
gap> N := SI_transpose( M );
<singular module, 2 vectors in free module of rank 3>
gap> Display( N );
x,x^2,
y,y^2,
z,z^2
gap> v0 := SI_vector( r, "0,0,0,0" );
<singular vector, 0 entries>
gap> Display( v0 );
[0]
gap> t0 := SI_transpose( v0 );
<singular matrix, 1x1>
gap> Display( t0 );
0
gap> v2 := SI_vector( r, "0,x,0,0" );
<singular vector, 2 entries>
gap> Display( v2 );
[0,x]
gap> t2 := SI_transpose( v2 );
<singular matrix, 1x2>
gap> Display( t2 );
0,x
gap> v3 := SI_vector( r, "0,x,y^2,0" );
<singular vector, 3 entries>
gap> Display( v3 );
[0,x,y^2]
gap> t3 := SI_transpose( v3 );
<singular matrix, 1x3>
gap> Display( t3 );
0,x,y^2
gap> v4 := SI_vector( r, "0,x,y^2,z^3" );
<singular vector, 4 entries>
gap> Display( v4 );
[0,x,y^2,z^3]
gap> t4 := SI_transpose( v4 );
<singular matrix, 1x4>
gap> Display( t4 );
0,x,y^2,z^3
gap> bim := SI_bigintmat( [[1,2,3],[4,5,6]] );
<singular bigintmat:[ [ 1, 2, 3 ], [ 4, 5, 6 ] ]>
gap> Display( bim );
1,2,3,
4,5,6
gap> tim := SI_transpose( bim );
<singular bigintmat:[ [ 1, 4 ], [ 2, 5 ], [ 3, 6 ] ]>
gap> Display( tim );
1,4,
2,5,
3,6
gap> iv := SI_intvec( [ 1, 2, 3, 0 ] );
<singular intvec:[ 1, 2, 3, 0 ]>
gap> Display( iv );
1,
2,
3,
0
gap> tv := SI_transpose( iv );
<singular intmat:[ [ 1, 2, 3, 0 ] ]>
gap> Display( tv );
1 2 3 0
gap> SI_transpose( tv );
<singular intmat:[ [ 1 ], [ 2 ], [ 3 ], [ 0 ] ]>

4.2-3 SI_det
‣ SI_det( mat )( function )
‣ Determinant( mat )( attribute )
‣ DeterminantMat( mat )( attribute )

Return the determinant of the square matrix mat.

gap> r := SI_ring( );
<singular ring, 3 indeterminates>
gap> m := SI_matrix( r, 2, 3, "x,y,z,x^2,y^2,z^2" );
<singular matrix, 2x3>
gap> Display( m );
x, y, z,
x^2,y^2,z^2
gap> n := m * SI_transpose( m );
<singular matrix, 2x2>
gap> SI_det( n );
x^4*y^2-2*x^3*y^3+x^2*y^4+x^4*z^2+y^4*z^2-2*x^3*z^3-2*y^3*z^3+x^2*z^4+y^2*z^4
gap> N := SI_module( n );
<singular module, 2 vectors in free module of rank 2>
gap> SI_det( N );
x^4*y^2-2*x^3*y^3+x^2*y^4+x^4*z^2+y^4*z^2-2*x^3*z^3-2*y^3*z^3+x^2*z^4+y^2*z^4

4.2-4 SI_\[
‣ SI_\[( mat, i )( function )
‣ \[\]( mat, i )( operation )

The syntax mat[i] is a shorthand for SI_\[(mat,i). If mat is of type

gap> r := SI_ring( );
<singular ring, 3 indeterminates>
gap> m := SI_matrix( r, 2, 3, "x,y,0,z^2,0,0" );
<singular matrix, 2x3>
gap> Display( m );
x, y,0,
z^2,0,0
gap> m1 := m[1];
<singular vector, 2 entries>
gap> Display( m1 );
[x,z^2]
gap> m2 := m[2];
<singular vector, 1 entry>
gap> Display( m2 );
[y]
gap> m3 := m[3];
<singular vector, 0 entries>
gap> Display( m3 );
[0]
gap> M := SI_module( m );
<singular module, 3 vectors in free module of rank 2>
gap> M1 := M[1];
<singular vector, 2 entries>
gap> Display( M1 );
[x,z^2]
gap> M[1][2];
z^2
gap> M2 := M[2];
<singular vector, 1 entry>
gap> Display( M2 );
[y]
gap> M3 := M[3];
<singular vector, 0 entries>
gap> Display( M3 );
[0]
gap> I := SI_ideal( m );
<singular ideal, 6 gens>
gap> Display( I );
x,
y,
0,
z^2,
0,
0
gap> I[1]; I[6];
x
0

4.2-5 SI_std
‣ SI_std( mat )( function )

Compute the standard basis of the columns of the matrix mat, which can be of type matrix, module, or ideal.

This holds for commutative rings. For noncommutative rings provided by Plural the result is the transposed of the standard basis of the rows of the transposed of mat (see also Section 1.4).

gap> R := SI_ring( 0, "x0..3" );
<singular ring, 4 indeterminates>
gap> SI_option( "redTail" );
true
gap> I := SI_ideal( R, "x0^2-x1*x3, x0*x1-x2*x3" );
<singular ideal, 2 gens>
gap> Display( I );
x0^2-x1*x3,
x0*x1-x2*x3
gap> J := SI_std( I );
<singular ideal, 3 gens>
gap> Display( J );
x0*x1-x2*x3,
x0^2-x1*x3,
x1^2*x3-x0*x2*x3
gap> m := SI_matrix( R, 3, 4, "x0,x1*x3,x0,x3, -x1,-x2*x3,x1,x2, -1,-x0,x3,x0" );
<singular matrix, 3x4>
gap> Display( m );
x0, x1*x3, x0,x3,
-x1,-x2*x3,x1,x2,
-1, -x0, x3,x0
gap> g := SI_std( m );
<singular module, 6 vectors in free module of rank 3>
gap> Display( g );
0, x3,x0,x1*x3+x3, 0, x2*x3^3-x2*x3,
2*x1,x2,x1,-x2*x3+x2,2*x0*x2*x3-2*x0*x2, x2^2*x3^2-x2^2,
x3+1,x0,x3,0, x1*x3^2-x1*x3+x3^2-x3,x1^2*x3^2-x1^2*x3+x1*x3^2-x1*x3
gap> M := SI_module( m );
<singular module, 4 vectors in free module of rank 3>
gap> G := SI_std( M );
<singular module, 6 vectors in free module of rank 3>
gap> Display( G );
0, x3,x0,x1*x3+x3, 0, x2*x3^3-x2*x3,
2*x1,x2,x1,-x2*x3+x2,2*x0*x2*x3-2*x0*x2, x2^2*x3^2-x2^2,
x3+1,x0,x3,0, x1*x3^2-x1*x3+x3^2-x3,x1^2*x3^2-x1^2*x3+x1*x3^2-x1*x3

4.2-6 SI_lift
‣ SI_lift( mat, std )( function )

The matrix std is assumed to be the output of SI_std and the number of rows of mat and std must coincide. If the columns of mat are linear combinations of the columns of std then the resulting matrix T satisfies the matrix equation mat * T = std.

This holds for commutative rings. For noncommutative rings provided by Plural an inequivalent equality holds: SI_transpose(T) * SI_transpose(mat) = SI_transpose(std), which is equivalent to SI_transpose(SI_transpose(T) * SI_transpose(mat)) = std but not to mat * T = std if the ring is noncommutative (see also Section 1.4).

4.2-7 SI_reduce
‣ SI_reduce( mat, std )( function )

The matrix std is assumed to be the output of SI_std and the number of rows of mat and std must coincide. The output is a matrix having the same shape as mat. It columns are the reductions of the columns of mat modulo those of std.

4.2-8 SI_syz
‣ SI_syz( mat )( function )

Compute the matrix of column syzygies of the matrix mat, which can be of type matrix, module, or ideal.

This holds for commutative rings. For noncommutative rings provided by Plural and SCA the result is the transposed of the matrix of row syzygies of the transposed of mat. We refer the reader to the documentation of the corresponding procedure in the Plural manual (see also Section 1.4).

gap> R := SI_ring( 0, "x0..3" );
<singular ring, 4 indeterminates>
gap> SI_option( "redTail" );
true
gap> I := SI_ideal( R, "x0^2-x1*x3, x0*x1-x2*x3" );
<singular ideal, 2 gens>
gap> Display( I );
x0^2-x1*x3,
x0*x1-x2*x3
gap> K := SI_syz( I );
<singular module, 1 vector in free module of rank 2>
gap> Display( K );
-x0*x1+x2*x3,
x0^2-x1*x3
gap> J := SI_std( I );
<singular ideal, 3 gens>
gap> Display( J );
x0*x1-x2*x3,
x0^2-x1*x3,
x1^2*x3-x0*x2*x3
gap> S := SI_syz( J );
<singular module, 2 vectors in free module of rank 3>
gap> Display( S );
x0, x1*x3,
-x1,-x2*x3,
-1, -x0
gap> S2 := SI_syz( S );
<singular module, 1 vector in free module of rank 2>
gap> Display( S2 );
0,
0
gap> j := SI_matrix( J );
<singular matrix, 1x3>
gap> s := SI_syz( j );
<singular module, 2 vectors in free module of rank 3>
gap> Display( s );
x0, x1*x3,
-x1,-x2*x3,
-1, -x0

4.2-9 SI_modulo
‣ SI_modulo( mat, rel )( function )

The number of rows of the matrices mat and rel must coincide. The procedures returns the column syzygies of mat modulo the columns of rel.

This holds for commutative rings. For noncommutative rings provided by Plural and SCA we refer the reader to the documentation of the corresponding procedure in the Plural manual (see also Section 1.4).

 [Top of Book]  [Contents]   [Previous Chapter]   [Next Chapter] 
Goto Chapter: Top 1 2 3 4 5 A Bib Ind

generated by GAPDoc2HTML