Skip to content

Commit

Permalink
Wrote spothelpbrowser.m script to take matlab published examples from…
Browse files Browse the repository at this point in the history
… spotdoc and format them for the help browser
  • Loading branch information
FrancesKR committed Jul 13, 2012
1 parent 03b54dc commit c6a56ed
Show file tree
Hide file tree
Showing 48 changed files with 218 additions and 115 deletions.
10 changes: 6 additions & 4 deletions doc/guide_circulant.m → doc/docguide_circulant.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
%% Building a Circulant Operator
%% Building a circulant operator
% In our first example we will use Spot to create an implicit
% circulant matrix and that can be used as a fast operator. Circulant
% matrices are fully specified by their first column, and each
Expand Down Expand Up @@ -29,7 +29,8 @@
c = (1:n)'; % make sure c is a column vector

%%
% Our very first Spot command will create the required DFT operator.
% Our very first Spot command will create the required
% <http://www.cs.ubc.ca/labs/scl/spot/operators.html#opDFT DFT operator>.
% We omit the semicolon so that Matlab will display details of the
% resulting operator:

Expand Down Expand Up @@ -60,8 +61,8 @@
C = real( F'*opDiag(d)*F )

%%
% We could have left out the |real| modifier, and used the simpler
% command
% We could have left out the <matlab:doc('opSpot/real') real>
% modifier, and used the simpler command
%
% C = F'*opDiag(d)*F
%
Expand Down Expand Up @@ -111,3 +112,4 @@
% simultaneously to a collection of vectors:

C*eye(n)

11 changes: 6 additions & 5 deletions doc/guide_containers.m → doc/docguide_containers.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
%% Using Spot Containers
%% Using Spot containers
% Spot provides a set of "wrappers" that can be used to integrate
% external opertors with Spot utilities.

Expand All @@ -15,7 +15,7 @@

%%
% In order to make this function available as a Spot operator, we wrap it
% using <matlab:doc('opFunction') opFunction>:
% using <http://www.cs.ubc.ca/labs/scl/spot/operators.html\#opFunction/ |opFunction|>:

n = 5; m = 5;
A = opFunction(n,m,@heaviside);
Expand Down Expand Up @@ -43,9 +43,10 @@

%%
% Though in this special case, we might have as well used the Spot operator
% <matlab:doc('opDiag') opDiag> instead of the more general (and in this
% case, cumbersome) <matlab:doc('opMatrix') opMatrix>(diag(1:m)).
% <http://www.cs.ubc.ca/labs/scl/spot/operators.html\#opDiag/ |opDiag|> instead of the more general (and in this
% case, cumbersome) <http://www.cs.ubc.ca/labs/scl/spot/operators.html\#opMatrix/ |opMatrix|>|(diag(1:m))|.

%% Class containers
% Finally, the <matlab:doc('opClass') opClass> container can be used to encapsulate
% Finally, the <http://www.cs.ubc.ca/labs/scl/spot/operators.html\#opClass/ |opClass|> container can be used to encapsulate
% objects defined by external toolboxes.

8 changes: 4 additions & 4 deletions doc/guide_convolution.m → doc/docguide_convolution.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
%% Blurring and Deblurring an Image with opConvolve
%% Blurring and deblurring with opConvolve
% The convolution operator is often used in signal processing as a
% technique for filtering and noise removal. In image processing, for
% example, convolution can be used to blur images or remove noise. First, a
Expand All @@ -21,7 +21,7 @@
%
% |opConvolve(M,N,KERNEL,OFFSET,MODE)|
%
% This example will demonstrate how to blur an image using opConvolve and
% This example will demonstrate how to blur an image using |opConvolve| and
% two different types of kernel. We will then deblur it using the same operator.

%% Using a Uniform Kernel
Expand Down Expand Up @@ -75,7 +75,7 @@
A = opConvolve(m, n, K, center, 'truncated');

