Package hlcd.exporter
Class LatexWeightEnumeratorWriter
java.lang.Object
hlcd.exporter.LatexWeightEnumeratorWriter
Exports the weight enumerator of some code \(\mathsf{C}\) as a
.tex
file. Similar to CodeExporter, this will not
automatically override the file if it already exists because it does use a
timestamp.
The .tex file that will be generated assumes there exist a \(\LaTeX\)
environment named weightEnumerator. Here is a complete but
minimal example showing the definition of weightEnumerator:
\documentclass[12pt]{article}
\usepackage{ifthen}
\usepackage{breqn}
\usepackage{numprint}
\npthousandsep{,}
\newcolumntype{:}{%
!{\hspace{2.5pt}\vrule width 1pt\hspace{2.5pt}}
}
\newcommand{\nMinusK}[2]{\the\numexpr #1 - #2}
\newcommand{\code}[1][]{%
\ifthenelse{\equal{#1}{}}
{\ensuremath{[n, k, d]}}
{\ensuremath{[#1]}}%
}
\DeclareMathOperator{\wtFunctionText}
{\ensuremath{\normalfont\textsc{wt}}}
\newcommand{\wtFunction}[1]{\ensuremath{\wtFunctionText(#1)}}
\newenvironment{weightEnumerator}[4][]{
\begin{dmath}
\ifx&% optional argument has been passed
\label{eq:we#2_#3_#4}
\wtFunction{x}_{{\code[#2, \, #3, \, #4]}_4} =%
\else% no optional argument :(
\label{eq:we#2_#3_#4_#1}
\wtFunction{x}^{#1}_{{\code[#2, \, #3, \, #4]}_4} =%
\fi
}
{
\end{dmath}
}
\begin{document}
\begin{weightEnumerator}[]{23}{10}{9}
1\,+\, \numprint{540}x^{9}\,
+\, \numprint{1398}x^{10}\,
+\, \numprint{4032}x^{11}\,
+\, \numprint{11040}x^{12}\,
+\, \numprint{27237}x^{13}\
+\, \numprint{57126}x^{14}\,
+\, \numprint{102417}x^{15}\,
+\, \numprint{155403}x^{16}\,
+\, \numprint{193542}x^{17}\,
+\, \numprint{197562}x^{18}\,
+\, \numprint{156714}x^{19}\,
+\, \numprint{92772}x^{20}\,
+\, \numprint{38169}x^{21}\,
+\, \numprint{9498}x^{22}\,
+\,\numprint{1125}x^{23}
\end{weightEnumerator}
\end{document}
The above will render the following:
\( \begin{array}{l} {\rm WT}({x})_{\left[23, \, 10, \, 9\right]_4} = 1\,+\, 540x^{9}\,+\, 1,398x^{10}\,+\, 4,032x^{11}\,+\, 11,040x^{12}\,\\% \kern6.5em +\, 27,237x^{13}\,+\, 57,126x^{14}\,+\, 102,417x^{15}\,+\, 155,403x^{16}\,\\% \kern6.5em +\, 193,542x^{17}\,+\, 197,562x^{18}\,+\, 156,714x^{19}\,\\% \kern6.5em +\, 92,772x^{20}\,+\, 38,169x^{21}\,+\, 9,498x^{22}\,+\, 1,125x^{23} \end{array} \)
//minimal example to execute this class:
public static void main(String[] args) {
System.out.println("Running LatexWeightEnumeratorWriter...");
String path = Paths.DEFAULT_PATH;
String directoryName = "LatexWeightEnumeratorWriter";
byte n = 7;
byte k = 4;
byte d = 3;
byte base = 4;
boolean printPathToConsole = true;
CodeParameters cp = new CodeParameters(n, k, d, base);
CodeValidatorParameters cvp = new CodeValidatorParameters();
CodeExporterParameters cep = new CodeExporterParameters();
Code code = new Code(cp, cvp);
code.startEngine();
code.printGeneratorMatrix(true, Style.DECIMAL, true);
DirectoryCreator dc = new DirectoryCreator(path, directoryName);
dc.createDirectory();
LatexWeightEnumeratorWriter lwew = new LatexWeightEnumeratorWriter(
dc, //directory creator
code.getCodeWeightEnumerator(), //the weight enumerator of code
code.getCodeParameters(), //the code parameters
"0", //the id of the generator matrix
printPathToConsole //should the path be printed
);
lwew.writeWeightEnumeratorAsLatex("x");
System.out.println("LatexWeightEnumeratorWriter completed.");
}
- Since:
- 1.8
- Version:
- 1.0 (January 25th, 2022)
- Author:
- Maysara Al Jumaily
-
Constructor Summary
ConstructorsConstructorDescriptionLatexWeightEnumeratorWriter(DirectoryCreator dc, WeightEnumerator weightEnumerator, CodeParameters cp, String id, boolean printPathToConsole)Initializes the LaTeX weight enumerator writer based on the parameters specified. -
Method Summary
Modifier and TypeMethodDescriptionvoidwriteWeightEnumeratorAsLatex(String variable)Write the weight enumerator of the code that was passed in the constructor.
-
Constructor Details
-
LatexWeightEnumeratorWriter
public LatexWeightEnumeratorWriter(DirectoryCreator dc, WeightEnumerator weightEnumerator, CodeParameters cp, String id, boolean printPathToConsole)Initializes the LaTeX weight enumerator writer based on the parameters specified.- Parameters:
dc- the directory creator object to ensure the files are stored in the appropriate placeweightEnumerator- the weight enumerator of the codecp- the code parameters (i.e., \(n\), \(k\), \(d\), \(base\), etc.)id- The id that would be associated with the matrix corresponding to the weight enumerator that was passed. Used when multiple generator matrices of the same \(\left[n, \, k, \, d\right]_{base}\) code are generated. Should be"0"if only a single generator matrix is found.printPathToConsole- should the file paths generated be printed to console
-
-
Method Details
-
writeWeightEnumeratorAsLatex
Write the weight enumerator of the code that was passed in the constructor.- Parameters:
variable- the name of the variable to use. It is suggested to pass"x".
-