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

Consider treating States and Operators as Functors #87

Closed
mofeing opened this issue Sep 13, 2023 · 1 comment
Closed

Consider treating States and Operators as Functors #87

mofeing opened this issue Sep 13, 2023 · 1 comment
Assignees
Labels
enhancement New feature or request question Further information is requested
Milestone

Comments

@mofeing
Copy link
Member

mofeing commented Sep 13, 2023

Due to the "directionality" of quantum tensor networks, it might be beneficial to consider adding support to "call" tensor network states and operators, turning them into functors.

Quantum Operators are... (you guessed it) operators, so they are functions that map functions to functions. Quantum States are complex-valued functions but its duals are functionals that map States to complex numbers. This is exactly the behavior seen in Tensor Networks (and QM), where...

  • An operator $U$ acting on a function $\ket{\psi}$ leads to a function $\ket{\psi'}$ $$U \ket{\psi} = \ket{\psi'}$$
  • A functional $\bra{\psi}$ acting on an operator $U$ leads to a functional $\bra{\psi'}$ $$\bra{\psi} U = \bra{\psi'}$$
  • An operator $U$ acting on another operator $V$ leads to third operator $W$ $$U V = W$$
  • A functional $\bra{\psi}$ acting on a function $\ket{\phi}$ leads to a scalar $\alpha$ $$\braket{\psi \mid \phi} = \alpha$$

Proposal

function (tn::TensorNetwork{A})(x) where {...}
    ...
end

Things to decide

  • What is the behavior for Propertys (i.e. TNs with no open physical indices)? IMO the most intuitive thing would be to perform scalar multiplication ⇒ outer product in TN
  • Can dynamic dispatch be avoided? Plug type should be sufficient but it's unclear how to do type dispatch on it.
    • Maybe @generated functions?
    • Maybe refactor Quantum to account this information?
@mofeing mofeing added enhancement New feature or request question Further information is requested labels Sep 13, 2023
@mofeing mofeing added this to the 0.4 milestone Sep 13, 2023
@mofeing mofeing linked a pull request Sep 19, 2023 that will close this issue
@mofeing mofeing linked a pull request Oct 6, 2023 that will close this issue
6 tasks
@mofeing
Copy link
Member Author

mofeing commented Nov 3, 2023

Related code moved to Qrochet.jl.

@mofeing mofeing closed this as not planned Won't fix, can't repro, duplicate, stale Nov 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants