changeset 25:dd0e78b5bb13

Added .squeeze() in GAP function to avoid strange error in numpy.delete(), which wasn't raised on my laptop but was raised on octave
author nikcleju
date Wed, 09 Nov 2011 00:55:45 +0000
parents c07440417bd8
children f0f77d92e0c1
files pyCSalgos/GAP/GAP.py scripts/ABSapprox.py
diffstat 2 files changed, 10 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/pyCSalgos/GAP/GAP.py	Wed Nov 09 00:15:57 2011 +0000
+++ b/pyCSalgos/GAP/GAP.py	Wed Nov 09 00:55:45 2011 +0000
@@ -412,7 +412,8 @@
 
       xinit = xhat.copy()
       #Lambdahat[to_be_removed] = []
-      Lambdahat = np.delete(Lambdahat, to_be_removed)
+      # TODO: find what why squeeze() is needed here!!
+      Lambdahat = np.delete(Lambdahat.squeeze(),to_be_removed)
   
       #n = sqrt(d);
       #figure(9);
--- a/scripts/ABSapprox.py	Wed Nov 09 00:15:57 2011 +0000
+++ b/scripts/ABSapprox.py	Wed Nov 09 00:55:45 2011 +0000
@@ -8,8 +8,8 @@
 import numpy as np
 import scipy.io
 import math
-import matplotlib.pyplot as plt
-import matplotlib.cm as cm
+#import matplotlib.pyplot as plt
+#import matplotlib.cm as cm
 import pyCSalgos
 import pyCSalgos.GAP.GAP
 import pyCSalgos.SL0.SL0_approx
@@ -55,21 +55,22 @@
   nalgosL = len(algosL)
   
   #Set up experiment parameters
-  d = 50;
+  d = 50.0;
   sigma = 2.0
   deltas = np.arange(0.05,0.95,0.05)
   rhos = np.arange(0.05,0.95,0.05)
-  #deltas = np.array([0.05,0.95])
-  #rhos = np.array([0.05,0.95])
+  #deltas = np.array([0.15,0.95])
+  #rhos = np.array([0.15,0.95])
   #deltas = np.array([0.05])
   #rhos = np.array([0.05])
   #delta = 0.8;
   #rho   = 0.15;
-  numvects = 100; # Number of vectors to generate
+  numvects = 20; # Number of vectors to generate
   SNRdb = 20.;    # This is norm(signal)/norm(noise), so power, not energy
   # Values for lambda
   #lambdas = [0 10.^linspace(-5, 4, 10)];
-  lambdas = np.concatenate((np.array([0]), 10**np.linspace(-5, 4, 10)))
+  #lambdas = np.concatenate((np.array([0]), 10**np.linspace(-5, 4, 10)))
+  lambdas = np.array([0., 0.0001, 0.01, 1, 100, 10000])
 
   meanmatrix = dict()
   for i,algo in zip(np.arange(nalgosN),algosN):