In case anyone is curious, here is the Schur decomposition inversion I tried to implement:
function [T] = recursiveSchurInv(A)
%RECURSIVESCHURINV Summary of this function goes here
% Detailed explanation goes here
sz= size(A);
if sz(1) ~= sz(2) % matrix must be sequare
% error
end
N = sz(1);
% Edge cases: N = 1 and 2
if N == 1
T = 1/A;
elseif N == 2
T = A\eye(N);
else
% Big matrix case
% Matrix partition
A1 = A(1:2, 1:2); % 2x2
A2 = A(3:N, 3:N); % N-2 x N-2
As = A(3:N, 1:2); % N-2 x 2
As_t = As.';
% Inverse variables
A2_inv = recursiveSchurInv(A2);
D = A1 - As_t * A2_inv * As;
D_inv = recursiveSchurInv(D);
% Calculate inverse terms
T11 = D_inv;
T12 = - D_inv * As_t* A2_inv;
T21 = T12.';
T22 = A2_inv * ( eye(N-2) + As * D_inv * As_t * A2_inv );
T = [T11, T12;
T21, T22];
end
end
Note that it assumes that the matrix is symmetric (again, I was trying to capitalize on that).