|
Sequential Quantum Gate Decomposer
v1.9.6
Powerful decomposition of general unitarias into one- and two-qubit gates gates
|
Header file for AVX-optimized implementations for applying multi-qubit gate kernels to quantum state vectors and matrices. More...
#include <immintrin.h>#include "matrix.h"#include "matrix_float.h"#include "common.h"#include "apply_large_kernel_to_input.h"

Go to the source code of this file.
Functions | |
| void | apply_2qbit_kernel_to_matrix_input_parallel_AVX_OpenMP (Matrix &two_qbit_unitary, Matrix &input, std::vector< int > involved_qbits, const int &matrix_size) |
| Apply two-qubit gate kernel to an input matrix using AVX optimization and OpenMP parallelization. More... | |
| void | apply_2qbit_kernel_to_matrix_input_parallel_AVX_OpenMP32 (Matrix_float &two_qbit_unitary, Matrix_float &input, std::vector< int > involved_qbits, const int &matrix_size) |
| void | apply_crot_kernel_to_matrix_input_AVX (Matrix &u3_1qbit1, Matrix &u3_qbit2, Matrix &input, const int &target_qbit, const int &control_qbit, const int &matrix_size) |
| Apply controlled rotation (CROT) kernel to a matrix input using AVX optimization. More... | |
| void | apply_crot_kernel_to_matrix_input_AVX32 (Matrix_float &u3_1qbit1, Matrix_float &u3_qbit2, Matrix_float &input, const int &target_qbit, const int &control_qbit, const int &matrix_size) |
| void | apply_crot_kernel_to_matrix_input_AVX_parallel (Matrix &u3_1qbit1, Matrix &u3_1qbit2, Matrix &input, const int &target_qbit, const int &control_qbit, const int &matrix_size) |
| Apply controlled rotation (CROT) kernel to a matrix input using AVX optimization and parallel processing. More... | |
| void | apply_crot_kernel_to_matrix_input_AVX_parallel32 (Matrix_float &u3_1qbit1, Matrix_float &u3_1qbit2, Matrix_float &input, const int &target_qbit, const int &control_qbit, const int &matrix_size) |
| void | apply_crot_kernel_to_matrix_input_from_right_AVX (Matrix &u3_1qbit1, Matrix &u3_qbit2, Matrix &input, const int &target_qbit, const int &control_qbit, const int &matrix_size) |
| void | apply_crot_kernel_to_matrix_input_from_right_AVX32 (Matrix_float &u3_1qbit1, Matrix_float &u3_qbit2, Matrix_float &input, const int &target_qbit, const int &control_qbit, const int &matrix_size) |
| void | apply_crot_kernel_to_matrix_input_from_right_AVX_parallel (Matrix &u3_1qbit1, Matrix &u3_1qbit2, Matrix &input, const int &target_qbit, const int &control_qbit, const int &matrix_size) |
| void | apply_crot_kernel_to_matrix_input_from_right_AVX_parallel32 (Matrix_float &u3_1qbit1, Matrix_float &u3_1qbit2, Matrix_float &input, const int &target_qbit, const int &control_qbit, const int &matrix_size) |
| void | apply_large_kernel_from_right_AVX (Matrix &unitary, Matrix &input, std::vector< int > involved_qbits, const int &matrix_size) |
| void | apply_large_kernel_from_right_AVX32 (Matrix_float &unitary, Matrix_float &input, std::vector< int > involved_qbits, const int &matrix_size) |
| void | apply_large_kernel_from_right_AVX_OpenMP (Matrix &unitary, Matrix &input, std::vector< int > involved_qbits, const int &matrix_size) |
| void | apply_large_kernel_from_right_AVX_OpenMP32 (Matrix_float &unitary, Matrix_float &input, std::vector< int > involved_qbits, const int &matrix_size) |
| void | apply_large_kernel_from_right_AVX_TBB (Matrix &unitary, Matrix &input, std::vector< int > involved_qbits, const int &matrix_size) |
| void | apply_large_kernel_from_right_AVX_TBB32 (Matrix_float &unitary, Matrix_float &input, std::vector< int > involved_qbits, const int &matrix_size) |
| void | apply_large_kernel_to_input_AVX (Matrix &unitary, Matrix &input, std::vector< int > involved_qbits, const int &matrix_size) |
| Apply multi-qubit gate kernel to an input matrix using AVX optimization. More... | |
| void | apply_large_kernel_to_input_AVX32 (Matrix_float &unitary, Matrix_float &input, std::vector< int > involved_qbits, const int &matrix_size) |
| void | apply_large_kernel_to_input_AVX_OpenMP (Matrix &unitary, Matrix &input, std::vector< int > involved_qbits, const int &matrix_size) |
| Apply multi-qubit gate kernel to an input matrix using AVX optimization and OpenMP parallelization. More... | |
| void | apply_large_kernel_to_input_AVX_OpenMP32 (Matrix_float &unitary, Matrix_float &input, std::vector< int > involved_qbits, const int &matrix_size) |
| void | apply_large_kernel_to_input_AVX_TBB (Matrix &unitary, Matrix &input, std::vector< int > involved_qbits, const int &matrix_size) |
| Apply multi-qubit gate kernel to an input matrix using AVX optimization and TBB parallelization. More... | |
| void | apply_large_kernel_to_input_AVX_TBB32 (Matrix_float &unitary, Matrix_float &input, std::vector< int > involved_qbits, const int &matrix_size) |
| __m256d | complex_mult_AVX (__m256d input_vec, __m256d unitary_row_vec, __m256d neg) |
| Perform complex multiplication using AVX intrinsics. More... | |
| __m256d * | construct_mv_xy_vectors (const Matrix &gate_kernel_unitary, const int &matrix_size) |
| Precompute AVX vectors for the unitary matrix to optimize complex multiplication. More... | |
| __m256d | get_AVX_vector (double *element_outer, double *element_inner) |
| Helper function to load and prepare AVX vectors with outer and inner elements for complex multiplication. More... | |
| void | get_block_indices (int N, const std::vector< int > &tq, const std::vector< int > &non_targets, int iter_idx, std::vector< int > &indices) |
| Compute the indices for a given block in the quantum state. More... | |
| void | get_block_indices_fast (int iter_idx, const std::vector< int > &target_qubits, const std::vector< int > &non_targets, const std::vector< int > &block_pattern, std::vector< int > &indices) |
| Efficiently compute the indices for a given block using precomputed patterns. More... | |
| void | precompute_index_mapping (const std::vector< int > &target_qubits, const std::vector< int > &non_targets, std::vector< int > &block_pattern) |
| Precompute the index mapping for target and non-target qubits. More... | |
Header file for AVX-optimized implementations for applying multi-qubit gate kernels to quantum state vectors and matrices.
Definition in file apply_large_kernel_to_input_AVX.h.
| void apply_2qbit_kernel_to_matrix_input_parallel_AVX_OpenMP | ( | Matrix & | two_qbit_unitary, |
| Matrix & | input, | ||
| std::vector< int > | involved_qbits, | ||
| const int & | matrix_size | ||
| ) |
Apply two-qubit gate kernel to an input matrix using AVX optimization and OpenMP parallelization.
| two_qbit_unitary | The 4x4 unitary matrix representing the two-qubit gate operation |
| input | The input matrix on which the transformation is applied |
| involved_qbits | The qubits involved in the gate operation (2 qubits) |
| matrix_size | The size of the input matrix (should be a power of 2) |
Definition at line 3520 of file apply_large_kernel_to_input_AVX.cpp.


