热门问题
时间线
聊天
视角

調和矩陣

来自维基百科,自由的百科全书

Remove ads

圖論中,調和矩陣harmonic matrix),也稱拉普拉斯矩陣拉氏矩陣Laplacian matrix)、離散拉普拉斯discrete Laplacian),是矩陣表示。[1]

調和矩陣也是拉普拉斯算子離散化。換句話說,調和矩陣的縮放極限拉普拉斯算子。它在機器學習物理學中有很多應用。

定義

若G是簡單,G有n個頂點,A是鄰接矩陣,D是度數矩陣,則調和矩陣[1]

Remove ads

動機

這跟拉普拉斯算子有什麼關係?若f 是加權圖G的頂點函數,則[2]

w是邊的權重函數。u、v是頂點。f = (f(1), ..., f(n)) 是n維的矢量。上面泛函也稱為Dirichlet泛函。[3]

Remove ads

接續矩陣

而且若K是接續矩陣(incidence matrix),則[2]

Kf 是f 的圖梯度。另外,特徵值滿足

Remove ads

舉例

更多資訊 , ...
Remove ads

其他形式

對稱正規化調和矩陣

注意[4]

Remove ads

Remove ads

動力學和微分方程

例如,離散的冷卻定律使用調和矩陣[5]

使用矩陣矢量

解是

Remove ads

平衡舉動

的時候,

MATLAB代碼

N = 20;%The number of pixels along a dimension of the image
A = zeros(N, N);%The image
Adj = zeros(N*N, N*N);%The adjacency matrix

%Use 8 neighbors, and fill in the adjacency matrix
dx = [-1, 0, 1, -1, 1, -1, 0, 1];
dy = [-1, -1, -1, 0, 0, 1, 1, 1];
for x = 1:N
   for y = 1:N
       index = (x-1)*N + y;
       for ne = 1:length(dx)
           newx = x + dx(ne);
           newy = y + dy(ne);
           if newx > 0 && newx <= N && newy > 0 && newy <= N
               index2 = (newx-1)*N + newy;
               Adj(index, index2) = 1;
           end
       end
   end
end

%%%BELOW IS THE KEY CODE THAT COMPUTES THE SOLUTION TO THE DIFFERENTIAL
%%%EQUATION
Deg = diag(sum(Adj, 2));%Compute the degree matrix
L = Deg - Adj;%Compute the laplacian matrix in terms of the degree and adjacency matrices
[V, D] = eig(L);%Compute the eigenvalues/vectors of the laplacian matrix
D = diag(D);

%Initial condition (place a few large positive values around and
%make everything else zero)
C0 = zeros(N, N);
C0(2:5, 2:5) = 5;
C0(10:15, 10:15) = 10;
C0(2:5, 8:13) = 7;
C0 = C0(:);

C0V = V'*C0;%Transform the initial condition into the coordinate system 
%of the eigenvectors
for t = 0:0.05:5
   %Loop through times and decay each initial component
   Phi = C0V.*exp(-D*t);%Exponential decay for each component
   Phi = V*Phi;%Transform from eigenvector coordinate system to original coordinate system
   Phi = reshape(Phi, N, N);
   %Display the results and write to GIF file
   imagesc(Phi);
   caxis([0, 10]);
   title(sprintf('Diffusion t = %3f', t));
   frame = getframe(1);
   im = frame2im(frame);
   [imind, cm] = rgb2ind(im, 256);
   if t == 0
      imwrite(imind, cm, 'out.gif', 'gif', 'Loopcount', inf, 'DelayTime', 0.1); 
   else
      imwrite(imind, cm, 'out.gif', 'gif', 'WriteMode', 'append', 'DelayTime', 0.1);
   end
end
Thumb
GIF:離散拉普拉斯過程,使用拉普拉斯矩陣

應用

參考文獻

閱讀

Loading related searches...

Wikiwand - on

Seamless Wikipedia browsing. On steroids.

Remove ads