From: limw Date: Thu, 14 Jul 2011 21:28:30 +0000 (+0000) Subject: Fixed issues with compilation. X-Git-Url: http://plrg.eecs.uci.edu/git/?p=IRC.git;a=commitdiff_plain;h=da2acd0ec4172a0a21566433759abc72a567a2ec Fixed issues with compilation. --- diff --git a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/Fibheaps/FibHeap.java b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/Fibheaps/FibHeap.java index c96413af..13bc0023 100644 --- a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/Fibheaps/FibHeap.java +++ b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/Fibheaps/FibHeap.java @@ -1,38 +1,40 @@ +package Fibheaps; + public class FibHeap { public int degree; public TaggedTree ttree; public Vector forest; - + public FibHeap() { this.degree = 0; this.ttree = null; this.forest = null; } - + public FibHeap(int degree, - TaggedTree ttree, - Vector forest) { + TaggedTree ttree, + Vector forest) { this.degree = degree; this.ttree = ttree; this.forest = forest; } - + public boolean isEmpty() { return this.degree == 0; } - + public int minFH() { return this.ttree.tree.root; } - + public FibHeap insertFH(int x) { TaggedTree tt = new TaggedTree(0, new Tree(x, null)); FibHeap fh = new FibHeap(1, tt, null); - + return this.meldFH(fh); } - + public FibHeap meldFH(FibHeap fh) { if(this.isEmpty()) { return fh; @@ -59,9 +61,9 @@ public class FibHeap { return new FibHeap(fh.degree+this.degree, root, forest); } } - + private void insert(Vector a, - TaggedTree tt) { + TaggedTree tt) { int index = tt.degree; if(a.elementAt(index) == null) { a.setElementAt(tt.tree, index); @@ -74,13 +76,13 @@ public class FibHeap { insert(a, itt); } } - + private FibHeap getMin_t(Vector a, - int mini, - Tree mint, - Vector b, - int i, - int d) { + int mini, + Tree mint, + Vector b, + int i, + int d) { if(i >= d) { return new FibHeap(this.degree-1, new TaggedTree(mini, mint), b); } else { @@ -98,7 +100,7 @@ public class FibHeap { } } } - + private int locallog(int n) { if(n == 1) { return 0; @@ -106,7 +108,7 @@ public class FibHeap { return 1 + locallog(n/2); } } - + public FibHeap deleteMinFH() { if(this.isEmpty()) { // error here @@ -144,11 +146,11 @@ public class FibHeap { return getMin_t(a, d, test, new Vector(), 0, d); } } - + private Vector combine(int index, - Vector ts, - Vector next, - Vector rest) { + Vector ts, + Vector next, + Vector rest) { if(ts.size() == 0) { return startup(index+1, next, rest); } else if (ts.size() == 1) { @@ -166,10 +168,10 @@ public class FibHeap { return combine(index, nts, next, rest); } } - + private Vector startup(int index, - Vector ts, - Vector rest) { + Vector ts, + Vector rest) { if(ts.size() == 0) { if(rest.size() == 0) { return new Vector(); @@ -194,9 +196,9 @@ public class FibHeap { } } } - + private FibHeap chooseMin(FibHeap fh, - TaggedTree tt) { + TaggedTree tt) { FibHeap rfh = null; if(fh.ttree.tree.root <= tt.tree.root) { fh.forest.insertElementAt(tt, 0); @@ -207,7 +209,7 @@ public class FibHeap { } return rfh; } - + public FibHeap deleteMinFH_t() { if(this.isEmpty()) { // error here @@ -243,7 +245,7 @@ public class FibHeap { na.addElement(a.elementAt(i)); } Vector vvec = startup(0, ts, na); - + // getMin() TaggedTree rtt = (TaggedTree)vvec.elementAt(0); FibHeap rfh = new FibHeap(this.degree-1, rtt, new Vector()); diff --git a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/Fibheaps/TestRunner.java b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/Fibheaps/TestRunner.java index 2b5d94a5..c61f7b72 100644 --- a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/Fibheaps/TestRunner.java +++ b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/Fibheaps/TestRunner.java @@ -1,5 +1,7 @@ +package Fibheaps; + // the fibheap class -public class TestRunner { +public class TestRunner extends Thread { public TestRunner() {} @@ -60,7 +62,7 @@ public class TestRunner { int threadnum = 62; for(int i = 0; i < threadnum; ++i) { TestRunner tr = new TestRunner(); - tr.run(); + tr.start(); } } } diff --git a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/Fibheaps/Tree.java b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/Fibheaps/Tree.java index a6e495e0..4df6d36e 100644 --- a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/Fibheaps/Tree.java +++ b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/Fibheaps/Tree.java @@ -1,15 +1,17 @@ +package Fibheaps; + // the bionomial class public class Tree { public int root; public Vector v_trees; - + public Tree() { this.root = 0; this.v_trees = null; } - + public Tree(int root, - Vector trees) { + Vector trees) { this.root = root; this.v_trees = trees; } @@ -39,18 +41,18 @@ public class Tree { public class TaggedTree { public int degree; public Tree tree; - + public TaggedTree() { this.degree = 0; this.tree = null; } - + public TaggedTree(int degree, - Tree tree) { + Tree tree) { this.degree = degree; this.tree = tree; } - + public Vector getChildren() { Vector rst = new Vector(); Vector v = tree.v_trees; diff --git a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/GCBench/Node.java b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/GCBench/Node.java new file mode 100644 index 00000000..13a97faa --- /dev/null +++ b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/GCBench/Node.java @@ -0,0 +1,8 @@ +package GCBench; + +public class Node { + Node left, right; + int i, j; + Node(Node l, Node r) { left = l; right = r; } + Node() { } +} diff --git a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/GCBench/TestRunner.java b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/GCBench/TestRunner.java index 24297535..0507ff1f 100644 --- a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/GCBench/TestRunner.java +++ b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/GCBench/TestRunner.java @@ -1,3 +1,5 @@ +package GCBench; + //This is adapted from a benchmark written by John Ellis and Pete Kovac //of Post Communications. //It was modified by Hans Boehm of Silicon Graphics. @@ -43,7 +45,7 @@ //- Results are sensitive to locking cost, but we dont //check for proper locking -public class TestRunner extends Thread { +public class TestRunner extends Thread { public static final int kStretchTreeDepth = 16; // about 4Mb public static final int kLongLivedTreeDepth = 14; // about 1Mb @@ -144,19 +146,12 @@ public class TestRunner extends Thread { System.out.println((int)(array[1000]*1000000)); } } - - class Node { - Node left, right; - int i, j; - Node(Node l, Node r) { left = l; right = r; } - Node() { } - } - + public static void main(String[] args) { int threadnum = 62; for(int i = 0; i < threadnum; ++i) { TestRunner tr = new TestRunner(); - tr.run(); + tr.start(); } } } // class JavaGC diff --git a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/JGFMonteCarlo/AppDemo.java b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/JGFMonteCarlo/AppDemo.java index 001923da..b7a99141 100644 --- a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/JGFMonteCarlo/AppDemo.java +++ b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/JGFMonteCarlo/AppDemo.java @@ -1,3 +1,4 @@ +package JGFMonteCarlo; /************************************************************************** * * @@ -33,7 +34,7 @@ * * * @author H W Yau - * @version $Revision: 1.1 $ $Date: 2011/07/13 23:49:52 $ + * @version $Revision: 1.2 $ $Date: 2011/07/14 21:28:29 $ */ public class AppDemo { diff --git a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/JGFMonteCarlo/AppDemoRunner.java b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/JGFMonteCarlo/AppDemoRunner.java index e03ec1d6..96a13210 100644 --- a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/JGFMonteCarlo/AppDemoRunner.java +++ b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/JGFMonteCarlo/AppDemoRunner.java @@ -1,4 +1,6 @@ -class AppDemoRunner { +package JGFMonteCarlo; + +public class AppDemoRunner extends Thread { public String header; public String name; @@ -61,6 +63,7 @@ class AppDemoRunner { results.addElement(ps.getResult()); } } + public static void main(String[] args) { int datasize = 10000; //should be times of 2 int nruns = 62 * 62; //16 * 16; @@ -71,7 +74,7 @@ class AppDemoRunner { for(int i = 0; i < group; i++) { AppDemoRunner adr = new AppDemoRunner(i, nruns, group, ad); - adr.run(); + adr.start(); } } } \ No newline at end of file diff --git a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/JGFMonteCarlo/MonteCarloPath.java b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/JGFMonteCarlo/MonteCarloPath.java index c3756b4b..5a414329 100644 --- a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/JGFMonteCarlo/MonteCarloPath.java +++ b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/JGFMonteCarlo/MonteCarloPath.java @@ -1,4 +1,4 @@ -/** Banboo Version **/ +package JGFMonteCarlo; /************************************************************************** * * @@ -30,434 +30,434 @@ * * * @author H W Yau - * @version $Revision: 1.1 $ $Date: 2011/07/13 23:49:52 $ + * @version $Revision: 1.2 $ $Date: 2011/07/14 21:28:29 $ */ public class MonteCarloPath extends PathId { - //------------------------------------------------------------------------ - // Instance variables. - //------------------------------------------------------------------------ - /** - * Random fluctuations generated as a series of random numbers with - * given distribution. - */ - public float[] fluctuations; - /** - * The path values from which the random fluctuations are used to update. - */ - public float[] pathValue; - /** - * Integer flag for determining how the return was calculated, when - * used to calculate the mean drift and volatility parameters. - */ - public int returnDefinition; - /** - * Value for the mean drift, for use in the generation of the random path. - */ - public float expectedReturnRate; - /** - * Value for the volatility, for use in the generation of the random path. - */ - public float volatility; - /** - * Number of time steps for which the simulation should act over. - */ - public int nTimeSteps; - /** - * The starting value for of the security. - */ - public float pathStartValue; - //------------------------------------------------------------------------ - // Constructors. - //------------------------------------------------------------------------ - /** - * Default constructor. Needed by the HPT library to start create - * new instances of this class. The instance variables for this should - * then be initialised with the setInitAllTasks() method. - */ - public MonteCarloPath() { - super(); - this.expectedReturnRate = (float)0.0; - this.volatility = (float)0.0; - this.pathStartValue = (float)0.0; - this.returnDefinition=1; - this.nTimeSteps=0; - } + //------------------------------------------------------------------------ + // Instance variables. + //------------------------------------------------------------------------ + /** + * Random fluctuations generated as a series of random numbers with + * given distribution. + */ + public float[] fluctuations; + /** + * The path values from which the random fluctuations are used to update. + */ + public float[] pathValue; + /** + * Integer flag for determining how the return was calculated, when + * used to calculate the mean drift and volatility parameters. + */ + public int returnDefinition; + /** + * Value for the mean drift, for use in the generation of the random path. + */ + public float expectedReturnRate; + /** + * Value for the volatility, for use in the generation of the random path. + */ + public float volatility; + /** + * Number of time steps for which the simulation should act over. + */ + public int nTimeSteps; + /** + * The starting value for of the security. + */ + public float pathStartValue; + //------------------------------------------------------------------------ + // Constructors. + //------------------------------------------------------------------------ + /** + * Default constructor. Needed by the HPT library to start create + * new instances of this class. The instance variables for this should + * then be initialised with the setInitAllTasks() method. + */ + public MonteCarloPath() { + super(); + this.expectedReturnRate = (float)0.0; + this.volatility = (float)0.0; + this.pathStartValue = (float)0.0; + this.returnDefinition=1; + this.nTimeSteps=0; + } + /** + * Constructor, using the ReturnPath object to initialise + * the necessary instance variables. + * + * @param returnPath Object used to define the instance variables in + * this object. + * @param nTimeSteps The number of time steps for which to generate the + * random path. + * @exception DemoException Thrown if there is a problem initialising the + * object's instance variables. + */ + public MonteCarloPath(ReturnPath returnPath, + int nTimeSteps) { /** - * Constructor, using the ReturnPath object to initialise - * the necessary instance variables. - * - * @param returnPath Object used to define the instance variables in - * this object. - * @param nTimeSteps The number of time steps for which to generate the - * random path. - * @exception DemoException Thrown if there is a problem initialising the - * object's instance variables. - */ - public MonteCarloPath(ReturnPath returnPath, - int nTimeSteps) { - /** - * These instance variables are members of PathId class. - */ - this.expectedReturnRate = (float)0.0; - this.volatility = (float)0.0; - this.pathStartValue = (float)0.0; - this.returnDefinition=1; - - copyInstanceVariables(returnPath); - this.nTimeSteps = nTimeSteps; - this.pathValue = new float[nTimeSteps]; - this.fluctuations = new float[nTimeSteps]; - } - /** - * Constructor, where the PathId objects is used to ease - * the number of instance variables to pass in. - * - * @param pathId Object used to define the identity of this Path. - * @param returnDefinition How the statistic variables were defined, - * according to the definitions in - * ReturnPath's two class variables - * COMPOUNDED and - * NONCOMPOUNDED. - * @param expectedReturnRate The measured expected return rate for which to generate. - * @param volatility The measured volatility for which to generate. - * @param nTimeSteps The number of time steps for which to generate. - * @exception DemoException Thrown if there is a problem initialising the - * object's instance variables. + * These instance variables are members of PathId class. */ - public MonteCarloPath(PathId pathId, - int returnDefinition, - float expectedReturnRate, - float volatility, - int nTimeSteps) { - /** - * These instance variables are members of PathId class. - * Invoking with this particular signature should point to the - * definition in the PathId class. - */ - this.pathStartValue = (float)0.0; - - copyInstanceVariables(pathId); - this.returnDefinition = returnDefinition; - this.expectedReturnRate = expectedReturnRate; - this.volatility = volatility; - this.nTimeSteps = nTimeSteps; - this.pathValue = new float[nTimeSteps]; - this.fluctuations = new float[nTimeSteps]; - } + this.expectedReturnRate = (float)0.0; + this.volatility = (float)0.0; + this.pathStartValue = (float)0.0; + this.returnDefinition=1; + + copyInstanceVariables(returnPath); + this.nTimeSteps = nTimeSteps; + this.pathValue = new float[nTimeSteps]; + this.fluctuations = new float[nTimeSteps]; + } + /** + * Constructor, where the PathId objects is used to ease + * the number of instance variables to pass in. + * + * @param pathId Object used to define the identity of this Path. + * @param returnDefinition How the statistic variables were defined, + * according to the definitions in + * ReturnPath's two class variables + * COMPOUNDED and + * NONCOMPOUNDED. + * @param expectedReturnRate The measured expected return rate for which to generate. + * @param volatility The measured volatility for which to generate. + * @param nTimeSteps The number of time steps for which to generate. + * @exception DemoException Thrown if there is a problem initialising the + * object's instance variables. + */ + public MonteCarloPath(PathId pathId, + int returnDefinition, + float expectedReturnRate, + float volatility, + int nTimeSteps) { /** - * Constructor, for when the user wishes to define each of the instance - * variables individually. - * - * @param name The name of the security which this Monte Carlo path - * should represent. - * @param startDate The date when the path starts, in 'YYYYMMDD' format. - * @param endDate The date when the path ends, in 'YYYYMMDD' format. - * @param dTime The interval in the data between successive data points - * in the generated path. - * @param returnDefinition How the statistic variables were defined, - * according to the definitions in - * ReturnPath's two class variables - * COMPOUNDED and - * NONCOMPOUNDED. - * @param expectedReturnRate The measured mean drift for which to generate. - * @param volatility The measured volatility for which to generate. - * @param nTimeSteps The number of time steps for which to generate. + * These instance variables are members of PathId class. + * Invoking with this particular signature should point to the + * definition in the PathId class. */ - public MonteCarloPath(String name, - int startDate, - int endDate, - float dTime, - int returnDefinition, - float expectedReturnRate, - float volatility, - int nTimeSteps) { - /** - * These instance variables are members of PathId class. - */ - this.name = name; - this.startDate = startDate; - this.endDate = endDate; - this.dTime = dTime; - this.returnDefinition = returnDefinition; - this.expectedReturnRate = expectedReturnRate; - this.volatility = volatility; - this.nTimeSteps = nTimeSteps; - this.pathValue = new float[nTimeSteps]; - this.fluctuations = new float[nTimeSteps]; - } + this.pathStartValue = (float)0.0; - //------------------------------------------------------------------------ - // Methods. - //------------------------------------------------------------------------ - //------------------------------------------------------------------------ - // Accessor methods for class MonteCarloPath. - // Generated by 'makeJavaAccessor.pl' script. HWY. 20th January 1999. - //------------------------------------------------------------------------ + copyInstanceVariables(pathId); + this.returnDefinition = returnDefinition; + this.expectedReturnRate = expectedReturnRate; + this.volatility = volatility; + this.nTimeSteps = nTimeSteps; + this.pathValue = new float[nTimeSteps]; + this.fluctuations = new float[nTimeSteps]; + } + /** + * Constructor, for when the user wishes to define each of the instance + * variables individually. + * + * @param name The name of the security which this Monte Carlo path + * should represent. + * @param startDate The date when the path starts, in 'YYYYMMDD' format. + * @param endDate The date when the path ends, in 'YYYYMMDD' format. + * @param dTime The interval in the data between successive data points + * in the generated path. + * @param returnDefinition How the statistic variables were defined, + * according to the definitions in + * ReturnPath's two class variables + * COMPOUNDED and + * NONCOMPOUNDED. + * @param expectedReturnRate The measured mean drift for which to generate. + * @param volatility The measured volatility for which to generate. + * @param nTimeSteps The number of time steps for which to generate. + */ + public MonteCarloPath(String name, + int startDate, + int endDate, + float dTime, + int returnDefinition, + float expectedReturnRate, + float volatility, + int nTimeSteps) { /** - * Accessor method for private instance variable fluctuations. - * - * @return Value of instance variable fluctuations. - * @exception DemoException thrown if instance variable fluctuations - * is undefined. + * These instance variables are members of PathId class. */ - /*public float[] get_fluctuations() { + this.name = name; + this.startDate = startDate; + this.endDate = endDate; + this.dTime = dTime; + this.returnDefinition = returnDefinition; + this.expectedReturnRate = expectedReturnRate; + this.volatility = volatility; + this.nTimeSteps = nTimeSteps; + this.pathValue = new float[nTimeSteps]; + this.fluctuations = new float[nTimeSteps]; + } + + //------------------------------------------------------------------------ + // Methods. + //------------------------------------------------------------------------ + //------------------------------------------------------------------------ + // Accessor methods for class MonteCarloPath. + // Generated by 'makeJavaAccessor.pl' script. HWY. 20th January 1999. + //------------------------------------------------------------------------ + /** + * Accessor method for private instance variable fluctuations. + * + * @return Value of instance variable fluctuations. + * @exception DemoException thrown if instance variable fluctuations + * is undefined. + */ + /*public float[] get_fluctuations() { return(this.fluctuations); }*/ - /** - * Set method for private instance variable fluctuations. - * - * @param fluctuations the value to set for the instance variable - * fluctuations. - */ - public void set_fluctuations(float[] fluctuations) { - this.fluctuations = fluctuations; - } - /** - * Accessor method for private instance variable pathValue. - * - * @return Value of instance variable pathValue. - * @exception DemoException thrown if instance variable pathValue - * is undefined. - */ - /*public float[] get_pathValue() { + /** + * Set method for private instance variable fluctuations. + * + * @param fluctuations the value to set for the instance variable + * fluctuations. + */ + public void set_fluctuations(float[] fluctuations) { + this.fluctuations = fluctuations; + } + /** + * Accessor method for private instance variable pathValue. + * + * @return Value of instance variable pathValue. + * @exception DemoException thrown if instance variable pathValue + * is undefined. + */ + /*public float[] get_pathValue() { return(this.pathValue); }*/ - /** - * Set method for private instance variable pathValue. - * - * @param pathValue the value to set for the instance variable pathValue. - */ - public void set_pathValue(float[] pathValue) { - this.pathValue = pathValue; - } - /** - * Accessor method for private instance variable returnDefinition. - * - * @return Value of instance variable returnDefinition. - * @exception DemoException thrown if instance variable returnDefinition - * is undefined. - */ - /*public int get_returnDefinition() { + /** + * Set method for private instance variable pathValue. + * + * @param pathValue the value to set for the instance variable pathValue. + */ + public void set_pathValue(float[] pathValue) { + this.pathValue = pathValue; + } + /** + * Accessor method for private instance variable returnDefinition. + * + * @return Value of instance variable returnDefinition. + * @exception DemoException thrown if instance variable returnDefinition + * is undefined. + */ + /*public int get_returnDefinition() { return(this.returnDefinition); }*/ - /** - * Set method for private instance variable returnDefinition. - * - * @param returnDefinition the value to set for the instance variable - * returnDefinition. - */ - public void set_returnDefinition(int returnDefinition) { - this.returnDefinition = returnDefinition; - } - /** - * Accessor method for private instance variable expectedReturnRate. - * - * @return Value of instance variable expectedReturnRate. - * @exception DemoException thrown if instance variable expectedReturnRate - * is undefined. - */ - /*public float get_expectedReturnRate() { + /** + * Set method for private instance variable returnDefinition. + * + * @param returnDefinition the value to set for the instance variable + * returnDefinition. + */ + public void set_returnDefinition(int returnDefinition) { + this.returnDefinition = returnDefinition; + } + /** + * Accessor method for private instance variable expectedReturnRate. + * + * @return Value of instance variable expectedReturnRate. + * @exception DemoException thrown if instance variable expectedReturnRate + * is undefined. + */ + /*public float get_expectedReturnRate() { return(this.expectedReturnRate); }*/ - /** - * Set method for private instance variable expectedReturnRate. - * - * @param expectedReturnRate the value to set for the instance variable - * expectedReturnRate. - */ - public void set_expectedReturnRate(float expectedReturnRate) { - this.expectedReturnRate = expectedReturnRate; - } - /** - * Accessor method for private instance variable volatility. - * - * @return Value of instance variable volatility. - * @exception DemoException thrown if instance variable volatility - * is undefined. - */ - /*public float get_volatility() { + /** + * Set method for private instance variable expectedReturnRate. + * + * @param expectedReturnRate the value to set for the instance variable + * expectedReturnRate. + */ + public void set_expectedReturnRate(float expectedReturnRate) { + this.expectedReturnRate = expectedReturnRate; + } + /** + * Accessor method for private instance variable volatility. + * + * @return Value of instance variable volatility. + * @exception DemoException thrown if instance variable volatility + * is undefined. + */ + /*public float get_volatility() { return(this.volatility); }*/ - /** - * Set method for private instance variable volatility. - * - * @param volatility the value to set for the instance variable - * volatility. - */ - public void set_volatility(float volatility) { - this.volatility = volatility; - } - /** - * Accessor method for private instance variable nTimeSteps. - * - * @return Value of instance variable nTimeSteps. - * @exception DemoException thrown if instance variable nTimeSteps - * is undefined. - */ - /*public int get_nTimeSteps() { + /** + * Set method for private instance variable volatility. + * + * @param volatility the value to set for the instance variable + * volatility. + */ + public void set_volatility(float volatility) { + this.volatility = volatility; + } + /** + * Accessor method for private instance variable nTimeSteps. + * + * @return Value of instance variable nTimeSteps. + * @exception DemoException thrown if instance variable nTimeSteps + * is undefined. + */ + /*public int get_nTimeSteps() { return(this.nTimeSteps); }*/ - /** - * Set method for private instance variable nTimeSteps. - * - * @param nTimeSteps the value to set for the instance variable - * nTimeSteps. - */ - public void set_nTimeSteps(int nTimeSteps) { - this.nTimeSteps = nTimeSteps; - } - /** - * Accessor method for private instance variable pathStartValue. - * - * @return Value of instance variable pathStartValue. - * @exception DemoException thrown if instance variable pathStartValue - * is undefined. - */ - /*public float get_pathStartValue() { + /** + * Set method for private instance variable nTimeSteps. + * + * @param nTimeSteps the value to set for the instance variable + * nTimeSteps. + */ + public void set_nTimeSteps(int nTimeSteps) { + this.nTimeSteps = nTimeSteps; + } + /** + * Accessor method for private instance variable pathStartValue. + * + * @return Value of instance variable pathStartValue. + * @exception DemoException thrown if instance variable pathStartValue + * is undefined. + */ + /*public float get_pathStartValue() { return(this.pathStartValue); }*/ - /** - * Set method for private instance variable pathStartValue. - * - * @param pathStartValue the value to set for the instance variable - * pathStartValue. - */ - public void set_pathStartValue(float pathStartValue) { - this.pathStartValue = pathStartValue; - } - //------------------------------------------------------------------------ - /** - * Method for copying the suitable instance variable from a - * ReturnPath object. - * - * @param obj Object used to define the instance variables which - * should be carried over to this object. - * @exception DemoException thrown if there is a problem accessing the - * instance variables from the target objetct. - */ - private void copyInstanceVariables(ReturnPath obj) { - // - // Instance variables defined in the PathId object. - this.name = obj.name; - this.startDate = obj.startDate; - this.endDate = obj.endDate; - this.dTime = obj.dTime; - // - // Instance variables defined in this object. - this.returnDefinition = obj.returnDefinition; - this.expectedReturnRate = obj.expectedReturnRate; - this.volatility = obj.volatility; - } + /** + * Set method for private instance variable pathStartValue. + * + * @param pathStartValue the value to set for the instance variable + * pathStartValue. + */ + public void set_pathStartValue(float pathStartValue) { + this.pathStartValue = pathStartValue; + } + //------------------------------------------------------------------------ + /** + * Method for copying the suitable instance variable from a + * ReturnPath object. + * + * @param obj Object used to define the instance variables which + * should be carried over to this object. + * @exception DemoException thrown if there is a problem accessing the + * instance variables from the target objetct. + */ + private void copyInstanceVariables(ReturnPath obj) { + // + // Instance variables defined in the PathId object. + this.name = obj.name; + this.startDate = obj.startDate; + this.endDate = obj.endDate; + this.dTime = obj.dTime; + // + // Instance variables defined in this object. + this.returnDefinition = obj.returnDefinition; + this.expectedReturnRate = obj.expectedReturnRate; + this.volatility = obj.volatility; + } - /** - * Method for returning a RatePath object from the Monte Carlo data - * generated. - * - * @return a RatePath object representing the generated - * data. - * @exception DemoException thrown if there was a problem creating - * the RatePath object. - */ - public RatePath getRatePath() { - return(new RatePath(this)); + /** + * Method for returning a RatePath object from the Monte Carlo data + * generated. + * + * @return a RatePath object representing the generated + * data. + * @exception DemoException thrown if there was a problem creating + * the RatePath object. + */ + public RatePath getRatePath() { + return(new RatePath(this)); + } + /** + * Method for calculating the sequence of fluctuations, based around + * a Gaussian distribution of given mean and variance, as defined + * in this class' instance variables. Mapping from Gaussian + * distribution of (0,1) to (mean-drift,volatility) is done via + * Ito's lemma on the log of the stock price. + * + * @param randomSeed The psuedo-random number seed value, to start off a + * given sequence of Gaussian fluctuations. + * @exception DemoException thrown if there are any problems with + * the computation. + */ + public boolean computeFluctuationsGaussian(long randomSeed) { + int ntimesteps = this.nTimeSteps; + int length = this.fluctuations.length; + if( ntimesteps > length ) { + return false; } - /** - * Method for calculating the sequence of fluctuations, based around - * a Gaussian distribution of given mean and variance, as defined - * in this class' instance variables. Mapping from Gaussian - * distribution of (0,1) to (mean-drift,volatility) is done via - * Ito's lemma on the log of the stock price. - * - * @param randomSeed The psuedo-random number seed value, to start off a - * given sequence of Gaussian fluctuations. - * @exception DemoException thrown if there are any problems with - * the computation. - */ - public boolean computeFluctuationsGaussian(long randomSeed) { - int ntimesteps = this.nTimeSteps; - int length = this.fluctuations.length; - if( ntimesteps > length ) { - return false; - } - float[] flucts = this.fluctuations; - float expectedreturnrate = this.expectedReturnRate; - float vol = this.volatility; - float dtime = this.dTime; - - // - // First, make use of the passed in seed value. - MyRandom rnd; - float v1,v2, r; - v1 = (float)0.0; - v2 = (float)0.0; - if( randomSeed == -1 ) { - rnd = new MyRandom(0, v1, v2); - } else { - rnd = new MyRandom((int)randomSeed, v1, v2); - } - - // - // Determine the mean and standard-deviation, from the mean-drift and volatility. - float mean = (expectedreturnrate-(float)0.5*vol*vol)*dtime; - float sd = vol*Math.sqrtf(dtime); - float gauss, meanGauss=(float)0.0, variance=(float)0.0; - for( int i=0; i < ntimesteps; i += 2 ) { - r = rnd.seed(); - gauss = r*rnd.v1; - meanGauss+= gauss; - variance+= gauss*gauss; - // - // Now map this onto a general Gaussian of given mean and variance. - flucts[i] = mean + sd*gauss; - // dbgPrintln("gauss="+gauss+" fluctuations="+fluctuations[i]); - - gauss = r*rnd.v2; - meanGauss+= gauss; - variance+= gauss*gauss; - // - // Now map this onto a general Gaussian of given mean and variance. - flucts[i+1] = mean + sd*gauss; - } - meanGauss/=(float)ntimesteps; - variance /=(float)ntimesteps; - // dbgPrintln("meanGauss="+meanGauss+" variance="+variance); + float[] flucts = this.fluctuations; + float expectedreturnrate = this.expectedReturnRate; + float vol = this.volatility; + float dtime = this.dTime; + + // + // First, make use of the passed in seed value. + MyRandom rnd; + float v1,v2, r; + v1 = (float)0.0; + v2 = (float)0.0; + if( randomSeed == -1 ) { + rnd = new MyRandom(0, v1, v2); + } else { + rnd = new MyRandom((int)randomSeed, v1, v2); } - /** - * Method for calculating the sequence of fluctuations, based around - * a Gaussian distribution of given mean and variance, as defined - * in this class' instance variables. Mapping from Gaussian - * distribution of (0,1) to (mean-drift,volatility) is done via - * Ito's lemma on the log of the stock price. This overloaded method - * is for when the random seed should be decided by the system. - * - * @exception DemoException thrown if there are any problems with - * the computation. - */ - public void computeFluctuationsGaussian() { - computeFluctuationsGaussian((long)-1); + + // + // Determine the mean and standard-deviation, from the mean-drift and volatility. + float mean = (expectedreturnrate-(float)0.5*vol*vol)*dtime; + float sd = vol*Math.sqrtf(dtime); + float gauss, meanGauss=(float)0.0, variance=(float)0.0; + for( int i=0; i < ntimesteps; i += 2 ) { + r = rnd.seed(); + gauss = r*rnd.v1; + meanGauss+= gauss; + variance+= gauss*gauss; + // + // Now map this onto a general Gaussian of given mean and variance. + flucts[i] = mean + sd*gauss; + // dbgPrintln("gauss="+gauss+" fluctuations="+fluctuations[i]); + + gauss = r*rnd.v2; + meanGauss+= gauss; + variance+= gauss*gauss; + // + // Now map this onto a general Gaussian of given mean and variance. + flucts[i+1] = mean + sd*gauss; } - /** - * Method for calculating the corresponding rate path, given the - * fluctuations and starting rate value. - * - * @param startValue the starting value of the rate path, to be - * updated with the precomputed fluctuations. - * @exception DemoException thrown if there are any problems with - * the computation. - */ - public void computePathValue(float startValue) { - float[] pathvalue = this.pathValue; - float[] flucts = this.fluctuations; - int length = this.nTimeSteps; - pathvalue[0] = startValue; - if( returnDefinition == 1 | - returnDefinition == 2) { - for(int i=1; i < length; i++ ) { - //System.printI((int)(flucts[i] * 10000)); - pathvalue[i] = pathvalue[i-1] * Math.expf(flucts[i]); - } - } + meanGauss/=(float)ntimesteps; + variance /=(float)ntimesteps; + // dbgPrintln("meanGauss="+meanGauss+" variance="+variance); + } + /** + * Method for calculating the sequence of fluctuations, based around + * a Gaussian distribution of given mean and variance, as defined + * in this class' instance variables. Mapping from Gaussian + * distribution of (0,1) to (mean-drift,volatility) is done via + * Ito's lemma on the log of the stock price. This overloaded method + * is for when the random seed should be decided by the system. + * + * @exception DemoException thrown if there are any problems with + * the computation. + */ + public void computeFluctuationsGaussian() { + computeFluctuationsGaussian((long)-1); + } + /** + * Method for calculating the corresponding rate path, given the + * fluctuations and starting rate value. + * + * @param startValue the starting value of the rate path, to be + * updated with the precomputed fluctuations. + * @exception DemoException thrown if there are any problems with + * the computation. + */ + public void computePathValue(float startValue) { + float[] pathvalue = this.pathValue; + float[] flucts = this.fluctuations; + int length = this.nTimeSteps; + pathvalue[0] = startValue; + if( returnDefinition == 1 | + returnDefinition == 2) { + for(int i=1; i < length; i++ ) { + //System.printI((int)(flucts[i] * 10000)); + pathvalue[i] = pathvalue[i-1] * Math.expf(flucts[i]); + } } + } } diff --git a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/JGFMonteCarlo/MyRandom.java b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/JGFMonteCarlo/MyRandom.java index 2a8f985d..ec6ef14c 100644 --- a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/JGFMonteCarlo/MyRandom.java +++ b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/JGFMonteCarlo/MyRandom.java @@ -1,58 +1,60 @@ +package JGFMonteCarlo; + public class MyRandom { - public int iseed; - public float v1,v2; + public int iseed; + public float v1,v2; - public MyRandom(int iseed, float v1, float v2) { - this.iseed = iseed; - this.v1 = v1; - this.v2 = v2; - } + public MyRandom(int iseed, float v1, float v2) { + this.iseed = iseed; + this.v1 = v1; + this.v2 = v2; + } - public float update() { - float rand; - float scale= (float)4.656612875e-10; + public float update() { + float rand; + float scale= (float)4.656612875e-10; - int is1,is2,iss2; - int imult= 16807; - int imod = 2147483647; - int seed = this.iseed; + int is1,is2,iss2; + int imult= 16807; + int imod = 2147483647; + int seed = this.iseed; - if (seed<=0) { - iseed = seed = 1; - } + if (seed<=0) { + iseed = seed = 1; + } - is2 = seed % 32768; - is1 = seed / 32768; - iss2 = is2 * imult; - is2 = iss2 % 32768; - is1 = (is1 * imult + iss2 / 32768) % (65536); + is2 = seed % 32768; + is1 = seed / 32768; + iss2 = is2 * imult; + is2 = iss2 % 32768; + is1 = (is1 * imult + iss2 / 32768) % (65536); - iseed = seed = (is1 * 32768 + is2) % imod; + iseed = seed = (is1 * 32768 + is2) % imod; - rand = scale * seed; + rand = scale * seed; - return rand; + return rand; - } + } - public float seed() { + public float seed() { - float s,u1,u2,r; - s = (float)1.0; - //do { - u1 = update(); - u2 = update(); + float s,u1,u2,r; + s = (float)1.0; + //do { + u1 = update(); + u2 = update(); - v1 = (float)2.0 * u1 - (float)1.0; - v2 = (float)2.0 * u2 - (float)1.0; - s = v1*v1 + v2*v2; - //} while (s >= (float)1.0); - s = s - (int)s; - //System.printI(0xb4); - r = Math.sqrtf((float)(-2.0*Math.logf(s))/(float)s); - //System.printI(0xb5); - return r; + v1 = (float)2.0 * u1 - (float)1.0; + v2 = (float)2.0 * u2 - (float)1.0; + s = v1*v1 + v2*v2; + //} while (s >= (float)1.0); + s = s - (int)s; + //System.printI(0xb4); + r = Math.sqrtf((float)(-2.0*Math.logf(s))/(float)s); + //System.printI(0xb5); + return r; - } + } } diff --git a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/JGFMonteCarlo/PathId.java b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/JGFMonteCarlo/PathId.java index 2320a693..fba9615a 100644 --- a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/JGFMonteCarlo/PathId.java +++ b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/JGFMonteCarlo/PathId.java @@ -1,63 +1,63 @@ -/** Banboo Version **/ +package JGFMonteCarlo; /************************************************************************** -* * -* Java Grande Forum Benchmark Suite - Thread Version 1.0 * -* * -* produced by * -* * -* Java Grande Benchmarking Project * -* * -* at * -* * -* Edinburgh Parallel Computing Centre * -* * -* email: epcc-javagrande@epcc.ed.ac.uk * -* * -* Original version of this code by Hon Yau (hwyau@epcc.ed.ac.uk) * -* * -* This version copyright (c) The University of Edinburgh, 2001. * -* All rights reserved. * -* * -**************************************************************************/ + * * + * Java Grande Forum Benchmark Suite - Thread Version 1.0 * + * * + * produced by * + * * + * Java Grande Benchmarking Project * + * * + * at * + * * + * Edinburgh Parallel Computing Centre * + * * + * email: epcc-javagrande@epcc.ed.ac.uk * + * * + * Original version of this code by Hon Yau (hwyau@epcc.ed.ac.uk) * + * * + * This version copyright (c) The University of Edinburgh, 2001. * + * All rights reserved. * + * * + **************************************************************************/ /** - * Base class for all the security objects, namely in terms of - * providing a consistent means of identifying each such object. - * Also provides some methods for writing out debug messages. - * - * @author H W Yau - * @version $Revision: 1.1 $ $Date: 2011/07/13 23:49:52 $ - */ + * Base class for all the security objects, namely in terms of + * providing a consistent means of identifying each such object. + * Also provides some methods for writing out debug messages. + * + * @author H W Yau + * @version $Revision: 1.2 $ $Date: 2011/07/14 21:28:29 $ + */ public class PathId { //------------------------------------------------------------------------ // Instance variables. //------------------------------------------------------------------------ /** - * Simple string name. - */ + * Simple string name. + */ public String name; /** - * The start date for the path, in YYYYMMDD format. - */ + * The start date for the path, in YYYYMMDD format. + */ public int startDate; /** - * The end date for the path, in YYYYMMDD format. - */ + * The end date for the path, in YYYYMMDD format. + */ public int endDate; /** - * The change in time between two successive data values. - */ + * The change in time between two successive data values. + */ public float dTime; //------------------------------------------------------------------------ // Constructors. //------------------------------------------------------------------------ /** - * Default constructor. - */ + * Default constructor. + */ public PathId() { this.startDate=0; this.endDate=0; @@ -65,10 +65,10 @@ public class PathId { } /** - * Another constructor. - * - * @param name The name for the security to record. - */ + * Another constructor. + * + * @param name The name for the security to record. + */ public PathId(String name) { this.name = name; this.startDate=0; @@ -84,82 +84,82 @@ public class PathId { // Generated by 'makeJavaAccessor.pl' script. HWY. 20th January 1999. //------------------------------------------------------------------------ /** - * Accessor method for private instance variable name. - * - * @return Value of instance variable name. - * @exception DemoException thrown if instance variable name is undefined. - */ + * Accessor method for private instance variable name. + * + * @return Value of instance variable name. + * @exception DemoException thrown if instance variable name is undefined. + */ /*public String get_name() { return(this.name); }*/ /** - * Set method for private instance variable name. - * - * @param name the value to set for the instance variable name. - */ + * Set method for private instance variable name. + * + * @param name the value to set for the instance variable name. + */ public void set_name(String name) { this.name = name; } /** - * Accessor method for private instance variable startDate. - * - * @return Value of instance variable startDate. - * @exception DemoException thrown if instance variable startDate is undefined. - */ + * Accessor method for private instance variable startDate. + * + * @return Value of instance variable startDate. + * @exception DemoException thrown if instance variable startDate is undefined. + */ /*public int get_startDate() { return(this.startDate); }*/ /** - * Set method for private instance variable startDate. - * - * @param startDate the value to set for the instance variable startDate. - */ + * Set method for private instance variable startDate. + * + * @param startDate the value to set for the instance variable startDate. + */ public void set_startDate(int startDate) { this.startDate = startDate; } /** - * Accessor method for private instance variable endDate. - * - * @return Value of instance variable endDate. - * @exception DemoException thrown if instance variable endDate is undefined. - */ + * Accessor method for private instance variable endDate. + * + * @return Value of instance variable endDate. + * @exception DemoException thrown if instance variable endDate is undefined. + */ /*public int get_endDate() { return(this.endDate); }*/ /** - * Set method for private instance variable endDate. - * - * @param endDate the value to set for the instance variable endDate. - */ + * Set method for private instance variable endDate. + * + * @param endDate the value to set for the instance variable endDate. + */ public void set_endDate(int endDate) { this.endDate = endDate; } /** - * Accessor method for private instance variable dTime. - * - * @return Value of instance variable dTime. - * @exception DemoException thrown if instance variable dTime is undefined. - */ + * Accessor method for private instance variable dTime. + * + * @return Value of instance variable dTime. + * @exception DemoException thrown if instance variable dTime is undefined. + */ /*public float get_dTime() { return(this.dTime); }*/ /** - * Set method for private instance variable dTime. - * - * @param dTime the value to set for the instance variable dTime. - */ + * Set method for private instance variable dTime. + * + * @param dTime the value to set for the instance variable dTime. + */ public void set_dTime(float dTime) { this.dTime = dTime; } //------------------------------------------------------------------------ /** - * Clone the instance variables in this class, from another instance - * of this class. - * - * @param obj the PathId object from which to copy. - * @exception DemoException thrown if the values to be copied contain - * any undefined objects. - */ + * Clone the instance variables in this class, from another instance + * of this class. + * + * @param obj the PathId object from which to copy. + * @exception DemoException thrown if the values to be copied contain + * any undefined objects. + */ public void copyInstanceVariables(PathId obj) { this.name = obj.name; this.startDate = obj.startDate; @@ -167,13 +167,13 @@ public class PathId { this.dTime = obj.dTime; } /** - * Dumps the contents of the fields, to standard-out, for debugging. - */ + * Dumps the contents of the fields, to standard-out, for debugging. + */ public void dbgDumpFields() { -// dbgPrintln("name=" +this.name); -// dbgPrintln("startDate="+this.startDate); -// dbgPrintln("endDate=" +this.endDate); -// dbgPrintln("dTime=" +this.dTime); + // dbgPrintln("name=" +this.name); + // dbgPrintln("startDate="+this.startDate); + // dbgPrintln("endDate=" +this.endDate); + // dbgPrintln("dTime=" +this.dTime); } } diff --git a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/JGFMonteCarlo/PriceStock.java b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/JGFMonteCarlo/PriceStock.java index 7daed65c..78d76efb 100644 --- a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/JGFMonteCarlo/PriceStock.java +++ b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/JGFMonteCarlo/PriceStock.java @@ -1,4 +1,4 @@ -/** Banboo Version **/ +package JGFMonteCarlo; /************************************************************************** * * @@ -29,122 +29,122 @@ * value. * * @author H W Yau - * @version $Revision: 1.1 $ $Date: 2011/07/13 23:49:52 $ + * @version $Revision: 1.2 $ $Date: 2011/07/14 21:28:29 $ */ public class PriceStock{ - //------------------------------------------------------------------------ - // Instance variables. - //------------------------------------------------------------------------ - /** - * The Monte Carlo path to be generated. - */ - public MonteCarloPath mcPath; - /** - * String identifier for a given task. - */ - //private String taskHeader; - /** - * Random seed from which the Monte Carlo sequence is started. - */ - public long randomSeed; - /** - * Initial stock price value. - */ - public float pathStartValue; - /** - * Object which represents the results from a given computation task. - */ - public ToResult result; - public float expectedReturnRate; - public float volatility; - public float volatility2; - public float finalStockPrice; - public float[] pathValue; + //------------------------------------------------------------------------ + // Instance variables. + //------------------------------------------------------------------------ + /** + * The Monte Carlo path to be generated. + */ + public MonteCarloPath mcPath; + /** + * String identifier for a given task. + */ + //private String taskHeader; + /** + * Random seed from which the Monte Carlo sequence is started. + */ + public long randomSeed; + /** + * Initial stock price value. + */ + public float pathStartValue; + /** + * Object which represents the results from a given computation task. + */ + public ToResult result; + public float expectedReturnRate; + public float volatility; + public float volatility2; + public float finalStockPrice; + public float[] pathValue; - //------------------------------------------------------------------------ - // Constructors. - //------------------------------------------------------------------------ - /** - * Default constructor. - */ - public PriceStock() { - //this.taskHeader = ""; - this.randomSeed=-1; - this.pathStartValue=(float)0.0; - this.expectedReturnRate=(float)0.0; - this.volatility=(float)0.0; - this.volatility2=(float)0.0; - this.finalStockPrice=(float)0.0; + //------------------------------------------------------------------------ + // Constructors. + //------------------------------------------------------------------------ + /** + * Default constructor. + */ + public PriceStock() { + //this.taskHeader = ""; + this.randomSeed=-1; + this.pathStartValue=(float)0.0; + this.expectedReturnRate=(float)0.0; + this.volatility=(float)0.0; + this.volatility2=(float)0.0; + this.finalStockPrice=(float)0.0; - mcPath = new MonteCarloPath(); - } - //------------------------------------------------------------------------ - // Methods. - //------------------------------------------------------------------------ - //------------------------------------------------------------------------ - // Methods which implement the Slaveable interface. - //------------------------------------------------------------------------ - /** - * Method which is passed in the initialisation data common to all tasks, - * and then unpacks them for use by this object. - * - * @param obj Object representing data which are common to all tasks. - */ - public void setInitAllTasks(AppDemoRunner obj) { - mcPath.name = obj.name; - mcPath.startDate = obj.startDate; - mcPath.endDate = obj.endDate; - mcPath.dTime = obj.dTime; - mcPath.returnDefinition = obj.returnDefinition; - mcPath.expectedReturnRate = obj.expectedReturnRate; - mcPath.volatility = obj.volatility; - int nTimeSteps = obj.nTimeSteps; - mcPath.nTimeSteps = nTimeSteps; - this.pathStartValue = obj.pathStartValue; - mcPath.pathStartValue = pathStartValue; - mcPath.pathValue = new float[nTimeSteps]; - mcPath.fluctuations = new float[nTimeSteps]; - } - /** - * Method which is passed in the data representing each task, which then - * unpacks it for use by this object. - * - * @param obj Object representing the data which defines a given task. - */ - public void setTask(/*String header, */long randomSeed) { - //this.taskHeader = header; - this.randomSeed = randomSeed; - } - /** - * The business end. Invokes the necessary computation routine, for a - * a given task. - */ - public void run() { - mcPath.computeFluctuationsGaussian(randomSeed); - mcPath.computePathValue(pathStartValue); - RatePath rateP = new RatePath(mcPath); - ReturnPath returnP = rateP.getReturnCompounded(); - returnP.estimatePath(); - expectedReturnRate = returnP.expectedReturnRate; - volatility = returnP.volatility; - volatility2 = returnP.volatility2; - finalStockPrice = rateP.getEndPathValue();//pathValue[rateP.pathValue.length-1]; - pathValue = mcPath.pathValue; - } - /* - * Method which returns the results of a computation back to the caller. - * - * @return An object representing the computed results. - */ - public ToResult getResult() { - //String resultHeader = "Result of task with Header="+taskHeader+": randomSeed="+randomSeed+": pathStartValue="+(int)pathStartValue; - ToResult res = new ToResult(/*resultHeader,*/ - expectedReturnRate, - volatility, - volatility2, - finalStockPrice, - pathValue); - return res; - } + mcPath = new MonteCarloPath(); + } + //------------------------------------------------------------------------ + // Methods. + //------------------------------------------------------------------------ + //------------------------------------------------------------------------ + // Methods which implement the Slaveable interface. + //------------------------------------------------------------------------ + /** + * Method which is passed in the initialisation data common to all tasks, + * and then unpacks them for use by this object. + * + * @param obj Object representing data which are common to all tasks. + */ + public void setInitAllTasks(AppDemoRunner obj) { + mcPath.name = obj.name; + mcPath.startDate = obj.startDate; + mcPath.endDate = obj.endDate; + mcPath.dTime = obj.dTime; + mcPath.returnDefinition = obj.returnDefinition; + mcPath.expectedReturnRate = obj.expectedReturnRate; + mcPath.volatility = obj.volatility; + int nTimeSteps = obj.nTimeSteps; + mcPath.nTimeSteps = nTimeSteps; + this.pathStartValue = obj.pathStartValue; + mcPath.pathStartValue = pathStartValue; + mcPath.pathValue = new float[nTimeSteps]; + mcPath.fluctuations = new float[nTimeSteps]; + } + /** + * Method which is passed in the data representing each task, which then + * unpacks it for use by this object. + * + * @param obj Object representing the data which defines a given task. + */ + public void setTask(/*String header, */long randomSeed) { + //this.taskHeader = header; + this.randomSeed = randomSeed; + } + /** + * The business end. Invokes the necessary computation routine, for a + * a given task. + */ + public void run() { + mcPath.computeFluctuationsGaussian(randomSeed); + mcPath.computePathValue(pathStartValue); + RatePath rateP = new RatePath(mcPath); + ReturnPath returnP = rateP.getReturnCompounded(); + returnP.estimatePath(); + expectedReturnRate = returnP.expectedReturnRate; + volatility = returnP.volatility; + volatility2 = returnP.volatility2; + finalStockPrice = rateP.getEndPathValue();//pathValue[rateP.pathValue.length-1]; + pathValue = mcPath.pathValue; + } + /* + * Method which returns the results of a computation back to the caller. + * + * @return An object representing the computed results. + */ + public ToResult getResult() { + //String resultHeader = "Result of task with Header="+taskHeader+": randomSeed="+randomSeed+": pathStartValue="+(int)pathStartValue; + ToResult res = new ToResult(/*resultHeader,*/ + expectedReturnRate, + volatility, + volatility2, + finalStockPrice, + pathValue); + return res; + } } diff --git a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/JGFMonteCarlo/RatePath.java b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/JGFMonteCarlo/RatePath.java index f7576982..c22a0c38 100644 --- a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/JGFMonteCarlo/RatePath.java +++ b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/JGFMonteCarlo/RatePath.java @@ -1,4 +1,4 @@ -/** Banboo Version **/ +package JGFMonteCarlo; /************************************************************************** * * @@ -30,307 +30,307 @@ * * * @author H W Yau - * @version $Revision: 1.1 $ $Date: 2011/07/13 23:49:52 $ + * @version $Revision: 1.2 $ $Date: 2011/07/14 21:28:29 $ */ public class RatePath extends PathId { - //------------------------------------------------------------------------ - // Class variables. - //------------------------------------------------------------------------ - /** - * Class variable to represent the minimal date, whence the stock prices - * appear. Used to trap any potential problems with the data. - */ - public int MINIMUMDATE; - /** - * Class variable for defining what is meant by a small number, small enough - * to cause an arithmetic overflow when dividing. According to the - * Java Nutshell book, the actual range is +/-4.9406564841246544E-324 - */ - public float EPSILON; + //------------------------------------------------------------------------ + // Class variables. + //------------------------------------------------------------------------ + /** + * Class variable to represent the minimal date, whence the stock prices + * appear. Used to trap any potential problems with the data. + */ + public int MINIMUMDATE; + /** + * Class variable for defining what is meant by a small number, small enough + * to cause an arithmetic overflow when dividing. According to the + * Java Nutshell book, the actual range is +/-4.9406564841246544E-324 + */ + public float EPSILON; - //------------------------------------------------------------------------ - // Instance variables. - //------------------------------------------------------------------------ - /** - * An instance variable, for storing the rate's path values itself. - */ - public float[] pathValue; - /** - * An instance variable, for storing the corresponding date of the datum, - * in 'YYYYMMDD' format. - */ - public int[] pathDate; - /** - * The number of accepted values in the rate path. - */ - public int nAcceptedPathValue; + //------------------------------------------------------------------------ + // Instance variables. + //------------------------------------------------------------------------ + /** + * An instance variable, for storing the rate's path values itself. + */ + public float[] pathValue; + /** + * An instance variable, for storing the corresponding date of the datum, + * in 'YYYYMMDD' format. + */ + public int[] pathDate; + /** + * The number of accepted values in the rate path. + */ + public int nAcceptedPathValue; - //------------------------------------------------------------------------ - // Constructors. - //------------------------------------------------------------------------ - /** - * Constructor, where the user specifies the directory and filename in - * from which the data should be read. - * - * @param String dirName - * @param String filename - * @exception DemoException thrown if there is a problem reading in - * the data file. - */ - public RatePath() { - this.MINIMUMDATE = 19000101; - this.EPSILON= (float)10.0 * (float)(4.9E-324); - this.nAcceptedPathValue = 0; - readRatesFile(); - } - /** - * Constructor, for when the user specifies simply an array of values - * for the path. User must also include information for specifying - * the other characteristics of the path. - * - * @param pathValue the array containing the values for the path. - * @param name the name to attach to the path. - * @param startDate date from which the path is supposed to start, in - * 'YYYYMMDD' format. - * @param startDate date from which the path is supposed to end, in - * 'YYYYMMDD' format. - * @param dTime the time interval between successive path values, in - * fractions of a year. - */ - public RatePath(float[] pathValue, - String name, - int startDate, - int endDate, - float dTime) { - this.MINIMUMDATE = 19000101; - this.EPSILON= (float)10.0 * (float)(4.9E-324); - - this.name = name; - this.startDate = startDate; - this.endDate = endDate; - this.dTime = dTime; - this.pathValue = pathValue; - this.nAcceptedPathValue = pathValue.length; - } - /** - * Constructor, for use by the Monte Carlo generator, when it wishes - * to represent its findings as a RatePath object. - * - * @param mc the Monte Carlo generator object, whose data are to - * be copied over. - * @exception DemoException thrown if there is an attempt to access - * an undefined variable. - */ - public RatePath(MonteCarloPath mc) { - this.MINIMUMDATE = 19000101; - this.EPSILON= (float)10.0 * (float)(4.9E-324); + //------------------------------------------------------------------------ + // Constructors. + //------------------------------------------------------------------------ + /** + * Constructor, where the user specifies the directory and filename in + * from which the data should be read. + * + * @param String dirName + * @param String filename + * @exception DemoException thrown if there is a problem reading in + * the data file. + */ + public RatePath() { + this.MINIMUMDATE = 19000101; + this.EPSILON= (float)10.0 * (float)(4.9E-324); + this.nAcceptedPathValue = 0; + readRatesFile(); + } + /** + * Constructor, for when the user specifies simply an array of values + * for the path. User must also include information for specifying + * the other characteristics of the path. + * + * @param pathValue the array containing the values for the path. + * @param name the name to attach to the path. + * @param startDate date from which the path is supposed to start, in + * 'YYYYMMDD' format. + * @param startDate date from which the path is supposed to end, in + * 'YYYYMMDD' format. + * @param dTime the time interval between successive path values, in + * fractions of a year. + */ + public RatePath(float[] pathValue, + String name, + int startDate, + int endDate, + float dTime) { + this.MINIMUMDATE = 19000101; + this.EPSILON= (float)10.0 * (float)(4.9E-324); + + this.name = name; + this.startDate = startDate; + this.endDate = endDate; + this.dTime = dTime; + this.pathValue = pathValue; + this.nAcceptedPathValue = pathValue.length; + } + /** + * Constructor, for use by the Monte Carlo generator, when it wishes + * to represent its findings as a RatePath object. + * + * @param mc the Monte Carlo generator object, whose data are to + * be copied over. + * @exception DemoException thrown if there is an attempt to access + * an undefined variable. + */ + public RatePath(MonteCarloPath mc) { + this.MINIMUMDATE = 19000101; + this.EPSILON= (float)10.0 * (float)(4.9E-324); - // - // Fields pertaining to the parent PathId object: - this.name = mc.name; - this.startDate = mc.startDate; - this.endDate = mc.endDate; - this.dTime = mc.dTime; - // - // Fields pertaining to RatePath object itself. - pathValue=mc.pathValue; - nAcceptedPathValue=mc.nTimeSteps; - // - // Note that currently the pathDate is neither declared, defined, - // nor used in the MonteCarloPath object. - pathDate=new int[nAcceptedPathValue]; + // + // Fields pertaining to the parent PathId object: + this.name = mc.name; + this.startDate = mc.startDate; + this.endDate = mc.endDate; + this.dTime = mc.dTime; + // + // Fields pertaining to RatePath object itself. + pathValue=mc.pathValue; + nAcceptedPathValue=mc.nTimeSteps; + // + // Note that currently the pathDate is neither declared, defined, + // nor used in the MonteCarloPath object. + pathDate=new int[nAcceptedPathValue]; + } + /** + * Constructor, for when there is no actual pathValue with which to + * initialise. + * + * @param pathValueLegth the length of the array containing the values + * for the path. + * @param name the name to attach to the path. + * @param startDate date from which the path is supposed to start, in + * 'YYYYMMDD' format. + * @param startDate date from which the path is supposed to end, in + * 'YYYYMMDD' format. + * @param dTime the time interval between successive path values, in + * fractions of a year. + */ + public RatePath(int pathValueLength, + String name, + int startDate, + int endDate, + float dTime) { + this.MINIMUMDATE = 19000101; + this.EPSILON= (float)10.0 * (float)(4.9E-324); + + this.name = name; + this.startDate = startDate; + this.endDate = endDate; + this.dTime = dTime; + this.pathValue = new float[pathValueLength]; + this.nAcceptedPathValue = pathValue.length; + } + //------------------------------------------------------------------------ + // Methods. + //------------------------------------------------------------------------ + /** + * Routine to update this rate path with the values from another rate + * path, via its pathValue array. + * + * @param operandPath the path value array to use for the update. + * @exception DemoException thrown if there is a mismatch between the + * lengths of the operand and target arrays. + */ + public boolean inc_pathValue(float[] operandPath) { + int length = this.pathValue.length; + if( length != operandPath.length ) { + return false; } - /** - * Constructor, for when there is no actual pathValue with which to - * initialise. - * - * @param pathValueLegth the length of the array containing the values - * for the path. - * @param name the name to attach to the path. - * @param startDate date from which the path is supposed to start, in - * 'YYYYMMDD' format. - * @param startDate date from which the path is supposed to end, in - * 'YYYYMMDD' format. - * @param dTime the time interval between successive path values, in - * fractions of a year. - */ - public RatePath(int pathValueLength, - String name, - int startDate, - int endDate, - float dTime) { - this.MINIMUMDATE = 19000101; - this.EPSILON= (float)10.0 * (float)(4.9E-324); - - this.name = name; - this.startDate = startDate; - this.endDate = endDate; - this.dTime = dTime; - this.pathValue = new float[pathValueLength]; - this.nAcceptedPathValue = pathValue.length; + float[] pathvalue = this.pathValue; + for(int i=0; ipathValue. - * - * @return Value of instance variable pathValue. - * @exception DemoException thrown if instance variable pathValue is undefined. - */ - /*public float[] get_pathValue() { + return true; + } + //------------------------------------------------------------------------ + // Accessor methods for class RatePath. + // Generated by 'makeJavaAccessor.pl' script. HWY. 20th January 1999. + //------------------------------------------------------------------------ + /** + * Accessor method for private instance variable pathValue. + * + * @return Value of instance variable pathValue. + * @exception DemoException thrown if instance variable pathValue is undefined. + */ + /*public float[] get_pathValue() { return(this.pathValue); }*/ - /** - * Set method for private instance variable pathValue. - * - * @param pathValue the value to set for the instance variable pathValue. - */ - public void set_pathValue(float[] pathValue) { - this.pathValue = pathValue; - } - /** - * Accessor method for private instance variable pathDate. - * - * @return Value of instance variable pathDate. - * @exception DemoException thrown if instance variable pathDate is undefined. - */ - /*public int[] get_pathDate() { + /** + * Set method for private instance variable pathValue. + * + * @param pathValue the value to set for the instance variable pathValue. + */ + public void set_pathValue(float[] pathValue) { + this.pathValue = pathValue; + } + /** + * Accessor method for private instance variable pathDate. + * + * @return Value of instance variable pathDate. + * @exception DemoException thrown if instance variable pathDate is undefined. + */ + /*public int[] get_pathDate() { return(this.pathDate); }*/ - /** - * Set method for private instance variable pathDate. - * - * @param pathDate the value to set for the instance variable pathDate. - */ - public void set_pathDate(int[] pathDate) { - this.pathDate = pathDate; - } - //------------------------------------------------------------------------ - /** - * Method to return the terminal value for a given rate path, as used - * in derivative calculations. - * - * @return The last value in the rate path. - */ - public float getEndPathValue() { - return( getPathValue(pathValue.length-1) ); + /** + * Set method for private instance variable pathDate. + * + * @param pathDate the value to set for the instance variable pathDate. + */ + public void set_pathDate(int[] pathDate) { + this.pathDate = pathDate; + } + //------------------------------------------------------------------------ + /** + * Method to return the terminal value for a given rate path, as used + * in derivative calculations. + * + * @return The last value in the rate path. + */ + public float getEndPathValue() { + return( getPathValue(pathValue.length-1) ); + } + /** + * Method to return the value for a given rate path, at a given index. + * One may want to index this in a more user friendly manner! + * + * @param index the index on which to return the path value. + * @return The value of the path at the designated index. + */ + public float getPathValue(int index) { + return(pathValue[index]); + } + /** + * Method for calculating the returns on a given rate path, via the + * definition for the instantaneous compounded return. + * u_i = \ln{\frac{S_i}{S_{i-1}}} + * + * @return the return, as defined. + * @exception DemoException thrown if there is a problem with the + * calculation. + */ + public ReturnPath getReturnCompounded() { + int length = this.nAcceptedPathValue; + float[] pathvalue = this.pathValue; + if( pathvalue == null || length == 0 ) { + return null; } - /** - * Method to return the value for a given rate path, at a given index. - * One may want to index this in a more user friendly manner! - * - * @param index the index on which to return the path value. - * @return The value of the path at the designated index. - */ - public float getPathValue(int index) { - return(pathValue[index]); + float[] returnPathValue = new float[length]; + returnPathValue[0] = (float)0.0; + for(int i=1; i< length; i++ ) { + returnPathValue[i] = Math.logf(pathvalue[i] / pathvalue[i-1]); } - /** - * Method for calculating the returns on a given rate path, via the - * definition for the instantaneous compounded return. - * u_i = \ln{\frac{S_i}{S_{i-1}}} - * - * @return the return, as defined. - * @exception DemoException thrown if there is a problem with the - * calculation. - */ - public ReturnPath getReturnCompounded() { - int length = this.nAcceptedPathValue; - float[] pathvalue = this.pathValue; - if( pathvalue == null || length == 0 ) { - return null; - } - float[] returnPathValue = new float[length]; - returnPathValue[0] = (float)0.0; - for(int i=1; i< length; i++ ) { - returnPathValue[i] = Math.logf(pathvalue[i] / pathvalue[i-1]); - } - ReturnPath rPath = new ReturnPath(returnPathValue, length, 1); - // - // Copy the PathId information to the ReturnPath object. - rPath.copyInstanceVariables(this); - rPath.estimatePath(); - return(rPath); + ReturnPath rPath = new ReturnPath(returnPathValue, length, 1); + // + // Copy the PathId information to the ReturnPath object. + rPath.copyInstanceVariables(this); + rPath.estimatePath(); + return(rPath); + } + /** + * Method for calculating the returns on a given rate path, via the + * definition for the instantaneous non-compounded return. + * u_i = \frac{S_i - S_{i-1}}{S_i} + * + * @return the return, as defined. + * @exception DemoException thrown if there is a problem with the + * calculation. + */ + public ReturnPath getReturnNonCompounded() { + int length = this.nAcceptedPathValue; + float[] pathvalue = this.pathValue; + if( pathvalue == null || length == 0 ) { + return null; } - /** - * Method for calculating the returns on a given rate path, via the - * definition for the instantaneous non-compounded return. - * u_i = \frac{S_i - S_{i-1}}{S_i} - * - * @return the return, as defined. - * @exception DemoException thrown if there is a problem with the - * calculation. - */ - public ReturnPath getReturnNonCompounded() { - int length = this.nAcceptedPathValue; - float[] pathvalue = this.pathValue; - if( pathvalue == null || length == 0 ) { - return null; - } - float[] returnPathValue = new float[length]; - returnPathValue[0] = (float)0.0; - for(int i=1; i< length; i++ ) { - returnPathValue[i] = (pathvalue[i] - pathvalue[i-1])/pathvalue[i]; - } - - ReturnPath rPath = new ReturnPath(returnPathValue, length, 2); - // - // Copy the PathId information to the ReturnPath object. - rPath.copyInstanceVariables(this); - rPath.estimatePath(); - return(rPath); + float[] returnPathValue = new float[length]; + returnPathValue[0] = (float)0.0; + for(int i=1; i< length; i++ ) { + returnPathValue[i] = (pathvalue[i] - pathvalue[i-1])/pathvalue[i]; } - //------------------------------------------------------------------------ - // Private methods. - //------------------------------------------------------------------------ - /** - * Method for reading in data file, in a given format. - * Namely: + + ReturnPath rPath = new ReturnPath(returnPathValue, length, 2); + // + // Copy the PathId information to the ReturnPath object. + rPath.copyInstanceVariables(this); + rPath.estimatePath(); + return(rPath); + } + //------------------------------------------------------------------------ + // Private methods. + //------------------------------------------------------------------------ + /** + * Method for reading in data file, in a given format. + * Namely:
       881003,0.0000,14.1944,13.9444,14.0832,2200050,0
       881004,0.0000,14.1668,14.0556,14.1668,1490850,0
