Socket
Socket
Sign inDemoInstall

ndarray-pack

Package Overview
Dependencies
8
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.1 to 1.0.0

18

convert.js
"use strict"
var ndarray = require("ndarray")
var numeric = require("numeric")
var cwise = require("cwise")

@@ -18,10 +17,15 @@

module.exports = function convert(arr, dtype) {
if(!dtype) {
dtype = "float64"
module.exports = function convert(arr) {
var shape = [], c = arr, sz = 1
while(c instanceof Array) {
shape.push(c.length)
sz *= c.length
c = c[0]
}
var shape = numeric.dim(arr)
var result = ndarray.zeros(shape, dtype)
if(shape.length === 0) {
return ndarray([])
}
var result = ndarray(new Float64Array(sz), shape)
do_convert(result, arr)
return result
}
}
{
"name": "ndarray-pack",
"version": "0.0.1",
"version": "1.0.0",
"description": "Packs an array-of-arrays into a single ndarray",

@@ -10,5 +10,4 @@ "main": "convert.js",

"dependencies": {
"cwise": "~0.1.2",
"ndarray": "~0.2.1",
"numeric": "~1.2.6"
"cwise": "~0.3.2",
"ndarray": "~1.0.0"
},

@@ -15,0 +14,0 @@ "devDependencies": {

@@ -22,7 +22,6 @@ ndarray-pack

### `require("ndarray-pack")(nested_array[, dtype])`
### `require("ndarray-pack")(nested_array)`
Converts the nested array into a packed ndarray.
* `nested_array` is an array-of-arrays (ie a numeric.js array)
* `dtype` is the data type of the packed ndarray. (Either, "uint8", "uint16", "uint32", "int8", "int16", "int32", "float" or "double")

@@ -29,0 +28,0 @@ **Returns** A packed ndarray representation of the nested arrays.

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc