matrix

package
v0.0.0-...-8cfed74 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Identity = New([]float64{1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1})

Identity is a 4x4 identity matrix

Functions

This section is empty.

Types

type Matrix

type Matrix struct {
	N      int
	Values [][]float64
}

Matrix represents a NxN matrix

func New

func New(arr []float64) *Matrix

New returns a new NxN matrix from an array of N*N values

func (*Matrix) At

func (m *Matrix) At(i, j int) float64

At returns matrix value at (i,J)

func (*Matrix) Cofactor

func (m *Matrix) Cofactor(i, j int) float64

Cofactor returns the cofactor of a matrix at row i and column j

func (*Matrix) Determinant

func (m *Matrix) Determinant() float64

Determinant returns the determinant of a NxN matrix

func (*Matrix) Equals

func (m *Matrix) Equals(n *Matrix) bool

Equals reports whether two matrices are equal

func (*Matrix) Inverse

func (m *Matrix) Inverse() (*Matrix, error)

Inverse returns the inverse of a matrix

func (*Matrix) Invertible

func (m *Matrix) Invertible() bool

Invertible reports if a matrix is invertible

func (*Matrix) Minor

func (m *Matrix) Minor(i, j int) float64

Minor returns the minor of a matrix at row i and column j

func (*Matrix) Multiply

func (m *Matrix) Multiply(n *Matrix) *Matrix

Multiply returns the product of two 4x4 matrices

func (*Matrix) MultiplyTuple

func (m *Matrix) MultiplyTuple(t tuple.Tuple) tuple.Tuple

MultiplyTuple returns the product of a matrix and tuple

func (*Matrix) Submatrix

func (m *Matrix) Submatrix(r, c int) *Matrix

Submatrix returns a copy of m after deleting row r and column c from it

func (*Matrix) Transpose

func (m *Matrix) Transpose() Matrix

Transpose returns the transpose of a matrix

Jump to

Keyboard shortcuts

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