Copyright | (c) Artur M. Brodzki 2018 |
---|---|

License | BSD3 |

Maintainer | artur@brodzki.org |

Stability | experimental |

Portability | Windows/POSIX |

Safe Haskell | None |

Language | Haskell2010 |

- This module provides convenient constructors that generate a arbitrary finitely- or infinitely-dimensional tensors.
- Finitely-dimensional tensors provide much greater performance than inifitely-dimensional

## Synopsis

- fromIndices :: Num a => (String, [Int]) -> (String, [Int]) -> ([Int] -> [Int] -> a) -> Tensor a
- generate :: Num a => (String, [Int]) -> (String, [Int]) -> ([Int] -> [Int] -> Tensor a) -> Tensor a
- const :: Num a => (String, [Int]) -> (String, [Int]) -> a -> Tensor a
- randomDouble :: ContGen d => (String, [Int]) -> (String, [Int]) -> d -> IO (Tensor Double)
- randomDoubleSeed :: (ContGen d, PrimMonad m) => (String, [Int]) -> (String, [Int]) -> d -> Int -> m (Tensor Double)
- randomInt :: DiscreteGen d => (String, [Int]) -> (String, [Int]) -> d -> IO (Tensor Int)
- randomIntSeed :: (DiscreteGen d, PrimMonad m) => (String, [Int]) -> (String, [Int]) -> d -> Int -> m (Tensor Int)

# Generators

:: Num a | |

=> (String, [Int]) | Upper indices names (one character per index) and its sizes |

-> (String, [Int]) | Lower indices names (one character per index) and its sizes |

-> ([Int] -> [Int] -> a) | Generator function (f [u1,u2,...] [d1,d2,...] returns a tensor element at t [u1,u2,...] [d1,d2,...]) |

-> Tensor a | Generated tensor |

Generate tensor as functions of its indices

:: Num a | |

=> (String, [Int]) | Upper indices names (one character per index) and its sizes |

-> (String, [Int]) | Lower indices names (one character per index) and its sizes |

-> ([Int] -> [Int] -> Tensor a) | Generator function (f [u1,u2,...] [d1,d2,...] returns a tensor element at t [u1,u2,...] [d1,d2,...]) |

-> Tensor a | Generated tensor |

Generate tensor composed of other tensors

:: Num a | |

=> (String, [Int]) | Upper indices names (one character per index) and its sizes |

-> (String, [Int]) | Lower indices names (one character per index) and its sizes |

-> a | Tensor elements value |

-> Tensor a | Generated tensor |

Generate tensor with all components equal to `v`

:: ContGen d | |

=> (String, [Int]) | Upper indices names (one character per index) and its sizes |

-> (String, [Int]) | Lower indices names (one character per index) and its sizes |

-> d | Continuous probability distribution (as from Statistics.Distribution) |

-> IO (Tensor Double) | Generated tensor |

Generate tensor with random real components with given probability distribution. The tensor 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, [Int]) | Upper indices names (one character per index) and its sizes |

-> (String, [Int]) | Lower indices names (one character per index) and its sizes |

-> d | Continuous probability distribution (as from Statistics.Distribution) |

-> Int | Randomness seed |

-> m (Tensor Double) | Generated tensor |

Generate tensor with random real components with given probability distribution and given seed. The tensor 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, [Int]) | Upper indices names (one character per index) and its sizes |

-> (String, [Int]) | Lower indices names (one character per index) and its sizes |

-> d | Discrete probability distribution (as from Statistics.Distribution) |

-> IO (Tensor Int) | Generated tensor |

Generate tensor with random integer components with given probability distribution. The tensor 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, [Int]) | Index name (one character) |

-> (String, [Int]) | Number of elements |

-> d | Discrete probability distribution (as from Statistics.Distribution) |

-> Int | Randomness seed |

-> m (Tensor Int) | Generated tensor |

Generate tensor with random integer components with given probability distribution and given seed. The tensor is wrapped in a monad.

Available probability distributions:

- Binomial : Statistics.Distribution.Binomial
- Poisson : Statistics.Distribution.Poisson
- Geometric : Statistics.Distribution.Geometric
- Hypergeometric: Statistics.Distribution.Hypergeometric