Skip to content

Exponential#465

Open
sanderdemeyer wants to merge 4 commits into
QuantumKitHub:mainfrom
sanderdemeyer:exp
Open

Exponential#465
sanderdemeyer wants to merge 4 commits into
QuantumKitHub:mainfrom
sanderdemeyer:exp

Conversation

@sanderdemeyer

Copy link
Copy Markdown
Contributor

This changes the current way of calculating the exponential (using LinearAlgebra) to the one recently implemented in MatrixAlgebraKit (see QuantumKitHub/MatrixAlgebraKit.jl#94). This will not yet work, since there is no new version of MatrixAlgebraKit tagged yet. I just wanted to start the discussion here already.

I added both exp!(t) and exp!(tau, t). I added the special case where t is real and tau is complex, when exp! cannot overwrite the original tensor and instead a new one is allocated. Suggestions on how to best do this are definitely appreciated.

I still need to add some tests. We can definitely add some tests on whether the output tensor has the expected scalartype, and whether exp!(copy(a)) == exp!((1.0, copy(a)), but suggestions on more nontrivial tests are also welcome.

@sanderdemeyer sanderdemeyer changed the title Exp Exponential Jun 26, 2026

@lkdvos lkdvos left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably discuss together how to best approach this, because I guess the question is if we want to implement the MatrixAlgebraKit functionality and interface directly on the tensors first, like we did for the factorizations.

I didn't even remember we have exp!, which is as far as I can tell defined in TensorKit itself, which means we could in principle indeed decide to use that for exp!((tau, t)), although my initial feeling seems to gravitate more towards just overloading the MatrixAlgebraKit versions.
That would then also at least expose the algorithm selection and in-place versions a little better?

@sanderdemeyer

Copy link
Copy Markdown
Contributor Author

I can definitely get behind just overloading the MatrixAlgebraKit version. Maybe we want to keep exp! as a (deprecated) version just to avoid breaking changes?

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