/* * @license Apache-2.0 * * Copyright (c) 2021 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 { Collection } from '@stdlib/types/array'; /** * Returns an accessed value. * * @returns accessed value */ type Nullary = ( this: V ) => number | void; /** * Returns an accessed value. * * @param value - array element * @returns accessed value */ type Unary = ( this: V, value: T ) => number | void; /** * Returns an accessed value. * * @param value - array element * @param idx - iteration index * @returns accessed value */ type Binary = ( this: V, value: T, idx: number ) => number | void; /** * Returns an accessed value. * * @param value - array element * @param idx - iteration index * @param xi - strided index (offsetX + idx*strideX) * @returns accessed value */ type Ternary = ( this: V, value: T, idx: number, xi: number ) => number | void; /** * Returns an accessed value. * * @param value - array element * @param idx - iteration index * @param xi - strided index (offsetX + idx*strideX) * @param yi - strided index (offsetY + idx*strideY) * @returns accessed value */ type Quaternary = ( this: V, value: T, idx: number, xi: number, yi: number ) => number | void; /** * Returns an accessed value. * * @param value - array element * @param idx - iteration index * @param xi - strided index (offsetX + idx*strideX) * @param yi - strided index (offsetY + idx*strideY) * @param x - input array * @returns accessed value */ type Quinary = ( this: V, value: T, idx: number, xi: number, yi: number, x: Collection ) => number | void; /** * Returns an accessed value. * * @param value - array element * @param idx - iteration index * @param xi - strided index (offsetX + idx*strideX) * @param yi - strided index (offsetY + idx*strideY) * @param x - input array * @param y - output array * @returns accessed value */ type Senary = ( this: V, value: T, idx: number, xi: number, yi: number, x: Collection, y: Collection ) => number | void; /** * Returns an accessed value. * * @param value - array element * @param idx - iteration index * @param xi - strided index (offsetX + idx*strideX) * @param yi - strided index (offsetY + idx*strideY) * @param x - input array * @param y - output array * @returns accessed value */ type Callback = Nullary | Unary | Binary | Ternary | Quaternary | Quinary | Senary; /** * Interface describing `aversinBy`. */ interface Routine { /** * Computes the inverse versed sine of each element retrieved from an input strided array `x` via a callback function and assigns each result to an element in an output strided array `y`. * * @param N - number of indexed elements * @param x - input array * @param strideX - `x` stride length * @param y - destination array * @param strideY - `y` stride length * @param clbk - callback function * @param thisArg - callback execution context * @returns `y` * * @example * function accessor( v ) { * return v; * } * * var x = [ 0.0, 1.57, 0.5, 1.0, 1.25 ]; * var y = [ 0.0, 0.0, 0.0, 0.0, 0.0 ]; * * aversinBy( x.length, x, 1, y, 1, accessor ); * // y => [ 0.0, ~2.177, ~1.047, ~1.571, ~1.823 ] */ ( N: number, x: Collection, strideX: number, y: Collection, strideY: number, clbk: Callback, thisArg?: ThisParameterType> ): Collection; /** * Computes the inverse versed sine of each element retrieved from an input strided array `x` via a callback function and assigns each result to an element in an output strided array `y` using alternative indexing semantics. * * @param N - number of indexed elements * @param x - input array * @param strideX - `x` stride length * @param offsetX - starting index for `x` * @param y - destination array * @param strideY - `y` stride length * @param offsetY - starting index for `y` * @param clbk - callback function * @param thisArg - callback execution context * @returns `y` * * @example * function accessor( v ) { * return v; * } * * var x = [ 0.0, 1.57, 0.5, 1.0, 1.25 ]; * var y = [ 0.0, 0.0, 0.0, 0.0, 0.0 ]; * * aversinBy.ndarray( x.length, x, 1, 0, y, 1, 0, accessor ); * // y => [ 0.0, ~2.177, ~1.047, ~1.571, ~1.823 ] */ ndarray( N: number, x: Collection, strideX: number, offsetX: number, y: Collection, strideY: number, offsetY: number, clbk: Callback, thisArg?: ThisParameterType> ): Collection; } /** * Computes the inverse versed sine of each element retrieved from an input strided array `x` via a callback function and assigns each result to an element in an output strided array `y`. * * @param N - number of indexed elements * @param x - input array * @param strideX - `x` stride length * @param y - destination array * @param strideY - `y` stride length * @param clbk - callback function * @param thisArg - callback execution context * @returns `y` * * @example * function accessor( v ) { * return v; * } * * var x = [ 0.0, 1.57, 0.5, 1.0, 1.25 ]; * var y = [ 0.0, 0.0, 0.0, 0.0, 0.0 ]; * * aversinBy( x.length, x, 1, y, 1, accessor ); * // y => [ 0.0, ~2.177, ~1.047, ~1.571, ~1.823 ] * * @example * function accessor( v ) { * return v; * } * * var x = [ 0.0, 1.57, 0.5, 1.0, 1.25 ]; * var y = [ 0.0, 0.0, 0.0, 0.0, 0.0 ]; * * aversinBy.ndarray( x.length, x, 1, 0, y, 1, 0, accessor ); * // y => [ 0.0, ~2.177, ~1.047, ~1.571, ~1.823 ] */ declare var aversinBy: Routine; // EXPORTS // export = aversinBy;