The C++ class wrapper (2)

  // redimension (reallocate) an array:
  int create (int n1, int n2) {
    int dim2[2]; dim2[0] = n1; dim2[1] = n2;
    a = (PyArrayObject*) PyArray_FromDims(2, dim2, PyArray_DOUBLE);
    if (a == NULL) { return 0; } else { return 1; } }

  // wrap existing data in a NumPy array:
  void wrap (double* data, int n1, int n2) { 
    int dim2[2]; dim2[0] = n1; dim2[1] = n2;
    a = (PyArrayObject*) PyArray_FromDimsAndData(\
        2, dim2, PyArray_DOUBLE, (char*) data);
  }

  // for consistency checks:
  int checktype () const;
  int checkdim  (int expected_ndim) const;
  int checksize (int expected_size1, int expected_size2=0, 
	         int expected_size3=0) const;

previousnexttable of contents