如果我知道K = kron(A,B),其中kron是MATLAB中定义的矩阵的Kronecker乘积,我如何从给定矩阵K中找到A和B?
例如,假设
K = [1 0 0 0 ;0 1 0 0 ; 0 1 0 0 ;0 1 0 0 ;1 0 0 0 ;0 1 0 0 ;0 1 0 0 ;0 1 0 0 ;1 0 0 0 ;0 1 0 0 ;0 1 0 0 ;0 1 0 0 ;0 0 1 0 ;0 0 0 1 ;0 0 0 1 ;0 0 0 1 ]
Run Code Online (Sandbox Code Playgroud)
有没有办法找到A和B,这样K = kron(A,B)?在这种情况下,A和B如下:
A = [ 1 0 ; 1 0 ; 1 0 ; 0 1 ]
B = [ 1 0 ; 0 1 ; 0 1 ; 0 1 ]
Run Code Online (Sandbox Code Playgroud)
你不能找到这两者,A并且B给定a K,因为可能有许多可能的A's B' 和's来产生某个kron矩阵,K.因此,非常久远K,你需要或者A或B获得剩余的输入B或A分别.
案例#1给定A和K(kron矩阵),您可以找到B-
B = K(1:size(K,1)/size(A,1),1:size(K,2)/size(A,2))./A(1)
Run Code Online (Sandbox Code Playgroud)
案例#2给定B和K(kron矩阵),您可以找到A-
A = K(1:size(B,1):end,1:size(B,2):end)./B(1)
Run Code Online (Sandbox Code Playgroud)
因此,如果不是整个其他输入,您至少需要知道它的大小和它的一个元素,最好是第一个元素.
您可以非常轻松地将其转换为功能代码,以便轻松实现即插即用 -
%// INVERSE_KRON Inverse of Kronecker tensor product to find one of the inputs.
% // INVERSE_KRON(K,ARRAY,INPUT_ID) finds one of the inputs used for calculating the
% // Kronecker tensor product given the other input and the ID of that other input.
% // Thus, if K was obtained with K = KRON(A,B), one must use -
% // A = INVERSE_KRON(K,B,2) to find A, and
% // B = INVERSE_KRON(K,A,1) to find B.
function out = inverse_kron(K,array,input_id)
switch input_id
case 1
out = K(1:size(K,1)/size(array,1),1:size(K,2)/size(array,2))./array(1);
case 2
out = K(1:size(array,1):end,1:size(array,2):end)./array(1);
otherwise
error('The Input ID must be either 1 or 2')
end
return;
Run Code Online (Sandbox Code Playgroud)
典型用例看起来像这样 -
K = kron(A,B); %// Get kron product
A = inverse_kron(K,B,2) %// Recover A
B = inverse_kron(K,A,1) %// Recover B
Run Code Online (Sandbox Code Playgroud)
注意:对于矢量案例,可以在此处找到另一个相关的问题和答案.
| 归档时间: |
|
| 查看次数: |
1318 次 |
| 最近记录: |