matrix

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2021 License: BSD-3-Clause Imports: 3 Imported by: 2

Documentation

Overview

Package matrix provides a generic matrix abstraction.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ON

func ON(u Matrix) (bool, error)

ON returns true if the matrix is an ON-matrix. It returns an error if the matrix is not quadratic.

func Orthogonal

func Orthogonal(u Matrix) (bool, error)

Orthogonal returns true if the matrix is orthogonal. An error will be returned if the matrix is not quadratic.

Types

type Matrix

type Matrix [][]float64

Matrix is an extension of a 2d slice if float64.

func Add

func Add(u, v Matrix) (Matrix, error)

Add adds the matrices together. The matrices must have the same ammount of rows and columns.

func AddVec

func AddVec(u Matrix, v rn.VecN) (Matrix, error)

AddVec adds the vector to the matrix. The vector must be of the same length as the matrix rows.

func Mult

func Mult(u, v Matrix) (Matrix, error)

Mult multiplies the matrices together to form a new matrix. The new matrix will have the same rows as u and columns as v.

func New

func New(rows, cols int) Matrix

New allocates a new matrix with the set ammount of rows and columns.

func NewFromVec

func NewFromVec(vectors ...rn.VecN) Matrix

NewFromVec creates a new matrix from a set of vectors. The vectors are assummed as column vectors with the same length.

func ScalarMult

func ScalarMult(u Matrix, s float64) Matrix

ScalarMult multiplies the vector u with the scalar s.

func Sub

func Sub(u, v Matrix) (Matrix, error)

Sub subtracts the matrix v from u. The matrices must have the same ammount of rows and columns.

func SubVec

func SubVec(u Matrix, v rn.VecN) (Matrix, error)

SubVec subtracts the vector from the matrix. The vector must be of the same length as the matrix rows.

func Transpose

func Transpose(u Matrix) Matrix

Transpose returns the transposed matrix of u.

func (Matrix) Cols

func (m Matrix) Cols() int

Cols returns the amount of columns in the matrix.

func (Matrix) Rows

func (m Matrix) Rows() int

Rows returns the amount of rows in the matrix.

Jump to

Keyboard shortcuts

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