Skip to content

Commit 6ff5862

Browse files
committed
docs: upgrade documentation with docstrings
1 parent 425c3ed commit 6ff5862

19 files changed

+277
-36
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# TensorRenormalizationGroups.jl
22

3-
*A Julia package implementing various two-dimensional tensor renormalization group-like algorithms in an application agnostic way under a single interface. Based on [TensorKit.jl](https://github.com/Jutho/TensorKit.jl).*
3+
*A Julia package implementing various two-dimensional tensor renormalization group-like algorithms under a single interface. Designed to be application agnostic. Based on [TensorKit.jl](https://github.com/Jutho/TensorKit.jl).*
44

55
[![](https://img.shields.io/badge/docs-dev-blue.svg)](https://jack-dunham.github.io/TensorRenormalizationGroups.jl/dev)

docs/make.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ makedocs(
66
authors="Jack Dunham",
77
pages=[
88
"Home" => "index.md",
9-
"Library" => "library.md",
9+
"Library" => [
10+
"Computing and contracting" => "renormalize.md",
11+
"Defining tensor networks" => "networks.md",
12+
"Algorithms" => "algorithms.md",
13+
],
1014
"Index" => "_index.md"
1115
]
1216
)

docs/src/algorithms.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Algorithms
2+
3+
## Generic
4+
5+
```@docs
6+
AbstractRenormalizationAlgorithm
7+
AbstractBoundaryAlgorithm
8+
AbstractGrainingAlgorithm
9+
AbstractRenormalizationRuntime
10+
AbstractBoundaryRuntime
11+
AbstractGrainingRuntime
12+
```
13+
14+
## VUMPS
15+
16+
```@docs
17+
VUMPS
18+
VUMPSRuntime
19+
MPS
20+
FixedPoints
21+
```
22+
23+
## CTMRG
24+
25+
```@docs
26+
AbstractCornerMethod
27+
CTMRG
28+
CornerMethodTensors
29+
CornerMethodRuntime
30+
Corners
31+
Edges
32+
corners
33+
edges
34+
```
35+
36+
## TRG
37+
38+
```@docs
39+
TRG
40+
TRGRuntime
41+
```

docs/src/index.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
# TensorRenormalizationGroups.jl
22

3-
A package for performing contractions of infinite two-dimensional tensor networks.
3+
```@docs
4+
TensorRenormalizationGroups
5+
```

docs/src/library.md

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +0,0 @@
1-
# Library
2-
3-
## Methods
4-
5-
```@docs
6-
initialize
7-
calculate!
8-
contract
9-
```
10-
11-
## Algorithms
12-
13-
```@docs
14-
VUMPS
15-
CTMRG
16-
```

docs/src/networks.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Defining tensor networks
2+
3+
## Unit cells
4+
5+
```@docs
6+
AbstractUnitCell
7+
UnitCell
8+
```
9+
10+
## Geometry
11+
12+
```@docs
13+
AbstractUnitCellGeometry
14+
Square
15+
SquareSymmetric
16+
```
17+
18+
## Tensor-specific
19+
20+
```@docs
21+
CompositeTensor
22+
tensortype
23+
virtualspace
24+
swapaxes
25+
invertaxes
26+
```

docs/src/renormalize.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Computing and contracting
2+
3+
```@docs
4+
Renormalization
5+
renormalize!
6+
TRGroups.continue!
7+
TRGroups.reset!
8+
TRGroups.recycle!
9+
TRGroups.restart!
10+
contract
11+
```

src/TensorRenormalizationGroups.jl

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
"""
2+
*A Julia package implementing various two-dimensional tensor renormalization group-like
3+
algorithms under a single interface. Designed to be application agnostic.
4+
Based on [TensorKit.jl](https://github.com/Jutho/TensorKit.jl).*
5+
6+
!!! note
7+
This documentation is a work in progress.
8+
"""
19
module TensorRenormalizationGroups
210
const TRGroups = TensorRenormalizationGroups
311

@@ -40,10 +48,14 @@ export AbstractCornerMethod
4048
export CornerMethodTensors, CornerMethodRuntime, Corners, Edges
4149
export corners, edges
4250

51+
# GRAINING
52+
export TRGRuntime
53+
4354
export getboundary
4455

4556
# INTERFACE
46-
export initialize, renormalize!, contract
57+
export renormalize!, contract
58+
public continue!, reset!, recycle!, restart!
4759

4860
# No deps
4961
include("convergenceinfo.jl")

src/abstractproblem.jl

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
1+
"""
2+
$(TYPEDEF)
3+
4+
Abstract supertype of all algorithms available in this package.
5+
"""
16
abstract type AbstractRenormalizationAlgorithm end
7+
8+
"""
9+
$(TYPEDEF)
10+
11+
Abstract supertype of all algorithm-specific runtime state objects.
12+
"""
213
abstract type AbstractRenormalizationRuntime end
314

415
"""
@@ -13,22 +24,24 @@ $(TYPEDFIELDS)
1324
1425
# Constructors
1526
16-
Renormalization(network::AbstractMatrix, alg::AbstractRenormalizationAlgorithm, [initial::AbstractRenormalizationRuntime])
27+
$(FUNCTIONNAME)(network::AbstractMatrix, alg::AbstractRenormalizationAlgorithm, [initial::AbstractRenormalizationRuntime])
1728
1829
A new instance of `Renormalization` is constructed by passing `network` and
1930
(optionally) an initial runtime object, as well as the chosen `alg`.
2031
If `initial` is specified, `convertproblem` will be called to attempt to make
2132
`initial` compatible with `alg`.
2233
23-
Note, `Renormalization` will *always* be constructed using a `copy` of `network`, but
24-
*not* a `deepcopy`. That is, one can mutate the `network` struct using `setindex!` with
25-
out mutating the constructed `Renormalization`, but mutating the tensor elements
26-
themselves *will* propagate through to this struct.
27-
28-
Renormalization(network::AbstractMatrix, problem::Renormalization)
34+
$(FUNCTIONNAME)(network::AbstractMatrix, problem::Renormalization)
2935
3036
Constuct a new instance of `Renormalization` using the algorithm and runtime from
3137
existing `problem`.
38+
39+
!!! warn
40+
`Renormalization` will *always* be constructed using a `copy` of `network`, but
41+
*not* a `deepcopy`. That is, one can mutate the `network` struct using `setindex!` with
42+
out mutating the constructed `Renormalization`, but mutating the tensor elements
43+
themselves *will* propagate through to this struct.
44+
3245
"""
3346
struct Renormalization{
3447
Alg<:AbstractRenormalizationAlgorithm,

src/abstractunitcell.jl

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
1+
"""
2+
$(TYPEDEF)
3+
4+
Abstract supertype of all unit cell lattice geometries.
5+
"""
16
abstract type AbstractUnitCellGeometry end
7+
8+
"""
9+
$(TYPEDEF)
10+
11+
Abstract supertype of all unit cells (periodic boundary conditions) defined on a lattice
12+
with geometry `G`.
13+
"""
214
abstract type AbstractUnitCell{G<:AbstractUnitCellGeometry,ElType,A} <:
315
AbstractMatrix{ElType} end
416

@@ -7,6 +19,12 @@ basedata(arr::AbstractUnitCell) = basedata(getdata(arr))
719

820
const AbUnCe{T,G,A} = AbstractUnitCell{G,T,A}
921

22+
"""
23+
$(FUNCTIONNAME)(x) -> AbstractTensorMap
24+
25+
Return the type of tensor associated with object `x`, if any. Similar to `eltype` for container
26+
types but always returns an `AbstractTensorMap`. Defined in both the value and type domains.
27+
"""
1028
tensortype(val) = tensortype(typeof(val))
1129
tensortype(args::Type) = throw(MethodError(tensortype, (args,)))
1230
tensortype(T::Type{<:AbstractTensorMap}) = T

0 commit comments

Comments
 (0)