SSJ API Documentation
Stochastic Simulation in Java
Loading...
Searching...
No Matches
BakerTransformedPointSet.java
1/*
2 * Class: BakerTransformedPointSet
3 * Description:
4 * Environment: Java
5 * Software: SSJ
6 * Copyright (C) 2001-2018 Pierre L'Ecuyer and Universite de Montreal
7 * Organization: DIRO, Universite de Montreal
8 * @author
9 * @since
10 *
11 *
12 * Licensed under the Apache License, Version 2.0 (the "License");
13 * you may not use this file except in compliance with the License.
14 * You may obtain a copy of the License at
15 *
16 * http://www.apache.org/licenses/LICENSE-2.0
17 *
18 * Unless required by applicable law or agreed to in writing, software
19 * distributed under the License is distributed on an "AS IS" BASIS,
20 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21 * See the License for the specific language governing permissions and
22 * limitations under the License.
23 *
24 */
25package umontreal.ssj.hups;
26
27import umontreal.ssj.util.PrintfFormat;
28
40
47 init(p);
48 }
49
50 public double getCoordinate(int i, int j) {
51 double u = P.getCoordinate(i, j);
52 if (u < 0.5)
53 return 2.0 * u;
54 else
55 return 2.0 * (1 - u);
56 }
57
61
62 public String toString() {
63 return "Baker transformed point set of: {" + PrintfFormat.NEWLINE + P.toString() + PrintfFormat.NEWLINE + "}";
64 }
65
66 /*
67 * public String formatPoints() { try { return super.formatPoints(); } catch
68 * (UnsupportedOperationException e) { return
69 * "The values are Baker transformed for each coordinate:" +
70 * PrintfFormat.NEWLINE + " {" + P.formatPoints() + PrintfFormat.NEWLINE + "}";
71 * } }
72 */
73 // ***************************************************************
74
76
77 public double nextCoordinate() {
78 double u = innerIterator.nextCoordinate();
79 if (u < 0.5)
80 return 2.0 * u;
81 else
82 return 2.0 * (1.0 - u);
83 }
84
85 // Same as nextCoordinate.
86 public double nextDouble() {
87 double u = innerIterator.nextCoordinate();
88 if (u < 0.5)
89 return 2.0 * u;
90 else
91 return 2.0 * (1.0 - u);
92 }
93
94 public void nextCoordinates(double p[], int d) {
95 innerIterator.nextCoordinates(p, d);
96 for (int j = 0; j < d; j++)
97 if (p[j] < 0.5)
98 p[j] *= 2.0;
99 else
100 p[j] = 2.0 * (1.0 - p[j]);
101 }
102
103 public int nextPoint(double p[], int d) {
104 innerIterator.nextPoint(p, d);
105 for (int j = 0; j < d; j++)
106 if (p[j] < 0.5)
107 p[j] *= 2.0;
108 else
109 p[j] = 2.0 * (1.0 - p[j]);
110 return getCurPointIndex();
111 }
112
113 }
114}
String toString()
Formats a string that contains information about the point set.
PointSetIterator iterator()
Return an iterator for this ContainerPointSet.
BakerTransformedPointSet(PointSet p)
Constructs a baker-transformed point set from the given point set p.
double getCoordinate(int i, int j)
By default, returns the untransformed coordinate for the contained point set.
This acts as a generic base class for all container classes that contain a point set and apply a spec...
void init(PointSet p0)
Initializes this container point set so that it will contain the point set p0.
This abstract class represents a general point set.
Definition PointSet.java:99
static final String NEWLINE
End-of-line symbol or line separator.
This is the interface for iterators that permit one to go through the points of a PointSet and the su...