Compare commits
2 Commits
5762c602af
...
fffb15595b
| Author | SHA1 | Date | |
|---|---|---|---|
| fffb15595b | |||
| c73d3bc9e9 |
@ -102,7 +102,7 @@ parity constraint. In a similar vein, we can define the following set of
|
|||||||
polynomial equations to describe codewords:
|
polynomial equations to describe codewords:
|
||||||
|
|
||||||
$$
|
$$
|
||||||
F = \left[\begin{array}{c}1 - x_1^2 \\ \vdots\\ 1 - x_n^2 \\ 1 - \prod_{i \in A(1)}x_i \\ \vdots\\ 1 - \prod_{i \in A(m)}x_i\end{array}\right] \overset{!}{=} \bm{0}.
|
F(\bm{x}) = \left[\begin{array}{c}1 - x_1^2 \\ \vdots\\ 1 - x_n^2 \\ 1 - \prod_{i \in A(1)}x_i \\ \vdots\\ 1 - \prod_{i \in A(m)}x_i\end{array}\right] \overset{!}{=} \bm{0}.
|
||||||
$$
|
$$
|
||||||
|
|
||||||
This is a problem we can solve using homotopy continuation.
|
This is a problem we can solve using homotopy continuation.
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import galois
|
|||||||
import argparse
|
import argparse
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from tqdm import tqdm
|
from tqdm import tqdm
|
||||||
|
import pandas as pd
|
||||||
|
|
||||||
# autopep8: off
|
# autopep8: off
|
||||||
import sys
|
import sys
|
||||||
@ -47,7 +48,7 @@ def decode(tracker, y, H, args: SimulationArgs) -> np.ndarray:
|
|||||||
return x_hat
|
return x_hat
|
||||||
|
|
||||||
|
|
||||||
def simulate_error_rates_for_SNR(H, Eb_N0, args: SimulationArgs) -> typing.Tuple[np.ndarray, np.ndarray, np.ndarray]:
|
def simulate_error_rates_for_SNR(H, Eb_N0, args: SimulationArgs) -> typing.Tuple[float, float, float, int]:
|
||||||
GF = galois.GF(2)
|
GF = galois.GF(2)
|
||||||
H_GF = GF(H)
|
H_GF = GF(H)
|
||||||
G = H_GF.null_space()
|
G = H_GF.null_space()
|
||||||
@ -84,14 +85,29 @@ def simulate_error_rates_for_SNR(H, Eb_N0, args: SimulationArgs) -> typing.Tuple
|
|||||||
|
|
||||||
num_frames += 1
|
num_frames += 1
|
||||||
|
|
||||||
if frame_errors > args.target_frame_errors:
|
if frame_errors >= args.target_frame_errors:
|
||||||
break
|
break
|
||||||
|
|
||||||
BER = bit_errors / (num_frames * n)
|
BER = bit_errors / (num_frames * n)
|
||||||
FER = frame_errors / num_frames
|
FER = frame_errors / num_frames
|
||||||
DFR = decoding_failures / num_frames
|
DFR = decoding_failures / num_frames
|
||||||
|
|
||||||
return FER, BER, DFR
|
return FER, BER, DFR, frame_errors
|
||||||
|
|
||||||
|
|
||||||
|
def simulate_error_rates(H, Eb_N0_list, args: SimulationArgs) -> typing.Tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray]:
|
||||||
|
FERs = []
|
||||||
|
BERs = []
|
||||||
|
DFRs = []
|
||||||
|
frame_errors_list = []
|
||||||
|
for SNR in Eb_N0_list:
|
||||||
|
FER, BER, DFR, num_frames = simulate_error_rates_for_SNR(H, SNR, args)
|
||||||
|
FERs.append(FER)
|
||||||
|
BERs.append(BER)
|
||||||
|
DFRs.append(DFR)
|
||||||
|
frame_errors_list.append(num_frames)
|
||||||
|
|
||||||
|
return np.array(FERs), np.array(BERs), np.array(DFRs), np.array(frame_errors_list)
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
@ -101,9 +117,10 @@ def main():
|
|||||||
|
|
||||||
parser.add_argument("-c", "--code", type=str, required=True,
|
parser.add_argument("-c", "--code", type=str, required=True,
|
||||||
help="Path to the alist file containing the parity check matrix of the code")
|
help="Path to the alist file containing the parity check matrix of the code")
|
||||||
# TODO: Extend this script to multiple SRNs
|
parser.add_argument("--snr", type=float, required=True, nargs=3,
|
||||||
parser.add_argument("--snr", type=float, required=True,
|
metavar=('start', 'stop', 'step'),
|
||||||
help="Eb/N0 to use for this simulation")
|
help="SNRs to simulate (Eb/N0) in dB")
|
||||||
|
|
||||||
parser.add_argument("--max-frames", type=int, default=int(1e6),
|
parser.add_argument("--max-frames", type=int, default=int(1e6),
|
||||||
help="Maximum number of frames to simulate")
|
help="Maximum number of frames to simulate")
|
||||||
parser.add_argument("--target-frame-errors", type=int, default=200,
|
parser.add_argument("--target-frame-errors", type=int, default=200,
|
||||||
@ -139,12 +156,12 @@ def main():
|
|||||||
max_frames=args.max_frames,
|
max_frames=args.max_frames,
|
||||||
target_frame_errors=args.target_frame_errors)
|
target_frame_errors=args.target_frame_errors)
|
||||||
|
|
||||||
FER, BER, DFR = simulate_error_rates_for_SNR(H, args.snr, simulation_args)
|
SNRs = np.arange(args.snr[0], args.snr[1], args.snr[2])
|
||||||
|
FERs, BERs, DFRs, frame_errors_list = simulate_error_rates(
|
||||||
print(f"FER: {FER}")
|
H, SNRs, simulation_args)
|
||||||
print(f"DFR: {DFR}")
|
|
||||||
print(f"BER: {BER}")
|
|
||||||
|
|
||||||
|
df = pd.DataFrame({"SNR": SNRs, "FER": FERs, "BER": BERs, "DFR": DFRs, "frame_errors": frame_errors_list})
|
||||||
|
print(df)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user