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
38 changes: 14 additions & 24 deletions lib/node_modules/@stdlib/blas/base/dsymv/test/test.dsymv.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@

var tape = require( 'tape' );
var Float64Array = require( '@stdlib/array/float64' );
var EPS = require( '@stdlib/constants/float64/eps' );
var abs = require( '@stdlib/math/base/special/abs' );
var ones = require( '@stdlib/array/ones' );
var isAlmostSameValue = require( '@stdlib/assert/is-almost-same-value' );
var dsymv = require( './../lib/dsymv.js' );


Expand All @@ -37,7 +36,6 @@ var rxpyp = require( './fixtures/row_major_xpyp.json' );
var rxnyp = require( './fixtures/row_major_xnyp.json' );
var rxpyn = require( './fixtures/row_major_xpyn.json' );
var rxnyn = require( './fixtures/row_major_xnyn.json' );

var cxoyt = require( './fixtures/column_major_xoyt.json' );
var cxpyp = require( './fixtures/column_major_xpyp.json' );
var cxnyp = require( './fixtures/column_major_xnyp.json' );
Expand All @@ -54,22 +52,14 @@ var cxnyn = require( './fixtures/column_major_xnyn.json' );
* @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 @@ -235,7 +225,7 @@ tape( 'the function performs the matrix-vector operation `y = alpha*A*x + beta*y

out = dsymv( rxpyp.order, rxpyp.uplo, rxpyp.N, rxpyp.alpha, a, rxpyp.lda, x, rxpyp.strideX, rxpyp.beta, y, rxpyp.strideY );
t.strictEqual( out, y, 'returns expected value' );
isApprox( t, y, expected, 2.0 );
isApprox( t, y, expected, 0 );

t.end();
});
Expand All @@ -255,7 +245,7 @@ tape( 'the function performs the matrix-vector operation `y = alpha*A*x + beta*y

out = dsymv( cxpyp.order, cxpyp.uplo, cxpyp.N, cxpyp.alpha, a, cxpyp.lda, x, cxpyp.strideX, cxpyp.beta, y, cxpyp.strideY );
t.strictEqual( out, y, 'returns expected value' );
isApprox( t, y, expected, 2.0 );
isApprox( t, y, expected, 0 );

t.end();
});
Expand All @@ -275,7 +265,7 @@ tape( 'the function performs the matrix-vector operation `y = alpha*A*x + beta*y

out = dsymv( rxoyt.order, rxoyt.uplo, rxoyt.N, rxoyt.alpha, a, rxoyt.lda, x, rxoyt.strideX, rxoyt.beta, y, rxoyt.strideY );
t.strictEqual( out, y, 'returns expected value' );
isApprox( t, y, expected, 2.0 );
isApprox( t, y, expected, 0 );

t.end();
});
Expand All @@ -295,7 +285,7 @@ tape( 'the function performs the matrix-vector operation `y = alpha*A*x + beta*y

out = dsymv( cxoyt.order, cxoyt.uplo, cxoyt.N, cxoyt.alpha, a, cxoyt.lda, x, cxoyt.strideX, cxoyt.beta, y, cxoyt.strideY );
t.strictEqual( out, y, 'returns expected value' );
isApprox( t, y, expected, 2.0 );
isApprox( t, y, expected, 0 );

t.end();
});
Expand All @@ -315,7 +305,7 @@ tape( 'the function performs the matrix-vector operation `y = alpha*A*x + beta*y

out = dsymv( rxpyn.order, rxpyn.uplo, rxpyn.N, rxpyn.alpha, a, rxpyn.lda, x, rxpyn.strideX, rxpyn.beta, y, rxpyn.strideY );
t.strictEqual( out, y, 'returns expected value' );
isApprox( t, y, expected, 2.0 );
isApprox( t, y, expected, 0 );

t.end();
});
Expand All @@ -335,7 +325,7 @@ tape( 'the function performs the matrix-vector operation `y = alpha*A*x + beta*y

out = dsymv( cxpyn.order, cxpyn.uplo, cxpyn.N, cxpyn.alpha, a, cxpyn.lda, x, cxpyn.strideX, cxpyn.beta, y, cxpyn.strideY );
t.strictEqual( out, y, 'returns expected value' );
isApprox( t, y, expected, 2.0 );
isApprox( t, y, expected, 0 );

t.end();
});
Expand All @@ -355,7 +345,7 @@ tape( 'the function performs the matrix-vector operation `y = alpha*A*x + beta*y

out = dsymv( rxnyp.order, rxnyp.uplo, rxnyp.N, rxnyp.alpha, a, rxnyp.lda, x, rxnyp.strideX, rxnyp.beta, y, rxnyp.strideY );
t.strictEqual( out, y, 'returns expected value' );
isApprox( t, y, expected, 2.0 );
isApprox( t, y, expected, 0 );

t.end();
});
Expand All @@ -375,7 +365,7 @@ tape( 'the function performs the matrix-vector operation `y = alpha*A*x + beta*y

out = dsymv( cxnyp.order, cxnyp.uplo, cxnyp.N, cxnyp.alpha, a, cxnyp.lda, x, cxnyp.strideX, cxnyp.beta, y, cxnyp.strideY );
t.strictEqual( out, y, 'returns expected value' );
isApprox( t, y, expected, 2.0 );
isApprox( t, y, expected, 0 );

t.end();
});
Expand Down Expand Up @@ -563,7 +553,7 @@ tape( 'the function supports complex access patterns (row-major)', function test

out = dsymv( rxnyn.order, rxnyn.uplo, rxnyn.N, rxnyn.alpha, a, rxnyn.lda, x, rxnyn.strideX, rxnyn.beta, y, rxnyn.strideY );
t.strictEqual( out, y, 'returns expected value' );
isApprox( t, y, expected, 2.0 );
isApprox( t, y, expected, 0 );

t.end();
});
Expand All @@ -583,7 +573,7 @@ tape( 'the function supports complex access patterns (column-major)', function t

out = dsymv( cxnyn.order, cxnyn.uplo, cxnyn.N, cxnyn.alpha, a, cxnyn.lda, x, cxnyn.strideX, cxnyn.beta, y, cxnyn.strideY );
t.strictEqual( out, y, 'returns expected value' );
isApprox( t, y, expected, 2.0 );
isApprox( t, y, expected, 0 );

t.end();
});
37 changes: 14 additions & 23 deletions lib/node_modules/@stdlib/blas/base/dsymv/test/test.ndarray.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@

