matrix

package
v0.0.0-...-ec3c368 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2023 License: Unlicense Imports: 1 Imported by: 0

Documentation

Overview

Package matrix implements common matrix operations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Matrix

type Matrix [][]float64

Matrix is an m by n matrix of m rows and n columns.

func New

func New(m, n int) (A Matrix)

New creates and returns a new m by n matrix of m rows and n columns.

func (Matrix) Add

func (A Matrix) Add(B Matrix) (C Matrix)

Add returns the result of adding A to B.

C = A + B

func (Matrix) Adj

func (A Matrix) Adj() (B Matrix)

Adj returns the adjugate of the matrix A.

func (Matrix) Cols

func (A Matrix) Cols() (n int)

Cols returns the number of columns in A.

func (Matrix) Det

func (A Matrix) Det() float64

Det returns the determinant of the matrix A.

func (Matrix) ForEach

func (A Matrix) ForEach(f func(i, j int))

ForEach calls f for each entry (at row i and column j) in A.

func (Matrix) Inv

func (A Matrix) Inv() (B Matrix)

Inv returns the inverse of the matrix A.

func (Matrix) Mul

func (A Matrix) Mul(B Matrix) (C Matrix)

Mul returns the result of multiplying A by B.

C = A * B

func (Matrix) Rows

func (A Matrix) Rows() (m int)

Rows returns the number of rows in A.

func (Matrix) ScalarMul

func (A Matrix) ScalarMul(b float64) (C Matrix)

ScalarMul returns the result of multiplying A by the scalar b.

C = bA

func (Matrix) Sub

func (A Matrix) Sub(B Matrix) (C Matrix)

Sub returns the result of subtracting A from B.

C = A - B

func (Matrix) Trans

func (A Matrix) Trans() (B Matrix)

Trans returns the transpose of the matrix A.

B = trans(A)

Jump to

Keyboard shortcuts

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