Macaulay2 » Documentation
Packages » Macaulay2Doc » matrices » submatrices » submatrixByDegrees
next | previous | forward | backward | up | index | toc

# submatrixByDegrees -- submatrix consisting of rows and columns in an interval or box of degrees

- Usage:
    `submatrixByDegrees(m, targetBox, sourceBox)`
- Inputs:
  - m, a matrix, A matrix between free modules
  - targetBox, a sequence, A sequence of 2 degree vectors, (lodegree, hidegree). All rows whose multi-degree is greater than or equal (in each component) to lodegree, and less than or equal to hidegree, are selected
  - sourceBox, a sequence, Same as targetBox, except this governs which columns are selected
- Outputs:
  - a matrix, The submatrix of m consisting of those rows (respectively columns) whose (multi-)degree lie in the box targetBox, (respectively columnBox)

## Description

If only one degree (as integer, or list of integers) is given for targetBox or sourceBox, then only rows or columns that match that exact degree are used.

    i1 : R = QQ[a..d];

    i2 : I = ideal"a2b-c3,abc-d3,ac2-bd2-cd2,abcd-c4"

                 2     3           3     2      2      2     4
    o2 = ideal (a b - c , a*b*c - d , a*c  - b*d  - c*d , - c  + a*b*c*d)

    o2 : Ideal of R

    i3 : C = res I;

    i4 : m = C.dd_2

    o4 = {3} | ac2-bd2-cd2 0           -abc+d3 0        -a3c+a2cd
         {3} | 0           ac2-bd2-cd2 a2b-c3  -acd+cd2 a4-a3d-acd2+cd3
         {3} | -a2b+c3     -abc+d3     0       abd-bd2  -a2c2+ac2d-acd2+cd3
         {4} | 0           0           0       b2+bc-cd a3-bcd-c2d-cd2
         ------------------------------------------------------------------------
         -a3c+a2cd
         a4-a3d+a2cd-3acd2-ad3+2cd3+d4
         -a2c2-a2bd+ac2d+2abd2-acd2-bd3+cd3
         a3-ab2+b2d+acd-c2d-2cd2-d3
         ------------------------------------------------------------------------
         -a3c+a2cd
         a4-a3d+a2cd-3acd2-ad3+2cd3+d4
         -a2c2-a2bd+ac2d+2abd2-acd2-ad3-bd3+cd3+d4
         a3-ab2+ac2+b2d+acd-c2d-bd2-3cd2-d3
         ------------------------------------------------------------------------
         -a2bc+a2cd-acd2+d4                        a2cd-acd2            |
         a3b-a3d+abcd+ac2d+a2d2-2bcd2-c2d2-bd3-cd3 -a3d+ac2d+a2d2-c2d2  |
         -abc2-ab2d-abcd+ac2d+b2d2-c2d2+cd3+d4     -abcd+ac2d+bcd2-c2d2 |
         a2b-b3-b2c+bc2-a2d+bcd                    -b2c+c3-a2d+c2d      |

                 4      9
    o4 : Matrix R  <-- R

    i5 : submatrixByDegrees(m, 3, 6)

    o5 = {3} | ac2-bd2-cd2 0           -abc+d3 0        |
         {3} | 0           ac2-bd2-cd2 a2b-c3  -acd+cd2 |
         {3} | -a2b+c3     -abc+d3     0       abd-bd2  |

                 3      4
    o5 : Matrix R  <-- R

    i6 : submatrixByDegrees(m, (3,3), (6,7))

    o6 = {3} | ac2-bd2-cd2 0           -abc+d3 0        -a3c+a2cd
         {3} | 0           ac2-bd2-cd2 a2b-c3  -acd+cd2 a4-a3d-acd2+cd3
         {3} | -a2b+c3     -abc+d3     0       abd-bd2  -a2c2+ac2d-acd2+cd3
         ------------------------------------------------------------------------
         -a3c+a2cd
         a4-a3d+a2cd-3acd2-ad3+2cd3+d4
         -a2c2-a2bd+ac2d+2abd2-acd2-bd3+cd3
         ------------------------------------------------------------------------
         -a3c+a2cd
         a4-a3d+a2cd-3acd2-ad3+2cd3+d4
         -a2c2-a2bd+ac2d+2abd2-acd2-ad3-bd3+cd3+d4
         ------------------------------------------------------------------------
         -a2bc+a2cd-acd2+d4                        a2cd-acd2            |
         a3b-a3d+abcd+ac2d+a2d2-2bcd2-c2d2-bd3-cd3 -a3d+ac2d+a2d2-c2d2  |
         -abc2-ab2d-abcd+ac2d+b2d2-c2d2+cd3+d4     -abcd+ac2d+bcd2-c2d2 |

                 3      9
    o6 : Matrix R  <-- R

    i7 : submatrixByDegrees(m, (4,4), (7,7))

    o7 = {4} | a3-bcd-c2d-cd2 a3-ab2+b2d+acd-c2d-2cd2-d3
         ------------------------------------------------------------------------
         a3-ab2+ac2+b2d+acd-c2d-bd2-3cd2-d3 a2b-b3-b2c+bc2-a2d+bcd
         ------------------------------------------------------------------------
         -b2c+c3-a2d+c2d |

                 1      5
    o7 : Matrix R  <-- R

For multidegrees, the interval is a box.

    i8 : S = QQ[a..d, Degrees=>{2:{1,0},2:{0,1}}];

    i9 : I = ideal(a*d^4, b^3, a^2*d^2, a*b*c*d^3)

                   4   3   2 2         3
    o9 = ideal (a*d , b , a d , a*b*c*d )

    o9 : Ideal of S

    i10 : C = res I

           1      4      6      4      1
    o10 = S  <-- S  <-- S  <-- S  <-- S  <-- 0

          0      1      2      3      4      5

    o10 : ChainComplex

    i11 : m = C.dd_2

    o11 = {3, 0} | 0   -a2d2 0    0   -acd3 -ad4 |
          {2, 2} | -d2 b3    -bcd 0   0     0    |
          {1, 4} | a   0     0    -bc 0     b3   |
          {2, 4} | 0   0     a    d   b2    0    |

                  4      6
    o11 : Matrix S  <-- S

    i12 : degrees target m

    o12 = {{3, 0}, {2, 2}, {1, 4}, {2, 4}}

    o12 : List

    i13 : degrees source m

    o13 = {{2, 4}, {5, 2}, {3, 4}, {2, 5}, {4, 4}, {4, 4}}

    o13 : List

    i14 : submatrixByDegrees(C.dd_2, ({2,2},{2,4}), ({2,2},{5,4}))

    o14 = {2, 2} | -d2 b3 -bcd 0  0 |
          {2, 4} | 0   0  a    b2 0 |

                  2      5
    o14 : Matrix S  <-- S

## Caveat

The degrees are taken from the target and source free modules, not from the matrix entries themselves.

## See also

- submatrix -- select part of a matrix

## Ways to use submatrixByDegrees:

- `submatrixByDegrees(Matrix,List,List)`
- `submatrixByDegrees(Matrix,Sequence,Sequence)`
- `submatrixByDegrees(Matrix,ZZ,ZZ)`

## For the programmer

The object submatrixByDegrees is a method function.

The source of this document is in /build/macaulay2-88fgJW/macaulay2-1.25.11+ds/M2/Macaulay2/packages/Macaulay2Doc/functions/submatrix-doc.m2:235:0.