UBC Home Page -
UBC Home Page -
UBC Home Page UBC Home Page -
-
-
News Events Directories Search UBC myUBC Login
-
- -
Main»Examples

Examples

Examples

ex1

This example illustrates the use of the generateProblem function and access to the fields in the problem structure:

 >> P = generateProblem(6);

The fields accessed in this example include

  • P.A, the operator that transforms the sparse coefficient vector into the observed signal
  • P.b, the observed signal
  • P.sizaA, gives the size of operator P.A. This information can also be obtained using opsize(P.A).
  • P.x0, this vector, available for certain problems, gives the ideal or desired result for sparse recovery.
  • P.reconstruct, this function applies the sparsity basis operator to the given coefficient vector and resizes the output to the default dimensions.

The example further illustrates the use of the classOp constructor function that turns an operator into a class, which makes the operator look like a general Matlab matrix.

exOp

This example illustrates the use of Sparco operators by constructing a signal that is sparse in the Haar basis, and measured using a randomly restricted DCT:

 >> p = randperm(n);
 >> M = opFoG(opRestriction(n,p(1:m)), opDCT(n));
 >> B = opHaar(n);
 >> A = opFoG(M,B);

It then uses the SPGL1 solver to recover the sparse coefficients from the compressed measurements. It also illustrates the use of the dottest function which checks if \langle Ax,y\rangle = \langle x,A^*y\rangle for a series of random vectors x and y. This function is very helpful when developing new operators.

exGPSR

This example generates a test problem and shows two ways of invoking GPSR to solve the sparse reconstruction problem. The first way provides GPSR with functions for evaluation A and A^*, the second way uses classOp to provide a matrix-like operator.

exSPGL1

This example examines the angiogram problem (502) and show the exact and observed Fourier coefficients based on the operators provided in P.op. It then applies SPGL1 to solve the complex recovery problem.

exSeismic

In this example, techniques from compressed sensing are applied to recover missing traces in seismic data. Instead of instantiating problem 901 it constructs all operators and data in a way that is very similar to the existing test problem. This illustrates how easy it is to implement different problems using Sparco.

exSheppLogan

This example generates different slices of the full 3D Shepp-Logan model which is implemented in Sparco's ellipsoids function.

exTV

In this example a total variation based solver is used to reconstruct the angiogram in problem 502 from its compressed measurements. It shows how the opDifference operator can be used to simplify computation.