close Warning: Can't synchronize with repository "(default)" (/var/svn/tolp does not appear to be a Subversion repository.). Look in the Trac log for more information.

Opened 15 years ago

Closed 15 years ago

#793 closed doubt (fixed)

Malfunction in Sort Matrix function — at Version 1

Reported by: César Pérez Álvarez Owned by: Víctor de Buen Remiro
Priority: normal Milestone:
Component: Kernel Version: 1.1.7
Severity: normal Keywords:
Cc:

Description (last modified by Víctor de Buen Remiro)

I would expect that

  Matrix mat  = Rand(100, 1, 0, 30);
  Matrix matS = Sort(mat, SetOfReal(1));

puts in order the matrix mat, however it seems do nothing.

Can someone help me? Thanks...

Change History (1)

comment:1 Changed 15 years ago by Víctor de Buen Remiro

Description: modified (diff)
Resolution: fixed
Status: newclosed

I've checked this function and it's all right. You may want to write this?

  Matrix mat = Rand(100, 1, 0, 30);
  Matrix permutation = Sort(mat, SetOfReal(1));
  Matrix sorted = PivotByRows(mat,permutation);

I think the description of this function could help you

Sort {Matrix Sort(Matrix mat, Set criterium)
  • English: Sorts rows of a matrix given a mixed criterium of ascent or descent columns. For example, criterium=[[-2,3]] sorts by 2-nd column descent and 3-th one ascent in case of tie. Returns the permutation matrix p such that PivotByRows(mat,p) is the sorted matrix.
  • Spanish: Ordena las filas de una matriz dado un criterio mezclado de columnas ascendentes y descendentes. Por ejemplo, criterium=[[-2,3]] ordena por la segunda columna descendente y por la tercera ascendente en caso de empate.Devuelve la matriz de permutación tal que PivotByRows(mat,p) es la matriz ordenada.
Note: See TracTickets for help on using tickets.