58
58
import org .apache .sysds .runtime .compress .lib .CLALibMMChain ;
59
59
import org .apache .sysds .runtime .compress .lib .CLALibMatrixMult ;
60
60
import org .apache .sysds .runtime .compress .lib .CLALibMerge ;
61
+ import org .apache .sysds .runtime .compress .lib .CLALibReorg ;
61
62
import org .apache .sysds .runtime .compress .lib .CLALibReplace ;
62
63
import org .apache .sysds .runtime .compress .lib .CLALibReshape ;
63
64
import org .apache .sysds .runtime .compress .lib .CLALibRexpand ;
72
73
import org .apache .sysds .runtime .data .DenseBlock ;
73
74
import org .apache .sysds .runtime .data .SparseBlock ;
74
75
import org .apache .sysds .runtime .data .SparseRow ;
75
- import org .apache .sysds .runtime .functionobjects .SwapIndex ;
76
76
import org .apache .sysds .runtime .instructions .InstructionUtils ;
77
77
import org .apache .sysds .runtime .instructions .cp .CM_COV_Object ;
78
78
import org .apache .sysds .runtime .instructions .cp .ScalarObject ;
@@ -226,6 +226,7 @@ public void allocateColGroup(AColGroup cg) {
226
226
* @param colGroups new ColGroups in the MatrixBlock
227
227
*/
228
228
public void allocateColGroupList (List <AColGroup > colGroups ) {
229
+ cachedMemorySize = -1 ;
229
230
_colGroups = colGroups ;
230
231
}
231
232
@@ -351,7 +352,6 @@ public long recomputeNonZeros(int k) {
351
352
List <Future <Long >> tasks = new ArrayList <>();
352
353
for (AColGroup g : _colGroups )
353
354
tasks .add (pool .submit (() -> g .getNumberNonZeros (rlen )));
354
-
355
355
long nnz = 0 ;
356
356
for (Future <Long > t : tasks )
357
357
nnz += t .get ();
@@ -398,7 +398,6 @@ public long estimateSizeInMemory() {
398
398
public long estimateCompressedSizeInMemory () {
399
399
400
400
if (cachedMemorySize <= -1L ) {
401
-
402
401
long total = baseSizeInMemory ();
403
402
// take into consideration duplicate dictionaries
404
403
Set <IDictionary > dicts = new HashSet <>();
@@ -413,7 +412,6 @@ public long estimateCompressedSizeInMemory() {
413
412
}
414
413
cachedMemorySize = total ;
415
414
return total ;
416
-
417
415
}
418
416
else
419
417
return cachedMemorySize ;
@@ -635,21 +633,7 @@ public MatrixBlock replaceOperations(MatrixValue result, double pattern, double
635
633
636
634
@ Override
637
635
public MatrixBlock reorgOperations (ReorgOperator op , MatrixValue ret , int startRow , int startColumn , int length ) {
638
- if (op .fn instanceof SwapIndex && this .getNumColumns () == 1 ) {
639
- MatrixBlock tmp = decompress (op .getNumThreads ());
640
- long nz = tmp .setNonZeros (tmp .getNonZeros ());
641
- tmp = new MatrixBlock (tmp .getNumColumns (), tmp .getNumRows (), tmp .getDenseBlockValues ());
642
- tmp .setNonZeros (nz );
643
- return tmp ;
644
- }
645
- else {
646
- // Allow transpose to be compressed output. In general we need to have a transposed flag on
647
- // the compressed matrix. https://issues.apache.org/jira/browse/SYSTEMDS-3025
648
- String message = op .getClass ().getSimpleName () + " -- " + op .fn .getClass ().getSimpleName ();
649
- MatrixBlock tmp = getUncompressed (message , op .getNumThreads ());
650
- return tmp .reorgOperations (op , ret , startRow , startColumn , length );
651
- }
652
-
636
+ return CLALibReorg .reorg (this , op , (MatrixBlock ) ret , startRow , startColumn , length );
653
637
}
654
638
655
639
public boolean isOverlapping () {
@@ -1002,6 +986,10 @@ public MatrixBlock getUncompressed() {
1002
986
return getUncompressed ((String ) null );
1003
987
}
1004
988
989
+ public MatrixBlock getUncompressed (int k ){
990
+ return getUncompressed ((String ) null , k );
991
+ }
992
+
1005
993
public MatrixBlock getUncompressed (String operation ) {
1006
994
return getUncompressed (operation ,
1007
995
ConfigurationManager .isParallelMatrixOperations () ? InfrastructureAnalyzer .getLocalParallelism () : 1 );
@@ -1213,8 +1201,8 @@ public void examSparsity(boolean allowCSR, int k) {
1213
1201
}
1214
1202
1215
1203
@ Override
1216
- public void sparseToDense (int k ) {
1217
- // do nothing
1204
+ public MatrixBlock sparseToDense (int k ) {
1205
+ return this ; // do nothing
1218
1206
}
1219
1207
1220
1208
@ Override
0 commit comments