gma

package module
v0.0.0-...-1e03496 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2022 License: BSD-2-Clause Imports: 3 Imported by: 0

Documentation

Overview

Package gma provides naive primitives for geometric algebra.

Index

Constants

This section is empty.

Variables

View Source
var (
	E1 = uint8(1)
	E2 = uint8(1 << 1)
	E3 = uint8(1 << 2)
	I2 = Blade{1, E1 ^ E2}
	I3 = Blade{1, E1 ^ E2 ^ E3}

	ZB = Blade{}
)

Functions

This section is empty.

Types

type Blade

type Blade struct {
	Scalar float64

	// Basis is a bitmap of independent vectors, if any; vectors must be in
	// canonical ordering so account for sign changes of Scalar when specifying.
	Basis uint8
}

func Scalar

func Scalar(x float64) Blade

Scalar returns a 0-grade Blade.

func (Blade) Angle

func (a Blade) Angle(b Blade) float64

func (Blade) Conj

func (a Blade) Conj() Blade

TODO check

func (Blade) Grade

func (a Blade) Grade() int

Grade returns the number of independent vectors of Blade.

func (Blade) Inverse

func (a Blade) Inverse() Blade

func (Blade) Invol

func (a Blade) Invol() Blade

func (Blade) Lc

func (a Blade) Lc(b Blade) Blade

Lc returns the left contraction of a onto b.

func (Blade) Mul

func (a Blade) Mul(b Blade) Blade

Mul returns the geometric product of ab; assumes orthonormal bases and annihilates dependent vectors.

func (Blade) Norm

func (a Blade) Norm() float64

func (Blade) NormSq

func (a Blade) NormSq() float64

func (Blade) Rev

func (a Blade) Rev() Blade

func (Blade) String

func (a Blade) String() string

TODO return instead something like: 0.8*e1^e2

func (Blade) Wedge

func (a Blade) Wedge(b Blade) Blade

Wedge returns the outer product of a^b; a zero product if a and b are dependent, otherwise the geometric product.

type Multivector

type Multivector []Blade

Multivector is formally defined as a set of blades of varying grades. This package generalizes the type to also represent graded vectors. This may change in the future with explicit types. For example, instead of Multivector{{1, E1}, {1, E1}} one might use Bivector

func Rotor

func Rotor(angle float64, basis uint8) Multivector

TODO for 2D, no need to sandwhich vector; see 7.3.1

func (Multivector) Add

func (Multivector) Angle

func (a Multivector) Angle(b Multivector) float64

func (Multivector) E1

func (a Multivector) E1() float64

func (Multivector) E2

func (a Multivector) E2() float64

func (Multivector) E3

func (a Multivector) E3() float64

func (Multivector) Inverse

func (a Multivector) Inverse() Multivector

func (Multivector) Lc

func (Multivector) Mul

func (Multivector) Norm

func (a Multivector) Norm() float64

func (Multivector) NormSq

func (a Multivector) NormSq() float64

func (Multivector) Rev

func (a Multivector) Rev() Multivector

func (Multivector) Scalar

func (a Multivector) Scalar() float64

func (Multivector) ScalarOf

func (a Multivector) ScalarOf(basis uint8) float64

func (Multivector) ScalarProduct

func (a Multivector) ScalarProduct(b Multivector) float64

func (Multivector) Wedge

func (a Multivector) Wedge(b Multivector) Multivector

Jump to

Keyboard shortcuts

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