# permutation_vector

##### Class ser_permutation_vector --

The class `ser_permutation_vector`

represents a single permutation vector.

- Keywords
- classes

##### Usage

```
## constructor
ser_permutation_vector(x, method = NULL)
```

##### Arguments

- x
- an object which contains a permutation vector (currently an
integer vector or an object of class
`hclust`

). The value`NA`

creates an identity permutation. - method
- a string representing the method used to obtain the permutation vector

##### Details

A permutation vector
maps a set of \(n\) objects \(\{O_1, O_2, ..., O_n\}\) onto itself.
In seriation we represent a permutation \(\pi\)
as a vector which lists the objects in their permuted order.
For example, the permutation vector \(\langle3, 1, 2\rangle\) indicates that in first position is the object with index 3 then the object with index 1 and finally
the object with index 2.
A permutation vector can be extracted from a permuation vector object
via `get_order()`

. Such a permutation vector can be directly used
to subset the list of original objects with `"["`

to apply the permutation.
*Note:* An alternative way to specify a permutation is via a list of the ranks of the objects after permutation (see `get_rank()`

).

`ser_permutation_vector`

objects are usually packed into
a `ser_permutation`

object
which is a collection of \(k\) permutation vectors for \(k\)-mode data.

The constructor `ser_permutation_vector`

checks if the permutation vector is valid
(i.e. if all integers occur exactly once).

The following functions are implemented: `print`

, `rev`

,
`length`

, `get_order`

, `get_rank`

, `get_method`

.

##### Value

An object of class `ser_permutation_vector`

.

##### See Also

`ser_permutation`

,
`get_order`

,
`get_rank`

,
`get_permutation_matrix`

,
`permutation_vector2matrix`

.

##### Examples

```
p <- ser_permutation_vector(sample(10), "random")
p
## some methods
length(p)
get_method(p)
get_order(p)
get_rank(p)
get_permutation_matrix(p)
r <- rev(p)
r
get_order(r)
## create a indentity permutation vector (with unknown length)
ip <- ser_permutation_vector(NA)
ip
```

*Documentation reproduced from package seriation, version 1.2-2, License: GPL-3*