Skip to content

Commit

Permalink
Apply @mofeing suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Sergio Sánchez Ramírez <[email protected]>
  • Loading branch information
jofrevalles and mofeing authored Jul 13, 2023
1 parent eed0d8a commit 7087099
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 24 deletions.
17 changes: 1 addition & 16 deletions docs/src/transformations.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

In tensor network computations, it is common to apply various transformations to simplify the network structure, reduce computational cost, or prepare the network for further operations. These transformations can modify the network's structure in a variety of ways such as reducing dimensions or ranks of tensors, converting certain indices, or even reordering tensor indices.

In Tenet, we provide a set of predefined transformations which you can apply to your `TensorNetwork` using both the `transform` and `transform!` functions. The `transform` function is non-mutating, meaning it will return a new `TensorNetwork` where the transformation has been applied, leaving the original network unchanged. For in-place transformation, you can use the mutating version, `transform!`.
In Tenet, we provide a set of predefined transformations which you can apply to your `TensorNetwork` using both the `transform`/`transform!` functions. The `transform` function is non-mutating, meaning it will return a new `TensorNetwork` where the transformation has been applied, leaving the original network unchanged. For in-place transformation, you can use the mutating version, `transform!`.

```@docs
transform
Expand Down Expand Up @@ -32,23 +32,8 @@ julia> ax2.titlesize=20

```@docs
Tenet.HyperindConverter
```

```@docs
Tenet.DiagonalReduction
```
```@docs
Tenet.RankSimplification
```

```@docs
Tenet.AntiDiagonalGauging
```

```@docs
Tenet.ColumnReduction
```

```@docs
Tenet.SplitSimplification
```
16 changes: 8 additions & 8 deletions src/Transformations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ end
"""
DiagonalReduction <: Transformation
Reduces the dimension of a `Tensor` in a `TensorNetwork` when it has a pair of indices that fulfil a diagonal structure.
Reduce the dimension of a `Tensor` in a `TensorNetwork` when it has a pair of indices that fulfil a diagonal structure.
# Keyword Arguments
Expand Down Expand Up @@ -121,7 +121,7 @@ end
"""
RankSimplification <: Transformation
Reduces the rank of the `TensorNetwork` by contracting some tensors preemptively.
Reduce the rank of the `TensorNetwork` by contracting some tensors preemptively.
This is done by identifying pairs of tensors in the network which can be contracted together without increasing the maximum rank of the network.
"""
struct RankSimplification <: Transformation end
Expand Down Expand Up @@ -158,13 +158,13 @@ end
"""
AntiDiagonalGauging <: Transformation
Modifies the `TensorNetwork` by reversing the order of some indices of tensors that fulfill an anti-diagonal condition.
Modify the `TensorNetwork` by reversing the order of some indices of tensors that fulfill an anti-diagonal condition.
While this transformation doesn't directly enhance computational efficiency, it sets up the `TensorNetwork` for other operations that do.
# Keyword Arguments
- `atol` Absolute tolerance. Defaults to `1e-12`.
- `skip` A list of indices to skip. Defaults to `[]`.
- `skip` List of indices to skip. Defaults to `[]`.
"""
Base.@kwdef struct AntiDiagonalGauging <: Transformation
atol::Float64 = 1e-12
Expand Down Expand Up @@ -198,12 +198,12 @@ end
"""
ColumnReduction <: Transformation
Reduces the dimension of a `Tensor` in a `TensorNetwork` when it contains columns with all elements smaller than `atol`.
Reduce the dimension of a `Tensor` in a `TensorNetwork` when it contains columns with all elements smaller than `atol`.
# Keyword Arguments
- `atol` Absolute tolerance.
- `skip` A list of indices to skip. Defaults to `[]`.
- `skip` List of indices to skip. Defaults to `[]`.
"""
Base.@kwdef struct ColumnReduction <: Transformation
atol::Float64 = 1e-12
Expand Down Expand Up @@ -272,11 +272,11 @@ end
"""
SplitSimplification <: Transformation
Reduces the rank of some tensors in the `TensorNetwork` by splitting some tensors into two. It uses teh singular value decomposition to identify the tensors that can be split without increasing the maximum rank of the network.
Reduces the rank of some tensors in the `TensorNetwork` by splitting some tensors into two. It uses the singular value decomposition to identify the tensors that can be split without increasing the maximum rank of the network.
# Keyword Arguments
- `atol` Absolute tolerance.
- `atol` Absolute tolerance. Defaults to `1e-10`.
"""
Base.@kwdef struct SplitSimplification <: Transformation
atol::Float64 = 1e-10 # A threshold for SVD rank determination
Expand Down

0 comments on commit 7087099

Please sign in to comment.