Skip to content

Commit 19b7f95

Browse files
committed
clear extra condition checks from cached functions
1 parent f7bd96d commit 19b7f95

File tree

1 file changed

+0
-12
lines changed

1 file changed

+0
-12
lines changed

fdg.js

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,6 @@ var CACHED_thunk = {
4949
cdiff: function(compile) {
5050
var CACHED = {}
5151
return function cdiff_cwise_thunk(array0, array1, array2) {
52-
if (!(array0.shape.length === array1.shape.length + 0 && array0.shape.length === array2.shape.length + 0)) throw new Error('cwise: Arrays do not all have the same dimensionality!')
53-
for (var shapeIndex = array0.shape.length - 0; shapeIndex-- > 0;) {
54-
if (!(array0.shape[shapeIndex + 0] === array1.shape[shapeIndex + 0] && array0.shape[shapeIndex + 0] === array2.shape[shapeIndex + 0])) throw new Error('cwise: Arrays do not all have the same shape!')
55-
}
5652
var t0 = array0.dtype, r0 = array0.order, t1 = array1.dtype, r1 = array1.order, t2 = array2.dtype, r2 = array2.order, type = [t0, r0.join(), t1, r1.join(), t2, r2.join()].join(), proc = CACHED[type]
5753
if (!proc) { CACHED[type] = proc = compile([t0, r0, t1, r1, t2, r2]) } return proc(array0.shape.slice(0), array0.data, array0.stride, array0.offset | 0, array1.data, array1.stride, array1.offset | 0, array2.data, array2.stride, array2.offset | 0)
5854
}
@@ -69,10 +65,6 @@ var CACHED_thunk = {
6965
fdTemplate1: function(compile) {
7066
var CACHED = {}
7167
return function fdTemplate1_cwise_thunk(array0, array1) {
72-
if (!(array0.shape.length === array1.shape.length + 0)) throw new Error('cwise: Arrays do not all have the same dimensionality!')
73-
for (var shapeIndex = array0.shape.length - 0; shapeIndex-- > 0;) {
74-
if (!(array0.shape[shapeIndex + 0] === array1.shape[shapeIndex + 0])) throw new Error('cwise: Arrays do not all have the same shape!')
75-
}
7668
var t0 = array0.dtype, r0 = array0.order, t1 = array1.dtype, r1 = array1.order, type = [t0, r0.join(), t1, r1.join()].join(), proc = CACHED[type]
7769
if (!proc) { CACHED[type] = proc = compile([t0, r0, t1, r1]) } return proc(array0.shape.slice(0), array0.data, array0.stride, array0.offset | 0, array1.data, array1.stride, array1.offset | 0)
7870
}
@@ -81,10 +73,6 @@ var CACHED_thunk = {
8173
fdTemplate2: function(compile) {
8274
var CACHED = {}
8375
return function fdTemplate2_cwise_thunk(array0, array1, array4) {
84-
if (!(array0.shape.length === array1.shape.length + 0 && array0.shape.length === array4.shape.length + 0)) throw new Error('cwise: Arrays do not all have the same dimensionality!')
85-
for (var shapeIndex = array0.shape.length - 0; shapeIndex-- > 0;) {
86-
if (!(array0.shape[shapeIndex + 0] === array1.shape[shapeIndex + 0] && array0.shape[shapeIndex + 0] === array4.shape[shapeIndex + 0])) throw new Error('cwise: Arrays do not all have the same shape!')
87-
}
8876
var t0 = array0.dtype, r0 = array0.order, t1 = array1.dtype, r1 = array1.order, t4 = array4.dtype, r4 = array4.order, type = [t0, r0.join(), t1, r1.join(), t4, r4.join()].join(), proc = CACHED[type]
8977
if (!proc) { CACHED[type] = proc = compile([t0, r0, t1, r1, t4, r4]) } return proc(array0.shape.slice(0), array0.data, array0.stride, array0.offset | 0, array1.data, array1.stride, array1.offset | 0, array4.data, array4.stride, array4.offset | 0)
9078
}

0 commit comments

Comments
 (0)