Skip to content

Commit

Permalink
Merge pull request #156 from qulacs/resolve-eigen-warning
Browse files Browse the repository at this point in the history
Resolve Eigen warnings on CUDA environment
  • Loading branch information
gandalfr-KY authored Aug 20, 2024
2 parents 7bd3d1b + bb9417f commit 7f52c4b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
5 changes: 3 additions & 2 deletions scaluq/gate/gate_pauli.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,9 @@ class PauliRotationGateImpl : public GateBase {
ComplexMatrix mat = this->_pauli.get_matrix_ignoring_coef();
Complex true_angle = _angle * _pauli.get_coef();
StdComplex imag_unit(0, 1);
mat = Kokkos::cos(-true_angle / 2) * ComplexMatrix::Identity(mat.rows(), mat.cols()) +
imag_unit * Kokkos::sin(-true_angle / 2) * mat;
mat = (StdComplex)Kokkos::cos(-true_angle / 2) *
ComplexMatrix::Identity(mat.rows(), mat.cols()) +
imag_unit * (StdComplex)Kokkos::sin(-true_angle / 2) * mat;
return mat;
}
void update_quantum_state(StateVector& state_vector) const override {
Expand Down
5 changes: 3 additions & 2 deletions scaluq/gate/param_gate_pauli.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ class PPauliRotationGateImpl : public ParamGateBase {
Complex true_angle = angle * this->_pauli.get_coef();
ComplexMatrix mat = this->_pauli.get_matrix_ignoring_coef();
StdComplex imag_unit(0, 1);
mat = Kokkos::cos(-true_angle / 2) * ComplexMatrix::Identity(mat.rows(), mat.cols()) +
imag_unit * Kokkos::sin(-true_angle / 2) * mat;
mat = (StdComplex)Kokkos::cos(-true_angle / 2) *
ComplexMatrix::Identity(mat.rows(), mat.cols()) +
imag_unit * (StdComplex)Kokkos::sin(-true_angle / 2) * mat;
return mat;
}
void update_quantum_state(StateVector& state_vector, double param) const override {
Expand Down
2 changes: 1 addition & 1 deletion scaluq/operator/pauli_operator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ Complex PauliOperator::get_transition_amplitude(const StateVector& state_vector_
return mat;
}
[[nodiscard]] ComplexMatrix PauliOperator::get_matrix() const {
return get_matrix_ignoring_coef() * _ptr->_coef;
return get_matrix_ignoring_coef() * StdComplex(_ptr->_coef);
}

PauliOperator PauliOperator::operator*(const PauliOperator& target) const {
Expand Down

0 comments on commit 7f52c4b

Please sign in to comment.