Skip to content
6 changes: 4 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "ITensorBase"
uuid = "4795dd04-0d67-49bb-8f44-b89c448a1dc7"
version = "0.6.3"
version = "0.7.0"
authors = ["ITensor developers <support@itensor.org> and contributors"]

[workspace]
Expand All @@ -14,6 +14,7 @@ Combinatorics = "861a8166-3701-5b0c-9a16-15d98fcdc6aa"
Compat = "34da2185-b29b-5c13-b0c7-acf172513d20"
ConstructionBase = "187b0558-2788-49d3-abe0-74a17ed4e7c9"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
MatrixAlgebraKit = "6c742aac-3347-4629-af66-fc926824e5e4"
OrderedCollections = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
SimpleTraits = "699a6c99-e7fa-54fc-8d76-47d257e15c1d"
Expand Down Expand Up @@ -46,11 +47,12 @@ Combinatorics = "1"
Compat = "4.16"
ConstructionBase = "1.6"
LinearAlgebra = "1.10"
MatrixAlgebraKit = "0.2, 0.3, 0.4, 0.5, 0.6"
Mooncake = "0.4.202, 0.5"
OrderedCollections = "1.6"
Random = "1.10"
SimpleTraits = "0.9.4"
TensorAlgebra = "0.9.6"
TensorAlgebra = "0.10"
TensorOperations = "5.3.1"
TermInterface = "2"
TupleTools = "1.6"
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ julia> Pkg.add("ITensorBase")
## Examples

````julia
using ITensorBase: ITensorBase, ITensor, Index, aligndims, dename
using LinearAlgebra: qr
using ITensorBase: ITensorBase, ITensor, Index, aligndims, unname
using MatrixAlgebraKit: qr_compact
using Test: @test
i = Index(2)
j = Index(2)
Expand All @@ -54,11 +54,11 @@ a = randn(i, j)
a′ = randn(j, i)
b = randn(j, k)
c = a * b
@test dename(c, (i, k)) ≈ dename(a, (i, j)) * dename(b, (j, k))
@test unname(c, (i, k)) ≈ unname(a, (i, j)) * unname(b, (j, k))
d = a + a′
@test dename(d, (i, j)) ≈ dename(a, (i, j)) + dename(a′, (i, j))
@test unname(d, (i, j)) ≈ unname(a, (i, j)) + unname(a′, (i, j))
@test a ≈ aligndims(a, (j, i))
q, r = qr(a, (i,))
q, r = qr_compact(a, (i,))
@test q * r ≈ a
````

Expand Down
6 changes: 4 additions & 2 deletions docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
ITensorBase = "4795dd04-0d67-49bb-8f44-b89c448a1dc7"
ITensorFormatter = "b6bf39f1-c9d3-4bad-aad8-593d802f65fd"
Literate = "98b081ad-f1c9-55d3-8b20-4c87d4299306"
MatrixAlgebraKit = "6c742aac-3347-4629-af66-fc926824e5e4"
TensorAlgebra = "68bd88dc-f39d-4e12-b2ca-f046b68fcc6a"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

Expand All @@ -11,8 +12,9 @@ path = ".."

[compat]
Documenter = "1"
ITensorBase = "0.6"
ITensorBase = "0.7"
ITensorFormatter = "0.2.27"
Literate = "2"
TensorAlgebra = "0.9.6"
MatrixAlgebraKit = "0.2, 0.3, 0.4, 0.5, 0.6"
TensorAlgebra = "0.10"
Test = "1.10"
6 changes: 3 additions & 3 deletions examples/Project.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[deps]
ITensorBase = "4795dd04-0d67-49bb-8f44-b89c448a1dc7"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
MatrixAlgebraKit = "6c742aac-3347-4629-af66-fc926824e5e4"

[sources.ITensorBase]
path = ".."

[compat]
ITensorBase = "0.6"
LinearAlgebra = "1.10"
ITensorBase = "0.7"
MatrixAlgebraKit = "0.2, 0.3, 0.4, 0.5, 0.6"
10 changes: 5 additions & 5 deletions examples/README.jl
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ julia> Pkg.add("ITensorBase")

# ## Examples

using ITensorBase: ITensorBase, ITensor, Index, aligndims, dename
using LinearAlgebra: qr
using ITensorBase: ITensorBase, ITensor, Index, aligndims, unname
using MatrixAlgebraKit: qr_compact
using Test: @test
i = Index(2)
j = Index(2)
Expand All @@ -55,9 +55,9 @@ a = randn(i, j)
a′ = randn(j, i)
b = randn(j, k)
c = a * b
@test dename(c, (i, k)) ≈ dename(a, (i, j)) * dename(b, (j, k))
@test unname(c, (i, k)) ≈ unname(a, (i, j)) * unname(b, (j, k))
d = a + a′
@test dename(d, (i, j)) ≈ dename(a, (i, j)) + dename(a′, (i, j))
@test unname(d, (i, j)) ≈ unname(a, (i, j)) + unname(a′, (i, j))
@test a ≈ aligndims(a, (j, i))
q, r = qr(a, (i,))
q, r = qr_compact(a, (i,))
@test q * r ≈ a
4 changes: 2 additions & 2 deletions ext/ITensorBaseAdaptExt/ITensorBaseAdaptExt.jl
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
module ITensorBaseAdaptExt

using Adapt: Adapt, adapt
using ITensorBase: AbstractITensor, denamed, dimnames, nameddims
using ITensorBase: AbstractITensor, dimnames, nameddims, unnamed

function Adapt.adapt_structure(to, a::AbstractITensor)
return nameddims(adapt(to, denamed(a)), dimnames(a))
return nameddims(adapt(to, unnamed(a)), dimnames(a))
end

end
4 changes: 2 additions & 2 deletions ext/ITensorBaseMooncakeExt/ITensorBaseMooncakeExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ Mooncake.tangent_type(::Type{<:NamedUnitRange}) = Mooncake.NoTangent
@zero_derivative DefaultCtx Tuple{typeof(uniquename), Any, Any}
@zero_derivative DefaultCtx Tuple{typeof(to_inds), Any, Any}

using ITensorBase: AbstractITensor, ITensor, denamed
using ITensorBase: AbstractITensor, ITensor, unnamed
using Mooncake: Tangent
function Base.copyto!(dest::ITensor, src::Tangent)
# TODO: Account for the `inds` of the Tangent? In other words, is the tangent data
# aligned with the `dest` data?
copyto!(denamed(dest), src.fields.parent)
copyto!(unnamed(dest), src.fields.parent)
return dest
end

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module ITensorBaseTensorOperationsExt

using ITensorBase.TermInterface: arguments
using ITensorBase: ITensorBase, Optimal, denamed, inds, ismul, optimize_contraction_order,
substitute, symnameddims
using ITensorBase: ITensorBase, Optimal, inds, ismul, optimize_contraction_order,
substitute, symnameddims, unnamed
using TensorOperations: TensorOperations, optimaltree

function contraction_tree_to_expr(f, tree)
Expand All @@ -18,7 +18,7 @@ function ITensorBase.optimize_contraction_order(alg::Optimal, a)
ts = arguments(a)
inds_network = collect.(inds.(ts))
# Converting dims to Float64 to minimize overflow issues
inds_to_dims = Dict(i => Float64(length(denamed(i))) for i in reduce(∪, inds_network))
inds_to_dims = Dict(i => Float64(length(i)) for i in reduce(∪, inds_network))
tree, _ = optimaltree(inds_network, inds_to_dims)
return contraction_tree_to_expr(i -> ts[i], tree)
end
Expand Down
Loading
Loading