예제 #1
0
파일: metric.c 프로젝트: dsimba/clann
clann_real_type
metric_hausdorff_symmetric(const struct matrix *a,
                           const struct matrix *b)
{
    clann_real_type ab, ba; 

    ab = metric_hausdorff(a, b);
    ba = metric_hausdorff(b, a);

    return ab > ba ? ab : ba;
}
예제 #2
0
파일: metric.c 프로젝트: jpzm/clann
PyObject*
hausdorff(PyObject *self, PyObject *args)
{
    /**
     * Convert input
     */
    PyObject *a = NULL,
             *b = NULL;

    if (!PyArg_ParseTuple(args, "OO", &a, &b))
        return NULL;

    /**
     * Call the function
     */
    clann_matrix_type *x = PyCObject_AsVoidPtr(a),
                      *y = PyCObject_AsVoidPtr(b);

    clann_real_type v = metric_hausdorff(x, y);

    /**
     * Convert output
     */
    return Py_BuildValue("d", (double) v);
}