11/*
22 * The baseCode project
3- *
3+ *
44 * Copyright (c) 2008 University of British Columbia
5- *
5+ *
66 * Licensed under the Apache License, Version 2.0 (the "License");
77 * you may not use this file except in compliance with the License.
88 * You may obtain a copy of the License at
2727
2828import org .apache .commons .lang3 .time .StopWatch ;
2929
30- import ubic .basecode .dataStructure .matrix .DenseDoubleMatrix ;
31- import ubic .basecode .dataStructure .matrix .DoubleMatrix ;
3230import cern .colt .matrix .DoubleMatrix2D ;
3331import cern .colt .matrix .impl .DenseDoubleMatrix2D ;
32+ import ubic .basecode .dataStructure .matrix .DenseDoubleMatrix ;
33+ import ubic .basecode .dataStructure .matrix .DoubleMatrix ;
3434
3535/**
3636 * SVD for DoubleMatrix.
37- *
38- * @author paul
37+ *
38+ * @author paul
3939 * @version $Id$
4040 */
4141public class SingularValueDecomposition <R , C > {
@@ -62,7 +62,7 @@ public SingularValueDecomposition( DoubleMatrix<R, C> matrix ) {
6262
6363 computeSVD ( dm );
6464
65- List <Integer > componentIds = new ArrayList <Integer >();
65+ List <Integer > componentIds = new ArrayList <>();
6666
6767 if ( rowNames .size () == 0 ) { // sanity check
6868 throw new IllegalStateException ( "No row names!" );
@@ -72,46 +72,46 @@ public SingularValueDecomposition( DoubleMatrix<R, C> matrix ) {
7272 componentIds .add ( i );
7373 }
7474
75- this .uMatrix = new DenseDoubleMatrix <R , Integer >( svd .getU ().toArray () );
75+ this .uMatrix = new DenseDoubleMatrix <>( svd .getU ().toArray () );
7676 uMatrix .setRowNames ( this .rowNames );
7777 uMatrix .setColumnNames ( componentIds );
7878
79- this .vMatrix = new DenseDoubleMatrix <Integer , C >( svd .getV ().toArray () );
79+ this .vMatrix = new DenseDoubleMatrix <>( svd .getV ().toArray () );
8080 vMatrix .setRowNames ( componentIds );
8181 vMatrix .setColumnNames ( this .columnNames );
8282
83- this .sMatrix = new DenseDoubleMatrix <Integer , Integer >( svd .getS ().toArray () );
83+ this .sMatrix = new DenseDoubleMatrix <>( svd .getS ().toArray () );
8484 sMatrix .setRowNames ( componentIds );
8585 sMatrix .setColumnNames ( componentIds );
8686 }
8787
8888 /**
8989 * @return the condition number of the matrix
90- * @see cern.colt.matrix.linalg.SingularValueDecomposition#cond()
90+ * @see cern.colt.matrix.linalg.SingularValueDecomposition#cond()
9191 */
9292 public double cond () {
9393 return svd .cond ();
9494 }
9595
9696 /**
9797 * @return
98- * @see cern.colt.matrix.linalg.SingularValueDecomposition#getS()
98+ * @see cern.colt.matrix.linalg.SingularValueDecomposition#getS()
9999 */
100100 public DoubleMatrix <Integer , Integer > getS () {
101101 return this .sMatrix ;
102102 }
103103
104104 /**
105105 * @return
106- * @see cern.colt.matrix.linalg.SingularValueDecomposition#getSingularValues()
106+ * @see cern.colt.matrix.linalg.SingularValueDecomposition#getSingularValues()
107107 */
108108 public double [] getSingularValues () {
109109 return svd .getSingularValues ();
110110 }
111111
112112 /**
113113 * @return
114- * @see cern.colt.matrix.linalg.SingularValueDecomposition#getU()
114+ * @see cern.colt.matrix.linalg.SingularValueDecomposition#getU()
115115 */
116116 public DoubleMatrix <R , Integer > getU () {
117117 return this .uMatrix ;
@@ -120,31 +120,31 @@ public DoubleMatrix<R, Integer> getU() {
120120
121121 /**
122122 * @return
123- * @see cern.colt.matrix.linalg.SingularValueDecomposition#getV()
123+ * @see cern.colt.matrix.linalg.SingularValueDecomposition#getV()
124124 */
125125 public DoubleMatrix <Integer , C > getV () {
126126 return this .vMatrix ;
127127 }
128128
129129 /**
130130 * @return
131- * @see cern.colt.matrix.linalg.SingularValueDecomposition#norm2()
131+ * @see cern.colt.matrix.linalg.SingularValueDecomposition#norm2()
132132 */
133133 public double norm2 () {
134134 return svd .norm2 ();
135135 }
136136
137137 /**
138138 * @return
139- * @see cern.colt.matrix.linalg.SingularValueDecomposition#rank()
139+ * @see cern.colt.matrix.linalg.SingularValueDecomposition#rank()
140140 */
141141 public int rank () {
142142 return svd .rank ();
143143 }
144144
145145 /**
146146 * @return
147- * @see cern.colt.matrix.linalg.SingularValueDecomposition#toString()
147+ * @see cern.colt.matrix.linalg.SingularValueDecomposition#toString()
148148 */
149149 @ Override
150150 public String toString () {
@@ -158,7 +158,7 @@ private void computeSVD( final DoubleMatrix2D dm ) {
158158 /*
159159 * This fails to converge some times, we have to bail.
160160 */
161- FutureTask <cern .colt .matrix .linalg .SingularValueDecomposition > svdFuture = new FutureTask <cern . colt . matrix . linalg . SingularValueDecomposition >(
161+ FutureTask <cern .colt .matrix .linalg .SingularValueDecomposition > svdFuture = new FutureTask <>(
162162 new Callable <cern .colt .matrix .linalg .SingularValueDecomposition >() {
163163 @ Override
164164 public cern .colt .matrix .linalg .SingularValueDecomposition call () {
0 commit comments