sebwrede commented on a change in pull request #1060:
URL: https://github.com/apache/systemds/pull/1060#discussion_r493266586
##########
File path:
src/main/java/org/apache/sysds/runtime/privacy/finegrained/FineGrainedPrivacyList.java
##########
@@ -35,11 +35,61 @@
private ArrayList<Map.Entry<DataRange, PrivacyLevel>>
constraintCollection = new ArrayList<>();
+ @Override
+ public PrivacyLevel[] getRowPrivacy(int numRows, int numCols) {
+ PrivacyLevel[] privacyLevels = new PrivacyLevel[numRows];
+ for (int i = 0; i < numRows; i++) {
+ long[] beginRange1 = new long[] {i, 0};
+ long[] endRange1 = new long[] {i, numCols};
+ privacyLevels[i] = getStrictestPrivacyLevel(new
DataRange(beginRange1, endRange1));
+ }
+ return privacyLevels;
+ }
+
+ @Override
+ public PrivacyLevel[] getColPrivacy(int numRows, int numCols) {
+ PrivacyLevel[] privacyLevels = new PrivacyLevel[numCols];
+ for (int i = 0; i < numCols; i++) {
+ long[] beginRange = new long[] {0, i};
+ long[] endRange = new long[] {numRows, i};
+ privacyLevels[i] = getStrictestPrivacyLevel(new
DataRange(beginRange, endRange));
+ }
+ return privacyLevels;
+ }
+
+ private PrivacyLevel getStrictestPrivacyLevel(DataRange searchRange){
+ PrivacyLevel strictestLevel = PrivacyLevel.None;
+ for ( Map.Entry<DataRange, PrivacyLevel> constraint :
constraintCollection ) {
Review comment:
I actually started implementing a tree structure when I added
fine-grained privacy, but we decided that it was not relevant for now and that
we could do it later when we have the propagation of fine-grained constraints
ready.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]