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, column 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);
67 * Answers all values present in the Matrix ordered by row,column
69 * @return the double array containing the values ordered in {row values} per
72 double[][] getValues();
79 MatrixI preMultiply(MatrixI m);
81 MatrixI postMultiply(MatrixI m);
87 void print(PrintStream ps, String format);
89 void printD(PrintStream ps, String format);
91 void printE(PrintStream ps, String format);
93 void tqli() throws Exception;
98 * Reverses the range of the matrix values, so that the smallest values become
99 * the largest, and the largest become the smallest. This operation supports
100 * using a distance measure as a similarity measure, or vice versa.
102 * If parameter <code>maxToZero</code> is true, then the maximum value becomes
103 * zero, i.e. all values are subtracted from the maximum. This is consistent
104 * with converting an identity similarity score to a distance score - the most
105 * similar (identity) corresponds to zero distance. However note that the
106 * operation is not reversible (unless the original minimum value is zero).
107 * For example a range of 10-40 would become 30-0, which would reverse a
108 * second time to 0-30. Also note that a general similarity measure (such as
109 * BLOSUM) may give different 'identity' scores for different sequences, so
110 * they cannot all convert to zero distance.
112 * If parameter <code>maxToZero</code> is false, then the values are reflected
113 * about the average of {min, max} (effectively swapping min and max). This
114 * operation <em>is</em> reversible.
118 void reverseRange(boolean maxToZero);
121 * Multiply all entries by the given value
125 void multiply(double d);