code: def hamm_encoder(self,x):
          
          if(np.dtype(x[0]) != int):
              raise ValueError('Error: Invalid data type. Input must be a vector of ints')
  
          if(len(x) % self.k or len(x) < self.k):
              raise ValueError('Error: Invalid input vector length. Length must be a multiple of %d' %self.k)
  
          N_symbols = int(len(x)/self.k)
          codewords = np.zeros(N_symbols*self.n)
          x = np.reshape(x,(1,len(x)))
  
          for i in range(0,N_symbols):
              codewords[i*self.n:(i+1)*self.n] = np.matmul(x[:,i*self.k:(i+1)*self.k],self.G)%2
          return codewords
docs: Encodes input bit array x using hamming block code.
          
          parameters
          ----------
          x: array of source bits to be encoded by block encoder.
          
          returns
          -------
          codewords: array of code words generated by generator
          matrix G and input x.
          
          Andrew Smit November 2018