HNumeric-0.4.1.0: Haskell Numeric Library with pure functionality, R & MATLAB Syntax.

Copyright(c) Tae Geun Kim 2018
LicenseBSD3
Maintaineredeftg@gmail.com
StabilityStable
Safe HaskellSafe
LanguageHaskell2010

HNum.Vector

Description

 

Synopsis

Documentation

newtype Vector a Source #

Constructors

Vector [a] 

Instances

Functor Vector Source # 

Methods

fmap :: (a -> b) -> Vector a -> Vector b #

(<$) :: a -> Vector b -> Vector a #

Applicative Vector Source # 

Methods

pure :: a -> Vector a #

(<*>) :: Vector (a -> b) -> Vector a -> Vector b #

liftA2 :: (a -> b -> c) -> Vector a -> Vector b -> Vector c #

(*>) :: Vector a -> Vector b -> Vector b #

(<*) :: Vector a -> Vector b -> Vector a #

Foldable Vector Source # 

Methods

fold :: Monoid m => Vector m -> m #

foldMap :: Monoid m => (a -> m) -> Vector a -> m #

foldr :: (a -> b -> b) -> b -> Vector a -> b #

foldr' :: (a -> b -> b) -> b -> Vector a -> b #

foldl :: (b -> a -> b) -> b -> Vector a -> b #

foldl' :: (b -> a -> b) -> b -> Vector a -> b #

foldr1 :: (a -> a -> a) -> Vector a -> a #

foldl1 :: (a -> a -> a) -> Vector a -> a #

toList :: Vector a -> [a] #

null :: Vector a -> Bool #

length :: Vector a -> Int #

elem :: Eq a => a -> Vector a -> Bool #

maximum :: Ord a => Vector a -> a #

minimum :: Ord a => Vector a -> a #

sum :: Num a => Vector a -> a #

product :: Num a => Vector a -> a #

FuncTools Vector Source # 

Methods

hflat :: ([a] -> a) -> Vector a -> a Source #

hlift :: ([a] -> [b]) -> Vector a -> Vector b Source #

hmap :: (a -> b) -> Vector a -> Vector b Source #

hfilter :: (a -> Bool) -> Vector a -> Vector a Source #

htake :: Int -> Vector a -> Vector a Source #

htakeWhile :: (a -> Bool) -> Vector a -> Vector a Source #

hdrop :: Int -> Vector a -> Vector a Source #

hdropWhile :: (a -> Bool) -> Vector a -> Vector a Source #

Concatable Vector Source # 

Methods

hcat :: Vector a -> Vector a -> Vector a Source #

vcat :: Vector a -> Vector a -> Matrix a Source #

VecOps Vector Source # 

Methods

(.+) :: Num a => Vector a -> a -> Vector a Source #

(.-) :: Num a => Vector a -> a -> Vector a Source #

(.*) :: Num a => Vector a -> a -> Vector a Source #

(./) :: Fractional a => Vector a -> a -> Vector a Source #

(.^) :: Floating a => Vector a -> a -> Vector a Source #

(.*.) :: Num a => Vector a -> Vector a -> a Source #

norm :: Floating a => Vector a -> a Source #

Convertable Vector Source # 
List Vector Source # 

Methods

toList :: Vector a -> [a] Source #

fromList :: [a] -> Vector a Source #

(!) :: Vector a -> Int -> a Source #

findFirst :: Eq a => a -> Vector a -> Int Source #

SpecialFunc Vector Source # 

Methods

erf :: Real a => Vector a -> Vector Double Source #

invErf :: Real a => Vector a -> Vector Double Source #

Writable Vector Source # 

Methods

toString :: Show a => Vector a -> String Source #

writeCSV :: Show a => String -> Vector a -> IO () Source #

Statistical Vector Source # 

Methods

mean :: Fractional a => Vector a -> a Source #

cov' :: Floating a => Vector a -> Vector a -> a Source #

cov :: Floating a => Vector a -> Vector a -> Matrix a Source #

var :: Floating a => Vector a -> a Source #

std :: Floating a => Vector a -> a Source #

se :: Floating a => Vector a -> a Source #

cor :: Floating a => Vector a -> Vector a -> a Source #

med :: (Ord a, Floating a) => Vector a -> a Source #

mode :: Eq a => Vector a -> a Source #

cv :: Floating a => Vector a -> a Source #

moment :: Floating a => a -> Vector a -> a Source #

skew :: Floating a => Vector a -> a Source #

skew' :: Floating a => Vector a -> a Source #

kurt :: Floating a => Vector a -> a Source #

Eq a => Eq (Vector a) Source # 

Methods

