-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1515 from CQCL/main
update docs
- Loading branch information
Showing
19 changed files
with
190 additions
and
2,479 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -103,7 +103,7 @@ jobs: | |
uses: slackapi/[email protected] | ||
with: | ||
channel-id: 'G01CP0YFFA7' | ||
slack-message: '${{ env.RETURN_TEST }}' | ||
slack-message: '${{ env.RETURN_TEST }} Release tag: ${{ github.event.release.tag_name }}.' | ||
env: | ||
SLACK_BOT_TOKEN: ${{ secrets.PYTKET_BENCHMARKING_SLACK_BOT_TOKEN }} | ||
RETURN_TEST: ${{ env.RETURN_TEST }} |
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
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
This file was deleted.
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<!-- Download Vue 3--> | ||
<script type="application/javascript" src="https://cdn.jsdelivr.net/npm/vue@3"></script> | ||
<!-- Download Circuit Renderer with styles --> | ||
<script type="application/javascript" src="https://unpkg.com/pytket-circuit-renderer@0.8/dist/pytket-circuit-renderer.umd.js"></script> | ||
<script type="application/javascript" src="https://unpkg.com/pytket-circuit-renderer@0.9/dist/pytket-circuit-renderer.umd.js"></script> | ||
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/pytket-circuit-renderer.css"> |
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,43 @@ | ||
# Copyright 2019-2024 Cambridge Quantum Computing | ||
# | ||
# 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 | ||
# | ||
# http://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. | ||
|
||
from pytket.unit_id import _TEMP_BIT_NAME | ||
from pytket.circuit import Circuit, Bit | ||
from .._tket.passes import BasePass, CustomPass | ||
|
||
MAX_C_REG_WIDTH = 32 | ||
|
||
|
||
def _is_scratch(bit: Bit) -> bool: | ||
reg_name = bit.reg_name | ||
return bool(reg_name == _TEMP_BIT_NAME) or reg_name.startswith(f"{_TEMP_BIT_NAME}_") | ||
|
||
|
||
def scratch_reg_resize_pass(max_size: int = MAX_C_REG_WIDTH) -> BasePass: | ||
"""Given a max scratch register width, return a compiler pass that | ||
breaks up the internal scratch bit registers into smaller registers | ||
""" | ||
|
||
def trans(circ: Circuit, max_size: int = max_size) -> Circuit: | ||
# Find all scratch bits | ||
scratch_bits = list(filter(_is_scratch, circ.bits)) | ||
# If the total number of scratch bits exceeds the max width, rename them | ||
if len(scratch_bits) > max_size: | ||
bits_map = {} | ||
for i, bit in enumerate(scratch_bits): | ||
bits_map[bit] = Bit(f"{_TEMP_BIT_NAME}_{i//max_size}", i % max_size) | ||
circ.rename_units(bits_map) # type: ignore | ||
return circ | ||
|
||
return CustomPass(trans, label="resize scratch bits") |
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
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