Skip to content

Commit

Permalink
Merge pull request #1 from Quantum-Many-Body/master
Browse files Browse the repository at this point in the history
Set the immutable fields of mutable types.
  • Loading branch information
wwangnju authored Sep 25, 2022
2 parents 7b4a79e + fb09cd4 commit 1bbfbc5
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 28 deletions.
12 changes: 6 additions & 6 deletions src/DegreesOfFreedom.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1054,12 +1054,12 @@ A term of a quantum lattice system.
"""
mutable struct Term{K, I, V, B, C<:TermCoupling, A<:TermAmplitude, M<:TermModulate}
value::V
bondkind::B
coupling::C
amplitude::A
ishermitian::Bool
modulate::M
factor::V
const bondkind::B
const coupling::C
const amplitude::A
const ishermitian::Bool
const modulate::M
const factor::V
function Term{K, I}(value, bondkind, coupling::TermCoupling, amplitude::TermAmplitude, ishermitian::Bool, modulate::TermModulate, factor) where {K, I}
@assert isa(K, Symbol) "Term error: kind must be a Symbol."
@assert isa(I, Symbol) "Term error: id must be a Symbol."
Expand Down
38 changes: 19 additions & 19 deletions src/Frameworks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ Expand the generator to get the representation of the quantum lattice system (or
Representation of a quantum lattice system by an analytical expression.
"""
mutable struct AnalyticalExpression{F<:Function, P<:Parameters} <: RepresentationGenerator
expression::F
const expression::F
parameters::P
end
@inline function update!(expression::AnalyticalExpression; parameters...)
Expand All @@ -114,11 +114,11 @@ end
The basic representation generator of a quantum lattice system that records the quantum operators or a representation of the quantum operators related to (part of) the system.
"""
mutable struct Entry{C, A<:NamedTuple, B<:NamedTuple, P<:Parameters, D<:Boundary} <: RepresentationGenerator
constops::C
alterops::A
boundops::B
const constops::C
const alterops::A
const boundops::B
parameters::P
boundary::D
const boundary::D
end
@inline Entry(entry::Entry) = entry
@inline Base.eltype(E::Type{<:Entry}) = eltype(valtype(E))
Expand Down Expand Up @@ -470,10 +470,10 @@ end
The image of a transformation applied to a representation of a quantum lattice system.
"""
mutable struct Image{E<:Entry, H<:Transformation, T<:Union{Table, Nothing}} <: CompositeGenerator{E, T}
operators::E
const operators::E
transformation::H
table::T
sourceid::UInt
const table::T
const sourceid::UInt
end
@inline contentnames(::Type{<:Image}) = (:operators, :transformation, :table, :sourceid)

Expand Down Expand Up @@ -551,11 +551,11 @@ abstract type Action end
An assignment associated with an action.
"""
mutable struct Assignment{A<:Action, P<:Parameters, M<:Function, N, D} <: Function
id::Symbol
action::A
const id::Symbol
const action::A
parameters::P
map::M
dependences::NTuple{N, Symbol}
const map::M
const dependences::NTuple{N, Symbol}
data::D
ismatched::Bool
end
Expand Down Expand Up @@ -591,14 +591,14 @@ end
An algorithm associated with an frontend.
"""
mutable struct Algorithm{F<:Frontend, P<:Parameters, M<:Function} <: Function
name::Symbol
frontend::F
din::String
dout::String
const name::Symbol
const frontend::F
const din::String
const dout::String
parameters::P
map::M
assignments::Dict{Symbol, Assignment}
timer::TimerOutput
const map::M
const assignments::Dict{Symbol, Assignment}
const timer::TimerOutput
end
@inline run!(alg::Algorithm, assign::Assignment) = nothing
@inline function Base.:(==)(algorithm₁::Algorithm, algorithm₂::Algorithm)
Expand Down
6 changes: 3 additions & 3 deletions src/Toolkit.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1143,9 +1143,9 @@ The core of a simple tree.
"""
mutable struct SimpleTreeCore{N, D}
root::Union{N, Nothing}
contents::Dict{N, D}
parent::Dict{N, N}
children::Dict{N, Vector{N}}
const contents::Dict{N, D}
const parent::Dict{N, N}
const children::Dict{N, Vector{N}}
SimpleTreeCore{N, D}() where {N, D} = new{N, D}(nothing, Dict{N, D}(), Dict{N, N}(), Dict{N, Vector{N}}())
end
@inline Base.:(==)(tc1::TC, tc2::TC) where {TC<:SimpleTreeCore} = ==(efficientoperations, tc1, tc2)
Expand Down

0 comments on commit 1bbfbc5

Please sign in to comment.