简短讨论和解决方案代码
你不能同时找到A 和B,给定一个K,因为可能有很多可能的A 和B 来产生一个特定的kron 矩阵,@ 987654328@。因此,除了K,您还需要A 或B 分别获得剩余的输入B 或A。
案例#1给定A和K(克朗矩阵),你可以找到B和-
B = K(1:size(K,1)/size(A,1),1:size(K,2)/size(A,2))./A(1)
案例#2给定B和K(克朗矩阵),你可以找到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找到另一个相关的问题和答案。