Rice University logo
 
Top blue bar image
 

Archive for January, 2011


Some tricks for numerical simulations in MATLAB

January 25th, 2011 by wy1

Numerical experiments are often used to validate ideas, evaluate algorithms, and compare different approaches on a set of problems. They take time to complete and can be very tiring and even boring sometimes. The post collects tricks that may help make your experience of numerical experiments faster, more productive, and hopefully more fun.

 

  1. Generate unique file names in mass numerical simulations [download m-file]

    % Usage:
    %   filename = gen_filename(base_name, varargin)
    %   where varargin can be ‘hostname’, ‘date’, ‘datetime’,suffix
    %
    % Example:
    %   call
    %     filename = gen_filename(mfilename,’hostname’,’datetime’,’mat’);
    %   in foo.m on PC “yind20” at 23:42:25 on Jan 24, 2011 gives
    %     filename = ‘foo_yind20_20110124T234225.mat’
    %
    % Note: mfilename returns the name of the current m-file.

  2. A template for repeated numerical experiments. [download m-file]
    function simulation_xxx()
    
    %% generate data file's name
    datafile = gen_filename(mfilename,'hostname','datetime','mat');
    [~,host] = system('hostname'); host = host(1:end-1); % get hostname
    
    %% testset's parameters
    par.set1 = 1:2:10;
    par.set2 = 0:0.1:0.5;
    par.nrep = 100;
    
    set1_len = length(par.set1);
    set2_len = length(par.set2);
    
    %% initialize rand gen's seed
    par.seed = 2010; % use fixed seed
    % par.seed = sum(100*clock); % use clock seed
    if isfield(par,'seed')
       fprintf('Seed = %d\n',par.seed);
       RandStream.setDefaultStream(RandStream('mt19937ar','seed',par.seed));
    end
    
    %% generate stationary part of the data
    data.st = generate_st_data( parameters );
    
    %% initialize arrays to save test statistics
    data.resu = cell (set1_len,set2_len,par.nrep);  % store test output, if not too large
    data.psnr = zeros(set1_len,set2_len,par.nrep);  % record PSNRs
    data.mser = zeros(set1_len,set2_len,par.nrep);  % record mean square error
    data.time = zeros(set1_len,set2_len,par.nrep);  % record time
    data.rand = cell (set1_len,set2_len);           % record rand state
    
    %% main iterations
    for ii = 1:set1_len
        par1 = par.set1(ii);
    
        for jj = 1:set2_len
            par2 = par.set2(jj);
    
            data.rand{ii,jj} = get(RandStream.getDefaultStream,'state');
    
            for rep = 1:par.nrep
    
                %% generate complete data
                thisdata = generate_data(data.st, par1, par2);
    
                %% call solver
                tic;
                resu = solver(thisdata,par1,par2);
                data.time(ii,jj,rep) = toc;
    
                %% save and analyze result
                data.resu{ii,jj,rep} = resu; % store test output, if not too large
                [psnr, mser] = analysis(thisdata, resu);
                data.psnr(ii,jj,rep) = psnr;
                data.mser(ii,jj,rep) = mser;
            end
    
            fprintf('%s par1:%4.2f par2:%4.2f avg.psnr:%4.2f avg.mser:%4.2e\n',...
                     host, par1, par2, mean(data.psnr(ii,jj,:)),...
                     mean(data.mser(ii,jj,:)));
            save(datafile,'par','data','ii','jj');
        end
    end
    
    end % function
  3. Obtain the folder of the current m-file in use:
    fileparts(mfilename('fullpath'));

    Example: add subfolder “utilities” to search path

    addpath([fileparts(mfilename('fullpath')) '/utilities']);

Recent updates on Matlab’s random generator

Initializing the Generator with an Integer Seed

 

Initializing the Generator with a State Vector

Introduction and Overview of Topics I

January 17th, 2011 by wd5

Wotao Yin: Optimization with Normalization and Orthogonality Constraints. (Slides)

Nabor Reyna: GPU Computation. (Slides)

Xin Liu: Limited Memory Block Subspace Acceleration for Computing Dominant Singular Values and Vectors. (Slides)

Jorge Castanon: Slides.

Wei Deng: Efficient Optimization Algorithms for Reconstructing Signals with Joint or Group Sparsity. (Slides)

Chengbo Li: Hyperspectral Data Unmixing Using Comressed Sensing Techniques. (Slides)

Yingying Li: 1. Multi-spectral Data to Classification. (Paper)
2. OFDM Channel Estimation using Compressive Sensing. (Paper)

Sparse Approximation Property in Compressive Sampling by Qiyu Sun

January 1st, 2011 by wd5

Abstract:  The null space property and the restricted isometry property  for a  measurement matrix are two basic properties in compressive sampling, and are closely related to the sparse approximation. In this talk,  we introduce the  sparse approximation property  for a measurement matrix,  a weaker version of the restricted isometry property and a stronger version of the null space property. We show that the sparse approximation property  for a measurement matrix could be an appropriate condition to consider stable recovery of any compressible signal from its noisy measurements.

2-4pm, 01/19/2011 in Duncan Hall 3076