Macaulay2 » Documentation
Packages » Macaulay2Doc :: sortColumns
next | previous | forward | backward | up | index | toc

sortColumns -- permutation giving sort order

Synopsis

Description

See sort(Matrix) for the ordering used. The meanings of the optional parameters is also the same.
i1 : R = ZZ/32003[a..d,MonomialOrder=>Lex];
i2 : m = matrix{{a*d, b^2, b^100, b^50*d^50, c^2*d}}

o2 = | ad b2 b100 b50d50 c2d |

             1      5
o2 : Matrix R  <-- R
i3 : p = sortColumns m

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

o3 : List
i4 : m_p

o4 = | c2d b2 b50d50 b100 ad |

             1      5
o4 : Matrix R  <-- R
i5 : p = sortColumns(m, DegreeOrder=>null, MonomialOrder=>Descending)

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

o5 : List
i6 : m_p

o6 = | ad b100 b50d50 b2 c2d |

             1      5
o6 : Matrix R  <-- R
i7 : R = ZZ/101[a..c];
i8 : f = matrix{{1,a,a^2,b^2,b,c,c^2,a*b,b*c,a*c}}

o8 = | 1 a a2 b2 b c c2 ab bc ac |

             1      10
o8 : Matrix R  <-- R
i9 : s = sortColumns f

o9 = {0, 5, 4, 1, 6, 8, 9, 3, 7, 2}

o9 : List
i10 : f_s

o10 = | 1 c b a c2 bc ac b2 ab a2 |

              1      10
o10 : Matrix R  <-- R
i11 : s = sortColumns(f,DegreeOrder => Descending)

o11 = {6, 8, 9, 3, 7, 2, 5, 4, 1, 0}

o11 : List
i12 : f_s

o12 = | c2 bc ac b2 ab a2 c b a 1 |

              1      10
o12 : Matrix R  <-- R

See also

Ways to use sortColumns :

For the programmer

The object sortColumns is a method function with options.