# Permute: Permute rows and columns of a matrix In GraphAlignment: GraphAlignment

## Description

Permute rows and columns of the input matrix.

## Usage

 `1` ```Permute(m, p, invertp=FALSE) ```

## Arguments

 `m` matrix `p` permutation vector `invertp` apply inverse permutation

## Details

This function permutes rows and columns of a matrix using the specified permutation vector. The inverse of the permutation will be applied if the invertp argument is set to TRUE.

## Value

The return value is the row- and columnwise Permutation of the elements of the input matrix, so Permute(m, p)[i, j] is equal to m[p[i], p[j]].

## Author(s)

Joern P. Meier, Michal Kolar, Ville Mustonen, Michael Laessig, and Johannes Berg

## Examples

 ```1 2 3 4``` ``` example <- GenerateExample(10, 10, 1, 0.5, TRUE, 4) b <- example\$b p <- rank(rnorm(10)) Permute(b, p, TRUE) ```

### Example output

```              [,1]       [,2]        [,3]        [,4]        [,5]        [,6]
[1,]  2.393108369 -1.0904185 -1.52638680 -1.35297339 -0.42646846 -0.07548492
[2,] -1.090418523  0.5285182  0.88815362 -1.25829278  0.88107764 -0.23054109
[3,] -1.526386802  0.8881536  0.95313454 -0.43854333  0.03084888 -0.24095389
[4,] -1.352973393 -1.2582928 -0.43854333  2.42697294 -0.13206834  0.05270007
[5,] -0.426468460  0.8810776  0.03084888 -0.13206834 -0.02676689 -0.22456785
[6,] -0.075484923 -0.2305411 -0.24095389  0.05270007 -0.22456785  1.48742956
[7,]  0.008130561 -0.5274380 -0.37213983  0.30215768  2.01529350  0.24862601
[8,]  1.455070255 -1.2366349  1.01901697  0.77590645  1.03545183  0.41881701
[9,]  0.729266767  0.4583121 -0.57225344 -0.76397844  0.60449967 -0.57143741
[10,]  0.305427889 -1.4103352  1.54580435  0.04222270  0.02474029  0.28617006
[,7]       [,8]       [,9]       [,10]
[1,]  0.008130561  1.4550703  0.7292668  0.30542789
[2,] -0.527438047 -1.2366349  0.4583121 -1.41033519
[3,] -0.372139825  1.0190170 -0.5722534  1.54580435
[4,]  0.302157676  0.7759064 -0.7639784  0.04222270
[5,]  2.015293497  1.0354518  0.6044997  0.02474029
[6,]  0.248626008  0.4188170 -0.5714374  0.28617006
[7,] -1.626395804 -0.1295602 -0.8514867  0.14514039
[8,] -0.129560211 -0.2229970 -0.3541544  2.58335403
[9,] -0.851486665 -0.3541544 -1.5825200 -0.63399283
[10,]  0.145140388  2.5833540 -0.6339928  1.28745544
```

GraphAlignment documentation built on Nov. 8, 2020, 6:56 p.m.