Skip to content
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

Support svdvals, generalize norm, and introduce tracedist for Qobj #102

Merged
merged 7 commits into from
May 18, 2024

Conversation

ytdHuang
Copy link
Member

@ytdHuang ytdHuang commented May 18, 2024

The original LinearAlgebra.norm calculates standard vector norm no matter the input array is vector or matrix. But usually we calculate Schatten p-norm for matrices (density operators), which need to first calculate the singular values before taking the standard vector norm.

Summary for this PR:

  • Support LinearAlgebra.svdvals (singular values) for Qobj
  • Generalize LinearAlgebra.norm(A::QuantumObject, p::Real=2):
    • if Qobj is Ket, Bra, OperatorKet, or OperatorBra, calculate the standard vector p-norm
    • if Qobj is Operator or SuperOperator, calculate the Schatten p-norm
  • Since the definition of negativity is related to the trace-norm (Schatten 1-norm), use the above method directly can slightly increase the efficiency.
  • Introduce tracedist (also relates to the trace-norm) between two given Qobj

Copy link

codecov bot commented May 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.28%. Comparing base (82dc55f) to head (3fe2450).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #102      +/-   ##
==========================================
+ Coverage   91.24%   91.28%   +0.03%     
==========================================
  Files          20       20              
  Lines        1737     1744       +7     
==========================================
+ Hits         1585     1592       +7     
  Misses        152      152              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

src/general_functions.jl Outdated Show resolved Hide resolved
src/general_functions.jl Outdated Show resolved Hide resolved
src/negativity.jl Outdated Show resolved Hide resolved
@albertomercurio albertomercurio merged commit ba88ab1 into qutip:main May 18, 2024
13 checks passed
@ytdHuang ytdHuang deleted the dev/tracedist branch May 18, 2024 18:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants