\r
import jalview.math.*;\r
\r
+import java.io.*;\r
\r
/**\r
* Performs Principal Component Analysis on given sequences\r
Matrix m2;\r
double[] eigenvalue;\r
Matrix eigenvector;\r
+ StringBuffer details = new StringBuffer();\r
\r
\r
/**\r
return out / eigenvector.d[n];\r
}\r
\r
+ public String getDetails()\r
+ {\r
+ return details.toString();\r
+ }\r
+\r
\r
/**\r
* DOCUMENT ME!\r
{\r
Matrix mt = m.transpose();\r
\r
- // System.out.println(" --- OrigT * Orig ---- ");\r
+ details.append(" --- OrigT * Orig ---- \n");\r
eigenvector = mt.preMultiply(m2);\r
\r
- // eigenvector.print(System.out);\r
+ PrintStream ps = new PrintStream(System.out)\r
+ {\r
+ public void print(String x) {\r
+ details.append(x);\r
+ }\r
+ public void println()\r
+ {\r
+ details.append("\n");\r
+ }\r
+ };\r
+\r
+\r
+ eigenvector.print( ps );\r
+\r
symm = eigenvector.copy();\r
\r
- //TextArea ta = new TextArea(25,72);\r
- //TextAreaPrintStream taps = new TextAreaPrintStream(System.out,ta);\r
- //Frame f = new Frame("PCA output");\r
- //f.resize(500,500);\r
- //f.setLayout(new BorderLayout());\r
- //f.add("Center",ta);\r
- //f.show();\r
- //symm.print(taps);\r
- long tstart = System.currentTimeMillis();\r
eigenvector.tred();\r
\r
- long tend = System.currentTimeMillis();\r
+ details.append(" ---Tridiag transform matrix ---\n");\r
+ details.append(" --- D vector ---\n");\r
+ eigenvector.printD(ps);\r
+ ps.println();\r
+ details.append("--- E vector ---\n");\r
+ eigenvector.printE(ps);\r
+ ps.println();\r
\r
- //taps.println("Time take for tred = " + (tend-tstart) + "ms");\r
- //taps.println(" ---Tridiag transform matrix ---");\r
- //taps.println(" --- D vector ---");\r
- //eigenvector.printD(taps);\r
- //taps.println();\r
- //taps.println(" --- E vector ---");\r
- // eigenvector.printE(taps);\r
- //taps.println();\r
// Now produce the diagonalization matrix\r
- tstart = System.currentTimeMillis();\r
eigenvector.tqli();\r
- tend = System.currentTimeMillis();\r
-\r
- //System.out.println("Time take for tqli = " + (tend-tstart) + " ms");\r
- //System.out.println(" --- New diagonalization matrix ---");\r
- //System.out.println(" --- Eigenvalues ---");\r
- //eigenvector.printD(taps);\r
- //System.out.println();\r
- // for (int i=0; i < eigenvector.cols; i++) {\r
- // checkEigenvector(i,taps);\r
- // taps.println();\r
- // }\r
+\r
+\r
+ details.append(" --- New diagonalization matrix ---\n");\r
+ details.append(" --- Eigenvalues ---\n");\r
+ eigenvector.printD(ps);\r
+ ps.println();\r
// taps.println();\r
// taps.println("Transformed sequences = ");\r
// Matrix trans = m.preMultiply(eigenvector);\r