(==) :: Vector a -> Vector a -> Bool #

(/=) :: Vector a -> Vector a -> Bool #

Floating a => Floating (Vector a) Source # 

Methods

pi :: Vector a #

exp :: Vector a -> Vector a #

log :: Vector a -> Vector a #

sqrt :: Vector a -> Vector a #

(**) :: Vector a -> Vector a -> Vector a #

logBase :: Vector a -> Vector a -> Vector a #

sin :: Vector a -> Vector a #

cos :: Vector a -> Vector a #

tan :: Vector a -> Vector a #

asin :: Vector a -> Vector a #

acos :: Vector a -> Vector a #

atan :: Vector a -> Vector a #

sinh :: Vector a -> Vector a #

cosh :: Vector a -> Vector a #

tanh :: Vector a -> Vector a #

asinh :: Vector a -> Vector a #

acosh :: Vector a -> Vector a #

atanh :: Vector a -> Vector a #

log1p :: Vector a -> Vector a #

expm1 :: Vector a -> Vector a #

log1pexp :: Vector a -> Vector a #

log1mexp :: Vector a -> Vector a #

Fractional a => Fractional (Vector a) Source # 

Methods

(/) :: Vector a -> Vector a -> Vector a #

recip :: Vector a -> Vector a #

fromRational :: Rational -> Vector a #

Num a => Num (Vector a) Source # 

Methods

(+) :: Vector a -> Vector a -> Vector a #

(-) :: Vector a -> Vector a -> Vector a #

(*) :: Vector a -> Vector a -> Vector a #

negate :: Vector a -> Vector a #

abs :: Vector a -> Vector a #

signum :: Vector a -> Vector a #

fromInteger :: Integer -> Vector a #

Show a => Show (Vector a) Source # 

Methods

showsPrec :: Int -> Vector a -> ShowS #

show :: Vector a -> String #

showList :: [Vector a] -> ShowS #

vector :: [a] -> Vector a Source #

vec :: [a] -> Vector a Source #

class List m where Source #

Minimal complete definition

toList, fromList, (!), findFirst

Methods

toList :: m a -> [a] Source #

to List

fromList :: [a] -> m a Source #

From List

(!) :: m a -> Int -> a Source #

Extract Element

findFirst :: Eq a => a -> m a -> Int Source #

Find Position of Element

Instances

List Vector Source # 

Methods

toList :: Vector a -> [a] Source #

fromList :: [a] -> Vector a Source #

(!) :: Vector a -> Int -> a Source #

findFirst :: Eq a => a -> Vector a -> Int Source #

data Matrix a Source #

Definition of Matrix

Constructors

Matrix 

Fields

Instances

Functor Matrix Source # 

Methods

fmap :: (a -> b) -> Matrix a -> Matrix b #

(<$) :: a -> Matrix b -> Matrix a #

Applicative Matrix Source # 

Methods

pure :: a -> Matrix a #

(<*>) :: Matrix (a -> b) -> Matrix a -> Matrix b #

liftA2 :: (a -> b -> c) -> Matrix a -> Matrix b -> Matrix c #

(*>) :: Matrix a -> Matrix b -> Matrix b #

(<*) :: Matrix a -> Matrix b -> Matrix a #

Foldable Matrix Source # 

Methods

fold :: Monoid m => Matrix m -> m #

foldMap :: Monoid m => (a -> m) -> Matrix a -> m #

foldr :: (a -> b -> b) -> b -> Matrix a -> b #

foldr' :: (a -> b -> b) -> b -> Matrix a -> b #

foldl :: (b -> a -> b) -> b -> Matrix a -> b #

foldl' :: (b -> a -> b) -> b -> Matrix a -> b #

foldr1 :: (a -> a -> a) -> Matrix a -> a #

foldl1 :: (a -> a -> a) -> Matrix a -> a #

toList :: Matrix a -> [a] #

null :: Matrix a -> Bool #

length :: Matrix a -> Int #

elem :: Eq a => a -> Matrix a -> Bool #

maximum :: Ord a => Matrix a -> a #

minimum :: Ord a => Matrix a -> a #

sum :: Num a => Matrix a -> a #

product :: Num a => Matrix a -> a #

FuncTools Matrix Source # 

Methods

hflat :: ([a] -> a) -> Matrix a -> a Source #

hlift :: ([a] -> [b]) -> Matrix a -> Matrix b Source #

hmap :: (a -> b) -> Matrix a -> Matrix b Source #

hfilter :: (a -> Bool) -> Matrix a -> Matrix a Source #

htake :: Int -> Matrix a -> Matrix a Source #

