如何找到逆Kron?

时间:2015-02-02 05:09:36

标签: matlab matrix

如果我知道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 ]

有没有办法找到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 ]

1 个答案:

答案 0 :(得分:6)

简短讨论和解决方案代码

在给定A的情况下,您找不到BK,因为可能有许多AB生成某个kron矩阵K。因此,与K一起,您需要AB分别获得剩余输入BA

案例#1 鉴于AK(kron矩阵),您可以找到B -

B = K(1:size(K,1)/size(A,1),1:size(K,2)/size(A,2))./A(1)

案例#2 鉴于BK(kron矩阵),您可以找到A -

A = K(1:size(B,1):end,1:size(B,2):end)./B(1)

因此,如果不是整个其他输入,你至少需要知道它的大小和它的一个元素,最好是第一个元素。


功能代码

您可以非常轻松地将其转换为功能代码,以便轻松实现即插即用 -

%// 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;

典型用例如下所示 -

K = kron(A,B);          %// Get kron product
A = inverse_kron(K,B,2) %// Recover A
B = inverse_kron(K,A,1) %// Recover B

注意:对于矢量案例,可以找到另一个相关的问题和答案here