itensors.jl
A Julia library for efficient tensor computations and tensor network calculations. ITensors.jl is supported by the Simons Foundation's Flatiron Institute.
Science Score: 77.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 4 DOI reference(s) in README -
✓Academic publication links
Links to: arxiv.org -
✓Committers with academic emails
11 of 55 committers (20.0%) from academic institutions -
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (13.9%) to scientific vocabulary
Keywords
Keywords from Contributors
Repository
A Julia library for efficient tensor computations and tensor network calculations. ITensors.jl is supported by the Simons Foundation's Flatiron Institute.
Basic Info
- Host: GitHub
- Owner: ITensor
- License: apache-2.0
- Language: Julia
- Default Branch: main
- Homepage: https://itensor.org
- Size: 53.3 MB
Statistics
- Stars: 610
- Watchers: 23
- Forks: 127
- Open Issues: 83
- Releases: 187
Topics
Metadata Files
README.md
ITensors.jl
ITensor is a library for rapidly creating correct and efficient tensor network algorithms.
| Documentation|Citation|
|:----------------:|:----------:|
|
|
|
|Version|Download Statistics|Style Guide|License|
|:---------:|:---------------------:|:-------------:|:---------:|
||
|
|
|
The source code for ITensors.jl can be found on Github.
Additional documentation can be found on the ITensor website itensor.org.
An ITensor is a tensor whose interface is independent of its memory layout. ITensor indices are objects which carry extra information and which 'recognize' each other (compare equal to each other).
The ITensorMPS.jl library includes composable and extensible algorithms for optimizing and transforming tensor networks, such as matrix product state and matrix product operators, such as the DMRG algorithm. If you are looking for information on running finite MPS/MPO calculations such as DMRG, take a look at the ITensorMPS.jl documentation.
Support
ITensors.jl is supported by the Flatiron Institute, a division of the Simons Foundation.
News
March 26, 2025: ITensors.jl v0.9 has been released. This is a minor breaking change since the
optimal_contraction_sequencefunction now passes to theoptimaltreefunction from TensorOperations.jl. TheTensorOperationspackage therefore needs to be loaded in order foroptimal_contraction_sequenceto be used or if the flagITensors.enable_contraction_sequence_optimization()is switched on.March 22, 2025: As part of the latest release of ITensors.jl (v0.8.3), all documentation related to MPS/MPO functionality has been moved to the ITensorMPS.jl documentation.
February 22, 2025: Please note that there were issues installing the latest version of ITensors.jl (ITensors.jl v0.8) in older versions of Julia v1.10 and v1.11 (https://github.com/ITensor/ITensors.jl/issues/1618, https://itensor.discourse.group/t/typeparameteraccessors-not-found-error-on-julia-v-1-10-0/2260). This issue has been fixed in NDTensors.jl v0.4.4, so please try updating your packages if you are using older versions of Julia v1.10 or v1.11 and running into issues installing ITensors.jl.
February 3, 2025: ITensors.jl v0.8 has been released. This release should not be breaking to the average user using documented features of the library. This removes internal submodules that held experimental code for rewriting the internals of NDTensors.jl/ITensors.jl, which have now been turned into separate packages for future development. It is marked as breaking since ITensorMPS.jl was making use of some of that experimental code, and will be updated accordingly. Also note that it fixes an issue that existed in some more recent versions of NDTensors.jl v0.3/ITensors.jl v0.7 where loading ITensors.jl in combination with some packages like LinearMaps.jl caused very long load/compile times (https://itensor.discourse.group/t/linearmaps-and-itensors-incompatibility/2216), so if you are seeing that issue when using ITensors.jl v0.7 you should upgrade to this version.
October 25, 2024: ITensors.jl v0.7 has been released. This is a major breaking change, since all of the MPS/MPO functionality from this package has been moved to ITensorMPS.jl, along with all of the functionality of ITensorTDVP.jl. If you want to use MPS/MPO types and related functionality, such as
MPS,MPO,dmrg,siteinds,OpSum,op, etc. you now must install and load the ITensorMPS.jl package. Additionally, if you are using ITensorTDVP.jl in your code, please changeusing ITensorTDVPtousing ITensorMPS. ITensorMPS.jl has all of the same functionality as ITensorTDVP.jl, and ITensorTDVP.jl will be deprecated in favor of ITensorMPS.jl. Note: If you are usingITensors.compile, you must now install and load the ITensorMPS.jl package in order to trigger it to load properly, since it relies on running MPS/MPO functionality as example code for Julia to compile.May 9, 2024: A new package ITensorMPS.jl has been released. We plan to move all of the MPS/MPO functionality in ITensors.jl to ITensorMPS.jl. For now, ITensorMPS.jl just re-exports the MPS/MPO functionality of ITensors.jl (as well as of ITensorTDVP.jl), such as
dmrg,siteinds,MPS,MPO, etc. To prepare for the change over to ITensorMPS.jl, please changeusing ITensorstousing ITensors, ITensorMPSin any code that makes use of MPS/MPO functionality, and if you are using ITensorTDVP.jl changeusing ITensorTDVPtousing ITensorMPSin your code.May 8, 2024: ITensors.jl v0.6 has been released. This version deletes the experimental "combine-contract" contraction backend, which was enabled by
ITensors.enable_combine_contract(). This feature enabled performing ITensor contractions by first combining indices and then performing contractions as matrix multiplications, which potentially could lead to speedups for certain contractions involving higher-order QN-conserving tensors. However, the speedups weren't consistent with the current implementation, and this feature will be incorporated into the library in a more systematic way when we release our new non-abelian symmetric tensor backend.May 2, 2024: ITensors.jl v0.5 has been released. This version removes PackageCompiler.jl as a dependency and moves the package compilation functionality into a package extension. In order to use the
ITensors.compile()function going forward, you need to install the PackageCompiler.jl package withusing Pkg: Pkg; Pkg.add("PackageCompiler")and putusing PackageCompilertogether withusing ITensorsin your code.April 16, 2024: ITensors.jl v0.4 has been released. This version removes HDF5.jl as a dependency and moves the HDF5 read and write functions for ITensor, MPS, MPO, and other associated types into a package extension. To enable ITensor HDF5 features, install the HDF5.jl package with
using Pkg: Pkg; Pkg.add("HDF5")and putusing HDF5together withusing ITensorsin your code. Other recent changes include support for multiple GPU backends using package extensions.March 25, 2022: ITensors.jl v0.3 has been released. The main breaking change is that we no longer support versions of Julia below 1.6. Julia 1.6 is the long term support version of Julia (LTS), which means that going forward versions below Julia 1.6 won't be as well supported with bug fixes and improvements. Additionally, Julia 1.6 introduced many improvements including syntax improvements that we would like to start using with ITensors.jl, which becomes challenging if we try to support Julia versions below 1.6. See here and here for some nice summaries of the Julia 1.6 release.
Jun 09, 2021: ITensors.jl v0.2 has been released, with a few breaking changes as well as a variety of bug fixes and new features. Take a look at the upgrade guide for help upgrading your code.
Installation
The ITensors package can be installed with the Julia package manager.
From the Julia REPL, type ] to enter the Pkg REPL mode and run:
~ julia
```julia julia> ]
pkg> add ITensors ```
Or, equivalently, via the Pkg API:
julia
julia> import Pkg; Pkg.add("ITensors")
Please note that right now, ITensors.jl requires that you use Julia v1.3 or later (since ITensors.jl relies on a feature that was introduced in Julia v1.3).
We recommend using ITensors.jl with Intel MKL in order to get the best possible performance. If you have not done so already, you can replace your current BLAS and LAPACK implementation with MKL by using the MKL.jl package. Please follow the instructions here.
Documentation
- LATEST -- documentation of the latest version.
Citation
If you use ITensor in your work, please cite the ITensor Paper:
bib
@article{ITensor,
title={{The ITensor Software Library for Tensor Network Calculations}},
author={Matthew Fishman and Steven R. White and E. Miles Stoudenmire},
journal={SciPost Phys. Codebases},
pages={4},
year={2022},
publisher={SciPost},
doi={10.21468/SciPostPhysCodeb.4},
url={https://scipost.org/10.21468/SciPostPhysCodeb.4},
}
and associated "Codebase Release" for the version you have used. The current one is
bib
@article{ITensor-r0.3,
title={{Codebase release 0.3 for ITensor}},
author={Matthew Fishman and Steven R. White and E. Miles Stoudenmire},
journal={SciPost Phys. Codebases},
pages={4-r0.3},
year={2022},
publisher={SciPost},
doi={10.21468/SciPostPhysCodeb.4-r0.3},
url={https://scipost.org/10.21468/SciPostPhysCodeb.4-r0.3},
}
ITensor Code Samples
Basic Overview
ITensor construction, setting of elements, contraction, and addition. Before constructing an ITensor, one constructs Index objects representing tensor indices.
```julia using ITensors let i = Index(3) j = Index(5) k = Index(2) l = Index(7)
A = ITensor(i,j,k) B = ITensor(j,l)
# Set elements of A A[i=>1,j=>1,k=>1] = 11.1 A[i=>2,j=>1,k=>2] = -21.2 A[k=>1,i=>3,j=>1] = 31.1 # can provide Index values in any order # ...
# Contract over shared index j C = A * B
@show hasinds(C,i,k,l) # = true
D = random_itensor(k,j,i) # ITensor with random elements
# Add two ITensors # must have same set of indices # but can be in any order R = A + D
nothing end
output
hasinds(C, i, k, l) = true ```
Singular Value Decomposition (SVD) of a Matrix
In this example, we create a random 10x20 matrix
and compute its SVD. The resulting factors can
be simply multiplied back together using the
ITensor * operation, which automatically recognizes
the matching indices between U and S, and between S and V
and contracts (sums over) them.
```julia using ITensors let i = Index(10) # index of dimension 10 j = Index(20) # index of dimension 20 M = random_itensor(i,j) # random matrix, indices i,j U,S,V = svd(M,i) # compute SVD with i as row index @show M ≈ USV # = true
nothing end
output
M ≈ U * S * V = true ```
Singular Value Decomposition (SVD) of a Tensor
In this example, we create a random 4x4x4x4 tensor
and compute its SVD, temporarily treating the indices i and k
together as the "row" index and j and l as the "column" index
for the purposes of the SVD. The resulting factors can
be simply multiplied back together using the
ITensor * operation, which automatically recognizes
the matching indices between U and S, and between S and V
and contracts (sums over) them.

```julia using ITensors let i = Index(4,"i") j = Index(4,"j") k = Index(4,"k") l = Index(4,"l") T = random_itensor(i,j,k,l) U,S,V = svd(T,i,k) # compute SVD with (i,k) as row indices (indices of U) @show hasinds(U,i,k) # = true @show hasinds(V,j,l) # = true @show T ≈ USV # = true
nothing end
output
hasinds(U, i, k) = true hasinds(V, j, l) = true T ≈ U * S * V = true ```
Tensor Indices: Tags and Prime Levels
Before making an ITensor, you have to define its indices. Tensor Index objects carry extra information beyond just their dimension.
All Index objects carry a permanent, immutable id number which is determined when it is constructed, and allow it to be matched (compare equal) with copies of itself.
Additionally, an Index can have up to four tag strings, and an integer primelevel. If two Index objects have different tags or different prime levels, they do not compare equal even if they have the same id.
Tags are also useful for identifying Index objects when printing tensors, and for performing certain Index manipulations (e.g. priming indices having certain sets of tags).
```julia using ITensors let i = Index(3) # Index of dimension 3 @show dim(i) # = 3 @show id(i) # = 0x5d28aa559dd13001 or similar
ci = copy(i) @show ci == i # = true
j = Index(5,"j") # Index with a tag "j"
@show j == i # = false
s = Index(2,"n=1,Site") # Index with two tags, # "Site" and "n=1" @show hastags(s,"Site") # = true @show hastags(s,"n=1") # = true
i1 = prime(i) # i1 has a "prime level" of 1 # but otherwise same properties as i @show i1 == i # = false, prime levels do not match
nothing end
output
dim(i) = 3 id(i) = 0x5d28aa559dd13001 ci == i = true j == i = false hastags(s, "Site") = true hastags(s, "n=1") = true i1 == i = false ```
Owner
- Name: ITensor
- Login: ITensor
- Kind: organization
- Email: mstoudenmire@flatironinstitute.org
- Website: itensor.org
- Twitter: itensorlib
- Repositories: 24
- Profile: https://github.com/ITensor
A software library for developing and performing state of the art tensor network calculations.
Citation (CITATION.cff)
cff-version: 1.1.0
authors:
- family-names: Fishman
given-names: Matthew
- family-names: White
given-names: Steven R.
orcid: "https://orcid.org/0000-0003-3496-0707"
- family-names: Stoudenmire
given-names: E. Miles
orcid: "https://orcid.org/0000-0003-3389-9692"
references:
- type: article
authors:
- family-names: Fishman
given-names: Matthew
- family-names: White
given-names: Steven R.
orcid: "https://orcid.org/0000-0003-3496-0707"
- family-names: Stoudenmire
given-names: E. Miles
orcid: "https://orcid.org/0000-0003-3389-9692"
title: "The ITensor Software Library for Tensor Network Calculations"
status: "preprint"
number: "2007.14822"
identifiers: "arXiv:2007.14822"
url: "https://arxiv.org/abs/2007.14822"
date-released: 2020-07-28
repository-code: "https://arxiv.org/abs/2007.14822"
message: "Please cite the following article when using this software."
license: "Apache-2.0"
version: "0.2"
identifiers:
- type: "other"
value: "arXiv:2007.14822"
title: "The ITensor Software Library for Tensor Network Calculations"
GitHub Events
Total
- Create event: 105
- Commit comment event: 154
- Release event: 32
- Issues event: 51
- Watch event: 72
- Delete event: 62
- Issue comment event: 353
- Push event: 563
- Pull request review comment event: 83
- Pull request review event: 84
- Pull request event: 190
- Fork event: 11
Last Year
- Create event: 105
- Commit comment event: 154
- Release event: 32
- Issues event: 51
- Watch event: 72
- Delete event: 62
- Issue comment event: 353
- Push event: 563
- Pull request review comment event: 83
- Pull request review event: 84
- Pull request event: 190
- Fork event: 11
Committers
Last synced: about 2 years ago
Top Committers
| Name | Commits | |
|---|---|---|
| Miles Stoudenmire | m****e@g****m | 1,209 |
| Matt Fishman | m****n | 489 |
| Matthew Fishman | m****n@f****g | 479 |
| Katharine Hyatt | k****t@f****g | 76 |
| github-actions[bot] | 4****] | 52 |
| Karl Pierce | k****5@v****u | 38 |
| orialb | o****1@g****m | 36 |
| Christopher White | c****e@a****u | 22 |
| Matthew Fishman | m****n@c****u | 21 |
| Katharine Hyatt | k****t | 20 |
| Mason Protter | m****r@g****m | 12 |
| Yiqing Zhou | z****y@g****m | 10 |
| Jan | j****r@t****o | 10 |
| Michael Abbott | 3****t | 6 |
| Ryan Levy | r****3@i****u | 6 |
| Hyeongjin Kim | 4****t | 5 |
| Giacomo Torlai | t****o@g****m | 5 |
| alvarorga | a****a@h****m | 5 |
| b-kloss | b****s@g****m | 4 |
| Tomohiro Soejima | t****a@b****u | 4 |
| Dominic Rose | d****e@g****m | 4 |
| Nick Robinson | n****1@g****m | 3 |
| Jan Schneider | 9****r | 3 |
| Matthew Fishman | m****n@l****l | 3 |
| Miles Stoudenmire | m****e@f****g | 3 |
| Jan N. Reimers | j****s@g****m | 2 |
| Satoshi Terasaki | t****h@g****m | 2 |
| Yiqing Zhou | 3****y | 2 |
| Lander Burgelman | 3****l | 2 |
| Leandro Chinellato | 3****o | 1 |
| and 25 more... | ||
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 170
- Total pull requests: 504
- Average time to close issues: about 2 months
- Average time to close pull requests: 18 days
- Total issue authors: 56
- Total pull request authors: 38
- Average comments per issue: 4.96
- Average comments per pull request: 3.38
- Merged pull requests: 373
- Bot issues: 0
- Bot pull requests: 74
Past Year
- Issues: 30
- Pull requests: 136
- Average time to close issues: 1 day
- Average time to close pull requests: 9 days
- Issue authors: 17
- Pull request authors: 14
- Average comments per issue: 1.67
- Average comments per pull request: 1.88
- Merged pull requests: 98
- Bot issues: 0
- Bot pull requests: 27
Top Authors
Issue Authors
- mtfishman (86)
- emstoudenmire (13)
- kmp5VT (11)
- ArtemStrashko (8)
- ogauthe (8)
- VinceNeede (4)
- amilsted (4)
- jtschneider (4)
- NuclearPowerNerd (3)
- GTorlai (3)
- ntausend (3)
- iagoleal (2)
- JanReimers (2)
- AFeuerpfeil (2)
- MasonProtter (2)
Pull Request Authors
- mtfishman (320)
- github-actions[bot] (101)
- kmp5VT (96)
- emstoudenmire (61)
- ogauthe (27)
- ryanlevy (15)
- kshyatt (14)
- corbett5 (14)
- dependabot[bot] (13)
- lkdvos (8)
- JanReimers (6)
- b-kloss (6)
- VinceNeede (5)
- pre-commit-ci[bot] (5)
- andrewkhardy (4)
Top Labels
Issue Labels
Pull Request Labels
Dependencies
- JuliaRegistries/TagBot v1 composite
- actions/checkout v2 composite
- julia-actions/setup-julia latest composite
- actions/checkout v2 composite
- julia-actions/setup-julia v1 composite
- actions/checkout v2 composite
- peter-evans/create-pull-request v3 composite
- actions/checkout v2 composite
- julia-actions/setup-julia latest composite
- reviewdog/action-suggester v1 composite
- julia-actions/RegisterAction latest composite
- actions/checkout v2 composite
- julia-actions/setup-julia latest composite
- nvidia/cuda 11.4.2-cudnn8-devel-ubuntu20.04 build
- actions/checkout v3 composite
- actions/setup-node v3 composite
- julia-actions/setup-julia latest composite
- myrotvorets/set-commit-status-action master composite
- xt0rted/pull-request-comment-branch v1 composite
- actions/checkout v3 composite
- actions/github-script v6 composite
- actions/setup-node v3 composite
- myrotvorets/set-commit-status-action master composite
- xt0rted/pull-request-comment-branch v1 composite
- actions/checkout v3 composite
- actions/github-script v6 composite
- actions/setup-node v3 composite
- julia-actions/setup-julia latest composite
- myrotvorets/set-commit-status-action master composite
- xt0rted/pull-request-comment-branch v1 composite
- actions/cache v1 composite
- actions/checkout v3 composite
- actions/github-script v6 composite
- actions/setup-node v3 composite
- julia-actions/setup-julia latest composite
- myrotvorets/set-commit-status-action master composite
- xt0rted/pull-request-comment-branch v1 composite
- actions/checkout v3 composite
- actions/github-script v6 composite
- actions/setup-node v3 composite
- julia-actions/julia-uploadcodecov latest composite
- julia-actions/setup-julia latest composite
- myrotvorets/set-commit-status-action master composite
- xt0rted/pull-request-comment-branch v1 composite
- actions/checkout v3 composite
- actions/github-script v6 composite
- actions/setup-node v3 composite
- julia-actions/setup-julia latest composite
- myrotvorets/set-commit-status-action master composite
- xt0rted/pull-request-comment-branch v1 composite
- actions/checkout v3 composite
- actions/github-script v6 composite
- actions/setup-node v3 composite
- julia-actions/setup-julia latest composite
- myrotvorets/set-commit-status-action master composite
- xt0rted/pull-request-comment-branch v1 composite
- actions/checkout v2 composite
- julia-actions/setup-julia latest composite
- actions/cache v1 composite
- actions/checkout v2 composite
- julia-actions/setup-julia latest composite
- actions/checkout v2 composite
- julia-actions/julia-uploadcodecov latest composite
- julia-actions/setup-julia latest composite
- actions/checkout v2 composite
- julia-actions/julia-uploadcodecov latest composite
- julia-actions/setup-julia latest composite
- actions/checkout v2 composite
- julia-actions/setup-julia latest composite
- actions/checkout v2 composite
- julia-actions/setup-julia latest composite
- actions/checkout v2 composite
- julia-actions/julia-uploadcodecov latest composite
- julia-actions/setup-julia latest composite