<commit_before>numbas-extension-codewords
==========================

Linear codes extension for Numbas<commit_msg>Document JME functions<commit_after>Linear codes extension for Numbas
==========================

This extension provides a new data type and some functions to deal with linear codes.

JME functions
-------------

### `codeword(digits,field_size)`

Create a codeword from a list of digits, in Z_{field_size}. For example, `codeword([1,1,0,1],2)`

### `codeword(word_string,field_size)`

Create a codeword from a string of digits, in Z_{field_zie}. For example, `codeword("11001",2)`

### `word1+word2`

Add two codewords. 

### `word1-word2`

Subtract one codeword from another

### `n*word` or `word*n`

Multiply a codeword by a scalar

### `allwords(word_length,field_size)`

Generate a list of all codewords of given length in Z_{field_size}.

### `set_generated_by(basis)`

Returns the set of codewords generated by the given list of basis codewords.

### `linearly_independent(basis)`

Are the given codewords linearly independent? (Not sure if this is correctly implemented - it just checks that the set generated by the basis contains `(field_size)^(number of basis words)` words)

### `coset_containing(word,basis)`

Generate the coset containing the given word, with respect to the given generating set.

### `sleppian_array(basis)`

Generate the Sleppian array corresponding to the given basis set. Each row in the result is a coset, sorted by weight.

### `is_coset_leader(word,basis)`

Is the given word a coset leader in its coset? That is, does it have the minimum weight?

### `parity_check_matrix(basis)`

Create a parity check matrix for the given generating set, by putting it in reduced row-echelon form `I_n|A` and returning `A_transpose|I_(m)`.

*Not guaranteed to work!* What should this function do when the matrix can't be put into reduced row-echelon form?
{'fraction_non_alphanumeric': 0.12183544303797468, 'fraction_numerical': 0.007911392405063292, 'mean_word_length': 5.260726072607261, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3153661', 'n_tokens_mistral': 583, 'n_tokens_neox': 560, 'n_words': 229}