Skip to content

Commit

Permalink
run check/format-incremental --apply
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinsung committed Feb 7, 2022
1 parent b32b55c commit a2fabeb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 22 deletions.
28 changes: 8 additions & 20 deletions src/openfermion/ops/representations/quadratic_hamiltonian_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,21 +179,12 @@ def test_majorana_form(self):
def test_diagonalizing_bogoliubov_transform(self):
"""Test diagonalizing Bogoliubov transform."""
hermitian_part = numpy.array(
[[0.0, 1.0, 0.0],
[1.0, 0.0, 1.0],
[0.0, 1.0, 0.0]],
dtype=complex
)
[[0.0, 1.0, 0.0], [1.0, 0.0, 1.0], [0.0, 1.0, 0.0]], dtype=complex)
antisymmetric_part = numpy.array(
[[0.0, 1.0j, 0.0],
[-1.0j, 0.0, 1.0j],
[0.0, -1.0j, 0.0]],
dtype=complex
)
quad_ham = QuadraticHamiltonian(hermitian_part,
antisymmetric_part)
block_matrix = numpy.zeros((6, 6),
dtype=complex)
[[0.0, 1.0j, 0.0], [-1.0j, 0.0, 1.0j], [0.0, -1.0j, 0.0]],
dtype=complex)
quad_ham = QuadraticHamiltonian(hermitian_part, antisymmetric_part)
block_matrix = numpy.zeros((6, 6), dtype=complex)
block_matrix[:3, :3] = antisymmetric_part
block_matrix[:3, 3:] = hermitian_part
block_matrix[3:, :3] = -hermitian_part.conj()
Expand All @@ -203,14 +194,11 @@ def test_diagonalizing_bogoliubov_transform(self):
quad_ham.diagonalizing_bogoliubov_transform())
left_block = transformation_matrix[:, :3]
right_block = transformation_matrix[:, 3:]
ferm_unitary = numpy.zeros((6, 6),
dtype=complex)
ferm_unitary = numpy.zeros((6, 6), dtype=complex)
ferm_unitary[:3, :3] = left_block
ferm_unitary[:3, 3:] = right_block
ferm_unitary[3:, :3] = numpy.conjugate(
right_block)
ferm_unitary[3:, 3:] = numpy.conjugate(
left_block)
ferm_unitary[3:, :3] = numpy.conjugate(right_block)
ferm_unitary[3:, 3:] = numpy.conjugate(left_block)

# Check that the transformation is diagonalizing
majorana_matrix, _ = quad_ham.majorana_form()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,9 @@ def test_reduced_ccsd_t(self):
pyscf_etot = mycas.e_tot

# Don't do triples (it's zero anyway for 2e) b/c div by zero w/ ROHF
_, _, resource_estimates_etot = ccsd_t(
*pyscf_to_cas(mf, n_orb, n_elec), no_triples=True)
_, _, resource_estimates_etot = ccsd_t(*pyscf_to_cas(
mf, n_orb, n_elec),
no_triples=True)

# ignore relative tolerance, we just want absolute tolerance
assert np.isclose(pyscf_etot, resource_estimates_etot, rtol=1E-14)
Expand Down

0 comments on commit a2fabeb

Please sign in to comment.