
{{alias}}( x, dim[, options], fcn[, thisArg] )
    Flattens an ndarray according to a callback function starting from a
    specified dimension.

    Parameters
    ----------
    x: ndarray
        Input ndarray. Must have one or more dimensions.

    dim: integer
        Dimension to start flattening from. If provided an integer less than
        zero, the dimension index is resolved relative to the last dimension,
        with the last dimension corresponding to the value `-1`.

    options: Object (optional)
        Function options.

    options.order: string (optional)
        Order in which input ndarray elements should be flattened. Must be one
        of the following:

        - 'row-major': flatten elements in lexicographic order.
        - 'column-major': flatten elements in colexicographic order.
        - 'any': flatten according to the physical layout of the input ndarray
        data in memory, regardless of the stated order of the input ndarray.
        - 'same': flatten according to the stated order of the input ndarray.

        Default: 'row-major'.

    options.dtype: any (optional)
        Output ndarray data type. By default, the function returns an ndarray
        having the same data type as a provided input ndarray.

    fcn: Function
        Callback function.

    thisArg: any (optional)
        Callback execution context.

    Returns
    -------
    out: ndarray
        Output ndarray.

    Examples
    --------
    > var x = {{alias:@stdlib/ndarray/array}}( [ [ [ 1, 2 ], [ 3, 4 ] ] ] )
    <ndarray>
    > function scale( v ) { return v * 2.0; };
    > var y = {{alias}}( x, 1, scale )
    <ndarray>[ [ 2, 4, 6, 8 ] ]

    > x = {{alias:@stdlib/ndarray/array}}( [ [ [ 1, 2 ], [ 3, 4 ] ] ] )
    <ndarray>
    > y = {{alias}}( x, 0, { 'order': 'column-major' }, scale )
    <ndarray>[ 2, 6, 4, 8 ]

    > x = {{alias:@stdlib/ndarray/array}}( [ [ [ 1, 2 ], [ 3, 4 ] ] ] )
    <ndarray>
    > y = {{alias}}( x, 0, { 'dtype': 'float32' }, scale )
    <ndarray>[ 2, 4, 6, 8 ]

    See Also
    --------
