-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added methods to serialize and deserialize quantum data types. * Add serialization and deserialization methods for all data types. Write unit tests to ensure round trip of each datatype using both numeric and sympy inputs. * Update qualtran/protos/data_types.proto Co-authored-by: Tanuj Khattar <tanujkhattar@google.com> * Update Proto:wq * Fixed error formatting * Remove bitsize from QBit * Fixed formatting * Remove uncessesary files * Fix data type in formatted string in error message * Update qualtran/serialization/data_types_test.py * Added Sympy serialization. Sympy expressions can now be serialized through a recursive proto. * Clean up workspace * Remote large tests from get_bloq_examples() * Remove qpe_hubbard_model tests The qpe_hubbard_model is too large to test and causes developer friction. We have disabled the tests for now * Remove qpe_hubbard tests These tests are very large and will cause problems when running. These tests are now disabled. * Cleanup branch * Only remove the serialization tests from the large bloq.s Move the changes from bloq_finder.py to bloq_report_card.py. This way, only the serialization portion of the test is affected. * Address issues with failing sympy tests. Added support for fraction constant parameters. Fixed issue with cwap test assertion which expected sympy in the old string format. * Fix formatting * Fix formatting * Delete Untitled.ipynb Delete scratch notebook * Cleanup after merging local branches. (Old changes were accidentally left in). * Remove changes from PR#849 Rather than building on top of #849, we keep the changes separate. * Fixed assortment of bugs in fraction, and constant symbol serialization * Scratch test * Fixed bad reference to resolver dict by bloq module name. * Minor refactoring * Ran formatting tools * Cleanup forgotten test code. * Add tests, fix naming conventions, and add proper return types. * Update sympy_test.py Call sympy serialization directly rather than calling it through bloq. * Apply suggestions from code review Addressed nit comments. Co-authored-by: Tanuj Khattar <tanujkhattar@google.com> * Fix sympy_test * Fix return type of sympy_expr_from_proto --------- Co-authored-by: Tanuj Khattar <tanujkhattar@google.com>
- Loading branch information
1 parent
7bf19b3
commit c78dd0b
Showing
12 changed files
with
644 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
/* | ||
Copyright 2023 Google LLC | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
https://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
syntax = "proto3"; | ||
package qualtran; | ||
|
||
// A function sympy expression. | ||
enum Function { | ||
// Each Term has an associated function. A "NONE" function means that the term | ||
// is made up of a single parameter and can not be decomposed further. | ||
NONE = 0; | ||
Add = 1; | ||
Mul = 2; | ||
Pow = 3; | ||
Mod = 4; | ||
Log = 5; | ||
Floor = 6; | ||
Ceiling = 7; | ||
Max = 8; | ||
Min = 9; | ||
Sin = 10; | ||
Cos = 11; | ||
Tan = 12; | ||
} | ||
|
||
// Represents a constant, rational number. | ||
message Rational { | ||
Parameter numerator = 1; | ||
Parameter denominator = 2; | ||
} | ||
|
||
enum ConstSymbol { | ||
Pi = 0; | ||
E = 1; | ||
EulerGamma = 2; | ||
Infinity = 3; | ||
ImaginaryUnit = 4; | ||
} | ||
|
||
// A single parameter of a sympy expression. | ||
message Parameter { | ||
oneof parameter { | ||
int32 const_int = 1; | ||
string symbol = 2; | ||
Rational const_rat = 3; | ||
float const_float = 4; | ||
ConstSymbol const_symbol = 5; | ||
|
||
} | ||
} | ||
|
||
message Operand { | ||
oneof operand { | ||
Term term = 1; | ||
Parameter parameter = 2; | ||
} | ||
} | ||
|
||
message Term { | ||
Function function = 1; | ||
repeated Operand operands = 2; | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.