htakeWhile :: (a -> Bool) -> Matrix a -> Matrix a Source #

hdrop :: Int -> Matrix a -> Matrix a Source #

hdropWhile :: (a -> Bool) -> Matrix a -> Matrix a Source #

Concatable Matrix Source # 

Methods

hcat :: Matrix a -> Matrix a -> Matrix a Source #

vcat :: Matrix a -> Matrix a -> Matrix a Source #

MatOps Matrix Source # 

Methods

(%*%) :: Num a => Matrix a -> Matrix a -> Matrix a Source #

(%/%) :: (Eq a, Fractional a) => Matrix a -> Matrix a -> Matrix a Source #

det :: (Eq a, Fractional a) => Matrix a -> a Source #

inv :: (Eq a, Fractional a) => Matrix a -> Matrix a Source #

transpose :: Matrix a -> Matrix a Source #

VecOps Matrix Source # 

Methods

(.+) :: Num a => Matrix a -> a -> Matrix a Source #

(.-) :: Num a => Matrix a -> a -> Matrix a Source #

(.*) :: Num a => Matrix a -> a -> Matrix a Source #

(./) :: Fractional a => Matrix a -> a -> Matrix a Source #

(.^) :: Floating a => Matrix a -> a -> Matrix a Source #

(.*.) :: Num a => Matrix a -> Matrix a -> a Source #

norm :: Floating a => Matrix a -> a Source #

Convertable Matrix Source # 
Matrices Matrix Source # 

Methods

matForm :: Matrix a -> [[a]] Source #

formMat :: [[a]] -> Matrix a Source #

Writable Matrix Source # 

Methods

toString :: Show a => Matrix a -> String Source #

writeCSV :: Show a => String -> Matrix a -> IO () Source #

Eq a => Eq (Matrix a) Source # 

Methods

(==) :: Matrix a -> Matrix a -> Bool #

(/=) :: Matrix a -> Matrix a -> Bool #

Floating a => Floating (Matrix a) Source # 

Methods

pi :: Matrix a #

exp :: Matrix a -> Matrix a #

log :: Matrix a -> Matrix a #

sqrt :: Matrix a -> Matrix a #

(**) :: Matrix a -> Matrix a -> Matrix a #

logBase :: Matrix a -> Matrix a -> Matrix a #

sin :: Matrix a -> Matrix a #

cos :: Matrix a -> Matrix a #

tan :: Matrix a -> Matrix a #

asin :: Matrix a -> Matrix a #

acos :: Matrix a -> Matrix a #

atan :: Matrix a -> Matrix a #

sinh :: Matrix a -> Matrix a #

cosh :: Matrix a -> Matrix a #

tanh :: Matrix a -> Matrix a #

asinh :: Matrix a -> Matrix a #

acosh :: Matrix a -> Matrix a #

atanh :: Matrix a -> Matrix a #

log1p :: Matrix a -> Matrix a #

expm1 :: Matrix a -> Matrix a #

log1pexp :: Matrix a -> Matrix a #

log1mexp :: Matrix a -> Matrix a #

Fractional a => Fractional (Matrix a) Source # 

Methods

(/) :: Matrix a -> Matrix a -> Matrix a #

recip :: Matrix a -> Matrix a #

fromRational :: Rational -> Matrix a #

Num a => Num (Matrix a) Source # 

Methods

(+) :: Matrix a -> Matrix a -> Matrix a #

(-) :: Matrix a -> Matrix a -> Matrix a #

(*) :: Matrix a -> Matrix a -> Matrix a #

negate :: Matrix a -> Matrix a #

abs :: Matrix a -> Matrix a #

signum :: Matrix a -> Matrix a #

fromInteger :: Integer -> Matrix a #

Show a => Show (Matrix a) Source # 

Methods

showsPrec :: Int -> Matrix a -> ShowS #

show :: Matrix a -> String #

showList :: [Matrix a] -> ShowS #

matrix :: [[a]] -> Matrix a Source #

matrix is syntactic sugar to create Matrix

class Matrices m where Source #

Matrices is necessary class for Matrix

Minimal complete definition

matForm, formMat

Methods

matForm :: m a -> [[a]] Source #

Matrix to Array

formMat :: [[a]] -> m a Source #

Array to Matrix

Instances

Matrices Matrix Source # 

Methods

matForm :: Matrix a -> [[a]] Source #

formMat :: [[a]] -> Matrix a Source #

class Functor f => VecOps f where Source #

(.ops) is an operation Vector(or Matrix) with Constant. Dot means position of Vector. Example: a .* 2 = twice whole elements of a a .*. b = Dot product

Minimal complete definition

