Utils
Here we define some support functions.
- vulqano.utils.check_circuit_equivalence(circuit_1, circuit_2)[source]
Checks if two circuits are equivalent: ||U1 U2^(-1) - 1||_F < 10^(1-precision). Based on Qiskit.
Arguments
- circuit_1AbstractCircuitState
Matrix of the Input circuit 1.
- circuit_2AbstractCircuitState
Input circuit 2.
Returns
- is_equivalentbool
True if the two circuit are equivalent.
- vulqano.utils.save_to_json(dictionary, path, file_name)[source]
Saves the object var object to a Json file.
Arguments
- varobject
Object to be saved.
- pathstr
Destination path.
- namestr
File name.
Returns
None.
- vulqano.utils.var_to_md5(var, digits=5)[source]
Generates the first digits of the md5 of str(var), as a string. Useful for generating unique filenames.
Arguments
- varobject
Any object having a __str__ method.
- digitsint, optional
Number of digits to be returned.
Returns
: string First “digits” digits of the md5 of str(var), as a string.