Skip to content

Document interface of library#346

Draft
emstoudenmire wants to merge 19 commits intomainfrom
MS_doc_interface
Draft

Document interface of library#346
emstoudenmire wants to merge 19 commits intomainfrom
MS_doc_interface

Conversation

@emstoudenmire
Copy link
Copy Markdown
Contributor

@emstoudenmire emstoudenmire commented Apr 27, 2026

This PR adds documentation of which methods we may consider "interface", and thus should keep and add docstrings for, versus deprecated methods we may want to delete. Methods not in the two files interface_methods.md and deprecated_methods.md are considered internal, developer-facing methods.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 27, 2026

Your PR no longer requires formatting changes. Thank you for your contribution!

Comment thread docs/src/interface_methods.md Outdated
Comment thread docs/src/interface_methods.md Outdated
Comment thread docs/src/deprecated_methods.md
Comment thread docs/src/deprecated_methods.md Outdated
Comment on lines +59 to +71
## TreeTensorNetwork Constructors

* From `Op` and related types (`opsum_to_ttn.jl`):
```julia
mpo(os::OpSum, external_inds::Vector; kws...)
mpo(os::OpSum, s::IndsNetwork; kws...)
ttn(o::Op, s::IndsNetwork; kws...)
ttn(o::Scaled{C, Op}, s::IndsNetwork; kws...)
ttn(o::Sum{Op}, s::IndsNetwork; kws...)
ttn(o::Prod{Op}, s::IndsNetwork; kws...)
ttn(o::Scaled{C, Prod{Op}}, s::IndsNetwork; kws...)
ttn(o::Sum{Scaled{C, Op}}, s::IndsNetwork; kws...)
```
Copy link
Copy Markdown
Member

@mtfishman mtfishman Apr 27, 2026

Choose a reason for hiding this comment

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

I guess we'll have to think about the alternatives to these if we remove them. Maybe it would be something like ttn(opsum::OpSum, graph::NamedGraph, siteinds:Dict{V, <: Index}), i.e. you specify the graph and site indices? Though I guess we could make it more general, i.e. ITensorNetwork(opsum::OpSum, graph::NamedGraph, siteinds:Dict{V, <: Index}), and error if the graph isn't a tree.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It was my bad to include the mpo ones here. I had put them in "interface" actually, just accidentally duplicated them here.

Were your comments above about a more general constructor that would take the place of the mpo ones?

The ones really intended to be here in Deprecated are the ones which take other Op-adjacent data like Scaled{C,Op}, Prod{Op}, etc. My guess was we might want those but later on through Lukas's system so maybe better not to have them here? They are little one-liners though so not causing any big issues. What do you think of these?

Copy link
Copy Markdown
Member

@mtfishman mtfishman Apr 27, 2026

Choose a reason for hiding this comment

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

I see, I thought you were including all mpo and ttn constructors. That sounds reasonable to get rid of Scaled{C,Op}, Prod{Op}, etc. for now (non-OpSum ones).

I was indeed suggesting getting rid of ttn and mpo entirely and just focusing on a more general ITensorNetwork constructor that just restricts to trees with a runtime check.

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.

Of course, that would be a longer term change which assumes we are getting rid of the TTN type, and since the current DMRG/TDVP code still expects a TTN then we could replace mpo and ttn with using the TTN type directly, i.e. remove mpo and ttn functions in favor of just making a TTN constructor that accepts an OpSum.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think the above would be a good plan. One way we could go would be to start replacing tree tensor network methods with ITensorNetwork ones (just restricted to trees with a runtime check) and then after some rounds of this see how much of a "footprint" is left by the actual TreeTensorNetwork type. It might not be that much after a handful of key changes.

My guess is probably the largest footprint is through parts of the code, like solvers, which rely on the gauging capabilities of tree tensor networks but also of course that's something that could be switched over to ITensorNetworks with a runtime tree check. Also I remember you had some thoughts about gauging and caches that sounded more deep.. we should discuss more.

Comment thread docs/src/interface_methods.md Outdated
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 71.10%. Comparing base (9ed5949) to head (c7a26b1).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #346      +/-   ##
==========================================
- Coverage   73.08%   71.10%   -1.99%     
==========================================
  Files          66       64       -2     
  Lines        3151     3097      -54     
==========================================
- Hits         2303     2202     -101     
- Misses        848      895      +47     
Flag Coverage Δ
docs 46.63% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread docs/src/interface_methods.md Outdated
Comment thread docs/src/interface_methods.md Outdated
@mtfishman
Copy link
Copy Markdown
Member

@emstoudenmire can you bump the version, fix the docs build, and format just so we can get tests passing?

Also, I noticed you are just including the function signatures in the docs. For functions that have docstrings, can you insert the docstring instead of just putting the function signature?

Comment thread docs/src/interface_methods.md Outdated
Comment thread docs/src/interface_methods.md
Comment thread docs/src/interface_methods.md Outdated
Comment thread docs/src/interface_methods.md Outdated
Comment thread docs/src/interface_methods.md Outdated
Comment thread docs/src/interface_methods.md Outdated
Comment thread docs/src/interface_methods.md Outdated
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.

3 participants