2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $$Year-Rel$$ The Jalview Authors
5 * This file is part of Jalview.
7 * Jalview is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation, either version 3
10 * of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
23 import java.io.PrintStream;
25 public interface MatrixI
28 * Answers the number of columns
35 * Answers the number of rows
42 * Answers the value at row i, column j
48 double getValue(int i, int j);
51 * Sets the value at row i, colum j
57 void setValue(int i, int j, double d);
60 * Answers a copy of the values in the i'th row
64 double[] getRow(int i);
70 MatrixI preMultiply(MatrixI m);
72 MatrixI postMultiply(MatrixI m);
78 void print(PrintStream ps, String format);
80 void printD(PrintStream ps, String format);
82 void printE(PrintStream ps, String format);
84 void tqli() throws Exception;
89 * Reverses the range of the matrix values, so that the smallest values become
90 * the largest, and the largest become the smallest. This operation supports
91 * using a distance measure as a similarity measure, or vice versa.
93 * If parameter <code>maxToZero</code> is true, then the maximum value becomes
94 * zero, i.e. all values are subtracted from the maximum. This is consistent
95 * with converting an identity similarity score to a distance score - the most
96 * similar (identity) corresponds to zero distance. However note that the
97 * operation is not reversible (unless the original minimum value is zero).
98 * For example a range of 10-40 would become 30-0, which would reverse a
99 * second time to 0-30. Also note that a general similarity measure (such as
100 * BLOSUM) may give different 'identity' scores for different sequences, so
101 * they cannot all convert to zero distance.
103 * If parameter <code>maxToZero</code> is false, then the values are reflected
104 * about the average of {min, max} (effectively swapping min and max). This
105 * operation <em>is</em> reversible.
109 void reverseRange(boolean maxToZero);
112 * Multiply all entries by the given value
116 void multiply(double d);