@@ -61,6 +61,37 @@ FLOATRET NAME(blasint *N, FLOAT *x, blasint *INCX){
61
61
#else
62
62
return fabsf (x [0 ]);
63
63
#endif
64
+ #endif
65
+
66
+ if (incx == 0 )
67
+ #ifndef COMPLEX
68
+ #ifdef DOUBLE
69
+ return (sqrt ((double )n )* fabs (x [0 ]));
70
+ #else
71
+ return (sqrt ((float )n )* fabsf (x [0 ]));
72
+ #endif
73
+ #else
74
+ #ifdef DOUBLE
75
+ {
76
+ double fr = fabs (x [0 ]);
77
+ double fi = fabs (x [1 ]);
78
+ double fmin = MIN (fr ,fi );
79
+ double fmax = MAX (fr ,fi );
80
+ if (fmax == 0. ) return (fmax );
81
+ if (fmax == fmin ) return (sqrt ((double )n )* sqrt (2. )* fmax );
82
+ return (sqrt ((double )n ) * fmax * sqrt (1. + (fmin /fmax )* (fmin /fmax )));
83
+ }
84
+ #else
85
+ {
86
+ float fr = fabs (x [0 ]);
87
+ float fi = fabs (x [1 ]);
88
+ float fmin = MIN (fr ,fi );
89
+ float fmax = MAX (fr ,fi );
90
+ if (fmax == 0. ) return (fmax );
91
+ if (fmax == fmin ) return (sqrt ((float )n )* sqrt (2. )* fmax );
92
+ return (sqrt ((float )n ) * fmax * sqrt (1. + (fmin /fmax )* (fmin /fmax )));
93
+ }
94
+ #endif
64
95
#endif
65
96
66
97
if (incx < 0 )
@@ -97,13 +128,50 @@ FLOAT CNAME(blasint n, FLOAT *x, blasint incx){
97
128
98
129
if (n <= 0 ) return 0. ;
99
130
100
- #ifndef COMPLEX
101
131
if (n == 1 )
132
+ #ifndef COMPLEX
102
133
#ifdef DOUBLE
103
134
return fabs (x [0 ]);
104
135
#else
105
136
return fabsf (x [0 ]);
106
137
#endif
138
+ #else
139
+ #ifdef DOUBLE
140
+ return fabs (x [0 ]+ fabs (x [1 ]));
141
+ #else
142
+ return fabsf (x [0 ]+ fabsf (x [1 ]));
143
+ #endif
144
+ #endif
145
+
146
+ if (incx == 0 )
147
+ #ifndef COMPLEX
148
+ #ifdef DOUBLE
149
+ return (sqrt ((double )n )* fabs (x [0 ]));
150
+ #else
151
+ return (sqrt ((float )n )* fabsf (x [0 ]));
152
+ #endif
153
+ #else
154
+ #ifdef DOUBLE
155
+ {
156
+ double fr = fabs (x [0 ]);
157
+ double fi = fabs (x [1 ]);
158
+ double fmin = MIN (fr ,fi );
159
+ double fmax = MAX (fr ,fi );
160
+ if (fmax == 0. ) return (fmax );
161
+ if (fmax == fmin ) return (sqrt ((double )n )* sqrt (2. )* fmax );
162
+ return (sqrt ((double )n ) * fmax * sqrt (1. + (fmin /fmax )* (fmin /fmax )));
163
+ }
164
+ #else
165
+ {
166
+ float fr = fabs (x [0 ]);
167
+ float fi = fabs (x [1 ]);
168
+ float fmin = MIN (fr ,fi );
169
+ float fmax = MAX (fr ,fi );
170
+ if (fmax == 0. ) return (fmax );
171
+ if (fmax == fmin ) return (sqrt ((float )n )* sqrt (2. )* fmax );
172
+ return (sqrt ((float )n ) * fmax * sqrt (1. + (fmin /fmax )* (fmin /fmax )));
173
+ }
174
+ #endif
107
175
#endif
108
176
109
177
if (incx < 0 )
0 commit comments