Documentation ¶
Index ¶
- type Matrix
- func (mat *Matrix) Add(a, b *Matrix)
- func (mat *Matrix) And(a, b *Matrix)
- func (mat *Matrix) At(i, j int) int
- func (mat *Matrix) Column(j int) *TransposedVector
- func (mat *Matrix) Dims() (int, int)
- func (mat *Matrix) Equals(m *Matrix) bool
- func (mat *Matrix) MarshalJSON() ([]byte, error)
- func (mat *Matrix) Mul(a, b *Matrix)
- func (mat *Matrix) Negate()
- func (mat *Matrix) Or(a, b *Matrix)
- func (mat *Matrix) Row(i int) *Vector
- func (mat *Matrix) Set(i, j, value int)
- func (mat *Matrix) SetColumn(j int, vec *TransposedVector)
- func (mat *Matrix) SetMatrix(a *Matrix, iOffset, jOffset int)
- func (mat *Matrix) SetRow(i int, vec *Vector)
- func (mat *Matrix) Slice(i, j, rows, cols int) *Matrix
- func (mat Matrix) String() string
- func (mat *Matrix) T() *Matrix
- func (mat *Matrix) UnmarshalJSON(bytes []byte) error
- func (mat *Matrix) XOr(a, b *Matrix)
- func (mat *Matrix) Zeroize()
- func (mat *Matrix) ZeroizeRange(i, j, rows, cols int)
- type TransposedVector
- func (tvec *TransposedVector) Add(a, b *TransposedVector)
- func (tvec *TransposedVector) And(a, b *TransposedVector)
- func (tvec *TransposedVector) At(j int) int
- func (tvec *TransposedVector) Equals(v *TransposedVector) bool
- func (tvec *TransposedVector) Len() int
- func (tvec *TransposedVector) MarshalJSON() ([]byte, error)
- func (tvec *TransposedVector) MulVec(a *Matrix, b *TransposedVector)
- func (tvec *TransposedVector) Negate()
- func (tvec *TransposedVector) NonzeroValues() (indexToValues map[int]int)
- func (tvec *TransposedVector) Or(a, b *TransposedVector)
- func (tvec *TransposedVector) Set(j, value int)
- func (tvec *TransposedVector) SetVec(a *TransposedVector, j int)
- func (tvec *TransposedVector) Slice(j, len int) *TransposedVector
- func (tvec *TransposedVector) String() string
- func (tvec *TransposedVector) T() *Vector
- func (tvec *TransposedVector) UnmarshalJSON(bytes []byte) error
- func (tvec *TransposedVector) XOr(a, b *TransposedVector)
- type Vector
- func (vec *Vector) Add(a, b *Vector)
- func (vec *Vector) And(a, b *Vector)
- func (vec *Vector) At(i int) int
- func (vec *Vector) Dot(a *Vector) int
- func (vec *Vector) Equals(v *Vector) bool
- func (vec *Vector) Len() int
- func (vec *Vector) MarshalJSON() ([]byte, error)
- func (vec *Vector) Mul(vec2 *Vector, mat *Matrix)
- func (vec *Vector) Negate()
- func (vec *Vector) NonzeroValues() (indexToValues map[int]int)
- func (vec *Vector) Or(a, b *Vector)
- func (vec *Vector) Set(i, value int)
- func (vec *Vector) SetVec(a *Vector, i int)
- func (vec *Vector) Slice(i, len int) *Vector
- func (vec *Vector) String() string
- func (vec *Vector) T() *TransposedVector
- func (vec *Vector) UnmarshalJSON(bytes []byte) error
- func (vec *Vector) XOr(a, b *Vector)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Matrix ¶
type Matrix struct {
// contains filtered or unexported fields
}
func NewMat ¶
NewMat creates a new matrix with the specified number of rows and cols. If values is empty, the matrix will be zeroized. If values are not empty it must have rows*cols items. The values are expected to be 0's or 1's anything else may have unexpected behavior matrix's methods.
func NewMatFromVec ¶
func (*Matrix) And ¶
And executes a piecewise logical AND on the two matrices and stores the values in this matrix.
func (*Matrix) Column ¶
func (mat *Matrix) Column(j int) *TransposedVector
Column returns a map containing the non zero row indices as the keys and it's associated values.
func (*Matrix) Equals ¶
Equals return true if the m matrix has the same shape and values as this matrix.
func (*Matrix) MarshalJSON ¶
func (*Matrix) Or ¶
Or executes a piecewise logical OR on the two matrices and stores the values in this matrix.
func (*Matrix) Row ¶
Row returns a map containing the non zero column indices as the keys and it's associated values.
func (*Matrix) SetColumn ¶
func (mat *Matrix) SetColumn(j int, vec *TransposedVector)
SetColumn sets the values in column j. The values' keys are expected to be row indices.
func (*Matrix) SetMatrix ¶
SetMatrix replaces the values of this matrix with the values of from matrix a. The shape of 'a' must be less than or equal mat. If the 'a' shape is less then iOffset and jOffset can be used to place 'a' matrix in a specific location.
func (*Matrix) SetRow ¶
SetRow sets the values in row i. The values' keys are expected to be column indices.
func (*Matrix) Slice ¶
Slice creates a slice of the matrix. The slice will be connected to the original matrix, changes to one causes changes in the other.
func (*Matrix) T ¶
T returns a matrix that is the transpose of the underlying matrix. Note the transpose is connected to matrix it is a transpose of, and changes made to one affect the other.
func (*Matrix) UnmarshalJSON ¶
func (*Matrix) XOr ¶
XOr executes a piecewise logical XOR on the two matrices and stores the values in this matrix.
func (*Matrix) Zeroize ¶
func (mat *Matrix) Zeroize()
Zeroize take the current matrix sets all values to 0.
func (*Matrix) ZeroizeRange ¶
ZeroizeRange take the current matrix sets values inside the range to zero.
type TransposedVector ¶
type TransposedVector struct {
// contains filtered or unexported fields
}
func CopyTVec ¶
func CopyTVec(a *TransposedVector) *TransposedVector
func NewTVec ¶
func NewTVec(length int, values ...int) *TransposedVector
func (*TransposedVector) Add ¶
func (tvec *TransposedVector) Add(a, b *TransposedVector)
func (*TransposedVector) And ¶
func (tvec *TransposedVector) And(a, b *TransposedVector)
func (*TransposedVector) At ¶
func (tvec *TransposedVector) At(j int) int
At returns the value at index i.
func (*TransposedVector) Equals ¶
func (tvec *TransposedVector) Equals(v *TransposedVector) bool
func (*TransposedVector) Len ¶
func (tvec *TransposedVector) Len() int
func (*TransposedVector) MarshalJSON ¶
func (tvec *TransposedVector) MarshalJSON() ([]byte, error)
func (*TransposedVector) MulVec ¶
func (tvec *TransposedVector) MulVec(a *Matrix, b *TransposedVector)
func (*TransposedVector) Negate ¶
func (tvec *TransposedVector) Negate()
func (*TransposedVector) NonzeroValues ¶
func (tvec *TransposedVector) NonzeroValues() (indexToValues map[int]int)
func (*TransposedVector) Or ¶
func (tvec *TransposedVector) Or(a, b *TransposedVector)
func (*TransposedVector) Set ¶
func (tvec *TransposedVector) Set(j, value int)
Set sets the value at row index i and column index j to value.
func (*TransposedVector) SetVec ¶
func (tvec *TransposedVector) SetVec(a *TransposedVector, j int)
SetVec replaces the values of this vector with the values of from vector a.
func (*TransposedVector) Slice ¶
func (tvec *TransposedVector) Slice(j, len int) *TransposedVector
Slice creates a slice of the TransposedVector. The slice will be connected to the original TransposedVector, changes to one causes changes in the other.
func (*TransposedVector) String ¶
func (tvec *TransposedVector) String() string
func (*TransposedVector) T ¶
func (tvec *TransposedVector) T() *Vector
func (*TransposedVector) UnmarshalJSON ¶
func (tvec *TransposedVector) UnmarshalJSON(bytes []byte) error
func (*TransposedVector) XOr ¶
func (tvec *TransposedVector) XOr(a, b *TransposedVector)
type Vector ¶
type Vector struct {
// contains filtered or unexported fields
}
func (*Vector) MarshalJSON ¶
func (*Vector) NonzeroValues ¶
func (*Vector) Slice ¶
Slice creates a slice of the Vector. The slice will be connected to the original Vector, changes to one causes changes in the other.
func (*Vector) T ¶
func (vec *Vector) T() *TransposedVector