| void apply_2qbit_kernel_to_matrix_input_parallel_AVX_OpenMP32 | ( | Matrix_float & | two_qbit_unitary, |
| Matrix_float & | input, | ||
| std::vector< int > | involved_qbits, | ||
| const int & | matrix_size | ||
| ) |
Definition at line 5960 of file apply_large_kernel_to_input_AVX.cpp.
| void apply_crot_kernel_to_matrix_input_AVX | ( | Matrix & | u3_1qbit1, |
| Matrix & | u3_1qbit2, | ||
| Matrix & | input, | ||
| const int & | target_qbit, | ||
| const int & | control_qbit, | ||
| const int & | matrix_size | ||
| ) |
Apply controlled rotation (CROT) kernel to a matrix input using AVX optimization.
| u3_1qbit1 | The U3 gate matrix for the first qubit |
| u3_qbit2 | The U3 gate matrix for the second qubit |
| input | The input matrix on which the transformation is applied |
| target_qbit | The target qubit index |
| control_qbit | The control qubit index |
| matrix_size | The size of the input matrix (should be a power of 2) |
Apply controlled rotation (CROT) kernel to a matrix input using AVX optimization.
| u3_1qbit1 | The 2x2 kernel to be applied on target |1> |
| u3_1qbit2 | The 2x2 kernel to be applied on target |0> |
| input | The input matrix on which the transformation is applied |
| target_qbit | The target qubit |
| control_qbit | The control qubit |
| matrix_size | The size of the input |
Definition at line 3617 of file apply_large_kernel_to_input_AVX.cpp.


