📄 khatri.m
字号:
function Y = khatri(A,B)%KHATRI Khatri-Rao product. %% KHATRI(X,Y) is the Khatri-Rao product of X and Y. The result is a large% matrix formed by taking Kronecker tensor products between the respective% columns of X and Y. For example, if X and Y have N columns each, then% KHATRI(X,Y) is given by%% [ kron(X(:,1),Y(:,1)) kron(X(:,2),Y(:,2)) ... kron(X(:,N),Y(:,N)) ]%% See also KRON.%% CUED System Identification Toolbox.% Cambridge University Engineering Department.% Copyright (C) 1998-2002. All Rights Reserved.% Version 1.00, Date: 01/06/2002% Created by H. Chen and E.C. Kerrigan.[RowA,ColA] = size(A);[RowB,ColB] = size(B);if ColA ~= ColB error('The columns of two input matrices have to be same.')end Y = zeros(RowA*RowB,ColA); % preallocate just enough memoryfor i = 1:ColA Y(:,i) = kron(A(:,i),B(:,i));end% *** last line of khatri.m ***
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -