|
| 1 | +/* |
| 2 | +* @license Apache-2.0 |
| 3 | +* |
| 4 | +* Copyright (c) 2021 The Stdlib Authors. |
| 5 | +* |
| 6 | +* Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | +* you may not use this file except in compliance with the License. |
| 8 | +* You may obtain a copy of the License at |
| 9 | +* |
| 10 | +* http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | +* |
| 12 | +* Unless required by applicable law or agreed to in writing, software |
| 13 | +* distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | +* See the License for the specific language governing permissions and |
| 16 | +* limitations under the License. |
| 17 | +*/ |
| 18 | + |
| 19 | +// TypeScript Version: 2.0 |
| 20 | + |
| 21 | +/* tslint:disable:max-line-length */ |
| 22 | +/* tslint:disable:max-file-line-count */ |
| 23 | + |
| 24 | +import unary = require( '@stdlib/math/tools/unary' ); |
| 25 | + |
| 26 | +/** |
| 27 | +* Interface describing the `tools` namespace. |
| 28 | +*/ |
| 29 | +interface Namespace { |
| 30 | + /** |
| 31 | + * Returns a function which dispatches to specified functions based on input argument types. |
| 32 | + * |
| 33 | + * @param table - resolution table object |
| 34 | + * @throws must provide valid table fields |
| 35 | + * @throws table field values must be array-like objects having an even number of elements |
| 36 | + * @throws table field values must consist of dtype-function pairs |
| 37 | + * @returns dispatch function |
| 38 | + * |
| 39 | + * @example |
| 40 | + * var nabs = require( `@stdlib/math/base/special/abs` ); |
| 41 | + * var dabs = require( `@stdlib/math/strided/special/dabs` ); |
| 42 | + * var sabs = require( `@stdlib/math/strided/special/sabs` ); |
| 43 | + * var gabs = require( `@stdlib/math/strided/special/abs` ); |
| 44 | + * var Float64Array = require( `@stdlib/array/float64` ); |
| 45 | + * |
| 46 | + * var table = { |
| 47 | + * 'scalar': [ |
| 48 | + * 'number', nabs |
| 49 | + * ], |
| 50 | + * 'array': [ |
| 51 | + * 'float64', dabs, |
| 52 | + * 'float32', sabs, |
| 53 | + * 'generic', gabs |
| 54 | + * ], |
| 55 | + * 'ndarray': [ |
| 56 | + * 'float64', dabs.ndarray, |
| 57 | + * 'float32', sabs.ndarray, |
| 58 | + * 'generic', gabs.ndarray |
| 59 | + * ] |
| 60 | + * }; |
| 61 | + * |
| 62 | + * var abs = ns.unary( table ); |
| 63 | + * |
| 64 | + * var x = new Float64Array( [ -1.0, -2.0, -3.0 ] ); |
| 65 | + * var y = abs( x ); |
| 66 | + * // returns <Float64Array>[ 1.0, 2.0, 3.0 ] |
| 67 | + */ |
| 68 | + unary: typeof unary; |
| 69 | +} |
| 70 | + |
| 71 | +/** |
| 72 | +* Standard library math tools. |
| 73 | +*/ |
| 74 | +declare var ns: Namespace; |
| 75 | + |
| 76 | + |
| 77 | +// EXPORTS // |
| 78 | + |
| 79 | +export = ns; |
0 commit comments