Skip to content

Commit a384858

Browse files
Automatic Runic.jl run (#49)
Co-authored-by: mtfishman <[email protected]> Co-authored-by: mtfishman <[email protected]>
1 parent 8a6aa34 commit a384858

28 files changed

+1627
-1621
lines changed

.JuliaFormatter.toml

Lines changed: 0 additions & 3 deletions
This file was deleted.

.github/workflows/CompatHelper.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: "CompatHelper"
22

33
on:
44
schedule:
5-
- cron: 0 0 * * *
5+
- cron: '0 0 * * *'
66
workflow_dispatch:
77
permissions:
88
contents: write

.github/workflows/FormatCheck.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
name: "Format Check"
22

33
on:
4-
push:
5-
branches:
6-
- 'main'
7-
tags: '*'
8-
pull_request:
4+
pull_request_target:
5+
paths: ['**/*.jl']
6+
types: [opened, synchronize, reopened, ready_for_review]
7+
8+
permissions:
9+
contents: read
10+
actions: write
11+
pull-requests: write
912

1013
jobs:
1114
format-check:

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
.vscode/
1010
Manifest.toml
1111
benchmark/*.json
12+
dev/
13+
docs/LocalPreferences.toml
1214
docs/Manifest.toml
1315
docs/build/
1416
docs/src/index.md
17+
examples/LocalPreferences.toml
18+
test/LocalPreferences.toml

.pre-commit-config.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
ci:
2-
skip: [julia-formatter]
2+
skip: [runic]
33

44
repos:
55
- repo: https://github.com/pre-commit/pre-commit-hooks
@@ -11,7 +11,7 @@ repos:
1111
- id: end-of-file-fixer
1212
exclude_types: [markdown] # incompatible with Literate.jl
1313

14-
- repo: "https://github.com/domluna/JuliaFormatter.jl"
15-
rev: v2.1.6
14+
- repo: https://github.com/fredrikekre/runic-pre-commit
15+
rev: v2.0.1
1616
hooks:
17-
- id: "julia-formatter"
17+
- id: runic

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "DiagonalArrays"
22
uuid = "74fd4be6-21e2-4f6f-823a-4360d37c7a77"
33
authors = ["ITensor developers <[email protected]> and contributors"]
4-
version = "0.3.21"
4+
version = "0.3.22"
55

66
[deps]
77
ArrayLayouts = "4c555306-a7a7-4459-81d9-ec55ddd5c99a"

README.md

Lines changed: 55 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -45,67 +45,67 @@ julia> Pkg.add("DiagonalArrays")
4545

4646
````julia
4747
using DiagonalArrays:
48-
DiagonalArray, DiagonalMatrix, DiagIndex, DiagIndices, diaglength, isdiagindex
48+
DiagonalArray, DiagonalMatrix, DiagIndex, DiagIndices, diaglength, isdiagindex
4949
using Test: @test
5050

5151
function main()
52-
d = DiagonalMatrix([1.0, 2.0, 3.0])
53-
@test eltype(d) == Float64
54-
@test diaglength(d) == 3
55-
@test size(d) == (3, 3)
56-
@test d[1, 1] == 1
57-
@test d[2, 2] == 2
58-
@test d[3, 3] == 3
59-
@test d[1, 2] == 0
60-
61-
d = DiagonalArray([1.0, 2.0, 3.0], 3, 4, 5)
62-
@test eltype(d) == Float64
63-
@test diaglength(d) == 3
64-
@test d[1, 1, 1] == 1
65-
@test d[2, 2, 2] == 2
66-
@test d[3, 3, 3] == 3
67-
@test d[1, 2, 1] == 0
68-
69-
d[2, 2, 2] = 22
70-
@test d[2, 2, 2] == 22
71-
72-
d_r = reshape(d, 3, 20)
73-
@test size(d_r) == (3, 20)
74-
@test all(I -> d_r[I] == d[I], LinearIndices(d))
75-
76-
@test length(d[DiagIndices(:)]) == 3
77-
@test Array(d) == d
78-
@test d[DiagIndex(2)] == d[2, 2, 2]
79-
80-
d[DiagIndex(2)] = 222
81-
@test d[2, 2, 2] == 222
82-
83-
a = randn(3, 4, 5)
84-
new_diag = randn(3)
85-
a[DiagIndices(:)] = new_diag
86-
d[DiagIndices(:)] = a[DiagIndices(:)]
87-
88-
@test a[DiagIndices(:)] == new_diag
89-
@test d[DiagIndices(:)] == new_diag
90-
91-
permuted_d = permutedims(d, (3, 2, 1))
92-
@test permuted_d isa DiagonalArray
93-
@test permuted_d[DiagIndices(:)] == d[DiagIndices(:)]
94-
@test size(d) == (3, 4, 5)
95-
@test size(permuted_d) == (5, 4, 3)
96-
for I in eachindex(d)
97-
if !isdiagindex(d, I)
98-
@test iszero(d[I])
99-
else
100-
@test !iszero(d[I])
52+
d = DiagonalMatrix([1.0, 2.0, 3.0])
53+
@test eltype(d) == Float64
54+
@test diaglength(d) == 3
55+
@test size(d) == (3, 3)
56+
@test d[1, 1] == 1
57+
@test d[2, 2] == 2
58+
@test d[3, 3] == 3
59+
@test d[1, 2] == 0
60+
61+
d = DiagonalArray([1.0, 2.0, 3.0], 3, 4, 5)
62+
@test eltype(d) == Float64
63+
@test diaglength(d) == 3
64+
@test d[1, 1, 1] == 1
65+
@test d[2, 2, 2] == 2
66+
@test d[3, 3, 3] == 3
67+
@test d[1, 2, 1] == 0
68+
69+
d[2, 2, 2] = 22
70+
@test d[2, 2, 2] == 22
71+
72+
d_r = reshape(d, 3, 20)
73+
@test size(d_r) == (3, 20)
74+
@test all(I -> d_r[I] == d[I], LinearIndices(d))
75+
76+
@test length(d[DiagIndices(:)]) == 3
77+
@test Array(d) == d
78+
@test d[DiagIndex(2)] == d[2, 2, 2]
79+
80+
d[DiagIndex(2)] = 222
81+
@test d[2, 2, 2] == 222
82+
83+
a = randn(3, 4, 5)
84+
new_diag = randn(3)
85+
a[DiagIndices(:)] = new_diag
86+
d[DiagIndices(:)] = a[DiagIndices(:)]
87+
88+
@test a[DiagIndices(:)] == new_diag
89+
@test d[DiagIndices(:)] == new_diag
90+
91+
permuted_d = permutedims(d, (3, 2, 1))
92+
@test permuted_d isa DiagonalArray
93+
@test permuted_d[DiagIndices(:)] == d[DiagIndices(:)]
94+
@test size(d) == (3, 4, 5)
95+
@test size(permuted_d) == (5, 4, 3)
96+
for I in eachindex(d)
97+
if !isdiagindex(d, I)
98+
@test iszero(d[I])
99+
else
100+
@test !iszero(d[I])
101+
end
101102
end
102-
end
103103

104-
mapped_d = map(x -> 2x, d)
105-
@test mapped_d isa DiagonalArray
106-
@test mapped_d == map(x -> 2x, Array(d))
104+
mapped_d = map(x -> 2x, d)
105+
@test mapped_d isa DiagonalArray
106+
@test mapped_d == map(x -> 2x, Array(d))
107107

108-
return nothing
108+
return nothing
109109
end
110110

111111
main()

docs/make.jl

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
using DiagonalArrays: DiagonalArrays
22
using Documenter: Documenter, DocMeta, deploydocs, makedocs
33

4-
DocMeta.setdocmeta!(DiagonalArrays, :DocTestSetup, :(using DiagonalArrays); recursive=true)
4+
DocMeta.setdocmeta!(DiagonalArrays, :DocTestSetup, :(using DiagonalArrays); recursive = true)
55

66
include("make_index.jl")
77

88
makedocs(;
9-
modules=[DiagonalArrays],
10-
authors="ITensor developers <[email protected]> and contributors",
11-
sitename="DiagonalArrays.jl",
12-
format=Documenter.HTML(;
13-
canonical="https://itensor.github.io/DiagonalArrays.jl",
14-
edit_link="main",
15-
assets=["assets/favicon.ico", "assets/extras.css"],
16-
),
17-
pages=["Home" => "index.md", "Reference" => "reference.md"],
9+
modules = [DiagonalArrays],
10+
authors = "ITensor developers <[email protected]> and contributors",
11+
sitename = "DiagonalArrays.jl",
12+
format = Documenter.HTML(;
13+
canonical = "https://itensor.github.io/DiagonalArrays.jl",
14+
edit_link = "main",
15+
assets = ["assets/favicon.ico", "assets/extras.css"],
16+
),
17+
pages = ["Home" => "index.md", "Reference" => "reference.md"],
1818
)
1919

2020
deploydocs(;
21-
repo="github.com/ITensor/DiagonalArrays.jl", devbranch="main", push_preview=true
21+
repo = "github.com/ITensor/DiagonalArrays.jl", devbranch = "main", push_preview = true
2222
)

docs/make_index.jl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@ using Literate: Literate
22
using DiagonalArrays: DiagonalArrays
33

44
function ccq_logo(content)
5-
include_ccq_logo = """
5+
include_ccq_logo = """
66
```@raw html
77
<img class="display-light-only" src="assets/CCQ.png" width="20%" alt="Flatiron Center for Computational Quantum Physics logo."/>
88
<img class="display-dark-only" src="assets/CCQ-dark.png" width="20%" alt="Flatiron Center for Computational Quantum Physics logo."/>
99
```
1010
"""
11-
content = replace(content, "{CCQ_LOGO}" => include_ccq_logo)
12-
return content
11+
content = replace(content, "{CCQ_LOGO}" => include_ccq_logo)
12+
return content
1313
end
1414

1515
Literate.markdown(
16-
joinpath(pkgdir(DiagonalArrays), "examples", "README.jl"),
17-
joinpath(pkgdir(DiagonalArrays), "docs", "src");
18-
flavor=Literate.DocumenterFlavor(),
19-
name="index",
20-
postprocess=ccq_logo,
16+
joinpath(pkgdir(DiagonalArrays), "examples", "README.jl"),
17+
joinpath(pkgdir(DiagonalArrays), "docs", "src");
18+
flavor = Literate.DocumenterFlavor(),
19+
name = "index",
20+
postprocess = ccq_logo,
2121
)

docs/make_readme.jl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@ using Literate: Literate
22
using DiagonalArrays: DiagonalArrays
33

44
function ccq_logo(content)
5-
include_ccq_logo = """
5+
include_ccq_logo = """
66
<picture>
77
<source media="(prefers-color-scheme: dark)" width="20%" srcset="docs/src/assets/CCQ-dark.png">
88
<img alt="Flatiron Center for Computational Quantum Physics logo." width="20%" src="docs/src/assets/CCQ.png">
99
</picture>
1010
"""
11-
content = replace(content, "{CCQ_LOGO}" => include_ccq_logo)
12-
return content
11+
content = replace(content, "{CCQ_LOGO}" => include_ccq_logo)
12+
return content
1313
end
1414

1515
Literate.markdown(
16-
joinpath(pkgdir(DiagonalArrays), "examples", "README.jl"),
17-
joinpath(pkgdir(DiagonalArrays));
18-
flavor=Literate.CommonMarkFlavor(),
19-
name="README",
20-
postprocess=ccq_logo,
16+
joinpath(pkgdir(DiagonalArrays), "examples", "README.jl"),
17+
joinpath(pkgdir(DiagonalArrays));
18+
flavor = Literate.CommonMarkFlavor(),
19+
name = "README",
20+
postprocess = ccq_logo,
2121
)

0 commit comments

Comments
 (0)