1+ /*
2+ * Copyright (c) 2023 - 2025 Chair for Design Automation, TUM
3+ * Copyright (c) 2025 Munich Quantum Software Company GmbH
4+ * All rights reserved.
5+ *
6+ * SPDX-License-Identifier: MIT
7+ *
8+ * Licensed under the MIT License
9+ */
10+
111#include < array>
212#include < complex>
313#include < iomanip>
@@ -32,7 +42,7 @@ matrix4x4 zgemm2(matrix4x4 a, matrix4x4 b) {
3242 qfp z__1;
3343 qfp z__2;
3444 qfp temp;
35- qfp alpha {1.0 , 0.0 };
45+ qfp alpha{1.0 , 0.0 };
3646 for (auto j = 0 ; j < i__1; ++j) {
3747 for (auto i__ = 0 ; i__ < 4 ; ++i__) {
3848 auto i__3 = i__ + j * 4 ;
@@ -71,18 +81,17 @@ matrix4x4 zgemm2(matrix4x4 a, matrix4x4 b) {
7181}
7282
7383int zgemm_ (char * transa, char * transb, integer* m, integer* n, integer* k,
74- doublecomplex* alpha, matrix4x4 a, integer* lda,
75- matrix4x4 b, integer* ldb, doublecomplex* beta,
76- matrix4x4& c__, integer* ldc);
84+ doublecomplex* alpha, matrix4x4 a, integer* lda, matrix4x4 b,
85+ integer* ldb, doublecomplex* beta, matrix4x4& c__, integer* ldc);
7786matrix4x4 zgemm (matrix4x4 a, matrix4x4 b) {
7887 qfp alpha{1.0 , 0.0 };
7988 qfp beta{1.0 , 0.0 };
8089 int dimension = 4 ;
8190 matrix4x4 result{};
8291 // zgemm_("n", "n", &dimension, &dimension, &dimension, &alpha, a.data(),
8392 // &dimension, b.data(), &dimension, &beta, result.data(), &dimension);
84- zgemm_ (" N" , " N" , &dimension, &dimension, &dimension, &alpha, a,
85- &dimension, b, &dimension, &beta, result, &dimension);
93+ zgemm_ (" N" , " N" , &dimension, &dimension, &dimension, &alpha, a, &dimension, b,
94+ &dimension, &beta, result, &dimension);
8695 return result;
8796}
8897
@@ -91,8 +100,7 @@ void d_cnjg(doublecomplex* r, doublecomplex* z) { *r = std::conj(*z); }
91100/* Subroutine */ int zgemm_ (char * transa, char * transb, integer* m, integer* n,
92101 integer* k, doublecomplex* alpha, matrix4x4 a,
93102 integer* lda, matrix4x4 b, integer* ldb,
94- doublecomplex* beta, matrix4x4& c__,
95- integer* ldc) {
103+ doublecomplex* beta, matrix4x4& c__, integer* ldc) {
96104 /* System generated locals */
97105 integer a_dim1, a_offset, b_dim1, b_offset, c_dim1, c_offset, i__1, i__2,
98106 i__3, i__4, i__5, i__6;
@@ -360,14 +368,16 @@ void d_cnjg(doublecomplex* r, doublecomplex* z) { *r = std::conj(*z); }
360368 beta->imag () * c__[i__4 - c_offset].imag ()),
361369 z__1.imag (beta->real () * c__[i__4 - c_offset].imag () +
362370 beta->imag () * c__[i__4 - c_offset].real ());
363- c__[i__3 - c_offset].real (z__1.real ()), c__[i__3 - c_offset].imag (z__1.imag ());
371+ c__[i__3 - c_offset].real (z__1.real ()),
372+ c__[i__3 - c_offset].imag (z__1.imag ());
364373 /* L60: */
365374 }
366375 }
367376 i__2 = *k;
368377 for (l = 1 ; l <= i__2; ++l) {
369378 i__3 = l + j * b_dim1;
370- if (b[i__3 - b_offset].real () != 0 . || b[i__3 - b_offset].imag () != 0 .) {
379+ if (b[i__3 - b_offset].real () != 0 . ||
380+ b[i__3 - b_offset].imag () != 0 .) {
371381 i__3 = l + j * b_dim1;
372382 z__1.real (alpha->real () * b[i__3 - b_offset].real () -
373383 alpha->imag () * b[i__3 - b_offset].imag ()),
@@ -385,7 +395,8 @@ void d_cnjg(doublecomplex* r, doublecomplex* z) { *r = std::conj(*z); }
385395 temp.imag () * a[i__6 - a_offset].real ());
386396 z__1.real (c__[i__5 - c_offset].real () + z__2.real ()),
387397 z__1.imag (c__[i__5 - c_offset].imag () + z__2.imag ());
388- c__[i__4 - c_offset].real (z__1.real ()), c__[i__4 - c_offset].imag (z__1.imag ());
398+ c__[i__4 - c_offset].real (z__1.real ()),
399+ c__[i__4 - c_offset].imag (z__1.imag ());
389400 /* L70: */
390401 }
391402 }
@@ -421,7 +432,8 @@ void d_cnjg(doublecomplex* r, doublecomplex* z) { *r = std::conj(*z); }
421432 alpha->imag () * temp.imag ()),
422433 z__1.imag (alpha->real () * temp.imag () +
423434 alpha->imag () * temp.real ());
424- c__[i__3 - c_offset].real (z__1.real ()), c__[i__3 - c_offset].imag (z__1.imag ());
435+ c__[i__3 - c_offset].real (z__1.real ()),
436+ c__[i__3 - c_offset].imag (z__1.imag ());
425437 } else {
426438 i__3 = i__ + j * c_dim1;
427439 z__2.real (alpha->real () * temp.real () -
@@ -435,7 +447,8 @@ void d_cnjg(doublecomplex* r, doublecomplex* z) { *r = std::conj(*z); }
435447 beta->imag () * c__[i__4 - c_offset].real ());
436448 z__1.real (z__2.real () + z__3.real ()),
437449 z__1.imag (z__2.imag () + z__3.imag ());
438- c__[i__3 - c_offset].real (z__1.real ()), c__[i__3 - c_offset].imag (z__1.imag ());
450+ c__[i__3 - c_offset].real (z__1.real ()),
451+ c__[i__3 - c_offset].imag (z__1.imag ());
439452 }
440453 /* L110: */
441454 }
0 commit comments