New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@stdlib/ndarray-base-ctor

Package Overview
Dependencies
Maintainers
4
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stdlib/ndarray-base-ctor - npm Package Compare versions

Comparing version 0.0.5 to 0.0.6

3

docs/repl.txt

@@ -144,3 +144,4 @@

{{alias}}.prototype.flags
Information about the memory layout of the array.
Meta information, such as information concerning the memory layout of the
array.

@@ -147,0 +148,0 @@ Returns

@@ -24,3 +24,3 @@ /*

import { ArrayLike } from '@stdlib/types/array';
import { ndarray, DataType, Order } from '@stdlib/types/ndarray';
import { ndarray, DataType, Order, Shape, Strides } from '@stdlib/types/ndarray';
import { Buffer } from 'buffer';

@@ -64,3 +64,3 @@

*/
new( dtype: DataType, buffer: ArrayLike<any> | Buffer, shape: ArrayLike<number>, strides: ArrayLike<number>, offset: number, order: Order ): ndarray; // tslint-disable-line max-line-length
new( dtype: DataType, buffer: ArrayLike<any> | Buffer, shape: Shape, strides: Strides, offset: number, order: Order ): ndarray; // tslint-disable-line max-line-length

@@ -99,3 +99,3 @@ /**

*/
( dtype: DataType, buffer: ArrayLike<any> | Buffer, shape: ArrayLike<number>, strides: ArrayLike<number>, offset: number, order: Order ): ndarray; // tslint-disable-line max-line-length
( dtype: DataType, buffer: ArrayLike<any> | Buffer, shape: Shape, strides: Strides, offset: number, order: Order ): ndarray; // tslint-disable-line max-line-length
}

@@ -102,0 +102,0 @@

