# TABLE_ORTHONORMALIZE Orthonormalize a Set of Vectors

TABLE_ORTHONORMALIZE is a FORTRAN90 program which can read in a set of vectors and orthonormalize them.

Caution: it may not be clear from the documentation, but the program implicitly assumes that each vector represents a velocity field, and hence can be thought of as a quantity V(M/2,2), where "M" is the appropriate dimension if we think of the quantity as a vector of scalar values. Moreover, each vector is written to a file as M/2 records of pairs of values.

For instance, the program can read three (or in general N) files, each containing one of the M-dimensional vectors v1, v2 and v3. The program then outputs three new vectors q1, q2 and q3, with the properties that

• The Euclidean norm of qi is 1, for all i;
• The dot product qi•qj is 0, for i and j distinct;
• The vectors qi span the same space as the original vectors vi;

The algorithm collects the N input vectors vj into an M by N matrix V. It then calls the appropriate LAPACK routines (SGEQRF and SORGQR) to compute the QR factorization:

```
V = Q * R
```
and outputs the individual columns of Q as the new vectors qj.

This routine can be useful as a postprocessing tool for the output from CVT_BASIS for example. However, orthonormalization would probably not be appropriate if CVT_BASIS had done its computations using mass matrix preconditioning. In that case, the output vectors have a special orthogonality property under an L2 inner product, which would be lost if the vectors were processed by this program.

Some effort has been made to relieve the user of the tedious necessity of specifying how many input files there are (the number N), and what their dimensionality is (the number M). It is assumed that the input data files have "consecutive" names, such as file01.txt, file02.txt, ... and so on. This is enough to figure out N. And the program counts the number of lines in the first file, and assumes this value of M may safely be applied to all the files.

### Usage:

table_orthonormalize input_file_01 output_file_01
reads input_file_01, orthonormalizes the vectors, and writes them to output_file_01.

### Languages:

TABLE_ORTHONORMALIZE is available in a FORTRAN90 version.

### Related Data and Programs:

LAPACK, a FORTRAN90 library which supplies the routines used to orthonormalize the vectors.

TABLE_BARPLOT_PPMA, a FORTRAN90 program which reads a table file and creates a PPMA bargraph of the data.

TABLE_BORDER, a FORTRAN90 program which can be used to add a border (of zero values) to a table file.

TABLE_COLUMNS, a FORTRAN90 program which can extract specific columns of data from a table file.

TABLE_COLUMNS_PERMUTE, a FORTRAN90 program which permutes the columns of a table file.

TABLE_DELAUNAY, a FORTRAN90 program which computes the Delaunay triangulation of a set of points.

TABLE_HISTOGRAM, a FORTRAN90 program which can make a histogram of a set of points stored in a table file.

TABLE_IO, a FORTRAN90 library which supplies the routines used to read the TABLE file.

TABLE_LATINIZE, a FORTRAN90 program which reads a file of points and creates a "latinized" version by adjusting the data.

TABLE_MERGE, a FORTRAN90 program which reads a file of points, and removes duplicates, and points that are close to each other.

TABLE_QUALITY, a FORTRAN90 program which reads a file of points and computes the quality of dispersion.

TABLE_RECORD_MATCH, a FORTRAN90 program which can be used to find close records in a table file.

TABLE_SCALE, a FORTRAN90 program which can be used to multiply the entries of a table file by a scale vector.

TABLE_SHIFT, a FORTRAN90 program which can be used to shift the entries of a table file by a shift vector.

TABLE_STATS, a FORTRAN90 program which can read a table file and compute certain statistics.

TABLE_TET_MESH, a FORTRAN90 program which can read a table file of 3D data, and compute a tetrahedral mesh.

TABLE_TOP, a FORTRAN90 program which can read a table file of M-dimensional data and make a table of plots of all pairs of coordinates.

TABLE_UNBORDER, a FORTRAN90 program which can be used to remove the border from a table file.

TABLE_UNIFORM_NOISE, a FORTRAN90 program which can be used to add a uniform noise term to the data in a table file.

TABLE_VORONOI, a FORTRAN90 program which can be used to compute information about the Voronoi diagram of the points.

### Reference:

1. Edward Anderson, Zhaojun Bai, Christian Bischof, Susan Blackford, James Demmel, Jack Dongarra, Jeremy DuCroz, Anne Greenbaum, Sven Hammarling, Alan McKenney, Danny Sorensen,
LAPACK User's Guide,
Third Edition,
SIAM, 1999,
QA76.73.F25L36

### Examples and Tests:

A set of sample input files you may copy, with M = 8 and N = 3:

A set of output files corresponding to the sample input files, with M = 8 and N = 3, including:

### List of Routines:

• MAIN is the main program for TABLE_ORTHONORMALIZE.
• CH_CAP capitalizes a single character.
• CH_EQI is a case insensitive comparison of two characters for equality.
• CH_IS_DIGIT returns TRUE if a character is a decimal digit.
• CH_TO_DIGIT returns the integer value of a base 10 digit.
• DIGIT_INC increments a decimal digit.
• DIGIT_TO_CH returns the character representation of a decimal digit.
• FILE_NAME_INC generates the next filename in a series.
• GET_UNIT returns a free FORTRAN unit number.
• Q_FACTOR determines the Q factor of a matrix.
• R8MAT_PRINT prints an R8MAT.
• R8MAT_PRINT_SOME prints some of an R8MAT.
• S_INPUT prints a prompt string and reads a string from the user.
• S_TO_R8 reads an R8 from a string.
• S_TO_R8VEC reads an R8VEC from a string.
• TIMESTAMP prints the current YMDHMS date as a time stamp.
• TIMESTRING writes the current YMDHMS date into a string.