def sparc_codebook(L, M, n,P): Ax, Ay, _ = block_sub_fht(n, M, L, seed=None, ordering=None) # seed must be explicit def Ab(b): return Ax(b).reshape(-1, 1) / np.sqrt(n) def Az(z): return Ay(z).reshape(-1, 1) / np.sqrt(n) return Ab, Az
def SparcCodebook(self, L, ml, N): """ Generate SPARC Codebook for CS encoding :param L: number of sections :param ml: length of each section :param N: number of channel uses (real DOF) """ # generate Hadamard matrices self.__numBlockRows = N self.__Ax, self.__Ay, _ = block_sub_fht(N, ml, L, ordering=None, seed=None)
def sparc_codebook(L, M, n): """ Create sensing matrix via randomly sampling the rows of Hadamard matrices :param L: number of sections :param M: length of each section :param n: number of channel uses (real d.o.f.) """ Ax, Ay, _ = block_sub_fht(n, M, L, seed=None, ordering=None) # seed must be explicit def Ab(b): return Ax(b).reshape(-1, 1) / np.sqrt(n) def Az(z): return Ay(z).reshape(-1, 1) / np.sqrt(n) return Ab, Az
def sparcCodebook(self, n): """ Create sensing matrix via randomly sampling the rows of Hadamard matrices :param n: number of rows in matrix """ # Initialize important parameters M = self.__M L = self.__L if self.__SensingMatrixType == 'Dense' else 1 self.__numBlockRows = n # Create SPARC-like codebook Ax, Ay, _ = block_sub_fht(n, M, L, seed=None, ordering=None) # seed must be explicit def Ab(b): return Ax(b).reshape(-1, 1) / np.sqrt(n) def Az(z): return Ay(z).reshape(-1, 1) / np.sqrt(n) return Ab, Az