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

Refactor TN Ansatzes to traits #96

Closed
mofeing opened this issue Sep 19, 2023 · 1 comment · Fixed by #103
Closed

Refactor TN Ansatzes to traits #96

mofeing opened this issue Sep 19, 2023 · 1 comment · Fixed by #103
Assignees
Labels
refactor Change internals
Milestone

Comments

@mofeing
Copy link
Member

mofeing commented Sep 19, 2023

Using type-parameters for encoding TN ansatz is not going to scale well.

  1. Composite incurs in a lot of compilation.
  2. Runtime dispatch is more costly than conditionals.

Proposal

The idea is to replace MatrixProduct, ProjectedEntangledPair, ... for Holy traits.

abstract type MatrixProduct{P,B} <: Quantum where {P<:Plug,B<:Boundary} end

would be rewritten as

abstract type Ansatz end
struct MatrixProduct{P<:Plug,B<:Boundary} <: Ansatz end

Also, the current Ansatz type would be renamed, because it would no longer express what we are meaning about it (i.e. the form of the graph). I suggest renaming it to Domain because that's what its fields are going to vary on.

Links

https://invenia.github.io/blog/2019/11/06/julialang-features-part-2/
https://www.ahsmart.com/pub/holy-traits-design-patterns-and-best-practice-book/

@mofeing mofeing added the refactor Change internals label Sep 19, 2023
@mofeing mofeing added this to the 0.4 milestone Sep 19, 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
refactor Change internals
Projects
None yet
2 participants