@@ -12,15 +12,12 @@ import 'package:dart_lapack/src/intrinsics/radix.dart';
1212import 'package:dart_lapack/src/matrix.dart' ;
1313
1414double dnrm2 (final int n, final Array <double > x_, final int incx) {
15- // -- Reference BLAS level1 routine (version 3.9.1) --
16- // -- Reference BLAS is a software package provided by Univ. of Tennessee, --
17- // -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
1815 final x = x_.having ();
1916 const zero = 0.0 ;
2017 const one = 1.0 ;
2118 final maxN = huge (0.0 );
2219
23- // .. Blue's scaling constants ..
20+ // Blue's scaling constants
2421 final tsml = pow (radix (0.0 ), ((minexponent (0.0 ) - 1 ) * 0.5 ).ceil ());
2522 final tbig =
2623 pow (radix (0.0 ), ((maxexponent (0.0 ) - digits (0.0 ) + 1 ) * 0.5 ).floor ());
@@ -30,7 +27,6 @@ double dnrm2(final int n, final Array<double> x_, final int incx) {
3027 pow (radix (0.0 ), - ((maxexponent (0.0 ) + digits (0.0 ) - 1 ) * 0.5 ).ceil ());
3128
3229 // Quick return if possible
33-
3430 if (n <= 0 ) return zero;
3531
3632 // Compute the sum of squares in 3 accumulators:
@@ -40,7 +36,6 @@ double dnrm2(final int n, final Array<double> x_, final int incx) {
4036 // The thresholds and multipliers are
4137 // tbig -- values bigger than this are scaled down by sbig
4238 // tsml -- values smaller than this are scaled up by ssml
43-
4439 var notbig = true ;
4540 var asml = zero;
4641 var amed = zero;
@@ -61,19 +56,16 @@ double dnrm2(final int n, final Array<double> x_, final int incx) {
6156
6257 // Combine abig and amed or amed and asml if more than one
6358 // accumulator was used.
64-
6559 final double scl, sumsq;
6660 if (abig > zero) {
6761 // Combine abig and amed if abig > 0.
68-
6962 if ((amed > zero) || (amed > maxN) || amed.isNaN) {
7063 abig += (amed * sbig) * sbig;
7164 }
7265 scl = one / sbig;
7366 sumsq = abig;
7467 } else if (asml > zero) {
7568 // Combine amed and asml if asml > 0.
76-
7769 if ((amed > zero) || (amed > maxN) || amed.isNaN) {
7870 amed = sqrt (amed);
7971 asml = sqrt (asml) / ssml;
@@ -86,7 +78,6 @@ double dnrm2(final int n, final Array<double> x_, final int incx) {
8678 }
8779 } else {
8880 // Otherwise all values are mid-range
89-
9081 scl = one;
9182 sumsq = amed;
9283 }
0 commit comments