hama-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From edwardy...@apache.org
Subject svn commit: r793813 - in /incubator/hama/trunk/src/java/org/apache/hama: AbstractMatrix.java DenseMatrix.java
Date Tue, 14 Jul 2009 08:22:16 GMT
Author: edwardyoon
Date: Tue Jul 14 08:22:16 2009
New Revision: 793813

URL: http://svn.apache.org/viewvc?rev=793813&view=rev
Log:
Applying formatter

Modified:
    incubator/hama/trunk/src/java/org/apache/hama/AbstractMatrix.java
    incubator/hama/trunk/src/java/org/apache/hama/DenseMatrix.java

Modified: incubator/hama/trunk/src/java/org/apache/hama/AbstractMatrix.java
URL: http://svn.apache.org/viewvc/incubator/hama/trunk/src/java/org/apache/hama/AbstractMatrix.java?rev=793813&r1=793812&r2=793813&view=diff
==============================================================================
--- incubator/hama/trunk/src/java/org/apache/hama/AbstractMatrix.java (original)
+++ incubator/hama/trunk/src/java/org/apache/hama/AbstractMatrix.java Tue Jul 14 08:22:16
2009
@@ -77,7 +77,7 @@
 public abstract class AbstractMatrix implements Matrix {
   static int tryPathLength = Constants.DEFAULT_PATH_LENGTH;
   static final Logger LOG = Logger.getLogger(AbstractMatrix.class);
-  
+
   protected HamaConfiguration config;
   protected HBaseAdmin admin;
   // a matrix just need a table path to point to the table which stores matrix.
@@ -112,7 +112,8 @@
   protected void tryToCreateTable(String table_prefix) throws IOException {
     int tryTimes = Constants.DEFAULT_TRY_TIMES;
     do {
-      matrixPath = table_prefix + "_" + RandomVariable.randMatrixPath(tryPathLength);
+      matrixPath = table_prefix + "_"
+          + RandomVariable.randMatrixPath(tryPathLength);
 
       if (!admin.tableExists(matrixPath)) { // no table 'matrixPath' in hbase.
         tableDesc = new HTableDescriptor(matrixPath);
@@ -131,7 +132,7 @@
     // throw out an IOException to let the user know what happened.
     throw new IOException("Try too many times to create a table in hbase.");
   }
-  
+
   /**
    * Create matrix space
    */
@@ -152,11 +153,11 @@
           .toBytes(JacobiEigenValue.EI), 1, CompressionType.NONE, false, false,
           Integer.MAX_VALUE, HConstants.FOREVER, false));
       this.tableDesc.addFamily(new HColumnDescriptor(Bytes
-          .toBytes(JacobiEigenValue.EICOL), 10, CompressionType.NONE, false, false,
-          Integer.MAX_VALUE, HConstants.FOREVER, false));
+          .toBytes(JacobiEigenValue.EICOL), 10, CompressionType.NONE, false,
+          false, Integer.MAX_VALUE, HConstants.FOREVER, false));
       this.tableDesc.addFamily(new HColumnDescriptor(Bytes
-          .toBytes(JacobiEigenValue.EIVEC), 10, CompressionType.NONE, false, false,
-          Integer.MAX_VALUE, HConstants.FOREVER, false));
+          .toBytes(JacobiEigenValue.EIVEC), 10, CompressionType.NONE, false,
+          false, Integer.MAX_VALUE, HConstants.FOREVER, false));
 
       LOG.info("Initializing the matrix storage.");
       this.admin.createTable(this.tableDesc);
@@ -188,20 +189,22 @@
 
     jobConf.setNumMapTasks(config.getNumMapTasks());
     jobConf.setNumReduceTasks(1);
-    
+
     final FileSystem fs = FileSystem.get(jobConf);
-    Path outDir = new Path(new Path(getType() + "_TMP_norm1_dir_" + System.currentTimeMillis()),
"out");
-    if(fs.exists(outDir)) 
+    Path outDir = new Path(new Path(getType() + "_TMP_norm1_dir_"
+        + System.currentTimeMillis()), "out");
+    if (fs.exists(outDir))
       fs.delete(outDir, true);
