Home > manopt > tools > sylvester_nochecks.m

sylvester_nochecks

PURPOSE ^

Solve Sylvester equation without input checks.

SYNOPSIS ^

function X = sylvester_nochecks(A, B, C)

DESCRIPTION ^

 Solve Sylvester equation without input checks.

 function X = sylvester_nochecks(A, B, C)

 Solves the Sylvester equation A*X + X*B = C, where A is an m-by-m matrix,
 B is an n-by-n matrix, and X and C are two m-by-n matrices.

 This is a stripped-down version of Matlab's own sylvester function that
 bypasses any input checks. This is significantly faster for small m and
 n, which is often useful in Manopt.

 See also: sylvester lyapunov_symmetric

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function X = sylvester_nochecks(A, B, C)
0002 % Solve Sylvester equation without input checks.
0003 %
0004 % function X = sylvester_nochecks(A, B, C)
0005 %
0006 % Solves the Sylvester equation A*X + X*B = C, where A is an m-by-m matrix,
0007 % B is an n-by-n matrix, and X and C are two m-by-n matrices.
0008 %
0009 % This is a stripped-down version of Matlab's own sylvester function that
0010 % bypasses any input checks. This is significantly faster for small m and
0011 % n, which is often useful in Manopt.
0012 %
0013 % See also: sylvester lyapunov_symmetric
0014 
0015 % This file is part of Manopt: www.manopt.org.
0016 % Original author: Nicolas Boumal, July 19, 2018
0017 % Contributors: This is a modification of Matlab's built-in sylvester.
0018 % Change log:
0019 %   July 30, 2020 (NB):
0020 %       Changed call from builtin('_sylvester_tri', ...) to
0021 %       matlab.internal.math.sylvester_tri(...), which seems necessary for
0022 %       more recent versions of Matlab.
0023 %       Also had to remove the second output: the 'unique' flag.
0024 
0025     flag = 'real';
0026     if ~isreal(A) || ~isreal(B) || ~isreal(C)
0027         flag = 'complex';
0028     end
0029 
0030     [QA, TA] = schur(A, flag);
0031     [QB, TB] = schur(B, flag);
0032     
0033     % Solve Sylvester Equation TA*Y + Y*TB = QA'*C*QB.
0034     Y = matlab.internal.math.sylvester_tri(TA, TB, QA'*C*QB, ...
0035                                                      'I', 'I', 'notransp');
0036     % Use this call instead for older versions of Matlab:
0037     % [Y, info] = builtin('_sylvester_tri', TA, TB, QA'*C*QB);
0038 
0039     X = QA*Y*QB';
0040     
0041 end

Generated on Fri 30-Sep-2022 13:18:25 by m2html © 2005