@stdlib/ndarray-vector-int8 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/LICENSE ADDED
@@ -0,0 +1,177 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
package/NOTICE ADDED
@@ -0,0 +1 @@
1
+ Copyright (c) 2016-2026 The Stdlib Authors.
package/README.md ADDED
@@ -0,0 +1,287 @@
1
+ <!--
2
+
3
+ @license Apache-2.0
4
+
5
+ Copyright (c) 2025 The Stdlib Authors.
6
+
7
+ Licensed under the Apache License, Version 2.0 (the "License");
8
+ you may not use this file except in compliance with the License.
9
+ You may obtain a copy of the License at
10
+
11
+ http://www.apache.org/licenses/LICENSE-2.0
12
+
13
+ Unless required by applicable law or agreed to in writing, software
14
+ distributed under the License is distributed on an "AS IS" BASIS,
15
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ See the License for the specific language governing permissions and
17
+ limitations under the License.
18
+
19
+ -->
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
+
32
+ # Int8Vector
33
+
34
+ [![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] <!-- [![dependencies][dependencies-image]][dependencies-url] -->
35
+
36
+ > Create a signed 8-bit integer vector (i.e., a one-dimensional [ndarray][@stdlib/ndarray/ctor]).
37
+
38
+ <!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
39
+
40
+ <section class="intro">
41
+
42
+ </section>
43
+
44
+ <!-- /.intro -->
45
+
46
+ <!-- Package usage documentation. -->
47
+
48
+ <section class="installation">
49
+
50
+ ## Installation
51
+
52
+ ```bash
53
+ npm install @stdlib/ndarray-vector-int8
54
+ ```
55
+
56
+ </section>
57
+
58
+ <section class="usage">
59
+
60
+ ## Usage
61
+
62
+ ```javascript
63
+ var Int8Vector = require( '@stdlib/ndarray-vector-int8' );
64
+ ```
65
+
66
+ #### Int8Vector( \[options] )
67
+
68
+ Returns a one-dimensional signed 8-bit integer [ndarray][@stdlib/ndarray/ctor].
69
+
70
+ ```javascript
71
+ var numel = require( '@stdlib/ndarray-numel' );
72
+
73
+ var arr = new Int8Vector();
74
+ // returns <ndarray>
75
+
76
+ var len = numel( arr );
77
+ // returns 0
78
+ ```
79
+
80
+ The function accepts the following options:
81
+
82
+ - **order**: specifies whether an [ndarray][@stdlib/ndarray/ctor] is `'row-major'` (C-style) or `'column-major'` (Fortran-style). Default: `'row-major'`.
83
+ - **mode**: specifies how to handle indices which exceed array dimensions (see [`ndarray`][@stdlib/ndarray/ctor]). Default: `'throw'`.
84
+ - **readonly**: boolean indicating whether an array should be **read-only**. Default: `false`.
85
+
86
+ #### Int8Vector( length\[, options] )
87
+
88
+ Returns a one-dimensional signed 8-bit integer [ndarray][@stdlib/ndarray/ctor] having a specified `length`.
89
+
90
+ ```javascript
91
+ var numel = require( '@stdlib/ndarray-numel' );
92
+
93
+ var arr = new Int8Vector( 5 );
94
+ // returns <ndarray>
95
+
96
+ var len1 = numel( arr );
97
+ // returns 5
98
+ ```
99
+
100
+ #### Int8Vector( obj\[, options] )
101
+
102
+ Creates a one-dimensional signed 8-bit integer [ndarray][@stdlib/ndarray/ctor] from an array-like object or iterable.
103
+
104
+ ```javascript
105
+ var numel = require( '@stdlib/ndarray-numel' );
106
+
107
+ var arr = new Int8Vector( [ 1, 2, 3 ] );
108
+ // returns <ndarray>
109
+
110
+ var len1 = numel( arr );
111
+ // returns 3
112
+ ```
113
+
114
+ #### Int8Vector( buffer\[, byteOffset\[, length]]\[, options] )
115
+
116
+ Returns a one-dimensional signed 8-bit integer [ndarray][@stdlib/ndarray/ctor] view of an [`ArrayBuffer`][@stdlib/array/buffer].
117
+
118
+ ```javascript
119
+ var ArrayBuffer = require( '@stdlib/array-buffer' );
120
+ var numel = require( '@stdlib/ndarray-numel' );
121
+
122
+ var buf = new ArrayBuffer( 32 );
123
+
124
+ var arr1 = new Int8Vector( buf );
125
+ // returns <ndarray>
126
+
127
+ var len1 = numel( arr1 );
128
+ // returns 32
129
+
130
+ var arr2 = new Int8Vector( buf, 16 );
131
+ // returns <ndarray>
132
+
133
+ var len2 = numel( arr2 );
134
+ // returns 16
135
+
136
+ var arr3 = new Int8Vector( buf, 16, 1 );
137
+ // returns <ndarray>
138
+
139
+ var len3 = numel( arr3 );
140
+ // returns 1
141
+ ```
142
+
143
+ </section>
144
+
145
+ <!-- /.usage -->
146
+
147
+ <!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
148
+
149
+ <section class="notes">
150
+
151
+ </section>
152
+
153
+ <!-- /.notes -->
154
+
155
+ <!-- Package usage examples. -->
156
+
157
+ <section class="examples">
158
+
159
+ ## Examples
160
+
161
+ <!-- eslint no-undef: "error" -->
162
+
163
+ ```javascript
164
+ var discreteUniform = require( '@stdlib/random-array-discrete-uniform' );
165
+ var sum = require( '@stdlib/blas-ext-sum' );
166
+ var map = require( '@stdlib/ndarray-map' );
167
+ var Int8Vector = require( '@stdlib/ndarray-vector-int8' );
168
+
169
+ // Create a vector containing random values:
170
+ var x = new Int8Vector( discreteUniform( 10, 0, 100 ) );
171
+
172
+ // Compute the sum:
173
+ var v = sum( x );
174
+ console.log( v.get() );
175
+
176
+ // Define a function which applies a threshold to individual values:
177
+ function threshold( v ) {
178
+ return ( v > 10 ) ? v : 0;
179
+ }
180
+
181
+ // Apply threshold:
182
+ var y = map( x, threshold );
183
+
184
+ // Recompute the sum:
185
+ v = sum( y );
186
+ console.log( v.get() );
187
+ ```
188
+
189
+ </section>
190
+
191
+ <!-- /.examples -->
192
+
193
+ <!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
194
+
195
+ <section class="references">
196
+
197
+ </section>
198
+
199
+ <!-- /.references -->
200
+
201
+ <!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
202
+
203
+ <section class="related">
204
+
205
+ </section>
206
+
207
+ <!-- /.related -->
208
+
209
+ <!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
210
+
211
+
212
+ <section class="main-repo" >
213
+
214
+ * * *
215
+
216
+ ## Notice
217
+
218
+ This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more.
219
+
220
+ For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib].
221
+
222
+ #### Community
223
+
224
+ [![Chat][chat-image]][chat-url]
225
+
226
+ ---
227
+
228
+ ## License
229
+
230
+ See [LICENSE][stdlib-license].
231
+
232
+
233
+ ## Copyright
234
+
235
+ Copyright &copy; 2016-2026. The Stdlib [Authors][stdlib-authors].
236
+
237
+ </section>
238
+
239
+ <!-- /.stdlib -->
240
+
241
+ <!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
242
+
243
+ <section class="links">
244
+
245
+ [npm-image]: http://img.shields.io/npm/v/@stdlib/ndarray-vector-int8.svg
246
+ [npm-url]: https://npmjs.org/package/@stdlib/ndarray-vector-int8
247
+
248
+ [test-image]: https://github.com/stdlib-js/ndarray-vector-int8/actions/workflows/test.yml/badge.svg?branch=v0.1.0
249
+ [test-url]: https://github.com/stdlib-js/ndarray-vector-int8/actions/workflows/test.yml?query=branch:v0.1.0
250
+
251
+ [coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/ndarray-vector-int8/main.svg
252
+ [coverage-url]: https://codecov.io/github/stdlib-js/ndarray-vector-int8?branch=main
253
+
254
+ <!--
255
+
256
+ [dependencies-image]: https://img.shields.io/david/stdlib-js/ndarray-vector-int8.svg
257
+ [dependencies-url]: https://david-dm.org/stdlib-js/ndarray-vector-int8/main
258
+
259
+ -->
260
+
261
+ [chat-image]: https://img.shields.io/badge/zulip-join_chat-brightgreen.svg
262
+ [chat-url]: https://stdlib.zulipchat.com
263
+
264
+ [stdlib]: https://github.com/stdlib-js/stdlib
265
+
266
+ [stdlib-authors]: https://github.com/stdlib-js/stdlib/graphs/contributors
267
+
268
+ [umd]: https://github.com/umdjs/umd
269
+ [es-module]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules
270
+
271
+ [deno-url]: https://github.com/stdlib-js/ndarray-vector-int8/tree/deno
272
+ [deno-readme]: https://github.com/stdlib-js/ndarray-vector-int8/blob/deno/README.md
273
+ [umd-url]: https://github.com/stdlib-js/ndarray-vector-int8/tree/umd
274
+ [umd-readme]: https://github.com/stdlib-js/ndarray-vector-int8/blob/umd/README.md
275
+ [esm-url]: https://github.com/stdlib-js/ndarray-vector-int8/tree/esm
276
+ [esm-readme]: https://github.com/stdlib-js/ndarray-vector-int8/blob/esm/README.md
277
+ [branches-url]: https://github.com/stdlib-js/ndarray-vector-int8/blob/main/branches.md
278
+
279
+ [stdlib-license]: https://raw.githubusercontent.com/stdlib-js/ndarray-vector-int8/main/LICENSE
280
+
281
+ [@stdlib/array/buffer]: https://www.npmjs.com/package/@stdlib/array-buffer
282
+
283
+ [@stdlib/ndarray/ctor]: https://www.npmjs.com/package/@stdlib/ndarray-ctor
284
+
285
+ </section>
286
+
287
+ <!-- /.links -->
package/SECURITY.md ADDED
@@ -0,0 +1,5 @@
1
+ # Security
2
+
3
+ > Policy for reporting security vulnerabilities.
4
+
5
+ See the security policy [in the main project repository](https://github.com/stdlib-js/stdlib/security).
@@ -0,0 +1,3 @@
1
+ /// <reference path="../docs/types/index.d.ts" />
2
+ import ctor from '../docs/types/index';
3
+ export = ctor;
package/dist/index.js ADDED
@@ -0,0 +1,5 @@
1
+ "use strict";var i=function(a,r){return function(){return r||a((r={exports:{}}).exports,r),r.exports}};var e=i(function(n,t){
2
+ var s=require('@stdlib/ndarray-vector-ctor/dist').factory,c=s("int8");t.exports=c
3
+ });var o=e();module.exports=o;
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) 2025 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 factory = require( '@stdlib/ndarray-vector-ctor' ).factory;\n\n\n// MAIN //\n\n/**\n* Returns a signed 8-bit integer vector (i.e., a one-dimensional ndarray).\n*\n* @name Int8Vector\n* @type {Function}\n* @param {(NonNegativeInteger|Collection|ArrayBuffer|Iterable)} [arg] - length, typed array, array-like object, buffer, or iterable\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {Options} [options] - function options\n* @param {boolean} [options.readonly=false] - boolean indicating whether to return a read-only vector\n* @param {string} [options.mode='throw'] - specifies how to handle indices which exceed vector dimensions\n* @param {string} [options.order='row-major'] - memory layout (either row-major or column-major)\n* @throws {TypeError} first argument must be either a length, typed array, array-like object, buffer, iterable, or options object\n* @throws {TypeError} must provide valid options\n* @returns {ndarray} one-dimensional ndarray\n*\n* @example\n* var numel = require( '@stdlib/ndarray-numel' );\n*\n* var arr = new Int8Vector();\n* // returns <ndarray>\n*\n* var len = numel( arr );\n* // returns 0\n*\n* @example\n* var numel = require( '@stdlib/ndarray-numel' );\n*\n* var arr = new Int8Vector( 2 );\n* // returns <ndarray>\n*\n* var len = numel( arr );\n* // returns 2\n*\n* @example\n* var numel = require( '@stdlib/ndarray-numel' );\n*\n* var arr = new Int8Vector( [ 1, 2 ] );\n* // returns <ndarray>\n*\n* var len = numel( arr );\n* // returns 2\n*\n* @example\n* var numel = require( '@stdlib/ndarray-numel' );\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = new Int8Vector( buf );\n* // returns <ndarray>\n*\n* var len = numel( arr );\n* // returns 32\n*\n* @example\n* var numel = require( '@stdlib/ndarray-numel' );\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = new Int8Vector( buf, 16 );\n* // returns <ndarray>\n*\n* var len = numel( arr );\n* // returns 16\n*\n* @example\n* var numel = require( '@stdlib/ndarray-numel' );\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = new Int8Vector( buf, 16, 2 );\n* // returns <ndarray>\n*\n* var len = numel( arr );\n* // returns 2\n*/\nvar Int8Vector = factory( 'int8' );\n\n\n// EXPORTS //\n\nmodule.exports = Int8Vector;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 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 a signed 8-bit integer vector (i.e., a one-dimensional ndarray).\n*\n* @module @stdlib/ndarray-vector-int8\n*\n* @example\n* var numel = require( '@stdlib/ndarray-numel' );\n* var Int8Vector = require( '@stdlib/ndarray-vector-int8' );\n*\n* var v = new Int8Vector();\n* // returns <ndarray>\n*\n* var len = numel( v );\n* // returns 0\n*\n* @example\n* var numel = require( '@stdlib/ndarray-numel' );\n* var Int8Vector = require( '@stdlib/ndarray-vector-int8' );\n*\n* var v = new Int8Vector( 2 );\n* // returns <ndarray>\n*\n* var len = numel( v );\n* // returns 2\n*\n* @example\n* var numel = require( '@stdlib/ndarray-numel' );\n* var Int8Vector = require( '@stdlib/ndarray-vector-int8' );\n*\n* var v = new Int8Vector( [ 1, 2 ] );\n* // returns <ndarray>\n*\n* var len = numel( v );\n* // returns 2\n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var numel = require( '@stdlib/ndarray-numel' );\n* var Int8Vector = require( '@stdlib/ndarray-vector-int8' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var v = new Int8Vector( buf );\n* // returns <ndarray>\n*\n* var len = numel( v );\n* // returns 32\n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var numel = require( '@stdlib/ndarray-numel' );\n* var Int8Vector = require( '@stdlib/ndarray-vector-int8' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var v = new Int8Vector( buf, 16 );\n* // returns <ndarray>\n*\n* var len = numel( v );\n* // returns 16\n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var numel = require( '@stdlib/ndarray-numel' );\n* var Int8Vector = require( '@stdlib/ndarray-vector-int8' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var v = new Int8Vector( buf, 16, 2 );\n* // returns <ndarray>\n*\n* var len = numel( v );\n* // returns 2\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,EAAU,QAAS,6BAA8B,EAAE,QAiFnDC,EAAaD,EAAS,MAAO,EAKjCD,EAAO,QAAUE,ICdjB,IAAIC,EAAO,IAKX,OAAO,QAAUA",
6
+ "names": ["require_main", "__commonJSMin", "exports", "module", "factory", "Int8Vector", "main"]
7
+ }
@@ -0,0 +1,377 @@
1
+ /*
2
+ * @license Apache-2.0
3
+ *
4
+ * Copyright (c) 2025 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
+ // TypeScript Version: 4.1
20
+
21
+ /* eslint-disable @typescript-eslint/unified-signatures */
22
+
23
+ /// <reference types="@stdlib/types"/>
24
+
25
+ import { Order, Mode, int8ndarray } from '@stdlib/types/ndarray';
26
+ import { Collection, AccessorArrayLike } from '@stdlib/types/array';
27
+ import ArrayBuffer = require( '@stdlib/array-buffer' );
28
+
29
+ /**
30
+ * Interface describing function options.
31
+ */
32
+ interface Options {
33
+ /**
34
+ * Array order (either 'row-major' (C-style) or 'column-major' (Fortran-style)).
35
+ */
36
+ order?: Order;
37
+
38
+ /**
39
+ * Specifies how to handle a linear index which exceeds array dimensions (default: 'throw').
40
+ */
41
+ mode?: Mode;
42
+
43
+ /**
44
+ * Boolean indicating whether an array should be read-only (default: false).
45
+ */
46
+ readonly?: boolean;
47
+ }
48
+
49
+ /**
50
+ * Interface defining a typed vector constructor which is both "newable" and "callable".
51
+ */
52
+ interface Int8Vector {
53
+ /**
54
+ * Creates a signed 8-bit integer vector (i.e., a one-dimensional ndarray).
55
+ *
56
+ * @param options - function options
57
+ * @param options.readonly - boolean indicating whether to return a read-only vector
58
+ * @param options.mode - specifies how to handle indices which exceed vector dimensions
59
+ * @param options.order - memory layout (either row-major or column-major)
60
+ * @returns one-dimensional ndarray
61
+ *
62
+ * @example
63
+ * var numel = require( '@stdlib/ndarray-numel' );
64
+ *
65
+ * var arr = new Int8Vector();
66
+ * // returns <ndarray>
67
+ *
68
+ * var len = numel( arr );
69
+ * // returns 0
70
+ */
71
+ new ( options?: Options ): int8ndarray;
72
+
73
+ /**
74
+ * Creates a signed 8-bit integer vector (i.e., a one-dimensional ndarray).
75
+ *
76
+ * @param length - vector length
77
+ * @param options - function options
78
+ * @param options.readonly - boolean indicating whether to return a read-only vector
79
+ * @param options.mode - specifies how to handle indices which exceed vector dimensions
80
+ * @param options.order - memory layout (either row-major or column-major)
81
+ * @returns one-dimensional ndarray
82
+ *
83
+ * @example
84
+ * var numel = require( '@stdlib/ndarray-numel' );
85
+ *
86
+ * var arr = new Int8Vector( 2 );
87
+ * // returns <ndarray>
88
+ *
89
+ * var len = numel( arr );
90
+ * // returns 2
91
+ */
92
+ new ( length: number, options?: Options ): int8ndarray;
93
+
94
+ /**
95
+ * Creates a signed 8-bit integer vector (i.e., a one-dimensional ndarray).
96
+ *
97
+ * @param obj - array-like object or iterable from which to generate a vector
98
+ * @param options - function options
99
+ * @param options.readonly - boolean indicating whether to return a read-only vector
100
+ * @param options.mode - specifies how to handle indices which exceed vector dimensions
101
+ * @param options.order - memory layout (either row-major or column-major)
102
+ * @returns one-dimensional ndarray
103
+ *
104
+ * @example
105
+ * var numel = require( '@stdlib/ndarray-numel' );
106
+ *
107
+ * var arr = new Int8Vector( [ 1, 2 ] );
108
+ * // returns <ndarray>
109
+ *
110
+ * var len = numel( arr );
111
+ * // returns 2
112
+ */
113
+ new ( obj: Collection<unknown> | AccessorArrayLike<unknown> | Iterable<unknown>, options?: Options ): int8ndarray;
114
+
115
+ /**
116
+ * Creates a signed 8-bit integer vector (i.e., a one-dimensional ndarray).
117
+ *
118
+ * @param buffer - underlying ArrayBuffer
119
+ * @param options - function options
120
+ * @param options.readonly - boolean indicating whether to return a read-only vector
121
+ * @param options.mode - specifies how to handle indices which exceed vector dimensions
122
+ * @param options.order - memory layout (either row-major or column-major)
123
+ * @returns one-dimensional ndarray
124
+ *
125
+ * @example
126
+ * var numel = require( '@stdlib/ndarray-numel' );
127
+ * var ArrayBuffer = require( '@stdlib/array-buffer' );
128
+ *
129
+ * var buf = new ArrayBuffer( 32 );
130
+ * var arr = new Int8Vector( buf );
131
+ * // returns <ndarray>
132
+ *
133
+ * var len = numel( arr );
134
+ * // returns 32
135
+ */
136
+ new ( buffer: ArrayBuffer, options?: Options ): int8ndarray;
137
+
138
+ /**
139
+ * Creates a signed 8-bit integer vector (i.e., a one-dimensional ndarray).
140
+ *
141
+ * @param buffer - underlying ArrayBuffer
142
+ * @param byteOffset - integer byte offset specifying the location of the first vector element
143
+ * @param options - function options
144
+ * @param options.readonly - boolean indicating whether to return a read-only vector
145
+ * @param options.mode - specifies how to handle indices which exceed vector dimensions
146
+ * @param options.order - memory layout (either row-major or column-major)
147
+ * @returns one-dimensional ndarray
148
+ *
149
+ * @example
150
+ * var numel = require( '@stdlib/ndarray-numel' );
151
+ * var ArrayBuffer = require( '@stdlib/array-buffer' );
152
+ *
153
+ * var buf = new ArrayBuffer( 32 );
154
+ * var arr = new Int8Vector( buf, 8 );
155
+ * // returns <ndarray>
156
+ *
157
+ * var len = numel( arr );
158
+ * // returns 24
159
+ */
160
+ new ( buffer: ArrayBuffer, byteOffset: number, options?: Options ): int8ndarray;
161
+
162
+ /**
163
+ * Creates a signed 8-bit integer vector (i.e., a one-dimensional ndarray).
164
+ *
165
+ * @param buffer - underlying ArrayBuffer
166
+ * @param byteOffset - integer byte offset specifying the location of the first vector element
167
+ * @param length - view length; if not provided, the view spans from the byteOffset to the end of the underlying ArrayBuffer
168
+ * @param options - function options
169
+ * @param options.readonly - boolean indicating whether to return a read-only vector
170
+ * @param options.mode - specifies how to handle indices which exceed vector dimensions
171
+ * @param options.order - memory layout (either row-major or column-major)
172
+ * @returns one-dimensional ndarray
173
+ *
174
+ * @example
175
+ * var numel = require( '@stdlib/ndarray-numel' );
176
+ * var ArrayBuffer = require( '@stdlib/array-buffer' );
177
+ *
178
+ * var buf = new ArrayBuffer( 32 );
179
+ * var arr = new Int8Vector( buf, 8, 2 );
180
+ * // returns <ndarray>
181
+ *
182
+ * var len = numel( arr );
183
+ * // returns 2
184
+ */
185
+ new ( buffer: ArrayBuffer, byteOffset: number, length: number, options?: Options ): int8ndarray;
186
+
187
+ /**
188
+ * Creates a signed 8-bit integer vector (i.e., a one-dimensional ndarray).
189
+ *
190
+ * @param options - function options
191
+ * @param options.readonly - boolean indicating whether to return a read-only vector
192
+ * @param options.mode - specifies how to handle indices which exceed vector dimensions
193
+ * @param options.order - memory layout (either row-major or column-major)
194
+ * @returns one-dimensional ndarray
195
+ *
196
+ * @example
197
+ * var numel = require( '@stdlib/ndarray-numel' );
198
+ *
199
+ * var arr = new Int8Vector();
200
+ * // returns <ndarray>
201
+ *
202
+ * var len = numel( arr );
203
+ * // returns 0
204
+ */
205
+ ( options?: Options ): int8ndarray;
206
+
207
+ /**
208
+ * Creates a signed 8-bit integer vector (i.e., a one-dimensional ndarray).
209
+ *
210
+ * @param length - vector length
211
+ * @param options - function options
212
+ * @param options.readonly - boolean indicating whether to return a read-only vector
213
+ * @param options.mode - specifies how to handle indices which exceed vector dimensions
214
+ * @param options.order - memory layout (either row-major or column-major)
215
+ * @returns one-dimensional ndarray
216
+ *
217
+ * @example
218
+ * var numel = require( '@stdlib/ndarray-numel' );
219
+ *
220
+ * var arr = new Int8Vector( 2 );
221
+ * // returns <ndarray>
222
+ *
223
+ * var len = numel( arr );
224
+ * // returns 2
225
+ */
226
+ ( length: number, options?: Options ): int8ndarray;
227
+
228
+ /**
229
+ * Creates a signed 8-bit integer vector (i.e., a one-dimensional ndarray).
230
+ *
231
+ * @param obj - array-like object or iterable from which to generate a vector
232
+ * @param options - function options
233
+ * @param options.readonly - boolean indicating whether to return a read-only vector
234
+ * @param options.mode - specifies how to handle indices which exceed vector dimensions
235
+ * @param options.order - memory layout (either row-major or column-major)
236
+ * @returns one-dimensional ndarray
237
+ *
238
+ * @example
239
+ * var numel = require( '@stdlib/ndarray-numel' );
240
+ *
241
+ * var arr = new Int8Vector( [ 1, 2 ] );
242
+ * // returns <ndarray>
243
+ *
244
+ * var len = numel( arr );
245
+ * // returns 2
246
+ */
247
+ ( obj: Collection<unknown> | AccessorArrayLike<unknown> | Iterable<unknown>, options?: Options ): int8ndarray;
248
+
249
+ /**
250
+ * Creates a signed 8-bit integer vector (i.e., a one-dimensional ndarray).
251
+ *
252
+ * @param buffer - underlying ArrayBuffer
253
+ * @param options - function options
254
+ * @param options.readonly - boolean indicating whether to return a read-only vector
255
+ * @param options.mode - specifies how to handle indices which exceed vector dimensions
256
+ * @param options.order - memory layout (either row-major or column-major)
257
+ * @returns one-dimensional ndarray
258
+ *
259
+ * @example
260
+ * var numel = require( '@stdlib/ndarray-numel' );
261
+ * var ArrayBuffer = require( '@stdlib/array-buffer' );
262
+ *
263
+ * var buf = new ArrayBuffer( 32 );
264
+ * var arr = new Int8Vector( buf );
265
+ * // returns <ndarray>
266
+ *
267
+ * var len = numel( arr );
268
+ * // returns 32
269
+ */
270
+ ( buffer: ArrayBuffer, options?: Options ): int8ndarray;
271
+
272
+ /**
273
+ * Creates a signed 8-bit integer vector (i.e., a one-dimensional ndarray).
274
+ *
275
+ * @param buffer - underlying ArrayBuffer
276
+ * @param byteOffset - integer byte offset specifying the location of the first vector element
277
+ * @param options - function options
278
+ * @param options.readonly - boolean indicating whether to return a read-only vector
279
+ * @param options.mode - specifies how to handle indices which exceed vector dimensions
280
+ * @param options.order - memory layout (either row-major or column-major)
281
+ * @returns one-dimensional ndarray
282
+ *
283
+ * @example
284
+ * var numel = require( '@stdlib/ndarray-numel' );
285
+ * var ArrayBuffer = require( '@stdlib/array-buffer' );
286
+ *
287
+ * var buf = new ArrayBuffer( 32 );
288
+ * var arr = new Int8Vector( buf, 8 );
289
+ * // returns <ndarray>
290
+ *
291
+ * var len = numel( arr );
292
+ * // returns 24
293
+ */
294
+ ( buffer: ArrayBuffer, byteOffset: number, options?: Options ): int8ndarray;
295
+
296
+ /**
297
+ * Creates a signed 8-bit integer vector (i.e., a one-dimensional ndarray).
298
+ *
299
+ * @param buffer - underlying ArrayBuffer
300
+ * @param byteOffset - integer byte offset specifying the location of the first vector element
301
+ * @param length - view length; if not provided, the view spans from the byteOffset to the end of the underlying ArrayBuffer
302
+ * @param options - function options
303
+ * @param options.readonly - boolean indicating whether to return a read-only vector
304
+ * @param options.mode - specifies how to handle indices which exceed vector dimensions
305
+ * @param options.order - memory layout (either row-major or column-major)
306
+ * @returns one-dimensional ndarray
307
+ *
308
+ * @example
309
+ * var numel = require( '@stdlib/ndarray-numel' );
310
+ * var ArrayBuffer = require( '@stdlib/array-buffer' );
311
+ *
312
+ * var buf = new ArrayBuffer( 32 );
313
+ * var arr = new Int8Vector( buf, 8, 2 );
314
+ * // returns <ndarray>
315
+ *
316
+ * var len = numel( arr );
317
+ * // returns 2
318
+ */
319
+ ( buffer: ArrayBuffer, byteOffset: number, length: number, options?: Options ): int8ndarray;
320
+ }
321
+
322
+ /**
323
+ * Creates a signed 8-bit integer vector (i.e., a one-dimensional ndarray).
324
+ *
325
+ * @param arg - length, typed array, array-like object, buffer, or iterable
326
+ * @param byteOffset - integer byte offset specifying the location of the first vector element (default: 0)
327
+ * @param length - view length; if not provided, the view spans from the byteOffset to the end of the underlying ArrayBuffer
328
+ * @param options - function options
329
+ * @param options.readonly - boolean indicating whether to return a read-only vector
330
+ * @param options.mode - specifies how to handle indices which exceed vector dimensions
331
+ * @param options.order - memory layout (either row-major or column-major)
332
+ * @returns one-dimensional ndarray
333
+ *
334
+ * @example
335
+ * var numel = require( '@stdlib/ndarray-numel' );
336
+ *
337
+ * var arr = new Int8Vector();
338
+ * // returns <ndarray>
339
+ *
340
+ * var len = numel( arr );
341
+ * // returns 0
342
+ *
343
+ * @example
344
+ * var numel = require( '@stdlib/ndarray-numel' );
345
+ *
346
+ * var arr = new Int8Vector( 2 );
347
+ * // returns <ndarray>
348
+ *
349
+ * var len = numel( arr );
350
+ * // returns 2
351
+ *
352
+ * @example
353
+ * var numel = require( '@stdlib/ndarray-numel' );
354
+ *
355
+ * var arr = new Int8Vector( [ 1, 2 ] );
356
+ * // returns <ndarray>
357
+ *
358
+ * var len = numel( arr );
359
+ * // returns 2
360
+ *
361
+ * @example
362
+ * var numel = require( '@stdlib/ndarray-numel' );
363
+ * var ArrayBuffer = require( '@stdlib/array-buffer' );
364
+ *
365
+ * var buf = new ArrayBuffer( 32 );
366
+ * var arr = new Int8Vector( buf, 8, 2 );
367
+ * // returns <ndarray>
368
+ *
369
+ * var len = numel( arr );
370
+ * // returns 2
371
+ */
372
+ declare var ctor: Int8Vector;
373
+
374
+
375
+ // EXPORTS //
376
+
377
+ export = ctor;
package/lib/index.js ADDED
@@ -0,0 +1,100 @@
1
+ /**
2
+ * @license Apache-2.0
3
+ *
4
+ * Copyright (c) 2025 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
+ 'use strict';
20
+
21
+ /**
22
+ * Create a signed 8-bit integer vector (i.e., a one-dimensional ndarray).
23
+ *
24
+ * @module @stdlib/ndarray-vector-int8
25
+ *
26
+ * @example
27
+ * var numel = require( '@stdlib/ndarray-numel' );
28
+ * var Int8Vector = require( '@stdlib/ndarray-vector-int8' );
29
+ *
30
+ * var v = new Int8Vector();
31
+ * // returns <ndarray>
32
+ *
33
+ * var len = numel( v );
34
+ * // returns 0
35
+ *
36
+ * @example
37
+ * var numel = require( '@stdlib/ndarray-numel' );
38
+ * var Int8Vector = require( '@stdlib/ndarray-vector-int8' );
39
+ *
40
+ * var v = new Int8Vector( 2 );
41
+ * // returns <ndarray>
42
+ *
43
+ * var len = numel( v );
44
+ * // returns 2
45
+ *
46
+ * @example
47
+ * var numel = require( '@stdlib/ndarray-numel' );
48
+ * var Int8Vector = require( '@stdlib/ndarray-vector-int8' );
49
+ *
50
+ * var v = new Int8Vector( [ 1, 2 ] );
51
+ * // returns <ndarray>
52
+ *
53
+ * var len = numel( v );
54
+ * // returns 2
55
+ *
56
+ * @example
57
+ * var ArrayBuffer = require( '@stdlib/array-buffer' );
58
+ * var numel = require( '@stdlib/ndarray-numel' );
59
+ * var Int8Vector = require( '@stdlib/ndarray-vector-int8' );
60
+ *
61
+ * var buf = new ArrayBuffer( 32 );
62
+ * var v = new Int8Vector( buf );
63
+ * // returns <ndarray>
64
+ *
65
+ * var len = numel( v );
66
+ * // returns 32
67
+ *
68
+ * @example
69
+ * var ArrayBuffer = require( '@stdlib/array-buffer' );
70
+ * var numel = require( '@stdlib/ndarray-numel' );
71
+ * var Int8Vector = require( '@stdlib/ndarray-vector-int8' );
72
+ *
73
+ * var buf = new ArrayBuffer( 32 );
74
+ * var v = new Int8Vector( buf, 16 );
75
+ * // returns <ndarray>
76
+ *
77
+ * var len = numel( v );
78
+ * // returns 16
79
+ *
80
+ * @example
81
+ * var ArrayBuffer = require( '@stdlib/array-buffer' );
82
+ * var numel = require( '@stdlib/ndarray-numel' );
83
+ * var Int8Vector = require( '@stdlib/ndarray-vector-int8' );
84
+ *
85
+ * var buf = new ArrayBuffer( 64 );
86
+ * var v = new Int8Vector( buf, 16, 2 );
87
+ * // returns <ndarray>
88
+ *
89
+ * var len = numel( v );
90
+ * // returns 2
91
+ */
92
+
93
+ // MODULES //
94
+
95
+ var main = require( './main.js' );
96
+
97
+
98
+ // EXPORTS //
99
+
100
+ module.exports = main;
package/lib/main.js ADDED
@@ -0,0 +1,109 @@
1
+ /**
2
+ * @license Apache-2.0
3
+ *
4
+ * Copyright (c) 2025 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
+ 'use strict';
20
+
21
+ // MODULES //
22
+
23
+ var factory = require( '@stdlib/ndarray-vector-ctor' ).factory;
24
+
25
+
26
+ // MAIN //
27
+
28
+ /**
29
+ * Returns a signed 8-bit integer vector (i.e., a one-dimensional ndarray).
30
+ *
31
+ * @name Int8Vector
32
+ * @type {Function}
33
+ * @param {(NonNegativeInteger|Collection|ArrayBuffer|Iterable)} [arg] - length, typed array, array-like object, buffer, or iterable
34
+ * @param {NonNegativeInteger} [byteOffset=0] - byte offset
35
+ * @param {NonNegativeInteger} [length] - view length
36
+ * @param {Options} [options] - function options
37
+ * @param {boolean} [options.readonly=false] - boolean indicating whether to return a read-only vector
38
+ * @param {string} [options.mode='throw'] - specifies how to handle indices which exceed vector dimensions
39
+ * @param {string} [options.order='row-major'] - memory layout (either row-major or column-major)
40
+ * @throws {TypeError} first argument must be either a length, typed array, array-like object, buffer, iterable, or options object
41
+ * @throws {TypeError} must provide valid options
42
+ * @returns {ndarray} one-dimensional ndarray
43
+ *
44
+ * @example
45
+ * var numel = require( '@stdlib/ndarray-numel' );
46
+ *
47
+ * var arr = new Int8Vector();
48
+ * // returns <ndarray>
49
+ *
50
+ * var len = numel( arr );
51
+ * // returns 0
52
+ *
53
+ * @example
54
+ * var numel = require( '@stdlib/ndarray-numel' );
55
+ *
56
+ * var arr = new Int8Vector( 2 );
57
+ * // returns <ndarray>
58
+ *
59
+ * var len = numel( arr );
60
+ * // returns 2
61
+ *
62
+ * @example
63
+ * var numel = require( '@stdlib/ndarray-numel' );
64
+ *
65
+ * var arr = new Int8Vector( [ 1, 2 ] );
66
+ * // returns <ndarray>
67
+ *
68
+ * var len = numel( arr );
69
+ * // returns 2
70
+ *
71
+ * @example
72
+ * var numel = require( '@stdlib/ndarray-numel' );
73
+ * var ArrayBuffer = require( '@stdlib/array-buffer' );
74
+ *
75
+ * var buf = new ArrayBuffer( 32 );
76
+ * var arr = new Int8Vector( buf );
77
+ * // returns <ndarray>
78
+ *
79
+ * var len = numel( arr );
80
+ * // returns 32
81
+ *
82
+ * @example
83
+ * var numel = require( '@stdlib/ndarray-numel' );
84
+ * var ArrayBuffer = require( '@stdlib/array-buffer' );
85
+ *
86
+ * var buf = new ArrayBuffer( 32 );
87
+ * var arr = new Int8Vector( buf, 16 );
88
+ * // returns <ndarray>
89
+ *
90
+ * var len = numel( arr );
91
+ * // returns 16
92
+ *
93
+ * @example
94
+ * var numel = require( '@stdlib/ndarray-numel' );
95
+ * var ArrayBuffer = require( '@stdlib/array-buffer' );
96
+ *
97
+ * var buf = new ArrayBuffer( 64 );
98
+ * var arr = new Int8Vector( buf, 16, 2 );
99
+ * // returns <ndarray>
100
+ *
101
+ * var len = numel( arr );
102
+ * // returns 2
103
+ */
104
+ var Int8Vector = factory( 'int8' );
105
+
106
+
107
+ // EXPORTS //
108
+
109
+ module.exports = Int8Vector;
package/package.json ADDED
@@ -0,0 +1,68 @@
1
+ {
2
+ "name": "@stdlib/ndarray-vector-int8",
3
+ "version": "0.1.0",
4
+ "description": "Create a signed 8-bit integer vector (i.e., a one-dimensional ndarray).",
5
+ "license": "Apache-2.0",
6
+ "author": {
7
+ "name": "The Stdlib Authors",
8
+ "url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
9
+ },
10
+ "contributors": [
11
+ {
12
+ "name": "The Stdlib Authors",
13
+ "url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
14
+ }
15
+ ],
16
+ "main": "./lib",
17
+ "directories": {
18
+ "doc": "./docs",
19
+ "lib": "./lib",
20
+ "dist": "./dist"
21
+ },
22
+ "types": "./docs/types",
23
+ "scripts": {},
24
+ "homepage": "https://stdlib.io",
25
+ "repository": {
26
+ "type": "git",
27
+ "url": "git://github.com/stdlib-js/ndarray-vector-int8.git"
28
+ },
29
+ "bugs": {
30
+ "url": "https://github.com/stdlib-js/stdlib/issues"
31
+ },
32
+ "dependencies": {
33
+ "@stdlib/ndarray-vector-ctor": "github:stdlib-js/ndarray-vector-ctor#main"
34
+ },
35
+ "devDependencies": {},
36
+ "engines": {
37
+ "node": ">=0.10.0",
38
+ "npm": ">2.7.0"
39
+ },
40
+ "os": [
41
+ "aix",
42
+ "darwin",
43
+ "freebsd",
44
+ "linux",
45
+ "macos",
46
+ "openbsd",
47
+ "sunos",
48
+ "win32",
49
+ "windows"
50
+ ],
51
+ "keywords": [
52
+ "stdlib",
53
+ "stdtypes",
54
+ "types",
55
+ "data",
56
+ "structure",
57
+ "vector",
58
+ "vec",
59
+ "ndarray",
60
+ "constructor",
61
+ "ctor",
62
+ "int8"
63
+ ],
64
+ "funding": {
65
+ "type": "opencollective",
66
+ "url": "https://opencollective.com/stdlib"
67
+ }
68
+ }