|
From: Brendan M. <mc...@us...> - 2006-11-11 02:05:03
|
Update of /cvsroot/jigs/jigs/src/edu/whitman/halfway/util In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv20896/src/edu/whitman/halfway/util Modified Files: ProcessUtil.java MathUtil.java MiscUtil.java PropProvider.java EADoubleFactory2D.java Log Message: Index: ProcessUtil.java =================================================================== RCS file: /cvsroot/jigs/jigs/src/edu/whitman/halfway/util/ProcessUtil.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ProcessUtil.java 16 May 2005 22:59:47 -0000 1.5 --- ProcessUtil.java 11 Nov 2006 02:04:56 -0000 1.6 *************** *** 13,16 **** --- 13,20 ---- private static Logger log = Logger.getLogger(ProcessUtil.class.getName()); + + public static boolean exec(String[] command, OutputStream out){ + return exec(command, out, null); + } /** Tries to exec the command, waits for it to finsih, logs errors if *************** *** 19,27 **** becomes available ... pass in System.out to monitor progress.*/ ! public static boolean exec(String[] command, OutputStream out){ Process proc; try{ log.debug("Trying to execute command " + Arrays.asList(command)); ! proc = Runtime.getRuntime().exec(command); }catch(IOException e){ log.error("IOException while trying to execute " + command, e); --- 23,31 ---- becomes available ... pass in System.out to monitor progress.*/ ! public static boolean exec(String[] command, OutputStream out, File workingDir){ Process proc; try{ log.debug("Trying to execute command " + Arrays.asList(command)); ! proc = Runtime.getRuntime().exec(command, null, workingDir); }catch(IOException e){ log.error("IOException while trying to execute " + command, e); Index: MathUtil.java =================================================================== RCS file: /cvsroot/jigs/jigs/src/edu/whitman/halfway/util/MathUtil.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** MathUtil.java 20 Mar 2004 00:07:23 -0000 1.3 --- MathUtil.java 11 Nov 2006 02:04:56 -0000 1.4 *************** *** 23,26 **** --- 23,30 ---- public static final double TWO_PI = Math.PI * 2; + + + + /** Given the function f and the step-paramter t, returns * extimates of the gradients */ Index: MiscUtil.java =================================================================== RCS file: /cvsroot/jigs/jigs/src/edu/whitman/halfway/util/MiscUtil.java,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** MiscUtil.java 11 Sep 2006 15:05:22 -0000 1.24 --- MiscUtil.java 11 Nov 2006 02:04:56 -0000 1.25 *************** *** 7,1175 **** import java.util.*; ! public final class MiscUtil{ ! ! private static Logger log = Logger.getLogger(MiscUtil.class); ! //private static DecimalFormat df = new DecimalFormat("0.000E0"); ! private static DecimalFormat df = new DecimalFormat("0.000"); ! private static Random rand = new Random(); [...2445 lines suppressed...] + } + System.out.println("Sorting Results (key array over value array): "); + MiscUtil.simpleSortDecPairs(key, value); + System.out.println(MiscUtil.toString(key)); + System.out.print(MiscUtil.toString(value)); + System.out.println(); ! System.out.println("Testing unpack methods on 1, ..., 9"); ! double[] d = { 1, 2, 3, 4, 5, 6, 7, 8, 9 }; ! System.out.println("Unpack Row Major:"); ! double[][] rm = unpackRowMajor(3, 3, d); ! System.out.println(MiscUtil.toString(rm)); ! System.out.println(MiscUtil.toString(MiscUtil.packRowMajor(rm))); ! System.out.println("Column Major:"); ! double[][] cm = unpackColMajor(3, 3, d); ! System.out.println(MiscUtil.toString(cm)); ! } } Index: PropProvider.java =================================================================== RCS file: /cvsroot/jigs/jigs/src/edu/whitman/halfway/util/PropProvider.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** PropProvider.java 11 Sep 2006 15:05:22 -0000 1.5 --- PropProvider.java 11 Nov 2006 02:04:56 -0000 1.6 *************** *** 38,43 **** } }else{ ! log.info("Skipping field " + fields[i].getName()); log.debug("Skipped because of modifiers: " + Modifier.toString(mods)); } } --- 38,45 ---- } }else{ ! if(log.isDebugEnabled()){ ! log.debug("Skipping field " + fields[i].getName()); log.debug("Skipped because of modifiers: " + Modifier.toString(mods)); + } } } Index: EADoubleFactory2D.java =================================================================== RCS file: /cvsroot/jigs/jigs/src/edu/whitman/halfway/util/EADoubleFactory2D.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** EADoubleFactory2D.java 12 Jan 2004 20:06:43 -0000 1.2 --- EADoubleFactory2D.java 11 Nov 2006 02:04:56 -0000 1.3 *************** *** 1,3 **** --- 1,4 ---- package edu.whitman.halfway.util; + // import cern.colt.function.DoubleDoubleFunction; import cern.colt.matrix.*; *************** *** 6,77 **** // import cern.colt.list.DoubleArrayList; - import org.apache.log4j.Logger; - /** a dense factory that makes ElementAccessDenseDoubleMatrix2D's*/ ! public class EADoubleFactory2D extends DoubleFactory2D{ ! static Logger log = Logger.getLogger(EADoubleFactory2D.class); ! public DoubleMatrix2D make(DoubleMatrix1D m, int rows, int cols) { ! if(!(m instanceof EADoubleFactory1D.ElementAccessDenseDoubleMatrix1D)){ ! log.warn("Slow..."); ! m = (CernUtil.dense1D.make(m.size())).assign(m); ! } ! return new ElementAccessDenseDoubleMatrix2D ! ( ((EADoubleFactory1D.ElementAccessDenseDoubleMatrix1D)m).getElements(), rows, cols); ! } ! public DoubleMatrix2D make(double[][] values) { ! return new ElementAccessDenseDoubleMatrix2D(values); } ! public DoubleMatrix2D make(int rows, int columns) { ! return new ElementAccessDenseDoubleMatrix2D(rows, columns); } ! public static class ElementAccessDenseDoubleMatrix2D ! extends DenseDoubleMatrix2D{ ! ! public ElementAccessDenseDoubleMatrix2D(double[][] array){ ! super(array); ! } ! ! public ElementAccessDenseDoubleMatrix2D(int rows, int cols){ ! super(rows, cols); ! } ! ! ! /** elements is packed in row-major */ ! public ElementAccessDenseDoubleMatrix2D(double[] elements, int rows, int cols){ ! super(rows, cols, elements, 0, 0, cols, 1); ! } ! ! public double[] getElements(){ ! return elements; ! } ! ! public DoubleMatrix1D like1D(int size){ ! return new EADoubleFactory1D.ElementAccessDenseDoubleMatrix1D(size); ! } ! public DoubleMatrix2D like(int rows, int columns){ ! return new ElementAccessDenseDoubleMatrix2D(rows, columns); ! } ! protected DoubleMatrix1D like1D(int size, int zero, int stride) { ! return new EADoubleFactory1D.ElementAccessDenseDoubleMatrix1D(size,this.elements,zero,stride); ! } } } - - - --- 7,72 ---- // import cern.colt.list.DoubleArrayList; import org.apache.log4j.Logger; /** a dense factory that makes ElementAccessDenseDoubleMatrix2D's*/ ! public class EADoubleFactory2D extends DoubleFactory2D { ! static Logger log = Logger.getLogger(EADoubleFactory2D.class); ! ! public DoubleMatrix2D make(DoubleMatrix1D m, int rows, int cols) { ! if (!(m instanceof EADoubleFactory1D.ElementAccessDenseDoubleMatrix1D)) { ! log.warn("Slow..."); ! m = (CernUtil.dense1D.make(m.size())).assign(m); ! log.info("...done"); ! } ! return new ElementAccessDenseDoubleMatrix2D( ! ((EADoubleFactory1D.ElementAccessDenseDoubleMatrix1D) m) ! .getElements(), rows, cols); ! } ! public DoubleMatrix2D make(double[][] values) { ! return new ElementAccessDenseDoubleMatrix2D(values); ! } + public DoubleMatrix2D make(int rows, int columns) { + return new ElementAccessDenseDoubleMatrix2D(rows, columns); + } + public static class ElementAccessDenseDoubleMatrix2D extends + DenseDoubleMatrix2D { ! public ElementAccessDenseDoubleMatrix2D(double[][] array) { ! super(array); } ! public ElementAccessDenseDoubleMatrix2D(int rows, int cols) { ! super(rows, cols); } ! /** elements is packed in row-major */ ! public ElementAccessDenseDoubleMatrix2D(double[] elements, int rows, ! int cols) { ! super(rows, cols, elements, 0, 0, cols, 1); ! } ! public double[] getElements() { ! return elements; ! } ! public DoubleMatrix1D like1D(int size) { ! return new EADoubleFactory1D.ElementAccessDenseDoubleMatrix1D(size); ! } + public DoubleMatrix2D like(int rows, int columns) { + return new ElementAccessDenseDoubleMatrix2D(rows, columns); } + protected DoubleMatrix1D like1D(int size, int zero, int stride) { + return new EADoubleFactory1D.ElementAccessDenseDoubleMatrix1D(size, + this.elements, zero, stride); + } + } } |