source: distools/setsig.m @ 89

Last change on this file since 89 was 79, checked in by bduin, 11 years ago
File size: 2.0 KB
RevLine 
[10]1%SETSIG Set signature for pseudo-Euclidean dataset or mapping
2%
3%   B = SETSIG(A,SIG)
4%   B = A*SETSIG([],SIG);
5%   V = SETSIG(W,SIG);
6%
7% INPUT
8%   A    Dataset or data matrix (doubles)
9%   SIG  Signature, 2-element vector with numbers of positive
10%        and negative dimensions, default: all positive
11%   W    Pseudo-Euclidean mapping created by PE_EM
12%
13% OUTPUT
14%   B   PE dataset
15%   V   PE mapping
16%
17% DESCRIPTION
18% Distances in a PE dataset are computed in a special way, see PE_DISTM
19% using the signature of the PE space. This routine stores the signature
20% in the user-field of the dataset, so it can be used by any routine that
21% needs it. The signature is determined during a pseudo-Euclidean mapping,
22% e.g. by PSEM. Datasets applied to such a mapping obtain the signature
23% automatically. The signature is a vector of two elements equal to the
24% numbers of positive and negative eigenvalues found during the process of
25% PE mapping. Their sum should thereby be equal to the dimensionality of
26% the space, i.e. the number of features in A.
27%
28% Note that V = W*SETSIG converts a pseudo-Euclidean mapping W into a
29% mapping V to the associated space.
30%
31% SEE ALSO
32% DATASETS, MAPPINGS, PE_EM, PE_DISTM, GETSIG
33
34% Copyright: R.P.W. Duin, r.p.w.duin@prtools.org
35% Faculty EWI, Delft University of Technology
36% P.O. Box 5031, 2600 GA Delft, The Netherlands
37
38function b = setsig(a,sig)
39
40  if nargin < 2, sig = []; end
41  if nargin < 1 | isempty(a)
[79]42    b = prmapping(mfilename,'fixed',{sig});
[10]43    b = setname(b,'Set signature');
44    return
45  end
46 
47  if isempty(sig), sig = [size(a,2) 0]; end
48  if length(sig) ~= 2
49    error('The PE signature should consist of a vector of two elements');
50        end
51       
52        if sum(sig) ~= size(a,2)
53                error('The signature does not match the feature size')
54        end
55        if ispe_em(a)
56                data = getdata(a);
57                data.sig = sig;
58                b = setdata(a,data);
59        else
[79]60                a = prdataset(a);
[10]61                b = setuser(a,sig,'pe_signature');
62        end
63 
64return
65 
66 
67 
Note: See TracBrowser for help on using the repository browser.