Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
6 changes: 6 additions & 0 deletions lib/node_modules/@stdlib/blas/base/dsyr/lib/ndarray.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ function dsyr( uplo, N, alpha, x, strideX, offsetX, A, strideA1, strideA2, offse
if ( strideX === 0 ) {
throw new RangeError( format( 'invalid argument. Fifth argument must be non-zero. Value: `%d`.', strideX ) );
}
if ( strideA1 === 0 ) {
throw new RangeError( format( 'invalid argument. Eighth argument must be non-zero. Value: `%d`.', strideA1 ) );
}
if ( strideA2 === 0 ) {
throw new RangeError( format( 'invalid argument. Ninth argument must be non-zero. Value: `%d`.', strideA2 ) );
}
if ( N === 0 || alpha === 0.0 ) {
return A;
}
Expand Down
46 changes: 46 additions & 0 deletions lib/node_modules/@stdlib/blas/base/dsyr/test/test.ndarray.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,52 @@ tape( 'the function throws an error if provided an invalid fifth argument', func
}
});

tape( 'the function throws an error if provided an invalid eighth argument', function test( t ) {
var values;
var data;
var i;

data = ru;

values = [
0
];

for ( i = 0; i < values.length; i++ ) {
t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] );
}
t.end();

function badValue( value ) {
return function badValue() {
dsyr( data.uplo, data.N, data.alpha, new Float64Array( data.x ), data.strideX, data.offsetX, new Float64Array( data.A ), value, data.strideA2, data.offsetA );
};
}
});

tape( 'the function throws an error if provided an invalid ninth argument', function test( t ) {
var values;
var data;
var i;

data = ru;

values = [
0
];

for ( i = 0; i < values.length; i++ ) {
t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] );
}
t.end();

function badValue( value ) {
return function badValue() {
dsyr( data.uplo, data.N, data.alpha, new Float64Array( data.x ), data.strideX, data.offsetX, new Float64Array( data.A ), data.strideA1, value, data.offsetA );
};
}
});

tape( 'the function performs the symmetric rank 1 operation `A = α*x*x^T + A` (row-major, upper)', function test( t ) {
var expected;
var data;
Expand Down