http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/binary/matrix/UltraSparseMatrixMultiplication.R ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/binary/matrix/UltraSparseMatrixMultiplication.R b/src/test/scripts/functions/binary/matrix/UltraSparseMatrixMultiplication.R index 4909173..d70c7a6 100644 --- a/src/test/scripts/functions/binary/matrix/UltraSparseMatrixMultiplication.R +++ b/src/test/scripts/functions/binary/matrix/UltraSparseMatrixMultiplication.R @@ -19,19 +19,19 @@ # #------------------------------------------------------------- - -args <- commandArgs(TRUE) -options(digits=22) - -library("Matrix") - -A <- as.matrix(readMM(paste(args[1], "A.mtx", sep=""))) -B <- as.matrix(readMM(paste(args[1], "B.mtx", sep=""))) - -P <- diag( as.vector(B==2) ) -Px <- P[rowSums((P==0) | is.na(P)) != ncol(P),]; - -C <- Px %*% A; - -writeMM(as(C, "CsparseMatrix"), paste(args[2], "C", sep="")); - + +args <- commandArgs(TRUE) +options(digits=22) + +library("Matrix") + +A <- as.matrix(readMM(paste(args[1], "A.mtx", sep=""))) +B <- as.matrix(readMM(paste(args[1], "B.mtx", sep=""))) + +P <- diag( as.vector(B==2) ) +Px <- P[rowSums((P==0) | is.na(P)) != ncol(P),]; + +C <- Px %*% A; + +writeMM(as(C, "CsparseMatrix"), paste(args[2], "C", sep="")); +
http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/binary/matrix/UltraSparseMatrixMultiplication2.R ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/binary/matrix/UltraSparseMatrixMultiplication2.R b/src/test/scripts/functions/binary/matrix/UltraSparseMatrixMultiplication2.R index 4909173..d70c7a6 100644 --- a/src/test/scripts/functions/binary/matrix/UltraSparseMatrixMultiplication2.R +++ b/src/test/scripts/functions/binary/matrix/UltraSparseMatrixMultiplication2.R @@ -19,19 +19,19 @@ # #------------------------------------------------------------- - -args <- commandArgs(TRUE) -options(digits=22) - -library("Matrix") - -A <- as.matrix(readMM(paste(args[1], "A.mtx", sep=""))) -B <- as.matrix(readMM(paste(args[1], "B.mtx", sep=""))) - -P <- diag( as.vector(B==2) ) -Px <- P[rowSums((P==0) | is.na(P)) != ncol(P),]; - -C <- Px %*% A; - -writeMM(as(C, "CsparseMatrix"), paste(args[2], "C", sep="")); - + +args <- commandArgs(TRUE) +options(digits=22) + +library("Matrix") + +A <- as.matrix(readMM(paste(args[1], "A.mtx", sep=""))) +B <- as.matrix(readMM(paste(args[1], "B.mtx", sep=""))) + +P <- diag( as.vector(B==2) ) +Px <- P[rowSums((P==0) | is.na(P)) != ncol(P),]; + +C <- Px %*% A; + +writeMM(as(C, "CsparseMatrix"), paste(args[2], "C", sep="")); + http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/binary/matrix/ZipMMTest.R ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/binary/matrix/ZipMMTest.R b/src/test/scripts/functions/binary/matrix/ZipMMTest.R index 8b73634..bfc621a 100644 --- a/src/test/scripts/functions/binary/matrix/ZipMMTest.R +++ b/src/test/scripts/functions/binary/matrix/ZipMMTest.R @@ -1,34 +1,34 @@ -#------------------------------------------------------------- -# -# 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. -# -#------------------------------------------------------------- - -args <- commandArgs(TRUE) -options(digits=22) - -library("Matrix") - -A <- as.matrix(readMM(paste(args[1], "A.mtx", sep=""))) -B <- as.matrix(readMM(paste(args[1], "B.mtx", sep=""))) - -C = t(A) %*% B; - -writeMM(as(C, "CsparseMatrix"), paste(args[2], "C", sep="")); - - +#------------------------------------------------------------- +# +# 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. +# +#------------------------------------------------------------- + +args <- commandArgs(TRUE) +options(digits=22) + +library("Matrix") + +A <- as.matrix(readMM(paste(args[1], "A.mtx", sep=""))) +B <- as.matrix(readMM(paste(args[1], "B.mtx", sep=""))) + +C = t(A) %*% B; + +writeMM(as(C, "CsparseMatrix"), paste(args[2], "C", sep="")); + + http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/binary/matrix_full_cellwise/FullMatrixCellwiseOperation_Addition.R ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/binary/matrix_full_cellwise/FullMatrixCellwiseOperation_Addition.R b/src/test/scripts/functions/binary/matrix_full_cellwise/FullMatrixCellwiseOperation_Addition.R index c93053c..94809b6 100644 --- a/src/test/scripts/functions/binary/matrix_full_cellwise/FullMatrixCellwiseOperation_Addition.R +++ b/src/test/scripts/functions/binary/matrix_full_cellwise/FullMatrixCellwiseOperation_Addition.R @@ -19,20 +19,20 @@ # #------------------------------------------------------------- - -args <- commandArgs(TRUE) -options(digits=22) - -library("Matrix") - -A1 <- readMM(paste(args[1], "A.mtx", sep="")) -A <- as.matrix(A1); -B1 <- readMM(paste(args[1], "B.mtx", sep="")) -B <- as.matrix(B1); - - -C <- A+B; - -writeMM(as(C, "CsparseMatrix"), paste(args[2], "C", sep="")); - - + +args <- commandArgs(TRUE) +options(digits=22) + +library("Matrix") + +A1 <- readMM(paste(args[1], "A.mtx", sep="")) +A <- as.matrix(A1); +B1 <- readMM(paste(args[1], "B.mtx", sep="")) +B <- as.matrix(B1); + + +C <- A+B; + +writeMM(as(C, "CsparseMatrix"), paste(args[2], "C", sep="")); + + http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/binary/matrix_full_cellwise/FullMatrixCellwiseOperation_Division.R ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/binary/matrix_full_cellwise/FullMatrixCellwiseOperation_Division.R b/src/test/scripts/functions/binary/matrix_full_cellwise/FullMatrixCellwiseOperation_Division.R index 2058e29..79afbc5 100644 --- a/src/test/scripts/functions/binary/matrix_full_cellwise/FullMatrixCellwiseOperation_Division.R +++ b/src/test/scripts/functions/binary/matrix_full_cellwise/FullMatrixCellwiseOperation_Division.R @@ -19,20 +19,20 @@ # #------------------------------------------------------------- - -args <- commandArgs(TRUE) -options(digits=22) - -library("Matrix") - -A1 <- readMM(paste(args[1], "A.mtx", sep="")) -A <- as.matrix(A1); -B1 <- readMM(paste(args[1], "B.mtx", sep="")) -B <- as.matrix(B1); - - -C <- A/B; - -writeMM(as(C, "CsparseMatrix"), paste(args[2], "C", sep="")); - - + +args <- commandArgs(TRUE) +options(digits=22) + +library("Matrix") + +A1 <- readMM(paste(args[1], "A.mtx", sep="")) +A <- as.matrix(A1); +B1 <- readMM(paste(args[1], "B.mtx", sep="")) +B <- as.matrix(B1); + + +C <- A/B; + +writeMM(as(C, "CsparseMatrix"), paste(args[2], "C", sep="")); + + http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/binary/matrix_full_cellwise/FullMatrixCellwiseOperation_Multiplication.R ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/binary/matrix_full_cellwise/FullMatrixCellwiseOperation_Multiplication.R b/src/test/scripts/functions/binary/matrix_full_cellwise/FullMatrixCellwiseOperation_Multiplication.R index d32c17c..70573e0 100644 --- a/src/test/scripts/functions/binary/matrix_full_cellwise/FullMatrixCellwiseOperation_Multiplication.R +++ b/src/test/scripts/functions/binary/matrix_full_cellwise/FullMatrixCellwiseOperation_Multiplication.R @@ -19,20 +19,20 @@ # #------------------------------------------------------------- - -args <- commandArgs(TRUE) -options(digits=22) - -library("Matrix") - -A1 <- readMM(paste(args[1], "A.mtx", sep="")) -A <- as.matrix(A1); -B1 <- readMM(paste(args[1], "B.mtx", sep="")) -B <- as.matrix(B1); - - -C <- A*B; - -writeMM(as(C, "CsparseMatrix"), paste(args[2], "C", sep="")); - - + +args <- commandArgs(TRUE) +options(digits=22) + +library("Matrix") + +A1 <- readMM(paste(args[1], "A.mtx", sep="")) +A <- as.matrix(A1); +B1 <- readMM(paste(args[1], "B.mtx", sep="")) +B <- as.matrix(B1); + + +C <- A*B; + +writeMM(as(C, "CsparseMatrix"), paste(args[2], "C", sep="")); + + http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/binary/matrix_full_cellwise/FullMatrixCellwiseOperation_Substraction.R ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/binary/matrix_full_cellwise/FullMatrixCellwiseOperation_Substraction.R b/src/test/scripts/functions/binary/matrix_full_cellwise/FullMatrixCellwiseOperation_Substraction.R index f07a257..2dcd410 100644 --- a/src/test/scripts/functions/binary/matrix_full_cellwise/FullMatrixCellwiseOperation_Substraction.R +++ b/src/test/scripts/functions/binary/matrix_full_cellwise/FullMatrixCellwiseOperation_Substraction.R @@ -19,20 +19,20 @@ # #------------------------------------------------------------- - -args <- commandArgs(TRUE) -options(digits=22) - -library("Matrix") - -A1 <- readMM(paste(args[1], "A.mtx", sep="")) -A <- as.matrix(A1); -B1 <- readMM(paste(args[1], "B.mtx", sep="")) -B <- as.matrix(B1); - - -C <- A-B; - -writeMM(as(C, "CsparseMatrix"), paste(args[2], "C", sep="")); - - + +args <- commandArgs(TRUE) +options(digits=22) + +library("Matrix") + +A1 <- readMM(paste(args[1], "A.mtx", sep="")) +A <- as.matrix(A1); +B1 <- readMM(paste(args[1], "B.mtx", sep="")) +B <- as.matrix(B1); + + +C <- A-B; + +writeMM(as(C, "CsparseMatrix"), paste(args[2], "C", sep="")); + + http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/binary/matrix_full_cellwise/FullMatrixVectorColCellwiseOperation_Addition.R ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/binary/matrix_full_cellwise/FullMatrixVectorColCellwiseOperation_Addition.R b/src/test/scripts/functions/binary/matrix_full_cellwise/FullMatrixVectorColCellwiseOperation_Addition.R index 8cf01d9..0956055 100644 --- a/src/test/scripts/functions/binary/matrix_full_cellwise/FullMatrixVectorColCellwiseOperation_Addition.R +++ b/src/test/scripts/functions/binary/matrix_full_cellwise/FullMatrixVectorColCellwiseOperation_Addition.R @@ -19,20 +19,20 @@ # #------------------------------------------------------------- - -args <- commandArgs(TRUE) -options(digits=22) - -library("Matrix") - -A1 <- readMM(paste(args[1], "A.mtx", sep="")) -A <- as.matrix(A1); -B1 <- readMM(paste(args[1], "B.mtx", sep="")) -B <- as.vector(B1); - - -C <- A+B; - -writeMM(as(C, "CsparseMatrix"), paste(args[2], "C", sep="")); - - + +args <- commandArgs(TRUE) +options(digits=22) + +library("Matrix") + +A1 <- readMM(paste(args[1], "A.mtx", sep="")) +A <- as.matrix(A1); +B1 <- readMM(paste(args[1], "B.mtx", sep="")) +B <- as.vector(B1); + + +C <- A+B; + +writeMM(as(C, "CsparseMatrix"), paste(args[2], "C", sep="")); + + http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/binary/matrix_full_cellwise/FullMatrixVectorColCellwiseOperation_Division.R ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/binary/matrix_full_cellwise/FullMatrixVectorColCellwiseOperation_Division.R b/src/test/scripts/functions/binary/matrix_full_cellwise/FullMatrixVectorColCellwiseOperation_Division.R index 0d64579..c7026bd 100644 --- a/src/test/scripts/functions/binary/matrix_full_cellwise/FullMatrixVectorColCellwiseOperation_Division.R +++ b/src/test/scripts/functions/binary/matrix_full_cellwise/FullMatrixVectorColCellwiseOperation_Division.R @@ -19,20 +19,20 @@ # #------------------------------------------------------------- - -args <- commandArgs(TRUE) -options(digits=22) - -library("Matrix") - -A1 <- readMM(paste(args[1], "A.mtx", sep="")) -A <- as.matrix(A1); -B1 <- readMM(paste(args[1], "B.mtx", sep="")) -B <- as.vector(B1); - - -C <- A/B; - -writeMM(as(C, "CsparseMatrix"), paste(args[2], "C", sep="")); - - + +args <- commandArgs(TRUE) +options(digits=22) + +library("Matrix") + +A1 <- readMM(paste(args[1], "A.mtx", sep="")) +A <- as.matrix(A1); +B1 <- readMM(paste(args[1], "B.mtx", sep="")) +B <- as.vector(B1); + + +C <- A/B; + +writeMM(as(C, "CsparseMatrix"), paste(args[2], "C", sep="")); + + http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/binary/matrix_full_cellwise/FullMatrixVectorColCellwiseOperation_Multiplication.R ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/binary/matrix_full_cellwise/FullMatrixVectorColCellwiseOperation_Multiplication.R b/src/test/scripts/functions/binary/matrix_full_cellwise/FullMatrixVectorColCellwiseOperation_Multiplication.R index 33bc86d..383a819 100644 --- a/src/test/scripts/functions/binary/matrix_full_cellwise/FullMatrixVectorColCellwiseOperation_Multiplication.R +++ b/src/test/scripts/functions/binary/matrix_full_cellwise/FullMatrixVectorColCellwiseOperation_Multiplication.R @@ -19,20 +19,20 @@ # #------------------------------------------------------------- - -args <- commandArgs(TRUE) -options(digits=22) - -library("Matrix") - -A1 <- readMM(paste(args[1], "A.mtx", sep="")) -A <- as.matrix(A1); -B1 <- readMM(paste(args[1], "B.mtx", sep="")) -B <- as.vector(B1); - - -C <- A*B; - -writeMM(as(C, "CsparseMatrix"), paste(args[2], "C", sep="")); - - + +args <- commandArgs(TRUE) +options(digits=22) + +library("Matrix") + +A1 <- readMM(paste(args[1], "A.mtx", sep="")) +A <- as.matrix(A1); +B1 <- readMM(paste(args[1], "B.mtx", sep="")) +B <- as.vector(B1); + + +C <- A*B; + +writeMM(as(C, "CsparseMatrix"), paste(args[2], "C", sep="")); + + http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/binary/matrix_full_cellwise/FullMatrixVectorColCellwiseOperation_Substraction.R ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/binary/matrix_full_cellwise/FullMatrixVectorColCellwiseOperation_Substraction.R b/src/test/scripts/functions/binary/matrix_full_cellwise/FullMatrixVectorColCellwiseOperation_Substraction.R index 50b7120..149cf25 100644 --- a/src/test/scripts/functions/binary/matrix_full_cellwise/FullMatrixVectorColCellwiseOperation_Substraction.R +++ b/src/test/scripts/functions/binary/matrix_full_cellwise/FullMatrixVectorColCellwiseOperation_Substraction.R @@ -19,20 +19,20 @@ # #------------------------------------------------------------- - -args <- commandArgs(TRUE) -options(digits=22) - -library("Matrix") - -A1 <- readMM(paste(args[1], "A.mtx", sep="")) -A <- as.matrix(A1); -B1 <- readMM(paste(args[1], "B.mtx", sep="")) -B <- as.vector(B1); - - -C <- A-B; - -writeMM(as(C, "CsparseMatrix"), paste(args[2], "C", sep="")); - - + +args <- commandArgs(TRUE) +options(digits=22) + +library("Matrix") + +A1 <- readMM(paste(args[1], "A.mtx", sep="")) +A <- as.matrix(A1); +B1 <- readMM(paste(args[1], "B.mtx", sep="")) +B <- as.vector(B1); + + +C <- A-B; + +writeMM(as(C, "CsparseMatrix"), paste(args[2], "C", sep="")); + + http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/binary/matrix_full_cellwise/FullMatrixVectorRowCellwiseOperation_Addition.R ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/binary/matrix_full_cellwise/FullMatrixVectorRowCellwiseOperation_Addition.R b/src/test/scripts/functions/binary/matrix_full_cellwise/FullMatrixVectorRowCellwiseOperation_Addition.R index 96ac330..a582836 100644 --- a/src/test/scripts/functions/binary/matrix_full_cellwise/FullMatrixVectorRowCellwiseOperation_Addition.R +++ b/src/test/scripts/functions/binary/matrix_full_cellwise/FullMatrixVectorRowCellwiseOperation_Addition.R @@ -19,21 +19,21 @@ # #------------------------------------------------------------- - -args <- commandArgs(TRUE) -options(digits=22) - -library("Matrix") - -A1 <- readMM(paste(args[1], "A.mtx", sep="")) -A <- as.matrix(A1); -B1 <- readMM(paste(args[1], "B.mtx", sep="")) -B <- as.matrix(B1); - - -#C <- A+B; #not supported on row vectors -C <- t(t(A)+as.vector(t(B))) - -writeMM(as(C, "CsparseMatrix"), paste(args[2], "C", sep="")); - - + +args <- commandArgs(TRUE) +options(digits=22) + +library("Matrix") + +A1 <- readMM(paste(args[1], "A.mtx", sep="")) +A <- as.matrix(A1); +B1 <- readMM(paste(args[1], "B.mtx", sep="")) +B <- as.matrix(B1); + + +#C <- A+B; #not supported on row vectors +C <- t(t(A)+as.vector(t(B))) + +writeMM(as(C, "CsparseMatrix"), paste(args[2], "C", sep="")); + + http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/binary/matrix_full_cellwise/FullMatrixVectorRowCellwiseOperation_Division.R ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/binary/matrix_full_cellwise/FullMatrixVectorRowCellwiseOperation_Division.R b/src/test/scripts/functions/binary/matrix_full_cellwise/FullMatrixVectorRowCellwiseOperation_Division.R index 9baa59d..3155b12 100644 --- a/src/test/scripts/functions/binary/matrix_full_cellwise/FullMatrixVectorRowCellwiseOperation_Division.R +++ b/src/test/scripts/functions/binary/matrix_full_cellwise/FullMatrixVectorRowCellwiseOperation_Division.R @@ -19,21 +19,21 @@ # #------------------------------------------------------------- - -args <- commandArgs(TRUE) -options(digits=22) - -library("Matrix") - -A1 <- readMM(paste(args[1], "A.mtx", sep="")) -A <- as.matrix(A1); -B1 <- readMM(paste(args[1], "B.mtx", sep="")) -B <- as.matrix(B1); - - -#C <- A/B; #not supported on row vectors -C <- t(t(A)/as.vector(t(B))) - -writeMM(as(C, "CsparseMatrix"), paste(args[2], "C", sep="")); - - + +args <- commandArgs(TRUE) +options(digits=22) + +library("Matrix") + +A1 <- readMM(paste(args[1], "A.mtx", sep="")) +A <- as.matrix(A1); +B1 <- readMM(paste(args[1], "B.mtx", sep="")) +B <- as.matrix(B1); + + +#C <- A/B; #not supported on row vectors +C <- t(t(A)/as.vector(t(B))) + +writeMM(as(C, "CsparseMatrix"), paste(args[2], "C", sep="")); + + http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/binary/matrix_full_cellwise/FullMatrixVectorRowCellwiseOperation_Multiplication.R ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/binary/matrix_full_cellwise/FullMatrixVectorRowCellwiseOperation_Multiplication.R b/src/test/scripts/functions/binary/matrix_full_cellwise/FullMatrixVectorRowCellwiseOperation_Multiplication.R index df21560..1e18d8f 100644 --- a/src/test/scripts/functions/binary/matrix_full_cellwise/FullMatrixVectorRowCellwiseOperation_Multiplication.R +++ b/src/test/scripts/functions/binary/matrix_full_cellwise/FullMatrixVectorRowCellwiseOperation_Multiplication.R @@ -19,21 +19,21 @@ # #------------------------------------------------------------- - -args <- commandArgs(TRUE) -options(digits=22) - -library("Matrix") - -A1 <- readMM(paste(args[1], "A.mtx", sep="")) -A <- as.matrix(A1); -B1 <- readMM(paste(args[1], "B.mtx", sep="")) -B <- as.matrix(B1); - - -#C <- A*B; #not supported on row vectors -C <- t(t(A)*as.vector(t(B))) - -writeMM(as(C, "CsparseMatrix"), paste(args[2], "C", sep="")); - - + +args <- commandArgs(TRUE) +options(digits=22) + +library("Matrix") + +A1 <- readMM(paste(args[1], "A.mtx", sep="")) +A <- as.matrix(A1); +B1 <- readMM(paste(args[1], "B.mtx", sep="")) +B <- as.matrix(B1); + + +#C <- A*B; #not supported on row vectors +C <- t(t(A)*as.vector(t(B))) + +writeMM(as(C, "CsparseMatrix"), paste(args[2], "C", sep="")); + + http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/binary/matrix_full_cellwise/FullMatrixVectorRowCellwiseOperation_Substraction.R ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/binary/matrix_full_cellwise/FullMatrixVectorRowCellwiseOperation_Substraction.R b/src/test/scripts/functions/binary/matrix_full_cellwise/FullMatrixVectorRowCellwiseOperation_Substraction.R index c8588be..659001e 100644 --- a/src/test/scripts/functions/binary/matrix_full_cellwise/FullMatrixVectorRowCellwiseOperation_Substraction.R +++ b/src/test/scripts/functions/binary/matrix_full_cellwise/FullMatrixVectorRowCellwiseOperation_Substraction.R @@ -19,21 +19,21 @@ # #------------------------------------------------------------- - -args <- commandArgs(TRUE) -options(digits=22) - -library("Matrix") - -A1 <- readMM(paste(args[1], "A.mtx", sep="")) -A <- as.matrix(A1); -B1 <- readMM(paste(args[1], "B.mtx", sep="")) -B <- as.matrix(B1); - - -#C <- A-B; #not supported on row vectors -C <- t(t(A)-as.vector(t(B))) - -writeMM(as(C, "CsparseMatrix"), paste(args[2], "C", sep="")); - - + +args <- commandArgs(TRUE) +options(digits=22) + +library("Matrix") + +A1 <- readMM(paste(args[1], "A.mtx", sep="")) +A <- as.matrix(A1); +B1 <- readMM(paste(args[1], "B.mtx", sep="")) +B <- as.matrix(B1); + + +#C <- A-B; #not supported on row vectors +C <- t(t(A)-as.vector(t(B))) + +writeMM(as(C, "CsparseMatrix"), paste(args[2], "C", sep="")); + + http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/binary/matrix_full_cellwise/FullVectorVectorCellwiseOperation.R ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/binary/matrix_full_cellwise/FullVectorVectorCellwiseOperation.R b/src/test/scripts/functions/binary/matrix_full_cellwise/FullVectorVectorCellwiseOperation.R index 6a59bc8..167356b 100644 --- a/src/test/scripts/functions/binary/matrix_full_cellwise/FullVectorVectorCellwiseOperation.R +++ b/src/test/scripts/functions/binary/matrix_full_cellwise/FullVectorVectorCellwiseOperation.R @@ -19,27 +19,27 @@ # #------------------------------------------------------------- - -args <- commandArgs(TRUE) -options(digits=22) - -library("Matrix") - -A <- as.vector(readMM(paste(args[1], "A.mtx", sep=""))) -B <- as.vector(readMM(paste(args[1], "B.mtx", sep=""))) - -opcode = args[2]; + +args <- commandArgs(TRUE) +options(digits=22) + +library("Matrix") + +A <- as.vector(readMM(paste(args[1], "A.mtx", sep=""))) +B <- as.vector(readMM(paste(args[1], "B.mtx", sep=""))) + +opcode = args[2]; if( opcode == "lt" ) { opcode = "<" } if( opcode == "le" ) { opcode = "<=" } if( opcode == "gt" ) { opcode = ">" } if( opcode == "ge" ) { opcode = ">=" } if( opcode == "eq" ) { opcode = "==" } -if( opcode == "ne" ) { opcode = "!=" } -if( opcode == "mult" ) { opcode = "*" } - -C <- outer(A, B, opcode) -C <- as.matrix(C) - -writeMM(as(C, "CsparseMatrix"), paste(args[3], "C", sep="")); - - +if( opcode == "ne" ) { opcode = "!=" } +if( opcode == "mult" ) { opcode = "*" } + +C <- outer(A, B, opcode) +C <- as.matrix(C) + +writeMM(as(C, "CsparseMatrix"), paste(args[3], "C", sep="")); + + http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/binary/matrix_full_cellwise/Minus1MultTest.R ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/binary/matrix_full_cellwise/Minus1MultTest.R b/src/test/scripts/functions/binary/matrix_full_cellwise/Minus1MultTest.R index f34b164..30e543e 100644 --- a/src/test/scripts/functions/binary/matrix_full_cellwise/Minus1MultTest.R +++ b/src/test/scripts/functions/binary/matrix_full_cellwise/Minus1MultTest.R @@ -1,39 +1,39 @@ -#------------------------------------------------------------- -# -# 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. -# -#------------------------------------------------------------- - - -args <- commandArgs(TRUE) -options(digits=22) - -library("Matrix") - -A = as.matrix(readMM(paste(args[1], "A.mtx", sep=""))) -B = as.matrix(readMM(paste(args[1], "B.mtx", sep=""))) - -if( nrow(A) == 1 ){ - C = 1 - as.double(A) * B; -} else if( nrow(B) == 1 ){ - C = 1 - A * as.double(B); -} else { - C = 1 - A * B; -} - -writeMM(as(C, "CsparseMatrix"), paste(args[2], "C", sep="")); +#------------------------------------------------------------- +# +# 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. +# +#------------------------------------------------------------- + + +args <- commandArgs(TRUE) +options(digits=22) + +library("Matrix") + +A = as.matrix(readMM(paste(args[1], "A.mtx", sep=""))) +B = as.matrix(readMM(paste(args[1], "B.mtx", sep=""))) + +if( nrow(A) == 1 ){ + C = 1 - as.double(A) * B; +} else if( nrow(B) == 1 ){ + C = 1 - A * as.double(B); +} else { + C = 1 - A * B; +} + +writeMM(as(C, "CsparseMatrix"), paste(args[2], "C", sep="")); http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/binary/matrix_full_other/FullDistributedMatrixMultiplication.R ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/binary/matrix_full_other/FullDistributedMatrixMultiplication.R b/src/test/scripts/functions/binary/matrix_full_other/FullDistributedMatrixMultiplication.R index 184c144..94cd5d6 100644 --- a/src/test/scripts/functions/binary/matrix_full_other/FullDistributedMatrixMultiplication.R +++ b/src/test/scripts/functions/binary/matrix_full_other/FullDistributedMatrixMultiplication.R @@ -19,20 +19,20 @@ # #------------------------------------------------------------- - -args <- commandArgs(TRUE) -options(digits=22) - -library("Matrix") - -A1 <- readMM(paste(args[1], "A.mtx", sep="")) -A <- as.matrix(A1); -B1 <- readMM(paste(args[1], "B.mtx", sep="")) -B <- as.matrix(B1); - - -C <- A%*%B; - -writeMM(as(C, "CsparseMatrix"), paste(args[2], "C", sep="")); - - + +args <- commandArgs(TRUE) +options(digits=22) + +library("Matrix") + +A1 <- readMM(paste(args[1], "A.mtx", sep="")) +A <- as.matrix(A1); +B1 <- readMM(paste(args[1], "B.mtx", sep="")) +B <- as.matrix(B1); + + +C <- A%*%B; + +writeMM(as(C, "CsparseMatrix"), paste(args[2], "C", sep="")); + + http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/binary/matrix_full_other/FullMatrixMultiplication.R ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/binary/matrix_full_other/FullMatrixMultiplication.R b/src/test/scripts/functions/binary/matrix_full_other/FullMatrixMultiplication.R index 184c144..94cd5d6 100644 --- a/src/test/scripts/functions/binary/matrix_full_other/FullMatrixMultiplication.R +++ b/src/test/scripts/functions/binary/matrix_full_other/FullMatrixMultiplication.R @@ -19,20 +19,20 @@ # #------------------------------------------------------------- - -args <- commandArgs(TRUE) -options(digits=22) - -library("Matrix") - -A1 <- readMM(paste(args[1], "A.mtx", sep="")) -A <- as.matrix(A1); -B1 <- readMM(paste(args[1], "B.mtx", sep="")) -B <- as.matrix(B1); - - -C <- A%*%B; - -writeMM(as(C, "CsparseMatrix"), paste(args[2], "C", sep="")); - - + +args <- commandArgs(TRUE) +options(digits=22) + +library("Matrix") + +A1 <- readMM(paste(args[1], "A.mtx", sep="")) +A <- as.matrix(A1); +B1 <- readMM(paste(args[1], "B.mtx", sep="")) +B <- as.matrix(B1); + + +C <- A%*%B; + +writeMM(as(C, "CsparseMatrix"), paste(args[2], "C", sep="")); + + http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/binary/matrix_full_other/FullMinMaxComparison.R ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/binary/matrix_full_other/FullMinMaxComparison.R b/src/test/scripts/functions/binary/matrix_full_other/FullMinMaxComparison.R index 91d9068..a156e39 100644 --- a/src/test/scripts/functions/binary/matrix_full_other/FullMinMaxComparison.R +++ b/src/test/scripts/functions/binary/matrix_full_other/FullMinMaxComparison.R @@ -19,40 +19,40 @@ # #------------------------------------------------------------- - -args <- commandArgs(TRUE) -options(digits=22) - -library("Matrix") - -A <- as.matrix(readMM(paste(args[1], "A.mtx", sep=""))) -B <- as.matrix(readMM(paste(args[1], "B.mtx", sep=""))) - -if( as.integer(args[2])==1 ){ - # MIN - if( nrow(A)>1 | nrow(B)>1 ){ - if( nrow(B)>nrow(A) ) { - C <- pmin(B, A); - } - else { - C <- pmin(A, B); - } - }else{ - C <- min(A, B); - } -} else{ - # MAX - if( nrow(A)>1 | nrow(B)>1 ){ - if( nrow(B)>nrow(A) ){ - C <- pmax(B, A); - }else{ - C <- pmax(A, B); - } - }else{ - C <- max(A, B); - } -} - -writeMM(as(as.matrix(C), "CsparseMatrix"), paste(args[3], "C", sep="")); - - + +args <- commandArgs(TRUE) +options(digits=22) + +library("Matrix") + +A <- as.matrix(readMM(paste(args[1], "A.mtx", sep=""))) +B <- as.matrix(readMM(paste(args[1], "B.mtx", sep=""))) + +if( as.integer(args[2])==1 ){ + # MIN + if( nrow(A)>1 | nrow(B)>1 ){ + if( nrow(B)>nrow(A) ) { + C <- pmin(B, A); + } + else { + C <- pmin(A, B); + } + }else{ + C <- min(A, B); + } +} else{ + # MAX + if( nrow(A)>1 | nrow(B)>1 ){ + if( nrow(B)>nrow(A) ){ + C <- pmax(B, A); + }else{ + C <- pmax(A, B); + } + }else{ + C <- max(A, B); + } +} + +writeMM(as(as.matrix(C), "CsparseMatrix"), paste(args[3], "C", sep="")); + + http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/binary/matrix_full_other/FullPower.R ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/binary/matrix_full_other/FullPower.R b/src/test/scripts/functions/binary/matrix_full_other/FullPower.R index 1563697..0223632 100644 --- a/src/test/scripts/functions/binary/matrix_full_other/FullPower.R +++ b/src/test/scripts/functions/binary/matrix_full_other/FullPower.R @@ -19,23 +19,23 @@ # #------------------------------------------------------------- - -args <- commandArgs(TRUE) -options(digits=22) - -library("Matrix") - -A <- as.matrix(readMM(paste(args[1], "A.mtx", sep=""))) -B <- as.matrix(readMM(paste(args[1], "B.mtx", sep=""))) -if( nrow(A)==1 ){ #support for scalars - A <- as.numeric(A); -} -if( nrow(B)==1 ){ #support for scalars - B <- as.numeric(B); -} -C <- A^B; - -#note: writeMM replaces NaN and Inf -writeMM(as(C, "CsparseMatrix"), paste(args[2], "C", sep="")); - - + +args <- commandArgs(TRUE) +options(digits=22) + +library("Matrix") + +A <- as.matrix(readMM(paste(args[1], "A.mtx", sep=""))) +B <- as.matrix(readMM(paste(args[1], "B.mtx", sep=""))) +if( nrow(A)==1 ){ #support for scalars + A <- as.numeric(A); +} +if( nrow(B)==1 ){ #support for scalars + B <- as.numeric(B); +} +C <- A^B; + +#note: writeMM replaces NaN and Inf +writeMM(as(C, "CsparseMatrix"), paste(args[2], "C", sep="")); + + http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/binary/matrix_full_other/IntegerDivision_div.R ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/binary/matrix_full_other/IntegerDivision_div.R b/src/test/scripts/functions/binary/matrix_full_other/IntegerDivision_div.R index 9f528d5..1221f70 100644 --- a/src/test/scripts/functions/binary/matrix_full_other/IntegerDivision_div.R +++ b/src/test/scripts/functions/binary/matrix_full_other/IntegerDivision_div.R @@ -19,23 +19,23 @@ # #------------------------------------------------------------- - -args <- commandArgs(TRUE) -#options(digits=22) - -library("Matrix") - -A <- as.matrix(readMM(paste(args[1], "A.mtx", sep=""))) -B <- as.matrix(readMM(paste(args[1], "B.mtx", sep=""))) -if( nrow(A)==1 ){ #support for scalars - A <- as.numeric(A); -} -if( nrow(B)==1 ){ #support for scalars - B <- as.numeric(B); -} -C <- A%/%B; - -#note: writeMM replaces NaN and Inf -writeMM(as(C, "CsparseMatrix"), paste(args[2], "C", sep="")); - - + +args <- commandArgs(TRUE) +#options(digits=22) + +library("Matrix") + +A <- as.matrix(readMM(paste(args[1], "A.mtx", sep=""))) +B <- as.matrix(readMM(paste(args[1], "B.mtx", sep=""))) +if( nrow(A)==1 ){ #support for scalars + A <- as.numeric(A); +} +if( nrow(B)==1 ){ #support for scalars + B <- as.numeric(B); +} +C <- A%/%B; + +#note: writeMM replaces NaN and Inf +writeMM(as(C, "CsparseMatrix"), paste(args[2], "C", sep="")); + + http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/binary/matrix_full_other/IntegerDivision_mod.R ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/binary/matrix_full_other/IntegerDivision_mod.R b/src/test/scripts/functions/binary/matrix_full_other/IntegerDivision_mod.R index f70d1b1..4588ef8 100644 --- a/src/test/scripts/functions/binary/matrix_full_other/IntegerDivision_mod.R +++ b/src/test/scripts/functions/binary/matrix_full_other/IntegerDivision_mod.R @@ -19,23 +19,23 @@ # #------------------------------------------------------------- - -args <- commandArgs(TRUE) -options(digits=22) - -library("Matrix") - -A <- as.matrix(readMM(paste(args[1], "A.mtx", sep=""))) -B <- as.matrix(readMM(paste(args[1], "B.mtx", sep=""))) -if( nrow(A)==1 ){ #support for scalars - A <- as.numeric(A); -} -if( nrow(B)==1 ){ #support for scalars - B <- as.numeric(B); -} -C <- A%%B; - -#note: writeMM replaces NaN and Inf -writeMM(as(C, "CsparseMatrix"), paste(args[2], "C", sep="")); - - + +args <- commandArgs(TRUE) +options(digits=22) + +library("Matrix") + +A <- as.matrix(readMM(paste(args[1], "A.mtx", sep=""))) +B <- as.matrix(readMM(paste(args[1], "B.mtx", sep=""))) +if( nrow(A)==1 ){ #support for scalars + A <- as.numeric(A); +} +if( nrow(B)==1 ){ #support for scalars + B <- as.numeric(B); +} +C <- A%%B; + +#note: writeMM replaces NaN and Inf +writeMM(as(C, "CsparseMatrix"), paste(args[2], "C", sep="")); + + http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/binary/matrix_full_other/PPredMatrixTest.R ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/binary/matrix_full_other/PPredMatrixTest.R b/src/test/scripts/functions/binary/matrix_full_other/PPredMatrixTest.R index 5990c0f..6f57134 100644 --- a/src/test/scripts/functions/binary/matrix_full_other/PPredMatrixTest.R +++ b/src/test/scripts/functions/binary/matrix_full_other/PPredMatrixTest.R @@ -19,41 +19,41 @@ # #------------------------------------------------------------- - -args <- commandArgs(TRUE) -options(digits=22) - -library("Matrix") - -A <- readMM(paste(args[1], "A.mtx", sep="")) -B <- readMM(paste(args[1], "B.mtx", sep="")) - -type = as.integer(args[2]) - -if( type == 0 ) -{ - C = (A > B) -} -if( type == 1 ) -{ - C = (A < B) -} -if( type == 2 ) -{ - C = (A == B) -} -if( type == 3 ) -{ - C = (A != B) -} -if( type == 4 ) -{ - C = (A >= B) -} -if( type == 5 ) -{ - C = (A <= B) -} - - + +args <- commandArgs(TRUE) +options(digits=22) + +library("Matrix") + +A <- readMM(paste(args[1], "A.mtx", sep="")) +B <- readMM(paste(args[1], "B.mtx", sep="")) + +type = as.integer(args[2]) + +if( type == 0 ) +{ + C = (A > B) +} +if( type == 1 ) +{ + C = (A < B) +} +if( type == 2 ) +{ + C = (A == B) +} +if( type == 3 ) +{ + C = (A != B) +} +if( type == 4 ) +{ + C = (A >= B) +} +if( type == 5 ) +{ + C = (A <= B) +} + + writeMM(as(C, "CsparseMatrix"), paste(args[3], "C", sep="")); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/binary/matrix_full_other/PPredScalarLeftTest.R ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/binary/matrix_full_other/PPredScalarLeftTest.R b/src/test/scripts/functions/binary/matrix_full_other/PPredScalarLeftTest.R index 5578776..c54b185 100644 --- a/src/test/scripts/functions/binary/matrix_full_other/PPredScalarLeftTest.R +++ b/src/test/scripts/functions/binary/matrix_full_other/PPredScalarLeftTest.R @@ -19,42 +19,42 @@ # #------------------------------------------------------------- - -args <- commandArgs(TRUE) -options(digits=22) - -library("Matrix") - -A1 <- readMM(paste(args[1], "A.mtx", sep="")) -A <- as.matrix(A1); - -type = as.integer(args[2]) -constant = as.double(args[3]); - -if( type == 0 ) -{ - B = (constant > A) -} -if( type == 1 ) -{ - B = (constant < A) -} -if( type == 2 ) -{ - B = (constant == A) -} -if( type == 3 ) -{ - B = (constant != A) -} -if( type == 4 ) -{ - B = (constant >= A) -} -if( type == 5 ) -{ - B = (constant <= A) -} - - + +args <- commandArgs(TRUE) +options(digits=22) + +library("Matrix") + +A1 <- readMM(paste(args[1], "A.mtx", sep="")) +A <- as.matrix(A1); + +type = as.integer(args[2]) +constant = as.double(args[3]); + +if( type == 0 ) +{ + B = (constant > A) +} +if( type == 1 ) +{ + B = (constant < A) +} +if( type == 2 ) +{ + B = (constant == A) +} +if( type == 3 ) +{ + B = (constant != A) +} +if( type == 4 ) +{ + B = (constant >= A) +} +if( type == 5 ) +{ + B = (constant <= A) +} + + writeMM(as(B, "CsparseMatrix"), paste(args[4], "B", sep="")); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/binary/matrix_full_other/PPredScalarRightTest.R ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/binary/matrix_full_other/PPredScalarRightTest.R b/src/test/scripts/functions/binary/matrix_full_other/PPredScalarRightTest.R index e8944da..cd39071 100644 --- a/src/test/scripts/functions/binary/matrix_full_other/PPredScalarRightTest.R +++ b/src/test/scripts/functions/binary/matrix_full_other/PPredScalarRightTest.R @@ -19,42 +19,42 @@ # #------------------------------------------------------------- - -args <- commandArgs(TRUE) -options(digits=22) - -library("Matrix") - -A1 <- readMM(paste(args[1], "A.mtx", sep="")) -A <- as.matrix(A1); - -type = as.integer(args[2]) -constant = as.double(args[3]); - -if( type == 0 ) -{ - B = (A > constant) -} -if( type == 1 ) -{ - B = (A < constant) -} -if( type == 2 ) -{ - B = (A == constant) -} -if( type == 3 ) -{ - B = (A != constant) -} -if( type == 4 ) -{ - B = (A >= constant) -} -if( type == 5 ) -{ - B = (A <= constant) -} - - + +args <- commandArgs(TRUE) +options(digits=22) + +library("Matrix") + +A1 <- readMM(paste(args[1], "A.mtx", sep="")) +A <- as.matrix(A1); + +type = as.integer(args[2]) +constant = as.double(args[3]); + +if( type == 0 ) +{ + B = (A > constant) +} +if( type == 1 ) +{ + B = (A < constant) +} +if( type == 2 ) +{ + B = (A == constant) +} +if( type == 3 ) +{ + B = (A != constant) +} +if( type == 4 ) +{ + B = (A >= constant) +} +if( type == 5 ) +{ + B = (A <= constant) +} + + writeMM(as(B, "CsparseMatrix"), paste(args[4], "B", sep="")); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/binary/matrix_full_other/TransposeSelfMatrixMultiplication1.R ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/binary/matrix_full_other/TransposeSelfMatrixMultiplication1.R b/src/test/scripts/functions/binary/matrix_full_other/TransposeSelfMatrixMultiplication1.R index 8e88c02..b6171d7 100644 --- a/src/test/scripts/functions/binary/matrix_full_other/TransposeSelfMatrixMultiplication1.R +++ b/src/test/scripts/functions/binary/matrix_full_other/TransposeSelfMatrixMultiplication1.R @@ -19,15 +19,15 @@ # #------------------------------------------------------------- - -args <- commandArgs(TRUE) -options(digits=22) - -library("Matrix") - -A1 <- readMM(paste(args[1], "A.mtx", sep="")) -A <- as.matrix(A1); - -B <- t(A)%*%A; - + +args <- commandArgs(TRUE) +options(digits=22) + +library("Matrix") + +A1 <- readMM(paste(args[1], "A.mtx", sep="")) +A <- as.matrix(A1); + +B <- t(A)%*%A; + writeMM(as(B, "CsparseMatrix"), paste(args[2], "B", sep="")); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/binary/matrix_full_other/TransposeSelfMatrixMultiplication2.R ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/binary/matrix_full_other/TransposeSelfMatrixMultiplication2.R b/src/test/scripts/functions/binary/matrix_full_other/TransposeSelfMatrixMultiplication2.R index 241a3d2..8b68e28 100644 --- a/src/test/scripts/functions/binary/matrix_full_other/TransposeSelfMatrixMultiplication2.R +++ b/src/test/scripts/functions/binary/matrix_full_other/TransposeSelfMatrixMultiplication2.R @@ -19,15 +19,15 @@ # #------------------------------------------------------------- - -args <- commandArgs(TRUE) -options(digits=22) - -library("Matrix") - -A1 <- readMM(paste(args[1], "A.mtx", sep="")) -A <- as.matrix(A1); - -B <- A%*%t(A); - + +args <- commandArgs(TRUE) +options(digits=22) + +library("Matrix") + +A1 <- readMM(paste(args[1], "A.mtx", sep="")) +A <- as.matrix(A1); + +B <- A%*%t(A); + writeMM(as(B, "CsparseMatrix"), paste(args[2], "B", sep="")); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/binary/scalar/ModulusSingleTest.dml ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/binary/scalar/ModulusSingleTest.dml b/src/test/scripts/functions/binary/scalar/ModulusSingleTest.dml index 86ffde2..9c62581 100644 --- a/src/test/scripts/functions/binary/scalar/ModulusSingleTest.dml +++ b/src/test/scripts/functions/binary/scalar/ModulusSingleTest.dml @@ -19,12 +19,12 @@ # #------------------------------------------------------------- - -# junit test class: org.apache.sysml.test.integration.functions.binary.scalar.ModulusTest.java - -$$readhelper$$ - -$$vardeclaration$$ -Computation = $$op1$$ %% $$op2$$; -ComputationHelper = Computation * Helper; + +# junit test class: org.apache.sysml.test.integration.functions.binary.scalar.ModulusTest.java + +$$readhelper$$ + +$$vardeclaration$$ +Computation = $$op1$$ %% $$op2$$; +ComputationHelper = Computation * Helper; write(ComputationHelper, "$$outdir$$computed", format="text"); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/binary/scalar/ModulusTest.dml ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/binary/scalar/ModulusTest.dml b/src/test/scripts/functions/binary/scalar/ModulusTest.dml index eb1167c..e798f4f 100644 --- a/src/test/scripts/functions/binary/scalar/ModulusTest.dml +++ b/src/test/scripts/functions/binary/scalar/ModulusTest.dml @@ -19,27 +19,27 @@ # #------------------------------------------------------------- - -# junit test class: org.apache.sysml.test.integration.functions.binary.scalar.ModulusTest - -$$readhelper$$ - -$$intintvardeclaration$$ -IntIntComputation = $$intintop1$$ %% $$intintop2$$; -IntIntComputationHelper = IntIntComputation * Helper; -write(IntIntComputationHelper, "$$outdir$$int_int", format="text"); - -$$intdoublevardeclaration$$ -IntDoubleComputation = $$intdoubleop1$$ %% $$intdoubleop2$$; -IntDoubleComputationHelper = IntDoubleComputation * Helper; -write(IntDoubleComputationHelper, "$$outdir$$int_double", format="text"); - -$$doubledoublevardeclaration$$ -DoubleDoubleComputation = $$doubledoubleop1$$ %% $$doubledoubleop2$$; -DoubleDoubleComputationHelper = DoubleDoubleComputation * Helper; -write(DoubleDoubleComputationHelper, "$$outdir$$double_double", format="text"); - -$$doubleintvardeclaration$$ -DoubleIntComputation = $$doubleintop1$$ %% $$doubleintop2$$; -DoubleIntComputationHelper = DoubleIntComputation * Helper; + +# junit test class: org.apache.sysml.test.integration.functions.binary.scalar.ModulusTest + +$$readhelper$$ + +$$intintvardeclaration$$ +IntIntComputation = $$intintop1$$ %% $$intintop2$$; +IntIntComputationHelper = IntIntComputation * Helper; +write(IntIntComputationHelper, "$$outdir$$int_int", format="text"); + +$$intdoublevardeclaration$$ +IntDoubleComputation = $$intdoubleop1$$ %% $$intdoubleop2$$; +IntDoubleComputationHelper = IntDoubleComputation * Helper; +write(IntDoubleComputationHelper, "$$outdir$$int_double", format="text"); + +$$doubledoublevardeclaration$$ +DoubleDoubleComputation = $$doubledoubleop1$$ %% $$doubledoubleop2$$; +DoubleDoubleComputationHelper = DoubleDoubleComputation * Helper; +write(DoubleDoubleComputationHelper, "$$outdir$$double_double", format="text"); + +$$doubleintvardeclaration$$ +DoubleIntComputation = $$doubleintop1$$ %% $$doubleintop2$$; +DoubleIntComputationHelper = DoubleIntComputation * Helper; write(DoubleIntComputationHelper, "$$outdir$$double_int", format="text"); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/caching/export.dml ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/caching/export.dml b/src/test/scripts/functions/caching/export.dml index 76cd082..790cc9e 100644 --- a/src/test/scripts/functions/caching/export.dml +++ b/src/test/scripts/functions/caching/export.dml @@ -19,6 +19,6 @@ # #------------------------------------------------------------- - -V = read($1,rows=$2,cols=$3, format="text"); + +V = read($1,rows=$2,cols=$3, format="text"); write(V, $4, format=$5); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/data/RandRuntimePlatformTest.dml ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/data/RandRuntimePlatformTest.dml b/src/test/scripts/functions/data/RandRuntimePlatformTest.dml index 7bc714a..ad91e7a 100644 --- a/src/test/scripts/functions/data/RandRuntimePlatformTest.dml +++ b/src/test/scripts/functions/data/RandRuntimePlatformTest.dml @@ -1,26 +1,26 @@ -#------------------------------------------------------------- -# -# 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. -# -#------------------------------------------------------------- - -# This script simply generates a matrix with random numbers according to a given set of arguments. -# This script must be invoked with via runtime platforms (for example, -exec hadoop -exec singlenode etc.) - -A = Rand(rows=$1, cols=$2, sparsity=$3, seed=$4, pdf=$5); -write(A, $6); +#------------------------------------------------------------- +# +# 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. +# +#------------------------------------------------------------- + +# This script simply generates a matrix with random numbers according to a given set of arguments. +# This script must be invoked with via runtime platforms (for example, -exec hadoop -exec singlenode etc.) + +A = Rand(rows=$1, cols=$2, sparsity=$3, seed=$4, pdf=$5); +write(A, $6); http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/data/RandRuntimePlatformTestPoisson.dml ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/data/RandRuntimePlatformTestPoisson.dml b/src/test/scripts/functions/data/RandRuntimePlatformTestPoisson.dml index d6147f3..f3e7ffd 100644 --- a/src/test/scripts/functions/data/RandRuntimePlatformTestPoisson.dml +++ b/src/test/scripts/functions/data/RandRuntimePlatformTestPoisson.dml @@ -1,27 +1,27 @@ -#------------------------------------------------------------- -# -# 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. -# -#------------------------------------------------------------- - - -# This script simply generates a matrix with random numbers according to a given set of arguments. -# This script must be invoked with via runtime platforms (for example, -exec hadoop -exec singlenode etc.) - -A = Rand(rows=$1, cols=$2, sparsity=$3, seed=$4, pdf=$5, lambda=$6); -write(A, $7); +#------------------------------------------------------------- +# +# 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. +# +#------------------------------------------------------------- + + +# This script simply generates a matrix with random numbers according to a given set of arguments. +# This script must be invoked with via runtime platforms (for example, -exec hadoop -exec singlenode etc.) + +A = Rand(rows=$1, cols=$2, sparsity=$3, seed=$4, pdf=$5, lambda=$6); +write(A, $7); http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/data/RandVarMinMax.R ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/data/RandVarMinMax.R b/src/test/scripts/functions/data/RandVarMinMax.R index 811a210..ce07801 100644 --- a/src/test/scripts/functions/data/RandVarMinMax.R +++ b/src/test/scripts/functions/data/RandVarMinMax.R @@ -19,20 +19,20 @@ # #------------------------------------------------------------- - -args <- commandArgs(TRUE) -options(digits=22) -library("Matrix") - - -M = as.integer(args[1]); -N = as.integer(args[2]); - -R = matrix(0, M, N); - -for (x in 1 : M) { - R[x,] = matrix (x, 1, N); -} - -writeMM(as(R,"CsparseMatrix"), paste(args[3], "R", sep="")) - + +args <- commandArgs(TRUE) +options(digits=22) +library("Matrix") + + +M = as.integer(args[1]); +N = as.integer(args[2]); + +R = matrix(0, M, N); + +for (x in 1 : M) { + R[x,] = matrix (x, 1, N); +} + +writeMM(as(R,"CsparseMatrix"), paste(args[3], "R", sep="")) + http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/data/Sample2.dml ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/data/Sample2.dml b/src/test/scripts/functions/data/Sample2.dml index 044ca8e..cb672e5 100644 --- a/src/test/scripts/functions/data/Sample2.dml +++ b/src/test/scripts/functions/data/Sample2.dml @@ -19,6 +19,6 @@ # #------------------------------------------------------------- - -A = sample($1, $2); -write(A, $3); + +A = sample($1, $2); +write(A, $3); http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/data/Sample3.dml ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/data/Sample3.dml b/src/test/scripts/functions/data/Sample3.dml index 58065c0..124a6a5 100644 --- a/src/test/scripts/functions/data/Sample3.dml +++ b/src/test/scripts/functions/data/Sample3.dml @@ -19,6 +19,6 @@ # #------------------------------------------------------------- - -A = sample($1, $2, $3); -write(A, $4); + +A = sample($1, $2, $3); +write(A, $4); http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/data/Sample4.dml ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/data/Sample4.dml b/src/test/scripts/functions/data/Sample4.dml index 05ca57a..d3de0be 100644 --- a/src/test/scripts/functions/data/Sample4.dml +++ b/src/test/scripts/functions/data/Sample4.dml @@ -19,6 +19,6 @@ # #------------------------------------------------------------- - -A = sample($1, $2, $3, $4); -write(A, $5); + +A = sample($1, $2, $3, $4); +write(A, $5); http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/data/Sequence.R ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/data/Sequence.R b/src/test/scripts/functions/data/Sequence.R index 6b25c5a..0113777 100644 --- a/src/test/scripts/functions/data/Sequence.R +++ b/src/test/scripts/functions/data/Sequence.R @@ -19,11 +19,11 @@ # #------------------------------------------------------------- - -args <- commandArgs(TRUE) -options(digits=22) -library("Matrix") - -A = seq(as.numeric(args[1]), as.numeric(args[2]), as.numeric(args[3])); -writeMM(as(A,"CsparseMatrix"), paste(args[4], "A", sep=""), format="text") - + +args <- commandArgs(TRUE) +options(digits=22) +library("Matrix") + +A = seq(as.numeric(args[1]), as.numeric(args[2]), as.numeric(args[3])); +writeMM(as(A,"CsparseMatrix"), paste(args[4], "A", sep=""), format="text") + http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/data/Sequence.dml ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/data/Sequence.dml b/src/test/scripts/functions/data/Sequence.dml index 52b10e6..94c21b9 100644 --- a/src/test/scripts/functions/data/Sequence.dml +++ b/src/test/scripts/functions/data/Sequence.dml @@ -19,7 +19,7 @@ # #------------------------------------------------------------- - - -A = seq($1, $2, $3); -write(A, $4); + + +A = seq($1, $2, $3); +write(A, $4); http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/data/Sequence2inputs.R ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/data/Sequence2inputs.R b/src/test/scripts/functions/data/Sequence2inputs.R index 40abb37..7fecf5e 100644 --- a/src/test/scripts/functions/data/Sequence2inputs.R +++ b/src/test/scripts/functions/data/Sequence2inputs.R @@ -19,11 +19,11 @@ # #------------------------------------------------------------- - -args <- commandArgs(TRUE) -options(digits=22) -library("Matrix") - -A = seq(as.numeric(args[1]), as.numeric(args[2])); -writeMM(as(A,"CsparseMatrix"), paste(args[3], "A", sep=""), format="text") - + +args <- commandArgs(TRUE) +options(digits=22) +library("Matrix") + +A = seq(as.numeric(args[1]), as.numeric(args[2])); +writeMM(as(A,"CsparseMatrix"), paste(args[3], "A", sep=""), format="text") + http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/data/Sequence2inputs.dml ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/data/Sequence2inputs.dml b/src/test/scripts/functions/data/Sequence2inputs.dml index c46b424..7d0c89f 100644 --- a/src/test/scripts/functions/data/Sequence2inputs.dml +++ b/src/test/scripts/functions/data/Sequence2inputs.dml @@ -19,7 +19,7 @@ # #------------------------------------------------------------- - - -A = seq($1, $2); -write(A, $3); + + +A = seq($1, $2); +write(A, $3); http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/data/StrInit.dml ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/data/StrInit.dml b/src/test/scripts/functions/data/StrInit.dml index 04b6603..0c36b66 100644 --- a/src/test/scripts/functions/data/StrInit.dml +++ b/src/test/scripts/functions/data/StrInit.dml @@ -1,23 +1,23 @@ -#------------------------------------------------------------- -# -# 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. -# -#------------------------------------------------------------- - -A = matrix($1, rows=$2, cols=$3); -write(A, $4); +#------------------------------------------------------------- +# +# 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. +# +#------------------------------------------------------------- + +A = matrix($1, rows=$2, cols=$3); +write(A, $4); http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/data/WriteMMComplexTest.dml ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/data/WriteMMComplexTest.dml b/src/test/scripts/functions/data/WriteMMComplexTest.dml index 5e0674e..63ed24e 100644 --- a/src/test/scripts/functions/data/WriteMMComplexTest.dml +++ b/src/test/scripts/functions/data/WriteMMComplexTest.dml @@ -19,13 +19,13 @@ # #------------------------------------------------------------- - -# junit test class: org.apache.sysml.test.integration.functions.data.WriteMMTest.java - -A = read ($1, rows=$2, cols=$3, format="text"); - -i = 0; -while( i < 2) { - write (A, $4, format="mm"); - i = i +1; -} + +# junit test class: org.apache.sysml.test.integration.functions.data.WriteMMTest.java + +A = read ($1, rows=$2, cols=$3, format="text"); + +i = 0; +while( i < 2) { + write (A, $4, format="mm"); + i = i +1; +} http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/data/WriteMMTest.dml ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/data/WriteMMTest.dml b/src/test/scripts/functions/data/WriteMMTest.dml index edc0747..2fd7bcf 100644 --- a/src/test/scripts/functions/data/WriteMMTest.dml +++ b/src/test/scripts/functions/data/WriteMMTest.dml @@ -19,9 +19,9 @@ # #------------------------------------------------------------- - -# junit test class: org.apache.sysml.test.integration.functions.data.WriteMMTest.java - -A = read($1, rows=$2, cols=$3, format="text"); - -write(A, $4, format="mm"); + +# junit test class: org.apache.sysml.test.integration.functions.data.WriteMMTest.java + +A = read($1, rows=$2, cols=$3, format="text"); + +write(A, $4, format="mm"); http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/external/DynProject.R ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/external/DynProject.R b/src/test/scripts/functions/external/DynProject.R index 67f6009..0f476f0 100644 --- a/src/test/scripts/functions/external/DynProject.R +++ b/src/test/scripts/functions/external/DynProject.R @@ -19,20 +19,20 @@ # #------------------------------------------------------------- - -args <- commandArgs(TRUE) -options(digits=22) - -library("Matrix") - -X <- as.matrix(readMM(paste(args[1], "X.mtx", sep=""))); -c <- as.matrix(readMM(paste(args[1], "c.mtx", sep=""))); - -if( ncol(X)==1 ) -{ - Y <- X[c]; -} else { - Y <- X[c,c]; -} - + +args <- commandArgs(TRUE) +options(digits=22) + +library("Matrix") + +X <- as.matrix(readMM(paste(args[1], "X.mtx", sep=""))); +c <- as.matrix(readMM(paste(args[1], "c.mtx", sep=""))); + +if( ncol(X)==1 ) +{ + Y <- X[c]; +} else { + Y <- X[c,c]; +} + writeMM(as(Y, "CsparseMatrix"), paste(args[2], "Y.mtx", sep="")); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/external/DynProject.dml ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/external/DynProject.dml b/src/test/scripts/functions/external/DynProject.dml index 6339575..2444a17 100644 --- a/src/test/scripts/functions/external/DynProject.dml +++ b/src/test/scripts/functions/external/DynProject.dml @@ -19,14 +19,14 @@ # #------------------------------------------------------------- - -dynProject = externalFunction(Matrix[Double] B, Matrix[Double] c) - return (Matrix[Double] PD) - implemented in (classname="org.apache.sysml.udf.lib.DynamicProjectMatrixCP",exectype="mem") - -X = read($1, rows=$3, cols=$4, format="text"); -c = read($2, rows=1, cols=$5, format="text"); - -Y = dynProject(X, c); - + +dynProject = externalFunction(Matrix[Double] B, Matrix[Double] c) + return (Matrix[Double] PD) + implemented in (classname="org.apache.sysml.udf.lib.DynamicProjectMatrixCP",exectype="mem") + +X = read($1, rows=$3, cols=$4, format="text"); +c = read($2, rows=1, cols=$5, format="text"); + +Y = dynProject(X, c); + write(Y, $6); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/external/DynReadWrite.dml ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/external/DynReadWrite.dml b/src/test/scripts/functions/external/DynReadWrite.dml index aee88dc..eb98991 100644 --- a/src/test/scripts/functions/external/DynReadWrite.dml +++ b/src/test/scripts/functions/external/DynReadWrite.dml @@ -19,22 +19,22 @@ # #------------------------------------------------------------- - -dynRead = externalFunction(String fname, Integer rows, Integer cols, String format) -return (Matrix[Double] M) -implemented in (classname="org.apache.sysml.udf.lib.DynamicReadMatrixCP",exectype="mem") - -dynWrite = externalFunction(Matrix[Double] input, String fname, String format) -return(Boolean success) -implemented in (classname="org.apache.sysml.udf.lib.DynamicWriteMatrixCP",exectype="mem") - - -X = read($1, rows=$2, cols=$3, format="text"); - -s = $1+"2"; -ret1 = dynWrite(X, s, $4); -Y = dynRead(s, $2, $3, $4); -ret2 = dynWrite(Y, $5, $4); - -print("successfully written: "+ret2); + +dynRead = externalFunction(String fname, Integer rows, Integer cols, String format) +return (Matrix[Double] M) +implemented in (classname="org.apache.sysml.udf.lib.DynamicReadMatrixCP",exectype="mem") + +dynWrite = externalFunction(Matrix[Double] input, String fname, String format) +return(Boolean success) +implemented in (classname="org.apache.sysml.udf.lib.DynamicWriteMatrixCP",exectype="mem") + + +X = read($1, rows=$2, cols=$3, format="text"); + +s = $1+"2"; +ret1 = dynWrite(X, s, $4); +Y = dynRead(s, $2, $3, $4); +ret2 = dynWrite(Y, $5, $4); + +print("successfully written: "+ret2); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/external/FunctionExpressions1.dml ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/external/FunctionExpressions1.dml b/src/test/scripts/functions/external/FunctionExpressions1.dml index 816b043..94c5633 100644 --- a/src/test/scripts/functions/external/FunctionExpressions1.dml +++ b/src/test/scripts/functions/external/FunctionExpressions1.dml @@ -19,19 +19,19 @@ # #------------------------------------------------------------- - -orderExternal = externalFunction(Matrix[Double] A, Integer col, Boolean desc) return (Matrix[Double] B) - implemented in (classname="org.apache.sysml.udf.lib.OrderWrapper",exectype="mem") - -foo = function( Matrix[Double] A ) return (Matrix[Double] B) -{ - for( i in 1:ncol(A) ) { - B = orderExternal(A, i, TRUE); - } -} - -X = read( $1, rows=$2, cols=$3 ); -Y = foo( X*X+7 ); -Y = sqrt( Y-7 ); -write( Y, $4 ); #ordered input - + +orderExternal = externalFunction(Matrix[Double] A, Integer col, Boolean desc) return (Matrix[Double] B) + implemented in (classname="org.apache.sysml.udf.lib.OrderWrapper",exectype="mem") + +foo = function( Matrix[Double] A ) return (Matrix[Double] B) +{ + for( i in 1:ncol(A) ) { + B = orderExternal(A, i, TRUE); + } +} + +X = read( $1, rows=$2, cols=$3 ); +Y = foo( X*X+7 ); +Y = sqrt( Y-7 ); +write( Y, $4 ); #ordered input + http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/external/FunctionExpressions2.dml ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/external/FunctionExpressions2.dml b/src/test/scripts/functions/external/FunctionExpressions2.dml index 39c50cf..fb2fcba 100644 --- a/src/test/scripts/functions/external/FunctionExpressions2.dml +++ b/src/test/scripts/functions/external/FunctionExpressions2.dml @@ -19,19 +19,19 @@ # #------------------------------------------------------------- - -orderExternal = externalFunction(Matrix[Double] A, Integer col, Boolean desc) return (Matrix[Double] B) - implemented in (classname="org.apache.sysml.udf.lib.OrderWrapper",exectype="mem") - -foo = function( Matrix[Double] A ) return (Matrix[Double] B) -{ - for( i in 1:ncol(A) ) { - B = orderExternal(A*A+7, i, TRUE); - } -} - -X = read( $1, rows=$2, cols=$3 ); -Y = foo( X ); -Y = sqrt( Y-7 ); -write( Y, $4 ); #ordered input - + +orderExternal = externalFunction(Matrix[Double] A, Integer col, Boolean desc) return (Matrix[Double] B) + implemented in (classname="org.apache.sysml.udf.lib.OrderWrapper",exectype="mem") + +foo = function( Matrix[Double] A ) return (Matrix[Double] B) +{ + for( i in 1:ncol(A) ) { + B = orderExternal(A*A+7, i, TRUE); + } +} + +X = read( $1, rows=$2, cols=$3 ); +Y = foo( X ); +Y = sqrt( Y-7 ); +write( Y, $4 ); #ordered input + http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/external/Order.R ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/external/Order.R b/src/test/scripts/functions/external/Order.R index b061c25..769b6a8 100644 --- a/src/test/scripts/functions/external/Order.R +++ b/src/test/scripts/functions/external/Order.R @@ -19,15 +19,15 @@ # #------------------------------------------------------------- - -args <- commandArgs(TRUE) -options(digits=22) - -library("Matrix") - -A <- readMM(paste(args[1], "A.mtx", sep="")) -col <- as.numeric(args[2]); - -B <- A[order(sign(col)*A[,abs(col)]),] - + +args <- commandArgs(TRUE) +options(digits=22) + +library("Matrix") + +A <- readMM(paste(args[1], "A.mtx", sep="")) +col <- as.numeric(args[2]); + +B <- A[order(sign(col)*A[,abs(col)]),] + writeMM(as(B, "CsparseMatrix"), paste(args[3], "B.mtx", sep="")); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/external/Order1.dml ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/external/Order1.dml b/src/test/scripts/functions/external/Order1.dml index b49a910..c7e3346 100644 --- a/src/test/scripts/functions/external/Order1.dml +++ b/src/test/scripts/functions/external/Order1.dml @@ -19,12 +19,12 @@ # #------------------------------------------------------------- - -orderExternal = externalFunction(Matrix[Double] A, Integer col, Boolean desc) return (Matrix[Double] B) - implemented in (classname="org.apache.sysml.udf.lib.OrderWrapper",exectype="mem") - -A = read( $1, rows=$2, cols=$3); -B1 = orderExternal(A, $4, FALSE); - -write(B1, $5); - + +orderExternal = externalFunction(Matrix[Double] A, Integer col, Boolean desc) return (Matrix[Double] B) + implemented in (classname="org.apache.sysml.udf.lib.OrderWrapper",exectype="mem") + +A = read( $1, rows=$2, cols=$3); +B1 = orderExternal(A, $4, FALSE); + +write(B1, $5); + http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/external/Order2.dml ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/external/Order2.dml b/src/test/scripts/functions/external/Order2.dml index 8359560..69e90b5 100644 --- a/src/test/scripts/functions/external/Order2.dml +++ b/src/test/scripts/functions/external/Order2.dml @@ -19,12 +19,12 @@ # #------------------------------------------------------------- - -orderExternal = externalFunction(Matrix[Double] A, Integer col, Boolean desc) return (Matrix[Double] B) - implemented in (classname="org.apache.sysml.udf.lib.OrderWrapper",exectype="mem") - -A = read( $1, rows=$2, cols=$3); -B1 = orderExternal(A, $4, TRUE); - -write(B1, $5); - + +orderExternal = externalFunction(Matrix[Double] A, Integer col, Boolean desc) return (Matrix[Double] B) + implemented in (classname="org.apache.sysml.udf.lib.OrderWrapper",exectype="mem") + +A = read( $1, rows=$2, cols=$3); +B1 = orderExternal(A, $4, TRUE); + +write(B1, $5); + http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/external/Outlier.dml ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/external/Outlier.dml b/src/test/scripts/functions/external/Outlier.dml index 071125a..1e0668d 100644 --- a/src/test/scripts/functions/external/Outlier.dml +++ b/src/test/scripts/functions/external/Outlier.dml @@ -19,23 +19,23 @@ # #------------------------------------------------------------- - -# Note this script is externalized to customers, please do not change w/o consulting component owner. -# How to invoke this dml script Outlier.dml? -# Assume OUTLIER_HOME is set to the home of the dml script -# Assume input and output directories are on hdfs as INPUT_DIR and OUTPUT_DIR -# Assume rows = 100, cols = 10 for input matrix M -# hadoop jar SystemML.jar -f $OUTLIER_HOME/Outlier.dml -args "$INPUT_DIR/M" 100 10 "$OUPUT_DIR/o" - -outliers = externalFunction(Matrix[Double] D, Integer m, Integer k) -return (Matrix[Double] C) -implemented in (classname="org.apache.sysml.udf.lib.OutlierWrapper",execlocation="master") - -M = read( $1, rows=$2, cols=$3, format="text"); - -k = 2; -m = 5; - -o = outliers(M,m,k); - + +# Note this script is externalized to customers, please do not change w/o consulting component owner. +# How to invoke this dml script Outlier.dml? +# Assume OUTLIER_HOME is set to the home of the dml script +# Assume input and output directories are on hdfs as INPUT_DIR and OUTPUT_DIR +# Assume rows = 100, cols = 10 for input matrix M +# hadoop jar SystemML.jar -f $OUTLIER_HOME/Outlier.dml -args "$INPUT_DIR/M" 100 10 "$OUPUT_DIR/o" + +outliers = externalFunction(Matrix[Double] D, Integer m, Integer k) +return (Matrix[Double] C) +implemented in (classname="org.apache.sysml.udf.lib.OutlierWrapper",execlocation="master") + +M = read( $1, rows=$2, cols=$3, format="text"); + +k = 2; +m = 5; + +o = outliers(M,m,k); + write(o, $4, format="text"); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/external/kMeans.dml ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/external/kMeans.dml b/src/test/scripts/functions/external/kMeans.dml index d5343b3..28b7a77 100644 --- a/src/test/scripts/functions/external/kMeans.dml +++ b/src/test/scripts/functions/external/kMeans.dml @@ -19,23 +19,23 @@ # #------------------------------------------------------------- - -# Note this script is externalized to customers, please do not change w/o consulting component owner. -# How to invoke this dml script kMeans.dml? -# Assume KMEANS_HOME is set to the home of the dml script -# Assume input and output directories are on hdfs as INPUT_DIR and OUTPUT_DIR -# Assume rows = 100, cols = 10, clusters = 5 -# hadoop jar SystemML.jar -f $KMEANS_HOME/kMeans.dml -args "$INPUT_DIR/M" 100 10 "$OUPUT_DIR/kcenters" - -kMeans = externalFunction(Matrix[Double] D, Integer k) -return (Matrix[Double] C) -implemented in (classname="org.apache.sysml.udf.lib.kMeansWrapper",execlocation="master") - -M = read($1, rows=$2, cols=$3, format="text"); - -k = 5; - -kcenters = kMeans(M,k) - -write(kcenters, $4, format="text"); - + +# Note this script is externalized to customers, please do not change w/o consulting component owner. +# How to invoke this dml script kMeans.dml? +# Assume KMEANS_HOME is set to the home of the dml script +# Assume input and output directories are on hdfs as INPUT_DIR and OUTPUT_DIR +# Assume rows = 100, cols = 10, clusters = 5 +# hadoop jar SystemML.jar -f $KMEANS_HOME/kMeans.dml -args "$INPUT_DIR/M" 100 10 "$OUPUT_DIR/kcenters" + +kMeans = externalFunction(Matrix[Double] D, Integer k) +return (Matrix[Double] C) +implemented in (classname="org.apache.sysml.udf.lib.kMeansWrapper",execlocation="master") + +M = read($1, rows=$2, cols=$3, format="text"); + +k = 5; + +kcenters = kMeans(M,k) + +write(kcenters, $4, format="text"); + http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/external/kMeans2.dml ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/external/kMeans2.dml b/src/test/scripts/functions/external/kMeans2.dml index b1f4a76..ae1edd2 100644 --- a/src/test/scripts/functions/external/kMeans2.dml +++ b/src/test/scripts/functions/external/kMeans2.dml @@ -19,30 +19,30 @@ # #------------------------------------------------------------- - -# Note this script is externalized to customers, please do not change w/o consulting component owner. -# How to invoke this dml script kMeans.dml? -# Assume KMEANS2_HOME is set to the home of the dml script -# Assume input and output directories are on hdfs as INPUT_DIR and OUTPUT_DIR -# Assume rows = 100, cols = 10, clusters = 5 -# hadoop jar SystemML.jar -f $KMEANS2_HOME/kMeans2.dml -args "$INPUT_DIR/M" 100 10 "$INPUT_DIR/initCenters" "$OUPUT_DIR/kcenters" "$OUTPUT_DIR/kcentersWithInit" - -kMeans = externalFunction(Matrix[Double] D, Integer k) -return (Matrix[Double] C) -implemented in (classname="org.apache.sysml.udf.lib.kMeansWrapper",execlocation="master") - -kMeansWithInit = externalFunction(Matrix[Double] D, Integer k, Matrix[Double] initK) -return (Matrix[Double] C) -implemented in (classname="org.apache.sysml.udf.lib.kMeansWrapper",execlocation="master") - -M = read($1, rows=$2, cols=$3, format="text"); -initialCenters = read($4, rows=5, cols=$3, format="text"); - -k = 5; - -kcenters = kMeans(M,k) -kcentersWithInit = kMeansWithInit(M,k,initialCenters); - -write(kcenters, $5, format="text"); -write(kcentersWithInit, $6, format="text"); - + +# Note this script is externalized to customers, please do not change w/o consulting component owner. +# How to invoke this dml script kMeans.dml? +# Assume KMEANS2_HOME is set to the home of the dml script +# Assume input and output directories are on hdfs as INPUT_DIR and OUTPUT_DIR +# Assume rows = 100, cols = 10, clusters = 5 +# hadoop jar SystemML.jar -f $KMEANS2_HOME/kMeans2.dml -args "$INPUT_DIR/M" 100 10 "$INPUT_DIR/initCenters" "$OUPUT_DIR/kcenters" "$OUTPUT_DIR/kcentersWithInit" + +kMeans = externalFunction(Matrix[Double] D, Integer k) +return (Matrix[Double] C) +implemented in (classname="org.apache.sysml.udf.lib.kMeansWrapper",execlocation="master") + +kMeansWithInit = externalFunction(Matrix[Double] D, Integer k, Matrix[Double] initK) +return (Matrix[Double] C) +implemented in (classname="org.apache.sysml.udf.lib.kMeansWrapper",execlocation="master") + +M = read($1, rows=$2, cols=$3, format="text"); +initialCenters = read($4, rows=5, cols=$3, format="text"); + +k = 5; + +kcenters = kMeans(M,k) +kcentersWithInit = kMeansWithInit(M,k,initialCenters); + +write(kcenters, $5, format="text"); +write(kcentersWithInit, $6, format="text"); + http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/gdfo/LinregCG.R ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/gdfo/LinregCG.R b/src/test/scripts/functions/gdfo/LinregCG.R index 1d69385..5dcad95 100644 --- a/src/test/scripts/functions/gdfo/LinregCG.R +++ b/src/test/scripts/functions/gdfo/LinregCG.R @@ -19,39 +19,39 @@ # #------------------------------------------------------------- - -args <- commandArgs(TRUE) -options(digits=22) -library("Matrix") - -X = readMM(paste(args[1], "X.mtx", sep="")) -y = readMM(paste(args[1], "y.mtx", sep="")) - -intercept = as.integer(args[2]); -eps = as.double(args[3]); -maxiter = as.double(args[4]); - -if( intercept == 1 ){ - ones = matrix(1, nrow(X), 1); - X = cbind(X, ones); -} - -r = -(t(X) %*% y); -p = -r; -norm_r2 = sum(r * r); -w = matrix(0, ncol(X), 1); - -i = 0; -while(i < maxiter) { - q = ((t(X) %*% (X %*% p)) + eps * p); - alpha = norm_r2 / ((t(p) %*% q)[1:1]); - w = w + alpha * p; - old_norm_r2 = norm_r2; - r = r + alpha * q; - norm_r2 = sum(r * r); - beta = norm_r2 / old_norm_r2; - p = -r + beta * p; - i = i + 1; -} - -writeMM(as(w,"CsparseMatrix"), paste(args[5], "w", sep="")) + +args <- commandArgs(TRUE) +options(digits=22) +library("Matrix") + +X = readMM(paste(args[1], "X.mtx", sep="")) +y = readMM(paste(args[1], "y.mtx", sep="")) + +intercept = as.integer(args[2]); +eps = as.double(args[3]); +maxiter = as.double(args[4]); + +if( intercept == 1 ){ + ones = matrix(1, nrow(X), 1); + X = cbind(X, ones); +} + +r = -(t(X) %*% y); +p = -r; +norm_r2 = sum(r * r); +w = matrix(0, ncol(X), 1); + +i = 0; +while(i < maxiter) { + q = ((t(X) %*% (X %*% p)) + eps * p); + alpha = norm_r2 / ((t(p) %*% q)[1:1]); + w = w + alpha * p; + old_norm_r2 = norm_r2; + r = r + alpha * q; + norm_r2 = sum(r * r); + beta = norm_r2 / old_norm_r2; + p = -r + beta * p; + i = i + 1; +} + +writeMM(as(w,"CsparseMatrix"), paste(args[5], "w", sep="")) http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/gdfo/LinregCG.dml ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/gdfo/LinregCG.dml b/src/test/scripts/functions/gdfo/LinregCG.dml index 02d0fad..85a66e4 100644 --- a/src/test/scripts/functions/gdfo/LinregCG.dml +++ b/src/test/scripts/functions/gdfo/LinregCG.dml @@ -19,38 +19,38 @@ # #------------------------------------------------------------- - -X = read($1); -y = read($2); -intercept = $3; -eps = $4; -maxiter = $5; - -if( intercept == 1 ){ - ones = matrix(1, nrow(X), 1); - X = append(X, ones); -} - -r = -(t(X) %*% y); -p = -r; -norm_r2 = sum(r * r); -w = matrix(0, rows = ncol(X), cols = 1); - -i = 0; -while(i < maxiter) { - q = ((t(X) %*% (X %*% p)) + eps * p); - alpha = norm_r2 / castAsScalar(t(p) %*% q); - w = w + alpha * p; - old_norm_r2 = norm_r2; - r = r + alpha * q; - norm_r2 = sum(r * r); - beta = norm_r2 / old_norm_r2; - p = -r + beta * p; - i = i + 1; -} - -write(w, $6); - - - - + +X = read($1); +y = read($2); +intercept = $3; +eps = $4; +maxiter = $5; + +if( intercept == 1 ){ + ones = matrix(1, nrow(X), 1); + X = append(X, ones); +} + +r = -(t(X) %*% y); +p = -r; +norm_r2 = sum(r * r); +w = matrix(0, rows = ncol(X), cols = 1); + +i = 0; +while(i < maxiter) { + q = ((t(X) %*% (X %*% p)) + eps * p); + alpha = norm_r2 / castAsScalar(t(p) %*% q); + w = w + alpha * p; + old_norm_r2 = norm_r2; + r = r + alpha * q; + norm_r2 = sum(r * r); + beta = norm_r2 / old_norm_r2; + p = -r + beta * p; + i = i + 1; +} + +write(w, $6); + + + + http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/gdfo/LinregDS.R ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/gdfo/LinregDS.R b/src/test/scripts/functions/gdfo/LinregDS.R index 588d2be..752e862 100644 --- a/src/test/scripts/functions/gdfo/LinregDS.R +++ b/src/test/scripts/functions/gdfo/LinregDS.R @@ -19,25 +19,25 @@ # #------------------------------------------------------------- - -args <- commandArgs(TRUE) -options(digits=22) -library("Matrix") - -X = as.matrix(readMM(paste(args[1], "X.mtx", sep=""))) -y = as.matrix(readMM(paste(args[1], "y.mtx", sep=""))) -I = as.vector(matrix(1, ncol(X), 1)); -intercept = as.integer(args[2]) -lambda = as.double(args[3]); - -if( intercept == 1 ){ - ones = matrix(1, nrow(X), 1); - X = cbind(X, ones); - I = as.vector(matrix(1, ncol(X), 1)); -} - -A = t(X) %*% X + diag(I)*lambda; -b = t(X) %*% y; -beta = solve(A, b); - + +args <- commandArgs(TRUE) +options(digits=22) +library("Matrix") + +X = as.matrix(readMM(paste(args[1], "X.mtx", sep=""))) +y = as.matrix(readMM(paste(args[1], "y.mtx", sep=""))) +I = as.vector(matrix(1, ncol(X), 1)); +intercept = as.integer(args[2]) +lambda = as.double(args[3]); + +if( intercept == 1 ){ + ones = matrix(1, nrow(X), 1); + X = cbind(X, ones); + I = as.vector(matrix(1, ncol(X), 1)); +} + +A = t(X) %*% X + diag(I)*lambda; +b = t(X) %*% y; +beta = solve(A, b); + writeMM(as(beta,"CsparseMatrix"), paste(args[4], "B", sep="")) \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/05d2c0a8/src/test/scripts/functions/gdfo/LinregDS.dml ---------------------------------------------------------------------- diff --git a/src/test/scripts/functions/gdfo/LinregDS.dml b/src/test/scripts/functions/gdfo/LinregDS.dml index b8549ee..3601830 100644 --- a/src/test/scripts/functions/gdfo/LinregDS.dml +++ b/src/test/scripts/functions/gdfo/LinregDS.dml @@ -19,21 +19,21 @@ # #------------------------------------------------------------- - -X = read($1); -y = read($2); -I = matrix(1, ncol(X), 1); -intercept = $3; -lambda = $4; - -if( intercept == 1 ){ - ones = matrix(1, nrow(X), 1); - X = append(X, ones); - I = matrix(1, ncol(X), 1); -} - -A = t(X) %*% X + diag(I)*lambda; -b = t(X) %*% y; -beta = solve(A, b); - -write(beta, $5); + +X = read($1); +y = read($2); +I = matrix(1, ncol(X), 1); +intercept = $3; +lambda = $4; + +if( intercept == 1 ){ + ones = matrix(1, nrow(X), 1); + X = append(X, ones); + I = matrix(1, ncol(X), 1); +} + +A = t(X) %*% X + diag(I)*lambda; +b = t(X) %*% y; +beta = solve(A, b); + +write(beta, $5);
