Macaulay2 » Documentation
Packages » Macaulay2Doc » matrices » Matrix » leadComponent
next | previous | forward | backward | up | index | toc

# leadComponent -- the leading component(s) of a vector or matrix

- Usage:
    `leadComponent v`
- Inputs:
  - v, a vector, or Matrix
- Outputs:
  - an integer, or List of integers, the largest index of a nonzero element of v

## Description

    i1 : leadComponent vector{0,0,1,0,1}

    o1 = 4

    i2 : leadComponent vector{0,0,1,2,3,4,0}

    o2 = 5

    i3 : leadComponent matrix{{0,0,1}, {0,1,0}, {1,0,0}}

    o3 = {2, 1, 0}

    o3 : List

Leading appears to be a bit of a misnomer here, since the index/indices return are the last, not the first, corresponding to nonzero elements.

This command also works with vectors and matrices that contain polynomial ring elements.

    i4 : R = ZZ/5[a,b,c]; leadComponent vector{a*b^2,3*b*c^3,0}

    o5 = 1

## See also

- leadCoefficient -- the coefficient of the leading term
- leadMonomial -- the leading monomial of a ring element
- leadTerm -- get the greatest term
- position -- the first element of a list satisfying a condition
- positions -- which elements of a list satisfy a condition
- select -- select from a list, hash table, or string
- support -- list of variables occurring in a polynomial or matrix

## Ways to use leadComponent:

- `leadComponent(Matrix)`
- `leadComponent(Vector)`

## For the programmer

The object leadComponent is a method function.

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