ind = (PyArrayObject *)PyArray_ContiguousFromObject(indIn, PyArray_INT, 1, 1); mask = (PyArrayObject *)PyArray_ContiguousFromObject(maskIn, PyArray_INT, 1, 1);
ind = (PyArrayObject *)PyArray_ContiguousFromObject(indIn, PyArray_LONG, 1, 1); mask = (PyArrayObject *)PyArray_ContiguousFromObject(maskIn, PyArray_LONG, 1, 1);
LLMat_update_add_mask_sym(LLMatObject *self, PyObject *args) {  PyObject *bIn, *indIn, *maskIn;   PyArrayObject *b, *ind, *mask;  double v;  int len, i, j, i1, j1, ldb;  if (!PyArg_ParseTuple(args, "OOO", &bIn, &indIn, &maskIn))     return NULL;  b = (PyArrayObject *)PyArray_ContiguousFromObject(bIn, PyArray_DOUBLE, 2, 2);  ind = (PyArrayObject *)PyArray_ContiguousFromObject(indIn, PyArray_INT, 1, 1);  mask = (PyArrayObject *)PyArray_ContiguousFromObject(maskIn, PyArray_INT, 1, 1);  if (b == NULL || ind == NULL || mask == NULL)    goto fail;  len = ind->dimensions[0];  /* validate array shapes */  if (mask->dimensions[0] != len) {    PyErr_SetString(PyExc_ValueError, "shapes of index and mask array do not match");    goto fail;  }  if (b->dimensions[0] != len || b->dimensions[1] != len) {    PyErr_SetString(PyExc_ValueError, "shapes of input matrix and index arrays do not match");    goto fail;  }    /* perform update add operation */  ldb = b->dimensions[0];  for (i = 0; i < len; i ++) {    if (((int *)mask->data)[i]) {      i1 = ((int *)ind->data)[i];      if (i1 < 0)	i1 += self->dim[0];      if (i1 < 0 || i1 >= self->dim[0]) {	PyErr_SetString(PyExc_IndexError, "element of arg 2 out of range");	goto fail;      }         for (j = 0; j <= i; j ++) {	if (((int *)mask->data)[j]) {	  j1 = ((int *)ind->data)[j]; /* index check not necessary here */	  if (j1 < 0)	    j1 += self->dim[1];	  v = ((double *)b->data)[i + ldb*j];	  if (self->issym) {	    /* symmetric matrix: update entry in lower triangle */	    if (i1 > j1) {	      if (SpMatrix_LLMatUpdateItemAdd(self, i1, j1, v) == -1)		goto fail;	    } else {	      if (SpMatrix_LLMatUpdateItemAdd(self, j1, i1, v) == -1)		goto fail;	    }	  } else {	    /* non-symmetric matrix: update two entries if not on diagonal */	    if (SpMatrix_LLMatUpdateItemAdd(self, i1, j1, v) == -1)	      goto fail;	    if (i1 != j1) {	      if (SpMatrix_LLMatUpdateItemAdd(self, j1, i1, v) == -1)		goto fail;	    }	  }	}      }    }  }    Py_DECREF(b);  Py_DECREF(ind);  Py_DECREF(mask);  Py_INCREF(Py_None);   return Py_None; fail:  Py_XDECREF(b);  Py_XDECREF(ind);  Py_XDECREF(mask);  return NULL;}