BitArrays32¶
Usage
use BitArrays.BitArrays32;
or
import BitArrays.BitArrays32;
- type bit32Index = int¶
- class BitArray32¶
- BitArray32 is an array of boolean values stored packed together as 32 bit words. All boolean values are mapped one-to-one to a bit in a 32 bit integer. - proc init(size: bit32Index, targetLocales = Locales)¶
- Create a bit array of a given size. The values are distributed across locales with a Block distribution. - Arguments
- size – The size of the bit array 
- locales – What nodes to distibute the values over 
 
 
 - proc init(ref values: [] uint(32), size: bit32Index)
- Create a bit array from a given set of values. * The input values must be a rectangular 1-dimensional array. * The input values must not be a sparse array. * The input values must not be an associative array. - Arguments
- values – The valuess in the bit array stored as 32 bit integers. If the size does is not a multiple of 32 then one extra value must be added to contain the reminder bits. 
- size – The number of individual bits in the bit array. 
 
 
 - proc all(): bool¶
- Test if all the values are true. - Returns
- true if all the values are true 
- Return type
- bool 
 
 - proc any(): bool¶
- Test if any of the values are true - Returns
- true if any of the values are true 
- Return type
- bool 
 
 - proc at(idx: bit32Index): bool throws¶
- Look up value at index idx. - Arguments
- idx – The index in the bitarray to look up. 
- Returns
- value at idx 
- Return type
- bool 
- Throws
- BitRangeError – If idx is outside the range [1..size). 
 
 - proc equals(rhs: BitArray32): bool¶
- Compares two bit arrays by values. - Returns
- true if the two bit arrays has identical values. 
- Return type
- bool 
 
 - proc fill()¶
- Set all the values to true. 
 - proc popcount()¶
- Count the number of values set to true. - Returns
- The count. 
- Return type
- int 
 
 - proc reverse()¶
- Reverse the ordering of the values. The last value becomes the first value. The second last value becomes the second first value. And so on. 
 - proc rotateLeft(shift: integral)¶
- Rotate all the values to the left. Values wrap around to the other side. - Arguments
- shift – number of bits to rotate 
 
 - proc rotateRight(shift: integral)¶
- Rotate all the values to the right. Values wrap around to the other side. - Arguments
- shift – number of bits to rotate 
 
 - proc set(idx: bit32Index, value: bool) throws¶
- Set the value at a given index. - Arguments
- idx – The index of the value. 
- value – The value to set. 
 
- Throws
- BitRangeError – if the idx value is outside the range [0, size). 
 
 - proc size(): bit32Index¶
- Get the number of values. - Returns
- bit vector size. 
- Return type
- bit32Index 
 
 - iter these()¶
- Iterate over all the values. - Yields
- All the values 
- Yields type
- bool 
 
 - iter trueIndices()¶
- Iterate over the index of all the values that are true. - Yields
- The index of a true value 
- Yields type
- int 
 
 - proc unfill()¶
- Set all the values to false. 
 - proc type ==(lhs: BitArray32, rhs: BitArray32)¶
- Compares parwise the values of the two bit arrays for equality. - Arguments
- lhs – left hand bit array 
- rhs – right hand bit array 
 
- Returns
- if the bits in the arrays are equal 
- Return type
- list 
 
 - proc type !=(lhs: BitArray32, rhs: BitArray32)¶
- Compares parwise the values of the two bit arrays for inequality - Arguments
- lhs – left hand bit array 
- rhs – right hand bit array 
 
- Returns
- if the bits in the arrays are equal 
- Return type
- list 
 
 - proc type =(ref lhs: BitArray32, rhs: BitArray32)¶
- Copies the values from a bit array. - Arguments
- lhs – the bit array to assign 
- rhs – The bit array to copy 
 
 
 - proc type !(arg: BitArray32): BitArray32¶
- Nagation operator. Turn all true values into false values. Turn all false values into true values. - Returns
- A copy of this bit array negated. 
- Return type
- BitArray32 
 
 - proc type <<(lhs: BitArray32, shift: integral): BitArray32 throws¶
