Unique Identifiers

B

blackjack612

Hi,

I've been trying to come up with a way to efficiently create a unique
number identifier for a largish array of doubles. I've also been
checking out the boost libraries hash stuff and am at a loss when
trying to understand what they do. In the library I'm working on
(where I use arrays of bits, integers, and doubles), it would be very
helpful if I was able to represent an array of numeric types with a
unique identifier. While creating a unique identifier for bits and
integers isn't much of a problem, creating one for an array of doubles
is. Does anybody know if it's even possible to do what I'm talking
about?

Sincerely,
Ed H
 
V

Victor Bazarov

blackjack612 said:
I've been trying to come up with a way to efficiently create a unique
number identifier for a largish array of doubles. [..]
> Does anybody know if it's even possible to do what I'm talking
about?

Some probably do...

How about explaining (using an example) for the rest of us? WTH do you
mean?

V
 
M

Mohammad Nabil Al-Aggan

Hi,

I've been trying to come up with a way to efficiently create a unique
number identifier for a largish array of doubles. I've also been
checking out the boost libraries hash stuff and am at a loss when
trying to understand what they do. In the library I'm working on
(where I use arrays of bits, integers, and doubles), it would be very
helpful if I was able to represent an array of numeric types with a
unique identifier. While creating a unique identifier for bits and
integers isn't much of a problem, creating one for an array of doubles
is. Does anybody know if it's even possible to do what I'm talking
about?

Sincerely,
Ed H

If you are talking about the hash value of an array, depending on the
maximum array length, it might not be unique.
For example if the hash value is 128 bits in length, it can only
represent 2^128 unique identities. That means your array of integers
(assuming 4-byte integers), to be uniquely identifiable with such
mechanism, can not exceed 128 / 32 items. That is 4 items only.
It's basically intuitive. Number of bits in the hash are 128. Number
of bits in 12-item 4-byte-per-item array is also 128 bits.
If you want to uniquely identify X arrays, you need your hash to be
able to represent X different values. Which is not possible for arrays
longer than B bits, where B is the number of bits in the hash.
 
J

James Kanze

If you are talking about the hash value of an array, depending
on the maximum array length, it might not be unique.

If he's talking about the hash value of the array (that's not
what I understood, but then, I didn't understand what he was
talking about), then there's practically no way to do it
portable. On the other hand, *if* the values in the array are
all "reasonable" (for some definition of "reasonable", but at
the least, no NaN nor infinity, no non-normals, probably no
underflow, and maybe even no 0.0, but if that's the case, you
can work around it by treating 0.0 specially), and the format is
the common IEEE (or some others---this will work with IBM
mainframe floating point), and the hash code is used exclusively
within the program (otherwise, you might have problems with byte
order), then just hashing the array as if it were an array of
unsigned char might do the trick.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top