Documentation
¶
Index ¶
- type Decoder
- type GaussElimDecoderState
- func (d *GaussElimDecoderState) AddPiece(codedPiece *coder.CodedPiece)
- func (d *GaussElimDecoderState) CodedPieceMatrix() matrix.Matrix
- func (d *GaussElimDecoderState) CoefficientMatrix() matrix.Matrix
- func (d *GaussElimDecoderState) GetPiece(idx uint) (coder.Piece, error)
- func (d *GaussElimDecoderState) IsLinearIndependent(vector coder.CodingVector) bool
- func (d *GaussElimDecoderState) Rank() uint
- func (d *GaussElimDecoderState) Rref()
- type GaussElimRLNCDecoder
- func (d *GaussElimRLNCDecoder) AddPiece(piece *coder.CodedPiece) error
- func (d *GaussElimRLNCDecoder) GetPiece(i uint) (coder.Piece, error)
- func (d *GaussElimRLNCDecoder) GetPieces() ([]coder.Piece, error)
- func (d *GaussElimRLNCDecoder) IsDecoded() bool
- func (d *GaussElimRLNCDecoder) PieceLength() uint
- func (d *GaussElimRLNCDecoder) ProcessRate() float64
- func (d *GaussElimRLNCDecoder) Required() uint
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Decoder ¶
type Decoder interface { PieceLength() uint IsDecoded() bool Required() uint ProcessRate() float64 AddPiece(piece *coder.CodedPiece) error GetPiece(index uint) (coder.Piece, error) GetPieces() ([]coder.Piece, error) }
func NewGaussElimRLNCDecoder ¶
If minimum #-of linearly independent coded pieces required for decoding coded pieces --- is provided with, it returns a decoder, which keeps applying full RLNC decoding step on received coded pieces
As soon as minimum #-of linearly independent pieces are obtained which is generally equal to original #-of pieces, decoded pieces can be read back
type GaussElimDecoderState ¶
type GaussElimDecoderState struct {
// contains filtered or unexported fields
}
func NewGaussElimDecoderState ¶
func NewGaussElimDecoderState(gf *galoisfield.GF, coeffs, coded matrix.Matrix) *GaussElimDecoderState
func NewGaussElimDecoderStateWithPieceCount ¶
func NewGaussElimDecoderStateWithPieceCount(gf *galoisfield.GF, pieceCount uint) *GaussElimDecoderState
func (*GaussElimDecoderState) AddPiece ¶
func (d *GaussElimDecoderState) AddPiece(codedPiece *coder.CodedPiece)
Adds a new coded piece to decoder state, which will hopefully help in decoding pieces, if linearly independent with other rows i.e. read pieces
func (*GaussElimDecoderState) CodedPieceMatrix ¶
func (d *GaussElimDecoderState) CodedPieceMatrix() matrix.Matrix
Current state of coded piece matrix, which is updated along side coding coefficient matrix ( during rref )
func (*GaussElimDecoderState) CoefficientMatrix ¶
func (d *GaussElimDecoderState) CoefficientMatrix() matrix.Matrix
Current state of coding coefficient matrix
func (*GaussElimDecoderState) GetPiece ¶
func (d *GaussElimDecoderState) GetPiece(idx uint) (coder.Piece, error)
Request decoded piece by index ( 0 based, definitely )
If piece not yet decoded/ requested index is >= #-of pieces coded together, returns error message indicating so
Otherwise piece is returned, without any error ¶
Note: This method will copy decoded piece into newly allocated memory when whole decoding hasn't yet happened, to prevent any chance that user mistakenly modifies slice returned ( read piece ) & that affects next round of decoding ( when new piece is received )
func (*GaussElimDecoderState) IsLinearIndependent ¶
func (d *GaussElimDecoderState) IsLinearIndependent(vector coder.CodingVector) bool
func (*GaussElimDecoderState) Rank ¶
func (d *GaussElimDecoderState) Rank() uint
Expected to be invoked after RREF-ed, in other words it won't rref matrix first to calculate rank, rather that needs to first invoked
func (*GaussElimDecoderState) Rref ¶
func (d *GaussElimDecoderState) Rref()
Calculates Reduced Row Echelon Form of coefficient matrix, while also modifying coded piece matrix First it forward, backward cleans up matrix i.e. cells other than pivots are zeroed, later it checks if some rows of coefficient matrix are linearly dependent or not, if yes it removes those, while respective rows of coded piece matrix is also removed --- considered to be `not useful piece`
Note: All operations are in-place, no more memory allocations are performed
type GaussElimRLNCDecoder ¶
type GaussElimRLNCDecoder struct {
// contains filtered or unexported fields
}
func (*GaussElimRLNCDecoder) AddPiece ¶
func (d *GaussElimRLNCDecoder) AddPiece(piece *coder.CodedPiece) error
AddPiece - Adds a new received coded piece along with coding vector. After every new coded piece reception augmented matrix ( coding vector + coded piece ) is rref-ed, to keep it as ready as possible for consuming decoded pieces
Note: As soon as all pieces are decoded, no more calls to this method does anything useful --- so better check for error & proceed !
func (*GaussElimRLNCDecoder) GetPiece ¶
func (d *GaussElimRLNCDecoder) GetPiece(i uint) (coder.Piece, error)
GetPiece - Get a decoded piece by index, may ( not ) succeed !
Note: It's not necessary that full decoding needs to happen for this method to return something useful
If M-many pieces are received among N-many expected ( read M <= N ) then pieces with index in [0..M] ( remember upper bound exclusive ) can be attempted to be consumed, given algebric structure has revealed requested piece at index `i`
func (*GaussElimRLNCDecoder) GetPieces ¶
func (d *GaussElimRLNCDecoder) GetPieces() ([]coder.Piece, error)
GetPieces - Get a list of all decoded pieces, given full decoding has happened
func (*GaussElimRLNCDecoder) IsDecoded ¶
func (d *GaussElimRLNCDecoder) IsDecoded() bool
IsDecoded - Use it for checking whether more piece collection is required or not
If it returns false, denotes more linearly independent pieces need to be collected, only then decoding can be completed
func (*GaussElimRLNCDecoder) PieceLength ¶
func (d *GaussElimRLNCDecoder) PieceLength() uint
PieceLength - Returns piece length in bytes
If no pieces are yet added to decoder state, then returns 0, denoting **unknown**
func (*GaussElimRLNCDecoder) ProcessRate ¶
func (d *GaussElimRLNCDecoder) ProcessRate() float64
ProcessRate - How many pieces are received so far ? Returns a value in range [0..1]
func (*GaussElimRLNCDecoder) Required ¶
func (d *GaussElimRLNCDecoder) Required() uint
Required - How many more linearly independent pieces are required for successfully decoding pieces ?