git://source.jalview.org
/
jalview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
JAL-2416 allow space in score matrix name
[jalview.git]
/
src
/
jalview
/
math
/
Matrix.java
diff --git
a/src/jalview/math/Matrix.java
b/src/jalview/math/Matrix.java
index
28b9d67
..
647fc3a
100755
(executable)
--- a/
src/jalview/math/Matrix.java
+++ b/
src/jalview/math/Matrix.java
@@
-26,22
+26,23
@@
import jalview.util.MessageManager;
import java.io.PrintStream;
/**
import java.io.PrintStream;
/**
- * DOCUMENT ME!
- *
- * @author $author$
- * @version $Revision$
+ * A class to model rectangular matrices of double values and operations on them
*/
public class Matrix
{
*/
public class Matrix
{
- /**
- * SMJSPUBLIC
+ /*
+ * the cell values in row-major order
*/
public double[][] value;
*/
public double[][] value;
- /** DOCUMENT ME!! */
+ /*
+ * the number of rows
+ */
public int rows;
public int rows;
- /** DOCUMENT ME!! */
+ /*
+ * the number of columns
+ */
public int cols;
/** DOCUMENT ME!! */
public int cols;
/** DOCUMENT ME!! */
@@
-60,10
+61,10
@@
public class Matrix
* Creates a new Matrix object. For example
*
* <pre>
* Creates a new Matrix object. For example
*
* <pre>
- * new Matrix(new double[][] {{2, 3}, {4, 5}, 2, 2)
+ * new Matrix(new double[][] {{2, 3, 4}, {5, 6, 7})
* constructs
* constructs
- * (2 3)
- * (4 5)
+ * (2 3 4)
+ * (5 6 7)
* </pre>
*
* Note that ragged arrays (with not all rows, or columns, of the same
* </pre>
*
* Note that ragged arrays (with not all rows, or columns, of the same
@@
-72,13
+73,11
@@
public class Matrix
*
* @param values
* the matrix values in row-major order
*
* @param values
* the matrix values in row-major order
- * @param rows
- * @param cols
*/
*/
- public Matrix(double[][] values, int rows, int cols)
+ public Matrix(double[][] values)
{
{
- this.rows = rows;
- this.cols = cols;
+ this.rows = values.length;
+ this.cols = this.rows == 0 ? 0 : values[0].length;
this.value = values;
}
this.value = values;
}
@@
-99,7
+98,7
@@
public class Matrix
}
}
}
}
- return new Matrix(out, cols, rows);
+ return new Matrix(out);
}
/**
}
/**
@@
-155,7
+154,7
@@
public class Matrix
}
}
}
}
- return new Matrix(tmp, in.rows, this.cols);
+ return new Matrix(tmp);
}
/**
}
/**
@@
-218,13
+217,9
@@
public class Matrix
for (int i = 0; i < rows; i++)
{
System.arraycopy(value[i], 0, newmat[i], 0, value[i].length);
for (int i = 0; i < rows; i++)
{
System.arraycopy(value[i], 0, newmat[i], 0, value[i].length);
- // for (int j = 0; j < cols; j++)
- // {
- // newmat[i][j] = value[i][j];
- // }
}
}
- return new Matrix(newmat, rows, cols);
+ return new Matrix(newmat);
}
/**
}
/**