nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dimensionalityreduction/PCA.java
public static INDArray[] principalComponents(INDArray cov) {
        assert cov.rows() == cov.columns();
        INDArray[] result = new INDArray[2];
        result[0] = Nd4j.eye(cov.rows());
        result[1] = Eigen.symmetricGeneralizedEigenvalues(result[0], cov, true);
        return result;
    }
public static INDArray[] principalComponents(INDArray cov) {
        assert cov.rows() == cov.columns();
        INDArray[] result = new INDArray[2];
        result[0] = Nd4j.eye(cov.rows());
        result[1] = Eigen.symmetricGeneralizedEigenvalues(result[0], cov, true);
        return result;
    }
Calculates the principal component vectors and their eigenvalues (lambda) for the covariance matrix.
The result includes two things: the eigenvectors (modes) as result[0] and the eigenvalues (lambda)
as result[1].

@param cov The covariance matrix (calculated with the covarianceMatrix(in) method)
@return Array INDArray[2] "result".  The principal component vectors in decreasing flexibility are
the columns of element 0 and the eigenvalues are element 1.