function v = SolLE(A,B,W,rhs)
%Generate the solution vector to a linear equation system with left-hand
%matrix formed from A, B and W, with the right-hand vector given by r.
%Here, A and B are ntilde by ntilde matrices, where ntilde = n(n+1)/2, and
%n is the size of matrix W.
[mtilde,ntilde]=size(A);
rhs1=rhs(1:ntilde);
rhs2=rhs(ntilde+1:2*ntilde);
K=Kronecker(W,W);
lhs=B-A*K;
v2=lhs\(rhs1-A*rhs2);
v1=rhs2-K*v2;
v=[v1;v2];