|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.lcsim.util.ArraySmearer
This class smears a vector of quantities in accordance with a multivariate normal distribution. The constructor takes a covariance matrix as input; only a minimal amount of checking is done. The method 'smear' takes an array and smears its members according to a gaussian distribution, whose width corresponds to the square root of the diagonal element of the covariance matrix. Here is an example of how the covariance terms are handled: v11 cov = v12 v22 v13 v23 v33 x1 = x1 + a1*rn1 x2 = x2 + a2*rn1 + b2*rn2 x3 = x3 + a3*rn1 + b3*rn2 + c3*rn3 where rn1, rn2 and rn3 are independently generated normal random numbers a1 = sqrt(v11) if a1 = 0, then a2 = a3 = 0 otherwise a2 = v12/a1, a3 = v13/a1 b2 = sqrt(v22 - a2*a2) if b2 = 0, then b3 = 0 otherwise b3 = (v23 - a2*a3)/b2 c3 = sqrt(v33 - a3*a3 - b3*b3)
| Constructor Summary | |
ArraySmearer(double[][] cov)
constructor from the covariance matrix |
|
| Method Summary | |
void |
generate(double[] vec)
Generate a vector of variables distributed according to the covariance matrix. |
void |
smear(double[] vec)
Smear a vector according to the covariance matrix. |
java.lang.String |
toString()
Output Stream |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public ArraySmearer(double[][] cov)
cov - The covariance matrix as| Method Detail |
public void smear(double[] vec)
vec - The array to be smeared.public void generate(double[] vec)
vec - Array to be filledpublic java.lang.String toString()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||