Skip to content

Commit

Permalink
Format code (#119)
Browse files Browse the repository at this point in the history
Co-authored-by: mofeing <[email protected]>
  • Loading branch information
github-actions[bot] and mofeing authored Nov 1, 2023
1 parent 2089a76 commit 135b5ea
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion ext/TenetChainRulesCoreExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,4 @@ function ChainRulesCore.rrule(T::Type{<:absclass(TensorNetwork)}, tensors)
T(tensors), TensorNetwork_pullback
end

end
end
2 changes: 1 addition & 1 deletion ext/TenetChainRulesTestUtilsExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ function ChainRulesTestUtils.rand_tangent(rng::AbstractRNG, x::T) where {T<:absc
return Tangent{T}(tensors = [ProjectTo(tensor)(rand_tangent.(Ref(rng), tensor)) for tensor in tensors(x)])
end

end
end
2 changes: 1 addition & 1 deletion ext/TenetFiniteDifferencesExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ function FiniteDifferences.to_vec(x::T) where {T<:absclass(TensorNetwork)}
return x_vec, TensorNetwork_from_vec
end

end
end
8 changes: 7 additions & 1 deletion src/Numerics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,21 @@ LinearAlgebra.qr(t::Tensor{<:Any,2}; kwargs...) = Base.@invoke qr(t::Tensor; lef

"""
LinearAlgebra.qr(t::Tensor, mode::Symbol = :reduced; left_inds = (), right_inds = (), virtualind::Symbol = Symbol(uuid4()), kwargs...
Perform QR factorization on a tensor.
# Arguments
- `t::Tensor`: tensor to be factorized
# Keyword Arguments
- `left_inds`: left indices to be used in the QR factorization. Defaults to all indices of `t` except `right_inds`.
- `right_inds`: right indices to be used in the QR factorization. Defaults to all indices of `t` except `left_inds`.
- `virtualind`: name of the virtual bond. Defaults to a random `Symbol`.
"""
function LinearAlgebra.qr(t::Tensor; left_inds = (), right_inds = (), virtualind::Symbol = Symbol(uuid4()), kwargs...) isdisjoint(left_inds, right_inds) ||
function LinearAlgebra.qr(t::Tensor; left_inds = (), right_inds = (), virtualind::Symbol = Symbol(uuid4()), kwargs...)
isdisjoint(left_inds, right_inds) ||
throw(ArgumentError("left ($left_inds) and right $(right_inds) indices must be disjoint"))

left_inds, right_inds =
Expand Down
2 changes: 1 addition & 1 deletion src/Quantum/Quantum.jl
Original file line number Diff line number Diff line change
Expand Up @@ -255,4 +255,4 @@ Base.getproperty(obj::QTNSampler, name::Symbol) = name === :config ? getfield(ob
Base.get(obj::QTNSampler, name, default) = get(obj.config, name, default)

Base.rand(A::Type{<:Ansatz}; kwargs...) = rand(Random.default_rng(), A; kwargs...)
Base.rand(rng::AbstractRNG, A::Type{<:Ansatz}; kwargs...) = rand(rng, QTNSampler{A}(; kwargs...))
Base.rand(rng::AbstractRNG, A::Type{<:Ansatz}; kwargs...) = rand(rng, QTNSampler{A}(; kwargs...))

0 comments on commit 135b5ea

Please sign in to comment.