# Eigen decomp for non-symmetric matrices?

**URL:** https://community.konduit.ai/t/eigen-decomp-for-non-symmetric-matrices/1403
**Category:** ND4J
**Created:** [May 25, 2021, 7:33pm UTC](https://community.konduit.ai/t/eigen-decomp-for-non-symmetric-matrices/1403 "2021-05-25T19:33:34Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![wcneill](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/wcneill/32/559_2.png) [@wcneill](https://community.konduit.ai/u/wcneill)
#### Post date: [May 25, 2021, 7:33pm UTC](https://community.konduit.ai/t/eigen-decomp-for-non-symmetric-matrices/1403/1 "2021-05-25T19:33:34Z")

</div>

I’ve been trying to figure out why the eigenvalue decomposition provided by ND4J is returning incorrect results in my unit tests. I worked out the matrix decomp by hand and calculated it with several other libraries (EJML, Parallel Colt, and JAMA).

I’ve tried both the standard and the generalized method (setting B to the identity matrix). Both give the same incorrect values:

```auto
        double[][] array = new double[][]{{1, 2, 1}, {6, -1, 0}, {-1, -2, -1}};
        INDArray matrix = Nd4j.create(array);

        INDArray values = Eigen.symmetricGeneralizedEigenvalues(matrix);
        // INDArray values = Eigen.symmetricGeneralizedEigenvalues(matrix, Nd4j.eye(matrix.row));
        System.out.println(values);

```

With either method I get:

```auto
[-6.2408, -1.3996, 6.6403]

```

However, the actual eigenvalues are

```auto
[-4.0, 0.0, 3.0]

```

I figure this has something to do with the fact that the docs say A should be symmetric… but I see no other class in the library that does eigenvalue decomposition and symmetric matrices are a pretty narrow scope (or so I thought?).

Does anyone have any ideas? Thanks!