- Shift the values shift values to the right. Missing right values are padded with false values. - Arguments
- shift – the number of values to shift. 
- Returns
- A copy of the values shifted to the right. 
- Return type
- BitArray32 
- Throws
- ShiftRangeError – If shift is less than zero or bigger than the size of the bit array. 
 
 - proc type <<=(ref lhs: BitArray32, shift: integral) throws¶
- Shift all the values to the right. Left values are padded with false values. - Arguments
- shift – the number of values to shift. 
- Throws
- ShiftRangeError – If shift is less than zero or bigger than the size of the bit array. 
 
 - proc type >>(lhs: BitArray32, shift: integral): BitArray32 throws¶
- Shift the values shift positions to the left. Missing left values are padded with false values. - Arguments
- shift – the number of values to shift. 
- Returns
- a copy of the values shifted shift positions to the left. 
- Return type
- BitArray32 
- Throws
- ShiftRangeError – If shift is less than zero or bigger than the size of the bit array. 
 
 - proc type >>=(ref lhs: BitArray32, shift: integral) throws¶
- Shift all the values to the right. Left values are padded with false values. - Arguments
- shift – the number of values to shift. 
- Throws
- ShiftRangeError – If shift is less than zero or bigger than the size of the bit array. 
 
 - proc type ^(lhs: BitArray32, rhs: BitArray32)
- Perform xor the values with the corresponding values in the input bit array. X[i] ^ Y[i] is performed for all indices i where X and Y are bit arrays. If one of the two bit arrays has different size then indices fitting the shortes bit array are compared. - Arguments
- lhs – this bit array 
- rhs – bit array to perform xor with 
 
- Returns
- The results 
- Return type
- BitArray32 
 
 - proc type ^=(ref lhs: BitArray32, rhs: BitArray32)
- Perform xor the values with the corresponding values in the input bit array. X[i] ^ Y[i] is performed for all indices i where X and Y are bit arrays. If one of the two bit arrays has different size then indices fitting the shortes bit array are compared. - Arguments
- lhs – this bit array 
- rhs – bit array to perform xor with 
 
 
 - proc type &(lhs: BitArray32, rhs: BitArray32): BitArray32
- Perform the and operation on the values in this bit array with the values in another bit array. If one of the two bit arrays has different size then indices fitting the shortes bit array are compared. - Arguments
- lhs – this bit array 
- rhs – bit array to perform and with 
 
- Returns
- the result of lhs or rhs 
- Return type
- BitArray32 
 
 - proc type &=(ref lhs: BitArray32, rhs: BitArray32): BitArray32
- Perform the and operation on the values in this bit array with the values in another bit array. If one of the two bit arrays has different size then indices fitting the shortes bit array are compared. - Arguments
- lhs – this bit array 
- rhs – bit array to perform and with 
 
 
 - proc type +(lhs: BitArray32, rhs: BitArray32): BitArray32¶
- Perform the or operation on the values in this bit array with the values in another bit array. - Arguments
- lhs – this bit array 
- rhs – bit array to perform or with 
 
- Returns
- The result of lhs or rhs 
- Return type
- BitArray32 
 
 - proc type +=(ref lhs: BitArray32, rhs: BitArray32)¶
- Perform the or operation on the values in this bit array with the values in another bit array. - Arguments
- lhs – this bit array 
- rhs – bit array to perform or with 
 
 
 - proc type -(lhs: BitArray32, rhs: BitArray32)¶
- Perform the minus operation on the values in this bit array with the values in another bit array.
- The result is all the values in lhs which are not present in rhs. 
 - Arguments
- lhs – this bit array 
- rhs – bit array to perform minus with 
 
- Returns
- The result of lhs - rhs 
- Return type
- BitArray32 
 
 - proc type -=(ref lhs: BitArray32, rhs: BitArray32)¶
- Perform the minus operation on the values in this bit array with the values in another bit array.
- The result is all the values in lhs which are not present in rhs. 
 - Arguments
- lhs – this bit array 
- rhs – bit array to perform minus with