public final double doOperation() throws OperatorFailedException {
  final int dim=parameter.getDimension();
  final int dim1=MathUtils.nextInt(dim);
  int dim2=dim1;
  while (dim1 == dim2) {
    dim2=MathUtils.nextInt(dim);
  }
  double scalar1=parameter.getParameterValue(dim1);
  double scalar2=parameter.getParameterValue(dim2);
  final double d=MathUtils.nextDouble() * delta * scalar1;
  scalar1-=d;
  if (parameterWeights[dim1] != parameterWeights[dim2]) {
    scalar2+=d * (double)parameterWeights[dim1] / (double)parameterWeights[dim2];
  }
 else {
    scalar2+=d;
  }
  parameter.setParameterValue(dim1,scalar1);
  parameter.setParameterValue(dim2,scalar2);
  return Math.log(scalar2 / (scalar1 + d));
}

public final double doOperation ( ) throws OperatorFailedException { final int dim = parameter . getDimension ( ) ; final int dim1 = MathUtils . nextInt ( dim ) ; int dim2 = dim1 ; while ( dim1 == dim2 ) { dim2 = MathUtils . nextInt ( dim ) ; } double scalar1 = parameter . getParameterValue ( dim1 ) ; double scalar2 = parameter . getParameterValue ( dim2 ) ; final double d = MathUtils . nextDouble ( ) * delta * scalar1 ; scalar1 -= d ; if ( parameterWeights [ dim1 ] != parameterWeights [ dim2 ] ) { scalar2 += d * ( double ) parameterWeights [ dim1 ] / ( double ) parameterWeights [ dim2 ] ; } else { scalar2 += d ; } parameter . setParameterValue ( dim1 , scalar1 ) ; parameter . setParameterValue ( dim2 , scalar2 ) ; return Math . log ( scalar2 / ( scalar1 + d ) ) ; }
change the parameter and return the hastings ratio . performs a delta exchange operation between two scalars in the vector and return the hastings ratio .
