Join our webinar on Wednesday, June 26, at 1pm EDTHow Chia Mitigates Risk in the Crypto Industry.Register
Socket
Socket
Sign inDemoInstall

cwise

Package Overview
Dependencies
2
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.0 to 0.1.1

bench/array_2d.js

3

index.js

@@ -7,3 +7,3 @@ "use strict"

var REQUIRED_FIELDS = [ "args", "body" ]
var OPTIONAL_FIELDS = [ "pre", "post", "unroll", "printCode" ]
var OPTIONAL_FIELDS = [ "pre", "post", "printCode" ]

@@ -78,3 +78,2 @@ function CompiledProcedure() {

//Parse options
proc.unroll = user_args.unroll || 1
proc.printCode = user_args.printCode || false

@@ -81,0 +80,0 @@

@@ -10,6 +10,5 @@ "use strict"

, code = []
, idx, pidx, i, j
code.push("var i0=0")
for(i=1; i<dimension; ++i) {
code.push(",i"+i+"=0")
, idx=0, pidx=0, i, j
for(i=0; i<dimension; ++i) {
code.push("var i"+i+"=0;")
}

@@ -19,8 +18,8 @@ //Compute scan deltas

for(i=0; i<dimension; ++i) {
pidx = idx
idx = order[i]
if(i < 1) {
code.push(",d"+j+"s"+i+"=stride"+j+"["+idx+"]|0")
if(i === 0) {
code.push("var d"+j+"s"+i+"=stride"+j+"["+idx+"]|0;")
} else {
pidx = order[i-1]
code.push(",d"+j+"s"+i+"=(stride"+j+"["+idx+"]-shape["+pidx+"]*stride"+j+"["+pidx+"])|0")
code.push("var d"+j+"s"+i+"=(stride"+j+"["+idx+"]-shape["+pidx+"]*stride"+j+"["+pidx+"])|0;")
}

@@ -32,3 +31,3 @@ }

idx = order[i]
code.push("for(i"+i+"=(shape["+idx+"]-1)|0;i"+i+">=0;--i"+i+"){")
code.push("for(i"+i+"=shape["+idx+"]|0;--i"+i+">=0;){")
}

@@ -39,2 +38,3 @@ //Push body of inner loop

for(i=0; i<dimension; ++i) {
pidx = idx
idx = order[i]

@@ -46,3 +46,2 @@ for(j=0; j<nargs; ++j) {

if(i > 0) {
pidx = order[i-1]
code.push("index["+pidx+"]-=shape["+pidx+"]")

@@ -176,4 +175,10 @@ }

arglist.push("stride" + i)
code.push("ptr"+i+"=ptr"+i+"|0")
code.push("ptr"+i+"|=0")
for(j = 0; j<dimension; ++j) {
code.push("stride"+i+"["+j+"]|=0")
}
}
for(i = 0; i<dimension; ++i) {
code.push("shape["+i+"]|=0")
}
for(i = 0; i<procedure.numScalarArgs; ++i) {

@@ -215,3 +220,3 @@ arglist.push("scalar"+i)

if(procedure.printCode) {
console.log("Generated code:", result+"")
console.log("For order:", orders, "Generated code: \n", result+"")
}

@@ -218,0 +223,0 @@ return result

@@ -131,4 +131,6 @@ "use strict"

return "var this_={}"
} else if(this.this_vars.length > 0) {
return "var this_" + this.this_vars.join(",this_")
} else {
return "var this_" + this.this_vars.join(",this_")
return ""
}

@@ -135,0 +137,0 @@ }

@@ -35,10 +35,2 @@ "use strict"

Shim.prototype.getOrder = function(stride) {
switch(stride.length) {
case 1:
return [ 0 ]
case 2:
return Math.abs(stride[0]) > Math.abs(stride[1]) ? [0,1] : [1,0]
default:
break;
}
var zipped = new Array(stride.length)

@@ -45,0 +37,0 @@ for(var i=0; i<stride.length; ++i) {

{
"name": "cwise",
"version": "0.1.0",
"version": "0.1.1",
"description": "Component-wise map/reduce for ndarrays",

@@ -5,0 +5,0 @@ "main": "index.js",

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