Changeset 594 for inundation/ga/storm_surge/pyvolution/sparse_ext.c
- Timestamp:
- Nov 18, 2004, 10:53:59 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/ga/storm_surge/pyvolution/sparse_ext.c
r589 r594 16 16 int _csr_mv(int M, 17 17 double* data, 18 int* colind,19 int* row_ptr,18 long* colind, 19 long* row_ptr, 20 20 double* x, 21 21 double* y) { 22 22 23 inti, j, ckey;23 long i, j, ckey; 24 24 25 25 for (i=0; i<M; i++ ) … … 40 40 41 41 PyObject *csr_sparse, // input sparse matrix 42 * R; // output wrapped vector42 *xin, *R; // output wrapped vector 43 43 44 44 PyArrayObject … … 48 48 *x, //Input vector array 49 49 *y; //Return vector array 50 51 double *xdata; 50 52 51 53 int dimensions[1], M, err; 52 54 53 55 // Convert Python arguments to C 54 if (!PyArg_ParseTuple(args, "OO", &csr_sparse, &x ))56 if (!PyArg_ParseTuple(args, "OO", &csr_sparse, &xin)) 55 57 return NULL; 58 59 x = (PyArrayObject*) PyArray_ContiguousFromObject(xin,PyArray_DOUBLE,1,2); 60 if (!x) 61 return NULL; 62 63 /* printf("x.nd = %i\n",x->nd); */ 64 /* printf("x.descr->type_num = %i %i\n",x->descr->type_num,PyArray_LONG); */ 65 /* printf("x.dimensions[0] = %i\n",x->dimensions[0]); */ 66 /* printf("x.data[0] = %g\n",((double*) x->data)[0]); */ 67 /* printf("x.data[1] = %g\n",((double*) x->data)[1]); */ 68 /* printf("x.data[2] = %g\n",((double*) x->data)[2]); */ 69 /* printf("x.data[3] = %g\n",((double*) x->data)[3]); */ 70 /* printf("x.data[4] = %g\n",((double*) x->data)[4]); */ 71 /* printf("x.data[5] = %g\n",((double*) x->data)[5]); */ 72 73 56 74 57 75 … … 61 79 return NULL; 62 80 81 63 82 colind = (PyArrayObject*) 64 83 PyObject_GetAttrString(csr_sparse, "colind"); 65 84 if (!colind) return NULL; 66 85 67 86 row_ptr = (PyArrayObject*) 68 87 PyObject_GetAttrString(csr_sparse, "row_ptr"); … … 77 96 err = _csr_mv(M, 78 97 (double*) data -> data, 79 ( int*) colind -> data,80 ( int*) row_ptr -> data,98 (long*) colind -> data, 99 (long*) row_ptr -> data, 81 100 (double*) x -> data, 82 101 (double*) y -> data);
Note: See TracChangeset
for help on using the changeset viewer.