Skip to content

Commit

Permalink
use new RobustDeterminantDD
Browse files Browse the repository at this point in the history
  • Loading branch information
tholden committed Aug 28, 2017
1 parent 593d8c6 commit 6ecc1a1
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 18 deletions.
2 changes: 1 addition & 1 deletion Core/MChecks/FullTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
if UseVPA
MDet = double( det( vpa( MSub ) ) );
else
MDet = RobustDeterminant( MSub );
MDet = RobustDeterminantDD( MSub );
end
if MDet < MinimumDeterminant
MinimumDeterminant = MDet;
Expand Down
47 changes: 30 additions & 17 deletions Core/MChecks/InitialChecks.m
Original file line number Diff line number Diff line change
Expand Up @@ -230,26 +230,30 @@
if LargestPMatrix < Ts
if QuickPCheckUseMex
disp( 'Checking whether the contiguous principal sub-matrices of M have positive determinants, using the MEX version of QuickPCheck.' );
[ QuickPCheckResult, StartEndDet, IndicesToCheck ] = QuickPCheck_mex( Ms );
[ ~, StartEndDet, IndicesToCheck ] = QuickPCheck_mex( Ms );
else
disp( 'Checking whether the contiguous principal sub-matrices of M have positive determinants, using the non-MEX version of QuickPCheck.' );
[ QuickPCheckResult, StartEndDet, IndicesToCheck ] = QuickPCheck( Ms );
[ ~, StartEndDet, IndicesToCheck ] = QuickPCheck( Ms );
end
if UseVPA
QuickPCheckResult = true;
for i = 1 : 3
if any( IndicesToCheck <= 0 )
continue;
end
TmpSet = IndicesToCheck(1):IndicesToCheck(2);

QuickPCheckResult = true;
for i = 1 : 3
if any( IndicesToCheck <= 0 )
continue;
end
TmpSet = IndicesToCheck(1):IndicesToCheck(2);
if UseVPA
TmpDet = double( det( vpa( Ms( TmpSet, TmpSet ) ) ) );
if TmpDet <= 0
QuickPCheckResult = false;
StartEndDet = [ IndicesToCheck, TmpDet ];
break;
end
else
TmpDet = RobustDeterminantDD( Ms( TmpSet, TmpSet ) );
end
if TmpDet <= 0
QuickPCheckResult = false;
StartEndDet = [ IndicesToCheck, TmpDet ];
break;
end
end

if QuickPCheckResult
fprintf( 'No contiguous principal sub-matrices with negative determinants found. This is a necessary condition for M to be a P-matrix.\n\n' );
else
Expand Down Expand Up @@ -313,18 +317,27 @@
Mc = Ms( Indices, Indices );
if AltPTestUseMex
disp( 'Testing whether the requested sub-matrix of M is a P-matrix using the MEX version of AltPTest.' );
[ AltPTestResult, IndicesToCheck ] = AltPTest_mex( Mc, true );
[ ~, IndicesToCheck ] = AltPTest_mex( Mc, true );
else
disp( 'Testing whether the requested sub-matrix of M is a P-matrix using the non-MEX version of AltPTest.' );
[ AltPTestResult, IndicesToCheck ] = AltPTest( Mc, true );
[ ~, IndicesToCheck ] = AltPTest( Mc, true );
end
if UseVPA
AltPTestResult = true;
for i = 1 : 3
TmpSet = IndicesToCheck{i};
if ~isempty( TmpSet ) && double( det( vpa( Mc( IndicesToCheck{i}, IndicesToCheck{i} ) ) ) ) <= 0
AltPTestResult = false;
break;
break
end
end
else
AltPTestResult = true;
for i = 1 : 3
TmpSet = IndicesToCheck{i};
if ~isempty( TmpSet ) && RobustDeterminantDD( Mc( IndicesToCheck{i}, IndicesToCheck{i} ) ) <= 0
AltPTestResult = false;
break
end
end
end
Expand Down

0 comments on commit 6ecc1a1

Please sign in to comment.