Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 12 additions & 21 deletions lib/node_modules/@stdlib/blas/base/zaxpy/test/test.ndarray.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ var tape = require( 'tape' );
var Float64Array = require( '@stdlib/array/float64' );
var Complex128Array = require( '@stdlib/array/complex128' );
var Complex128 = require( '@stdlib/complex/float64/ctor' );
var EPS = require( '@stdlib/constants/float64/eps' );
var abs = require( '@stdlib/math/base/special/abs' );
var isAlmostSameValue = require( '@stdlib/assert/is-almost-same-value' );
var zaxpy = require( './../lib/ndarray.js' );


Expand All @@ -38,22 +37,14 @@ var zaxpy = require( './../lib/ndarray.js' );
* @param {Object} t - test object
* @param {Collection} actual - actual values
* @param {Collection} expected - expected values
* @param {number} rtol - relative tolerance
* @param {NonNegativeInteger} ulp - maximum allowed ULP difference
*/
function isApprox( t, actual, expected, rtol ) {
var delta;
var tol;
function isApprox( t, actual, expected, ulp ) {
var i;

t.strictEqual( actual.length, expected.length, 'returns expected value' );
for ( i = 0; i < expected.length; i++ ) {
if ( actual[ i ] === expected[ i ] ) {
t.strictEqual( actual[ i ], expected[ i ], 'returns expected value' );
} else {
delta = abs( actual[ i ] - expected[ i ] );
tol = rtol * EPS * abs( expected[ i ] );
t.ok( delta <= tol, 'within tolerance. actual: '+actual[ i ]+'. expected: '+expected[ i ]+'. delta: '+delta+'. tol: '+tol+'.' );
}
t.strictEqual( isAlmostSameValue( actual[ i ], expected[ i ], ulp ), true, 'returns expected value' );
}
}

Expand Down Expand Up @@ -131,7 +122,7 @@ tape( 'the function scales elements from `x` by `alpha` and adds the result to `
0.8,
-0.7
]);
isApprox( t, viewY, expected, 14.0 );
isApprox( t, viewY, expected, 24 );
t.end();
});

Expand Down Expand Up @@ -195,7 +186,7 @@ tape( 'the function supports an `x` stride', function test( t ) {
0.8,
-0.7
]);
isApprox( t, viewY, expected, 14.0 );
isApprox( t, viewY, expected, 8 );
t.end();
});

Expand Down Expand Up @@ -259,7 +250,7 @@ tape( 'the function supports an `x` offset', function test( t ) {
0.8,
-0.7
]);
isApprox( t, viewY, expected, 14.0 );
isApprox( t, viewY, expected, 11 );
t.end();
});

Expand Down Expand Up @@ -323,7 +314,7 @@ tape( 'the function supports a `y` stride', function test( t ) {
0.32, // 4
-1.16 // 4
]);
isApprox( t, viewY, expected, 14.0 );
isApprox( t, viewY, expected, 6 );
t.end();
});

Expand Down Expand Up @@ -387,7 +378,7 @@ tape( 'the function supports a `y` offset', function test( t ) {
0.8,
-0.7
]);
isApprox( t, viewY, expected, 14.0 );
isApprox( t, viewY, expected, 1 );
t.end();
});

Expand Down Expand Up @@ -513,7 +504,7 @@ tape( 'the function supports a negative `x` stride', function test( t ) {
0.8,
-0.7
]);
isApprox( t, viewY, expected, 14.0 );
isApprox( t, viewY, expected, 24 );
t.end();
});

Expand Down Expand Up @@ -577,7 +568,7 @@ tape( 'the function supports a negative `y` stride', function test( t ) {
0.52, // 1
-1.51 // 1
]);
isApprox( t, viewY, expected, 14.0 );
isApprox( t, viewY, expected, 8 );
t.end();
});

