Changeset 7708 for trunk/projects/slimcurve/src/main/c/EcfUtil.c
 Timestamp:
 05/20/11 22:24:58 (9 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/projects/slimcurve/src/main/c/EcfUtil.c
r7706 r7708 22 22 int ECF_debug = 0; 23 23 24 //TODO ARG 25 //#define SPEEDUP1 1 26 //#define SPEEDUP2 1 27 //#define SPEEDUP3 1 24 28 25 29 /******************************************************************** … … 176 180 } 177 181 182 #ifdef SPEEDUP1 183 //TODO ARG this is actually slower! 184 // swap rows 185 float *ptr1; 186 float *ptr2; 187 if (pivotRow != col) { 188 // swap elements in a matrix 189 ptr1 = &a[col][0]; 190 ptr2 = &a[pivotRow][0]; 191 for (i = 0; i < n; ++i) { 192 float temp; 193 SWAP(*ptr1, *ptr2); 194 ++ptr1; 195 ++ptr2; 196 } 197 198 // swap elements in order vector 199 { 200 int temp; 201 SWAP(order[col], order[pivotRow]); 202 } 203 } 204 #else 178 205 // swap rows 179 206 if (pivotRow != col) { … … 190 217 } 191 218 } 219 #endif 192 220 } 193 221 … … 210 238 int kCol; 211 239 float sum; 212 240 213 241 // initialize ordering vector 242 #ifdef SPEEDUP2 243 //TODO ARG this is *slightly* slower 244 int *order_ptr = order; 245 for (i = 0; i < n; ++i) 246 { 247 *order_ptr++ = i; 248 } 249 #else 214 250 for (i = 0; i < n; ++i) 215 251 { 216 252 order[i] = i; 217 253 } 254 #endif 218 255 219 256 // pivot first column … … 227 264 228 265 // compute first row of upper 266 #ifdef SPEEDUP3 267 //TODO ARG this is *much* slower!!! 268 // Note compiler probably realizes a[0] is a constant anyway 269 inverse = 1.0 / a[0][0]; 270 float *a_0_ptr = a[0]; 271 for (i = 1; i < n; ++i) { 272 *a_0_ptr++ *= inverse; 273 } 274 #else 229 275 inverse = 1.0 / a[0][0]; 230 276 for (i = 1; i < n; ++i) { 231 277 a[0][i] *= inverse; 232 278 } 279 #endif 233 280 234 281 // continue computing columns of lowers then rows of uppers … … 377 424 int GCI_solve(float **a, int n, float *b) 378 425 { 379 return GCI_solve_Gaussian(a, n, b);380 //return GCI_solve_lu_decomp(a, n, b);426 //return GCI_solve_Gaussian(a, n, b); 427 return GCI_solve_lu_decomp(a, n, b); 381 428 } 382 429 … … 387 434 int GCI_invert(float **a, int n) 388 435 { 389 return GCI_invert_Gaussian(a, n);390 //return GCI_invert_lu_decomp(a, n);436 //return GCI_invert_Gaussian(a, n); 437 return GCI_invert_lu_decomp(a, n); 391 438 } 392 439
Note: See TracChangeset
for help on using the changeset viewer.