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