Skip to content

Commit

Permalink
add make file for testing and doc
Browse files Browse the repository at this point in the history
  • Loading branch information
exAClior committed Feb 28, 2024
1 parent 7b5b4c5 commit d831c09
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
37 changes: 37 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
JL = julia --project

default: init test

init:
$(JL) -e 'using Pkg; Pkg.develop([Pkg.PackageSpec(path = joinpath("lib", pkg)) for pkg in ["YaoArrayRegister", "YaoBlocks", "YaoSym", "YaoPlots", "YaoAPI"]]); Pkg.precompile()'
init-docs:
$(JL) -e 'using Pkg; Pkg.activate("docs"); Pkg.develop([Pkg.PackageSpec(path = joinpath("lib", pkg)) for pkg in ["YaoArrayRegister", "YaoBlocks", "YaoSym", "YaoPlots", "YaoAPI"]]); Pkg.precompile()'

update:
$(JL) -e 'using Pkg; Pkg.update(); Pkg.precompile()'
update-docs:
$(JL) -e 'using Pkg; Pkg.activate("docs"); Pkg.update(); Pkg.precompile()'

test-Yao:
$(JL) -e 'using Pkg; Pkg.test("Yao")'
test-CuYao:
$(JL) -e 'using Pkg; Pkg.activate("ext/CuYao/test"); Pkg.develop(path="."); Pkg.update()'
$(JL) -e 'using Pkg; Pkg.activate("ext/CuYao/test"); include("ext/CuYao/test/runtests.jl")'

test-%:
$(JL) -e 'using Pkg; Pkg.test("$*")'

test:
$(JL) -e 'using Pkg; Pkg.test(["YaoAPI", "YaoArrayRegister", "YaoBlocks", "YaoSym", "YaoPlots", "Yao"])'

coverage:
$(JL) -e 'using Pkg; Pkg.test(["YaoAPI", "YaoArrayRegister", "YaoBlocks", "YaoSym", "YaoPlots", "Yao"]; coverage=true)'

servedocs:
$(JL) -e 'using Pkg; Pkg.activate("docs"); using LiveServer; servedocs(;skip_dirs=["docs/src/assets", "docs/src/generated"])'

clean:
rm -rf docs/build
find . -name "*.cov" -type f -print0 | xargs -0 /bin/rm -f

.PHONY: init test
4 changes: 3 additions & 1 deletion lib/YaoAPI/src/registers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,8 @@ Trace distance is defined as following:
\\frac{1}{2} || A - B ||_{\\rm tr}
```
It takes values between 0 and 1.
### Examples
```jldoctest; setup=:(using Yao)
Expand All @@ -672,7 +674,7 @@ julia> reg1 = uniform_state(3);
julia> reg2 = zero_state(3);
julia> tracedist(reg1, reg2)
0.9354143624774909
0.9354143466934852
```
### References
Expand Down

0 comments on commit d831c09

Please sign in to comment.