def reduce(vector):
        """
        Can be a vector or matrix. If data are bool, sum Trues.
        """
        if type(vector) is list: # matrix
            return array(list(map(add.reduce, vector)))
        else:
            return sum(vector)