comparison toolbox/pdtoep.m @ 0:8f23314345f4 draft

Create local repository for matrix toolboxes. Step #0 done.
author Antonio Pino Robles <data.script93@gmail.com>
date Wed, 06 May 2015 14:56:53 +0200
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:8f23314345f4
1 function T = pdtoep(n, m, w, theta)
2 %PDTOEP Symmetric positive definite Toeplitz matrix.
3 % PDTOEP(N, M, W, THETA) is an N-by-N symmetric positive (semi-)
4 % definite (SPD) Toeplitz matrix, comprised of the sum of M rank 2
5 % (or, for certain THETA, rank 1) SPD Toeplitz matrices.
6 % Specifically,
7 % T = W(1)*T(THETA(1)) + ... + W(M)*T(THETA(M)),
8 % where T(THETA(k)) has (i,j) element COS(2*PI*THETA(k)*(i-j)).
9 % Defaults: M = N, W = RAND(M,1), THETA = RAND(M,1).
10
11 % Reference:
12 % G. Cybenko and C.F. Van Loan, Computing the minimum eigenvalue of
13 % a symmetric positive definite Toeplitz matrix, SIAM J. Sci. Stat.
14 % Comput., 7 (1986), pp. 123-131.
15
16 if nargin < 2, m = n; end
17 if nargin < 3, w = rand(m,1); end
18 if nargin < 4, theta = rand(m,1); end
19
20 if max(size(w)) ~= m | max(size(theta)) ~= m
21 error('Arguments W and THETA must be vectors of length M.')
22 end
23
24 T = zeros(n);
25 E = 2*pi*( (1:n)'*ones(1,n) - ones(n,1)*(1:n) );
26
27 for i=1:m
28 T = T + w(i) * cos( theta(i)*E );
29 end