Skip to content

Commit e8775fc

Browse files
stdlib-botkgryte
andauthored
feat: update namespace TypeScript declarations
PR-URL: stdlib-js#951 Co-authored-by: Athan Reines <kgryte@gmail.com> Reviewed-by: Athan Reines <kgryte@gmail.com>
1 parent e554460 commit e8775fc

5 files changed

Lines changed: 309 additions & 0 deletions

File tree

lib/node_modules/@stdlib/ndarray/base/docs/types/index.d.ts

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ import minViewBufferIndex = require( '@stdlib/ndarray/base/min-view-buffer-index
5353
import minmaxViewBufferIndex = require( '@stdlib/ndarray/base/minmax-view-buffer-index' );
5454
import ndarraylike2object = require( '@stdlib/ndarray/base/ndarraylike2object' );
5555
import nonsingletonDimensions = require( '@stdlib/ndarray/base/nonsingleton-dimensions' );
56+
import nullaryLoopOrder = require( '@stdlib/ndarray/base/nullary-loop-interchange-order' );
57+
import nullaryBlockSize = require( '@stdlib/ndarray/base/nullary-tiling-block-size' );
5658
import numel = require( '@stdlib/ndarray/base/numel' );
5759
import prependSingletonDimensions = require( '@stdlib/ndarray/base/prepend-singleton-dimensions' );
5860
import removeSingletonDimensions = require( '@stdlib/ndarray/base/remove-singleton-dimensions' );
@@ -1052,6 +1054,52 @@ interface Namespace {
10521054
*/
10531055
nonsingletonDimensions: typeof nonsingletonDimensions;
10541056

1057+
/**
1058+
* Reorders ndarray dimensions and associated strides for loop interchange.
1059+
*
1060+
* ## Notes
1061+
*
1062+
* - The returned object has the following properties:
1063+
*
1064+
* - **sh**: dimensions sorted in loop order.
1065+
* - **sx**: ndarray strides sorted in loop order.
1066+
*
1067+
* - 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.
1068+
*
1069+
* 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 minimized cache misses and ensure locality of reference.
1070+
*
1071+
* @param sh - array dimensions
1072+
* @param sx - array stride lengths
1073+
* @returns loop interchange data
1074+
*
1075+
* @example
1076+
* var sh = [ 2, 3, 4 ];
1077+
*
1078+
* var sx = [ 12, 4, 1 ]; // row-major
1079+
*
1080+
* var o = ns.nullaryLoopOrder( sh, sx );
1081+
* // returns {...}
1082+
*
1083+
* var ssh = o.sh;
1084+
* // returns [ 4, 3, 2 ]
1085+
*
1086+
* var ssx = o.sx;
1087+
* // returns [ 1, 4, 12 ]
1088+
*/
1089+
nullaryLoopOrder: typeof nullaryLoopOrder;
1090+
1091+
/**
1092+
* Returns a loop block size for multi-dimensional array tiled loops.
1093+
*
1094+
* @param dtypeX - array data type
1095+
* @returns block size (in units of elements)
1096+
*
1097+
* @example
1098+
* var bsize = ns.nullaryBlockSize( 'float64' );
1099+
* // returns <number>
1100+
*/
1101+
nullaryBlockSize: typeof nullaryBlockSize;
1102+
10551103
/**
10561104
* Returns the number of elements in an array.
10571105
*

lib/node_modules/@stdlib/random/array/docs/types/index.d.ts

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,14 @@
2424
import arcsine = require( '@stdlib/random/array/arcsine' );
2525
import beta = require( '@stdlib/random/array/beta' );
2626
import betaprime = require( '@stdlib/random/array/betaprime' );
27+
import cosine = require( '@stdlib/random/array/cosine' );
2728
import discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
2829
import exponential = require( '@stdlib/random/array/exponential' );
2930
import gamma = require( '@stdlib/random/array/gamma' );
3031
import invgamma = require( '@stdlib/random/array/invgamma' );
3132
import lognormal = require( '@stdlib/random/array/lognormal' );
3233
import minstd = require( '@stdlib/random/array/minstd' );
34+
import minstdShuffle = require( '@stdlib/random/array/minstd-shuffle' );
3335
import mt19937 = require( '@stdlib/random/array/mt19937' );
3436
import normal = require( '@stdlib/random/array/normal' );
3537
import randu = require( '@stdlib/random/array/randu' );
@@ -102,6 +104,27 @@ interface Namespace {
102104
*/
103105
betaprime: typeof betaprime;
104106

107+
/**
108+
* Returns an array containing pseudorandom numbers drawn from a raised cosine distribution with parameters `mu` (mean) and `s` (scale parameter).
109+
*
110+
* @param len - array length
111+
* @param mu - mean
112+
* @param s - scale parameter
113+
* @param options - function options
114+
* @returns output array
115+
*
116+
* @example
117+
* var out = ns.cosine( 10, 2.0, 5.0 );
118+
* // returns <Float64Array>
119+
*
120+
* @example
121+
* var random = ns.cosine.factory( 2.0, 5.0 );
122+
*
123+
* var out = random( 10 );
124+
* // returns <Float64Array>
125+
*/
126+
cosine: typeof cosine;
127+
105128
/**
106129
* Returns an array containing pseudorandom numbers drawn from a discrete uniform distribution with minimum support `a` and maximum support `b`.
107130
*
@@ -229,6 +252,29 @@ interface Namespace {
229252
*/
230253
minstd: typeof minstd;
231254

255+
/**
256+
* Returns an array containing pseudorandom numbers using a linear congruential pseudorandom number generator (LCG) whose output is shuffled.
257+
*
258+
* @param len - array length
259+
* @param options - function options
260+
* @returns output array
261+
*
262+
* @example
263+
* var out = ns.minstdShuffle( 10 );
264+
* // returns <Float64Array>
265+
*
266+
* @example
267+
* var out = ns.minstdShuffle.normalized( 10 );
268+
* // returns <Float64Array>
269+
*
270+
* @example
271+
* var random = ns.minstdShuffle.factory();
272+
*
273+
* var out = random( 10 );
274+
* // returns <Float64Array>
275+
*/
276+
minstdShuffle: typeof minstdShuffle;
277+
232278
/**
233279
* Returns an array containing pseudorandom numbers using a 32-bit Mersenne Twister pseudorandom number generator.
234280
*

lib/node_modules/@stdlib/random/strided/docs/types/index.d.ts

Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,14 @@
2424
import arcsine = require( '@stdlib/random/strided/arcsine' );
2525
import beta = require( '@stdlib/random/strided/beta' );
2626
import betaprime = require( '@stdlib/random/strided/betaprime' );
27+
import cosine = require( '@stdlib/random/strided/cosine' );
2728
import discreteUniform = require( '@stdlib/random/strided/discrete-uniform' );
2829
import exponential = require( '@stdlib/random/strided/exponential' );
30+
import gamma = require( '@stdlib/random/strided/gamma' );
31+
import invgamma = require( '@stdlib/random/strided/invgamma' );
2932
import lognormal = require( '@stdlib/random/strided/lognormal' );
3033
import minstd = require( '@stdlib/random/strided/minstd' );
34+
import minstdShuffle = require( '@stdlib/random/strided/minstd-shuffle' );
3135
import mt19937 = require( '@stdlib/random/strided/mt19937' );
3236
import normal = require( '@stdlib/random/strided/normal' );
3337
import randu = require( '@stdlib/random/strided/randu' );
@@ -145,6 +149,42 @@ interface Namespace {
145149
*/
146150
betaprime: typeof betaprime;
147151

152+
/**
153+
* Fills a strided array with pseudorandom numbers drawn from a raised cosine distribution.
154+
*
155+
* @param N - number of indexed elements
156+
* @param mu - mean
157+
* @param sm - `mu` stride length
158+
* @param s - scale parameter
159+
* @param ss - `s` stride length
160+
* @param out - output array
161+
* @param so - `out` stride length
162+
* @param options - function options
163+
* @throws must provide valid distribution parameters
164+
* @throws must provide valid options
165+
* @throws must provide a valid state
166+
* @returns output array
167+
*
168+
* @example
169+
* var Float64Array = require( `@stdlib/array/float64` );
170+
*
171+
* // Create an array:
172+
* var out = new Float64Array( 10 );
173+
*
174+
* // Fill the array with pseudorandom numbers:
175+
* ns.cosine( out.length, [ 2.0 ], 0, [ 5.0 ], 0, out, 1 );
176+
*
177+
* @example
178+
* var Float64Array = require( `@stdlib/array/float64` );
179+
*
180+
* // Create an array:
181+
* var out = new Float64Array( 10 );
182+
*
183+
* // Fill the array with pseudorandom numbers:
184+
* ns.cosine.ndarray( out.length, [ 2.0 ], 0, 0, [ 5.0 ], 0, 0, out, 1, 0 );
185+
*/
186+
cosine: typeof cosine;
187+
148188
/**
149189
* Fills a strided array with pseudorandom numbers drawn from a discrete uniform distribution.
150190
*
@@ -215,6 +255,78 @@ interface Namespace {
215255
*/
216256
exponential: typeof exponential;
217257

258+
/**
259+
* Fills a strided array with pseudorandom numbers drawn from a gamma distribution.
260+
*
261+
* @param N - number of indexed elements
262+
* @param alpha - shape parameter
263+
* @param sa - `alpha` stride length
264+
* @param beta - rate parameter
265+
* @param sb - `beta` stride length
266+
* @param out - output array
267+
* @param so - `out` stride length
268+
* @param options - function options
269+
* @throws must provide valid distribution parameters
270+
* @throws must provide valid options
271+
* @throws must provide a valid state
272+
* @returns output array
273+
*
274+
* @example
275+
* var Float64Array = require( `@stdlib/array/float64` );
276+
*
277+
* // Create an array:
278+
* var out = new Float64Array( 10 );
279+
*
280+
* // Fill the array with pseudorandom numbers:
281+
* ns.gamma( out.length, [ 2.0 ], 0, [ 5.0 ], 0, out, 1 );
282+
*
283+
* @example
284+
* var Float64Array = require( `@stdlib/array/float64` );
285+
*
286+
* // Create an array:
287+
* var out = new Float64Array( 10 );
288+
*
289+
* // Fill the array with pseudorandom numbers:
290+
* ns.gamma.ndarray( out.length, [ 2.0 ], 0, 0, [ 5.0 ], 0, 0, out, 1, 0 );
291+
*/
292+
gamma: typeof gamma;
293+
294+
/**
295+
* Fills a strided array with pseudorandom numbers drawn from an inverse gamma distribution.
296+
*
297+
* @param N - number of indexed elements
298+
* @param alpha - shape parameter
299+
* @param sa - `alpha` stride length
300+
* @param beta - scale parameter
301+
* @param sb - `beta` stride length
302+
* @param out - output array
303+
* @param so - `out` stride length
304+
* @param options - function options
305+
* @throws must provide valid distribution parameters
306+
* @throws must provide valid options
307+
* @throws must provide a valid state
308+
* @returns output array
309+
*
310+
* @example
311+
* var Float64Array = require( `@stdlib/array/float64` );
312+
*
313+
* // Create an array:
314+
* var out = new Float64Array( 10 );
315+
*
316+
* // Fill the array with pseudorandom numbers:
317+
* ns.invgamma( out.length, [ 2.0 ], 0, [ 5.0 ], 0, out, 1 );
318+
*
319+
* @example
320+
* var Float64Array = require( `@stdlib/array/float64` );
321+
*
322+
* // Create an array:
323+
* var out = new Float64Array( 10 );
324+
*
325+
* // Fill the array with pseudorandom numbers:
326+
* ns.invgamma.ndarray( out.length, [ 2.0 ], 0, 0, [ 5.0 ], 0, 0, out, 1, 0 );
327+
*/
328+
invgamma: typeof invgamma;
329+
218330
/**
219331
* Fills a strided array with pseudorandom numbers drawn from a lognormal distribution.
220332
*
@@ -300,6 +412,55 @@ interface Namespace {
300412
*/
301413
minstd: typeof minstd;
302414

415+
/**
416+
* Fills a strided array with pseudorandom integers on the interval `[1, 2147483646]`.
417+
*
418+
* @param N - number of indexed elements
419+
* @param out - output array
420+
* @param so - `out` stride length
421+
* @param options - function options
422+
* @throws must provide valid options
423+
* @throws must provide a valid state
424+
* @returns output array
425+
*
426+
* @example
427+
* var Float64Array = require( `@stdlib/array/float64` );
428+
*
429+
* // Create an array:
430+
* var out = new Float64Array( 10 );
431+
*
432+
* // Fill the array with pseudorandom numbers:
433+
* ns.minstdShuffle( out.length, out, 1 );
434+
*
435+
* @example
436+
* var Float64Array = require( `@stdlib/array/float64` );
437+
*
438+
* // Create an array:
439+
* var out = new Float64Array( 10 );
440+
*
441+
* // Fill the array with pseudorandom numbers:
442+
* ns.minstdShuffle.ndarray( out.length, out, 1, 0 );
443+
*
444+
* @example
445+
* var Float64Array = require( `@stdlib/array/float64` );
446+
*
447+
* // Create an array:
448+
* var out = new Float64Array( 10 );
449+
*
450+
* // Fill the array with pseudorandom numbers:
451+
* ns.minstdShuffle.normalized( out.length, out, 1 );
452+
*
453+
* @example
454+
* var Float64Array = require( `@stdlib/array/float64` );
455+
*
456+
* // Create an array:
457+
* var out = new Float64Array( 10 );
458+
*
459+
* // Fill the array with pseudorandom numbers:
460+
* ns.minstdShuffle.normalized.ndarray( out.length, out, 1, 0 );
461+
*/
462+
minstdShuffle: typeof minstdShuffle;
463+
303464
/**
304465
* Fills a strided array with pseudorandom integers on the interval `[0, 4294967295]`.
305466
*

lib/node_modules/@stdlib/string/base/docs/types/index.d.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import pascalcase = require( '@stdlib/string/base/pascalcase' );
3636
import percentEncode = require( '@stdlib/string/base/percent-encode' );
3737
import repeat = require( '@stdlib/string/base/repeat' );
3838
import replace = require( '@stdlib/string/base/replace' );
39+
import replaceBefore = require( '@stdlib/string/base/replace-before' );
3940
import rtrim = require( '@stdlib/string/base/right-trim' );
4041
import snakecase = require( '@stdlib/string/base/snakecase' );
4142
import startcase = require( '@stdlib/string/base/startcase' );
@@ -340,6 +341,32 @@ interface Namespace {
340341
*/
341342
replace: typeof replace;
342343

344+
/**
345+
* Replaces the substring before the first occurrence of a specified search string.
346+
*
347+
* @param str - input string
348+
* @param search - search string
349+
* @param replacement - replacement string
350+
* @returns output string
351+
*
352+
* @example
353+
* var out = ns.replaceBefore( 'beep boop', ' ', 'foo' );
354+
* // returns 'foo boop'
355+
*
356+
* @example
357+
* var out = ns.replaceBefore( 'beep boop', 'p', 'foo' );
358+
* // returns 'foop boop'
359+
*
360+
* @example
361+
* var out = ns.replaceBefore( 'Hello World!', '', 'foo' );
362+
* // returns 'Hello world!'
363+
*
364+
* @example
365+
* var out = ns.replaceBefore( 'Hello World!', 'xyz', 'foo' );
366+
* // returns 'Hello World!'
367+
*/
368+
replaceBefore: typeof replaceBefore;
369+
343370
/**
344371
* Trims whitespace from the end of a string.
345372
*

0 commit comments

Comments
 (0)