Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "ITensorBase"
uuid = "4795dd04-0d67-49bb-8f44-b89c448a1dc7"
authors = ["ITensor developers <[email protected]> and contributors"]
version = "0.2.15"
version = "0.3.0"

[deps]
Accessors = "7d9f7c33-5ae7-4f3b-8dc6-eff91059b697"
Expand All @@ -18,20 +18,17 @@ VectorInterface = "409d34a3-91d5-4945-b6ec-7529ddf182d8"

[weakdeps]
DiagonalArrays = "74fd4be6-21e2-4f6f-823a-4360d37c7a77"
GradedArrays = "bc96ca6e-b7c8-4bb6-888e-c93f838762c2"
SparseArraysBase = "0d5efcca-f356-4864-8770-e1ed8d78f208"

[extensions]
ITensorBaseDiagonalArraysExt = "DiagonalArrays"
ITensorBaseGradedArraysExt = "GradedArrays"
ITensorBaseSparseArraysBaseExt = ["NamedDimsArrays", "SparseArraysBase"]

[compat]
Accessors = "0.1.39"
DerivableInterfaces = "0.5"
DiagonalArrays = "0.3"
FillArrays = "1.13"
GradedArrays = "0.4"
LinearAlgebra = "1.10"
MapBroadcast = "0.1.5"
NamedDimsArrays = "0.8"
Expand Down
2 changes: 1 addition & 1 deletion docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Literate = "98b081ad-f1c9-55d3-8b20-4c87d4299306"
NamedDimsArrays = "60cbd0c0-df58-4cb7-918c-6f5607b73fde"

[compat]
ITensorBase = "0.2"
ITensorBase = "0.3"
Documenter = "1"
Literate = "2"
NamedDimsArrays = "0.8"
2 changes: 1 addition & 1 deletion examples/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
NamedDimsArrays = "60cbd0c0-df58-4cb7-918c-6f5607b73fde"

[compat]
ITensorBase = "0.2"
ITensorBase = "0.3"
LinearAlgebra = "1.10"
NamedDimsArrays = "0.8"
10 changes: 0 additions & 10 deletions ext/ITensorBaseGradedArraysExt/ITensorBaseGradedArraysExt.jl

This file was deleted.

44 changes: 0 additions & 44 deletions src/quirks.jl
Original file line number Diff line number Diff line change
@@ -1,47 +1,3 @@
using NamedDimsArrays: dename

# TODO: Deprecate, just use `Int(length(i))` or
# `unname(length(i))` directly.
# Conversion to `Int` is used in case the output is named.
dim(i::Index) = Int(length(i))
# TODO: Deprecate.
# Conversion to `Int` is used in case the output is named.
# TODO: Deprecate, just use `Int(length(i))` or
# `unname(length(i))` directly.
dim(a::AbstractITensor) = Int(length(a))

# TODO: Delete this definition?
Base.adjoint(i::Index) = prime(i)

# TODO: Deprecate, just use `randname` directly.
sim(n::IndexName) = randname(n)
sim(i::Index) = setname(i, sim(name(i)))
sim(a::AbstractITensor) = mapinds(sim, a)

# TODO: Maybe deprecate these and use `mapinds` directly?
prime(a::AbstractITensor) = mapinds(prime, a)
noprime(a::AbstractITensor) = mapinds(noprime, a)

# TODO: Delete these and just use set operations on `inds` directly.
function uniqueinds(a1::AbstractITensor, a_rest::AbstractITensor...)
return setdiff(inds(a1), inds.(a_rest)...)
end
function uniqueind(a1::AbstractITensor, a_rest::AbstractITensor...)
return only(uniqueinds(a1, a_rest...))
end
function commoninds(a1::AbstractITensor, a_rest::AbstractITensor...)
return intersect(inds(a1), inds.(a_rest)...)
end
function commonind(a1::AbstractITensor, a_rest::AbstractITensor...)
return only(commoninds(a1, a_rest...))
end

# TODO: Replace with a more general functionality in
# `GradedArrays`, like `isgraded`.
hasqns(r::AbstractUnitRange) = false
hasqns(i::Index) = hasqns(dename(i))
hasqns(a::AbstractITensor) = all(hasqns, inds(a))

# This seems to be needed to get broadcasting working.
# TODO: Investigate this and see if we can get rid of it.
Base.Broadcast.extrude(a::AbstractITensor) = a
Expand Down
8 changes: 1 addition & 7 deletions test/Project.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
[deps]
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
BlockArrays = "8e7c35d0-a365-5155-bbbb-fb81a777f24e"
BlockSparseArrays = "2c9a651f-6452-4ace-a6ac-809f4280fbb4"
DiagonalArrays = "74fd4be6-21e2-4f6f-823a-4360d37c7a77"
GradedArrays = "bc96ca6e-b7c8-4bb6-888e-c93f838762c2"
ITensorBase = "4795dd04-0d67-49bb-8f44-b89c448a1dc7"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
NamedDimsArrays = "60cbd0c0-df58-4cb7-918c-6f5607b73fde"
Expand All @@ -15,11 +12,8 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[compat]
Aqua = "0.8.9"
BlockArrays = "1"
BlockSparseArrays = "0.8, 0.9, 0.10"
DiagonalArrays = "0.3"
GradedArrays = "0.4"
ITensorBase = "0.2"
ITensorBase = "0.3"
NamedDimsArrays = "0.8"
SafeTestsets = "0.1"
SparseArraysBase = "0.7"
Expand Down
28 changes: 2 additions & 26 deletions test/test_basics.jl
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
using BlockArrays: Block
using BlockSparseArrays: BlockSparseArray
using DiagonalArrays: δ, delta, diagview
using GradedArrays: U1, dual, gradedrange
using ITensorBase:
ITensorBase,
ITensor,
Index,
gettag,
hastag,
hasqns,
inds,
plev,
prime,
setplev,
settag,
tags,
unsettag
using NamedDimsArrays: dename, name, named
using NamedDimsArrays: dename, inds, mapinds, name, named
using SparseArraysBase: oneelement
using LinearAlgebra: factorize
using Test: @test, @test_broken, @test_throws, @testset
Expand All @@ -32,7 +27,7 @@ const elts = (Float32, Float64, Complex{Float32}, Complex{Float64})
@test plev(i) == 0
@test plev(prime(i)) == 1
@test length(tags(i)) == 0
a′ = prime(a)
a′ = mapinds(prime, a)
@test dename(a′) == x
@test issetequal(inds(a′), (prime(i), prime(j)))
end
Expand Down Expand Up @@ -146,25 +141,6 @@ const elts = (Float32, Float64, Complex{Float32}, Complex{Float64})
@test a[2] == 1
@test a[3] == 0
end
@testset "hasqns" begin
i = Index(2)
j = Index(2)
a = ITensor(randn(2, 2), (i, j))
@test !hasqns(i)
@test !hasqns(j)
@test !hasqns(a)

r = gradedrange([U1(0) => 2, U1(1) => 2])
d = BlockSparseArray{Float64}(undef, r, dual(r))
d[Block(1, 1)] = randn(2, 2)
d[Block(2, 2)] = randn(2, 2)
i = Index(r)
j = Index(dual(r))
a = ITensor(d, (i, j))
@test hasqns(i)
@test hasqns(j)
@test hasqns(a)
end
@testset "factorize" for elt in elts
i = Index(2)
j = Index(2)
Expand Down
Loading