Re: [eigen] HELP:minimum value |

[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]

*To*: eigen@xxxxxxxxxxxxxxxxxxx
*Subject*: Re: [eigen] HELP:minimum value
*From*: Gael Guennebaud <gael.guennebaud@xxxxxxxxx>
*Date*: Thu, 28 Jun 2012 08:35:58 +0200
*Dkim-signature*: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=n88soppA2RmkBL0tkuBOOaClTYK2j5ho5QMLmFZUP8M=; b=PKhn7FvsJOKxqW+7ns26/wUVMnqMHLm+U2/2yLNmcak2cYRDRRHHPGXW5ddeWvHLGZ 9bu4R5ErtAcB+xEWaZjCzigpStVU5Xz5DJo/lLnh+OoEJgjTAtJgYa/10hlCM5taaHQJ dztX2SSXu3LiosWr1mU5qdOozwubZGbX2WeJ1zWqBngVrvLRXQ4AqjW8crlvKnsz5zXh CoCcNy+8uSiXn4vXsL40BqL+Dg7mYrYZgAUODINNxGt+C6X/4q7V8ZFq9cxvpW/njN2V OGDYNQgsUtFdxXEkf515+ol+TtY7Z0MdvTDHMHozRV0/3Iv2Ld1WZxMi+uSc9KNyDfXz hfBw==

no need to sort the vector to extract the minimum coefficient.
minCoeff() simply loop trough the vector:
Scalar min_val = v(0);
for(int i=1;i<v.size();++i)
min_val = min(min_val, v(i));
The actual Eigen's code is more complicated and more optimized (loop
peeling, loop unrollling, vectorization). You can see the structure of
the loops in the Eigen/src/Core/Redux.h file.
On Thu, Jun 28, 2012 at 7:25 AM, Gaurav Gupta <gaurav71531@xxxxxxxxx> wrote:
> i have constructed a function to compute minimum value in a vector, applying
> sorting approach. But my
> function is taking much more time as compared to inbuilt minCoeff()
> operation, am I going wrong, How can
> I see the code for minCoeff() operation.