kortschak | 805531d | 2017-11-01 10:30:53 +1030 | [diff] [blame] | 1 | // Copyright ©2016 The Gonum Authors. All rights reserved. |
btracey | 477fe7e | 2016-01-24 12:43:19 -0700 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style |
| 3 | // license that can be found in the LICENSE file. |
| 4 | |
| 5 | package distmv |
| 6 | |
| 7 | // Quantiler returns the multi-dimensional inverse cumulative distribution function. |
| 8 | // len(x) must equal len(p), and if x is non-nil, len(x) must also equal len(p). |
| 9 | // If x is nil, a new slice will be allocated and returned, otherwise the quantile |
| 10 | // will be stored in-place into x. All of the values of p must be between 0 and 1, |
| 11 | // or Quantile will panic. |
| 12 | type Quantiler interface { |
| 13 | Quantile(x, p []float64) []float64 |
| 14 | } |
| 15 | |
| 16 | // LogProber computes the log of the probability of the point x. |
| 17 | type LogProber interface { |
| 18 | LogProb(x []float64) float64 |
| 19 | } |
| 20 | |
| 21 | // Rander generates a random number according to the distributon. |
| 22 | // If the input is non-nil, len(x) must equal len(p) and the dimension of the distribution, |
| 23 | // otherwise Quantile will panic. |
| 24 | // If the input is nil, a new slice will be allocated and returned. |
| 25 | type Rander interface { |
| 26 | Rand(x []float64) []float64 |
| 27 | } |
| 28 | |
| 29 | // RandLogProber is both a Rander and a LogProber. |
| 30 | type RandLogProber interface { |
| 31 | Rander |
| 32 | LogProber |
| 33 | } |