@stdlib/math-tools-unary 0.0.5 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CITATION.cff ADDED
@@ -0,0 +1,30 @@
1
+ cff-version: 1.2.0
2
+ title: stdlib
3
+ message: >-
4
+ If you use this software, please cite it using the
5
+ metadata from this file.
6
+
7
+ type: software
8
+
9
+ authors:
10
+ - name: The Stdlib Authors
11
+ url: https://github.com/stdlib-js/stdlib/graphs/contributors
12
+
13
+ repository-code: https://github.com/stdlib-js/stdlib
14
+ url: https://stdlib.io
15
+
16
+ abstract: |
17
+ Standard library for JavaScript and Node.js.
18
+
19
+ keywords:
20
+ - JavaScript
21
+ - Node.js
22
+ - TypeScript
23
+ - standard library
24
+ - scientific computing
25
+ - numerical computing
26
+ - statistical computing
27
+
28
+ license: Apache-2.0 AND BSL-1.0
29
+
30
+ date-released: 2016
package/LICENSE CHANGED
@@ -175,307 +175,3 @@
175
175
  of your accepting any such warranty or additional liability.
176
176
 
177
177
  END OF TERMS AND CONDITIONS
178
-
179
-
180
-
181
- Boost Software License - Version 1.0 - August 17th, 2003
182
-
183
- Permission is hereby granted, free of charge, to any person or organization
184
- obtaining a copy of the software and accompanying documentation covered by this
185
- license (the "Software") to use, reproduce, display, distribute, execute, and
186
- transmit the Software, and to prepare derivative works of the Software, and to
187
- permit third-parties to whom the Software is furnished to do so, all subject to
188
- the following:
189
-
190
- The copyright notices in the Software and this entire statement, including the
191
- above license grant, this restriction and the following disclaimer, must be
192
- included in all copies of the Software, in whole or in part, and all derivative
193
- works of the Software, unless such copies or derivative works are solely in the
194
- form of machine-executable object code generated by a source language processor.
195
-
196
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
197
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
198
- FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
199
- COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES
200
- OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
201
- OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
202
-
203
-
204
-
205
-
206
- DEPENDENCIES
207
-
208
- The library links against the following external libraries, which have their own
209
- licenses:
210
-
211
- * OpenBLAS <https://raw.githubusercontent.com/xianyi/OpenBLAS/
212
- def146efed8d5908ea04e22668feeab7099599a0/LICENSE>
213
-
214
- Copyright (c) 2011-2014, The OpenBLAS Project
215
- All rights reserved.
216
-
217
- Redistribution and use in source and binary forms, with or without
218
- modification, are permitted provided that the following conditions are
219
- met:
220
-
221
- 1. Redistributions of source code must retain the above copyright
222
- notice, this list of conditions and the following disclaimer.
223
-
224
- 2. Redistributions in binary form must reproduce the above copyright
225
- notice, this list of conditions and the following disclaimer in
226
- the documentation and/or other materials provided with the
227
- distribution.
228
-
229
- 3. Neither the name of the OpenBLAS project nor the names of
230
- its contributors may be used to endorse or promote products
231
- derived from this software without specific prior written
232
- permission.
233
-
234
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
235
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
236
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
237
- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
238
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
239
- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
240
- GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
241
- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
242
- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
243
- THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
244
-
245
-
246
- * Electron <https://raw.githubusercontent.com/electron/electron/
247
- c4cfb3e7110266b9d7ad80e1ae097c4db564501c/LICENSE>
248
-
249
- Copyright (c) 2013-2017 GitHub Inc.
250
-
251
- Permission is hereby granted, free of charge, to any person obtaining
252
- a copy of this software and associated documentation files (the
253
- "Software"), to deal in the Software without restriction, including
254
- without limitation the rights to use, copy, modify, merge, publish,
255
- distribute, sublicense, and/or sell copies of the Software, and to
256
- permit persons to whom the Software is furnished to do so, subject to
257
- the following conditions:
258
-
259
- The above copyright notice and this permission notice shall be
260
- included in all copies or substantial portions of the Software.
261
-
262
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
263
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
264
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
265
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
266
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
267
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
268
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
269
-
270
-
271
- * Boost <http://www.boost.org/LICENSE_1_0.txt>
272
-
273
- Boost Software License - Version 1.0 - August 17th, 2003
274
-
275
- Permission is hereby granted, free of charge, to any person or organization
276
- obtaining a copy of the software and accompanying documentation covered by
277
- this license (the "Software") to use, reproduce, display, distribute,
278
- execute, and transmit the Software, and to prepare derivative works of the
279
- Software, and to permit third-parties to whom the Software is furnished to
280
- do so, all subject to the following:
281
-
282
- The copyright notices in the Software and this entire statement, including
283
- the above license grant, this restriction and the following disclaimer,
284
- must be included in all copies of the Software, in whole or in part, and
285
- all derivative works of the Software, unless such copies or derivative
286
- works are solely in the form of machine-executable object code generated by
287
- a source language processor.
288
-
289
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
290
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
291
- FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
292
- SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
293
- FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
294
- ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
295
- DEALINGS IN THE SOFTWARE.
296
-
297
-
298
- * Cephes <http://www.netlib.org/cephes/readme>
299
-
300
- Copyright (c) 1984-2000 Stephen L. Moshier
301
-
302
- Some software in this archive may be from the book _Methods and Programs for
303
- Mathematical Functions_ (Prentice-Hall or Simon & Schuster International, 1989)
304
- or from the Cephes Mathematical Library, a commercial product. In either event,
305
- it is copyrighted by the author. What you see here may be used freely but it
306
- comes with no support or guarantee.
307
-
308
- Stephen L. Moshier
309
- moshier@na-net.ornl.gov
310
-
311
-
312
-
313
- ATTRIBUTION
314
-
315
- The library contains implementations from the following external libraries,
316
- which have their own licenses:
317
-
318
- * FreeBSD <https://svnweb.freebsd.org/>
319
-
320
- Copyright (C) 1993-2004 by Sun Microsystems, Inc. All rights reserved.
321
-
322
- Developed at SunPro, a Sun Microsystems, Inc. business.
323
- Permission to use, copy, modify, and distribute this
324
- software is freely granted, provided that this notice
325
- is preserved.
326
-
327
-
328
- * FDLIBM <http://www.netlib.org/fdlibm/>
329
-
330
- Copyright (C) 2004 by Sun Microsystems, Inc. All rights reserved.
331
-
332
- Developed at SunPro, a Sun Microsystems, Inc. business.
333
- Permission to use, copy, modify, and distribute this
334
- software is freely granted, provided that this notice
335
- is preserved.
336
-
337
-
338
- * Go <https://raw.githubusercontent.com/golang/go/master/LICENSE>
339
-
340
- Copyright (c) 2009 The Go Authors. All rights reserved.
341
-
342
- Redistribution and use in source and binary forms, with or without
343
- modification, are permitted provided that the following conditions are
344
- met:
345
-
346
- * Redistributions of source code must retain the above copyright
347
- notice, this list of conditions and the following disclaimer.
348
- * Redistributions in binary form must reproduce the above
349
- copyright notice, this list of conditions and the following disclaimer
350
- in the documentation and/or other materials provided with the
351
- distribution.
352
- * Neither the name of Google Inc. nor the names of its
353
- contributors may be used to endorse or promote products derived from
354
- this software without specific prior written permission.
355
-
356
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
357
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
358
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
359
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
360
- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
361
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
362
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
363
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
364
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
365
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
366
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
367
-
368
-
369
- * SLATEC Common Mathematical Library <http://www.netlib.no/netlib/slatec/>
370
-
371
- Public domain.
372
-
373
-
374
- * ESLint <https://raw.githubusercontent.com/eslint/eslint/master/LICENSE>
375
-
376
- Copyright JS Foundation and other contributors, https://js.foundation
377
-
378
- Permission is hereby granted, free of charge, to any person obtaining a copy
379
- of this software and associated documentation files (the "Software"), to deal
380
- in the Software without restriction, including without limitation the rights
381
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
382
- copies of the Software, and to permit persons to whom the Software is
383
- furnished to do so, subject to the following conditions:
384
-
385
- The above copyright notice and this permission notice shall be included in
386
- all copies or substantial portions of the Software.
387
-
388
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
389
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
390
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
391
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
392
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
393
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
394
- THE SOFTWARE.
395
-
396
-
397
- * StatsFuns.jl <https://raw.githubusercontent.com/JuliaStats/StatsFuns.jl/
398
- e66dd973650c375bc1739c820e5b96bb5bd000a8/LICENSE.md>
399
-
400
- Copyright (c) 2015: Dahua Lin.
401
-
402
- Permission is hereby granted, free of charge, to any person obtaining
403
- a copy of this software and associated documentation files (the
404
- "Software"), to deal in the Software without restriction, including
405
- without limitation the rights to use, copy, modify, merge, publish,
406
- distribute, sublicense, and/or sell copies of the Software, and to
407
- permit persons to whom the Software is furnished to do so, subject to
408
- the following conditions:
409
-
410
- The above copyright notice and this permission notice shall be
411
- included in all copies or substantial portions of the Software.
412
-
413
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
414
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
415
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
416
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
417
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
418
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
419
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
420
-
421
-
422
- * SpecialFunctions.jl <https://raw.githubusercontent.com/JuliaMath/
423
- SpecialFunctions.jl/02a173fbe24a61c4b392aec17a9764ac5727feb1/LICENSE>
424
-
425
- The MIT License (MIT)
426
-
427
- Copyright (c) 2017 Jeff Bezanson, Stefan Karpinski, Viral B. Shah, and others:
428
-
429
- https://github.com/JuliaMath/SpecialFunctions.jl/graphs/contributors
430
-
431
- Permission is hereby granted, free of charge, to any person obtaining a copy
432
- of this software and associated documentation files (the "Software"), to deal
433
- in the Software without restriction, including without limitation the rights
434
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
435
- copies of the Software, and to permit persons to whom the Software is
436
- furnished to do so, subject to the following conditions:
437
-
438
- The above copyright notice and this permission notice shall be included in all
439
- copies or substantial portions of the Software.
440
-
441
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
442
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
443
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
444
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
445
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
446
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
447
- SOFTWARE.
448
-
449
-
450
- * MT19937 <http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/MT2002/CODES/
451
- mt19937ar.c>
452
-
453
- Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,
454
- All rights reserved.
455
-
456
- Redistribution and use in source and binary forms, with or without
457
- modification, are permitted provided that the following conditions
458
- are met:
459
-
460
- 1. Redistributions of source code must retain the above copyright
461
- notice, this list of conditions and the following disclaimer.
462
-
463
- 2. Redistributions in binary form must reproduce the above copyright
464
- notice, this list of conditions and the following disclaimer in the
465
- documentation and/or other materials provided with the distribution.
466
-
467
- 3. The names of its contributors may not be used to endorse or promote
468
- products derived from this software without specific prior written
469
- permission.
470
-
471
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
472
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
473
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
474
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
475
- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
476
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
477
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
478
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
479
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
480
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
481
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package/NOTICE CHANGED
@@ -1 +1 @@
1
- Copyright (c) 2016-2021 The Stdlib Authors.
1
+ Copyright (c) 2016-2023 The Stdlib Authors.
package/README.md CHANGED
@@ -18,9 +18,20 @@ limitations under the License.
18
18
 
