Example #1
0
def test_ready(N, p):
    #tests ready(M)
    M = SVD.prepare(N, p)
    rMin, OptM = SVD.APIndexCode(M)
    size = ready(OptM)
    print(size)

#test_ready(10, .3)
Example #2
0
def test(N):
    #test SVD decoding with APIC
    p = .3
    M = SVD.prepare(N, p)
    T = np.random.rand(N, 1)
    print(T)
    [Rmin, OptM] = SVD.APIndexCode(M)
    print(Rmin)
    X = SVDenc(OptM, T, Rmin)
    A = np.zeros((N, N))
    for i in range(N):
        for j in range(N):
            if M[i][j] > .001 and M[i][j] != 1:
                A[i][j] = T[j][0]
    message = []
    for i in range(N):
        t = SVDdec(OptM, X, i, A[i][:])
        message.append(t)
    print(message)