Is it possible with jdistlib to save and pass generic distribution types or frozen distributions between objects? I am more familiar with python.scipy (where there are frozen distributions that can be treated as variables), but something tells me that this might not be possible with java/jdistlib. The jdistlib code on sourceforge never seems to do that.
What would be the correct way of passing references to abstract generic distributions with jdistlib? I realize that the following code will not work (as GenericDistribution is an abstract class) but it may serve to illustrate what I want to do.
The only possible solution I could think of would be to pass the names of the distributions as strings instead and then use a switch in the method where the random variates are drawn from the distributions. But this is most likely also not the proper way to solve this.
public class A {
private GenericDistribution dist1;
private GenericDistribution dist2;
private void A (GenericDistribution x1, GenericDistribution x2) {
this.dist1 = x1;
this.dist2 = x1;
}
public double ReturnProduct () {
new double a = this.dist1.random();
new double b = this.dist2.random();
return a*b;
}
}
Aucun commentaire:
Enregistrer un commentaire