title: Cython - Class with numpy attributes
body: <p>I am trying to optimize a python class by using <code>cython</code> extension type. My operations are using <code>numpy</code> without indexing at all i.e. piecewise addition , matrix multiplication, so my primary goal is to reduce python overhead. I am mostly interested in the type declaration: should I use <code>numpy</code> or <code>cython</code> structures?
  Here's a simple example:</p>
  
  <pre class="lang-py prettyprint-override"><code>
  cdef class Analyzer:
      cdef float coeff
      cdef float[:] v1, v2 #should I use memoryview? can I use a ndarray?
  
      def __init__(self):
          # some stuff ...
  
      cpdef void func(self, matrix, vector):
          # some stuff ...
          cdef Py_ssize_t i
          for i in range(big_number):
              self.update_vectors(i)
              self.v1 = matrix @ vector + self.coeff * self.v2 # all my operations are like this i.e. no indeces 
              # should I convert views to nd.arrays?
  </code></pre>
  
  <p>Note, that when I try <code>self.coeff * self.v2</code>, I get errors since they are not considered numpy arrays:</p>
  
  <pre><code>Invalid operand types for '*' (float; float[:] *)
  </code></pre>
  
  <p>So, since I am using <code>numpy</code> and there's is no point to create loops just for standard linear algebra stuff, how do I declare (class) attribute types to reduce overhead? </p>