0.2.0
Loading...
Searching...
No Matches
Sort.hpp File Reference

Sorting algorithms. More...

Go to the source code of this file.

Functions

template<typename Scalar , int Size>
Eigen::Vector< Scalar, Size > NAV::apply_permutation (const Eigen::Vector< Scalar, Size > &vec, const std::vector< size_t > &p)
 Sort a vector with a permutation.
 
template<typename T >
std::vector< T > NAV::apply_permutation (const std::vector< T > &vec, const std::vector< size_t > &p)
 Sort a std::vector with a permutation.
 
template<typename Derived >
Derived::PlainObject NAV::apply_permutation_colwise (const Eigen::MatrixBase< Derived > &m, const std::vector< size_t > &p)
 Sort a matrix col-wise with a permutation.
 
template<typename Scalar , int Rows, int Cols>
void NAV::apply_permutation_colwise_in_place (Eigen::Matrix< Scalar, Rows, Cols > &m, const std::vector< size_t > &p)
 Sort a matrix col-wise with a permutation.
 
template<typename Scalar , int Size>
void NAV::apply_permutation_in_place (Eigen::Vector< Scalar, Size > &vec, const std::vector< size_t > &p)
 Sort a vector with a permutation.
 
template<typename T >
void NAV::apply_permutation_in_place (std::vector< T > &vec, const std::vector< size_t > &p)
 Sort a std::vector with a permutation.
 
template<typename Derived >
Derived::PlainObject NAV::apply_permutation_rowwise (const Eigen::MatrixBase< Derived > &m, const std::vector< size_t > &p)
 Sort a matrix row-wise with a permutation.
 
template<typename Scalar , int Rows, int Cols>
void NAV::apply_permutation_rowwise_in_place (Eigen::Matrix< Scalar, Rows, Cols > &m, const std::vector< size_t > &p)
 Sort a matrix row-wise with a permutation.
 
template<typename Derived , typename Compare >
std::vector< size_t > NAV::sort_permutation (const Eigen::MatrixBase< Derived > &vec, Compare compare)
 Gives the permutation to sort the vector.
 
template<typename T , typename Compare >
std::vector< size_t > NAV::sort_permutation (const std::vector< T > &vec, Compare compare)
 Gives the permutation to sort the std::vector.
 

Detailed Description

Sorting algorithms.

Author
T. Topp (topp@.nosp@m.ins..nosp@m.uni-s.nosp@m.tutt.nosp@m.gart..nosp@m.de)
Date
2023-09-15

Function Documentation

◆ apply_permutation() [1/2]

template<typename Scalar , int Size>
Eigen::Vector< Scalar, Size > NAV::apply_permutation ( const Eigen::Vector< Scalar, Size > & vec,
const std::vector< size_t > & p )

Sort a vector with a permutation.

Parameters
vecVector to sort
pPermutation to sort by
Returns
Sorted vector
Note
Taken from https://stackoverflow.com/a/17074810, adapted for Eigen

◆ apply_permutation() [2/2]

template<typename T >
std::vector< T > NAV::apply_permutation ( const std::vector< T > & vec,
const std::vector< size_t > & p )

Sort a std::vector with a permutation.

Parameters
vecVector to sort
pPermutation to sort by
Returns
Sorted vector
Note
Taken from https://stackoverflow.com/a/17074810

◆ apply_permutation_colwise()

template<typename Derived >
Derived::PlainObject NAV::apply_permutation_colwise ( const Eigen::MatrixBase< Derived > & m,
const std::vector< size_t > & p )

Sort a matrix col-wise with a permutation.

Parameters
mMatrix to sort
pPermutation to sort by
Returns
Sorted matrix
Note
Taken from https://stackoverflow.com/a/17074810, adapted for Eigen

◆ apply_permutation_colwise_in_place()

template<typename Scalar , int Rows, int Cols>
void NAV::apply_permutation_colwise_in_place ( Eigen::Matrix< Scalar, Rows, Cols > & m,
const std::vector< size_t > & p )

Sort a matrix col-wise with a permutation.

Parameters
mMatrix to sort
pPermutation to sort by
Note
Taken from https://stackoverflow.com/a/17074810

◆ apply_permutation_in_place() [1/2]

template<typename Scalar , int Size>
void NAV::apply_permutation_in_place ( Eigen::Vector< Scalar, Size > & vec,
const std::vector< size_t > & p )

Sort a vector with a permutation.

Parameters
vecVector to sort
pPermutation to sort by
Note
Taken from https://stackoverflow.com/a/17074810

◆ apply_permutation_in_place() [2/2]

template<typename T >
void NAV::apply_permutation_in_place ( std::vector< T > & vec,
const std::vector< size_t > & p )

Sort a std::vector with a permutation.

Parameters
vecVector to sort
pPermutation to sort by

◆ apply_permutation_rowwise()

template<typename Derived >
Derived::PlainObject NAV::apply_permutation_rowwise ( const Eigen::MatrixBase< Derived > & m,
const std::vector< size_t > & p )

Sort a matrix row-wise with a permutation.

Parameters
mMatrix to sort
pPermutation to sort by
Returns
Sorted matrix
Note
Taken from https://stackoverflow.com/a/17074810, adapted for Eigen

◆ apply_permutation_rowwise_in_place()

template<typename Scalar , int Rows, int Cols>
void NAV::apply_permutation_rowwise_in_place ( Eigen::Matrix< Scalar, Rows, Cols > & m,
const std::vector< size_t > & p )

Sort a matrix row-wise with a permutation.

Parameters
mMatrix to sort
pPermutation to sort by
Note
Taken from https://stackoverflow.com/a/17074810

◆ sort_permutation() [1/2]

template<typename Derived , typename Compare >
std::vector< size_t > NAV::sort_permutation ( const Eigen::MatrixBase< Derived > & vec,
Compare compare )

Gives the permutation to sort the vector.

Parameters
vecVector to get the sorting permutation for
compareComparison operator
Returns
Permutation vector
Note
Taken from https://stackoverflow.com/a/17074810, adapted for Eigen

◆ sort_permutation() [2/2]

template<typename T , typename Compare >
std::vector< size_t > NAV::sort_permutation ( const std::vector< T > & vec,
Compare compare )

Gives the permutation to sort the std::vector.

Parameters
vecVector to get the sorting permutation for
compareComparison operator
Returns
Permutation vector
Note
Taken from https://stackoverflow.com/a/17074810