def benchfig(): from jfig.utils import Array # several array utilities from jfig.utils import MHG # the plot functions from jfig.utils import SetupManager # the plot functions from jarray import array m = MHG() # initalize the plot library, resfile = file("/home/kostas/jylabtester/mtjbench","r") res = resfile.readlines() for i in range(len(res)): res[i] = float(res[i].split("\n")[0]) mtjres = array(res,'d') resfile = file("/home/kostas/jylabtester/javabench","r") res = resfile.readlines() for i in range(len(res)): res[i] = float(res[i].split("\n")[0]) javares = array(res,'d') resfile = file("/home/kostas/jylabtester/jlapackbench","r") res = resfile.readlines() for i in range(len(res)): res[i] = float(res[i].split("\n")[0]) jlres = array(res,'d') resfile = file("/home/kostas/jylabtester/nativebench","r") res = resfile.readlines() for i in range(len(res)): res[i] = float(res[i].split("\n")[0]) natres = array(res,'d') resfile = file("/home/kostas/jylabtester/matlabbench","r") res = resfile.readlines() for i in range(len(res)): res[i] = float(res[i].split("\n")[0]) matres = array(res,'d') x = [] for i in range(1,51): x.append(i*10) x = array(x,'d') SetupManager.getInteger( "jfig.utils.MHG.defaultWindowWidth", 1000 ) SetupManager.getInteger( "jfig.utils.MHG.defaultWindowHeight", 500 ) m.figure(); # new plot window m.gca().autoscaleTight( x, natres ) # default scaling m.plot( x, natres, '-b' ) # solid-blue-line plot m.plot( x, mtjres, '-.r' ) # solid-blue-line plot m.plot( x, matres, '-g' ) # solid-blue-line plot m.plot( x, javares, '-k' ) # solid-blue-line plot m.plot( x, jlres, '-m' ) # solid-blue-line plot m.text( 30 , 4150, 'Εκτέλεση του Πολ/σμού C = a*A*B + b*C ', "color=black fontsize=18" ) m.xlabel( 'Μέγεθος Πίνακα' ) # x-axis label m.ylabel( 'MegaFlops' ) # y-axis label m.text( 510, 3700, "--- Jylab JNI Blas", "color=red fontsize=18" ); m.text( 510, 3400, "--- Blas", "color=blue fontsize=18" ); m.text( 510, 3100, "--- Matlab", "color=green fontsize=18" ); m.text( 510, 2800, "--- Pure Java", "color=black fontsize=18" ); m.text( 510, 2500, "--- JLapack", "color=magenta fontsize=18" ); m.plotCartesianAxes() # axes m.plotGrid() # grid #m.doZoomFit() from java.io import File m.save( File( '/home/kostas/jylabtester/plot3.fig' )) # save figure
def jfigtest(): from jfig.utils import Array # several array utilities from jfig.utils import MHG # the plot functions m = MHG() # initalize the plot library, # reference via variab N = 200 x = Array.linspace(0,10,N) # 200 values (0.0 .. 10.0) y = Array.cos(x) # vector with cos(x) z = Array.random(N) # 200 random values, range [0,1] z = Array.add( z, -0.3 ) # shift to range [-0.3, 0.7] m.figure(); # new plot window m.gca().autoscaleTight( x, y ) # default scaling m.plot( x, y, '-b' ) # solid-blue-line plot m.plot( x, z, '.r' ) # red-dot markers m.xlabel( 'x' ) # x-axis label m.ylabel( 'sin(x), random data' ) # y-axis label m.plotCartesianAxes() # axes m.plotGrid() # grid m.doZoomFit() from java.io import File m.save( File( 'plot1.fig' )) # save figure