lapack-0.3: Numerical Linear Algebra using LAPACK

Safe HaskellNone

Numeric.LAPACK.Matrix.Array

Synopsis

Documentation

data family Matrix typ a Source

type ArrayMatrix shape = Matrix (Array shape)Source

data Array shape Source

Instances

Box sh => Box (Array sh) 
MultiplySame sh => MultiplySame (Array sh) 
FormatArray sh => FormatMatrix (Array sh) 
NFData shape => NFData (Array shape) 
Indexed sh => Indexed (Array sh) 
Power shape => Power (Array shape) 
MultiplySquare shape => MultiplySquare (Array shape) 
MultiplyVector shape => MultiplyVector (Array shape) 
Inverse shape => Inverse (Array shape) 
Solve shape => Solve (Array shape) 
Determinant shape => Determinant (Array shape) 
SquareShape sh => SquareShape (Array sh) 
Complex sh => Complex (Array sh) 
(C shapeA, Eq shapeA, ~ * shapeA (HeightOf shapeB), Box shapeB, Scale shapeB) => Multiply (Scale shapeA) (Array shapeB) 
(Box shapeA, Scale shapeA, ~ * (WidthOf shapeA) shapeB, C shapeB, Eq shapeB) => Multiply (Array shapeA) (Scale shapeB) 
(Box shapeA, Box shapeB, Multiply shapeA shapeB) => Multiply (Array shapeA) (Array shapeB) 
(Show shape, Show a, Storable a, C shape) => Show (Matrix (Array shape) a) 

type Full vert horiz height width = ArrayMatrix (Full vert horiz height width)Source

type General height width = ArrayMatrix (General height width)Source

type Tall height width = ArrayMatrix (Tall height width)Source

type Wide height width = ArrayMatrix (Wide height width)Source

shape :: ArrayMatrix sh a -> shSource

reshape :: (C sh0, C sh1) => sh1 -> ArrayMatrix sh0 a -> ArrayMatrix sh1 aSource

mapShape :: (C sh0, C sh1) => (sh0 -> sh1) -> ArrayMatrix sh0 a -> ArrayMatrix sh1 aSource

fromVector :: (Admissible sh, Floating a) => Array sh a -> ArrayMatrix sh aSource

lift0 :: Array shA a -> ArrayMatrix shA aSource

lift0 is a synonym for fromVector but lacks the admissibility check. You may thus fool the type tags. This applies to the other lift functions, too.

lift1 :: (Array shA a -> Array shB b) -> ArrayMatrix shA a -> ArrayMatrix shB bSource

lift2 :: (Array shA a -> Array shB b -> Array shC c) -> ArrayMatrix shA a -> ArrayMatrix shB b -> ArrayMatrix shC cSource

lift3 :: (Array shA a -> Array shB b -> Array shC c -> Array shD d) -> ArrayMatrix shA a -> ArrayMatrix shB b -> ArrayMatrix shC c -> ArrayMatrix shD dSource

lift4 :: (Array shA a -> Array shB b -> Array shC c -> Array shD d -> Array shE e) -> ArrayMatrix shA a -> ArrayMatrix shB b -> ArrayMatrix shC c -> ArrayMatrix shD d -> ArrayMatrix shE eSource

unlift1 :: (ArrayMatrix shA a -> ArrayMatrix shB b) -> Array shA a -> Array shB bSource

unlift2 :: (ArrayMatrix shA a -> ArrayMatrix shB b -> ArrayMatrix shC c) -> Array shA a -> Array shB b -> Array shC cSource

unliftRow :: Order -> (General () height0 a -> General () height1 b) -> Vector height0 a -> Vector height1 bSource

unliftColumn :: Order -> (General height0 () a -> General height1 () b) -> Vector height0 a -> Vector height1 bSource

class C shape => Homogeneous shape Source

Instances

C size => Homogeneous (Hermitian size) 
(Natural off, C size) => Homogeneous (BandedHermitian off size) 
(Content lo, ~ * NonUnit diag, Content up, C size) => Homogeneous (Triangular lo diag up size) 
(C vert, C horiz, C height, C width) => Homogeneous (Full vert horiz height width) 
(Natural sub, Natural super, C vert, C horiz, C height, C width) => Homogeneous (Banded sub super vert horiz height width) 

zero :: (Homogeneous shape, Floating a) => shape -> ArrayMatrix shape aSource

negate :: (Homogeneous shape, Floating a) => ArrayMatrix shape a -> ArrayMatrix shape aSource

scaleReal :: (Homogeneous shape, Floating a) => RealOf a -> ArrayMatrix shape a -> ArrayMatrix shape aSource

scale :: (Scale shape, Floating a) => a -> ArrayMatrix shape a -> ArrayMatrix shape aSource

scaleRealReal :: (Homogeneous shape, Real a) => a -> ArrayMatrix shape a -> ArrayMatrix shape aSource

