use of dr.math.matrixAlgebra.ReadableVector in project beast-mcmc by beast-dev.
the class IrreversibleZigZagOperator method drawInitialVelocity.
@Override
WrappedVector drawInitialVelocity(WrappedVector momentum) {
ReadableVector mass = preconditioning.mass;
double[] velocity = new double[mass.getDim()];
for (int i = 0, len = mass.getDim(); i < len; ++i) {
velocity[i] = (MathUtils.nextDouble() > 0.5) ? 1.0 : -1.0;
}
if (mask != null) {
// TODO Is this necessary?
applyMask(velocity);
}
return new WrappedVector.Raw(velocity);
}
use of dr.math.matrixAlgebra.ReadableVector in project beast-mcmc by beast-dev.
the class ReversibleZigZagOperator method drawInitialVelocity.
@Override
final WrappedVector drawInitialVelocity(WrappedVector momentum) {
ReadableVector mass = preconditioning.mass;
double[] velocity = new double[momentum.getDim()];
for (int i = 0, len = momentum.getDim(); i < len; ++i) {
velocity[i] = sign(momentum.get(i)) / Math.sqrt(mass.get(i));
}
return new WrappedVector.Raw(velocity);
}
Aggregations