Copyright | (c) Artur M. Brodzki 2018 |
---|---|
License | GLP-3 |
Maintainer | artur@brodzki.org |
Stability | experimental |
Portability | Windows/POSIX |
Safe Haskell | None |
Language | Haskell2010 |
- This module provides convenient constructors that generates n-forms (tensors with n lower indices with finite or infinite size).
- Finitely-dimensional n-forms provide much greater performance than infinitely-dimensional
Synopsis
- fromIndices :: Num a => String -> [Int] -> ([Int] -> a) -> Tensor a
- const :: Num a => String -> [Int] -> a -> Tensor a
- randomDouble :: ContGen d => String -> [Int] -> d -> IO (Tensor Double)
- randomDoubleSeed :: (ContGen d, PrimMonad m) => String -> [Int] -> d -> Int -> m (Tensor Double)
- randomInt :: DiscreteGen d => String -> [Int] -> d -> IO (Tensor Int)
- randomIntSeed :: (DiscreteGen d, PrimMonad m) => String -> [Int] -> d -> Int -> m (Tensor Int)
- dot :: Num a => String -> Int -> Tensor a
- cross :: Num a => String -> Int -> Tensor a
Generators
:: Num a | |
=> String | Indices names (one characted per index) |
-> [Int] | Indices sizes |
-> ([Int] -> a) | Generator function |
-> Tensor a | Generated N-form |
Generate N-form as function of its indices
:: Num a | |
=> String | Indices names (one characted per index) |
-> [Int] | Indices sizes |
-> a | N-form elements value |
-> Tensor a | Generated N-form |
Generate N-form with all components equal to v
:: ContGen d | |
=> String | Indices names (one character per index) |
-> [Int] | Indices sizes |
-> d | Continuous probability distribution (as from Statistics.Distribution) |
-> IO (Tensor Double) | Generated linear functional |
Generate n-vector with random real components with given probability distribution. The n-vector is wrapped in the IO monad.
Available probability distributions:
- Beta : Statistics.Distribution.BetaDistribution
- Cauchy : Statistics.Distribution.CauchyLorentz
- Chi-squared : Statistics.Distribution.ChiSquared
- Exponential : Statistics.Distribution.Exponential
- Gamma : Statistics.Distribution.Gamma
- Geometric : Statistics.Distribution.Geometric
- Normal : Statistics.Distribution.Normal
- StudentT : Statistics.Distribution.StudentT
- Uniform : Statistics.Distribution.Uniform
- F : Statistics.Distribution.FDistribution
- Laplace : Statistics.Distribution.Laplace
:: (ContGen d, PrimMonad m) | |
=> String | Index name (one character) |
-> [Int] | Number of elements |
-> d | Continuous probability distribution (as from Statistics.Distribution) |
-> Int | Randomness seed |
-> m (Tensor Double) | Generated n-vector |
Generate n-vector with random real components with given probability distribution and given seed. The form is wrapped in a monad.
Available probability distributions:
- Beta : Statistics.Distribution.BetaDistribution
- Cauchy : Statistics.Distribution.CauchyLorentz
- Chi-squared : Statistics.Distribution.ChiSquared
- Exponential : Statistics.Distribution.Exponential
- Gamma : Statistics.Distribution.Gamma
- Geometric : Statistics.Distribution.Geometric
- Normal : Statistics.Distribution.Normal
- StudentT : Statistics.Distribution.StudentT
- Uniform : Statistics.Distribution.Uniform
- F : Statistics.Distribution.FDistribution
- Laplace : Statistics.Distribution.Laplace
:: DiscreteGen d | |
=> String | Indices names (one character per index) |
-> [Int] | Indices sizes |
-> d | Discrete probability distribution (as from Statistics.Distribution) |
-> IO (Tensor Int) | Generated n-vector |
Generate n-vector with random integer components with given probability distribution. The n-vector is wrapped in the IO monad.
Available probability distributions:
- Binomial : Statistics.Distribution.Binomial
- Poisson : Statistics.Distribution.Poisson
- Geometric : Statistics.Distribution.Geometric
- Hypergeometric: Statistics.Distribution.Hypergeometric
:: (DiscreteGen d, PrimMonad m) | |
=> String | Index name (one character) |
-> [Int] | Number of elements |
-> d | Discrete probability distribution (as from Statistics.Distribution) |
-> Int | Randomness seed |
-> m (Tensor Int) | Generated n-vector |
Generate n-vector with random integer components with given probability distribution and given seed. The form is wrapped in a monad.
Available probability distributions:
- Binomial : Statistics.Distribution.Binomial
- Poisson : Statistics.Distribution.Poisson
- Geometric : Statistics.Distribution.Geometric
- Hypergeometric: Statistics.Distribution.Hypergeometric
Common cases
:: Num a | |
=> String | Indices names (one characted per index) |
-> Int | Size of tensor (dot product is a square tensor) |
-> Tensor a | Generated dot product |
2-form representing a dot product
:: Num a | |
=> String | Indices names (one characted per index) |
-> Int | Size of tensor (dot product is a square tensor) |
-> Tensor a | Generated dot product |
Tensor representing a cross product (Levi - Civita symbol). It also allows to compute a determinant of square matrix - determinant of matrix M
is a equal to length of cross product of all columns of M