function [U2,V2,TA2,TB2,AR,AI,BETA] = gsch_order(U,V,TA,TB,SELECT);
% PURPOSE: returns ordered generalized Shur decomposition
%
% ---------------------------------------------------
% USAGE: [U2,V2,TA2,TB2,AR,AI,BETA] = gsch_order(U,V,TA,TB,SELECT);
% where:
% U,V,TA,TB generalized schur form of a matrix pair (A,B)
% SELECT positions of eigenvalues of the pair (A,B) that
% should be moved to the left-upper block
%
% U2,V2,TA2,TB2 generalized real schur decomposition
% A = U' TA V
% B = U' TB V
% such that selected eigenvalues are in the
% left-upper block
% AR,AI,BETA describe eigenvalues
% lambda[k] = (AR[k]+i AI[k])./BETA[k]
%
% COMMENTS:
% mex file, gsch_order.dll is required
% based on Lapack dtgsen routine
%
% Copyright (c) Pawel Kowal (2006)
% All rights reserved
% LREM_SOLVE toolbox is available free for noncommercial academic use only.
% pkowal3@sgh.waw.pl