Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
cythonでは、親と子を持つノードのシステムを実行する必要があります(kdtreeの場合)。私はこれを試してみます:
cdef struct Node: int id Node *left_child Node *right_left
しかし、構造体にそれ自体を含めることができないというエラーが発生します。私はPythonでそれを行うことができるので、cython/Cで可能だと思いました。
Cythonでは前方定義が許可されているため、次のようになります。
cdef struct Node cdef struct Node: int id Node *left_child Node *right_left
あなたはすでにこれを知っているかもしれませんが、Scipyは純粋なPythonとCythonで非常に素晴らしいkdtree実装を持っています。
私はcythonやcdefに精通していないので、ここに行きます。代わりにこれを試してみましたか?
cdef struct Node: int id struct Node *left_child struct Node *right_left