Contents
- Index

**TRANSFORM>COLLAPSE **

**PURPOSE **Combine one or more rows or columns of a matrix.

**DESCRIPTION **Combines row, columns or both simultaneously to form a new smaller matrix. The value of the combined cells can either be the average, the sum, the maximum or the minimum of the set of cells which are to be collapsed.

**PARAMETERS**

**Input dataset **

** **Name of file containing matrix to be collapsed. Data type: Matrix.

**Aggregation operation:** (Default = Sum).

Specifies how to aggregate the cells which are to be collapsed.

Choices are:

**Average** - The arithmetic mean of all the cells.

** Sum**** **- The sum of all the cells.

**Maximum**- Maximum value of all the cells.

**Minimum** - Minimum value of all the cells.

**Enter instructions for collapsing:**

** **In the window provided the user must provide instructions to the routine which specify which rows or columns must be collapsed.

The following keywords are used.

ROWS to combine rows.

COLS to combine columns

NODES to combine rows and columns simultaneously.

Each new line must commence with one of these keywords. Each keyword is followed by a list of the rows, columns or nodes which are to be collapsed. The list has elements separated by spaces or commas, the keywords TO is permissible. For example:

ROWS 1 3 4

collapse rows 1, 3 and 4 to a single row;

COLS 2 TO 4

COLS 1, 6

collapses columns 2, 3 and 4 to one column and 1 and 6 to another column separately.

**(For Square Mats) Include diagonal values?** (Default = No).

No excludes diagonal values from consideration.

**OUTPUT dataset:** (Default = 'Collapse').

Name of file which contains labeled collapsed matrix described below.

**LOG FILE** A list of assignments of rows and columns to blocks. The blocks specify the new row and column numbers for each of the old row and column numbers.

The collapsed matrix. Each row or column is labeled. Rows or columns that have been collapsed are labeled by B followed by their block number. Rows or columns which have not been collapsed retain the label R (for row) or C (for column) followed by their row or column number.

**TIMING** O(N^2).

**COMMENTS **None.

**REFERENCES **None.