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
8 changes: 4 additions & 4 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "QuantumOperatorDefinitions"
uuid = "826dd319-6fd5-459a-a990-3a4f214664bf"
authors = ["ITensor developers <[email protected]> and contributors"]
version = "0.2.0"
version = "0.2.1"

[deps]
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Expand All @@ -19,9 +19,9 @@ QuantumOperatorDefinitionsGradedArraysExt = ["BlockArrays", "GradedArrays"]

[compat]
BlockArrays = "1.3.0"
GradedArrays = "0.2.1"
ITensorBase = "0.2.0"
GradedArrays = "0.3"
ITensorBase = "0.2"
LinearAlgebra = "1.10"
NamedDimsArrays = "0.6"
NamedDimsArrays = "0.7"
Random = "1.10"
julia = "1.10"
14 changes: 8 additions & 6 deletions src/op.jl
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@
:(Base.:-),
)
@eval begin
$f(n::$(nametype)) = $(applied)(; f=$f, arg=n)
$f(n::$(nametype)) = $(applied)(; f=($f), arg=n)
end
end
end
Expand All @@ -191,8 +191,9 @@
domains = map((start, stop) -> domain[start:stop], starts, stops)
return kron(map((arg, domain) -> arg(domain...), n.args, domains)...)
end
Base.kron(n1::$(nametype), n2::$(nametype), n_rest::$(nametype)...) =
$(kronned)(; args=(n1, n2, n_rest...))
Base.kron(n1::$(nametype), n2::$(nametype), n_rest::$(nametype)...) = $(kronned)(;

Check warning on line 194 in src/op.jl

View check run for this annotation

Codecov / codecov/patch

src/op.jl#L194

Added line #L194 was not covered by tests
args=(n1, n2, n_rest...)
)
⊗(n1::$(nametype), n2::$(nametype)) = kron(n1, n2)
⊗(n1::$(kronned), n2::$(kronned)) = kron(n1.args..., n2.args...)
⊗(n1::$(nametype), n2::$(kronned)) = kron(n1, n2.args...)
Expand All @@ -211,8 +212,9 @@
function (n::$(summed))(domain...)
return mapreduce(a -> a(domain...), +, n.args)
end
Base.:+(n1::$(nametype), n2::$(nametype), n_rest::$(nametype)...) =
$(summed)(; args=(n1, n2, n_rest...))
Base.:+(n1::$(nametype), n2::$(nametype), n_rest::$(nametype)...) = $(summed)(;
args=(n1, n2, n_rest...)
)
Base.:+(n1::$(summed), n2::$(summed)) = +(n1.args..., n2.args...)
Base.:+(n1::$(summed), n2::$(nametype)) = +(n1.args..., n2)
Base.:+(n1::$(nametype), n2::$(summed)) = +(n1, n2.args...)
Expand Down Expand Up @@ -252,7 +254,7 @@
# Unary operations unique to operators.
for f in (:(Base.sqrt), :(Base.exp), :(Base.cis), :(Base.cos), :(Base.sin), :(Base.adjoint))
@eval begin
$f(n::OpName) = OpName"applied"(; f=$f, arg=n)
$f(n::OpName) = OpName"applied"(; f=($f), arg=n)
end
end

Expand Down
4 changes: 2 additions & 2 deletions test/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Aqua = "0.8.9"
BlockArrays = "1"
BlockSparseArrays = "0.4"
GradedArrays = "0.2"
GradedArrays = "0.3"
ITensorBase = "0.2"
NamedDimsArrays = "0.6"
NamedDimsArrays = "0.7"
QuantumOperatorDefinitions = "0.2"
SafeTestsets = "0.1"
Suppressor = "0.2"
Expand Down
10 changes: 6 additions & 4 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@ const GROUP = uppercase(
)

"match files of the form `test_*.jl`, but exclude `*setup*.jl`"
istestfile(fn) =
endswith(fn, ".jl") && startswith(basename(fn), "test_") && !contains(fn, "setup")
function istestfile(fn)
return endswith(fn, ".jl") && startswith(basename(fn), "test_") && !contains(fn, "setup")
end
"match files of the form `*.jl`, but exclude `*_notest.jl` and `*setup*.jl`"
isexamplefile(fn) =
endswith(fn, ".jl") && !endswith(fn, "_notest.jl") && !contains(fn, "setup")
function isexamplefile(fn)
return endswith(fn, ".jl") && !endswith(fn, "_notest.jl") && !contains(fn, "setup")
end

@time begin
# tests in groups based on folder structure
Expand Down
Loading