-    
-    MatrixNormMapRed.initJob(this.getPath(), outDir.toString(), 
-        MatrixOneNormMapper.class, MatrixOneNormCombiner.class, MatrixOneNormReducer.class,
jobConf);
-    
+
+    MatrixNormMapRed.initJob(this.getPath(), outDir.toString(),
+        MatrixOneNormMapper.class, MatrixOneNormCombiner.class,
+        MatrixOneNormReducer.class, jobConf);
+
     // update the out put dir of the job
     outDir = FileOutputFormat.getOutputPath(jobConf);
     JobManager.execute(jobConf);
 
-    //read outputs
+    // read outputs
     Path inFile = new Path(outDir, "reduce-out");
     IntWritable numInside = new IntWritable();
     DoubleWritable max = new DoubleWritable();
@@ -215,27 +218,29 @@
     fs.delete(outDir.getParent(), true);
     return max.get();
   }
-  
+
   protected double getMaxvalue() throws IOException {
     JobConf jobConf = new JobConf(config);
     jobConf.setJobName("MaxValue Norm MR job : " + this.getPath());
 
     jobConf.setNumMapTasks(config.getNumMapTasks());
     jobConf.setNumReduceTasks(1);
-    
+
     final FileSystem fs = FileSystem.get(jobConf);
-    Path outDir = new Path(new Path(getType() + "_TMP_normMaxValue_dir_" + System.currentTimeMillis()),
"out");
-    if(fs.exists(outDir)) 
+    Path outDir = new Path(new Path(getType() + "_TMP_normMaxValue_dir_"
+        + System.currentTimeMillis()), "out");
+    if (fs.exists(outDir))
       fs.delete(outDir, true);
-    
-    MatrixNormMapRed.initJob(this.getPath(), outDir.toString(), 
-        MatrixMaxValueNormMapper.class, MatrixMaxValueNormReducer.class, MatrixMaxValueNormReducer.class,
jobConf);
-    
+
+    MatrixNormMapRed.initJob(this.getPath(), outDir.toString(),
+        MatrixMaxValueNormMapper.class, MatrixMaxValueNormReducer.class,
+        MatrixMaxValueNormReducer.class, jobConf);
+
     // update the out put dir of the job
     outDir = FileOutputFormat.getOutputPath(jobConf);
     JobManager.execute(jobConf);
 
-    //read outputs
+    // read outputs
     Path inFile = new Path(outDir, "part-00000");
     IntWritable numInside = new IntWritable();
     DoubleWritable max = new DoubleWritable();
@@ -256,21 +261,23 @@
 
     jobConf.setNumMapTasks(config.getNumMapTasks());
     jobConf.setNumReduceTasks(1);
-    
+
     final FileSystem fs = FileSystem.get(jobConf);
-    Path outDir = new Path(new Path(getType() + "_TMP_normInifity_dir_" + System.currentTimeMillis()),
"out");
-    if(fs.exists(outDir)) 
+    Path outDir = new Path(new Path(getType() + "_TMP_normInifity_dir_"
+        + System.currentTimeMillis()), "out");
+    if (fs.exists(outDir))
       fs.delete(outDir, true);
-    
-    MatrixNormMapRed.initJob(this.getPath(), outDir.toString(), 
-        MatrixInfinityNormMapper.class, MatrixInfinityNormReducer.class, MatrixInfinityNormReducer.class,
jobConf);
-    
+
+    MatrixNormMapRed.initJob(this.getPath(), outDir.toString(),
+        MatrixInfinityNormMapper.class, MatrixInfinityNormReducer.class,
+        MatrixInfinityNormReducer.class, jobConf);
+
     // update the out put dir of the job
     outDir = FileOutputFormat.getOutputPath(jobConf);
-    
+
     JobManager.execute(jobConf);
 
-    //read outputs
+    // read outputs
     Path inFile = new Path(outDir, "part-00000");
     IntWritable numInside = new IntWritable();
     DoubleWritable max = new DoubleWritable();
@@ -291,21 +298,23 @@
 
     jobConf.setNumMapTasks(config.getNumMapTasks());
     jobConf.setNumReduceTasks(1);
-    
+
     final FileSystem fs = FileSystem.get(jobConf);
-    Path outDir = new Path(new Path(getType() + "_TMP_normFrobenius_dir_" + System.currentTimeMillis()),
"out");
-    if(fs.exists(outDir)) 
+    Path outDir = new Path(new Path(getType() + "_TMP_normFrobenius_dir_"
+        + System.currentTimeMillis()), "out");
+    if (fs.exists(outDir))
       fs.delete(outDir, true);
-    
-    MatrixNormMapRed.initJob(this.getPath(), outDir.toString(), 
-        MatrixFrobeniusNormMapper.class, MatrixFrobeniusNormCombiner.class, MatrixFrobeniusNormReducer.class,
jobConf);
-    
+
+    MatrixNormMapRed.initJob(this.getPath(), outDir.toString(),
+        MatrixFrobeniusNormMapper.class, MatrixFrobeniusNormCombiner.class,
+        MatrixFrobeniusNormReducer.class, jobConf);
+
     // update the out put dir of the job
     outDir = FileOutputFormat.getOutputPath(jobConf);
-    
+
     JobManager.execute(jobConf);
 
-    //read outputs
+    // read outputs
     Path inFile = new Path(outDir, "part-00000");
     IntWritable numInside = new IntWritable();
     DoubleWritable sqrt = new DoubleWritable();
@@ -319,7 +328,7 @@
     fs.delete(outDir.getParent(), true);
     return sqrt.get();
   }
