Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pulse_lib
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
QuTech QDLabs
pulse_lib
Commits
ea2e3d89
Commit
ea2e3d89
authored
3 years ago
by
Sander Snoo
Browse files
Options
Downloads
Patches
Plain Diff
Fix
parent
e67fe6f8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pulse_lib/virtual_matrix/virtual_gate_matrices.py
+25
-7
25 additions, 7 deletions
pulse_lib/virtual_matrix/virtual_gate_matrices.py
with
25 additions
and
7 deletions
pulse_lib/virtual_matrix/virtual_gate_matrices.py
+
25
−
7
View file @
ea2e3d89
...
...
@@ -18,17 +18,18 @@ class VirtualGateMatrices:
v_gates
=
[]
for
vm
in
self
.
_virtual_matrices
.
values
():
v_gates
+=
vm
.
virtual_gates
print
(
'''
this is just a stupid
test.
'''
)
return
v_gates
@property
def
virtual_gate_
map
(
self
):
def
virtual_gate_
projection
(
self
):
'''
Returns a dictionary with per virtual gate name a dictionary
with real gate names and multipliers.
Example:
'
vP1
'
: {
'
P1
'
: 1.0,
'
P2
'
: -0.12},
'
vP2
'
: {
'
P1
'
: -0.10,
'
P2
'
: 1.0},
'''
# create dictionary with all v_gates and their matrix
#
first
create dictionary with all v_gates and their matrix
v_gates
=
{}
for
vm
in
self
.
_virtual_matrices
.
values
():
for
gate
in
vm
.
virtual_gates
:
...
...
@@ -46,7 +47,21 @@ class VirtualGateMatrices:
filter_undefined
=
False
,
keep_squared
=
False
,
awg_channels
=
[]):
'''
Adds a virtual gate matrix.
A real gate name must either be AWG channel or an already defined
virtual gate name of another matrix.
Args:
name (str): name of the virtual gate matrix.
real_gate_names (list[str]): names of real gates
virtual_gate_names (list[str]): names of virtual gates
matrix (2D array-like): matrix to convert voltages of virtual gates to voltages of real gates.
real2virtual (bool): If True v_real = M^-1 @ v_virtual else v_real = M @ v_virtual
filter_undefined (bool): If True removes rows with unknown real gates.
keep_squared (bool): matrix is square and should be kept square when valid_indices is used.
awg_channels (list[str]): names of the AWG channels.
'''
if
name
in
self
.
_virtual_matrices
:
del
self
.
_virtual_matrices
[
name
]
...
...
@@ -108,6 +123,9 @@ class VirtualGateMatrices:
def
_get_combination
(
self
,
gate
,
v_gates
):
'''
Resolves virtual gate to real gate projection.
'''
vm
=
v_gates
[
gate
]
iv
=
vm
.
virtual_gates
.
index
(
gate
)
multipliers
=
vm
.
v2r_matrix
[:,
iv
]
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment