function P = kronprod(A, B, C)
% Mixed-Kronecker product of real matrices A, B and C.
% The result is equivalent to computing kron(A,B)*C but is significantly
% faster if compiled MEX files are available.
%
% Input arguments:
% A:
%    A matrix with dimensions a_m * a_n.
% B:
%    A matrix with dimensions b_m * b_n.
% C:
%    A sparse matrix with dimensions (a_n*b_n) * c_n.
%
% Output arguments:
% P:
%    A matrix with dimensions (a_m*b_m) * c_n.

% Copyright 2008-2009 Levente Hunyadi

P = kron(A, B) * C;