@stdlib/ndarray-base-empty 0.0.1 → 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/README.md CHANGED
@@ -18,6 +18,17 @@ 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
  # empty
22
33
 
23
34
  [![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] <!-- [![dependencies][dependencies-image]][dependencies-url] -->
@@ -173,8 +184,8 @@ Copyright &copy; 2016-2023. The Stdlib [Authors][stdlib-authors].
173
184
  [npm-image]: http://img.shields.io/npm/v/@stdlib/ndarray-base-empty.svg
174
185
  [npm-url]: https://npmjs.org/package/@stdlib/ndarray-base-empty
175
186
 
176
- [test-image]: https://github.com/stdlib-js/ndarray-base-empty/actions/workflows/test.yml/badge.svg?branch=v0.0.1
177
- [test-url]: https://github.com/stdlib-js/ndarray-base-empty/actions/workflows/test.yml?query=branch:v0.0.1
187
+ [test-image]: https://github.com/stdlib-js/ndarray-base-empty/actions/workflows/test.yml/badge.svg?branch=v0.1.0
188
+ [test-url]: https://github.com/stdlib-js/ndarray-base-empty/actions/workflows/test.yml?query=branch:v0.1.0
178
189
 
179
190
  [coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/ndarray-base-empty/main.svg
180
191
  [coverage-url]: https://codecov.io/github/stdlib-js/ndarray-base-empty?branch=main
@@ -0,0 +1,3 @@
1
+ /// <reference path="../docs/types/index.d.ts" />
2
+ import empty from '../docs/types/index';
3
+ export = empty;
package/dist/index.js ADDED
@@ -0,0 +1,5 @@
1
+ "use strict";var f=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var v=f(function(g,n){
2
+ var l=require('@stdlib/ndarray-base-shape2strides/dist'),q=require('@stdlib/ndarray-base-strides2offset/dist'),m=require('@stdlib/ndarray-base-ctor/dist'),c=require('@stdlib/ndarray-base-numel/dist'),o=require('@stdlib/array-empty/dist'),y=require('@stdlib/buffer-alloc-unsafe/dist');function b(e,r,t){var u,s,i,a;return u=r.length,u>0?(i=c(r),a=l(r,t)):(i=1,a=[0]),e==="binary"?s=y(i):s=o(i,e),new m(e,s,r,a,q(r,a),t)}n.exports=b
3
+ });var x=v();module.exports=x;
4
+ /** @license Apache-2.0 */
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../lib/main.js", "../lib/index.js"],
4
+ "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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 shape2strides = require( '@stdlib/ndarray-base-shape2strides' );\nvar strides2offset = require( '@stdlib/ndarray-base-strides2offset' );\nvar ndarray = require( '@stdlib/ndarray-base-ctor' );\nvar numel = require( '@stdlib/ndarray-base-numel' );\nvar emptyArray = require( '@stdlib/array-empty' );\nvar allocUnsafe = require( '@stdlib/buffer-alloc-unsafe' );\n\n\n// MAIN //\n\n/**\n* Creates an uninitialized ndarray having a specified shape and data type.\n*\n* @param {string} dtype - data type\n* @param {NonNegativeIntegerArray} shape - array shape\n* @param {string} order - array order\n* @throws {TypeError} first argument must be a recognized data type\n* @returns {ndarray} ndarray\n*\n* @example\n* var arr = empty( 'float32', [ 2, 2 ], 'row-major' );\n* // returns <ndarray>\n*\n* var sh = arr.shape;\n* // returns [ 2, 2 ]\n*\n* var dt = arr.dtype;\n* // returns 'float32'\n*/\nfunction empty( dtype, shape, order ) {\n\tvar ndims;\n\tvar buf;\n\tvar len;\n\tvar st;\n\n\tndims = shape.length;\n\tif ( ndims > 0 ) {\n\t\tlen = numel( shape );\n\t\tst = shape2strides( shape, order );\n\t} else {\n\t\t// For 0-dimensional arrays, the buffer should contain a single element...\n\t\tlen = 1;\n\t\tst = [ 0 ];\n\t}\n\tif ( dtype === 'binary' ) {\n\t\tbuf = allocUnsafe( len );\n\t} else {\n\t\tbuf = emptyArray( len, dtype );\n\t}\n\treturn new ndarray( dtype, buf, shape, st, strides2offset( shape, st ), order ); // eslint-disable-line max-len\n}\n\n\n// EXPORTS //\n\nmodule.exports = empty;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 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* Create an uninitialized ndarray having a specified shape and data type.\n*\n* @module @stdlib/ndarray-base-empty\n*\n* @example\n* var empty = require( '@stdlib/ndarray-base-empty' );\n*\n* var arr = empty( 'float32', [ 2, 2 ], 'row-major' );\n* // returns <ndarray>\n*\n* var sh = arr.shape;\n* // returns [ 2, 2 ]\n*\n* var dt = arr.dtype;\n* // returns 'float32'\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"],
5
+ "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAgB,QAAS,oCAAqC,EAC9DC,EAAiB,QAAS,qCAAsC,EAChEC,EAAU,QAAS,2BAA4B,EAC/CC,EAAQ,QAAS,4BAA6B,EAC9CC,EAAa,QAAS,qBAAsB,EAC5CC,EAAc,QAAS,6BAA8B,EAwBzD,SAASC,EAAOC,EAAOC,EAAOC,EAAQ,CACrC,IAAIC,EACAC,EACAC,EACAC,EAEJ,OAAAH,EAAQF,EAAM,OACTE,EAAQ,GACZE,EAAMT,EAAOK,CAAM,EACnBK,EAAKb,EAAeQ,EAAOC,CAAM,IAGjCG,EAAM,EACNC,EAAK,CAAE,CAAE,GAELN,IAAU,SACdI,EAAMN,EAAaO,CAAI,EAEvBD,EAAMP,EAAYQ,EAAKL,CAAM,EAEvB,IAAIL,EAASK,EAAOI,EAAKH,EAAOK,EAAIZ,EAAgBO,EAAOK,CAAG,EAAGJ,CAAM,CAC/E,CAKAV,EAAO,QAAUO,ICrCjB,IAAIQ,EAAO,IAKX,OAAO,QAAUA",
6
+ "names": ["require_main", "__commonJSMin", "exports", "module", "shape2strides", "strides2offset", "ndarray", "numel", "emptyArray", "allocUnsafe", "empty", "dtype", "shape", "order", "ndims", "buf", "len", "st", "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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stdlib/ndarray-base-empty",
3
- "version": "0.0.1",
3
+ "version": "0.1.0",
4
4
  "description": "Create an uninitialized ndarray having a specified shape and data type.",
5
5
  "license": "Apache-2.0",
6
6
  "author": {
@@ -37,32 +37,32 @@
37
37
  "url": "https://github.com/stdlib-js/stdlib/issues"
38
38
  },
39
39
  "dependencies": {
40
- "@stdlib/array-empty": "^0.0.1",
41
- "@stdlib/buffer-alloc-unsafe": "^0.0.7",
42
- "@stdlib/ndarray-base-ctor": "^0.0.6",
43
- "@stdlib/ndarray-base-numel": "^0.0.8",
44
- "@stdlib/ndarray-base-shape2strides": "^0.0.8",
45
- "@stdlib/ndarray-base-strides2offset": "^0.0.8",
46
- "@stdlib/types": "^0.0.14"
40
+ "@stdlib/array-empty": "^0.1.0",
41
+ "@stdlib/buffer-alloc-unsafe": "^0.1.0",
42
+ "@stdlib/ndarray-base-ctor": "^0.1.0",
43
+ "@stdlib/ndarray-base-numel": "^0.1.0",
44
+ "@stdlib/ndarray-base-shape2strides": "^0.1.0",
45
+ "@stdlib/ndarray-base-strides2offset": "^0.1.0",
46
+ "@stdlib/types": "^0.1.0"
47
47
  },
48
48
  "devDependencies": {
49
- "@stdlib/array-complex128": "^0.0.6",
50
- "@stdlib/array-complex64": "^0.0.6",
51
- "@stdlib/array-float32": "^0.0.6",
52
- "@stdlib/array-float64": "^0.0.6",
53
- "@stdlib/array-int16": "^0.0.6",
54
- "@stdlib/array-int32": "^0.0.6",
55
- "@stdlib/array-int8": "^0.0.6",
56
- "@stdlib/array-uint16": "^0.0.6",
57
- "@stdlib/array-uint32": "^0.0.6",
58
- "@stdlib/array-uint8": "^0.0.7",
59
- "@stdlib/array-uint8c": "^0.0.8",
60
- "@stdlib/assert-instance-of": "^0.0.8",
61
- "@stdlib/assert-is-ndarray-like": "^0.0.6",
62
- "@stdlib/bench": "^0.0.12",
63
- "@stdlib/buffer-ctor": "^0.0.7",
64
- "@stdlib/math-base-special-pow": "^0.0.7",
65
- "@stdlib/ndarray-dtypes": "^0.0.9",
49
+ "@stdlib/array-complex128": "^0.1.0",
50
+ "@stdlib/array-complex64": "^0.1.0",
51
+ "@stdlib/array-float32": "^0.1.0",
52
+ "@stdlib/array-float64": "^0.1.0",
53
+ "@stdlib/array-int16": "^0.1.0",
54
+ "@stdlib/array-int32": "^0.1.0",
55
+ "@stdlib/array-int8": "^0.1.0",
56
+ "@stdlib/array-uint16": "^0.1.0",
57
+ "@stdlib/array-uint32": "^0.1.0",
58
+ "@stdlib/array-uint8": "^0.1.0",
59
+ "@stdlib/array-uint8c": "^0.1.0",
60
+ "@stdlib/assert-instance-of": "^0.1.0",
61
+ "@stdlib/assert-is-ndarray-like": "^0.1.0",
62
+ "@stdlib/bench": "^0.1.0",
63
+ "@stdlib/buffer-ctor": "^0.1.0",
64
+ "@stdlib/math-base-special-pow": "^0.1.0",
65
+ "@stdlib/ndarray-dtypes": "^0.1.0",
66
66
  "tape": "git+https://github.com/kgryte/tape.git#fix/globby",
67
67
  "istanbul": "^0.4.1",
68
68
  "tap-min": "git+https://github.com/Planeshifter/tap-min.git"