/* * @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 { typedndarray } from '@stdlib/types/ndarray'; /** * Interface describing function options. */ interface Options { /** * Dimension along which to concatenate input ndarrays. */ dim?: number; } /** * Interface describing `concat`. */ interface Concat { /** * Concatenates a list of ndarrays along a specified ndarray dimension. * * @param arrays - array-like object containing input ndarrays * @param options - function options * @returns output ndarray * * @example * var Float64Array = require( '@stdlib/array/float64' ); * var ndarray = require( './../../../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 ], { * 'dim': -1 * }); * // returns [ [ -1.0, 2.0, -5.0, 6.0, -7.0 ], [ -3.0, 4.0, 8.0, -9.0, 10.0 ] ] */ ( arrays: ArrayLike>, options?: Options ): typedndarray; /** * 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 options - function options * @returns output ndarray * * @example * var Float64Array = require( '@stdlib/array/float64' ); * var ndarray = require( './../../../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, { * 'dim': -1 * }); * // returns [ [ -1.0, 2.0, -5.0, 6.0, -7.0 ], [ -3.0, 4.0, 8.0, -9.0, 10.0 ] ] * * var bool = ( out === z ); * // returns true */ assign = typedndarray>( arrays: ArrayLike>, out: V, options?: Options ): V; } /** * Concatenates a list of ndarrays along a specified ndarray dimension. * * @param arrays - array-like object containing input ndarrays * @param options - function options * @returns output ndarray * * @example * 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 ], { * 'dim': -1 * }); * // returns [ [ -1.0, 2.0, -5.0, 6.0, -7.0 ], [ -3.0, 4.0, 8.0, -9.0, 10.0 ] ] * * @example * 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, { * 'dim': -1 * }); * // returns [ [ -1.0, 2.0, -5.0, 6.0, -7.0 ], [ -3.0, 4.0, 8.0, -9.0, 10.0 ] ] * * var bool = ( out === z ); * // returns true */ declare var concat: Concat; // EXPORTS // export = concat;