Skip to content

Commit

Permalink
feat: update namespace TypeScript declarations
Browse files Browse the repository at this point in the history
PR-URL: #1122
Co-authored-by: Athan Reines <[email protected]>
Reviewed-by: Athan Reines <[email protected]>
  • Loading branch information
stdlib-bot and kgryte authored Oct 31, 2023
1 parent de17736 commit 7faffe3
Show file tree
Hide file tree
Showing 7 changed files with 1,681 additions and 15 deletions.
73 changes: 73 additions & 0 deletions lib/node_modules/@stdlib/array/base/docs/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import bbinary2d = require( '@stdlib/array/base/broadcasted-binary2d' );
import bbinary3d = require( '@stdlib/array/base/broadcasted-binary3d' );
import bbinary4d = require( '@stdlib/array/base/broadcasted-binary4d' );
import bbinary5d = require( '@stdlib/array/base/broadcasted-binary5d' );
import bternary2d = require( '@stdlib/array/base/broadcasted-ternary2d' );
import bunary2d = require( '@stdlib/array/base/broadcasted-unary2d' );
import bunary3d = require( '@stdlib/array/base/broadcasted-unary3d' );
import bunary4d = require( '@stdlib/array/base/broadcasted-unary4d' );
Expand Down Expand Up @@ -86,6 +87,7 @@ import ones5d = require( '@stdlib/array/base/ones5d' );
import onesnd = require( '@stdlib/array/base/onesnd' );
import setter = require( '@stdlib/array/base/setter' );
import take = require( '@stdlib/array/base/take' );
import ternary2d = require( '@stdlib/array/base/ternary2d' );
import toAccessorArray = require( '@stdlib/array/base/to-accessor-array' );
import unary2d = require( '@stdlib/array/base/unary2d' );
import unary2dBy = require( '@stdlib/array/base/unary2d-by' );
Expand Down Expand Up @@ -583,6 +585,44 @@ interface Namespace {
*/
bbinary5d: typeof bbinary5d;

/**
* Applies a ternary callback to elements in three broadcasted input arrays and assigns results to elements in a two-dimensional nested output array.
*
* ## Notes
*
* - The input array shapes must be broadcast compatible with the output array shape.
*
* @param arrays - array containing three input nested arrays and one output nested array
* @param shapes - array shapes
* @param fcn - ternary callback
*
* @example
* var ones2d = require( `@stdlib/array/base/ones2d` );
* var zeros2d = require( `@stdlib/array/base/zeros2d` );
*
* function add( x, y, z ) {
* return x + y + z;
* }
*
* var shapes = [
* [ 1, 2 ],
* [ 2, 1 ],
* [ 1, 1 ],
* [ 2, 2 ]
* ];
*
* var x = ones2d( shapes[ 0 ] );
* var y = ones2d( shapes[ 1 ] );
* var z = ones2d( shapes[ 2 ] );
* var out = zeros2d( shapes[ 3 ] );
*
* ns.bternary2d( [ x, y, z, out ], shapes, add );
*
* console.log( out );
* // => [ [ 3.0, 6.0 ], [ 9.0, 12.0 ] ]
*/
bternary2d: typeof bternary2d;

/**
* Applies a unary callback to elements in a broadcasted nested input array and assigns results to elements in a two-dimensional nested output array.
*
Expand Down Expand Up @@ -1627,6 +1667,39 @@ interface Namespace {
*/
take: typeof take;

/**
* Applies a ternary callback to elements in three two-dimensional nested input arrays and assigns results to elements in a two-dimensional nested output array.
*
* ## Notes
*
* - The function assumes that the input and output arrays have the same shape.
*
* @param arrays - array containing three input nested arrays and one output nested array
* @param shape - array shape
* @param fcn - ternary callback
*
* @example
* var ones2d = require( `@stdlib/array/base/ones2d` );
* var zeros2d = require( `@stdlib/array/base/zeros2d` );
*
* function add( x, y, z ) {
* return x + y + z;
* }
*
* var shape = [ 2, 2 ];
*
* var x = ones2d( shape );
* var y = ones2d( shape );
* var z = ones2d( shape );
* var out = zeros2d( shape );
*
* ns.ternary2d( [ x, y, z, out ], shape, add );
*
* console.log( out );
* // => [ [ 3.0, 3.0 ], [ 3.0, 3.0 ] ]
*/
ternary2d: typeof ternary2d;

/**
* Converts an array-like object to a minimal array-like object supporting the accessor protocol.
*
Expand Down
20 changes: 20 additions & 0 deletions lib/node_modules/@stdlib/ndarray/base/assert/docs/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import isDataType = require( '@stdlib/ndarray/base/assert/is-data-type' );
import isFloatingPointDataType = require( '@stdlib/ndarray/base/assert/is-floating-point-data-type' );
import isIndexMode = require( '@stdlib/ndarray/base/assert/is-index-mode' );
import isIntegerDataType = require( '@stdlib/ndarray/base/assert/is-integer-data-type' );
import isMostlySafeDataTypeCast = require( '@stdlib/ndarray/base/assert/is-mostly-safe-data-type-cast' );
import isNumericDataType = require( '@stdlib/ndarray/base/assert/is-numeric-data-type' );
import isOrder = require( '@stdlib/ndarray/base/assert/is-order' );
import isReadOnly = require( '@stdlib/ndarray/base/assert/is-read-only' );
Expand Down Expand Up @@ -131,6 +132,9 @@ interface Namespace {
* bool = ns.isCastingMode( 'safe' );
* // returns true
*
* bool = ns.isCastingMode( 'mostly-safe' );
* // returns true
*
* bool = ns.isCastingMode( 'same-kind' );
* // returns true
*
Expand Down Expand Up @@ -432,6 +436,22 @@ interface Namespace {
*/
isIntegerDataType: typeof isIntegerDataType;

/**
* Returns a boolean indicating if a provided ndarray data type can be safely cast or, for floating-point data types, downcast to another ndarray data type.
*
* @param from - ndarray data type
* @param to - ndarray data type
* @returns boolean indicating if a data type can be cast to another data type
*
* @example
* var bool = ns.isMostlySafeDataTypeCast( 'float32', 'float64' );
* // returns true
*
* bool = ns.isMostlySafeDataTypeCast( 'float64', 'int32' );
* // returns false
*/
isMostlySafeDataTypeCast: typeof isMostlySafeDataTypeCast;

/**
* Tests whether an input value is a supported ndarray numeric data type.
*
Expand Down
Loading

1 comment on commit 7faffe3

@stdlib-bot
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage Report

Package Statements Branches Functions Lines
array/base $\color{green}780/780$
$\color{green}+100.00\%$
$\color{green}1/1$
$\color{green}+100.00\%$
$\color{green}0/0$
$\color{green}+100.00\%$
$\color{green}780/780$
$\color{green}+100.00\%$
ndarray/base/assert $\color{green}267/267$
$\color{green}+100.00\%$
$\color{green}1/1$
$\color{green}+100.00\%$
$\color{green}0/0$
$\color{green}+100.00\%$
$\color{green}267/267$
$\color{green}+100.00\%$
ndarray/base $\color{green}811/811$
$\color{green}+100.00\%$
$\color{green}1/1$
$\color{green}+100.00\%$
$\color{green}0/0$
$\color{green}+100.00\%$
$\color{green}811/811$
$\color{green}+100.00\%$
ndarray $\color{green}411/411$
$\color{green}+100.00\%$
$\color{green}1/1$
$\color{green}+100.00\%$
$\color{green}0/0$
$\color{green}+100.00\%$
$\color{green}411/411$
$\color{green}+100.00\%$
ndarray/iter $\color{green}96/96$
$\color{green}+100.00\%$
$\color{green}1/1$
$\color{green}+100.00\%$
$\color{green}0/0$
$\color{green}+100.00\%$
$\color{green}96/96$
$\color{green}+100.00\%$
slice/base $\color{green}159/159$
$\color{green}+100.00\%$
$\color{green}1/1$
$\color{green}+100.00\%$
$\color{green}0/0$
$\color{green}+100.00\%$
$\color{green}159/159$
$\color{green}+100.00\%$
string $\color{green}523/523$
$\color{green}+100.00\%$
$\color{green}1/1$
$\color{green}+100.00\%$
$\color{green}0/0$
$\color{green}+100.00\%$
$\color{green}523/523$
$\color{green}+100.00\%$

The above coverage report was generated for the changes in this push.

Please sign in to comment.