summaryrefslogtreecommitdiff
path: root/docs/examples/userguide/buffer/matrix.pyx
blob: ca597c2f2f9d90400d36162bb832829bc7d20f09 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# distutils: language = c++

# matrix.pyx

from libcpp.vector cimport vector

cdef class Matrix:
    cdef unsigned ncols
    cdef vector[float] v

    def __cinit__(self, unsigned ncols):
        self.ncols = ncols

    def add_row(self):
        """Adds a row, initially zero-filled."""
        self.v.resize(self.v.size() + self.ncols)