Infleqtion / qLDPC

Tools for constructing and analyzing quantum low density parity check (qLDPC) codes.
Apache License 2.0
74 stars 8 forks source link

View galoir.FieldArray objects as numpy arrays #8

Closed perlinm closed 8 months ago

perlinm commented 8 months ago

... rather than passing them to np.array(field_array). This is the preferred method:

In [1]: import galois

In [2]: import numpy as np

In [3]: mat = galois.GF(2).Random((100, 100))

In [4]: %timeit np.array(mat)
488 ns ± 6.41 ns per loop (mean ± std. dev. of 7 runs, 1,000,000 loops each)

In [5]: %timeit mat.view(np.ndarray)
114 ns ± 1.12 ns per loop (mean ± std. dev. of 7 runs, 10,000,000 loops each