Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dstructs-matrix

Package Overview
Dependencies
Maintainers
2
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dstructs-matrix - npm Package Compare versions

Comparing version 2.1.1 to 2.1.2

26

lib/tojson.js
'use strict';
// MODULES //
var cast = require( 'dstructs-cast-arrays' ),
copy = require( 'utils-copy' );
// TOJSON //
/**

@@ -12,13 +20,4 @@ * FUNCTION: toJSON()

var prop,
out,
len,
d,
i;
out;
// Copy data to a generic array...
len = this.data.length;
d = new Array( len );
for ( i = 0; i < len; i++ ) {
d[ i ] = this.data[ i ];
}
// Build an object containing all Matrix properties needed to revive a serialized Matrix...

@@ -28,5 +27,5 @@ out = {};

out.dtype = this.dtype;
out.shape = this.shape;
out.shape = copy( this.shape );
out.offset = this.offset;
out.strides = this.strides;
out.strides = copy( this.strides );

@@ -36,3 +35,4 @@ prop = Object.getOwnPropertyDescriptor( this, 'data' );

out.data = d;
// Cast data to a generic array:
out.data = cast( this.data, 'generic' );

@@ -39,0 +39,0 @@ return out;

{
"name": "dstructs-matrix",
"version": "2.1.1",
"version": "2.1.2",
"description": "Matrices.",

@@ -55,2 +55,3 @@ "author": {

"dstructs-cast-arrays": "^1.0.2",
"utils-copy": "^1.0.0",
"validate.io-array": "^1.0.6",

@@ -57,0 +58,0 @@ "validate.io-contains": "^1.0.0",

@@ -221,6 +221,8 @@ Matrix

var mat = matrix( data, [10,1] );
// [ 0 0 0 0 0 0 0 0 0 0 ]
var mat = matrix( data, [1,10] );
/*
[ 0 0 0 0 0 0 0 0 0 0 ]
*/
var value = mat.get( 3, 1 );
var value = mat.get( 1, 3 );
// returns 0

@@ -227,0 +229,0 @@

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