Home Changelog as of October 2, 2021
Post
Cancel

Changelog as of October 2, 2021

Release Highlights

  • Improved setup.cfg packaging
  • Added todo.md at source/openqasm/src/openqasm/translator/tests/todo.md to keep track of required changes in translator
  • Updated Makefiles for easy installation and building grammar
  • Changes in ast.py - LiChen
    • Notable Changes:
      • Fixed NoDesignatorType parsing ub qasn_parser.py
      • Added include statement type in ast.py
      • Consistent use of Identifier and str. Refined QuantumGateDefinition, QuantumWhileLoop, Expression, Identifier, Qubit, FunctionCall, QuantumGate, QuantumMeasurementAssignment, BitType, ComplexType, CalibrationDefinition, SubroutineDefinition, BranchingStatement, BinaryExpression in ast.py
      • Simplified version parsing and formatting
  • Updated test.qasm with basic tests
  • Added support for Identifier and IndexIdentifier subscripts

Update notes

  1. source/openqasm/src/openqasm/translator/context.py -
    • Added modify_symbol to modify given symbol to the context with the provided value
    • Updated assign_value_symbol to accommodate float, bool and ClassicalType
  2. source/openqasm/src/openqasm/translator/translator.py -
    • Updated type imports
  3. source/openqasm/src/openqasm/translator/test.py -
    • Updated type testing. Added testing for return types
    • Functions now use cast instead of coerce
  4. source/openqasm/src/openqasm/translator/identifiers.py -
    • Added get_register
  5. source/openqasm/src/openqasm/translator/expressions.py -
    • Updated import statements
    • Updated _ComputeAssignmentExpressionNamespace _FUNCTIONS dict
  6. source/openqasm/src/openqasm/translator/exceptions.py -
    • Removed ClassicalTypeOverflow
  7. source/openqasm/src/openqasm/translator/types.py -
    • Fixed typing issue for AngleType, UnsignedIntegerType and BitArrayType
    • Update get_typecast and get_typevar to get mapping and instance creation from AST to translator types
    • Fixed get_typecast now checks for variable type before returning a value.
  8. source/openqasm/src/openqasm/build_ast.py -
    • Added testing rountine for adder.qasm. Checks statement type translation, version detection, Listing of for loops
  • Operation support
Type \ Operator=&or^«»~popcountrotlrotr>>=<<===!=&&oror!+-*/%**
BitArrayoooooooooo??????         
SignedIntegero         oooooo   oooooo
UnsignedIntegero         oooooo   oooooo
Floato         oooooo   oooooo
Angleo         oooooo   oooooo
boolo               ooo      
complex[x]o                  oooo ?
  • Type cast support
From \ TobitBitArraySignedIntegerUnsignedIntegerFloatAngleboolcomplex[x]
bitoooo  o 
BitArray ooo ?? 
SignedInteger oo+o+    
UnsignedInteger oo+o+    
Float  ??oo+  
Angle ?   o  
boolo?    o 
complex[x]  ???? o

o+ means that the casts are allowed even between types that do not have the same sizes.

Angles (and integers and floats) cannot be measured

The following code

angle[20] c;
qubit q;

measure q -> c[0];

is ill-formed according to https://qiskit.github.io/openqasm/language/insts.html

  • The statement bit|bit[] = measure qubit|qreg; measures the qubit(s) in the Z-basis and assigns the measurement outcome(s) to the target bit(s).
  • For backwards compatibility this is equivalent to measure qubit|qubit[] -> bit|bit[]; which is also supported.
  • Measurement corresponds to a projection onto one of the eigenstates of , and qubit(s) are immediately available for further quantum computation.
    Both arguments must be register-type, or both must be bit-type.
  • If both arguments are register-type and have the same size, the statement b = measure a; broadcasts to b[j] = measure a[j]; for each index j into register a.
This post is licensed under CC BY 4.0 by the author.