@stdlib/ndarray-base-unary-tiling-block-size 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 +30 -0
- package/README.md +14 -3
- package/dist/index.d.ts +3 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +7 -0
- package/docs/types/index.d.ts +1 -1
- package/package.json +8 -8
- package/docs/repl.txt +0 -27
- package/docs/types/test.ts +0 -57
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
|
# unaryBlockSize
|
|
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] -->
|
|
@@ -161,8 +172,8 @@ Copyright © 2016-2023. The Stdlib [Authors][stdlib-authors].
|
|
|
161
172
|
[npm-image]: http://img.shields.io/npm/v/@stdlib/ndarray-base-unary-tiling-block-size.svg
|
|
162
173
|
[npm-url]: https://npmjs.org/package/@stdlib/ndarray-base-unary-tiling-block-size
|
|
163
174
|
|
|
164
|
-
[test-image]: https://github.com/stdlib-js/ndarray-base-unary-tiling-block-size/actions/workflows/test.yml/badge.svg?branch=v0.0
|
|
165
|
-
[test-url]: https://github.com/stdlib-js/ndarray-base-unary-tiling-block-size/actions/workflows/test.yml?query=branch:v0.0
|
|
175
|
+
[test-image]: https://github.com/stdlib-js/ndarray-base-unary-tiling-block-size/actions/workflows/test.yml/badge.svg?branch=v0.1.0
|
|
176
|
+
[test-url]: https://github.com/stdlib-js/ndarray-base-unary-tiling-block-size/actions/workflows/test.yml?query=branch:v0.1.0
|
|
166
177
|
|
|
167
178
|
[coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/ndarray-base-unary-tiling-block-size/main.svg
|
|
168
179
|
[coverage-url]: https://codecov.io/github/stdlib-js/ndarray-base-unary-tiling-block-size?branch=main
|
|
@@ -175,7 +186,7 @@ Copyright © 2016-2023. The Stdlib [Authors][stdlib-authors].
|
|
|
175
186
|
-->
|
|
176
187
|
|
|
177
188
|
[chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg
|
|
178
|
-
[chat-url]: https://gitter.im
|
|
189
|
+
[chat-url]: https://app.gitter.im/#/room/#stdlib-js_stdlib:gitter.im
|
|
179
190
|
|
|
180
191
|
[stdlib]: https://github.com/stdlib-js/stdlib
|
|
181
192
|
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";var _=function(u,r){return function(){return r||u((r={exports:{}}).exports,r),r.exports}};var s=_(function(N,n){
|
|
2
|
+
var I={BLOCK_SIZE_IN_BYTES:64,BLOCK_SIZE_IN_ELEMENTS:8};n.exports=I
|
|
3
|
+
});var a=_(function(v,S){
|
|
4
|
+
var i=require('@stdlib/ndarray-base-bytes-per-element/dist'),E=s();function B(u,r){var e,t;return e=i(u),t=i(r),e===null||t===null?E.BLOCK_SIZE_IN_ELEMENTS:e>t?E.BLOCK_SIZE_IN_BYTES/e|0:E.BLOCK_SIZE_IN_BYTES/t|0}S.exports=B
|
|
5
|
+
});var l=a();module.exports=l;
|
|
6
|
+
/** @license Apache-2.0 */
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../lib/defaults.js", "../lib/main.js", "../lib/index.js"],
|
|
4
|
+
"sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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// MAIN //\n\nvar defaults = {\n\t// Define a default block size (in bytes):\n\t'BLOCK_SIZE_IN_BYTES': 64|0, // 64b is a common cache line size. How applicable the common cache line size is here is debatable, given that, depending on the associated stride(s), the innermost loop may not iterate over adjacent elements. The primary goal is to have a block size in which all data within a block can always fit in (L1) cache, regardless of cache size (i.e., cache-oblivious). For reference, a common L1 cache size is 32kB per core. For best performance, block sizes should be tuned based on system hardware; however, such tuning is not readily available to us here. Without obvious better alternatives, 64b has some theoretical (and practical) underpinning, and it should be good enough for most inputs, especially for ndarrays with near contiguity.\n\n\t// Define a default block size (in elements):\n\t'BLOCK_SIZE_IN_ELEMENTS': 8|0 // 64 bytes / 8 bytes per element (i.e., default element size is same as a double)\n};\n\n\n// EXPORTS //\n\nmodule.exports = defaults;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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 bytesPerElement = require( '@stdlib/ndarray-base-bytes-per-element' );\nvar defaults = require( './defaults.js' );\n\n\n// MAIN //\n\n/**\n* Returns a loop block size for multi-dimensional array tiled loops.\n*\n* @param {string} dtypeX - input array data type\n* @param {string} dtypeY - output array data type\n* @returns {integer} block size (in units of elements)\n*\n* @example\n* var bsize = unaryBlockSize( 'float64', 'float64' );\n* // returns <number>\n*/\nfunction unaryBlockSize( dtypeX, dtypeY ) {\n\tvar nbx;\n\tvar nby;\n\n\tnbx = bytesPerElement( dtypeX );\n\tnby = bytesPerElement( dtypeY );\n\tif ( nbx === null || nby === null ) { // e.g., \"generic\" arrays\n\t\treturn defaults.BLOCK_SIZE_IN_ELEMENTS;\n\t}\n\tif ( nbx > nby ) {\n\t\treturn ( defaults.BLOCK_SIZE_IN_BYTES/nbx )|0; // asm type annotation\n\t}\n\treturn ( defaults.BLOCK_SIZE_IN_BYTES/nby )|0; // asm type annotation\n}\n\n\n// EXPORTS //\n\nmodule.exports = unaryBlockSize;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2022 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* Resolve a loop block size for multi-dimensional array tiled loops.\n*\n* @module @stdlib/ndarray-base-unary-tiling-block-size\n*\n* @example\n* var unaryBlockSize = require( '@stdlib/ndarray-base-unary-tiling-block-size' );\n*\n* var bsize = unaryBlockSize( 'float64', 'float64' );\n* // returns <number>\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,EAAW,CAEd,oBAAuB,GAGvB,uBAA0B,CAC3B,EAKAD,EAAO,QAAUC,ICjCjB,IAAAC,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAkB,QAAS,wCAAyC,EACpEC,EAAW,IAgBf,SAASC,EAAgBC,EAAQC,EAAS,CACzC,IAAIC,EACAC,EAIJ,OAFAD,EAAML,EAAiBG,CAAO,EAC9BG,EAAMN,EAAiBI,CAAO,EACzBC,IAAQ,MAAQC,IAAQ,KACrBL,EAAS,uBAEZI,EAAMC,EACDL,EAAS,oBAAoBI,EAAM,EAEpCJ,EAAS,oBAAoBK,EAAM,CAC7C,CAKAP,EAAO,QAAUG,ICvBjB,IAAIK,EAAO,IAKX,OAAO,QAAUA",
|
|
6
|
+
"names": ["require_defaults", "__commonJSMin", "exports", "module", "defaults", "require_main", "__commonJSMin", "exports", "module", "bytesPerElement", "defaults", "unaryBlockSize", "dtypeX", "dtypeY", "nbx", "nby", "main"]
|
|
7
|
+
}
|
package/docs/types/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stdlib/ndarray-base-unary-tiling-block-size",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "Resolve a loop block size for multi-dimensional array tiled loops.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": {
|
|
@@ -37,13 +37,13 @@
|
|
|
37
37
|
"url": "https://github.com/stdlib-js/stdlib/issues"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@stdlib/ndarray-base-bytes-per-element": "^0.0
|
|
40
|
+
"@stdlib/ndarray-base-bytes-per-element": "^0.1.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@stdlib/array-base-cartesian-square": "^0.0.
|
|
44
|
-
"@stdlib/assert-is-positive-integer": "^0.0
|
|
45
|
-
"@stdlib/bench": "^0.0
|
|
46
|
-
"@stdlib/ndarray-dtypes": "^0.0
|
|
43
|
+
"@stdlib/array-base-cartesian-square": "^0.0.3",
|
|
44
|
+
"@stdlib/assert-is-positive-integer": "^0.1.0",
|
|
45
|
+
"@stdlib/bench": "^0.1.0",
|
|
46
|
+
"@stdlib/ndarray-dtypes": "^0.1.0",
|
|
47
47
|
"tape": "git+https://github.com/kgryte/tape.git#fix/globby",
|
|
48
48
|
"istanbul": "^0.4.1",
|
|
49
49
|
"tap-min": "git+https://github.com/Planeshifter/tap-min.git"
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
],
|
|
83
83
|
"__stdlib__": {},
|
|
84
84
|
"funding": {
|
|
85
|
-
"type": "
|
|
86
|
-
"url": "https://
|
|
85
|
+
"type": "opencollective",
|
|
86
|
+
"url": "https://opencollective.com/stdlib"
|
|
87
87
|
}
|
|
88
88
|
}
|
package/docs/repl.txt
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
{{alias}}( dtypeX, dtypeY )
|
|
3
|
-
Returns a loop block size for multi-dimensional array tiled loops.
|
|
4
|
-
|
|
5
|
-
Parameters
|
|
6
|
-
----------
|
|
7
|
-
dtypeX: string
|
|
8
|
-
Input array data type.
|
|
9
|
-
|
|
10
|
-
dtypeY: string
|
|
11
|
-
Output array data type.
|
|
12
|
-
|
|
13
|
-
Returns
|
|
14
|
-
-------
|
|
15
|
-
out: integer
|
|
16
|
-
Block size.
|
|
17
|
-
|
|
18
|
-
Examples
|
|
19
|
-
--------
|
|
20
|
-
> var out = {{alias}}( 'float64', 'float64' )
|
|
21
|
-
<number>
|
|
22
|
-
> out = {{alias}}( 'int32', 'float64' )
|
|
23
|
-
<number>
|
|
24
|
-
|
|
25
|
-
See Also
|
|
26
|
-
--------
|
|
27
|
-
|
package/docs/types/test.ts
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @license Apache-2.0
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) 2022 The Stdlib Authors.
|
|
5
|
-
*
|
|
6
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
-
* you may not use this file except in compliance with the License.
|
|
8
|
-
* You may obtain a copy of the License at
|
|
9
|
-
*
|
|
10
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
-
*
|
|
12
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
-
* See the License for the specific language governing permissions and
|
|
16
|
-
* limitations under the License.
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
import unaryBlockSize = require( './index' );
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
// TESTS //
|
|
23
|
-
|
|
24
|
-
// The function returns a number...
|
|
25
|
-
{
|
|
26
|
-
unaryBlockSize( 'float64', 'float64' ); // $ExpectType number
|
|
27
|
-
unaryBlockSize( 'generic', 'generic' ); // $ExpectType number
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// The compiler throws an error if the function is provided a first argument which is not a string...
|
|
31
|
-
{
|
|
32
|
-
unaryBlockSize( 123, 'float64' ); // $ExpectError
|
|
33
|
-
unaryBlockSize( true, 'float64' ); // $ExpectError
|
|
34
|
-
unaryBlockSize( false, 'float64' ); // $ExpectError
|
|
35
|
-
unaryBlockSize( null, 'float64' ); // $ExpectError
|
|
36
|
-
unaryBlockSize( {}, 'float64' ); // $ExpectError
|
|
37
|
-
unaryBlockSize( [], 'float64' ); // $ExpectError
|
|
38
|
-
unaryBlockSize( ( x: number ): number => x, 'float64' ); // $ExpectError
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// The compiler throws an error if the function is provided a second argument which is not a string...
|
|
42
|
-
{
|
|
43
|
-
unaryBlockSize( 'int32', 123 ); // $ExpectError
|
|
44
|
-
unaryBlockSize( 'int32', true ); // $ExpectError
|
|
45
|
-
unaryBlockSize( 'int32', false ); // $ExpectError
|
|
46
|
-
unaryBlockSize( 'int32', null ); // $ExpectError
|
|
47
|
-
unaryBlockSize( 'int32', {} ); // $ExpectError
|
|
48
|
-
unaryBlockSize( 'int32', [] ); // $ExpectError
|
|
49
|
-
unaryBlockSize( 'int32', ( x: number ): number => x ); // $ExpectError
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
// The compiler throws an error if the function is provided an unsupported number of arguments...
|
|
53
|
-
{
|
|
54
|
-
unaryBlockSize(); // $ExpectError
|
|
55
|
-
unaryBlockSize( 'float64' ); // $ExpectError
|
|
56
|
-
unaryBlockSize( 'float64', 'float64', 'float64' ); // $ExpectError
|
|
57
|
-
}
|