Skip to content

Commit b3cb4ec

Browse files
committed
Auto-generated commit
1 parent 2c6719d commit b3cb4ec

File tree

6 files changed

+18
-70
lines changed

6 files changed

+18
-70
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -860,6 +860,7 @@ A total of 57 issues were closed in this release:
860860

861861
<details>
862862

863+
- [`fa69a58`](https://github.com/stdlib-js/stdlib/commit/fa69a5843285eae8c1340497bf27ecc51875f384) - **docs:** improve doctests for ndarray instances in `blas/ext/sum` [(#11481)](https://github.com/stdlib-js/stdlib/pull/11481) _(by Uday Kakade)_
863864
- [`b434fcc`](https://github.com/stdlib-js/stdlib/commit/b434fcc0eee2e5a6930b5c99a0fe8515dcff2fae) - **docs:** improve doctests for ndarray instances in `blas/ext/sorthp` [(#11483)](https://github.com/stdlib-js/stdlib/pull/11483) _(by Uday Kakade)_
864865
- [`4743252`](https://github.com/stdlib-js/stdlib/commit/4743252abb3eb47297a10260e2ed159389036143) - **docs:** improve doctests for ndarray instances in `blas/ext/find-index` [(#11486)](https://github.com/stdlib-js/stdlib/pull/11486) _(by Uday Kakade)_
865866
- [`ace9b98`](https://github.com/stdlib-js/stdlib/commit/ace9b98cd31056ec3efbbd14b3c12defe96b07fc) - **docs:** improve doctests for ndarray instances in `blas/ext/find-last-index` [(#11487)](https://github.com/stdlib-js/stdlib/pull/11487) _(by Uday Kakade)_

ext/sum/README.md

Lines changed: 8 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,7 @@ var array = require( '@stdlib/ndarray/array' );
4040
var x = array( [ -1.0, 2.0, -3.0 ] );
4141

4242
var y = sum( x );
43-
// returns <ndarray>
44-
45-
var v = y.get();
46-
// returns -2.0
43+
// returns <ndarray>[ -2.0 ]
4744
```
4845

4946
The function has the following parameters:
@@ -60,82 +57,56 @@ The function accepts the following options:
6057
By default, the function performs a reduction over all elements in a provided input [ndarray][@stdlib/ndarray/ctor]. To perform a reduction over specific dimensions, provide a `dims` option.
6158

6259
```javascript
63-
var ndarray2array = require( '@stdlib/ndarray/to-array' );
6460
var array = require( '@stdlib/ndarray/array' );
6561

6662
var x = array( [ -1.0, 2.0, -3.0, 4.0 ], {
6763
'shape': [ 2, 2 ],
6864
'order': 'row-major'
6965
});
7066

71-
var v = ndarray2array( x );
72-
// returns [ [ -1.0, 2.0 ], [ -3.0, 4.0 ] ]
73-
7467
var y = sum( x, {
7568
'dims': [ 0 ]
7669
});
77-
// returns <ndarray>
78-
79-
v = ndarray2array( y );
80-
// returns [ -4.0, 6.0 ]
70+
// returns <ndarray>[ -4.0, 6.0 ]
8171

8272
y = sum( x, {
8373
'dims': [ 1 ]
8474
});
85-
// returns <ndarray>
86-
87-
v = ndarray2array( y );
88-
// returns [ 1.0, 1.0 ]
75+
// returns <ndarray>[ 1.0, 1.0 ]
8976

9077
y = sum( x, {
9178
'dims': [ 0, 1 ]
9279
});
93-
// returns <ndarray>
94-
95-
v = y.get();
96-
// returns 2.0
80+
// returns <ndarray>[ 2.0 ]
9781
```
9882

9983
By default, the function excludes reduced dimensions from the output [ndarray][@stdlib/ndarray/ctor]. To include the reduced dimensions as singleton dimensions, set the `keepdims` option to `true`.
10084

10185
```javascript
102-
var ndarray2array = require( '@stdlib/ndarray/to-array' );
10386
var array = require( '@stdlib/ndarray/array' );
10487

10588
var x = array( [ -1.0, 2.0, -3.0, 4.0 ], {
10689
'shape': [ 2, 2 ],
10790
'order': 'row-major'
10891
});
10992

110-
var v = ndarray2array( x );
111-
// returns [ [ -1.0, 2.0 ], [ -3.0, 4.0 ] ]
112-
11393
var y = sum( x, {
11494
'dims': [ 0 ],
11595
'keepdims': true
11696
});
117-
// returns <ndarray>
118-
119-
v = ndarray2array( y );
120-
// returns [ [ -4.0, 6.0 ] ]
97+
// returns <ndarray>[ [ -4.0, 6.0 ] ]
12198

12299
y = sum( x, {
123100
'dims': [ 1 ],
124101
'keepdims': true
125102
});
126-
// returns <ndarray>
127-
128-
v = ndarray2array( y );
129-
// returns [ [ 1.0 ], [ 1.0 ] ]
103+
// returns <ndarray>[ [ 1.0 ], [ 1.0 ] ]
130104

131105
y = sum( x, {
132106
'dims': [ 0, 1 ],
133107
'keepdims': true
134108
});
135-
// returns <ndarray>
136-
137-
v = ndarray2array( y );
138-
// returns [ [ 2.0 ] ]
109+
// returns <ndarray>[ [ 2.0 ] ]
139110
```
140111

141112
By default, the function returns an [ndarray][@stdlib/ndarray/ctor] having a [data type][@stdlib/ndarray/dtypes] determined by the function's output data type [policy][@stdlib/ndarray/output-dtype-policies]. To override the default behavior, set the `dtype` option.
@@ -169,10 +140,7 @@ var x = array( [ -1.0, 2.0, -3.0 ] );
169140
var y = zeros( [] );
170141

171142
var out = sum.assign( x, y );
172-
// returns <ndarray>
173-
174-
var v = out.get();
175-
// returns -2.0
143+
// returns <ndarray>[ -2.0 ]
176144

177145
var bool = ( out === y );
178146
// returns true

ext/sum/docs/repl.txt

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,8 @@
3030
Examples
3131
--------
3232
> var x = {{alias:@stdlib/ndarray/array}}( [ -1.0, 2.0, -3.0, -4.0 ] );
33-
> var y = {{alias}}( x );
34-
> var v = y.get()
35-
-6.0
33+
> var y = {{alias}}( x )
34+
<ndarray>[ -6.0 ]
3635

3736

3837
{{alias}}.assign( x, out[, options] )
@@ -65,11 +64,9 @@
6564
> var x = {{alias:@stdlib/ndarray/array}}( [ -1.0, 2.0, -3.0, -4.0 ] );
6665
> var out = {{alias:@stdlib/ndarray/zeros}}( [] );
6766
> var y = {{alias}}.assign( x, out )
68-
<ndarray>
67+
<ndarray>[ -6.0 ]
6968
> var bool = ( out === y )
7069
true
71-
> var v = out.get()
72-
-6.0
7370

7471
See Also
7572
--------

ext/sum/docs/types/index.d.ts

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,7 @@ interface Unary {
7575
* var x = array( [ -1.0, 2.0, -3.0 ] );
7676
*
7777
* var y = sum( x );
78-
* // returns <ndarray>
79-
*
80-
* var v = y.get();
81-
* // returns -2.0
78+
* // returns <ndarray>[ -2.0 ]
8279
*/
8380
<T = unknown, U = unknown>( x: InputArray<T>, options?: Options ): OutputArray<U>; // NOTE: we lose type specificity here, but retaining specificity would likely be difficult and/or tedious to completely enumerate, as the output ndarray data type is dependent on how `x` interacts with output data type policy and whether that policy has been overridden by `options.dtype`.
8481

@@ -98,10 +95,7 @@ interface Unary {
9895
* var y = zeros( [] );
9996
*
10097
* var out = sum.assign( x, y );
101-
* // returns <ndarray>
102-
*
103-
* var v = out.get();
104-
* // returns -2.0
98+
* // returns <ndarray>[ -2.0 ]
10599
*
106100
* var bool = ( out === y );
107101
* // returns true
@@ -122,10 +116,7 @@ interface Unary {
122116
* var x = array( [ -1.0, 2.0, -3.0 ] );
123117
*
124118
* var y = sum( x );
125-
* // returns <ndarray>
126-
*
127-
* var v = y.get();
128-
* // returns -2.0
119+
* // returns <ndarray>[ -2.0 ]
129120
*
130121
* @example
131122
* var array = require( '@stdlib/ndarray/array' );
@@ -135,10 +126,7 @@ interface Unary {
135126
* var y = zeros( [] );
136127
*
137128
* var out = sum.assign( x, y );
138-
* // returns <ndarray>
139-
*
140-
* var v = out.get();
141-
* // returns -2.0
129+
* // returns <ndarray>[ -2.0 ]
142130
*
143131
* var bool = ( out === y );
144132
* // returns true

ext/sum/lib/index.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,7 @@
4545
*
4646
* // Perform reduction:
4747
* var out = sum( x );
48-
* // returns <ndarray>
49-
*
50-
* var v = out.get();
51-
* // returns 39.0
48+
* // returns <ndarray>[ 39.0 ]
5249
*/
5350

5451
// MODULES //

ext/sum/lib/main.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,7 @@ var table = {
9494
*
9595
* // Perform reduction:
9696
* var out = sum( x );
97-
* // returns <ndarray>
98-
*
99-
* var v = out.get();
100-
* // returns 39.0
97+
* // returns <ndarray>[ 39.0 ]
10198
*/
10299
var sum = factory( table, [ idtypes ], odtypes, policies );
103100

0 commit comments

Comments
 (0)