wirehair icon indicating copy to clipboard operation
wirehair copied to clipboard

Issue understanding matrix layout

Open orlp opened this issue 5 years ago • 5 comments

In WirehairCodec.h we find:

    (1) Matrix Construction
        A = Original data blocks, N blocks long.
        D = Count of dense/heavy matrix rows (see below), chosen based on N.
        E = N + D blocks = Count of recovery set blocks.
        R = Recovery blocks, E blocks long.
        C = Matrix, with E rows and E columns.
        0 = Dense/heavy rows sum to zero.
        +---------+-------+   +---+   +---+
        |         |       |   |   |   |   |
        |    P    |   M   |   |   |   | A |
        |         |       |   |   |   |   |
        +---------+-----+-+ x | R | = +---+
        |    D    |  J  |0|   |   |   | 0 |
        +---------+-+---+-+   |   |   +---+
        |    0      |  H  |   |   |   | 0 |
        +-----------+-----+   +---+   +---+
        A and B are Ex1 vectors of blocks.
            A has N rows of the original data padded by H zeros.
            R has E rows of encoded blocks.
        C is the ExE hybrid matrix above:
            P is the NxN peeling binary submatrix.
                - Optimized for success of the peeling solver.
            M is the NxD mixing binary submatrix.
                - Used to mix the D dense/heavy rows into the peeling rows.
            D is the DxN dense binary submatrix.
                - Used to improve on recovery properties of peeling code.
            J is a DxD random-looking invertible submatrix.
            H is the 6x18 heavy GF(256) submatrix.
                - Used to improve on recovery properties of dense code.
            0 is a Dx6 zero submatrix.

My confusion lies in the M, D, J and 0 part. If M is NxD and D is DxN and J is DxD, then J exactly fills the corner between M and D and there should be no room for the 0 part. What gives?

orlp avatar Aug 26 '19 12:08 orlp

Sorry about the confusion. I had to go check the code to be sure.

_dense_count = D _block_count = N _mix_count = _dense_count + 6

So it looks like the 0 matrix to the right of J is Dx6 in size, and the size of M is Nx(D+6) rather than NxD.

catid avatar Aug 27 '19 05:08 catid

@catid Another issue I have with that particular section of documentation is that there are multiple references to an object B, however one calls it a vector, the other a matrix, and none of them say what B actually is.

A and B are Ex1 vectors of blocks.

After that the encoder will start producing random- looking M-byte blocks by generating new rows for P and M and multiplying them by B.

Once enough rows have been received, back-substitution reconstructs matrix B.

orlp avatar Aug 28 '19 06:08 orlp

Good point. I'll improve it tonight after work

On Tue, Aug 27, 2019, 11:16 PM Orson Peters [email protected] wrote:

@catid https://github.com/catid Another issue I have with that particular section of documentation is that there are multiple references to an object B, however one call it a vector, the other a matrix, and none of them say what B actually is.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/catid/wirehair/issues/17?email_source=notifications&email_token=AAB5SIP3T47BUN75XGVEDEDQGYJ3TA5CNFSM4IPPMZS2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5KALLY#issuecomment-525600175, or mute the thread https://github.com/notifications/unsubscribe-auth/AAB5SIP2WSPLMTHVQEKBNTDQGYJ3TANCNFSM4IPPMZSQ .

catid avatar Aug 28 '19 22:08 catid

Perhaps also could be added how matrix J is generated.

orlp avatar Aug 28 '19 23:08 orlp

You got it.

On Wed, Aug 28, 2019, 4:31 PM Orson Peters [email protected] wrote:

Perhaps also could be added how matrix J is generated.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/catid/wirehair/issues/17?email_source=notifications&email_token=AAB5SIKOZUK5DS32Y6ROYZ3QG4DENA5CNFSM4IPPMZS2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5MYSUA#issuecomment-525961552, or mute the thread https://github.com/notifications/unsubscribe-auth/AAB5SIPSK3QIGY2IMLSRUGTQG4DENANCNFSM4IPPMZSQ .

catid avatar Aug 29 '19 23:08 catid