%%
% The third argument to this psfGaussian function determines the standard deviation of
% The third argument to this |psfGaussian| function determines the standard deviation of
% the Gaussian distribution, or how quickly the values diminish to zero.
% Therefore, using a larger standard deviation will make a "larger" kernel,
% and cause more blur. Compare the distribution we've used (first image) to
Expand Down Expand Up @@ -177,4 +177,4 @@
%%
% This means that when you create your convolution operator with |A =
% Finv*S*F|, where |S| is some scaling operator, the same efficient |F'| operation
% will be used whether you write |inv(F)*S*F|, |F'*S*F|, or |F\S*F|.
% will be used whether you write |inv(F)*S*F|, |F'*S*F|, or |F\S*F|.
38 changes: 21 additions & 17 deletions doc/guide_quick.m → doc/docguide_quick.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
%% A Quick Guide to Spot
%% A quick guide to Spot
% Using explicit matrices is not practical for some very large problems.
% Instead, we can use Spot operators. A Spot operator represents a matrix,
% and can be treated in a similar way, but it doesn't rely on the matrix
Expand All @@ -15,8 +15,8 @@
%%
% We see that Spot displays some information about A when we leave off the
% semicolon, such as its construction, the number of rows and columns, and
% whether it is complex. We can also use the <matlab:doc('opSpot/double') double> method to construct the
% underlying matrix:
% whether it is complex. We can also use the <matlab:doc('opSpot/double') double>
% method to construct the underlying matrix:

double(A)

Expand All @@ -31,8 +31,10 @@
%%
% If you add a matrix and an operator, Spot will first automatically
% convert the matrix into a Spot operator using opMatrix. We can discover
% other information about the operator C by using the methods <matlab:doc('opSpot/size') size>,
% <matlab:doc('opSpot/disp') disp>, and <matlab:doc('opSpot/whos') whos>:
% other information about the operator C by using the methods
% <matlab:doc('opSpot/size') size>,
% <matlab:doc('opSpot/disp') disp>,
% and <matlab:doc('opSpot/whos') whos>:

whos C

Expand Down Expand Up @@ -80,9 +82,9 @@

%% Creating More Complex Operators
% Spot operators can be combined into more complex operators using methods
% such as <matlab:doc('opSpot/blkdiag') blkdiag> and <matlab:doc('opSpot/kron') kron>.
% Whenever a matrix is passed to one of these
% methods, it is automatically converted to a Spot operator. blkdiag takes
% such as blkdiag and kron. Whenever a matrix is passed to one of these
% methods, it is automatically converted to a Spot operator.
% <matlab:doc('opSpot/blkdiag') blkdiag> takes
% a list of operators and matrices and creates a block diagonal operator:

A = opOnes(2,2);
Expand All @@ -93,18 +95,17 @@

%%
% We can also have the blocks overlap and create anti-diagonal operators
% (see <usingmethods.html "Using methods on operators">). Operators can be horizontally or
% vertically concatenated using <matlab:doc('opDictionary') opDictionary>
% or <matlab:doc('opStack') opStack>, or simply by passing them as elements
% in a matrix:
% (see <usingmethods.html "Using the Methods">).
% Operators can be horizontally or vertically concatenated using
% opDictionary or opStack, or simply by passing them as elements in a matrix:

E = 4*opOnes(2,3);
F = [A E];
double(F)

%%
% The <matlab:doc('opSpot/kron') kron> method computes the Kronecker product of an arbitrary number of
% operators:
% The <matlab:doc('opSpot/kron') kron> method
% computes the Kronecker product of an arbitrary number of operators:

G = opMatrix([2 1;3 0]);
H = opMatrix([1 2]);
Expand All @@ -113,6 +114,9 @@

%%
% For more information on how to work with Spot operators, see
% <usingmethods.html "Using methods on operators">. For a list of the Spot operator classes and
% what they do, including fast transformations, random ensembles, and
% convolution, see the <spotoperators.html "Operators">.
% <usingmethods.html "Using the Methods">.
% For a list of methods, see the <http://www.cs.ubc.ca/labs/scl/spot/methods.html "Index of Methods">.
% For a list of the Spot operator classes and what they do, including fast
% transformations, random ensembles, and convolution, see the
% <http://www.cs.ubc.ca/labs/scl/spot/operators.html "Index of Operators">.

5 changes: 3 additions & 2 deletions doc/guide_sparserecovery.m → doc/docguide_sparserecovery.m
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@
m = 120;

%%
% Instead of an explicit matrix, we can use a Spot opGaussian operator.
% Instead of an explicit matrix, we can use a Spot
% <http://www.cs.ubc.ca/labs/scl/spot/operators.html#opGaussian |opGuassian|> operator.
% Using mode 3 of opGaussian creates an implicit Gaussian matrix with
% unit-norm columns (EXPLAIN). This
% means that the columns of the matrix are generated as the operator is
Expand Down Expand Up @@ -119,4 +120,4 @@

