This forum has been archived. All content is frozen. Please use KDE Discuss instead.

[SOLVED] Finding minimum in a matrix

Tags: None
(comma "," separated)
Xtremecpp
Registered Member
Posts
5
Karma
0

[SOLVED] Finding minimum in a matrix

Mon Jan 26, 2009 10:39 am
Hello,

i have got a StrictlyUpperTriangular Matrix. I am interesting in a possiblity to search minimum only in this triangular matrix for finding the minimum faster as searching in the whole matrix.

Thanks for help


Xtremecpp, proud to be a member of KDE forums since 2008-Dec.
User avatar
bjacob
Registered Member
Posts
658
Karma
3
Triangular visitors and reductions aren't implemented yet.
This means that there is currently no way to tell minCoeff() to take advantage of triangularness. You'll have to write your own code with for loops. One trick: since you're going to do a lot of coefficient access, you don't want to pay the price of an assertion everytime. So use MatrixBase::coeff(int,int) instead of MatrixBase::operator()(int,int) to read coefficients.


Join us on Eigen's IRC channel: #eigen on irc.freenode.net
Have a serious interest in Eigen? Then join the mailing list!
Xtremecpp
Registered Member
Posts
5
Karma
0
thanks for this trick, helped me very well.

Existing same alternative for write access too?


Xtremecpp, proud to be a member of KDE forums since 2008-Dec.
User avatar
bjacob
Registered Member
Posts
658
Karma
3
Xtremecpp wrote:Existing same alternative for write access too?


Yep, it's called coeffRef(int,int)

Notice that for vectors you also have variants taking only one int parameter.


Join us on Eigen's IRC channel: #eigen on irc.freenode.net
Have a serious interest in Eigen? Then join the mailing list!


Bookmarks



Who is online

Registered users: Bing [Bot], Evergrowing, Google [Bot], rblackwell