Skip to content

Commit cadf4dc

Browse files
committed
fix: update files
1 parent fbefa23 commit cadf4dc

File tree

4 files changed

+210
-104
lines changed

4 files changed

+210
-104
lines changed

lib/node_modules/@stdlib/blas/base/srotmg/docs/repl.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323

2424
Examples
2525
--------
26-
> var out = {{alias}}( 1.0, 1.0, 1.0, 0.0 )
27-
<Float32Array>[ -2.0, 0.0, 0.0, 1.0, 0.0 ]
26+
> var out = {{alias}}( 3.0, 4.0, 1.5, 2.5 )
27+
<Float32Array>[ 1.0, 0.45, 0.0, 0.0, 0.6 ]
2828

2929

3030
{{alias}}.assign( d1, d2, x1. y1, out, stride, offset )
@@ -61,8 +61,8 @@
6161
Examples
6262
--------
6363
> var out = new {{alias:@stdlib/array/float32}}( 5 );
64-
> var y = {{alias}}.assign( 1.0, 1.0, 1.0, 0.0, out, 1, 0 )
65-
<Float32Array>[ -2.0, 0.0, 0.0, 1.0, 0.0 ]
64+
> var y = {{alias}}.assign( 3.0, 4.0, 1.5, 2.5, out, 1, 0 )
65+
<Float32Array>[ 1.0, 0.45, 0.0, 0.0, 0.6 ]
6666
> var bool = ( y === out )
6767
true
6868

