diff --git a/src/GTPSA.jl b/src/GTPSA.jl index 590d1381..6b048817 100644 --- a/src/GTPSA.jl +++ b/src/GTPSA.jl @@ -113,6 +113,8 @@ export translate, par, scalar, + setGTPSA!, + getGTPSA, # Temporaries: @FastGTPSA, @@ -166,6 +168,42 @@ show_eps::Float64 = 0.0 # Print epsilon show_sparse::Bool = false # Use sparse monomial print show_header::Bool = false # Print a header above each TPS +""" + setGTPSA!(a::AbstractString, val) + +Function to set global variables in GTPSA. Options for `a` are: + +- `desc_current::Descriptor` -- defines the `Descriptor` to use when that information is not explicitly (or implicitly in a TPS copy constructor) available, e.g. when calling `TPS(a)` where `a` is not a TPS. This is set each time a new `Descriptor` is defined +- `show_eps::Float64` -- defines the value below which the absolute value of a monomial coefficient is NOT printed +- `show_sparse::Bool` -- specifies whether the sparse monomial format is used for printing. This is useful for GTPSAs containing a large number of variables and parameters +- `show_header::Bool` -- specifies whether or not to print the GTPSA `Descriptor` information above each TPS output +""" +function setGTPSA!(a::AbstractString, val) + a == "desc_current" && (GTPSA.desc_current = val; return) + a == "show_eps" && (GTPSA.show_eps = val; return) + a == "show_sparse" && (GTPSA.show_sparse = val; return) + a == "show_header" && (GTPSA.show_header = val; return) + error("Global variable \"$(a)\" does not exist!") +end + +""" + setGTPSA!(a::AbstractString, val) + +Function to set global variables in GTPSA. Options for `a` are: + +- `desc_current::Descriptor` -- defines the `Descriptor` to use when that information is not explicitly (or implicitly in a TPS copy constructor) available, e.g. when calling `TPS(a)` where `a` is not a TPS. This is set each time a new `Descriptor` is defined +- `show_eps::Float64` -- defines the value below which the absolute value of a monomial coefficient is NOT printed +- `show_sparse::Bool` -- specifies whether the sparse monomial format is used for printing. This is useful for GTPSAs containing a large number of variables and parameters +- `show_header::Bool` -- specifies whether or not to print the GTPSA `Descriptor` information above each TPS output +""" +function getGTPSA(a::AbstractString) + a == "desc_current" && (return GTPSA.desc_current) + a == "show_eps" && (return GTPSA.show_eps) + a == "show_sparse" && (return GTPSA.show_sparse) + a == "show_header" && (return GTPSA.show_header) + error("Global variable \"$(a)\" does not exist!") +end + # Descriptor outer constructors """ Descriptor(nv::Integer, vo::Integer)::Descriptor diff --git a/src/show.jl b/src/show.jl index 85c88a1f..e69d1736 100644 --- a/src/show.jl +++ b/src/show.jl @@ -31,6 +31,7 @@ end function show(io::IO, d::Descriptor) println(io, "GTPSA Descriptor") println(io, "-----------------------") + d.desc == C_NULL && (println(io, "Null"); return) desc = unsafe_load(d.desc) show_GTPSA_info(io, desc) end