From cfe4f4f83592363456ba6af961dc4ded5c900498 Mon Sep 17 00:00:00 2001 From: Muhammad Haris <101793258+headlessNode@users.noreply.github.com> Date: Mon, 22 Jul 2024 14:23:03 +0000 Subject: [PATCH 1/3] test: add 8d tests --- .../ndarray/base/nullary/test/test.8d.js | 1597 ++++++++++++++--- 1 file changed, 1384 insertions(+), 213 deletions(-) diff --git a/lib/node_modules/@stdlib/ndarray/base/nullary/test/test.8d.js b/lib/node_modules/@stdlib/ndarray/base/nullary/test/test.8d.js index 0f51650441d4..11aa5357371e 100644 --- a/lib/node_modules/@stdlib/ndarray/base/nullary/test/test.8d.js +++ b/lib/node_modules/@stdlib/ndarray/base/nullary/test/test.8d.js @@ -32,6 +32,9 @@ var ndarray = require( '@stdlib/ndarray/ctor' ); var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); var strides2offset = require( '@stdlib/ndarray/base/strides2offset' ); var numel = require( '@stdlib/ndarray/base/numel' ); +var dfill = require( '@stdlib/blas/ext/base/dfill' ); +var gfill = require( '@stdlib/blas/ext/base/gfill' ); +var blockSize = require( '@stdlib/ndarray/base/nullary-tiling-block-size' ); var nullary = require( './../lib' ); @@ -107,6 +110,25 @@ tape( 'the function applies a nullary callback to each indexed element of an 8-d t.end(); }); +tape( 'the function applies a nullary callback to each indexed element of a 8-dimensional ndarray (row-major, empty)', function test( t ) { + var expected; + var x; + + x = ndarray( 'float64', zeros( 4, 'float64' ), [ 0, 0, 0, 0, 0, 0, 0, 0 ], [ 1, 1, 1, 1, 1, 1, 1, 1 ], 0, 'row-major' ); + + nullary( [ x ], constantFunction( 10.0 ) ); + + expected = new Float64Array([ + 0.0, + 0.0, + 0.0, + 0.0 + ]); + t.strictEqual( isSameFloat64Array( x.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + tape( 'the function applies a nullary callback to each indexed element of an 8-dimensional ndarray (row-major, contiguous)', function test( t ) { var expected; var ord; @@ -141,6 +163,40 @@ tape( 'the function applies a nullary callback to each indexed element of an 8-d t.end(); }); +tape( 'the function applies a nullary callback to each indexed element of an 8-dimensional ndarray (row-major, contiguous, negative strides)', function test( t ) { + var expected; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'row-major'; + sh = [ 1, 1, 1, 1, 2, 2, 1, 2 ]; + st = [ -8, -8, -8, -8, -4, -2, -2, -1 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); + + nullary( [ x ], constantFunction( 10.0 ) ); + + expected = new Float64Array([ + 10.0, + 10.0, + 10.0, + 10.0, + 10.0, + 10.0, + 10.0, + 10.0 + ]); + t.strictEqual( isSameFloat64Array( x.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + tape( 'the function applies a nullary callback to each indexed element of an 8-dimensional ndarray (row-major, non-contiguous, same sign strides)', function test( t ) { var expected; var ord; @@ -205,27 +261,1242 @@ tape( 'the function applies a nullary callback to each indexed element of an 8-d expected = new Float64Array([ 10.0, 10.0, - 0.0, - 0.0, + 0.0, + 0.0, + 10.0, + 10.0, + 0.0, + 0.0, + 10.0, + 10.0, + 0.0, + 0.0, + 10.0, + 10.0, + 0.0, + 0.0 + ]); + t.strictEqual( isSameFloat64Array( x.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a nullary callback to each indexed element of a 8-dimensional ndarray (row-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ bsize*2, 1, 2, 1, 1, 2, 1, 2 ]; + st = [ 16, 16, 8, -8, -8, 4, 4, 2 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); + + nullary( [ x ], constantFunction( 10.0 ) ); + + expected = new Float64Array( x.length*2 ); + dfill( x.length, 10.0, expected, st[ 7 ] ); + + t.strictEqual( isSameFloat64Array( x.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a nullary callback to each indexed element of a 8-dimensional ndarray (row-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, bsize*2, 1, 1, 1, 2, 1, 2 ]; + st = [ -bsize*16, -8, 8, -8, -8, 4, -4, 2 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); + + nullary( [ x ], constantFunction( 10.0 ) ); + + expected = new Float64Array( x.length*2 ); + dfill( x.length, 10.0, expected, st[ 7 ] ); + + t.strictEqual( isSameFloat64Array( x.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a nullary callback to each indexed element of a 8-dimensional ndarray (row-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, bsize*2, 1, 1, 2, 1, 2 ]; + st = [ -bsize*16, -bsize*16, 8, -8, -8, 4, -4, 2 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); + + nullary( [ x ], constantFunction( 10.0 ) ); + + expected = new Float64Array( x.length*2 ); + dfill( x.length, 10.0, expected, st[ 7 ] ); + + t.strictEqual( isSameFloat64Array( x.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a nullary callback to each indexed element of a 8-dimensional ndarray (row-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 1, bsize*2, 1, 2, 1, 2 ]; + st = [ -bsize*16, -bsize*16, bsize*16, -8, -8, 4, -4, 2 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); + + nullary( [ x ], constantFunction( 10.0 ) ); + + expected = new Float64Array( x.length*2 ); + dfill( x.length, 10.0, expected, st[ 7 ] ); + + t.strictEqual( isSameFloat64Array( x.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a nullary callback to each indexed element of a 8-dimensional ndarray (row-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 1, bsize*2, 1, 1, 2 ]; + st = [ -bsize*16, -bsize*16, bsize*8, -bsize*8, -4, 4, -4, 2 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); + + nullary( [ x ], constantFunction( 10.0 ) ); + + expected = new Float64Array( x.length*2 ); + dfill( x.length, 10.0, expected, st[ 7 ] ); + + t.strictEqual( isSameFloat64Array( x.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a nullary callback to each indexed element of a 8-dimensional ndarray (row-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 1, 1, bsize*2, 1, 2 ]; + st = [ -bsize*16, -bsize*16, bsize*8, -bsize*8, -bsize*8, 4, -4, 2 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); + + nullary( [ x ], constantFunction( 10.0 ) ); + + expected = new Float64Array( x.length*2 ); + dfill( x.length, 10.0, expected, st[ 7 ] ); + + t.strictEqual( isSameFloat64Array( x.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a nullary callback to each indexed element of a 8-dimensional ndarray (row-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 1, 1, 1, bsize*2, 2 ]; + st = [ -bsize*16, -bsize*16, bsize*8, -bsize*8, -bsize*8, bsize*8, -4, 2 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); + + nullary( [ x ], constantFunction( 10.0 ) ); + + expected = new Float64Array( x.length*2 ); + dfill( x.length, 10.0, expected, st[ 7 ] ); + + t.strictEqual( isSameFloat64Array( x.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a nullary callback to each indexed element of a 8-dimensional ndarray (row-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 1, 1, 2, 1, bsize*2 ]; + st = [ + -bsize*16, + -bsize*16, + bsize*8, + -bsize*8, + -bsize*8, + bsize*4, + -bsize*4, + 2 + ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); + + nullary( [ x ], constantFunction( 10.0 ) ); + + expected = new Float64Array( x.length*2 ); + dfill( x.length, 10.0, expected, st[ 7 ] ); + + t.strictEqual( isSameFloat64Array( x.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a nullary callback to each indexed element of an 8-dimensional ndarray (row-major, contiguous, accessors)', function test( t ) { + var expected; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'complex128'; + ord = 'row-major'; + sh = [ 1, 1, 1, 1, 2, 2, 1, 2 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); + + nullary( [ x ], constantFunction( new Complex128( 10.0, 10.0 ) ) ); + + expected = new Complex128Array([ + 10.0, + 10.0, + 10.0, + 10.0, + 10.0, + 10.0, + 10.0, + 10.0, + 10.0, + 10.0, + 10.0, + 10.0, + 10.0, + 10.0, + 10.0, + 10.0 + ]); + t.strictEqual( isSameComplex128Array( x.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a nullary callback to each indexed element of an 8-dimensional ndarray (row-major, contiguous, accessors, negative strides)', function test( t ) { + var expected; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'complex128'; + ord = 'row-major'; + sh = [ 1, 1, 1, 1, 2, 2, 1, 2 ]; + st = [ -8, -8, -8, -8, -4, -2, -2, -1 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); + + nullary( [ x ], constantFunction( new Complex128( 10.0, 10.0 ) ) ); + + expected = new Complex128Array([ + 10.0, + 10.0, + 10.0, + 10.0, + 10.0, + 10.0, + 10.0, + 10.0, + 10.0, + 10.0, + 10.0, + 10.0, + 10.0, + 10.0, + 10.0, + 10.0 + ]); + t.strictEqual( isSameComplex128Array( x.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a nullary callback to each indexed element of an 8-dimensional ndarray (row-major, non-contiguous, same sign strides, accessors)', function test( t ) { + var expected; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'complex128'; + ord = 'row-major'; + sh = [ 1, 1, 1, 1, 2, 2, 1, 2 ]; + st = [ 16, 16, 16, 16, 8, 4, 2, 1 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( 16, dt ), sh, st, o, ord ); + + nullary( [ x ], constantFunction( new Complex128( 10.0, 10.0 ) ) ); + + expected = new Complex128Array([ + 10.0, + 10.0, + 10.0, + 10.0, + 0.0, + 0.0, + 0.0, + 0.0, + 10.0, + 10.0, + 10.0, + 10.0, + 0.0, + 0.0, + 0.0, + 0.0, + 10.0, + 10.0, + 10.0, + 10.0, + 0.0, + 0.0, + 0.0, + 0.0, + 10.0, + 10.0, + 10.0, + 10.0, + 0.0, + 0.0, + 0.0, + 0.0 + ]); + t.strictEqual( isSameComplex128Array( x.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a nullary callback to each indexed element of an 8-dimensional ndarray (row-major, non-contiguous, mixed sign strides, accessors)', function test( t ) { + var expected; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'complex128'; + ord = 'row-major'; + sh = [ 1, 1, 1, 1, 2, 2, 1, 2 ]; + st = [ 16, 16, -16, 16, -8, -4, -2, 1 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( 16, dt ), sh, st, o, ord ); + + nullary( [ x ], constantFunction( new Complex128( 10.0, 10.0 ) ) ); + + expected = new Complex128Array([ + 10.0, + 10.0, + 10.0, + 10.0, + 0.0, + 0.0, + 0.0, + 0.0, + 10.0, + 10.0, + 10.0, + 10.0, + 0.0, + 0.0, + 0.0, + 0.0, + 10.0, + 10.0, + 10.0, + 10.0, + 0.0, + 0.0, + 0.0, + 0.0, + 10.0, + 10.0, + 10.0, + 10.0, + 0.0, + 0.0, + 0.0, + 0.0 + ]); + t.strictEqual( isSameComplex128Array( x.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a nullary callback to each indexed element of a 8-dimensional ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'complex128'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ bsize*2, 1, 2, 1, 1, 2, 1, 2 ]; + st = [ 16, 16, 8, -8, -8, 4, 4, 2 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); + + nullary( [ x ], constantFunction( new Complex128( 10.0, 10.0 ) ) ); + + expected = new Complex128Array( x.length*2 ); + gfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 7 ] ); + + t.strictEqual( isSameComplex128Array( x.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a nullary callback to each indexed element of a 8-dimensional ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'complex128'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, bsize*2, 1, 1, 1, 2, 1, 2 ]; + st = [ -bsize*16, -8, 8, -8, -8, 4, -4, 2 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); + + nullary( [ x ], constantFunction( new Complex128( 10.0, 10.0 ) ) ); + + expected = new Complex128Array( x.length*2 ); + gfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 7 ] ); + + t.strictEqual( isSameComplex128Array( x.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a nullary callback to each indexed element of a 8-dimensional ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'complex128'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, bsize*2, 1, 1, 2, 1, 2 ]; + st = [ -bsize*16, -bsize*16, 8, -8, -8, 4, -4, 2 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); + + nullary( [ x ], constantFunction( new Complex128( 10.0, 10.0 ) ) ); + + expected = new Complex128Array( x.length*2 ); + gfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 7 ] ); + + t.strictEqual( isSameComplex128Array( x.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a nullary callback to each indexed element of a 8-dimensional ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'complex128'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 1, bsize*2, 1, 2, 1, 2 ]; + st = [ -bsize*16, -bsize*16, bsize*16, -8, -8, 4, -4, 2 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); + + nullary( [ x ], constantFunction( new Complex128( 10.0, 10.0 ) ) ); + + expected = new Complex128Array( x.length*2 ); + gfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 7 ] ); + + t.strictEqual( isSameComplex128Array( x.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a nullary callback to each indexed element of a 8-dimensional ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'complex128'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 1, bsize*2, 1, 1, 2 ]; + st = [ -bsize*16, -bsize*16, bsize*8, -bsize*8, -4, 4, -4, 2 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); + + nullary( [ x ], constantFunction( new Complex128( 10.0, 10.0 ) ) ); + + expected = new Complex128Array( x.length*2 ); + gfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 7 ] ); + + t.strictEqual( isSameComplex128Array( x.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a nullary callback to each indexed element of a 8-dimensional ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'complex128'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 1, 1, bsize*2, 1, 2 ]; + st = [ -bsize*16, -bsize*16, bsize*8, -bsize*8, -bsize*8, 4, -4, 2 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); + + nullary( [ x ], constantFunction( new Complex128( 10.0, 10.0 ) ) ); + + expected = new Complex128Array( x.length*2 ); + gfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 7 ] ); + + t.strictEqual( isSameComplex128Array( x.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a nullary callback to each indexed element of a 8-dimensional ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'complex128'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 1, 1, 1, bsize*2, 2 ]; + st = [ -bsize*16, -bsize*16, bsize*8, -bsize*8, -bsize*8, bsize*8, -4, 2 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); + + nullary( [ x ], constantFunction( new Complex128( 10.0, 10.0 ) ) ); + + expected = new Complex128Array( x.length*2 ); + gfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 7 ] ); + + t.strictEqual( isSameComplex128Array( x.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a nullary callback to each indexed element of a 8-dimensional ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { + var expected; + var bsize; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'complex128'; + ord = 'row-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 1, 1, 2, 1, bsize*2 ]; + st = [ + -bsize*16, + -bsize*16, + bsize*8, + -bsize*8, + -bsize*8, + bsize*4, + -bsize*4, + 2 + ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); + + nullary( [ x ], constantFunction( new Complex128( 10.0, 10.0 ) ) ); + + expected = new Complex128Array( x.length*2 ); + gfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 7 ] ); + + t.strictEqual( isSameComplex128Array( x.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a nullary callback to each indexed element of an 8-dimensional ndarray (column-major, singleton dimensions)', function test( t ) { + var expected; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'column-major'; + sh = [ 4, 1, 1, 1, 1, 1, 1, 1 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); + + nullary( [ x ], constantFunction( 10.0 ) ); + + expected = new Float64Array([ + 10.0, + 10.0, + 10.0, + 10.0 + ]); + t.strictEqual( isSameFloat64Array( x.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a nullary callback to each indexed element of an 8-dimensional ndarray (column-major, singleton dimensions, accessors)', function test( t ) { + var expected; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'complex128'; + ord = 'column-major'; + sh = [ 4, 1, 1, 1, 1, 1, 1, 1 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); + + nullary( [ x ], constantFunction( new Complex128( 10.0, 10.0 ) ) ); + + expected = new Complex128Array([ + 10.0, + 10.0, + 10.0, + 10.0, + 10.0, + 10.0, + 10.0, + 10.0 + ]); + t.strictEqual( isSameComplex128Array( x.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a nullary callback to each indexed element of a 8-dimensional ndarray (column-major, empty)', function test( t ) { + var expected; + var x; + + x = ndarray( 'float64', zeros( 4, 'float64' ), [ 0, 0, 0, 0, 0, 0, 0, 0 ], [ 1, 1, 1, 1, 1, 1, 1, 1 ], 0, 'column-major' ); + + nullary( [ x ], constantFunction( 10.0 ) ); + + expected = new Float64Array([ + 0.0, + 0.0, + 0.0, + 0.0 + ]); + t.strictEqual( isSameFloat64Array( x.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a nullary callback to each indexed element of an 8-dimensional ndarray (column-major, contiguous)', function test( t ) { + var expected; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'column-major'; + sh = [ 1, 1, 1, 2, 2, 1, 2, 1 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); + + nullary( [ x ], constantFunction( 10.0 ) ); + + expected = new Float64Array([ + 10.0, + 10.0, + 10.0, + 10.0, + 10.0, + 10.0, + 10.0, + 10.0 + ]); + t.strictEqual( isSameFloat64Array( x.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a nullary callback to each indexed element of an 8-dimensional ndarray (column-major, contiguous, negative strides)', function test( t ) { + var expected; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'column-major'; + sh = [ 1, 1, 1, 2, 2, 1, 2, 1 ]; + st = [ -1, -1, -1, -1, -2, -4, -4, -8 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); + + nullary( [ x ], constantFunction( 10.0 ) ); + + expected = new Float64Array([ + 10.0, + 10.0, + 10.0, + 10.0, + 10.0, + 10.0, + 10.0, + 10.0 + ]); + t.strictEqual( isSameFloat64Array( x.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape('the function applies a nullary callback to each indexed element of an 8-dimensional ndarray (column-major, non-contiguous, same sign strides)', function test( t ) { + var expected; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'column-major'; + sh = [ 1, 1, 1, 1, 2, 2, 1, 2 ]; + st = [ 1, 1, 1, 1, 1, 4, 8, 8 ]; + o = strides2offset(sh, st); + + x = ndarray( dt, zeros( 16, dt ), sh, st, o, ord ); + + nullary( [ x ], constantFunction( 10.0 ) ); + + expected = new Float64Array( [ + 10.0, + 10.0, + 0.0, + 0.0, + 10.0, + 10.0, + 0.0, + 0.0, + 10.0, + 10.0, + 0.0, + 0.0, + 10.0, + 10.0, + 0.0, + 0.0 + ]); + t.strictEqual( isSameFloat64Array( x.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape('the function applies a nullary callback to each indexed element of an 8-dimensional ndarray (column-major, non-contiguous, mixed sign strides)', function test( t ) { + var expected; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'column-major'; + sh = [ 1, 1, 1, 1, 2, 2, 1, 2 ]; + st = [ 1, 1, 1, 1, -1, -4, 8, -8 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( 16, dt ), sh, st, o, ord ); + + nullary( [ x ], constantFunction( 10.0 ) ); + + expected = new Float64Array( [ + 10.0, + 10.0, + 0.0, + 0.0, + 10.0, + 10.0, + 0.0, + 0.0, + 10.0, + 10.0, + 0.0, + 0.0, + 10.0, + 10.0, + 0.0, + 0.0 + ]); + t.strictEqual( isSameFloat64Array( x.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a nullary callback to each indexed element of a 8-dimensional ndarray (column-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ bsize*2, 1, 2, 1, 1, 2, 1, 2 ]; + st = [ 2, bsize*4, bsize*4, bsize*8, bsize*8, bsize*8, bsize*16, bsize*16 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); + + nullary( [ x ], constantFunction( 10.0 ) ); + + expected = new Float64Array( x.length*2 ); + dfill( x.length, 10.0, expected, st[ 0 ] ); + + t.strictEqual( isSameFloat64Array( x.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a nullary callback to each indexed element of a 8-dimensional ndarray (column-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, bsize*2, 1, 1, 1, 2, 1, 2 ]; + st = [ 2, -4, bsize*8, bsize*8, bsize*8, bsize*8, bsize*16, bsize*16 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); + + nullary( [ x ], constantFunction( 10.0 ) ); + + expected = new Float64Array( x.length*2 ); + dfill( x.length, 10.0, expected, st[ 0 ] ); + + t.strictEqual( isSameFloat64Array( x.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a nullary callback to each indexed element of a 8-dimensional ndarray (column-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, bsize*2, 1, 1, 2, 1, 2 ]; + st = [ 2, 4, 4, bsize*8, bsize*8, bsize*8, bsize*16, bsize*16 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); + + nullary( [ x ], constantFunction( 10.0 ) ); + + expected = new Float64Array( x.length*2 ); + dfill( x.length, 10.0, expected, st[ 0 ] ); + + t.strictEqual( isSameFloat64Array( x.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a nullary callback to each indexed element of a 8-dimensional ndarray (column-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 1, bsize*2, 1, 2, 1, 2 ]; + st = [ 2, 4, 4, 4, bsize*8, bsize*8, bsize*16, bsize*16 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); + + nullary( [ x ], constantFunction( 10.0 ) ); + + expected = new Float64Array( x.length*2 ); + dfill( x.length, 10.0, expected, st[ 0 ] ); + + t.strictEqual( isSameFloat64Array( x.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a nullary callback to each indexed element of a 8-dimensional ndarray (column-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 1, bsize*2, 1, 1, 2 ]; + st = [ 2, 4, 4, 8, 8, bsize*16, bsize*16, bsize*16 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); + + nullary( [ x ], constantFunction( 10.0 ) ); + + expected = new Float64Array( x.length*2 ); + dfill( x.length, 10.0, expected, st[ 0 ] ); + + t.strictEqual( isSameFloat64Array( x.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a nullary callback to each indexed element of a 8-dimensional ndarray (column-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 1, 1, bsize*2, 1, 2 ]; + st = [ 2, 4, 4, 8, 8, 8, bsize*16, bsize*16 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); + + nullary( [ x ], constantFunction( 10.0 ) ); + + expected = new Float64Array( x.length*2 ); + dfill( x.length, 10.0, expected, st[ 0 ] ); + + t.strictEqual( isSameFloat64Array( x.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a nullary callback to each indexed element of a 8-dimensional ndarray (column-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 1, 1, 1, bsize*2, 2 ]; + st = [ 2, 4, 4, 8, 8, 8, 8, bsize*16 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); + + nullary( [ x ], constantFunction( 10.0 ) ); + + expected = new Float64Array( x.length*2 ); + dfill( x.length, 10.0, expected, st[ 0 ] ); + + t.strictEqual( isSameFloat64Array( x.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a nullary callback to each indexed element of a 8-dimensional ndarray (column-major, non-contiguous, large arrays)', function test( t ) { + var expected; + var bsize; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'float64'; + ord = 'column-major'; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 1, 1, 2, 1, bsize*2 ]; + st = [ 2, 4, 4, 8, 8, 8, 16, 16 ]; + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); + + nullary( [ x ], constantFunction( 10.0 ) ); + + expected = new Float64Array( x.length*2 ); + dfill( x.length, 10.0, expected, st[ 0 ] ); + + t.strictEqual( isSameFloat64Array( x.data, expected ), true, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function applies a nullary callback to each indexed element of an 8-dimensional ndarray (column-major, contiguous, accessors)', function test( t ) { + var expected; + var ord; + var sh; + var st; + var dt; + var o; + var x; + + dt = 'complex128'; + ord = 'column-major'; + sh = [ 1, 1, 1, 2, 2, 1, 2, 1 ]; + st = shape2strides( sh, ord ); + o = strides2offset( sh, st ); + + x = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); + + nullary( [ x ], constantFunction( new Complex128( 10.0, 10.0 ) ) ); + + expected = new Complex128Array([ + 10.0, + 10.0, + 10.0, + 10.0, + 10.0, + 10.0, 10.0, 10.0, - 0.0, - 0.0, 10.0, 10.0, - 0.0, - 0.0, 10.0, 10.0, - 0.0, - 0.0 + 10.0, + 10.0, + 10.0, + 10.0 ]); - t.strictEqual( isSameFloat64Array( x.data, expected ), true, 'returns expected value' ); + t.strictEqual( isSameComplex128Array( x.data, expected ), true, 'returns expected value' ); t.end(); }); -tape( 'the function applies a nullary callback to each indexed element of an 8-dimensional ndarray (row-major, contiguous, accessors)', function test( t ) { +tape( 'the function applies a nullary callback to each indexed element of an 8-dimensional ndarray (column-major, contiguous, accessors, negative strides)', function test( t ) { var expected; var ord; var sh; @@ -235,9 +1506,9 @@ tape( 'the function applies a nullary callback to each indexed element of an 8-d var x; dt = 'complex128'; - ord = 'row-major'; - sh = [ 1, 1, 1, 1, 2, 2, 1, 2 ]; - st = shape2strides( sh, ord ); + ord = 'column-major'; + sh = [ 1, 1, 1, 2, 2, 1, 2, 1 ]; + st = [ -1, -1, -1, -1, -2, -4, -4, -8 ]; o = strides2offset( sh, st ); x = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); @@ -267,7 +1538,7 @@ tape( 'the function applies a nullary callback to each indexed element of an 8-d t.end(); }); -tape( 'the function applies a nullary callback to each indexed element of an 8-dimensional ndarray (row-major, non-contiguous, same sign strides, accessors)', function test( t ) { +tape( 'the function applies a nullary callback to each indexed element of an 8-dimensional ndarray (column-major, non-contiguous, same sign strides, accessors)', function test( t ) { var expected; var ord; var sh; @@ -277,16 +1548,16 @@ tape( 'the function applies a nullary callback to each indexed element of an 8-d var x; dt = 'complex128'; - ord = 'row-major'; + ord = 'column-major'; sh = [ 1, 1, 1, 1, 2, 2, 1, 2 ]; - st = [ 16, 16, 16, 16, 8, 4, 2, 1 ]; + st = [ 1, 1, 1, 1, 1, 4, 8, 8 ]; o = strides2offset( sh, st ); x = ndarray( dt, zeros( 16, dt ), sh, st, o, ord ); nullary( [ x ], constantFunction( new Complex128( 10.0, 10.0 ) ) ); - expected = new Complex128Array([ + expected = new Complex128Array( [ 10.0, 10.0, 10.0, @@ -325,7 +1596,7 @@ tape( 'the function applies a nullary callback to each indexed element of an 8-d t.end(); }); -tape( 'the function applies a nullary callback to each indexed element of an 8-dimensional ndarray (row-major, non-contiguous, mixed sign strides, accessors)', function test( t ) { +tape( 'the function applies a nullary callback to each indexed element of an 8-dimensional ndarray (column-major, non-contiguous, mixed sign strides, accessors)', function test( t ) { var expected; var ord; var sh; @@ -335,9 +1606,9 @@ tape( 'the function applies a nullary callback to each indexed element of an 8-d var x; dt = 'complex128'; - ord = 'row-major'; + ord = 'column-major'; sh = [ 1, 1, 1, 1, 2, 2, 1, 2 ]; - st = [ 16, 16, -16, 16, -8, -4, -2, 1 ]; + st = [ -1, 1, -1, 1, 1, -4, -8, 8 ]; o = strides2offset( sh, st ); x = ndarray( dt, zeros( 16, dt ), sh, st, o, ord ); @@ -383,8 +1654,9 @@ tape( 'the function applies a nullary callback to each indexed element of an 8-d t.end(); }); -tape( 'the function applies a nullary callback to each indexed element of an 8-dimensional ndarray (column-major, singleton dimensions)', function test( t ) { +tape( 'the function applies a nullary callback to each indexed element of a 8-dimensional ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { var expected; + var bsize; var ord; var sh; var st; @@ -392,29 +1664,29 @@ tape( 'the function applies a nullary callback to each indexed element of an 8-d var o; var x; - dt = 'float64'; + dt = 'complex128'; ord = 'column-major'; - sh = [ 4, 1, 1, 1, 1, 1, 1, 1 ]; - st = shape2strides( sh, ord ); + + bsize = blockSize( dt ); + sh = [ bsize*2, 1, 2, 1, 1, 2, 1, 2 ]; + st = [ 2, bsize*4, bsize*4, bsize*8, bsize*8, bsize*8, bsize*16, bsize*16 ]; o = strides2offset( sh, st ); - x = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); + x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); - nullary( [ x ], constantFunction( 10.0 ) ); + nullary( [ x ], constantFunction( new Complex128( 10.0, 10.0 ) ) ); - expected = new Float64Array([ - 10.0, - 10.0, - 10.0, - 10.0 - ]); - t.strictEqual( isSameFloat64Array( x.data, expected ), true, 'returns expected value' ); + expected = new Complex128Array( x.length*2 ); + gfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 0 ] ); + + t.strictEqual( isSameComplex128Array( x.data, expected ), true, 'returns expected value' ); t.end(); }); -tape( 'the function applies a nullary callback to each indexed element of an 8-dimensional ndarray (column-major, singleton dimensions, accessors)', function test( t ) { +tape( 'the function applies a nullary callback to each indexed element of a 8-dimensional ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { var expected; + var bsize; var ord; var sh; var st; @@ -424,31 +1696,27 @@ tape( 'the function applies a nullary callback to each indexed element of an 8-d dt = 'complex128'; ord = 'column-major'; - sh = [ 4, 1, 1, 1, 1, 1, 1, 1 ]; - st = shape2strides( sh, ord ); + + bsize = blockSize( dt ); + sh = [ 2, bsize*2, 1, 1, 1, 2, 1, 2 ]; + st = [ 2, -4, bsize*8, bsize*8, bsize*8, bsize*8, bsize*16, bsize*16 ]; o = strides2offset( sh, st ); - x = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); + x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); nullary( [ x ], constantFunction( new Complex128( 10.0, 10.0 ) ) ); - expected = new Complex128Array([ - 10.0, - 10.0, - 10.0, - 10.0, - 10.0, - 10.0, - 10.0, - 10.0 - ]); + expected = new Complex128Array( x.length*2 ); + gfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 0 ] ); + t.strictEqual( isSameComplex128Array( x.data, expected ), true, 'returns expected value' ); t.end(); }); -tape( 'the function applies a nullary callback to each indexed element of an 8-dimensional ndarray (column-major, contiguous)', function test( t ) { +tape( 'the function applies a nullary callback to each indexed element of a 8-dimensional ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { var expected; + var bsize; var ord; var sh; var st; @@ -456,33 +1724,29 @@ tape( 'the function applies a nullary callback to each indexed element of an 8-d var o; var x; - dt = 'float64'; + dt = 'complex128'; ord = 'column-major'; - sh = [ 1, 1, 1, 2, 2, 1, 2, 1 ]; - st = shape2strides( sh, ord ); + + bsize = blockSize( dt ); + sh = [ 2, 1, bsize*2, 1, 1, 2, 1, 2 ]; + st = [ 2, 4, 4, bsize*8, bsize*8, bsize*8, bsize*16, bsize*16 ]; o = strides2offset( sh, st ); - x = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); + x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); - nullary( [ x ], constantFunction( 10.0 ) ); + nullary( [ x ], constantFunction( new Complex128( 10.0, 10.0 ) ) ); - expected = new Float64Array([ - 10.0, - 10.0, - 10.0, - 10.0, - 10.0, - 10.0, - 10.0, - 10.0 - ]); - t.strictEqual( isSameFloat64Array( x.data, expected ), true, 'returns expected value' ); + expected = new Complex128Array( x.length*2 ); + gfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 0 ] ); + + t.strictEqual( isSameComplex128Array( x.data, expected ), true, 'returns expected value' ); t.end(); }); -tape('the function applies a nullary callback to each indexed element of an 8-dimensional ndarray (column-major, non-contiguous, same sign strides)', function test( t ) { +tape( 'the function applies a nullary callback to each indexed element of a 8-dimensional ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { var expected; + var bsize; var ord; var sh; var st; @@ -490,41 +1754,29 @@ tape('the function applies a nullary callback to each indexed element of an 8-di var o; var x; - dt = 'float64'; + dt = 'complex128'; ord = 'column-major'; - sh = [ 1, 1, 1, 1, 2, 2, 1, 2 ]; - st = [ 1, 1, 1, 1, 1, 4, 8, 8 ]; - o = strides2offset(sh, st); - x = ndarray( dt, zeros( 16, dt ), sh, st, o, ord ); + bsize = blockSize( dt ); + sh = [ 2, 1, 1, bsize*2, 1, 2, 1, 2 ]; + st = [ 2, 4, 4, 4, bsize*8, bsize*8, bsize*16, bsize*16 ]; + o = strides2offset( sh, st ); - nullary( [ x ], constantFunction( 10.0 ) ); + x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); - expected = new Float64Array( [ - 10.0, - 10.0, - 0.0, - 0.0, - 10.0, - 10.0, - 0.0, - 0.0, - 10.0, - 10.0, - 0.0, - 0.0, - 10.0, - 10.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameFloat64Array( x.data, expected ), true, 'returns expected value' ); + nullary( [ x ], constantFunction( new Complex128( 10.0, 10.0 ) ) ); + + expected = new Complex128Array( x.length*2 ); + gfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 0 ] ); + + t.strictEqual( isSameComplex128Array( x.data, expected ), true, 'returns expected value' ); t.end(); }); -tape('the function applies a nullary callback to each indexed element of an 8-dimensional ndarray (column-major, non-contiguous, mixed sign strides)', function test( t ) { +tape( 'the function applies a nullary callback to each indexed element of a 8-dimensional ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { var expected; + var bsize; var ord; var sh; var st; @@ -532,41 +1784,29 @@ tape('the function applies a nullary callback to each indexed element of an 8-di var o; var x; - dt = 'float64'; + dt = 'complex128'; ord = 'column-major'; - sh = [ 1, 1, 1, 1, 2, 2, 1, 2 ]; - st = [ 1, 1, 1, 1, -1, -4, 8, -8 ]; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 1, bsize*2, 1, 1, 2 ]; + st = [ 2, 4, 4, 8, 8, bsize*16, bsize*16, bsize*16 ]; o = strides2offset( sh, st ); - x = ndarray( dt, zeros( 16, dt ), sh, st, o, ord ); + x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); - nullary( [ x ], constantFunction( 10.0 ) ); + nullary( [ x ], constantFunction( new Complex128( 10.0, 10.0 ) ) ); - expected = new Float64Array( [ - 10.0, - 10.0, - 0.0, - 0.0, - 10.0, - 10.0, - 0.0, - 0.0, - 10.0, - 10.0, - 0.0, - 0.0, - 10.0, - 10.0, - 0.0, - 0.0 - ]); - t.strictEqual( isSameFloat64Array( x.data, expected ), true, 'returns expected value' ); + expected = new Complex128Array( x.length*2 ); + gfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 0 ] ); + + t.strictEqual( isSameComplex128Array( x.data, expected ), true, 'returns expected value' ); t.end(); }); -tape( 'the function applies a nullary callback to each indexed element of an 8-dimensional ndarray (column-major, contiguous, accessors)', function test( t ) { +tape( 'the function applies a nullary callback to each indexed element of a 8-dimensional ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { var expected; + var bsize; var ord; var sh; var st; @@ -576,39 +1816,27 @@ tape( 'the function applies a nullary callback to each indexed element of an 8-d dt = 'complex128'; ord = 'column-major'; - sh = [ 1, 1, 1, 2, 2, 1, 2, 1 ]; - st = shape2strides( sh, ord ); + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 1, 1, bsize*2, 1, 2 ]; + st = [ 2, 4, 4, 8, 8, 8, bsize*16, bsize*16 ]; o = strides2offset( sh, st ); - x = ndarray( dt, zeros( numel( sh ), dt ), sh, st, o, ord ); + x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); nullary( [ x ], constantFunction( new Complex128( 10.0, 10.0 ) ) ); - expected = new Complex128Array([ - 10.0, - 10.0, - 10.0, - 10.0, - 10.0, - 10.0, - 10.0, - 10.0, - 10.0, - 10.0, - 10.0, - 10.0, - 10.0, - 10.0, - 10.0, - 10.0 - ]); + expected = new Complex128Array( x.length*2 ); + gfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 0 ] ); + t.strictEqual( isSameComplex128Array( x.data, expected ), true, 'returns expected value' ); t.end(); }); -tape( 'the function applies a nullary callback to each indexed element of an 8-dimensional ndarray (column-major, non-contiguous, same sign strides, accessors)', function test( t ) { +tape( 'the function applies a nullary callback to each indexed element of a 8-dimensional ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { var expected; + var bsize; var ord; var sh; var st; @@ -618,55 +1846,27 @@ tape( 'the function applies a nullary callback to each indexed element of an 8-d dt = 'complex128'; ord = 'column-major'; - sh = [ 1, 1, 1, 1, 2, 2, 1, 2 ]; - st = [ 1, 1, 1, 1, 1, 4, 8, 8 ]; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 1, 1, 1, bsize*2, 2 ]; + st = [ 2, 4, 4, 8, 8, 8, 8, bsize*16 ]; o = strides2offset( sh, st ); - x = ndarray( dt, zeros( 16, dt ), sh, st, o, ord ); + x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); nullary( [ x ], constantFunction( new Complex128( 10.0, 10.0 ) ) ); - expected = new Complex128Array( [ - 10.0, - 10.0, - 10.0, - 10.0, - 0.0, - 0.0, - 0.0, - 0.0, - 10.0, - 10.0, - 10.0, - 10.0, - 0.0, - 0.0, - 0.0, - 0.0, - 10.0, - 10.0, - 10.0, - 10.0, - 0.0, - 0.0, - 0.0, - 0.0, - 10.0, - 10.0, - 10.0, - 10.0, - 0.0, - 0.0, - 0.0, - 0.0 - ]); + expected = new Complex128Array( x.length*2 ); + gfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 0 ] ); + t.strictEqual( isSameComplex128Array( x.data, expected ), true, 'returns expected value' ); t.end(); }); -tape( 'the function applies a nullary callback to each indexed element of an 8-dimensional ndarray (column-major, non-contiguous, mixed sign strides, accessors)', function test( t ) { +tape( 'the function applies a nullary callback to each indexed element of a 8-dimensional ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { var expected; + var bsize; var ord; var sh; var st; @@ -676,48 +1876,19 @@ tape( 'the function applies a nullary callback to each indexed element of an 8-d dt = 'complex128'; ord = 'column-major'; - sh = [ 1, 1, 1, 1, 2, 2, 1, 2 ]; - st = [ -1, 1, -1, 1, 1, -4, -8, 8 ]; + + bsize = blockSize( dt ); + sh = [ 2, 1, 2, 1, 1, 2, 1, bsize*2 ]; + st = [ 2, 4, 4, 8, 8, 8, 16, 16 ]; o = strides2offset( sh, st ); - x = ndarray( dt, zeros( 16, dt ), sh, st, o, ord ); + x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); nullary( [ x ], constantFunction( new Complex128( 10.0, 10.0 ) ) ); - expected = new Complex128Array([ - 10.0, - 10.0, - 10.0, - 10.0, - 0.0, - 0.0, - 0.0, - 0.0, - 10.0, - 10.0, - 10.0, - 10.0, - 0.0, - 0.0, - 0.0, - 0.0, - 10.0, - 10.0, - 10.0, - 10.0, - 0.0, - 0.0, - 0.0, - 0.0, - 10.0, - 10.0, - 10.0, - 10.0, - 0.0, - 0.0, - 0.0, - 0.0 - ]); + expected = new Complex128Array( x.length*2 ); + gfill( x.length, new Complex128( 10.0, 10.0 ), expected, st[ 0 ] ); + t.strictEqual( isSameComplex128Array( x.data, expected ), true, 'returns expected value' ); t.end(); From a429b9baedb7dc1d356366475caa3cdeae17d338 Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Wed, 24 Jul 2024 00:20:14 -0700 Subject: [PATCH 2/3] test: fix grammar in descriptions --- .../ndarray/base/nullary/test/test.8d.js | 68 +++++++++---------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/lib/node_modules/@stdlib/ndarray/base/nullary/test/test.8d.js b/lib/node_modules/@stdlib/ndarray/base/nullary/test/test.8d.js index 11aa5357371e..da0b9bae7b41 100644 --- a/lib/node_modules/@stdlib/ndarray/base/nullary/test/test.8d.js +++ b/lib/node_modules/@stdlib/ndarray/base/nullary/test/test.8d.js @@ -110,7 +110,7 @@ tape( 'the function applies a nullary callback to each indexed element of an 8-d t.end(); }); -tape( 'the function applies a nullary callback to each indexed element of a 8-dimensional ndarray (row-major, empty)', function test( t ) { +tape( 'the function applies a nullary callback to each indexed element of an 8-dimensional ndarray (row-major, empty)', function test( t ) { var expected; var x; @@ -281,7 +281,7 @@ tape( 'the function applies a nullary callback to each indexed element of an 8-d t.end(); }); -tape( 'the function applies a nullary callback to each indexed element of a 8-dimensional ndarray (row-major, non-contiguous, large arrays)', function test( t ) { +tape( 'the function applies a nullary callback to each indexed element of an 8-dimensional ndarray (row-major, non-contiguous, large arrays)', function test( t ) { var expected; var bsize; var ord; @@ -311,7 +311,7 @@ tape( 'the function applies a nullary callback to each indexed element of a 8-di t.end(); }); -tape( 'the function applies a nullary callback to each indexed element of a 8-dimensional ndarray (row-major, non-contiguous, large arrays)', function test( t ) { +tape( 'the function applies a nullary callback to each indexed element of an 8-dimensional ndarray (row-major, non-contiguous, large arrays)', function test( t ) { var expected; var bsize; var ord; @@ -341,7 +341,7 @@ tape( 'the function applies a nullary callback to each indexed element of a 8-di t.end(); }); -tape( 'the function applies a nullary callback to each indexed element of a 8-dimensional ndarray (row-major, non-contiguous, large arrays)', function test( t ) { +tape( 'the function applies a nullary callback to each indexed element of an 8-dimensional ndarray (row-major, non-contiguous, large arrays)', function test( t ) { var expected; var bsize; var ord; @@ -371,7 +371,7 @@ tape( 'the function applies a nullary callback to each indexed element of a 8-di t.end(); }); -tape( 'the function applies a nullary callback to each indexed element of a 8-dimensional ndarray (row-major, non-contiguous, large arrays)', function test( t ) { +tape( 'the function applies a nullary callback to each indexed element of an 8-dimensional ndarray (row-major, non-contiguous, large arrays)', function test( t ) { var expected; var bsize; var ord; @@ -401,7 +401,7 @@ tape( 'the function applies a nullary callback to each indexed element of a 8-di t.end(); }); -tape( 'the function applies a nullary callback to each indexed element of a 8-dimensional ndarray (row-major, non-contiguous, large arrays)', function test( t ) { +tape( 'the function applies a nullary callback to each indexed element of an 8-dimensional ndarray (row-major, non-contiguous, large arrays)', function test( t ) { var expected; var bsize; var ord; @@ -431,7 +431,7 @@ tape( 'the function applies a nullary callback to each indexed element of a 8-di t.end(); }); -tape( 'the function applies a nullary callback to each indexed element of a 8-dimensional ndarray (row-major, non-contiguous, large arrays)', function test( t ) { +tape( 'the function applies a nullary callback to each indexed element of an 8-dimensional ndarray (row-major, non-contiguous, large arrays)', function test( t ) { var expected; var bsize; var ord; @@ -461,7 +461,7 @@ tape( 'the function applies a nullary callback to each indexed element of a 8-di t.end(); }); -tape( 'the function applies a nullary callback to each indexed element of a 8-dimensional ndarray (row-major, non-contiguous, large arrays)', function test( t ) { +tape( 'the function applies a nullary callback to each indexed element of an 8-dimensional ndarray (row-major, non-contiguous, large arrays)', function test( t ) { var expected; var bsize; var ord; @@ -491,7 +491,7 @@ tape( 'the function applies a nullary callback to each indexed element of a 8-di t.end(); }); -tape( 'the function applies a nullary callback to each indexed element of a 8-dimensional ndarray (row-major, non-contiguous, large arrays)', function test( t ) { +tape( 'the function applies a nullary callback to each indexed element of an 8-dimensional ndarray (row-major, non-contiguous, large arrays)', function test( t ) { var expected; var bsize; var ord; @@ -730,7 +730,7 @@ tape( 'the function applies a nullary callback to each indexed element of an 8-d t.end(); }); -tape( 'the function applies a nullary callback to each indexed element of a 8-dimensional ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { +tape( 'the function applies a nullary callback to each indexed element of an 8-dimensional ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { var expected; var bsize; var ord; @@ -760,7 +760,7 @@ tape( 'the function applies a nullary callback to each indexed element of a 8-di t.end(); }); -tape( 'the function applies a nullary callback to each indexed element of a 8-dimensional ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { +tape( 'the function applies a nullary callback to each indexed element of an 8-dimensional ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { var expected; var bsize; var ord; @@ -790,7 +790,7 @@ tape( 'the function applies a nullary callback to each indexed element of a 8-di t.end(); }); -tape( 'the function applies a nullary callback to each indexed element of a 8-dimensional ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { +tape( 'the function applies a nullary callback to each indexed element of an 8-dimensional ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { var expected; var bsize; var ord; @@ -820,7 +820,7 @@ tape( 'the function applies a nullary callback to each indexed element of a 8-di t.end(); }); -tape( 'the function applies a nullary callback to each indexed element of a 8-dimensional ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { +tape( 'the function applies a nullary callback to each indexed element of an 8-dimensional ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { var expected; var bsize; var ord; @@ -850,7 +850,7 @@ tape( 'the function applies a nullary callback to each indexed element of a 8-di t.end(); }); -tape( 'the function applies a nullary callback to each indexed element of a 8-dimensional ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { +tape( 'the function applies a nullary callback to each indexed element of an 8-dimensional ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { var expected; var bsize; var ord; @@ -880,7 +880,7 @@ tape( 'the function applies a nullary callback to each indexed element of a 8-di t.end(); }); -tape( 'the function applies a nullary callback to each indexed element of a 8-dimensional ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { +tape( 'the function applies a nullary callback to each indexed element of an 8-dimensional ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { var expected; var bsize; var ord; @@ -910,7 +910,7 @@ tape( 'the function applies a nullary callback to each indexed element of a 8-di t.end(); }); -tape( 'the function applies a nullary callback to each indexed element of a 8-dimensional ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { +tape( 'the function applies a nullary callback to each indexed element of an 8-dimensional ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { var expected; var bsize; var ord; @@ -940,7 +940,7 @@ tape( 'the function applies a nullary callback to each indexed element of a 8-di t.end(); }); -tape( 'the function applies a nullary callback to each indexed element of a 8-dimensional ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { +tape( 'the function applies a nullary callback to each indexed element of an 8-dimensional ndarray (row-major, non-contiguous, large arrays, accessors)', function test( t ) { var expected; var bsize; var ord; @@ -1043,7 +1043,7 @@ tape( 'the function applies a nullary callback to each indexed element of an 8-d t.end(); }); -tape( 'the function applies a nullary callback to each indexed element of a 8-dimensional ndarray (column-major, empty)', function test( t ) { +tape( 'the function applies a nullary callback to each indexed element of an 8-dimensional ndarray (column-major, empty)', function test( t ) { var expected; var x; @@ -1214,7 +1214,7 @@ tape('the function applies a nullary callback to each indexed element of an 8-di t.end(); }); -tape( 'the function applies a nullary callback to each indexed element of a 8-dimensional ndarray (column-major, non-contiguous, large arrays)', function test( t ) { +tape( 'the function applies a nullary callback to each indexed element of an 8-dimensional ndarray (column-major, non-contiguous, large arrays)', function test( t ) { var expected; var bsize; var ord; @@ -1244,7 +1244,7 @@ tape( 'the function applies a nullary callback to each indexed element of a 8-di t.end(); }); -tape( 'the function applies a nullary callback to each indexed element of a 8-dimensional ndarray (column-major, non-contiguous, large arrays)', function test( t ) { +tape( 'the function applies a nullary callback to each indexed element of an 8-dimensional ndarray (column-major, non-contiguous, large arrays)', function test( t ) { var expected; var bsize; var ord; @@ -1274,7 +1274,7 @@ tape( 'the function applies a nullary callback to each indexed element of a 8-di t.end(); }); -tape( 'the function applies a nullary callback to each indexed element of a 8-dimensional ndarray (column-major, non-contiguous, large arrays)', function test( t ) { +tape( 'the function applies a nullary callback to each indexed element of an 8-dimensional ndarray (column-major, non-contiguous, large arrays)', function test( t ) { var expected; var bsize; var ord; @@ -1304,7 +1304,7 @@ tape( 'the function applies a nullary callback to each indexed element of a 8-di t.end(); }); -tape( 'the function applies a nullary callback to each indexed element of a 8-dimensional ndarray (column-major, non-contiguous, large arrays)', function test( t ) { +tape( 'the function applies a nullary callback to each indexed element of an 8-dimensional ndarray (column-major, non-contiguous, large arrays)', function test( t ) { var expected; var bsize; var ord; @@ -1334,7 +1334,7 @@ tape( 'the function applies a nullary callback to each indexed element of a 8-di t.end(); }); -tape( 'the function applies a nullary callback to each indexed element of a 8-dimensional ndarray (column-major, non-contiguous, large arrays)', function test( t ) { +tape( 'the function applies a nullary callback to each indexed element of an 8-dimensional ndarray (column-major, non-contiguous, large arrays)', function test( t ) { var expected; var bsize; var ord; @@ -1364,7 +1364,7 @@ tape( 'the function applies a nullary callback to each indexed element of a 8-di t.end(); }); -tape( 'the function applies a nullary callback to each indexed element of a 8-dimensional ndarray (column-major, non-contiguous, large arrays)', function test( t ) { +tape( 'the function applies a nullary callback to each indexed element of an 8-dimensional ndarray (column-major, non-contiguous, large arrays)', function test( t ) { var expected; var bsize; var ord; @@ -1394,7 +1394,7 @@ tape( 'the function applies a nullary callback to each indexed element of a 8-di t.end(); }); -tape( 'the function applies a nullary callback to each indexed element of a 8-dimensional ndarray (column-major, non-contiguous, large arrays)', function test( t ) { +tape( 'the function applies a nullary callback to each indexed element of an 8-dimensional ndarray (column-major, non-contiguous, large arrays)', function test( t ) { var expected; var bsize; var ord; @@ -1424,7 +1424,7 @@ tape( 'the function applies a nullary callback to each indexed element of a 8-di t.end(); }); -tape( 'the function applies a nullary callback to each indexed element of a 8-dimensional ndarray (column-major, non-contiguous, large arrays)', function test( t ) { +tape( 'the function applies a nullary callback to each indexed element of an 8-dimensional ndarray (column-major, non-contiguous, large arrays)', function test( t ) { var expected; var bsize; var ord; @@ -1654,7 +1654,7 @@ tape( 'the function applies a nullary callback to each indexed element of an 8-d t.end(); }); -tape( 'the function applies a nullary callback to each indexed element of a 8-dimensional ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { +tape( 'the function applies a nullary callback to each indexed element of an 8-dimensional ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { var expected; var bsize; var ord; @@ -1684,7 +1684,7 @@ tape( 'the function applies a nullary callback to each indexed element of a 8-di t.end(); }); -tape( 'the function applies a nullary callback to each indexed element of a 8-dimensional ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { +tape( 'the function applies a nullary callback to each indexed element of an 8-dimensional ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { var expected; var bsize; var ord; @@ -1714,7 +1714,7 @@ tape( 'the function applies a nullary callback to each indexed element of a 8-di t.end(); }); -tape( 'the function applies a nullary callback to each indexed element of a 8-dimensional ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { +tape( 'the function applies a nullary callback to each indexed element of an 8-dimensional ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { var expected; var bsize; var ord; @@ -1744,7 +1744,7 @@ tape( 'the function applies a nullary callback to each indexed element of a 8-di t.end(); }); -tape( 'the function applies a nullary callback to each indexed element of a 8-dimensional ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { +tape( 'the function applies a nullary callback to each indexed element of an 8-dimensional ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { var expected; var bsize; var ord; @@ -1774,7 +1774,7 @@ tape( 'the function applies a nullary callback to each indexed element of a 8-di t.end(); }); -tape( 'the function applies a nullary callback to each indexed element of a 8-dimensional ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { +tape( 'the function applies a nullary callback to each indexed element of an 8-dimensional ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { var expected; var bsize; var ord; @@ -1804,7 +1804,7 @@ tape( 'the function applies a nullary callback to each indexed element of a 8-di t.end(); }); -tape( 'the function applies a nullary callback to each indexed element of a 8-dimensional ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { +tape( 'the function applies a nullary callback to each indexed element of an 8-dimensional ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { var expected; var bsize; var ord; @@ -1834,7 +1834,7 @@ tape( 'the function applies a nullary callback to each indexed element of a 8-di t.end(); }); -tape( 'the function applies a nullary callback to each indexed element of a 8-dimensional ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { +tape( 'the function applies a nullary callback to each indexed element of an 8-dimensional ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { var expected; var bsize; var ord; @@ -1864,7 +1864,7 @@ tape( 'the function applies a nullary callback to each indexed element of a 8-di t.end(); }); -tape( 'the function applies a nullary callback to each indexed element of a 8-dimensional ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { +tape( 'the function applies a nullary callback to each indexed element of an 8-dimensional ndarray (column-major, non-contiguous, large arrays, accessors)', function test( t ) { var expected; var bsize; var ord; From 369d01d04c6e28eb3758712a0ab44b8754996e5f Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Wed, 24 Jul 2024 00:45:06 -0700 Subject: [PATCH 3/3] test: refactor strides to ensure full branch coverage --- .../ndarray/base/nullary/test/test.8d.js | 96 +++++++++---------- 1 file changed, 48 insertions(+), 48 deletions(-) diff --git a/lib/node_modules/@stdlib/ndarray/base/nullary/test/test.8d.js b/lib/node_modules/@stdlib/ndarray/base/nullary/test/test.8d.js index da0b9bae7b41..779263cb6e68 100644 --- a/lib/node_modules/@stdlib/ndarray/base/nullary/test/test.8d.js +++ b/lib/node_modules/@stdlib/ndarray/base/nullary/test/test.8d.js @@ -295,8 +295,8 @@ tape( 'the function applies a nullary callback to each indexed element of an 8-d ord = 'row-major'; bsize = blockSize( dt ); - sh = [ bsize*2, 1, 2, 1, 1, 2, 1, 2 ]; - st = [ 16, 16, 8, -8, -8, 4, 4, 2 ]; + sh = [ bsize*2, 2, 2, 1, 1, 2, 1, 2 ]; + st = [ 32, -16, 8, -8, -8, 4, 4, 2 ]; o = strides2offset( sh, st ); x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); @@ -325,8 +325,8 @@ tape( 'the function applies a nullary callback to each indexed element of an 8-d ord = 'row-major'; bsize = blockSize( dt ); - sh = [ 2, bsize*2, 1, 1, 1, 2, 1, 2 ]; - st = [ -bsize*16, -8, 8, -8, -8, 4, -4, 2 ]; + sh = [ 2, bsize*2, 2, 1, 1, 2, 1, 2 ]; + st = [ -bsize*32, -16, 8, -8, -8, 4, -4, 2 ]; o = strides2offset( sh, st ); x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); @@ -355,8 +355,8 @@ tape( 'the function applies a nullary callback to each indexed element of an 8-d ord = 'row-major'; bsize = blockSize( dt ); - sh = [ 2, 1, bsize*2, 1, 1, 2, 1, 2 ]; - st = [ -bsize*16, -bsize*16, 8, -8, -8, 4, -4, 2 ]; + sh = [ 2, 1, bsize*2, 2, 1, 2, 1, 2 ]; + st = [ -bsize*32, -bsize*32, 16, -8, -8, 4, -4, 2 ]; o = strides2offset( sh, st ); x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); @@ -385,8 +385,8 @@ tape( 'the function applies a nullary callback to each indexed element of an 8-d ord = 'row-major'; bsize = blockSize( dt ); - sh = [ 2, 1, 1, bsize*2, 1, 2, 1, 2 ]; - st = [ -bsize*16, -bsize*16, bsize*16, -8, -8, 4, -4, 2 ]; + sh = [ 2, 1, 1, bsize*2, 2, 2, 1, 2 ]; + st = [ -bsize*32, -bsize*32, bsize*32, -16, -8, 4, -4, 2 ]; o = strides2offset( sh, st ); x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); @@ -415,8 +415,8 @@ tape( 'the function applies a nullary callback to each indexed element of an 8-d ord = 'row-major'; bsize = blockSize( dt ); - sh = [ 2, 1, 2, 1, bsize*2, 1, 1, 2 ]; - st = [ -bsize*16, -bsize*16, bsize*8, -bsize*8, -4, 4, -4, 2 ]; + sh = [ 2, 1, 2, 1, bsize*2, 2, 1, 2 ]; + st = [ -bsize*32, -bsize*32, bsize*16, -bsize*16, -8, 4, -4, 2 ]; o = strides2offset( sh, st ); x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); @@ -445,8 +445,8 @@ tape( 'the function applies a nullary callback to each indexed element of an 8-d ord = 'row-major'; bsize = blockSize( dt ); - sh = [ 2, 1, 2, 1, 1, bsize*2, 1, 2 ]; - st = [ -bsize*16, -bsize*16, bsize*8, -bsize*8, -bsize*8, 4, -4, 2 ]; + sh = [ 2, 1, 2, 1, 1, bsize*2, 2, 2 ]; + st = [ -bsize*32, -bsize*32, bsize*16, -bsize*16, -bsize*16, 8, -4, 2 ]; o = strides2offset( sh, st ); x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); @@ -744,8 +744,8 @@ tape( 'the function applies a nullary callback to each indexed element of an 8-d ord = 'row-major'; bsize = blockSize( dt ); - sh = [ bsize*2, 1, 2, 1, 1, 2, 1, 2 ]; - st = [ 16, 16, 8, -8, -8, 4, 4, 2 ]; + sh = [ bsize*2, 2, 2, 1, 1, 2, 1, 2 ]; + st = [ 32, 16, 8, -8, -8, 4, 4, 2 ]; o = strides2offset( sh, st ); x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); @@ -774,8 +774,8 @@ tape( 'the function applies a nullary callback to each indexed element of an 8-d ord = 'row-major'; bsize = blockSize( dt ); - sh = [ 2, bsize*2, 1, 1, 1, 2, 1, 2 ]; - st = [ -bsize*16, -8, 8, -8, -8, 4, -4, 2 ]; + sh = [ 2, bsize*2, 2, 1, 1, 2, 1, 2 ]; + st = [ -bsize*32, -16, 8, -8, -8, 4, -4, 2 ]; o = strides2offset( sh, st ); x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); @@ -804,8 +804,8 @@ tape( 'the function applies a nullary callback to each indexed element of an 8-d ord = 'row-major'; bsize = blockSize( dt ); - sh = [ 2, 1, bsize*2, 1, 1, 2, 1, 2 ]; - st = [ -bsize*16, -bsize*16, 8, -8, -8, 4, -4, 2 ]; + sh = [ 2, 1, bsize*2, 2, 1, 2, 1, 2 ]; + st = [ -bsize*32, -bsize*32, 16, -8, -8, 4, -4, 2 ]; o = strides2offset( sh, st ); x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); @@ -834,8 +834,8 @@ tape( 'the function applies a nullary callback to each indexed element of an 8-d ord = 'row-major'; bsize = blockSize( dt ); - sh = [ 2, 1, 1, bsize*2, 1, 2, 1, 2 ]; - st = [ -bsize*16, -bsize*16, bsize*16, -8, -8, 4, -4, 2 ]; + sh = [ 2, 1, 1, bsize*2, 2, 2, 1, 2 ]; + st = [ -bsize*32, -bsize*32, bsize*32, -16, -8, 4, -4, 2 ]; o = strides2offset( sh, st ); x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); @@ -864,8 +864,8 @@ tape( 'the function applies a nullary callback to each indexed element of an 8-d ord = 'row-major'; bsize = blockSize( dt ); - sh = [ 2, 1, 2, 1, bsize*2, 1, 1, 2 ]; - st = [ -bsize*16, -bsize*16, bsize*8, -bsize*8, -4, 4, -4, 2 ]; + sh = [ 2, 1, 2, 1, bsize*2, 2, 1, 2 ]; + st = [ -bsize*32, -bsize*32, bsize*16, -bsize*16, -8, 4, -4, 2 ]; o = strides2offset( sh, st ); x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); @@ -894,8 +894,8 @@ tape( 'the function applies a nullary callback to each indexed element of an 8-d ord = 'row-major'; bsize = blockSize( dt ); - sh = [ 2, 1, 2, 1, 1, bsize*2, 1, 2 ]; - st = [ -bsize*16, -bsize*16, bsize*8, -bsize*8, -bsize*8, 4, -4, 2 ]; + sh = [ 2, 1, 2, 1, 1, bsize*2, 2, 2 ]; + st = [ -bsize*32, -bsize*32, bsize*16, -bsize*16, -bsize*16, 8, -4, 2 ]; o = strides2offset( sh, st ); x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); @@ -1288,8 +1288,8 @@ tape( 'the function applies a nullary callback to each indexed element of an 8-d ord = 'column-major'; bsize = blockSize( dt ); - sh = [ 2, 1, bsize*2, 1, 1, 2, 1, 2 ]; - st = [ 2, 4, 4, bsize*8, bsize*8, bsize*8, bsize*16, bsize*16 ]; + sh = [ 2, 2, bsize*2, 1, 1, 2, 1, 2 ]; + st = [ 2, 4, 8, bsize*16, bsize*16, bsize*16, bsize*32, bsize*32 ]; o = strides2offset( sh, st ); x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); @@ -1318,8 +1318,8 @@ tape( 'the function applies a nullary callback to each indexed element of an 8-d ord = 'column-major'; bsize = blockSize( dt ); - sh = [ 2, 1, 1, bsize*2, 1, 2, 1, 2 ]; - st = [ 2, 4, 4, 4, bsize*8, bsize*8, bsize*16, bsize*16 ]; + sh = [ 2, 1, 2, bsize*2, 1, 2, 1, 2 ]; + st = [ 2, 4, 4, 8, bsize*16, bsize*16, bsize*32, bsize*32 ]; o = strides2offset( sh, st ); x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); @@ -1348,8 +1348,8 @@ tape( 'the function applies a nullary callback to each indexed element of an 8-d ord = 'column-major'; bsize = blockSize( dt ); - sh = [ 2, 1, 2, 1, bsize*2, 1, 1, 2 ]; - st = [ 2, 4, 4, 8, 8, bsize*16, bsize*16, bsize*16 ]; + sh = [ 2, 1, 2, 2, bsize*2, 1, 1, 2 ]; + st = [ 2, 4, 4, 8, 16, bsize*32, bsize*32, bsize*32 ]; o = strides2offset( sh, st ); x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); @@ -1378,8 +1378,8 @@ tape( 'the function applies a nullary callback to each indexed element of an 8-d ord = 'column-major'; bsize = blockSize( dt ); - sh = [ 2, 1, 2, 1, 1, bsize*2, 1, 2 ]; - st = [ 2, 4, 4, 8, 8, 8, bsize*16, bsize*16 ]; + sh = [ 2, 1, 2, 1, 2, bsize*2, 1, 2 ]; + st = [ 2, 4, 4, 8, 8, 16, bsize*32, bsize*32 ]; o = strides2offset( sh, st ); x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); @@ -1408,8 +1408,8 @@ tape( 'the function applies a nullary callback to each indexed element of an 8-d ord = 'column-major'; bsize = blockSize( dt ); - sh = [ 2, 1, 2, 1, 1, 1, bsize*2, 2 ]; - st = [ 2, 4, 4, 8, 8, 8, 8, bsize*16 ]; + sh = [ 2, 1, 2, 1, 1, 2, bsize*2, 2 ]; + st = [ 2, 4, 4, 8, 8, 8, 16, bsize*32 ]; o = strides2offset( sh, st ); x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); @@ -1438,8 +1438,8 @@ tape( 'the function applies a nullary callback to each indexed element of an 8-d ord = 'column-major'; bsize = blockSize( dt ); - sh = [ 2, 1, 2, 1, 1, 2, 1, bsize*2 ]; - st = [ 2, 4, 4, 8, 8, 8, 16, 16 ]; + sh = [ 2, 1, 2, 1, 1, 2, 2, bsize*2 ]; + st = [ 2, 4, 4, 8, 8, 8, 16, 32 ]; o = strides2offset( sh, st ); x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); @@ -1728,8 +1728,8 @@ tape( 'the function applies a nullary callback to each indexed element of an 8-d ord = 'column-major'; bsize = blockSize( dt ); - sh = [ 2, 1, bsize*2, 1, 1, 2, 1, 2 ]; - st = [ 2, 4, 4, bsize*8, bsize*8, bsize*8, bsize*16, bsize*16 ]; + sh = [ 2, 2, bsize*2, 1, 1, 2, 1, 2 ]; + st = [ 2, 4, 8, bsize*16, bsize*16, bsize*16, bsize*32, bsize*32 ]; o = strides2offset( sh, st ); x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); @@ -1758,8 +1758,8 @@ tape( 'the function applies a nullary callback to each indexed element of an 8-d ord = 'column-major'; bsize = blockSize( dt ); - sh = [ 2, 1, 1, bsize*2, 1, 2, 1, 2 ]; - st = [ 2, 4, 4, 4, bsize*8, bsize*8, bsize*16, bsize*16 ]; + sh = [ 2, 1, 2, bsize*2, 1, 2, 1, 2 ]; + st = [ 2, 4, 4, 8, bsize*16, bsize*16, bsize*32, bsize*32 ]; o = strides2offset( sh, st ); x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); @@ -1788,8 +1788,8 @@ tape( 'the function applies a nullary callback to each indexed element of an 8-d ord = 'column-major'; bsize = blockSize( dt ); - sh = [ 2, 1, 2, 1, bsize*2, 1, 1, 2 ]; - st = [ 2, 4, 4, 8, 8, bsize*16, bsize*16, bsize*16 ]; + sh = [ 2, 1, 2, 2, bsize*2, 1, 1, 2 ]; + st = [ 2, 4, 4, 8, 16, bsize*32, bsize*32, bsize*32 ]; o = strides2offset( sh, st ); x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); @@ -1818,8 +1818,8 @@ tape( 'the function applies a nullary callback to each indexed element of an 8-d ord = 'column-major'; bsize = blockSize( dt ); - sh = [ 2, 1, 2, 1, 1, bsize*2, 1, 2 ]; - st = [ 2, 4, 4, 8, 8, 8, bsize*16, bsize*16 ]; + sh = [ 2, 1, 2, 1, 2, bsize*2, 1, 2 ]; + st = [ 2, 4, 4, 8, 8, 16, bsize*32, bsize*32 ]; o = strides2offset( sh, st ); x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); @@ -1848,8 +1848,8 @@ tape( 'the function applies a nullary callback to each indexed element of an 8-d ord = 'column-major'; bsize = blockSize( dt ); - sh = [ 2, 1, 2, 1, 1, 1, bsize*2, 2 ]; - st = [ 2, 4, 4, 8, 8, 8, 8, bsize*16 ]; + sh = [ 2, 1, 2, 1, 1, 2, bsize*2, 2 ]; + st = [ 2, 4, 4, 8, 8, 8, 16, bsize*32 ]; o = strides2offset( sh, st ); x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord ); @@ -1878,8 +1878,8 @@ tape( 'the function applies a nullary callback to each indexed element of an 8-d ord = 'column-major'; bsize = blockSize( dt ); - sh = [ 2, 1, 2, 1, 1, 2, 1, bsize*2 ]; - st = [ 2, 4, 4, 8, 8, 8, 16, 16 ]; + sh = [ 2, 1, 2, 1, 1, 2, 2, bsize*2 ]; + st = [ 2, 4, 4, 8, 8, 8, 16, 32 ]; o = strides2offset( sh, st ); x = ndarray( dt, zeros( numel( sh )*2, dt ), sh, st, o, ord );