1 Reply Latest reply: Jun 22, 2013 8:49 AM by Gysbert Wassenaar RSS

    help needed: perform bitand between two huge numbers



      I have two (string) fields containing the binar representation of big numbers and I need to perform a bitwise AND between these fields.



      F1 = '01001...001'

      F2 = '00101...011'


      the result should be a string obtained by processing AND for each pair of digits in same ordinal position.


      Result = '00001...001'


      The final gial is then to calculate a number by summing up each digit in the Result: = 0+0+0+1+...+0+0+1


      Please keep in mind that the field values can have more than 10,000 digits.

      Also the table containing these two fileds migth have more than 500,000 records (even 1,000,000)


      The goal is to implement the solution (if any ) either during LOADING script or in CHARTs and the processing time not to be over 2-3 hours.


      What I'm tring to do is to calculate the Similarity between Customers based on purchased Producs by them.

      F1 and F2 represents the vectors for each Customer and its prurchased Products (0 = not purchased, 1 = purchased) and I try to compute the Similarities between each customer and the rest of the customers.


      Any ideas, please?


      (there is an sample attached with two field values. the digits are separated by ";", but it is not mandatory to be separated by anything)