Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use zscal in givens rotation #29

Merged
merged 1 commit into from
Sep 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions python/ffsim/slow/gates/orbital_rotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from __future__ import annotations

import numpy as np
from scipy.linalg.blas import zdrot
from scipy.linalg.blas import zdrot, zscal


def gen_orbital_rotation_index_in_place_slow(
Expand Down Expand Up @@ -74,6 +74,6 @@ def apply_givens_rotation_in_place_slow(
"""Apply a Givens rotation to slices of a state vector."""
phase_conj = phase.conjugate()
for i, j in zip(slice1, slice2):
vec[i] *= phase_conj
zscal(phase_conj, vec[i])
vec[i], vec[j] = zdrot(vec[i], vec[j], c, s)
vec[i] *= phase
zscal(phase, vec[i])