lib/node_modules/@stdlib/blas/base/srotmg/lib/assign.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,16 @@ var RGAM_SQ = 5.9604645e-8;
4141
* @param {number} d2 - scaling factor for the second vector component
4242
* @param {number} x1 - first component of the first vector
4343
* @param {number} y1 - first component of the second vector
44-
* @param {Float64Array} param - output array
44+
* @param {Float32Array} param - output array
4545
* @param {integer} stride - index increment
4646
* @param {NonNegativeInteger} offset - starting index
47-
* @returns {Float64Array} - output array
47+
* @returns {Float32Array} - output array
4848
*
4949
* @example
5050
* var Float32Array = require( '@stdlib/array/float32' );
5151
*
52-
* var out = srotmg( 3.0, 4.0, 1.5, 2.5, new Float64Array( 5 ), 1, 0 );
53-
* // returns <Float64Array>[ 1.0, 0.45, 0.0, 0.0, 0.6 ]
52+
* var out = srotmg( 3.0, 4.0, 1.5, 2.5, new Float32Array( 5 ), 1, 0 );
53+
* // returns <Float32Array>[ 1.0, 0.45, 0.0, 0.0, 0.6 ]
5454
*/
5555
function srotmg( d1, d2, x1, y1, param, stride, offset ) {
5656
var flag;

lib/node_modules/@stdlib/blas/base/srotmg/test/test.assign.js

Lines changed: 127 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
var tape = require( 'tape' );
2424
var Float32Array = require( '@stdlib/array/float32' );
25+
var float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' );
2526
var isnanf = require( '@stdlib/math/base/assert/is-nanf' );
2627
var srotmg = require( './../lib/assign.js' );
2728

@@ -42,175 +43,234 @@ tape( 'the function has an arity of 7', function test( t ) {
4243
tape( 'the function constructs the parameters for a modified Givens plane rotation', function test( t ) {
4344
var expected;
4445
var values;
46+
var delta;
47+
var tol;
4548
var out;
49+
var e;
4650
var i;
51+
var j;
4752

4853
expected = [
49-
[ 0.8944271802902222, 0.4472135901451111, 1.0, 1.0, 3.0 ],
50-
[ 0.3162277638912201, 0.9486832618713379, 2.0, -4.0, -5.0 ],
51-
[ 0.7071067690849304, 0.7071067690849304, 2.0, 2.0, 6.0 ],
52-
[ 0.6, 0.8, 2.0, -2.0, -4.0 ],
53-
[ 0.6, 0.8, 2.0, 1.5, 2.5 ],
54-
[ 0.906183123588562, 0.4228854477405548, 1.0, -1.50, -2.50 ],
55-
[ 0.4472135901451111, 0.8944271802902222, 2.0, 3.50, -7.50 ],
56-
[ 0.800000011920929, 0.6000000238418579, 1.0, 4.50, -9.50 ]
54+
[ 1.0, 0.375, 0.0, 0.0, 0.5 ],
55+
[ -1.0, 0.0, 0.0, 0.0, 0.0 ],
56+
[ 0.0, 0.0, -0.5, 0.125, 0.0 ],
57+
[ 0.0, 0.0, -0.25, 0.1, 0.0 ],
58+
[ 1.0, 0.625, 0.0, 0.0, 0.5 ],
59+
[ -1.0, 0.0, 0.0, 0.0, 0.0 ],
60+
[ 1.0, -0.625, 0.0, 0.0, -0.5 ],
61+
[ 1.0, -0.625, 0.0, 0.0, -0.5 ],
62+
[ -2.0, 0.0, 0.0, 0.0, 0.0 ],
63+
[ 1.0, 0.0, 0.0, 0.0, 0.0 ],
64+
[ -2.0, 0.0, 0.0, 0.0, 0.0 ]
5765
];
5866
values = [
59-
[ 4.0, 2.0, 1.0, 3.0 ],
60-
[ 1.0, 3.0, -4.0, -5.0 ],
61-
[ 5.0, 5.0, 2.0, 6.0 ],
62-
[ 6.0, 8.0, -2.0, -4.0 ],
63-
[ -3.0, -4.0, 1.5, 2.5 ],
64-
[ -7.5, -3.5, -1.5, -2.5 ],
65-
[ 10.0, 20.0, 3.5, -7.5 ],
66-
[ -8.0, -6.0, 4.5, -9.5 ]
67+
[ 3.0, 4.0, 1.0, 2.0 ],
68+
[ -3.0, 2.0, 2.0, 3.0 ],
69+
[ 4.0, 1.0, 2.0, 1.0 ],
70+
[ 5.0, 2.0, 4.0, 1.0 ],
71+
[ 5.0, 4.0, 1.0, 2.0 ],
72+
[ -5.0, 4.0, 1.0, 2.0 ],
73+
[ 5.0, 4.0, -1.0, 2.0 ],
74+
[ 5.0, 4.0, 1.0, -2.0 ],
75+
[ 5.0, 0.0, 1.0, 2.0 ],
76+
[ 5.0, 3.0, 0.0, 2.0 ],
77+
[ 5.0, 3.0, 1.0, 0.0 ]
6778
];
6879

6980
for ( i = 0; i < values.length; i++ ) {
70-
expected[i] = new Float32Array( expected[i] );
81+
e = new Float32Array( expected[i] );
7182
out = new Float32Array( 5 );
72-
srotmg( values[i][0], values[i][1], values[i][2], values[i][3], out, 1, 0 ); // eslint-disable-line max-len
73-
t.deepEqual( out, expected[i], 'returns expected value' );
83+
srotmg( float64ToFloat32( values[i][0] ), float64ToFloat32( values[i][1] ), float64ToFloat32( values[i][2] ), float64ToFloat32( values[i][3] ), out, 1, 0 );
84+
for ( j = 0; j < out.length; j++ ) {
85+
if ( out[j] === e[j] ) {
86+
t.strictEqual( out[j], e[j], 'returns expected value' );
87+
} else {
88+
delta = abs( out[j] - e[j] );
89+
tol = 1.5 * EPS * abs( e[j] );
90+
t.ok( delta <= tol, 'within tolerance. out: '+out[j]+'. expected: '+e[j]+'. delta: '+delta+'. tol: '+tol+'.' );
91+
}
92+
}
7493
}
75-
7694
t.end();
7795
});
7896

7997
tape( 'the function returns an array of NaNs if provided a rotation elimination parameter equal to NaN', function test(t) {
8098
var actual;
8199
var i;
82100

83-
actual = srotmg( NaN, 1.0, 2.0, 3.0, new Float32Array( 4 ), 1, 0 );
101+
actual = srotmg( NaN, 1.0, 2.0, 3.0, new Float32Array( 5 ), 1, 0 );
84102
for ( i = 0; i < actual.length; i++ ) {
85103
t.strictEqual( isnanf( actual[i] ), true, 'returns expected value' );
86104
}
87105

88-
actual = srotmg( 1.0, NaN, 2.0, 3.0, new Float32Array( 4 ), 1, 0 );
106+
actual = srotmg( 1.0, NaN, 3.0, 4.0, new Float32Array( 5 ), 1, 0 );
89107
for ( i = 0; i < actual.length; i++ ) {
90108
t.strictEqual( isnanf( actual[i] ), true, 'returns expected value' );
91109
}
92110

93-
actual = srotmg( 1.0, 2.0, NaN, 3.0, new Float32Array( 4 ), 1, 0 );
111+
actual = srotmg( 1.0, 2.0, NaN, 3.0, new Float32Array( 5 ), 1, 0 );
94112
for ( i = 0; i < actual.length; i++ ) {
95113
t.strictEqual( isnanf( actual[i] ), true, 'returns expected value' );
96114
}
97115

98-
actual = srotmg( 1.0, 2.0, 3.0, NaN, new Float32Array( 4 ), 1, 0 );
116+
actual = srotmg( 1.0, 2.0, 3.0, NaN, new Float32Array( 5 ), 1, 0 );
99117
for ( i = 0; i < actual.length; i++ ) {
100118
t.strictEqual( isnanf( actual[i] ), true, 'returns expected value' );
101119
}
102120

103-
actual = srotmg( NaN, NaN, 3.0, 4.0, new Float32Array( 4 ), 1, 0 );
121+
actual = srotmg( NaN, NaN, 3.0, 4.0, new Float32Array( 5 ), 1, 0 );
104122
for ( i = 0; i < actual.length; i++ ) {
105123
t.strictEqual( isnanf( actual[i] ), true, 'returns expected value' );
106124
}
107125

108-
actual = srotmg( 1.0, NaN, NaN, 3.0, new Float32Array( 4 ), 1, 0 );
126+
actual = srotmg( 1.0, NaN, NaN, 4.0, new Float32Array( 5 ), 1, 0 );
109127
for ( i = 0; i < actual.length; i++ ) {
110128
t.strictEqual( isnanf( actual[i] ), true, 'returns expected value' );
111129
}
112130

113-
actual = srotmg( 1.0, 2.0, NaN, NaN, new Float32Array( 4 ), 1, 0 );
131+
actual = srotmg( 1.0, 2.0, NaN, NaN, new Float32Array( 5 ), 1, 0 );
114132
for ( i = 0; i < actual.length; i++ ) {
115133
t.strictEqual( isnanf( actual[i] ), true, 'returns expected value' );
116134
}
117-
actual = srotmg( NaN, 2.0, NaN, 3.0, new Float32Array( 4 ), 1, 0 );
135+
136+
actual = srotmg( NaN, 2.0, NaN, 4.0, new Float32Array( 5 ), 1, 0 );
118137
for ( i = 0; i < actual.length; i++ ) {
119138
t.strictEqual( isnanf( actual[i] ), true, 'returns expected value' );
120139
}
121-
actual = srotmg( NaN, 1.0, 2.0, NaN, new Float32Array( 4 ), 1, 0 );
140+
141+
actual = srotmg( 1.0, NaN, 3.0, NaN, new Float32Array( 5 ), 1, 0 );
122142
for ( i = 0; i < actual.length; i++ ) {
123143
t.strictEqual( isnanf( actual[i] ), true, 'returns expected value' );
124144
}
125-
actual = srotmg( 1.0, NaN, 3.0, NaN, new Float32Array( 4 ), 1, 0 );
145+
146+
actual = srotmg( NaN, 2.0, 3.0, NaN, new Float32Array( 5 ), 1, 0 );
126147
for ( i = 0; i < actual.length; i++ ) {
127148
t.strictEqual( isnanf( actual[i] ), true, 'returns expected value' );
128149
}
129-
t.end();
130-
});
131150

132-
tape( 'the function returns an array of zeros except s equals to 1 if provided scaling factor for the first vector component equal to 0', function test(t) {
133-
var actual;
134-
var i;
135-
actual = srotmg( 0.0, 1.0, 2.0, 3.0, new Float32Array( 5 ), 1, 0 );
151+
actual = srotmg( NaN, NaN, NaN, 4.0, new Float32Array( 5 ), 1, 0 );
136152
for ( i = 0; i < actual.length; i++ ) {
137-
if ( i === 1 ) {
138-
t.strictEqual( actual[ i ], 1.0, 'returns expected value' );
139-
} else {
140-
t.strictEqual( actual[ i ], 0.0, 'returns expected value' );
141-
}
153+
t.strictEqual( isnanf( actual[i] ), true, 'returns expected value' );
142154
}
143-
t.end();
144-
});
145155

146-
tape( 'the function returns an array with c, s value equal to 0 and param value value equal to 1 if provided scaling factor for the second vector component equal to 0', function test(t) {
147-
var actual;
148-
var i;
156+
actual = srotmg( 1.0, NaN, NaN, NaN, new Float32Array( 5 ), 1, 0 );
157+
for ( i = 0; i < actual.length; i++ ) {
158+
t.strictEqual( isnanf( actual[i] ), true, 'returns expected value' );
159+
}
149160

150-
actual = srotmg( 1.0, 0.0, 2.0, 3.0, new Float32Array( 5 ), 1, 0 );
151-
for ( i = 0; i < ( actual.length - 2 ); i++ ) {
152-
if ( i === 1 ) {
153-
t.strictEqual( actual[ i ], 0.0, 'returns expected value' );
154-
} else {
155-
t.strictEqual( actual[ i ], 1.0, 'returns expected value' );
156-
}
161+
actual = srotmg( NaN, NaN, 3.0, NaN, new Float32Array( 5 ), 1, 0 );
162+
for ( i = 0; i < actual.length; i++ ) {
163+
t.strictEqual( isnanf( actual[i] ), true, 'returns expected value' );
164+
}
165+
166+
actual = srotmg( NaN, 2.0, NaN, NaN, new Float32Array( 5 ), 1, 0 );
167+
for ( i = 0; i < actual.length; i++ ) {
168+
t.strictEqual( isnanf( actual[i] ), true, 'returns expected value' );
169+
}
170+
171+
actual = srotmg( NaN, NaN, NaN, NaN, new Float32Array( 5 ), 1, 0 );
172+
for ( i = 0; i < actual.length; i++ ) {
173+
t.strictEqual( isnanf( actual[i] ), true, 'returns expected value' );
157174
}
158-
console.log(actual);
159175
t.end();
160176
});
161177

162178
tape( 'the function supports providing a positive stride', function test(t) {
163179
var expected;
164180
var actual;
181+
var delta;
182+
var tol;
165183
var out;
184+
var i;
166185

167-
expected = new Float32Array( [ 0.857492983341217, 0.0, 0.5144957900047302, 0.0, 1.0, 0.0, 1.0, 0.0, 2.0 ] );
186+
expected = new Float32Array( [ 1.0, 0.0, 0.375, 0.0, 0.0, 0.0, 0.0, 0.0, 0.5 ] );
168187
out = new Float32Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );
169188

170-
actual = srotmg( 5.0, 3.0, 1.0, 2.0, out, 2, 0 );
189+
actual = srotmg( 3.0, 4.0, 1.0, 2.0, out, 2, 0 );
171190
t.strictEqual( actual, out, 'returns expected value' );
172-
t.deepEqual( actual, expected, 'returns expected value' );
191+
for ( i = 0; i < out.length; i++ ) {
192+
if ( out[i] === expected[i] ) {
193+
t.strictEqual( out[i], expected[i], 'returns expected value' );
194+
} else {
195+
delta = abs( out[i] - expected[i] );
196+
tol = 1.5 * EPS * abs( expected[i] );
197+
t.ok( delta <= tol, 'within tolerance. out: '+out[i]+'. expected: '+expected[i]+'. delta: '+delta+'. tol: '+tol+'.' );
198+
}
199+
}
173200
t.end();
174201
});
175202

176203
tape( 'the function supports providing a negative stride', function test(t) {
177204
var expected;
178205
var actual;
206+
var delta;
207+
var tol;
179208
var out;
209+
var i;
180210

181-
expected = new Float32Array( [ 1.0, 0.0, 0.5144957900047302, 0.0, 0.857492983341217, 0.0, 0.0, 0.0, 0.0, 0.0 ] );
182-
out = new Float32Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );
211+
expected = new Float32Array( [ 0.5, 0.0, 0.0, 0.0, 0.0, 0.0, 0.375, 0.0, 1.0 ] );
212+
out = new Float32Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );
183213

184-
actual = srotmg( 5.0, 3.0, 1.0, 2.0, out, -2, 4 );
214+
actual = srotmg( 3.0, 4.0, 1.0, 2.0, out, -2, 8 );
185215
t.strictEqual( actual, out, 'returns expected value' );
186-
t.deepEqual( actual, expected, 'returns expected value' );
216+
for ( i = 0; i < out.length; i++ ) {
217+
if ( out[i] === expected[i] ) {
218+
t.strictEqual( out[i], expected[i], 'returns expected value' );
219+
} else {
220+
delta = abs( out[i] - expected[i] );
221+
tol = 1.5 * EPS * abs( expected[i] );
222+
t.ok( delta <= tol, 'within tolerance. out: '+out[i]+'. expected: '+expected[i]+'. delta: '+delta+'. tol: '+tol+'.' );
223+
}
224+
}
187225
t.end();
188226
});
189227

190228
tape( 'the function supports providing an offset', function test(t) {
191229
var expected;
192230
var actual;
231+
var delta;
232+
var tol;
193233
var out;
234+
var i;
194235

195-
expected = new Float32Array( [ 0.0, 0.857492983341217, 0.5144957900047302, 1.0, 1.0, 2.0 ] );
236+
expected = new Float32Array( [ 0.0, 1.0, 0.375, 0.0, 0.0, 0.5 ] );
196237
out = new Float32Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );
197238

198-
actual = srotmg( 5.0, 3.0, 1.0, 2.0, out, 1, 1 );
239+
actual = srotmg( 3.0, 4.0, 1.0, 2.0, out, 1, 1 );
199240
t.strictEqual( actual, out, 'returns expected value' );
200-
t.deepEqual( actual, expected, 'returns expected value' );
241+
for ( i = 0; i < out.length; i++ ) {
242+
if ( out[i] === expected[i] ) {
243+
t.strictEqual( out[i], expected[i], 'returns expected value' );
244+
} else {
245+
delta = abs( out[i] - expected[i] );
246+
tol = 1.5 * EPS * abs( expected[i] );
247+
t.ok( delta <= tol, 'within tolerance. out: '+out[i]+'. expected: '+expected[i]+'. delta: '+delta+'. tol: '+tol+'.' );
248+
}
249+
}
201250
t.end();
202251
});
203252

