package umontreal.iro.lecuyer.hups;
/* *
 * Title:        

* Description:

* Copyright: Copyright (c)

* Company:

* @author * @version 1.0 */ import umontreal.iro.lecuyer.util.PrintfFormat; /** * This container class provides antithetic points. * That is, * 1 - ui, j is returned in place of coordinate ui, j. * To generate regular and antithetic variates with a point * set p, e.g., for variance reduction, one can define an * {@link AntitheticPointSet} object pa that contains p, * and then generate the regular variates with p and the * antithetic variates with pa. * */ public class AntitheticPointSet extends ContainerPointSet { /** * Constructs an antithetic point set from the given point set P. * * @param P point set for which we want antithetic version * * */ public AntitheticPointSet (PointSet P) { init (P); } public double getCoordinate (int i, int j) { return 1.0 - P.getCoordinate (i, j); } public PointSetIterator iterator(){ return new AntitheticPointSetIterator(); } public String toString() { return "Antithetic point set of: {" + PrintfFormat.NEWLINE + P.toString() + PrintfFormat.NEWLINE + "}"; } // *************************************************************** protected class AntitheticPointSetIterator extends ContainerPointSetIterator { public double nextCoordinate() { return 1.0 - innerIterator.nextCoordinate(); } public double nextDouble() { return 1.0 - innerIterator.nextCoordinate(); } public void nextCoordinates (double p[], int d) { innerIterator.nextCoordinates (p, d); for (int j = 0; j < d; j++) p[j] = 1.0 - p[j]; } public int nextPoint (double p[], int d) { innerIterator.nextPoint (p, d); for (int j = 0; j < d; j++) p[j] = 1.0 - p[j]; return getCurPointIndex(); } } }

Ads help maintain this website.