massiv-0.5.2.0: Massiv (Массив) is an Array Library.

Copyright(c) Alexey Kuleshevich 2018-2019
LicenseBSD3
MaintainerAlexey Kuleshevich <lehins@yandex.ru>
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Data.Massiv.Array.Numeric

Contents

Description

 
Synopsis

Num

(.+.) :: (Load r ix e, Numeric r e, MonadThrow m) => Array r ix e -> Array r ix e -> m (Array r ix e) infixl 6 Source #

Add two arrays together pointwise. Throws SizeMismatchException if arrays sizes do not match.

Since: 0.4.0

(.+) :: (Index ix, Numeric r e) => Array r ix e -> e -> Array r ix e infixl 6 Source #

Add a scalar to each element of the array. Array is on the left.

Since: 0.1.0

(+.) :: (Index ix, Numeric r e) => e -> Array r ix e -> Array r ix e infixl 6 Source #

Add a scalar to each element of the array. Array is on the right.

Since: 0.4.0

(.-.) :: (Load r ix e, Numeric r e, MonadThrow m) => Array r ix e -> Array r ix e -> m (Array r ix e) infixl 6 Source #

Subtract two arrays pointwise. Throws SizeMismatchException if arrays sizes do not match.

Since: 0.4.0

(.-) :: (Index ix, Numeric r e) => Array r ix e -> e -> Array r ix e infixl 6 Source #

Subtract a scalar from each element of the array. Array is on the left.

Since: 0.1.0

(-.) :: (Index ix, Numeric r e) => e -> Array r ix e -> Array r ix e infixl 6 Source #

Subtract a scalar from each element of the array. Array is on the right.

Since: 0.4.0

(.*.) :: (Load r ix e, Numeric r e, MonadThrow m) => Array r ix e -> Array r ix e -> m (Array r ix e) infixl 7 Source #

Multiply two arrays together pointwise.

Since: 0.4.0

(.*) :: (Index ix, Numeric r e) => Array r ix e -> e -> Array r ix e infixl 7 Source #

(*.) :: (Index ix, Numeric r e) => e -> Array r ix e -> Array r ix e infixl 7 Source #

(.^) :: (Index ix, Numeric r e) => Array r ix e -> Int -> Array r ix e infixr 8 Source #

