def receive(self, src, msg): m = DecodedMsg(msg.dataGet()) self.counter = m.get_counter() timeformat = '%Y/%d/%m %H:%M:%S' print 'Received message %s: counter: %d' % (time.strftime(timeformat), self.counter) if m.get_perform_svd(): print ' svd received:' Svals = m.get_A() print Svals U,S,V = np.linalg.svd(self.A) print ' svd check:' print [s**2 for s in S] self.perform_svd = 0
def receive(self, src, msg): m = DecodedMsg(msg.dataGet()) self.counter = m.get_counter() timeformat = '%Y/%d/%m %H:%M:%S' print 'Received message %s: counter: %d' % (time.strftime(timeformat), self.counter) if m.get_perform_svd(): print ' svd received:' Svals = m.get_A() print Svals U, S, V = np.linalg.svd(self.A) print ' svd check:' print[s**2 for s in S] self.perform_svd = 0 self.A = make_A_matrix(self.N) self.counter += 1 self.perform_svd = self.counter % (self.N + 1) self.send()
def receive(self, src, msg): m = DecodedMsg(msg.dataGet()) self.counter = m.get_counter() timeformat = '%Y/%d/%m %H:%M:%S' print 'Received message %s: counter: %d' % (time.strftime(timeformat), self.counter) if m.get_perform_svd() == self.N: #print ' svd received:' Svals = m.get_A() print 'Rx svd: ', Svals U,S,V = np.linalg.svd(self.A) #S = [s**2 for s in S] #print ' svd check:' print 'PC svd: ', S self.perform_svd = 0 self.A = make_A_matrix(self.N) print 'MSE: ', np.linalg.norm(np.array(S)-np.array(Svals),2) proctime = time.time() - self.prevtime print 'Elapsed time: %f seconds' % proctime else: self.prevtime = time.time() self.perform_svd += 1 self.counter += 1 self.send()
def receive(self, src, msg): m = DecodedMsg(msg.dataGet()) self.counter = m.get_counter() timeformat = '%Y/%d/%m %H:%M:%S' print 'Received message %s: counter: %d' % (time.strftime(timeformat), self.counter) if m.get_perform_svd() == self.N: #print ' svd received:' Svals = m.get_A() print 'Rx svd: ', Svals U, S, V = np.linalg.svd(self.A) #S = [s**2 for s in S] #print ' svd check:' print 'PC svd: ', S self.perform_svd = 0 self.A = make_A_matrix(self.N) print 'MSE: ', np.linalg.norm(np.array(S) - np.array(Svals), 2) proctime = time.time() - self.prevtime print 'Elapsed time: %f seconds' % proctime else: self.prevtime = time.time() self.perform_svd += 1 self.counter += 1 self.send()