(.+), (.-), (.*), (./), (.^), (.*.), norm

Methods

(.+) :: Num a => f a -> a -> f a Source #

(.-) :: Num a => f a -> a -> f a Source #

(.*) :: Num a => f a -> a -> f a Source #

(./) :: Fractional a => f a -> a -> f a Source #

(.^) :: Floating a => f a -> a -> f a Source #

(.*.) :: Num a => f a -> f a -> a Source #

norm :: Floating a => f a -> a Source #

Instances

VecOps Matrix Source # 

Methods

(.+) :: Num a => Matrix a -> a -> Matrix a Source #

(.-) :: Num a => Matrix a -> a -> Matrix a Source #

(.*) :: Num a => Matrix a -> a -> Matrix a Source #

(./) :: Fractional a => Matrix a -> a -> Matrix a Source #

(.^) :: Floating a => Matrix a -> a -> Matrix a Source #

(.*.) :: Num a => Matrix a -> Matrix a -> a Source #

norm :: Floating a => Matrix a -> a Source #

VecOps Vector Source # 

Methods

(.+) :: Num a => Vector a -> a -> Vector a Source #

(.-) :: Num a => Vector a -> a -> Vector a Source #

(.*) :: Num a => Vector a -> a -> Vector a Source #

(./) :: Fractional a => Vector a -> a -> Vector a Source #

(.^) :: Floating a => Vector a -> a -> Vector a Source #

(.*.) :: Num a => Vector a -> Vector a -> a Source #

norm :: Floating a => Vector a -> a Source #

class Functor f => MatOps f where Source #

Minimal complete definition

(%*%), (%/%), det, inv, transpose

Methods

(%*%) :: Num a => f a -> f a -> f a Source #

(%/%) :: (Eq a, Fractional a) => f a -> f a -> f a Source #

det :: (Eq a, Fractional a) => f a -> a Source #

inv :: (Eq a, Fractional a) => f a -> f a Source #

transpose :: f a -> f a Source #

Instances

MatOps Matrix Source # 

Methods

(%*%) :: Num a => Matrix a -> Matrix a -> Matrix a Source #

(%/%) :: (Eq a, Fractional a) => Matrix a -> Matrix a -> Matrix a Source #

det :: (Eq a, Fractional a) => Matrix a -> a Source #

inv :: (Eq a, Fractional a) => Matrix a -> Matrix a Source #

transpose :: Matrix a -> Matrix a Source #

bp :: Int -> Matrix a -> Matrix a Source #

Block Partitioning

class Functor f => Concatable f where Source #

Minimal complete definition

hcat, vcat

Methods

hcat :: f a -> f a -> f a Source #

vcat :: f a -> f a -> Matrix a Source #

Instances

(.:) :: Vector a -> Matrix a -> Matrix a Source #

(.:) inserts vector to head of matrix.

qsort :: Ord a => Vector a -> Vector a Source #

Quick Sort

transposeMat :: [[a]] -> [[a]] Source #

Merge Sort msort :: Ord a => Vector a -> Vector a msort

indexMat :: [[a]] -> [[(Int, Int)]] Source #

dropAtMat :: Int -> Int -> [[a]] -> [[a]] Source #

postSplitAt :: ([a], [a]) -> [a] Source #

dropAt :: Int -> [a] -> [a] Source #

dropAtMat' :: Int -> [[a]] -> [[a]] Source #

bpMat :: Int -> [[a]] -> [[a]] Source #

(%-+-%) :: Num a => [[a]] -> [[a]] -> [[a]] Source #

negMap :: Num a => [[a]] -> [[a]] Source #

(%---%) :: Num a => [[a]] -> [[a]] -> [[a]] Source #

(%-*-%) :: Num a => [[a]] -> [[a]] -> [[a]] Source #

eyeMat :: Int -> [[Int]] Source #

basisVec :: Int -> Int -> [Int] Source #

permMat :: Int -> Int -> [[a]] -> [[Int]] Source #

whichMax :: Ord a => [a] -> Int Source #

colMat :: [[a]] -> Int -> [a] Source #

colMaxIdx :: Ord a => [[a]] -> Int -> Int Source #

cycleMat :: [[a]] -> [[a]] Source #

bpMat' :: Int -> [[a]] -> [[a]] Source #

Another Block Partitioning

detMat :: (Eq a, Fractional a) => [[a]] -> a Source #

Determinant for Double List - Order ~ 4^n

invMat :: (Eq a, Fractional a) => [[a]] -> [[a]] Source #

Inverse for Double List - Order ~ n * 2^n

fd :: Eq a => a -> [a] -> Int Source #

Find First