code: public static double[][] pseudoInverse(double[][] matrix){
  		if(isSolverUseApacheCommonsMath) {
  			// Use LU from common math
  			SingularValueDecomposition svd = new SingularValueDecomposition(new Array2DRowRealMatrix(matrix));
  			double[][] matrixInverse = svd.getSolver().getInverse().getData();
  
  			return matrixInverse;
  		}
  		else {
  			return org.jblas.Solve.pinv(new org.jblas.DoubleMatrix(matrix)).toArray2();
  		}
  	}
docs: Pseudo-Inverse of a matrix calculated in the least square sense.
  
  @param matrix The given matrix A.
  @return pseudoInverse The pseudo-inverse matrix P, such that A*P*A = A and P*A*P = P