regression-simple-0.2: Simple linear and quadratic regression
Safe HaskellSafe-Inferred
LanguageHaskell2010

Math.Regression.Simple.LinAlg

Description

Minimil linear algebra lib.

Synopsis

Operations

class Add a where Source #

Addition

Methods

zero :: a Source #

add :: a -> a -> a infixl 6 Source #

Instances

Instances details
Add M22 Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

zero :: M22 Source #

add :: M22 -> M22 -> M22 Source #

Add M33 Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

zero :: M33 Source #

add :: M33 -> M33 -> M33 Source #

Add SM22 Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

zero :: SM22 Source #

add :: SM22 -> SM22 -> SM22 Source #

Add SM33 Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

zero :: SM33 Source #

add :: SM33 -> SM33 -> SM33 Source #

Add V2 Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

zero :: V2 Source #

add :: V2 -> V2 -> V2 Source #

Add V3 Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

zero :: V3 Source #

add :: V3 -> V3 -> V3 Source #

Add Double Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

class Eye a where Source #

Identity

Methods

eye :: a Source #

Instances

Instances details
Eye M22 Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

eye :: M22 Source #

Eye M33 Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

eye :: M33 Source #

Eye SM22 Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

eye :: SM22 Source #

Eye SM33 Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

eye :: SM33 Source #

Eye Double Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

eye :: Double Source #

class Eye a => Mult a b c | a b -> c where Source #

Multiplication of different things.

Methods

mult :: a -> b -> c infixl 7 Source #

Instances

Instances details
Mult M22 M22 M22 Source #
>>> M22 1 2 3 4 `mult` eye @M22
M22 1.0 2.0 3.0 4.0
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

mult :: M22 -> M22 -> M22 Source #

Mult M22 V2 V2 Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

mult :: M22 -> V2 -> V2 Source #

Mult M33 V3 V3 Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

mult :: M33 -> V3 -> V3 Source #

Mult SM22 V2 V2 Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

mult :: SM22 -> V2 -> V2 Source #

Mult SM33 V3 V3 Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

mult :: SM33 -> V3 -> V3 Source #

Mult Double M22 M22 Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

mult :: Double -> M22 -> M22 Source #

Mult Double M33 M33 Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

mult :: Double -> M33 -> M33 Source #

Mult Double SM22 SM22 Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

mult :: Double -> SM22 -> SM22 Source #

Mult Double SM33 SM33 Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

mult :: Double -> SM33 -> SM33 Source #

Mult Double V2 V2 Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

mult :: Double -> V2 -> V2 Source #

Mult Double V3 V3 Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

mult :: Double -> V3 -> V3 Source #

Mult Double Double Double Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

mult :: Double -> Double -> Double Source #

class Eye a => Det a where Source #

Determinant

Methods

det :: a -> Double Source #

Instances

Instances details
Det M22 Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

det :: M22 -> Double Source #

Det M33 Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

det :: M33 -> Double Source #

Det SM22 Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

det :: SM22 -> Double Source #

Det SM33 Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

det :: SM33 -> Double Source #

Det Double Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

det :: Double -> Double Source #

class Det a => Inv a where Source #

Inverse

Methods

inv :: a -> a Source #

Instances

Instances details
Inv M22 Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

inv :: M22 -> M22 Source #

Inv M33 Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

inv :: M33 -> M33 Source #

Inv SM22 Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

inv :: SM22 -> SM22 Source #

Inv SM33 Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

inv :: SM33 -> SM33 Source #

Inv Double Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

inv :: Double -> Double Source #

Zeros

zerosLin :: V2 -> Double Source #

Solve linear equation.

>>> zerosLin (V2 1 2)
-2.0

zerosQuad :: V3 -> Either (Complex Double, Complex Double) (Double, Double) Source #

Solve quadratic equation.

>>> zerosQuad (V3 2 0 (-1))
Right (-0.7071067811865476,0.7071067811865476)
>>> zerosQuad (V3 2 0 1)
Left ((-0.0) :+ (-0.7071067811865476),(-0.0) :+ 0.7071067811865476)

Double root is not treated separately:

>>> zerosQuad (V3 1 0 0)
Right (-0.0,0.0)
>>> zerosQuad (V3 1 (-2) 1)
Right (1.0,1.0)

optimaQuad :: V3 -> Double Source #

Find an optima point.

>>> optimaQuad (V3 1 (-2) 0)
1.0

compare to

>>> zerosQuad (V3 1 (-2) 0)
Right (0.0,2.0)

Two dimensions

data V2 Source #

2d vector. Strict pair of Doubles.

Also used to represent linear polynomial: V2 a b \(= a x + b\).

Constructors

V2 !Double !Double 

Instances

Instances details
Show V2 Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

showsPrec :: Int -> V2 -> ShowS #

show :: V2 -> String #

showList :: [V2] -> ShowS #

NFData V2 Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

rnf :: V2 -> () #

Eq V2 Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

(==) :: V2 -> V2 -> Bool #

(/=) :: V2 -> V2 -> Bool #

Add V2 Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

zero :: V2 Source #

add :: V2 -> V2 -> V2 Source #

