c - Binary matrix vector multiplication -


i want multiply 8x8 binary matrix represented unsigned 64 bit integer 8 bit vector represented unsigned char. however, due other issues matrix must be ordered columns, ergo there's no easy matching of bytes easy multiplication.

any idea how speed such calculation? every operation counts need billions of such calculations made.

the multiplications made on 2 element field (f-2).

with matrix , vector representation, helps matrix multiplication way:

(col1 ... col8) * (v1 ... v8)t = col1 * v1 + ... + col8 * v8

where matrix = (col1 ... col8)

and column vector v = (v1 ... v8)t

thinking further, can multiplications @ once if inflate 8-bit vector 64-bit vector repeating every bit 8 times , calculating p = & v_inflated. thing left then, addition (i.e. xor) of products.

a simple approach xoring products is.

uint64_t p = calculated products text above; uint64_t sum = 0; for( int = 8; i; --i ) {    sum ^= p & 0xff;    p >> 8;   } 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -