1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

[Rust] const-genericsがやって来たのでHilbertの空間充填曲線を実装した

Posted at

Rust 1.51 で const-generics が stable に降ってきたので, これを記念して D 次元Hilbert 曲線を Rust で実装しました.

Hilbert 曲線はフラクタル曲線の一種 (空間充填曲線) で, 立方体のなかのすべての格子点を重複なく辿る効率的な経路を与えてくれます. この種のもので最も有名なのは Peano 曲線だと思いますが, Peano 曲線が三進数に基づいているのに対して Hilbert 曲線は二進数で, 計算機とより親和性が高いです. そのため高次元データを扱うために用いられたりします. 既に Rust クレートは存在するのですが, 任意の空間次元で使えて手に馴染むクレートがなかったため自作しました. これまでは D 次元で実装しようと思うとマクロで頑張るかヒープを使うかしかなかったのですが, const-generics のおかげで [T; D] がとても使いやすくなりました.

参考文献

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?