Skip to content

Commit

Permalink
Merge pull request #612 from qulacs/fix-test-util-kronecker-product
Browse files Browse the repository at this point in the history
Fix kronecker-product
  • Loading branch information
KowerKoint committed Mar 7, 2024
2 parents 7459ff7 + 6ee5966 commit 4b4b70d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions test/util/util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ static Eigen::VectorXcd get_eigen_diagonal_matrix_random_multi_qubit_unitary(
static Eigen::MatrixXcd kronecker_product(
const Eigen::MatrixXcd& lhs, const Eigen::MatrixXcd& rhs) {
Eigen::MatrixXcd result(lhs.rows() * rhs.rows(), lhs.cols() * rhs.cols());
for (int i = 0; i < lhs.cols(); i++) {
for (int j = 0; j < lhs.rows(); j++) {
for (int i = 0; i < lhs.rows(); i++) {
for (int j = 0; j < lhs.cols(); j++) {
result.block(i * rhs.rows(), j * rhs.cols(), rhs.rows(),
rhs.cols()) = lhs(i, j) * rhs;
}
Expand Down

0 comments on commit 4b4b70d

Please sign in to comment.