Discussion:
Block Toeplitz Matrix
(too old to reply)
Ahmad
2009-11-29 07:12:03 UTC
Permalink
Hi,

Is there any method in Matlab to generate a BLOCK Toeplitz matrix whose structure is

[a b c 0 0
0 a b c 0
0 0 a b c ]

where a,b, c, and all 0's are COLUMN vectors of the same length r x 1.
Bruno Luong
2009-11-29 12:20:18 UTC
Permalink
Post by Ahmad
Hi,
Is there any method in Matlab to generate a BLOCK Toeplitz matrix whose structure is
[a b c 0 0
0 a b c 0
0 0 a b c ]
where a,b, c, and all 0's are COLUMN vectors of the same length r x 1.
One way:

a=rand(3,2); b=rand(3,2); c=rand(3,2);

abc = {a b c};
% use z = zeros(size(a)) instead to build full matrix
z = sparse([], [], [], size(a,1), size(a,2));
% z = zeros(size(a));
abc = [{z} abc];
n = length(abc);

s = spdiags(repmat(1:n-1,n+1,1),0:n-2,n+1,n+1);
M = cell2mat(abc(s+1))

I would recommend to go back to the basic: use the SPARSE command to build the matrix from scratch.

Bruno
Matt J
2009-11-29 13:55:18 UTC
Permalink
Post by Ahmad
Hi,
Is there any method in Matlab to generate a BLOCK Toeplitz matrix whose structure is
[a b c 0 0
0 a b c 0
0 0 a b c ]
where a,b, c, and all 0's are COLUMN vectors of the same length r x 1.
Here's another one. It's efficient in syntax, but not in execution:

A=kron( speye(N), [a,b,c]); %N is number of recurrences of the blocks
Bruno Luong
2009-11-29 14:14:03 UTC
Permalink
Post by Matt J
A=kron( speye(N), [a,b,c]); %N is number of recurrences of the blocks
The structure of the blocks generated like the above are disjoint like SPDIAGS, not like TOEPLITZ.

Bruno
Bruno Luong
2009-11-29 14:50:09 UTC
Permalink
Sorry for the typo
The structure of the blocks generated like the above are disjoint like BLKDIAG, not like TOEPLITZ.
Bruno
Matt J
2009-11-29 14:50:09 UTC
Permalink
Post by Bruno Luong
Post by Matt J
A=kron( speye(N), [a,b,c]); %N is number of recurrences of the blocks
The structure of the blocks generated like the above are disjoint like SPDIAGS, not like TOEPLITZ.
Yeah. Oh well, just for the hell of it, here's a brute force way, using kron()

e=ones(N,1);
A=kron(spdiags(e,0,N,N+2),a)+...
kron(spdiags(e,1,N,N+2),b)+...
kron(spdiags(e,2,N,N+2),c)
Jos (10584)
2009-11-30 10:30:20 UTC
Permalink
Post by Ahmad
Hi,
Is there any method in Matlab to generate a BLOCK Toeplitz matrix whose structure is
[a b c 0 0
0 a b c 0
0 0 a b c ]
where a,b, c, and all 0's are COLUMN vectors of the same length r x 1.
Here is a aproach

% original arrays
r = 4 ;
a = rand(r,1) ; b = 10*rand(size(a)) ; c = 10*rand(size(a)) ;

% create block toeplitz matrix
X = {zeros(size(a)) a b c} ;
idx = toeplitz([1:3 0 0],[0 0 0]).' + 1 % indices
X = X(idx)
X = cell2mat(X)
% or in 1 step: X = cell2mat(X (toeplitz(..)+1))

hth
Jos

Continue reading on narkive:
Loading...