trotter (version 0.6)

apv: Amalgams Pseudo-Vector Constructor

Description

The APV class defines a pseudo-vector containing all the arranged k-amalgams (permutations with replacement) of the objects stored in items. The function apv is a constructor for this class.

Usage

apv(k, items)

Arguments

k
the number of objects taken at a time.
items
a vector of objects to be amalgamated.

Value

an instance of APV.

Details

The amalgams are arranged according to the order in which the objects appear in items. The arrangement is very similar to that used by the PPV class (see ppv) except that objects are replaced during permutation creation.

References

Steinhaus-Johnson-Trotter algorithm. (2014, April 29). In Wikipedia, The Free Encyclopedia. Retrieved 13:24, September 5, 2014

See Also

Permutations Pseudo-Vector ppv

Combinations Pseudo-Vector cpv

Selections Pseudo-Vector spv

Subsets Pseudo-Vector sspv

Examples

Run this code
# create a pseudo-vector of 10-amalgams from the first 15 letters
a <- apv(10, letters[1:15])
# generate a description
print(a)
# compatable with length
length(a)
# inspect a few of the combinations "stored" in a
a[1]
a[1000000]
a[576650390625]

Run the code above in your browser using DataLab