help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Deleting equal rows/columns in matrix


From: AlbFrigerio
Subject: Re: Deleting equal rows/columns in matrix
Date: Thu, 21 Oct 2010 03:30:55 -0700 (PDT)

I believe Octave function is better than mine for lots of reasons, mainlty
because my function works only with matrix of integer 0:9 values with small
size. I tried it on some matrices, and the time discrepance is not big. I
implemented it only because I wasn't able to find the unique function, now
I'm using it because it is more flexible (also with big size matrices).

My idea is quite simple : given a matrix, I transform every row in a number
using 10-base representation. Then I produce the outer difference of the
resulting vector, looking for the non-diagonal zeros. These are the repeated
elements, I choose to delete the latest ones.

You may find the attached codes. Since I cannot understand how to use the
outer function to make outer difference (I tried outer(B,B,@diff) or
outer(B,-B,@sum) but they didn't work) I created the outermio function.

By the way, just an information on unique function. Is it possible to know
how much rows were equal to the lines which have not been deleted?  For
example, if I got a 6 row matrix with equal rows 1 - 2 - 6 and 3 - 5 , my
resultant matrix will const of previous rows 1 - 3 - 4 , and I'd like to
have a vector b whose elements are [3 2 1] , i.e. b(i) = the number of rows
in the input matrix which are equal to the i-th row of the unique one.

Have all a nice day,
   Alberto

http://octave.1599824.n4.nabble.com/file/n3005348/outermio.m outermio.m 
http://octave.1599824.n4.nabble.com/file/n3005348/xcs_remove_duplicate.m
xcs_remove_duplicate.m 
http://octave.1599824.n4.nabble.com/file/n3005348/AA.txt AA.txt 


Jaroslav Hajek-2 wrote:
> 
> On Wed, Oct 20, 2010 at 5:33 PM, AlbFrigerio
> <address@hidden> wrote:
>>
>> YES!!!!!
>>
>> Thank you so much , I hadn't found it in the manual ... how stupid I am!!
>> By
>> the way, everybody says that the best way to learn programming is to
>> program
>> yourself : I made my own program and, with entries between 0 and 9, it is
>> faster than Octave ones :)
>>
> 
> That is certainly interesting. Can you post a code demonstrating this?
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
> 
> 

-- 
View this message in context: 
http://octave.1599824.n4.nabble.com/Deleting-equal-rows-columns-in-matrix-tp3003845p3005348.html
Sent from the Octave - General mailing list archive at Nabble.com.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]