def objective(val, Pyx=Pyx, x=x, y=y, nx=nx, ny=ny): global C_equal, C_equal_bounds xmin, xmax, ymin, ymax = val xinputs = linspace(xmin, xmax, nx) ydividers = linspace(ymin, ymax, ny+1) ydividers = ydividers[1:-1] Pyx_sub, x_sub, y_sub = blahut.quantize(Pyx, x, y, xinputs, ydividers) C, Px = blahut.blahut_arimoto(Pyx_sub, tolerance=1e-7, iterations = 100) if C > C_equal[ix, iy]: C_equal[ix, iy] = C C_equal_bounds[ix, iy, :] = (xmin, xmax, ymin, ymax) data = dict(C_equal=C_equal, C_equal_bounds=C_equal_bounds) savez('./../npz/C_equal_optimized.npz', data=data) print '\nC:', C print 'nx:', nx, xmin, xmax print 'ny:', ny, ymin, ymax return -C
def objective(val, Pyx=Pyx, x=x, y=y, nx=nx, ny=ny): global C_nonequal, x_in, y_out, Px_in xinputs = val[0:nx] ydividers = val[nx:] xinputs.sort() ydividers.sort() Pyx_sub, x_sub, y_sub = blahut.quantize(Pyx, x, y, xinputs, ydividers) C, Px = blahut.blahut_arimoto(Pyx_sub, tolerance=1e-7, iterations = 1000) if C > C_nonequal[ix, iy]: C_nonequal[ix, iy] = C x_in[ix][iy] = xinputs y_out[ix][iy] = ydividers Px_in[ix][iy] = Px data = dict(C_nonequal=C_nonequal, x_in = x_in, y_out = y_out, Px_in = Px_in) savez('./../npz/C_nonequal_optimized.npz', data=data) print '\nC:', C print 'x:', nx, xinputs print 'y:', ny, ydividers return -C
def objective(val, Pyx=Pyx, x=x, y=y, idx=idx): xinputs = val xinputs.sort() Pyx_sub, x_sub, y_sub = blahut.quantize(Pyx, x, y, xinputs, ydividers=None) C, Px = blahut.blahut_arimoto(Pyx_sub, tolerance=1e-4, iterations = 100) result = {'C_in':C, 'Px_in':Px, 'x_in':xinputs} helpers.add_to_database( result=result, index=idx, goal=('C_in', 'max'), filename=filename ) print '\nC:', C print 'x_in:', xinputs print 'idx:', idx return -C
Pyx, x, y = blahut.Q(V, R, nx=2000, ny=2000) #============================================================================== # %% Calculate Constrained Capacity #============================================================================== f = load('./../data/transistorFD12.npz') Vg = f['Vg'] I = f['Isd'].T[-1] I_spline = interpolate.UnivariateSpline(Vg, I) Ix = I_spline(x) Vsd = 4 t_reset = 300e-9 #seconds energy = (Ix * Vsd * t_reset * 1e12) / 2 #pJ #s go from 1e-2 to 1 n = 10 s_list = logspace(-4, -1, n) func = lambda s: blahut.blahut_arimoto(Pyx=Pyx, tolerance=1e-3, iterations=10, e=energy, s=s, debug=True) iters = [('s', s_list)] outs = ['C','Px', 'E'] res = helpers.loop(func, iters, outs, savefile='./../npz/Cenergy_loop.npz')
#============================================================================== #%% Load and preformat the data #Derive 2-D Density with Linear Interpolation of Gaussian KDE #============================================================================== data = load('./../data/IEDM2014_PCM_Partial_Reset.npz') helpers.dict2global(data) Pyx, x, y = blahut.Q(V, R, nx=2000, ny=2000) #============================================================================== # %% Calculate Constrained Capacity #============================================================================== f = load('./../data/transistorFD12.npz') Vg = f['Vg'] I = f['Isd'].T[-1] I_spline = interpolate.UnivariateSpline(Vg, I) Ix = I_spline(x) Vsd = 4 t_reset = 300e-9 #seconds energy = (Ix * Vsd * t_reset * 1e12) / 2 #pJ #s go from 1e-2 to 1 n = 10 s_list = logspace(-4, -1, n) func = lambda s: blahut.blahut_arimoto( Pyx=Pyx, tolerance=1e-3, iterations=10, e=energy, s=s, debug=True) iters = [('s', s_list)] outs = ['C', 'Px', 'E'] res = helpers.loop(func, iters, outs, savefile='./../npz/Cenergy_loop.npz')