X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fmath%2FMatrix.java;fp=src%2Fjalview%2Fmath%2FMatrix.java;h=b7d225ab887ae90e8c246a8a7ac47ae029661722;hb=c99e5757c9c199687f6e3cdbbdb500f2cbb3cf89;hp=7870c14609822b3f577d6a32dfae0d0cfd263aff;hpb=d879fd713c06451d655f312840a610f2bae7eda5;p=jalview.git diff --git a/src/jalview/math/Matrix.java b/src/jalview/math/Matrix.java index 7870c14..b7d225a 100755 --- a/src/jalview/math/Matrix.java +++ b/src/jalview/math/Matrix.java @@ -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); + } }