eigen.pxd 953 Bytes
Newer Older
lucasb-eyer's avatar
lucasb-eyer committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
cdef extern from "Eigen/Dense":
    cdef cppclass c_MatrixXf "Eigen::MatrixXf":
        float* data()
        Py_ssize_t cols()
        Py_ssize_t rows()

    cdef cppclass c_VectorXf "Eigen::VectorXf":
        float* data()
        Py_ssize_t size()


cdef extern from "eigen_impl.cpp":
    c_VectorXf c_buf2vecf "buf2vecf" (float *mem, Py_ssize_t n)
    void c_vecf2buf "vecf2buf" (const c_VectorXf &mat, float *buf)
    c_MatrixXf c_buf2matf "buf2matf" (float *mem, Py_ssize_t h, Py_ssize_t w)
    void c_matf2buf "matf2buf" (const c_MatrixXf &mat, float *buf)


cdef class VectorXf:
    cdef c_VectorXf v
    cdef Py_ssize_t  shape[1]
    cdef Py_ssize_t strides[1]

    cdef VectorXf wrap(self, c_VectorXf v)

cdef c_VectorXf c_vectorXf(float[::1] arr)


cdef class MatrixXf:
    cdef c_MatrixXf m
    cdef Py_ssize_t shape[2]
    cdef Py_ssize_t strides[2]

    cdef MatrixXf wrap(self, c_MatrixXf m)

cdef c_MatrixXf c_matrixXf(float[:,::1] arr)