public final double doOperation() throws OperatorFailedException {
  final double scale=(scaleFactor + (MathUtils.nextDouble() * ((1.0 / scaleFactor) - scaleFactor)));
  double oldValue=variance.getParameterValue(0);
  double newValue=scale * oldValue;
  double logq=-Math.log(scale);
  final Bounds<Double> bounds=variance.getBounds();
  if (newValue < bounds.getLowerLimit(0) || newValue > bounds.getUpperLimit(0)) {
    throw new OperatorFailedException("proposed value outside boundaries");
  }
  variance.setParameterValue(0,newValue);
  NodeRef root=tree.getRoot();
  final int index=root.getNumber();
  List<NodeRef> listNode=new ArrayList<NodeRef>();
  getSubtree(listNode,tree.getNode(index));
  final double rateScale=Math.sqrt(scale);
  for (  NodeRef node : listNode) {
    oldValue=tree.getNodeRate(node);
    newValue=oldValue * rateScale;
    tree.setNodeRate(node,newValue);
  }
  logq+=(listNode.size() - 2) * Math.log(rateScale);
  return logq;
}

public final double doOperation ( ) throws OperatorFailedException { final double scale = ( scaleFactor + ( MathUtils . nextDouble ( ) * ( ( 1.0 / scaleFactor ) - scaleFactor ) ) ) ; double oldValue = variance . getParameterValue ( 0 ) ; double newValue = scale * oldValue ; double logq = - Math . log ( scale ) ; final Bounds < Double > bounds = variance . getBounds ( ) ; if ( newValue < bounds . getLowerLimit ( 0 ) || newValue > bounds . getUpperLimit ( 0 ) ) { throw new OperatorFailedException ( "proposed value outside boundaries" ) ; } variance . setParameterValue ( 0 , newValue ) ; NodeRef root = tree . getRoot ( ) ; final int index = root . getNumber ( ) ; List < NodeRef > listNode = new ArrayList < NodeRef > ( ) ; getSubtree ( listNode , tree . getNode ( index ) ) ; final double rateScale = Math . sqrt ( scale ) ; for ( NodeRef node : listNode ) { oldValue = tree . getNodeRate ( node ) ; newValue = oldValue * rateScale ; tree . setNodeRate ( node , newValue ) ; } logq += ( listNode . size ( ) - 2 ) * Math . log ( rateScale ) ; return logq ; }
scale the rates of a subtree and return the hastings ratio .
