Documentation
¶
Index ¶
- Constants
- type Matrix
- func (m *Matrix[T]) AllOfColumn(col int, f func(cell T) bool) (bool, error)
- func (m *Matrix[T]) AllOfRow(row int, f func(cell T) bool) (bool, error)
- func (m *Matrix[T]) AnyOfPoints(points PairIterator, f func(cell T) bool) (bool, error)
- func (m *Matrix[T]) ColumnData(col int) ([]T, error)
- func (m *Matrix[T]) Filtered(f func(cell T) bool) ([]struct{ ... }, error)
- func (m *Matrix[T]) Get(row, column int) (T, error)
- func (m *Matrix[T]) MirrorColumns() error
- func (m *Matrix[T]) MirrorRows() error
- func (m *Matrix[T]) RemoveRow(r int) error
- func (m *Matrix[T]) Rotate() error
- func (m *Matrix[T]) RowData(row int) ([]T, error)
- func (m *Matrix[T]) Set(row, column int, value T) error
- func (m *Matrix[T]) SetBatch(value T, points PairIterator) error
- func (m *Matrix[T]) ShiftRowsDown() error
- func (m *Matrix[T]) Transpose() error
- type PairIterator
Constants ¶
const ( InvalidIndexError = "InvalidIndexError" NilMatrixObject = "NilMatrixObject" InvalidMatrixSize = "InvalidMatrixSize" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Matrix ¶
type Matrix[T any] struct { // contains filtered or unexported fields }
Matrix represent simple square of any type data
func NewMatrixFromPoints ¶ added in v1.3.0
func NewMatrixFromPoints[T any](points PairIterator, value T) *Matrix[T]
NewMatrixFromPoints create matrix of int with filled by `value` cells from `points`. Other cells filled by default value for type T.
func NewZeroMatrix ¶
NewZeroMatrix create default initialized matrix with specified size
func (*Matrix[T]) AllOfColumn ¶
AllOfColumn check `f` for each value on `col`
func (*Matrix[T]) AnyOfPoints ¶ added in v1.1.0
func (m *Matrix[T]) AnyOfPoints(points PairIterator, f func(cell T) bool) (bool, error)
AnyOfPoints check if for any of `points` success functor `f`
func (*Matrix[T]) ColumnData ¶
ColumnData get slice of values stored in spicified column
func (*Matrix[T]) Filtered ¶ added in v1.2.0
Filtered get slice of points {row, column} represents matrix points which satisfy `f`
func (*Matrix[T]) MirrorColumns ¶ added in v1.2.0
MirrorColumns reverse column order
func (*Matrix[T]) MirrorRows ¶ added in v1.2.0
MirrorRows reverse row order
func (*Matrix[T]) SetBatch ¶ added in v1.1.0
func (m *Matrix[T]) SetBatch(value T, points PairIterator) error
SetBatch set `value` to each point [row, column] from slice `points`
func (*Matrix[T]) ShiftRowsDown ¶
ShiftRowsDown shift all rows down to 1 row. First row make default values row.
type PairIterator ¶ added in v1.2.0
type PairIterator interface {
// Begin set iterator to begin
Begin()
// Next iterate to the next element or to the first element (if it is first call) and return true if element exists
Next() bool
// First get first value from pair
First() int
// Second get second value from pair
Second() int
}
PairIterator interface for iteraing on any collection with 2 values