systemml-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matthias Boehm <mboe...@googlemail.com>
Subject Re: SystemML query
Date Mon, 17 Apr 2017 17:38:52 GMT
if your data X is already ordered you can do the following:

I = rbind(matrix(1,1,1), (X[1:nrow(X)-1,]!=X[2:nrow(X),]));
dX = removeEmpty(target=X, margin="rows", select=I);

Regards,
Matthias

On 4/17/2017 8:40 AM, arijit chakraborty wrote:
>
> Hi,
>
> I've an issue regarding finding and removing the duplicate in a column/ row of a matrix.
I'm tried this method:
>
> duplicate_matrix = matrix("1 2 3 3 3 4 5 6", rows = 8, cols = 1)
>
> dup_ind = matrix(1,rows = nrow(duplicate_matrix),cols = 1)
> a = nrow(dup_ind)
> b = nrow(duplicate_matrix)
>                                                 #Clumsy Unique. Can we check with the
systemml guy?
> for(i in 2:nrow(duplicate_matrix)){
>     if(as.scalar(duplicate_matrix[i,]) == as.scalar(duplicate_matrix[i-1,]) ){
>     dup_ind[i,] = 0
>   }
> }
>
>
> My question is, is there any better way of doing it? In systemML, we don't have method
to find/remove/ count duplicate values.
>
> Thank you!
> Arijit
>
>
> ________________________________
> From: Niketan Pansare <npansar@us.ibm.com>
> Sent: Friday, April 14, 2017 9:14 PM
> To: arijit chakraborty
> Cc: Matthias Boehm1; Berthold Reinwald
> Subject: Re: SystemML query
>
> Thanks Arijit. I appreciate your feedback. I will convey your concerns to other committers
and urge them to be active on stackoverflow too. If you have already posted questions on stackoverflow,
please send me the links and I will do my best to answer them :)
>
> On Apr 14, 2017, at 6:50 AM, arijit chakraborty <akc14@hotmail.com<mailto:akc14@hotmail.com>>
wrote:
>
> Thanks a lot Niketan! I didn’t expect you to reply my question. Actually I was not
sure if I can post question in that forum. And hardly people reply on systemML in stackoverflow.
>
> But from now on I’ll surely post my questions there. I’ve few more questions.
>
> Thanks a lot again!
>
> Regards,
> Arijit
>
> Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10
>
> From: Niketan Pansare<mailto:npansar@us.ibm.com>
> Sent: Thursday, April 13, 2017 11:01 PM
> To: arijit chakraborty<mailto:akc14@hotmail.com>
> Subject: Re: SystemML query
>
>
> Hi Arijit,
>
> I am happy to help, however I would recommend to post question (along with answer) on
our mailing list dev@systemml.incubator.apache.org<mailto:dev@systemml.incubator.apache.org>
as your question may help others as well :)
>
> X = matrix(1, rows = 1, cols = 100)
> J = matrix("10 20 25 26 28 31 50 67 79", rows=1, cols=9)
> J = t(J) # Make J a column vector
> I = matrix(1, rows=nrow(J), cols=1)
> V = matrix(10, rows=nrow(J), cols=1)
> output = table(I, J, V)
>
> Thanks,
>
> Niketan Pansare
> IBM Almaden Research Center
> E-mail: npansar At us.ibm.com<http://us.ibm.com>
> http://researcher.watson.ibm.com/researcher/view.php?person=us-npansar
>
> <graycol.gif>arijit chakraborty ---04/13/2017 09:20:38 AM---Hi Niketan, Hope you
are keeping well!
>
> From: arijit chakraborty <akc14@hotmail.com<mailto:akc14@hotmail.com>>
> To: Niketan Pansare/Almaden/IBM@IBMUS
> Date: 04/13/2017 09:20 AM
> Subject: SystemML query
> <EC07C6C8E03748A1B86D1B5DBC6B46FD.png>
>
>
>
> Hi Niketan,
>
> Hope you are keeping well!
>
> I got stuck in a systemML coding problem and don't know where to approach. So mailing
you. I know this is not fair, and will not repeat in future.
>
> My question is the following:
>
> I've a matrix of 1 row and 100 columns, matrix(1, rows = 1, cols = 100). I've another
column matrix of form matrix("10 20 25 26 28 31 50 67 79", rows = 1, cols = 9). I want to
add some value say 10, to 100 column matrix using the values of second matrix position indicator.
Rest of the columns' values remain the same
>
> How to do it here?
>
> Thanks a lot! Regards,
> Arijit
>
>
>
>
>

Mime
View raw message