项目文件夹

文件
2026-07-13 13:30:25 +08:00

10 行
271 B
Matlab
可执行文件

function D = kn2sd(K)
% Transform a kernel matrix (or inner product matrix) to a squared distance matrix
% Input:
% K: n x n kernel matrix
% Ouput:
% D: n x n squared distance matrix
% Written by Mo Chen (sth4nth@gmail.com).
d = diag(K);
D = -2*K+bsxfun(@plus,d,d');