@@ -61,6 +61,37 @@ FLOATRET NAME(blasint *N, FLOAT *x, blasint *INCX){
6161#else
6262 return fabsf (x [0 ]);
6363#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
6495#endif
6596
6697 if (incx < 0 )
@@ -97,13 +128,44 @@ FLOAT CNAME(blasint n, FLOAT *x, blasint incx){
97128
98129 if (n <= 0 ) return 0. ;
99130
100- #ifndef COMPLEX
131+ #ifndef COMPLEX
101132 if (n == 1 )
102133#ifdef DOUBLE
103134 return fabs (x [0 ]);
104135#else
105136 return fabsf (x [0 ]);
106137#endif
138+ #endif
139+
140+ if (incx == 0 )
141+ #ifndef COMPLEX
142+ #ifdef DOUBLE
143+ return (sqrt ((double )n )* fabs (x [0 ]));
144+ #else
145+ return (sqrt ((float )n )* fabsf (x [0 ]));
146+ #endif
147+ #else
148+ #ifdef DOUBLE
149+ {
150+ double fr = fabs (x [0 ]);
151+ double fi = fabs (x [1 ]);
152+ double fmin = MIN (fr ,fi );
153+ double fmax = MAX (fr ,fi );
154+ if (fmax == 0. ) return (fmax );
155+ if (fmax == fmin ) return (sqrt ((double )n )* sqrt (2. )* fmax );
156+ return (sqrt ((double )n ) * fmax * sqrt (1. + (fmin /fmax )* (fmin /fmax )));
157+ }
158+ #else
159+ {
160+ float fr = fabs (x [0 ]);
161+ float fi = fabs (x [1 ]);
162+ float fmin = MIN (fr ,fi );
163+ float fmax = MAX (fr ,fi );
164+ if (fmax == 0. ) return (fmax );
165+ if (fmax == fmin ) return (sqrt ((float )n )* sqrt (2. )* fmax );
166+ return (sqrt ((float )n ) * fmax * sqrt (1. + (fmin /fmax )* (fmin /fmax )));
167+ }
168+ #endif
107169#endif
108170
109171 if (incx < 0 )
0 commit comments