204253
tape( 'the function supports providing both a stride and offset', function test(t) {
205254
var expected;
206255
var actual;
256+
var delta;
257+
var tol;
207258
var out;
259+
var i;
208260

209-
expected = new Float32Array( [ 0.0, 0.0, 0.857492983341217, 0.0, 0.5144957900047302, 0.0, 1.0, 0.0, 1.0, 0.0, 2.0 ] ); // eslint-disable-line max-len
261+
expected = new Float32Array( [ 0.0, 0.0, 1.0, 0.0, 0.375, 0.0, 0.0, 0.0, 0.0, 0.0, 0.5 ] ); // eslint-disable-line max-len
210262
out = new Float32Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );
211263

212-
actual = srotmg( 5.0, 3.0, 1.0, 2.0, out, 2, 2 );
264+
actual = srotmg( 3.0, 4.0, 1.0, 2.0, out, 2, 2 );
213265
t.strictEqual( actual, out, 'returns expected value' );
214-
t.deepEqual( actual, expected, 'returns expected value' );
266+
for ( i = 0; i < out.length; i++ ) {
267+
if ( out[i] === expected[i] ) {
268+
t.strictEqual( out[i], expected[i], 'returns expected value' );
269+
} else {
270+
delta = abs( out[i] - expected[i] );
271+
tol = 1.5 * EPS * abs( expected[i] );
272+
t.ok( delta <= tol, 'within tolerance. out: '+out[i]+'. expected: '+expected[i]+'. delta: '+delta+'. tol: '+tol+'.' );
273+
}
274+
}
215275
t.end();
216276
});

0 commit comments

Comments
 (0)