matrix

package
v0.0.0-...-1420a53 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DotProduct

dotProduct returns the dot-product of the two vectors. This will panic if the dimensions differ.

func VectorFromIntSlice

func VectorFromIntSlice(L *integervector.Parent, S []int) *integervector.Element

VectorFromIntSlice returns an integer vector in the lattice L from the given slice. It will panic if the dimension of L does not match the length of S.

func VectorFromIntegerSlice

func VectorFromIntegerSlice(L *integervector.Parent, S []*integer.Element) *integervector.Element

VectorFromIntegerSlice returns an integer vector in the lattice L from the given slice. It will panic if the dimension of L does not match the length of S.

func VectorMultiplyMatrix

func VectorMultiplyMatrix(v *integervector.Element, m Matrix) *integervector.Element

VectorMultiplyMatrix returns the product v*m (i.e. the matrix multiplies the row vector v on the right)

func VectorSum

func VectorSum(S ...*integervector.Element) *integervector.Element

VectorSum returns the sum of the given vectors.

Types

type Matrix

type Matrix []*integervector.Element

Matrix represents a matrix with integer entries, given by a slice of vectors for the columns.

func IdentityMatrix

func IdentityMatrix(dim int) Matrix

IdentityMatrix returns the dim x dim identity matrix

func (Matrix) Column

func (m Matrix) Column(j int) *integervector.Element

Column returns the j-th column of a matrix. j indexes from 0

func (Matrix) Columns

func (m Matrix) Columns() []*integervector.Element

Columns returns the columns of a matrix, as a slice of integer vectors

func (Matrix) EntryOrPanic

func (m Matrix) EntryOrPanic(i int, j int) *integer.Element

EntryOrPanic returns the (i,j) entry of a matrix. i and j both index from 0. This will panic if either i or j is out of range.

func (Matrix) FromColumns

func (m Matrix) FromColumns(columns []*integervector.Element) Matrix

FromColumns returns a new matrix with columns given by columns, which is a slice of integer vectors

func (Matrix) NumberOfColumns

func (m Matrix) NumberOfColumns() int

NumberOfColumns returns the number of columns of the matrix.

func (Matrix) NumberOfRows

func (m Matrix) NumberOfRows() int

NumberOfRows returns the number of rows of the matrix.

func (Matrix) RowSums

func (m Matrix) RowSums() []*integer.Element

RowSums returns a slice S of integers, where the i-th entry of S is the sum of the i-th row of the matrix m.

func (Matrix) String

func (m Matrix) String() string

String returns a string representation of the matrix.

Jump to

Keyboard shortcuts

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