@@ -33,3 +33,4 @@ /**

'ROW_MAJOR_CONTIGUOUS': flags.ROW_MAJOR_CONTIGUOUS,
'COLUMN_MAJOR_CONTIGUOUS': flags.COLUMN_MAJOR_CONTIGUOUS
'COLUMN_MAJOR_CONTIGUOUS': flags.COLUMN_MAJOR_CONTIGUOUS,
'READONLY': flags.READONLY
};

@@ -36,0 +37,0 @@ }

@@ -123,3 +123,4 @@ /**

'ROW_MAJOR_CONTIGUOUS': isRowMajorContiguous( ord, contiguous ),
'COLUMN_MAJOR_CONTIGUOUS': isColumnMajorContiguous( ord, contiguous )
'COLUMN_MAJOR_CONTIGUOUS': isColumnMajorContiguous( ord, contiguous ),
'READONLY': false
};

@@ -240,3 +241,3 @@

/**
* Information about the memory layout of the array.
* Meta information, such as information concerning the memory layout of the array.
*

@@ -582,3 +583,3 @@ * @name flags

* ```text
* | <endianness> (1 byte) | <dtype> (2 bytes) | <ndims> (8 bytes) | <shape> (ndims*8 bytes) | <strides> (ndims*8 bytes) | <offset> (8 bytes) | <order> (1 byte) | <mode> (1 byte) | <nsubmodes> (8 bytes) | <submodes> (nsubmodes*1 bytes) |
* | <endianness> (1 byte) | <dtype> (2 bytes) | <ndims> (8 bytes) | <shape> (ndims*8 bytes) | <strides> (ndims*8 bytes) | <offset> (8 bytes) | <order> (1 byte) | <mode> (1 byte) | <nsubmodes> (8 bytes) | <submodes> (nsubmodes*1 bytes) | <flags> (4 bytes) |
* ```

@@ -585,0 +586,0 @@ *

@@ -55,3 +55,3 @@ /**

* ```text
* | endianness (1 byte) | <dtype> (2 bytes) | <ndims> (8 bytes) | <shape> (ndims*8 bytes) | <strides> (ndims*8 bytes) | <offset> (8 bytes) | <order> (1 byte) | <mode> (1 byte) | <nsubmodes> (8 bytes) | <submodes> (nsubmodes*1 bytes) |
* | endianness (1 byte) | <dtype> (2 bytes) | <ndims> (8 bytes) | <shape> (ndims*8 bytes) | <strides> (ndims*8 bytes) | <offset> (8 bytes) | <order> (1 byte) | <mode> (1 byte) | <nsubmodes> (8 bytes) | <submodes> (nsubmodes*1 bytes) | <flags> (4 bytes) |
* ```

@@ -72,3 +72,4 @@ *

* <nsubmodes>[int64],
* <submodes>[nsubmodes*int8]
* <submodes>[nsubmodes*int8],
* <flags>[int32]
* ]

@@ -84,3 +85,3 @@ * ```

* ```text
* 1 + 2 + 8 + (ndims*8) + (ndims*8) + 8 + 1 + 1 + 8 + (nsubmodes*1) = 29 + (ndims*16) + nsubmodes
* 1 + 2 + 8 + (ndims*8) + (ndims*8) + 8 + 1 + 1 + 8 + (nsubmodes*1) + 4 = 33 + (ndims*16) + nsubmodes
* ```

@@ -91,3 +92,3 @@ *

* ```text
* 29 + (3*16) + 1 = 78 bytes
* 33 + (3*16) + 1 = 82 bytes
* ```

@@ -107,2 +108,3 @@ *

* - submodes: `Int8Array( buf, 29+(ndims*16), nsubmodes )`
* - flags: `Int32Array( buf, 29+(ndims*16)+nsubmodes, 1 )`
*

@@ -115,2 +117,3 @@ * @private

var nbytes;
var flgs;
var len;

@@ -135,3 +138,3 @@ var dt;

// Compute the amount of memory we need to allocate for storing meta data:
len = 29 + (N*16) + M;
len = 33 + (N*16) + M;

@@ -194,2 +197,7 @@ // Check if we've already serialized ndarray meta data and can reuse an already allocated array buffer...

}
// Flags: (byteoffset: 29+(ndims*16)+nsubmodes; bytelength: 4)
flgs = 0|0;
flgs |= ( this._flags.READONLY ) ? 4 : 0; // 00000000 00000000 00000000 00000100
v.setInt32( o, flgs, IS_LITTLE_ENDIAN );
// Cache the serialized meta data:

@@ -196,0 +204,0 @@ this.__meta_dataview__ = v;

@@ -56,3 +56,3 @@ /**

* ```text
* | endianness (1 byte) | <dtype> (2 bytes) | <ndims> (8 bytes) | <shape> (ndims*8 bytes) | <strides> (ndims*8 bytes) | <offset> (8 bytes) | <order> (1 byte) | <mode> (1 byte) | <nsubmodes> (8 bytes) | <submodes> (nsubmodes*1 bytes) |
* | endianness (1 byte) | <dtype> (2 bytes) | <ndims> (8 bytes) | <shape> (ndims*8 bytes) | <strides> (ndims*8 bytes) | <offset> (8 bytes) | <order> (1 byte) | <mode> (1 byte) | <nsubmodes> (8 bytes) | <submodes> (nsubmodes*1 bytes) | <flags> (4 bytes) |
* ```

@@ -73,3 +73,4 @@ *

* <nsubmodes>[int64],
* <submodes>[nsubmodes*int8]
* <submodes>[nsubmodes*int8],
* <flags>[int32]
* ]

@@ -85,3 +86,3 @@ * ```

* ```text
* 1 + 2 + 8 + (ndims*8) + (ndims*8) + 8 + 1 + 1 + 8 + (nsubmodes*1) = 29 + (ndims*16) + nsubmodes
* 1 + 2 + 8 + (ndims*8) + (ndims*8) + 8 + 1 + 1 + 8 + (nsubmodes*1) + 4 = 33 + (ndims*16) + nsubmodes
* ```

@@ -92,3 +93,3 @@ *

* ```text
* 29 + (3*16) + 1 = 78 bytes
* 33 + (3*16) + 1 = 82 bytes
* ```

@@ -108,2 +109,3 @@ *

* - submodes: `Int8Array( buf, 29+(ndims*16), nsubmodes )`
* - flags: `Int32Array( buf, 29+(ndims*16)+nsubmodes, 1 )`
*

@@ -117,2 +119,3 @@ * @private

var bytes;
var flgs;
var len;

@@ -137,3 +140,3 @@ var dt;

// Compute the amount of memory we need to allocate for storing meta data:
len = 29 + (N*16) + M;
len = 33 + (N*16) + M;

@@ -197,2 +200,7 @@ // Check if we've already serialized ndarray meta data and can reuse an already allocated array buffer...

}
// Flags: (byteoffset: 29+(ndims*16)+nsubmodes; bytelength: 4)
flgs = 0|0;
flgs |= ( this._flags.READONLY ) ? 4 : 0; // 00000000 00000000 00000000 00000100
v.setInt32( o, flgs, IS_LITTLE_ENDIAN );
// Cache the serialized meta data:

@@ -199,0 +207,0 @@ this.__meta_dataview__ = v;

@@ -52,3 +52,5 @@ /**

out.dtype = this.dtype;
out.flags = {}; // TODO: reserved for future use
out.flags = {
'READONLY': this._flags.READONLY
};
out.order = this._order;

@@ -55,0 +57,0 @@ out.shape = this._shape.slice();

{
"name": "@stdlib/ndarray-base-ctor",
"version": "0.0.5",
"version": "0.0.6",
"description": "Base multidimensional array.",

@@ -5,0 +5,0 @@ "license": "Apache-2.0",

@@ -23,3 +23,3 @@ <!--

[![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] [![dependencies][dependencies-image]][dependencies-url]
[![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] <!-- [![dependencies][dependencies-image]][dependencies-url] -->

@@ -252,6 +252,7 @@ > Create a multidimensional array.

Information regarding the memory layout of the array. The returned `object` has the following properties:
Meta information, such as information concerning the memory layout of the array. The returned `object` has the following properties:
- **ROW_MAJOR_CONTIGUOUS**: `boolean` indicating if an array is row-major contiguous.
- **COLUMN_MAJOR_CONTIGUOUS**: `boolean` indicating if an array is column-major contiguous.
- **READONLY**: `boolean` indicating if an array is **read-only**.

@@ -641,3 +642,3 @@ An array is contiguous if (1) an array is compatible with being stored in a single memory segment and (2) each array element is adjacent to the next array element. Note that an array can be both row-major contiguous and column-major contiguous at the same time (e.g., if an array is a 1-dimensional ndarray with `strides = [1]`).

str = JSON.stringify( arr.toJSON() );
// returns '{"type":"ndarray","dtype":"float32","flags":{},"order":"row-major","shape":[3,3,3,3],"strides":[27,9,3,1],"data":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}'
// e.g., returns '{"type":"ndarray","dtype":"float32","flags":{"READONLY":false},"order":"row-major","shape":[3,3,3,3],"strides":[27,9,3,1],"data":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}'
```

@@ -657,2 +658,17 @@

<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
<section class="related">
* * *
## See Also
- <span class="package-name">[`@stdlib/ndarray/array`][@stdlib/ndarray/array]</span><span class="delimiter">: </span><span class="description">multidimensional arrays.</span>
- <span class="package-name">[`@stdlib/ndarray/ctor`][@stdlib/ndarray/ctor]</span><span class="delimiter">: </span><span class="description">multidimensional array constructor.</span>
</section>
<!-- /.related -->
<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->

@@ -684,3 +700,3 @@

Copyright &copy; 2016-2021. The Stdlib [Authors][stdlib-authors].
Copyright &copy; 2016-2022. The Stdlib [Authors][stdlib-authors].

@@ -704,5 +720,16 @@ </section>

<!--
[dependencies-image]: https://img.shields.io/david/stdlib-js/ndarray-base-ctor.svg
[dependencies-url]: https://david-dm.org/stdlib-js/ndarray-base-ctor/main
-->
[umd]: https://github.com/umdjs/umd
[es-module]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules
[deno-url]: https://github.com/stdlib-js/ndarray-base-ctor/tree/deno
[umd-url]: https://github.com/stdlib-js/ndarray-base-ctor/tree/umd
[esm-url]: https://github.com/stdlib-js/ndarray-base-ctor/tree/esm
[chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg

@@ -725,4 +752,12 @@ [chat-url]: https://gitter.im/stdlib-js/stdlib/

<!-- <related-links> -->
[@stdlib/ndarray/array]: https://www.npmjs.com/package/@stdlib/ndarray-array
[@stdlib/ndarray/ctor]: https://www.npmjs.com/package/@stdlib/ndarray-ctor
<!-- </related-links> -->
</section>
<!-- /.links -->

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc