source: distools/pe_affine.m @ 103

Last change on this file since 103 was 79, checked in by bduin, 11 years ago
File size: 1.1 KB
RevLine 
[10]1%PE_AFFINE Define and execute Pseudo Eclidean Affine mappings
2%
3%   W = PE_AFFINE(W,SIG)
4%   F = PE_AFFINE(A,W)
5%   F = A*W
6
7function argout = pe_affine(arg1,arg2)
8
9if ismapping(arg1)  % definition of PE mapping
10        isaffine(arg1);
11        if length(arg2) ~= 2
12                error('Signature should have two components')
13        end
14        [n1,n2] = size(arg1);
15        if sum(arg2) ~= n1
16                error('Sum of signature numbers should equal input dimension of mapping')
17        end
18        par.map = arg1;
19        par.sig = arg2;
[79]20        argout = prmapping(mfilename,'trained',par,getlabels(arg1),n1,n2);
[10]21else
22        isdataset(arg1);
23        ismapping(arg2);
24        w = getdata(arg2,'map');
25        sig = getdata(arg2,'sig');
26        if sig(2) ~= 0;
27                data = getdata(w);
28                data.rot = -data.rot;
29                data.offset = zeros(1,size(arg2,2));
30                v = setdata(w,data);
31                [m,k] = size(arg1);
32                if sig(1) ~= 0
33                        argout = [arg1(:,1:sig(1)) zeros(m,sig(2))]*w;
34                else
35                        argout = setdata(arg1,zeros(m,k))*w;
36                end
37                argout = argout + [setdata(arg1,zeros(m,sig(1))) arg1(:,sig(1)+1:end)]*v;
38        else % no negative directions: back in Euclidean case
39                argout = arg1*w;
40        end
41end
Note: See TracBrowser for help on using the repository browser.