Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Update Data Class as specified in Issue #27
This PR refactors the
Data
class to align with the specifications outlined in the corresponded issue. The following modifications have been made:Main Changes:
Attributes:
qubits
,depth
, andactivation_matrices
now store and manage the circuit's parameters and activation matrices as described.data.json
and supports the storage of converted matrices.Methods:
get_data()
: Loadsqubits
,depth
, andactivation_matrices
fromdata.json
. Returns error codes ifdata.json
ortrain.json
are missing.return_matrices()
: Validates and returns activation matrices with the expected properties; returns an error code if validation fails.convert_matrices()
: Converts each activation matrix by combining values from three pages into a flattened format, following the required structure.check_final_matrix()
: Checks matrix dimensions to ensure they match the required(qubits, depth * 3)
format.create_training_matrix()
: Generates a training matrix with randomized values, validates dimensions, and saves it totrain.json
.Additional Changes:
pytest
to ensure functionality and handle edge cases:Fixes #27