Skip to content

Commit 01114c2

Browse files
committed
Update artifacts
1 parent 71fe32a commit 01114c2

File tree

4 files changed

+80
-47
lines changed

4 files changed

+80
-47
lines changed

ndarray/base/shift/coverage.ndjson

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
[151,151,100,4,4,100,1,1,100,151,151,100,"8dff2cb330a44feb82ed3d4bbad65084af1277d8","2025-09-24 20:20:17 +0500"]
1+
[158,162,97.5309,3,5,60,1,1,100,158,162,97.5309,"bf4686f6e93757d055889d00cacd1a9c35237d5c","2025-09-24 22:04:36 +0500"]

ndarray/base/shift/index.html

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

2525
<div class='fl pad1y space-right2'>
26-
<span class="strong">100% </span>
26+
<span class="strong">97.53% </span>
2727
<span class="quiet">Statements</span>
28-
<span class='fraction'>151/151</span>
28+
<span class='fraction'>158/162</span>
2929
</div>
3030

3131

3232
<div class='fl pad1y space-right2'>
33-
<span class="strong">100% </span>
33+
<span class="strong">60% </span>
3434
<span class="quiet">Branches</span>
35-
<span class='fraction'>4/4</span>
35+
<span class='fraction'>3/5</span>
3636
</div>
3737

3838

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

4545

4646
<div class='fl pad1y space-right2'>
47-
<span class="strong">100% </span>
47+
<span class="strong">97.53% </span>
4848
<span class="quiet">Lines</span>
49-
<span class='fraction'>151/151</span>
49+
<span class='fraction'>158/162</span>
5050
</div>
5151

5252

@@ -95,17 +95,17 @@ <h1><a href="../../../../index.html">All files</a> ndarray/base/shift/lib</h1>
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="100" class="pic high">
99-
<div class="chart"><div class="cover-fill cover-full" style="width: 100%"></div><div class="cover-empty" style="width: 0%"></div></div>
98+
<td data-value="96.11" class="pic high">
99+
<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="100" class="pct high">100%</td>
102-
<td data-value="92" class="abs high">92/92</td>
103-
<td data-value="100" class="pct high">100%</td>
104-
<td data-value="3" class="abs high">3/3</td>
101+
<td data-value="96.11" class="pct high">96.11%</td>
102+
<td data-value="103" class="abs high">99/103</td>
103+
<td data-value="50" class="pct medium">50%</td>
104+
<td data-value="4" class="abs medium">2/4</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="100" class="pct high">100%</td>
108-
<td data-value="92" class="abs high">92/92</td>
107+
<td data-value="96.11" class="pct high">96.11%</td>
108+
<td data-value="103" class="abs high">99/103</td>
109109
</tr>
110110

111111
</tbody>
@@ -116,7 +116,7 @@ <h1><a href="../../../../index.html">All files</a> ndarray/base/shift/lib</h1>
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-24T15:22:00.775Z
119+
at 2025-09-24T17:07:07.454Z
120120
</div>
121121
<script src="../../../../prettify.js"></script>
122122
<script>

