# HG changeset patch # User Jordi GutiƩrrez Hermoso # Date 1463607825 14400 # Node ID 1aa38f4846e022cdbd04d6753573e659ce115705 # Parent 916349600c4b0e6c8abf1da00c14f9cb499f4a5e showalgo: show the rank diff --git a/talk/code/show_mc.py b/talk/code/show_mc.py --- a/talk/code/show_mc.py +++ b/talk/code/show_mc.py @@ -95,6 +95,7 @@ RemFile = open("remaining", "w") Ptotfile = open("Ptotal", "w") Qtotfile = open("Qtotal", "w") + medc_idxfile = open("medc_idx", "w") jackpot = open("jackpot", "w") # FIXME: Figure out what to do about NaNs. @@ -166,6 +167,7 @@ Ltot = 0 Rtot = n_minus*n_plus medc_idx = Rtot//2 + medc_idxfile.write("%s\n" % medc_idx) Lfile.write("%s\n" % L) Rfile.write("%s\n" % R) @@ -259,7 +261,7 @@ def main(): - data = np.random.uniform(size=18) + data = np.random.uniform(size=26) mc = medcouple_1d(data) with open("mc", "w") as f: diff --git a/talk/code/showalgo.m b/talk/code/showalgo.m --- a/talk/code/showalgo.m +++ b/talk/code/showalgo.m @@ -9,6 +9,7 @@ mc = load("mc"); jackpot = load("jackpot"); Am = load("Am"); +medc_idx = load("medc_idx"); Am(end+1) = mc; colidx = 1:columns(H); @@ -18,7 +19,7 @@ for iter = 1:length(Am) ## Reset the image imgH = origH; - + ## Make greater-than red red = imgH(:,:,1); red(colidx < L(iter, :)') = 1; @@ -29,6 +30,7 @@ blue(colidx > R(iter, :)') = 1; imgH(:, :, 3) = blue; + printf("Remaining: %d\n", remaining(iter)) imshow(imgH); pause @@ -54,7 +56,7 @@ ## Brighten blue blue(idx) = 1; - + ## Dim red and green red(idx) .*= 0.5; green(idx) .*= 0.5; @@ -66,7 +68,7 @@ [i,j] = find(Am(iter) == H); imgH(i,j,1) = imgH(i,j,2) = 1; imgH(i,j,3) = 0; - + imshow(imgLeft); pause @@ -80,7 +82,7 @@ ## Brighten red blue(idx) = 1; - + ## Dim blue and green blue(idx) .*= 0.5; green(idx) .*= 0.5; @@ -92,7 +94,9 @@ [i,j] = find(Am(iter) == H); imgH(i,j,1) = imgH(i,j,2) = 1; imgH(i,j,3) = 0; - + + printf("rank is between %d and %d (target: %d)\n", + Ptot(iter), Qtot(iter), medc_idx) imshow(imgRight); pause