Skip to content

Commit 2dfa44c

Browse files
committed
Update artifacts
1 parent 8df90ee commit 2dfa44c

File tree

4 files changed

+77
-53
lines changed

4 files changed

+77
-53
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
[224,230,97.3913,19,22,86.3636,1,1,100,224,230,97.3913,"16c9908ab00555de7a0e56b7951156370df4712a","2025-09-06 03:57:54 -0700"]
1+
[232,238,97.479,18,21,85.7143,1,1,100,232,238,97.479,"4e8e2fd150da54f422db65daa3b661a75686afd3","2025-09-06 18:05:57 -0700"]

ndarray/base/broadcast-array-except-dimensions/index.html

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,16 @@ <h1><a href="../../../../index.html">All files</a> ndarray/base/broadcast-array-
2323
<div class='clearfix'>
2424

2525
<div class='fl pad1y space-right2'>
26-
<span class="strong">97.39% </span>
26+
<span class="strong">97.47% </span>
2727
<span class="quiet">Statements</span>
28-
<span class='fraction'>224/230</span>
28+
<span class='fraction'>232/238</span>
2929
</div>
3030

3131

3232
<div class='fl pad1y space-right2'>
33-
<span class="strong">86.36% </span>
33+
<span class="strong">85.71% </span>
3434
<span class="quiet">Branches</span>
35-
<span class='fraction'>19/22</span>
35+
<span class='fraction'>18/21</span>
3636
</div>
3737

3838

@@ -44,9 +44,9 @@ <h1><a href="../../../../index.html">All files</a> ndarray/base/broadcast-array-
4444

4545

4646
<div class='fl pad1y space-right2'>
47-
<span class="strong">97.39% </span>
47+
<span class="strong">97.47% </span>
4848
<span class="quiet">Lines</span>
49-
<span class='fraction'>224/230</span>
49+
<span class='fraction'>232/238</span>
5050
</div>
5151

5252

@@ -84,28 +84,28 @@ <h1><a href="../../../../index.html">All files</a> ndarray/base/broadcast-array-
8484
<div class="chart"><div class="cover-fill cover-full" style="width: 100%"></div><div class="cover-empty" style="width: 0%"></div></div>
8585
</td>
8686
<td data-value="100" class="pct high">100%</td>
87-
<td data-value="68" class="abs high">68/68</td>
87+
<td data-value="69" class="abs high">69/69</td>
8888
<td data-value="100" class="pct high">100%</td>
8989
<td data-value="1" class="abs high">1/1</td>
9090
<td data-value="100" class="pct high">100%</td>
9191
<td data-value="0" class="abs high">0/0</td>
9292
<td data-value="100" class="pct high">100%</td>
93-
<td data-value="68" class="abs high">68/68</td>
93+
<td data-value="69" class="abs high">69/69</td>
9494
</tr>
9595

9696
<tr>
9797
<td class="file high" data-value="main.js"><a href="main.js.html">main.js</a></td>
98-
<td data-value="96.29" class="pic high">
98+
<td data-value="96.44" class="pic high">
9999
<div class="chart"><div class="cover-fill" style="width: 96%"></div><div class="cover-empty" style="width: 4%"></div></div>
100100
</td>
101-
<td data-value="96.29" class="pct high">96.29%</td>
102-
<td data-value="162" class="abs high">156/162</td>
103-
<td data-value="85.71" class="pct high">85.71%</td>
104-
<td data-value="21" class="abs high">18/21</td>
101+
<td data-value="96.44" class="pct high">96.44%</td>
102+
<td data-value="169" class="abs high">163/169</td>
103+
<td data-value="85" class="pct high">85%</td>
104+
<td data-value="20" class="abs high">17/20</td>
105105
<td data-value="100" class="pct high">100%</td>
106106
<td data-value="1" class="abs high">1/1</td>
107-
<td data-value="96.29" class="pct high">96.29%</td>
108-
<td data-value="162" class="abs high">156/162</td>
107+
<td data-value="96.44" class="pct high">96.44%</td>
108+
<td data-value="169" class="abs high">163/169</td>
109109
</tr>
110110

111111
</tbody>
@@ -116,7 +116,7 @@ <h1><a href="../../../../index.html">All files</a> ndarray/base/broadcast-array-
116116
<div class='footer quiet pad2 space-top1 center small'>
117117
Code coverage generated by
118118
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
119-
at 2025-09-06T10:59:38.599Z
119+
at 2025-09-07T01:08:13.492Z
120120
</div>
121121
<script src="../../../../prettify.js"></script>
122122
<script>

