matrix

package
v1.0.36 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 20, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CoordinateToOrdinal

func CoordinateToOrdinal[T constraints.Integer](rows, cols T, coord MatrixCoordinate[T]) T

Types

type Matrix

type Matrix[T constraints.Integer, V any] struct {
	MatrixDescriptor[T]
	// contains filtered or unexported fields
}

func FromDescriptor

func FromDescriptor[T constraints.Integer, V any](descriptor MatrixDescriptor[T], initial V) *Matrix[T, V]

func FromSlice

func FromSlice[T constraints.Integer, V any](slice [][]V) *Matrix[T, V]

func (*Matrix[T, V]) Fill

func (t *Matrix[T, V]) Fill(value V)

func (Matrix[T, V]) GetValueC

func (t Matrix[T, V]) GetValueC(coord MatrixCoordinate[T]) (V, bool)

func (Matrix[T, V]) GetValueP

func (t Matrix[T, V]) GetValueP(row, col T) (V, bool)

type MatrixCoordinate

type MatrixCoordinate[T constraints.Integer] struct {
	Row T
	Col T
}

func OrdinalToCoordinate

func OrdinalToCoordinate[T constraints.Integer](rows, cols, ord T) MatrixCoordinate[T]

type MatrixDescriptor

type MatrixDescriptor[T constraints.Integer] struct {
	Rows T
	Cols T
}

func SliceToDescriptor

func SliceToDescriptor[T constraints.Integer, V any](slice [][]V) MatrixDescriptor[T]

func (MatrixDescriptor[T]) CoordinateToOrdinal

func (t MatrixDescriptor[T]) CoordinateToOrdinal(coord MatrixCoordinate[T]) T

func (MatrixDescriptor[T]) OrdinalToPosition

func (t MatrixDescriptor[T]) OrdinalToPosition(ord T) MatrixCoordinate[T]

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL