X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fmath%2FMatrixI.java;h=94b933349d2352474331b8d0961a394909ae5e49;hb=7733b7433ee8771d85ccfe2ed32119feac8056e0;hp=05fe22ffa887fee646501d628d81d1764fbc7614;hpb=d6a30c6516e8e2f923c8c2f6dce7592cb3b7d974;p=jalview.git diff --git a/src/jalview/math/MatrixI.java b/src/jalview/math/MatrixI.java index 05fe22f..94b9333 100644 --- a/src/jalview/math/MatrixI.java +++ b/src/jalview/math/MatrixI.java @@ -65,12 +65,33 @@ public interface MatrixI void tred(); - double getMaxValue(); + /** + * Reverses the range of the matrix values, so that the smallest values become + * the largest, and the largest become the smallest. This operation supports + * using a distance measure as a similarity measure, or vice versa. + *

+ * If parameter maxToZero is true, then the maximum value becomes + * zero, i.e. all values are subtracted from the maximum. This is consistent + * with converting an identity similarity score to a distance score - the most + * similar (identity) corresponds to zero distance. However note that the + * operation is not reversible (unless the original minimum value is zero). + * For example a range of 10-40 would become 30-0, which would reverse a + * second time to 0-30. Also note that a general similarity measure (such as + * BLOSUM) may give different 'identity' scores for different sequences, so + * they cannot all convert to zero distance. + *

+ * If parameter maxToZero is false, then the values are reflected + * about the average of {min, max} (effectively swapping min and max). This + * operation is reversible. + * + * @param maxToZero + */ + void reverseRange(boolean maxToZero); /** - * Update each value in the matrix by subtracting it from the given value + * Multiply all entries by the given value * - * @param val + * @param d */ - void subtractAllFrom(double val); + void multiply(double d); }