var tape = require( 'tape' );
var Float64Array = require( '@stdlib/array/float64' );
var EPS = require( '@stdlib/constants/float64/eps' );
var abs = require( '@stdlib/math/base/special/abs' );
var ones = require( '@stdlib/array/ones' );
var isAlmostSameValue = require( '@stdlib/assert/is-almost-same-value' );
var dsymv = require( './../lib/ndarray.js' );


Expand Down Expand Up @@ -54,22 +53,14 @@ var cxnyn = require( './fixtures/column_major_xnyn.json' );
* @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 @@ -235,7 +226,7 @@ tape( 'the function performs the matrix-vector operation `y = alpha*A*x + beta*y

out = dsymv( rxpyp.order, rxpyp.uplo, rxpyp.N, rxpyp.alpha, a, rxpyp.lda, x, rxpyp.strideX, rxpyp.offsetX, rxpyp.beta, y, rxpyp.strideY, rxpyp.offsetY );
t.strictEqual( out, y, 'returns expected value' );
isApprox( t, y, expected, 2.0 );
isApprox( t, y, expected, 0 );

t.end();
});
Expand All @@ -255,7 +246,7 @@ tape( 'the function performs the matrix-vector operation `y = alpha*A*x + beta*y

out = dsymv( cxpyp.order, cxpyp.uplo, cxpyp.N, cxpyp.alpha, a, cxpyp.lda, x, cxpyp.strideX, cxpyp.offsetX, cxpyp.beta, y, cxpyp.strideY, cxpyp.offsetY );
t.strictEqual( out, y, 'returns expected value' );
isApprox( t, y, expected, 2.0 );
isApprox( t, y, expected, 0 );

t.end();
});
Expand All @@ -275,7 +266,7 @@ tape( 'the function performs the matrix-vector operation `y = alpha*A*x + beta*y

out = dsymv( rxoyt.order, rxoyt.uplo, rxoyt.N, rxoyt.alpha, a, rxoyt.lda, x, rxoyt.strideX, rxoyt.offsetX, rxoyt.beta, y, rxoyt.strideY, rxoyt.offsetY );
t.strictEqual( out, y, 'returns expected value' );
isApprox( t, y, expected, 2.0 );
isApprox( t, y, expected, 0 );

t.end();
});
Expand All @@ -295,7 +286,7 @@ tape( 'the function performs the matrix-vector operation `y = alpha*A*x + beta*y

out = dsymv( cxoyt.order, cxoyt.uplo, cxoyt.N, cxoyt.alpha, a, cxoyt.lda, x, cxoyt.strideX, cxoyt.offsetX, cxoyt.beta, y, cxoyt.strideY, cxoyt.offsetY );
t.strictEqual( out, y, 'returns expected value' );
isApprox( t, y, expected, 2.0 );
isApprox( t, y, expected, 0 );

t.end();
});
Expand All @@ -315,7 +306,7 @@ tape( 'the function performs the matrix-vector operation `y = alpha*A*x + beta*y

out = dsymv( rxpyn.order, rxpyn.uplo, rxpyn.N, rxpyn.alpha, a, rxpyn.lda, x, rxpyn.strideX, rxpyn.offsetX, rxpyn.beta, y, rxpyn.strideY, rxpyn.offsetY );
t.strictEqual( out, y, 'returns expected value' );
isApprox( t, y, expected, 2.0 );
isApprox( t, y, expected, 0 );

t.end();
});
Expand All @@ -335,7 +326,7 @@ tape( 'the function performs the matrix-vector operation `y = alpha*A*x + beta*y

out = dsymv( cxpyn.order, cxpyn.uplo, cxpyn.N, cxpyn.alpha, a, cxpyn.lda, x, cxpyn.strideX, cxpyn.offsetX, cxpyn.beta, y, cxpyn.strideY, cxpyn.offsetY );
t.strictEqual( out, y, 'returns expected value' );
isApprox( t, y, expected, 2.0 );
isApprox( t, y, expected, 0 );

t.end();
});
Expand All @@ -355,7 +346,7 @@ tape( 'the function performs the matrix-vector operation `y = alpha*A*x + beta*y

out = dsymv( rxnyp.order, rxnyp.uplo, rxnyp.N, rxnyp.alpha, a, rxnyp.lda, x, rxnyp.strideX, rxnyp.offsetX, rxnyp.beta, y, rxnyp.strideY, rxnyp.offsetY );
t.strictEqual( out, y, 'returns expected value' );
isApprox( t, y, expected, 2.0 );
isApprox( t, y, expected, 0 );

t.end();
});
Expand All @@ -375,7 +366,7 @@ tape( 'the function performs the matrix-vector operation `y = alpha*A*x + beta*y

out = dsymv( cxnyp.order, cxnyp.uplo, cxnyp.N, cxnyp.alpha, a, cxnyp.lda, x, cxnyp.strideX, cxnyp.offsetX, cxnyp.beta, y, cxnyp.strideY, cxnyp.offsetY );
t.strictEqual( out, y, 'returns expected value' );
isApprox( t, y, expected, 2.0 );
isApprox( t, y, expected, 0 );

t.end();
});
Expand Down Expand Up @@ -563,7 +554,7 @@ tape( 'the function supports complex access patterns (row-major)', function test

out = dsymv( rxnyn.order, rxnyn.uplo, rxnyn.N, rxnyn.alpha, a, rxnyn.lda, x, rxnyn.strideX, rxnyn.offsetX, rxnyn.beta, y, rxnyn.strideY, rxnyn.offsetY );
t.strictEqual( out, y, 'returns expected value' );
isApprox( t, y, expected, 2.0 );
isApprox( t, y, expected, 0 );

t.end();
});
Expand All @@ -583,7 +574,7 @@ tape( 'the function supports complex access patterns (column-major)', function t

out = dsymv( cxnyn.order, cxnyn.uplo, cxnyn.N, cxnyn.alpha, a, cxnyn.lda, x, cxnyn.strideX, cxnyn.offsetX, cxnyn.beta, y, cxnyn.strideY, cxnyn.offsetY );
t.strictEqual( out, y, 'returns expected value' );
isApprox( t, y, expected, 2.0 );
isApprox( t, y, expected, 0 );

t.end();
});
Loading