@@ -59,51 +59,47 @@ public FrameBlock decode(MatrixBlock in, FrameBlock out) {
5959
6060 @ Override
6161 public void decode (MatrixBlock in , FrameBlock out , int rl , int ru ) {
62- //TODO perf (exploit sparse representation for better asymptotic behavior)
63- // out.ensureAllocatedColumns(in.getNumRows());
64- if (in .isInSparseFormat ()){
62+ if (in .isInSparseFormat ()) {
6563 SparseBlock sb = in .getSparseBlock ();
66- for (int i = rl ; i < ru ; i ++){
67- if (!sb .isEmpty (i )){
64+ for (int i = rl ; i < ru ; i ++) {
65+ if (!sb .isEmpty (i )) {
6866 int apos = sb .pos (i );
6967 int alen = sb .size (i ) + apos ;
7068 int [] aix = sb .indexes (i );
71- // double[] val = sb.values(i); always 1...
69+ // double[] val = sb.values(i); always 1... therefore not needed
7270 int h = 0 ;
73- for (int j = 0 ; j < _colList .length && h < alen ; j ++){
71+ for (int j = 0 ; j < _colList .length && h < alen ; j ++) {
7472 // find k, the index in aix, within the range of low and high
7573 int low = _clPos [j ];
7674 int high = _cuPos [j ];
77- while (h < alen && aix [h ] < low ){
75+ while (h < alen && aix [h ] < low ) {
7876 h ++;
7977 }
80- if (h < alen && aix [h ] >= low && aix [h ] < high ){
78+ if (h < alen && aix [h ] >= low && aix [h ] < high ) {
8179 int k = aix [h ];
8280 int col = _colList [j ] - 1 ;
8381 out .getColumn (col ).set (i , k - _clPos [j ] + 1 );
8482 }
85- while (h < alen && aix [h ] < high ){
83+ while (h < alen && aix [h ] < high ) {
8684 h ++;
8785 }
8886 }
8987 }
9088 }
9189 }
92- else {
90+ else {
9391 for (int i = rl ; i < ru ; i ++)
9492 for (int j = 0 ; j < _colList .length ; j ++)
9593 for (int k = _clPos [j ]; k < _cuPos [j ]; k ++)
9694 if (in .get (i , k - 1 ) != 0 ) {
9795 int col = _colList [j ] - 1 ;
9896 out .getColumn (col ).set (i , k - _clPos [j ] + 1 );
9997 // if the non zero is found, we can skip the rest of k.
100- continue ;
98+ continue ;
10199 }
102100 }
103-
104-
105101 }
106-
102+
107103 @ Override
108104 public Decoder subRangeDecoder (int colStart , int colEnd , int dummycodedOffset ) {
109105 List <Integer > dcList = new ArrayList <>();
0 commit comments