function X = TinySylvesterSolve(A,B,C)
% A is p-by-p
% B is q-by-q
% Assume that A and B have no eigenvalues in common
% C is p-by-q
% X solves AX - XB = C
% Reasonably efficient only if p = 1 or 2.
[p,q] = size(C);
c = reshape(C,p*q,1);
M = kron(eye(q,q),A) - kron(B',eye(p,p));
X = reshape(M\c,p,q);