title: Using pointers to numpy array data attribute
body: <p>I'm trying to solve the bottleneck in my application, which is an elementwise sum of two matrices.</p>
  
  <p>I'm using NumPy and Cython. I have a <code>cdef</code> class with a matrix attribute. Since Cython still doesn't support buffer arrays in class attributes, I followed <a href="https://groups.google.com/forum/?fromgroups=#!topic/cython-users/vFXntLy_s9Q" rel="nofollow" title="this">this</a> and tried to use a pointer to the <code>data</code> attribute of the matrix. The thing is, I'm sure I'm doing something wrong, as the results indicate.</p>
  
  <p>What I tried to do is more or less the following:</p>
  
  <pre><code>cdef class the_class:
      cdef np.ndarray the_matrix
      cdef float_t* the_matrix_p
  
      def __init__(self):
          the_matrix_p = &lt;float_t*&gt; self.the_matrix.data
  
      cpdef the_function(self):
          other_matrix = self.get_other_matrix()
  
  
          the_matrix_p += other_matrix.data
  </code></pre>