Inlcude 8 dimensions
[jalview.git] / src / jalview / math / Matrix.java
index 7870c14..b7d225a 100755 (executable)
@@ -1415,4 +1415,23 @@ public class Matrix implements MatrixI
     return result;
   }
 
+  /**
+  * mirrors columns of the matrix
+  *
+  * @return
+  */
+  @Override
+  public MatrixI mirrorCol()
+  {
+    double[][] result = new double[rows][cols];
+    for (int i = 0; i < rows; i++)
+    {
+      int k = cols - 1;        // reverse col
+      for (int j = 0; j < cols; j++)
+      {
+       result[i][k--] = this.getValue(i,j);
+      }
+    }
+    return new Matrix(result);
+  }
 }