# Introducing ITensorEntropyTools.jl

**URL:** <https://itensor.discourse.group/t/introducing-itensorentropytools-jl/2192>\
**Category:** General Discussion\
**Tags:** entanglement\
**Created:** [January 6, 2025, 2:01pm UTC](https://itensor.discourse.group/t/introducing-itensorentropytools-jl/2192 "2025-01-06T14:01:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ryanlevy](https://yyz2.discourse-cdn.com/free1/user_avatar/itensor.discourse.group/ryanlevy/32/150_2.png) [@ryanlevy](https://itensor.discourse.group/u/ryanlevy)\
**Post date:** [January 6, 2025, 2:01pm UTC](https://itensor.discourse.group/t/introducing-itensorentropytools-jl/2192/1 "2025-01-06T14:01:39Z")

</div>

Introducing a new 3rd party package to compute entanglement entropy `ITensorEntropyTools.jl`:

> **[GitHub - ryanlevy/ITensorEntropyTools.jl: Tools for calculating Entanglement Entropy w/...](https://github.com/ryanlevy/ITensorEntropyTools.jl)**
>
> Tools for calculating Entanglement Entropy w/ ITensors.jl

## Features

The idea behind `ITensorEntropyTools.jl` is to automate some common calculations/tools:

- Entanglement Entropy calculations
  - von Neumann and Rényi
  - Bipartite regions
  - Arbitrary (potentially-disconnected) regions
  - Automatic calculation of (potentially) minimal rank RDMs

- Mutual information
- Tripartite mutual information
- _Experimental Support_
  - `ITensorNetworks.jl` (see `network` branch)
  - Entanglement negativity and partial transpose

In particular, determining the smallest reduced density matrix calculation necessary (as close to minimal rank as possible) without too much user effort.

Feature requests, bug reports, and external PRs are welcome!

## Example

Consider an mps `psi`. To determine the entanglement entropy of a reduced density matrix of some region of sites, there is a simple interface

```julia
julia> using ITensorEntropyTools

julia> ee_region(psi, [2,3,4]; verbose=true)
Contiguous region found, considering sites and bond versions
Site density matrix would be size (log2) 3.0
Complement sites would be size (log2) 7.0
Bond-based density matrix would be size (log2) 4.0
Using site mode
1.5967236103088644

julia> ee_region(psi, [2,3,4,5,6]; verbose=true)
Contiguous region found, considering sites and bond versions
Site density matrix would be size (log2) 5.0
Complement sites would be size (log2) 5.0
Bond-based density matrix would be size (log2) 4.0
Using bond mode
1.6807859305972712

julia> ee_region(psi, [1,2,3]; verbose=true)
Using bipartite calculation for region [1, 2, 3]
1.1657496391466677

```

To see more of the interface check out the [Readme](https://github.com/ryanlevy/ITensorEntropyTools.jl/blob/main/Readme.md) and [examples.](https://github.com/ryanlevy/ITensorEntropyTools.jl/tree/main/examples)

#### Other Support

There is also experimental [entanglement negativity](https://github.com/ryanlevy/ITensorEntropyTools.jl/blob/main/examples/experimental/negativity.jl) support.  
In the `network` branch there is experimental `ITensorNetworks.jl` support but future support as the API changes is not guaranteed.  
There are also tentative plans to add more density matrix tools and approximate methods for large subregions.

#### ⚠ Warning

Because the techniques are not scalable to large regions (besides bipartite ones), please use caution for large calculations. Expect to diagonalize at worst a `maxlinkdim`^2 x `maxlinkdim`^2 matrix.

This library has also not been rigorously tested so please check your results properly.

* * *

(Special shout out to @aakhan3 who collaborated on the original version of this library)
