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.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
trace, partial trace, and superoperators #55
trace, partial trace, and superoperators #55
Changes from 14 commits
353d689
19e1b3f
1af6b2a
45a4224
49411c9
c397478
e3d2a49
ac731e2
5066d34
1e3c956
4793dc7
b7aeab1
871b1c3
343108b
7c25134
057a837
e41dc7e
194ebba
5997dfb
3e9f5e7
e9c4c91
e3d7eb0
ffd9c26
bcddbc5
77f737d
9f05adb
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
Check warning on line 99 in src/QSymbolicsBase/basic_ops_homogeneous.jl
Codecov / codecov/patch
src/QSymbolicsBase/basic_ops_homogeneous.jl#L97-L99
Check warning on line 167 in src/QSymbolicsBase/basic_ops_homogeneous.jl
Codecov / codecov/patch
src/QSymbolicsBase/basic_ops_homogeneous.jl#L167
Check warning on line 175 in src/QSymbolicsBase/basic_ops_homogeneous.jl
Codecov / codecov/patch
src/QSymbolicsBase/basic_ops_homogeneous.jl#L175
Check warning on line 181 in src/QSymbolicsBase/basic_ops_homogeneous.jl
Codecov / codecov/patch
src/QSymbolicsBase/basic_ops_homogeneous.jl#L181
Check warning on line 192 in src/QSymbolicsBase/basic_ops_homogeneous.jl
GitHub Actions / Spell Check with Typos
Check warning on line 229 in src/QSymbolicsBase/basic_ops_homogeneous.jl
GitHub Actions / Spell Check with Typos
Check warning on line 116 in src/QSymbolicsBase/basic_ops_inhomogeneous.jl
Codecov / codecov/patch
src/QSymbolicsBase/basic_ops_inhomogeneous.jl#L116
Check warning on line 82 in src/QSymbolicsBase/literal_objects.jl
Codecov / codecov/patch
src/QSymbolicsBase/literal_objects.jl#L81-L82
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the new
iszero
implementations here are type piracy. Where are they needed?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fixes a bug mentioned in #54 as well: #54 (comment).
Check warning on line 310 in src/QSymbolicsBase/predefined.jl
Codecov / codecov/patch
src/QSymbolicsBase/predefined.jl#L310
Check warning on line 313 in src/QSymbolicsBase/predefined.jl
Codecov / codecov/patch
src/QSymbolicsBase/predefined.jl#L313
Check warning on line 316 in src/QSymbolicsBase/predefined.jl
Codecov / codecov/patch
src/QSymbolicsBase/predefined.jl#L316
Check warning on line 368 in src/QSymbolicsBase/predefined.jl
Codecov / codecov/patch
src/QSymbolicsBase/predefined.jl#L363-L368
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is actually a bit worse than this. You can have
@op A SpinBasis(1//2)^2
, i.e. the symbolic operator is already over a composite basis. The number of subsystem would be the number of subsystems inbasis
, which might be different from the number of terms in the tensor product.Also, what if flattening has not happened. E.g
ptrace(A⊗(B⊗C+D⊗E), 2)
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, these are both fair comments. Will make changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just found another small bug:
We would want
tp
to show(A⊗B⊗C)
andQuantumSymbolics.arguments(tp)
to be a 3-element vector of the symbolic operators.Weird. I wonder why this doesn't happen for multiplication of operators:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A question somewhat related to this: should we have a function in the package that expands expressions? For instance, if a user for some reason wanted to convert
A⊗(B⊗C+D⊗E)
intoA⊗B⊗C+A⊗D⊗E
, shouldn't they have a way to do that? Maybe we could call itqexpand
, using theq
prefix the same we do forqsimplify
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yup, let's have a
qexpand
for now. Maybe at some point we will just hook into the standardexpand
and at that point it can be just an alias without making a breaking releaseconcerning the difference between mul and tensor, I think it is because
prefactorscalings
were created for tensor, and it has been kinda hackishly applied to mul. We probably need to cleanprefactorscalings
to work on both. I will make a separate issue for that.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait, no that is overly complicated. Why not just have
scalar=true
always. Is there a situation that benefits fromscalar=false
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes about a new file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's my understanding that
prefactorscalings
was originally created for tensor product properties. For instance,|k1⟩⊗(A*|k2⟩)
would giveA|k1⟩|k2⟩
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regardless, I will clean up the scaling and flattening functions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prefactorscaling
was always meant only for scalars. The operator identity you are giving is wrong because A is defined to act on the Hilbert space of k2, not on the composite hilbert space of k1k2.Check warning on line 387 in src/QSymbolicsBase/predefined.jl
Codecov / codecov/patch
src/QSymbolicsBase/predefined.jl#L387
Check warning on line 79 in src/QSymbolicsBase/predefined_CPTP.jl
Codecov / codecov/patch
src/QSymbolicsBase/predefined_CPTP.jl#L74-L79
Check warning on line 82 in src/QSymbolicsBase/predefined_CPTP.jl
Codecov / codecov/patch
src/QSymbolicsBase/predefined_CPTP.jl#L81-L82