0

I want to make a bit array or bit vector of items I have in an array so that I can create a binary fingerprint to compare to an object's fingerprint.

Here is an example:

Base fingerprint... All "available" colors

  1. colorsArray[blue, red, white, green, orange];

  2. Make this into a binary array (or whatever)

  3. This is the result = masterPrint[1,1,1,1,1];

  4. Now I have a separate object that has the colors red and blue in it (object[red,blue])

  5. This object's fingerprint is object's print = [1,1,0,0,0];

  6. Compare two prints, master print [1,1,1,1,1] and object print [1,1,0,0,0];

  7. Result is two matches 40%

How can I accomplish this? Thank you

1 Answer 1

3

Better option is CFMutableBitVector

CFBitVector and its derived mutable type, CFMutableBitVector, manage ordered collections of bit values, which are either 0 or 1.

CFBitVector creates static bit vectors and CFMutableBitVector creates dynamic bit vectors.

See the class reference here

Sign up to request clarification or add additional context in comments.

8 Comments

I have read this reference but I am unsure as to how to take an array and parse it into this. Do you have any sample code? Thank you
if the answer helped you, please accept it. Do the code your own, then any issues occurred, post it as a good question. thanks
I will, I'm looking through it, it looks interesting, but there has to be an easier way, it looks like too much code just to add some values to a 1,0 array...
Depending on your application, there might be an argument for using one of the many bit-vector implementations offered by C++ - which you can easily interwork with objective-c. Performance might be one very good reason for doing so, but an even stronger case might be the selection of high-performance algorithms you can apply to the data from the algorithm collection in STL.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.