1

私は以下の3つのタイプのINT(4)すなわちショート、INT(8)またはvarchar(512)のキーを持つ多次元ポイントを持っています。コンパイルヒルベルトコード - コンパクトヒルベルト指数を計算する

このため、通常のヒルベルト曲線変換は使用できません。私はコンパクトなヒルベルト指数を計算するのに非常に良いリソースを見つけました。ここにリンクがあります。

http://web.cs.dal.ca/~chamilto/hilbert/index.html

私は彼の論文でのポイントや動機を理解するが、私はコードを解読することができません。コンパクトヒルベルト指数とその逆数を計算するためにどの関数を呼び出すべきか分かりません。

+0

ですから、コードがどのように機能するかを私たちに求めていますか?なぜ著者に連絡しないのですか? – Bart

+1

C++には 'INT(4)'、 'INT(8)'、 'varchar(512)'の型はありません。これはFortranによく似ています。この質問に正しくタグ付けしてもよろしいですか? –

+0

@DietmarKühliirc、これらはint32_t、int64_t、char [512]またはstd :: stringに簡単に対応するSQL型です。ライブラリ自体はC++で書かれているようですので、タグ付けはおそらくOKです。 – kfmfe04

答えて

1

http://code.google.com/p/uzaygezen/はオープ​​ンソースのJava実装でありますコンパクトヒルベルト指数。ここでは、質問に指定されている4、8、512バイトの3次元に対応する例を示します

CompactHilbertCurve chc = new CompactHilbertCurve(new int[] {4 * 8, 8 * 8, 512 * 8}); 
List<Integer> bitsPerDimension = chc.getSpec().getBitsPerDimension(); 
BitVector[] p = new BitVector[bitsPerDimension.size()]; 
for (int i = p.length; --i >= 0;) { 
    p[i] = BitVectorFactories.OPTIMAL.apply(bitsPerDimension.get(i)); 
} 
p[0].copyFrom(123); 
p[1].copyFrom(32342); 
p[2].copyFrom(BitSet.valueOf("test".getBytes("ISO-8859-1"))); 
BitVector chi = BitVectorFactories.OPTIMAL.apply(chc.getSpec().sumBitsPerDimension()); 
chc.index(p, 0, chi); 
System.out.println(chi); 
0

あなたは、コードをダウンロードして、ヘッダファイルを見れば、それは自明でなければなりません(ところで、LIBは、Ubuntuの上で私のために罰金建て):

// 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, 


namespace Hilbert 
{ 
    // fix -> fix 
    void coordsToIndex(const CFixBitVec *p, int m, int n, CFixBitVec &h); 
    void indexToCoords(CFixBitVec *p, int m, int n, const CFixBitVec &h); 
    void coordsToCompactIndex(const CFixBitVec *p, const int *ms, int n, 
     CFixBitVec &hc, int M = 0, int m = 0); 
    void compactIndexToCoords(CFixBitVec *p, const int *ms, int n, 
     const CFixBitVec &hc, int M = 0, int m = 0); 

    // fix -> big 
    void coordsToIndex(const CFixBitVec *p, int m, int n, CBigBitVec &h); 
    void indexToCoords(CFixBitVec *p, int m, int n, const CBigBitVec &h); 
    void coordsToCompactIndex(const CFixBitVec *p, const int *ms, int n, 
     CBigBitVec &hc, int M = 0, int m = 0); 
    void compactIndexToCoords(CFixBitVec *p, const int *ms, int n, 
     const CBigBitVec &hc, int M = 0, int m = 0); 

    // big -> big 
    void coordsToIndex(const CBigBitVec *p, int m, int n, CBigBitVec &h); 
    void indexToCoords(CBigBitVec *p, int m, int n, const CBigBitVec &h); 
    void coordsToCompactIndex(const CBigBitVec *p, const int *ms, int n, 
     CBigBitVec &hc, int M = 0, int m = 0); 
    void compactIndexToCoords(CBigBitVec *p, const int *ms, int n, 
     const CBigBitVec &hc, int M = 0, int m = 0); 
}; 
+0

親切なプロンプトをありがとう、テストのメインコードに気づいた場合、作成者は4次元の点を作成し、それはちょうどOkを変換します。しかし、このコードを5次元まで拡張しようとすると、ガベージ・アンサーが始まります。それを試みましたか? – Basmah

+0

著者のドキュメントを読んでください - 彼の実装にはおそらく制限があります。わかりません。 – kfmfe04

+0

著者のドキュメントはありません。私たちはそれを使う方法を知りません。 – Basmah

関連する問題