Mercurial > repos > public > sbplib
view minors.m @ 852:fbb8be3177c8 feature/burgers1d
Fix bug in SAT terms for upwind operators
- Set the appropriate boundary derivatives in respect to choice of upwind discretization of D2
- Distinguish between upwind discretizations e.g upwind+ vs upwind-
author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
---|---|
date | Thu, 27 Sep 2018 09:30:21 +0200 |
parents | eaf557023fbe |
children |
line wrap: on
line source
function [minor, sub] = minors(A, verbose) default_arg('verbose', true); [n, m] = size(A); if n ~= m error('A must be square'); end sub = {}; ks = {}; ind = 1:n; for k = 1:n C = nchoosek(ind,k); for i = 1:size(C,1) ks{end + 1} = k; sub{end + 1} = A(C(i,:),C(i,:)); end end for i = 1:length(sub) if verbose fprintf('%d:\n', ks{i}); disp(sub{i}) end minor(i) = det(sub{i}); end end % A is positive semidefinite if all minors are non-negative % A is negative semidefinite if all odd minors are non-positive and all even minors are non-negative