view funm_files/sylv_tri.m @ 8:a587712dcf5f draft default tip

funm_atom.m: rename fun_atom to funm_atom * funm_atom.m: rename fun_atom to funm_atom.
author Antonio Pino Robles <data.script93@gmail.com>
date Fri, 29 May 2015 09:48:36 +0200
parents 8f23314345f4
children
line wrap: on
line source

function X = sylv_tri(T,U,B)
%SYLV_TRI    Solves triangular Sylvester equation.
%            x = SYLV_TRI(T,U,B) solves the Sylvester equation
%            T*X + X*U = B, where T and U are square upper triangular matrices.

m = length(T);
n = length(U);
X = zeros(m,n);

% Forward substitution.
for i = 1:n
    X(:,i) = (T + U(i,i)*eye(m)) \ (B(:,i) - X(:,1:i-1)*U(1:i-1,i));
end