Skip to content

Commit bc99d4f

Browse files
committed
Auto-generated commit
1 parent a4ac765 commit bc99d4f

2 files changed

Lines changed: 38 additions & 2 deletions

File tree

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+
- [`e98a2a0`](https://github.com/stdlib-js/stdlib/commit/e98a2a0ffd29fe7da7a95ac18b4a1e519464fde0) - update `ndarray/base` TypeScript declarations [(#12688)](https://github.com/stdlib-js/stdlib/pull/12688)
1314
- [`c016f87`](https://github.com/stdlib-js/stdlib/commit/c016f877831218b06cb925732a4f33612b58d5f8) - add `assignDiagonal` to namespace
1415
- [`b186702`](https://github.com/stdlib-js/stdlib/commit/b186702222b3b2cd2039d886b62ce78bd2f6af3b) - add `ndarray/base/assign-diagonal` [(#11993)](https://github.com/stdlib-js/stdlib/pull/11993)
1516
- [`e08276d`](https://github.com/stdlib-js/stdlib/commit/e08276d789ba1671769175bf5d2c3c5f587f6dca) - update `ndarray` TypeScript declarations [(#12593)](https://github.com/stdlib-js/stdlib/pull/12593)
@@ -36,6 +37,7 @@
3637

3738
<details>
3839

40+
- [`e98a2a0`](https://github.com/stdlib-js/stdlib/commit/e98a2a0ffd29fe7da7a95ac18b4a1e519464fde0) - **feat:** update `ndarray/base` TypeScript declarations [(#12688)](https://github.com/stdlib-js/stdlib/pull/12688) _(by stdlib-bot)_
3941
- [`8060cfe`](https://github.com/stdlib-js/stdlib/commit/8060cfed800ae155e24fd1298e1a6c7462dcc3ec) - **docs:** update `ndarray` TypeScript declarations [(#12689)](https://github.com/stdlib-js/stdlib/pull/12689) _(by stdlib-bot)_
4042
- [`c016f87`](https://github.com/stdlib-js/stdlib/commit/c016f877831218b06cb925732a4f33612b58d5f8) - **feat:** add `assignDiagonal` to namespace _(by Athan Reines)_
4143
- [`b186702`](https://github.com/stdlib-js/stdlib/commit/b186702222b3b2cd2039d886b62ce78bd2f6af3b) - **feat:** add `ndarray/base/assign-diagonal` [(#11993)](https://github.com/stdlib-js/stdlib/pull/11993) _(by Muhammad Haris, Athan Reines)_

base/docs/types/index.d.ts

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import anyBy = require( './../../../base/any-by' );
2525
import appendSingletonDimensions = require( './../../../base/append-singleton-dimensions' );
2626
import assert = require( './../../../base/assert' );
2727
import assign = require( './../../../base/assign' );
28+
import assignDiagonal = require( './../../../base/assign-diagonal' );
2829
import assignScalar = require( './../../../base/assign-scalar' );
2930
import atleast1d = require( './../../../base/atleast1d' );
3031
import atleast2d = require( './../../../base/atleast2d' );
@@ -364,6 +365,39 @@ interface Namespace {
364365
*/
365366
assign: typeof assign;
366367

368+
/**
369+
* Assigns elements from a broadcasted input ndarray to a specified diagonal of an output ndarray.
370+
*
371+
* ## Notes
372+
*
373+
* - The order of the dimension indices contained in `dims` matters. The first element specifies the row-like dimension. The second element specifies the column-like dimension.
374+
* - Each provided dimension index must reside on the interval `[-ndims, ndims-1]`.
375+
* - The diagonal offset `k` is interpreted as `column - row`. Accordingly, when `k = 0`, the function assigns to the main diagonal; when `k > 0`, the function assigns to a diagonal above the main diagonal; and when `k < 0`, the function assigns to a diagonal below the main diagonal.
376+
* - The input ndarray must be broadcast compatible with the output ndarray view defined by the specified diagonal.
377+
*
378+
* @param arrays - array-like object containing one input array and one output array
379+
* @param dims - dimension indices defining the plane in which to assign elements to the diagonal
380+
* @param k - diagonal offset
381+
* @returns output ndarray
382+
*
383+
* @example
384+
* var scalar2ndarray = require( './../../../from-scalar' );
385+
* var zeros = require( './../../../zeros' );
386+
*
387+
* var x = scalar2ndarray( 1.0 );
388+
* // returns <ndarray>
389+
*
390+
* var y = zeros( [ 3, 3 ] );
391+
* // returns <ndarray>[ [ 0.0, 0.0, 0.0 ], [ 0.0, 0.0, 0.0 ], [ 0.0, 0.0, 0.0 ] ]
392+
*
393+
* var out = ns.assignDiagonal( [ x, y ], [ 0, 1 ], 0 );
394+
* // returns <ndarray>[ [ 1.0, 0.0, 0.0 ], [ 0.0, 1.0, 0.0 ], [ 0.0, 0.0, 1.0 ] ]
395+
*
396+
* var bool = ( out === y );
397+
* // returns true
398+
*/
399+
assignDiagonal: typeof assignDiagonal;
400+
367401
/**
368402
* Assigns a scalar value to every element of an output ndarray.
369403
*
@@ -3351,8 +3385,8 @@ interface Namespace {
33513385
*
33523386
* 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.
33533387
*
3354-
* @param sh - array dimensions
3355-
* @param sx - array stride lengths
3388+
* @param shape - array dimensions
3389+
* @param stridesX - array stride lengths
33563390
* @returns loop interchange data
33573391
*
33583392
* @example

0 commit comments

Comments
 (0)