Re: [Boost-users] ranking of ublas vector

Hi, I think the problem is: we discuss about the "rank" and the "rank index". I my problem I only need the rank index and the value to calculate a new value like: exp( -rank_index) * vec(rank_index) So the smallest element in vec will be multiply with 1 and other elements with values < 1 Phil

AMDG Kraus Philipp wrote:
I think the problem is:
we discuss about the "rank" and the "rank index".
I my problem I only need the rank index and the value to calculate a new value like: exp( -rank_index) * vec(rank_index)
So the smallest element in vec will be multiply with 1 and other elements with values < 1
This doesn't quite add up for me. Taking the example from before, you have [4](0.405121, 0.943918, 0.887914, 0.338921) and [4](3, 0, 2, 1) You don't want exp(-3) * vec(3), right? Is exp(-0) * vec(3), exp(-1) * vec(0), ... correct? In Christ, Steven Watanabe

Am 14.03.2010 um 15:42 schrieb Steven Watanabe:
AMDG
Kraus Philipp wrote:
I think the problem is:
we discuss about the "rank" and the "rank index".
I my problem I only need the rank index and the value to calculate a new value like: exp( -rank_index) * vec(rank_index)
So the smallest element in vec will be multiply with 1 and other elements with values < 1
This doesn't quite add up for me.
Taking the example from before, you have [4](0.405121, 0.943918, 0.887914, 0.338921) and [4](3, 0, 2, 1)
You don't want exp(-3) * vec(3), right? Is exp(-0) * vec(3), exp(-1) * vec(0), ... correct?
Exactly. This rank option is used in neuronal networks for setting the "winner" neuron. I hope this option will be set up into the boost standard :-P Thanks Phil

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Am 14.03.2010 um 15:42 schrieb Steven Watanabe:
exp(-0) * vec(3), exp(-1) * vec(0), ... correct?
That's the correct option. in This case vec(3) hold the smallest entry in vec. I think a hash map is a way to realize it, but I think it a little bit overkill for the problem. I need an iterator about the sorted elements in the vector Phil -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.8 (Darwin) iEYEARECAAYFAkudVwsACgkQ6s0Ua5LeGumxwQCgiDLPXybjrgYFwcUvRlr0/mgE 2xkAoMu5O4UzcUc2KPDddWRC2suh1znx =d/s0 -----END PGP SIGNATURE-----

AMDG Kraus Philipp wrote:
Am 14.03.2010 um 15:42 schrieb Steven Watanabe:
exp(-0) * vec(3), exp(-1) * vec(0), ... correct?
That's the correct option. in This case vec(3) hold the smallest entry in vec.
I think a hash map is a way to realize it, but I think it a little bit overkill for the problem. I need an iterator about the sorted elements in the vector
Okay, so in the code I gave, temp should give you a sorted view and ranking should give the indexes of elements in the sorted array. Given [4](0.405121, 0.943918, 0.887914, 0.338921) the code outputs 1 3 2 0 You can just match them up elementwise to get the correct exponents. If this doesn't work please post the complete code and output that demonstrates the problem. In Christ, Steven Watanabe
participants (2)
-
Kraus Philipp
-
Steven Watanabe