ndarray/base/broadcast-array-except-dimensions/index.js.html

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ <h1><a href="../../../../index.html">All files</a> / <a href="index.html">ndarra
2525
<div class='fl pad1y space-right2'>
2626
<span class="strong">100% </span>
2727
<span class="quiet">Statements</span>
28-
<span class='fraction'>68/68</span>
28+
<span class='fraction'>69/69</span>
2929
</div>
3030

3131

@@ -46,7 +46,7 @@ <h1><a href="../../../../index.html">All files</a> / <a href="index.html">ndarra
4646
<div class='fl pad1y space-right2'>
4747
<span class="strong">100% </span>
4848
<span class="quiet">Lines</span>
49-
<span class='fraction'>68/68</span>
49+
<span class='fraction'>69/69</span>
5050
</div>
5151

5252

@@ -131,7 +131,9 @@ <h1><a href="../../../../index.html">All files</a> / <a href="index.html">ndarra
131131
<a name='L66'></a><a href='#L66'>66</a>
132132
<a name='L67'></a><a href='#L67'>67</a>
133133
<a name='L68'></a><a href='#L68'>68</a>
134-
<a name='L69'></a><a href='#L69'>69</a></td><td class="line-coverage quiet"><span class="cline-any cline-yes">1x</span>
134+
<a name='L69'></a><a href='#L69'>69</a>
135+
<a name='L70'></a><a href='#L70'>70</a></td><td class="line-coverage quiet"><span class="cline-any cline-yes">1x</span>
136+
<span class="cline-any cline-yes">1x</span>
135137
<span class="cline-any cline-yes">1x</span>
136138
<span class="cline-any cline-yes">1x</span>
137139
<span class="cline-any cline-yes">1x</span>
@@ -226,18 +228,19 @@ <h1><a href="../../../../index.html">All files</a> / <a href="index.html">ndarra
226228
*
227229
* @example
228230
* var array = require( '@stdlib/ndarray/array' );
231+
* var getShape = require( '@stdlib/ndarray/shape' );
229232
* var broadcastArrayExceptDimensions = require( '@stdlib/ndarray/base/broadcast-array-except-dimensions' );
230233
*
231234
* var x = array( [ [ 1, 2, 3 ] ] );
232235
* // returns &lt;ndarray&gt;
233236
*
234-
* var shx = x.shape;
237+
* var shx = getShape( x );
235238
* // returns [ 1, 3 ]
236239
*
237240
* var y = broadcastArrayExceptDimensions( x, [ 2, 2, 3 ], [ -2 ] );
238241
* // returns &lt;ndarray&gt;
239242
*
240-
* var shy = y.shape;
243+
* var shy = getShape( y );
241244
* // returns [ 2, 1, 3 ]
242245
*
243246
* var v = y.get( 0, 0, 0 );
@@ -274,7 +277,7 @@ <h1><a href="../../../../index.html">All files</a> / <a href="index.html">ndarra
274277
<div class='footer quiet pad2 space-top1 center small'>
275278
Code coverage generated by
276279
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
277-
at 2025-09-06T10:59:38.599Z
280+
at 2025-09-07T01:08:13.492Z
278281
</div>
279282
<script src="../../../../prettify.js"></script>
280283
<script>

ndarray/base/broadcast-array-except-dimensions/main.js.html

Lines changed: 51 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,16 @@ <h1><a href="../../../../index.html">All files</a> / <a href="index.html">ndarra
2323
<div class='clearfix'>
2424

2525
<div class='fl pad1y space-right2'>
26-
<span class="strong">96.29% </span>
26+
<span class="strong">96.44% </span>
2727
<span class="quiet">Statements</span>
28-
<span class='fraction'>156/162</span>
28+
<span class='fraction'>163/169</span>
2929
</div>
3030

3131

3232
<div class='fl pad1y space-right2'>
33-
<span class="strong">85.71% </span>
33+
<span class="strong">85% </span>
3434
<span class="quiet">Branches</span>
35-
<span class='fraction'>18/21</span>
35+
<span class='fraction'>17/20</span>
3636
</div>
3737

3838

@@ -44,9 +44,9 @@ <h1><a href="../../../../index.html">All files</a> / <a href="index.html">ndarra
4444

4545

4646
<div class='fl pad1y space-right2'>
47-
<span class="strong">96.29% </span>
47+
<span class="strong">96.44% </span>
4848
<span class="quiet">Lines</span>
49-
<span class='fraction'>156/162</span>
49+
<span class='fraction'>163/169</span>
5050
</div>
5151

5252

