Package: pyreedsolomon
pyreedsolomonA high performance Python interface to the linux kernel Reed Solomon librariesSee more onhttps://github.com/mugpahug/pyreedsolomonAuthor: Edwin G.W. PetersRequirementsUserspace interface to the kernel Reed Solomon libraries and numpy
Source and build instructions onhttps://github.com/CyberLeo/reed-solomonconfigure with --prefix=/usr/ or add the location oflibrs.sois in your library path (LD_LIBRARY_PATH)Installationpip install pyreedsolomonUsageThis library provides fast methods where the user needs to allocate the buffers and handle padding as well as easy-to-use methods that have a slightly lower performanceimportpyreedsolomonimportnumpyasnprs_dr=pyreedsolomon.Reed_Solomon(8,223,255,0x11D,0,1,32)data=np.random.randint(0,256,150).astype(np.uint8)data_enc=rs_dr.encode(data)# create a few errorserr_idx=[23,53,12,97,102]data_enc[err_idx]=255data_dec,n_errors=rs_dr.decode(data_enc)verify=np.all(data_dec==data)print(f"Decoding succes:{verify}. errors corrected{n_errors}")For more examples including how to use the fast encoder and decoder that omits variable checking, check tests/bench.pyPerformancePerformance comparison ofpyreedsolomonwith different input data types and comparison tounireedsolomonandreedsoloInput data types supported:numpy.ndarraylistbytesbytearrayTest run onIntel(R) Core(TM) i7-4790 CPU @ 3.60GHzRS (973, 935, 10) -- encoding and decoding 1000 runstest nameencodingdecodingnum errorspyreedsolomon numpy.ndarray0.065 s 0.065 ms each0.061 s 0.061 ms each0pyreedsolomon list0.114 s 0.114 ms each0.117 s 0.117 ms each0pyreedsolomon bytearray0.067 s 0.067 ms each0.060 s 0.060 ms each0pyreedsolomon bytes0.063 s 0.063 ms each0.060 s 0.060 ms each0pyreedsolomon fast0.064 s 0.064 ms each0.056 s 0.056 ms each0py unireedsolomon8.828 s 8.828 ms each6.830 s 6.830 ms each0RS (255, 223, 8) -- encoding and decoding 10000 runstest nameencodingdecodingnum errorspyreedsolomon numpy.ndarray0.189 s 0.019 ms each0.200 s 0.020 ms each0pyreedsolomon list0.339 s 0.034 ms each0.385 s 0.038 ms each0pyreedsolomon bytearray0.201 s 0.020 ms each0.231 s 0.023 ms each0pyreedsolomon bytes0.190 s 0.019 ms each0.225 s 0.023 ms each0pyreedsolomon fast0.166 s 0.017 ms each0.196 s 0.020 ms each0py unireedsolomon12.233 s 1.223 ms each12.556 s 1.256 ms each0py reedsolo9.292 s 0.929 ms each16.142 s 1.614 ms each0RS (15, 11, 4) -- encoding and decoding 100000 runstest nameencodingdecodingnum errorspyreedsolomon numpy.ndarray0.755 s 0.008 ms each0.787 s 0.008 ms each0pyreedsolomon list1.039 s 0.010 ms each1.132 s 0.011 ms each0pyreedsolomon bytearray0.823 s 0.008 ms each0.869 s 0.009 ms each0pyreedsolomon bytes0.773 s 0.008 ms each0.851 s 0.009 ms each0pyreedsolomon fast0.538 s 0.005 ms each0.574 s 0.006 ms each0py unireedsolomon1.921 s 0.019 ms each2.661 s 0.027 ms each0py reedsolo1.255 s 0.013 ms each1.659 s 0.017 ms each0Test run onIntel(R) Core(TM) i7-3770 CPU @ 3.40GHzRS (973, 935, 10) -- encoding and decoding 1000 runstest nameencodingdecodingnum errorspyreedsolomon numpy.ndarray0.081 s 0.081 ms each0.077 s 0.077 ms each0pyreedsolomon list0.173 s 0.173 ms each0.147 s 0.147 ms each0pyreedsolomon bytearray0.082 s 0.082 ms each0.079 s 0.079 ms each0pyreedsolomon bytes0.080 s 0.080 ms each0.078 s 0.078 ms each0pyreedsolomon fast0.076 s 0.076 ms each0.073 s 0.073 ms each0py unireedsolomon10.175 s 10.175 ms each8.111 s 8.111 ms each0RS (255, 223, 8) -- encoding and decoding 10000 runstest nameencodingdecodingnum errorspyreedsolomon numpy.ndarray0.286 s 0.029 ms each0.319 s 0.032 ms each0pyreedsolomon list0.475 s 0.048 ms each0.542 s 0.054 ms each0pyreedsolomon bytearray0.277 s 0.028 ms each0.356 s 0.036 ms each0pyreedsolomon bytes0.272 s 0.027 ms each0.328 s 0.033 ms each0pyreedsolomon fast0.232 s 0.023 ms each0.280 s 0.028 ms each0py unireedsolomon13.396 s 1.340 ms each13.963 s 1.396 ms each0py reedsolo12.086 s 1.209 ms each24.035 s 2.404 ms each0RS (15, 11, 4) -- encoding and decoding 100000 runstest nameencodingdecodingnum errorspyreedsolomon numpy.ndarray1.365 s 0.014 ms each1.453 s 0.015 ms each0pyreedsolomon list1.759 s 0.018 ms each1.900 s 0.019 ms each0pyreedsolomon bytearray1.452 s 0.015 ms each1.613 s 0.016 ms each0pyreedsolomon bytes1.409 s 0.014 ms each1.521 s 0.015 ms each0pyreedsolomon fast1.069 s 0.011 ms each1.015 s 0.010 ms each0py unireedsolomon2.626 s 0.026 ms each4.015 s 0.040 ms each0py reedsolo1.991 s 0.020 ms each2.753 s 0.028 ms each0