blob: 358fdb171d3dc632490f8d0a616fe619dc62ddba [file] [log] [blame]
#-------------------------------------------------------------
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
#-------------------------------------------------------------
test_num = $in_test_num;
row_part = $in_rp;
if(row_part) {
X = federated(addresses=list($in_X1, $in_X2),
ranges=list(list(0, 0), list($rows / 2, $cols), list($rows / 2, 0), list($rows, $cols)));
}
else {
X = federated(addresses=list($in_X1, $in_X2),
ranges=list(list(0, 0), list($rows, $cols / 2), list(0, $cols / 2), list($rows, $cols)));
}
if(test_num == 1) {
# X ... 6x4 matrix
r1 = min(X > 0.5);
r2 = max(X > 0.5);
Z = as.matrix(r1 + r2);
}
else if(test_num == 2) {
# X ... 6x4 matrix
r1 = sum(X > 0.5);
r2 = sum((X > 0.5)^2);
Z = as.matrix(r1 + r2);
}
else if(test_num == 3) {
# X ... 6x4 matrix
#disjoint partitions with shared read
r1 = sum(X == 0.7)
r2 = sum(X == 0.3)
Z = as.matrix(r1 + r2);
}
else if(test_num == 4) {
# X ... 6x4 matrix
Y = matrix(seq(2,25), rows=6, cols=4);
#disjoint partitions with partial shared reads
r1 = sum(X * Y);
r2 = sum(X ^ 2);
r3 = sum(Y ^ 2);
Z = as.matrix(r1 + r2 + r3);
}
else if(test_num == 5) {
# X ... 6x4 matrix
U = matrix(seq(0,23), rows=6, cols=4);
V = matrix(seq(2,25), rows=6, cols=4);
W = matrix(seq(3,26), rows=6, cols=4);
#disjoint partitions with transitive partial shared reads
r1 = sum(X * U);
r2 = sum(V * W);
r3 = sum(X * V * W);
Z = as.matrix(r1 + r2 + r3);
}
else if(test_num == 6) {
# X ... 6x4 matrix
r1 = min(X);
r2 = max(X);
r3 = sum(X);
Z = as.matrix(r1 + r2 + r3);
}
else if(test_num == 7) {
# X ... 20x1 vector
Y = seq(2,21);
while(FALSE){}
r1 = t(X) %*% X;
r2 = t(X) %*% Y;
r3 = t(Y) %*% Y;
Z = r1 + r2 + r3;
}
write(Z, $out_Z);