Search by BitArray


#1

Hello!
my BitArray looks like this
1 0 0 1
0 1 1 1
1 1 1 1
0 1 0 1
0 1 0 0
How can I check if there is such a value?
1
0
0
1
0
0

I’m wondering if there is a function in Julia for such a search?


#2

Hi! Just to clarify, do you have a matrix like this?

julia> BitMatrix([1 0 0 1; 0 1 1 1; 1 1 1 1; 0 1 0 1; 0 1 0 0])
5×4 BitArray{2}:
  true  false  false   true
 false   true   true   true
  true   true   true   true
 false   true  false   true
 false   true  false  false

How do you want to do the matching? Your search value has 6 entries, while the sample matrix has 5 rows and 4 columns. Could you give a concrete example of a match in that array?


#3

has 6 entries, while the sample matrix has 5 rows

This is a typo, there is no specific example yet. The fact is that I plan to do a search in a large matrix.
BitArray(64,10 ^ 9)


#4

You need to be much more detailed in your question. Please include some sample data and examples of what is a match and not.

If your matrix will actually consist of 64 bit chunks, and you want to search aligned with those chunks, you could just loop over the matrix and compare UInt64’s.


#5

I will give an example later. I know I can use the loop. I just thought that there is a special function for bitarray.