RandomBallCover  1.2.1
 Hosted by GitHub
Namespaces | Functions
helper_funcs.hpp File Reference

Declarations of helper functions for testing. More...

#include <cassert>
#include <algorithm>
#include <functional>
#include <RBC/data_types.hpp>
#include <CL/cl.hpp>
Include dependency graph for helper_funcs.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

 RBC
 

Functions

bool RBC::setProfilingFlag (int argc, char **argv)
 Checks the command line arguments for the profiling flag, --profiling. More...
 
template<typename T >
uint64_t RBC::nextPow2 (T num)
 Returns the first power of 2 greater than or equal to the input. More...
 
template<typename T >
void RBC::printBuffer (const char *title, T *ptr, uint32_t width, uint32_t height)
 Prints an array of an integer type to standard output. More...
 
template<typename T >
void RBC::printBufferF (const char *title, T *ptr, uint32_t width, uint32_t height, uint32_t prec)
 Prints an array of floating-point type to standard output. More...
 
template<typename T >
void RBC::cpuReduce (T *in, T *out, uint32_t cols, uint32_t rows, std::function< bool(T, T)> func)
 Reduces each row of an array to a single element. More...
 
template<typename T >
void RBC::cpuInScan (T *in, T *out, uint32_t width, uint32_t height)
 Performs an inclusive scan operation on the columns of an array. More...
 
template<typename T >
void RBC::cpuExScan (T *in, T *out, uint32_t width, uint32_t height)
 Performs an exclusive scan operation on the columns of an array. More...
 
template<typename T >
void RBC::cpuRBCComputeDists (T *X, T *R, T *D, uint32_t nx, uint32_t nr, uint32_t d)
 Computes the distances between two sets of points in a brute force way. More...
 
template<typename T >
void RBC::cpuRBCComputeDists8 (T *X, T *R, T *D, uint32_t nx, uint32_t nr, uint32_t d, T a)
 Computes the distances between two sets of points in a brute force way. More...
 
template<typename T >
void RBC::cpuRBCMinDists (T *in, rbc_dist_id *out, uint32_t *N, uint32_t *Rnk, uint32_t cols, uint32_t rows, bool accCounters)
 Computes the minimum element, and its corresponding column id, for each row in an array. It also builds a histogram of the id values. And lastly, it stores the rank (order of insert) of each minimum element within its corresponding histogram bin. More...
 
template<typename T >
void RBC::cpuRBCPermute (T *X, rbc_dist_id *ID, T *Xp, rbc_dist_id *IDp, uint32_t *O, uint32_t *Rnk, uint32_t nx, uint32_t nr, uint32_t d, bool permID)
 Performs a permutation of the RBC database to form the representative lists. More...
 
template<typename T >
RBC::euclideanMetric (T *p1, T *p2, uint32_t d)
 Calculates the euclidean distance betweeen two points. More...
 
template<typename T >
RBC::euclideanMetric8Squared (T *p1, T *p2, float a)
 Calculates the euclidean distance betweeen two points in \( \mathbb{R}^8 \).. More...
 
template<typename T >
void RBC::cpuRBCSearch (T *Qp, rbc_dist_id *RID, T *Xp, cl_uint *O, cl_uint *N, rbc_dist_id *NNID, T *NN, uint32_t nq, uint32_t nr, uint32_t nx, uint32_t d)
 Uses the RBC data structure to search for the nearest neighbors. More...
 
template<typename T >
void RBC::cpuRBCSearch8 (T *Qp, rbc_dist_id *RID, T *Xp, cl_uint *O, cl_uint *N, rbc_dist_id *NNID, T *NN, uint32_t nq, uint32_t nr, uint32_t nx, T a)
 Uses the RBC data structure to search for the nearest neighbors. More...
 
template<typename T >
void RBC::cpuNNSearch (T *Q, T *X, T *NN, uint32_t nq, uint32_t nx, uint32_t d)
 Computes (brute force) the nearest neighbors of a set of queries. More...
 
template<typename T >
RBC::meanError (T *Q, T *NN, uint32_t n, uint32_t d)
 Computes the mean euclidean distance from the queries to their NNs. More...
 

Detailed Description

Declarations of helper functions for testing.

Author
Nick Lamprianidis
Version
1.2.1
Date
2015
Copyright (c) 2015 Nick Lamprianidis
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.