diff --git a/lib/node_modules/@stdlib/ndarray/concat/README.md b/lib/node_modules/@stdlib/ndarray/concat/README.md new file mode 100644 index 000000000000..c3130c259294 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/concat/README.md @@ -0,0 +1,142 @@ + + +# concat + +> Concatenate a list of ndarrays along a specified ndarray dimension. + + + +
+ +
+ + + + + +
+ +## Usage + +```javascript +var concat = require( '@stdlib/ndarray/concat' ); +``` + +#### concat( arrays, dim ) + +Concatenates a list of ndarrays along a specified ndarray dimension. + +```javascript +var ndarray = require( '@stdlib/ndarray/ctor' ); +var Float64Array = require( '@stdlib/array/float64' ); +var ndarray2array = require( '@stdlib/ndarray/to-array' ); + +var xbuf = new Float64Array( [ -1.0, 2.0, -3.0, 4.0 ] ); +var x = new ndarray( 'float64', xbuf, [ 2, 2 ], [ 2, 1 ], 0, 'row-major' ); + +var ybuf = new Float64Array( [ -5.0, 6.0, -7.0, 8.0, -9.0, 10.0 ] ); +var y = new ndarray( 'float64', ybuf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); + +var out = concat( [ x, y ], -1 ); +// returns + +var arr = ndarray2array( out ); +// returns [ [ -1.0, 2.0, -5.0, 6.0, 7.0 ], [ -3.0, 4.0, 8.0, 9.0, 10.0 ] ] +``` + +The function accepts the following arguments: + +- **arrays**: a list of input ndarrays. +- **dim**: dimension along which the arrays are concatenated. Default: `-1`. + +#### concat.assign( arrays, out, dim ) + + + +
+ + + + + +
+ +## Notes + +
+ + + + + +
+ +## Examples + +```javascript +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); +var ndarray = require( '@stdlib/ndarray/ctor' ); +var ndarray2array = require( '@stdlib/ndarray/to-array' ); +var concat = require( '@stdlib/ndarray/concat' ); + +var xbuf = discreteUniform( 6, 0, 10, { + 'dtype': 'generic' +}); +var x = new ndarray( 'generic', xbuf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); +console.log( ndarray2array( x ) ); + +var ybuf = discreteUniform( 8, 0, 10, { + 'dtype': 'generic' +}); +var y = new ndarray( 'generic', ybuf, [ 2, 4 ], [ 4, 1 ], 0, 'row-major' ); +console.log( ndarray2array( y ) ); + +var out = concat( [ x, y ], -1 ); +console.log( ndarray2array( out ) ); +``` + +
+ + + + + +
+ +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/ndarray/concat/benchmark/benchmark.assign.js b/lib/node_modules/@stdlib/ndarray/concat/benchmark/benchmark.assign.js new file mode 100644 index 000000000000..0288fc4d92fd --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/concat/benchmark/benchmark.assign.js @@ -0,0 +1,190 @@ +/** +* @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 isndarrayLike = require( '@stdlib/assert/is-ndarray-like' ); +var zeros = require( '@stdlib/ndarray/zeros' ); +var pkg = require( './../package.json' ).name; +var concat = require( './../lib' ); + + +// MAIN // + +bench( pkg+'::1d', function benchmark( b ) { + var values; + var out; + var v; + var i; + + /* eslint-disable object-curly-newline */ + + values = [ + zeros( [ 2 ], { 'dtype': 'float64' }), + zeros( [ 2 ], { 'dtype': 'float32' }), + zeros( [ 2 ], { 'dtype': 'int32' }), + zeros( [ 2 ], { 'dtype': 'complex128' }), + zeros( [ 2 ], { 'dtype': 'generic' }) + ]; + out = zeros( [ 10 ], { 'dtype': 'float64' }); + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + v = concat( values, out, -1 ); + if ( typeof v !== 'object' ) { + b.fail( 'should return an ndarray' ); + } + } + b.toc(); + if ( !isndarrayLike( v ) ) { + b.fail( 'should return an ndarray' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); + +bench( pkg+'::2d', function benchmark( b ) { + var values; + var out; + var v; + var i; + + /* eslint-disable object-curly-newline */ + + values = [ + zeros( [ 2, 2 ], { 'dtype': 'float64' }), + zeros( [ 2, 2 ], { 'dtype': 'float32' }), + zeros( [ 2, 2 ], { 'dtype': 'int32' }), + zeros( [ 2, 2 ], { 'dtype': 'complex128' }), + zeros( [ 2, 2 ], { 'dtype': 'generic' }) + ]; + out = zeros( [ 2, 10 ], { 'dtype': 'float64' }); + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + v = concat( values, out, -1 ); + if ( typeof v !== 'object' ) { + b.fail( 'should return an ndarray' ); + } + } + b.toc(); + if ( !isndarrayLike( v ) ) { + b.fail( 'should return an ndarray' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); + +bench( pkg+'::3d', function benchmark( b ) { + var values; + var out; + var v; + var i; + + /* eslint-disable object-curly-newline */ + + values = [ + zeros( [ 2, 2, 2 ], { 'dtype': 'float64' }), + zeros( [ 2, 2, 2 ], { 'dtype': 'float32' }), + zeros( [ 2, 2, 2 ], { 'dtype': 'int32' }), + zeros( [ 2, 2, 2 ], { 'dtype': 'complex128' }), + zeros( [ 2, 2, 2 ], { 'dtype': 'generic' }) + ]; + out = zeros( [ 2, 2, 10 ], { 'dtype': 'float64' }); + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + v = concat( values, out, -1 ); + if ( typeof v !== 'object' ) { + b.fail( 'should return an ndarray' ); + } + } + b.toc(); + if ( !isndarrayLike( v ) ) { + b.fail( 'should return an ndarray' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); + +bench( pkg+'::4d', function benchmark( b ) { + var values; + var out; + var v; + var i; + + /* eslint-disable object-curly-newline */ + + values = [ + zeros( [ 2, 2, 2, 2 ], { 'dtype': 'float64' }), + zeros( [ 2, 2, 2, 2 ], { 'dtype': 'float32' }), + zeros( [ 2, 2, 2, 2 ], { 'dtype': 'int32' }), + zeros( [ 2, 2, 2, 2 ], { 'dtype': 'complex128' }), + zeros( [ 2, 2, 2, 2 ], { 'dtype': 'generic' }) + ]; + out = zeros( [ 2, 2, 2, 10 ], { 'dtype': 'float64' }); + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + v = concat( values, out, -1 ); + if ( typeof v !== 'object' ) { + b.fail( 'should return an ndarray' ); + } + } + b.toc(); + if ( !isndarrayLike( v ) ) { + b.fail( 'should return an ndarray' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); + +bench( pkg+'::5d', function benchmark( b ) { + var values; + var out; + var v; + var i; + + /* eslint-disable object-curly-newline */ + + values = [ + zeros( [ 2, 2, 2, 2, 2 ], { 'dtype': 'float64' }), + zeros( [ 2, 2, 2, 2, 2 ], { 'dtype': 'float32' }), + zeros( [ 2, 2, 2, 2, 2 ], { 'dtype': 'int32' }), + zeros( [ 2, 2, 2, 2, 2 ], { 'dtype': 'complex128' }), + zeros( [ 2, 2, 2, 2, 2 ], { 'dtype': 'generic' }) + ]; + out = zeros( [ 2, 2, 2, 2, 10 ], { 'dtype': 'float64' }); + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + v = concat( values, out, -1 ); + if ( typeof v !== 'object' ) { + b.fail( 'should return an ndarray' ); + } + } + b.toc(); + if ( !isndarrayLike( v ) ) { + b.fail( 'should return an ndarray' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/ndarray/concat/benchmark/benchmark.js b/lib/node_modules/@stdlib/ndarray/concat/benchmark/benchmark.js new file mode 100644 index 000000000000..32fc4e89e14a --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/concat/benchmark/benchmark.js @@ -0,0 +1,180 @@ +/** +* @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 isndarrayLike = require( '@stdlib/assert/is-ndarray-like' ); +var zeros = require( '@stdlib/ndarray/zeros' ); +var pkg = require( './../package.json' ).name; +var concat = require( './../lib' ); + + +// MAIN // + +bench( pkg+'::1d', function benchmark( b ) { + var values; + var v; + var i; + + /* eslint-disable object-curly-newline */ + + values = [ + zeros( [ 2 ], { 'dtype': 'float64' }), + zeros( [ 2 ], { 'dtype': 'float32' }), + zeros( [ 2 ], { 'dtype': 'int32' }), + zeros( [ 2 ], { 'dtype': 'complex128' }), + zeros( [ 2 ], { 'dtype': 'generic' }) + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + v = concat( values, -1 ); + if ( typeof v !== 'object' ) { + b.fail( 'should return an ndarray' ); + } + } + b.toc(); + if ( !isndarrayLike( v ) ) { + b.fail( 'should return an ndarray' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); + +bench( pkg+'::2d', function benchmark( b ) { + var values; + var v; + var i; + + /* eslint-disable object-curly-newline */ + + values = [ + zeros( [ 2, 2 ], { 'dtype': 'float64' }), + zeros( [ 2, 2 ], { 'dtype': 'float32' }), + zeros( [ 2, 2 ], { 'dtype': 'int32' }), + zeros( [ 2, 2 ], { 'dtype': 'complex128' }), + zeros( [ 2, 2 ], { 'dtype': 'generic' }) + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + v = concat( values, -1 ); + if ( typeof v !== 'object' ) { + b.fail( 'should return an ndarray' ); + } + } + b.toc(); + if ( !isndarrayLike( v ) ) { + b.fail( 'should return an ndarray' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); + +bench( pkg+'::3d', function benchmark( b ) { + var values; + var v; + var i; + + /* eslint-disable object-curly-newline */ + + values = [ + zeros( [ 2, 2, 2 ], { 'dtype': 'float64' }), + zeros( [ 2, 2, 2 ], { 'dtype': 'float32' }), + zeros( [ 2, 2, 2 ], { 'dtype': 'int32' }), + zeros( [ 2, 2, 2 ], { 'dtype': 'complex128' }), + zeros( [ 2, 2, 2 ], { 'dtype': 'generic' }) + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + v = concat( values, -1 ); + if ( typeof v !== 'object' ) { + b.fail( 'should return an ndarray' ); + } + } + b.toc(); + if ( !isndarrayLike( v ) ) { + b.fail( 'should return an ndarray' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); + +bench( pkg+'::4d', function benchmark( b ) { + var values; + var v; + var i; + + /* eslint-disable object-curly-newline */ + + values = [ + zeros( [ 2, 2, 2, 2 ], { 'dtype': 'float64' }), + zeros( [ 2, 2, 2, 2 ], { 'dtype': 'float32' }), + zeros( [ 2, 2, 2, 2 ], { 'dtype': 'int32' }), + zeros( [ 2, 2, 2, 2 ], { 'dtype': 'complex128' }), + zeros( [ 2, 2, 2, 2 ], { 'dtype': 'generic' }) + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + v = concat( values, -1 ); + if ( typeof v !== 'object' ) { + b.fail( 'should return an ndarray' ); + } + } + b.toc(); + if ( !isndarrayLike( v ) ) { + b.fail( 'should return an ndarray' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); + +bench( pkg+'::5d', function benchmark( b ) { + var values; + var v; + var i; + + /* eslint-disable object-curly-newline */ + + values = [ + zeros( [ 2, 2, 2, 2, 2 ], { 'dtype': 'float64' }), + zeros( [ 2, 2, 2, 2, 2 ], { 'dtype': 'float32' }), + zeros( [ 2, 2, 2, 2, 2 ], { 'dtype': 'int32' }), + zeros( [ 2, 2, 2, 2, 2 ], { 'dtype': 'complex128' }), + zeros( [ 2, 2, 2, 2, 2 ], { 'dtype': 'generic' }) + ]; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + v = concat( values, -1 ); + if ( typeof v !== 'object' ) { + b.fail( 'should return an ndarray' ); + } + } + b.toc(); + if ( !isndarrayLike( v ) ) { + b.fail( 'should return an ndarray' ); + } + b.pass( 'benchmark finished' ); + b.end(); +}); diff --git a/lib/node_modules/@stdlib/ndarray/concat/docs/repl.txt b/lib/node_modules/@stdlib/ndarray/concat/docs/repl.txt new file mode 100644 index 000000000000..39bc9a1f3ce5 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/concat/docs/repl.txt @@ -0,0 +1,62 @@ + +{{alias}}( arrays, dim ) + Concatenates a list of ndarrays along a specified ndarray dimension. + + Parameters + ---------- + arrays: ArrayLikeObject + Array-like object containing input ndarrays. + + dim: integer + Dimension along which the arrays are concatenated. + + Returns + ------- + out: ndarray + Output ndarray. + + Examples + -------- + > var x = {{alias:@stdlib/ndarray/array}}( [ [ 1.0, 2.0 ], [ 3.0, 4.0 ] ] ); + > var y = {{alias:@stdlib/ndarray/array}}( [ [ 5.0, 6.0 ], [ 7.0, 8.0 ] ] ); + > var out = {{alias}}( [ x, y ], -1 ) + + > var arr = {{alias:@stdlib/ndarray/to-array}}( out ) + [ [ 1.0, 2.0, 5.0, 6.0 ], [ 3.0, 4.0, 7.0, 8.0 ] ] + + +{{alias}}.assign( arrays, out, dim ) + Concatenates a list of ndarrays along a specified ndarray dimension and + assigns results to a provided output ndarray. + + Parameters + ---------- + arrays: ArrayLikeObject + Array-like object containing input ndarrays. + + out: ndarray + Output ndarray. + + dim: integer + Dimension along which the arrays are concatenated. + + Returns + ------- + out: ndarray + Output ndarray. + + Examples + -------- + > var x = {{alias:@stdlib/ndarray/array}}( [ [ 1.0 ], [ 2.0 ] ] ); + > var y = {{alias:@stdlib/ndarray/array}}( [ [ 3.0 ], [ 4.0 ] ] ); + > var z = {{alias:@stdlib/ndarra/array}}( [ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ] ); + > var out = {{alias}}.assign( [ x, y ], z, -1 ) + + > var bool = ( out === z ) + true + > var arr = {{alias:@stdlib/ndarray/to-array}}( out ) + [ [ 1.0, 3.0 ], [ 2.0, 4.0 ] ] + + See Also + -------- + diff --git a/lib/node_modules/@stdlib/ndarray/concat/docs/types/index.d.ts b/lib/node_modules/@stdlib/ndarray/concat/docs/types/index.d.ts new file mode 100644 index 000000000000..528a26677f4c --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/concat/docs/types/index.d.ts @@ -0,0 +1,139 @@ +/* +* @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 { ArrayLike } from '@stdlib/types/array'; +import { ndarray } from '@stdlib/types/ndarray'; + + +/** +* Interface describing `concat`. +*/ +interface Concat { + /** + * Concatenates a list of ndarrays along a specified ndarray dimension. + * + * @param arrays - array-like object containing input ndarrays + * @param dim - dimension along which to the arrays are concatenated + * @returns output ndarray + * + * @example + * var ndarray2array = require( '@stdlib/ndarray/to-array' ); + * var Float64Array = require( '@stdlib/array/float64' ); + * var ndarray = require( '@stdlib/ndarray/ctor' ); + * + * var xbuf = new Float64Array( [ -1.0, 2.0, -3.0, 4.0 ] ); + * var x = new ndarray( 'float64', xbuf, [ 2, 2 ], [ 2, 1 ], 0, 'row-major' ); + * + * var ybuf = new Float64Array( [ -5.0, 6.0, -7.0, 8.0, -9.0, 10.0 ] ); + * var y = new ndarray( 'float64', ybuf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); + * + * var out = concat( [ x, y ] ); + * // returns + * + * var arr = ndarray2array( out ); + * // returns [ [ -1.0, 2.0, -5.0, 6.0, 7.0 ], [ -3.0, 4.0, 8.0, 9.0, 10.0 ] ] + */ + ( arrays: ArrayLike, dim: number ): ndarray; + + /** + * Concatenates a list of ndarrays along a specified ndarray dimension and assigns results to a provided output ndarray. + * + * @param arrays - array-like object containing input ndarrays + * @param out - output ndarray + * @param dim - dimension along which to the arrays are concatenated + * @returns output ndarray + * + * @example + * var ndarray2array = require( '@stdlib/ndarray/to-array' ); + * var Float64Array = require( '@stdlib/array/float64' ); + * var ndarray = require( '@stdlib/ndarray/ctor' ); + * + * var xbuf = new Float64Array( [ -1.0, 2.0, -3.0, 4.0 ] ); + * var x = new ndarray( 'float64', xbuf, [ 2, 2 ], [ 2, 1 ], 0, 'row-major' ); + * + * var ybuf = new Float64Array( [ -5.0, 6.0, -7.0, 8.0, -9.0, 10.0 ] ); + * var y = new ndarray( 'float64', ybuf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); + * + * var z = new ndarray( 'float64', new Float64Array( 10 ), [ 2, 5 ], [ 5, 1 ], 0, 'row-major' ); + * + * var out = assign( [ x, y ], z, -1 ); + * + * var bool = ( out === z ); + * // returns true + * + * var arr = ndarray2array( z ); + * // returns [ [ -1.0, 2.0, -5.0, 6.0, 7.0 ], [ -3.0, 4.0, 8.0, 9.0, 10.0 ] ] + */ + assign( arrays: ArrayLike, out: T, dim: number ): T; +} + +/** +* Concatenates a list of ndarrays along a specified ndarray dimension. +* +* @param arrays - array-like object containing input ndarrays +* @param dim - dimension along which to the arrays are concatenated +* @returns output ndarray +* +* @example +* var ndarray2array = require( '@stdlib/ndarray/to-array' ); +* var Float64Array = require( '@stdlib/array/float64' ); +* var ndarray = require( '@stdlib/ndarray/ctor' ); +* +* var xbuf = new Float64Array( [ -1.0, 2.0, -3.0, 4.0 ] ); +* var x = new ndarray( 'float64', xbuf, [ 2, 2 ], [ 2, 1 ], 0, 'row-major' ); +* +* var ybuf = new Float64Array( [ -5.0, 6.0, -7.0, 8.0, -9.0, 10.0 ] ); +* var y = new ndarray( 'float64', ybuf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); +* +* var out = concat( [ x, y ] ); +* // returns +* +* var arr = ndarray2array( out ); +* // returns [ [ -1.0, 2.0, -5.0, 6.0, 7.0 ], [ -3.0, 4.0, 8.0, 9.0, 10.0 ] ] +* +* @example +* var ndarray2array = require( '@stdlib/ndarray/to-array' ); +* var Float64Array = require( '@stdlib/array/float64' ); +* var ndarray = require( '@stdlib/ndarray/ctor' ); +* +* var xbuf = new Float64Array( [ -1.0, 2.0, -3.0, 4.0 ] ); +* var x = new ndarray( 'float64', xbuf, [ 2, 2 ], [ 2, 1 ], 0, 'row-major' ); +* +* var ybuf = new Float64Array( [ -5.0, 6.0, -7.0, 8.0, -9.0, 10.0 ] ); +* var y = new ndarray( 'float64', ybuf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); +* +* var z = new ndarray( 'float64', new Float64Array( 10 ), [ 2, 5 ], [ 5, 1 ], 0, 'row-major' ); +* +* var out = concat.assign( [ x, y ], z, -1 ); +* +* var bool = ( out === z ); +* // returns true +* +* var arr = ndarray2array( z ); +* // returns [ [ -1.0, 2.0, -5.0, 6.0, 7.0 ], [ -3.0, 4.0, 8.0, 9.0, 10.0 ] ] +*/ +declare var concat: Concat; + + +// EXPORTS // + +export = concat; diff --git a/lib/node_modules/@stdlib/ndarray/concat/docs/types/test.ts b/lib/node_modules/@stdlib/ndarray/concat/docs/types/test.ts new file mode 100644 index 000000000000..16c66962b7b8 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/concat/docs/types/test.ts @@ -0,0 +1,132 @@ +/* +* @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. +*/ + +/// + +import zeros = require( '@stdlib/ndarray/zeros' ); +import concat = require( './index' ); + + +// TESTS // + +// The function returns an ndarray... +{ + const x = zeros( [ 2, 2 ] ); + const y = zeros( [ 2, 3 ] ); + + concat( [ x, y ], -1 ); // $ExpectType ndarray +} + +// The compiler throws an error if the function is provided a first argument which is not an array-like object containing ndarray-like objects... +{ + concat( 5, -1 ); // $ExpectError + concat( true, -1 ); // $ExpectError + concat( false, -1 ); // $ExpectError + concat( null, -1 ); // $ExpectError + concat( undefined, -1 ); // $ExpectError + concat( {}, -1 ); // $ExpectError + concat( [ 1 ], -1 ); // $ExpectError + concat( ( x: number ): number => x, -1 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a second argument which is not an integer... +{ + const x = zeros( [ 2, 2 ] ); + const y = zeros( [ 2, 3 ] ); + + concat( [ x, y ], '5' ); // $ExpectError + concat( [ x, y ], 5 ); // $ExpectError + concat( [ x, y ], true ); // $ExpectError + concat( [ x, y ], false ); // $ExpectError + concat( [ x, y ], null ); // $ExpectError + concat( [ x, y ], [ 1 ] ); // $ExpectError + concat( [ x, y ], ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + const x = zeros( [ 2, 2 ] ); + const y = zeros( [ 2, 3 ] ); + + concat(); // $ExpectError + concat( x ); // $ExpectError + concat( [ x, y ], 0.0, {} ); // $ExpectError +} + +// Attached to the function is an `assign` method which returns an ndarray... +{ + const x = zeros( [ 2, 2 ] ); + const y = zeros( [ 2, 3 ] ); + const z = zeros( [ 2, 5 ] ); + + concat.assign( [ x, y ], z, -1 ); // $ExpectType ndarray +} + +// The compiler throws an error if the `assign` method is provided a first argument which is not an array-like object containing ndarray-like objects...... +{ + const z = zeros( [ 2, 5 ] ); + + concat.assign( 5, z, -1 ); // $ExpectError + concat.assign( true, z, -1 ); // $ExpectError + concat.assign( false, z, -1 ); // $ExpectError + concat.assign( null, z, -1 ); // $ExpectError + concat.assign( undefined, z, -1 ); // $ExpectError + concat.assign( {}, z, -1 ); // $ExpectError + concat.assign( [ 1 ], z, -1 ); // $ExpectError + concat.assign( ( x: number ): number => x, z, -1 ); // $ExpectError +} + +// The compiler throws an error if the `assign` method is provided a second argument which is not an ndarray... +{ + const x = zeros( [ 2, 2 ] ); + const y = zeros( [ 2, 3 ] ); + + concat.assign( [ x, y ], '5', -1 ); // $ExpectError + concat.assign( [ x, y ], 5, -1 ); // $ExpectError + concat.assign( [ x, y ], true, -1 ); // $ExpectError + concat.assign( [ x, y ], false, -1 ); // $ExpectError + concat.assign( [ x, y ], null, -1 ); // $ExpectError + concat.assign( [ x, y ], [ 1 ], -1 ); // $ExpectError + concat.assign( [ x, y ], ( x: number ): number => x, -1 ); // $ExpectError +} + +// The compiler throws an error if the `assign` method is provided a third argument which is not an integer... +{ + const x = zeros( [ 2, 2 ] ); + const y = zeros( [ 2, 3 ] ); + const z = zeros( [ 2, 5 ] ); + + concat.assign( [ x, y ], z, '5' ); // $ExpectError + concat.assign( [ x, y ], z, 5 ); // $ExpectError + concat.assign( [ x, y ], z, true ); // $ExpectError + concat.assign( [ x, y ], z, false ); // $ExpectError + concat.assign( [ x, y ], z, null ); // $ExpectError + concat.assign( [ x, y ], z, [ 1 ] ); // $ExpectError + concat.assign( [ x, y ], z, ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + const x = zeros( [ 2, 2 ] ); + const y = zeros( [ 2, 3 ] ); + const z = zeros( [ 2, 5 ] ); + + concat.assign(); // $ExpectError + concat.assign( [ x, y ], z ); // $ExpectError + concat.assign( [ x, y ], z, -1, {} ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/ndarray/concat/examples/index.js b/lib/node_modules/@stdlib/ndarray/concat/examples/index.js new file mode 100644 index 000000000000..f4d99b5b9524 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/concat/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/ctor' ); +var ndarray2array = require( '@stdlib/ndarray/to-array' ); +var concat = require( './../lib' ); + +var xbuf = discreteUniform( 6, 0, 10, { + 'dtype': 'generic' +}); +var x = new ndarray( 'generic', xbuf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); +console.log( ndarray2array( x ) ); + +var ybuf = discreteUniform( 8, 0, 10, { + 'dtype': 'generic' +}); +var y = new ndarray( 'generic', ybuf, [ 2, 4 ], [ 4, 1 ], 0, 'row-major' ); +console.log( ndarray2array( y ) ); + +var out = concat( [ x, y ], -1 ); +console.log( ndarray2array( out ) ); diff --git a/lib/node_modules/@stdlib/ndarray/concat/lib/assign.js b/lib/node_modules/@stdlib/ndarray/concat/lib/assign.js new file mode 100644 index 000000000000..fa51c2468c04 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/concat/lib/assign.js @@ -0,0 +1,151 @@ +/** +* @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 broadcastArrayExceptDimensions = require( '@stdlib/ndarray/base/broadcast-array-except-dimensions' ); +var normalizeIndex = require( '@stdlib/ndarray/base/normalize-index' ); +var isndarrayLike = require( '@stdlib/assert/is-ndarray-like' ); +var indicesComplement = require( '@stdlib/array/base/indices-complement' ); +var nditerStacks = require( '@stdlib/ndarray/iter/stacks' ); +var getShape = require( '@stdlib/ndarray/shape' ); +var getStrides = require( '@stdlib/ndarray/strides' ); +var getDtype = require( '@stdlib/ndarray/dtype' ); +var getOrder = require( '@stdlib/ndarray/order' ); +var format = require( '@stdlib/string/format' ); +var base = require( '@stdlib/ndarray/base/assign' ); +var output = require( './output.js' ); + + +// MAIN // + +/** +* Concatenates a list of ndarrays along a specified ndarray dimension and assigns results to a provided output ndarray. +* +* @param {ArrayLikeObject} arrays - array-like object containing input ndarrays +* @param {ndarray} out - output ndarray +* @param {integer} dim - dimension along which the arrays are concatenated +* @throws {TypeError} first argument must be an array of ndarray-like objects +* @throws {RangeError} first argument must have more than one ndarray +* @throws {TypeError} second argument must be an array of ndarray-like objects +* @returns {ndarray} output ndarray +* +* @example +* var ndarray2array = require( '@stdlib/ndarray/to-array' ); +* var Float64Array = require( '@stdlib/array/float64' ); +* var ndarray = require( '@stdlib/ndarray/ctor' ); +* +* var xbuf = new Float64Array( [ -1.0, 2.0, -3.0, 4.0 ] ); +* var x = new ndarray( 'float64', xbuf, [ 2, 2 ], [ 2, 1 ], 0, 'row-major' ); +* +* var ybuf = new Float64Array( [ -5.0, 6.0, -7.0, 8.0, -9.0, 10.0 ] ); +* var y = new ndarray( 'float64', ybuf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); +* +* var z = new ndarray( 'float64', new Float64Array( 10 ), [ 2, 5 ], [ 5, 1 ], 0, 'row-major' ); +* +* var out = assign( [ x, y ], z, -1 ); +* +* var bool = ( out === z ); +* // returns true +* +* var arr = ndarray2array( z ); +* // returns [ [ -1.0, 2.0, -5.0, 6.0, 7.0 ], [ -3.0, 4.0, 8.0, 9.0, 10.0 ] ] +*/ +function assign( arrays, out, dim ) { + var istacks; + var ostacks; + var strides; + var shapes; + var dtypes; + var orders; + var arrs; + var err; + var mi; + var N; + var d; + var s; + var i; + + N = arrays.length; + arrs = []; + if ( N < 1 ) { + throw new RangeError( format( 'invalid argument. First argument must have more than one ndarray. Value: `%s`.', N ) ); + } + if ( !isndarrayLike( out ) ) { + throw new TypeError( format( 'invalid argument. Second argument must be an ndarray-like object. Value: `%s`.', out ) ); + } + // Unpack the ndarrays and standardize ndarray meta data: + shapes = []; + strides = []; + dtypes = []; + orders = []; + for ( i = 0; i < N; i++ ) { + if ( !isndarrayLike( arrays[ i ] ) ) { + throw new TypeError( format( 'invalid argument. First argument must be an array of ndarray-like objects. Value: `%s`.', arrays[ i ] ) ); + } + arrs[ i ] = arrays[ i ]; + shapes.push( getShape( arrs[ i ] ) ); + strides.push( getStrides( arrs[ i ] ) ); + dtypes.push( getDtype( arrs[ i ] ) ); + orders.push( getOrder( arrs[ i ] ) ); + } + // Determine the ndarray with max-rank: + mi = 0; + for ( i = 1; i < N; i++ ) { + if ( shapes[ i ].length > shapes[ mi ].length ) { + mi = i; + } + } + // Normalize dimension index: + d = normalizeIndex( dim, shapes[ mi ].length - 1 ); + + // Broadcast all ndarrays to shape of max-rank ndarray: + for ( i = 0; i < N; i++ ) { + if ( i === mi ) { + continue; + } + arrs[ i ] = broadcastArrayExceptDimensions( arrs[ i ], shapes[ mi ], [ dim ] ); // eslint-disable-line max-len + } + // Validate the output ndarray: + err = output( shapes, dtypes, orders, d, out ); + if ( err ) { + throw err; + } + // Create iterator for output subarrays: + ostacks = nditerStacks( out, indicesComplement( out.shape.length, [ d ] ) ); + + // Assign each input subarray to relevant output subarray: + for ( i = 0; i < arrs.length; i++ ) { + istacks = nditerStacks( arrs[ i ], indicesComplement( arrs[ i ].shape.length, [ d ] ) ); // eslint-disable-line max-len + while ( true ) { + s = istacks.next(); + if ( s.done ) { + break; + } + base( [ s.value, ostacks.next().value ] ); + } + } + return out; +} + + +// EXPORTS // + +module.exports = assign; diff --git a/lib/node_modules/@stdlib/ndarray/concat/lib/index.js b/lib/node_modules/@stdlib/ndarray/concat/lib/index.js new file mode 100644 index 000000000000..203f50534a5b --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/concat/lib/index.js @@ -0,0 +1,61 @@ +/** +* @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'; + +/** +* Concatenate a list of ndarrays along a specified ndarray dimension. +* +* @module @stdlib/ndarray/concat +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* var ndarray2array = require( '@stdlib/ndarray/to-array' ); +* var ndarray = require( '@stdlib/ndarray/ctor' ); +* var concat = require( '@stdlib/ndarray/concat' ); +* +* var xbuf = new Float64Array( [ -1.0, 2.0, -3.0, 4.0 ] ); +* var x = new ndarray( 'float64', xbuf, [ 2, 2 ], [ 2, 1 ], 0, 'row-major' ); +* +* var ybuf = new Float64Array( [ -5.0, 6.0, -7.0, 8.0, -9.0, 10.0 ] ); +* var y = new ndarray( 'float64', ybuf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); +* +* var out = concat( [ x, y ], -1 ); +* // returns +* +* var arr = ndarray2array( out ); +* // returns [ [ -1.0, 2.0, -5.0, 6.0, 7.0 ], [ -3.0, 4.0, 8.0, 9.0, 10.0 ] ] +*/ + +// MODULES // + +var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); +var main = require( './main.js' ); +var assign = require( './assign.js' ); + + +// MAIN // + +setReadOnly( main, 'assign', assign ); + + +// EXPORTS // + +module.exports = main; + +// exports: { "assign": "main.assign" } diff --git a/lib/node_modules/@stdlib/ndarray/concat/lib/main.js b/lib/node_modules/@stdlib/ndarray/concat/lib/main.js new file mode 100644 index 000000000000..7cf2b0569132 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/concat/lib/main.js @@ -0,0 +1,140 @@ +/** +* @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 broadcastArrayExceptDimensions = require( '@stdlib/ndarray/base/broadcast-array-except-dimensions' ); +var normalizeIndex = require( '@stdlib/ndarray/base/normalize-index' ); +var isndarrayLike = require( '@stdlib/assert/is-ndarray-like' ); +var indicesComplement = require( '@stdlib/array/base/indices-complement' ); +var nditerStacks = require( '@stdlib/ndarray/iter/stacks' ); +var getShape = require( '@stdlib/ndarray/shape' ); +var getStrides = require( '@stdlib/ndarray/strides' ); +var getDtype = require( '@stdlib/ndarray/dtype' ); +var getOrder = require( '@stdlib/ndarray/order' ); +var format = require( '@stdlib/string/format' ); +var assign = require( '@stdlib/ndarray/base/assign' ); +var output = require( './output.js' ); + + +// MAIN // + +/** +* Concatenates a list of ndarrays along a specified ndarray dimension. +* +* @param {ArrayLikeObject} arrays - array-like object containing input ndarrays +* @param {integer} dim - dimension along which the arrays are concatenated +* @throws {TypeError} first argument must be an array of ndarray-like objects +* @throws {RangeError} first argument must have more than one ndarray +* @returns {ndarray} output ndarray +* +* @example +* var ndarray2array = require( '@stdlib/ndarray/to-array' ); +* var Float64Array = require( '@stdlib/array/float64' ); +* var ndarray = require( '@stdlib/ndarray/ctor' ); +* +* var xbuf = new Float64Array( [ -1.0, 2.0, -3.0, 4.0 ] ); +* var x = new ndarray( 'float64', xbuf, [ 2, 2 ], [ 2, 1 ], 0, 'row-major' ); +* +* var ybuf = new Float64Array( [ -5.0, 6.0, -7.0, 8.0, -9.0, 10.0 ] ); +* var y = new ndarray( 'float64', ybuf, [ 2, 3 ], [ 3, 1 ], 0, 'row-major' ); +* +* var out = concat( [ x, y ] ); +* // returns +* +* var arr = ndarray2array( out ); +* // returns [ [ -1.0, 2.0, -5.0, 6.0, 7.0 ], [ -3.0, 4.0, 8.0, 9.0, 10.0 ] ] +*/ +function concat( arrays, dim ) { + var istacks; + var ostacks; + var strides; + var shapes; + var dtypes; + var orders; + var arrs; + var out; + var mi; + var N; + var d; + var s; + var i; + + N = arrays.length; + arrs = []; + if ( N < 1 ) { + throw new RangeError( format( 'invalid argument. First argument must have more than one ndarray. Value: `%s`.', N ) ); + } + // Unpack the ndarrays and standardize ndarray meta data: + shapes = []; + strides = []; + dtypes = []; + orders = []; + for ( i = 0; i < N; i++ ) { + if ( !isndarrayLike( arrays[ i ] ) ) { + throw new TypeError( format( 'invalid argument. First argument must be an array of ndarray-like objects. Value: `%s`.', arrays[ i ] ) ); + } + arrs[ i ] = arrays[ i ]; + shapes.push( getShape( arrs[ i ] ) ); + strides.push( getStrides( arrs[ i ] ) ); + dtypes.push( getDtype( arrs[ i ] ) ); + orders.push( getOrder( arrs[ i ] ) ); + } + // Determine the ndarray with max-rank: + mi = 0; + for ( i = 1; i < N; i++ ) { + if ( shapes[ i ].length > shapes[ mi ].length ) { + mi = i; + } + } + // Normalize dimension index: + d = normalizeIndex( dim, shapes[ mi ].length - 1 ); + + // Broadcast all ndarrays to shape of max-rank ndarray: + for ( i = 0; i < N; i++ ) { + if ( i === mi ) { + continue; + } + arrs[ i ] = broadcastArrayExceptDimensions( arrs[ i ], shapes[ mi ], [ dim ] ); // eslint-disable-line max-len + } + // Create output ndarray: + out = output( shapes, dtypes, orders, d ); + + // Create iterator for output subarrays: + ostacks = nditerStacks( out, indicesComplement( out.shape.length, [ d ] ) ); + + // Assign each input subarray to relevant output subarray: + for ( i = 0; i < arrs.length; i++ ) { + istacks = nditerStacks( arrs[ i ], indicesComplement( arrs[ i ].shape.length, [ d ] ) ); // eslint-disable-line max-len + while ( true ) { + s = istacks.next(); + if ( s.done ) { + break; + } + assign( [ s.value, ostacks.next().value ] ); + } + } + return out; +} + + +// EXPORTS // + +module.exports = concat; diff --git a/lib/node_modules/@stdlib/ndarray/concat/lib/output.js b/lib/node_modules/@stdlib/ndarray/concat/lib/output.js new file mode 100644 index 000000000000..c5c9be01c1cd --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/concat/lib/output.js @@ -0,0 +1,115 @@ +/** +* @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 promoteDataTypes = require( '@stdlib/ndarray/base/promote-dtypes' ); +var defaults = require( '@stdlib/ndarray/defaults' ); +var empty = require( '@stdlib/ndarray/empty' ); +var slice = require( '@stdlib/array/slice' ); +var getShape = require( '@stdlib/ndarray/shape' ); +var getDtype = require( '@stdlib/ndarray/dtype' ); +var getOrder = require( '@stdlib/ndarray/order' ); +var format = require( '@stdlib/string/format' ); + + +// FUNCTIONS // + +/** +* Returns output ndarray order. +* +* @private +* @param {ArrayLikeObject} orders - list of input ndarray orders +* @returns {integer} output ndarray order +*/ +function resolveOutputOrder( orders ) { + var o; + var i; + + o = orders[ 0 ]; + for ( i = 0; i < orders.length; i++ ) { + if ( orders[ i ] !== o ) { + return defaults.order; + } + } + return o; +} + + +// MAIN // + +/** +* Returns an output ndarray. +* +* @param {ArrayLikeObject} shapes - input ndarray shapes +* @param {ArrayLikeObject} dtypes - input ndarray dtypes +* @param {ArrayLikeObject} orders - input ndarray orders +* @param {integer} dim - irregular dimension +* @param {ndarray} [out] - output ndarray +* @throws {TypeError} output ndarray must have a valid data type +* @throws {TypeError} output ndarray must have a valid order +* @throws {RangeError} output ndarray must have valid number of dimensions +* @throws {RangeError} output ndarray must have a valid shape +* @returns {ndarray} output ndarray +* +* @example +*/ +function output( shapes, dtypes, orders, dim, out ) { + var ord; + var sh; + var dt; + var s; + var i; + + dt = promoteDataTypes( dtypes ); + sh = slice( shapes[ 0 ] ); + for ( i = 1; i < shapes.length; i++ ) { + s = shapes[ i ]; + sh[ dim ] += s[ dim ]; + } + ord = resolveOutputOrder( orders ); + if ( out ) { + if ( getDtype( out ) !== dt ) { + throw new TypeError( format( 'invalid argument. Output ndarray must have a dtype of `%s`. Value: `%s`.', dt, getDtype( out ) ) ); + } + if ( getOrder( out ) !== ord ) { + throw new TypeError( format( 'invalid argument. Output ndarray must have an order of `%s`. Value: `%s`.', ord, getOrder( out ) ) ); + } + if ( getShape( out ).length !== sh.length ) { + throw new RangeError( format( 'invalid argument. Output ndarray must have %d dimensions. Value: %d.', sh.length, getShape( out ).length ) ); + } + for ( i = 0; i < sh.length; i++ ) { + if ( getShape( out )[ i ] !== sh[ i ] ) { + throw new RangeError( format( 'invalid argument. Output ndarray dimension %d must have size %d. Value: %d.', i, sh[ i ], getShape( out )[ i ] ) ); + } + } + return null; + } + out = empty( sh, { + 'dtype': dt, + 'order': ord + }); + return out; +} + + +// EXPORTS // + +module.exports = output; diff --git a/lib/node_modules/@stdlib/ndarray/concat/package.json b/lib/node_modules/@stdlib/ndarray/concat/package.json new file mode 100644 index 000000000000..c4b152877892 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/concat/package.json @@ -0,0 +1,65 @@ +{ + "name": "@stdlib/ndarray/concat", + "version": "0.0.0", + "description": "Concatenate a list of ndarrays along a specified ndarray dimension.", + "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", + "stdtypes", + "types", + "base", + "data", + "structure", + "vector", + "ndarray", + "concatenate", + "matrix", + "join", + "concat" + ] +} diff --git a/lib/node_modules/@stdlib/ndarray/concat/test/test.js b/lib/node_modules/@stdlib/ndarray/concat/test/test.js new file mode 100644 index 000000000000..e85cd1995432 --- /dev/null +++ b/lib/node_modules/@stdlib/ndarray/concat/test/test.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'; + +// MODULES // + +var tape = require( 'tape' ); +var isMethod = require( '@stdlib/assert/is-method' ); +var concat = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof concat, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'attached to the main export is an `assign` method', function test( t ) { + t.strictEqual( isMethod( concat, 'assign' ), true, 'returns expected value' ); + t.end(); +});