]> foleosoft.com Git - QAnsel.git/commitdiff
Mon Mar 4 06:03:36 PM EST 2024
authormiha-q <>
Mon, 4 Mar 2024 23:03:36 +0000 (18:03 -0500)
committermiha-q <>
Mon, 4 Mar 2024 23:03:36 +0000 (18:03 -0500)
src/QAnsel.c

index bc29e5b047cbc2bd613f9711a1ef42d1f0c5a678..df82734fcef87815b04c4ad41edc97fde28dbb21 100644 (file)
@@ -228,22 +228,21 @@ void qansel_instruction(cpx_mtx_t* stateVector, unsigned char qubitCount, QInstr
                us2 = get_time();
                printf("\tBare: %lu\n", us2 - us1);
                #else
-//             if (USE_GPU && 0)
-//             {
-//                     cpx_mtx_knk_metal(tmp.ptr, filter.ptr, gate.ptr, filter.rows, filter.cols, gate.rows, gate.cols);
-//             }
-//             else if (USE_THREADS)
-//             {
-//                     cpx_mtx_knk_threads(tmp.ptr, filter.ptr, gate.ptr, filter.rows, filter.cols, gate.rows, gate.cols);
-//             }
-//             else
-//             {
-//                     cpx_mtx_knk(tmp.ptr, filter.ptr, gate.ptr, filter.rows, filter.cols, gate.rows, gate.cols);
-//             }
-
+               if (USE_GPU && 0)
+               {
+                       cpx_mtx_knk_metal(tmp.ptr, filter.ptr, gate.ptr, filter.rows, filter.cols, gate.rows, gate.cols);
+               }
+               else if (USE_THREADS)
+               {
                        cpx_mtx_knk_threads(tmp.ptr, filter.ptr, gate.ptr, filter.rows, filter.cols, gate.rows, gate.cols);
+               }
+               else
+               {
+                       cpx_mtx_knk(tmp.ptr, filter.ptr, gate.ptr, filter.rows, filter.cols, gate.rows, gate.cols);
+               }
                #endif
 
+
                free(filter.ptr);
                filter.ptr = tmp.ptr;
                filter.rows = tmp.rows;
@@ -268,7 +267,18 @@ void qansel_instruction(cpx_mtx_t* stateVector, unsigned char qubitCount, QInstr
        us2 = get_time();
        printf("\tBare: %lu\n", us2 - us1);
        #else
+       if (USE_GPU)
+       {
+               cpx_mtx_dot_metal(tmp.ptr, stateVector->ptr, filter.ptr, stateVector->rows, stateVector->cols, filter.rows, filter.cols);
+       }
+       else if (USE_THREADS)
+       {
                cpx_mtx_dot_threads(tmp.ptr, stateVector->ptr, filter.ptr, stateVector->rows, stateVector->cols, filter.rows, filter.cols);
+       }
+       else
+       {
+               cpx_mtx_dot(tmp.ptr, stateVector->ptr, filter.ptr, stateVector->rows, stateVector->cols, filter.rows, filter.cols);
+       }
        #endif
        free(stateVector->ptr);
        stateVector->ptr = tmp.ptr;