root / src / lapack / double / dlassq.f @ 2
Historique | Voir | Annoter | Télécharger (2,63 ko)
| 1 | 1 | pfleura2 | SUBROUTINE DLASSQ( N, X, INCX, SCALE, SUMSQ ) |
|---|---|---|---|
| 2 | 1 | pfleura2 | * |
| 3 | 1 | pfleura2 | * -- LAPACK auxiliary routine (version 3.2) -- |
| 4 | 1 | pfleura2 | * -- LAPACK is a software package provided by Univ. of Tennessee, -- |
| 5 | 1 | pfleura2 | * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- |
| 6 | 1 | pfleura2 | * November 2006 |
| 7 | 1 | pfleura2 | * |
| 8 | 1 | pfleura2 | * .. Scalar Arguments .. |
| 9 | 1 | pfleura2 | INTEGER INCX, N |
| 10 | 1 | pfleura2 | DOUBLE PRECISION SCALE, SUMSQ |
| 11 | 1 | pfleura2 | * .. |
| 12 | 1 | pfleura2 | * .. Array Arguments .. |
| 13 | 1 | pfleura2 | DOUBLE PRECISION X( * ) |
| 14 | 1 | pfleura2 | * .. |
| 15 | 1 | pfleura2 | * |
| 16 | 1 | pfleura2 | * Purpose |
| 17 | 1 | pfleura2 | * ======= |
| 18 | 1 | pfleura2 | * |
| 19 | 1 | pfleura2 | * DLASSQ returns the values scl and smsq such that |
| 20 | 1 | pfleura2 | * |
| 21 | 1 | pfleura2 | * ( scl**2 )*smsq = x( 1 )**2 +...+ x( n )**2 + ( scale**2 )*sumsq, |
| 22 | 1 | pfleura2 | * |
| 23 | 1 | pfleura2 | * where x( i ) = X( 1 + ( i - 1 )*INCX ). The value of sumsq is |
| 24 | 1 | pfleura2 | * assumed to be non-negative and scl returns the value |
| 25 | 1 | pfleura2 | * |
| 26 | 1 | pfleura2 | * scl = max( scale, abs( x( i ) ) ). |
| 27 | 1 | pfleura2 | * |
| 28 | 1 | pfleura2 | * scale and sumsq must be supplied in SCALE and SUMSQ and |
| 29 | 1 | pfleura2 | * scl and smsq are overwritten on SCALE and SUMSQ respectively. |
| 30 | 1 | pfleura2 | * |
| 31 | 1 | pfleura2 | * The routine makes only one pass through the vector x. |
| 32 | 1 | pfleura2 | * |
| 33 | 1 | pfleura2 | * Arguments |
| 34 | 1 | pfleura2 | * ========= |
| 35 | 1 | pfleura2 | * |
| 36 | 1 | pfleura2 | * N (input) INTEGER |
| 37 | 1 | pfleura2 | * The number of elements to be used from the vector X. |
| 38 | 1 | pfleura2 | * |
| 39 | 1 | pfleura2 | * X (input) DOUBLE PRECISION array, dimension (N) |
| 40 | 1 | pfleura2 | * The vector for which a scaled sum of squares is computed. |
| 41 | 1 | pfleura2 | * x( i ) = X( 1 + ( i - 1 )*INCX ), 1 <= i <= n. |
| 42 | 1 | pfleura2 | * |
| 43 | 1 | pfleura2 | * INCX (input) INTEGER |
| 44 | 1 | pfleura2 | * The increment between successive values of the vector X. |
| 45 | 1 | pfleura2 | * INCX > 0. |
| 46 | 1 | pfleura2 | * |
| 47 | 1 | pfleura2 | * SCALE (input/output) DOUBLE PRECISION |
| 48 | 1 | pfleura2 | * On entry, the value scale in the equation above. |
| 49 | 1 | pfleura2 | * On exit, SCALE is overwritten with scl , the scaling factor |
| 50 | 1 | pfleura2 | * for the sum of squares. |
| 51 | 1 | pfleura2 | * |
| 52 | 1 | pfleura2 | * SUMSQ (input/output) DOUBLE PRECISION |
| 53 | 1 | pfleura2 | * On entry, the value sumsq in the equation above. |
| 54 | 1 | pfleura2 | * On exit, SUMSQ is overwritten with smsq , the basic sum of |
| 55 | 1 | pfleura2 | * squares from which scl has been factored out. |
| 56 | 1 | pfleura2 | * |
| 57 | 1 | pfleura2 | * ===================================================================== |
| 58 | 1 | pfleura2 | * |
| 59 | 1 | pfleura2 | * .. Parameters .. |
| 60 | 1 | pfleura2 | DOUBLE PRECISION ZERO |
| 61 | 1 | pfleura2 | PARAMETER ( ZERO = 0.0D+0 ) |
| 62 | 1 | pfleura2 | * .. |
| 63 | 1 | pfleura2 | * .. Local Scalars .. |
| 64 | 1 | pfleura2 | INTEGER IX |
| 65 | 1 | pfleura2 | DOUBLE PRECISION ABSXI |
| 66 | 1 | pfleura2 | * .. |
| 67 | 1 | pfleura2 | * .. Intrinsic Functions .. |
| 68 | 1 | pfleura2 | INTRINSIC ABS |
| 69 | 1 | pfleura2 | * .. |
| 70 | 1 | pfleura2 | * .. Executable Statements .. |
| 71 | 1 | pfleura2 | * |
| 72 | 1 | pfleura2 | IF( N.GT.0 ) THEN |
| 73 | 1 | pfleura2 | DO 10 IX = 1, 1 + ( N-1 )*INCX, INCX |
| 74 | 1 | pfleura2 | IF( X( IX ).NE.ZERO ) THEN |
| 75 | 1 | pfleura2 | ABSXI = ABS( X( IX ) ) |
| 76 | 1 | pfleura2 | IF( SCALE.LT.ABSXI ) THEN |
| 77 | 1 | pfleura2 | SUMSQ = 1 + SUMSQ*( SCALE / ABSXI )**2 |
| 78 | 1 | pfleura2 | SCALE = ABSXI |
| 79 | 1 | pfleura2 | ELSE |
| 80 | 1 | pfleura2 | SUMSQ = SUMSQ + ( ABSXI / SCALE )**2 |
| 81 | 1 | pfleura2 | END IF |
| 82 | 1 | pfleura2 | END IF |
| 83 | 1 | pfleura2 | 10 CONTINUE |
| 84 | 1 | pfleura2 | END IF |
| 85 | 1 | pfleura2 | RETURN |
| 86 | 1 | pfleura2 | * |
| 87 | 1 | pfleura2 | * End of DLASSQ |
| 88 | 1 | pfleura2 | * |
| 89 | 1 | pfleura2 | END |