Learn R Programming

cayleyR (version 0.2.1)

apply_operations: Apply Sequence of Operations

Description

Applies a sequence of shift and reverse operations to a permutation state. Operations can be specified as "1"/"L" (shift left), "2"/"R" (shift right), or "3"/"X" (reverse prefix). Tracks celestial coordinates.

Value

List with components:

state

Integer vector after all operations applied

coords

List of final celestial coordinates (nL, nR, nX, theta, phi, omega_conformal)

Arguments

state

Integer vector representing the current permutation state

operations

Character vector of operations ("1"/"L", "2"/"R", "3"/"X")

k

Integer, parameter for reverse operations

coords

Optional list of current celestial coordinates. If NULL, starts from zero coordinates.

Examples

Run this code
result <- apply_operations(1:10, c("1", "3", "2"), k = 4)
result$state

# Using letter codes
result <- apply_operations(1:20, c("L", "X", "R"), k = 4)
result$state

Run the code above in your browser using DataLab