%%
% The signal and reconstruction overlap almost completely, so our
% reconstruction is accurate.
% reconstruction is accurate.
2 changes: 1 addition & 1 deletion doc/examples.m
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
% * <guide_circulant.html Building a circulant operator>
% * <guide_containers.html Using Spot containers>
% * <guide_convolution.html Blurring and deblurring with opConvolve>
% * <guide_sparserecovery.html Sparse Recovery>
% * <guide_sparserecovery.html Sparse recovery>
10 changes: 5 additions & 5 deletions doc/helptoc.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<toc version="1.0">

<tocitem target="html/spot_main_page.html">Spot Linear Operator Toolbox
<tocitem target="html/guide_quick.html"
<tocitem target="html/docguide_quick.html"
image="HelpIcon.GETTING_STARTED">
A quick guide to Spot
</tocitem>
Expand Down Expand Up @@ -39,16 +39,16 @@
<tocitem target="html/examples.html"
image="HelpIcon.EXAMPLES">
Examples
<tocitem target="html/guide_circulant.html">
<tocitem target="html/docguide_circulant.html">
Building a circulant operator
</tocitem>
<tocitem target="html/guide_containers.html">
<tocitem target="html/docguide_containers.html">
Using Spot containers
</tocitem>
<tocitem target="html/guide_convolution.html">
<tocitem target="html/docguide_convolution.html">
Blurring and deblurring with opConvolve
</tocitem>
<tocitem target="html/guide_sparserecovery.html">
<tocitem target="html/docguide_sparserecovery.html">
Sparse Recovery
</tocitem>
</tocitem>
Expand Down
18 changes: 10 additions & 8 deletions doc/html/guide_circulant.html → doc/html/docguide_circulant.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<!--
This HTML was auto-generated from MATLAB code.
To make changes, update the MATLAB code and republish this document.
--><title>Building a Circulant Operator</title><meta name="generator" content="MATLAB 7.12"><link rel="schema.DC" href="http://purl.org/dc/elements/1.1/"><meta name="DC.date" content="2012-07-10"><meta name="DC.source" content="guide_circulant.m"><style type="text/css">
--><title>Building a circulant operator</title><meta name="generator" content="MATLAB 7.12"><link rel="schema.DC" href="http://purl.org/dc/elements/1.1/"><meta name="DC.date" content="2012-07-12"><meta name="DC.source" content="docguide_circulant.m"><style type="text/css">

body {
background-color: white;
Expand Down Expand Up @@ -62,9 +62,9 @@
color: gray;
}