-  
+
   /** {@inheritDoc} */
   public int getRows() throws IOException {
     Cell rows = null;
@@ -355,7 +364,7 @@
     update.put(Constants.ATTRIBUTE + "string", name);
     table.commit(update.getBatchUpdate());
   }
-  
+
   /** {@inheritDoc} */
   public void setDimension(int rows, int columns) throws IOException {
     VectorUpdate update = new VectorUpdate(Constants.METADATA);
@@ -364,7 +373,7 @@
 
     table.commit(update.getBatchUpdate());
   }
-  
+
   /** {@inheritDoc} */
   public void add(int i, int j, double value) throws IOException {
     VectorUpdate update = new VectorUpdate(i);
@@ -372,7 +381,7 @@
     table.commit(update.getBatchUpdate());
 
   }
-  
+
   /**
    * Just full scan a table.
    */
@@ -392,9 +401,10 @@
           update.put(e.getKey(), e.getValue().getValue());
         } else {
           String column = new String(e.getKey());
-          if(column.startsWith(Constants.COLUMN)) {
+          if (column.startsWith(Constants.COLUMN)) {
             double currValue = BytesUtil.bytesToDouble(e.getValue().getValue());
-            update.put(e.getKey(), (BytesUtil.doubleToBytes(currValue * alpha.get(0))));
+            update.put(e.getKey(), (BytesUtil.doubleToBytes(currValue
+                * alpha.get(0))));
           } else {
             update.put(e.getKey(), e.getValue().getValue());
           }
@@ -404,7 +414,7 @@
     }
 
     public static void setAlpha(double a) {
-      if(alpha.size() > 0) 
+      if (alpha.size() > 0)
         alpha = new ArrayList<Double>();
       alpha.add(a);
     }
@@ -524,12 +534,12 @@
 
   public Matrix transpose() throws IOException {
     Matrix result;
-    if(this.getType().equals("SparseMatrix")) {
+    if (this.getType().equals("SparseMatrix")) {
       result = new SparseMatrix(config, this.getRows(), this.getColumns());
     } else {
       result = new DenseMatrix(config, this.getRows(), this.getColumns());
     }
-    
+
     JobConf jobConf = new JobConf(config);
     jobConf.setJobName("transpose MR job" + result.getPath());
 
@@ -538,13 +548,12 @@
 
     TransposeMap.initJob(this.getPath(), TransposeMap.class, IntWritable.class,
         MapWritable.class, jobConf);
-    TransposeReduce.initJob(result.getPath(),
-        TransposeReduce.class, jobConf);
+    TransposeReduce.initJob(result.getPath(), TransposeReduce.class, jobConf);
 
     JobManager.execute(jobConf);
     return result;
   }
-  
+
   public boolean save(String aliasename) throws IOException {
     // mark & update the aliase name in "alise:name" meta column.
     // ! one matrix has only one aliasename now.

Modified: incubator/hama/trunk/src/java/org/apache/hama/DenseMatrix.java
URL: http://svn.apache.org/viewvc/incubator/hama/trunk/src/java/org/apache/hama/DenseMatrix.java?rev=793813&r1=793812&r2=793813&view=diff
==============================================================================
--- incubator/hama/trunk/src/java/org/apache/hama/DenseMatrix.java (original)
+++ incubator/hama/trunk/src/java/org/apache/hama/DenseMatrix.java Tue Jul 14 08:22:16 2009
@@ -254,7 +254,7 @@
     jobConf.setInt("matrix.column", n);
     jobConf.set("matrix.type", TABLE_PREFIX);
     jobConf.set("matrix.density", "100");
-    
+
     jobConf.setInputFormat(SequenceFileInputFormat.class);
     final FileSystem fs = FileSystem.get(jobConf);
     int interval = m / conf.getNumMapTasks();
@@ -365,8 +365,8 @@
 
   /** {@inheritDoc} */
   public void set(int i, int j, double value) throws IOException {
-    if(this.getRows() < i || this.getColumns() < j)
-      throw new ArrayIndexOutOfBoundsException(i +", "+j);
+    if (this.getRows() < i || this.getColumns() < j)
+      throw new ArrayIndexOutOfBoundsException(i + ", " + j);
     VectorUpdate update = new VectorUpdate(i);
     update.put(j, value);
     table.commit(update.getBatchUpdate());
@@ -674,90 +674,91 @@
 
     JobManager.execute(jobConf);
   }
-  
+
   /**
-   * Compute all the eigen values.
-   * Note: all the eigen values are collected in the "eival:value" column,
-   * and the eigen vector of a specified eigen value is collected in the
-   * "eivec:" column family in the same row.
+   * Compute all the eigen values. Note: all the eigen values are collected in
+   * the "eival:value" column, and the eigen vector of a specified eigen value
+   * is collected in the "eivec:" column family in the same row.
    * 
-   * TODO: we may need to expose the interface to access the eigen values
-   * and vectors
+   * TODO: we may need to expose the interface to access the eigen values and
+   * vectors
    * 
    * @param loops limit the loops of the computation
    * @throws IOException
    */
   public void jacobiEigenValue(int loops) throws IOException {
     JobConf jobConf = new JobConf(config);
-    
-    /******************************************************************
+
+    /***************************************************************************
      * Initialization
      * 
-     * A M/R job is used for initialization(such as, preparing a matrx
-     * copy of the original in "eicol:" family.)
-     ******************************************************************/
+     * A M/R job is used for initialization(such as, preparing a matrx copy of
+     * the original in "eicol:" family.)
+     **************************************************************************/
     // initialization
     jobConf.setJobName("JacobiEigen initialization MR job" + getPath());
-    
+
     jobConf.setMapperClass(JacobiEigenValue.InitMapper.class);
     jobConf.setInputFormat(VectorInputFormat.class);
     jobConf.set(VectorInputFormat.COLUMN_LIST, Constants.COLUMN);
-    
+
     FileInputFormat.addInputPaths(jobConf, getPath());
     jobConf.set(JacobiEigenValue.MATRIX, getPath());
     jobConf.setOutputFormat(NullOutputFormat.class);
     jobConf.setMapOutputKeyClass(IntWritable.class);
     jobConf.setMapOutputValueClass(MapWritable.class);
-    
+
     JobManager.execute(jobConf);
-    
+
     final FileSystem fs = FileSystem.get(jobConf);
     Pair pivotPair = new Pair();
     DoubleWritable pivotWritable = new DoubleWritable();
-    VectorUpdate vu ;
-    
+    VectorUpdate vu;
+
     // loop
     int size = this.getRows();
     int state = size;
     int pivot_row, pivot_col;
     double pivot;
     double s, c, t, y;
-    
-    while(state != 0 && loops > 0) {
-      /******************************************************************
-       * Find the pivot and its index(pivot_row, pivot_col) 
+
+    while (state != 0 && loops > 0) {
+      /*************************************************************************
+       * Find the pivot and its index(pivot_row, pivot_col)
        * 
-       * A M/R job is used to scan all the "eival:ind" to get the max 
-       * absolute value of each row, and do a MAX aggregation of these
-       * max values to get the max value in the matrix.
-       ******************************************************************/
+       * A M/R job is used to scan all the "eival:ind" to get the max absolute
+       * value of each row, and do a MAX aggregation of these max values to get
+       * the max value in the matrix.
+       ************************************************************************/
       jobConf = new JobConf(config);
       jobConf.setJobName("Find Pivot MR job" + getPath());
-      
+
       jobConf.setNumReduceTasks(1);
-      
-      Path outDir = new Path(new Path(getType() + "_TMP_FindPivot_dir_" + System.currentTimeMillis()),
"out");
-      if(fs.exists(outDir)) 
+
+      Path outDir = new Path(new Path(getType() + "_TMP_FindPivot_dir_"
+          + System.currentTimeMillis()), "out");
+      if (fs.exists(outDir))
         fs.delete(outDir, true);
-      
+
       jobConf.setMapperClass(JacobiEigenValue.PivotMapper.class);
       jobConf.setInputFormat(JacobiEigenValue.PivotInputFormat.class);
-      jobConf.set(JacobiEigenValue.PivotInputFormat.COLUMN_LIST, JacobiEigenValue.EIIND);
+      jobConf.set(JacobiEigenValue.PivotInputFormat.COLUMN_LIST,
+          JacobiEigenValue.EIIND);
       FileInputFormat.addInputPaths(jobConf, getPath());
       jobConf.setMapOutputKeyClass(Pair.class);
       jobConf.setMapOutputValueClass(DoubleWritable.class);
-      
+
       jobConf.setOutputKeyClass(Pair.class);
       jobConf.setOutputValueClass(DoubleWritable.class);
       jobConf.setOutputFormat(SequenceFileOutputFormat.class);
       FileOutputFormat.setOutputPath(jobConf, outDir);
-      
+
       // update the out put dir of the job
       outDir = FileOutputFormat.getOutputPath(jobConf);
-      
+
       JobManager.execute(jobConf);
 
-      //read outputs
+      // read outputs
       Path inFile = new Path(outDir, "part-00000");
       SequenceFile.Reader reader = new SequenceFile.Reader(fs, inFile, jobConf);
       try {
@@ -769,146 +770,154 @@
         reader.close();
       }
       fs.delete(outDir.getParent(), true);
-      
-      /******************************************************************
+
+      /*************************************************************************
        * Calculation
        * 
        * Compute the rotation parameters of next rotation.
-       ******************************************************************/
-      double e1 = BytesUtil.bytesToDouble(table.get(BytesUtil.getRowIndex(pivot_row), 
+       ************************************************************************/
+      double e1 = BytesUtil.bytesToDouble(table.get(
+          BytesUtil.getRowIndex(pivot_row),
           Bytes.toBytes(JacobiEigenValue.EIVAL)).getValue());
-      double e2 = BytesUtil.bytesToDouble(table.get(BytesUtil.getRowIndex(pivot_col), 
+      double e2 = BytesUtil.bytesToDouble(table.get(
+          BytesUtil.getRowIndex(pivot_col),
           Bytes.toBytes(JacobiEigenValue.EIVAL)).getValue());
-      
+
       y = (e2 - e1) / 2;
       t = Math.abs(y) + Math.sqrt(pivot * pivot + y * y);
       s = Math.sqrt(pivot * pivot + t * t);
       c = t / s;
       s = pivot / s;
       t = (pivot * pivot) / t;
-      if(y < 0) {
+      if (y < 0) {
         s = -s;
         t = -t;
       }
-      
-      /******************************************************************
+
+      /*************************************************************************
        * Upate the pivot and the eigen values indexed by the pivot
-       ******************************************************************/
+       ************************************************************************/
       vu = new VectorUpdate(pivot_row);
       vu.put(JacobiEigenValue.EICOL, pivot_col, 0);
       table.commit(vu.getBatchUpdate());
-      
+
       state = update(pivot_row, -t, state);
       state = update(pivot_col, t, state);
-      
-      /******************************************************************
+
+      /*************************************************************************
        * Rotation the matrix
-       ******************************************************************/
+       ************************************************************************/
       // rotation
       jobConf = new JobConf(config);
       jobConf.setJobName("Rotation Matrix MR job" + getPath());
-      
+
       jobConf.setInt(JacobiEigenValue.PIVOTROW, pivot_row);
       jobConf.setInt(JacobiEigenValue.PIVOTCOL, pivot_col);
       jobConf.set(JacobiEigenValue.PIVOTSIN, String.valueOf(s));
       jobConf.set(JacobiEigenValue.PIVOTCOS, String.valueOf(c));
-      
+
       jobConf.setMapperClass(DummyMapper.class);
-      jobConf.setInputFormat(JacobiEigenValue.RotationInputFormat.class);     
-      jobConf.set(JacobiEigenValue.RotationInputFormat.COLUMN_LIST, JacobiEigenValue.EIIND);
+      jobConf.setInputFormat(JacobiEigenValue.RotationInputFormat.class);
+      jobConf.set(JacobiEigenValue.RotationInputFormat.COLUMN_LIST,
+          JacobiEigenValue.EIIND);
       FileInputFormat.addInputPaths(jobConf, getPath());
       jobConf.setMapOutputKeyClass(NullWritable.class);
       jobConf.setMapOutputValueClass(NullWritable.class);
       FileInputFormat.addInputPaths(jobConf, getPath());
       jobConf.setOutputFormat(NullOutputFormat.class);
-      
+
       JobManager.execute(jobConf);
-      
+
       // rotate eigenvectors
       LOG.info("rotating eigenvector");
-      for(int i = 0; i < size; i++) {
-        e1 = BytesUtil.bytesToDouble(table.get(BytesUtil.getRowIndex(pivot_row), 
+      for (int i = 0; i < size; i++) {
+        e1 = BytesUtil.bytesToDouble(table.get(
+            BytesUtil.getRowIndex(pivot_row),
             Bytes.toBytes(JacobiEigenValue.EIVEC + i)).getValue());
-        e2 = BytesUtil.bytesToDouble(table.get(BytesUtil.getRowIndex(pivot_col), 
+        e2 = BytesUtil.bytesToDouble(table.get(
+            BytesUtil.getRowIndex(pivot_col),
             Bytes.toBytes(JacobiEigenValue.EIVEC + i)).getValue());
-        
+
         vu = new VectorUpdate(pivot_row);
         vu.put(JacobiEigenValue.EIVEC, i, c * e1 - s * e2);
         table.commit(vu.getBatchUpdate());
-        
+
         vu = new VectorUpdate(pivot_col);
         vu.put(JacobiEigenValue.EIVEC, i, s * e1 + c * e2);
         table.commit(vu.getBatchUpdate());
       }
-      
+
       LOG.info("update index...");
       // update index array
       maxind(pivot_row, size);
       maxind(pivot_col, size);
-      
-      loops --;
+
+      loops--;
     }
   }
-  
+
   void maxind(int row, int size) throws IOException {
     int m = row + 1;
-    if(row + 2 < size) {
-      double max = BytesUtil.bytesToDouble(table.get(BytesUtil.getRowIndex(row), 
-          Bytes.toBytes(JacobiEigenValue.EICOL + m)).getValue());
+    if (row + 2 < size) {
+      double max = BytesUtil.bytesToDouble(table
+          .get(BytesUtil.getRowIndex(row),
+              Bytes.toBytes(JacobiEigenValue.EICOL + m)).getValue());
       double val;
-      for(int i=row + 2; i<size; i++) {
-        val = BytesUtil.bytesToDouble(table.get(BytesUtil.getRowIndex(row), 
+      for (int i = row + 2; i < size; i++) {
+        val = BytesUtil.bytesToDouble(table.get(BytesUtil.getRowIndex(row),
             Bytes.toBytes(JacobiEigenValue.EICOL + i)).getValue());
-        if(Math.abs(val) > Math.abs(max)) {
+        if (Math.abs(val) > Math.abs(max)) {
           m = i;
           max = val;
         }
       }
     }
-    
+
     VectorUpdate vu = new VectorUpdate(row);
     vu.put(JacobiEigenValue.EIIND, m);
     table.commit(vu.getBatchUpdate());
   }
-  
+
   int update(int row, double value, int state) throws IOException {
-    double e = BytesUtil.bytesToDouble(table.get(BytesUtil.getRowIndex(row), 
+    double e = BytesUtil.bytesToDouble(table.get(BytesUtil.getRowIndex(row),
         Bytes.toBytes(JacobiEigenValue.EIVAL)).getValue());
-    int changed = BytesUtil.bytesToInt(table.get(BytesUtil.getRowIndex(row), 
+    int changed = BytesUtil.bytesToInt(table.get(BytesUtil.getRowIndex(row),
         Bytes.toBytes(JacobiEigenValue.EICHANGED)).getValue());
     double y = e;
     e += value;
-    
+
     VectorUpdate vu = new VectorUpdate(row);
     vu.put(JacobiEigenValue.EIVAL, e);
-    if(changed == 1 && (Math.abs(y - e) < .0000001)) { //y == e) {
+    if (changed == 1 && (Math.abs(y - e) < .0000001)) { // y == e) {
       changed = 0;
       vu.put(JacobiEigenValue.EICHANGED, changed);
-      state --;
-    } else if(changed == 0 && (Math.abs(y - e) > .0000001)) {
+      state--;
+    } else if (changed == 0 && (Math.abs(y - e) > .0000001)) {
       changed = 1;
       vu.put(JacobiEigenValue.EICHANGED, changed);
-      state ++;
-    } 
+      state++;
+    }
     table.commit(vu.getBatchUpdate());
     return state;
   }
-  
+
   // for test
   boolean verifyEigenValue(double[] e, double[][] E) throws IOException {
     boolean success = true;
     double e1, ev;
-    for(int i=0; i<e.length; i++) {
-      e1 = BytesUtil.bytesToDouble(table.get(BytesUtil.getRowIndex(i), 
+    for (int i = 0; i < e.length; i++) {
+      e1 = BytesUtil.bytesToDouble(table.get(BytesUtil.getRowIndex(i),
           Bytes.toBytes(JacobiEigenValue.EIVAL)).getValue());
       success &= ((Math.abs(e1 - e[i]) < .0000001));
-      if(!success) return success;
-      
-      for(int j=0; j<E[i].length; j++) {
-        ev = BytesUtil.bytesToDouble(table.get(BytesUtil.getRowIndex(i), 
+      if (!success)
+        return success;
+
+      for (int j = 0; j < E[i].length; j++) {
+        ev = BytesUtil.bytesToDouble(table.get(BytesUtil.getRowIndex(i),
             Bytes.toBytes(JacobiEigenValue.EIVEC + j)).getValue());
         success &= ((Math.abs(ev - E[i][j]) < .0000001));
-        if(!success) return success;
+        if (!success)
+          return success;
       }
     }
     return success;



Mime
View raw message