<commit_before>Introduction
============

<a href="http://www.youtube.com/watch?feature=player_embedded&v=RrfO1hlWmrw
" target="_blank"><img src="http://img.youtube.com/vi/RrfO1hlWmrw/0.jpg"
alt="IMAGE ALT TEXT HERE" width="240" height="180" border="10" /></a>



[![](http://img.youtube.com/vi/RrfO1hlWmrw/0.jpg)](http://www.youtube.com/watch?v=RrfO1hlWmrw)

This is a module to convert between one dimensional distance along a
`Hilbert curve`_, :math:`h`, and N-dimensional coordinates,
:math:`(x_0, x_1, ... x_N-1)`.  The two important parameters are :math:`N`
(the number of dimensions, must be > 0) and :math:`p` (the number of
iterations used in constructing the Hilbert curve, must be > 0).

We consider an N-dimensional `hypercube`_ of side length :math:`2^p`.
This hypercube contains :math:`2^{N p}` unit hypercubes (:math:`2^p` along
each dimension).  The number of unit hypercubes determine the possible
discrete distances along the Hilbert curve (indexed from :math:`0` to
:math:`2^{N p} - 1`).  The image below illustrates the situation for
:math:`N=2` and :math:`p=3`.

.. figure:: nD=2_p=3.png

   This is the third iteration (:math:`p=3`) of the Hilbert curve in two
   (:math:`N=2`) dimensions.  Distances, :math:`h`, along the curve are
   labeled from 0 to 63 (i.e. from 0 to :math:`2^{N p}-1`).  The provided
   functions translate between N-dimensional coordinates and the one
   dimensional distance.  For example, between (:math:`x_0=4, x_1=6`) and
   :math:`h=36`.


An animation of the same case in 3-D is available on YouTube.

[![3-D Hilbert Curve Animation](https://img.youtube.com/vi/RrfO1hlWmrw/0.jpg)](https://www.youtube.com/watch?v=RrfO1hlWmrw)

<commit_msg>youtube link working<commit_after>Introduction
============

This is a module to convert between one dimensional distance along a
`Hilbert curve`_, :math:`h`, and N-dimensional coordinates,
:math:`(x_0, x_1, ... x_N-1)`.  The two important parameters are :math:`N`
(the number of dimensions, must be > 0) and :math:`p` (the number of
iterations used in constructing the Hilbert curve, must be > 0).

We consider an N-dimensional `hypercube`_ of side length :math:`2^p`.
This hypercube contains :math:`2^{N p}` unit hypercubes (:math:`2^p` along
each dimension).  The number of unit hypercubes determine the possible
discrete distances along the Hilbert curve (indexed from :math:`0` to
:math:`2^{N p} - 1`).  The image below illustrates the situation for
:math:`N=2` and :math:`p=3`.

.. figure:: nD=2_p=3.png

   This is the third iteration (:math:`p=3`) of the Hilbert curve in two
   (:math:`N=2`) dimensions.  Distances, :math:`h`, along the curve are
   labeled from 0 to 63 (i.e. from 0 to :math:`2^{N p}-1`).  The provided
   functions translate between N-dimensional coordinates and the one
   dimensional distance.  For example, between (:math:`x_0=4, x_1=6`) and
   :math:`h=36`.


An animation of the same case in 3-D is available on YouTube (click on the thumbnail below).

[![3-D Hilbert Curve Animation](https://img.youtube.com/vi/RrfO1hlWmrw/0.jpg)](https://www.youtube.com/watch?v=RrfO1hlWmrw)


{'fraction_non_alphanumeric': 0.14893617021276595, 'fraction_numerical': 0.026434558349451968, 'mean_word_length': 4.662408759124087, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 10, 'https://': 4, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '549967', 'n_tokens_mistral': 1095, 'n_tokens_neox': 1031, 'n_words': 358}