hgeometry-0.7.0.0: Geometric Algorithms, Data structures, and Data types.

Data.Geometry.Vector.VectorFamilyPeano

Synopsis

# Natural number stuff

type One = S Z Source #

type Two = S One Source #

type Three = S Two Source #

type Many d = S (S (S (S (S d)))) Source #

type family FromPeano (d :: PeanoNum) :: Nat where ... Source #

Equations

 FromPeano Z = 0 FromPeano (S d) = 1 + FromPeano d

data SingPeano (d :: PeanoNum) where Source #

Constructors

 SZ :: SingPeano Z SS :: !(SingPeano d) -> SingPeano (S d)

class ImplicitPeano (d :: PeanoNum) where Source #

Minimal complete definition

implicitPeano

Methods

Instances
 Source # Instance detailsDefined in Data.Geometry.Vector.VectorFamilyPeano Methods ImplicitPeano d => ImplicitPeano (S d) Source # Instance detailsDefined in Data.Geometry.Vector.VectorFamilyPeano Methods

# d dimensional Vectors

newtype VectorFamily (d :: PeanoNum) (r :: *) Source #

Datatype representing d dimensional vectors. The default implementation is based n VectorFixed. However, for small vectors we automatically select a more efficient representation.

Constructors

 VectorFamily Fields_unVF :: VectorFamilyF d r
