// Numbas version: exam_results_page_options {"name": "Find a parity check matrix for a linear code", "extensions": ["codewords", "permutations"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"parts": [{"customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "prompt": "

$\\mathrm{H} =$ [[0]]

"}, "word_length": {"templateType": "anything", "group": "Ungrouped variables", "definition": "dimension+random(3..5)", "name": "word_length", "description": "

Length of each word in the code

"}, "dimension": {"templateType": "anything", "group": "Ungrouped variables", "definition": "3", "name": "dimension", "description": "

Dimension of the code - number of rows in the generating matrix.

"}, "dual_dimension": {"templateType": "anything", "group": "Ungrouped variables", "definition": "word_length-dimension", "name": "dual_dimension", "description": "

Dimension of the dual code

"}, "field_size": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(2,3,5)", "name": "field_size", "description": ""}, "g_words": {"templateType": "anything", "group": "Ungrouped variables", "definition": "shuffle(set_generated_by(M))[0..dimension]", "name": "g_words", "description": "

The generating matrix presented to the student, as a list of codewords.

\n

The variable testing condition ensures these words are linearly independent.

"}, "G_dual": {"templateType": "anything", "group": "Ungrouped variables", "definition": "codeword_matrix(parity_check_matrix(M))", "name": "G_dual", "description": "

Parity check matrix for $M$ (a generator matrix for the dual code of $M$)

"}, "g": {"templateType": "anything", "group": "Ungrouped variables", "definition": "codeword_matrix(G_words)", "name": "g", "description": "

A random generating matrix for the code, not in standard form.

"}, "nary": {"templateType": "anything", "group": "Ungrouped variables", "definition": "[\"\",\"unary\",\"binary\",\"ternary\",\"$4$-ary\",\"$5$-ary\"][field_size]", "name": "nary", "description": ""}, "A": {"templateType": "anything", "group": "Ungrouped variables", "definition": "repeat(codeword(repeat(random(0..field_size-1),word_length-dimension),field_size),dimension)", "name": "A", "description": "

The generating matrix is $I_{dim}|A$, where $A$ is random.

"}}, "ungrouped_variables": ["field_size", "nary", "dimension", "word_length", "dual_dimension", "A", "M", "g_words", "g", "G_dual"], "name": "Find a parity check matrix for a linear code", "variable_groups": [], "preamble": {"css": "", "js": ""}, "variablesTest": {"condition": "linearly_independent(G_words)", "maxRuns": 100}, "statement": "

Find a parity check matrix $\\mathrm{H}$ for the {nary} code $C$ with generator matrix

\n

\$\\mathrm{G} =\\var{G} \$

", "tags": [], "rulesets": {}, "extensions": ["codewords", "permutations"], "type": "question", "metadata": {"licence": "Creative Commons Attribution 4.0 International", "description": "

Given a generating matrix for a linear code, give a parity check matrix

"}, "functions": {"identity_right": {"type": "list", "language": "javascript", "definition": "var k = words.length;\nvar field_size = words[0].field_size;\nvar out = [];\nfor(var i=0;iFirst, row-reduce $\\mathrm{G}$ to obtain a standard generator matrix $\\mathrm{M}$ for the code

\n

\$\\mathrm{G}' = \\var{codeword_matrix(M)} \$

\n

This is in the form $(\\mathrm{I}_{\\var{dimension}}|\\mathrm{A})$. A parity check matrix is then $(-\\mathrm{A^T}|\\mathrm{I}_{\\var{word_length}-\\var{dimension}})$, i.e.

\n

\$\\mathrm{H} = \\var{G_dual} \$

\n

Note that this is just one possible parity-check matrix. In general any basis for the dual code $C^{\\bot}$ would do for the rows of the parity-check matrix.

", "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas-editor.mas.ncl.ac.uk/accounts/profile/3/"}, {"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}]}]}], "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas-editor.mas.ncl.ac.uk/accounts/profile/3/"}, {"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}]}