</style></head><body><div class="content"><h1>Building a Circulant Operator</h1><!--introduction--><p>In our first example we will use Spot to create an implicit circulant matrix and that can be used as a fast operator. Circulant matrices are fully specified by their first column, and each remaining column is a cyclic permutation of the first:</p><p><img src="guide_circulant_eq08112.png" alt="$$&#xA;C = \pmatrix{&#xA; c_1 &amp; c_{n} &amp; \ldots &amp; c_2&#xA; \cr c_2 &amp; c_1 &amp; \ldots &amp; \vdots&#xA; \cr \vdots&amp; \ddots &amp; \ddots &amp; c_n&#xA; \cr c_n &amp; \ldots &amp; c_2 &amp; c_1&#xA; }.&#xA;$$"></p><p>These matrices have the property that they can be diagonalized by the discrete Fourier transform (DFT), so that</p><pre> C = F'diag(d)F,</pre><p>where d = Fc. An important implication is that <tt>C</tt> can be treated as a fast operator.</p><!--/introduction--><h2>Contents</h2><div><ul><li><a href="#1">Instantiating a simple Spot operator</a></li><li><a href="#6">Building more complex operators</a></li></ul></div><h2>Instantiating a simple Spot operator<a name="1"></a></h2><p>In our toy example, we create a circulant matrix whose first column is simply the sequence 1,...,5:</p><pre class="codeinput">n = 5;
</style></head><body><div class="content"><h1>Building a circulant operator</h1><!--introduction--><p>In our first example we will use Spot to create an implicit circulant matrix and that can be used as a fast operator. Circulant matrices are fully specified by their first column, and each remaining column is a cyclic permutation of the first:</p><p><img src="docguide_circulant_eq08112.png" alt="$$&#xA;C = \pmatrix{&#xA; c_1 &amp; c_{n} &amp; \ldots &amp; c_2&#xA; \cr c_2 &amp; c_1 &amp; \ldots &amp; \vdots&#xA; \cr \vdots&amp; \ddots &amp; \ddots &amp; c_n&#xA; \cr c_n &amp; \ldots &amp; c_2 &amp; c_1&#xA; }.&#xA;$$"></p><p>These matrices have the property that they can be diagonalized by the discrete Fourier transform (DFT), so that</p><pre> C = F'diag(d)F,</pre><p>where d = Fc. An important implication is that <tt>C</tt> can be treated as a fast operator.</p><!--/introduction--><h2>Contents</h2><div><ul><li><a href="#1">Instantiating a simple Spot operator</a></li><li><a href="#6">Building more complex operators</a></li></ul></div><h2>Instantiating a simple Spot operator<a name="1"></a></h2><p>In our toy example, we create a circulant matrix whose first column is simply the sequence 1,...,5:</p><pre class="codeinput">n = 5;
c = (1:n)'; <span class="comment">% make sure c is a column vector</span>
</pre><p>Our very first Spot command will create the required DFT operator. We omit the semicolon so that Matlab will display details of the resulting operator:</p><pre class="codeinput">F = opDFT(n)
</pre><p>Our very first Spot command will create the required <a href="http://www.cs.ubc.ca/labs/scl/spot/operators.html#opDFT">DFT operator</a>. We omit the semicolon so that Matlab will display details of the resulting operator:</p><pre class="codeinput">F = opDFT(n)
</pre><pre class="codeoutput">F =
Spot operator: DFT(5,5)
rows: 5 complex: yes
Expand Down Expand Up @@ -94,7 +94,7 @@
Spot operator: Real(DFT(5,5)' * Diag(5,5) * DFT(5,5))
rows: 5 complex: no
cols: 5 type: real
</pre><p>We could have left out the <tt>real</tt> modifier, and used the simpler command</p><pre> C = F'*opDiag(d)*F</pre><p>However, we need to safeguard against numerical errors that might allow complex values to seep in. Hence, we finish off our construction with the <tt>real</tt> operator.</p><p>Just as the DFT operator <tt>F</tt> could be applied to vectors, the same is true of the compound operator <tt>C</tt>. Here we apply it to the first unit vector:</p><pre class="codeinput">e = eye(5,1);
</pre><p>We could have left out the <a href="matlab:doc('opSpot/real')">real</a> modifier, and used the simpler command</p><pre> C = F'*opDiag(d)*F</pre><p>However, we need to safeguard against numerical errors that might allow complex values to seep in. Hence, we finish off our construction with the <tt>real</tt> operator.</p><p>Just as the DFT operator <tt>F</tt> could be applied to vectors, the same is true of the compound operator <tt>C</tt>. Here we apply it to the first unit vector:</p><pre class="codeinput">e = eye(5,1);
C*e
</pre><pre class="codeoutput">
ans =
Expand Down Expand Up @@ -140,7 +140,7 @@
</pre><p class="footer"><br>
Published with MATLAB&reg; 7.12<br></p></div><!--
##### SOURCE BEGIN #####
%% Building a Circulant Operator
%% Building a circulant operator
% In our first example we will use Spot to create an implicit
% circulant matrix and that can be used as a fast operator. Circulant
% matrices are fully specified by their first column, and each
Expand Down Expand Up @@ -171,7 +171,8 @@
c = (1:n)'; % make sure c is a column vector
%%
% Our very first Spot command will create the required DFT operator.
% Our very first Spot command will create the required
% <http://www.cs.ubc.ca/labs/scl/spot/operators.html#opDFT DFT operator>.
% We omit the semicolon so that Matlab will display details of the
% resulting operator:
Expand Down Expand Up @@ -202,8 +203,8 @@
C = real( F'*opDiag(d)*F )
%%
% We could have left out the |real| modifier, and used the simpler
% command
% We could have left out the <matlab:doc('opSpot/real') real>
% modifier, and used the simpler command
%
% C = F'*opDiag(d)*F
%
Expand Down Expand Up @@ -254,5 +255,6 @@
C*eye(n)
##### SOURCE END #####
--></body></html>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit c6a56ed

Please sign in to comment.