Skip to content

Commit 49e7df6

Browse files
mtfishmangithub-actions[bot]
authored andcommitted
Format .jl files (Runic)
1 parent 6d7085d commit 49e7df6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+5152
-5138
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "BlockSparseArrays"
22
uuid = "2c9a651f-6452-4ace-a6ac-809f4280fbb4"
33
authors = ["ITensor developers <[email protected]> and contributors"]
4-
version = "0.10.6"
4+
version = "0.10.7"
55

66
[deps]
77
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"

docs/make.jl

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,26 @@ using BlockSparseArrays: BlockSparseArrays
22
using Documenter: Documenter, DocMeta, deploydocs, makedocs
33

44
DocMeta.setdocmeta!(
5-
BlockSparseArrays, :DocTestSetup, quote
6-
using BlockSparseArrays
7-
using LinearAlgebra: Diagonal
8-
end; recursive=true
5+
BlockSparseArrays, :DocTestSetup, quote
6+
using BlockSparseArrays
7+
using LinearAlgebra: Diagonal
8+
end; recursive = true
99
)
1010

1111
include("make_index.jl")
1212

1313
makedocs(;
14-
modules=[BlockSparseArrays],
15-
authors="ITensor developers <[email protected]> and contributors",
16-
sitename="BlockSparseArrays.jl",
17-
format=Documenter.HTML(;
18-
canonical="https://ITensor.github.io/BlockSparseArrays.jl",
19-
edit_link="main",
20-
assets=["assets/favicon.ico", "assets/extras.css"],
21-
),
22-
pages=["Home" => "index.md", "Reference" => "reference.md"],
14+
modules = [BlockSparseArrays],
15+
authors = "ITensor developers <[email protected]> and contributors",
16+
sitename = "BlockSparseArrays.jl",
17+
format = Documenter.HTML(;
18+
canonical = "https://ITensor.github.io/BlockSparseArrays.jl",
19+
edit_link = "main",
20+
assets = ["assets/favicon.ico", "assets/extras.css"],
21+
),
22+
pages = ["Home" => "index.md", "Reference" => "reference.md"],
2323
)
2424

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

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 BlockSparseArrays: BlockSparseArrays
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(BlockSparseArrays), "examples", "README.jl"),
17-
joinpath(pkgdir(BlockSparseArrays), "docs", "src");
18-
flavor=Literate.DocumenterFlavor(),
19-
name="index",
20-
postprocess=ccq_logo,
16+
joinpath(pkgdir(BlockSparseArrays), "examples", "README.jl"),
17+
joinpath(pkgdir(BlockSparseArrays), "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 BlockSparseArrays: BlockSparseArrays
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(BlockSparseArrays), "examples", "README.jl"),
17-
joinpath(pkgdir(BlockSparseArrays));
18-
flavor=Literate.CommonMarkFlavor(),
19-
name="README",
20-
postprocess=ccq_logo,
16+
joinpath(pkgdir(BlockSparseArrays), "examples", "README.jl"),
17+
joinpath(pkgdir(BlockSparseArrays));
18+
flavor = Literate.CommonMarkFlavor(),
19+
name = "README",
20+
postprocess = ccq_logo,
2121
)

examples/README.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# # BlockSparseArrays.jl
2-
#
2+
#
33
# [![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://itensor.github.io/BlockSparseArrays.jl/stable/)
44
# [![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://itensor.github.io/BlockSparseArrays.jl/dev/)
55
# [![Build Status](https://github.com/ITensor/BlockSparseArrays.jl/actions/workflows/Tests.yml/badge.svg?branch=main)](https://github.com/ITensor/BlockSparseArrays.jl/actions/workflows/Tests.yml?query=branch%3Amain)

ext/BlockSparseArraysTensorAlgebraExt/BlockSparseArraysTensorAlgebraExt.jl

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -2,64 +2,64 @@ module BlockSparseArraysTensorAlgebraExt
22

33
using BlockSparseArrays: AbstractBlockSparseArray, blockreshape
44
using TensorAlgebra:
5-
TensorAlgebra,
6-
BlockedTrivialPermutation,
7-
BlockedTuple,
8-
FusionStyle,
9-
ReshapeFusion,
10-
fuseaxes
5+
TensorAlgebra,
6+
BlockedTrivialPermutation,
7+
BlockedTuple,
8+
FusionStyle,
9+
ReshapeFusion,
10+
fuseaxes
1111

1212
struct BlockReshapeFusion <: FusionStyle end
1313

1414
function TensorAlgebra.FusionStyle(::Type{<:AbstractBlockSparseArray})
15-
return BlockReshapeFusion()
15+
return BlockReshapeFusion()
1616
end
1717

