Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MulAndAddByteSliceLE ¶
MulAndAddByteSliceLE treats in and out as arrays of Ts stored in little-endian format, and adds c.Times(in<T>[i]) to out<T>[i], for each i.
func MulByteSliceLE ¶
MulByteSliceLE treats in and out as arrays of Ts stored in little-endian format, and sets each out<T>[i] to c.Times(in<T>[i]).
Types ¶
type Matrix ¶
type Matrix struct {
// contains filtered or unexported fields
}
Matrix is an immutable rectangular array of elements of GF(2^16). It has just enough methods to support Reed-Solomon erasure codes.
func NewIdentityMatrix ¶
NewIdentityMatrix returns an n x n identity matrix.
func NewMatrixFromFunction ¶
NewMatrixFromFunction returns a rows x columns matrix with elements filled in from the given function, which is passed the row index and the column index, and shouldn't rely on any particular call ordering.
func NewMatrixFromSlice ¶
NewMatrixFromSlice returns a rows x columns matrix with elements taken from the given array in row-major order.
func NewZeroMatrix ¶
NewZeroMatrix returns a rows x columns matrix with every element being zero.
func (Matrix) Inverse ¶
Inverse returns the matrix inverse of m, which must be square, or an error if it is singular.
func (Matrix) RowReduceForInverse ¶
RowReduceForInverse runs row reduction on copies of m, which must be square, and n, which must have the same number of rows as m. The row-reduced copy of n is returned if m is non-singular; otherwise, an empty matrix and an error is returned.
Note that if n is the identity matrix, then the inverse of m is returned. This is the special case of the following fact: if n is equal to some matrix ( n_L | I ), where I is the appropriately-sized identity matrix and | denotes horizontal augmentation, then if the returned matrix is n', the matrix ( I / n' ) is the inverse of ( I / n_L | 0 / m ), where / denotes vertical augmentation.
type T ¶
type T uint16
T is an element of GF(2^16).
func (T) Div ¶
Div returns the product of t and u^{-1} as elements of GF(2^16), if u != 0. It panics if u == 0.
func (T) Minus ¶
Minus returns the difference of t and u as elements of GF(2^16), which is just the bitwise xor of the two.
func (T) Plus ¶
Plus returns the sum of t and u as elements of GF(2^16), which is just the bitwise xor of the two.