Copyright | (c) Matti A. Eskelinen 2016 |
---|---|
License | MIT |
Maintainer | matti.a.eskelinen@gmail.com |
Stability | experimental |
Portability | POSIX |
Safe Haskell | Safe |
Language | Haskell2010 |
This module implements the various Clif
operations on the underlying type. Currently Clif
is implemented on top of Data.Map, with blades as keys and scalar multipliers as values.
Warning
This module is not intended to be imported by end users and may change drastically in the future. It is currently exposed (and documented) only to help development.
As development continues, some of the definitions here may be exported from the other modules. Comments and suggestions are welcomed.
- newtype Clif b a = Clif {}
- fromList :: (Eq a, Basis b a) => [([b], a)] -> Clif b a
- blade :: (Eq a, Basis b a) => [b] -> a -> Clif b a
- (*:) :: (Eq a, Basis b a) => a -> [b] -> Clif b a
- vec :: (Eq a, Basis b a) => b -> a -> Clif b a
- toList :: Clif b a -> [([b], a)]
- gMul :: (Eq a, Basis b a) => Clif b a -> Clif b a -> Clif b a
- gMul' :: (Eq a, Basis b a) => Map [b] a -> Map [b] a -> Map [b] a
- gPlus :: (Eq a, Basis b a) => Clif b a -> Clif b a -> Clif b a
- gPlus' :: (Eq a, Basis b a) => Map [b] a -> Map [b] a -> Map [b] a
- rev :: Ord b => Clif b a -> Clif b a
- rev' :: Ord b => Map [b] a -> Map [b] a
- canon :: (Eq a, Basis b a) => Clif b a -> Clif b a
- canon' :: (Eq a, Basis b a) => Map [b] a -> Map [b] a
- grade :: (Eq a, Basis b a) => Int -> Clif b a -> Clif b a
- grade' :: (Eq a, Basis b a) => Int -> Map [b] a -> Map [b] a
- contractWith :: (Eq a, Basis b a) => (Int -> Int -> Int) -> Clif b a -> Clif b a -> Clif b a
- filledGrades :: (Eq a, Basis b a) => Clif b a -> [Int]
- filledGrades' :: (Eq a, Basis b a) => Map [b] a -> [Int]
- grades :: (Eq a, Basis b a) => Clif b a -> [(Int, Clif b a)]
- isScalar :: (Eq a, Basis b a) => Clif b a -> Bool
- isZero :: (Eq a, Basis b a) => Clif b a -> Bool
- maxGrade :: (Eq a, Basis b a) => Clif b a -> Int
- (.:) :: (a -> b) -> (c -> d -> a) -> c -> d -> b
Type Clif
A data type representing a Clif (multivector) composed of direct sum of scaled blades
Functor (Clif b) Source # | |
(Eq b, Eq a, Basis b a) => Eq (Clif b a) Source # | The Eq instance calculates the canonical forms of the compared Clifs before comparison. |
(Eq a, Basis b a, Fractional a) => Fractional (Clif b a) Source # | Inverse elements only exist for Clifs c for which c times c is scalar. For others, recip does not terminate. |
(Eq a, Basis b a) => Num (Clif b a) Source # | Note that abs and signum are only well-defined on the scalar component of each Clif, and zero otherwise. |
(Show b, Show a) => Show (Clif b a) Source # | |
Constructors
fromList :: (Eq a, Basis b a) => [([b], a)] -> Clif b a Source #
Constructs a Clif
from a list of blades and their multipliers in canonical form.
>>>
fromList [([], 42), ([E 1, E 2], 1)]
42 *: [] + 1 *: [E 1,E 2]
Deconstruction
Operations
gMul :: (Eq a, Basis b a) => Clif b a -> Clif b a -> Clif b a Source #
The Clifford (geometric) product on Clif
s.
gMul' :: (Eq a, Basis b a) => Map [b] a -> Map [b] a -> Map [b] a Source #
The Clifford product on Map
s of blades and multipliers. Filter out zero values
gPlus :: (Eq a, Basis b a) => Clif b a -> Clif b a -> Clif b a Source #
Addition of Clif
values (direct sum).
gPlus' :: (Eq a, Basis b a) => Map [b] a -> Map [b] a -> Map [b] a Source #
Direct sum of matching keys from two Map
s. Filter out zero values.
rev :: Ord b => Clif b a -> Clif b a Source #
Reverse of a Clif
, i.e. the reverse of all its component blades.
canon' :: (Eq a, Basis b a) => Map [b] a -> Map [b] a Source #
Returns the canonical representation of a Clif
(blades simplified and in canonical order)
grade :: (Eq a, Basis b a) => Int -> Clif b a -> Clif b a Source #
Grade projection on the given grade. For negative values, returns zero.
Note that this always calculates the canonical form of a Clif before projecting it.
grade' :: (Eq a, Basis b a) => Int -> Map [b] a -> Map [b] a Source #
Filter blades (keys) by their length.
contractWith :: (Eq a, Basis b a) => (Int -> Int -> Int) -> Clif b a -> Clif b a -> Clif b a Source #
Properties
filledGrades :: (Eq a, Basis b a) => Clif b a -> [Int] Source #
List of nonzero grades.
Note that this always calculates the canonical form of a Clif before recovering the filled grades.
filledGrades' :: (Eq a, Basis b a) => Map [b] a -> [Int] Source #
List of nonzero grades
Note that this always calculates the canonical form of a Clif before recovering the filled grades.
isScalar :: (Eq a, Basis b a) => Clif b a -> Bool Source #
True if the Clif
contains no nonzero blades of grade greater than zero.
Note that this always calculates the canonical form of a Clif before testing whether it is scalar.
isZero :: (Eq a, Basis b a) => Clif b a -> Bool Source #
True for a zero multivector.
Note that this always calculates the canonical form of a Clif before testing whether it is zero.
maxGrade :: (Eq a, Basis b a) => Clif b a -> Int Source #
The highest nonempty nonzero grade of a Clif.
Note that this always calculates the canonical form of a Clif before recovering the highest grade.