function C = block_product(A, B)
%BLOCK_PRODUCT Summary of this function goes here
%   Detailed explanation goes here

% Compute the block product of a single matrix A (M x N) by multiple
% matrices stored in the matrix B (K*N x P). The resulting matrix C will be
% of size (K*M x P) containing the K blocks of size M x P concatenated
% along 

[m, n] = size(A);
[r, p] = size(B);
k = r / n;

B_slices = reshape(permute(reshape(B.', p, n, []), [2 1 3]), [n k*p]);

C = reshape(permute(reshape(A * B_slices, m, p, []), [2 1 3]), [p m*k]).';

end

