Changeset 596
- Timestamp:
- Nov 19, 2004, 11:06:14 AM (20 years ago)
- Location:
- inundation/ga/storm_surge/pyvolution
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/ga/storm_surge/pyvolution/sparse_ext.c
r594 r596 13 13 #include "Numeric/arrayobject.h" 14 14 #include "math.h" 15 #include "stdio.h" 15 16 16 17 int _csr_mv(int M, … … 23 24 long i, j, ckey; 24 25 26 printf("test"); 25 27 for (i=0; i<M; i++ ) 26 28 for (ckey=row_ptr[i]; ckey<row_ptr[i+1]; ckey++) { … … 29 31 } 30 32 33 printf("end"); 31 34 return 0; 32 35 } … … 52 55 53 56 int dimensions[1], M, err; 57 int xdim, i; 54 58 55 59 // Convert Python arguments to C … … 89 93 90 94 M = (row_ptr -> dimensions[0])-1; 95 96 97 printf(" x.dim[0] = %i x.dim[1] = %i \n", x -> dimensions[0], x -> dimensions[1]); 91 98 92 99 //Allocate space for return vectors y (don't DECREF) … … 94 101 y = (PyArrayObject *) PyArray_FromDims(1, dimensions, PyArray_DOUBLE); 95 102 103 for (i=0;i<25;i++){ 104 printf(" data[%i]=%i\n",i,(data->data)[i]); 105 } 106 107 for (i=0;i<25;i++){ 108 printf(" colind[%i]=%i\n",i,(colind->data)[i]); 109 } 96 110 err = _csr_mv(M, 97 111 (double*) data -> data, … … 99 113 (long*) row_ptr -> data, 100 114 (double*) x -> data, 101 (double*) y -> data); 115 (double*) y -> data); 116 117 for (i=0;i<25;i++){ 118 printf(" data[%i]=%i\n",i,data->data[i]); 119 } 102 120 103 121 if (err != 0) { -
inundation/ga/storm_surge/pyvolution/test_cg_solve.py
r594 r596 79 79 80 80 def test_solve_large_2d_csr_matrix(self): 81 """Standard 2d laplacian""" 81 """Standard 2d laplacian with csr format 82 """ 82 83 83 84 n = 100 … … 102 103 103 104 # Convert to csr format 104 #print 'start covert'105 print 'start covert' 105 106 A = Sparse_CSR(A) 106 #print 'finish covert'107 print 'finish covert' 107 108 b = A*xe 108 109 x = conjugate_gradient(A,b,b,iprint=20) -
inundation/ga/storm_surge/pyvolution/test_sparse.py
r586 r596 150 150 151 151 def test_sparse_addition(self): 152 """ Test sparse addition with dok format 153 """ 152 154 153 155 A = Sparse(3,3) … … 167 169 168 170 def test_sparse_tocsr(self): 169 171 """ Test conversion to csr format 172 """ 173 170 174 A = Sparse(4,3) 171 175
Note: See TracChangeset
for help on using the changeset viewer.