Documentation ¶
Index ¶
- type Matrix
- func (m *Matrix) AddRow(r *Row)
- func (m *Matrix) AddRowInts(coefficients []int, constant int)
- func (m *Matrix) AddRows(rows []*Row)
- func (m *Matrix) Equal(other *Matrix) bool
- func (m *Matrix) Impossible() bool
- func (m *Matrix) KnownCoefficientCount() int
- func (m *Matrix) KnownCoefficientFloats() ([]float64, []bool)
- func (m *Matrix) KnownCoefficients() ([]*big.Rat, []bool)
- func (m *Matrix) NumCoefficients() int
- func (m *Matrix) Printable(prefix string, brackets bool) string
- func (m *Matrix) Rank() int
- func (m *Matrix) Rows() []*Row
- type Row
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
}
matrix represents an augmented matrix, for reduction.
func (*Matrix) AddRow ¶
AddRow adds a new row to the matrix. If the matrix is already reduced, it reduces it again. If the row contains a different number of coefficients from rows already in the matrix, AddRow panics.
func (*Matrix) AddRowInts ¶
AddRowInts adds a new row to the matrix, given integer coefficients and constant. If the matrix is already reduced, it reduces it again. If the row contains a different number of coefficients from rows already in the matrix, AddRow panics.
func (*Matrix) AddRows ¶
AddRows adds multiple new rows to the matrix. If the matrix is already reduced, it reduces it again. If the row contains a different number of coefficients from rows already in the matrix, AddRow panics.
func (*Matrix) Impossible ¶
Impossible returns true if there are rows with impossible values: all zero coefficients adding to a non-zero constant. It performs reduction first, if it hasn't been done already.
func (*Matrix) KnownCoefficientCount ¶
KnownCoefficientCount calls KnownCoefficients, but just returns the number of known coefficients.
func (*Matrix) KnownCoefficientFloats ¶
KnownCoefficientFloats returns almost the same result as KnownCoefficients, with Rationals converted to float64s. The difference is that if the magnitude of a rational is too large to be represented as a float64, the corresponding float will be an infinity, and the corresponding boolean will be set to false if it wasn't already false.
func (*Matrix) KnownCoefficients ¶
KnownCoefficients reduces the matrix, and returns a slice of coefficient values and a slice of booleans denoting whether the corresponding coefficient is actually known.
func (*Matrix) NumCoefficients ¶
NumCoefficients returns the number of coefficients in the matrix.
type Row ¶
type Row struct {
// contains filtered or unexported fields
}
Row represents a row in an augmented matrix. The last (constant) column is pulled out into its own field, k.
func (*Row) Coefficients ¶
Coefficients returns the coefficients of the row.
func (*Row) NonZeroCoefficientCount ¶
NonZeroCoefficientCount returns the number of non-zero coefficients in the row.
func (*Row) NumCoefficients ¶
NumCoefficients returns the number of coefficients in the row.