| void apply_crot_kernel_to_matrix_input_AVX32 | ( | Matrix_float & | u3_1qbit1, |
| Matrix_float & | u3_qbit2, | ||
| Matrix_float & | input, | ||
| const int & | target_qbit, | ||
| const int & | control_qbit, | ||
| const int & | matrix_size | ||
| ) |
Definition at line 6160 of file apply_large_kernel_to_input_AVX.cpp.

| void apply_crot_kernel_to_matrix_input_AVX_parallel | ( | Matrix & | u3_1qbit1, |
| Matrix & | u3_1qbit2, | ||
| Matrix & | input, | ||
| const int & | target_qbit, | ||
| const int & | control_qbit, | ||
| const int & | matrix_size | ||
| ) |
Apply controlled rotation (CROT) kernel to a matrix input using AVX optimization and parallel processing.
| u3_1qbit1 | The U3 gate matrix for the first qubit |
| u3_1qbit2 | The U3 gate matrix for the second qubit |
| input | The input matrix on which the transformation is applied |
| target_qbit | The target qubit index |
| control_qbit | The control qubit index |
| matrix_size | The size of the input matrix (should be a power of 2) |
Apply controlled rotation (CROT) kernel to a matrix input using AVX optimization and parallel processing.
| u3_1qbit1 | The 2x2 kernel to be applied on target |1> |
| u3_1qbit2 | The 2x2 kernel to be applied on target |0> |
| input | The input matrix on which the transformation is applied |
| target_qbit | The target qubit |
| control_qbit | The control qubit |
| matrix_size | The size of the input |
Definition at line 3836 of file apply_large_kernel_to_input_AVX.cpp.


| void apply_crot_kernel_to_matrix_input_AVX_parallel32 | ( | Matrix_float & | u3_1qbit1, |
| Matrix_float & | u3_1qbit2, | ||
| Matrix_float & | input, | ||
| const int & | target_qbit, | ||
| const int & | control_qbit, | ||
| const int & | matrix_size | ||
| ) |
Definition at line 6000 of file apply_large_kernel_to_input_AVX.cpp.

| void apply_crot_kernel_to_matrix_input_from_right_AVX | ( | Matrix & | u3_1qbit1, |
| Matrix & | u3_qbit2, | ||
| Matrix & | input, | ||
| const int & | target_qbit, | ||
| const int & | control_qbit, | ||
| const int & | matrix_size | ||
| ) |
Definition at line 4089 of file apply_large_kernel_to_input_AVX.cpp.


| void apply_crot_kernel_to_matrix_input_from_right_AVX32 | ( | Matrix_float & | u3_1qbit1, |
| Matrix_float & | u3_qbit2, | ||
| Matrix_float & | input, | ||
| const int & | target_qbit, | ||
| const int & | control_qbit, | ||
| const int & | matrix_size | ||
| ) |
Definition at line 6203 of file apply_large_kernel_to_input_AVX.cpp.


| void apply_crot_kernel_to_matrix_input_from_right_AVX_parallel | ( | Matrix & | u3_1qbit1, |
| Matrix & | u3_1qbit2, | ||
| Matrix & | input, | ||
| const int & | target_qbit, | ||
| const int & | control_qbit, | ||
| const int & | matrix_size | ||
| ) |
Definition at line 4217 of file apply_large_kernel_to_input_AVX.cpp.


