Debian Codegraph @

Modules/ThirdParty/VNL/src/vxl/v3p/netlib/lapack/single/slassq.c

raw symbols SCIP
1 /* lapack/single/slassq.f -- translated by f2c (version 20050501).
2 You must link the resulting object file with libf2c:
3 on Microsoft Windows system, link with libf2c.lib;
4 on Linux or Unix systems, link with .../path/to/libf2c.a -lm
5 or, if you install libf2c.a in a standard place, with -lf2c -lm
6 -- in that order, at the end of the command line, as in
7 cc *.o -lf2c -lm
8 Source for libf2c is in /netlib/f2c/libf2c.zip, e.g.,
9
10 http://www.netlib.org/f2c/libf2c.zip
11 */
12
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16 #include "v3p_netlib.h"cxx . . $ `<file>/Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_netlib.h`/
17
18 /*< SUBROUTINE SLASSQ( N, X, INCX, SCALE, SUMSQ ) >*/
19 /* Subroutine */ int slassq_cxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_netlib_mangle.h:263:9`!(integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! *n, realcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:69:9`! *x, integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! *incx, realcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:69:9`! *scale,
20 realcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:69:9`! *sumsq)
21 {
22 /* System generated locals */
23 integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! i__1, i__2;
24 realcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:69:9`! r__1;
25
26 /* Local variables */
27 integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! ix;
28 realcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:69:9`! absxi;
29
30
31 /* -- LAPACK auxiliary routine (version 3.0) -- */
32 /* Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd., */
33 /* Courant Institute, Argonne National Lab, and Rice University */
34 /* June 30, 1999 */
35
36 /* .. Scalar Arguments .. */
37 /*< INTEGER INCX, N >*/
38 /*< REAL SCALE, SUMSQ >*/
39 /* .. */
40 /* .. Array Arguments .. */
41 /*< REAL X( * ) >*/
42 /* .. */
43
44 /* Purpose */
45 /* ======= */
46
47 /* SLASSQ returns the values scl and smsq such that */
48
49 /* ( scl**2 )*smsq = x( 1 )**2 +...+ x( n )**2 + ( scale**2 )*sumsq, */
50
51 /* where x( i ) = X( 1 + ( i - 1 )*INCX ). The value of sumsq is */
52 /* assumed to be non-negative and scl returns the value */
53
54 /* scl = max( scale, abs( x( i ) ) ). */
55
56 /* scale and sumsq must be supplied in SCALE and SUMSQ and */
57 /* scl and smsq are overwritten on SCALE and SUMSQ respectively. */
58
59 /* The routine makes only one pass through the vector x. */
60
61 /* Arguments */
62 /* ========= */
63
64 /* N (input) INTEGER */
65 /* The number of elements to be used from the vector X. */
66
67 /* X (input) REAL array, dimension (N) */
68 /* The vector for which a scaled sum of squares is computed. */
69 /* x( i ) = X( 1 + ( i - 1 )*INCX ), 1 <= i <= n. */
70
71 /* INCX (input) INTEGER */
72 /* The increment between successive values of the vector X. */
73 /* INCX > 0. */
74
75 /* SCALE (input/output) REAL */
76 /* On entry, the value scale in the equation above. */
77 /* On exit, SCALE is overwritten with scl , the scaling factor */
78 /* for the sum of squares. */
79
80 /* SUMSQ (input/output) REAL */
81 /* On entry, the value sumsq in the equation above. */
82 /* On exit, SUMSQ is overwritten with smsq , the basic sum of */
83 /* squares from which scl has been factored out. */
84
85 /* ===================================================================== */
86
87 /* .. Parameters .. */
88 /*< REAL ZERO >*/
89 /*< PARAMETER ( ZERO = 0.0E+0 ) >*/
90 /* .. */
91 /* .. Local Scalars .. */
92 /*< INTEGER IX >*/
93 /*< REAL ABSXI >*/
94 /* .. */
95 /* .. Intrinsic Functions .. */
96 /*< INTRINSIC ABS >*/
97 /* .. */
98 /* .. Executable Statements .. */
99
100 /*< IF( N.GT.0 ) THEN >*/
101 /* Parameter adjustments */
102 --x;
103
104 /* Function Body */
105 if (*n > 0) {
106 /*< DO 10 IX = 1, 1 + ( N-1 )*INCX, INCX >*/
107 i__1 = (*n - 1) * *incx + 1;
108 i__2 = *incx;
109 for (ix = 1; i__2 < 0 ? ix >= i__1 : ix <= i__1; ix += i__2) {
110 /*< IF( X( IX ).NE.ZERO ) THEN >*/
111 if (x[ix] != (float)0.) {
112 /*< ABSXI = ABS( X( IX ) ) >*/
113 absxi = (r__1 = x[ix], dabscxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_original.h:158:9`!(r__1));
114 /*< IF( SCALE.LT.ABSXI ) THEN >*/
115 if (*scale < absxi) {
116 /*< SUMSQ = 1 + SUMSQ*( SCALE / ABSXI )**2 >*/
117 /* Computing 2nd power */
118 r__1 = *scale / absxi;
119 *sumsq = *sumsq * (r__1 * r__1) + 1;
120 /*< SCALE = ABSXI >*/
121 *scale = absxi;
122 /*< ELSE >*/
123 } else {
124 /*< SUMSQ = SUMSQ + ( ABSXI / SCALE )**2 >*/
125 /* Computing 2nd power */
126 r__1 = absxi / *scale;
127 *sumsq += r__1 * r__1;
128 /*< END IF >*/
129 }
130 /*< END IF >*/
131 }
132 /*< 10 CONTINUE >*/
133 /* L10: */
134 }
135 /*< END IF >*/
136 }
137 /*< RETURN >*/
138 return 0;
139
140 /* End of SLASSQ */
141
142 /*< END >*/
143 } /* slassq_ */
144
145 #ifdef __cplusplus
146 }
147 #endif