Instances
 Source # Instance detailsDefined in Data.Geometry.Vector.VectorFamilyPeano Methodsfmap :: (a -> b) -> VectorFamily d a -> VectorFamily d b #(<\$) :: a -> VectorFamily d b -> VectorFamily d a # Source # Instance detailsDefined in Data.Geometry.Vector.VectorFamilyPeano Methodspure :: a -> VectorFamily d a #(<*>) :: VectorFamily d (a -> b) -> VectorFamily d a -> VectorFamily d b #liftA2 :: (a -> b -> c) -> VectorFamily d a -> VectorFamily d b -> VectorFamily d c #(*>) :: VectorFamily d a -> VectorFamily d b -> VectorFamily d b #(<*) :: VectorFamily d a -> VectorFamily d b -> VectorFamily d a # Source # Instance detailsDefined in Data.Geometry.Vector.VectorFamilyPeano Methodsfold :: Monoid m => VectorFamily d m -> m #foldMap :: Monoid m => (a -> m) -> VectorFamily d a -> m #foldr :: (a -> b -> b) -> b -> VectorFamily d a -> b #foldr' :: (a -> b -> b) -> b -> VectorFamily d a -> b #foldl :: (b -> a -> b) -> b -> VectorFamily d a -> b #foldl' :: (b -> a -> b) -> b -> VectorFamily d a -> b #foldr1 :: (a -> a -> a) -> VectorFamily d a -> a #foldl1 :: (a -> a -> a) -> VectorFamily d a -> a #toList :: VectorFamily d a -> [a] #null :: VectorFamily d a -> Bool #length :: VectorFamily d a -> Int #elem :: Eq a => a -> VectorFamily d a -> Bool #maximum :: Ord a => VectorFamily d a -> a #minimum :: Ord a => VectorFamily d a -> a #sum :: Num a => VectorFamily d a -> a #product :: Num a => VectorFamily d a -> a # Source # Instance detailsDefined in Data.Geometry.Vector.VectorFamilyPeano Methodstraverse :: Applicative f => (a -> f b) -> VectorFamily d a -> f (VectorFamily d b) #sequenceA :: Applicative f => VectorFamily d (f a) -> f (VectorFamily d a) #mapM :: Monad m => (a -> m b) -> VectorFamily d a -> m (VectorFamily d b) #sequence :: Monad m => VectorFamily d (m a) -> m (VectorFamily d a) # Source # Instance detailsDefined in Data.Geometry.Vector.VectorFamilyPeano Associated Typestype Diff (VectorFamily d) :: * -> * # Methods(.-.) :: Num a => VectorFamily d a -> VectorFamily d a -> Diff (VectorFamily d) a #(.+^) :: Num a => VectorFamily d a -> Diff (VectorFamily d) a -> VectorFamily d a #(.-^) :: Num a => VectorFamily d a -> Diff (VectorFamily d) a -> VectorFamily d a # Source # Instance detailsDefined in Data.Geometry.Vector.VectorFamilyPeano Methodsdot :: Num a => VectorFamily d a -> VectorFamily d a -> a #quadrance :: Num a => VectorFamily d a -> a #qd :: Num a => VectorFamily d a -> VectorFamily d a -> a #distance :: Floating a => VectorFamily d a -> VectorFamily d a -> a #norm :: Floating a => VectorFamily d a -> a #signorm :: Floating a => VectorFamily d a -> VectorFamily d a # Source # Instance detailsDefined in Data.Geometry.Vector.VectorFamilyPeano Methodszero :: Num a => VectorFamily d a #(^+^) :: Num a => VectorFamily d a -> VectorFamily d a -> VectorFamily d a #(^-^) :: Num a => VectorFamily d a -> VectorFamily d a -> VectorFamily d a #lerp :: Num a => a -> VectorFamily d a -> VectorFamily d a -> VectorFamily d a #liftU2 :: (a -> a -> a) -> VectorFamily d a -> VectorFamily d a -> VectorFamily d a #liftI2 :: (a -> b -> c) -> VectorFamily d a -> VectorFamily d b -> VectorFamily d c # ImplicitArity d => Vector (VectorFamily d) r Source # Instance detailsDefined in Data.Geometry.Vector.VectorFamilyPeano Methodsconstruct :: Fun (Peano (Dim (VectorFamily d))) r (VectorFamily d r) #inspect :: VectorFamily d r -> Fun (Peano (Dim (VectorFamily d))) r b -> b #basicIndex :: VectorFamily d r -> Int -> r # (Eq r, ImplicitArity d) => Eq (VectorFamily d r) Source # Instance detailsDefined in Data.Geometry.Vector.VectorFamilyPeano Methods(==) :: VectorFamily d r -> VectorFamily d r -> Bool #(/=) :: VectorFamily d r -> VectorFamily d r -> Bool # (Ord r, ImplicitArity d) => Ord (VectorFamily d r) Source # Instance detailsDefined in Data.Geometry.Vector.VectorFamilyPeano Methodscompare :: VectorFamily d r -> VectorFamily d r -> Ordering #(<) :: VectorFamily d r -> VectorFamily d r -> Bool #(<=) :: VectorFamily d r -> VectorFamily d r -> Bool #(>) :: VectorFamily d r -> VectorFamily d r -> Bool #(>=) :: VectorFamily d r -> VectorFamily d r -> Bool #max :: VectorFamily d r -> VectorFamily d r -> VectorFamily d r #min :: VectorFamily d r -> VectorFamily d r -> VectorFamily d r # (ImplicitArity d, Show r) => Show (VectorFamily d r) Source # Instance detailsDefined in Data.Geometry.Vector.VectorFamilyPeano MethodsshowsPrec :: Int -> VectorFamily d r -> ShowS #show :: VectorFamily d r -> String #showList :: [VectorFamily d r] -> ShowS # (ToJSON r, ImplicitArity d) => ToJSON (VectorFamily d r) Source # Instance detailsDefined in Data.Geometry.Vector.VectorFamilyPeano MethodstoJSON :: VectorFamily d r -> Value #toEncoding :: VectorFamily d r -> Encoding #toJSONList :: [VectorFamily d r] -> Value #toEncodingList :: [VectorFamily d r] -> Encoding # (FromJSON r, ImplicitArity d) => FromJSON (VectorFamily d r) Source # Instance detailsDefined in Data.Geometry.Vector.VectorFamilyPeano MethodsparseJSON :: Value -> Parser (VectorFamily d r) # (NFData r, ImplicitArity d) => NFData (VectorFamily d r) Source # Instance detailsDefined in Data.Geometry.Vector.VectorFamilyPeano Methodsrnf :: VectorFamily d r -> () # ImplicitArity d => Ixed (VectorFamily d r) Source # Instance detailsDefined in Data.Geometry.Vector.VectorFamilyPeano Methodsix :: Index (VectorFamily d r) -> Traversal' (VectorFamily d r) (IxValue (VectorFamily d r)) # type Dim (VectorFamily d) Source # Instance detailsDefined in Data.Geometry.Vector.VectorFamilyPeano type Dim (VectorFamily d) = FromPeano d type Diff (VectorFamily d) Source # Instance detailsDefined in Data.Geometry.Vector.VectorFamilyPeano type Diff (VectorFamily d) = VectorFamily d type Index (VectorFamily d r) Source # Instance detailsDefined in Data.Geometry.Vector.VectorFamilyPeano type Index (VectorFamily d r) = Int type IxValue (VectorFamily d r) Source # Instance detailsDefined in Data.Geometry.Vector.VectorFamilyPeano type IxValue (VectorFamily d r) = r

type family VectorFamilyF (d :: PeanoNum) :: * -> * where ... Source #

Mapping between the implementation type, and the actual implementation.

Equations

 VectorFamilyF Z = Const () VectorFamilyF One = Identity VectorFamilyF Two = V2 VectorFamilyF Three = V3 VectorFamilyF Four = V4 VectorFamilyF (Many d) = Vector (FromPeano (Many d))

element' :: forall d r. ImplicitArity d => Int -> Traversal' (VectorFamily d r) r Source #

destruct :: (ImplicitArity d, ImplicitArity (S d)) => VectorFamily (S d) r -> (r, VectorFamily d r) Source #

Get the head and tail of a vector

snoc :: (ImplicitArity d, ImplicitArity (S d), (1 + FromPeano d) ~ (FromPeano d + 1)) => VectorFamily d r -> r -> VectorFamily (S d) r Source #