Dear dutch
Thank you for your various advices.
1 2
|
unordered_map<uint32_t,vector<pair<size_t,size_t>>> data;
uint32_t key = (uint32_t(m1) << 16) | uint32_t(m2);
|
In fact, I also tried the hashing as you told me, that is, the bit operation.
This modification make programs faster, nevertheless, speed of generation is slower than primitive type, std::size_t.
This overhead is superior to reduction of destruction time reduction,
from
unordered_map<std::size_t, unordered_map<std::size_t, vector<std::pair<std::size_t, std::size_t> > > >
to
unordered_map<std::pair<std::size_t, std::size_t>, vector<std::pair<std::size_t, std::size_t> > >
I suppose that this is due to high frequent call of unordered_map::emplace, which entails calls of hash functions.
(I have intention to consider a way to reduce the calls of emplace)
Another question:
In the data given previously, suppose the pair (3,4) existed (where 3 and 4 are both from group 1). Then could the vector associated with F(1,2) also contain (3,4) ? Or would that be associated with F(1,1) ?
|
Thank you for your consideration. If (3,4) exists, it is associated with F(1,1).
Also, in the notation F(1,2), does the first of the pair need to come from group 1 and the second from group 2? I.e., is F(1,2) different from F(2,1) ? |
In the generation stage of the mapper, as to F(M1, M2), M1 <= M2 is imposed, so that there just F(1,2) exists, but F(2,1) does not exist.