-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest-matrices.py
38 lines (32 loc) · 1.08 KB
/
test-matrices.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# -*- coding: utf-8 -*-
import argparse
from math import sqrt
from pathlib import Path
from time import time
import numpy as np
import pandas as pd
import scipy.sparse as sp
import LDPC
import specs
for n in specs.get_code_lengths():
for rate in specs.get_code_rates():
H = specs.get_expanded_H_matrix(n, rate)
col_sum = H.sum(axis=0)
row_sum = H.sum(axis=1)
regular_per_rows = False
if np.all(row_sum == row_sum[0]):
regular_per_rows = True
row_extent = row_sum[0]
regular_per_cols = False
if np.all(col_sum == col_sum[0]):
regular_per_cols = True
col_extent = col_sum[0]
if regular_per_cols and regular_per_rows:
print('n={}, rate={}: both regular'.format(n, rate))
elif regular_per_cols:
print('n={}, rate={}: regular per cols of {}'.format(n, rate, col_extent))
elif regular_per_rows:
print('n={}, rate={}: regular per rows of {}'.format(n, rate, row_extent))
else:
# print('non regular')
pass