-
Notifications
You must be signed in to change notification settings - Fork 45
Add OperatorStyle and GeometryStyle
#352
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
Merged
Merged
Changes from 10 commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
fa91804
add styles
AFeuerpfeil 1334fcb
start rewrite
AFeuerpfeil 140005f
start defining the styles
AFeuerpfeil bd6ccdf
implement styles for states and operators and add tests
AFeuerpfeil 5be03c3
Merge pull request #1 from AFeuerpfeil/pr-mpo-styles
AFeuerpfeil 0896113
add include styles
AFeuerpfeil 6350c96
fix InfiniteMPO test
AFeuerpfeil 50793bf
dispatch styles on type and rename IsfiniteStyle to GeometryStyle
AFeuerpfeil 7226788
readd Base.isfinite for AbstractMPS, MPO and MPOHamiltonian
AFeuerpfeil c206de8
add tests for styles of types
AFeuerpfeil 07f579c
fix include order
AFeuerpfeil d278a3a
fix OperatorStyle for MPOHamiltonian
AFeuerpfeil ea5366c
Add WindowStyle and increase code coverage
AFeuerpfeil 18b5ef2
fix test and hopefully also runic
AFeuerpfeil 5af3060
more tests
AFeuerpfeil 8f72c21
fix other tests
AFeuerpfeil 9b7905c
make GeometryStyle names more descriptive
AFeuerpfeil bb74ee8
implement changes
AFeuerpfeil 692f895
remove unnecessary Base.isfinite definitions, because it is already d…
AFeuerpfeil 38db5da
fix braille tests
AFeuerpfeil 5d1f975
addd
AFeuerpfeil abcf6a6
revert unnecessary changes
AFeuerpfeil 0718f63
update style docs
lkdvos ffc50d5
fix formatting
lkdvos 776748b
more formatting
lkdvos File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| """ | ||
| `OperatorStyle` | ||
AFeuerpfeil marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| Holy trait used as a dispatch tag for operator representations. | ||
| Concrete subtypes (`MPOStyle` and `HamiltonianStyle`) indicate | ||
| whether an operator is stored as an MPO or as a Hamiltonian. | ||
lkdvos marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| Use `OperatorStyle` in method signatures to select implementation- | ||
| specific code paths for different operator types. | ||
lkdvos marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| To opt a custom operator type into this dispatch scheme implement: | ||
| ```julia | ||
| OperatorStyle(::T) where {T<:YourOperatorType} | ||
lkdvos marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ``` | ||
| """ | ||
| abstract type OperatorStyle end | ||
lkdvos marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| OperatorStyle(x) = OperatorStyle(typeof(x)) | ||
| OperatorStyle(T::Type) = throw(MethodError(OperatorStyle, T)) # avoid stackoverflow if not defined | ||
|
|
||
| struct MPOStyle <: OperatorStyle end | ||
| struct HamiltonianStyle <: OperatorStyle end | ||
|
|
||
|
|
||
| """ | ||
lkdvos marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| `GeometryStyle` | ||
|
|
||
| Holy trait used as a dispatch tag to distinguish between different | ||
| geometry (currently finite and infinite). Concrete subtypes | ||
| (`FiniteStyle` and `InfiniteStyle`) indicate whether a system is | ||
| finite or infinite. Use `GeometryStyle` in method signatures to | ||
| select implementation-specific code paths for different types. | ||
|
|
||
| To opt a custom type into this dispatch scheme implement: | ||
| ```julia | ||
| GeometryStyle(::T) where {T<:YourType} | ||
| ``` | ||
| """ | ||
| abstract type GeometryStyle end | ||
| GeometryStyle(x) = GeometryStyle(typeof(x)) | ||
| GeometryStyle(T::Type) = throw(MethodError(GeometryStyle, T)) # avoid stackoverflow if not defined | ||
|
|
||
| struct FiniteStyle <: GeometryStyle end | ||
| struct InfiniteStyle <: GeometryStyle end | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.