@@ -225,7 +225,19 @@ <h1><a href="../../../../index.html">All files</a> / <a href="index.html">ndarra
225225
<a name='L160'></a><a href='#L160'>160</a>
226226
<a name='L161'></a><a href='#L161'>161</a>
227227
<a name='L162'></a><a href='#L162'>162</a>
228-
<a name='L163'></a><a href='#L163'>163</a></td><td class="line-coverage quiet"><span class="cline-any cline-yes">1x</span>
228+
<a name='L163'></a><a href='#L163'>163</a>
229+
<a name='L164'></a><a href='#L164'>164</a>
230+
<a name='L165'></a><a href='#L165'>165</a>
231+
<a name='L166'></a><a href='#L166'>166</a>
232+
<a name='L167'></a><a href='#L167'>167</a>
233+
<a name='L168'></a><a href='#L168'>168</a>
234+
<a name='L169'></a><a href='#L169'>169</a>
235+
<a name='L170'></a><a href='#L170'>170</a></td><td class="line-coverage quiet"><span class="cline-any cline-yes">1x</span>
236+
<span class="cline-any cline-yes">1x</span>
237+
<span class="cline-any cline-yes">1x</span>
238+
<span class="cline-any cline-yes">1x</span>
239+
<span class="cline-any cline-yes">1x</span>
240+
<span class="cline-any cline-yes">1x</span>
229241
<span class="cline-any cline-yes">1x</span>
230242
<span class="cline-any cline-yes">1x</span>
231243
<span class="cline-any cline-yes">1x</span>
@@ -354,17 +366,19 @@ <h1><a href="../../../../index.html">All files</a> / <a href="index.html">ndarra
354366
<span class="cline-any cline-yes">29x</span>
355367
<span class="cline-any cline-yes">45x</span>
356368
<span class="cline-any cline-yes">45x</span>
357-
<span class="cline-any cline-yes">11x</span>
358-
<span class="cline-any cline-yes">10x</span>
359-
<span class="cline-any cline-yes">10x</span>
360-
<span class="cline-any cline-yes">10x</span>
361-
<span class="cline-any cline-yes">11x</span>
369+
<span class="cline-any cline-yes">45x</span>
370+
<span class="cline-any cline-yes">45x</span>
371+
<span class="cline-any cline-yes">45x</span>
362372
<span class="cline-any cline-yes">11x</span>
363373
<span class="cline-any cline-yes">11x</span>
374+
<span class="cline-any cline-yes">34x</span>
364375
<span class="cline-any cline-yes">45x</span>
365376
<span class="cline-any cline-yes">10x</span>
366377
<span class="cline-any cline-yes">10x</span>
367378
<span class="cline-any cline-yes">10x</span>
379+
<span class="cline-any cline-yes">10x</span>
380+
<span class="cline-any cline-yes">10x</span>
381+
<span class="cline-any cline-yes">24x</span>
368382
<span class="cline-any cline-yes">24x</span>
369383
<span class="cline-any cline-yes">24x</span>
370384
<span class="cline-any cline-yes">45x</span>
@@ -428,28 +442,33 @@ <h1><a href="../../../../index.html">All files</a> / <a href="index.html">ndarra
428442
/**
429443
* Broadcasts an input ndarray to a target shape while keeping a list of specified dimensions unchanged.
430444
*
445+
* ## Notes
446+
*
447+
* - The function expects that each index in the list of dimensions is negative in order to ensure that indices correspond to the same relative position in the output ndarray shape. For example, given an input ndarray shape `[2,X1,X2]` and a desired shape `[6,7,2,Y1,Y2]`, a list of negative dimensions `[-2,-1]` correctly maps the unchanged dimensions `X` in the input ndarray to ignored dimensions `Y` in the provided target shape. Nonnegative indices, however, afford no such mapping. For example, the list of dimensions `[1,2]` corresponds to `[X1,X2]` in the input ndarray shape, but to `[7,2]` in the target shape, which is not desired. By expecting negative indices, we avoid confusion and ensure that users always refer to dimensions relative to the last broadcasted dimension.
448+
*
431449
* @param {ndarray} arr - input array
432450
* @param {NonNegativeIntegerArray} shape - desired shape
433-
* @param {IntegerArray} dims - list of dimensions to exclude from broadcasting
451+
* @param {NegativeIntegerArray} dims - list of dimensions to exclude from broadcasting
434452
* @throws {Error} input array cannot have more dimensions than the desired shape
435-
* @throws {Error} input array and desired shape must be broadcast compatible
453+
* @throws {Error} broadcasted dimensions in the input array and desired shape must be broadcast compatible
436454
* @throws {RangeError} dimension indices must not exceed desired shape bounds
437455
* @throws {Error} must provide unique dimension indices
438456
* @returns {ndarray} broadcasted array
439457
*
440458
* @example
441459
* var array = require( '@stdlib/ndarray/array' );
460+
* var getShape = require( '@stdlib/ndarray/shape' );
442461
*
443462
* var x = array( [ [ 1, 2, 3 ] ] );
444463
* // returns &lt;ndarray&gt;
445464
*
446-
* var shx = x.shape;
465+
* var shx = getShape( x );
447466
* // returns [ 1, 3 ]
448467
*
449468
* var y = broadcastArrayExceptDimensions( x, [ 2, 2, 3 ], [ -2 ] );
450469
* // returns &lt;ndarray&gt;
451470
*
452-
* var shy = y.shape;
471+
* var shy = getShape( y );
453472
* // returns [ 2, 1, 3 ]
454473
*
455474
* var v = y.get( 0, 0, 0 );
@@ -477,12 +496,12 @@ <h1><a href="../../../../index.html">All files</a> / <a href="index.html">ndarra
477496
var sh;
478497
var st;
479498
var dl;
480-
var di;
481499
var N;
482500
var M;
483501
var d;
484502
var i;
485503
var j;
504+
var k;
486505
&nbsp;
487506
// Copy input arguments to avoid unintended mutation:
488507
shape = copy( shape );
@@ -501,32 +520,34 @@ <h1><a href="../../../../index.html">All files</a> / <a href="index.html">ndarra
501520
&nbsp;
502521
// Verify that we've been provided a list of unique dimension indices...
503522
dl = idx.length;
504-
idx = normalizeIndices( idx, N-1 );
523+
idx = normalizeIndices( idx, M-1 );
505524
if ( idx === null ) <span class="branch-0 cbranch-no" title="branch not covered" >{</span>
506525
<span class="cstat-no" title="statement not covered" > throw new RangeError( format( 'invalid argument. Third argument contains an out-of-bounds dimension index. Value: [%s].', join( dims, ',' ) ) );</span>
507526
<span class="cstat-no" title="statement not covered" > }</span>
508-
idx.sort();
527+
idx.sort(); // sort in ascending order
509528
if ( idx.length !== dl ) <span class="branch-0 cbranch-no" title="branch not covered" >{</span>
510529
<span class="cstat-no" title="statement not covered" > throw new Error( format( 'invalid argument. Third argument must contain a list of unique dimension indices. Value: [%s].', join( dims, ',' ) ) );</span>
511530
<span class="cstat-no" title="statement not covered" > }</span>
512-
di = idx.length - 1;
531+
k = idx.length - 1;
513532
&nbsp;
514533
// Determine the output array strides...
515534
st = getStrides( arr, false );
516535
for ( i = N-1; i &gt;= 0; i-- ) {
517-
j = M - N + i;
518-
if ( di &gt;= 0 &amp;&amp; idx[ di ] === i ) {
519-
if ( j &gt;= 0 ) {
520-
shape[ i ] = sh[ j ];
521-
strides[ i ] = st[ j ];
522-
}
523-
di -= 1;
536+
// Moving from right-to-left, resolve an index into the input array shape:
537+
j = M - N + i; // M-1, M-2, M-3, ..., M-M, ..., M-N with N &gt;= M
538+
&nbsp;
539+
// For prepended singleton dimensions, the stride is zero...
540+
if ( j &lt; 0 ) {
524541
continue;
525542
}
526-
if ( j &lt; 0 ) {
527-
// Prepended singleton dimension; stride is zero...
543+
// Check for a dimension being held constant...
544+
if ( k &gt;= 0 &amp;&amp; idx[ k ] === j ) {
545+
shape[ i ] = sh[ j ];
546+
strides[ i ] = st[ j ];
547+
k -= 1;
528548
continue;
529549
}
550+
// Broadcast the current dimension...
530551
d = sh[ j ];
531552
dim = shape[ i ];
532553
if ( dim !== 0 &amp;&amp; dim &lt; d ) {
@@ -556,7 +577,7 @@ <h1><a href="../../../../index.html">All files</a> / <a href="index.html">ndarra
556577
<div class='footer quiet pad2 space-top1 center small'>
557578
Code coverage generated by
558579
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
559-
at 2025-09-06T10:59:38.599Z
580+
at 2025-09-07T01:08:13.492Z
560581
</div>
561582
<script src="../../../../prettify.js"></script>
562583
<script>

0 commit comments

Comments
 (0)