Singular Manual: matrix declarations

  | ### 4.13.1 matrix declarations Syntax: `matrix` name`[`rows`][`cols`] =` list_of_poly_expressions `;` `matrix` name = matrix_expression `;` Purpose: defines a matrix (of polynomials). The given poly_list fills up the matrix beginning with the first row from the left to the right, then the second row and so on. If the poly_list contains less than rows*cols elements, the matrix is filled up with zeros; if it contains more elements, then only the first rows*cols elements are used. If the right-hand side is a matrix expression the matrix on the left-hand side gets the same size as the right-hand side, otherwise the size is determined by the left-hand side. If the size is omitted a 1x1 matrix is created. Default: 0 (1 x 1 matrix) Example:
        int ro = 3;
        ring r = 32003,(x,y,z),dp;
        poly f=xyz;
        poly g=z*f;
        ideal i=f,g,g^2;
        matrix m[ro][3] = x3y4, 0, i, f ; // a 3 x 3 matrix
        m;
      ==> m[1,1]=x3y4
      ==> m[1,2]=0
      ==> m[1,3]=xyz
      ==> m[2,1]=xyz2
      ==> m[2,2]=x2y2z4
      ==> m[2,3]=xyz
      ==> m[3,1]=0
      ==> m[3,2]=0
      ==> m[3,3]=0
        print(m);
      ==> x3y4,0,     xyz,
      ==> xyz2,x2y2z4,xyz,
      ==> 0,   0,     0
        matrix A;   // the 1 x 1 zero matrix
        matrix B[2][2] = m[1..2, 2..3]; //defines a submatrix
        print(B);
      ==> 0,     xyz,
      ==> x2y2z4,xyz
        matrix C=m; // defines C as a 3 x 3 matrix equal to m
        print(C);
      ==> x3y4,0,     xyz,
      ==> xyz2,x2y2z4,xyz,
      ==> 0,   0,     0

User manual for Singular version 4.3.2, 2023, generated by texi2html.