Copyright | (c) Alexey Kuleshevich 2018-2019 |
---|---|
License | BSD3 |
Maintainer | Alexey Kuleshevich <lehins@yandex.ru> |
Stability | experimental |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
Synopsis
- class Num e => Numeric r e
- class (Numeric r e, Floating e) => NumericFloat r e
- (.+) :: (Index ix, Numeric r e) => Array r ix e -> e -> Array r ix e
- (+.) :: (Index ix, Numeric r e) => e -> Array r ix e -> Array r ix e
- (.+.) :: (Load r ix e, Numeric r e, MonadThrow m) => Array r ix e -> Array r ix e -> m (Array r ix e)
- (!+!) :: (Load r ix e, Numeric r e) => Array r ix e -> Array r ix e -> Array r ix e
- (.-) :: (Index ix, Numeric r e) => Array r ix e -> e -> Array r ix e
- (-.) :: (Index ix, Numeric r e) => e -> Array r ix e -> Array r ix e
- (.-.) :: (Load r ix e, Numeric r e, MonadThrow m) => Array r ix e -> Array r ix e -> m (Array r ix e)
- (!-!) :: (Load r ix e, Numeric r e) => Array r ix e -> Array r ix e -> Array r ix e
- (.*) :: (Index ix, Numeric r e) => Array r ix e -> e -> Array r ix e
- (*.) :: (Index ix, Numeric r e) => e -> Array r ix e -> Array r ix e
- (.*.) :: (Load r ix e, Numeric r e, MonadThrow m) => Array r ix e -> Array r ix e -> m (Array r ix e)
- (!*!) :: (Load r ix e, Numeric r e) => Array r ix e -> Array r ix e -> Array r ix e
- (.^) :: (Index ix, Numeric r e) => Array r ix e -> Int -> Array r ix e
- (!.!) :: (Numeric r e, Source r Ix1 e) => Vector r e -> Vector r e -> e
- dotM :: (Numeric r e, Source r Ix1 e, MonadThrow m) => Vector r e -> Vector r e -> m e
- (.><) :: (MonadThrow m, Numeric r e, Source r Ix1 e, Source r Ix2 e) => Matrix r e -> Vector r e -> m (Vector D e)
- (!><) :: (Numeric r e, Source r Ix1 e, Source r Ix2 e) => Matrix r e -> Vector r e -> Vector D e
- (><.) :: (MonadThrow m, Numeric r e, Mutable r Ix1 e, Mutable r Ix2 e) => Vector r e -> Matrix r e -> m (Vector D e)
- (><!) :: (Numeric r e, Mutable r Ix1 e, Mutable r Ix2 e) => Vector r e -> Matrix r e -> Vector D e
- (.><.) :: (Numeric r e, Mutable r Ix2 e, Source r' Ix2 e, MonadThrow m) => Matrix r e -> Matrix r' e -> m (Matrix D e)
- (!><!) :: (Numeric r e, Mutable r Ix2 e, Source r' Ix2 e) => Matrix r e -> Matrix r' e -> Matrix D e
- multiplyMatrices :: forall r r' e m. (Numeric r e, Mutable r Ix2 e, Source r' Ix2 e, MonadThrow m) => Matrix r e -> Matrix r' e -> m (Matrix D e)
- multiplyMatricesTransposed :: (Numeric r e, Manifest r Ix2 e, MonadThrow m) => Matrix r e -> Matrix r e -> m (Matrix D e)
- (#>) :: (MonadThrow m, Num e, Source (R r) Ix1 e, Manifest r' Ix1 e, OuterSlice r Ix2 e) => Array r Ix2 e -> Array r' Ix1 e -> m (Array D Ix1 e)
- (|*|) :: (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)
- 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)
- normL2 :: (NumericFloat r e, Source r ix e) => Array r ix e -> e
- identityMatrix :: Num e => Sz1 -> Matrix DL e
- lowerTriangular :: Num e => Comp -> Sz1 -> (Ix2 -> e) -> Matrix DL e
- upperTriangular :: Num e => Comp -> Sz1 -> (Ix2 -> e) -> Matrix DL e
- negateA :: (Index ix, Numeric r e) => Array r ix e -> Array r ix e
- absA :: (Index ix, Numeric r e) => Array r ix e -> Array r ix e
- signumA :: (Index ix, Numeric r e) => Array r ix e -> Array r ix e
- fromIntegerA :: (Index ix, Num e) => Integer -> Array D ix e
- quotA :: (Source r1 ix e, Source r2 ix e, Integral e) => Array r1 ix e -> Array r2 ix e -> Array D ix e
- remA :: (Source r1 ix e, Source r2 ix e, Integral e) => Array r1 ix e -> Array r2 ix e -> Array D ix e
- divA :: (Source r1 ix e, Source r2 ix e, Integral e) => Array r1 ix e -> Array r2 ix e -> Array D ix e
- modA :: (Source r1 ix e, Source r2 ix e, Integral e) => Array r1 ix e -> Array r2 ix e -> Array D ix e
- 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)
- 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)
- (./) :: (Index ix, NumericFloat r e) => Array r ix e -> e -> Array r ix e
- (/.) :: (Index ix, NumericFloat r e) => e -> Array r ix e -> Array r ix e
- (./.) :: (Load r ix e, NumericFloat r e, MonadThrow m) => Array r ix e -> Array r ix e -> m (Array r ix e)
- (!/!) :: (Load r ix e, NumericFloat r e) => Array r ix e -> Array r ix e -> Array r ix e
- (.^^) :: (Index ix, Numeric r e, Fractional e, Integral b) => Array r ix e -> b -> Array r ix e
- recipA :: (Index ix, NumericFloat r e) => Array r ix e -> Array r ix e
- fromRationalA :: (Index ix, Fractional e) => Rational -> Array D ix e
- piA :: (Index ix, Floating e) => Array D ix e
- expA :: (Index ix, NumericFloat r e) => Array r ix e -> Array r ix e
- logA :: (Index ix, NumericFloat r e) => Array r ix e -> Array r ix e
- sqrtA :: (Index ix, NumericFloat r e) => Array r ix e -> Array r ix e
- (.**) :: (Source r1 ix e, Source r2 ix e, Floating e) => Array r1 ix e -> Array r2 ix e -> Array D ix e
- logBaseA :: (Source r1 ix e, Source r2 ix e, Floating e) => Array r1 ix e -> Array r2 ix e -> Array D ix e
- sinA :: (Index ix, NumericFloat r e) => Array r ix e -> Array r ix e
- cosA :: (Index ix, NumericFloat r e) => Array r ix e -> Array r ix e
- tanA :: (Index ix, NumericFloat r e) => Array r ix e -> Array r ix e
- asinA :: (Index ix, NumericFloat r e) => Array r ix e -> Array r ix e
- acosA :: (Index ix, NumericFloat r e) => Array r ix e -> Array r ix e
- atanA :: (Index ix, NumericFloat r e) => Array r ix e -> Array r ix e
- sinhA :: (Index ix, NumericFloat r e) => Array r ix e -> Array r ix e
- coshA :: (Index ix, NumericFloat r e) => Array r ix e -> Array r ix e
- tanhA :: (Index ix, NumericFloat r e) => Array r ix e -> Array r ix e
- asinhA :: (Index ix, NumericFloat r e) => Array r ix e -> Array r ix e
- acoshA :: (Index ix, NumericFloat r e) => Array r ix e -> Array r ix e
- atanhA :: (Index ix, NumericFloat r e) => Array r ix e -> Array r ix e
- truncateA :: (Source r ix a, RealFrac a, Integral e) => Array r ix a -> Array D ix e
- roundA :: (Source r ix a, RealFrac a, Integral e) => Array r ix a -> Array D ix e
- ceilingA :: (Source r ix a, RealFrac a, Integral e) => Array r ix a -> Array D ix e
- floorA :: (Source r ix a, RealFrac a, Integral e) => Array r ix a -> Array D ix e
- 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)
Numeric
class Num e => Numeric r e Source #
Instances
class (Numeric r e, Floating e) => NumericFloat r e Source #
Instances
Pointwise addition
(.+) :: (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 #
Add two arrays together pointwise. Same as !+!
but produces monadic computation
that allows for handling failure.
Throws Exception: SizeMismatchException
when array sizes do not match.
Since: 0.4.0
(!+!) :: (Load r ix e, Numeric r e) => Array r ix e -> Array r ix e -> Array r ix e infixl 6 Source #
Add two arrays together pointwise. Prefer to use monadic version of this function
.+.
whenever possible, because it is better to avoid partial functions.
- Partial
- Mismatched array sizes will result in an impure exception being thrown.
Example
>>>
let a1 = Ix1 0 ... 10
>>>
let a2 = Ix1 20 ... 30
>>>
a1 !+! a2
Array D Seq (Sz1 11) [ 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40 ]
Since: 0.5.6
Pointwise subtraction
(.-) :: (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.4.0
(-.) :: (Index ix, Numeric r e) => e -> Array r ix e -> Array r ix e infixl 6 Source #
Subtract each element of the array from a scalar. Array is on the right.
Since: 0.5.6
(.-.) :: (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. Same as !-!
but produces monadic computation that
allows for handling failure.
Throws Exception: SizeMismatchException
when array sizes do not match.
Since: 0.4.0
(!-!) :: (Load r ix e, Numeric r e) => Array r ix e -> Array r ix e -> Array r ix e infixl 6 Source #
Subtract one array from another pointwise. Prefer to use monadic version of this
function .-.
whenever possible, because it is better to avoid partial functions.
- Partial
- Mismatched array sizes will result in an impure exception being thrown.
Example
>>>
let a1 = Ix1 0 ... 10
>>>
let a2 = Ix1 20 ... 30
>>>
a1 !-! a2
Array D Seq (Sz1 11) [ -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20 ]
Since: 0.5.6
Pointwise multiplication
(.*) :: (Index ix, Numeric r e) => Array r ix e -> e -> Array r ix e infixl 7 Source #
Multiply each element of the array by a scalar value. Scalar is on the right.
Example
>>>
let arr = Ix1 20 ..: 25
>>>
arr
Array D Seq (Sz1 5) [ 20, 21, 22, 23, 24 ]>>>
arr .* 10
Array D Seq (Sz1 5) [ 200, 210, 220, 230, 240 ]
Since: 0.4.0
(*.) :: (Index ix, Numeric r e) => e -> Array r ix e -> Array r ix e infixl 7 Source #
Multiply each element of the array by a scalar value. Scalar is on the left.
Example
>>>
let arr = Ix1 20 ..: 25
>>>
arr
Array D Seq (Sz1 5) [ 20, 21, 22, 23, 24 ]>>>
10 *. arr
Array D Seq (Sz1 5) [ 200, 210, 220, 230, 240 ]
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. Same as !*!
but produces monadic
computation that allows for handling failure.
Throws Exception: SizeMismatchException
when array sizes do not match.
Since: 0.4.0
(!*!) :: (Load r ix e, Numeric r e) => Array r ix e -> Array r ix e -> Array r ix e infixl 7 Source #
Multiplication of two arrays pointwise. Prefer to use monadic version of this
function .*.
whenever possible, because it is better to avoid partial functions.
- Partial
- Mismatched array sizes will result in an impure exception being thrown.
Example
>>>
let a1 = Ix1 0 ... 10
>>>
let a2 = Ix1 20 ... 30
>>>
a1 !*! a2
Array D Seq (Sz1 11) [ 0, 21, 44, 69, 96, 125, 156, 189, 224, 261, 300 ]
Since: 0.5.6
(.^) :: (Index ix, Numeric r e) => Array r ix e -> Int -> Array r ix e infixr 8 Source #
Raise each element of the array to a power.
Example
>>>
let arr = Ix1 20 ..: 25
>>>
arr
Array D Seq (Sz1 5) [ 20, 21, 22, 23, 24 ]>>>
arr .^ 3
Array D Seq (Sz1 5) [ 8000, 9261, 10648, 12167, 13824 ]
Since: 0.4.0
Dot product
(!.!) :: (Numeric r e, Source r Ix1 e) => Vector r e -> Vector r e -> e Source #
Dot product of two vectors.
- Partial
- Throws an impure exception when lengths of vectors do not match
Since: 0.5.6
dotM :: (Numeric r e, Source r Ix1 e, MonadThrow m) => Vector r e -> Vector r e -> m e Source #
Dot product of two vectors.
Throws Exception: SizeMismatchException
when lengths of vectors do not match
Since: 0.5.6
Matrix multiplication
:: (MonadThrow m, Numeric r e, Source r Ix1 e, Source r Ix2 e) | |
=> Matrix r e | Matrix |
-> Vector r e | Column vector (Used many times, so make sure it is computed) |
-> m (Vector D e) |
Multiply a matrix by a column vector. Same as !><
but produces monadic
computation that allows for handling failure.
Throws Exception: SizeMismatchException
when inner dimensions of arrays do not match.
Since: 0.5.6
:: (Numeric r e, Source r Ix1 e, Source r Ix2 e) | |
=> Matrix r e | Matrix |
-> Vector r e | Column vector (Used many times, so make sure it is computed) |
-> Vector D e |
Multiply a matrix by a column vector
- Partial
- Throws impure exception when inner dimensions do not agree
Since: 0.5.6
:: (MonadThrow m, Numeric r e, Mutable r Ix1 e, Mutable r Ix2 e) | |
=> Vector r e | Row vector |
-> Matrix r e | Matrix |
-> m (Vector D e) |
Multiply a row vector by a matrix. Same as ><!
but produces monadic computation
that allows for handling failure.
Throws Exception: SizeMismatchException
when inner dimensions of arrays do not match.
Since: 0.5.6
:: (Numeric r e, Mutable r Ix1 e, Mutable r Ix2 e) | |
=> Vector r e | Row vector |
-> Matrix r e | Matrix |
-> Vector D e |
Multiply a row vector by a matrix.
- Partial
- Throws impure exception when inner dimensions do not agree
Since: 0.5.6
(.><.) :: (Numeric r e, Mutable r Ix2 e, Source r' Ix2 e, MonadThrow m) => Matrix r e -> Matrix r' e -> m (Matrix D e) Source #
Matrix multiplication. Same as !><!
but produces monadic computation that allows
for handling failure.
Throws Exception: SizeMismatchException
when inner dimensions of arrays do not match.
Since: 0.5.6
(!><!) :: (Numeric r e, Mutable r Ix2 e, Source r' Ix2 e) => Matrix r e -> Matrix r' e -> Matrix D e Source #
Multiply two matrices together.
- Partial
- Inner dimension must agree
Examples
>>>
a1 = makeArrayR P Seq (Sz2 5 6) $ \(i :. j) -> i + j
>>>
a2 = makeArrayR D Seq (Sz2 6 5) $ \(i :. j) -> i - j
>>>
a1 !><! a2
Array D Seq (Sz (5 :. 5)) [ [ 55, 40, 25, 10, -5 ] , [ 70, 49, 28, 7, -14 ] , [ 85, 58, 31, 4, -23 ] , [ 100, 67, 34, 1, -32 ] , [ 115, 76, 37, -2, -41 ] ]
Since: 0.5.6
multiplyMatrices :: forall r r' e m. (Numeric r e, Mutable r Ix2 e, Source r' Ix2 e, MonadThrow m) => Matrix r e -> Matrix r' e -> m (Matrix D e) Source #
Synonym for .><.
Since: 0.5.6
multiplyMatricesTransposed :: (Numeric r e, Manifest r Ix2 e, MonadThrow m) => Matrix r e -> Matrix r e -> m (Matrix D e) Source #
Computes the matrix-matrix multiplication where second matrix is transposed (i.e. M x N')
m1 .><. transpose m2 == multiplyMatricesTransposed m1 m2
Since: 0.5.6
:: (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) |
Deprecated: In favor of (.><
)
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 #
Deprecated: In favor of .><.
Matrix multiplication
Throws Exception: SizeMismatchException
when inner dimensions of arrays do not match.
Since: 0.4.0
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')
Norms
normL2 :: (NumericFloat r e, Source r ix e) => Array r ix e -> e Source #
Compute L2 norm of an array.
Since: 0.5.6
Simple matrices
identityMatrix :: Num e => Sz1 -> Matrix DL e Source #
Create an indentity matrix.
Example
>>>
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
>>>
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
>>>
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 #
Negate each element of the array
Since: 0.4.0
absA :: (Index ix, Numeric r e) => Array r ix e -> Array r ix e Source #
Apply abs
to each element of the array
Since: 0.4.0
signumA :: (Index ix, Numeric r e) => Array r ix e -> Array r ix e Source #
Apply signum
to each element of the array
Since: 0.4.0
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 #
Perform a pointwise quotient where first array contains numerators and the second one denominators
quotA arr1 arr2 == zipWith quot arr1 arr2
- Partial
- Mismatched array sizes will result in an impure exception being thrown.
Since: 0.1.0
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 #
Perform a pointwise remainder computation
remA arr1 arr2 == zipWith rem arr1 arr2
- Partial
- Mismatched array sizes will result in an impure exception being thrown.
Since: 0.1.0
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 #
Perform a pointwise integer division where first array contains numerators and the second one denominators
divA arr1 arr2 == zipWith div arr1 arr2
- Partial
- Mismatched array sizes will result in an impure exception being thrown.
Since: 0.1.0
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 #
Perform a pointwise modulo computation
modA arr1 arr2 == zipWith mod arr1 arr2
- Partial
- Mismatched array sizes will result in an impure exception being thrown.
Since: 0.1.0
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 #
Perform a pointwise quotient with remainder where first array contains numerators and the second one denominators
quotRemA arr1 arr2 == zipWith quotRem arr1 arr2
- Partial
- Mismatched array sizes will result in an impure exception being thrown.
Since: 0.1.0
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 #
Perform a pointwise integer division with modulo where first array contains numerators and the second one denominators
divModA arr1 arr2 == zipWith divMod arr1 arr2
- Partial
- Mismatched array sizes will result in an impure exception being thrown.
Since: 0.1.0
Fractional
(./) :: (Index ix, NumericFloat r e) => Array r ix e -> e -> Array r ix e infixl 7 Source #
Divide each element of the array by a scalar value.
Example
>>>
let arr = fromIntegral <$> (Ix1 20 ..: 25) :: Array D Ix1 Float
>>>
arr
Array D Seq (Sz1 5) [ 20.0, 21.0, 22.0, 23.0, 24.0 ]>>>
arr ./ 100
Array D Seq (Sz1 5) [ 0.2, 0.21, 0.22, 0.23, 0.24 ]
Since: 0.4.0
(/.) :: (Index ix, NumericFloat r e) => e -> Array r ix e -> Array r ix e infixl 7 Source #
Divide a scalar value by each element of the array.
e /. arr == e *. recipA arr
Example
>>>
let arr = fromIntegral <$> (Ix1 20 ..: 25) :: Array D Ix1 Float
>>>
arr
Array D Seq (Sz1 5) [ 20.0, 21.0, 22.0, 23.0, 24.0 ]>>>
100 /. arr
Array D Seq (Sz1 5) [ 5.0, 4.7619047, 4.5454545, 4.347826, 4.1666665 ]
Since: 0.5.6
(./.) :: (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 #
Divide each element of one array by another pointwise. Same as !/!
but produces
monadic computation that allows for handling failure.
Throws Exception: SizeMismatchException
when array sizes do not match.
Since: 0.4.0
(!/!) :: (Load r ix e, NumericFloat r e) => Array r ix e -> Array r ix e -> Array r ix e infixl 7 Source #
Divide two arrays pointwise. Prefer to use monadic version of this function ./.
whenever possible, because it is better to avoid partial functions.
- Partial
- Mismatched array sizes will result in an impure exception being thrown.
Example
>>>
let arr1 = fromIntegral <$> (Ix1 20 ..: 25) :: Array D Ix1 Float
>>>
let arr2 = fromIntegral <$> (Ix1 100 ..: 105) :: Array D Ix1 Float
>>>
arr1 !/! arr2
Array D Seq (Sz1 5) [ 0.2, 0.20792079, 0.21568628, 0.22330096, 0.23076923 ]
Since: 0.5.6
(.^^) :: (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 #
Apply reciprocal to each element of the array.
recipA arr == 1 /. arr
Since: 0.4.0
fromRationalA :: (Index ix, Fractional e) => Rational -> Array D ix e Source #
Deprecated: This almost never a desired behavior. Use replicate
instead
Floating
piA :: (Index ix, Floating e) => Array D ix e Source #
Deprecated: This almost never a desired behavior. Use replicate
instead
expA :: (Index ix, NumericFloat r e) => Array r ix e -> Array r ix e Source #
Apply exponent to each element of the array.
expA arr == map exp arr
Since: 0.4.0
logA :: (Index ix, NumericFloat r e) => Array r ix e -> Array r ix e Source #
Apply logarithm to each element of the array.
logA arr == map log arr
Since: 0.4.0
sqrtA :: (Index ix, NumericFloat r e) => Array r ix e -> Array r ix e Source #
Apply square root to each element of the array.
sqrtA arr == map sqrt arr
Since: 0.4.0
(.**) :: (Source r1 ix e, Source r2 ix e, Floating e) => Array r1 ix e -> Array r2 ix e -> Array D ix e Source #
Apply power to each element of the array where the power value is in the same cell in the second array.
arr1 .** arr2 == zipWith (**) arr1 arr2
- Partial
- Throws an error when arrays do not have matching sizes
Since: 0.4.0
logBaseA :: (Source r1 ix e, Source r2 ix e, Floating e) => Array r1 ix e -> Array r2 ix e -> Array D ix e Source #
Apply logarithm to each element of the array where the base is in the same cell in the second array.
logBaseA arr1 arr2 == zipWith logBase arr1 arr2
- Partial
- Throws an error when arrays do not have matching sizes
Since: 0.4.0
sinA :: (Index ix, NumericFloat r e) => Array r ix e -> Array r ix e Source #
Apply sine function to each element of the array.
sinA arr == map sin arr
Since: 0.4.0
cosA :: (Index ix, NumericFloat r e) => Array r ix e -> Array r ix e Source #
Apply cosine function to each element of the array.
cosA arr == map cos arr
Since: 0.4.0
tanA :: (Index ix, NumericFloat r e) => Array r ix e -> Array r ix e Source #
Apply tangent function to each element of the array.
tanA arr == map tan arr
Since: 0.4.0
asinA :: (Index ix, NumericFloat r e) => Array r ix e -> Array r ix e Source #
Apply arcsine function to each element of the array.
asinA arr == map asin arr
Since: 0.4.0
acosA :: (Index ix, NumericFloat r e) => Array r ix e -> Array r ix e Source #
Apply arccosine function to each element of the array.
acosA arr == map acos arr
Since: 0.4.0
atanA :: (Index ix, NumericFloat r e) => Array r ix e -> Array r ix e Source #
Apply arctangent function to each element of the array.
atanA arr == map atan arr
Since: 0.4.0
sinhA :: (Index ix, NumericFloat r e) => Array r ix e -> Array r ix e Source #
Apply hyperbolic sine function to each element of the array.
sinhA arr == map sinh arr
Since: 0.4.0
coshA :: (Index ix, NumericFloat r e) => Array r ix e -> Array r ix e Source #
Apply hyperbolic cosine function to each element of the array.
coshA arr == map cosh arr
Since: 0.4.0
tanhA :: (Index ix, NumericFloat r e) => Array r ix e -> Array r ix e Source #
Apply hyperbolic tangent function to each element of the array.
tanhA arr == map tanh arr
Since: 0.4.0
asinhA :: (Index ix, NumericFloat r e) => Array r ix e -> Array r ix e Source #
Apply inverse hyperbolic sine function to each element of the array.
asinhA arr == map asinh arr
Since: 0.4.0
acoshA :: (Index ix, NumericFloat r e) => Array r ix e -> Array r ix e Source #
Apply inverse hyperbolic cosine function to each element of the array.
acoshA arr == map acosh arr
Since: 0.4.0
atanhA :: (Index ix, NumericFloat r e) => Array r ix e -> Array r ix e Source #
Apply inverse hyperbolic tangent function to each element of the array.
atanhA arr == map atanh arr
Since: 0.4.0
RealFrac
truncateA :: (Source r ix a, RealFrac a, Integral e) => Array r ix a -> Array D ix e Source #
Truncate each element of the array.
truncateA arr == map truncate arr
Since: 0.1.0
roundA :: (Source r ix a, RealFrac a, Integral e) => Array r ix a -> Array D ix e Source #
Round each element of the array.
truncateA arr == map truncate arr
Since: 0.1.0
ceilingA :: (Source r ix a, RealFrac a, Integral e) => Array r ix a -> Array D ix e Source #
Ceiling of each element of the array.
truncateA arr == map truncate arr
Since: 0.1.0
floorA :: (Source r ix a, RealFrac a, Integral e) => Array r ix a -> Array D ix e Source #
Floor each element of the array.
truncateA arr == map truncate arr
Since: 0.1.0