Python细纹织物STANN C++库

2024-05-12 22:41:29 发布

您现在位置:Python中文网/ 问答频道 /正文

我在尝试细纹织物在Python中构建一个快速的最小生成树程序。不幸的是,使用细纹织物我发现,C++的库,STANN,比我想象的更困难。以下是到STANN库的链接:http://sites.google.com/a/compgeom.com/stann/

下面是Python细纹织物我写的剧本。在

import scipy.weave as weave
from scipy.weave import inline
import numpy

def gmst(points):
    # computing GMST with STANN headers
    assert(type(points) == type(numpy.array([])))

    # now the c++ code
    code = """
        using namespace std;
        typedef reviver::dpoint<double,2> Point;

        typedef vector<Point>::size_type stype;
        vector< std::pair<stype,stype> > outputmst;
        PyArrayObject *py_val

        gmst(points,outputmst);
        return_val = outputmst;
        """

     return inline(code,['points'], 
        headers = ["<iostream>","<gmst.hpp>","<dpoint.hpp>","<test.hpp>"],
        include_dirs=["/home/tree/usr/STANN/include"])

到目前为止,织布还没有成功。你知道我为什么会遇到麻烦吗?谢谢你的帮助。在

干杯


Tags: importcomtypeinlinecodescipypoints织物