Changeset 7780
 Timestamp:
 09/30/11 18:29:18 (8 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/projects/slimcurve/src/main/c/EcfUtil.c
r7779 r7780 22 22 int ECF_debug = 0; 23 23 24 //TODO ARG25 //#define SPEEDUP1 126 //#define SPEEDUP2 127 //#define SPEEDUP3 128 29 24 /******************************************************************** 30 25 … … 46 41 float *pivotInverse = (float *)malloc(n * sizeof(float)); 47 42 int i, j, k, m; 48 /*int q, w;49 printf("\n");50 for (q = 0; q < n; ++q) {51 for (w = 0; w < n; ++w) {52 printf("%f ", a[q][w]);53 }54 printf(" %f\n", b[q]);55 } */56 43 57 44 // base row of matrix … … 82 69 if (0.0 == a[k][k]) 83 70 { 84 71 free(pivotInverse); 85 72 return 2; // singular matrix 86 73 } … … 111 98 } 112 99 113 /*printf("====>\n"); 114 for (q = 0; q < n; ++q) { 115 for (w = 0; w < n; ++w) { 116 printf("%f ", a[q][w]); 117 } 118 printf(" %f\n", b[q]); 119 }*/ 120 121 free(pivotInverse); 100 free(pivotInverse); 122 101 return 0; 123 102 } … … 183 162 } 184 163 185 #ifdef SPEEDUP1186 //TODO ARG this is actually slower!187 // swap rows188 float *ptr1;189 float *ptr2;190 if (pivotRow != col) {191 // swap elements in a matrix192 ptr1 = &a[col][0];193 ptr2 = &a[pivotRow][0];194 for (i = 0; i < n; ++i) {195 float temp;196 SWAP(*ptr1, *ptr2);197 ++ptr1;198 ++ptr2;199 }200 201 // swap elements in order vector202 {203 int temp;204 SWAP(order[col], order[pivotRow]);205 }206 }207 #else208 164 // swap rows 209 165 if (pivotRow != col) { … … 220 176 } 221 177 } 222 #endif223 178 } 224 179 … … 243 198 244 199 // initialize ordering vector 245 #ifdef SPEEDUP2246 //TODO ARG this is *slightly* slower247 int *order_ptr = order;248 for (i = 0; i < n; ++i)249 {250 *order_ptr++ = i;251 }252 #else253 200 for (i = 0; i < n; ++i) 254 201 { 255 202 order[i] = i; 256 203 } 257 #endif258 204 259 205 // pivot first column … … 268 214 // compute first row of upper 269 215 inverse = 1.0 / a[0][0]; 270 #ifdef SPEEDUP3271 //TODO ARG this is *much* slower!!!272 // Note compiler probably realizes a[0] is a constant anyway273 float *a_0_ptr = a[0];274 for (i = 1; i < n; ++i) {275 *a_0_ptr++ *= inverse;276 }277 #else278 216 for (i = 1; i < n; ++i) { 279 217 a[0][i] *= inverse; 280 218 } 281 #endif282 219 283 220 // continue computing columns of lowers then rows of uppers … … 417 354 } 418 355 419 356 free(order); 420 357 GCI_ecf_free_matrix(identity); 421 358 return returnValue;
Note: See TracChangeset
for help on using the changeset viewer.