Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
mofeing committed Dec 26, 2024
1 parent f2abea6 commit e783620
Show file tree
Hide file tree
Showing 19 changed files with 230 additions and 277 deletions.
2 changes: 1 addition & 1 deletion docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ NetworkLayout = "46757867-2c16-5918-afeb-47bfcb05e46a"
Tenet = "85d41934-b9cd-44e1-8730-56d86f15f3ec"

[sources]
Tenet = {path = "/Users/mofeing/Developer/Tenet.jl/docs/.."}
Tenet = {path = ".."}

[compat]
Documenter = "1"
Expand Down
6 changes: 3 additions & 3 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,22 @@ makedocs(;
"📖 Manual" => [
"Tensors" => "manual/tensors.md",
"Tensor Networks" => "manual/tensor-network.md",
"Contraction" => "manual/contraction.md",
"Transformations" => "manual/transformations.md",
"Quantum" => "manual/quantum.md",
"Ansatz" => [
"Introduction" => "manual/ansatz/index.md",
"Product ansatz" => "manual/ansatz/product.md",
"MPS/MPO ansatz" => "manual/ansatz/mps.md",
],
"Visualization" => "visualization.md",
],
"🫂 Friends" => "friends.md",
"🧭 API" => [
"Tensor" => "api/tensor.md",
"TensorNetwork" => "api/tensornetwork.md",
"Transformations" => "api/transformations.md",
"Quantum" => "api/quantum.md",
"Ansatz" => "api/ansatz.md",
"Product" => "api/product.md",
"MPS" => "api/mps.md",
],
"⚒️ Developer Reference" => [
"Hypergraph representation of `TensorNetwork`" => "developer/hypergraph.md",
Expand Down
7 changes: 3 additions & 4 deletions docs/src/api/ansatz.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Ansatz

## MPS

```@docs
MPS
```@autodocs
Modules = [Tenet]
Pages = ["Lattice.jl", "Ansatz.jl"]
```
6 changes: 6 additions & 0 deletions docs/src/api/mps.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# MPS

```@autodocs
Modules = [Tenet]
Pages = ["MPS.jl"]
```
6 changes: 6 additions & 0 deletions docs/src/api/product.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Product

```@autodocs
Modules = [Tenet]
Pages = ["Product.jl"]
```
23 changes: 3 additions & 20 deletions docs/src/api/quantum.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,6 @@
# Quantum

```@docs
Quantum
Tenet.TensorNetwork(::Quantum)
Base.adjoint(::Quantum)
sites
nsites
Tenet.inds(::Quantum; kwargs...)
Tenet.tensors(::Quantum; kwargs...)
inputs
outputs
lanes
ninputs
noutputs
nlanes
Socket
socket(::Quantum)
Scalar
State
Operator
Base.merge(::Quantum, ::Quantum...)
```@autodocs
Modules = [Tenet]
Pages = ["Site.jl", "Quantum.jl"]
```
11 changes: 3 additions & 8 deletions docs/src/api/tensor.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
# Tensor

```@docs
Base.parent(::Tensor)
inds(::Tensor)
Base.size(::Tensor)
Tenet.contract(::Tensor, ::Tensor)
LinearAlgebra.svd(::Tensor)
LinearAlgebra.qr(::Tensor)
LinearAlgebra.lu(::Tensor)
```@autodocs
Modules = [Tenet]
Pages = ["Tensor.jl", "Numerics.jl"]
```
33 changes: 3 additions & 30 deletions docs/src/api/tensornetwork.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,6 @@
# TensorNetwork

```@docs
TensorNetwork
inds(::Tenet.TensorNetwork)
size(::Tenet.TensorNetwork)
tensors(::Tenet.TensorNetwork)
push!(::Tenet.TensorNetwork, ::Tensor)
pop!(::Tenet.TensorNetwork, ::Tensor)
append!(::Tenet.TensorNetwork, ::Base.AbstractVecOrTuple{<:Tensor})
merge!(::Tenet.TensorNetwork, ::Tenet.TensorNetwork)
delete!(::Tenet.TensorNetwork, ::Any)
replace!
selectdim
slice!
view(::Tenet.TensorNetwork)
Base.copy(::Tenet.TensorNetwork)
Base.rand(::Type{TensorNetwork}, n::Integer, regularity::Integer)
```

## Transformations

```@docs
transform
transform!
Tenet.HyperFlatten
Tenet.HyperGroup
Tenet.ContractSimplification
Tenet.DiagonalReduction
Tenet.AntiDiagonalGauging
Tenet.Truncate
Tenet.SplitSimplificationd
```@autodocs
Modules = [Tenet]
Pages = ["TensorNetwork.jl"]
```
7 changes: 7 additions & 0 deletions docs/src/api/transformations.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Transformations

```@autodocs
Modules = [Tenet]
Pages = ["Transformations.jl"]
Order = [:function, :type]
```
4 changes: 2 additions & 2 deletions docs/src/developer/type-hierarchy.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Inheritance and Traits

```@setup kroki
using Kroki
# using Kroki
```

Julia (and in general, all modern languages like Rust or Go) implement Object Oriented Programming (OOP) in a rather restricted form compared to popular OOP languages like Java, C++ or Python.
Expand All @@ -14,7 +14,7 @@ Julia design space on this topic is not completely clear. Julia has _abstract ty
As of the time of writing, the type hierarchy of Tenet looks like this:

```@example kroki
mermaid"""graph TD
"""graph TD
id1(AbstractTensorNetwork)
id2(AbstractQuantum)
id3(AbstractAnsatz)
Expand Down
2 changes: 1 addition & 1 deletion docs/src/friends.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ If `Tenet`'s design doesn't fit your case, ¡no problem!. There are other nice l
- [tenpy](https://github.com/tenpy/tenpy) Tensor Network library written in Python with a strong focus on physics.
- [ITensors.jl](https://github.com/ITensor/ITensors.jl) and [ITensorNetworks.jl](https://github.com/ITensors/ITensorNetworks.jl) Mature Tensor Network framework written in Julia.
- [tensorkrowch](https://github.com/joserapa98/tensorkrowch) A new Tensor Network library built on top of PyTorch.
- [SeeMPS](https://github.com/juanjosegarciaripoll/seemps)
- [SeeMPS](https://github.com/juanjosegarciaripoll/seemps) A recent addition to the game with support for resolution of PDEs.
12 changes: 7 additions & 5 deletions docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ layout: home
hero:
name: Tenet.jl
text: Hackable Tensor Networks
text: The Hackable Tensor Network Library
tagline:
actions:
- theme: brand
Expand All @@ -24,7 +24,7 @@ hero:
features:
- icon: 🚀
title: Fast & Device Agnostic
details: Its deep integration with Reactant.jl and carefully developed code, makes it go brrrr
details: Its deep integration with [Reactant.jl](https://github.com/EnzymeAD/) and carefully developed code, makes it go fast!
link: /introduction
- icon: ∂
Expand All @@ -33,17 +33,19 @@ features:
link: /introduction
- icon: 🧩
title: Carefully crafted
details:
title: Composable
details: Design new TN types... or even replace the internals!
link: /introduction
- icon: 🫂
title: Compatible with friends
details:
details: We believe in collaboration and interoperation. As such, Tenet.jl integrates with many libraries... Even with Python!
link: /alternatives
---
```

Tenet.jl is a Tensor Network library written in Julia and designed to be performant, hackable and intuitive.

!!! info "BSC-Quantic's Registry"
`Tenet` and some of its dependencies are located in our [own Julia registry](https://github.com/bsc-quantic/Registry).
In order to download `Tenet`, add our registry to your Julia installation by using the [Pkg mode](https://docs.julialang.org/en/v1/stdlib/REPL/#Pkg-mode) in a REPL session,
Expand Down
29 changes: 5 additions & 24 deletions docs/src/manual/ansatz/mps.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,15 @@ Makie.inline!(true)
set_theme!(resolution=(800,200))
using CairoMakie
using GraphMakie
using Tenet
using NetworkLayout
```

```@example viz
fig = Figure() # hide
tn_open = rand(MatrixProduct{State,Open}, n=10, χ=4) # hide
tn_periodic = rand(MatrixProduct{State,Periodic}, n=10, χ=4) # hide
plot!(fig[1,1], tn_open, layout=Spring(iterations=1000, C=0.5, seed=100)) # hide
plot!(fig[1,2], tn_periodic, layout=Spring(iterations=1000, C=0.5, seed=100)) # hide
Label(fig[1,1, Bottom()], "Open") # hide
Label(fig[1,2, Bottom()], "Periodic") # hide
fig # hide
tn = rand(MPS; n=10, maxdim=4) # hide
graphplot(tn, layout=Spring(iterations=1000, C=0.5, seed=100)) # hide
```

## Matrix Product Operators (MPO)
Expand All @@ -36,18 +27,8 @@ Matrix Product Operators (MPO) are the operator version of [Matrix Product State
The major difference between them is that MPOs have 2 indices per site (1 input and 1 output) while MPSs only have 1 index per site (i.e. an output).

```@example viz
fig = Figure() # hide
tn_open = rand(MatrixProduct{Operator,Open}, n=10, χ=4) # hide
tn_periodic = rand(MatrixProduct{Operator,Periodic}, n=10, χ=4) # hide
plot!(fig[1,1], tn_open, layout=Spring(iterations=1000, C=0.5, seed=100)) # hide
plot!(fig[1,2], tn_periodic, layout=Spring(iterations=1000, C=0.5, seed=100)) # hide
Label(fig[1,1, Bottom()], "Open") # hide
Label(fig[1,2, Bottom()], "Periodic") # hide
fig # hide
tn = rand(MPO; n=10, maxdim=4) # hide
graphplot(tn, layout=Spring(iterations=1000, C=0.5, seed=100)) # hide
```

In `Tenet`, the generic `MatrixProduct` ansatz implements this topology. Type variables are used to address their functionality (`State` or `Operator`) and their boundary conditions (`Open` or `Periodic`).
9 changes: 0 additions & 9 deletions docs/src/manual/contraction.md

This file was deleted.

Loading

0 comments on commit e783620

Please sign in to comment.