X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fmath%2FMatrix.java;h=b910a7edb4229221c06ea32549489d604b3fcb63;hb=11ec9d4540710b65b82b8b901de07b441c130887;hp=8910c67a7ec07f7ce4d2c5c13880640972db3e95;hpb=e34a4c5332c2d4d92651e0adc99ab7c5d262d13b;p=jalview.git diff --git a/src/jalview/math/Matrix.java b/src/jalview/math/Matrix.java index 8910c67..b910a7e 100755 --- a/src/jalview/math/Matrix.java +++ b/src/jalview/math/Matrix.java @@ -31,37 +31,40 @@ import java.io.PrintStream; public class Matrix implements MatrixI { /* - * the cell values in row-major order + * maximum number of iterations for tqli */ - private double[][] value; + private static final int MAX_ITER = 45; + // fudge - add 15 iterations, just in case /* * the number of rows */ - protected int rows; + final protected int rows; /* * the number of columns */ - protected int cols; + final protected int cols; + + /* + * the cell values in row-major order + */ + private double[][] value; protected double[] d; // Diagonal protected double[] e; // off diagonal /** - * maximum number of iterations for tqli + * Constructor given number of rows and columns * + * @param colCount + * @param rowCount */ - private static final int maxIter = 45; // fudge - add 15 iterations, just in - // case - - /** - * Default constructor - */ - public Matrix() + protected Matrix(int rowCount, int colCount) { - + rows = rowCount; + cols = colCount; } /** @@ -103,11 +106,6 @@ public class Matrix implements MatrixI } } - /** - * Returns a new matrix which is the transpose of this one - * - * @return - */ @Override public MatrixI transpose() { @@ -145,18 +143,6 @@ public class Matrix implements MatrixI } } - /** - * Returns a new matrix which is the result of premultiplying this matrix by - * the supplied argument. If this of size AxB (A rows and B columns), and the - * argument is CxA (C rows and A columns), the result is of size CxB. - * - * @param in - * - * @return - * @throws IllegalArgumentException - * if the number of columns in the pre-multiplier is not equal to - * the number of rows in the multiplicand (this) - */ @Override public MatrixI preMultiply(MatrixI in) { @@ -208,21 +194,6 @@ public class Matrix implements MatrixI return out; } - /** - * Returns a new matrix which is the result of postmultiplying this matrix by - * the supplied argument. If this of size AxB (A rows and B columns), and the - * argument is BxC (B rows and C columns), the result is of size AxC. - *

- * This method simply returns the result of in.preMultiply(this) - * - * @param in - * - * @return - * @throws IllegalArgumentException - * if the number of rows in the post-multiplier is not equal to the - * number of columns in the multiplicand (this) - * @see #preMultiply(Matrix) - */ @Override public MatrixI postMultiply(MatrixI in) { @@ -234,11 +205,6 @@ public class Matrix implements MatrixI return in.preMultiply(this); } - /** - * Answers a new matrix with a copy of the values in this one - * - * @return - */ @Override public MatrixI copy() { @@ -479,11 +445,11 @@ public class Matrix implements MatrixI { iter++; - if (iter == maxIter) + if (iter == MAX_ITER) { throw new Exception(MessageManager.formatMessage( "exception.matrix_too_many_iteration", new String[] - { "tqli", Integer.valueOf(maxIter).toString() })); + { "tqli", Integer.valueOf(MAX_ITER).toString() })); } else { @@ -743,11 +709,11 @@ public class Matrix implements MatrixI { iter++; - if (iter == maxIter) + if (iter == MAX_ITER) { throw new Exception(MessageManager.formatMessage( "exception.matrix_too_many_iteration", new String[] - { "tqli2", Integer.valueOf(maxIter).toString() })); + { "tqli2", Integer.valueOf(MAX_ITER).toString() })); } else {