gips_perm {gips} | R Documentation |
Permutation object
Description
Create permutation objects to be passed to
other functions of the gips
package.
Usage
gips_perm(x, size)
new_gips_perm(rearranged_cycles, size)
validate_gips_perm(g)
Arguments
x |
A single object that can be interpreted by
the |
size |
An integer. Size of a permutation (AKA cardinality of a set, on which permutation is defined. See examples). |
rearranged_cycles |
A list of rearranged integer vectors. Each vector corresponds to a single cycle of a permutation. |
g |
Object to be checked whether it is
a proper object of a |
Value
gips_perm()
returns an object of
a gips_perm
class after the safety checks.
new_gips_perm()
returns an object of
a gips_perm
class without the safety checks.
validate_gips_perm()
returns its argument unchanged.
If the argument is not a proper element of a gips_perm
class,
it produces an error.
Functions
-
new_gips_perm()
: Constructor. Only intended for low-level use. -
validate_gips_perm()
: Validator. Only intended for low-level use.
Methods for a gips
class
See Also
-
project_matrix()
-gips_perm
is theperm
parameter ofproject_matrix()
. -
permutations::permutation()
- The constructor for thex
parameter. -
gips()
- The constructor for thegips
class uses thegips_perm
object as the base object.
Examples
# All 7 following lines give the same output:
gperm <- gips_perm("(12)(45)", 5)
gperm <- gips_perm("(1,2)(4,5)", 5)
gperm <- gips_perm(as.matrix(c(2, 1, 3, 5, 4)), 5)
gperm <- gips_perm(t(as.matrix(c(2, 1, 3, 5, 4))), 5) # both way for a matrix works
gperm <- gips_perm(list(list(c(2, 1), c(4, 5))), 5)
gperm <- gips_perm(permutations::as.word(c(2, 1, 3, 5, 4)), 5)
gperm <- gips_perm(permutations::as.cycle("(1,2)(4,5)"), 5)
gperm
# note the necessity of the `size` parameter:
gperm <- gips_perm("(12)(45)", 5)
gperm <- gips_perm("(12)(45)", 7) # this one is a different permutation
try(gperm <- gips_perm("(12)(45)", 4))
# Error, `size` was set to 4, while the permutation has the element 5.