Re: Finding maximum of an array



(1) Changing the ">=" to ">" and "N to M" to "M downto N",

Interesting idea. I implemented it, but saw no change in performance. But
my guess is that it will only affect the performance when many numerical
values are equal. So sometimes it will make a slight difference.

(2) Change the problem to an integer problem by making a lossless
transformation

Interesting also, but harder to do. I would get an improvement of about 30%
but it would require a lot of changes.

I'm not sure about the other ones, so here are what I try to achieve.

I need to perform a hierarchical clustering from a distance matrix. I have a
huge matrix of single values all between 0 and 1and I am looking for the
highest value. It is a diagonal matrix so I don't look at every cells but
only at the upper diagonal.
I get the coordinates of the highest value, transform some values in the
matrix and then delete the corresponding row and columns. I then repeat the
operation until I end up with a small matrix of 1 x 1.

I may start with a 4000 x 4000 matrix, and reduce the dimension 3999 times,
every time looking at the maximum value and then removing the row and
column.

About 45% of the time is spent deleting rows and column, and 45% finding the
maximum value (about 10% computing other things).

Hope this help

Richard






.



Relevant Pages