Documentation ¶
Index ¶
- Constants
- func Angle(v, w *Vector) complex128
- func DotProduct(v, w *Vector) complex128
- func Parallell(v, w *Vector) bool
- func Perpendicular(v, w *Vector) bool
- func TestAll()
- type Matrix
- func (m *Matrix) Augment(a *Matrix)
- func (m *Matrix) Columns() int
- func (m *Matrix) Conjugate()
- func (m *Matrix) Copy() *Matrix
- func (m *Matrix) Determinant() complex128
- func (a *Matrix) Equal(b *Matrix) bool
- func (m *Matrix) GetColumn(index int) *Vector
- func (m *Matrix) GetRow(index int) *Vector
- func (m *Matrix) HermitianTranspose()
- func (m *Matrix) Inverse()
- func (m *Matrix) IsHermitian() bool
- func (m *Matrix) IsInvertible() bool
- func (m *Matrix) IsSingular() bool
- func (m *Matrix) MatrixMultiply(a *Matrix)
- func (m *Matrix) RR()
- func (m *Matrix) RREF()
- func (m *Matrix) RealString() string
- func (m *Matrix) Rows() int
- func (m *Matrix) ScalarAdd(f complex128)
- func (m *Matrix) ScalarMultiply(f complex128)
- func (m *Matrix) SetColumn(index int, col *Vector)
- func (m *Matrix) SetRow(index int, row *Vector)
- func (m *Matrix) String() string
- func (m *Matrix) Transpose()
- type Vector
- func (v *Vector) Add(w *Vector)
- func (v *Vector) Conjugate()
- func (v *Vector) Copy() *Vector
- func (v *Vector) Equal(w *Vector) bool
- func (v *Vector) Magnitude() complex128
- func (v *Vector) MatrixMultiply(a *Matrix)
- func (v *Vector) Normalize()
- func (v *Vector) ScalarMultiply(factor complex128)
- func (v *Vector) Sub(w *Vector)
Constants ¶
const ERR_AUGM_ROW = "Cannot augment matrices with differing amount of rows"
const ERR_CRSP_DIM = "Can only calculate cross product of 3-dimensional vectors"
const ERR_DETM_SQR = "Cannot calculate inverse of non-square matrix"
const ERR_DOTP_DIM = "Cannot calculate dot-product of vectors with different dimensions"
Panic Messages --------------------------------------------------------------
const ERR_INVR_SNG = "Cannot calculate inverse of singular matrix"
const ERR_INVR_SQR = "Cannot calculate inverse of non-square matrix"
const ERR_MTRX_DIM = "Incompatible matrix dimensions"
const ERR_MTRX_RNG = "The index to get/set is out of range"
const ERR_MTRX_SNG = "Cannot row-reduce singular matrix"
const ERR_NORM_ZER = "Cannot normalize the zero-vector"
const ERR_PARA_ZER = "Cannot determine if zero-vector is parallell to another vector"
const ERR_PERP_ZER = "Cannot determine if zero-vector is perpendicular to another vector"
Variables ¶
This section is empty.
Functions ¶
func DotProduct ¶
func DotProduct(v, w *Vector) complex128
Returns dot product 'v*w'. Panics if 'v' and 'w' differs in dimension. O(n)
func Parallell ¶
Returns whether 'v' and 'w' are perpendicular. If 'v' and 'w' differ in dimension it pads the smaller one with zeroes. Panics if 'v' or 'w' are zero-vectors O(n)
func Perpendicular ¶
Returns whether 'v' and 'w' are perpendicular. Panics if 'v' or 'w' are zero-vectors O(n)
Types ¶
type Matrix ¶
type Matrix [][]complex128
func Zeroes ¶
Returns matrix with specified size filled with zeroes. O(n*m) TODO: Panic if rows or columns == 0
func (*Matrix) Augment ¶
Augments matrix 'm' with matrix 'a'. Panics if sizes are incompatible. O(n*m + p*q)
func (*Matrix) Determinant ¶
func (m *Matrix) Determinant() complex128
Returns determinant of square matrix 'm' Panics if 'm' is not square. TODO: Unsure if works for complex matrices
func (*Matrix) GetColumn ¶
Get column 'index' of matrix 'm' starting at 0. Panics if out of range. O(n)
func (*Matrix) HermitianTranspose ¶
func (m *Matrix) HermitianTranspose()
Transposes and conjugates matrix 'm'. O(n*m)
func (*Matrix) Inverse ¶
func (m *Matrix) Inverse()
Inverses matrix 'm'. Panics if matrix isn't invertible.
func (*Matrix) IsHermitian ¶
Returns whether matrix 'm' is hermitian or not. O(n*m)
func (*Matrix) IsInvertible ¶
Returns whether 'm' is invertible or not.
func (*Matrix) IsSingular ¶
Returns whether 'm' is singular or not. TODO: Defer to recover from singular matrix panic in Determinant()
func (*Matrix) MatrixMultiply ¶
Multiplies matrix 'm' by matrix 'a' O(n^3)
func (*Matrix) RR ¶
func (m *Matrix) RR()
Perform row reduction on matrix 'm'. Panics if singular matrix.
func (*Matrix) RREF ¶
func (m *Matrix) RREF()
Find Row-Reduced Echelon Form of matrix 'm'. Panics if singular matrix.
func (*Matrix) RealString ¶
Return string representation of real matrix 'm' O(n*m)
func (*Matrix) ScalarAdd ¶
func (m *Matrix) ScalarAdd(f complex128)
Adds scalar 'f' to each element in matrix 'm' O(n*m)
func (*Matrix) ScalarMultiply ¶
func (m *Matrix) ScalarMultiply(f complex128)
Multiplies each element in matrix 'm' by scalar 'f' O(n*m)
func (*Matrix) SetColumn ¶
Set column 'index' of matrix 'm' to 'col'. Column index starts at 0. Panics if out of range. O(n)
func (*Matrix) SetRow ¶
Set column 'index' of matrix 'm' to 'row'. Column index starts at 0. Panics if out of range. O(n)
type Vector ¶
type Vector []complex128
func CrossProduct ¶
Returns cross product 'vxw'. Panics if 'v' or 'w' not 3-dimensional. O(1)
func (*Vector) Add ¶
Add 'w' to vector 'v'. Pads vector with zeroes if different sizes O(n), n is highest dimension of 'v', 'w'
func (*Vector) MatrixMultiply ¶
Multiply vector 'v' by matrix 'a'. O(n)
func (*Vector) ScalarMultiply ¶
func (v *Vector) ScalarMultiply(factor complex128)
Multiply 'v' by complex factor. O(n)