Skip to content

Commit 93dc9bd

Browse files
[pre-commit.ci] pre-commit autoupdate (#1645)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: mtfishman <[email protected]>
1 parent ee3db08 commit 93dc9bd

File tree

15 files changed

+48
-40
lines changed

15 files changed

+48
-40
lines changed

.pre-commit-config.yaml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1+
ci:
2+
skip: [julia-formatter]
3+
14
repos:
25
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v4.5.0
6+
rev: v5.0.0
47
hooks:
58
- id: check-merge-conflict
69
- id: check-toml
@@ -10,7 +13,8 @@ repos:
1013
exclude_types: [markdown] # incompatible with Literate.jl
1114
- id: trailing-whitespace
1215
exclude: '.*references/.*\.txt$' # do not check reference TN images
13-
- repo: https://github.com/qiaojunfeng/pre-commit-julia-format
14-
rev: v0.2.0
16+
17+
- repo: "https://github.com/domluna/JuliaFormatter.jl"
18+
rev: v2.1.1
1519
hooks:
16-
- id: julia-format
20+
- id: "julia-formatter"

NDTensors/src/blocksparse/block.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ convert(::Type{Block{N}}, t::Tuple) where {N} = Block{N}(t)
6868

6969
gethash(b::Block) = b.hash[]
7070

71-
sethash!(b::Block, h::UInt) = (b.hash[] = h; return b)
71+
sethash!(b::Block, h::UInt) = (b.hash[]=h; return b)
7272

7373
#
7474
# Basic functions

NDTensors/src/dense/densetensor.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ end
134134
@propagate_inbounds @inline getindex(T::DenseTensor, i::Integer) = storage(T)[i]
135135

136136
@propagate_inbounds @inline function setindex!(T::DenseTensor, v, i::Integer)
137-
return (storage(T)[i] = v; T)
137+
return (storage(T)[i]=v; T)
138138
end
139139

140140
#

NDTensors/src/diag/tensoralgebra/contract.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ function contract!(
9393
# elements of A and B.
9494
# `expose` allows dispatching on the data type
9595
# in order to allow scalar indexing on GPU.
96-
expose(R)[] = mapreduce(*, +, diagview(T1), diagview(T2))
96+
expose(R)[] = mapreduce(*,+,diagview(T1),diagview(T2))
9797
else
9898
diagview(R) .= diagview(T1) .* diagview(T2)
9999
end

NDTensors/src/lib/BackendSelection/src/backend_types.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@ for type in (:Algorithm, :Backend)
2828
function Base.show(io::IO, backend::$type)
2929
return print(io, "$($type) type ", backend_string(backend), ", ", parameters(backend))
3030
end
31-
Base.print(io::IO, backend::$type) =
32-
print(io, backend_string(backend), ", ", parameters(backend))
31+
Base.print(io::IO, backend::$type) = print(
32+
io, backend_string(backend), ", ", parameters(backend)
33+
)
3334
end
3435
end
3536

NDTensors/src/tupletools.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ permute(s::AbstractVector, perm) = _permute(s, perm)
6060
sim(s::NTuple) = s
6161

6262
# type stable findfirst
63-
@inline _findfirst(args...) = (i = findfirst(args...); i === nothing ? 0 : i)
63+
@inline _findfirst(args...) = (i=findfirst(args...); i === nothing ? 0 : i)
6464

6565
"""
6666
getperm(col1,col2)

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "ITensors"
22
uuid = "9136182c-28ba-11e9-034c-db9fb085ebd5"
33
authors = ["Matthew Fishman <[email protected]>", "Miles Stoudenmire <[email protected]>"]
4-
version = "0.9.2"
4+
version = "0.9.3"
55

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

jenkins/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ RUN apt-get update && \
1313

1414
ARG JULIA=1.6
1515
RUN curl -s -L https://julialang-s3.julialang.org/bin/linux/x64/${JULIA}/julia-${JULIA}-latest-linux-x86_64.tar.gz | \
16-
tar -C /usr/local -x -z --strip-components=1 -f -
16+
tar -C /usr/local -x -z --strip-components=1 -f -

src/itensor.jl

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,9 @@ Constructor for an ITensor from a TensorStorage
119119
and a set of indices.
120120
The ITensor stores a view of the TensorStorage.
121121
"""
122-
ITensor(as::AliasStyle, st::TensorStorage, is)::ITensor =
123-
ITensor(as, Tensor(as, st, Tuple(is)))
122+
ITensor(as::AliasStyle, st::TensorStorage, is)::ITensor = ITensor(
123+
as, Tensor(as, st, Tuple(is))
124+
)
124125
ITensor(as::AliasStyle, is, st::TensorStorage)::ITensor = ITensor(as, st, is)
125126

126127
ITensor(st::TensorStorage, is)::ITensor = itensor(Tensor(NeverAlias(), st, Tuple(is)))
@@ -137,8 +138,9 @@ of the input data when possible.
137138
"""
138139
itensor(args...; kwargs...)::ITensor = ITensor(AllowAlias(), args...; kwargs...)
139140

140-
ITensor(::AliasStyle, args...; kwargs...)::ITensor =
141-
error("ITensor constructor with input arguments of types `$(typeof.(args))` not defined.")
141+
ITensor(::AliasStyle, args...; kwargs...)::ITensor = error(
142+
"ITensor constructor with input arguments of types `$(typeof.(args))` not defined."
143+
)
142144

143145
"""
144146
Tensor(::ITensor)
@@ -300,7 +302,7 @@ emptyITensor(is::Indices) = emptyITensor(EmptyNumber, is)
300302

301303
emptyITensor(is...) = emptyITensor(EmptyNumber, indices(is...))
302304

303-
function emptyITensor(::Type{ElT}=EmptyNumber) where {ElT<:Number}
305+
function emptyITensor((::Type{ElT})=EmptyNumber) where {ElT<:Number}
304306
return itensor(EmptyTensor(ElT, ()))
305307
end
306308

@@ -1092,8 +1094,9 @@ A[1, 2] # 2.0, same as: A[i => 1, i' => 2]
10921094
end
10931095

10941096
# Special case that handles indexing with `end` like `A[i => end, j => 3]`
1095-
@propagate_inbounds getindex(T::ITensor, I::Union{Integer,LastVal}...)::Any =
1096-
_getindex(tensor(T), I...)
1097+
@propagate_inbounds getindex(T::ITensor, I::Union{Integer,LastVal}...)::Any = _getindex(
1098+
tensor(T), I...
1099+
)
10971100

10981101
# Simple version with just integer indexing, bounds checking gets done by NDTensors
10991102

@@ -1119,8 +1122,9 @@ A = ITensor(2.0, i, i')
11191122
A[i => 1, i' => 2] # 2.0, same as: A[i' => 2, i => 1]
11201123
```
11211124
"""
1122-
@propagate_inbounds (getindex(T::ITensor, ivs::Vararg{Any,N})::Any) where {N} =
1123-
_getindex(tensor(T), ivs...)
1125+
@propagate_inbounds (getindex(T::ITensor, ivs::Vararg{Any,N})::Any) where {N} = _getindex(
1126+
tensor(T), ivs...
1127+
)
11241128

11251129
## Allowing one to get the first ITensor element if its an order 0 tensor or an order 1 tensor with a dimension of 1. Also convert GPU back to CPU
11261130
@propagate_inbounds function getindex(T::ITensor)::Any

src/symmetrystyle.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@ function symmetrystyle(T)
77
return error("No SymmetryStyle defined for the specified object $T of type $(typeof(T))")
88
end
99

10-
symmetrystyle(T, S, U, V...)::SymmetryStyle = (
11-
Base.@_inline_meta; symmetrystyle(symmetrystyle(T), symmetrystyle(S, U, V...))
12-
)
10+
symmetrystyle(T, S, U, V...)::SymmetryStyle =
11+
(Base.@_inline_meta; symmetrystyle(symmetrystyle(T), symmetrystyle(S, U, V...)))
1312

1413
symmetrystyle(T, S)::SymmetryStyle = symmetrystyle(symmetrystyle(T), symmetrystyle(S))
1514

0 commit comments

Comments
 (0)