linmeq - Sylvester and Lyapunov equations solver
Default: flag(1) = 0, flag(2) = 0 (, flag(3) = 0).
Default: trans = 0.
Default: schur = 1.
linmeq function for solving Sylvester and Lyapunov equations using SLICOT routines SB04MD, SB04ND, SB04PD, SB04QD, SB04RD, SB03MD, and SB03OD.
[X] = linmeq(1,A,B,C,flag,trans,schur) [X,sep] = linmeq(2,A,C,flag,trans) [X] = linmeq(2,A,C,flag,trans) [X] = linmeq(3,A,C,flag,trans)
linmeq solves various Sylvester and Lyapunov matrix equations:
op(A)*X + X*op(B) = C, (1a) op(A)*X*op(B) + X = C, (1b) op(A)'*X + X*op(A) = C, (2a) op(A)'*X*op(A) - X = C, (2b) op(A)'*(op(X)'*op(X)) + (op(X)'*op(X))*op(A) = - op(C)'*op(C), (3a) op(A)'*(op(X)'*op(X))*op(A) - op(X)'*op(X) = - op(C)'*op(C), (3b)
where op(M) = M, or M'.
V. Sima, Katholieke Univ. Leuven, Belgium, May 1999, May, Sep. 2000. V. Sima, University of Bucharest, Romania, May 2000.
//(1a) n=40;m=30; A=rand(n,n);C=rand(n,m);B=rand(m,m); X = linmeq(1,A,B,C); norm(A*X+X*B-C,1) //(1b) flag=[1,0,0] X = linmeq(1,A,B,C,flag); norm(A*X*B+X-C,1) //(2a) A=rand(n,n);C=rand(A);C=C+C'; X = linmeq(2,A,C); norm(A'*X + X*A -C,1) //(2b) X = linmeq(2,A,C,[1 0]); norm(A'*X*A -X-C,1) //(3a) A=rand(n,n); A=A-(max(real(spec(A)))+1)*eye(); //shift eigenvalues C=rand(A); X=linmeq(3,A,C); norm(A'*X'*X+X'*X*A +C'*C,1) //(3b) A = [-0.02, 0.02,-0.10, 0.02,-0.03, 0.12; 0.02, 0.14, 0.12,-0.10,-0.02,-0.14; -0.10, 0.12, 0.05, 0.03,-0.04,-0.04; 0.02,-0.10, 0.03,-0.06, 0.08, 0.11; -0.03,-0.02,-0.04, 0.08, 0.14,-0.07; 0.12,-0.14,-0.04, 0.11,-0.07, 0.04] C=rand(A); X=linmeq(3,A,C,[1 0]); norm(A'*X'*X*A - X'*X +C'*C,1)