Transforms a given object into an integer-based encoding.
encode(x) encode_pc_set(x) encode_pc_chord_type(x) encode_pc_chord(x) # S3 method for vec encode(x) # S3 method for coded_vec encode(x) # S3 method for corpus encode(x) # S3 method for pc_chord_type encode(x) # S3 method for pc_chord encode(x) # S3 method for pc_set_type encode(x) # S3 method for pc_set encode(x)
x | Object to encode, as created by
|
---|
Encoded object.
Encoding is currently defined for the following types:
An error will be thrown when trying to encode objects of other types.
The encode
function is vectorised and uses precomputed encodings.
The following functions represent alternative implementations
that are not vectorised and
do not rely on precomputed encodings.
Note that these alternative implementations do not necessarily
perform systematic input checking.
encode_pc_set
encode_pc_chord_type
encode_pc_chord
decode
for the reverse operation.