Skip to content

Commit 1130fc1

Browse files
committed
limit
1 parent 182db53 commit 1130fc1

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/main/java/org/apache/sysds/runtime/transform/decode/DecoderBin.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,16 @@ public void decode(MatrixBlock in, FrameBlock out, int rl, int ru) {
7171
try{
7272

7373
final int key = (int) Math.round(val);
74-
double bmin = _binMins[j][key];
75-
double bmax = _binMaxs[j][key];
76-
double oval = bmin + (bmax - bmin) / 2 // bin center
77-
+ (val - key) * (bmax - bmin); // bin fractions
78-
a.set(i, oval);
74+
if(key == 0){
75+
a.set(i, _binMins[j][key]);
76+
}
77+
else{
78+
double bmin = _binMins[j][key - 1];
79+
double bmax = _binMaxs[j][key - 1];
80+
double oval = bmin + (bmax - bmin) / 2 // bin center
81+
+ (val - key) * (bmax - bmin); // bin fractions
82+
a.set(i, oval);
83+
}
7984
}
8085
catch(Exception e){
8186
LOG.error(a);

0 commit comments

Comments
 (0)