(#>) Source #

Arguments

:: (MonadThrow m, Num e, Source (R r) Ix1 e, Manifest r' Ix1 e, OuterSlice r Ix2 e) 
=> Array r Ix2 e

Matrix

-> Array r' Ix1 e

Vector

-> m (Array D Ix1 e) 

Matrix-vector product

Inner dimensions must agree, otherwise SizeMismatchException

Since: 0.5.2

(|*|) :: (Mutable r Ix2 e, Source r' Ix2 e, OuterSlice r Ix2 e, Source (R r) Ix1 e, Num e, MonadThrow m) => Array r Ix2 e -> Array r' Ix2 e -> m (Array r Ix2 e) Source #

Matrix multiplication

Inner dimensions must agree, otherwise SizeMismatchException.

multiplyTransposed :: (Manifest r Ix2 e, OuterSlice r Ix2 e, Source (R r) Ix1 e, Num e, MonadThrow m) => Array r Ix2 e -> Array r Ix2 e -> m (Array D Ix2 e) Source #

Computes the matrix-matrix transposed product (i.e. A * A')

identityMatrix :: Num e => Sz1 -> Matrix DL e Source #

Create an indentity matrix.

Example

Expand
>>> import Data.Massiv.Array
>>> identityMatrix 5
Array DL Seq (Sz (5 :. 5))
  [ [ 1, 0, 0, 0, 0 ]
  , [ 0, 1, 0, 0, 0 ]
  , [ 0, 0, 1, 0, 0 ]
  , [ 0, 0, 0, 1, 0 ]
  , [ 0, 0, 0, 0, 1 ]
  ]

Since: 0.3.6

lowerTriangular :: Num e => Comp -> Sz1 -> (Ix2 -> e) -> Matrix DL e Source #

Create a lower triangular (L in LU decomposition) matrix of size NxN

Example

Expand
>>> import Data.Massiv.Array
>>> lowerTriangular Seq 5 (\(i :. j) -> i + j)
Array DL Seq (Sz (5 :. 5))
  [ [ 0, 0, 0, 0, 0 ]
  , [ 1, 2, 0, 0, 0 ]
  , [ 2, 3, 4, 0, 0 ]
  , [ 3, 4, 5, 6, 0 ]
  , [ 4, 5, 6, 7, 8 ]
  ]

Since: 0.5.2

upperTriangular :: Num e => Comp -> Sz1 -> (Ix2 -> e) -> Matrix DL e Source #

Create an upper triangular (U in LU decomposition) matrix of size NxN

Example

Expand
>>> import Data.Massiv.Array
>>> upperTriangular Par 5 (\(i :. j) -> i + j)
Array DL Par (Sz (5 :. 5))
  [ [ 0, 1, 2, 3, 4 ]
  , [ 0, 2, 3, 4, 5 ]
  , [ 0, 0, 4, 5, 6 ]
  , [ 0, 0, 0, 6, 7 ]
  , [ 0, 0, 0, 0, 8 ]
  ]

Since: 0.5.2

negateA :: (Index ix, Numeric r e) => Array r ix e -> Array r ix e Source #

absA :: (Index ix, Numeric r e) => Array r ix e -> Array r ix e Source #

signumA :: (Index ix, Numeric r e) => Array r ix e -> Array r ix e Source #

fromIntegerA :: (Index ix, Num e) => Integer -> Array D ix e Source #

Integral

quotA :: (Source r1 ix e, Source r2 ix e, Integral e) => Array r1 ix e -> Array r2 ix e -> Array D ix e infixl 7 Source #

remA :: (Source r1 ix e, Source r2 ix e, Integral e) => Array r1 ix e -> Array r2 ix e -> Array D ix e infixl 7 Source #

divA :: (Source r1 ix e, Source r2 ix e, Integral e) => Array r1 ix e -> Array r2 ix e -> Array D ix e infixl 7 Source #

modA :: (Source r1 ix e, Source r2 ix e, Integral e) => Array r1 ix e -> Array r2 ix e -> Array D ix e infixl 7 Source #

quotRemA :: (Source r1 ix e, Source r2 ix e, Integral e) => Array r1 ix e -> Array r2 ix e -> (Array D ix e, Array D ix e) Source #

divModA :: (Source r1 ix e, Source r2 ix e, Integral e) => Array r1 ix e -> Array r2 ix e -> (Array D ix e, Array D ix e) Source #

Fractional

(./.) :: (Load r ix e, NumericFloat r e, MonadThrow m) => Array r ix e -> Array r ix e -> m (Array r ix e) infixl 7 Source #

(./) :: (Index ix, NumericFloat r e) => Array r ix e -> e -> Array r ix e infixl 7 Source #

(.^^) :: (Index ix, Numeric r e, Fractional e, Integral b) => Array r ix e -> b -> Array r ix e infixr 8 Source #

recipA :: (Index ix, NumericFloat r e) => Array r ix e -> Array r ix e Source #

Floating

piA :: (Index ix, Floating e) => Array D ix e Source #

expA :: (Index ix, NumericFloat r e) => Array r ix e -> Array r ix e Source #

logA :: (Index ix, NumericFloat r e) => Array r ix e -> Array r ix e Source #

sqrtA :: (Index ix, NumericFloat r e) => Array r ix e -> Array r ix e Source #

(.**) :: (Source r1 ix e, Source r2 ix e, Floating e) => Array r1 ix e -> Array r2 ix e -> Array D ix e Source #

logBaseA :: (Source r1 ix e, Source r2 ix e, Floating e) => Array r1 ix e -> Array r2 ix e -> Array D ix e Source #

sinA :: (Index ix, NumericFloat r e) => Array r ix e -> Array r ix e Source #

cosA :: (Index ix, NumericFloat r e) => Array r ix e -> Array r ix e Source #

tanA :: (Index ix, NumericFloat r e) => Array r ix e -> Array r ix e Source #

asinA :: (Index ix, NumericFloat r e) => Array r ix e -> Array r ix e Source #

acosA :: (Index ix, NumericFloat r e) => Array r ix e -> Array r ix e Source #

atanA :: (Index ix, NumericFloat r e) => Array r ix e -> Array r ix e Source #

sinhA :: (Index ix, NumericFloat r e) => Array r ix e -> Array r ix e Source #

coshA :: (Index ix, NumericFloat r e) => Array r ix e -> Array r ix e Source #

tanhA :: (Index ix, NumericFloat r e) => Array r ix e -> Array r ix e Source #

asinhA :: (Index ix, NumericFloat r e) => Array r ix e -> Array r ix e Source #

acoshA :: (Index ix, NumericFloat r e) => Array r ix e -> Array r ix e Source #

atanhA :: (Index ix, NumericFloat r e) => Array r ix e -> Array r ix e Source #

RealFrac

truncateA :: (Index ix, Numeric r e, RealFrac a, Integral e) => Array r ix a -> Array r ix e Source #

roundA :: (Index ix, Numeric r e, RealFrac a, Integral e) => Array r ix a -> Array r ix e Source #

ceilingA :: (Index ix, Numeric r e, RealFrac a, Integral e) => Array r ix a -> Array r ix e Source #

floorA :: (Index ix, Numeric r e, RealFrac a, Integral e) => Array r ix a -> Array r ix e Source #

RealFloat

atan2A :: (Load r ix e, Numeric r e, RealFloat e, MonadThrow m) => Array r ix e -> Array r ix e -> m (Array r ix e) Source #