Skip to content

Commit 8ab7fe1

Browse files
committed
Auto-generated commit
1 parent bed70c1 commit 8ab7fe1

File tree

2 files changed

+157
-0
lines changed

2 files changed

+157
-0
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
### Features
1212

13+
- [`8f8998f`](https://github.com/stdlib-js/stdlib/commit/8f8998f02831c2db69698a26769916d68acfe54f) - update `ndarray/base` TypeScript declarations [(#9913)](https://github.com/stdlib-js/stdlib/pull/9913)
1314
- [`b6d8bcc`](https://github.com/stdlib-js/stdlib/commit/b6d8bcc8e3a285d4f874748191904580321aa0e8) - add `quinaryLoopOrder` to namespace
1415
- [`f3a6bc0`](https://github.com/stdlib-js/stdlib/commit/f3a6bc070f6ac5e2dee1374534ba6b0c134e4db6) - add `quaternaryLoopOrder` to namespace
1516
- [`02b9b76`](https://github.com/stdlib-js/stdlib/commit/02b9b7662449c9a04917e1353a8b53ff85df45d4) - add `broadcastScalarLike` to namespace
@@ -720,6 +721,7 @@ A total of 43 issues were closed in this release:
720721

721722
<details>
722723

724+
- [`8f8998f`](https://github.com/stdlib-js/stdlib/commit/8f8998f02831c2db69698a26769916d68acfe54f) - **feat:** update `ndarray/base` TypeScript declarations [(#9913)](https://github.com/stdlib-js/stdlib/pull/9913) _(by stdlib-bot)_
723725
- [`196734e`](https://github.com/stdlib-js/stdlib/commit/196734eccb0d43439332b2a275fb3a50cb73df67) - **docs:** update namespace table of contents [(#9915)](https://github.com/stdlib-js/stdlib/pull/9915) _(by stdlib-bot)_
724726
- [`b6d8bcc`](https://github.com/stdlib-js/stdlib/commit/b6d8bcc8e3a285d4f874748191904580321aa0e8) - **feat:** add `quinaryLoopOrder` to namespace _(by Athan Reines)_
725727
- [`f3a6bc0`](https://github.com/stdlib-js/stdlib/commit/f3a6bc070f6ac5e2dee1374534ba6b0c134e4db6) - **feat:** add `quaternaryLoopOrder` to namespace _(by Athan Reines)_

base/docs/types/index.d.ts

Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import broadcastArray = require( './../../../base/broadcast-array' );
3636
import broadcastArrayExceptDimensions = require( './../../../base/broadcast-array-except-dimensions' );
3737
import broadcastArrays = require( './../../../base/broadcast-arrays' );
3838
import broadcastScalar = require( './../../../base/broadcast-scalar' );
39+
import broadcastScalarLike = require( './../../../base/broadcast-scalar-like' );
3940
import broadcastShapes = require( './../../../base/broadcast-shapes' );
4041
import buffer = require( './../../../base/buffer' );
4142
import bufferCtors = require( './../../../base/buffer-ctors' );
@@ -124,6 +125,8 @@ import outputPolicyStr2Enum = require( './../../../base/output-policy-str2enum'
124125
import pop = require( './../../../base/pop' );
125126
import prependSingletonDimensions = require( './../../../base/prepend-singleton-dimensions' );
126127
import promoteDataTypes = require( './../../../base/promote-dtypes' );
128+
import quaternaryLoopOrder = require( './../../../base/quaternary-loop-interchange-order' );
129+
import quinaryLoopOrder = require( './../../../base/quinary-loop-interchange-order' );
127130
import removeSingletonDimensions = require( './../../../base/remove-singleton-dimensions' );
128131
import reverse = require( './../../../base/reverse' );
129132
import reverseDimension = require( './../../../base/reverse-dimension' );
@@ -745,6 +748,28 @@ interface Namespace {
745748
*/
746749
broadcastScalar: typeof broadcastScalar;
747750

751+
/**
752+
* Broadcasts a scalar value to an ndarray having the same shape and data type as a provided input ndarray.
753+
*
754+
* @param x - input array
755+
* @param value - scalar value
756+
* @returns output ndarray
757+
*
758+
* @example
759+
* var zeros = require( './../../../base/zeros' );
760+
* var getDType = require( './../../../dtype' );
761+
*
762+
* var x = zeros( 'float64', [ 2, 2 ], 'row-major' );
763+
* // returns <ndarray>[ [ 0.0, 0.0 ], [ 0.0, 0.0 ] ]
764+
*
765+
* var y = ns.broadcastScalarLike( x, 1.0 );
766+
* // returns <ndarray>[ [ 1.0, 1.0 ], [ 1.0, 1.0 ] ]
767+
*
768+
* var dt = String( getDType( y ) );
769+
* // returns 'float64'
770+
*/
771+
broadcastScalarLike: typeof broadcastScalarLike;
772+
748773
/**
749774
* Broadcasts array shapes to a single shape.
750775
*
@@ -3194,6 +3219,136 @@ interface Namespace {
31943219
*/
31953220
promoteDataTypes: typeof promoteDataTypes;
31963221

3222+
/**
3223+
* Reorders ndarray dimensions and associated strides for loop interchange.
3224+
*
3225+
* ## Notes
3226+
*
3227+
* - The returned object has the following properties:
3228+
*
3229+
* - **sh**: dimensions sorted in loop order.
3230+
* - **sx**: first input ndarray strides sorted in loop order.
3231+
* - **sy**: second input ndarray strides sorted in loop order.
3232+
* - **sz**: third input ndarray strides sorted in loop order.
3233+
* - **sw**: fourth input ndarray strides sorted in loop order.
3234+
* - **su**: output ndarray strides sorted in loop order.
3235+
*
3236+
* - When iterating over the elements of a multi-dimensional array, accessing elements which are closer in memory can improve performance. To this end, loop interchange is a technique used in loop nest optimization to improve locality of reference and take advantage of CPU cache.
3237+
*
3238+
* The purpose of this function is to order ndarray dimensions according to the magnitude of array strides. By using the ordered dimensions and associated strides, one can construct nested loops (one for each dimension) such that the innermost loop iterates over the dimension in which array elements are closest in memory and the outermost loop iterates over the dimension in which array elements are farthest apart in memory. As a consequence, element iteration is optimized to minimize cache misses and ensure locality of reference.
3239+
*
3240+
* - Cache performance may be degraded if the layout order (i.e., row-major or column-major) differs for the input and output ndarrays. This function is intended to optimize cache performance for the most common layout order. Accordingly, if the output ndarray has a different layout order (e.g., if the input ndarrays are row-major and the output ndarray is column-major), cache misses are likely for the output ndarray. In general, to ensure best performance, input and output ndarrays should have the same layout order.
3241+
*
3242+
* - The function assumes that the input and output ndarrays have the same shape. Hence, loop interchange order should only be determined **after** broadcasting.
3243+
*
3244+
* @param shape - array dimensions
3245+
* @param stridesX - first input array stride lengths
3246+
* @param stridesY - second input array stride lengths
3247+
* @param stridesZ - third input array stride lengths
3248+
* @param stridesW - fourth input array stride lengths
3249+
* @param stridesU - output array stride lengths
3250+
* @returns loop interchange data
3251+
*
3252+
* @example
3253+
* var sh = [ 2, 3, 4 ];
3254+
*
3255+
* var sx = [ 12, 4, 1 ]; // row-major
3256+
* var sy = [ 24, 8, 1 ]; // row-major
3257+
* var sz = [ 1, 4, 12 ]; // column-major
3258+
* var sw = [ 1, -2, 6 ]; // column-major
3259+
* var su = [ 1, -2, 6 ]; // column-major
3260+
*
3261+
* var o = ns.quaternaryLoopOrder( sh, sx, sy, sz, sw, su );
3262+
* // returns {...}
3263+
*
3264+
* var ssh = o.sh;
3265+
* // returns [ 2, 3, 4 ]
3266+
*
3267+
* var ssx = o.sx;
3268+
* // returns [ 12, 4, 1 ]
3269+
*
3270+
* var ssy = o.sy;
3271+
* // returns [ 24, 8, 1 ]
3272+
*
3273+
* var ssz = o.sz;
3274+
* // returns [ 1, 4, 12 ]
3275+
*
3276+
* var ssw = o.sw;
3277+
* // returns [ 1, -2, 6 ]
3278+
*
3279+
* var ssu = o.su;
3280+
* // returns [ 1, -2, 6 ]
3281+
*/
3282+
quaternaryLoopOrder: typeof quaternaryLoopOrder;
3283+
3284+
/**
3285+
* Reorders ndarray dimensions and associated strides for loop interchange.
3286+
*
3287+
* ## Notes
3288+
*
3289+
* - The returned object has the following properties:
3290+
*
3291+
* - **sh**: dimensions sorted in loop order.
3292+
* - **sx**: first input ndarray strides sorted in loop order.
3293+
* - **sy**: second input ndarray strides sorted in loop order.
3294+
* - **sz**: third input ndarray strides sorted in loop order.
3295+
* - **sw**: fourth input ndarray strides sorted in loop order.
3296+
* - **su**: fifth input ndarray strides sorted in loop order.
3297+
* - **sv**: output ndarray strides sorted in loop order.
3298+
*
3299+
* - When iterating over the elements of a multi-dimensional array, accessing elements which are closer in memory can improve performance. To this end, loop interchange is a technique used in loop nest optimization to improve locality of reference and take advantage of CPU cache.
3300+
*
3301+
* The purpose of this function is to order ndarray dimensions according to the magnitude of array strides. By using the ordered dimensions and associated strides, one can construct nested loops (one for each dimension) such that the innermost loop iterates over the dimension in which array elements are closest in memory and the outermost loop iterates over the dimension in which array elements are farthest apart in memory. As a consequence, element iteration is optimized to minimize cache misses and ensure locality of reference.
3302+
*
3303+
* - Cache performance may be degraded if the layout order (i.e., row-major or column-major) differs for the input and output ndarrays. This function is intended to optimize cache performance for the most common layout order. Accordingly, if the output ndarray has a different layout order (e.g., if the input ndarrays are row-major and the output ndarray is column-major), cache misses are likely for the output ndarray. In general, to ensure best performance, input and output ndarrays should have the same layout order.
3304+
*
3305+
* - The function assumes that the input and output ndarrays have the same shape. Hence, loop interchange order should only be determined **after** broadcasting.
3306+
*
3307+
* @param shape - array dimensions
3308+
* @param stridesX - first input array stride lengths
3309+
* @param stridesY - second input array stride lengths
3310+
* @param stridesZ - third input array stride lengths
3311+
* @param stridesW - fourth input array stride lengths
3312+
* @param stridesU - fifth input array stride lengths
3313+
* @param stridesV - output array stride lengths
3314+
* @returns loop interchange data
3315+
*
3316+
* @example
3317+
* var sh = [ 2, 3, 4 ];
3318+
*
3319+
* var sx = [ 12, 4, 1 ]; // row-major
3320+
* var sy = [ 24, 8, 1 ]; // row-major
3321+
* var sz = [ 12, 4, 1 ]; // row-major
3322+
* var sw = [ 24, 8, 1 ]; // row-major
3323+
* var su = [ 1, 4, 12 ]; // column-major
3324+
* var sv = [ 1, -2, 6 ]; // column-major
3325+
*
3326+
* var o = ns.quinaryLoopOrder( sh, sx, sy, sz, sw, su, sv );
3327+
* // returns {...}
3328+
*
3329+
* var ssh = o.sh;
3330+
* // returns [ 4, 3, 2 ]
3331+
*
3332+
* var ssx = o.sx;
3333+
* // returns [ 1, 4, 12 ]
3334+
*
3335+
* var ssy = o.sy;
3336+
* // returns [ 1, 8, 24 ]
3337+
*
3338+
* var ssz = o.sz;
3339+
* // returns [ 1, 4, 12 ]
3340+
*
3341+
* var ssw = o.sw;
3342+
* // returns [ 1, 8, 24 ]
3343+
*
3344+
* var ssu = o.su;
3345+
* // returns [ 12, 4, 1 ]
3346+
*
3347+
* var ssv = o.sv;
3348+
* // returns [ 6, -2, 1 ]
3349+
*/
3350+
quinaryLoopOrder: typeof quinaryLoopOrder;
3351+
31973352
/**
31983353
* Returns an array without singleton dimensions.
31993354
*

0 commit comments

Comments
 (0)