Copyright | (c) Conal Elliott 2008 |
---|---|
License | BSD3 |
Maintainer | conal@conal.net |
Stability | experimental |
Safe Haskell | Safe |
Language | Haskell98 |
Basis of a vector space, as an associated type This module requires ghc-6.10 or later
Synopsis
- class VectorSpace v => HasBasis v where
- linearCombo :: VectorSpace v => [(v, Scalar v)] -> v
- recompose :: HasBasis v => [(Basis v, Scalar v)] -> v
Documentation
class VectorSpace v => HasBasis v where Source #
basisValue :: Basis v -> v Source #
Interpret basis rep as a vector
basisValue :: (Generic v, HasBasis (VRep v), Basis (VRep v) ~ Basis v) => Basis v -> v Source #
Interpret basis rep as a vector
decompose :: v -> [(Basis v, Scalar v)] Source #
Extract coordinates
decompose :: (Generic v, HasBasis (VRep v), Scalar (VRep v) ~ Scalar v, Basis (VRep v) ~ Basis v) => v -> [(Basis v, Scalar v)] Source #
Extract coordinates
decompose' :: v -> Basis v -> Scalar v Source #
Experimental version. More elegant definitions, and friendly to infinite-dimensional vector spaces.
decompose' :: (Generic v, HasBasis (VRep v), Scalar (VRep v) ~ Scalar v, Basis (VRep v) ~ Basis v) => v -> Basis v -> Scalar v Source #
Experimental version. More elegant definitions, and friendly to infinite-dimensional vector spaces.
Instances
HasBasis Double Source # | |
HasBasis Float Source # | |
HasBasis CFloat Source # | |
HasBasis CDouble Source # | |
Integral a => HasBasis (Ratio a) Source # | |
(HasBasis u, s ~ Scalar u, HasBasis v, s ~ Scalar v) => HasBasis (u, v) Source # | |
HasBasis a => HasBasis (Rec0 a s) Source # | |
(HasBasis u, s ~ Scalar u, HasBasis v, s ~ Scalar v, HasBasis w, s ~ Scalar w) => HasBasis (u, v, w) Source # | |
(HasBasis (f p), HasBasis (g p), Scalar (f p) ~ Scalar (g p)) => HasBasis ((f :*: g) p) Source # | |
HasBasis (f p) => HasBasis (M1 i c f p) Source # | |
linearCombo :: VectorSpace v => [(v, Scalar v)] -> v Source #
Linear combination of vectors