List of usage examples for java.util Vector Vector
public Vector(Collection<? extends E> c)
From source file:edu.umd.cs.psl.reasoner.admm.SquaredLinearLossTermTest.java
private void testProblem(double[] z, double[] y, double[] coeffs, double constant, double weight, final double stepSize, double[] expected) { config.setProperty("admmreasoner.stepsize", stepSize); ADMMReasoner reasoner = new ADMMReasoner(config); reasoner.z = new Vector<Double>(z.length); for (int i = 0; i < z.length; i++) reasoner.z.add(z[i]);// ww w .jav a 2 s .c om int[] zIndices = new int[z.length]; for (int i = 0; i < z.length; i++) zIndices[i] = i; SquaredLinearLossTerm term = new SquaredLinearLossTerm(reasoner, zIndices, coeffs, constant, weight); for (int i = 0; i < z.length; i++) term.y[i] = y[i]; term.minimize(); for (int i = 0; i < z.length; i++) assertEquals(expected[i], term.x[i], 5e-5); }
From source file:com.hphoto.util.ThreadPool.java
/** * Creates a pool of numThreads size./*w w w. jav a 2 s. c o m*/ * These threads sit around waiting for jobs to * be posted to the list. */ public ThreadPool(int numThreads) { this.numThreads = numThreads; jobs = new Vector(37); running = true; for (int i = 0; i < numThreads; i++) { TaskThread t = new TaskThread(); t.start(); } Log l = LogFactory.getLog(ThreadPool.class.getName()); l.fatal("ThreadPool created with " + numThreads + " threads."); }