source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/zisserman/vgg_numerics/vgg_duplic_matrix.m @ 37

Last change on this file since 37 was 37, checked in by (none), 14 years ago

Added original make3d

  • Property svn:executable set to *
File size: 584 bytes
Line 
1% d = vgg_duplic_matrix(n)  Duplication matrix.
2%
3% Classical matrix re-arrangement operator, see book Magnus-Neudecker.
4%
5% Useful for rearranging equations with symmetric matrices.
6% For square symmetric X, it is
7%
8%   vgg_duplic_matrix(n)*vgg_vech(X) = vgg_vec(X)
9%
10% See also vgg_matrix_test, vgg_vech_swap.
11
12% Added by Tom Werner, originaly from T.Minka.
13
14
15function d = vgg_duplic_matrix(n)
16
17a = tril(ones(n));
18i = find(a);
19a(i) = 1:length(i);
20a = a + tril(a,-1)';
21j = a(:);
22
23m = n*(n+1)/2;
24d = zeros(n*n,m);
25for r = 1:size(d,1)
26  d(r, j(r)) = 1;
27end
Note: See TracBrowser for help on using the repository browser.