Skip to content

Commit

Permalink
Comment out print statements
Browse files Browse the repository at this point in the history
  • Loading branch information
CianLM committed Dec 26, 2023
1 parent 24820e7 commit cd46e09
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 20 deletions.
10 changes: 5 additions & 5 deletions src/Integrals/Integral.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ struct UnevaluatedIntegral <: OperatorSym
end

function UnevaluatedIntegral(integrand::Union{OperatorTerm,SymbolicUtils.Symbolic}, variable::SymbolicUtils.Sym{Number})
println("UE Constructed w $(typeof(integrand)): $(new(OperatorTerm(normalorder(integrand)), variable))")
# println("UE Constructed w $(typeof(integrand)): $(new(OperatorTerm(normalorder(integrand)), variable))")
new(OperatorTerm(normalorder(integrand)), variable)
end

Expand All @@ -32,7 +32,7 @@ struct UnevaluatedIntegral <: OperatorSym
end

function UnevaluatedIntegral(integrand::KetState, variable::SymbolicUtils.Sym{Number})
println("UE constructed w $(typeof(integrand)): $integrand")
# println("UE constructed w $(typeof(integrand)): $integrand")
dict = Dict{Ket,SymorNum}()
for (k,v) in integrand.states
dict[k] = get(dict, k, 0) + UnevaluatedIntegral(v * k.op, variable)
Expand All @@ -43,7 +43,7 @@ end
# :normal, :default, :bold, :black, :blink, :blue, :cyan, :green, :hidden, :light_black, :light_blue, :light_cyan, :light_green, :light_magenta, :light_red, :light_yellow, :magenta, :nothing, :red, :reverse, :underline, :white, or :yellow

function Base.show(io::IO, integral::UnevaluatedIntegral)
print(io, "∫d$(integral.variable) ($(integral.integrand)) ")
show(io, "∫d$(integral.variable) ($(integral.integrand)) ")
end

@latexrecipe function f(x::UnevaluatedIntegral)
Expand Down Expand Up @@ -116,7 +116,7 @@ end

function integrate(integrand::KetState, k::SymbolicUtils.Sym)
pieces = [integrate(val * key.op, k) * vacuum() for (key, val) in integrand.states]
println(join(pieces, "\n"))
# println(join(pieces, "\n"))
return sum(pieces)
end

Expand Down Expand Up @@ -146,7 +146,7 @@ end
function *(a::UnevaluatedIntegral, b::Ket)
integrand = 0
for (key, value) in a.integrand.terms
println(value * key * b)
# println(value * key * b)
integrand += value * key * b
end
# printstyled(integrand, "\n", color=:light_magenta)
Expand Down
12 changes: 6 additions & 6 deletions src/Tensors/Index.jl
Original file line number Diff line number Diff line change
Expand Up @@ -55,33 +55,33 @@ end
begin "TermInterface"

function istree(x::Index)
println("Is tree called on $x")
# println("Is tree called on $x")
return false
end

function exprhead(x::Index)
println("Exprhead called on $x")
# println("Exprhead called on $x")
return :call
end

function operation(x::Index)
println("operation called on $x")
# println("operation called on $x")
return Index
end

function arguments(x::Index)
println("Arguments called on $x")
# println("Arguments called on $x")
return (x.symbol, x.covariant, x.dim)
# return x.indices
end

function metadata(x::Index)
println("Metadata called on $x")
# println("Metadata called on $x")
return nothing
end

function similarterm(t::Index, f, args; exprhead=:call, metadata=nothing)
println("similar term called with $f, $args, $symtype, $metadata, $exprhead result: $(t.adjoint ? f(args...)' : f(args...))")
# println("similar term called with $f, $args, $symtype, $metadata, $exprhead result: $(t.adjoint ? f(args...)' : f(args...))")
return f(args...)
end

