BASIS_COMPARE is an executable FORTRAN90 program, using double precision arithmetic, that can compare the amount of overlap between two basis sets.
In an M-dimensional space, a set of N orthonormal vectors U is provided, which span some subspace. We let Q be the M by N matrix whose columns are an orthogonal basis for the span of the vectors U(1:N). (We'll assume for now that the vectors U are linearly independent. Otherwise, Q could actually have fewer "interesting" columns than U.)
One or more M-vectors V are then considered. For each V, it is desired to know the proportion of the vector that lies within and outside the subspace spanned by U. V admits an orthogonal decomposition of the form:
V = V1 + V2
where
The values
TAN ( THETA ) = BETA / ALPHA.
To compute ALPHA, we realize that Q' * V produces the N by 1 vector of projection coefficients of V onto each U(I). Therefore, V1, the orthogonal projection of V into U is Q * ( Q' * V ):
V1 = Q * Q' * V
and the "remainder" is:
V2 = ( I - Q * Q' ) * V
from which we can determine ALPHA and BETA, and finally
THETA.
Such sets are computed, for example, by CVT_BASIS_FLOW, POD_BASIS_FLOW, and SVD_BASIS, However, somewhat inconveniently, these programs are working with velocities, and store each vector in a pair of columns. For now, we have set up the program to expect the input data to have this format. Moreover, rather than comparing the two bases directly, we read in one basis to use as U, and then each vector of the other basis is checked against U. Also, U and V already consist of orthonormal columns, so the QR factorization of U is simply
U = Q * R = U * I.
CVT_BASIS_FLOW is a FORTRAN90 program which extracts a basis from a set of velocity snapshots using CVT methods.
POD_BASIS_FLOW is a FORTRAN90 program which extracts a basis from a set of velocity snapshots using POD methods.
SVD_BASIS is a FORTRAN90 program which extracts a basis from any set of vectors, using POD methods.
You can go up one level to the FORTRAN90 source codes.