Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 245100
Collapse All | Expand All

(-)scipy-0.6.0/scipy/linsolve/SuperLU/SRC/cgsequ.c (-2 / +2 lines)
Lines 118-124 Link Here
118
    for (j = 0; j < A->ncol; ++j)
118
    for (j = 0; j < A->ncol; ++j)
119
	for (i = Astore->colptr[j]; i < Astore->colptr[j+1]; ++i) {
119
	for (i = Astore->colptr[j]; i < Astore->colptr[j+1]; ++i) {
120
	    irow = Astore->rowind[i];
120
	    irow = Astore->rowind[i];
121
	    r[irow] = SUPERLU_MAX( r[irow], c_abs1(&Aval[i]) );
121
	    r[irow] = SUPERLU_MAX( r[irow], slu_c_abs1(&Aval[i]) );
122
	}
122
	}
123
123
124
    /* Find the maximum and minimum scale factors. */
124
    /* Find the maximum and minimum scale factors. */
Lines 153-159 Link Here
153
    for (j = 0; j < A->ncol; ++j)
153
    for (j = 0; j < A->ncol; ++j)
154
	for (i = Astore->colptr[j]; i < Astore->colptr[j+1]; ++i) {
154
	for (i = Astore->colptr[j]; i < Astore->colptr[j+1]; ++i) {
155
	    irow = Astore->rowind[i];
155
	    irow = Astore->rowind[i];
156
	    c[j] = SUPERLU_MAX( c[j], c_abs1(&Aval[i]) * r[irow] );
156
	    c[j] = SUPERLU_MAX( c[j], slu_c_abs1(&Aval[i]) * r[irow] );
157
	}
157
	}
158
158
159
    /* Find the maximum and minimum scale factors. */
159
    /* Find the maximum and minimum scale factors. */
(-)scipy-0.6.0/scipy/linsolve/SuperLU/SRC/cgsrfs.c (-16 / +16 lines)
Lines 276-296 Link Here
276
	       than SAFE2, then SAFE1 is added to the i-th component of the   
276
	       than SAFE2, then SAFE1 is added to the i-th component of the   
277
	       numerator and denominator before dividing. */
277
	       numerator and denominator before dividing. */
278
278
279
	    for (i = 0; i < A->nrow; ++i) rwork[i] = c_abs1( &Bptr[i] );
279
	    for (i = 0; i < A->nrow; ++i) rwork[i] = slu_c_abs1( &Bptr[i] );
280
	    
280
	    
281
	    /* Compute abs(op(A))*abs(X) + abs(B). */
281
	    /* Compute abs(op(A))*abs(X) + abs(B). */
282
	    if (notran) {
282
	    if (notran) {
283
		for (k = 0; k < A->ncol; ++k) {
283
		for (k = 0; k < A->ncol; ++k) {
284
		    xk = c_abs1( &Xptr[k] );
284
		    xk = slu_c_abs1( &Xptr[k] );
285
		    for (i = Astore->colptr[k]; i < Astore->colptr[k+1]; ++i)
285
		    for (i = Astore->colptr[k]; i < Astore->colptr[k+1]; ++i)
286
			rwork[Astore->rowind[i]] += c_abs1(&Aval[i]) * xk;
286
			rwork[Astore->rowind[i]] += slu_c_abs1(&Aval[i]) * xk;
287
		}
287
		}
288
	    } else {
288
	    } else {
289
		for (k = 0; k < A->ncol; ++k) {
289
		for (k = 0; k < A->ncol; ++k) {
290
		    s = 0.;
290
		    s = 0.;
291
		    for (i = Astore->colptr[k]; i < Astore->colptr[k+1]; ++i) {
291
		    for (i = Astore->colptr[k]; i < Astore->colptr[k+1]; ++i) {
292
			irow = Astore->rowind[i];
292
			irow = Astore->rowind[i];
293
			s += c_abs1(&Aval[i]) * c_abs1(&Xptr[irow]);
293
			s += slu_c_abs1(&Aval[i]) * slu_c_abs1(&Xptr[irow]);
294
		    }
294
		    }
295
		    rwork[k] += s;
295
		    rwork[k] += s;
296
		}
296
		}
Lines 298-306 Link Here
298
	    s = 0.;
298
	    s = 0.;
299
	    for (i = 0; i < A->nrow; ++i) {
299
	    for (i = 0; i < A->nrow; ++i) {
300
		if (rwork[i] > safe2)
300
		if (rwork[i] > safe2)
301
		    s = SUPERLU_MAX( s, c_abs1(&work[i]) / rwork[i] );
301
		    s = SUPERLU_MAX( s, slu_c_abs1(&work[i]) / rwork[i] );
302
		else
302
		else
303
		    s = SUPERLU_MAX( s, (c_abs1(&work[i]) + safe1) / 
303
		    s = SUPERLU_MAX( s, (slu_c_abs1(&work[i]) + safe1) / 
304
				(rwork[i] + safe1) );
304
				(rwork[i] + safe1) );
305
	    }
305
	    }
306
	    berr[j] = s;
306
	    berr[j] = s;
Lines 351-372 Link Here
351
             inv(op(A)) * diag(W),   
351
             inv(op(A)) * diag(W),   
352
          where W = abs(R) + NZ*EPS*( abs(op(A))*abs(X)+abs(B) ))) */
