import { matrix_householder_in_place } from "./matrix_householder_in_place.js";
import { matrix_qr_in_place } from "./matrix_qr_in_place.js";


/**
 * list of eigen values square matrix (allow non-symmetric)
 * NOTE: Modifies input matrix
 *
 * @template T extends ArrayLike<number>
 * @param {T} out
 * @param {SquareMatrix} mat column-major; modified in place
 * @return {T}
 */
export function matrix_eigenvalues_in_place(out, mat) {
    const n = mat.size;

    matrix_householder_in_place(mat.data, n);
    matrix_qr_in_place(mat.data, n);

    mat.readDiagonal(out);

    return out;
}
