diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 17a4df6..58d1767 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -3,8 +3,9 @@ on: push: branches: - main - tags: '*' + tags: ['*'] pull_request: + workflow_dispatch: concurrency: # Skip intermediate builds: always. # Cancel intermediate builds: only if it is a pull request build. @@ -14,6 +15,10 @@ jobs: test: name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }} runs-on: ${{ matrix.os }} + timeout-minutes: 60 + permissions: # needed to allow julia-actions/cache to proactively delete old caches that it has created + actions: write + contents: read strategy: fail-fast: false matrix: @@ -27,7 +32,7 @@ jobs: arch: - x64 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: julia-actions/setup-julia@v1 with: version: ${{ matrix.version }} @@ -36,25 +41,39 @@ jobs: - uses: julia-actions/julia-buildpkg@v1 - uses: julia-actions/julia-runtest@v1 - uses: julia-actions/julia-processcoverage@v1 - - uses: codecov/codecov-action@v2 + - uses: codecov/codecov-action@v4 with: files: lcov.info + token: ${{ secrets.CODECOV_TOKEN }} + fail_ci_if_error: false docs: name: Documentation runs-on: ubuntu-latest + permissions: + actions: write # needed to allow julia-actions/cache to proactively delete old caches that it has created + contents: write + statuses: write steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: julia-actions/setup-julia@v1 with: version: '1' + - uses: julia-actions/cache@v1 + - name: Configure doc environment + shell: julia --project=docs --color=yes {0} + run: | + using Pkg + Pkg.develop(PackageSpec(path=pwd())) + Pkg.instantiate() - uses: julia-actions/julia-buildpkg@v1 - uses: julia-actions/julia-docdeploy@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} - - run: | - julia --project=docs -e ' - using Documenter: DocMeta, doctest - using ITensorMPS - DocMeta.setdocmeta!(ITensorMPS, :DocTestSetup, :(using ITensorMPS); recursive=true) - doctest(ITensorMPS)' + - name: Run doctests + shell: julia --project=docs --color=yes {0} + run: | + using Documenter: DocMeta, doctest + using ITensorMPS + DocMeta.setdocmeta!(ITensorMPS, :DocTestSetup, :(using ITensorMPS); recursive=true) + doctest(ITensorMPS) diff --git a/.github/workflows/CompatHelper.yml b/.github/workflows/CompatHelper.yml index da266b9..cba9134 100644 --- a/.github/workflows/CompatHelper.yml +++ b/.github/workflows/CompatHelper.yml @@ -1,7 +1,7 @@ name: CompatHelper on: schedule: - - cron: '00 00 * * *' + - cron: 0 0 * * * workflow_dispatch: jobs: CompatHelper: diff --git a/.github/workflows/TagBot.yml b/.github/workflows/TagBot.yml index f49313b..0cd3114 100644 --- a/.github/workflows/TagBot.yml +++ b/.github/workflows/TagBot.yml @@ -4,6 +4,22 @@ on: types: - created workflow_dispatch: + inputs: + lookback: + default: "3" +permissions: + actions: read + checks: read + contents: write + deployments: read + issues: read + discussions: read + packages: read + pages: read + pull-requests: read + repository-projects: read + security-events: read + statuses: read jobs: TagBot: if: github.event_name == 'workflow_dispatch' || github.actor == 'JuliaTagBot' diff --git a/.github/workflows/register.yml b/.github/workflows/register.yml index 6e71f2f..5b7cd3b 100644 --- a/.github/workflows/register.yml +++ b/.github/workflows/register.yml @@ -8,6 +8,8 @@ on: jobs: register: runs-on: ubuntu-latest + permissions: + contents: write steps: - uses: julia-actions/RegisterAction@latest with: diff --git a/Project.toml b/Project.toml index 69c0bd3..1c7f5b1 100644 --- a/Project.toml +++ b/Project.toml @@ -6,10 +6,12 @@ version = "0.1.0" [deps] ITensorTDVP = "25707e16-a4db-4a07-99d9-4d67b7af0342" ITensors = "9136182c-28ba-11e9-034c-db9fb085ebd5" +Reexport = "189a3867-3050-52da-a836-e630ba90ab69" [compat] -ITensorTDVP = "0.3.0" +ITensorTDVP = "0.3" ITensors = "0.5.2" +Reexport = "1" julia = "1.6" [extras] diff --git a/README.md b/README.md index 6c56278..cf554f4 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,11 @@ # ITensorMPS.jl + +[![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://itensor.github.io/ITensorMPS.jl/stable/) +[![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://itensor.github.io/ITensorMPS.jl/dev/) +[![Build Status](https://github.com/ITensor/ITensorMPS.jl/actions/workflows/CI.yml/badge.svg?branch=main)](https://github.com/ITensor/ITensorMPS.jl/actions/workflows/CI.yml?query=branch%3Amain) +[![Coverage](https://codecov.io/gh/ITensor/ITensorMPS.jl/branch/main/graph/badge.svg)](https://codecov.io/gh/ITensor/ITensorMPS.jl) +[![Code Style: Blue](https://img.shields.io/badge/code%20style-blue-4495d1.svg)](https://github.com/invenia/BlueStyle) + MPS and MPO methods based on ITensor (ITensors.jl). This package supercedes the MPS codes previously located in the ITensors.jl and ITensorTDVP.jl packages, including applications like DMRG, TDVP, applying MPO to MPS, applying gates, etc. diff --git a/docs/Project.toml b/docs/Project.toml new file mode 100644 index 0000000..dfa65cd --- /dev/null +++ b/docs/Project.toml @@ -0,0 +1,2 @@ +[deps] +Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" diff --git a/docs/make.jl b/docs/make.jl new file mode 100644 index 0000000..3468de0 --- /dev/null +++ b/docs/make.jl @@ -0,0 +1,16 @@ +using ITensorMPS +using Documenter + +DocMeta.setdocmeta!(ITensorMPS, :DocTestSetup, :(using ITensorMPS); recursive=true) + +makedocs(; + modules=[ITensorMPS], + authors="ITensor developers", + sitename="ITensorMPS.jl", + format=Documenter.HTML(; + canonical="https://ITensor.github.io/ITensorMPS.jl", edit_link="main", assets=String[] + ), + pages=["Home" => "index.md"], +) + +deploydocs(; repo="github.com/ITensor/ITensorMPS.jl", devbranch="main") diff --git a/docs/src/index.md b/docs/src/index.md new file mode 100644 index 0000000..6dbda31 --- /dev/null +++ b/docs/src/index.md @@ -0,0 +1,14 @@ +```@meta +CurrentModule = ITensorMPS +``` + +# ITensorMPS + +Documentation for [ITensorMPS](https://github.com/ITensor/ITensorMPS.jl). + +```@index +``` + +```@autodocs +Modules = [ITensorMPS] +``` diff --git a/src/ITensorMPS.jl b/src/ITensorMPS.jl index f302f08..842d279 100644 --- a/src/ITensorMPS.jl +++ b/src/ITensorMPS.jl @@ -1,5 +1,169 @@ module ITensorMPS - -# Write your package code here. - +using Reexport: @reexport +@reexport using ITensorTDVP: TimeDependentSum, dmrg_x, linsolve, tdvp, to_vec +using ITensorTDVP: ITensorTDVP +const alternating_update_dmrg = ITensorTDVP.dmrg +@reexport using ITensors.ITensorMPS: + @OpName_str, + @SiteType_str, + @StateName_str, + @TagType_str, + @ValName_str, + @preserve_ortho, + @visualize, + @visualize!, + @visualize_noeval, + @visualize_noeval!, + @visualize_sequence, + @visualize_sequence_noeval, + AbstractMPS, + AbstractObserver, + Apply, + AutoMPO, + DMRGMeasurement, + DMRGObserver, + Lattice, + LatticeBond, + MPO, + MPS, + NoObserver, + Op, + OpName, + OpSum, + Ops, + Prod, + ProjMPO, + ProjMPOSum, + ProjMPO_MPS, + Scaled, + SiteType, + Spectrum, + StateName, + Sum, + Sweeps, + TagType, # deprecate + Trotter, + ValName, + add, + add!, + apply, + applyMPO, + applympo, + argsdict, + checkdone!, # remove export + coefficient, + common_siteind, + common_siteinds, + convert_leaf_eltype, # remove export + correlation_matrix, + cutoff, + cutoff!, # deprecate + disk, + dmrg, + dot, # remove export + eigs, # deprecate + energies, # deprecate + entropy, # deprecate + errorMPOprod, # deprecate + error_contract, + error_mpoprod, # deprecate + error_mul, # deprecate + expect, + findfirstsiteind, # deprecate + findfirstsiteinds, # deprecate + findsite, # deprecate + findsites, # deprecate + firstsiteind, # deprecate + firstsiteinds, # deprecate + get_cutoffs, # deprecate + get_maxdims, # deprecate + get_mindims, # deprecate + get_noises, # deprecate + has_fermion_string, # remove export + hassameinds, + inner, + isortho, + linkdim, + linkdims, + linkind, + linkindex, + linkinds, + logdot, + loginner, + lognorm, + lproj, + maxdim, + maxdim!, + maxlinkdim, + measure!, + measurements, + mindim, + mindim!, + movesite, + movesites, + mul, # deprecate + multMPO, + multmpo, + noise, + noise!, + noiseterm, + nsite, + nsweep, + op, + ops, + orthoCenter, + ortho_lims, + orthocenter, + orthogonalize, + orthogonalize!, + outer, + position!, + product, + primelinks!, + productMPS, + projector, + promote_itensor_eltype, + randomITensor, + randomMPO, + randomMPS, + replace_siteinds, + replace_siteinds!, + replacebond, + replacebond!, + replaceprime, + replacesites!, + reset_ortho_lims!, + rproj, + sample, + sample!, + set_leftlim!, + set_ortho_lims!, + set_rightlim!, + setcutoff!, + setmaxdim!, + setmindim!, + setnoise!, + simlinks!, + siteind, + siteindex, + siteinds, + splitblocks, + square_lattice, + state, + sum, + swapbondsites, + sweepnext, + tensors, + toMPO, + totalqn, + tr, + triangular_lattice, + truncate, + truncate!, + truncerror, + truncerrors, + unique_siteind, + unique_siteinds, + val, + ⋅ end diff --git a/test/Project.toml b/test/Project.toml new file mode 100644 index 0000000..72cc60a --- /dev/null +++ b/test/Project.toml @@ -0,0 +1,5 @@ +[deps] +ITensorMPS = "0d1a4710-d33b-49a5-8f18-73bdf49b47e2" +ITensorTDVP = "25707e16-a4db-4a07-99d9-4d67b7af0342" +ITensors = "9136182c-28ba-11e9-034c-db9fb085ebd5" +Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" diff --git a/test/runtests.jl b/test/runtests.jl index bfca00c..a820021 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,6 +1,24 @@ -using ITensorMPS -using Test - +@eval module $(gensym()) +using ITensorMPS: ITensorMPS +using ITensorTDVP: ITensorTDVP +using ITensors: ITensors +include("utils/TestITensorMPSExportedNames.jl") +using Test: @test, @testset @testset "ITensorMPS.jl" begin - # Write your tests here. + @testset "exports" begin + @test issetequal( + names(ITensorMPS), + [ + [:ITensorMPS] + # ITensorTDVP reexports + [:TimeDependentSum, :dmrg_x, :linsolve, :tdvp, :to_vec] + # ITensors and ITensors.ITensorMPS reexports + TestITensorMPSExportedNames.ITENSORMPS_EXPORTED_NAMES + ], + ) + end + @testset "aliases" begin + @test ITensorMPS.alternating_update_dmrg === ITensorTDVP.dmrg + end +end end diff --git a/test/utils/TestITensorMPSExportedNames.jl b/test/utils/TestITensorMPSExportedNames.jl new file mode 100644 index 0000000..158a847 --- /dev/null +++ b/test/utils/TestITensorMPSExportedNames.jl @@ -0,0 +1,167 @@ +module TestITensorMPSExportedNames +const ITENSORMPS_EXPORTED_NAMES = [ + Symbol("@OpName_str"), + Symbol("@SiteType_str"), + Symbol("@StateName_str"), + Symbol("@TagType_str"), + Symbol("@ValName_str"), + Symbol("@preserve_ortho"), + Symbol("@visualize"), + Symbol("@visualize!"), + Symbol("@visualize_noeval"), + Symbol("@visualize_noeval!"), + Symbol("@visualize_sequence"), + Symbol("@visualize_sequence_noeval"), + :AbstractMPS, + :AbstractObserver, + :Apply, + :AutoMPO, + :DMRGMeasurement, + :DMRGObserver, + :ITensorMPS, + :Lattice, + :LatticeBond, + :MPO, + :MPS, + :NoObserver, + :Op, + :OpName, + :OpSum, + :Ops, + :Prod, + :ProjMPO, + :ProjMPOSum, + :ProjMPO_MPS, + :Scaled, + :SiteType, + :Spectrum, + :StateName, + :Sum, + :TagType, + :Sweeps, + :Trotter, + :ValName, + :add, + :add!, + :apply, + :applyMPO, + :applympo, + :argsdict, + :checkdone!, + :coefficient, + :common_siteind, + :common_siteinds, + :convert_leaf_eltype, + :correlation_matrix, + :cutoff, + :cutoff!, + :disk, + :dmrg, + :dot, + :eigs, + :energies, + :entropy, + :errorMPOprod, + :error_contract, + :error_mpoprod, + :error_mul, + :expect, + :findfirstsiteind, + :findfirstsiteinds, + :findsite, + :findsites, + :firstsiteind, + :firstsiteinds, + :get_cutoffs, + :get_maxdims, + :get_mindims, + :get_noises, + :has_fermion_string, + :hassameinds, + :inner, + :isortho, + :linkdim, + :linkdims, + :linkind, + :linkindex, + :linkinds, + :logdot, + :loginner, + :lognorm, + :lproj, + :maxdim, + :maxdim!, + :maxlinkdim, + :measure!, + :measurements, + :mindim, + :mindim!, + :movesite, + :movesites, + :mul, + :multMPO, + :multmpo, + :noise, + :noise!, + :noiseterm, + :nsite, + :nsweep, + :op, + :ops, + :orthoCenter, + :ortho_lims, + :orthocenter, + :orthogonalize, + :orthogonalize!, + :outer, + :position!, + :product, + :primelinks!, + :productMPS, + :projector, + :promote_itensor_eltype, + :randomITensor, + :randomMPO, + :randomMPS, + :replace_siteinds, + :replace_siteinds!, + :replacebond, + :replacebond!, + :replaceprime, + :replacesites!, + :reset_ortho_lims!, + :rproj, + :sample, + :sample!, + :set_leftlim!, + :set_ortho_lims!, + :set_rightlim!, + :setcutoff!, + :setmaxdim!, + :setmindim!, + :setnoise!, + :simlinks!, + :siteind, + :siteindex, + :siteinds, + :splitblocks, + :square_lattice, + :state, + :sum, + :swapbondsites, + :sweepnext, + :tensors, + :toMPO, + :totalqn, + :tr, + :triangular_lattice, + :truncate, + :truncate!, + :truncerror, + :truncerrors, + :unique_siteind, + :unique_siteinds, + :val, + :⋅, +] +end