Skip to content

Commit 8002106

Browse files
Automatic ITensorFormatter run (#57)
Co-authored-by: mtfishman <7855256+mtfishman@users.noreply.github.com> Co-authored-by: mtfishman <mfishman@flatironinstitute.org>
1 parent 1e2a8fd commit 8002106

21 files changed

Lines changed: 70 additions & 61 deletions

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "ITensorNetworksNext"
22
uuid = "302f2e75-49f0-4526-aef7-d8ba550cb06c"
3-
version = "0.3.8"
3+
version = "0.3.9"
44
authors = ["ITensor developers <support@itensor.org> and contributors"]
55

66
[workspace]

docs/make.jl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
using ITensorNetworksNext: ITensorNetworksNext
21
using Documenter: Documenter, DocMeta, deploydocs, makedocs
2+
using ITensorNetworksNext: ITensorNetworksNext
33

44
DocMeta.setdocmeta!(
55
ITensorNetworksNext, :DocTestSetup, :(using ITensorNetworksNext); recursive = true
@@ -14,11 +14,12 @@ makedocs(;
1414
format = Documenter.HTML(;
1515
canonical = "https://itensor.github.io/ITensorNetworksNext.jl",
1616
edit_link = "main",
17-
assets = ["assets/favicon.ico", "assets/extras.css"],
17+
assets = ["assets/favicon.ico", "assets/extras.css"]
1818
),
19-
pages = ["Home" => "index.md", "Reference" => "reference.md"],
19+
pages = ["Home" => "index.md", "Reference" => "reference.md"]
2020
)
2121

2222
deploydocs(;
23-
repo = "github.com/ITensor/ITensorNetworksNext.jl", devbranch = "main", push_preview = true
23+
repo = "github.com/ITensor/ITensorNetworksNext.jl", devbranch = "main",
24+
push_preview = true
2425
)

docs/make_index.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
using Literate: Literate
21
using ITensorNetworksNext: ITensorNetworksNext
2+
using Literate: Literate
33

44
function ccq_logo(content)
55
include_ccq_logo = """
@@ -17,5 +17,5 @@ Literate.markdown(
1717
joinpath(pkgdir(ITensorNetworksNext), "docs", "src");
1818
flavor = Literate.DocumenterFlavor(),
1919
name = "index",
20-
postprocess = ccq_logo,
20+
postprocess = ccq_logo
2121
)

docs/make_readme.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
using Literate: Literate
21
using ITensorNetworksNext: ITensorNetworksNext
2+
using Literate: Literate
33

44
function ccq_logo(content)
55
include_ccq_logo = """
@@ -17,5 +17,5 @@ Literate.markdown(
1717
joinpath(pkgdir(ITensorNetworksNext));
1818
flavor = Literate.CommonMarkFlavor(),
1919
name = "README",
20-
postprocess = ccq_logo,
20+
postprocess = ccq_logo
2121
)

ext/ITensorNetworksNextTensorOperationsExt/ITensorNetworksNextTensorOperationsExt.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
module ITensorNetworksNextTensorOperationsExt
22

33
using BackendSelection: @Algorithm_str, Algorithm
4-
using ITensorNetworksNext.LazyNamedDimsArrays: LazyNamedDimsArrays, ismul, symnameddims,
5-
substitute
64
using ITensorNetworksNext.LazyNamedDimsArrays.TermInterface: arguments
5+
using ITensorNetworksNext.LazyNamedDimsArrays:
6+
LazyNamedDimsArrays, ismul, substitute, symnameddims
77
using NamedDimsArrays: inds
88
using TensorOperations: TensorOperations, optimaltree
99

src/AlgorithmsInterfaceExtensions/AlgorithmsInterfaceExtensions.jl

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module AlgorithmsInterfaceExtensions
22

33
import AlgorithmsInterface as AI
44

5-
#========================== Patches for AlgorithmsInterface.jl ============================#
5+
# ========================== Patches for AlgorithmsInterface.jl ============================
66

77
abstract type Problem <: AI.Problem end
88
abstract type Algorithm <: AI.Algorithm end
@@ -30,7 +30,7 @@ function AI.initialize_state(
3030
return DefaultState(; stopping_criterion_state, kwargs...)
3131
end
3232

33-
#============================ DefaultState ================================================#
33+
# ============================ DefaultState ================================================
3434

3535
@kwdef mutable struct DefaultState{
3636
Iterate, StoppingCriterionState <: AI.StoppingCriterionState,
@@ -40,14 +40,13 @@ end
4040
stopping_criterion_state::StoppingCriterionState
4141
end
4242

43-
#============================ increment! ==================================================#
43+
# ============================ increment! ==================================================
4444

4545
# Custom version of `increment!` that also takes the problem and algorithm as arguments.
4646
function AI.increment!(problem::Problem, algorithm::Algorithm, state::State)
4747
return AI.increment!(state)
4848
end
49-
50-
#============================ solve! ======================================================#
49+
# ============================ solve! ======================================================
5150

5251
# Custom version of `solve!` that allows specifying the logger and also overloads
5352
# `increment!` on the problem and algorithm.
@@ -58,13 +57,13 @@ default_logging_context_prefix(x) = Symbol(basetypenameof(x), :_)
5857
function default_logging_context_prefix(problem::Problem, algorithm::Algorithm)
5958
return Symbol(
6059
default_logging_context_prefix(problem),
61-
default_logging_context_prefix(algorithm),
60+
default_logging_context_prefix(algorithm)
6261
)
6362
end
6463
function AI.solve!(
6564
problem::Problem, algorithm::Algorithm, state::State;
6665
logging_context_prefix = default_logging_context_prefix(problem, algorithm),
67-
kwargs...,
66+
kwargs...
6867
)
6968
logger = AI.algorithm_logger()
7069

@@ -97,13 +96,13 @@ end
9796
function AI.solve(
9897
problem::Problem, algorithm::Algorithm;
9998
logging_context_prefix = default_logging_context_prefix(problem, algorithm),
100-
kwargs...,
99+
kwargs...
101100
)
102101
state = AI.initialize_state(problem, algorithm; kwargs...)
103102
return AI.solve!(problem, algorithm, state; logging_context_prefix, kwargs...)
104103
end
105104

106-
#============================ AlgorithmIterator ===========================================#
105+
# ============================ AlgorithmIterator ===========================================
107106

108107
abstract type AlgorithmIterator end
109108

@@ -138,7 +137,7 @@ struct DefaultAlgorithmIterator{Problem, Algorithm, State} <: AlgorithmIterator
138137
state::State
139138
end
140139

141-
#============================ with_algorithmlogger ========================================#
140+
# ============================ with_algorithmlogger ========================================
142141

143142
# Allow passing functions, not just CallbackActions.
144143
@inline function with_algorithmlogger(f, args::Pair{Symbol, AI.LoggingAction}...)
@@ -148,7 +147,7 @@ end
148147
return AI.with_algorithmlogger(f, (first.(args) .=> AI.CallbackAction.(last.(args)))...)
149148
end
150149

151-
#============================ NestedAlgorithm =============================================#
150+
# ============================ NestedAlgorithm =============================================
152151

153152
abstract type NestedAlgorithm <: Algorithm end
154153

@@ -211,7 +210,7 @@ function DefaultNestedAlgorithm(f::Function, nalgorithms::Int; kwargs...)
211210
return DefaultNestedAlgorithm(; algorithms = f.(1:nalgorithms), kwargs...)
212211
end
213212

214-
#============================ FlattenedAlgorithm ==========================================#
213+
# ============================ FlattenedAlgorithm ==========================================
215214

216215
# Flatten a nested algorithm.
217216
abstract type FlattenedAlgorithm <: Algorithm end
@@ -283,7 +282,7 @@ end
283282
stopping_criterion_state::StoppingCriterionState
284283
end
285284

286-
#============================ NonIterativeAlgorithm =======================================#
285+
# ============================ NonIterativeAlgorithm =======================================
287286

288287
# Algorithm that only performs a single step.
289288
abstract type NonIterativeAlgorithm <: Algorithm end

src/LazyNamedDimsArrays/symbolicarray.jl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
# TODO: Allow dynamic/unknown number of dimensions by supporting vector axes.
2-
struct SymbolicArray{T, N, Name, Axes <: NTuple{N, AbstractUnitRange{<:Integer}}} <: AbstractArray{T, N}
2+
struct SymbolicArray{T, N, Name, Axes <: NTuple{N, AbstractUnitRange{<:Integer}}} <:
3+
AbstractArray{T, N}
34
name::Name
45
axes::Axes
5-
function SymbolicArray{T}(name, ax::Tuple{Vararg{AbstractUnitRange{<:Integer}}}) where {T}
6+
function SymbolicArray{T}(
7+
name,
8+
ax::Tuple{Vararg{AbstractUnitRange{<:Integer}}}
9+
) where {T}
610
N = length(ax)
711
return new{T, N, typeof(name), typeof(ax)}(name, ax)
812
end

src/TensorNetworkGenerators/delta_network.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
using ..ITensorNetworksNext: TensorNetwork
12
using DiagonalArrays: δ
23
using Graphs: AbstractGraph
3-
using ..ITensorNetworksNext: TensorNetwork
44
using NamedGraphs.GraphsExtensions: incident_edges
55

66
"""

src/TensorNetworkGenerators/ising_network.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
using ..ITensorNetworksNext: @preserve_graph
12
using DiagonalArrays: DiagonalArray
23
using Graphs: degree, dst, edges, src
3-
using ..ITensorNetworksNext: @preserve_graph
44
using LinearAlgebra: Diagonal, eigen
55
using NamedDimsArrays: apply, denamed, name, operator, randname
66
using NamedGraphs.GraphsExtensions: vertextype

src/abstracttensornetwork.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ using BackendSelection: @Algorithm_str, Algorithm
33
using DataGraphs: DataGraphs, AbstractDataGraph, edge_data, underlying_graph,
44
underlying_graph_type, vertex_data
55
using Dictionaries: Dictionary
6-
using Graphs: Graphs, AbstractEdge, AbstractGraph, Graph, add_edge!, add_vertex!,
7-
bfs_tree, center, dst, edges, edgetype, ne, neighbors, nv, rem_edge!, src, vertices
6+
using Graphs: Graphs, AbstractEdge, AbstractGraph, Graph, add_edge!, add_vertex!, bfs_tree,
7+
center, dst, edges, edgetype, ne, neighbors, nv, rem_edge!, src, vertices
88
using LinearAlgebra: LinearAlgebra, factorize
99
using MacroTools: @capture
1010
using NamedDimsArrays: dimnames, inds
11+
using NamedGraphs.GraphsExtensions:
12+
directed_graph, incident_edges, rem_edges!, rename_vertices, vertextype,
1113
using NamedGraphs: NamedGraphs, NamedGraph, not_implemented, steiner_tree
12-
using NamedGraphs.GraphsExtensions: , directed_graph, incident_edges, rem_edges!,
13-
rename_vertices, vertextype
1414
using SplitApplyCombine: flatten
1515

1616
abstract type AbstractTensorNetwork{V, VD} <: AbstractDataGraph{V, VD, Nothing} end
@@ -144,7 +144,7 @@ is_assignment_expr(expr) = false
144144
macro preserve_graph(expr)
145145
if !is_setindex!_expr(expr)
146146
error(
147-
"preserve_graph must be used with setindex! syntax (as @preserve_graph a[i,j,...] = value)",
147+
"preserve_graph must be used with setindex! syntax (as @preserve_graph a[i,j,...] = value)"
148148
)
149149
end
150150
@capture(expr, array_[indices__] = value_)
@@ -234,7 +234,7 @@ using NamedGraphs.OrdinalIndexing: OrdinalSuffixedInteger
234234
function Base.setindex!(
235235
tn::AbstractTensorNetwork,
236236
value,
237-
edge::Pair{<:OrdinalSuffixedInteger, <:OrdinalSuffixedInteger},
237+
edge::Pair{<:OrdinalSuffixedInteger, <:OrdinalSuffixedInteger}
238238
)
239239
return error("No edge data.")
240240
end

0 commit comments

Comments
 (0)