code: public static final DoubleMatrix2D diagonalMatrixMult(final DoubleMatrix1D diagonalU, DoubleMatrix2D A, final DoubleMatrix1D diagonalV){
  		int r = A.rows();
  		int c = A.columns();
  		final DoubleMatrix2D ret;
  		if (A instanceof SparseDoubleMatrix2D) {
  			ret = DoubleFactory2D.sparse.make(r, c);
  			A.forEachNonZero(new IntIntDoubleFunction() {
  				@Override
  				public double apply(int i, int j, double aij) {
  					ret.setQuick(i, j, aij * diagonalU.getQuick(i) * diagonalV.getQuick(j));
  					return aij;
  				}
  			});
  		} else {
  			ret = DoubleFactory2D.dense.make(r, c);
  			for (int i = 0; i < r; i++) {
  				for (int j = 0; j < c; j++) {
  					ret.setQuick(i, j, A.getQuick(i, j) * diagonalU.getQuick(i)	* diagonalV.getQuick(j));
  				}
  			}
  		}
  
  		return ret;
  	}
docs: Return diagonalU.A.diagonalV with diagonalU and diagonalV diagonal.
  @param diagonalU diagonal matrix U, in the form of a vector of its diagonal elements
  @param diagonalV diagonal matrix V, in the form of a vector of its diagonal elements
  @return U.A.V