0001 function [X, spectrum] = slcmds(D, d, w, ty)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037 if nargin < 2
0038 raise_lackinput('slcmds', 2);
0039 end
0040
0041 if ndims(D) ~= 2 || size(D, 1) ~= size(D, 2)
0042 error('sltoolbox:invalidarg', ...
0043 'The D should be a square matrix');
0044 end
0045 n = size(D, 1);
0046
0047 if d >= n
0048 error('sltoolbox:exceedbound', ...
0049 'The dimension d should be less than the number of samples n');
0050 end
0051
0052 if nargin < 3
0053 w = [];
0054 else
0055 if ~isempty(w)
0056 if ~isequal(size(w), [1, n])
0057 error('sltoolbox:sizmismatch', ...
0058 'If w is specified, it should be an 1 x n row vector');
0059 end
0060 end
0061 end
0062
0063 if nargin >= 4 && strcmpi(ty, 'sqr')
0064 is_sqr = true;
0065 else
0066 is_sqr = false;
0067 end
0068
0069
0070
0071
0072 if ~is_sqr
0073 K = sldists2kernels(D);
0074 else
0075 K = sldists2kernels(D, 'sqr');
0076 end
0077
0078 [X, spectrum] = slkernelembed(K, d, w);
0079
0080
0081
0082
0083
0084
0085
0086
0087