Expand Down Expand Up @@ -641,6 +632,6 @@ tape( 'the function supports complex access patterns', function test( t ) {
0.32, // 1
-1.16 // 1
]);
isApprox( t, viewY, expected, 14.0 );
isApprox( t, viewY, expected, 6 );
t.end();
});
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ var tape = require( 'tape' );
var Float64Array = require( '@stdlib/array/float64' );
var Complex128Array = require( '@stdlib/array/complex128' );
var Complex128 = require( '@stdlib/complex/float64/ctor' );
var EPS = require( '@stdlib/constants/float64/eps' );
var abs = require( '@stdlib/math/base/special/abs' );
var isAlmostSameValue = require( '@stdlib/assert/is-almost-same-value' );
var tryRequire = require( '@stdlib/utils/try-require' );


Expand All @@ -47,22 +46,14 @@ var opts = {
* @param {Object} t - test object
* @param {Collection} actual - actual values
* @param {Collection} expected - expected values
* @param {number} rtol - relative tolerance
* @param {NonNegativeInteger} ulp - maximum allowed ULP difference
*/
function isApprox( t, actual, expected, rtol ) {
var delta;
var tol;
function isApprox( t, actual, expected, ulp ) {
var i;

t.strictEqual( actual.length, expected.length, 'returns expected value' );
for ( i = 0; i < expected.length; i++ ) {
if ( actual[ i ] === expected[ i ] ) {
t.strictEqual( actual[ i ], expected[ i ], 'returns expected value' );
} else {
delta = abs( actual[ i ] - expected[ i ] );
tol = rtol * EPS * abs( expected[ i ] );
t.ok( delta <= tol, 'within tolerance. actual: '+actual[ i ]+'. expected: '+expected[ i ]+'. delta: '+delta+'. tol: '+tol+'.' );
}
t.strictEqual( isAlmostSameValue( actual[ i ], expected[ i ], ulp ), true, 'returns expected value' );
}
}

Expand Down Expand Up @@ -140,7 +131,7 @@ tape( 'the function scales elements from `x` by `alpha` and adds the result to `
0.8,
-0.7
]);
isApprox( t, viewY, expected, 14.0 );
isApprox( t, viewY, expected, 24 );
t.end();
});

Expand Down Expand Up @@ -204,7 +195,7 @@ tape( 'if dcabs1( alpha ) === 0.0; the function returns the second input array u
0.8,
-0.7
]);
isApprox( t, viewY, expected, 14.0 );
isApprox( t, viewY, expected, 0 );
t.end();
});

Expand Down Expand Up @@ -268,7 +259,7 @@ tape( 'the function supports an `x` stride', opts, function test( t ) {
0.8,
-0.7
]);
isApprox( t, viewY, expected, 14.0 );
isApprox( t, viewY, expected, 8 );
t.end();
});

Expand Down Expand Up @@ -332,7 +323,7 @@ tape( 'the function supports an `x` offset', opts, function test( t ) {
0.8,
-0.7
]);
isApprox( t, viewY, expected, 14.0 );
isApprox( t, viewY, expected, 11 );
t.end();
});

Expand Down Expand Up @@ -396,7 +387,7 @@ tape( 'the function supports a `y` stride', opts, function test( t ) {
0.32, // 4
-1.16 // 4
]);
isApprox( t, viewY, expected, 14.0 );
isApprox( t, viewY, expected, 6 );
t.end();
});

Expand Down Expand Up @@ -460,7 +451,7 @@ tape( 'the function supports a `y` offset', opts, function test( t ) {
0.8,
-0.7
]);
isApprox( t, viewY, expected, 14.0 );
isApprox( t, viewY, expected, 1 );
t.end();
});

Expand Down Expand Up @@ -563,7 +554,7 @@ tape( 'the function supports a negative `x` stride', opts, function test( t ) {
0.8,
-0.7
]);
isApprox( t, viewY, expected, 14.0 );
isApprox( t, viewY, expected, 24 );
t.end();
});

Expand Down Expand Up @@ -627,7 +618,7 @@ tape( 'the function supports a negative `y` stride', opts, function test( t ) {
0.52, // 1
-1.51 // 1
]);
isApprox( t, viewY, expected, 14.0 );
isApprox( t, viewY, expected, 8 );
t.end();
});