Expand Down
4 changes: 2 additions & 2 deletions src/Tensors/Tensor.jl
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ end
function lower(tensor::Tensor{F}, index::Index) where F <: Field
# lower the specified index if it exists
for (i,ind) in enumerate(tensor.indices)
println(ind.symbol, index.symbol, ind.symbol == index.symbol)
# println(ind.symbol, index.symbol, ind.symbol == index.symbol)
if ind.symbol == index.symbol
indices = copy(tensor.indices)
indices[i] = Index(index.symbol, true)
Expand Down Expand Up @@ -371,7 +371,7 @@ function relabel(μ::Symbol, ν::Symbol, x::Tensor)
desired_index(index::Index) = index.symbol == μ
rule = @rule ~index::desired_index => Index(ν, index.covariant; dim=index.dim)
new_indices = Metatheory.PassThrough(rule).(arguments(x))
println(new_indices)
# println(new_indices)
return similarterm(x, operation(x), new_indices)
end

Expand Down
6 changes: 3 additions & 3 deletions src/Tensors/TensorProduct.jl
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,12 @@ contracted_indices(x::TensorProduct) = setdiff(vcat(map(x -> x.indices, x.tensor
function contract_metric(x::TensorProduct)
free_indices = signature(x)[1]
for (i,tensor) in enumerate(x.tensors)
println("tensor: $tensor, $(tensor_field(tensor)), $(any(ind -> ind free_indices, tensor.indices)), $(length(tensor.indices) == 2 ? tensor.indices[1].symbol != tensor.indices[2].symbol : tensor.indices )")
# println("tensor: $tensor, $(tensor_field(tensor)), $(any(ind -> ind ∉ free_indices, tensor.indices)), $(length(tensor.indices) == 2 ? tensor.indices[1].symbol != tensor.indices[2].symbol : tensor.indices )")
if tensor_field(tensor) == Metric && any(ind -> ind free_indices, tensor.indices) && (tensor.indices[1].symbol != tensor.indices[2].symbol)
println("here")
# println("here")
# get the index that is contracted
contracted_index = tensor.indices[findfirst(ind -> ind free_indices, tensor.indices)]
println("contracted index: $contracted_index")
# println("contracted index: $contracted_index")
# tensor.indices has 2 indices in it. One is contracted_index, the other we get with
other_index = tensor.indices[findfirst(ind -> ind != contracted_index, tensor.indices)]
# pop the metric tensor from the tensor product
Expand Down
8 changes: 4 additions & 4 deletions src/Tensors/tensors.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -169,27 +169,27 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 26,
"metadata": {},
"outputs": [
{
"data": {
"text/latex": [
"$$ \\begin{equation}\n",
"- \\beta g { } _ { \\mu } { } _ { \\nu } + 2 3 \\alpha A { } _ { \\mu } { } _ { \\nu } { } ^ { \\rho } { } ^ { \\tau } B { } _ { \\rho } { } _ { \\tau } + \\partial { } _ { \\mu } \\partial { } _ { \\nu }\n",
"- \\beta g { } _ { \\mu } { } _ { \\nu } + 2 3 \\alpha A { } _ { \\mu } { } _ { \\nu } { } ^ { \\rho } { } ^ { \\tau } B { } _ { \\rho } { } _ { \\tau } + ( 1 + \\alpha ) \\partial { } _ { \\mu } \\partial { } _ { \\nu }\n",
"\\end{equation}\n",
" $$"
],
"text/plain": [
"-βg_μν + 23αA_μν^ρτ B_ρτ + ∂_μ ∂_ν"
"-βg_μν + 23αA_μν^ρτ B_ρτ + (1 + α)∂_μ ∂_ν"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"α * A * 23B_ -β * g() + ∂() * ∂(@Index ν)"
"α * A * 23B_ -β * g() + ∂() * ∂(@Index ν) + α * ∂() * ∂(@Index ν)"
]
},
{
Expand Down

0 comments on commit cd46e09

Please sign in to comment.