1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * https://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18 /*
19 * This is not the original file distributed by the Apache Software Foundation
20 * It has been modified by the Hipparchus project
21 */
22 package org.hipparchus.distribution;
23
24 import org.hipparchus.exception.MathIllegalArgumentException;
25
26 /**
27 * Base interface for multivariate continuous distributions.
28 * <p>
29 * This is based largely on the RealDistribution interface, but cumulative
30 * distribution functions are not required because they are often quite
31 * difficult to compute for multivariate distributions.
32 */
33 public interface MultivariateRealDistribution {
34 /**
35 * Returns the probability density function (PDF) of this distribution
36 * evaluated at the specified point {@code x}. In general, the PDF is the
37 * derivative of the cumulative distribution function. If the derivative
38 * does not exist at {@code x}, then an appropriate replacement should be
39 * returned, e.g. {@code Double.POSITIVE_INFINITY}, {@code Double.NaN}, or
40 * the limit inferior or limit superior of the difference quotient.
41 *
42 * @param x Point at which the PDF is evaluated.
43 * @return the value of the probability density function at point {@code x}.
44 */
45 double density(double[] x);
46
47 /**
48 * Reseeds the random generator used to generate samples.
49 *
50 * @param seed Seed with which to initialize the random number generator.
51 */
52 void reseedRandomGenerator(long seed);
53
54 /**
55 * Gets the number of random variables of the distribution.
56 * It is the size of the array returned by the {@link #sample() sample}
57 * method.
58 *
59 * @return the number of variables.
60 */
61 int getDimension();
62
63 /**
64 * Generates a random value vector sampled from this distribution.
65 *
66 * @return a random value vector.
67 */
68 double[] sample();
69
70 /**
71 * Generates a list of a random value vectors from the distribution.
72 *
73 * @param sampleSize the number of random vectors to generate.
74 * @return an array representing the random samples.
75 * @throws org.hipparchus.exception.MathIllegalArgumentException
76 * if {@code sampleSize} is not positive.
77 *
78 * @see #sample()
79 */
80 double[][] sample(int sampleSize) throws MathIllegalArgumentException;
81 }