From 9be08ad2f8be8964ae72f6571d04ba38909e4388 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 18 Aug 2018 15:37:27 +0200 Subject: Clean up main public API header --- chilbert/Hilbert.hpp | 224 ++++++++++++++------------------------------------- 1 file changed, 62 insertions(+), 162 deletions(-) (limited to 'chilbert/Hilbert.hpp') diff --git a/chilbert/Hilbert.hpp b/chilbert/Hilbert.hpp index a6b48fb..5b4646d 100644 --- a/chilbert/Hilbert.hpp +++ b/chilbert/Hilbert.hpp @@ -19,172 +19,72 @@ #ifndef CHILBERT_HILBERT_HPP #define CHILBERT_HILBERT_HPP -#include "chilbert/Algorithm.hpp" -#include "chilbert/BigBitVec.hpp" -#include "chilbert/FixBitVec.hpp" - -// Description of parameters: -// -// FOR REGULAR HILBERT INDICES -// -// CFixBitVec/CBigBitVec *p -// Pointer to array of non-negative coordinate values. -// -// int m -// Precision of all coordinate values (number of bits required to -// represent the largest possible coordinate value). -// -// int n -// Number of dimensions (size of the array *p). -// -// CFixBitVec/CBigBitVec &h -// Hilbert index of maximum precision m*n. -// -// int *ms -// Array of precision values, one per dimension. -// -// FOR COMPACT HILBERT INDICES -// -// CFixBitVec/CBigBitVec &hc -// Compact Hilbert index of maximum precision M. -// -// int M -// Net precision value, corresponding to the size of the compact -// Hilbert code. If not provided, defaults to zero and will be calculated -// by the function (sum_i { ms[i] }). -// -// int m -// Largest precision value (max_i { ms[i] }). If not provided, defaults -// to zero and will be calculated by the function, +#include namespace chilbert { -// fix -> fix - -inline void -coordsToIndex(const CFixBitVec* const p, - const size_t m, - const size_t n, - CFixBitVec& h) -{ - coordsToIndex(p, m, n, h); -} - -inline void -indexToCoords(CFixBitVec* const p, - const size_t m, - const size_t n, - const CFixBitVec& h) -{ - indexToCoords(p, m, n, h); -} - -inline void -coordsToCompactIndex(const CFixBitVec* const p, - const size_t* const ms, - const size_t n, - CFixBitVec& hc, - const size_t M, - const size_t m) -{ - coordsToCompactIndex(p, ms, n, hc, M, m); -} - -inline void -compactIndexToCoords(CFixBitVec* const p, - const size_t* const ms, - const size_t n, - const CFixBitVec& hc, - const size_t M, - const size_t m) -{ - compactIndexToCoords(p, ms, n, hc, M, m); -} - -// fix -> big - -inline void -coordsToIndex(const CFixBitVec* const p, - const size_t m, - const size_t n, - CBigBitVec& h) -{ - coordsToIndex(p, m, n, h); -} - -inline void -indexToCoords(CFixBitVec* const p, - const size_t m, - const size_t n, - const CBigBitVec& h) -{ - indexToCoords(p, m, n, h); -} - -inline void -coordsToCompactIndex(const CFixBitVec* const p, - const size_t* const ms, - const size_t n, - CBigBitVec& hc, - const size_t M, - const size_t m) -{ - coordsToCompactIndex(p, ms, n, hc, M, m); -} - -inline void -compactIndexToCoords(CFixBitVec* const p, - const size_t* const ms, - const size_t n, - const CBigBitVec& hc, - const size_t M, - const size_t m) -{ - compactIndexToCoords(p, ms, n, hc, M, m); -} - -// big -> big - -inline void -coordsToIndex(const CBigBitVec* p, - const size_t m, - const size_t n, - CBigBitVec& h) -{ - coordsToIndex(p, m, n, h); -} - -inline void -indexToCoords(CBigBitVec* const p, - const size_t m, - const size_t n, - const CBigBitVec& h) -{ - indexToCoords(p, m, n, h); -} - -inline void -coordsToCompactIndex(const CBigBitVec* const p, - const size_t* const ms, - const size_t n, - CBigBitVec& hc, - const size_t M, - const size_t m) -{ - coordsToCompactIndex(p, ms, n, hc, M, m); -} - -inline void -compactIndexToCoords(CBigBitVec* const p, - const size_t* const ms, - const size_t n, - const CBigBitVec& hc, - const size_t M, - const size_t m) -{ - compactIndexToCoords(p, ms, n, hc, M, m); -} +/** Map the point `p` to a Hilbert Index. + * + * @param p Point with `n` dimensions. + * @param m Precision of each dimension in bits. + * @param n Number of dimensions. + * @param[out] h Hilbert Index. + */ +template +inline void coordsToIndex(const P* const p, + const size_t m, + const size_t n, + H& h); + +/** Map the Hilbert Index `p` to a point. + * + * @param[out] p Point with `n` dimensions. + * @param m Precision of each dimension in bits. + * @param n Number of dimensions. + * @param h Hilbert Index. + */ +template +inline void indexToCoords(P* const p, + const size_t m, + const size_t n, + const H& h); + +/** Map the point `p` to a Compact Hilbert Index. + * + * @param p Point with `n` dimensions. + * @param ms Array of `n` precision values for each dimension in bits. + * @param n Number of dimensions. + * @param[out] hc Compact Hilbert Index. + * @param M Optional net precision (sum of `ms`), the size of `hc` in bits. + * @param m Optional largest precision in `m`. + */ +template +inline void coordsToCompactIndex(const P* const p, + const size_t* const ms, + const size_t n, + H& hc, + const size_t M = 0, + const size_t m = 0); + +/** Map the Compact Hilbert Index `hc` to a point. + * + * @param[out] p Point with `n` dimensions. + * @param ms Array of `n` precision values for each dimension in bits. + * @param n Number of dimensions. + * @param hc Compact Hilbert Index. + * @param M Optional net precision (sum of `ms`), the size of `hc` in bits. + * @param m Optional largest precision in `m`. + */ +template +inline void compactIndexToCoords(P* const p, + const size_t* const ms, + const size_t n, + const H& hc, + const size_t M = 0, + const size_t m = 0); } // namespace chilbert +#include "chilbert/Hilbert.ipp" + #endif -- cgit v1.2.1