All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines
Public Member Functions
QGpCoreTools::PermutationVector Class Reference

To perfom permutations in a matrix. More...

#include <PermutationVector.h>

Inheritance diagram for QGpCoreTools::PermutationVector:
QVector

List of all members.

Public Member Functions

PermutationVector inverted ()
int newIndex (int oldIndex) const
 PermutationVector (int n)
 PermutationVector (const PermutationVector &o)
void setNewIndex (int oldIndex, int newIndex)
QString toString () const

Detailed Description

To perfom permutations in a matrix.

Matrix::sortedRows(), Matrix::sortedColumns()


Constructor & Destructor Documentation

: QVector<int>(n) {}
: QVector<int>(o) {}

Member Function Documentation

Returns a permutation vector that can de-sort matrix sorted so far.

References newIndex(), and setNewIndex().

  {
    int n=count();
    PermutationVector tmp(n);
    for(int i=0; i<n; i++) {
      tmp.setNewIndex(newIndex(i), i);
    }
    return tmp;
  }
int QGpCoreTools::PermutationVector::newIndex ( int  oldIndex) const [inline]
void QGpCoreTools::PermutationVector::setNewIndex ( int  oldIndex,
int  newIndex 
) [inline]

Referenced by inverted().

{operator[](oldIndex)=newIndex;}

References newIndex(), and str.

  {
    QString str;
    int n=count();
    for(int i=0; i<n; i++) {
      str+=QString("%1 --> %2\n").arg(i, 3, 10, QChar(' ')).arg(newIndex(i), 3, 10, QChar(' '));
    }
    return str;
  }

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines