Skip to content

Commit

Permalink
Try fixing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mtfishman committed Nov 27, 2024
1 parent e3460d5 commit 72f0d71
Show file tree
Hide file tree
Showing 31 changed files with 146 additions and 302 deletions.
20 changes: 20 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,28 @@ uuid = "60cbd0c0-df58-4cb7-918c-6f5607b73fde"
authors = ["ITensor developers <[email protected]> and contributors"]
version = "0.1.0"

[deps]
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"
BroadcastMapConversion = "4a4adec5-520f-4750-bb37-d5e66b4ddeb2"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
NestedPermutedDimsArrays = "2c2a8ec4-3cfc-4276-aa3e-1307b4294e58"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
SparseArraysBase = "0d5efcca-f356-4864-8770-e1ed8d78f208"
TensorAlgebra = "68bd88dc-f39d-4e12-b2ca-f046b68fcc6a"
TypeParameterAccessors = "7e5a90cf-f82e-492e-a09b-e3e26432c138"

[sources]
BroadcastMapConversion = {url = "https://github.com/ITensor/BroadcastMapConversion.jl"}
NestedPermutedDimsArrays = {url = "https://github.com/ITensor/NestedPermutedDimsArrays.jl"}
SparseArraysBase = {url = "https://github.com/ITensor/SparseArraysBase.jl"}
TensorAlgebra = {url = "https://github.com/ITensor/TensorAlgebra.jl"}
TypeParameterAccessors = {url = "https://github.com/ITensor/TypeParameterAccessors.jl"}

[compat]
Adapt = "4.1.1"
Aqua = "0.8.9"
LinearAlgebra = "1.10"
Random = "1.10"
Test = "1.10"
julia = "1.10"

Expand Down
8 changes: 7 additions & 1 deletion docs/Project.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
[deps]
NamedDimsArrays = "60cbd0c0-df58-4cb7-918c-6f5607b73fde"
BroadcastMapConversion = "4a4adec5-520f-4750-bb37-d5e66b4ddeb2"
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
Literate = "98b081ad-f1c9-55d3-8b20-4c87d4299306"
NamedDimsArrays = "60cbd0c0-df58-4cb7-918c-6f5607b73fde"
TypeParameterAccessors = "7e5a90cf-f82e-492e-a09b-e3e26432c138"

[sources]
BroadcastMapConversion = {url = "https://github.com/ITensor/BroadcastMapConversion.jl"}
TypeParameterAccessors = {url = "https://github.com/ITensor/TypeParameterAccessors.jl"}
6 changes: 6 additions & 0 deletions examples/Project.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
[deps]
BroadcastMapConversion = "4a4adec5-520f-4750-bb37-d5e66b4ddeb2"
NamedDimsArrays = "60cbd0c0-df58-4cb7-918c-6f5607b73fde"
TypeParameterAccessors = "7e5a90cf-f82e-492e-a09b-e3e26432c138"

[sources]
BroadcastMapConversion = {url = "https://github.com/ITensor/BroadcastMapConversion.jl"}
TypeParameterAccessors = {url = "https://github.com/ITensor/TypeParameterAccessors.jl"}
29 changes: 0 additions & 29 deletions examples/example_readme.jl

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Adapt: Adapt, adapt
using NDTensors.NamedDimsArrays: AbstractNamedDimsArray, dimnames, named, unname
using ..NamedDimsArrays: AbstractNamedDimsArray, dimnames, named, unname

function Adapt.adapt_structure(to, na::AbstractNamedDimsArray)
return named(adapt(to, unname(na)), dimnames(na))
Expand Down
4 changes: 0 additions & 4 deletions ext/NamedDimsArraysAdaptExt/test/Project.toml

This file was deleted.

13 changes: 0 additions & 13 deletions ext/NamedDimsArraysAdaptExt/test/runtests.jl

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using ..NamedDimsArrays: AbstractNamedDimsArray, dimnames, named, unname
using ...SparseArraysBase: SparseArraysBase, densearray
using SparseArraysBase: SparseArraysBase, densearray

# TODO: Use `Adapt` or some kind of rewrap function like in
# ArrayInterface.jl (https://github.com/JuliaArrays/ArrayInterface.jl/issues/136)
Expand Down
4 changes: 0 additions & 4 deletions ext/NamedDimsArraysSparseArraysBaseExt/test/Project.toml

This file was deleted.

12 changes: 0 additions & 12 deletions ext/NamedDimsArraysSparseArraysBaseExt/test/runtests.jl

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,4 @@ module NamedDimsArraysTensorAlgebraExt
include("contract.jl")
include("fusedims.jl")
include("qr.jl")
include("eigen.jl")
include("svd.jl")
end
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using ..NamedDimsArrays: AbstractNamedDimsArray, dimnames, named, unname
using ...TensorAlgebra: TensorAlgebra, blockedperms, contract, contract!
using TensorAlgebra: TensorAlgebra, blockedperms, contract, contract!

function TensorAlgebra.contract!(
na_dest::AbstractNamedDimsArray,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using ...NDTensors.TensorAlgebra: TensorAlgebra, blockedperm, fusedims, splitdims
using ...NDTensors.TensorAlgebra.BaseExtensions: BaseExtensions
using ..NamedDimsArrays: name
using TensorAlgebra: TensorAlgebra, blockedperm, fusedims, splitdims
using TensorAlgebra.BaseExtensions: BaseExtensions

function TensorAlgebra.blockedperm(na::AbstractNamedDimsArray, nameddim_blocks::Tuple...)
# Extract names if named dimensions or axes were passed
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# using ..ITensors: IndexID
using LinearAlgebra: LinearAlgebra, qr
using ...NDTensors.NamedDimsArrays: AbstractNamedDimsArray, dimnames, name, randname, unname
using ..NamedDimsArrays: AbstractNamedDimsArray, dimnames, name, randname, unname

function LinearAlgebra.qr(na::AbstractNamedDimsArray; positive=nothing)
return qr(na, (dimnames(na, 1),), (dimnames(na, 2),); positive)
Expand Down
47 changes: 0 additions & 47 deletions ext/NamedDimsArraysTensorAlgebraExt/src/eigen.jl

This file was deleted.

53 changes: 0 additions & 53 deletions ext/NamedDimsArraysTensorAlgebraExt/src/svd.jl

This file was deleted.

3 changes: 0 additions & 3 deletions ext/NamedDimsArraysTensorAlgebraExt/test/Project.toml

This file was deleted.

59 changes: 0 additions & 59 deletions ext/NamedDimsArraysTensorAlgebraExt/test/runtests.jl

This file was deleted.

10 changes: 0 additions & 10 deletions generate_readme.jl

This file was deleted.

13 changes: 7 additions & 6 deletions src/NamedDimsArrays.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
module NamedDimsArrays

include("traits.jl")
include("name.jl")
include("randname.jl")
Expand All @@ -18,10 +19,10 @@ include("map.jl")
include("broadcast_shape.jl")
include("broadcast.jl")

# Extensions
include("../ext/NamedDimsArraysAdaptExt/src/NamedDimsArraysAdaptExt.jl")
include(
"../ext/NamedDimsArraysSparseArraysBaseExt/src/NamedDimsArraysSparseArraysBaseExt.jl"
)
include("../ext/NamedDimsArraysTensorAlgebraExt/src/NamedDimsArraysTensorAlgebraExt.jl")
# Extensions.
# TODO: Turn these into actual package extensions.
include("../ext/NamedDimsArraysAdaptExt/NamedDimsArraysAdaptExt.jl")
include("../ext/NamedDimsArraysSparseArraysBaseExt/NamedDimsArraysSparseArraysBaseExt.jl")
include("../ext/NamedDimsArraysTensorAlgebraExt/NamedDimsArraysTensorAlgebraExt.jl")

end
6 changes: 2 additions & 4 deletions src/abstractnameddimsarray.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using ..BaseExtensions: BaseExtensions
using NDTensors.TypeParameterAccessors: TypeParameterAccessors, parenttype
using TypeParameterAccessors: TypeParameterAccessors, parenttype

# Some of the interface is inspired by:
# https://github.com/invenia/NamedDims.jl
Expand Down Expand Up @@ -70,8 +69,7 @@ rename(a::AbstractNamedDimsArray, names) = named(unname(a), names)
# `rename` in `NamedPlus.jl`.
# TODO: Define for `AbstractArray`.
function replacenames(na::AbstractNamedDimsArray, replacements::Pair...)
# `BaseExtension.replace` needed for `Tuple` support on Julia 1.6 and older.
return named(unname(na), BaseExtensions.replace(dimnames(na), replacements...))
return named(unname(na), replace(dimnames(na), replacements...))
end

# Either define new names or replace names
Expand Down
2 changes: 1 addition & 1 deletion src/broadcast.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Base.Broadcast: BroadcastStyle, AbstractArrayStyle, DefaultArrayStyle, Broadcasted
using ..BroadcastMapConversion: map_function, map_args
using BroadcastMapConversion: map_function, map_args

struct NamedDimsArrayStyle{N} <: AbstractArrayStyle{N} end

Expand Down
Loading

0 comments on commit 72f0d71

Please sign in to comment.