ndarray/base/shift/index.js.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ <h1><a href="../../../../index.html">All files</a> / <a href="index.html">ndarra
202202
'use strict';
203203
&nbsp;
204204
/**
205-
* Return an array containing a truncated view of an input ndarray and a complementary view of the first element(s) along a specified dimension.
205+
* Return an array containing a truncated view of an input ndarray and a view of the first element(s) along a specified dimension.
206206
*
207207
* @module @stdlib/ndarray/base/shift
208208
*
@@ -222,7 +222,7 @@ <h1><a href="../../../../index.html">All files</a> / <a href="index.html">ndarra
222222
* var arr = ndarray2array( x );
223223
* // returns [ [ 1.0, 2.0 ], [ 3.0, 4.0 ], [ 5.0, 6.0 ] ]
224224
*
225-
* var y = shift( x, 0, false, false );
225+
* var y = shift( x, 0, false );
226226
* // returns [ &lt;ndarray&gt;, &lt;ndarray&gt; ]
227227
*
228228
* arr = ndarray2array( y[ 0 ] );
@@ -247,7 +247,7 @@ <h1><a href="../../../../index.html">All files</a> / <a href="index.html">ndarra
247247
<div class='footer quiet pad2 space-top1 center small'>
248248
Code coverage generated by
249249
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
250-
at 2025-09-24T15:22:00.775Z
250+
at 2025-09-24T17:07:07.454Z
251251
</div>
252252
<script src="../../../../prettify.js"></script>
253253
<script>

ndarray/base/shift/main.js.html

Lines changed: 61 additions & 28 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">100% </span>
26+
<span class="strong">96.11% </span>
2727
<span class="quiet">Statements</span>
28-
<span class='fraction'>92/92</span>
28+
<span class='fraction'>99/103</span>
2929
</div>
3030

3131

3232
<div class='fl pad1y space-right2'>
33-
<span class="strong">100% </span>
33+
<span class="strong">50% </span>
3434
<span class="quiet">Branches</span>
35-
<span class='fraction'>3/3</span>
35+
<span class='fraction'>2/4</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">100% </span>
47+
<span class="strong">96.11% </span>
4848
<span class="quiet">Lines</span>
49-
<span class='fraction'>92/92</span>
49+
<span class='fraction'>99/103</span>
5050
</div>
5151

5252

@@ -155,7 +155,19 @@ <h1><a href="../../../../index.html">All files</a> / <a href="index.html">ndarra
155155
<a name='L90'></a><a href='#L90'>90</a>
156156
<a name='L91'></a><a href='#L91'>91</a>
157157
<a name='L92'></a><a href='#L92'>92</a>
158-
<a name='L93'></a><a href='#L93'>93</a></td><td class="line-coverage quiet"><span class="cline-any cline-yes">1x</span>
158+
<a name='L93'></a><a href='#L93'>93</a>
159+
<a name='L94'></a><a href='#L94'>94</a>
160+
<a name='L95'></a><a href='#L95'>95</a>
161+
<a name='L96'></a><a href='#L96'>96</a>
162+
<a name='L97'></a><a href='#L97'>97</a>
163+
<a name='L98'></a><a href='#L98'>98</a>
164+
<a name='L99'></a><a href='#L99'>99</a>
165+
<a name='L100'></a><a href='#L100'>100</a>
166+
<a name='L101'></a><a href='#L101'>101</a>
167+
<a name='L102'></a><a href='#L102'>102</a>
168+
<a name='L103'></a><a href='#L103'>103</a>
169+
<a name='L104'></a><a href='#L104'>104</a></td><td class="line-coverage quiet"><span class="cline-any cline-yes">1x</span>
170+
<span class="cline-any cline-yes">1x</span>
159171
<span class="cline-any cline-yes">1x</span>
160172
<span class="cline-any cline-yes">1x</span>
161173
<span class="cline-any cline-yes">1x</span>
@@ -219,6 +231,10 @@ <h1><a href="../../../../index.html">All files</a> / <a href="index.html">ndarra
219231
<span class="cline-any cline-yes">1x</span>
220232
<span class="cline-any cline-yes">1x</span>
221233
<span class="cline-any cline-yes">1x</span>
234+
<span class="cline-any cline-yes">1x</span>
235+
<span class="cline-any cline-yes">6x</span>
236+
<span class="cline-any cline-yes">6x</span>
237+
<span class="cline-any cline-yes">6x</span>
222238
<span class="cline-any cline-yes">6x</span>
223239
<span class="cline-any cline-yes">6x</span>
224240
<span class="cline-any cline-yes">6x</span>
@@ -229,13 +245,19 @@ <h1><a href="../../../../index.html">All files</a> / <a href="index.html">ndarra
229245
<span class="cline-any cline-yes">6x</span>
230246
<span class="cline-any cline-yes">6x</span>
231247
<span class="cline-any cline-yes">6x</span>
248+
<span class="cline-any cline-no">&nbsp;</span>
249+
<span class="cline-any cline-no">&nbsp;</span>
250+
<span class="cline-any cline-yes">6x</span>
251+
<span class="cline-any cline-yes">6x</span>
252+
<span class="cline-any cline-yes">6x</span>
253+
<span class="cline-any cline-no">&nbsp;</span>
254+
<span class="cline-any cline-no">&nbsp;</span>
255+
<span class="cline-any cline-yes">6x</span>
232256
<span class="cline-any cline-yes">6x</span>
233257
<span class="cline-any cline-yes">6x</span>
234258
<span class="cline-any cline-yes">6x</span>
235259
<span class="cline-any cline-yes">6x</span>
236260
<span class="cline-any cline-yes">6x</span>
237-
<span class="cline-any cline-yes">12x</span>
238-
<span class="cline-any cline-yes">12x</span>
239261
<span class="cline-any cline-yes">6x</span>
240262
<span class="cline-any cline-yes">6x</span>
241263
<span class="cline-any cline-yes">6x</span>
@@ -269,23 +291,25 @@ <h1><a href="../../../../index.html">All files</a> / <a href="index.html">ndarra
269291
&nbsp;
270292
// MODULES //
271293
&nbsp;
272-
var ndims = require( '@stdlib/ndarray/base/ndims' );
273294
var normalizeIndex = require( '@stdlib/ndarray/base/normalize-index' );
274295
var getShape = require( '@stdlib/ndarray/base/shape' );
275296
var sliceFrom = require( '@stdlib/ndarray/base/slice-from' );
276297
var sliceTo = require( '@stdlib/ndarray/base/slice-to' );
298+
var nulls = require( '@stdlib/array/base/nulls' );
299+
var format = require( '@stdlib/string/format' );
277300
&nbsp;
278301
&nbsp;
279302
// MAIN //
280303
&nbsp;
281304
/**
282-
* Returns an array containing a truncated view of an input ndarray and a complementary view of the first element(s) along a specified dimension.
305+
* Returns an array containing a truncated view of an input ndarray and a view of the first element(s) along a specified dimension.
283306
*
284307
* @param {ndarray} x - input array
285308
* @param {integer} dim - dimension along which to perform the operation
286-
* @param {boolean} strict - boolean indicating whether to enforce strict bounds checking
287309
* @param {boolean} writable - boolean indicating whether returned arrays should be writable
288-
* @returns {Array} a list of ndarrays
310+
* @throws {TypeError} first argument must be an ndarray having one or more dimensions
311+
* @throws {RangeError} dimension index exceeds the number of dimensions
312+
* @returns {Array&lt;ndarray&gt;} a list of ndarrays
289313
*
290314
* @example
291315
* var ndarray = require( '@stdlib/ndarray/ctor' );
@@ -302,36 +326,45 @@ <h1><a href="../../../../index.html">All files</a> / <a href="index.html">ndarra
302326
* var arr = ndarray2array( x );
303327
* // returns [ [ 1.0, 2.0 ], [ 3.0, 4.0 ], [ 5.0, 6.0 ] ]
304328
*
305-
* var y = shift( x, 0, false, false );
329+
* var y = shift( x, 0, false );
306330
* // returns [ &lt;ndarray&gt;, &lt;ndarray&gt; ]
307331
*
308332
* arr = ndarray2array( y[ 0 ] );
309-
* // returns [ [ 3, 4 ], [ 5, 6 ] ]
333+
* // returns [ [ 3.0, 4.0 ], [ 5.0, 6.0 ] ]
310334
*
311335
* arr = ndarray2array( y[ 1 ] );
312-
* // returns [ [ 1, 2 ] ]
336+
* // returns [ [ 1.0, 2.0 ] ]
313337
*/
314-
function shift( x, dim, strict, writable ) {
338+
function shift( x, dim, writable ) {
315339
var v0;
316340
var v1;
317341
var sh;
318342
var N;
319343
var s;
320-
var i;
321344
&nbsp;
322345
// Retrieve array meta data:
323346
sh = getShape( x );
324-
N = ndims( x );
347+
N = sh.length;
325348
&nbsp;
326-
// Resolve view slice:
327-
s = [];
328-
for ( i = 0; i &lt; N; i++ ) {
329-
s[ i ] = null;
330-
}
331-
dim = normalizeIndex( dim, N -1 );
349+
// Check whether we were provided a zero-dimensional array...
350+
if ( N === 0 ) <span class="branch-0 cbranch-no" title="branch not covered" >{</span>
351+
<span class="cstat-no" title="statement not covered" > throw new TypeError( format( 'invalid argument. First argument must be an ndarray having one or more dimensions. Number of dimensions: %d.', N ) );</span>
352+
<span class="cstat-no" title="statement not covered" > }</span>
353+
// Normalize the dimension index:
354+
dim = normalizeIndex( dim, N-1 );
355+
if ( dim === -1 ) <span class="branch-0 cbranch-no" title="branch not covered" >{</span>
356+
<span class="cstat-no" title="statement not covered" > throw new RangeError( format( 'invalid argument. Dimension index exceeds the number of dimensions. Number of dimensions: %d. Value: `%d`.', N, dim ) );</span>
357+
<span class="cstat-no" title="statement not covered" > }</span>
358+
// Define a list of slice arguments:
359+
s = nulls( N );
332360
s[ dim ] = sh[ dim ] - ( sh[ dim ] - 1 );
333-
v0 = sliceFrom( x, s, strict, writable );
334-
v1 = sliceTo( x, s, strict, writable );
361+
&nbsp;
362+
// Create a truncated view:
363+
v0 = sliceFrom( x, s, true, writable );
364+
&nbsp;
365+
// Create a view of the first element(s):
366+
v1 = sliceTo( x, s, true, writable );
367+
&nbsp;
335368
return [ v0, v1 ];
336369
}
337370
&nbsp;
@@ -346,7 +379,7 @@ <h1><a href="../../../../index.html">All files</a> / <a href="index.html">ndarra
346379
<div class='footer quiet pad2 space-top1 center small'>
347380
Code coverage generated by
348381
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
349-
at 2025-09-24T15:22:00.775Z
382+
at 2025-09-24T17:07:07.454Z
350383
</div>
351384
<script src="../../../../prettify.js"></script>
352385
<script>

0 commit comments

Comments
 (0)