Skip to content

[FEATURE] Refactor maps.py#106

Merged
TheGupta2012 merged 5 commits intoqBraid:mainfrom
ashmitjsg:main
Dec 14, 2024
Merged

[FEATURE] Refactor maps.py#106
TheGupta2012 merged 5 commits intoqBraid:mainfrom
ashmitjsg:main

Conversation

@ashmitjsg
Copy link
Copy Markdown
Contributor

Resolves #98

Summary of changes

This PR refactors maps.py to segregate gates and expressions related to functions and constants. It replaces the maps.py file with two new files, gates.py and expressions.py, stored in the maps folder. The segregation done is as follows:

/src/pyqasm/map/__init__.py:

  • OperatorFunction
  • SWITCH_BLACKLIST_STMTS
  • SUPPORTED_QASM_VERSIONS
  • QUANTUM_STATEMENTS

/src/pyqasm/map/gates.py:

  • u3_gate
  • u3_inv_gate
  • u2_gate
  • u2_inv_gate
  • global_phase_gate
  • sxdg_gate_op
  • cy_gate
  • ch_gate
  • xy_gate
  • xx_plus_yy_gate
  • ryy_gate
  • zz_gate
  • phaseshift_gate
  • cswap_gate
  • pswap_gate
  • iswap_gate
  • crx_gate
  • cry_gate
  • crz_gate
  • cu_gate
  • cu3_gate
  • cu1_gate
  • csx_gate
  • rxx_gate
  • rccx_gate
  • rzz_gate
  • cphaseshift_gate
  • cphaseshift00_gate
  • cphaseshift01_gate
  • cphaseshift10_gate
  • gpi_gate
  • gpi2_gate
  • ms_gate
  • ccx_gate_op
  • ecr_gate
  • c3sx_gate
  • c4x_gate
  • prx_gate
  • one_qubit_gate_op
  • one_qubit_rotation_op
  • two_qubit_gate_op
  • map_qasm_op_to_callable
  • map_qasm_inv_op_to_callable

/src/pyqasm/map/constants.py:

  • OPERATOR_MAP
  • ONE_QUBIT_OP_MAP
  • ONE_QUBIT_ROTATION_MAP
  • TWO_QUBIT_OP_MAP
  • THREE_QUBIT_OP_MAP
  • FOUR_QUBIT_OP_MAP
  • FIVE_QUBIT_OP_MAP
  • SELF_INVERTING_ONE_QUBIT_OP_SET
  • ST_GATE_INV_MAP
  • ROTATION_INVERSION_ONE_QUBIT_OP_MAP
  • U_INV_ROTATION_MAP

/src/pyqasm/map/expressions.py:

  • LIMITS_MAP
  • CONSTANTS_MAP
  • VARIABLE_TYPE_MAP
  • VARIABLE_TYPE_CAST_MAP
  • ARRAY_TYPE_MAP
  • MAX_ARRAY_DIMENSIONS
  • qasm3_expression_op_map
  • qasm_variable_type_cast

@ashmitjsg ashmitjsg changed the title refactored … [FEATURE] refactor maps.py Dec 10, 2024
@ashmitjsg ashmitjsg changed the title [FEATURE] refactor maps.py [FEATURE] Refactor maps.py Dec 10, 2024
Copy link
Copy Markdown
Member

@TheGupta2012 TheGupta2012 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, thanks for the changes! I've added some comments but other than that looks good.

Comment thread src/pyqasm/expressions.py Outdated
Comment thread src/pyqasm/maps/__init__.py Outdated
Comment thread src/pyqasm/maps/gates.py Outdated
Comment thread src/pyqasm/maps/gates.py Outdated
Copy link
Copy Markdown
Member

@TheGupta2012 TheGupta2012 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on the suggestions! Changes lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Refactor maps.py

2 participants