Expand Down Expand Up @@ -691,6 +682,6 @@ tape( 'the function supports complex access patterns', opts, function test( t )
0.32, // 1
-1.16 // 1
]);
isApprox( t, viewY, expected, 14.0 );
isApprox( t, viewY, expected, 6 );
t.end();
});
31 changes: 11 additions & 20 deletions lib/node_modules/@stdlib/blas/base/zaxpy/test/test.zaxpy.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ var tape = require( 'tape' );
var Float64Array = require( '@stdlib/array/float64' );
var Complex128Array = require( '@stdlib/array/complex128' );
var Complex128 = require( '@stdlib/complex/float64/ctor' );
var EPS = require( '@stdlib/constants/float64/eps' );
var abs = require( '@stdlib/math/base/special/abs' );
var isAlmostSameValue = require( '@stdlib/assert/is-almost-same-value' );
var zaxpy = require( './../lib/zaxpy.js' );


Expand All @@ -38,22 +37,14 @@ var zaxpy = require( './../lib/zaxpy.js' );
* @param {Object} t - test object
* @param {Collection} actual - actual values
* @param {Collection} expected - expected values
* @param {number} rtol - relative tolerance
* @param {NonNegativeInteger} ulp - maximum allowed ULP difference
*/
function isApprox( t, actual, expected, rtol ) {
var delta;
var tol;
function isApprox( t, actual, expected, ulp ) {
var i;

t.strictEqual( actual.length, expected.length, 'returns expected value' );
for ( i = 0; i < expected.length; i++ ) {
if ( actual[ i ] === expected[ i ] ) {
t.strictEqual( actual[ i ], expected[ i ], 'returns expected value' );
} else {
delta = abs( actual[ i ] - expected[ i ] );
tol = rtol * EPS * abs( expected[ i ] );
t.ok( delta <= tol, 'within tolerance. actual: '+actual[ i ]+'. expected: '+expected[ i ]+'. delta: '+delta+'. tol: '+tol+'.' );
}
t.strictEqual( isAlmostSameValue( actual[ i ], expected[ i ], ulp ), true, 'returns expected value' );
}
}

Expand Down Expand Up @@ -131,7 +122,7 @@ tape( 'the function scales elements from `x` by `alpha` and adds the result to `
0.8,
-0.7
]);
isApprox( t, viewY, expected, 14.0 );
isApprox( t, viewY, expected, 24 );
t.end();
});

Expand Down Expand Up @@ -195,7 +186,7 @@ tape( 'the function supports an `x` stride', function test( t ) {
0.8,
-0.7
]);
isApprox( t, viewY, expected, 14.0 );
isApprox( t, viewY, expected, 8 );
t.end();
});

Expand Down Expand Up @@ -259,7 +250,7 @@ tape( 'the function supports a `y` stride', function test( t ) {
0.32, // 4
-1.16 // 4
]);
isApprox( t, viewY, expected, 14.0 );
isApprox( t, viewY, expected, 6 );
t.end();
});

Expand Down Expand Up @@ -385,7 +376,7 @@ tape( 'the function supports negative `x` strides', function test( t ) {
0.8,
-0.7
]);
isApprox( t, viewY, expected, 14.0 );
isApprox( t, viewY, expected, 24 );
t.end();
});

Expand Down Expand Up @@ -449,7 +440,7 @@ tape( 'the function supports negative `y` strides', function test( t ) {
0.52, // 1
-1.51 // 1
]);
isApprox( t, viewY, expected, 14.0 );
isApprox( t, viewY, expected, 8 );
t.end();
});

Expand Down Expand Up @@ -513,7 +504,7 @@ tape( 'the function supports complex access patterns', function test( t ) {
0.32, // 1
-1.16 // 1
]);
isApprox( t, viewY, expected, 14.0 );
isApprox( t, viewY, expected, 6 );
t.end();
});

Expand Down Expand Up @@ -579,6 +570,6 @@ tape( 'the function supports view offsets', function test( t ) {
-0.96 // 4
]);

isApprox( t, viewY, expected, 14.0 );
isApprox( t, viewY, expected, 24 );
t.end();
});
Loading
Loading