Skip to content

Commit

Permalink
[CI] Add pre-commit hooks for formatting (#1321)
Browse files Browse the repository at this point in the history
  • Loading branch information
ogauthe authored Jan 31, 2024
1 parent 51e6193 commit 973cd94
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion examples/spinless_fermion_pairing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ let
end
H = ITensors.MPO(os_h + os_p, sites)

#Get Ground state
#Get Ground state
@assert ishermitian(h)
e = eigvals(Hermitian(h))
@show e
Expand Down
2 changes: 1 addition & 1 deletion src/gmera.jl
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function correlation_matrix_to_gmps_brickwall_tailed(
return Λ, V, indsnext, relinds
end

# shift givens rotation indexes according to the inds
# shift givens rotation indexes according to the inds
function shiftByInds!(G::Circuit, inds::Vector{Int})
for (n, g) in enumerate(G.rotations)
G.rotations[n] = Givens(inds[g.i1], inds[g.i2], g.c, g.s)
Expand Down
8 changes: 4 additions & 4 deletions src/gmps.jl
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ function quadratic_operator(os::OpSum)
sites[n] = ntuple(n -> ITensors.site(term[n]), Val(2))
nsites = max(nsites, maximum(sites[n]))
end
# detect coefficient type
# detect coefficient type
coef_type = mapreduce(typeof, promote_type, coefs)
ElT = isreal(coefs) ? real(coef_type) : coef_type
# fill Hamiltonian matrix with elements
Expand Down Expand Up @@ -338,7 +338,7 @@ givens_rotations(v::ConservesNf) = return givens_rotations(v.data)

"""
givens_rotations(_v0::ConservesNfParity)
For a vector
```julia
v=_v0.data
Expand Down Expand Up @@ -833,8 +833,8 @@ end
"""
slater_determinant_to_mps(s::Vector{<:Index}, Φ::AbstractMatrix; kwargs...)
Given indices and matrix of orbitals representing a Slater determinant,
compute a matrix product state (MPS) approximately having the same correlation
Given indices and matrix of orbitals representing a Slater determinant,
compute a matrix product state (MPS) approximately having the same correlation
matrices as this Slater determinant.
Optional keyword arguments:
Expand Down
2 changes: 1 addition & 1 deletion test/electron.jl
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ end
end

@testset "Electron - Pairing (currently inactive)" begin
# Keep this testset for when the Electron-sites + pairing bug is fixed
# Keep this testset for when the Electron-sites + pairing bug is fixed
# But skip the tests for now.
is_implemented = false
if !is_implemented
Expand Down
4 changes: 2 additions & 2 deletions test/linalg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const GMPS = ITensorGaussianMPS
H[1:N, 1:N] = -1 .* conj.(hd)
H[(N + 1):end, (N + 1):end] = hd
H = (H + H') ./ 2
# compare spectrum, which can also accurately be computed via standard eigendecomposition
# compare spectrum, which can also accurately be computed via standard eigendecomposition
d, U = GMPS._eigen_gaussian_blocked(Hermitian(H))
d2, _ = eigen(Hermitian(H))
d3, _ = GMPS.eigen_gaussian(Hermitian(GMPS.interleave(H)))
Expand All @@ -30,7 +30,7 @@ end
U = (x -> Matrix(qr(x).Q))(randn(ComplexF64, 3, 3))
AU = A * U
B = GMPS.make_subspace_real_if_possible(AU)
# verify that same subspace is spanned by real eigenvectors B as original eigenvectors A or AU
# verify that same subspace is spanned by real eigenvectors B as original eigenvectors A or AU
@test norm(((B * B' * A) .- A)) <= eps(Float64) * 10
@test norm(((B * B' * AU) .- AU)) <= eps(Float64) * 10
end

0 comments on commit 973cd94

Please sign in to comment.