Skip to content

Commit

Permalink
fix bug for models with multiple bounds
Browse files Browse the repository at this point in the history
  • Loading branch information
tholden committed Mar 8, 2017
1 parent aae92ed commit ef68f88
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions Core/MChecks/PrepareNormalizedSubMatrices.m
Original file line number Diff line number Diff line change
Expand Up @@ -43,29 +43,32 @@
if any( diag( Msc ) <= 0 )
continue;
end
if Tss > 1 && any( abs( angle( eig( Msc ) ) ) >= pi - pi / Tss )

TssTns = Tss * ns;

if TssTns > 1 && any( abs( angle( eig( Msc ) ) ) >= pi - pi / TssTns )
continue;
end

[ ~, pMsc ] = chol( Msc + Msc' );
if pMsc == 0
CPMatrix = true;
else
IminusMsc = eye( Tss ) - Msc;
IminusMsc = eye( TssTns ) - Msc;
absIminusMsc = abs( IminusMsc );
if max( abs( eig( absIminusMsc ) ) ) < 1 % corollary 3.2 of https://www.cogentoa.com/article/10.1080/23311835.2016.1271268.pdf
CPMatrix = true;
else
IplusMsc = eye( Tss ) + Msc;
IplusMsc = eye( TssTns ) + Msc;
norm_absIminusMsc = norm( absIminusMsc );
[ ~, pIMscComb ] = chol( IplusMsc' * IplusMsc - ( norm_absIminusMsc * norm_absIminusMsc ) * eye( Tss ) );
[ ~, pIMscComb ] = chol( IplusMsc' * IplusMsc - ( norm_absIminusMsc * norm_absIminusMsc ) * eye( TssTns ) );
if pIMscComb == 0 % theorem 3.4 of https://www.cogentoa.com/article/10.1080/23311835.2016.1271268.pdf
CPMatrix = true;
else
if norm_absIminusMsc < min( svd( IplusMsc ) ) % theorem 3.2 of https://www.cogentoa.com/article/10.1080/23311835.2016.1271268.pdf
CPMatrix = true;
else
if rank( IplusMsc ) == Tss
if rank( IplusMsc ) == TssTns
try
IMscRatio = IplusMsc \ IminusMsc;
if max( eig( abs( IMscRatio ) ) ) < 1 || norm( IplusMsc \ IminusMsc ) < 1 % theorem 3.1 of https://www.cogentoa.com/article/10.1080/23311835.2016.1271268.pdf
Expand All @@ -74,7 +77,7 @@
catch
end
end
if ~CPMatrix && rank( IminusMsc ) == Tss % theorem 3.1 of https://www.cogentoa.com/article/10.1080/23311835.2016.1271268.pdf
if ~CPMatrix && rank( IminusMsc ) == TssTns % theorem 3.1 of https://www.cogentoa.com/article/10.1080/23311835.2016.1271268.pdf
try
IMscAltRatio = IminusMsc \ IplusMsc;
if min( svd( IMscAltRatio ) ) > 1
Expand Down

0 comments on commit ef68f88

Please sign in to comment.