-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Peculiar decode matrices being constructed by build_decode_matrix_into_space() #72
Comments
What values did you pass with |
0x3 -> { 0, 1 } an alternative fix for me is to change |
That is a good find and fix! |
Those rows originate from the encoder matrix which is then inverted so they're not garbage - I'm still puzzled how on earth this could work for anybody else but since I'm not using zfec for its intended purpose - just borrowing some of its math - I can't comment whether or not it does work for other people. @WojciechMigda do you want me to submit a PR? Looks like there are a ton of unit tests that would check this for us? |
One possibility is that the code that normally uses this function re-orders the shards to replace data with parity. e.g. whereas I'm trying to decode Y, Z -> A, B |
Oh, I thought these are values right after the loop.
There are some tests and they pass. In particular the Haskell ones use
I am not a maintainer of this project, I just happen to be on the subject for the past few weeks. As for the existing tests it would be worth checking if they adequately cover this scenario.
I don't see anything like that in |
@chrisstjohn maybe you already figured this out by yourself, but anyway I looked closely into this and these are my conclusions:
(index[i] >= k) || (index[i] == i) (https://github.com/tahoe-lafs/zfec/blob/master/zfec/fec.c#L524) If the above does not hold then
[1] Unless assertions are disabled, but this is not a default setup. |
Thanks @WojciechMigda for your analysis and thoughts. My feeling is that an ordering requirement buried deep in a 'C' library that is implemented way outside in the Python wrapper is a rather brittle design. As you say, right now there is an assertion in
As I agree that right now, in this case, with this Python wrapper, Even in terms of performance there probably wouldn't be an extra indirection as |
I'm interested in pre-calculating some decode matrices so I used some of the "under the hood" functions of fec.c
With a trivial example of k=2, n=3 I get the following:
there are three erase cases identified by a bitmap
but note that the 0x5 and 0x6 decode matrices are identical - which is wrong.
I think I traced the problem to here
build_decode_matrix_into_space()
which does some weird stuff whilst trying to decimate the encoding matrix:I removed the apparent "optimisation" and it all springs into life:
Now this is really really really old code and pretty central the the whole decoder; am I missing something or is it broken?
The text was updated successfully, but these errors were encountered: