#NEWLINE# def SolveForZ( self ) : #NEWLINE# #INDENT# 'Solve for z in (alpha + beta.wd.wd^T)z = wd . x + alpha z_est - gamma exactly.\n\n    Output goes in z. temp is a matrix to store wd^Twd.\n    ' #NEWLINE# input_layer = self . input_layer #NEWLINE# code_layer = self . code_layer #NEWLINE# z = code_layer . state #NEWLINE# wd = self . decoder . params [ 'weight' ] #NEWLINE# hyp = code_layer . hyperparams #NEWLINE# alpha = hyp . sc_alpha #NEWLINE# beta = hyp . sc_beta #NEWLINE# gamma = hyp . sc_gamma #NEWLINE# temp = code_layer . m_by_m #NEWLINE# temp2 = code_layer . deriv #NEWLINE# eye_m_by_m = code_layer . eye_m_by_m #NEWLINE# cm . dot ( wd , wd . T , target = temp ) #NEWLINE# temp . mult ( beta ) #NEWLINE# temp . add ( alpha ) #NEWLINE# z_est . mult ( alpha , target = temp2 ) #NEWLINE# temp2 . add_dot ( hyp , x , mult = beta ) #NEWLINE# temp2 . subtract ( gamma ) #NEWLINE# A = temp . asarray ( ) #NEWLINE# B = temp2 . asarray ( ) #NEWLINE# Z = scipy . linalg . solve ( A , B , overwrite_a = True , overwrite_b = True ) #NEWLINE# z . overwrite ( Z )