next up previous contents
Next: ColumnPCAView Up: Views Previous: TransposeView   Contents

TransformView

The TransformView allows one to transform a dataset via an arbitrary transformation matrix. The usual rules of matrix algebra apply along with one other restriction - the matrix must not produce more columns than the parent dataset. This effectively restricts the matrix which can be used to an $NxN$ matrix where $N$ is the number of columns of the parent dataset.

For an example, let's create a view which transforms a 2D dataset from a standard orthogonal basis to the orthogonal basis $v_1 = \left( \begin{array}{r} 1  1  \end{array} \right) v_2 = \left( \begin{array}{r} 1  -1  \end{array} \right)$. The matrix we'll use is $m = \left( \begin{array}{rr} \frac{1}{2} & \frac{1}{2}  \frac{1}{2} & -\frac{1}{2}  \end{array} \right) $.

>>> ds = Dataset(MLab.rand(4,2))
>>> tv = TransformView(ds, Numeric.array([[0.5, 0.5],
... [0.5, -0.5]]))
>>> ds.getData()
[[ 0.78208232, 0.64115632,]
 [ 0.6568898 , 0.91970539,]
 [ 0.19737017, 0.42274952,]
 [ 0.32603681, 0.25608519,]]
>>> tv.getData()
[[ 0.71161932, 0.070463  ,]
 [ 0.78829759,-0.1314078 ,]
 [ 0.31005985,-0.11268967,]
 [ 0.291061  , 0.03497581,]]



Lucas Scharenbroich 2003-08-27