Skip to content

Commit 8f6a233

Browse files
authored
Rewrite (#3)
1 parent c04f2fc commit 8f6a233

40 files changed

+1138
-1660
lines changed

.github/ISSUE_TEMPLATE/BUG_REPORT.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
2-
name: ITensorQuantumOperatorDefinitions.jl bug report
3-
about: Create a bug report to help us improve ITensorQuantumOperatorDefinitions.jl
2+
name: QuantumOperatorDefinitions.jl bug report
3+
about: Create a bug report to help us improve QuantumOperatorDefinitions.jl
44
title: "[BUG] YOUR SHORT DESCRIPTION OF THE BUG HERE"
55
labels: ["bug"]
66
assignees: ''
@@ -55,8 +55,8 @@ If you provided a minimal code that demonstrates the bug or unexpected behavior,
5555
julia> versioninfo()
5656
[YOUR OUTPUT HERE]
5757
```
58-
- Output from `using Pkg; Pkg.status("ITensorQuantumOperatorDefinitions")`:
58+
- Output from `using Pkg; Pkg.status("QuantumOperatorDefinitions")`:
5959
```julia
60-
julia> using Pkg; Pkg.status("ITensorQuantumOperatorDefinitions")
60+
julia> using Pkg; Pkg.status("QuantumOperatorDefinitions")
6161
[YOUR OUTPUT HERE]
6262
```

.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
2-
name: ITensorQuantumOperatorDefinitions.jl feature request
3-
about: Suggest an idea for ITensorQuantumOperatorDefinitions.jl
2+
name: QuantumOperatorDefinitions.jl feature request
3+
about: Suggest an idea for QuantumOperatorDefinitions.jl
44
title: "[ENHANCEMENT] YOUR SHORT DESCRIPTION OF THE FEATURE REQUEST HERE"
55
labels: ["enhancement"]
66
assignees: ''

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Please give a summary of the tests that you added to verify your changes.
3333

3434
# Checklist:
3535

36-
- [ ] My code follows the style guidelines of this project. Please run `using JuliaFormatter; format(".")` in the base directory of the repository (`~/.julia/dev/ITensorQuantumOperatorDefinitions`) to format your code according to our style guidelines.
36+
- [ ] My code follows the style guidelines of this project. Please run `using JuliaFormatter; format(".")` in the base directory of the repository (`~/.julia/dev/QuantumOperatorDefinitions`) to format your code according to our style guidelines.
3737
- [ ] I have performed a self-review of my own code.
3838
- [ ] I have commented my code, particularly in hard-to-understand areas.
3939
- [ ] I have added tests that verify the behavior of the changes I made.

Project.toml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
1-
name = "ITensorQuantumOperatorDefinitions"
2-
uuid = "fd9b415b-e710-4e2a-b407-cba023081494"
1+
name = "QuantumOperatorDefinitions"
2+
uuid = "826dd319-6fd5-459a-a990-3a4f214664bf"
33
authors = ["ITensor developers <[email protected]> and contributors"]
4-
version = "0.1.2"
4+
version = "0.1.0"
55

66
[deps]
7-
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
8-
ITensorBase = "4795dd04-0d67-49bb-8f44-b89c448a1dc7"
97
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
108

119
[compat]
12-
ChainRulesCore = "1.25.1"
13-
ITensorBase = "0.1.8"
1410
LinearAlgebra = "1.10"
1511
julia = "1.10"

README.md

Lines changed: 43 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
# ITensorQuantumOperatorDefinitions.jl
1+
# QuantumOperatorDefinitions.jl
22

3-
[![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://ITensor.github.io/ITensorQuantumOperatorDefinitions.jl/stable/)
4-
[![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://ITensor.github.io/ITensorQuantumOperatorDefinitions.jl/dev/)
5-
[![Build Status](https://github.com/ITensor/ITensorQuantumOperatorDefinitions.jl/actions/workflows/Tests.yml/badge.svg?branch=main)](https://github.com/ITensor/ITensorQuantumOperatorDefinitions.jl/actions/workflows/Tests.yml?query=branch%3Amain)
6-
[![Coverage](https://codecov.io/gh/ITensor/ITensorQuantumOperatorDefinitions.jl/branch/main/graph/badge.svg)](https://codecov.io/gh/ITensor/ITensorQuantumOperatorDefinitions.jl)
3+
[![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://ITensor.github.io/QuantumOperatorDefinitions.jl/stable/)
4+
[![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://ITensor.github.io/QuantumOperatorDefinitions.jl/dev/)
5+
[![Build Status](https://github.com/ITensor/QuantumOperatorDefinitions.jl/actions/workflows/Tests.yml/badge.svg?branch=main)](https://github.com/ITensor/QuantumOperatorDefinitions.jl/actions/workflows/Tests.yml?query=branch%3Amain)
6+
[![Coverage](https://codecov.io/gh/ITensor/QuantumOperatorDefinitions.jl/branch/main/graph/badge.svg)](https://codecov.io/gh/ITensor/QuantumOperatorDefinitions.jl)
77
[![Code Style: Blue](https://img.shields.io/badge/code%20style-blue-4495d1.svg)](https://github.com/invenia/BlueStyle)
88
[![Aqua](https://raw.githubusercontent.com/JuliaTesting/Aqua.jl/master/badge.svg)](https://github.com/JuliaTesting/Aqua.jl)
99

@@ -26,50 +26,56 @@ if you want to use SSH credentials, which can make it so you don't have to enter
2626
Then, the package can be added as usual through the package manager:
2727

2828
```julia
29-
julia> Pkg.add("ITensorQuantumOperatorDefinitions")
29+
julia> Pkg.add("QuantumOperatorDefinitions")
3030
```
3131

3232
## Examples
3333

3434
````julia
35-
using ITensorBase: ITensor, Index, tags
36-
using ITensorQuantumOperatorDefinitions:
37-
OpName, SiteType, StateName, ValName, op, siteind, siteinds, state, val
35+
using QuantumOperatorDefinitions: OpName, SiteType, StateName, , controlled, op, state
36+
using LinearAlgebra: Diagonal
37+
using SparseArrays: SparseMatrixCSC, SparseVector
3838
using Test: @test
39-
````
4039

41-
States and operators as Julia arrays
40+
@test state("0") == [1, 0]
41+
@test state("1") == [0, 1]
4242

43-
````julia
44-
@test val(ValName("Up"), SiteType("S=1/2")) == 1
45-
@test val(ValName("Dn"), SiteType("S=1/2")) == 2
46-
@test state(StateName("Up"), SiteType("S=1/2")) == [1, 0]
47-
@test state(StateName("Dn"), SiteType("S=1/2")) == [0, 1]
48-
@test op(OpName("X"), SiteType("S=1/2")) == [0 1; 1 0]
49-
@test op(OpName("Z"), SiteType("S=1/2")) == [1 0; 0 -1]
50-
````
43+
@test state(Float32, "0") == [1, 0]
44+
@test eltype(state(Float32, "1")) === Float32
5145

52-
Index constructors
46+
@test Vector(StateName("0")) == [1, 0]
47+
@test Vector(StateName("1")) == [0, 1]
5348

54-
````julia
55-
@test siteind("S=1/2") isa Index
56-
@test Int(length(siteind("S=1/2"))) == 2
57-
@test "S=1/2" in tags(siteind("S=1/2"))
58-
@test siteinds("S=1/2", 4) isa Vector{<:Index}
59-
@test length(siteinds("S=1/2", 4)) == 4
60-
@test all(s -> "S=1/2" in tags(s), siteinds("S=1/2", 4))
61-
````
49+
@test Vector{Float32}(StateName("0")) == [1, 0]
50+
@test eltype(Vector{Float32}(StateName("0"))) === Float32
6251

63-
States and operators as ITensors
52+
@test state(SparseVector, "0") == [1, 0]
53+
@test state(SparseVector, "0") isa SparseVector
6454

65-
````julia
66-
s = Index(2, "S=1/2")
67-
@test val(s, "Up") == 1
68-
@test val(s, "Dn") == 2
69-
@test state("Up", s) == ITensor([1, 0], (s,))
70-
@test state("Dn", s) == ITensor([0, 1], (s,))
71-
@test op("X", s) == ITensor([0 1; 1 0], (s', s))
72-
@test op("Z", s) == ITensor([1 0; 0 -1], (s', s))
55+
@test state("0", 3) == [1, 0, 0]
56+
@test state("1", 3) == [0, 1, 0]
57+
@test state("2", 3) == [0, 0, 1]
58+
59+
@test Vector(StateName("0"), 3) == [1, 0, 0]
60+
@test Vector(StateName("1"), 3) == [0, 1, 0]
61+
@test Vector(StateName("2"), 3) == [0, 0, 1]
62+
63+
@test op("X") == [0 1; 1 0]
64+
@test op("Y") == [0 -im; im 0]
65+
@test op("Z") == [1 0; 0 -1]
66+
67+
@test op("Z") isa Diagonal
68+
69+
@test op(Float32, "X") == [0 1; 1 0]
70+
@test eltype(op(Float32, "X")) === Float32
71+
@test op(SparseMatrixCSC, "X") == [0 1; 1 0]
72+
@test op(SparseMatrixCSC, "X") isa SparseMatrixCSC
73+
74+
@test Matrix(OpName("X")) == [0 1; 1 0]
75+
@test Matrix(OpName("Y")) == [0 -im; im 0]
76+
@test Matrix(OpName("Z")) == [1 0; 0 -1]
77+
78+
@test Matrix(OpName("Rx"; θ=π / 3)) [sin/ 3) -cos/ 3)*im; -cos/ 3)*im sin/ 3)]
7379
````
7480

7581
---

benchmark/benchmarks.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using ITensorQuantumOperatorDefinitions
1+
using QuantumOperatorDefinitions
22
using BenchmarkTools
33

44
SUITE = BenchmarkGroup()

docs/Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[deps]
22
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
3-
ITensorBase = "4795dd04-0d67-49bb-8f44-b89c448a1dc7"
4-
ITensorQuantumOperatorDefinitions = "fd9b415b-e710-4e2a-b407-cba023081494"
53
Literate = "98b081ad-f1c9-55d3-8b20-4c87d4299306"
4+
QuantumOperatorDefinitions = "826dd319-6fd5-459a-a990-3a4f214664bf"
5+
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
66
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

docs/make.jl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
1-
using ITensorQuantumOperatorDefinitions: ITensorQuantumOperatorDefinitions
1+
using QuantumOperatorDefinitions: QuantumOperatorDefinitions
22
using Documenter: Documenter, DocMeta, deploydocs, makedocs
33

44
DocMeta.setdocmeta!(
5-
ITensorQuantumOperatorDefinitions,
5+
QuantumOperatorDefinitions,
66
:DocTestSetup,
7-
:(using ITensorQuantumOperatorDefinitions);
7+
:(using QuantumOperatorDefinitions);
88
recursive=true,
99
)
1010

1111
include("make_index.jl")
1212

1313
makedocs(;
14-
modules=[ITensorQuantumOperatorDefinitions],
14+
modules=[QuantumOperatorDefinitions],
1515
authors="ITensor developers <[email protected]> and contributors",
16-
sitename="ITensorQuantumOperatorDefinitions.jl",
16+
sitename="QuantumOperatorDefinitions.jl",
1717
format=Documenter.HTML(;
18-
canonical="https://ITensor.github.io/ITensorQuantumOperatorDefinitions.jl",
18+
canonical="https://ITensor.github.io/QuantumOperatorDefinitions.jl",
1919
edit_link="main",
2020
assets=String[],
2121
),
2222
pages=["Home" => "index.md", "Reference" => "reference.md"],
2323
)
2424

2525
deploydocs(;
26-
repo="github.com/ITensor/ITensorQuantumOperatorDefinitions.jl",
26+
repo="github.com/ITensor/QuantumOperatorDefinitions.jl",
2727
devbranch="main",
2828
push_preview=true,
2929
)

docs/make_index.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
using Literate: Literate
2-
using ITensorQuantumOperatorDefinitions: ITensorQuantumOperatorDefinitions
2+
using QuantumOperatorDefinitions: QuantumOperatorDefinitions
33

44
Literate.markdown(
5-
joinpath(pkgdir(ITensorQuantumOperatorDefinitions), "examples", "README.jl"),
6-
joinpath(pkgdir(ITensorQuantumOperatorDefinitions), "docs", "src");
5+
joinpath(pkgdir(QuantumOperatorDefinitions), "examples", "README.jl"),
6+
joinpath(pkgdir(QuantumOperatorDefinitions), "docs", "src");
77
flavor=Literate.DocumenterFlavor(),
88
name="index",
99
)

docs/make_readme.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
using Literate: Literate
2-
using ITensorQuantumOperatorDefinitions: ITensorQuantumOperatorDefinitions
2+
using QuantumOperatorDefinitions: QuantumOperatorDefinitions
33

44
Literate.markdown(
5-
joinpath(pkgdir(ITensorQuantumOperatorDefinitions), "examples", "README.jl"),
6-
joinpath(pkgdir(ITensorQuantumOperatorDefinitions));
5+
joinpath(pkgdir(QuantumOperatorDefinitions), "examples", "README.jl"),
6+
joinpath(pkgdir(QuantumOperatorDefinitions));
77
flavor=Literate.CommonMarkFlavor(),
88
name="README",
99
)

0 commit comments

Comments
 (0)