/*
* @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.
*/
/* eslint-disable max-lines */
// TypeScript Version: 4.1
///
import { Collection, Array1D, Array2D, Array3D, Array4D, Array5D, Array6D, Array7D, Array8D, Array9D, Array10D } from '@stdlib/types/array';
/**
* One-dimensional array shape.
*/
type Shape1D = [ number ];
/**
* Two-dimensional array shape.
*/
type Shape2D = [ number, number ];
/**
* Three-dimensional array shape.
*/
type Shape3D = [ number, number, number ];
/**
* Four-dimensional array shape.
*/
type Shape4D = [ number, number, number, number ];
/**
* Five-dimensional array shape.
*/
type Shape5D = [ number, number, number, number, number ];
/**
* Six-dimensional array shape.
*/
type Shape6D = [ number, number, number, number, number, number ];
/**
* Seven-dimensional array shape.
*/
type Shape7D = [ number, number, number, number, number, number, number ];
/**
* Eight-dimensional array shape.
*/
type Shape8D = [ number, number, number, number, number, number, number, number ];
/**
* Nine-dimensional array shape.
*/
type Shape9D = [ number, number, number, number, number, number, number, number, number ];
/**
* Ten-dimensional array shape.
*/
type Shape10D = [ number, number, number, number, number, number, number, number, number, number ];
/**
* Nullary callback function.
*
* @returns result
*/
type Nullary = ( this: V ) => U;
/**
* Unary callback function.
*
* @param value - array element
* @returns result
*/
type Unary = ( this: V, value: T ) => U;
/**
* Binary callback function.
*
* @param value - array element
* @param indices - element indices
* @returns result
*/
type Binary = ( this: V, value: T, indices: Array ) => U; // TODO: could consider whether to make indices a tuple of fixed length, but would require Binary1D, Binary2D, etc, etc.
/**
* Ternary callback function.
*
* @param value - array element
* @param indices - element indices
* @param arr - input array
* @returns result
*/
type Ternary1D = ( this: V, value: T, indices: Array, arr: Array1D ) => U;
/**
* Ternary callback function.
*
* @param value - array element
* @param indices - element indices
* @param arr - input array
* @returns result
*/
type Ternary2D = ( this: V, value: T, indices: Array, arr: Array2D ) => U;
/**
* Ternary callback function.
*
* @param value - array element
* @param indices - element indices
* @param arr - input array
* @returns result
*/
type Ternary3D = ( this: V, value: T, indices: Array, arr: Array3D ) => U;
/**
* Ternary callback function.
*
* @param value - array element
* @param indices - element indices
* @param arr - input array
* @returns result
*/
type Ternary4D = ( this: V, value: T, indices: Array, arr: Array4D ) => U;
/**
* Ternary callback function.
*
* @param value - array element
* @param indices - element indices
* @param arr - input array
* @returns result
*/
type Ternary5D = ( this: V, value: T, indices: Array, arr: Array5D ) => U;
/**
* Ternary callback function.
*
* @param value - array element
* @param indices - element indices
* @param arr - input array
* @returns result
*/
type Ternary6D = ( this: V, value: T, indices: Array, arr: Array6D ) => U;
/**
* Ternary callback function.
*
* @param value - array element
* @param indices - element indices
* @param arr - input array
* @returns result
*/
type Ternary7D = ( this: V, value: T, indices: Array, arr: Array7D ) => U;
/**
* Ternary callback function.
*
* @param value - array element
* @param indices - element indices
* @param arr - input array
* @returns result
*/
type Ternary8D = ( this: V, value: T, indices: Array, arr: Array8D ) => U;
/**
* Ternary callback function.
*
* @param value - array element
* @param indices - element indices
* @param arr - input array
* @returns result
*/
type Ternary9D = ( this: V, value: T, indices: Array, arr: Array9D ) => U;
/**
* Ternary callback function.
*
* @param value - array element
* @param indices - element indices
* @param arr - input array
* @returns result
*/
type Ternary10D = ( this: V, value: T, indices: Array, arr: Array10D ) => U;
/**
* Callback function.
*
* @param value - array element
* @param indices - element indices
* @param arr - input array
* @returns result
*/
type Callback1D = Nullary | Unary | Binary | Ternary1D;
/**
* Callback function.
*
* @param value - array element
* @param indices - element indices
* @param arr - input array
* @returns result
*/
type Callback2D = Nullary | Unary | Binary | Ternary2D;
/**
* Callback function.
*
* @param value - array element
* @param indices - element indices
* @param arr - input array
* @returns result
*/
type Callback3D = Nullary | Unary | Binary | Ternary3D;
/**
* Callback function.
*
* @param value - array element
* @param indices - element indices
* @param arr - input array
* @returns result
*/
type Callback4D = Nullary | Unary | Binary | Ternary4D;
/**
* Callback function.
*
* @param value - array element
* @param indices - element indices
* @param arr - input array
* @returns result
*/
type Callback5D = Nullary | Unary | Binary | Ternary5D;
/**
* Callback function.
*
* @param value - array element
* @param indices - element indices
* @param arr - input array
* @returns result
*/
type Callback6D = Nullary | Unary | Binary | Ternary6D;
/**
* Callback function.
*
* @param value - array element
* @param indices - element indices
* @param arr - input array
* @returns result
*/
type Callback7D = Nullary | Unary | Binary | Ternary7D;
/**
* Callback function.
*
* @param value - array element
* @param indices - element indices
* @param arr - input array
* @returns result
*/
type Callback8D = Nullary | Unary | Binary | Ternary8D;
/**
* Callback function.
*
* @param value - array element
* @param indices - element indices
* @param arr - input array
* @returns result
*/
type Callback9D = Nullary | Unary | Binary | Ternary9D;
/**
* Callback function.
*
* @param value - array element
* @param indices - element indices
* @param arr - input array
* @returns result
*/
type Callback10D = Nullary | Unary | Binary | Ternary10D;
/**
* Interface describing `flattenBy`.
*/
interface FlattenBy {
/**
* Flattens a one-dimensional nested array according to a callback function.
*
* @param x - input array
* @param shape - array shape
* @param colexicographic - specifies whether to flatten array values in colexicographic order
* @param clbk - callback function
* @param thisArg - callback execution context
* @returns flattened array
*
* @example
* function scale( v ) {
* return v * 2;
* }
*
* var x = [ 1, 2 ];
*
* var out = flattenBy( x, [ 2 ], false, scale );
* // returns [ 2, 4 ]
*
* @example
* function scale( v ) {
* return v * 2;
* }
*
* var x = [ 1, 2 ];
*
* var out = flattenBy( x, [ 2 ], true, scale );
* // returns [ 2, 4 ]
*/
( x: Array1D, shape: Shape1D, colexicographic: boolean, clbk: Callback1D, thisArg?: ThisParameterType> ): Array;
/**
* Flattens a two-dimensional nested array according to a callback function.
*
* ## Notes
*
* - The function assumes that all nested arrays have the same length (i.e., the input array is **not** a ragged array).
*
* @param x - input array
* @param shape - array shape
* @param colexicographic - specifies whether to flatten array values in colexicographic order
* @param clbk - callback function
* @param thisArg - callback execution context
* @returns flattened array
*
* @example
* function scale( v ) {
* return v * 2;
* }
*
* var x = [ [ 1, 2 ], [ 3, 4 ] ];
*
* var out = flattenBy( x, [ 2, 2 ], false, scale );
* // returns [ 1, 2, 3, 4 ]
*
* @example
* function scale( v ) {
* return v * 2;
* }
*
* var x = [ [ 1, 2 ], [ 3, 4 ] ];
*
* var out = flattenBy( x, [ 2, 2 ], true, scale );
* // returns [ 1, 3, 2, 4 ]
*/
( x: Array2D, shape: Shape2D, colexicographic: boolean, clbk: Callback2D, thisArg?: ThisParameterType> ): Array;
/**
* Flattens a three-dimensional nested array according to a callback function.
*
* ## Notes
*
* - The function assumes that all nested arrays have the same length (i.e., the input array is **not** a ragged array).
*
* @param x - input array
* @param shape - array shape
* @param colexicographic - specifies whether to flatten array values in colexicographic order
* @param clbk - callback function
* @param thisArg - callback execution context
* @returns flattened array
*
* @example
* function scale( v ) {
* return v * 2;
* }
*
* var x = [ [ [ 1, 2 ], [ 3, 4 ] ] ];
*
* var out = flattenBy( x, [ 1, 2, 2 ], false, scale );
* // returns [ 1, 2, 3, 4 ]
*
* @example
* function scale( v ) {
* return v * 2;
* }
*
* var x = [ [ [ 1, 2 ], [ 3, 4 ] ] ];
*
* var out = flattenBy( x, [ 1, 2, 2 ], true, scale );
* // returns [ 1, 3, 2, 4 ]
*/
( x: Array3D, shape: Shape3D, colexicographic: boolean, clbk: Callback3D, thisArg?: ThisParameterType> ): Array;
/**
* Flattens a four-dimensional nested array according to a callback function.
*
* ## Notes
*
* - The function assumes that all nested arrays have the same length (i.e., the input array is **not** a ragged array).
*
* @param x - input array
* @param shape - array shape
* @param colexicographic - specifies whether to flatten array values in colexicographic order
* @param clbk - callback function
* @param thisArg - callback execution context
* @returns flattened array
*
* @example
* function scale( v ) {
* return v * 2;
* }
*
* var x = [ [ [ [ 1, 2 ], [ 3, 4 ] ] ] ];
*
* var out = flattenBy( x, [ 1, 1, 2, 2 ], false, scale );
* // returns [ 1, 2, 3, 4 ]
*
* @example
* function scale( v ) {
* return v * 2;
* }
*
* var x = [ [ [ [ 1, 2 ], [ 3, 4 ] ] ] ];
*
* var out = flattenBy( x, [ 1, 1, 2, 2 ], true, scale );
* // returns [ 1, 3, 2, 4 ]
*/
( x: Array4D, shape: Shape4D, colexicographic: boolean, clbk: Callback4D, thisArg?: ThisParameterType> ): Array;
/**
* Flattens a five-dimensional nested array according to a callback function.
*
* ## Notes
*
* - The function assumes that all nested arrays have the same length (i.e., the input array is **not** a ragged array).
*
* @param x - input array
* @param shape - array shape
* @param colexicographic - specifies whether to flatten array values in colexicographic order
* @param clbk - callback function
* @param thisArg - callback execution context
* @returns flattened array
*
* @example
* function scale( v ) {
* return v * 2;
* }
*
* var x = [ [ [ [ [ 1, 2 ], [ 3, 4 ] ] ] ] ];
*
* var out = flattenBy( x, [ 1, 1, 1, 2, 2 ], false, scale );
* // returns [ 1, 2, 3, 4 ]
*
* @example
* function scale( v ) {
* return v * 2;
* }
*
* var x = [ [ [ [ [ 1, 2 ], [ 3, 4 ] ] ] ] ];
*
* var out = flattenBy( x, [ 1, 1, 1, 2, 2 ], true, scale );
* // returns [ 1, 3, 2, 4 ]
*/
( x: Array5D, shape: Shape5D, colexicographic: boolean, clbk: Callback5D, thisArg?: ThisParameterType> ): Array;
/**
* Flattens a six-dimensional nested array according to a callback function.
*
* ## Notes
*
* - The function assumes that all nested arrays have the same length (i.e., the input array is **not** a ragged array).
*
* @param x - input array
* @param shape - array shape
* @param colexicographic - specifies whether to flatten array values in colexicographic order
* @param clbk - callback function
* @param thisArg - callback execution context
* @returns flattened array
*
* @example
* function scale( v ) {
* return v * 2;
* }
*
* var x = [ [ [ [ [ [ 1, 2 ], [ 3, 4 ] ] ] ] ] ];
*
* var out = flattenBy( x, [ 1, 1, 1, 1, 2, 2 ], false, scale );
* // returns [ 1, 2, 3, 4 ]
*
* @example
* function scale( v ) {
* return v * 2;
* }
*
* var x = [ [ [ [ [ [ 1, 2 ], [ 3, 4 ] ] ] ] ] ];
*
* var out = flattenBy( x, [ 1, 1, 1, 1, 2, 2 ], true, scale );
* // returns [ 1, 3, 2, 4 ]
*/
( x: Array6D, shape: Shape6D, colexicographic: boolean, clbk: Callback6D, thisArg?: ThisParameterType> ): Array;
/**
* Flattens a seven-dimensional nested array according to a callback function.
*
* ## Notes
*
* - The function assumes that all nested arrays have the same length (i.e., the input array is **not** a ragged array).
*
* @param x - input array
* @param shape - array shape
* @param colexicographic - specifies whether to flatten array values in colexicographic order
* @param clbk - callback function
* @param thisArg - callback execution context
* @returns flattened array
*
* @example
* function scale( v ) {
* return v * 2;
* }
*
* var x = [ [ [ [ [ [ [ 1, 2 ], [ 3, 4 ] ] ] ] ] ] ];
*
* var out = flattenBy( x, [ 1, 1, 1, 1, 1, 2, 2 ], false, scale );
* // returns [ 1, 2, 3, 4 ]
*
* @example
* function scale( v ) {
* return v * 2;
* }
*
* var x = [ [ [ [ [ [ [ 1, 2 ], [ 3, 4 ] ] ] ] ] ] ];
*
* var out = flattenBy( x, [ 1, 1, 1, 1, 1, 2, 2 ], true, scale );
* // returns [ 1, 3, 2, 4 ]
*/
( x: Array7D, shape: Shape7D, colexicographic: boolean, clbk: Callback7D, thisArg?: ThisParameterType> ): Array;
/**
* Flattens an eight-dimensional nested array according to a callback function.
*
* ## Notes
*
* - The function assumes that all nested arrays have the same length (i.e., the input array is **not** a ragged array).
*
* @param x - input array
* @param shape - array shape
* @param colexicographic - specifies whether to flatten array values in colexicographic order
* @param clbk - callback function
* @param thisArg - callback execution context
* @returns flattened array
*
* @example
* function scale( v ) {
* return v * 2;
* }
*
* var x = [ [ [ [ [ [ [ [ 1, 2 ], [ 3, 4 ] ] ] ] ] ] ] ];
*
* var out = flattenBy( x, [ 1, 1, 1, 1, 1, 1, 2, 2 ], false, scale );
* // returns [ 1, 2, 3, 4 ]
*
* @example
* function scale( v ) {
* return v * 2;
* }
*
* var x = [ [ [ [ [ [ [ [ 1, 2 ], [ 3, 4 ] ] ] ] ] ] ] ];
*
* var out = flattenBy( x, [ 1, 1, 1, 1, 1, 1, 2, 2 ], true, scale );
* // returns [ 1, 3, 2, 4 ]
*/
( x: Array8D, shape: Shape8D, colexicographic: boolean, clbk: Callback8D, thisArg?: ThisParameterType> ): Array;
/**
* Flattens a nine-dimensional nested array according to a callback function.
*
* ## Notes
*
* - The function assumes that all nested arrays have the same length (i.e., the input array is **not** a ragged array).
*
* @param x - input array
* @param shape - array shape
* @param colexicographic - specifies whether to flatten array values in colexicographic order
* @param clbk - callback function
* @param thisArg - callback execution context
* @returns flattened array
*
* @example
* function scale( v ) {
* return v * 2;
* }
*
* var x = [ [ [ [ [ [ [ [ [ 1, 2 ], [ 3, 4 ] ] ] ] ] ] ] ] ];
*
* var out = flattenBy( x, [ 1, 1, 1, 1, 1, 1, 1, 2, 2 ], false, scale );
* // returns [ 1, 2, 3, 4 ]
*
* @example
* function scale( v ) {
* return v * 2;
* }
*
* var x = [ [ [ [ [ [ [ [ [ 1, 2 ], [ 3, 4 ] ] ] ] ] ] ] ] ];
*
* var out = flattenBy( x, [ 1, 1, 1, 1, 1, 1, 1, 2, 2 ], true, scale );
* // returns [ 1, 3, 2, 4 ]
*/
( x: Array9D, shape: Shape9D, colexicographic: boolean, clbk: Callback9D, thisArg?: ThisParameterType> ): Array;
/**
* Flattens a ten-dimensional nested array according to a callback function.
*
* ## Notes
*
* - The function assumes that all nested arrays have the same length (i.e., the input array is **not** a ragged array).
*
* @param x - input array
* @param shape - array shape
* @param colexicographic - specifies whether to flatten array values in colexicographic order
* @param clbk - callback function
* @param thisArg - callback execution context
* @returns flattened array
*
* @example
* function scale( v ) {
* return v * 2;
* }
*
* var x = [ [ [ [ [ [ [ [ [ [ 1, 2 ], [ 3, 4 ] ] ] ] ] ] ] ] ] ];
*
* var out = flattenBy( x, [ 1, 1, 1, 1, 1, 1, 1, 1, 2, 2 ], false, scale );
* // returns [ 1, 2, 3, 4 ]
*
* @example
* function scale( v ) {
* return v * 2;
* }
*
* var x = [ [ [ [ [ [ [ [ [ [ 1, 2 ], [ 3, 4 ] ] ] ] ] ] ] ] ] ];
*
* var out = flattenBy( x, [ 1, 1, 1, 1, 1, 1, 1, 1, 2, 2 ], true, scale );
* // returns [ 1, 3, 2, 4 ]
*/
( x: Array10D, shape: Shape10D, colexicographic: boolean, clbk: Callback10D, thisArg?: ThisParameterType> ): Array;
/**
* Flattens a one-dimensional nested array according to a callback function and assigns elements to a provided output array.
*
* @param x - input array
* @param shape - array shape
* @param colexicographic - specifies whether to flatten array values in colexicographic order
* @param out - output array
* @param stride - output array stride
* @param offset - output array index offset
* @param clbk - callback function
* @param thisArg - callback execution context
* @returns output array
*
* @example
* var Float64Array = require( './../../../../float64' );
*
* function scale( v ) {
* return v * 2;
* }
*
* var x = [ 1, 2 ];
*
* var out = flattenBy.assign( x, [ 2 ], false, new Float64Array( 2 ), 1, 0, scale );
* // returns [ 2, 4 ]
*
* @example
* var Float64Array = require( './../../../../float64' );
*
* function scale( v ) {
* return v * 2;
* }
*
* var x = [ 1, 2 ];
*
* var out = flattenBy.assign( x, [ 2 ], true, new Float64Array( 2 ), 1, 0, scale );
* // returns [ 2, 4 ]
*/
assign( x: Array1D, shape: Shape1D, colexicographic: boolean, out: Collection, stride: number, offset: number, clbk: Callback1D, thisArg?: ThisParameterType> ): Collection;
/**
* Flattens a two-dimensional nested array according to a callback function and assigns elements to a provided output array.
*
* ## Notes
*
* - The function assumes that all nested arrays have the same length (i.e., the input array is **not** a ragged array).
*
* @param x - input array
* @param shape - array shape
* @param colexicographic - specifies whether to flatten array values in colexicographic order
* @param out - output array
* @param stride - output array stride
* @param offset - output array index offset
* @param clbk - callback function
* @param thisArg - callback execution context
* @returns output array
*
* @example
* var Float64Array = require( './../../../../float64' );
*
* function scale( v ) {
* return v * 2;
* }
*
* var x = [ [ 1, 2 ], [ 3, 4 ] ];
*
* var out = flattenBy.assign( x, [ 2, 2 ], false, new Float64Array( 4 ), 1, 0, scale );
* // returns [ 1, 2, 3, 4 ]
*
* @example
* var Float64Array = require( './../../../../float64' );
*
* function scale( v ) {
* return v * 2;
* }
*
* var x = [ [ 1, 2 ], [ 3, 4 ] ];
*
* var out = flattenBy.assign( x, [ 2, 2 ], true, new Float64Array( 4 ), 1, 0, scale );
* // returns [ 1, 3, 2, 4 ]
*/
assign( x: Array2D, shape: Shape2D, colexicographic: boolean, out: Collection, stride: number, offset: number, clbk: Callback2D, thisArg?: ThisParameterType> ): Collection;
/**
* Flattens a three-dimensional nested array according to a callback function and assigns elements to a provided output array.
*
* ## Notes
*
* - The function assumes that all nested arrays have the same length (i.e., the input array is **not** a ragged array).
*
* @param x - input array
* @param shape - array shape
* @param colexicographic - specifies whether to flatten array values in colexicographic order
* @param out - output array
* @param stride - output array stride
* @param offset - output array index offset
* @param clbk - callback function
* @param thisArg - callback execution context
* @returns output array
*
* @example
* var Float64Array = require( './../../../../float64' );
*
* function scale( v ) {
* return v * 2;
* }
*
* var x = [ [ [ 1, 2 ], [ 3, 4 ] ] ];
*
* var out = flattenBy.assign( x, [ 1, 2, 2 ], false, new Float64Array( 4 ), 1, 0, scale );
* // returns [ 1, 2, 3, 4 ]
*
* @example
* var Float64Array = require( './../../../../float64' );
*
* function scale( v ) {
* return v * 2;
* }
*
* var x = [ [ [ 1, 2 ], [ 3, 4 ] ] ];
*
* var out = flattenBy.assign( x, [ 1, 2, 2 ], true, new Float64Array( 4 ), 1, 0, scale );
* // returns [ 1, 3, 2, 4 ]
*/
assign( x: Array3D, shape: Shape3D, colexicographic: boolean, out: Collection, stride: number, offset: number, clbk: Callback3D, thisArg?: ThisParameterType> ): Collection;
/**
* Flattens a four-dimensional nested array according to a callback function and assigns elements to a provided output array.
*
* ## Notes
*
* - The function assumes that all nested arrays have the same length (i.e., the input array is **not** a ragged array).
*
* @param x - input array
* @param shape - array shape
* @param colexicographic - specifies whether to flatten array values in colexicographic order
* @param out - output array
* @param stride - output array stride
* @param offset - output array index offset
* @param clbk - callback function
* @param thisArg - callback execution context
* @returns output array
*
* @example
* var Float64Array = require( './../../../../float64' );
*
* function scale( v ) {
* return v * 2;
* }
*
* var x = [ [ [ [ 1, 2 ], [ 3, 4 ] ] ] ];
*
* var out = flattenBy.assign( x, [ 1, 1, 2, 2 ], false, new Float64Array( 4 ), 1, 0, scale );
* // returns [ 1, 2, 3, 4 ]
*
* @example
* var Float64Array = require( './../../../../float64' );
*
* function scale( v ) {
* return v * 2;
* }
*
* var x = [ [ [ [ 1, 2 ], [ 3, 4 ] ] ] ];
*
* var out = flattenBy.assign( x, [ 1, 1, 2, 2 ], true, new Float64Array( 4 ), 1, 0, scale );
* // returns [ 1, 3, 2, 4 ]
*/
assign( x: Array4D, shape: Shape4D, colexicographic: boolean, out: Collection, stride: number, offset: number, clbk: Callback4D, thisArg?: ThisParameterType> ): Collection;
/**
* Flattens a five-dimensional nested array according to a callback function and assigns elements to a provided output array.
*
* ## Notes
*
* - The function assumes that all nested arrays have the same length (i.e., the input array is **not** a ragged array).
*
* @param x - input array
* @param shape - array shape
* @param colexicographic - specifies whether to flatten array values in colexicographic order
* @param out - output array
* @param stride - output array stride
* @param offset - output array index offset
* @param clbk - callback function
* @param thisArg - callback execution context
* @returns output array
*
* @example
* var Float64Array = require( './../../../../float64' );
*
* function scale( v ) {
* return v * 2;
* }
*
* var x = [ [ [ [ [ 1, 2 ], [ 3, 4 ] ] ] ] ];
*
* var out = flattenBy.assign( x, [ 1, 1, 1, 2, 2 ], false, new Float64Array( 4 ), 1, 0, scale );
* // returns [ 1, 2, 3, 4 ]
*
* @example
* var Float64Array = require( './../../../../float64' );
*
* function scale( v ) {
* return v * 2;
* }
*
* var x = [ [ [ [ [ 1, 2 ], [ 3, 4 ] ] ] ] ];
*
* var out = flattenBy.assign( x, [ 1, 1, 1, 2, 2 ], true, new Float64Array( 4 ), 1, 0, scale );
* // returns [ 1, 3, 2, 4 ]
*/
assign( x: Array5D, shape: Shape5D, colexicographic: boolean, out: Collection, stride: number, offset: number, clbk: Callback5D, thisArg?: ThisParameterType> ): Collection;
/**
* Flattens a six-dimensional nested array according to a callback function and assigns elements to a provided output array.
*
* ## Notes
*
* - The function assumes that all nested arrays have the same length (i.e., the input array is **not** a ragged array).
*
* @param x - input array
* @param shape - array shape
* @param colexicographic - specifies whether to flatten array values in colexicographic order
* @param out - output array
* @param stride - output array stride
* @param offset - output array index offset
* @param clbk - callback function
* @param thisArg - callback execution context
* @returns output array
*
* @example
* var Float64Array = require( './../../../../float64' );
*
* function scale( v ) {
* return v * 2;
* }
*
* var x = [ [ [ [ [ [ 1, 2 ], [ 3, 4 ] ] ] ] ] ];
*
* var out = flattenBy.assign( x, [ 1, 1, 1, 1, 2, 2 ], false, new Float64Array( 4 ), 1, 0, scale );
* // returns [ 1, 2, 3, 4 ]
*
* @example
* var Float64Array = require( './../../../../float64' );
*
* function scale( v ) {
* return v * 2;
* }
*
* var x = [ [ [ [ [ [ 1, 2 ], [ 3, 4 ] ] ] ] ] ];
*
* var out = flattenBy.assign( x, [ 1, 1, 1, 1, 2, 2 ], true, new Float64Array( 4 ), 1, 0, scale );
* // returns [ 1, 3, 2, 4 ]
*/
assign( x: Array6D, shape: Shape6D, colexicographic: boolean, out: Collection, stride: number, offset: number, clbk: Callback6D, thisArg?: ThisParameterType> ): Collection;
/**
* Flattens a seven-dimensional nested array according to a callback function and assigns elements to a provided output array.
*
* ## Notes
*
* - The function assumes that all nested arrays have the same length (i.e., the input array is **not** a ragged array).
*
* @param x - input array
* @param shape - array shape
* @param colexicographic - specifies whether to flatten array values in colexicographic order
* @param out - output array
* @param stride - output array stride
* @param offset - output array index offset
* @param clbk - callback function
* @param thisArg - callback execution context
* @returns output array
*
* @example
* var Float64Array = require( './../../../../float64' );
*
* function scale( v ) {
* return v * 2;
* }
*
* var x = [ [ [ [ [ [ [ 1, 2 ], [ 3, 4 ] ] ] ] ] ] ];
*
* var out = flattenBy.assign( x, [ 1, 1, 1, 1, 1, 2, 2 ], false, new Float64Array( 4 ), 1, 0, scale );
* // returns [ 1, 2, 3, 4 ]
*
* @example
* var Float64Array = require( './../../../../float64' );
*
* function scale( v ) {
* return v * 2;
* }
*
* var x = [ [ [ [ [ [ [ 1, 2 ], [ 3, 4 ] ] ] ] ] ] ];
*
* var out = flattenBy.assign( x, [ 1, 1, 1, 1, 1, 2, 2 ], true, new Float64Array( 4 ), 1, 0, scale );
* // returns [ 1, 3, 2, 4 ]
*/
assign( x: Array7D, shape: Shape7D, colexicographic: boolean, out: Collection, stride: number, offset: number, clbk: Callback7D, thisArg?: ThisParameterType> ): Collection;
/**
* Flattens an eight-dimensional nested array according to a callback function and assigns elements to a provided output array.
*
* ## Notes
*
* - The function assumes that all nested arrays have the same length (i.e., the input array is **not** a ragged array).
*
* @param x - input array
* @param shape - array shape
* @param colexicographic - specifies whether to flatten array values in colexicographic order
* @param out - output array
* @param stride - output array stride
* @param offset - output array index offset
* @param clbk - callback function
* @param thisArg - callback execution context
* @returns output array
*
* @example
* var Float64Array = require( './../../../../float64' );
*
* function scale( v ) {
* return v * 2;
* }
*
* var x = [ [ [ [ [ [ [ [ 1, 2 ], [ 3, 4 ] ] ] ] ] ] ] ];
*
* var out = flattenBy.assign( x, [ 1, 1, 1, 1, 1, 1, 2, 2 ], false, new Float64Array( 4 ), 1, 0, scale );
* // returns [ 1, 2, 3, 4 ]
*
* @example
* var Float64Array = require( './../../../../float64' );
*
* function scale( v ) {
* return v * 2;
* }
*
* var x = [ [ [ [ [ [ [ [ 1, 2 ], [ 3, 4 ] ] ] ] ] ] ] ];
*
* var out = flattenBy.assign( x, [ 1, 1, 1, 1, 1, 1, 2, 2 ], true, new Float64Array( 4 ), 1, 0, scale );
* // returns [ 1, 3, 2, 4 ]
*/
assign( x: Array8D, shape: Shape8D, colexicographic: boolean, out: Collection, stride: number, offset: number, clbk: Callback8D, thisArg?: ThisParameterType> ): Collection;
/**
* Flattens a nine-dimensional nested array according to a callback function and assigns elements to a provided output array.
*
* ## Notes
*
* - The function assumes that all nested arrays have the same length (i.e., the input array is **not** a ragged array).
*
* @param x - input array
* @param shape - array shape
* @param colexicographic - specifies whether to flatten array values in colexicographic order
* @param out - output array
* @param stride - output array stride
* @param offset - output array index offset
* @param clbk - callback function
* @param thisArg - callback execution context
* @returns output array
*
* @example
* var Float64Array = require( './../../../../float64' );
*
* function scale( v ) {
* return v * 2;
* }
*
* var x = [ [ [ [ [ [ [ [ [ 1, 2 ], [ 3, 4 ] ] ] ] ] ] ] ] ];
*
* var out = flattenBy.assign( x, [ 1, 1, 1, 1, 1, 1, 1, 2, 2 ], false, new Float64Array( 4 ), 1, 0, scale );
* // returns [ 1, 2, 3, 4 ]
*
* @example
* var Float64Array = require( './../../../../float64' );
*
* function scale( v ) {
* return v * 2;
* }
*
* var x = [ [ [ [ [ [ [ [ [ 1, 2 ], [ 3, 4 ] ] ] ] ] ] ] ] ];
*
* var out = flattenBy.assign( x, [ 1, 1, 1, 1, 1, 1, 1, 2, 2 ], true, new Float64Array( 4 ), 1, 0, scale );
* // returns [ 1, 3, 2, 4 ]
*/
assign( x: Array9D, shape: Shape9D, colexicographic: boolean, out: Collection, stride: number, offset: number, clbk: Callback9D, thisArg?: ThisParameterType> ): Collection;
/**
* Flattens a ten-dimensional nested array according to a callback function and assigns elements to a provided output array.
*
* ## Notes
*
* - The function assumes that all nested arrays have the same length (i.e., the input array is **not** a ragged array).
*
* @param x - input array
* @param shape - array shape
* @param colexicographic - specifies whether to flatten array values in colexicographic order
* @param out - output array
* @param stride - output array stride
* @param offset - output array index offset
* @param clbk - callback function
* @param thisArg - callback execution context
* @returns output array
*
* @example
* var Float64Array = require( './../../../../float64' );
*
* function scale( v ) {
* return v * 2;
* }
*
* var x = [ [ [ [ [ [ [ [ [ [ 1, 2 ], [ 3, 4 ] ] ] ] ] ] ] ] ] ];
*
* var out = flattenBy.assign( x, [ 1, 1, 1, 1, 1, 1, 1, 1, 2, 2 ], false, new Float64Array( 4 ), 1, 0, scale );
* // returns [ 1, 2, 3, 4 ]
*
* @example
* var Float64Array = require( './../../../../float64' );
*
* function scale( v ) {
* return v * 2;
* }
*
* var x = [ [ [ [ [ [ [ [ [ [ 1, 2 ], [ 3, 4 ] ] ] ] ] ] ] ] ] ];
*
* var out = flattenBy.assign( x, [ 1, 1, 1, 1, 1, 1, 1, 1, 2, 2 ], true, new Float64Array( 4 ), 1, 0, scale );
* // returns [ 1, 3, 2, 4 ]
*/
assign( x: Array10D, shape: Shape10D, colexicographic: boolean, out: Collection, stride: number, offset: number, clbk: Callback10D, thisArg?: ThisParameterType> ): Collection;
}
/**
* Flattens an n-dimensional nested array according to a callback function.
*
* ## Notes
*
* - The function assumes that all nested arrays have the same length (i.e., the input array is **not** a ragged array).
*
* @param x - input array
* @param shape - array shape
* @param colexicographic - specifies whether to flatten array values in colexicographic order
* @param clbk - callback function
* @param thisArg - callback execution context
* @returns flattened array
*
* @example
* function scale( v ) {
* return v * 2;
* }
*
* var x = [ [ 1, 2 ], [ 3, 4 ] ];
*
* var out = flattenBy( x, [ 2, 2 ], false, scale );
* // returns [ 1, 2, 3, 4 ]
*
* @example
* function scale( v ) {
* return v * 2;
* }
*
* var x = [ [ 1, 2 ], [ 3, 4 ] ];
*
* var out = flattenBy( x, [ 2, 2 ], true, scale );
* // returns [ 1, 3, 2, 4 ]
*/
declare var flattenBy: FlattenBy;
// EXPORTS //
export = flattenBy;