1818
using BlockArrays: Block, blocklength, blocks
1919
using BlockSparseArrays: blocksparse
2020
using SparseArraysBase: eachstoredindex
2121
using TensorAlgebra: TensorAlgebra, matricize, unmatricize
2222
function TensorAlgebra.matricize(
23-
::BlockReshapeFusion, a::AbstractArray, biperm::BlockedTrivialPermutation{2}
24-
)
25-
ax = fuseaxes(axes(a), biperm)
26-
reshaped_blocks_a = reshape(blocks(a), map(blocklength, ax))
27-
key(I) = Block(Tuple(I))
28-
value(I) = matricize(reshaped_blocks_a[I], biperm)
29-
Is = eachstoredindex(reshaped_blocks_a)
30-
bs = if isempty(Is)
31-
# Catch empty case and make sure the type is constrained properly.
32-
# This seems to only be necessary in Julia versions below v1.11,
33-
# try removing it when we drop support for those versions.
34-
keytype = Base.promote_op(key, eltype(Is))
35-
valtype = Base.promote_op(value, eltype(Is))
36-
valtype′ = !isconcretetype(valtype) ? AbstractMatrix{eltype(a)} : valtype
37-
Dict{keytype,valtype′}()
38-
else
39-
Dict(key(I) => value(I) for I in Is)
40-
end
41-
return blocksparse(bs, ax)
23+
::BlockReshapeFusion, a::AbstractArray, biperm::BlockedTrivialPermutation{2}
24+
)
25+
ax = fuseaxes(axes(a), biperm)
26+
reshaped_blocks_a = reshape(blocks(a), map(blocklength, ax))
27+
key(I) = Block(Tuple(I))
28+
value(I) = matricize(reshaped_blocks_a[I], biperm)
29+
Is = eachstoredindex(reshaped_blocks_a)
30+
bs = if isempty(Is)
31+
# Catch empty case and make sure the type is constrained properly.
32+
# This seems to only be necessary in Julia versions below v1.11,
33+
# try removing it when we drop support for those versions.
34+
keytype = Base.promote_op(key, eltype(Is))
35+
valtype = Base.promote_op(value, eltype(Is))
36+
valtype′ = !isconcretetype(valtype) ? AbstractMatrix{eltype(a)} : valtype
37+
Dict{keytype, valtype′}()
38+
else
39+
Dict(key(I) => value(I) for I in Is)
40+
end
41+
return blocksparse(bs, ax)
4242
end
4343

4444
using BlockArrays: blocklengths
4545
function TensorAlgebra.unmatricize(
46-
::BlockReshapeFusion,
47-
m::AbstractMatrix,
48-
blocked_ax::BlockedTuple{2,<:Any,<:Tuple{Vararg{AbstractUnitRange}}},
49-
)
50-
ax = Tuple(blocked_ax)
51-
reshaped_blocks_m = reshape(blocks(m), map(blocklength, ax))
52-
function f(I)
53-
block_axes_I = BlockedTuple(
54-
map(ntuple(identity, length(ax))) do i
55-
return Base.axes1(ax[i][Block(I[i])])
56-
end,
57-
blocklengths(blocked_ax),
46+
::BlockReshapeFusion,
47+
m::AbstractMatrix,
48+
blocked_ax::BlockedTuple{2, <:Any, <:Tuple{Vararg{AbstractUnitRange}}},
5849
)
59-
return unmatricize(reshaped_blocks_m[I], block_axes_I)
60-
end
61-
bs = Dict(Block(Tuple(I)) => f(I) for I in eachstoredindex(reshaped_blocks_m))
62-
return blocksparse(bs, ax)
50+
ax = Tuple(blocked_ax)
51+
reshaped_blocks_m = reshape(blocks(m), map(blocklength, ax))
52+
function f(I)
53+
block_axes_I = BlockedTuple(
54+
map(ntuple(identity, length(ax))) do i
55+
return Base.axes1(ax[i][Block(I[i])])
56+
end,
57+
blocklengths(blocked_ax),
58+
)
59+
return unmatricize(reshaped_blocks_m[I], block_axes_I)
60+
end
61+
bs = Dict(Block(Tuple(I)) => f(I) for I in eachstoredindex(reshaped_blocks_m))
62+
return blocksparse(bs, ax)
6363
end
6464

6565
end

ext/BlockSparseArraysTensorProductsExt/BlockSparseArraysTensorProductsExt.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ using TensorProducts: TensorProducts, tensor_product
55
# TODO: Dispatch on `FusionStyle` to allow different kinds of products,
66
# for example to allow merging common symmetry sectors.
77
function TensorProducts.tensor_product(a1::BlockUnitRange, a2::BlockUnitRange)
8-
new_blockaxes = vec(
9-
map(splat(tensor_product), Iterators.product(eachblockaxis(a1), eachblockaxis(a2)))
10-
)
11-
return blockrange(new_blockaxes)
8+
new_blockaxes = vec(
9+
map(splat(tensor_product), Iterators.product(eachblockaxis(a1), eachblockaxis(a2)))
10+
)
11+
return blockrange(new_blockaxes)
1212
end
1313

1414
end

0 commit comments

Comments
 (0)