MeatAxe  2.4
zct - Cut

Command Line

zct Options Rows[:Columns] Input Output 
Options
Standard options, see Standard Command Line Options
Rows
List of rows to cut.
Columns
List of columns to cut.
Input
Input matrix or permutation.
Output
Output file.

Input Files

Input
Input matrix or permutations.

Output Files

Output
Output file.

Description

This program cuts a piece, specified by Rows and Columns, out of the file Input, and writes the piece to Output. The input may be a matrix or a set of permutations. Both Rows and Columns are lists of positive integers or ranges (e.g., "13-25") separated by commas. If the input is a matrix, the corresponding rows and columns are cut, and the resulting rectangular pieces are combined into one rectangular matrix which is written to the output file. If the columns list is omitted, all columns of the selected rows are cut.

Here are some examples. Assume the input is the following 5 by 10 matrix

1 2 3 4 5 6 7 8 9 0
0 1 2 3 4 5 6 7 8 9
0 0 1 2 3 4 5 6 7 8
0 0 0 0 0 0 0 0 0 0
9 8 7 6 5 4 3 2 1 0

Then, zct would produce the output shown below for different Rows:Columns lists:

Rows:Columns        Result
-----------------   -------------------
1,4-5               1 2 3 4 5 6 7 8 9 0
                    0 0 0 0 0 0 0 0 0 0
                    9 8 7 6 5 4 3 2 1 0

1-3:8-10            8 9 0
                    7 8 9
                    6 7 8

1-2:2,5-7,9         2 5 6 7 9
                    1 4 5 6 8

1-2,5:1-3,9-10      1 2 3 9 0
                    0 1 2 8 9
                    9 8 7 1 0

The rows and columns which select the piece need not occur in ascending order, but the output depends on the ordering. For example,

zct 1,2 output input
zct 2,1 output input

both extract the first two rows of ‘input’, but the second form will also permute the rows. Another example:

zct 3-4,1-2:3-4,1-2 inp out

would perform the following operation on a 4 by 4 matrix:

  inp              out
1 1 2 2          4 4 3 3
1 1 2 2          4 4 3 3
3 3 4 4          2 2 1 1
3 3 4 4          2 2 1 1

With permutations the program works in the same way as with matrices. Each permutation is treated as a row. The Columns list must be empty in this case, because zct can cut only entire permutations.

Implementation Details

The number of entries in the Rows and Columns list must not be greater than 10. One row (or permutation, respectively) of the input file and the whole result of the cut must fit into memory.


MeatAxe 2.4 documentation, generated on Mon Jun 7 2021 11:42:24