diff --git a/lib/node_modules/@stdlib/blas/base/ndarray/gdot/README.md b/lib/node_modules/@stdlib/blas/base/ndarray/gdot/README.md new file mode 100644 index 000000000000..b653797afbec --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ndarray/gdot/README.md @@ -0,0 +1,133 @@ + + +# gdot + +> Calculate the dot product of two one-dimensional ndarrays. + +
+ +The [dot product][dot-product] (or scalar product) is defined as + + + +```math +\mathbf{x}\cdot\mathbf{y} = \sum_{i=0}^{N-1} x_i y_i = x_0 y_0 + x_1 y_1 + \ldots + x_{N-1} y_{N-1} +``` + + + + + +
+ + + +
+ +## Usage + +```javascript +var gdot = require( '@stdlib/blas/base/ndarray/gdot' ); +``` + +#### gdot( arrays ) + +Computes the dot product of two one-dimensional ndarrays. + +```javascript +var ndarray = require( '@stdlib/ndarray/base/ctor' ); + +var xbuf = [ 4.0, 2.0, -3.0, 5.0, -1.0 ]; +var x = new ndarray( 'generic', xbuf, [ 5 ], [ 1 ], 0, 'row-major' ); + +var ybuf = [ 2.0, 6.0, -1.0, -4.0, 8.0 ]; +var y = new ndarray( 'generic', ybuf, [ 5 ], [ 1 ], 0, 'row-major' ); + +var z = gdot( [ x, y ] ); +// returns -5.0 +``` + +The function has the following parameters: + +- **arrays**: array-like object containing two one-dimensional input ndarrays. + +
+ + + +
+ +
+ + + +
+ +## Examples + + + +```javascript +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); +var ndarray = require( '@stdlib/ndarray/base/ctor' ); +var ndarray2array = require( '@stdlib/ndarray/to-array' ); +var gdot = require( '@stdlib/blas/base/ndarray/gdot' ); + +var opts = { + 'dtype': 'generic' +}; + +var xbuf = discreteUniform( 10, 0, 500, opts ); +var x = new ndarray( opts.dtype, xbuf, [ xbuf.length ], [ 1 ], 0, 'row-major' ); +console.log( ndarray2array( x ) ); + +var ybuf = discreteUniform( 10, 0, 255, opts ); +var y = new ndarray( opts.dtype, ybuf, [ ybuf.length ], [ 1 ], 0, 'row-major' ); +console.log( ndarray2array( y ) ); + +var out = gdot( [ x, y ] ); +console.log( out ); +``` + +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/blas/base/ndarray/gdot/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/base/ndarray/gdot/benchmark/benchmark.js new file mode 100644 index 000000000000..2e88dc9cad05 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ndarray/gdot/benchmark/benchmark.js @@ -0,0 +1,113 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var ndarray = require( '@stdlib/ndarray/base/ctor' ); +var pkg = require( './../package.json' ).name; +var gdot = require( './../lib' ); + + +// VARIABLES // + +var options = { + 'dtype': 'generic' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - array length +* @returns {Function} benchmark function +*/ +function createBenchmark( len ) { + var xbuf; + var ybuf; + var x; + var y; + + xbuf = uniform( len, -100.0, 100.0, options ); + x = new ndarray( options.dtype, xbuf, [ len ], [ 1 ], 0, 'row-major' ); + + ybuf = uniform( len, -100.0, 100.0, options ); + y = new ndarray( options.dtype, ybuf, [ len ], [ 1 ], 0, 'row-major' ); + + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var z; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + z = gdot( [ x, y ] ); + if ( isnan( z ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( z ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + f = createBenchmark( len ); + bench( pkg+':len='+len, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/ndarray/gdot/docs/img/equation_dot_product.svg b/lib/node_modules/@stdlib/blas/base/ndarray/gdot/docs/img/equation_dot_product.svg new file mode 100644 index 000000000000..3762d6d95ba7 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ndarray/gdot/docs/img/equation_dot_product.svg @@ -0,0 +1,83 @@ + +bold x dot bold y equals sigma-summation Underscript i equals 0 Overscript upper N minus 1 Endscripts x Subscript i Baseline y Subscript i Baseline equals x 0 y 0 plus x 1 y 1 plus ellipsis plus x Subscript upper N minus 1 Baseline y Subscript upper N minus 1 + + + \ No newline at end of file diff --git a/lib/node_modules/@stdlib/blas/base/ndarray/gdot/docs/repl.txt b/lib/node_modules/@stdlib/blas/base/ndarray/gdot/docs/repl.txt new file mode 100644 index 000000000000..b38daf7ffd38 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ndarray/gdot/docs/repl.txt @@ -0,0 +1,34 @@ + +{{alias}}( arrays ) + Computes the dot product of two one-dimensional ndarrays. + + If provided an empty input ndarray, the function returns `0.0`. + + Parameters + ---------- + arrays: ArrayLikeObject + Array-like object containing two one-dimensional input ndarrays. + + Returns + ------- + out: number + The dot product. + + Examples + -------- + // Standard usage: + > var xbuf = [ 4.0, 2.0, -3.0, 5.0, -1.0 ]; + > var ybuf = [ 2.0, 6.0, -1.0, -4.0, 8.0 ]; + > var dt = 'generic'; + > var sh = [ xbuf.length ]; + > var st = [ 1 ]; + > var oo = 0; + > var ord = 'row-major'; + > var x = new {{alias:@stdlib/ndarray/ctor}}( dt, xbuf, sh, st, oo, ord ); + > var y = new {{alias:@stdlib/ndarray/ctor}}( dt, ybuf, sh, st, oo, ord ); + > {{alias}}( [ x, y ] ) + -5.0 + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/blas/base/ndarray/gdot/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/base/ndarray/gdot/docs/types/index.d.ts new file mode 100644 index 000000000000..e02c1c7bb389 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ndarray/gdot/docs/types/index.d.ts @@ -0,0 +1,48 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/// + +import { ndarray } from '@stdlib/types/ndarray'; + +/** +* Computes the dot product of two one-dimensional ndarrays. +* +* @param arrays - array-like object containing two one-dimensional input ndarrays +* @returns dot product +* +* @example +* var ndarray = require( '@stdlib/ndarray/base/ctor' ); +* +* var xbuf = [ 4.0, 2.0, -3.0, 5.0, -1.0 ]; +* var x = new ndarray( 'generic', xbuf, [ 5 ], [ 1 ], 0, 'row-major' ); +* +* var ybuf = [ 2.0, 6.0, -1.0, -4.0, 8.0 ]; +* var y = new ndarray( 'generic', ybuf, [ 5 ], [ 1 ], 0, 'row-major' ); +* +* var z = gdot( [ x, y ] ); +* // returns -5.0 +*/ +declare function gdot( arrays: [ T, T ] ): number; + + +// EXPORTS // + +export = gdot; diff --git a/lib/node_modules/@stdlib/blas/base/ndarray/gdot/docs/types/test.ts b/lib/node_modules/@stdlib/blas/base/ndarray/gdot/docs/types/test.ts new file mode 100644 index 000000000000..9ffe640aac84 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ndarray/gdot/docs/types/test.ts @@ -0,0 +1,64 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable space-in-parens */ + +import zeros = require( '@stdlib/ndarray/zeros' ); +import gdot = require( './index' ); + + +// TESTS // + +// The function returns a number... +{ + const x = zeros( [ 10 ], { + 'dtype': 'generic' + }); + const y = zeros( [ 10 ], { + 'dtype': 'generic' + }); + + gdot( [ x, y ] ); // $ExpectType number +} + +// The compiler throws an error if the function is provided a first argument which is not an array of ndarrays... +{ + gdot( '10' ); // $ExpectError + gdot( 10 ); // $ExpectError + gdot( true ); // $ExpectError + gdot( false ); // $ExpectError + gdot( null ); // $ExpectError + gdot( undefined ); // $ExpectError + gdot( [] ); // $ExpectError + gdot( {} ); // $ExpectError + gdot( ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + const x = zeros( [ 10 ], { + 'dtype': 'generic' + }); + const y = zeros( [ 10 ], { + 'dtype': 'generic' + }); + + gdot(); // $ExpectError + gdot( [ x, y ], {} ); // $ExpectError +} + diff --git a/lib/node_modules/@stdlib/blas/base/ndarray/gdot/examples/index.js b/lib/node_modules/@stdlib/blas/base/ndarray/gdot/examples/index.js new file mode 100644 index 000000000000..8977010b0376 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ndarray/gdot/examples/index.js @@ -0,0 +1,39 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); +var ndarray = require( '@stdlib/ndarray/base/ctor' ); +var ndarray2array = require( '@stdlib/ndarray/to-array' ); +var gdot = require( './../lib' ); + +var opts = { + 'dtype': 'generic' +}; + +var xbuf = discreteUniform( 10, 0, 500, opts ); +var x = new ndarray( opts.dtype, xbuf, [ xbuf.length ], [ 1 ], 0, 'row-major' ); +console.log( ndarray2array( x ) ); + +var ybuf = discreteUniform( 10, 0, 255, opts ); +var y = new ndarray( opts.dtype, ybuf, [ ybuf.length ], [ 1 ], 0, 'row-major' ); +console.log( ndarray2array( y ) ); + +var out = gdot( [ x, y ] ); +console.log( out ); diff --git a/lib/node_modules/@stdlib/blas/base/ndarray/gdot/lib/index.js b/lib/node_modules/@stdlib/blas/base/ndarray/gdot/lib/index.js new file mode 100644 index 000000000000..7f9da1c5ddc5 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ndarray/gdot/lib/index.js @@ -0,0 +1,47 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* BLAS level 1 routine to compute the dot product of two one-dimensional ndarrays. +* +* @module @stdlib/blas/base/ndarray/gdot +* +* @example +* var ndarray = require( '@stdlib/ndarray/base/ctor' ); +* var gdot = require( '@stdlib/blas/base/ndarray/gdot' ); +* +* var xbuf = [ 4.0, 2.0, -3.0, 5.0, -1.0 ]; +* var x = new ndarray( 'generic', xbuf, [ 5 ], [ 1 ], 0, 'row-major' ); +* +* var ybuf = [ 2.0, 6.0, -1.0, -4.0, 8.0 ]; +* var y = new ndarray( 'generic', ybuf, [ 5 ], [ 1 ], 0, 'row-major' ); +* +* var z = gdot( [ x, y ] ); +* // returns -5.0 +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/blas/base/ndarray/gdot/lib/main.js b/lib/node_modules/@stdlib/blas/base/ndarray/gdot/lib/main.js new file mode 100644 index 000000000000..547d3aca00de --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ndarray/gdot/lib/main.js @@ -0,0 +1,59 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var numelDimension = require( '@stdlib/ndarray/base/numel-dimension' ); +var getStride = require( '@stdlib/ndarray/base/stride' ); +var getOffset = require( '@stdlib/ndarray/base/offset' ); +var getData = require( '@stdlib/ndarray/base/data-buffer' ); +var strided = require( '@stdlib/blas/base/gdot' ).ndarray; + + +// MAIN // + +/** +* Computes the dot product of two one-dimensional ndarrays. +* +* @param {ArrayLikeObject} arrays - array-like object containing two one-dimensional input ndarrays +* @returns {number} dot product +* +* @example +* var ndarray = require( '@stdlib/ndarray/base/ctor' ); +* +* var xbuf = [ 4.0, 2.0, -3.0, 5.0, -1.0 ]; +* var x = new ndarray( 'generic', xbuf, [ 5 ], [ 1 ], 0, 'row-major' ); +* +* var ybuf = [ 2.0, 6.0, -1.0, -4.0, 8.0 ]; +* var y = new ndarray( 'generic', ybuf, [ 5 ], [ 1 ], 0, 'row-major' ); +* +* var z = gdot( [ x, y ] ); +* // returns -5.0 +*/ +function gdot( arrays ) { + var x = arrays[ 0 ]; + var y = arrays[ 1 ]; + return strided( numelDimension( x, 0 ), getData( x ), getStride( x, 0 ), getOffset( x ), getData( y ), getStride( y, 0 ), getOffset( y ) ); // eslint-disable-line max-len +} + + +// EXPORTS // + +module.exports = gdot; diff --git a/lib/node_modules/@stdlib/blas/base/ndarray/gdot/package.json b/lib/node_modules/@stdlib/blas/base/ndarray/gdot/package.json new file mode 100644 index 000000000000..60b81d76f8bc --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ndarray/gdot/package.json @@ -0,0 +1,73 @@ +{ + "name": "@stdlib/blas/base/ndarray/gdot", + "version": "0.0.0", + "description": "Compute the dot product of two one-dimensional ndarrays.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "stdmath", + "mathematics", + "math", + "blas", + "level 1", + "linear", + "algebra", + "subroutines", + "ddot", + "sdot", + "dot", + "product", + "dot product", + "scalar", + "scalar product", + "inner", + "inner product", + "vector", + "ndarray" + ] +} diff --git a/lib/node_modules/@stdlib/blas/base/ndarray/gdot/test/test.js b/lib/node_modules/@stdlib/blas/base/ndarray/gdot/test/test.js new file mode 100644 index 000000000000..712c57422112 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ndarray/gdot/test/test.js @@ -0,0 +1,200 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var ndarray = require( '@stdlib/ndarray/base/ctor' ); +var gdot = require( './../lib' ); + + +// FUNCTIONS // + +/** +* Returns a one-dimensional ndarray. +* +* @private +* @param {Collection} buffer - underlying data buffer +* @param {NonNegativeInteger} length - number of indexed elements +* @param {integer} stride - stride length +* @param {NonNegativeInteger} offset - index offset +* @returns {ndarray} one-dimensional ndarray +*/ +function vector( buffer, length, stride, offset ) { + return new ndarray( 'generic', buffer, [ length ], [ stride ], offset, 'row-major' ); +} + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof gdot, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 1', function test( t ) { + t.strictEqual( gdot.length, 1, 'has expected arity' ); + t.end(); +}); + +tape( 'the function calculates the dot product of two one-dimensional ndarrays', function test( t ) { + var xbuf; + var ybuf; + var x; + var y; + var v; + + xbuf = [ 4.0, 2.0, -3.0, 5.0, -1.0, 2.0, -5.0, 6.0 ]; + ybuf = [ 2.0, 6.0, -1.0, -4.0, 8.0, 8.0, 2.0, -3.0 ]; + x = vector( xbuf, 8, 1, 0 ); + y = vector( ybuf, 8, 1, 0 ); + v = gdot( [ x, y ] ); + + t.strictEqual( v, -17.0, 'returns expected value' ); + + xbuf = [ 3.0, -4.0, 1.0 ]; + ybuf = [ 1.0, -2.0, 3.0 ]; + x = vector( xbuf, 3, 1, 0 ); + y = vector( ybuf, 3, 1, 0 ); + v = gdot( [ x, y ] ); + + t.strictEqual( v, 14.0, 'returns expected value' ); + + t.end(); +}); + +tape( 'if provided an empty vector, the function returns `0.0`', function test( t ) { + var xbuf; + var ybuf; + var x; + var y; + var v; + + xbuf = []; + ybuf = []; + x = vector( xbuf, 0, 1, 0 ); + y = vector( ybuf, 0, 1, 0 ); + + v = gdot( [ x, y ] ); + t.strictEqual( v, 0.0, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports one-dimensional ndarrays having non-unit strides', function test( t ) { + var xbuf; + var ybuf; + var x; + var y; + var v; + + xbuf = [ + 2.0, // 0 + -3.0, + -5.0, // 1 + 7.0, + 6.0 // 2 + ]; + x = vector( xbuf, 3, 2, 0 ); + + ybuf = [ + 8.0, // 0 + 2.0, // 1 + -3.0, // 2 + 3.0, + -4.0, + 1.0 + ]; + y = vector( ybuf, 3, 1, 0 ); + + v = gdot( [ x, y ] ); + t.strictEqual( v, -12.0, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports one-dimensional ndarrays having negative strides', function test( t ) { + var xbuf; + var ybuf; + var x; + var y; + var v; + + xbuf = [ + 1.0, // 2 + 2.0, + 3.0, // 1 + 4.0, + 5.0 // 0 + ]; + x = vector( xbuf, 3, -2, 4 ); + + ybuf = [ + 6.0, // 2 + 7.0, // 1 + 8.0, // 0 + 9.0, + 10.0 + ]; + y = vector( ybuf, 3, -1, 2 ); + + v = gdot( [ x, y ] ); + t.strictEqual( v, 67.0, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports one-dimensional ndarrays having non-zero offsets', function test( t ) { + var xbuf; + var ybuf; + var x; + var y; + var v; + + xbuf = [ + 2.0, + 1.0, // 0 + 2.0, + -2.0, // 1 + -2.0, + 2.0, // 2 + 3.0, + 4.0 // 3 + ]; + x = vector( xbuf, 4, 2, 1 ); + + ybuf = [ + 1.0, + 2.0, + 3.0, // 0 + 4.0, // 1 + 5.0, // 2 + 6.0, // 3 + 7.0, + 8.0 + ]; + y = vector( ybuf, 4, 1, 2 ); + + v = gdot( [ x, y ] ); + t.strictEqual( v, 29.0, 'returns expected value' ); + + t.end(); +});