352
          where W = abs(R) + NZ*EPS*( abs(op(A))*abs(X)+abs(B) ))) */
353
	
353
	
354
	for (i = 0; i < A->nrow; ++i) rwork[i] = c_abs1( &Bptr[i] );
354
	for (i = 0; i < A->nrow; ++i) rwork[i] = slu_c_abs1( &Bptr[i] );
355
	
355
	
356
	/* Compute abs(op(A))*abs(X) + abs(B). */
356
	/* Compute abs(op(A))*abs(X) + abs(B). */
357
	if ( notran ) {
357
	if ( notran ) {
358
	    for (k = 0; k < A->ncol; ++k) {
358
	    for (k = 0; k < A->ncol; ++k) {
359
		xk = c_abs1( &Xptr[k] );
359
		xk = slu_c_abs1( &Xptr[k] );
360
		for (i = Astore->colptr[k]; i < Astore->colptr[k+1]; ++i)
360
		for (i = Astore->colptr[k]; i < Astore->colptr[k+1]; ++i)
361
		    rwork[Astore->rowind[i]] += c_abs1(&Aval[i]) * xk;
361
		    rwork[Astore->rowind[i]] += slu_c_abs1(&Aval[i]) * xk;
362
	    }
362
	    }
363
	} else {
363
	} else {
364
	    for (k = 0; k < A->ncol; ++k) {
364
	    for (k = 0; k < A->ncol; ++k) {
365
		s = 0.;
365
		s = 0.;
366
		for (i = Astore->colptr[k]; i < Astore->colptr[k+1]; ++i) {
366
		for (i = Astore->colptr[k]; i < Astore->colptr[k+1]; ++i) {
367
		    irow = Astore->rowind[i];
367
		    irow = Astore->rowind[i];
368
		    xk = c_abs1( &Xptr[irow] );
368
		    xk = slu_c_abs1( &Xptr[irow] );
369
		    s += c_abs1(&Aval[i]) * xk;
369
		    s += slu_c_abs1(&Aval[i]) * xk;
370
		}
370
		}
371
		rwork[k] += s;
371
		rwork[k] += s;
372
	    }
372
	    }
Lines 374-382 Link Here
374
	
374
	
375
	for (i = 0; i < A->nrow; ++i)
375
	for (i = 0; i < A->nrow; ++i)
376
	    if (rwork[i] > safe2)
376
	    if (rwork[i] > safe2)
377
		rwork[i] = c_abs(&work[i]) + (iwork[i]+1)*eps*rwork[i];
377
		rwork[i] = slu_c_abs(&work[i]) + (iwork[i]+1)*eps*rwork[i];
378
	    else
378
	    else
379
		rwork[i] = c_abs(&work[i])+(iwork[i]+1)*eps*rwork[i]+safe1;
379
		rwork[i] = slu_c_abs(&work[i])+(iwork[i]+1)*eps*rwork[i]+safe1;
380
	kase = 0;
380
	kase = 0;
381
381
382
	do {
382
	do {
Lines 424-436 Link Here
424
	lstres = 0.;
424
	lstres = 0.;
425
 	if ( notran && colequ ) {
425
 	if ( notran && colequ ) {
426
	    for (i = 0; i < A->nrow; ++i)
426
	    for (i = 0; i < A->nrow; ++i)
427
	    	lstres = SUPERLU_MAX( lstres, C[i] * c_abs1( &Xptr[i]) );
427
	    	lstres = SUPERLU_MAX( lstres, C[i] * slu_c_abs1( &Xptr[i]) );
428
  	} else if ( !notran && rowequ ) {
428
  	} else if ( !notran && rowequ ) {
429
	    for (i = 0; i < A->nrow; ++i)
429
	    for (i = 0; i < A->nrow; ++i)
430
	    	lstres = SUPERLU_MAX( lstres, R[i] * c_abs1( &Xptr[i]) );
430
	    	lstres = SUPERLU_MAX( lstres, R[i] * slu_c_abs1( &Xptr[i]) );
431
	} else {
431
	} else {
432
	    for (i = 0; i < A->nrow; ++i)
432
	    for (i = 0; i < A->nrow; ++i)
433
	    	lstres = SUPERLU_MAX( lstres, c_abs1( &Xptr[i]) );
433
	    	lstres = SUPERLU_MAX( lstres, slu_c_abs1( &Xptr[i]) );
434
	}
434
	}
435
	if ( lstres != 0. )
435
	if ( lstres != 0. )
436
	    ferr[j] /= lstres;
436
	    ferr[j] /= lstres;
(-)scipy-0.6.0/scipy/linsolve/SuperLU/SRC/clacon.c (-3 / +3 lines)
Lines 106-119 Link Here
106
  L20:
106
  L20:
107
    if (*n == 1) {
107
    if (*n == 1) {
108
	v[0] = x[0];
108
	v[0] = x[0];
109
	*est = c_abs(&v[0]);
109
	*est = slu_c_abs(&v[0]);
110
	/*        ... QUIT */
110
	/*        ... QUIT */
111
	goto L150;
111
	goto L150;
112
    }
112
    }
113
    *est = scsum1_(n, x, &c__1);
113
    *est = scsum1_(n, x, &c__1);
114
114
115
    for (i = 0; i < *n; ++i) {
115
    for (i = 0; i < *n; ++i) {
116
	d__1 = c_abs(&x[i]);
116
	d__1 = slu_c_abs(&x[i]);
117
	if (d__1 > safmin) {
117
	if (d__1 > safmin) {
118
	    d__1 = 1 / d__1;
118
	    d__1 = 1 / d__1;
119
	    x[i].r *= d__1;
119
	    x[i].r *= d__1;
Lines 158-164 Link Here
158
    if (*est <= estold) goto L120;
158
    if (*est <= estold) goto L120;
159
159
160
    for (i = 0; i < *n; ++i) {
160
    for (i = 0; i < *n; ++i) {
161
	d__1 = c_abs(&x[i]);
161
	d__1 = slu_c_abs(&x[i]);
162
	if (d__1 > safmin) {
162
	if (d__1 > safmin) {
163
	    d__1 = 1 / d__1;
163
	    d__1 = 1 / d__1;
164
	    x[i].r *= d__1;
164
	    x[i].r *= d__1;
(-)scipy-0.6.0/scipy/linsolve/SuperLU/SRC/clangs.c (-3 / +3 lines)
Lines 72-78 Link Here
72
	value = 0.;
72
	value = 0.;
73
	for (j = 0; j < A->ncol; ++j)
73
	for (j = 0; j < A->ncol; ++j)
74
	    for (i = Astore->colptr[j]; i < Astore->colptr[j+1]; i++)
74
	    for (i = Astore->colptr[j]; i < Astore->colptr[j+1]; i++)
75
		value = SUPERLU_MAX( value, c_abs( &Aval[i]) );
75
		value = SUPERLU_MAX( value, slu_c_abs( &Aval[i]) );
76
	
76
	
77
    } else if (lsame_(norm, "O") || *(unsigned char *)norm == '1') {
77
    } else if (lsame_(norm, "O") || *(unsigned char *)norm == '1') {
78
	/* Find norm1(A). */
78
	/* Find norm1(A). */
Lines 80-86 Link Here
80
	for (j = 0; j < A->ncol; ++j) {
80
	for (j = 0; j < A->ncol; ++j) {
81
	    sum = 0.;
81
	    sum = 0.;
82
	    for (i = Astore->colptr[j]; i < Astore->colptr[j+1]; i++) 
82
	    for (i = Astore->colptr[j]; i < Astore->colptr[j+1]; i++) 
83
		sum += c_abs( &Aval[i] );
83
		sum += slu_c_abs( &Aval[i] );
84
	    value = SUPERLU_MAX(value,sum);
84
	    value = SUPERLU_MAX(value,sum);
85
	}
85
	}
86
	
86
	
Lines 92-98 Link Here
92
	for (j = 0; j < A->ncol; ++j)
92
	for (j = 0; j < A->ncol; ++j)
93
	    for (i = Astore->colptr[j]; i < Astore->colptr[j+1]; i++) {
93
	    for (i = Astore->colptr[j]; i < Astore->colptr[j+1]; i++) {
94
		irow = Astore->rowind[i];
94
		irow = Astore->rowind[i];
95
		rwork[irow] += c_abs( &Aval[i] );
95
		rwork[irow] += slu_c_abs( &Aval[i] );
96
	    }
96
	    }
97
	value = 0.;
97
	value = 0.;
98
	for (i = 0; i < A->nrow; ++i)
98
	for (i = 0; i < A->nrow; ++i)
(-)scipy-0.6.0/scipy/linsolve/SuperLU/SRC/cpivotgrowth.c (-3 / +3 lines)
Lines 83-97 Link Here
83
	    maxaj = 0.;
83
	    maxaj = 0.;
84
            oldcol = inv_perm_c[j];
84
            oldcol = inv_perm_c[j];
85
	    for (i = Astore->colptr[oldcol]; i < Astore->colptr[oldcol+1]; ++i)
85
	    for (i = Astore->colptr[oldcol]; i < Astore->colptr[oldcol+1]; ++i)
86
		maxaj = SUPERLU_MAX( maxaj, c_abs1( &Aval[i]) );
86
		maxaj = SUPERLU_MAX( maxaj, slu_c_abs1( &Aval[i]) );
87
	
87
	
88
	    maxuj = 0.;
88
	    maxuj = 0.;
89
	    for (i = Ustore->colptr[j]; i < Ustore->colptr[j+1]; i++)
89
	    for (i = Ustore->colptr[j]; i < Ustore->colptr[j+1]; i++)
90
		maxuj = SUPERLU_MAX( maxuj, c_abs1( &Uval[i]) );
90
		maxuj = SUPERLU_MAX( maxuj, slu_c_abs1( &Uval[i]) );
91
	    
91
	    
92
	    /* Supernode */
92
	    /* Supernode */
93
	    for (i = 0; i < nz_in_U; ++i)
93
	    for (i = 0; i < nz_in_U; ++i)
94
		maxuj = SUPERLU_MAX( maxuj, c_abs1( &luval[i]) );
94
		maxuj = SUPERLU_MAX( maxuj, slu_c_abs1( &luval[i]) );
95
95
96
	    ++nz_in_U;
96
	    ++nz_in_U;
97
	    luval += nsupr;
97
	    luval += nsupr;
(-)scipy-0.6.0/scipy/linsolve/SuperLU/SRC/cpivotL.c (-3 / +3 lines)
Lines 106-112 Link Here
106
    diag = EMPTY;
106
    diag = EMPTY;
107
    old_pivptr = nsupc;
107
    old_pivptr = nsupc;
108
    for (isub = nsupc; isub < nsupr; ++isub) {
108
    for (isub = nsupc; isub < nsupr; ++isub) {
109
        rtemp = c_abs1 (&lu_col_ptr[isub]);
109
        rtemp = slu_c_abs1 (&lu_col_ptr[isub]);
110
	if ( rtemp > pivmax ) {
110
	if ( rtemp > pivmax ) {
111
	    pivmax = rtemp;
111
	    pivmax = rtemp;
112
	    pivptr = isub;
112
	    pivptr = isub;
Lines 127-133 Link Here
127
    
127
    
128
    /* Choose appropriate pivotal element by our policy. */
128
    /* Choose appropriate pivotal element by our policy. */
129
    if ( *usepr ) {
129
    if ( *usepr ) {
130
        rtemp = c_abs1 (&lu_col_ptr[old_pivptr]);
130
        rtemp = slu_c_abs1 (&lu_col_ptr[old_pivptr]);
131
	if ( rtemp != 0.0 && rtemp >= thresh )
131
	if ( rtemp != 0.0 && rtemp >= thresh )
132
	    pivptr = old_pivptr;
132
	    pivptr = old_pivptr;
133
	else
133
	else
Lines 136-142 Link Here
136
    if ( *usepr == 0 ) {
136
    if ( *usepr == 0 ) {
137
	/* Use diagonal pivot? */
137
	/* Use diagonal pivot? */
138
	if ( diag >= 0 ) { /* diagonal exists */
138
	if ( diag >= 0 ) { /* diagonal exists */
139
            rtemp = c_abs1 (&lu_col_ptr[diag]);
139
            rtemp = slu_c_abs1 (&lu_col_ptr[diag]);
140
	    if ( rtemp != 0.0 && rtemp >= thresh ) pivptr = diag;
140
	    if ( rtemp != 0.0 && rtemp >= thresh ) pivptr = diag;
141
        }
141
        }
142
	*pivrow = lsub_ptr[pivptr];
142
	*pivrow = lsub_ptr[pivptr];
(-)scipy-0.6.0/scipy/linsolve/SuperLU/SRC/cutil.c (-2 / +2 lines)
Lines 414-421 Link Here
414
      err = xnorm = 0.0;
414
      err = xnorm = 0.0;
415
      for (i = 0; i < X->nrow; i++) {
415
      for (i = 0; i < X->nrow; i++) {
416
        c_sub(&temp, &soln_work[i], &xtrue[i]);
416
        c_sub(&temp, &soln_work[i], &xtrue[i]);
417
	err = SUPERLU_MAX(err, c_abs(&temp));
417
	err = SUPERLU_MAX(err, slu_c_abs(&temp));
418
	xnorm = SUPERLU_MAX(xnorm, c_abs(&soln_work[i]));
418
	xnorm = SUPERLU_MAX(xnorm, slu_c_abs(&soln_work[i]));
419
      }
419
      }
420
      err = err / xnorm;
420
      err = err / xnorm;
421
      printf("||X - Xtrue||/||X|| = %e\n", err);
421
      printf("||X - Xtrue||/||X|| = %e\n", err);
(-)scipy-0.6.0/scipy/linsolve/SuperLU/SRC/scomplex.c (-2 / +2 lines)
Lines 45-51 Link Here
45
45
46
46
47
/* Returns sqrt(z.r^2 + z.i^2) */
47
/* Returns sqrt(z.r^2 + z.i^2) */
48
double c_abs(complex *z)
48
double slu_c_abs(complex *z)
49
{
49
{
50
    float temp;
50
    float temp;
51
    float real = z->r;
51
    float real = z->r;
Lines 68-74 Link Here
68
68
69
/* Approximates the abs */
69
/* Approximates the abs */
70
/* Returns abs(z.r) + abs(z.i) */
70
/* Returns abs(z.r) + abs(z.i) */
71
double c_abs1(complex *z)
71
double slu_c_abs1(complex *z)
72
{
72
{
73
    float real = z->r;
73
    float real = z->r;
74
    float imag = z->i;
74
    float imag = z->i;
(-)scipy-0.6.0/scipy/linsolve/SuperLU/SRC/scomplex.h (-2 / +2 lines)
Lines 57-64 Link Here
57
57
58
/* Prototypes for functions in scomplex.c */
58
/* Prototypes for functions in scomplex.c */
59
void c_div(complex *, complex *, complex *);
59
void c_div(complex *, complex *, complex *);
60
double c_abs(complex *);     /* exact */
60
double slu_c_abs(complex *);     /* exact */
61
double c_abs1(complex *);    /* approximate */
61
double slu_c_abs1(complex *);    /* approximate */
62
void c_exp(complex *, complex *);
62
void c_exp(complex *, complex *);
63
void r_cnjg(complex *, complex *);
63
void r_cnjg(complex *, complex *);
64
double r_imag(complex *);
64
double r_imag(complex *);
(-)scipy-0.6.0/scipy/linsolve/SuperLU/SRC/scsum1.c (-3 / +3 lines)
Lines 42-48 Link Here
42
    int i__1, i__2;
42
    int i__1, i__2;
43
    float ret_val;
43
    float ret_val;
44
    /* Builtin functions */
44
    /* Builtin functions */
45
    double c_abs(complex *);
45
    double slu_c_abs(complex *);
46
    /* Local variables */
46
    /* Local variables */
47
    static int i, nincx;
47
    static int i, nincx;
48
    static float stemp;
48
    static float stemp;
Lines 69-75 Link Here
69
69
70
/*        NEXT LINE MODIFIED. */
70
/*        NEXT LINE MODIFIED. */
71
71
72
	stemp += c_abs(&CX(i));
72
	stemp += slu_c_abs(&CX(i));
73
/* L10: */
73
/* L10: */
74
    }
74
    }
75
    ret_val = stemp;
75
    ret_val = stemp;
Lines 83-89 Link Here
83
83
84
/*        NEXT LINE MODIFIED. */
84
/*        NEXT LINE MODIFIED. */
85
85
86
	stemp += c_abs(&CX(i));
86
	stemp += slu_c_abs(&CX(i));
87
/* L30: */
87
/* L30: */
88
    }
88
    }
89
    ret_val = stemp;
89
    ret_val = stemp;

Return to bug 245100