Mult M22 V2 V2 Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

mult :: M22 -> V2 -> V2 Source #

Mult SM22 V2 V2 Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

mult :: SM22 -> V2 -> V2 Source #

Mult Double V2 V2 Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

mult :: Double -> V2 -> V2 Source #

data M22 Source #

2×2 matrix.

Constructors

M22 !Double !Double !Double !Double 

Instances

Instances details
Show M22 Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

showsPrec :: Int -> M22 -> ShowS #

show :: M22 -> String #

showList :: [M22] -> ShowS #

NFData M22 Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

rnf :: M22 -> () #

Eq M22 Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

(==) :: M22 -> M22 -> Bool #

(/=) :: M22 -> M22 -> Bool #

Add M22 Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

zero :: M22 Source #

add :: M22 -> M22 -> M22 Source #

Det M22 Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

det :: M22 -> Double Source #

Eye M22 Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

eye :: M22 Source #

Inv M22 Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

inv :: M22 -> M22 Source #

Mult M22 M22 M22 Source #
>>> M22 1 2 3 4 `mult` eye @M22
M22 1.0 2.0 3.0 4.0
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

mult :: M22 -> M22 -> M22 Source #

Mult M22 V2 V2 Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

mult :: M22 -> V2 -> V2 Source #

Mult Double M22 M22 Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

mult :: Double -> M22 -> M22 Source #

data SM22 Source #

Symmetric 2x2 matrix.

Constructors

SM22 !Double !Double !Double 

Instances

Instances details
Show SM22 Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

showsPrec :: Int -> SM22 -> ShowS #

show :: SM22 -> String #

showList :: [SM22] -> ShowS #

NFData SM22 Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

rnf :: SM22 -> () #

Eq SM22 Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

(==) :: SM22 -> SM22 -> Bool #

(/=) :: SM22 -> SM22 -> Bool #

Add SM22 Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

zero :: SM22 Source #

add :: SM22 -> SM22 -> SM22 Source #

Det SM22 Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

det :: SM22 -> Double Source #

Eye SM22 Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

eye :: SM22 Source #

Inv SM22 Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

inv :: SM22 -> SM22 Source #

Mult SM22 V2 V2 Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

mult :: SM22 -> V2 -> V2 Source #

Mult Double SM22 SM22 Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

mult :: Double -> SM22 -> SM22 Source #

Three dimensions

data V3 Source #

3d vector. Strict triple of Doubles.

Also used to represent quadratic polynomial: V3 a b c \(= a x^2 + b x + c\).

Constructors

V3 !Double !Double !Double 

Instances

Instances details
Show V3 Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

showsPrec :: Int -> V3 -> ShowS #

show :: V3 -> String #

showList :: [V3] -> ShowS #

NFData V3 Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

rnf :: V3 -> () #

Eq V3 Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

(==) :: V3 -> V3 -> Bool #

(/=) :: V3 -> V3 -> Bool #

Add V3 Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

zero :: V3 Source #

add :: V3 -> V3 -> V3 Source #

Mult M33 V3 V3 Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

mult :: M33 -> V3 -> V3 Source #

Mult SM33 V3 V3 Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

mult :: SM33 -> V3 -> V3 Source #

Mult Double V3 V3 Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

mult :: Double -> V3 -> V3 Source #

data M33 Source #

3×3 matrix.

Instances

Instances details
Show M33 Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

showsPrec :: Int -> M33 -> ShowS #

show :: M33 -> String #

showList :: [M33] -> ShowS #

NFData M33 Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

rnf :: M33 -> () #

Eq M33 Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

(==) :: M33 -> M33 -> Bool #

(/=) :: M33 -> M33 -> Bool #

Add M33 Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

zero :: M33 Source #

add :: M33 -> M33 -> M33 Source #

Det M33 Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

det :: M33 -> Double Source #

Eye M33 Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

eye :: M33 Source #

Inv M33 Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

inv :: M33 -> M33 Source #

Mult M33 V3 V3 Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

mult :: M33 -> V3 -> V3 Source #

Mult Double M33 M33 Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

mult :: Double -> M33 -> M33 Source #

data SM33 Source #

Symmetric 3×3 matrix.

Instances

Instances details
Show SM33 Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

showsPrec :: Int -> SM33 -> ShowS #

show :: SM33 -> String #

showList :: [SM33] -> ShowS #

NFData SM33 Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

rnf :: SM33 -> () #

Eq SM33 Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

(==) :: SM33 -> SM33 -> Bool #

(/=) :: SM33 -> SM33 -> Bool #

Add SM33 Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

zero :: SM33 Source #

add :: SM33 -> SM33 -> SM33 Source #

Det SM33 Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

det :: SM33 -> Double Source #

Eye SM33 Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

eye :: SM33 Source #

Inv SM33 Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

inv :: SM33 -> SM33 Source #

Mult SM33 V3 V3 Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

mult :: SM33 -> V3 -> V3 Source #

Mult Double SM33 SM33 Source # 
Instance details

Defined in Math.Regression.Simple.LinAlg

Methods

mult :: Double -> SM33 -> SM33 Source #