(.*#) :: (Scale shape, Floating a) => a -> ArrayMatrix shape a -> ArrayMatrix shape aSource

class C shape => ShapeOrder shape whereSource

Methods

shapeOrder :: shape -> OrderSource

Instances

C size => ShapeOrder (Hermitian size) 
(Content lo, TriDiag diag, Content up, C size) => ShapeOrder (Triangular lo diag up size) 
(C vert, C horiz, C height, C width) => ShapeOrder (Full vert horiz height width) 

forceOrder :: (ShapeOrder shape, Floating a) => Order -> ArrayMatrix shape a -> ArrayMatrix shape aSource

adaptOrder :: (ShapeOrder shape, Floating a) => ArrayMatrix shape a -> ArrayMatrix shape a -> ArrayMatrix shape aSource

adaptOrder x y contains the data of y with the layout of x.

class (Homogeneous shape, Eq shape) => Additive shape Source

Instances

(C size, Eq size) => Additive (Hermitian size) 
(Content lo, Eq lo, ~ * NonUnit diag, Content up, Eq up, C size, Eq size) => Additive (Triangular lo diag up size) 
(C vert, C horiz, C height, Eq height, C width, Eq width) => Additive (Full vert horiz height width) 

add :: (Additive shape, Floating a) => ArrayMatrix shape a -> ArrayMatrix shape a -> ArrayMatrix shape aSource

sub :: (Additive shape, Floating a) => ArrayMatrix shape a -> ArrayMatrix shape a -> ArrayMatrix shape aSource

(#+#) :: (Additive shape, Floating a) => ArrayMatrix shape a -> ArrayMatrix shape a -> ArrayMatrix shape aSource

(#-#) :: (Additive shape, Floating a) => ArrayMatrix shape a -> ArrayMatrix shape a -> ArrayMatrix shape aSource

class C shape => Complex shape Source

Instances

C size => Complex (Hermitian size) 
(Natural off, C size) => Complex (BandedHermitian off size) 
(Content lo, TriDiag diag, Content up, C size) => Complex (Triangular lo diag up size) 
(C vert, C horiz, C height, C width) => Complex (Full vert horiz height width) 
(Natural sub, Natural super, C vert, C horiz, C height, C width) => Complex (Banded sub super vert horiz height width) 

class (Box shape, HeightOf shape ~ WidthOf shape) => SquareShape shape Source

Instances

C size => SquareShape (Hermitian size) 
(Natural offDiag, C size) => SquareShape (BandedHermitian offDiag size) 
(Content lo, TriDiag diag, Content up, C size) => SquareShape (Triangular lo diag up size) 
(~ * Small vert, ~ * Small horiz, C height, ~ * height width) => SquareShape (Full vert horiz height width) 
(Natural sub, Natural super, ~ * Small vert, ~ * Small horiz, C height, ~ * height width) => SquareShape (Banded sub super vert horiz height width) 

class Box shape => MultiplyVector shape Source

Instances

C shape => MultiplyVector (Hermitian shape) 
(Natural offDiag, C size) => MultiplyVector (BandedHermitian offDiag size) 
(Content lo, Content up, TriDiag diag, C shape) => MultiplyVector (Triangular lo diag up shape) 
(C vert, C horiz, C width, C height) => MultiplyVector (Full vert horiz height width) 
(Natural sub, Natural super, C vert, C horiz, C height, C width) => MultiplyVector (Banded sub super vert horiz height width) 

class SquareShape shape => MultiplySquare shape Source

Instances

C shape => MultiplySquare (Hermitian shape) 
(Natural offDiag, C size) => MultiplySquare (BandedHermitian offDiag size) 
(Content lo, Content up, TriDiag diag, C shape) => MultiplySquare (Triangular lo diag up shape) 
(~ * vert Small, ~ * horiz Small, C height, ~ * height width) => MultiplySquare (Full vert horiz height width) 
(Natural sub, Natural super, ~ * vert Small, ~ * horiz Small, C height, ~ * height width) => MultiplySquare (Banded sub super vert horiz height width) 

class SquareShape shape => Power shape Source

Instances

C size => Power (Hermitian size) 
(PowerContentDiag lo diag up, C size) => Power (Triangular lo diag up size) 
(~ * Small vert, ~ * Small horiz, C height, ~ * height width) => Power (Full vert horiz height width) 

class (C shapeA, C shapeB) => Multiply shapeA shapeB Source

This class allows to Basic.multiply two matrices of arbitrary special features and returns the most special matrix type possible. At the first glance, this is handy. At the second glance, this has some problems. First of all, we may refine the types in future and then multiplication may return a different, more special type than before. Second, if you write code with polymorphic matrix types, then matrixMatrix may leave you with constraints like ExtentPriv.Multiply vert vert ~ vert. That constraint is always fulfilled but the compiler cannot infer that. Because of these problems you may instead consider using specialised multiply functions from the various modules for production use. Btw. MultiplyVector and MultiplySquare are much less problematic, because the input and output are always dense vectors or dense matrices.

Instances

(C shapeA, ~ * shapeA shapeB, Eq shapeB) => Multiply (Hermitian shapeA) (Hermitian shapeB) 
(C vert, C horiz, C size, ~ * size height, Eq height, C width) => Multiply (Hermitian size) (Full vert horiz height width) 
(Natural offDiagA, Natural offDiagB, C sizeA, ~ * sizeA sizeB, C sizeB, Eq sizeB) => Multiply (BandedHermitian offDiagA sizeA) (BandedHermitian offDiagB sizeB) 
(Natural offDiag, C vert, C horiz, C size, ~ * size height, Eq height, C width, Eq width) => Multiply (BandedHermitian offDiag size) (Full vert horiz height width) 
(Natural offDiag, Natural sub, Natural super, C vert, C horiz, C size, ~ * size height, Eq height, C width, Eq width) => Multiply (BandedHermitian offDiag size) (Banded sub super vert horiz height width) 
(C vert, C horiz, C size, ~ * size width, Eq width, C height) => Multiply (Full vert horiz height width) (Hermitian size) 
(Natural offDiag, C vert, C horiz, C size, ~ * size width, Eq width, C height, Eq height) => Multiply (Full vert horiz height width) (BandedHermitian offDiag size) 
(C sizeA, ~ * sizeA sizeB, Eq sizeB, MultiplyTriangular loA upA loB upB, TriDiag diagA, TriDiag diagB) => Multiply (Triangular loA diagA upA sizeA) (Triangular loB diagB upB sizeB) 
(Content lo, Content up, TriDiag diag, C vert, C horiz, C size, ~ * size height, Eq height, C width) => Multiply (Triangular lo diag up size) (Full vert horiz height width) 
(Content lo, Content up, TriDiag diag, C vert, C horiz, C size, ~ * size width, Eq width, C height) => Multiply (Full vert horiz height width) (Triangular lo diag up size) 
(C heightA, C widthA, C widthB, ~ * widthA heightB, Eq heightB, C vertA, C horizA, C vertB, C horizB) => Multiply (Full vertA horizA heightA widthA) (Full vertB horizB heightB widthB) 
(Natural sub, Natural super, C vertA, C horizA, C vertB, C horizB, C heightA, C widthA, C widthB, ~ * widthA heightB, Eq heightB) => Multiply (Full vertA horizA heightA widthA) (Banded sub super vertB horizB heightB widthB) 
(Natural offDiag, Natural sub, Natural super, C vert, C horiz, C size, ~ * size width, Eq width, C height, Eq height) => Multiply (Banded sub super vert horiz height width) (BandedHermitian offDiag size) 
(Natural sub, Natural super, C vertA, C horizA, C vertB, C horizB, C heightA, C widthA, C widthB, ~ * widthA heightB, Eq heightB) => Multiply (Banded sub super vertA horizA heightA widthA) (Full vertB horizB heightB widthB) 
(Natural subA, Natural superA, Natural subB, Natural superB, C vertA, C horizA, C vertB, C horizB, C heightA, C widthA, C widthB, ~ * widthA heightB, Eq heightB) => Multiply (Banded subA superA vertA horizA heightA widthA) (Banded subB superB vertB horizB heightB widthB) 

class SquareShape shape => Determinant shape Source

Instances

C shape => Determinant (Hermitian shape) 
(Natural offDiag, C size) => Determinant (BandedHermitian offDiag size)

There is no solver for general banded Hermitian matrices. Thus the instance will fail for an indefinite matrix.

(Content lo, Content up, TriDiag diag, C shape) => Determinant (Triangular lo diag up shape) 
(~ * vert Small, ~ * horiz Small, C height, ~ * height width) => Determinant (Full vert horiz height width) 
(Natural sub, Natural super, ~ * vert Small, ~ * horiz Small, C width, C height, ~ * width height) => Determinant (Banded sub super vert horiz height width) 

class SquareShape shape => Solve shape Source

Instances

C shape => Solve (Hermitian shape) 
(Natural offDiag, C size) => Solve (BandedHermitian offDiag size)

There is no solver for indefinite matrices. Thus the instance will fail for indefinite but solvable systems.

(Content lo, Content up, TriDiag diag, C shape) => Solve (Triangular lo diag up shape) 
(~ * vert Small, ~ * horiz Small, C height, ~ * height width) => Solve (Full vert horiz height width) 
(Natural sub, Natural super, ~ * vert Small, ~ * horiz Small, C width, C height, ~ * width height) => Solve (Banded sub super vert horiz height width) 

class (Solve shape, Power shape) => Inverse shape Source

Instances

C shape => Inverse (Hermitian shape) 
(PowerContentDiag lo diag up, C shape) => Inverse (Triangular lo diag up shape) 
(~ * vert Small, ~ * horiz Small, C height, ~ * height width) => Inverse (Full vert horiz height width)