Ejemplo n.º 1
0
print 'Remaining receivers are: ', interf_map
print 'Interference indicator sets are'
print Interferers

#### for quick test, should be replaced with symbol/message data structures
K = len(interf_map)
W = np.matrix(np.zeros((K, 1)))
A = np.matrix(np.zeros((K, K)))
I = (Interferers - 1) * -1
I[np.diag_indices_from(I)] = 0
for index, node in enumerate(interf_map):
    W[index, 0] = sym_vec[node].val
    for jindex, i in enumerate(I[index, :]):
        if i == 1:
            A[index, jindex] = sym_vec[interf_map[jindex]].val

## nuclear norm approx
num_transmissions = 2 * K  # int(K/2) + 1
print
print 'num transmissions is ', num_transmissions
V, U = nuclear_alignment(Interferers, num_transmissions, .1, 1)
print
print 'U.T*V is:'
print U.T * V

print
for k in range(K):
    W_dec = ((U.T * V)[k, :] * W -
             (U.T * V)[k, :] * A[k, :].T) / (U.T * V)[k, k]
    print 'Message %d truth: %d decoded: %.2f' % (k, W[k], W_dec)
Ejemplo n.º 2
0
print 'Interference indicator sets are'
print Interferers


#### for quick test, should be replaced with symbol/message data structures
K = len(interf_map)
W = np.matrix(np.zeros((K,1)))
A = np.matrix(np.zeros((K, K)))
I = (Interferers - 1)*-1
I[np.diag_indices_from(I)] = 0
for index,node in enumerate(interf_map):
	W[index,0] = sym_vec[node].val
	for jindex,i in enumerate(I[index,:]):
		if i == 1:
			A[index,jindex] = sym_vec[interf_map[jindex]].val


## nuclear norm approx
num_transmissions = 2*K # int(K/2) + 1
print
print 'num transmissions is ', num_transmissions
V, U = nuclear_alignment(Interferers, num_transmissions, .1, 1)
print
print 'U.T*V is:'
print U.T*V

print
for k in range(K):
	W_dec = ((U.T*V)[k,:]*W - (U.T*V)[k,:]*A[k,:].T)/(U.T*V)[k,k]
	print 'Message %d truth: %d decoded: %.2f' % (k, W[k], W_dec)
Ejemplo n.º 3
0
#	U: [m,K] initialization decoding matrix
#	epsilon:	threshold for min. eigenvalue
#	iter:		number of iterations

#def nuclear_IA_K_user(I, U, epsilon=.1, iter=5):
# obtain problem parameters
#I = np.array([ [0,1,1], [1,0,0], [1,0,0] ])
#I = np.array([ [0,1,0,1], [0,0,1,0], [1,1,0,0], [0,0,1,0] ])
I = np.zeros((5, 5))

epsilon = .1
iter = 1
K = np.size(I, 0)
m = 1

V, U = nuclear_alignment(I, m, epsilon, iter, quiet=False)

print
print U.T * V
print
print I

W = np.random.randint(1, 255, [K, 1])
A = np.matrix(np.zeros((K, K)))

for k in range(K):
    for l in range(K):
        if k != l and I[k, l] != 1:
            A[k, l] = W[l]

print
Ejemplo n.º 4
0
#	U: [m,K] initialization decoding matrix
#	epsilon:	threshold for min. eigenvalue
#	iter:		number of iterations

#def nuclear_IA_K_user(I, U, epsilon=.1, iter=5):
	# obtain problem parameters
#I = np.array([ [0,1,1], [1,0,0], [1,0,0] ])
#I = np.array([ [0,1,0,1], [0,0,1,0], [1,1,0,0], [0,0,1,0] ])
I = np.zeros((5,5))

epsilon = .1
iter = 1
K = np.size(I,0)
m = 1

V,U = nuclear_alignment(I, m, epsilon, iter, quiet=False)

print
print U.T*V
print
print I

W = np.random.randint(1,255,[K,1])
A = np.matrix(np.zeros((K,K)))

for k in range(K):
	for l in range(K):
		if k != l and I[k,l] != 1:
			A[k,l] = W[l]