Turi Create  4.0
SGraph Compute

Namespaces

 turi::sgraph_compute
 

Functions

std::pair< size_t, size_t > turi::hilbert_index_to_coordinate (size_t s, size_t n)
 
size_t turi::coordinate_to_hilbert_index (std::pair< size_t, size_t > coord, size_t n)
 

Detailed Description

Function Documentation

◆ coordinate_to_hilbert_index()

size_t turi::coordinate_to_hilbert_index ( std::pair< size_t, size_t >  coord,
size_t  n 
)
inline

For an n*n square and a coordinate within the square. Returns the hilbert index which is the position of the coordinate along the hilbert curve. n must be at least 2 and must be a power of 2.

Algorithm from Figure 14-9 in Hacker's Delight.

Definition at line 80 of file hilbert_curve.hpp.

◆ hilbert_index_to_coordinate()

std::pair<size_t, size_t> turi::hilbert_index_to_coordinate ( size_t  s,
size_t  n 
)
inline

For an n*n square and a hilbert index (s) ranging from 0 to n*n-1, this function returns the coordinate of the s^th position along the hilbert curve. n must be at least 2 and must be a power of 2.

Algorithm from Figure 14-8 in Hacker's Delight.

Definition at line 31 of file hilbert_curve.hpp.