From: Peter Vanroose <peter_vanroose@ya...>  20090329 11:12:06

> There is a min_value() function for vnl_matrix, but is there > a way to get the location of that min value? > An exhaustive search doesn't sound too nice on a 30,000 x 30,000 matrix! You'll have to run through all values anyhow to obtain the arg_min. But it would indeed be nice to have a "builtin" method in vnl_matrix to do this; moreover, that method can then be optimized for speed, just like min_value() is. I'm currently putting in two functions arg_min() and arg_max() into all vector and matrix classes in vnl, next to min_value() and max_value(), which should do what you ask for. This just needs a little more of testing before I put it in the svn repository. There's of course no need for a combined min_value+arg_min function since, once you have the arg_min, it's straightforward (and optimal in terms of performance) to obtain the corresponding min_value from it. In case of ties, my implementation returns the smallest index with the min (or max) value. I believe this is the standard convention. I can post the svn diffs here (or mail them privately) if someone without access to the vxl repository wants to apply just this patch directly to his working copy of vxl.  Peter. __________________________________________________________ Går det långsamt? Skaffa dig en snabbare bredbandsuppkoppling. Sök och jämför priser hos Kelkoo. http://www.kelkoo.se/c100015813bredband.html?partnerId=96914325 