mlpack
Namespaces | Functions
address.hpp File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

 mlpack
 Linear algebra utility functions, generally performed on matrices or vectors.
 

Functions

template<typename AddressType , typename VecType >
void mlpack::bound::addr::PointToAddress (AddressType &address, const VecType &point)
 Calculate the address of a point. More...
 
template<typename AddressType , typename VecType >
void mlpack::bound::addr::AddressToPoint (VecType &point, const AddressType &address)
 Translate the address to the point. More...
 
template<typename AddressType1 , typename AddressType2 >
int mlpack::bound::addr::CompareAddresses (const AddressType1 &addr1, const AddressType2 &addr2)
 Compare two addresses. More...
 
template<typename AddressType1 , typename AddressType2 , typename AddressType3 >
bool mlpack::bound::addr::Contains (const AddressType1 &address, const AddressType2 &loBound, const AddressType3 &hiBound)
 Returns true if an address is contained between two other addresses.
 

Detailed Description

Author
Mikhail Lozhnikov

This file contains a series of functions for translating points to addresses and back and functions for comparing addresses.

The notion of addresses is described in the following paper.

@inproceedings{bayer1997,
author = {Bayer, Rudolf},
title = {The Universal B-Tree for Multidimensional Indexing: General
Concepts},
booktitle = {Proceedings of the International Conference on Worldwide
Computing and Its Applications},
series = {WWCA '97},
year = {1997},
isbn = {3-540-63343-X},
pages = {198--209},
numpages = {12},
publisher = {Springer-Verlag},
address = {London, UK, UK},
}

Function Documentation

◆ AddressToPoint()

template<typename AddressType , typename VecType >
void mlpack::bound::addr::AddressToPoint ( VecType &  point,
const AddressType &  address 
)

Translate the address to the point.

Be careful, the point and the address variables should be equal-sized and the type of the address should correspond to the type of the vector.

The function makes the backward transform to the function above.

Parameters
addressAn address to translate.
pointThe point that corresponds to the address.

◆ CompareAddresses()

template<typename AddressType1 , typename AddressType2 >
int mlpack::bound::addr::CompareAddresses ( const AddressType1 &  addr1,
const AddressType2 &  addr2 
)

Compare two addresses.

The function returns 1 if the first address is greater than the second one, -1 if the first address is less than the second one, otherwise the function returns 0.

◆ PointToAddress()

template<typename AddressType , typename VecType >
void mlpack::bound::addr::PointToAddress ( AddressType &  address,
const VecType &  point 
)

Calculate the address of a point.

Be careful, the point and the address variables should be equal-sized and the type of the address should correspond to the type of the vector.

The function maps each floating point coordinate to an equal-sized unsigned integer datatype in such a way that the transform preserves the ordering (i.e. lower floating point values correspond to lower integers). Thus, the mapping saves the exponent and the mantissa of each floating point value consequently, furthermore the exponent is stored before the mantissa. In the case of negative numbers the resulting integer value should be inverted. In the multi-dimensional case, after we transform the representation, we have to interleave the bits of the new representation across all the elements in the address vector.

Parameters
addressThe resulting address.
pointThe point that is being translated to the address.

mlpack is free software; you may redistribute it and/or modify it under the terms of the 3-clause BSD license. You should have received a copy of the 3-clause BSD license along with mlpack. If not, see http://www.opensource.org/licenses/BSD-3-Clause for more information.