VMD Extension Functions
List and matrix operations

Functions

 transpose matrix
 
 lseq from to ?step?
 
 arrayIndices arr
 
 printTable ll ?prepend? ?ch? ?fmt?
 
 printArray tmp ?prepend? ?ch? ?fmt?
 
 reshapeLongToArray table
 
 reshapeArrayToWide tmp
 
 reshapeLongToWide table
 
 reshapeArrayToLong tmp
 

Detailed Description

Miscellaneous TCL data-structure related operations.

Function Documentation

◆ arrayIndices()

arrayIndices   arr  

Given an array indexed by A,B pairs, return sorted row and column indices.

◆ lseq()

lseq   from to ?step?  

Sequence of integers from $from to $to, step by $step

◆ printArray()

printArray   tmp ?prepend? ?ch? ?fmt?  

Pretty-print an array, prepending rows and columns

◆ printTable()

printTable   ll ?prepend? ?ch? ?fmt?  

Pretty-print a 2D array (list of lists). Each line is prepended by the optional "extra" argument, a string, and output on the given channel (stdout if not given).

◆ reshapeArrayToLong()

reshapeArrayToLong   tmp  

Reverse of reshapeLongToWide

◆ reshapeArrayToWide()

reshapeArrayToWide   tmp  

Reshape array format into "wide". No order is assumed.

◆ reshapeLongToArray()

reshapeLongToArray   table  

Reshape a matrix in "long" format into an array format. No order is assumed. Returns a list containing: 1. the serialized array; 2. the list of rows (first index); 3. the list of columns (second index). This is a convenient matrix format for interchanging data.

◆ reshapeLongToWide()

reshapeLongToWide   table  

Reshape a matrix in "long" format into a "wide" (rectangular) format The first column will be used as row index, the second as column. No order is assumed.

◆ transpose()

transpose   matrix  

Transpose a 2D table (list of lists). From [[http://wiki.tcl.tk/2748]]