Last change
on this file since 177 was
37,
checked in by (none), 15 years ago
|
Added original make3d
|
-
Property svn:executable set to
*
|
File size:
938 bytes
|
Line | |
---|
1 | % S = vgg_vech_swap(x,y) For symmetric matrix A it is x'*A*y = vgg_vech(A)'*vgg_vech_swap(x,y).
|
---|
2 | %
|
---|
3 | % x ... matrix N-by-K
|
---|
4 | % y ... matrix N-by-K
|
---|
5 | % S ... matrix K*(K+1)/2-by-N
|
---|
6 | %
|
---|
7 | % Examples :-
|
---|
8 | %
|
---|
9 | % - Estimating symmetric matrix A that should satisfy x(:,k)'*A*y(:,k) = 0 from
|
---|
10 | % given points x(:,k), y(:,k). We solve homogeneous system vech(A)*vgg_vec_swap(x,y) = 0.
|
---|
11 | %
|
---|
12 | % - Evaluating values v(k) of x(:,k)'*A{k}*y(:,k) for all k, A{k} are square symmetric matrices.
|
---|
13 | % If column vectors vech(A{k}) are stacked to a single matrix AA, then
|
---|
14 | % v = sum(AA'.*vgg_vech_swap(x,y)).
|
---|
15 | %
|
---|
16 | % See also vgg_matrix_test, vgg_lineseg_from_x, vgg_vec_swap, vgg_commut_matrix, vgg_duplic_matrix.
|
---|
17 |
|
---|
18 | % Tomas Werner, Oct 2001
|
---|
19 |
|
---|
20 | function M = vgg_vech_swap(x,y)
|
---|
21 |
|
---|
22 | if nargin==1
|
---|
23 | y = x;
|
---|
24 | end
|
---|
25 |
|
---|
26 | [i j] = find(ones(size(x,1)));
|
---|
27 | d = i>=j;
|
---|
28 | i = i(d);
|
---|
29 | j = j(d);
|
---|
30 |
|
---|
31 | M = x(i,:).*y(j,:) + x(j,:).*y(i,:).*((i~=j)*ones(1,size(x,2)));
|
---|
32 |
|
---|
33 | return |
---|
Note: See
TracBrowser
for help on using the repository browser.