Search in sources :

Example 6 with ReadableVector

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);
}
Also used : ReadableVector(dr.math.matrixAlgebra.ReadableVector)

Example 7 with ReadableVector

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);
}
Also used : ReadableVector(dr.math.matrixAlgebra.ReadableVector)

Aggregations

ReadableVector (dr.math.matrixAlgebra.ReadableVector)7 WrappedMatrix (dr.math.matrixAlgebra.WrappedMatrix)2 WrappedVector (dr.math.matrixAlgebra.WrappedVector)2 DenseMatrix64F (org.ejml.data.DenseMatrix64F)2