@@ -339,43 +339,43 @@ public class RatePath extends PathId {
       990111,35.8125,35.8750,34.8750,35.1250,3920800,0
       990112,34.8750,34.8750,34.0000,34.0625,3577500,0
       
- *

Where the fields represent, one believes, the following: - *

    - *
  1. The date in 'YYMMDD' format
  2. - *
  3. Open
  4. - *
  5. High
  6. - *
  7. Low
  8. - *
  9. Last
  10. - *
  11. Volume
  12. - *
  13. Open Interest
  14. - *
- * One will probably make use of the closing price, but this can be - * redefined via the class variable DATUMFIELD. Note that - * since the read in data are then used to compute the return, this would - * be a good place to trap for zero values in the data, which will cause - * all sorts of problems. - * - * @param dirName the directory in which to search for the data file. - * @param filename the data filename itself. - * @exception DemoException thrown if there was a problem with the data - * file. - */ - private void readRatesFile(){ - // - // Now create an array to store the rates data. - int minimumdate = MINIMUMDATE; - float epsilon = EPSILON; - int nLines = 1000; //200; - int year = 88; - int month = 10; - int day = 3; - this.pathValue = new float[nLines]; - this.pathDate = new int[nLines]; - float[] pathvalue = this.pathValue; - int[] pathdate = this.pathDate; - nAcceptedPathValue=0; - int iLine=0; - /*char[] date = new char[9]; + *

Where the fields represent, one believes, the following: + *

    + *
  1. The date in 'YYMMDD' format
  2. + *
  3. Open
  4. + *
  5. High
  6. + *
  7. Low
  8. + *
  9. Last
  10. + *
  11. Volume
  12. + *
  13. Open Interest
  14. + *
+ * One will probably make use of the closing price, but this can be + * redefined via the class variable DATUMFIELD. Note that + * since the read in data are then used to compute the return, this would + * be a good place to trap for zero values in the data, which will cause + * all sorts of problems. + * + * @param dirName the directory in which to search for the data file. + * @param filename the data filename itself. + * @exception DemoException thrown if there was a problem with the data + * file. + */ + private void readRatesFile(){ + // + // Now create an array to store the rates data. + int minimumdate = MINIMUMDATE; + float epsilon = EPSILON; + int nLines = 1000; //200; + int year = 88; + int month = 10; + int day = 3; + this.pathValue = new float[nLines]; + this.pathDate = new int[nLines]; + float[] pathvalue = this.pathValue; + int[] pathdate = this.pathDate; + nAcceptedPathValue=0; + int iLine=0; + /*char[] date = new char[9]; date[0] = '1'; date[1] = '9'; date[2] = (char)(year/10 + '0'); @@ -385,13 +385,13 @@ public class RatePath extends PathId { date[6] = (char)(day/10 + '0'); date[7] = (char)(day%10 + '0'); date[8] = '\0';*/ - int aDate = 19881003; - /*for(int di = 0; di < 9; di++) { + int aDate = 19881003; + /*for(int di = 0; di < 9; di++) { aDate = aDate * 10 + (int)date[di]; }*/ - for(int k = 0; k < 20; /*40;*/ k++ ) { - for(int j = 0; j < 50; /*5;*/ j++) { - /*String date = "19"+String.valueOf(year); + for(int k = 0; k < 20; /*40;*/ k++ ) { + for(int j = 0; j < 50; /*5;*/ j++) { + /*String date = "19"+String.valueOf(year); if(month < 10) { date += "0"; } @@ -400,36 +400,36 @@ public class RatePath extends PathId { date += "0"; } date += String.valueOf(day);*/ - //int aDate = Integer.parseInt(date); - day++; - aDate++; - /*if(date[7] == '9') { + //int aDate = Integer.parseInt(date); + day++; + aDate++; + /*if(date[7] == '9') { date[7] = '0'; date[6] = (char)(date[6] + 1); } else { date[7] = (char)(date[7] + 1); }*/ - if(month == 2) { - if(day == 29) { - day = 1; - month++; - /*date[6] = '0'; + if(month == 2) { + if(day == 29) { + day = 1; + month++; + /*date[6] = '0'; date[7] = '1'; date[5] = '3';*/ - aDate += 72;// - day(29) + 101; - } - } else { - if(day == 31) { - day = 1; - month++; - aDate += 70; - /*date[6] = '0'; + aDate += 72;// - day(29) + 101; + } + } else { + if(day == 31) { + day = 1; + month++; + aDate += 70; + /*date[6] = '0'; date[7] = '1';*/ - if(month == 13) { - month = 1; - year++; - aDate += 8800; - /*date[4] = '0'; + if(month == 13) { + month = 1; + year++; + aDate += 8800; + /*date[4] = '0'; date[5] = '1'; if(date[3] == '9') { if(date[2] == '9') { @@ -447,7 +447,7 @@ public class RatePath extends PathId { } else { date[3] = (char)(date[3] + 1); }*/ - } /*else { + } /*else { if(date[5] == '9') { date[4] = '1'; date[5] = '0'; @@ -455,29 +455,29 @@ public class RatePath extends PathId { date[5] = (char)(date[5] + 1); } }*/ - } - } - // - // static float float.parsefloat() method is a feature of JDK1.2! - int tmp = k + j; - float aPathValue = (float)(121.7500 - tmp); - if( (aDate <= minimumdate) /*| (Math.abs(aPathValue) < epsilon)*/ ) { - //System.printString("Skipped erroneous data indexed by date="+date+"."); - } else { - pathdate[iLine] = aDate; - pathvalue[iLine] = aPathValue; - iLine++; - } - } - } - // - // Record the actual number of accepted data points. - nAcceptedPathValue = iLine; - // - // Now to fill in the structures from the 'PathId' class. - this.name = "rate"; - this.startDate = pathdate[0]; - this.endDate = pathdate[iLine-1]; - this.dTime = (float)(1.0/365.0); + } + } + // + // static float float.parsefloat() method is a feature of JDK1.2! + int tmp = k + j; + float aPathValue = (float)(121.7500 - tmp); + if( (aDate <= minimumdate) /*| (Math.abs(aPathValue) < epsilon)*/ ) { + //System.printString("Skipped erroneous data indexed by date="+date+"."); + } else { + pathdate[iLine] = aDate; + pathvalue[iLine] = aPathValue; + iLine++; + } + } } + // + // Record the actual number of accepted data points. + nAcceptedPathValue = iLine; + // + // Now to fill in the structures from the 'PathId' class. + this.name = "rate"; + this.startDate = pathdate[0]; + this.endDate = pathdate[iLine-1]; + this.dTime = (float)(1.0/365.0); + } } diff --git a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/JGFMonteCarlo/ReturnPath.java b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/JGFMonteCarlo/ReturnPath.java index 1f1eaee9..83c0d9a8 100644 --- a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/JGFMonteCarlo/ReturnPath.java +++ b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/JGFMonteCarlo/ReturnPath.java @@ -1,101 +1,101 @@ -/** Banboo Version **/ +package JGFMonteCarlo; /************************************************************************** -* * -* Java Grande Forum Benchmark Suite - Thread Version 1.0 * -* * -* produced by * -* * -* Java Grande Benchmarking Project * -* * -* at * -* * -* Edinburgh Parallel Computing Centre * -* * -* email: epcc-javagrande@epcc.ed.ac.uk * -* * -* Original version of this code by Hon Yau (hwyau@epcc.ed.ac.uk) * -* * -* This version copyright (c) The University of Edinburgh, 2001. * -* All rights reserved. * -* * -**************************************************************************/ + * * + * Java Grande Forum Benchmark Suite - Thread Version 1.0 * + * * + * produced by * + * * + * Java Grande Benchmarking Project * + * * + * at * + * * + * Edinburgh Parallel Computing Centre * + * * + * email: epcc-javagrande@epcc.ed.ac.uk * + * * + * Original version of this code by Hon Yau (hwyau@epcc.ed.ac.uk) * + * * + * This version copyright (c) The University of Edinburgh, 2001. * + * All rights reserved. * + * * + **************************************************************************/ /** - * Class for representing the returns of a given security. - * - *

To do list: - *

    - *
  1. Define a window over which the mean drift and volatility - * are calculated.
  2. - *
  3. Hash table to reference {DATE}->{pathValue-index}.
  4. - *
- * - * @author H W Yau - * @version $Revision: 1.1 $ $Date: 2011/07/13 23:49:52 $ - */ + * Class for representing the returns of a given security. + * + *

To do list: + *

    + *
  1. Define a window over which the mean drift and volatility + * are calculated.
  2. + *
  3. Hash table to reference {DATE}->{pathValue-index}.
  4. + *
+ * + * @author H W Yau + * @version $Revision: 1.2 $ $Date: 2011/07/14 21:28:29 $ + */ public class ReturnPath extends PathId { /** - * Flag for indicating one of the return definitions, via: - * u_i = \ln{\frac{S_i}{S_{i-1}}} - * corresponding to the instantaneous compounded return. - */ + * Flag for indicating one of the return definitions, via: + * u_i = \ln{\frac{S_i}{S_{i-1}}} + * corresponding to the instantaneous compounded return. + */ public int COMPOUNDED; /** - * Flag for indicating one of the return definitions, via: - * u_i = \frac{S_i - S_{i-1}}{S_i} - * corresponding to the instantaneous non-compounded return. - */ + * Flag for indicating one of the return definitions, via: + * u_i = \frac{S_i - S_{i-1}}{S_i} + * corresponding to the instantaneous non-compounded return. + */ public int NONCOMPOUNDED; //------------------------------------------------------------------------ // Instance variables. //------------------------------------------------------------------------ /** - * An instance variable, for storing the return values. - */ + * An instance variable, for storing the return values. + */ public float[] pathValue; /** - * The number of accepted values in the rate path. - */ + * The number of accepted values in the rate path. + */ public int nPathValue; /** - * Integer flag for indicating how the return was calculated. - */ + * Integer flag for indicating how the return was calculated. + */ public int returnDefinition; /** - * Value for the expected return rate. - */ + * Value for the expected return rate. + */ public float expectedReturnRate; /** - * Value for the volatility, calculated from the return data. - */ + * Value for the volatility, calculated from the return data. + */ public float volatility; /** - * Value for the volatility-squared, a more natural quantity - * to use for many of the calculations. - */ + * Value for the volatility-squared, a more natural quantity + * to use for many of the calculations. + */ public float volatility2; /** - * Value for the mean of this return. - */ + * Value for the mean of this return. + */ public float mean; /** - * Value for the variance of this return. - */ + * Value for the variance of this return. + */ public float variance; //------------------------------------------------------------------------ // Constructors. //------------------------------------------------------------------------ /** - * Default constructor. - */ + * Default constructor. + */ public ReturnPath() { super(); - + this.COMPOUNDED = 1; this.NONCOMPOUNDED = 2; this.nPathValue=-1; @@ -108,21 +108,21 @@ public class ReturnPath extends PathId { } /** - * Another constructor. - * - * @param pathValue for creating a return path with a precomputed path - * value. Indexed from 1 to nPathArray-1. - * @param nPathValue the number of accepted data points in the array. - * @param returnDefinition to tell this class how the return path values - * were computed. - */ + * Another constructor. + * + * @param pathValue for creating a return path with a precomputed path + * value. Indexed from 1 to nPathArray-1. + * @param nPathValue the number of accepted data points in the array. + * @param returnDefinition to tell this class how the return path values + * were computed. + */ public ReturnPath(float[] pathValue, - int nPathValue, - int returnDefinition) { + int nPathValue, + int returnDefinition) { this.pathValue = pathValue; this.nPathValue = nPathValue; this.returnDefinition = returnDefinition; - + this.COMPOUNDED = 1; this.NONCOMPOUNDED = 2; this.expectedReturnRate = (float)0.0; @@ -140,205 +140,205 @@ public class ReturnPath extends PathId { // Generated by 'makeJavaAccessor.pl' script. HWY. 20th January 1999. //------------------------------------------------------------------------ /** - * Accessor method for private instance variable pathValue. - * - * @return Value of instance variable pathValue. - * @exception DemoException thrown if instance variable pathValue is undefined. - */ + * Accessor method for private instance variable pathValue. + * + * @return Value of instance variable pathValue. + * @exception DemoException thrown if instance variable pathValue is undefined. + */ /*public float[] get_pathValue(){ return(this.pathValue); }*/ /** - * Set method for private instance variable pathValue. - * - * @param pathValue the value to set for the instance variable pathValue. - */ + * Set method for private instance variable pathValue. + * + * @param pathValue the value to set for the instance variable pathValue. + */ public void set_pathValue(float[] pathValue) { this.pathValue = pathValue; } /** - * Accessor method for private instance variable nPathValue. - * - * @return Value of instance variable nPathValue. - * @exception DemoException thrown if instance variable nPathValue is undefined. - */ + * Accessor method for private instance variable nPathValue. + * + * @return Value of instance variable nPathValue. + * @exception DemoException thrown if instance variable nPathValue is undefined. + */ /*public int get_nPathValue() { return(this.nPathValue); }*/ /** - * Set method for private instance variable nPathValue. - * - * @param nPathValue the value to set for the instance variable nPathValue. - */ + * Set method for private instance variable nPathValue. + * + * @param nPathValue the value to set for the instance variable nPathValue. + */ public void set_nPathValue(int nPathValue) { this.nPathValue = nPathValue; } /** - * Accessor method for private instance variable returnDefinition. - * - * @return Value of instance variable returnDefinition. - * @exception DemoException thrown if instance variable returnDefinition is undefined. - */ + * Accessor method for private instance variable returnDefinition. + * + * @return Value of instance variable returnDefinition. + * @exception DemoException thrown if instance variable returnDefinition is undefined. + */ /*public int get_returnDefinition() { return(this.returnDefinition); }*/ /** - * Set method for private instance variable returnDefinition. - * - * @param returnDefinition the value to set for the instance variable returnDefinition. - */ + * Set method for private instance variable returnDefinition. + * + * @param returnDefinition the value to set for the instance variable returnDefinition. + */ public void set_returnDefinition(int returnDefinition) { this.returnDefinition = returnDefinition; } /** - * Accessor method for private instance variable expectedReturnRate. - * - * @return Value of instance variable expectedReturnRate. - * @exception DemoException thrown if instance variable expectedReturnRate is undefined. - */ + * Accessor method for private instance variable expectedReturnRate. + * + * @return Value of instance variable expectedReturnRate. + * @exception DemoException thrown if instance variable expectedReturnRate is undefined. + */ /*public float get_expectedReturnRate() { return(this.expectedReturnRate); }*/ /** - * Set method for private instance variable expectedReturnRate. - * - * @param expectedReturnRate the value to set for the instance variable expectedReturnRate. - */ + * Set method for private instance variable expectedReturnRate. + * + * @param expectedReturnRate the value to set for the instance variable expectedReturnRate. + */ public void set_expectedReturnRate(float expectedReturnRate) { this.expectedReturnRate = expectedReturnRate; } /** - * Accessor method for private instance variable volatility. - * - * @return Value of instance variable volatility. - * @exception DemoException thrown if instance variable volatility is undefined. - */ + * Accessor method for private instance variable volatility. + * + * @return Value of instance variable volatility. + * @exception DemoException thrown if instance variable volatility is undefined. + */ /*public float get_volatility() { return(this.volatility); }*/ /** - * Set method for private instance variable volatility. - * - * @param volatility the value to set for the instance variable volatility. - */ + * Set method for private instance variable volatility. + * + * @param volatility the value to set for the instance variable volatility. + */ public void set_volatility(float volatility) { this.volatility = volatility; } /** - * Accessor method for private instance variable volatility2. - * - * @return Value of instance variable volatility2. - * @exception DemoException thrown if instance variable volatility2 is undefined. - */ + * Accessor method for private instance variable volatility2. + * + * @return Value of instance variable volatility2. + * @exception DemoException thrown if instance variable volatility2 is undefined. + */ /*public float get_volatility2() { return(this.volatility2); }*/ /** - * Set method for private instance variable volatility2. - * - * @param volatility2 the value to set for the instance variable volatility2. - */ + * Set method for private instance variable volatility2. + * + * @param volatility2 the value to set for the instance variable volatility2. + */ public void set_volatility2(float volatility2) { this.volatility2 = volatility2; } /** - * Accessor method for private instance variable mean. - * - * @return Value of instance variable mean. - * @exception DemoException thrown if instance variable mean is undefined. - */ + * Accessor method for private instance variable mean. + * + * @return Value of instance variable mean. + * @exception DemoException thrown if instance variable mean is undefined. + */ /*public float get_mean() { return(this.mean); }*/ /** - * Set method for private instance variable mean. - * - * @param mean the value to set for the instance variable mean. - */ + * Set method for private instance variable mean. + * + * @param mean the value to set for the instance variable mean. + */ public void set_mean(float mean) { this.mean = mean; } /** - * Accessor method for private instance variable variance. - * - * @return Value of instance variable variance. - * @exception DemoException thrown if instance variable variance is undefined. - */ + * Accessor method for private instance variable variance. + * + * @return Value of instance variable variance. + * @exception DemoException thrown if instance variable variance is undefined. + */ /*public float get_variance() { return(this.variance); }*/ /** - * Set method for private instance variable variance. - * - * @param variance the value to set for the instance variable variance. - */ + * Set method for private instance variable variance. + * + * @param variance the value to set for the instance variable variance. + */ public void set_variance(float variance) { this.variance = variance; } //------------------------------------------------------------------------ /** - * Method to calculate the expected return rate from the return data, - * using the relationship: - * \mu = \frac{\bar{u}}{\Delta t} + \frac{\sigma^2}{2} - * - * @exception DemoException thrown one tries to obtain an undefined variable. - */ + * Method to calculate the expected return rate from the return data, + * using the relationship: + * \mu = \frac{\bar{u}}{\Delta t} + \frac{\sigma^2}{2} + * + * @exception DemoException thrown one tries to obtain an undefined variable. + */ public void computeExpectedReturnRate() { this.expectedReturnRate = mean/(float)this.dTime + (float)0.5*volatility2; } /** - * Method to calculate volatility and volatility2 - * from the return path data, using the relationship, based on the - * precomputed variance. - * \sigma^2 = s^2\Delta t - * - * @exception DemoException thrown if one of the quantites in the - * computation are undefined. - */ + * Method to calculate volatility and volatility2 + * from the return path data, using the relationship, based on the + * precomputed variance. + * \sigma^2 = s^2\Delta t + * + * @exception DemoException thrown if one of the quantites in the + * computation are undefined. + */ public void computeVolatility() { this.volatility2 = this.variance / (float)this.dTime; this.volatility = Math.sqrtf(volatility2); } /** - * Method to calculate the mean of the return, for use by other - * calculations. - * - * @exception DemoException thrown if nPathValue is - * undefined. - */ + * Method to calculate the mean of the return, for use by other + * calculations. + * + * @exception DemoException thrown if nPathValue is + * undefined. + */ public void computeMean() { - float sum = (float) 0.0; - float[] tmpvalue = this.pathValue; - int length = this.nPathValue; - for( int i=1; i < length; i++ ) { - sum += tmpvalue[i]; - } - this.mean = sum / ((float)(length - (float)1.0)); + float sum = (float) 0.0; + float[] tmpvalue = this.pathValue; + int length = this.nPathValue; + for( int i=1; i < length; i++ ) { + sum += tmpvalue[i]; + } + this.mean = sum / ((float)(length - (float)1.0)); } /** - * Method to calculate the variance of the retrun, for use by other - * calculations. - * - * @exception DemoException thrown if the mean or - * nPathValue values are undefined. - */ + * Method to calculate the variance of the retrun, for use by other + * calculations. + * + * @exception DemoException thrown if the mean or + * nPathValue values are undefined. + */ public void computeVariance() { - float sum = (float) 0.0; - int length = this.nPathValue; - float[] tmpvalue = this.pathValue; - float tmpmean = this.mean; + float sum = (float) 0.0; + int length = this.nPathValue; + float[] tmpvalue = this.pathValue; + float tmpmean = this.mean; for( int i=1; i < length; i++ ) { - sum += (tmpvalue[i] - tmpmean)*(tmpvalue[i] - tmpmean); + sum += (tmpvalue[i] - tmpmean)*(tmpvalue[i] - tmpmean); } this.variance = sum / ((float)(length - (float)1.0)); } /** - * A single method for invoking all the necessary methods which - * estimate the parameters. - * - * @exception DemoException thrown if there is a problem reading any - * variables. - */ + * A single method for invoking all the necessary methods which + * estimate the parameters. + * + * @exception DemoException thrown if there is a problem reading any + * variables. + */ public void estimatePath() { computeMean(); computeVariance(); @@ -346,15 +346,15 @@ public class ReturnPath extends PathId { computeVolatility(); } /** - * Dumps the contents of the fields, to standard-out, for debugging. - */ + * Dumps the contents of the fields, to standard-out, for debugging. + */ public void dbgDumpFields() { super.dbgDumpFields(); -// dbgPrintln("nPathValue=" +this.nPathValue); -// dbgPrintln("expectedReturnRate="+this.expectedReturnRate); -// dbgPrintln("volatility=" +this.volatility); -// dbgPrintln("volatility2=" +this.volatility2); -// dbgPrintln("mean=" +this.mean); -// dbgPrintln("variance=" +this.variance); + // dbgPrintln("nPathValue=" +this.nPathValue); + // dbgPrintln("expectedReturnRate="+this.expectedReturnRate); + // dbgPrintln("volatility=" +this.volatility); + // dbgPrintln("volatility2=" +this.volatility2); + // dbgPrintln("mean=" +this.mean); + // dbgPrintln("variance=" +this.variance); } } diff --git a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/JGFMonteCarlo/ToResult.java b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/JGFMonteCarlo/ToResult.java index b1cf010f..73845532 100644 --- a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/JGFMonteCarlo/ToResult.java +++ b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/JGFMonteCarlo/ToResult.java @@ -1,33 +1,33 @@ -/** Banboo Version **/ +package JGFMonteCarlo; /************************************************************************** -* * -* Java Grande Forum Benchmark Suite - Thread Version 1.0 * -* * -* produced by * -* * -* Java Grande Benchmarking Project * -* * -* at * -* * -* Edinburgh Parallel Computing Centre * -* * -* email: epcc-javagrande@epcc.ed.ac.uk * -* * -* Original version of this code by Hon Yau (hwyau@epcc.ed.ac.uk) * -* * -* This version copyright (c) The University of Edinburgh, 2001. * -* All rights reserved. * -* * -**************************************************************************/ + * * + * Java Grande Forum Benchmark Suite - Thread Version 1.0 * + * * + * produced by * + * * + * Java Grande Benchmarking Project * + * * + * at * + * * + * Edinburgh Parallel Computing Centre * + * * + * email: epcc-javagrande@epcc.ed.ac.uk * + * * + * Original version of this code by Hon Yau (hwyau@epcc.ed.ac.uk) * + * * + * This version copyright (c) The University of Edinburgh, 2001. * + * All rights reserved. * + * * + **************************************************************************/ /** - * Class for defining the results of a task. Currently, this is simply - * the Monte Carlo generate rate path. - * - * @author H W Yau - * @version $Revision: 1.1 $ $Date: 2011/07/13 23:49:52 $ - */ + * Class for defining the results of a task. Currently, this is simply + * the Monte Carlo generate rate path. + * + * @author H W Yau + * @version $Revision: 1.2 $ $Date: 2011/07/14 21:28:29 $ + */ public class ToResult { //private String header; public float expectedReturnRate; @@ -37,17 +37,17 @@ public class ToResult { public float[] pathValue; /** - * Constructor, for the results from a computation. - * - * @param header Simple header string. - * @param pathValue Data computed by the Monte Carlo generator. - */ + * Constructor, for the results from a computation. + * + * @param header Simple header string. + * @param pathValue Data computed by the Monte Carlo generator. + */ public ToResult(/*String header, */ - float expectedReturnRate, - float volatility, - float volatility2, - float finalStockPrice, - float[] pathValue) { + float expectedReturnRate, + float volatility, + float volatility2, + float finalStockPrice, + float[] pathValue) { //this.header=header; this.expectedReturnRate = expectedReturnRate; this.volatility = volatility; @@ -56,10 +56,10 @@ public class ToResult { this.pathValue = pathValue; } /** - * Gives a simple string representation of this object. - * - * @return String representation of this object. - */ + * Gives a simple string representation of this object. + * + * @return String representation of this object. + */ /*public String toString(){ return(header); }*/ @@ -68,100 +68,100 @@ public class ToResult { // Generated by 'makeJavaAccessor.pl' script. HWY. 20th January 1999. //------------------------------------------------------------------------ /** - * Accessor method for private instance variable header. - * - * @return Value of instance variable header. - */ + * Accessor method for private instance variable header. + * + * @return Value of instance variable header. + */ /*public String get_header() { return(this.header); }*/ /** - * Set method for private instance variable header. - * - * @param header the value to set for the instance variable header. - */ + * Set method for private instance variable header. + * + * @param header the value to set for the instance variable header. + */ /*public void set_header(String header) { this.header = header; }*/ /** - * Accessor method for private instance variable expectedReturnRate. - * - * @return Value of instance variable expectedReturnRate. - */ + * Accessor method for private instance variable expectedReturnRate. + * + * @return Value of instance variable expectedReturnRate. + */ /*public float get_expectedReturnRate() { return(this.expectedReturnRate); }*/ /** - * Set method for private instance variable expectedReturnRate. - * - * @param expectedReturnRate the value to set for the instance variable - * expectedReturnRate. - */ + * Set method for private instance variable expectedReturnRate. + * + * @param expectedReturnRate the value to set for the instance variable + * expectedReturnRate. + */ public void set_expectedReturnRate(float expectedReturnRate) { this.expectedReturnRate = expectedReturnRate; } /** - * Accessor method for private instance variable volatility. - * - * @return Value of instance variable volatility. - */ + * Accessor method for private instance variable volatility. + * + * @return Value of instance variable volatility. + */ /*public float get_volatility() { return(this.volatility); }*/ /** - * Set method for private instance variable volatility. - * - * @param volatility the value to set for the instance variable volatility. - */ + * Set method for private instance variable volatility. + * + * @param volatility the value to set for the instance variable volatility. + */ public void set_volatility(float volatility) { this.volatility = volatility; } /** - * Accessor method for private instance variable volatility2. - * - * @return Value of instance variable volatility2. - */ + * Accessor method for private instance variable volatility2. + * + * @return Value of instance variable volatility2. + */ /*public float get_volatility2() { return(this.volatility2); }*/ /** - * Set method for private instance variable volatility2. - * - * @param volatility2 the value to set for the instance variable volatility2. - */ + * Set method for private instance variable volatility2. + * + * @param volatility2 the value to set for the instance variable volatility2. + */ public void set_volatility2(float volatility2) { this.volatility2 = volatility2; } /** - * Accessor method for private instance variable finalStockPrice. - * - * @return Value of instance variable finalStockPrice. - */ + * Accessor method for private instance variable finalStockPrice. + * + * @return Value of instance variable finalStockPrice. + */ /*public float get_finalStockPrice() { return(this.finalStockPrice); }*/ /** - * Set method for private instance variable finalStockPrice. - * - * @param finalStockPrice the value to set for the instance variable - * finalStockPrice. - */ + * Set method for private instance variable finalStockPrice. + * + * @param finalStockPrice the value to set for the instance variable + * finalStockPrice. + */ public void set_finalStockPrice(float finalStockPrice) { this.finalStockPrice = finalStockPrice; } /** - * Accessor method for private instance variable pathValue. - * - * @return Value of instance variable pathValue. - */ + * Accessor method for private instance variable pathValue. + * + * @return Value of instance variable pathValue. + */ /*public float[] get_pathValue() { return(this.pathValue); }*/ /** - * Set method for private instance variable pathValue. - * - * @param pathValue the value to set for the instance variable pathValue. - */ + * Set method for private instance variable pathValue. + * + * @param pathValue the value to set for the instance variable pathValue. + */ public void set_pathValue(float[] pathValue) { this.pathValue = pathValue; } diff --git a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/RayTracer/Composer.java b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/RayTracer/Composer.java index 08f0322c..373a8491 100644 --- a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/RayTracer/Composer.java +++ b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/RayTracer/Composer.java @@ -1,3 +1,5 @@ +package RayTracer; + public class Composer { int numCore; @@ -8,7 +10,7 @@ public class Composer { public long result1; public Composer(int numCore, - int size) { + int size) { this.numCore = numCore; this.num_composed = 0; heightPerCore = size/this.numCore; @@ -18,7 +20,7 @@ public class Composer { this.result = 0; this.result1 = 0; } - + public boolean compose(TestRunner tr) { this.num_composed++; int startidx=0; //heightPerCore * tr.id; diff --git a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/RayTracer/Interval.java b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/RayTracer/Interval.java index 653dd8b8..7c1ceba4 100644 --- a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/RayTracer/Interval.java +++ b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/RayTracer/Interval.java @@ -1,3 +1,5 @@ +package RayTracer; + /************************************************************************** * * * Java Grande Forum Benchmark Suite - Version 2.0 * diff --git a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/RayTracer/Isect.java b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/RayTracer/Isect.java index 5f7aca3f..1d58ae2d 100644 --- a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/RayTracer/Isect.java +++ b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/RayTracer/Isect.java @@ -1,3 +1,5 @@ +package RayTracer; + /************************************************************************** * * * Java Grande Forum Benchmark Suite - Version 2.0 * diff --git a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/RayTracer/Light.java b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/RayTracer/Light.java index 05750ede..ca89298f 100644 --- a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/RayTracer/Light.java +++ b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/RayTracer/Light.java @@ -1,3 +1,5 @@ +package RayTracer; + /************************************************************************** * * * Java Grande Forum Benchmark Suite - Version 2.0 * diff --git a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/RayTracer/Primitive.java b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/RayTracer/Primitive.java index ce0cf56d..3ccafae1 100644 --- a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/RayTracer/Primitive.java +++ b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/RayTracer/Primitive.java @@ -1,3 +1,5 @@ +package RayTracer; + /************************************************************************** * * * Java Grande Forum Benchmark Suite - Version 2.0 * diff --git a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/RayTracer/Ray.java b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/RayTracer/Ray.java index 7d86ecad..659870e6 100644 --- a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/RayTracer/Ray.java +++ b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/RayTracer/Ray.java @@ -1,3 +1,5 @@ +package RayTracer; + /************************************************************************** * * * Java Grande Forum Benchmark Suite - Version 2.0 * diff --git a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/RayTracer/RayTracer.java b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/RayTracer/RayTracer.java index 35b114ca..2cb307e8 100644 --- a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/RayTracer/RayTracer.java +++ b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/RayTracer/RayTracer.java @@ -1,3 +1,4 @@ +package RayTracer; /************************************************************************** * * Java Grande Forum Benchmark Suite - Version 2.0 * * produced by * * Java diff --git a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/RayTracer/Scene.java b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/RayTracer/Scene.java index 38b3e409..f32cca5c 100644 --- a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/RayTracer/Scene.java +++ b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/RayTracer/Scene.java @@ -1,3 +1,5 @@ +package RayTracer; + /************************************************************************** * * * Java Grande Forum Benchmark Suite - Version 2.0 * diff --git a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/RayTracer/Sphere.java b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/RayTracer/Sphere.java index 24957b77..67d2ba40 100644 --- a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/RayTracer/Sphere.java +++ b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/RayTracer/Sphere.java @@ -1,3 +1,5 @@ +package RayTracer; + /************************************************************************** * * * Java Grande Forum Benchmark Suite - Version 2.0 * @@ -28,7 +30,7 @@ public class Sphere extends Primitive { Vec c; float r, r2; -//Vec v,b; // temporary vecs used to minimize the memory load + //Vec v,b; // temporary vecs used to minimize the memory load public Sphere(Vec center, float radius) { @@ -36,8 +38,8 @@ public class Sphere extends Primitive c = center; r = radius; r2 = r*r; -// v=new Vec(); -// b=new Vec(); + // v=new Vec(); + // b=new Vec(); } public float dot(float x1, float y1, float z1, float x2, float y2, float z2){ @@ -69,7 +71,7 @@ public class Sphere extends Primitive ip = new Isect(); ip.t = t; ip.enter = dot(x,y,z,x,y,z) > r2 + 1e-6 ? 1 : 0; -// ip.enter = Vec.dot(v, v) > r2 + 1e-6 ? 1 : 0; + // ip.enter = Vec.dot(v, v) > r2 + 1e-6 ? 1 : 0; ip.prim = this; ip.surf = surf; return ip; diff --git a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/RayTracer/Surface.java b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/RayTracer/Surface.java index 2bdc20ee..d0e1ecc9 100644 --- a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/RayTracer/Surface.java +++ b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/RayTracer/Surface.java @@ -1,3 +1,5 @@ +package RayTracer; + /************************************************************************** * * * Java Grande Forum Benchmark Suite - Version 2.0 * diff --git a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/RayTracer/TestRunner.java b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/RayTracer/TestRunner.java index 46ff50c2..2c39a7c4 100644 --- a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/RayTracer/TestRunner.java +++ b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/RayTracer/TestRunner.java @@ -1,3 +1,5 @@ +package RayTracer; + /************************************************************************** * * Java Grande Forum Benchmark Suite - Version 2.0 * * produced by * * Java * Grande Benchmarking Project * * at * * Edinburgh Parallel Computing Centre * @@ -83,10 +85,7 @@ public class TestRunner extends RayTracer { Scene scene = rt.createScene(); for(int i = 0; i < threadnum; ++i) { TestRunner tr = new TestRunner(i, threadnum, size, scene); - tr.run(); - if(comp.compose(tr)) { - long r = comp.result; - } + tr.start(); } } } diff --git a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/RayTracer/Vec.java b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/RayTracer/Vec.java index 1daa0f06..2c4fd705 100644 --- a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/RayTracer/Vec.java +++ b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/RayTracer/Vec.java @@ -1,3 +1,5 @@ +package RayTracer; + /************************************************************************** * * * Java Grande Forum Benchmark Suite - Version 2.0 * @@ -130,9 +132,9 @@ public class Vec public static Vec cross(Vec a, Vec b) { return - new Vec(a.y*b.z - a.z*b.y, - a.z*b.x - a.x*b.z, - a.x*b.y - a.y*b.x); + new Vec(a.y*b.z - a.z*b.y, + a.z*b.x - a.x*b.z, + a.x*b.y - a.y*b.x); } public static float dot(Vec a, Vec b) { @@ -141,9 +143,9 @@ public class Vec public static Vec comb(float a, Vec A, float b, Vec B) { return - new Vec(a * A.x + b * B.x, - a * A.y + b * B.y, - a * A.z + b * B.z); + new Vec(a * A.x + b * B.x, + a * A.y + b * B.y, + a * A.z + b * B.z); } public final void comb2(float a,Vec A,float b,Vec B) { diff --git a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/RayTracer/View.java b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/RayTracer/View.java index f22e4ce9..3b46dc59 100644 --- a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/RayTracer/View.java +++ b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/RayTracer/View.java @@ -1,3 +1,5 @@ +package RayTracer; + /************************************************************************** * * * Java Grande Forum Benchmark Suite - Version 2.0 * diff --git a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/bh/Body.java b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/bh/Body.java index bc341f49..0800f409 100644 --- a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/bh/Body.java +++ b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/bh/Body.java @@ -1,3 +1,4 @@ +package bh; /** * A class used to representing particles in the N-body simulation. diff --git a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/bh/Cell.java b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/bh/Cell.java index 4e83ee96..32299850 100644 --- a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/bh/Cell.java +++ b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/bh/Cell.java @@ -1,3 +1,4 @@ +package bh; /** * A class used to represent internal nodes in the tree diff --git a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/bh/MathVector.class b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/bh/MathVector.class index a13c3079..6ee4ec7f 100644 Binary files a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/bh/MathVector.class and b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/bh/MathVector.class differ diff --git a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/bh/MathVector.java b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/bh/MathVector.java index e81e8266..02d654f8 100644 --- a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/bh/MathVector.java +++ b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/bh/MathVector.java @@ -1,3 +1,4 @@ +package bh; /** * A class representing a three dimensional vector that implements diff --git a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/bh/Node.java b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/bh/Node.java index 2d2cbaaa..f596e923 100644 --- a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/bh/Node.java +++ b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/bh/Node.java @@ -1,3 +1,4 @@ +package bh; /** * A class that represents the common fields of a cell or body @@ -40,7 +41,7 @@ class Node int i = 0; for (int k = 0; k < 3/*MathVector.NDIM*/; k++) { if (((int)ic.value(k) & l) != 0) - i += 8/*Cell.NSUB*/ >> (k + 1); + i += 8/*Cell.NSUB*/ >> (k + 1); } return i; } @@ -73,40 +74,3 @@ class Node return hg; } } - -/** - * A class which is used to compute and save information during the - * gravity computation phse. - **/ -public class HG -{ - /** - * Body to skip in force evaluation - **/ - public Body pskip; - /** - * Point at which to evaluate field - **/ - public MathVector pos0; - /** - * Computed potential at pos0 - **/ - public double phi0; - /** - * computed acceleration at pos0 - **/ - public MathVector acc0; - - /** - * Create a HG object. - * @param b the body object - * @param p a vector that represents the body - **/ - public HG(Body b, MathVector p) - { - pskip = b; - pos0 = (MathVector)p.clone(); - phi0 = 0.0; - acc0 = new MathVector(); - } -} diff --git a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/bh/TestRunner.java b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/bh/TestRunner.java index 213a7084..de3ffcbd 100644 --- a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/bh/TestRunner.java +++ b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/bh/TestRunner.java @@ -1,4 +1,4 @@ - +package bh; /*import java.util.Enumeration; import java.lang.Math;*/ @@ -17,7 +17,7 @@ import java.lang.Math;*/ **/ public class TestRunner extends Thread { - + /** * The user specified number of bodies to create. **/ @@ -39,7 +39,7 @@ public class TestRunner extends Thread public double DTIME; // = 0.0125; public double TSTOP; // = 2.0; - + public TestRunner(int nbody) { this.nbody = nbody; this.nsteps = 10; @@ -91,10 +91,10 @@ public class TestRunner extends Thread * @param seed the seed to the generator * @return a random number **/ - public double myRand(double seed) + public double myRand(double seed) { double t = 16807.0*seed + 1; - + seed = t - 2147483647.0 * Math.floor(t / 2147483647.0f); return seed; } @@ -108,7 +108,7 @@ public class TestRunner extends Thread * @param r seed * @return a doubleing point randon number **/ - public double xRand(double xl, double xh, double r) + public double xRand(double xl, double xh, double r) { double res = xl + (xh-xl)*r/2147483647.0; return res; @@ -119,7 +119,7 @@ public class TestRunner extends Thread int nbody = 700; for(int i = 0; i < threadnum; ++i) { TestRunner tr = new TestRunner(nbody); - tr.run(); + tr.start(); } } } diff --git a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/bh/Tree.java b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/bh/Tree.java index 6dea99a8..821f6200 100644 --- a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/bh/Tree.java +++ b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/bh/Tree.java @@ -1,3 +1,4 @@ +package bh; //import java.util.Enumeration; @@ -8,7 +9,7 @@ class Tree { public double DTIME; - + MathVector rmin; public double rsize; /** @@ -38,7 +39,7 @@ class Tree rmin.value(0, -2.0); rmin.value(1, -2.0); rmin.value(2, -2.0); - + this.DTIME = DTIME; } @@ -87,7 +88,7 @@ class Tree double res = xl + (xh-xl)*r/2147483647.0; return res; } - + /** * Create the testdata used in the benchmark. * @param nbody the number of bodies to create @@ -188,7 +189,7 @@ class Tree this.root = null; makeTree(nstep); - + Body next = null; Body b = this.bodyTabRev; do { @@ -270,7 +271,7 @@ class Tree MathVector dacc = new MathVector(); MathVector dvel = new MathVector(); double dthf = 0.5 * this.DTIME; - + Body b = p; do { MathVector acc1 = (MathVector)b.newAcc.clone(); @@ -291,7 +292,7 @@ class Tree b.pos = (MathVector)dpos.clone(); vel1.addition(dvel); b.vel = (MathVector)vel1.clone(); - + b = b.getProcNext(); } while(b != null); } diff --git a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/lcss/TestRunner.java b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/lcss/TestRunner.java index b22808d9..9a91b4cc 100644 --- a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/lcss/TestRunner.java +++ b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/lcss/TestRunner.java @@ -1,4 +1,6 @@ -public class TestRunner { +package lcss; + +public class TestRunner extends Thread { int[] testargs; @@ -240,7 +242,7 @@ public class TestRunner { args[5] = 240; for(int i = 0; i < threadnum; ++i) { TestRunner tr = new TestRunner(args); - tr.run(); + tr.start(); } } } \ No newline at end of file diff --git a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/tsp/TestRunner.java b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/tsp/TestRunner.java index 28f5ae2d..ce70adc4 100644 --- a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/tsp/TestRunner.java +++ b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/tsp/TestRunner.java @@ -1,3 +1,4 @@ +package tsp; //import java.io.*; @@ -13,7 +14,7 @@ **/ public class TestRunner extends Thread { - + /** * Number of cities in the problem. **/ @@ -26,7 +27,7 @@ public class TestRunner extends Thread * Set to true to print informative messages **/ //private static boolean printMsgs = false; - + public TestRunner(int cities) { this.cities = cities; } @@ -41,7 +42,7 @@ public class TestRunner extends Thread if (printMsgs) System.out.println("Building tree of size " + cities); - + long start0 = System.currentTimeMillis();*/ Tree_tsp t = Tree_tsp.buildTree(this.cities, false, 0.0f, 1.0f, 0.0f, 1.0f); /*long end0 = System.currentTimeMillis(); @@ -107,7 +108,7 @@ public class TestRunner extends Thread int ncities = 4080*2; for(int i = 0; i < threadnum; ++i) { TestRunner tr = new TestRunner(ncities); - tr.run(); + tr.start(); } } } diff --git a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/tsp/Tree_tsp.java b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/tsp/Tree_tsp.java index 706ba059..164438aa 100644 --- a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/tsp/Tree_tsp.java +++ b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/tsp/Tree_tsp.java @@ -1,3 +1,4 @@ +package tsp; //import java.util.Random; @@ -54,7 +55,7 @@ final class Tree_tsp M_E3 = 20.08553692318766774179f; M_E6 = 403.42879349273512264299f; M_E12 = 162754.79141900392083592475f;*/ - + sz = size; this.x = x; this.y = y; @@ -298,7 +299,7 @@ final class Tree_tsp choice = 4; if (choice == 1) { - //case 1: + //case 1: // 1:p1,this this,p2 n2,n1 -- reverse 2! n2.reverse(); p1.next = this; @@ -309,7 +310,7 @@ final class Tree_tsp n1.prev = n2; //break; } else if(choice == 2) { - //case 2: + //case 2: // 2:p1,this this,n2 p2,n1 -- OK p1.next = this; this.prev = p1; @@ -319,7 +320,7 @@ final class Tree_tsp n1.prev = p2; //break; } else if(choice == 3) { - //case 3: + //case 3: // 3:p2,this this,n1 p1,n2 -- OK p2.next = this; this.prev = p2; @@ -329,7 +330,7 @@ final class Tree_tsp n2.prev = p1; //break; } else if(choice == 4) { - //case 4: + //case 4: // 4:n1,this this,n2 p2,p1 -- reverse 1! n1.reverse(); n1.next = this; @@ -388,7 +389,7 @@ final class Tree_tsp float M_E3 = 20.08553692318766774179f; float M_E6 = 403.42879349273512264299f; float M_E12 = 162754.79141900392083592475f; - + // get random value in [0.0, 1.0) float t = (new Random()).nextFloat(); diff --git a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/voronoi/Edge.java b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/voronoi/Edge.java index b2819dea..bd88150f 100644 --- a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/voronoi/Edge.java +++ b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/voronoi/Edge.java @@ -1,3 +1,4 @@ +package voronoi; /** * A class that represents the quad edge data structure which implements diff --git a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/voronoi/EdgePair.java b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/voronoi/EdgePair.java index 0778de01..b8dffa4b 100644 --- a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/voronoi/EdgePair.java +++ b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/voronoi/EdgePair.java @@ -1,4 +1,4 @@ - +package voronoi; /** * A class that represents an edge pair diff --git a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/voronoi/MyDouble.java b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/voronoi/MyDouble.java index c995c9cc..1fe14f64 100644 --- a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/voronoi/MyDouble.java +++ b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/voronoi/MyDouble.java @@ -1,4 +1,4 @@ - +package voronoi; /** * A class that represents a wrapper around a double value so diff --git a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/voronoi/TestRunner.java b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/voronoi/TestRunner.java index aa2f0f58..52de99ca 100644 --- a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/voronoi/TestRunner.java +++ b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/voronoi/TestRunner.java @@ -1,6 +1,7 @@ - +package voronoi; /** + * * A Java implementation of the voronoi Olden benchmark. Voronoi * generates a random set of points and computes a Voronoi diagram for * the points. @@ -18,12 +19,12 @@ **/ public class TestRunner extends Thread { - + /** * The number of points in the diagram **/ private int points; - + public TestRunner(int npoints) { this.points = npoints; } @@ -41,13 +42,13 @@ public class TestRunner extends Thread Vertex point = v.createPoints(points-1, new MyDouble(extra.X()), points-1); Edge edge = point.buildDelaunayTriangulation(extra); } - + public static void main(String[] args) { int threadnum = 62; int npoints = 32000; for(int i = 0; i < threadnum; ++i) { TestRunner tr = new TestRunner(npoints); - tr.run(); + tr.start(); } } } diff --git a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/voronoi/Vec2.java b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/voronoi/Vec2.java index 10d1da9e..7feabff4 100644 --- a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/voronoi/Vec2.java +++ b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/voronoi/Vec2.java @@ -1,4 +1,4 @@ - +package voronoi; /** * Vector Routines from CMU vision library. @@ -11,7 +11,7 @@ class Vec2 float norm; public Vec2() {} - + public Vec2(float xx, float yy) { x = xx; @@ -33,7 +33,7 @@ class Vec2 { return norm; } - + public void setNorm(float d) { norm = d; @@ -99,10 +99,10 @@ class Vec2 Vec2 sub(Vec2 v) { - return(new Vec2((float)(x - v.x), (float)(y - v.y))); + return(new Vec2((float)(x - v.x), (float)(y - v.y))); } -/* V2_magn: magnitude of vector */ + /* V2_magn: magnitude of vector */ float magn() { @@ -118,4 +118,4 @@ class Vec2 } - + diff --git a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/voronoi/Vertex.java b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/voronoi/Vertex.java index 6ab45d72..571caa1a 100644 --- a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/voronoi/Vertex.java +++ b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/voronoi/Vertex.java @@ -1,4 +1,4 @@ - +package voronoi; /** * A class that represents a voronoi diagram. The diagram is represnted @@ -33,7 +33,7 @@ class Vertex extends Vec2 { left = l; } - + public void setRight(Vertex r) { right = r; @@ -43,7 +43,7 @@ class Vertex extends Vec2 { return left; } - + public Vertex getRight() { return right; @@ -68,7 +68,7 @@ class Vertex extends Vec2 cur.right = right; curmax.value = (float)cur.X(); Vertex left = cur.createPoints(n/2, curmax, i-1); - + cur.left = left; return cur; } @@ -100,7 +100,7 @@ class Vertex extends Vec2 Edge e = new Edge(); retval = e.doMerge(delleft.getLeft(), delleft.getRight(), - delright.getLeft(), delright.getRight()); + delright.getLeft(), delright.getRight()); Edge ldo = retval.getLeft(); while (ldo.orig() != minx) { @@ -146,7 +146,7 @@ class Vertex extends Vec2 /*void print() { Vertex tleft, tright; - + System.out.println("X=" + X() + " Y=" + Y()); if (left == null) System.out.println("NULL"); @@ -165,17 +165,17 @@ class Vertex extends Vec2 { Vertex temp; Vertex tree = this; - + while ((temp=tree.getLeft()) != null) tree = temp; return tree; } - + /****************************************************************/ /* Geometric primitives - ****************************************************************/ + ****************************************************************/ boolean incircle(Vertex b, Vertex c, Vertex d) - /* incircle, as in the Guibas-Stolfi paper. */ + /* incircle, as in the Guibas-Stolfi paper. */ { float adx, ady, bdx, bdy, cdx, cdy, dx, dy, anorm, bnorm, cnorm, dnorm; float dret ; @@ -195,14 +195,14 @@ class Vertex extends Vec2 dret += (float)((cnorm - dnorm) * (adx * bdy - ady * bdx)); return( (0.0f < dret) ? true : false ); } - + boolean ccw(Vertex b, Vertex c) /* TRUE iff this, B, C form a counterclockwise oriented triangle */ { float dret ; float xa,ya,xb,yb,xc,yc; Vertex loc_a,loc_b,loc_c; - + int donexa,doneya,donexb,doneyb,donexc,doneyc; loc_a = this; @@ -253,10 +253,10 @@ class Vertex extends Vec2 { this.seed = this.random(this.seed); float retval = ((float)this.seed) / - (float) 2147483647; + (float) 2147483647; return retval; } - + } - +