pub fn ternary<F>(a1: &Bitmap, a2: &Bitmap, a3: &Bitmap, op: F) -> Bitmap
where
    F: Fn(u64, u64, u64) -> u64,
{
    assert_eq!(a1.len(), a2.len());
    assert_eq!(a1.len(), a3.len());
    let a1_chunks = a1.chunks();
    let a2_chunks = a2.chunks();
    let a3_chunks = a3.chunks();

    let rem_a1 = a1_chunks.remainder();
    let rem_a2 = a2_chunks.remainder();
    let rem_a3 = a3_chunks.remainder();

    let chunks = a1_chunks
        .zip(a2_chunks)
        .zip(a3_chunks)
        .map(|((a1, a2), a3)| op(a1, a2, a3));

    let buffer = chunk_iter_to_vec(chunks.chain(std::iter::once(op(rem_a1, rem_a2, rem_a3))));

    let length = a1.len();

    Bitmap::from_u8_vec(buffer, length)
}
/// Apply a bitwise operation `op` to three inputs and return the result as a [`Bitmap`].
Apply a bitwise operation `op` to three inputs and return the result as a [`Bitmap`].
Apply a bitwise operation ` op ` to three inputs and return the result as a [ ` Bitmap ` ] .
pub fn ternary<F>(a1: &Bitmap, a2: &Bitmap, a3: &Bitmap, op: F) -> Bitmap
where
    F: Fn(u64, u64, u64) -> u64,
{
    assert_eq!(a1.len(), a2.len());
    assert_eq!(a1.len(), a3.len());
    let a1_chunks = a1.chunks();
    let a2_chunks = a2.chunks();
    let a3_chunks = a3.chunks();
    let rem_a1 = a1_chunks.remainder();
    let rem_a2 = a2_chunks.remainder();
    let rem_a3 = a3_chunks.remainder();
    let chunks = a1_chunks
        .zip(a2_chunks)
        .zip(a3_chunks)
        .map(|((a1, a2), a3)| op(a1, a2, a3));
    let buffer = chunk_iter_to_vec(chunks.chain(std::iter::once(op(rem_a1, rem_a2, rem_a3))));
    let length = a1.len();
    Bitmap::from_u8_vec(buffer, length)
}
pub fn ternary < F > ( a1 : & Bitmap , a2 : & Bitmap , a3 : & Bitmap , op : F ) -> Bitmap where F : Fn ( u64 , u64 , u64 ) -> u64 , { assert_eq ! ( a1 len ( ) a2 len ( ) ) ; assert_eq ! ( a1 len ( ) a3 len ( ) ) ; let a1_chunks = a1 . chunks ( ) ; let a2_chunks = a2 . chunks ( ) ; let a3_chunks = a3 . chunks ( ) ; let rem_a1 = a1_chunks . remainder ( ) ; let rem_a2 = a2_chunks . remainder ( ) ; let rem_a3 = a3_chunks . remainder ( ) ; let chunks = a1_chunks . zip ( a2_chunks ) . zip ( a3_chunks ) . map ( | ( ( a1 , a2 ) , a3 ) | op ( a1 , a2 , a3 ) ) ; let buffer = chunk_iter_to_vec ( chunks . chain ( std :: iter :: once ( op ( rem_a1 , rem_a2 , rem_a3 ) ) ) ) ; let length = a1 . len ( ) ; Bitmap :: from_u8_vec ( buffer , length ) }
Apply a bitwise operation `op` to three inputs and return the result as a [`Bitmap`].
Apply a bitwise operation ` op ` to three inputs and return the result as a [ ` Bitmap ` ] .
a1
&Bitmap
a2
&Bitmap
a3
&Bitmap
op
F
a1
&Bitmap
a2
&Bitmap
a3
&Bitmap
op
F