Convert two-body operator into sum of squared one-body operators.

As in arXiv:1808.02625, this function decomposes :math:\sum_{pqrs} h_{pqrs} a^\dagger_p a^\dagger_q a_r a_s as :math:\sum_{l} \lambda_l (\sum_{pq} g_{lpq} a^\dagger_p a_q)^2 l is truncated to take max value L so that :math:\sum_{l=0}^{L-1} (\sum_{pq} |g_{lpq}|)^2 |\lambda_l| < x

two_body_coefficients (ndarray): an N x N x N x N numpy array giving the :math:h_{pqrs} tensor. This tensor must be 8-fold symmetric (real integrals). truncation_threshold (optional Float): the value of x, above. final_rank (optional int): if provided, this specifies the value of L at which to truncate. This overrides truncation_threshold. spin_basis (bool): True if the two-body terms are passed in spin orbital basis. False if already in spatial orbital basis.

eigenvalues (ndarray of floats): length L array giving the :math:\lambda_l. one_body_squares (ndarray of floats): L x N x N array of floats corresponding to the value of :math:g_{pql}. one_body_correction (ndarray): One-body correction terms that result from reordering to chemist ordering, in spin-orbital basis. truncation_value (float): after truncation, this is the value :math:\sum_{l=0}^{L-1} (\sum_{pq} |g_{lpq}|)^2 |\lambda_l| < x

TypeError Invalid two-body coefficient tensor specification.