/* * @license Apache-2.0 * * Copyright (c) 2023 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 { Shape } from '@stdlib/types/ndarray'; /** * One-dimensional array. */ type Array1D = Array; /** * One-dimensional array shape. */ type Shape1D = [ number ]; /** * Two-dimensional array. */ type Array2D = Array>; /** * Two-dimensional array shape. */ type Shape2D = [ number, number ]; /** * Three-dimensional array. */ type Array3D = Array>; /** * Three-dimensional array shape. */ type Shape3D = [ number, number, number ]; /** * Four-dimensional array. */ type Array4D = Array>; /** * Four-dimensional array shape. */ type Shape4D = [ number, number, number, number ]; /** * Five-dimensional array. */ type Array5D = Array>; /** * Five-dimensional array shape. */ type Shape5D = [ number, number, number, number, number ]; /** * Six-dimensional array. */ type Array6D = Array>; /** * Six-dimensional array shape. */ type Shape6D = [ number, number, number, number, number, number ]; /** * Seven-dimensional array. */ type Array7D = Array>; /** * Seven-dimensional array shape. */ type Shape7D = [ number, number, number, number, number, number, number ]; /** * Eight-dimensional array. */ type Array8D = Array>; /** * Eight-dimensional array shape. */ type Shape8D = [ number, number, number, number, number, number, number, number ]; /** * Nine-dimensional array. */ type Array9D = Array>; /** * Nine-dimensional array shape. */ type Shape9D = [ number, number, number, number, number, number, number, number, number ]; /** * Ten-dimensional array. */ type Array10D = Array>; // WARNING: arbitrarily limited to 10 dimensions, which should be fine for most practical purposes /** * Ten-dimensional array shape. */ type Shape10D = [ number, number, number, number, number, number, number, number, number, number ]; /** * Nullary callback function. * * @returns fill value */ type Nullary = ( this: V ) => T; /** * Unary callback function. * * @param indices - current array element indices * @returns fill value */ type Unary = ( this: V, indices: Array ) => T; /** * Callback function. * * @param indices - current array element indices * @returns fill value */ type Callback = Nullary | Unary; /** * Creates a filled one-dimensional nested array according to a provided callback function. * * @param shape - array shape * @param clbk - callback function * @param thisArg - callback execution context * @returns output array * * @example * var constantFunction = require( '@stdlib/utils/constant-function' ); * * var out = filledndBy( [ 3 ], constantFunction( 1.0 ) ); * // returns [ 1.0, 1.0, 1.0 ] */ declare function filledndBy( shape: Shape1D, clbk: Callback, thisArg?: ThisParameterType> ): Array1D; /** * Creates a filled two-dimensional nested array according to a provided callback function. * * @param shape - array shape * @param clbk - callback function * @param thisArg - callback execution context * @returns output array * * @example * var constantFunction = require( '@stdlib/utils/constant-function' ); * * var out = filledndBy( [ 1, 3 ], constantFunction( 1.0 ) ); * // returns [ [ 1.0, 1.0, 1.0 ] ] */ declare function filledndBy( shape: Shape2D, clbk: Callback, thisArg?: ThisParameterType> ): Array2D; /** * Creates a filled three-dimensional nested array according to a provided callback function. * * @param shape - array shape * @param clbk - callback function * @param thisArg - callback execution context * @returns output array * * @example * var constantFunction = require( '@stdlib/utils/constant-function' ); * * var out = filledndBy( [ 1, 1, 3 ], constantFunction( 1.0 ) ); * // returns [ [ [ 1.0, 1.0, 1.0 ] ] ] */ declare function filledndBy( shape: Shape3D, clbk: Callback, thisArg?: ThisParameterType> ): Array3D; /** * Creates a filled four-dimensional nested array according to a provided callback function. * * @param shape - array shape * @param clbk - callback function * @param thisArg - callback execution context * @returns output array * * @example * var constantFunction = require( '@stdlib/utils/constant-function' ); * * var out = filledndBy( [ 1, 1, 1, 3 ], constantFunction( 1.0 ) ); * // returns [ [ [ [ 1.0, 1.0, 1.0 ] ] ] ] */ declare function filledndBy( shape: Shape4D, clbk: Callback, thisArg?: ThisParameterType> ): Array4D; /** * Creates a filled five-dimensional nested array according to a provided callback function. * * @param shape - array shape * @param clbk - callback function * @param thisArg - callback execution context * @returns output array * * @example * var constantFunction = require( '@stdlib/utils/constant-function' ); * * var out = filledndBy( [ 1, 1, 1, 1, 3 ], constantFunction( 1.0 ) ); * // returns [ [ [ [ [ 1.0, 1.0, 1.0 ] ] ] ] ] */ declare function filledndBy( shape: Shape5D, clbk: Callback, thisArg?: ThisParameterType> ): Array5D; /** * Creates a filled six-dimensional nested array according to a provided callback function. * * @param shape - array shape * @param clbk - callback function * @param thisArg - callback execution context * @returns output array * * @example * var constantFunction = require( '@stdlib/utils/constant-function' ); * * var out = filledndBy( [ 1, 1, 1, 1, 1, 3 ], constantFunction( 1.0 ) ); * // returns [ [ [ [ [ [ 1.0, 1.0, 1.0 ] ] ] ] ] ] */ declare function filledndBy( shape: Shape6D, clbk: Callback, thisArg?: ThisParameterType> ): Array6D; /** * Creates a filled seven-dimensional nested array according to a provided callback function. * * @param shape - array shape * @param clbk - callback function * @param thisArg - callback execution context * @returns output array * * @example * var constantFunction = require( '@stdlib/utils/constant-function' ); * * var out = filledndBy( [ 1, 1, 1, 1, 1, 1, 3 ], constantFunction( 1.0 ) ); * // returns [ [ [ [ [ [ [ 1.0, 1.0, 1.0 ] ] ] ] ] ] ] */ declare function filledndBy( shape: Shape7D, clbk: Callback, thisArg?: ThisParameterType> ): Array7D; /** * Creates a filled eight-dimensional nested array according to a provided callback function. * * @param shape - array shape * @param clbk - callback function * @param thisArg - callback execution context * @returns output array * * @example * var constantFunction = require( '@stdlib/utils/constant-function' ); * * var out = filledndBy( [ 1, 1, 1, 1, 1, 1, 1, 3 ], constantFunction( 1.0 ) ); * // returns [ [ [ [ [ [ [ [ 1.0, 1.0, 1.0 ] ] ] ] ] ] ] ] */ declare function filledndBy( shape: Shape8D, clbk: Callback, thisArg?: ThisParameterType> ): Array8D; /** * Creates a filled nine-dimensional nested array according to a provided callback function. * * @param shape - array shape * @param clbk - callback function * @param thisArg - callback execution context * @returns output array * * @example * var constantFunction = require( '@stdlib/utils/constant-function' ); * * var out = filledndBy( [ 1, 1, 1, 1, 1, 1, 1, 1, 3 ], constantFunction( 1.0 ) ); * // returns [ [ [ [ [ [ [ [ [ 1.0, 1.0, 1.0 ] ] ] ] ] ] ] ] ] */ declare function filledndBy( shape: Shape9D, clbk: Callback, thisArg?: ThisParameterType> ): Array9D; /** * Creates a filled ten-dimensional nested array according to a provided callback function. * * @param shape - array shape * @param clbk - callback function * @param thisArg - callback execution context * @returns output array * * @example * var constantFunction = require( '@stdlib/utils/constant-function' ); * * var out = filledndBy( [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 3 ], constantFunction( 1.0 ) ); * // returns [ [ [ [ [ [ [ [ [ [ 1.0, 1.0, 1.0 ] ] ] ] ] ] ] ] ] ] */ declare function filledndBy( shape: Shape10D, clbk: Callback, thisArg?: ThisParameterType> ): Array10D; /** * Creates a filled n-dimensional nested array according to a provided callback function. * * @param shape - array shape * @param clbk - callback function * @param thisArg - callback execution context * @returns output array * * @example * var constantFunction = require( '@stdlib/utils/constant-function' ); * * var out = filledndBy( [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3 ], constantFunction( 1.0 ) ); * // returns [ [ [ [ [ [ [ [ [ [ [ 1.0, 1.0, 1.0 ] ] ] ] ] ] ] ] ] ] */ declare function filledndBy( shape: Shape, clbk: Callback, thisArg?: ThisParameterType> ): Array; // EXPORTS // export = filledndBy;