Skip to content

Commit

Permalink
Fix doctest errors
Browse files Browse the repository at this point in the history
  • Loading branch information
emstoudenmire committed Mar 18, 2021
1 parent c9bf435 commit 2f07e48
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 16 deletions.
8 changes: 4 additions & 4 deletions docs/src/AdvancedUsageGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -756,8 +756,8 @@ Advanced users might notice something strange about the definition
of the ITensor type, that it is often not "type stable". Some of
this is by design. The definition for ITensor is:
```julia
mutable struct ITensor{N}
inds::IndexSet{N}
mutable struct ITensor
inds::IndexSet
store::TensorStorage
end
```
Expand All @@ -774,7 +774,7 @@ julia> A = randomITensor(i, i');
julia> @code_warntype A[i=>1, i'=>2]
Variables
#self#::Core.Compiler.Const(getindex, false)
T::ITensor{1}
T::ITensor
ivs::Tuple{Pair{Index{Int64},Int64}}
p::Tuple{Union{Nothing, Int64}}
vals::Tuple{Any}
Expand All @@ -789,7 +789,7 @@ Body::Number
%7 = Base.broadcasted(ITensors.val, ivs)::Base.Broadcast.Broadcasted{Base.Broadcast.Style{Tuple},Nothing,typeof(val),Tuple{Tuple{Pair{Index{Int64},Int64}}}}
%8 = Base.materialize(%7)::Tuple{Int64}
│ (vals = (%6)(%8, p))
%10 = Core.tuple(T)::Tuple{ITensor{1}}
%10 = Core.tuple(T)::Tuple{ITensor}
%11 = Core._apply_iterate(Base.iterate, Base.getindex, %10, vals)::Number
%12 = Core.typeassert(%11, ITensors.Number)::Number
└── return %12
Expand Down
8 changes: 4 additions & 4 deletions docs/src/ITensorType.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,17 @@ delta(::Type{<:Number}, ::QN, ::ITensors.Indices)
## Convert to Array

```@docs
Array{ElT, N}(::ITensor{N}, ::Vararg{Index, N}) where {ElT, N}
Array{ElT, N}(::ITensor, ::Vararg{Index, N}) where {ElT, N}
array(::ITensor)
matrix(::ITensor{2})
vector(::ITensor{1})
matrix(::ITensor)
vector(::ITensor)
```

## Getting and setting elements

```@docs
getindex(::ITensor, ::Any...)
getindex(::ITensor{N}, ::Vararg{Int,N}) where {N}
getindex(::ITensor, ::Vararg{Int,N}) where {N}
setindex!(::ITensor, ::Number, ::Any...)
setindex!(::ITensor, ::Number, ::Int...)
```
Expand Down
15 changes: 7 additions & 8 deletions docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ It originates in physics with the purpose of finding
eigenvectors of Hamiltonian (energy) matrices which model
the behavior of quantum systems.

```jldoctest; output=false, filter=[r"After sweep [1-5] energy=\-[0-9]{3}\.[0-9]{10,16} maxlinkdim=[0-9]{1,3} time=[0-9]{1,2}\.[0-9]{3}", r"Final energy = \-138\.[0-9]{10,16}"]
```jldoctest; output=false, filter=[r"After sweep [1-5] energy=\-[0-9]{3}\.[0-9]{10,16} maxlinkdim=[0-9]{1,3} maxerr=[0-9]{1,2}\.[0-9]{1,3}E\-[0-9]{1,2} time=[0-9]{1,2}\.[0-9]{3}", r"Final energy = \-138\.[0-9]{10,16}"]
using ITensors
let
# Create 100 spin-one indices
Expand Down Expand Up @@ -347,11 +347,10 @@ sweeps = Sweeps
4 cutoff=1.0E-10, maxdim=100, mindim=1, noise=0.0E+00
5 cutoff=1.0E-10, maxdim=200, mindim=1, noise=0.0E+00
After sweep 1 energy=-137.845841178879 maxlinkdim=9 time=8.538
After sweep 2 energy=-138.935378608196 maxlinkdim=20 time=0.316
After sweep 3 energy=-138.940079710492 maxlinkdim=88 time=1.904
After sweep 4 energy=-138.940086018149 maxlinkdim=100 time=4.179
After sweep 5 energy=-138.940086075413 maxlinkdim=96 time=4.184
Final energy = -138.94008607296038
After sweep 1 energy=-137.954199761732 maxlinkdim=9 maxerr=2.43E-16 time=9.356
After sweep 2 energy=-138.935058943878 maxlinkdim=20 maxerr=4.97E-06 time=0.671
After sweep 3 energy=-138.940080155429 maxlinkdim=92 maxerr=1.00E-10 time=4.522
After sweep 4 energy=-138.940086009318 maxlinkdim=100 maxerr=1.05E-10 time=11.644
After sweep 5 energy=-138.940086058840 maxlinkdim=96 maxerr=1.00E-10 time=12.771
Final energy = -138.94008605883985
```

0 comments on commit 2f07e48

Please sign in to comment.