Barbar1432 commented on code in PR #1903:
URL: https://github.com/apache/systemds/pull/1903#discussion_r1333389179


##########
scripts/builtin/img_mirror_linearized.dml:
##########
@@ -0,0 +1,82 @@
+#-------------------------------------------------------------
+#
+# 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 function has  the same functionality with img_mirror but it handles 
multiple images at
+# the same time. Each row of the input and output matrix represents a 
linearized image/matrix
+# It flips an image on the X (horizontal) or Y (vertical) axis.
+# INPUT:
+# 
-----------------------------------------------------------------------------------------
+# img_matrix           Input matrix/image (every row represents a linearized 
matrix/image)
+# horizontal_axis      flip either in X or Y axis
+# original_rows        number of rows in the original 2-D images 
+# original_cols        number of cols in the original 2-D images 
+# 
-----------------------------------------------------------------------------------------
+#
+# OUTPUT:
+# 
-----------------------------------------------------------------------------------------
+# R            Output matrix/image  (every row represents a linearized 
matrix/image)
+# 
-----------------------------------------------------------------------------------------
+
+m_img_mirror_linearized = function(matrix[double] img_matrix, Boolean 
horizontal_axis, 
+Integer original_rows, Integer original_cols) return (matrix[double] R) {
+  n = ncol(img_matrix);
+  R = matrix(0, rows=nrow(img_matrix), cols=n);
+  rows = original_rows;
+  cols = original_cols;
+
+  if (horizontal_axis) {
+    for (i in seq(1, (rows %/% 2) * cols, cols)) {

Review Comment:
   I have added the parfor loop but I had to use check =0 . As far as I 
understand parallel execution should be fine as all the iterations are 
independent from each other but it still didnt allow me without check = 0 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to