Baunsgaard commented on code in PR #2149:
URL: https://github.com/apache/systemds/pull/2149#discussion_r1866806275
##########
src/main/java/org/apache/sysds/runtime/compress/colgroup/ColGroupSDCZeros.java:
##########
@@ -848,23 +848,52 @@ else if(points[c].o < of)
while(c < points.length && points[c].o < last)
c++;
- c = processRow(points, sr, nCol, c, of,
_data.getIndex(it.getDataIndex()));
+ c = processRowSparse(points, sr, nCol, c, of,
_data.getIndex(it.getDataIndex()));
}
@Override
protected void denseSelection(MatrixBlock selection, P[] points,
MatrixBlock ret, int rl, int ru) {
- throw new NotImplementedException();
+ final DenseBlock dr = ret.getDenseBlock();
+ final int nCol = _colIndexes.size();
+ final AIterator it = _indexes.getIterator();
+ final int last = _indexes.getOffsetToLast();
+ int c = 0;
+ int of = it.value();
+
+ while(of < last && c < points.length) {
+ if(points[c].o == of) {
+ c = processRowDense(points, dr,
nCol, c, of, _data.getIndex(it.getDataIndex()));
+ of = it.next();
+ }
+ else if(points[c].o < of)
+ c++;
+ else
+ of = it.next();
+ }
+ // increment the c pointer until it is pointing
at least to last point or is done.
+ while(c < points.length &&
points[c].o < last)
+ c++;
+ c = processRowDense(points, dr,
nCol, c, of, _data.getIndex(it.getDataIndex()));
+ }
+
+ private int processRowSparse(P[] points, final SparseBlock sr, final
int nCol, int c, int of, final int did) {
+ while(c < points.length && points[c].o == of) {
+ _dict.putSparse(sr, did, points[c].r, nCol,
_colIndexes);
+ c++;
+ }
+ return c;
}
- private int processRow(P[] points, final SparseBlock sr, final int
nCol, int c, int of, final int did) {
+ private int processRowDense(P[] points, final DenseBlock dr, final int
nCol, int c, int of, final int did) {
while(c < points.length && points[c].o == of) {
- _dict.put(sr, did, points[c].r, nCol, _colIndexes);
+ _dict.putDense(dr, did, points[c].r, nCol, _colIndexes);
c++;
}
return c;
}
+
Review Comment:
formatting (no double new line)
##########
src/main/java/org/apache/sysds/runtime/compress/colgroup/ColGroupSDCZeros.java:
##########
@@ -848,23 +848,52 @@ else if(points[c].o < of)
while(c < points.length && points[c].o < last)
c++;
- c = processRow(points, sr, nCol, c, of,
_data.getIndex(it.getDataIndex()));
+ c = processRowSparse(points, sr, nCol, c, of,
_data.getIndex(it.getDataIndex()));
}
@Override
protected void denseSelection(MatrixBlock selection, P[] points,
MatrixBlock ret, int rl, int ru) {
- throw new NotImplementedException();
+ final DenseBlock dr = ret.getDenseBlock();
Review Comment:
Indentation
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]