systemml-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Niketan Pansare" <>
Subject Re: which() Function in SystemML
Date Thu, 05 Jul 2018 17:26:21 GMT

Hi Kuno,

Thanks for trying out SystemML. One way to implement your logic in SystemML
is as follows:
X = matrix("1 4 -99 2 5 -99", rows=6, cols=1)
Y = removeEmpty(target=(X > 2)*seq(1, nrow(X)), margin="rows")
print("\nIndexes:\n" + toString(Y))

For handling NAs, you can replace NAs by certain value (in this case -99 or
one of the builtin constants, i.e. Inf or NaN ... see
) using the "na.strings" parameter of the transform builtin function (

Hope this helps.


Niketan Pansare
IBM Almaden Research Center
E-mail: npansar At

From:	"Baeriswyl Kuno (IT-SWE-CC1-JV6)" <>
To:	"" <>
Date:	07/05/2018 05:29 AM
Subject:	which() Function in SystemML


I'm a developer want to use SystemMl for running R-Code from our business
people on a Spark cluster.

I've studied
 , however, haven't found a implementation of the R function "which" or any
alternative functionality. Has anyone an idea how I could

# Given
v = c(1,4,NA,2, 5, NA)

# Expect indexes where value meets condition =  int[] 2 5
v2 = which(v>2)

# Expect indexes where returns TRUE =   int[] 3 6
v3 = which(

I've already considered the functions replace() and removeEmpty(), but they
don't exactly meets my needs.

Thanks a lot in advance

  • Unnamed multipart/related (inline, None, 0 bytes)
View raw message