| void apply_crot_kernel_to_matrix_input_from_right_AVX_parallel32 | ( | Matrix_float & | u3_1qbit1, |
| Matrix_float & | u3_1qbit2, | ||
| Matrix_float & | input, | ||
| const int & | target_qbit, | ||
| const int & | control_qbit, | ||
| const int & | matrix_size | ||
| ) |
Definition at line 6060 of file apply_large_kernel_to_input_AVX.cpp.

| void apply_large_kernel_from_right_AVX | ( | Matrix & | unitary, |
| Matrix & | input, | ||
| std::vector< int > | involved_qbits, | ||
| const int & | matrix_size | ||
| ) |
Definition at line 5568 of file apply_large_kernel_to_input_AVX.cpp.


| void apply_large_kernel_from_right_AVX32 | ( | Matrix_float & | unitary, |
| Matrix_float & | input, | ||
| std::vector< int > | involved_qbits, | ||
| const int & | matrix_size | ||
| ) |
Definition at line 5610 of file apply_large_kernel_to_input_AVX.cpp.


| void apply_large_kernel_from_right_AVX_OpenMP | ( | Matrix & | unitary, |
| Matrix & | input, | ||
| std::vector< int > | involved_qbits, | ||
| const int & | matrix_size | ||
| ) |
Definition at line 5582 of file apply_large_kernel_to_input_AVX.cpp.

| void apply_large_kernel_from_right_AVX_OpenMP32 | ( | Matrix_float & | unitary, |
| Matrix_float & | input, | ||
| std::vector< int > | involved_qbits, | ||
| const int & | matrix_size | ||
| ) |
Definition at line 5624 of file apply_large_kernel_to_input_AVX.cpp.

| void apply_large_kernel_from_right_AVX_TBB | ( | Matrix & | unitary, |
| Matrix & | input, | ||
| std::vector< int > | involved_qbits, | ||
| const int & | matrix_size | ||
| ) |
Definition at line 5596 of file apply_large_kernel_to_input_AVX.cpp.


| void apply_large_kernel_from_right_AVX_TBB32 | ( | Matrix_float & | unitary, |
| Matrix_float & | input, | ||
| std::vector< int > | involved_qbits, | ||
| const int & | matrix_size | ||
| ) |
Definition at line 5638 of file apply_large_kernel_to_input_AVX.cpp.


| void apply_large_kernel_to_input_AVX | ( | Matrix & | unitary, |
| Matrix & | input, | ||
| std::vector< int > | involved_qbits, | ||
| const int & | matrix_size | ||
| ) |
Apply multi-qubit gate kernel to an input matrix using AVX optimization.
| unitary | The 2^Nx2^N unitary matrix representing the gate operation |
| input | The input matrix on which the transformation is applied |
| involved_qbits | The qubits involved in the gate operation |
| matrix_size | The size of the input matrix (should be a power of 2) |
Definition at line 90 of file apply_large_kernel_to_input_AVX.cpp.


| void apply_large_kernel_to_input_AVX32 | ( | Matrix_float & | unitary, |
| Matrix_float & | input, | ||
| std::vector< int > | involved_qbits, | ||
| const int & | matrix_size | ||
| ) |
Definition at line 4345 of file apply_large_kernel_to_input_AVX.cpp.


| void apply_large_kernel_to_input_AVX_OpenMP | ( | Matrix & | unitary, |
| Matrix & | input, | ||
| std::vector< int > | involved_qbits, | ||
| const int & | matrix_size | ||
| ) |
Apply multi-qubit gate kernel to an input matrix using AVX optimization and OpenMP parallelization.
| unitary | The 2^Nx2^N unitary matrix representing the gate operation |
| input | The input matrix on which the transformation is applied |
| involved_qbits | The qubits involved in the gate operation |
| matrix_size | The size of the input matrix (should be a power of 2) |
Definition at line 145 of file apply_large_kernel_to_input_AVX.cpp.


