Latin Hypercube Samples (lhs)  1.0
R, C++, and Rcpp code to generate Latin hypercube samples
All Classes Namespaces Files Functions Variables Typedefs Macros Pages
order.h File Reference
#include <vector>
#include <algorithm>

Go to the source code of this file.

Functions

template<class T >
bool bclib::findranksCompare (const std::pair< T, int > first, const std::pair< T, int > second)
 
template<class T >
void bclib::findorder_zero (const std::vector< T > &v, std::vector< int > &order)
 
template<class T >
void bclib::findorder (const std::vector< T > &v, std::vector< int > &order)
 

Detailed Description

Author
Robert Carnell
License:\n GNU General Public License (GPL v3)
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Function Documentation

◆ findorder()

template<class T >
void bclib::findorder ( const std::vector< T > &  v,
std::vector< int > &  order 
)

Find the order of each vector element (one based)

Template Parameters
Tnumeric argument that can be ordered
Parameters
vthe vector to be ranked
orderthe order of the elements

◆ findorder_zero()

template<class T >
void bclib::findorder_zero ( const std::vector< T > &  v,
std::vector< int > &  order 
)

Find the order of each vector element (zero based)

Template Parameters
Tnumeric argument that can be ordered
Parameters
vthe vector to be ordered
orderthe order of the elements

◆ findranksCompare()

template<class T >
bool bclib::findranksCompare ( const std::pair< T, int >  first,
const std::pair< T, int >  second 
)

Comparison operator to use in the findranks method

Parameters
firstthe first pair of arguments (value, rank)
secondthe second pair of arguments (value, rank)
Returns
true if the value in the first argument is less than the value in the second argument