19
19
  -->
20
20
 
21
+
22
+ <details>
23
+ <summary>
24
+ About stdlib...
25
+ </summary>
26
+ <p>We believe in a future in which the web is a preferred environment for numerical computation. To help realize this future, we've built stdlib. stdlib is a standard library, with an emphasis on numerical and scientific computation, written in JavaScript (and C) for execution in browsers and in Node.js.</p>
27
+ <p>The library is fully decomposable, being architected in such a way that you can swap out and mix and match APIs and functionality to cater to your exact preferences and use cases.</p>
28
+ <p>When you use stdlib, you can be absolutely certain that you are using the most thorough, rigorous, well-written, studied, documented, tested, measured, and high-quality code out there.</p>
29
+ <p>To join us in bringing numerical computing to the web, get started by checking us out on <a href="https://github.com/stdlib-js/stdlib">GitHub</a>, and please consider <a href="https://opencollective.com/stdlib">financially supporting stdlib</a>. We greatly appreciate your continued support!</p>
30
+ </details>
31
+
21
32
  # Unary
22
33
 
23
- [![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] [![dependencies][dependencies-image]][dependencies-url]
34
+ [![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] <!-- [![dependencies][dependencies-image]][dependencies-url] -->
24
35
 
25
36
  > Multiple dispatch for unary mathematical functions.
26
37
 
@@ -324,6 +335,14 @@ for ( i = 0; i < x.length; i++ ) {
324
335
 
325
336
  <!-- /.references -->
326
337
 
338
+ <!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
339
+
340
+ <section class="related">
341
+
342
+ </section>
343
+
344
+ <!-- /.related -->
345
+
327
346
  <!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
328
347
 
329
348
 
@@ -350,7 +369,7 @@ See [LICENSE][stdlib-license].
350
369
 
351
370
  ## Copyright
352
371
 
353
- Copyright &copy; 2016-2021. The Stdlib [Authors][stdlib-authors].
372
+ Copyright &copy; 2016-2023. The Stdlib [Authors][stdlib-authors].
354
373
 
355
374
  </section>
356
375
 
@@ -363,22 +382,34 @@ Copyright &copy; 2016-2021. The Stdlib [Authors][stdlib-authors].
363
382
  [npm-image]: http://img.shields.io/npm/v/@stdlib/math-tools-unary.svg
364
383
  [npm-url]: https://npmjs.org/package/@stdlib/math-tools-unary
365
384
 
366
- [test-image]: https://github.com/stdlib-js/math-tools-unary/actions/workflows/test.yml/badge.svg
367
- [test-url]: https://github.com/stdlib-js/math-tools-unary/actions/workflows/test.yml
385
+ [test-image]: https://github.com/stdlib-js/math-tools-unary/actions/workflows/test.yml/badge.svg?branch=v0.1.0
386
+ [test-url]: https://github.com/stdlib-js/math-tools-unary/actions/workflows/test.yml?query=branch:v0.1.0
368
387
 
369
388
  [coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/math-tools-unary/main.svg
370
389
  [coverage-url]: https://codecov.io/github/stdlib-js/math-tools-unary?branch=main
371
390
 
391
+ <!--
392
+
372
393
  [dependencies-image]: https://img.shields.io/david/stdlib-js/math-tools-unary.svg
373
394
  [dependencies-url]: https://david-dm.org/stdlib-js/math-tools-unary/main
374
395
 
396
+ -->
397
+
375
398
  [chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg
376
- [chat-url]: https://gitter.im/stdlib-js/stdlib/
399
+ [chat-url]: https://app.gitter.im/#/room/#stdlib-js_stdlib:gitter.im
377
400
 
378
401
  [stdlib]: https://github.com/stdlib-js/stdlib
379
402
 
380
403
  [stdlib-authors]: https://github.com/stdlib-js/stdlib/graphs/contributors
381
404
 
405
+ [umd]: https://github.com/umdjs/umd
406
+ [es-module]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules
407
+
408
+ [deno-url]: https://github.com/stdlib-js/math-tools-unary/tree/deno
409
+ [umd-url]: https://github.com/stdlib-js/math-tools-unary/tree/umd
410
+ [esm-url]: https://github.com/stdlib-js/math-tools-unary/tree/esm
411
+ [branches-url]: https://github.com/stdlib-js/math-tools-unary/blob/main/branches.md
412
+
382
413
  [stdlib-license]: https://raw.githubusercontent.com/stdlib-js/math-tools-unary/main/LICENSE
383
414
 
384
415
  [@stdlib/ndarray/ctor]: https://www.npmjs.com/package/@stdlib/ndarray-ctor
@@ -0,0 +1,3 @@
1
+ /// <reference path="../docs/types/index.d.ts" />
2
+ import dispatch from '../docs/types/index';
3
+ export = dispatch;
package/dist/index.js ADDED
@@ -0,0 +1,15 @@
1
+ "use strict";var v=function(r,e){return function(){return e||r((e={exports:{}}).exports,e),e.exports}};var b=v(function(Pr,w){
2
+ var h=require('@stdlib/ndarray-ctor/dist'),q=require('@stdlib/ndarray-base-buffer/dist'),B=require('@stdlib/ndarray-base-shape2strides/dist'),G=require('@stdlib/ndarray-base-numel/dist'),H=require('@stdlib/array-base-copy-indexed/dist');function J(r,e,u,n){var t,i,d;return t=H(e.shape),t.length===0?(i=q(u,1),d=h(u,i,[],[0],0,n)):(i=q(u,e.length||G(t)),d=h(u,i,t,B(t,n),0,n)),r(e,d),d}w.exports=J
3
+ });var T=v(function(jr,E){
4
+ var Q=require('@stdlib/error-tools-fmtprodmsg/dist');function W(r,e){switch(e){case"same":return r;case"floating-point":return r==="float64"||r==="float32"||r==="generic"||r==="complex128"||r==="complex64"?r:"float64";case"real floating-point":return r==="float64"||r==="float32"||r==="generic"?r:"float64";case"complex floating-point":return r==="complex128"||r==="complex64"?r:"complex128";default:throw new Error(Q('0gz4W',e))}}E.exports=W
5
+ });var O=v(function(_r,X){X.exports={output_dtype_policy:"floating-point"}});var _=v(function(kr,j){
6
+ var Z=require('@stdlib/assert-is-plain-object/dist'),$=require('@stdlib/assert-has-own-property/dist'),x=require('@stdlib/assert-is-function/dist'),rr=require('@stdlib/assert-is-null/dist'),er=require('@stdlib/utils-keys/dist'),P=require('@stdlib/error-tools-fmtprodmsg/dist');function ar(r,e){var u,n,t,i;if(!Z(e))return new TypeError(P('0gz4Z',e));for(u=er(r),i=0;i<u.length;i++)if(t=u[i],$(e,t)){if(n=e[t],!x(n)&&!rr(n))return new TypeError(P('0gz4a',t,n));r[t]=n}return null}j.exports=ar
7
+ });var k=v(function(Rr,ir){ir.exports=["same","floating-point","real floating-point","complex floating-point"]});var z=v(function(Vr,V){
8
+ var nr=require('@stdlib/assert-is-plain-object/dist'),tr=require('@stdlib/assert-has-own-property/dist'),ur=require('@stdlib/assert-contains/dist'),R=require('@stdlib/error-tools-fmtprodmsg/dist'),or=k();function lr(r,e){return nr(e)?tr(e,"output_dtype_policy")&&(r.policy=e.output_dtype_policy,!ur(or,r.policy))?new TypeError(R('0gz4Y',"output_dtype_policy",r.policy)):null:new TypeError(R('0gz2V',e));}V.exports=lr
9
+ });var L=v(function(zr,S){
10
+ var sr=require('@stdlib/assert-is-plain-object/dist'),C=require('@stdlib/assert-has-own-property/dist'),I=require('@stdlib/assert-contains/dist'),pr=require('@stdlib/ndarray-orders/dist'),vr=require('@stdlib/ndarray-dtypes/dist'),c=require('@stdlib/error-tools-fmtprodmsg/dist'),dr=pr(),fr=vr();function cr(r,e){return sr(e)?C(e,"dtype")&&(r.dtype=e.dtype,!I(fr,r.dtype))?new TypeError(c('0gz4X',"dtype",r.dtype)):C(e,"order")&&(r.order=e.order,!I(dr,r.order))?new TypeError(c('0gz4X',"order",r.order)):null:new TypeError(c('0gz2V',e));}S.exports=cr
11
+ });var Y=v(function(Cr,U){
12
+ var mr=require('@stdlib/utils-define-nonenumerable-read-only-property/dist'),D=require('@stdlib/assert-is-number/dist').isPrimitive,M=require('@stdlib/assert-is-complex-like/dist'),m=require('@stdlib/assert-is-ndarray-like/dist'),g=require('@stdlib/assert-is-collection/dist'),y=require('@stdlib/ndarray-base-buffer-dtype/dist'),gr=require('@stdlib/ndarray-base-buffer/dist'),N=require('@stdlib/ndarray-base-broadcast-array/dist'),F=require('@stdlib/error-tools-fmtprodmsg/dist'),yr=b(),K=T(),hr=O(),qr=_(),wr=z(),br=L();function Er(r,e){var u,n,t,i;if(i={number:null,complex:null,array:null,ndarray:null},n=qr(i,r),n||(u={policy:hr.output_dtype_policy},arguments.length>1&&(n=wr(u,e),n)))throw n;return t=d,mr(t,"assign",A),t;function d(a){var o,s,l,p,f;if(D(a)){if(i.number)return i.number(a);throw new TypeError(format('0gz0O'))}if(M(a)){if(i.complex)return i.complex(a);throw new TypeError(format('0gz0P'))}if(l={},arguments.length>1&&(p=br(l,arguments[1]),p))throw p;if(m(a)){if(i.ndarray===null)throw new TypeError(format('0gz0Q'));return s=l.dtype||K(a.dtype,u.policy),yr(i.ndarray,a,s,l.order||a.order)}if(g(a)){if(i.array===null)throw new TypeError(format('0gz0R'));return o=y(a)||"generic",s=l.dtype||K(o,u.policy),f=gr(s,a.length),i.array(a.length,o,a,1,s,f,1),f}throw new TypeError(F('0gz4V',a))}function A(a,o){var s,l,p;if(m(a)){if(m(o)){if(s=a.shape,l=o.shape,s.length===l.length){for(p=0;p<s.length;p++)if(s[p]!==l[p]){a=N(a,l);break}}else a=N(a,l);return i.ndarray(a,o),o}throw new TypeError(format('0gz0S'))}if(g(a)){if(g(o)){if(o.length!==a.length)throw new RangeError(format('0gz0T'));return i.array(a.length,y(a)||"generic",a,1,y(o)||"generic",o,1),o}throw new TypeError(format('0gz0U'))}throw D(a)?new TypeError(format('0gz0V')):M(a)?new TypeError(format('0gz0W')):new TypeError(F('0gz4V',a))}}U.exports=Er
13
+ });var Tr=Y();module.exports=Tr;
14
+ /** @license Apache-2.0 */
15
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../lib/ndarray.js", "../lib/resolve_output_dtype.js", "../lib/defaults.json", "../lib/validate_table.js", "../lib/policies.json", "../lib/validate_options.js", "../lib/validate.js", "../lib/main.js", "../lib/index.js"],
4
+ "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar ndarray = require( '@stdlib/ndarray-ctor' );\nvar buffer = require( '@stdlib/ndarray-base-buffer' );\nvar shape2strides = require( '@stdlib/ndarray-base-shape2strides' );\nvar numel = require( '@stdlib/ndarray-base-numel' );\nvar copy = require( '@stdlib/array-base-copy-indexed' );\n\n\n// MAIN //\n\n/**\n* Applies a function to an ndarray.\n*\n* @private\n* @param {Function} fcn - function to apply\n* @param {ndarray} x - input array\n* @param {string} ydtype - output array data type\n* @param {string} yorder - output array order\n* @returns {ndarray} output array\n*/\nfunction ndarrayfcn( fcn, x, ydtype, yorder ) {\n\tvar shape;\n\tvar buf;\n\tvar y;\n\n\t// Check if we were provided a zero-dimensional array...\n\tshape = copy( x.shape ); // Note: we need to copy the shape to avoid a shared shape object between `x` and `y` which could lead to unintended mutations (e.g., if either `x` or `y` is reshaped)\n\tif ( shape.length === 0 ) {\n\t\tbuf = buffer( ydtype, 1 );\n\t\ty = ndarray( ydtype, buf, [], [ 0 ], 0, yorder );\n\t} else {\n\t\tbuf = buffer( ydtype, x.length || numel( shape ) ); // WARNING: `x.length` is a property found on ndarray instances, but not strictly necessary to describe an ndarray; accordingly, used here to avoid unnecessary computation, but a potential source of bugs if provided an ndarray-like object having a `length` property which is not equal to the product of the dimensions.\n\t\ty = ndarray( ydtype, buf, shape, shape2strides( shape, yorder ), 0, yorder ); // eslint-disable-line max-len\n\t}\n\tfcn( x, y );\n\treturn y;\n}\n\n\n// EXPORTS //\n\nmodule.exports = ndarrayfcn;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar format = require( '@stdlib/string-format' );\n\n\n// MAIN //\n\n/**\n* Resolves an output array data type.\n*\n* @private\n* @param {string} xdtype - input array data type\n* @param {string} policy - policy determining an output array data type\n* @throws {Error} unsupported policy\n* @returns {string} output array data type\n*/\nfunction resolve( xdtype, policy ) {\n\tswitch ( policy ) {\n\tcase 'same':\n\t\treturn xdtype;\n\tcase 'floating-point':\n\t\t// TODO: we may want to delegate checking for a floating-point dtype to a utility function/package (e.g., isFloatDtype), in order to centralize logic for testing whether a dtype is \"floating-point\". Otherwise, this will be yet another place to update logic should we ever add, e.g., a `float128` or `float16` dtype.\n\t\tif (\n\t\t\txdtype === 'float64' ||\n\t\t\txdtype === 'float32' ||\n\t\t\txdtype === 'generic' ||\n\t\t\txdtype === 'complex128' ||\n\t\t\txdtype === 'complex64'\n\t\t) {\n\t\t\treturn xdtype;\n\t\t}\n\t\treturn 'float64'; // TODO: constants/math/default-real-floating-point-dtype?\n\tcase 'real floating-point':\n\t\tif (\n\t\t\txdtype === 'float64' ||\n\t\t\txdtype === 'float32' ||\n\t\t\txdtype === 'generic'\n\t\t) {\n\t\t\treturn xdtype;\n\t\t}\n\t\treturn 'float64';\n\tcase 'complex floating-point':\n\t\tif (\n\t\t\txdtype === 'complex128' ||\n\t\t\txdtype === 'complex64'\n\t\t) {\n\t\t\treturn xdtype;\n\t\t}\n\t\treturn 'complex128'; // TODO: constants/math/default-complex-floating-point-dtype?\n\tdefault:\n\t\tthrow new Error( format( 'invalid option. Unsupported policy for determining an output array data type. Option: `%s`.', policy ) );\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = resolve;\n", "{\n\t\"output_dtype_policy\": \"floating-point\"\n}\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar isPlainObject = require( '@stdlib/assert-is-plain-object' );\nvar hasOwnProp = require( '@stdlib/assert-has-own-property' );\nvar isFunction = require( '@stdlib/assert-is-function' );\nvar isNull = require( '@stdlib/assert-is-null' );\nvar objectKeys = require( '@stdlib/utils-keys' );\nvar format = require( '@stdlib/string-format' );\n\n\n// MAIN //\n\n/**\n* Validates a resolution table object.\n*\n* @private\n* @param {Object} out - destination object\n* @param {Object} table - resolution table object\n* @param {(Function|null)} [table.number] - function to invoke upon receiving a number\n* @param {(Function|null)} [table.complex] - function to invoke upon receiving a complex number\n* @param {(Function|null)} [table.array] - function to invoke upon receiving an array-like object\n* @param {(Function|null)} [table.ndarray] - function to invoke upon receiving an ndarray-like object\n* @returns {(Error|null)} null or an error object\n*\n* @example\n* var out = {};\n* var table = {\n* 'number': null,\n* 'complex': null,\n* 'array': null,\n* 'ndarray': null\n* };\n* var err = validate( out, table );\n* if ( err ) {\n* throw err;\n* }\n*/\nfunction validate( out, table ) {\n\tvar fields;\n\tvar tmp;\n\tvar key;\n\tvar i;\n\n\tif ( !isPlainObject( table ) ) {\n\t\treturn new TypeError( format( 'invalid argument. Resolution table must be an object. Value: `%s`.', table ) );\n\t}\n\tfields = objectKeys( out );\n\tfor ( i = 0; i < fields.length; i++ ) {\n\t\tkey = fields[ i ];\n\t\tif ( hasOwnProp( table, key ) ) {\n\t\t\ttmp = table[ key ];\n\t\t\tif ( !isFunction( tmp ) && !isNull( tmp ) ) {\n\t\t\t\treturn new TypeError( format( 'invalid argument. Resolution table `%s` field value must be either a function or null. Value: `%s`.', key, tmp ) );\n\t\t\t}\n\t\t\tout[ key ] = tmp;\n\t\t}\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nmodule.exports = validate;\n", "[\n\t\"same\",\n\t\"floating-point\",\n \"real floating-point\",\n \"complex floating-point\"\n]\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar isPlainObject = require( '@stdlib/assert-is-plain-object' );\nvar hasOwnProp = require( '@stdlib/assert-has-own-property' );\nvar contains = require( '@stdlib/assert-contains' );\nvar format = require( '@stdlib/string-format' );\nvar POLICIES = require( './policies.json' );\n\n\n// MAIN //\n\n/**\n* Validates function options.\n*\n* @private\n* @param {Object} opts - destination object\n* @param {Object} options - options\n* @param {string} [options.output_dtype_policy] - policy for determining the output array data type\n* @returns {(Error|null)} null or an error object\n*\n* @example\n* var opts = {};\n* var options = {\n* 'output_dtype_policy': 'float'\n* };\n* var err = validate( opts, options );\n* if ( err ) {\n* throw err;\n* }\n*/\nfunction validate( opts, options ) {\n\tif ( !isPlainObject( options ) ) {\n\t\treturn new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );\n\t}\n\tif ( hasOwnProp( options, 'output_dtype_policy' ) ) {\n\t\topts.policy = options.output_dtype_policy;\n\t\tif ( !contains( POLICIES, opts.policy ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a recognized/supported output array data type policy. Option: `%s`.', 'output_dtype_policy', opts.policy ) );\n\t\t}\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nmodule.exports = validate;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar isPlainObject = require( '@stdlib/assert-is-plain-object' );\nvar hasOwnProp = require( '@stdlib/assert-has-own-property' );\nvar contains = require( '@stdlib/assert-contains' );\nvar orders = require( '@stdlib/ndarray-orders' );\nvar dtypes = require( '@stdlib/ndarray-dtypes' );\nvar format = require( '@stdlib/string-format' );\n\n\n// VARIABLES //\n\nvar ORDERS = orders();\nvar DTYPES = dtypes();\n\n\n// MAIN //\n\n/**\n* Validates function options.\n*\n* @private\n* @param {Object} opts - destination object\n* @param {Object} options - options\n* @param {string} [options.dtype] - output array data type\n* @param {string} [options.order] - output array order\n* @returns {(Error|null)} null or an error object\n*\n* @example\n* var opts = {};\n* var options = {\n* 'order': 'row-major'\n* };\n* var err = validate( opts, options );\n* if ( err ) {\n* throw err;\n* }\n*/\nfunction validate( opts, options ) {\n\tif ( !isPlainObject( options ) ) {\n\t\treturn new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );\n\t}\n\tif ( hasOwnProp( options, 'dtype' ) ) {\n\t\topts.dtype = options.dtype;\n\t\tif ( !contains( DTYPES, opts.dtype ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a recognized/supported data type. Option: `%s`.', 'dtype', opts.dtype ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'order' ) ) {\n\t\topts.order = options.order;\n\t\tif ( !contains( ORDERS, opts.order ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a recognized/supported data type. Option: `%s`.', 'order', opts.order ) );\n\t\t}\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nmodule.exports = validate;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar setReadOnly = require( '@stdlib/utils-define-nonenumerable-read-only-property' );\nvar isNumber = require( '@stdlib/assert-is-number' ).isPrimitive;\nvar isComplexLike = require( '@stdlib/assert-is-complex-like' );\nvar isndarrayLike = require( '@stdlib/assert-is-ndarray-like' );\nvar isCollection = require( '@stdlib/assert-is-collection' );\nvar dtype = require( '@stdlib/ndarray-base-buffer-dtype' );\nvar buffer = require( '@stdlib/ndarray-base-buffer' );\nvar broadcast = require( '@stdlib/ndarray-base-broadcast-array' );\nvar format = require( '@stdlib/string-format' );\nvar ndarrayfcn = require( './ndarray.js' );\nvar odtype = require( './resolve_output_dtype.js' );\nvar defaults = require( './defaults.json' );\nvar validateTable = require( './validate_table.js' );\nvar validateOptions = require( './validate_options.js' );\nvar validate = require( './validate.js' );\n\n\n// MAIN //\n\n/**\n* Returns a function which dispatches to specified functions based on input argument types.\n*\n* @param {Object} table - resolution table object\n* @param {(Function|null)} [table.number] - function to invoke upon receiving a number\n* @param {(Function|null)} [table.complex] - function to invoke upon receiving a complex number\n* @param {(Function|null)} [table.array] - function to invoke upon receiving an array-like object\n* @param {(Function|null)} [table.ndarray] - function to invoke upon receiving an ndarray-like object\n* @param {Options} [options] - options\n* @param {string} [options.output_dtype_policy='floating-point'] - policy for determining the output array data type\n* @throws {TypeError} first argument must be an object\n* @throws {TypeError} first argument must have valid table fields\n* @throws {Error} each table field value must be either a function or `null`\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @returns {Function} dispatch function\n*\n* @example\n* var base = require( '@stdlib/math-base-special-abs' );\n* var strided = require( '@stdlib/math-strided-special-abs' );\n* var dispatcher = require( '@stdlib/ndarray-dispatch' );\n* var unary = require( '@stdlib/ndarray-base-unary' );\n* var Float64Array = require( '@stdlib/array-float64' );\n*\n* var types = [\n* 'float64', 'float64',\n* 'float32', 'float32',\n* 'generic', 'generic'\n* ];\n* var data = [\n* base,\n* base,\n* base\n* ];\n* var nd = dispatcher( unary, types, data, 2, 1, 1 );\n*\n* var table = {\n* 'number': base,\n* 'complex': null,\n* 'array': strided,\n* 'ndarray': nd\n* };\n*\n* var abs = dispatch( table, {\n* 'output_dtype_policy': 'same'\n* });\n*\n* var x = new Float64Array( [ -1.0, -2.0, -3.0 ] );\n*\n* var y = abs( x );\n* // returns <Float64Array>[ 1.0, 2.0, 3.0 ]\n*/\nfunction dispatch( table, options ) {\n\tvar OPTS;\n\tvar err;\n\tvar fcn;\n\tvar t;\n\n\tt = {\n\t\t'number': null,\n\t\t'complex': null,\n\t\t'array': null,\n\t\t'ndarray': null\n\t};\n\terr = validateTable( t, table );\n\tif ( err ) {\n\t\tthrow err;\n\t}\n\tOPTS = {\n\t\t'policy': defaults.output_dtype_policy\n\t};\n\tif ( arguments.length > 1 ) {\n\t\terr = validateOptions( OPTS, options );\n\t\tif ( err ) {\n\t\t\tthrow err;\n\t\t}\n\t}\n\tfcn = dispatcher;\n\tsetReadOnly( fcn, 'assign', assign );\n\treturn fcn;\n\n\t/**\n\t* Function interface which performs dispatch.\n\t*\n\t* @private\n\t* @param {(ndarray|Collection|number|Complex)} x - input value\n\t* @param {Options} [options] - options\n\t* @param {string} [options.dtype] - output array data type\n\t* @param {string} [options.order] - output array order (row-major or column-major)\n\t* @throws {TypeError} first argument must be a supported data type\n\t* @throws {TypeError} options argument must be an object\n\t* @throws {TypeError} must provide valid options\n\t* @returns {(ndarray|Collection|number|Complex)} results\n\t*/\n\tfunction dispatcher( x ) {\n\t\tvar xdtype;\n\t\tvar ydtype;\n\t\tvar opts;\n\t\tvar err;\n\t\tvar y;\n\t\tif ( isNumber( x ) ) {\n\t\t\tif ( t.number ) {\n\t\t\t\treturn t.number( x );\n\t\t\t}\n\t\t\tthrow new TypeError( 'invalid argument. Providing a number is not supported.' );\n\t\t}\n\t\tif ( isComplexLike( x ) ) {\n\t\t\tif ( t.complex ) {\n\t\t\t\treturn t.complex( x );\n\t\t\t}\n\t\t\tthrow new TypeError( 'invalid argument. Providing a complex number is not supported.' );\n\t\t}\n\t\topts = {};\n\t\tif ( arguments.length > 1 ) {\n\t\t\terr = validate( opts, arguments[ 1 ] );\n\t\t\tif ( err ) {\n\t\t\t\tthrow err;\n\t\t\t}\n\t\t}\n\t\tif ( isndarrayLike( x ) ) {\n\t\t\tif ( t.ndarray === null ) {\n\t\t\t\tthrow new TypeError( 'invalid argument. Providing an ndarray is not supported.' );\n\t\t\t}\n\t\t\tydtype = opts.dtype || odtype( x.dtype, OPTS.policy );\n\t\t\treturn ndarrayfcn( t.ndarray, x, ydtype, opts.order || x.order );\n\t\t}\n\t\tif ( isCollection( x ) ) {\n\t\t\tif ( t.array === null ) {\n\t\t\t\tthrow new TypeError( 'invalid argument. Providing an array-like object is not supported.' );\n\t\t\t}\n\t\t\txdtype = dtype( x ) || 'generic';\n\t\t\tydtype = opts.dtype || odtype( xdtype, OPTS.policy );\n\t\t\ty = buffer( ydtype, x.length );\n\t\t\tt.array( x.length, xdtype, x, 1, ydtype, y, 1 );\n\t\t\treturn y;\n\t\t}\n\t\tthrow new TypeError( format( 'invalid argument. Must provide an argument having a supported data type. Value: `%s`.', x ) );\n\t}\n\n\t/**\n\t* Function interface which performs dispatch and assigns results to a provided output array.\n\t*\n\t* @private\n\t* @param {(ndarray|Collection)} x - input array\n\t* @param {(ndarray|Collection)} y - output array\n\t* @throws {TypeError} first argument must be a supported data type\n\t* @throws {TypeError} second argument must be a supported data type\n\t* @throws {TypeError} first and second argument must be the same \"kind\" (i.e., either both ndarrays or both collections)\n\t* @throws {RangeError} output array must have sufficient elements\n\t* @throws {Error} unable to broadcast the input array against the output array\n\t* @returns {(ndarray|Collection)} output array\n\t*/\n\tfunction assign( x, y ) {\n\t\tvar xsh;\n\t\tvar ysh;\n\t\tvar i;\n\t\tif ( isndarrayLike( x ) ) {\n\t\t\tif ( isndarrayLike( y ) ) {\n\t\t\t\txsh = x.shape;\n\t\t\t\tysh = y.shape;\n\n\t\t\t\t// Check whether we need to broadcast `x`...\n\t\t\t\tif ( xsh.length === ysh.length ) {\n\t\t\t\t\tfor ( i = 0; i < xsh.length; i++ ) {\n\t\t\t\t\t\t// Check whether dimensions match...\n\t\t\t\t\t\tif ( xsh[ i ] !== ysh[ i ] ) {\n\t\t\t\t\t\t\t// We found a mismatched dimension; delegate to `broadcast` to ensure that `x` is broadcast compatible with the output array shape...\n\t\t\t\t\t\t\tx = broadcast( x, ysh );\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t// If we are provided arrays with different ranks (i.e., number of dimensions), assume we need to broadcast, delegating to `broadcast` to ensure that `x` is broadcast compatible with the output array shape...\n\t\t\t\t\tx = broadcast( x, ysh );\n\t\t\t\t}\n\t\t\t\tt.ndarray( x, y );\n\t\t\t\treturn y;\n\t\t\t}\n\t\t\tthrow new TypeError( 'invalid argument. If the first argument is an ndarray, the second argument must be an ndarray.' );\n\t\t}\n\t\tif ( isCollection( x ) ) {\n\t\t\tif ( isCollection( y ) ) {\n\t\t\t\tif ( y.length !== x.length ) {\n\t\t\t\t\tthrow new RangeError( 'invalid argument. Output array must have the same number of elements (i.e., length) as the input array.' );\n\t\t\t\t}\n\t\t\t\tt.array( x.length, dtype( x ) || 'generic', x, 1, dtype( y ) || 'generic', y, 1 );\n\t\t\t\treturn y;\n\t\t\t}\n\t\t\tthrow new TypeError( 'invalid argument. If the first argument is an array-like object, the second argument must be an array-like object.' );\n\t\t}\n\t\tif ( isNumber( x ) ) {\n\t\t\tthrow new TypeError( 'invalid argument. Providing a number is not supported. Consider providing a zero-dimensional ndarray containing the numeric value.' );\n\t\t}\n\t\tif ( isComplexLike( x ) ) {\n\t\t\tthrow new TypeError( 'invalid argument. Providing a complex number is not supported. Consider providing a zero-dimensional ndarray containing the complex number value.' );\n\t\t}\n\t\tthrow new TypeError( format( 'invalid argument. Must provide an argument having a supported data type. Value: `%s`.', x ) );\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = dispatch;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2021 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Return a function which dispatches to specified functions based on input argument types.\n*\n* @module @stdlib/math-tools-unary\n*\n* @example\n* var base = require( '@stdlib/math-base-special-abs' );\n* var strided = require( '@stdlib/math-strided-special-abs' );\n* var dispatcher = require( '@stdlib/ndarray-dispatch' );\n* var unary = require( '@stdlib/ndarray-base-unary' );\n* var Float64Array = require( '@stdlib/array-float64' );\n* var dispatch = require( '@stdlib/math-tools-unary' );\n*\n* var types = [\n* 'float64', 'float64',\n* 'float32', 'float32',\n* 'generic', 'generic'\n* ];\n* var data = [\n* base,\n* base,\n* base\n* ];\n* var nd = dispatcher( unary, types, data, 2, 1, 1 );\n*\n* var table = {\n* 'number': base,\n* 'complex': null,\n* 'array': strided,\n* 'ndarray': nd\n* };\n*\n* var abs = dispatch( table );\n*\n* var x = new Float64Array( [ -1.0, -2.0, -3.0 ] );\n* var y = abs( x );\n* // returns <Float64Array>[ 1.0, 2.0, 3.0 ]\n*/\n\n// MAIN //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"],
5
+ "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,GAAAC,EAAA,cAsBA,IAAIC,EAAU,QAAS,sBAAuB,EAC1CC,EAAS,QAAS,6BAA8B,EAChDC,EAAgB,QAAS,oCAAqC,EAC9DC,EAAQ,QAAS,4BAA6B,EAC9CC,EAAO,QAAS,iCAAkC,EAetD,SAASC,EAAYC,EAAKC,EAAGC,EAAQC,EAAS,CAC7C,IAAIC,EACAC,EACAC,EAGJ,OAAAF,EAAQN,EAAMG,EAAE,KAAM,EACjBG,EAAM,SAAW,GACrBC,EAAMV,EAAQO,EAAQ,CAAE,EACxBI,EAAIZ,EAASQ,EAAQG,EAAK,CAAC,EAAG,CAAE,CAAE,EAAG,EAAGF,CAAO,IAE/CE,EAAMV,EAAQO,EAAQD,EAAE,QAAUJ,EAAOO,CAAM,CAAE,EACjDE,EAAIZ,EAASQ,EAAQG,EAAKD,EAAOR,EAAeQ,EAAOD,CAAO,EAAG,EAAGA,CAAO,GAE5EH,EAAKC,EAAGK,CAAE,EACHA,CACR,CAKAb,EAAO,QAAUM,IC9DjB,IAAAQ,EAAAC,EAAA,SAAAC,GAAAC,EAAA,cAsBA,IAAIC,EAAS,QAAS,uBAAwB,EAc9C,SAASC,EAASC,EAAQC,EAAS,CAClC,OAASA,EAAS,CAClB,IAAK,OACJ,OAAOD,EACR,IAAK,iBAEJ,OACCA,IAAW,WACXA,IAAW,WACXA,IAAW,WACXA,IAAW,cACXA,IAAW,YAEJA,EAED,UACR,IAAK,sBACJ,OACCA,IAAW,WACXA,IAAW,WACXA,IAAW,UAEJA,EAED,UACR,IAAK,yBACJ,OACCA,IAAW,cACXA,IAAW,YAEJA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,CAC3H,CACD,CAKAzB,EAAO,QAAUgB,KCvLjB,IAAIiB,GAAO,IAKX,OAAO,QAAUA",
6
+ "names": ["require_ndarray", "__commonJSMin", "exports", "module", "ndarray", "buffer", "shape2strides", "numel", "copy", "ndarrayfcn", "fcn", "x", "ydtype", "yorder", "shape", "buf", "y", "require_resolve_output_dtype", "__commonJSMin", "exports", "module", "format", "resolve", "xdtype", "policy", "require_defaults", "__commonJSMin", "exports", "module", "require_validate_table", "__commonJSMin", "exports", "module", "isPlainObject", "hasOwnProp", "isFunction", "isNull", "objectKeys", "format", "validate", "out", "table", "fields", "tmp", "key", "require_policies", "__commonJSMin", "exports", "module", "require_validate_options", "__commonJSMin", "exports", "module", "isPlainObject", "hasOwnProp", "contains", "format", "POLICIES", "validate", "opts", "options", "require_validate", "__commonJSMin", "exports", "module", "isPlainObject", "hasOwnProp", "contains", "orders", "dtypes", "format", "ORDERS", "DTYPES", "validate", "opts", "options", "require_main", "__commonJSMin", "exports", "module", "setReadOnly", "isNumber", "isComplexLike", "isndarrayLike", "isCollection", "dtype", "buffer", "broadcast", "format", "ndarrayfcn", "odtype", "defaults", "validateTable", "validateOptions", "validate", "dispatch", "table", "options", "OPTS", "err", "fcn", "t", "dispatcher", "assign", "x", "xdtype", "ydtype", "opts", "y", "xsh", "ysh", "i", "main"]
7
+ }
@@ -16,7 +16,7 @@
16
16
  * limitations under the License.
17
17
  */
18
18
 
19
- // TypeScript Version: 2.0
19
+ // TypeScript Version: 4.1
20
20
 
21
21
  /// <reference types="@stdlib/types"/>
22
22
 
package/lib/defaults.json CHANGED
@@ -1,3 +1,3 @@
1
1
  {
2
- "output_dtype_policy": "float"
2
+ "output_dtype_policy": "floating-point"
3
3
  }
package/lib/main.js CHANGED
@@ -28,6 +28,7 @@ var isCollection = require( '@stdlib/assert-is-collection' );
28
28
  var dtype = require( '@stdlib/ndarray-base-buffer-dtype' );
29
29
  var buffer = require( '@stdlib/ndarray-base-buffer' );
30
30
  var broadcast = require( '@stdlib/ndarray-base-broadcast-array' );
31
+ var format = require( '@stdlib/string-format' );
31
32
  var ndarrayfcn = require( './ndarray.js' );
32
33
  var odtype = require( './resolve_output_dtype.js' );
33
34
  var defaults = require( './defaults.json' );
@@ -47,7 +48,7 @@ var validate = require( './validate.js' );
47
48
  * @param {(Function|null)} [table.array] - function to invoke upon receiving an array-like object
48
49
  * @param {(Function|null)} [table.ndarray] - function to invoke upon receiving an ndarray-like object
49
50
  * @param {Options} [options] - options
50
- * @param {string} [options.output_dtype_policy='float'] - policy for determining the output array data type
51
+ * @param {string} [options.output_dtype_policy='floating-point'] - policy for determining the output array data type
51
52
  * @throws {TypeError} first argument must be an object
52
53
  * @throws {TypeError} first argument must have valid table fields
53
54
  * @throws {Error} each table field value must be either a function or `null`
@@ -132,7 +133,7 @@ function dispatch( table, options ) {
132
133
  * @throws {TypeError} must provide valid options
133
134
  * @returns {(ndarray|Collection|number|Complex)} results
134
135
  */
135
- function dispatcher( x, options ) {
136
+ function dispatcher( x ) {
136
137
  var xdtype;
137
138
  var ydtype;
138
139
  var opts;
@@ -152,7 +153,7 @@ function dispatch( table, options ) {
152
153
  }
153
154
  opts = {};
154
155
  if ( arguments.length > 1 ) {
155
- err = validate( opts, options );
156
+ err = validate( opts, arguments[ 1 ] );
156
157
  if ( err ) {
157
158
  throw err;
158
159
  }
@@ -171,12 +172,10 @@ function dispatch( table, options ) {
171
172
  xdtype = dtype( x ) || 'generic';
172
173
  ydtype = opts.dtype || odtype( xdtype, OPTS.policy );
173
174
  y = buffer( ydtype, x.length );
174
-
175
- // FIXME: need to supply dtype enum argument for each array argument...
176
- t.array( x.length, x, 1, y, 1 );
175
+ t.array( x.length, xdtype, x, 1, ydtype, y, 1 );
177
176
  return y;
178
177
  }
179
- throw new TypeError( 'invalid argument. Must provide an argument having a supported data type. Value: `' + x + '`.' );
178
+ throw new TypeError( format( 'invalid argument. Must provide an argument having a supported data type. Value: `%s`.', x ) );
180
179
  }
181
180
 
182
181
  /**
@@ -225,8 +224,7 @@ function dispatch( table, options ) {
225
224
  if ( y.length !== x.length ) {
226
225
  throw new RangeError( 'invalid argument. Output array must have the same number of elements (i.e., length) as the input array.' );
227
226
  }
228
- // FIXME: need to supply dtype enum argument for each array argument...
229
- t.array( x.length, x, 1, y, 1 );
227
+ t.array( x.length, dtype( x ) || 'generic', x, 1, dtype( y ) || 'generic', y, 1 );
230
228
  return y;
231
229
  }
232
230
  throw new TypeError( 'invalid argument. If the first argument is an array-like object, the second argument must be an array-like object.' );
@@ -237,7 +235,7 @@ function dispatch( table, options ) {
237
235
  if ( isComplexLike( x ) ) {
238
236
  throw new TypeError( 'invalid argument. Providing a complex number is not supported. Consider providing a zero-dimensional ndarray containing the complex number value.' );
239
237
  }
240
- throw new TypeError( 'invalid argument. Must provide an argument having a supported data type. Value: `' + x + '`.' );
238
+ throw new TypeError( format( 'invalid argument. Must provide an argument having a supported data type. Value: `%s`.', x ) );
241
239
  }
242
240
  }
243
241