#!/usr/bin/python
# -*- coding: utf-8 -*-
"""Some operations on matrices over GF(2) represented as lists of integers.
The row corresponding to the LSB is last, and correspondingly, the
column corresponding to the LSB is printed last.
"""
import operator
import random
import sys
def mxor(matrix, vector):
return reduce(operator.xor, [row for ii, row in enumerate(reversed(matrix))
if vector & (1 << ii)],
0)
def random_matrix(n):
return [random.randrange(1<