Skip to content
Open
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
2 changes: 2 additions & 0 deletions lib/node_modules/@stdlib/blas/base/dcopy/src/dcopy_ndarray.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ void API_SUFFIX(c_dcopy_ndarray)( const CBLAS_INT N, const double *X, const CBLA
Y[ iy+4 ] = X[ ix+4 ];
Y[ iy+5 ] = X[ ix+5 ];
Y[ iy+6 ] = X[ ix+6 ];
ix += M;
iy += M;
}
return;
}
Expand Down
29 changes: 29 additions & 0 deletions lib/node_modules/@stdlib/blas/base/dcopy/test/test.ndarray.js
Original file line number Diff line number Diff line change
Expand Up @@ -296,3 +296,32 @@ tape( 'if both strides are equal to `1`, the function efficiently copies element

t.end();
});

tape( 'if both strides are equal to `1` and the offsets are non-zero, the function copies all elements spanning multiple unrolled blocks', function test( t ) {
var expected;
var lens;
var x;
var y;
var i;
var j;

lens = [ 14, 15, 16, 21, 28 ];
for ( j = 0; j < lens.length; j++ ) {
x = new Float64Array( lens[ j ]+5 );
y = new Float64Array( lens[ j ]+5 );
expected = new Float64Array( lens[ j ]+5 );
for ( i = 0; i < x.length; i++ ) {
x[ i ] = i + 1;
y[ i ] = -1.0;
expected[ i ] = -1.0;
}
for ( i = 0; i < lens[ j ]; i++ ) {
expected[ 3+i ] = x[ 2+i ];
}

dcopy( lens[ j ], x, 1, 2, y, 1, 3 );

t.deepEqual( y, expected, 'returns expected value when N='+lens[ j ] );
}
t.end();
});
Original file line number Diff line number Diff line change
Expand Up @@ -305,3 +305,32 @@ tape( 'if both strides are equal to `1`, the function efficiently copies element

t.end();
});

tape( 'if both strides are equal to `1` and the offsets are non-zero, the function copies all elements spanning multiple unrolled blocks', opts, function test( t ) {
var expected;
var lens;
var x;
var y;
var i;
var j;

lens = [ 14, 15, 16, 21, 28 ];
for ( j = 0; j < lens.length; j++ ) {
x = new Float64Array( lens[ j ]+5 );
y = new Float64Array( lens[ j ]+5 );
expected = new Float64Array( lens[ j ]+5 );
for ( i = 0; i < x.length; i++ ) {
x[ i ] = i + 1;
y[ i ] = -1.0;
expected[ i ] = -1.0;
}
for ( i = 0; i < lens[ j ]; i++ ) {
expected[ 3+i ] = x[ 2+i ];
}

dcopy( lens[ j ], x, 1, 2, y, 1, 3 );

t.deepEqual( y, expected, 'returns expected value when N='+lens[ j ] );
}
t.end();
});
2 changes: 2 additions & 0 deletions lib/node_modules/@stdlib/blas/base/scopy/src/scopy_ndarray.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ void API_SUFFIX(c_scopy_ndarray)( const CBLAS_INT N, const float *X, const CBLAS
Y[ iy+4 ] = X[ ix+4 ];
Y[ iy+5 ] = X[ ix+5 ];
Y[ iy+6 ] = X[ ix+6 ];
ix += M;
iy += M;
}
return;
}
Expand Down
29 changes: 29 additions & 0 deletions lib/node_modules/@stdlib/blas/base/scopy/test/test.ndarray.js
Original file line number Diff line number Diff line change
Expand Up @@ -296,3 +296,32 @@ tape( 'if both strides are equal to `1`, the function efficiently copies element

t.end();
});

tape( 'if both strides are equal to `1` and the offsets are non-zero, the function copies all elements spanning multiple unrolled blocks', function test( t ) {
var expected;
var lens;
var x;
var y;
var i;
var j;

lens = [ 14, 15, 16, 21, 28 ];
for ( j = 0; j < lens.length; j++ ) {
x = new Float32Array( lens[ j ]+5 );
y = new Float32Array( lens[ j ]+5 );
expected = new Float32Array( lens[ j ]+5 );
for ( i = 0; i < x.length; i++ ) {
x[ i ] = i + 1;
y[ i ] = -1.0;
expected[ i ] = -1.0;
}
for ( i = 0; i < lens[ j ]; i++ ) {
expected[ 3+i ] = x[ 2+i ];
}

scopy( lens[ j ], x, 1, 2, y, 1, 3 );

t.deepEqual( y, expected, 'returns expected value when N='+lens[ j ] );
}
t.end();
});
Original file line number Diff line number Diff line change
Expand Up @@ -305,3 +305,32 @@ tape( 'if both strides are equal to `1`, the function efficiently copies element

t.end();
});

tape( 'if both strides are equal to `1` and the offsets are non-zero, the function copies all elements spanning multiple unrolled blocks', opts, function test( t ) {
var expected;
var lens;
var x;
var y;
var i;
var j;

lens = [ 14, 15, 16, 21, 28 ];
for ( j = 0; j < lens.length; j++ ) {
x = new Float32Array( lens[ j ]+5 );
y = new Float32Array( lens[ j ]+5 );
expected = new Float32Array( lens[ j ]+5 );
for ( i = 0; i < x.length; i++ ) {
x[ i ] = i + 1;
y[ i ] = -1.0;
expected[ i ] = -1.0;
}
for ( i = 0; i < lens[ j ]; i++ ) {
expected[ 3+i ] = x[ 2+i ];
}

scopy( lens[ j ], x, 1, 2, y, 1, 3 );

t.deepEqual( y, expected, 'returns expected value when N='+lens[ j ] );
}
t.end();
});
Loading