| void apply_large_kernel_to_input_AVX_OpenMP32 | ( | Matrix_float & | unitary, |
| Matrix_float & | input, | ||
| std::vector< int > | involved_qbits, | ||
| const int & | matrix_size | ||
| ) |
Definition at line 4389 of file apply_large_kernel_to_input_AVX.cpp.


| void apply_large_kernel_to_input_AVX_TBB | ( | Matrix & | unitary, |
| Matrix & | input, | ||
| std::vector< int > | involved_qbits, | ||
| const int & | matrix_size | ||
| ) |
Apply multi-qubit gate kernel to an input matrix using AVX optimization and TBB parallelization.
| unitary | The 2^Nx2^N unitary matrix representing the gate operation |
| input | The input matrix on which the transformation is applied |
| involved_qbits | The qubits involved in the gate operation |
| matrix_size | The size of the input matrix (should be a power of 2) |
Definition at line 373 of file apply_large_kernel_to_input_AVX.cpp.


| void apply_large_kernel_to_input_AVX_TBB32 | ( | Matrix_float & | unitary, |
| Matrix_float & | input, | ||
| std::vector< int > | involved_qbits, | ||
| const int & | matrix_size | ||
| ) |
Definition at line 4433 of file apply_large_kernel_to_input_AVX.cpp.


|
inline |
Perform complex multiplication using AVX intrinsics.
| input_vec | AVX vector containing the input complex number (real and imaginary parts) |
| unitary_row_vec | AVX vector containing the unitary matrix row element (real and imaginary parts) |
| neg | AVX vector containing sign pattern for complex multiplication |
Definition at line 62 of file apply_large_kernel_to_input_AVX.cpp.


|
inline |
Precompute AVX vectors for the unitary matrix to optimize complex multiplication.
| gate_kernel_unitary | The unitary matrix of the gate operation |
| matrix_size | The size of the unitary matrix |
Precompute AVX vectors for the unitary matrix to optimize complex multiplication.
| input | The input matrix to be updated |
| new_block_real | The real parts of the new block |
| new_block_imag | The imaginary parts of the new block |
| indices | The indices where the new block should be written Precompute AVX vectors for the unitary matrix to optimize complex multiplication |
| gate_kernel_unitary | The unitary matrix of the gate operation |
| matrix_size | The size of the unitary matrix |
Definition at line 481 of file apply_large_kernel_to_input_AVX.cpp.

|
inline |
Helper function to load and prepare AVX vectors with outer and inner elements for complex multiplication.
| element_outer | Pointer to the outer element (real and imaginary parts) |
| element_inner | Pointer to the inner element (real and imaginary parts) |
Definition at line 43 of file apply_large_kernel_to_input_AVX.cpp.

|
inline |
Compute the indices for a given block in the quantum state.
| N | The number of qubits |
| tq | The target qubits involved in the gate operation |
| non_targets | The qubits not involved in the gate operation |
| iter_idx | The current iteration index |
| indices | The computed indices for the current block (output parameter) |
|
inline |
Efficiently compute the indices for a given block using precomputed patterns.
| iter_idx | The current iteration index |
| target_qubits | The qubits involved in the gate operation |
| non_targets | The qubits not involved in the gate operation |
| block_pattern | The precomputed index mapping |
| indices | The computed indices for the current block (output parameter) |
| iter_idx | The current iteration index |
| target_qubits | The qubits involved in the gate operation |
| non_targets | The qubits not involved in the gate operation |
| block_pattern | The precomputed index mapping |
| indices | The computed indices for the current block |
Definition at line 451 of file apply_large_kernel_to_input_AVX.cpp.

| void precompute_index_mapping | ( | const std::vector< int > & | target_qubits, |
| const std::vector< int > & | non_targets, | ||
| std::vector< int > & | block_pattern | ||
| ) |
Precompute the index mapping for target and non-target qubits.
| target_qubits | The qubits involved in the gate operation |
| non_targets | The qubits not involved in the gate operation |
| block_pattern | The precomputed index mapping (output parameter) |
Definition at line 426 of file apply_large_kernel_to_input_AVX.cpp.

1.8.13