diff --git a/docs/src/man/k_fastgtpsa.md b/docs/src/man/k_fastgtpsa.md index 9117a08..1779382 100644 --- a/docs/src/man/k_fastgtpsa.md +++ b/docs/src/man/k_fastgtpsa.md @@ -60,6 +60,23 @@ t3 = ComplexTPS64(); t4 = ComplexTPS64(); @gensym w; ``` +`@FastGTPSA` and `@FastGTPSA!` are also compatible with broadcasted, vectorized operators. This can be very useful for example if a structure-of-arrays (SoA) layout is used in a simulation program, but you would like to calculate a Taylor map of the output by propagating GTPSAs through. Note that for `@FastGTPSA`, which allocates the result, that there are two allocations per `TPS` and one for the `Array`. For `@FastGTPSA!`, which requires a pre-allocated output, there are zero allocations. Both are still transparent to non-`TPS` types for universally polymorphic use without cost. + +```@repl +using GTPSA, BenchmarkTools # hide +d = Descriptor(3, 7); x = vars(d); # hide +y = rand(3); # hide +@btime @FastGTPSA begin + out = @. $x^3*sin($y)/log(2+$x)-exp($x*$y)*im; + end; +out = zeros(ComplexTPS64, 3) # pre-allocate +@btime @FastGTPSA! begin + @. $out = $x^3*sin($y)/log(2+$x)-exp($x*$y)*im; + end; +``` + +If errors are thrown during usage of `@FastGTPSA`/`@FastGTPSA!`, temporaries in use may not have been properly popped from the stack. Therefore, if the Julia session is not terminated, the helper functions [`GTPSA.checktemps`](@ref) and [`GTPSA.cleartemps!](@ref) should be used to evaluate and correct the state of the buffer. + Without using the macro, each time an operation is performed using a TPS, a new TPS is dynamically-allocated containing the result. For example in the above expression, the calculation of `sin(x[2])` creates a new TPS, and the calculation of `x[1]^3` also creates a new TPS. The multiplication of these two resulting TPSs creates a new TPS, and so on until a TPS containing the full result of the evaluated expression is obtained. The intermediate TPSs that must be created to evaluate the expression are referred to as *temporaries*, because they only exist temporarily. Julia's garbage collector notices when the dynamically-allocated temporaries are no longer in scope, and cleans up that memory when it decides it's a good time to. This process can cause slowdowns in performance critical code however, especially in more complicated expressions where a lot of temporaries are created. Both `@FastGTPSA` and `@FastGTPSA!` basically tell the code to instead use a permanent, pre-allocated thread-safe buffer of TPSs for the temporaries during evaluation of the expression, so there is no dynamic memory allocation; for `@FastGTPSA`, the number of allocations is reduced to two (which is one single `TPS`), and for `@FastGTPSA!` the number of allocations is zero. Furthermore, these temporaries are accessed and deleted in a stack-like manner from the buffer by each thread, so that temporaries involved in operations are right next to each other in memory. This ensures minimal cache misses throughout the evaluation of the expression. @@ -71,4 +88,6 @@ The speedup of using the macro can be quite significant. See our [example](https ```@docs @FastGTPSA @FastGTPSA! +GTPSA.cleartemps! +GTPSA.checktemps ``` \ No newline at end of file diff --git a/src/fastgtpsa/fastgtpsa.jl b/src/fastgtpsa/fastgtpsa.jl index 1007802..cbdaad5 100644 --- a/src/fastgtpsa/fastgtpsa.jl +++ b/src/fastgtpsa/fastgtpsa.jl @@ -1,3 +1,118 @@ +# 1. Apply other macros to expression first +# taken from https://jkrumbiegel.com/pages/2022-08-09-composing-macros/ +function apply_macro(exp::Expr) + if exp isa Expr && exp.head == :macrocall + exp.args[3] = apply_macro(exp.args[3]) + return macroexpand(@__MODULE__, exp, recursive = false) + else + return exp + end +end + +# 2. Change broadcasted arithmetic .+ -> (+). +# this is basically converting expression with .+ to those +# generated by using @. (yes they are different) +function change_dots(expr::Expr) + i=1 + while i <= length(expr.args) + if expr.args[i] isa Expr + change_dots(expr.args[i]) + i += 1 + else + if expr.args[i] == :.+ + expr.head = :. + expr.args = [:+, Expr(:tuple, expr.args[i+1:end]...)] + elseif expr.args[i] == :.- + expr.head = :. + expr.args = [:-, Expr(:tuple, expr.args[i+1:end]...)] + elseif expr.args[i] == :.* + expr.head = :. + expr.args = [:*, Expr(:tuple, expr.args[i+1:end]...)] + elseif expr.args[i] == :./ + expr.head = :. + expr.args = [:/, Expr(:tuple, expr.args[i+1:end]...)] + elseif expr.args[i] == :.^ + expr.head = :. + expr.args = [:^, Expr(:tuple, expr.args[i+1:end]...)] + else + i += 1 + end + end + end + return expr +end + +# 3. Munge expression :(+, a, b, c, d) to be :(+, (+, (+, a, b), c), d) +# so temporaries push/pop handled correctly +function munge_expr(expr; inplace::Bool = false) + if !inplace; expr = deepcopy(expr); end + + if (expr.args[1] == :+ || expr.args[1] == :*) + if length(expr.args) > 3 + stub = deepcopy(expr) + pop!(stub.args) # d removed in above example + expr.args = [expr.args[1], stub, expr.args[end]] + elseif expr.head == :. && (expr.args[1] == :+ || expr.args[1] == :*) # broadcasting + if expr.args[2].head == :tuple && length(expr.args[2].args) > 2 + stub = deepcopy(expr) + pop!(stub.args[2].args) + expr.args[2].args = [stub, expr.args[2].args[end]] + end + end + end + + # Recursively call this routine for each element in args array if the arg is an Expr. + for arg in expr.args + if typeof(arg) == Expr; arg = munge_expr(arg, inplace = true); end + end + + return expr +end + +# 4. Change functions symbols to temporary types +function change_functions(expr::Expr) + fcns = [:unit, :sqrt, :exp, :log, :sin, :cos, :tan, :cot, :sinh, :cosh, :tanh, :inv, :coth, + :asin, :acos, :atan, :acot, :asinh, :acosh, :atanh, :acoth, :erf, :erfc, :sinc, + :sinhc, :asinc, :asinhc, :csc, :csch, :acsc, :acsch, :sec, :sech, :asec, :asech, + :conj, :rect, :real, :imag, :angle, :abs, :atan, :polar, :complex, :zero, :one, + :norm, :normTPS] + + function map_to_temp(fun::Symbol) + if fun == :+ + return :(GTPSA.:±) # \pm (allowed as unary operator) + elseif fun == :- + return :(GTPSA.:∓) # \mp (allowed as unary operator) + elseif fun == :* + return :(GTPSA.:⨰) # \dottimes + elseif fun == :/ + return :(GTPSA.:⨱) # \timesbar + elseif fun == :^ + return :(GTPSA.:⤊) # \Uuparrow + elseif fun in fcns + return :(GTPSA.$(Symbol("__t_" * string(fun)))) + else + return fun + end + end + + # Check if we are calling a function in GTPSA module (with qualified GTPSA. ) and change if so + if expr.head == :. && expr.args[2] isa QuoteNode && expr.args[1] == :GTPSA && expr.args[end].value in fcns + expr.args[end] = QuoteNode(map_to_temp(expr.args[end].value)) + return expr + end + + for i in eachindex(expr.args) + if expr.args[i] isa Expr + change_functions(expr.args[i]) + elseif expr.args[i] isa Symbol + expr.args[i] = map_to_temp(expr.args[i]) + end + end + + return expr +end + + """ @FastGTPSA(expr_or_block) @@ -32,17 +147,43 @@ julia> @btime @FastGTPSA begin end 6.317 μs (6 allocations: 5.81 KiB) ``` + +Broadcasting is also compatible with `@FastGTPSA` (note two allocations +per `TPS` and one allocation per `Array`): + +```julia-repl +julia> using GTPSA, BenchmarkTools + +julia> d = Descriptor(3, 7); x = vars(d); y = rand(3); + +julia> @btime @FastGTPSA begin + out = @. \$x^3*sin(\$y)/log(2+\$x)-exp(\$x*\$y)*im; + end; + 7.573 μs (7 allocations: 5.89 KiB) +``` """ macro FastGTPSA(expr_or_block) - if expr_or_block.head == :block - for i in eachindex(expr_or_block.args) - if !(expr_or_block.args[i] isa LineNumberNode) && expr_or_block.args[i].head == :(=) - expr_or_block.args[i] = :($(expr_or_block.args[i].args[1]) = GTPSA.to_TPS($(to_temp_form(munge_expr(expr_or_block.args[i].args[2]))))) + if expr_or_block.head == :block + block = expr_or_block + for i in eachindex(block.args) + if !(block.args[i] isa LineNumberNode) + expr = esc(apply_macro(block.args[i])) + lhs = expr.args[1].args[1] + rhs = expr.args[1].args[2] + rhs = change_dots(rhs) + rhs = munge_expr(rhs) + rhs = change_functions(rhs) + block.args[i] = :($lhs = GTPSA.to_TPS.($rhs)) end end - return esc(expr_or_block) + return esc(block) else - return :(to_TPS($(to_temp_form(munge_expr(esc(expr_or_block)))))) + expr = expr_or_block + expr = esc(apply_macro(expr)) + expr = change_dots(expr) + expr = munge_expr(expr) + expr = change_functions(expr) + return :(to_TPS.($expr)) end end @@ -92,109 +233,201 @@ julia> @btime @FastGTPSA! begin end 5.965 μs (0 allocations: 0 bytes) ``` + +Broadcasting is also compatible with `@FastGTPSA!`: + +```julia-repl +julia> using GTPSA, BenchmarkTools + +julia> d = Descriptor(3, 7); x = vars(d); y = rand(3); + +julia> out = zeros(ComplexTPS64, 3) # pre-allocate + +julia> @btime @FastGTPSA! begin + @. \$out = \$x^3*sin(\$y)/log(2+\$x)-exp(\$x*\$y)*im; + end; + 7.312 μs (0 allocations: 0 bytes) +``` """ macro FastGTPSA!(expr_or_block) - if expr_or_block.head == :block - for i in eachindex(expr_or_block.args) - if !(expr_or_block.args[i] isa LineNumberNode) - if expr_or_block.args[i].head == :(=) + if expr_or_block.head == :block + block = expr_or_block + for i in eachindex(block.args) + if !(block.args[i] isa LineNumberNode) + expr = esc(apply_macro(block.args[i])) + lhs = esc(expr.args[1].args[1]) + rhs = esc(expr.args[1].args[2]) + rhs = change_dots(rhs) + rhs = munge_expr(rhs) + rhs = change_functions(rhs) + + op! = false + if expr.args[1].head == :(=) op! = nothing - elseif expr_or_block.args[i].head == :(+=) + elseif expr.args[1].head == :(+=) op! = add! - elseif expr_or_block.args[i].head == :(-=) + elseif expr.args[1].head == :(-=) op! = sub! - elseif expr_or_block.args[i].head == :(*=) + elseif expr.args[1].head == :(*=) op! = mul! - elseif expr_or_block.args[i].head == :(/=) + elseif expr.args[1].head == :(/=) op! = div! - elseif expr_or_block.args[i].head == :(^=) + elseif expr.args[1].head == :(^=) op! = pow! - else + end + + if op! != false + block.args[i] = :(if $lhs isa TPS || eltype($lhs) <: TPS + to_TPS!.($lhs, $rhs, $op!) + else + $(expr) + end) + continue + end + + if expr.args[1].head == :(.=) + # broadcasted assignment + # leave rhs as is: + block.args[i] = :(if eltype($lhs) <: TPS + $lhs .= $rhs + else + $(expr) + end) + continue + elseif expr.args[1].head == :(.+=) + # broadcasted assignment + # leave rhs as is: + block.args[i] = :(if eltype($lhs) <: TPS + $lhs .+= $rhs + else + $(expr) + end) + continue + elseif expr.args[1].head == :(.-=) + # broadcasted assignment + # leave rhs as is: + block.args[i] = :(if eltype($lhs) <: TPS + $lhs .-= $rhs + else + $(expr) + end) + continue + elseif expr.args[1].head == :(.*=) + # broadcasted assignment + # leave rhs as is: + block.args[i] = :(if eltype($lhs) <: TPS + $lhs .*= $rhs + else + $(expr) + end) + continue + elseif expr.args[1].head == :(./=) + # broadcasted assignment + # leave rhs as is: + block.args[i] = :(if eltype($lhs) <: TPS + $lhs ./= $rhs + else + $(expr) + end) + continue + elseif expr.args[1].head == :(.^=) + # broadcasted assignment + # leave rhs as is: + block.args[i] = :(if eltype($lhs) <: TPS + $lhs .^= $rhs + else + $(expr) + end) continue end - expr_or_block.args[i] = :($(expr_or_block.args[i].args[1]) isa TPS ? $(expr_or_block.args[i].args[1]) = GTPSA.to_TPS!($(expr_or_block.args[i].args[1]), $(to_temp_form(munge_expr(expr_or_block.args[i].args[2]))), $op!) : $(expr_or_block.args[i])) end end - return esc(expr_or_block) + return block else - - if expr_or_block.head == :(=) + expr = expr_or_block + expr = esc(apply_macro(expr)) + lhs = esc(expr.args[1].args[1]) + rhs = esc(expr.args[1].args[2]) + rhs = change_dots(rhs) + rhs = munge_expr(rhs) + rhs = change_functions(rhs) + + op! = false + if expr.args[1].head == :(=) op! = nothing - elseif expr_or_block.head == :(+=) + elseif expr.args[1].head == :(+=) op! = add! - elseif expr_or_block.head == :(-=) + elseif expr.args[1].head == :(-=) op! = sub! - elseif expr_or_block.head == :(*=) + elseif expr.args[1].head == :(*=) op! = mul! - elseif expr_or_block.head == :(/=) + elseif expr.args[1].head == :(/=) op! = div! - elseif expr_or_block.head == :(^=) + elseif expr.args[1].head == :(^=) op! = pow! - else - return :($expr_or_block) end - return :( $(esc(expr_or_block.args[1])) isa TPS ? $(esc(expr_or_block.args[1])) = to_TPS!($(esc(expr_or_block.args[1])), $(to_temp_form(munge_expr(esc(expr_or_block.args[2])))),$op!) : $(esc(expr_or_block))) - end -end - -to_temp_form(not_expr) = not_expr -function to_temp_form(expr::Expr) - fcns = [:unit, :sqrt, :exp, :log, :sin, :cos, :tan, :cot, :sinh, :cosh, :tanh, :inv, :coth, - :asin, :acos, :atan, :acot, :asinh, :acosh, :atanh, :acoth, :erf, :erfc, :sinc, - :sinhc, :asinc, :asinhc, :csc, :csch, :acsc, :acsch, :sec, :sech, :asec, :asech, - :conj, :rect, :real, :imag, :angle, :abs, :atan, :polar, :complex, :zero, :one, - :norm, :normTPS, :+, :-, :*, :/, :^] - if expr.head == :. - pkg = expr.args[1] - if pkg == :GTPSA && expr.args[end].value in fcns # Only change is function is in GTPSA - str = "__t_" * string(expr.args[end].value) - expr.args[end] = QuoteNode(Symbol(str)) + if op! != false + return :( if $lhs isa TPS || eltype($lhs) <: TPS + to_TPS!.($lhs, $rhs, $op!) + else + $(expr) + end) end - return expr - end - for i in eachindex(expr.args) - if expr.args[i] isa Expr && expr.args[i].args[1] in fcns - to_temp_form(expr.args[i]) - elseif expr.args[i] == :+ - expr.args[i] = :(GTPSA.:±) # \pm (allowed as unary operator) - elseif expr.args[i] == :- - expr.args[i] = :(GTPSA.:∓) # \mp (allowed as unary operator) - elseif expr.args[i] == :* - expr.args[i] = :(GTPSA.:⨰) # \dottimes - elseif expr.args[i] == :/ - expr.args[i] = :(GTPSA.:⨱) # \timesbar - elseif expr.args[i] == :^ - expr.args[i] = :(GTPSA.:⤊) # \Uuparrow - elseif expr.args[i] in fcns - str = "__t_" * string(expr.args[i]) - expr.args[i] = :(GTPSA.$(Symbol(str))) - end - end - - return expr -end - -munge_expr(not_expr) = not_expr -function munge_expr(expr::Expr; inplace::Bool = false) - if !inplace; expr = deepcopy(expr); end - # Munge :(+, a, b, c, d) to be :(+, (+, a, b, c), d) - if expr.head == :call && (expr.args[1] == :+ || expr.args[1] == :*) && length(expr.args) > 3 - # println("Found +*") - stub = deepcopy(expr) - pop!(stub.args) # d removed in above exprample - expr.args = [expr.args[1], stub, expr.args[end]] - end - - # Recursively call this routine for each element in args array if the arg is an Expr. - for arg in expr.args - # println("In: " * string(arg)) - if typeof(arg) == Expr; arg = munge_expr(arg, inplace = true); end + if expr.args[1].head == :(.=) + # broadcasted assignment + # leave rhs as is: + return :( if eltype($lhs) <: TPS + $lhs .= $rhs + else + $(expr) + end) + elseif expr.args[1].head == :(.+=) + # broadcasted assignment + # leave rhs as is: + return :( if eltype($lhs) <: TPS + $lhs .+= $rhs + else + $(expr) + end) + elseif expr.args[1].head == :(.-=) + # broadcasted assignment + # leave rhs as is: + return :( if eltype($lhs) <: TPS + $lhs .-= $rhs + else + $(expr) + end) + elseif expr.args[1].head == :(.*=) + # broadcasted assignment + # leave rhs as is: + return :( if eltype($lhs) <: TPS + $lhs .*= $rhs + else + $(expr) + end) + elseif expr.args[1].head == :(./=) + # broadcasted assignment + # leave rhs as is: + return :( if eltype($lhs) <: TPS + $lhs ./= $rhs + else + $(expr) + end) + elseif expr.args[1].head == :(.^=) + # broadcasted assignment + # leave rhs as is: + return :( if eltype($lhs) <: TPS + $lhs .^= $rhs + else + $(expr) + end) + end + + return :($(esc(expr))) end - - return expr -end +end function to_TPS(t1::TempTPS{T}) where {T} t = TPS{T}(getdesc(t1).desc, getmo(t1)) #get_and_zero_mo!(t1)) @@ -203,29 +436,7 @@ function to_TPS(t1::TempTPS{T}) where {T} return t end -function to_TPS!(t::S, t1::T, op!) where {S,T} - if !(S <: TPS) - if T <: Union{TPS,TempTPS} - try error("Incorrect destination type: received $(typeof(a)), require $(TPS{T})") finally GTPSA.cleartemps!(getdesc(b)) end - else - if isnothing(op!) - return t1 - else - if op! == add! - return t+t1 - elseif op! == sub! - return t-t1 - elseif op! == mul! - return t*t1 - elseif op! == div! - return t/t1 - else - return t^t1 - end - end - end - end - +function to_TPS!(t::TPS, t1, op!) if isnothing(op!) if t1 isa TPS || t1 isa TempTPS copy!(t,t1) @@ -243,16 +454,5 @@ function to_TPS!(t::S, t1::T, op!) where {S,T} return t end - - - -#to_TPS!(t::TPS{T}, b::Union{TPS{T},TempTPS{T}}, op!) where {T} - - - - # Fallback for non-TPS types -to_TPS(a) = a -#to_TPS!(a, b::Union{TPS,TempTPS}, op!) = try error("Incorrect destination type: received $(typeof(a)), require $(TPS{T})") finally GTPSA.cleartemps!(getdesc(b)) end -#to_TPS!(a,b,op!) = b - +to_TPS(a) = a \ No newline at end of file diff --git a/src/fastgtpsa/operators.jl b/src/fastgtpsa/operators.jl index 5f93979..933b4e9 100644 --- a/src/fastgtpsa/operators.jl +++ b/src/fastgtpsa/operators.jl @@ -250,12 +250,12 @@ __t_complex(t1::TempTPS{Float64}) = (t = TempTPS{complex(eltype(t1))}(t1); compl function __t_complex(tre::RealTPS, tim::RealTPS) t = TempTPS{ComplexF64}(tre) complex!(t, tre=tre, tim=tim) - if tre isa TempTPS - rel_temp!(tre) - end if tim isa TempTPS rel_temp!(tim) end + if tre isa TempTPS + rel_temp!(tre) + end return t end diff --git a/src/fastgtpsa/temptps.jl b/src/fastgtpsa/temptps.jl index 15236e2..4d33ebf 100644 --- a/src/fastgtpsa/temptps.jl +++ b/src/fastgtpsa/temptps.jl @@ -95,6 +95,9 @@ necessary to run if `GTPSA.checktemps(d::Descriptor=GTPSA.desc_current)` returns using `@FastGTPSA` or `@FastGTPSA!`, and the Julia session is not terminated. """ function cleartemps!(d::Descriptor=GTPSA.desc_current) + if GTPSA.desc_current.desc == C_NULL + return + end desc = unsafe_load(d.desc) for i = 1:Threads.nthreads(:default) unsafe_store!(desc.ti, Cint(0), i) @@ -113,6 +116,9 @@ occur if an error is thrown during evaluation of an expression using `@FastGTPSA or `@FastGTPSA!`. """ function checktemps(d::Descriptor=GTPSA.desc_current) + if GTPSA.desc_current.desc == C_NULL + return false + end desc = unsafe_load(d.desc) for i=1:desc.nth unsafe_load(desc.ti, i) == 0 || return false @@ -121,6 +127,22 @@ function checktemps(d::Descriptor=GTPSA.desc_current) return true end +# --- overloads for broadcasting compatibility --- +Base.broadcastable(o::TempTPS) = Ref(o) +function Base.setindex!(A::Array{T}, x::TempTPS, i1::Int) where {T<:TPS} + copy!(A[i1], x) + rel_temp!(x) +end +# These operators are *only* called when doing .+= or .-= etc +# because temporaries should otherwise never see +, -, .... Broadcasting +# calls these guys internally. ++(t::TPS, t1::TempTPS) = (add!(t, t, t1); rel_temp!(t1); return t) +-(t::TPS, t1::TempTPS) = (sub!(t, t, t1); rel_temp!(t1); return t) +*(t::TPS, t1::TempTPS) = (mul!(t, t, t1); rel_temp!(t1); return t) +/(t::TPS, t1::TempTPS) = (div!(t, t, t1); rel_temp!(t1); return t) +^(t::TPS, t1::TempTPS) = (pow!(t, t, t1); rel_temp!(t1); return t) + + Base.unsafe_convert(::Type{Ptr{TPS{T}}}, t::TempTPS{T}) where {T} = t.t Base.eltype(::Type{TempTPS{T}}) where {T} = T Base.eltype(::TempTPS{T}) where {T} = T diff --git a/src/inplace_operators.jl b/src/inplace_operators.jl index a801f06..4f59733 100644 --- a/src/inplace_operators.jl +++ b/src/inplace_operators.jl @@ -160,18 +160,18 @@ Sets `t` to so that `real(t)=tre` and `imag(t)=tim` in place. complex!(t::ComplexTPS; tre=nothing, tim=nothing) = low_cplx!(t, tre, tim) # TPS: -function low_cplx!(t::ComplexTPS, tre::Union{TPS{Float64},Nothing}, tim::Union{TPS{Float64},Nothing}) +function low_cplx!(t::ComplexTPS, tre::Union{RealTPS,Nothing}, tim::Union{RealTPS,Nothing}) return mad_ctpsa_cplx!(!isnothing(tre) ? tre : C_NULL, !isnothing(tim) ? tim : C_NULL, t) end # TPS, Number: -function low_cplx!(t::ComplexTPS, tre::Union{TPS{Float64},Nothing}, tim::Real) +function low_cplx!(t::ComplexTPS, tre::Union{RealTPS,Nothing}, tim::Real) mad_ctpsa_cplx!(!isnothing(tre) ? tre : C_NULL, C_NULL, t) seti!(t, 0, 1, complex(0,tim)) end # Number, TPS: -function low_cplx!(t::ComplexTPS, tre::Real, tim::Union{TPS{Float64},Nothing}) +function low_cplx!(t::ComplexTPS, tre::Real, tim::Union{RealTPS,Nothing}) mad_ctpsa_cplx!(C_NULL, !isnothing(tim) ? tim : t) seti!(t, 0, 1, tre) end diff --git a/test/runtests.jl b/test/runtests.jl index 3ac326e..a3b3b38 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,4 +1,5 @@ using Test, JET +using BenchmarkTools: @benchmark, BenchmarkTools using SpecialFunctions using GTPSA import GTPSA: Desc @@ -737,7 +738,7 @@ end end -@testset "@FastGTPSA - Arithmetic operators" begin +@testset "FastGTPSA - Arithmetic operators" begin d = Descriptor(1, 5) t = TPS(use=d) ct = ComplexTPS64(t) @@ -838,15 +839,85 @@ end @test @FastGTPSA(normTPS(t2 ^ (3+3im) - 2^(3+3im))) < tol @test @FastGTPSA(normTPS((3+3im)^t2 - (3+3im)^2)) < tol + out = ComplexTPS64() + # TPS: + @test (@FastGTPSA!(out = t1 + t2 - t3); normTPS(out)) < tol + @test (@FastGTPSA!(out = t2 + t1 - t3); normTPS(out)) < tol + @test (@FastGTPSA!(out = t1 + 2 - t3); normTPS(out)) < tol + @test (@FastGTPSA!(out = 2 + t1 - t3); normTPS(out)) < tol + @test (@FastGTPSA!(out = t3 - t2 - t1); normTPS(out)) < tol + @test (@FastGTPSA!(out = t2 - t3 - -t1); normTPS(out)) < tol + @test (@FastGTPSA!(out = t3 - 2 - t1); normTPS(out)) < tol + @test (@FastGTPSA!(out = 2 - t3 - -t1); normTPS(out)) < tol + @test (@FastGTPSA!(out = t2 * t3 - 6); normTPS(out)) < tol + @test (@FastGTPSA!(out = t3 * t2 - 6); normTPS(out)) < tol + @test (@FastGTPSA!(out = t2 * 5 - 10); normTPS(out)) < tol + @test (@FastGTPSA!(out = 5 * t2 - 10 * t1); normTPS(out)) < tol + @test (@FastGTPSA!(out = t1 / t2 - 1/2); normTPS(out)) < tol + @test (@FastGTPSA!(out = t2 / t1 - 2); normTPS(out)) < tol + @test (@FastGTPSA!(out = 1 / t2 - 1/2); normTPS(out)) < tol + @test (@FastGTPSA!(out = t2 / 3 - 2/3); normTPS(out)) < tol + @test (@FastGTPSA!(out = t2 / t2 - t1); normTPS(out)) < tol + @test (@FastGTPSA!(out = t2 / t2 - 1); normTPS(out)) < tol + @test (@FastGTPSA!(out = t2 ^ t3 - 8); normTPS(out)) < tol + @test (@FastGTPSA!(out = t3 ^ t2 - 9); normTPS(out)) < tol + @test (@FastGTPSA!(out = t2 ^ 3 - 8); normTPS(out)) < tol + @test (@FastGTPSA!(out = t2 ^ (1/2) - sqrt(2)); normTPS(out)) < tol + @test (@FastGTPSA!(out = t2 ^ (1/2) - sqrt(t2)); normTPS(out)) < tol + @test (@FastGTPSA!(out = 2 ^ t3 - 8); normTPS(out)) < tol + @test (@FastGTPSA!(out = inv(t3) - 1/t3); normTPS(out)) < tol + @test (@FastGTPSA!(out = inv(t3) - 1/3); normTPS(out)) < tol + @test (@FastGTPSA!(out = ct1 + ct2 - ct3); normTPS(out)) < tol + @test (@FastGTPSA!(out = ct2 + ct1 - ct3); normTPS(out)) < tol + @test (@FastGTPSA!(out = ct1 + (2+2im) - ct3); normTPS(out)) < tol + @test (@FastGTPSA!(out = (2+2im) + ct1 - ct3); normTPS(out)) < tol + @test (@FastGTPSA!(out = ct3 - ct2 - ct1); normTPS(out)) < tol + @test (@FastGTPSA!(out = ct2 - ct3 - -ct1); normTPS(out)) < tol + @test (@FastGTPSA!(out = ct3 - (2+2im) - ct1); normTPS(out)) < tol + @test (@FastGTPSA!(out = (2+2im) - ct3 - -ct1); normTPS(out)) < tol + @test (@FastGTPSA!(out = ct2 * ct3 - (2+2im)*(3+3im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = ct3 * ct2 - (2+2im)*(3+3im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = ct2 * 5 - (10+10im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = 5 * ct2 - (10 * ct1)); normTPS(out)) < tol + @test (@FastGTPSA!(out = ct1 / ct2 - (1+im)/(2+2im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = ct2 / ct1 - 2); normTPS(out)) < tol + @test (@FastGTPSA!(out = 1 / ct2 - 1/(2+2im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = ct2 / 3 - (2+2im)/3); normTPS(out)) < tol + @test (@FastGTPSA!(out = ct2 / ct2 - 1); normTPS(out)) < tol + @test (@FastGTPSA!(out = ct2 ^ ct3 - (2+2im)^(3+3im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = ct3 ^ ct2 - (3+3im)^(2+2im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = ct2 ^ 3 - (2+2im)^3); normTPS(out)) < tol + @test (@FastGTPSA!(out = ct2 ^ (1/2) - sqrt(2+2im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = ct2 ^ (1/2) - sqrt(ct2)); normTPS(out)) < tol + @test (@FastGTPSA!(out = 2 ^ ct3 - 2^(3+3im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = inv(ct3) - 1/ct3); normTPS(out)) < tol + @test (@FastGTPSA!(out = inv(ct3) - 1/(3+3im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = t1 + ct2 - (1 + (2+2im))); normTPS(out)) < tol + @test (@FastGTPSA!(out = ct2 + t1 - (1 + (2+2im))); normTPS(out)) < tol + @test (@FastGTPSA!(out = t1 + (2+2im) - (1 + (2+2im))); normTPS(out)) < tol + @test (@FastGTPSA!(out = (2+2im) + t1 - (1 + (2+2im))); normTPS(out)) < tol + @test (@FastGTPSA!(out = t3 - ct2 - (3 - (2+2im))); normTPS(out)) < tol + @test (@FastGTPSA!(out = ct2 - t3 - ((2+2im) - 3)); normTPS(out)) < tol + @test (@FastGTPSA!(out = t3 - (2+2im) - (3 - (2+2im))); normTPS(out)) < tol + @test (@FastGTPSA!(out = (2+2im) - t3 - ((2+2im) - 3)); normTPS(out)) < tol + @test (@FastGTPSA!(out = t2 * ct3 - 2 * (3+3im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = ct3 * t2 - 2 * (3+3im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = t2 * (3+3im) - 2 * (3+3im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = (3+3im) * t2 - 2 * (3+3im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = t2 / ct3 - 2/(3+3im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = ct3 / t2 - (3+3im)/2); normTPS(out)) < tol + @test (@FastGTPSA!(out = t2 / (3+3im) - 2/(3+3im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = (3+3im) / t2 - (3+3im)/2); normTPS(out)) < tol + @test (@FastGTPSA!(out = t2 ^ ct3 - 2^(3+3im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = ct3 ^ t2 - (3+3im)^2); normTPS(out)) < tol + @test (@FastGTPSA!(out = t2 ^ (3+3im) - 2^(3+3im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = (3+3im)^t2 - (3+3im)^2); normTPS(out)) < tol + # Make sure stack is 0: - desc = unsafe_load(GTPSA.getdesc(t1).desc) - tmpidx = unsafe_load(desc.ti) - ctmpidx = unsafe_load(desc.cti) - @test ctmpidx == 0 - @test tmpidx == 0 + @test GTPSA.checktemps() end -@testset "@FastGTPSA - Functions: scalar TPSs vs. Julia scalars" begin +@testset "FastGTPSA - Functions: scalar TPSs vs. Julia scalars" begin d = Descriptor(1, 5) t = TPS(use=d) v = 0.5 @@ -1026,15 +1097,185 @@ end @test @FastGTPSA(normTPS(hypot(1,t2,3+3im) - hypot(1,2,3+3im))) < tol @test @FastGTPSA(normTPS(hypot(1+1im,2,t3) - hypot(1+1im,2,3))) < tol + + + d = Descriptor(1, 5) + t = TPS(use=d) + v = 0.5 + t[0] = v + tol = 1e-14 + t1 = TPS(t) + t1[0] = 1 + t2 = zero(t1) + t2[0] = 2 + t3 = zero(t1) + t3[0] = 3 + out = ComplexTPS64() + + @test (@FastGTPSA!(out = abs(-t) - abs(-v) ); normTPS(out)) < tol + @test (@FastGTPSA!(out = sqrt(t) - sqrt(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = exp(t) - exp(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = log(t) - log(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = sin(t) - sin(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = cos(t) - cos(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = tan(t) - tan(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = csc(t) - csc(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = sec(t) - sec(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = cot(t) - cot(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = sinc(t) - sinc(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = sinh(t) - sinh(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = cosh(t) - cosh(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = tanh(t) - tanh(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = csch(t) - csch(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = sech(t) - sech(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = coth(t) - coth(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = asin(t) - asin(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = acos(t) - acos(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = atan(t) - atan(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = acsc(1/t) - acsc(1/v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = asec(1/t) - asec(1/v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = acot(1/t) - acot(1/v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = asinh(t) - asinh(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = acosh(1/t) - acosh(1/v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = atanh(t) - atanh(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = acsch(1/t) - acsch(1/v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = asech(t) - asech(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = acoth(1/t) - acoth(1/v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = asinc(t/pi) - asin(v)/(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = asinhc(t/pi) - asinh(v)/(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = zero(t) - zero(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = real(t) - real(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = imag(t) - imag(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = conj(t) - conj(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = sinhc(t/pi) - sinh(v)/v); normTPS(out)) < tol + @test (@FastGTPSA!(out = erf(t) - erf(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = erfc(t) - erfc(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = -im*erf(t*im) - erfi(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = atan(t3,t2) - atan(3,2)); normTPS(out)) < tol + @test (@FastGTPSA!(out = atan(t3,2) - atan(3,2)); normTPS(out)) < tol + @test (@FastGTPSA!(out = atan(3,t2) - atan(3,2)); normTPS(out)) < tol + @test (@FastGTPSA!(out = atan(t3,-t2) - atan(3,-2)); normTPS(out)) < tol + @test (@FastGTPSA!(out = atan(t3,-2) - atan(3,-2)); normTPS(out)) < tol + @test (@FastGTPSA!(out = atan(3,-t2) - atan(3,-2)); normTPS(out)) < tol + @test (@FastGTPSA!(out = atan(-t3,-t2) - atan(-3,-2)); normTPS(out)) < tol + @test (@FastGTPSA!(out = atan(-t3,-2) - atan(-3,-2)); normTPS(out)) < tol + @test (@FastGTPSA!(out = atan(-3,-t2) - atan(-3,-2)); normTPS(out)) < tol + @test (@FastGTPSA!(out = atan(-t3,t2) - atan(-3,2)); normTPS(out)) < tol + @test (@FastGTPSA!(out = atan(-t3,2) - atan(-3,2)); normTPS(out)) < tol + @test (@FastGTPSA!(out = atan(-3,t2) - atan(-3,2)); normTPS(out)) < tol + @test (@FastGTPSA!(out = hypot(t2,t3) - hypot(2,3)); normTPS(out)) < tol + @test (@FastGTPSA!(out = hypot(2,t3) - hypot(2,3)); normTPS(out)) < tol + @test (@FastGTPSA!(out = hypot(t2,3) - hypot(2,3)); normTPS(out)) < tol + @test (@FastGTPSA!(out = hypot(t1,t2,t3) - hypot(1,2,3)); normTPS(out)) < tol + @test (@FastGTPSA!(out = hypot(1, t2, t3) - hypot(1,2,3)); normTPS(out)) < tol + @test (@FastGTPSA!(out = hypot(t1, 2, t3) - hypot(1,2,3)); normTPS(out)) < tol + @test (@FastGTPSA!(out = hypot(t1, t2, 3) - hypot(1,2,3)); normTPS(out)) < tol + @test (@FastGTPSA!(out = hypot(1, 2, t3) - hypot(1,2,3)); normTPS(out)) < tol + @test (@FastGTPSA!(out = hypot(1, t2, 3) - hypot(1,2,3)); normTPS(out)) < tol + @test (@FastGTPSA!(out = hypot(t1, 2, 3) - hypot(1,2,3)); normTPS(out)) < tol + @test (@FastGTPSA!(out = angle(t2) - angle(2)); normTPS(out)) < tol + @test (@FastGTPSA!(out = angle(-t2) - angle(-2)); normTPS(out)) < tol + @test (@FastGTPSA!(out = complex(t3) - complex(3)); normTPS(out)) < tol + @test (@FastGTPSA!(out = complex(t2,t3) - complex(2,3)); normTPS(out)) < tol + @test (@FastGTPSA!(out = polar(t2) - (abs(2)+im*atan(0,2))); normTPS(out)) < tol + @test (@FastGTPSA!(out = polar(-t1) - (abs(-1)+im*atan(0,-1))); normTPS(out)) < tol + @test (@FastGTPSA!(out = rect(t2) - (2*cos(0) + im*2*sin(0))); normTPS(out)) < tol + @test (@FastGTPSA!(out = rect(-t1) - (-1*cos(0) + im*-1*sin(0))); normTPS(out)) < tol + + + v = 0.5+0.5im + t = ComplexTPS64(t) + t[0] = v + ct1 = ComplexTPS64(t) + ct1[0] = 1 + 1im + ct2 = zero(ct1) + ct2[0] = 2 + 2im + ct3 = zero(ct1) + ct3[0] = 3 + 3im + @test (@FastGTPSA!(out = abs(-t) - abs(-v) ); normTPS(out)) < tol + @test (@FastGTPSA!(out = sqrt(t) - sqrt(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = exp(t) - exp(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = log(t) - log(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = sin(t) - sin(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = cos(t) - cos(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = tan(t) - tan(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = csc(t) - csc(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = sec(t) - sec(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = cot(t) - cot(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = sinc(t) - sinc(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = sinh(t) - sinh(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = cosh(t) - cosh(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = tanh(t) - tanh(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = csch(t) - csch(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = sech(t) - sech(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = coth(t) - coth(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = asin(t) - asin(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = acos(t) - acos(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = atan(t) - atan(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = acsc(t) - acsc(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = asec(t) - asec(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = acot(t) - acot(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = asinh(t) - asinh(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = acosh(t) - acosh(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = atanh(t) - atanh(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = acsch(t) - acsch(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = asech(t) - asech(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = acoth(t) - acoth(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = asinc(t/pi) - asin(v)/v); normTPS(out)) < tol + @test (@FastGTPSA!(out = asinhc(t/pi) - asinh(v)/v); normTPS(out)) < tol + @test (@FastGTPSA!(out = zero(t) - zero(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = real(t) - real(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = imag(t) - imag(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = conj(t) - conj(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = sinhc(t/pi) - sinh(v)/v); normTPS(out)) < tol + @test (@FastGTPSA!(out = erf(t) - erf(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = erfc(t) - erfc(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = -im*erf(t*im) - erfi(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = hypot(ct2,ct3) - hypot(2+2im,3+3im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = hypot(2+2im,ct3) - hypot(2+2im,3+3im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = hypot(ct2,3+3im) - hypot(2+2im,3+3im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = hypot(ct1,ct2,ct3) - hypot(1+1im,2+2im,3+3im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = hypot(1+1im, ct2, ct3) - hypot(1+1im,2+2im,3+3im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = hypot(ct1, 2+2im, ct3) - hypot(1+1im,2+2im,3+3im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = hypot(ct1, ct2, 3+3im) - hypot(1+1im,2+2im,3+3im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = hypot(1+1im, 2+2im, ct3) - hypot(1+1im,2+2im,3+3im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = hypot(1+1im, ct2, 3+3im) - hypot(1+1im,2+2im,3+3im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = hypot(ct1, 2+2im, 3+3im) - hypot(1+1im,2+2im,3+3im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = angle(t2+im*t3) - angle(2+3im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = angle(t2-im*t3) - angle(2-3im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = angle(-t2-im*t3) - angle(-2-3im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = angle(-t2+im*t3) - angle(-2+3im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = angle(ct2) - angle(2+2im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = angle(-ct2) - angle(-2-2im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = complex(ct3) - complex(3+3im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = polar(ct2) - (abs(2+2im)+im*angle(2+2im))); normTPS(out)) < tol + @test (@FastGTPSA!(out = polar(-ct1) - (abs(-1-im)+im*angle(-1-im))); normTPS(out)) < tol + @test (@FastGTPSA!(out = rect(ct2) - (2*cos(2) + im*2*sin(2))); normTPS(out)) < tol + @test (@FastGTPSA!(out = rect(-ct1) - (-1*cos(-1) + im*-1*sin(-1))); normTPS(out)) < tol + @test (@FastGTPSA!(out = hypot(ct1, ct2, t3) - hypot(1+1im,2+2im,3)); normTPS(out)) < tol + @test (@FastGTPSA!(out = hypot(ct1, t2, ct3) - hypot(1+1im,2,3+3im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = hypot(t1, ct2, ct3) - hypot(1,2+2im,3+3im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = hypot(ct1, t2, t3) - hypot(1+1im,2,3)); normTPS(out)) < tol + @test (@FastGTPSA!(out = hypot(t1, ct2, t3) - hypot(1,2+2im,3)); normTPS(out)) < tol + @test (@FastGTPSA!(out = hypot(t1, t2, ct3) - hypot(1,2,3+3im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = hypot(ct1,t2,3+3im) - hypot(1+1im,2,3+3im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = hypot(t1, ct2, 3+3im) - hypot(1,2+2im,3+3im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = hypot(ct1,2+2im,t3) - hypot(1+1im,2+2im,3)); normTPS(out)) < tol + @test (@FastGTPSA!(out = hypot(t1,2+2im,ct3) - hypot(1,2+2im,3+3im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = hypot(1+1im,ct2,t3) - hypot(1+1im,2+2im,3)); normTPS(out)) < tol + @test (@FastGTPSA!(out = hypot(1+1im, t2, ct3) - hypot(1+1im,2,3+3im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = hypot(t1,t2,3+3im) - hypot(1,2,3+3im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = hypot(t1,2+2im,t3) - hypot(1,2+2im,3)); normTPS(out)) < tol + @test (@FastGTPSA!(out = hypot(1+1im,t2,t3) - hypot(1+1im,2,3)); normTPS(out)) < tol + @test (@FastGTPSA!(out = hypot(t1,2,3+3im) - hypot(1,2,3+3im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = hypot(1,t2,3+3im) - hypot(1,2,3+3im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = hypot(1+1im,2,t3) - hypot(1+1im,2,3)); normTPS(out)) < tol + # Make sure stack is 0: - desc = unsafe_load(GTPSA.getdesc(t1).desc) - tmpidx = unsafe_load(desc.ti) - ctmpidx = unsafe_load(desc.cti) - @test ctmpidx == 0 - @test tmpidx == 0 + @test GTPSA.checktemps() end -@testset "@FastGTPSA - Functions: identities, using TPSs" begin +@testset "FastGTPSA - Functions: identities, using TPSs" begin d = Descriptor(1, 5) t = TPS(use=d) t[0] = 0.5; t[[1]] = 2; t[[2]] = 3; t[[3]] = 4; t[[4]] = 5; t[[5]] = 6 @@ -1146,12 +1387,119 @@ end @test @FastGTPSA(normTPS(angle(t) - atan(imag(t),real(t)))) < tol @test @FastGTPSA(normTPS(complex(t) - t)) < tol + + + d = Descriptor(1, 5) + t = TPS(use=d) + t[0] = 0.5; t[[1]] = 2; t[[2]] = 3; t[[3]] = 4; t[[4]] = 5; t[[5]] = 6 + + tol = 1e-10 + out = ComplexTPS64() + @test (@FastGTPSA!(out = sin(t)^2+cos(t)^2 - 1); normTPS(out)) < tol + @test (@FastGTPSA!(out = 1/sin(t) - csc(t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = 1/cos(t) - sec(t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = 1/tan(t) - cot(t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = sin(t)/cos(t) - tan(t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = cos(2*t) - cos(t)^2 + sin(t)^2); normTPS(out)) < tol + @test (@FastGTPSA!(out = sec(t)^2 - 1 - tan(t)^2); normTPS(out)) < tol + @test (@FastGTPSA!(out = sin(t/2) - sqrt((1-cos(t))/2)); normTPS(out)) < tol + @test (@FastGTPSA!(out = cos(t/2) - sqrt((1+cos(t))/2)); normTPS(out)) < tol + @test (@FastGTPSA!(out = sqrt(t^2) - abs(t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = csc(t)^2 - cot(t)^2 - 1); normTPS(out)) < tol + @test (@FastGTPSA!(out = exp(log(t)) - t); normTPS(out)) < tol + @test (@FastGTPSA!(out = log(exp(t)) - t); normTPS(out)) < tol + @test (@FastGTPSA!(out = log(exp(t)) - exp(log(t))); normTPS(out)) < tol + @test (@FastGTPSA!(out = log(t^2) - 2*log(t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = 5*log(t) - log(t^5)); normTPS(out)) < tol + @test (@FastGTPSA!(out = t*log(5) - log(5^t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = sinc(t) - sin(pi*t)/(pi*t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = sinhc(t/pi) - sinh(t)/t); normTPS(out)) < tol + @test (@FastGTPSA!(out = exp(im*t) - cos(t) - im*sin(t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = real(exp(im*t)) - cos(t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = imag(exp(im*t)) - sin(t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = sinh(t) - (exp(t) - exp(-t))/2); normTPS(out)) < tol + @test (@FastGTPSA!(out = cosh(t) - (exp(t) + exp(-t))/2); normTPS(out)) < tol + @test (@FastGTPSA!(out = tanh(t) - sinh(t)/cosh(t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = csch(t) - 1/sinh(t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = sech(t) - 1/cosh(t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = coth(t) - cosh(t)/sinh(t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = coth(t) - 1/tanh(t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = cosh(t)^2 - sinh(t)^2 - 1); normTPS(out)) < tol + @test (@FastGTPSA!(out = 1 - tanh(t)^2 - sech(t)^2); normTPS(out)) < tol + @test (@FastGTPSA!(out = coth(t)^2 - 1 - csch(t)^2); normTPS(out)) < tol + @test (@FastGTPSA!(out = asin(sin(t)) - t); normTPS(out)) < tol + @test (@FastGTPSA!(out = acos(cos(t)) - t); normTPS(out)) < tol + @test (@FastGTPSA!(out = atan(tan(t)) - t); normTPS(out)) < tol + @test (@FastGTPSA!(out = acsc(1/t) - asin(t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = asec(1/t) - acos(t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = acot(1/t) - atan(t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = asinh(sinh(t)) - t); normTPS(out)) < tol + @test (@FastGTPSA!(out = acosh(cosh(t)) - t); normTPS(out)) < tol + @test (@FastGTPSA!(out = atanh(tanh(t)) - t); normTPS(out)) < tol + @test (@FastGTPSA!(out = acsch(t) - asinh(1/t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = asech(t) - acosh(1/t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = acoth(1/t) - atanh(t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = asinc(t/pi) - asin(t)/t); normTPS(out)) < tol + @test (@FastGTPSA!(out = asinhc(t/pi) - asinh(t)/t); normTPS(out)) < tol + @test (@FastGTPSA!(out = erfc(t) - 1 + erf(t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = erf(-t) + erf(t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = angle(t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = complex(t) - t); normTPS(out)) < tol + @test (@FastGTPSA!(out = complex(t,t) - (t+im*t)); normTPS(out)) < tol + + t = ComplexTPS64(t) + t[0] = 0.5+0.5im; t[[1]] = 2+2im; t[[2]] = 3+3im; t[[3]] = 4+4im; t[[4]] = 5+5im; t[[5]] = 6+6im + @test (@FastGTPSA!(out = sin(t)^2+cos(t)^2 - 1); normTPS(out)) < tol + @test (@FastGTPSA!(out = 1/sin(t) - csc(t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = 1/cos(t) - sec(t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = 1/tan(t) - cot(t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = sin(t)/cos(t) - tan(t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = cos(2*t) - cos(t)^2 + sin(t)^2); normTPS(out)) < tol + @test (@FastGTPSA!(out = sec(t)^2 - 1 - tan(t)^2); normTPS(out)) < tol + @test (@FastGTPSA!(out = sin(t/2) - sqrt((1-cos(t))/2)); normTPS(out)) < tol + @test (@FastGTPSA!(out = cos(t/2) - sqrt((1+cos(t))/2)); normTPS(out)) < tol + @test (@FastGTPSA!(out = sqrt(t^2) - t); normTPS(out)) < tol + @test (@FastGTPSA!(out = csc(t)^2 - cot(t)^2 - 1); normTPS(out)) < tol + @test (@FastGTPSA!(out = exp(log(t)) - t); normTPS(out)) < tol + @test (@FastGTPSA!(out = log(exp(t)) - t); normTPS(out)) < tol + @test (@FastGTPSA!(out = log(exp(t)) - exp(log(t))); normTPS(out)) < tol + @test (@FastGTPSA!(out = log(t^2) - 2*log(t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = 5*log(t) - log(t^5) - 2*pi*im); normTPS(out)) < tol + @test (@FastGTPSA!(out = t*log(5) - log(5^t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = sinc(t/pi) - sin(t)/t); normTPS(out)) < tol + @test (@FastGTPSA!(out = sinhc(t/pi) - sinh(t)/t); normTPS(out)) < tol + @test (@FastGTPSA!(out = exp(im*t) - cos(t) - im*sin(t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = sinh(t) - (exp(t) - exp(-t))/2); normTPS(out)) < tol + @test (@FastGTPSA!(out = cosh(t) - (exp(t) + exp(-t))/2); normTPS(out)) < tol + @test (@FastGTPSA!(out = tanh(t) - sinh(t)/cosh(t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = csch(t) - 1/sinh(t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = sech(t) - 1/cosh(t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = coth(t) - cosh(t)/sinh(t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = coth(t) - 1/tanh(t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = cosh(t)^2 - sinh(t)^2 - 1); normTPS(out)) < tol + @test (@FastGTPSA!(out = 1 - tanh(t)^2 - sech(t)^2); normTPS(out)) < tol + @test (@FastGTPSA!(out = coth(t)^2 - 1 - csch(t)^2); normTPS(out)) < tol + @test (@FastGTPSA!(out = asin(sin(t)) - t); normTPS(out)) < tol + @test (@FastGTPSA!(out = acos(cos(t)) - t); normTPS(out)) < tol + @test (@FastGTPSA!(out = atan(tan(t)) - t); normTPS(out)) < tol + @test (@FastGTPSA!(out = acsc(t) - asin(1/t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = asec(t) - acos(1/t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = acot(t) - atan(1/t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = asinh(sinh(t)) - t); normTPS(out)) < tol + @test (@FastGTPSA!(out = acosh(cosh(t)) - t); normTPS(out)) < tol + @test (@FastGTPSA!(out = atanh(tanh(t)) - t); normTPS(out)) < tol + @test (@FastGTPSA!(out = acsch(t) - asinh(1/t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = asech(t) - acosh(1/t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = acoth(t) - atanh(1/t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = asinc(t/pi) - asin(t)/t); normTPS(out)) < tol + @test (@FastGTPSA!(out = asinhc(t/pi) - asinh(t)/t); normTPS(out)) < tol + @test (@FastGTPSA!(out = erfc(t) - 1 + erf(t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = erf(-t) + erf(t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = angle(t) - atan(imag(t),real(t))); normTPS(out)) < tol + @test (@FastGTPSA!(out = complex(t) - t); normTPS(out)) < tol + # Make sure stack is 0: - desc = unsafe_load(GTPSA.getdesc(t).desc) - tmpidx = unsafe_load(desc.ti) - ctmpidx = unsafe_load(desc.cti) - @test ctmpidx == 0 - @test tmpidx == 0 + @test GTPSA.checktemps() end @@ -1162,8 +1510,11 @@ end @test_opt benchmark_GTPSA3() end +# allocations only works on 1.10 +# maybe 1.9 includes the macro call allocations? +if VERSION >= v"1.10" -@testset "@FastGTPSA - Allocations" begin +@testset "FastGTPSA - Allocations" begin d = Descriptor(1, 5) t = TPS(use=d) ct = ComplexTPS64(t) @@ -1186,6 +1537,7 @@ end ct3[0] = 3 + 3im tol = 1e-14 + out = ComplexTPS64() # TPS: @test @allocations(@FastGTPSA(normTPS(t1 + t2 - t3))) == 0 @@ -1260,6 +1612,78 @@ end @test @allocations(@FastGTPSA(normTPS(t2 ^ (3+3im) - 2^(3+3im)))) == 0 @test @allocations(@FastGTPSA(normTPS((3+3im)^t2 - (3+3im)^2))) == 0 + @test @allocations(@FastGTPSA!(out = t1 + t2 - t3)) == 0 + @test @allocations(@FastGTPSA!(out = t2 + t1 - t3)) == 0 + @test @allocations(@FastGTPSA!(out = t1 + 2 - t3)) == 0 + @test @allocations(@FastGTPSA!(out = 2 + t1 - t3)) == 0 + @test @allocations(@FastGTPSA!(out = t3 - t2 - t1)) == 0 + @test @allocations(@FastGTPSA!(out = t2 - t3 - -t1)) == 0 + @test @allocations(@FastGTPSA!(out = t3 - 2 - t1)) == 0 + @test @allocations(@FastGTPSA!(out = 2 - t3 - -t1)) == 0 + @test @allocations(@FastGTPSA!(out = t2 * t3 - 6)) == 0 + @test @allocations(@FastGTPSA!(out = t3 * t2 - 6)) == 0 + @test @allocations(@FastGTPSA!(out = t2 * 5 - 10)) == 0 + @test @allocations(@FastGTPSA!(out = 5 * t2 - 10 * t1)) == 0 + @test @allocations(@FastGTPSA!(out = t1 / t2 - 1/2)) == 0 + @test @allocations(@FastGTPSA!(out = t2 / t1 - 2)) == 0 + @test @allocations(@FastGTPSA!(out = 1 / t2 - 1/2)) == 0 + @test @allocations(@FastGTPSA!(out = t2 / 3 - 2/3)) == 0 + @test @allocations(@FastGTPSA!(out = t2 / t2 - t1)) == 0 + @test @allocations(@FastGTPSA!(out = t2 / t2 - 1)) == 0 + @test @allocations(@FastGTPSA!(out = t2 ^ t3 - 8)) == 0 + @test @allocations(@FastGTPSA!(out = t3 ^ t2 - 9)) == 0 + @test @allocations(@FastGTPSA!(out = t2 ^ 3 - 8)) == 0 + @test @allocations(@FastGTPSA!(out = t2 ^ (1/2) - sqrt(2))) == 0 + @test @allocations(@FastGTPSA!(out = t2 ^ (1/2) - sqrt(t2))) == 0 + @test @allocations(@FastGTPSA!(out = 2 ^ t3 - 8)) == 0 + @test @allocations(@FastGTPSA!(out = inv(t3) - 1/t3)) == 0 + @test @allocations(@FastGTPSA!(out = inv(t3) - 1/3)) == 0 + @test @allocations(@FastGTPSA!(out = ct1 + ct2 - ct3)) == 0 + @test @allocations(@FastGTPSA!(out = ct2 + ct1 - ct3)) == 0 + @test @allocations(@FastGTPSA!(out = ct1 + (2+2im) - ct3)) == 0 + @test @allocations(@FastGTPSA!(out = (2+2im) + ct1 - ct3)) == 0 + @test @allocations(@FastGTPSA!(out = ct3 - ct2 - ct1)) == 0 + @test @allocations(@FastGTPSA!(out = ct2 - ct3 - -ct1)) == 0 + @test @allocations(@FastGTPSA!(out = ct3 - (2+2im) - ct1)) == 0 + @test @allocations(@FastGTPSA!(out = (2+2im) - ct3 - -ct1)) == 0 + @test @allocations(@FastGTPSA!(out = ct2 * ct3 - (2+2im)*(3+3im))) == 0 + @test @allocations(@FastGTPSA!(out = ct3 * ct2 - (2+2im)*(3+3im))) == 0 + @test @allocations(@FastGTPSA!(out = ct2 * 5 - (10+10im))) == 0 + @test @allocations(@FastGTPSA!(out = 5 * ct2 - (10 * ct1))) == 0 + @test @allocations(@FastGTPSA!(out = ct1 / ct2 - (1+im)/(2+2im))) == 0 + @test @allocations(@FastGTPSA!(out = ct2 / ct1 - 2)) == 0 + @test @allocations(@FastGTPSA!(out = 1 / ct2 - 1/(2+2im))) == 0 + @test @allocations(@FastGTPSA!(out = ct2 / 3 - (2+2im)/3)) == 0 + @test @allocations(@FastGTPSA!(out = ct2 / ct2 - 1)) == 0 + @test @allocations(@FastGTPSA!(out = ct2 ^ ct3 - (2+2im)^(3+3im))) == 0 + @test @allocations(@FastGTPSA!(out = ct3 ^ ct2 - (3+3im)^(2+2im))) == 0 + @test @allocations(@FastGTPSA!(out = ct2 ^ 3 - (2+2im)^3)) == 0 + @test @allocations(@FastGTPSA!(out = ct2 ^ (1/2) - sqrt(2+2im))) == 0 + @test @allocations(@FastGTPSA!(out = ct2 ^ (1/2) - sqrt(ct2))) == 0 + @test @allocations(@FastGTPSA!(out = 2 ^ ct3 - 2^(3+3im))) == 0 + @test @allocations(@FastGTPSA!(out = inv(ct3) - 1/ct3)) == 0 + @test @allocations(@FastGTPSA!(out = inv(ct3) - 1/(3+3im))) == 0 + @test @allocations(@FastGTPSA!(out = t1 + ct2 - (1 + (2+2im)))) == 0 + @test @allocations(@FastGTPSA!(out = ct2 + t1 - (1 + (2+2im)))) == 0 + @test @allocations(@FastGTPSA!(out = t1 + (2+2im) - (1 + (2+2im)))) == 0 + @test @allocations(@FastGTPSA!(out = (2+2im) + t1 - (1 + (2+2im)))) == 0 + @test @allocations(@FastGTPSA!(out = t3 - ct2 - (3 - (2+2im)))) == 0 + @test @allocations(@FastGTPSA!(out = ct2 - t3 - ((2+2im) - 3))) == 0 + @test @allocations(@FastGTPSA!(out = t3 - (2+2im) - (3 - (2+2im)))) == 0 + @test @allocations(@FastGTPSA!(out = (2+2im) - t3 - ((2+2im) - 3))) == 0 + @test @allocations(@FastGTPSA!(out = t2 * ct3 - 2 * (3+3im))) == 0 + @test @allocations(@FastGTPSA!(out = ct3 * t2 - 2 * (3+3im))) == 0 + @test @allocations(@FastGTPSA!(out = t2 * (3+3im) - 2 * (3+3im))) == 0 + @test @allocations(@FastGTPSA!(out = (3+3im) * t2 - 2 * (3+3im))) == 0 + @test @allocations(@FastGTPSA!(out = t2 / ct3 - 2/(3+3im))) == 0 + @test @allocations(@FastGTPSA!(out = ct3 / t2 - (3+3im)/2)) == 0 + @test @allocations(@FastGTPSA!(out = t2 / (3+3im) - 2/(3+3im))) == 0 + @test @allocations(@FastGTPSA!(out = (3+3im) / t2 - (3+3im)/2)) == 0 + @test @allocations(@FastGTPSA!(out = t2 ^ ct3 - 2^(3+3im))) == 0 + @test @allocations(@FastGTPSA!(out = ct3 ^ t2 - (3+3im)^2)) == 0 + @test @allocations(@FastGTPSA!(out = t2 ^ (3+3im) - 2^(3+3im))) == 0 + @test @allocations(@FastGTPSA!(out = (3+3im)^t2 - (3+3im)^2)) == 0 + d = Descriptor(1, 5) t = TPS(use=d) v = 0.5 @@ -1333,6 +1757,68 @@ end @test @allocations(@FastGTPSA(normTPS(polar(-t1) - (abs(-1)+im*atan(0,-1))))) == 0 @test @allocations(@FastGTPSA(normTPS(rect(t2) - (2*cos(0) + im*2*sin(0))))) == 0 @test @allocations(@FastGTPSA(normTPS(rect(-t1) - (-1*cos(0) + im*-1*sin(0))))) == 0 + + + @test @allocations(@FastGTPSA!(out = abs(-t) - abs(-v) )) == 0 + @test @allocations(@FastGTPSA!(out = sqrt(t) - sqrt(v))) == 0 + @test @allocations(@FastGTPSA!(out = exp(t) - exp(v))) == 0 + @test @allocations(@FastGTPSA!(out = log(t) - log(v))) == 0 + @test @allocations(@FastGTPSA!(out = sin(t) - sin(v))) == 0 + @test @allocations(@FastGTPSA!(out = cos(t) - cos(v))) == 0 + @test @allocations(@FastGTPSA!(out = tan(t) - tan(v))) == 0 + @test @allocations(@FastGTPSA!(out = csc(t) - csc(v))) == 0 + @test @allocations(@FastGTPSA!(out = sec(t) - sec(v))) == 0 + @test @allocations(@FastGTPSA!(out = cot(t) - cot(v))) == 0 + @test @allocations(@FastGTPSA!(out = sinc(t) - sinc(v))) == 0 + @test @allocations(@FastGTPSA!(out = sinh(t) - sinh(v))) == 0 + @test @allocations(@FastGTPSA!(out = cosh(t) - cosh(v))) == 0 + @test @allocations(@FastGTPSA!(out = tanh(t) - tanh(v))) == 0 + @test @allocations(@FastGTPSA!(out = csch(t) - csch(v))) == 0 + @test @allocations(@FastGTPSA!(out = sech(t) - sech(v))) == 0 + @test @allocations(@FastGTPSA!(out = coth(t) - coth(v))) == 0 + @test @allocations(@FastGTPSA!(out = asin(t) - asin(v))) == 0 + @test @allocations(@FastGTPSA!(out = acos(t) - acos(v))) == 0 + @test @allocations(@FastGTPSA!(out = atan(t) - atan(v))) == 0 + @test @allocations(@FastGTPSA!(out = acsc(1/t) - acsc(1/v))) == 0 + @test @allocations(@FastGTPSA!(out = asec(1/t) - asec(1/v))) == 0 + @test @allocations(@FastGTPSA!(out = acot(1/t) - acot(1/v))) == 0 + @test @allocations(@FastGTPSA!(out = asinh(t) - asinh(v))) == 0 + @test @allocations(@FastGTPSA!(out = acosh(1/t) - acosh(1/v))) == 0 + @test @allocations(@FastGTPSA!(out = atanh(t) - atanh(v))) == 0 + @test @allocations(@FastGTPSA!(out = acsch(1/t) - acsch(1/v))) == 0 + @test @allocations(@FastGTPSA!(out = asech(t) - asech(v))) == 0 + @test @allocations(@FastGTPSA!(out = acoth(1/t) - acoth(1/v))) == 0 + @test @allocations(@FastGTPSA!(out = asinc(t/pi) - asin(v)/(v))) == 0 + @test @allocations(@FastGTPSA!(out = asinhc(t/pi) - asinh(v)/(v))) == 0 + @test @allocations(@FastGTPSA!(out = zero(t) - zero(v))) == 0 + @test @allocations(@FastGTPSA!(out = one(t) + one(t) - zero(t))) == 0 + @test @allocations(@FastGTPSA!(out = real(t) - real(v))) == 0 + @test @allocations(@FastGTPSA!(out = imag(t) - imag(v))) == 0 + @test @allocations(@FastGTPSA!(out = conj(t) - conj(v))) == 0 + @test @allocations(@FastGTPSA!(out = sinhc(t/pi) - sinh(v)/v)) == 0 + @test @allocations(@FastGTPSA!(out = erf(t) - erf(v))) == 0 + @test @allocations(@FastGTPSA!(out = erfc(t) - erfc(v))) == 0 + @test @allocations(@FastGTPSA!(out = -im*erf(t*im) - erfi(v))) == 0 + @test @allocations(@FastGTPSA!(out = atan(t3,t2) - atan(3,2))) == 0 + @test @allocations(@FastGTPSA!(out = atan(t3,2) - atan(3,2))) == 0 + @test @allocations(@FastGTPSA!(out = atan(3,t2) - atan(3,2))) == 0 + @test @allocations(@FastGTPSA!(out = atan(t3,-t2) - atan(3,-2))) == 0 + @test @allocations(@FastGTPSA!(out = atan(t3,-2) - atan(3,-2))) == 0 + @test @allocations(@FastGTPSA!(out = atan(3,-t2) - atan(3,-2))) == 0 + @test @allocations(@FastGTPSA!(out = atan(-t3,-t2) - atan(-3,-2))) == 0 + @test @allocations(@FastGTPSA!(out = atan(-t3,-2) - atan(-3,-2))) == 0 + @test @allocations(@FastGTPSA!(out = atan(-3,-t2) - atan(-3,-2))) == 0 + @test @allocations(@FastGTPSA!(out = atan(-t3,t2) - atan(-3,2))) == 0 + @test @allocations(@FastGTPSA!(out = atan(-t3,2) - atan(-3,2))) == 0 + @test @allocations(@FastGTPSA!(out = atan(-3,t2) - atan(-3,2))) == 0 + @test @allocations(@FastGTPSA!(out = angle(t2) - angle(2))) == 0 + @test @allocations(@FastGTPSA!(out = angle(-t2) - angle(-2))) == 0 + @test @allocations(@FastGTPSA!(out = complex(t3) - complex(3))) == 0 + @test @allocations(@FastGTPSA!(out = complex(t2,t3) - complex(2,3))) == 0 + @test @allocations(@FastGTPSA!(out = polar(t2) - (abs(2)+im*atan(0,2)))) == 0 + @test @allocations(@FastGTPSA!(out = polar(-t1) - (abs(-1)+im*atan(0,-1)))) == 0 + @test @allocations(@FastGTPSA!(out = rect(t2) - (2*cos(0) + im*2*sin(0)))) == 0 + @test @allocations(@FastGTPSA!(out = rect(-t1) - (-1*cos(0) + im*-1*sin(0)))) == 0 v = 0.5+0.5im @@ -1395,6 +1881,57 @@ end @test @allocations(@FastGTPSA(normTPS(rect(ct2) - (2*cos(2) + im*2*sin(2))))) == 0 @test @allocations(@FastGTPSA(normTPS(rect(-ct1) - (-1*cos(-1) + im*-1*sin(-1))))) == 0 + @test @allocations(@FastGTPSA!(out = abs(-t) - abs(-v) )) == 0 + @test @allocations(@FastGTPSA!(out = sqrt(t) - sqrt(v))) == 0 + @test @allocations(@FastGTPSA!(out = exp(t) - exp(v))) == 0 + @test @allocations(@FastGTPSA!(out = log(t) - log(v))) == 0 + @test @allocations(@FastGTPSA!(out = sin(t) - sin(v))) == 0 + @test @allocations(@FastGTPSA!(out = cos(t) - cos(v))) == 0 + @test @allocations(@FastGTPSA!(out = tan(t) - tan(v))) == 0 + @test @allocations(@FastGTPSA!(out = csc(t) - csc(v))) == 0 + @test @allocations(@FastGTPSA!(out = sec(t) - sec(v))) == 0 + @test @allocations(@FastGTPSA!(out = cot(t) - cot(v))) == 0 + @test @allocations(@FastGTPSA!(out = sinc(t) - sinc(v))) == 0 + @test @allocations(@FastGTPSA!(out = sinh(t) - sinh(v))) == 0 + @test @allocations(@FastGTPSA!(out = cosh(t) - cosh(v))) == 0 + @test @allocations(@FastGTPSA!(out = tanh(t) - tanh(v))) == 0 + @test @allocations(@FastGTPSA!(out = csch(t) - csch(v))) == 0 + @test @allocations(@FastGTPSA!(out = sech(t) - sech(v))) == 0 + @test @allocations(@FastGTPSA!(out = coth(t) - coth(v))) == 0 + @test @allocations(@FastGTPSA!(out = asin(t) - asin(v))) == 0 + @test @allocations(@FastGTPSA!(out = acos(t) - acos(v))) == 0 + @test @allocations(@FastGTPSA!(out = atan(t) - atan(v))) == 0 + @test @allocations(@FastGTPSA!(out = acsc(t) - acsc(v))) == 0 + @test @allocations(@FastGTPSA!(out = asec(t) - asec(v))) == 0 + @test @allocations(@FastGTPSA!(out = acot(t) - acot(v))) == 0 + @test @allocations(@FastGTPSA!(out = asinh(t) - asinh(v))) == 0 + @test @allocations(@FastGTPSA!(out = acosh(t) - acosh(v))) == 0 + @test @allocations(@FastGTPSA!(out = atanh(t) - atanh(v))) == 0 + @test @allocations(@FastGTPSA!(out = acsch(t) - acsch(v))) == 0 + @test @allocations(@FastGTPSA!(out = asech(t) - asech(v))) == 0 + @test @allocations(@FastGTPSA!(out = acoth(t) - acoth(v))) == 0 + @test @allocations(@FastGTPSA!(out = asinc(t/pi) - asin(v)/v)) == 0 + @test @allocations(@FastGTPSA!(out = asinhc(t/pi) - asinh(v)/v)) == 0 + @test @allocations(@FastGTPSA!(out = zero(t) - zero(v))) == 0 + @test @allocations(@FastGTPSA!(out = real(t) - real(v))) == 0 + @test @allocations(@FastGTPSA!(out = imag(t) - imag(v))) == 0 + @test @allocations(@FastGTPSA!(out = conj(t) - conj(v))) == 0 + @test @allocations(@FastGTPSA!(out = sinhc(t/pi) - sinh(v)/v)) == 0 + @test @allocations(@FastGTPSA!(out = erf(t) - erf(v))) == 0 + @test @allocations(@FastGTPSA!(out = erfc(t) - erfc(v))) == 0 + @test @allocations(@FastGTPSA!(out = -im*erf(t*im) - erfi(v))) == 0 + @test @allocations(@FastGTPSA!(out = angle(t2+im*t3) - angle(2+3im))) == 0 + @test @allocations(@FastGTPSA!(out = angle(t2-im*t3) - angle(2-3im))) == 0 + @test @allocations(@FastGTPSA!(out = angle(-t2-im*t3) - angle(-2-3im))) == 0 + @test @allocations(@FastGTPSA!(out = angle(-t2+im*t3) - angle(-2+3im))) == 0 + @test @allocations(@FastGTPSA!(out = angle(ct2) - angle(2+2im))) == 0 + @test @allocations(@FastGTPSA!(out = angle(-ct2) - angle(-2-2im))) == 0 + @test @allocations(@FastGTPSA!(out = complex(ct3) - complex(3+3im))) == 0 + @test @allocations(@FastGTPSA!(out = polar(ct2) - (abs(2+2im)+im*angle(2+2im)))) == 0 + @test @allocations(@FastGTPSA!(out = polar(-ct1) - (abs(-1-im)+im*angle(-1-im)))) == 0 + @test @allocations(@FastGTPSA!(out = rect(ct2) - (2*cos(2) + im*2*sin(2)))) == 0 + @test @allocations(@FastGTPSA!(out = rect(-ct1) - (-1*cos(-1) + im*-1*sin(-1)))) == 0 + d = Descriptor(1, 5) t = TPS(use=d) t[0] = 0.5; t[[1]] = 2; t[[2]] = 3; t[[3]] = 4; t[[4]] = 5; t[[5]] = 6 @@ -1453,6 +1990,58 @@ end @test @allocations(@FastGTPSA(normTPS(complex(t) - t))) == 0 @test @allocations(@FastGTPSA(normTPS(complex(t,t) - (t+im*t)))) == 0 + @test @allocations(@FastGTPSA!(out = sin(t)^2+cos(t)^2 - 1)) == 0 + @test @allocations(@FastGTPSA!(out = 1/sin(t) - csc(t))) == 0 + @test @allocations(@FastGTPSA!(out = 1/cos(t) - sec(t))) == 0 + @test @allocations(@FastGTPSA!(out = 1/tan(t) - cot(t))) == 0 + @test @allocations(@FastGTPSA!(out = sin(t)/cos(t) - tan(t))) == 0 + @test @allocations(@FastGTPSA!(out = cos(2*t) - cos(t)^2 + sin(t)^2)) == 0 + @test @allocations(@FastGTPSA!(out = sec(t)^2 - 1 - tan(t)^2)) == 0 + @test @allocations(@FastGTPSA!(out = sin(t/2) - sqrt((1-cos(t))/2))) == 0 + @test @allocations(@FastGTPSA!(out = cos(t/2) - sqrt((1+cos(t))/2))) == 0 + @test @allocations(@FastGTPSA!(out = sqrt(t^2) - abs(t))) == 0 + @test @allocations(@FastGTPSA!(out = csc(t)^2 - cot(t)^2 - 1)) == 0 + @test @allocations(@FastGTPSA!(out = exp(log(t)) - t)) == 0 + @test @allocations(@FastGTPSA!(out = log(exp(t)) - t)) == 0 + @test @allocations(@FastGTPSA!(out = log(exp(t)) - exp(log(t)))) == 0 + @test @allocations(@FastGTPSA!(out = log(t^2) - 2*log(t))) == 0 + @test @allocations(@FastGTPSA!(out = 5*log(t) - log(t^5))) == 0 + @test @allocations(@FastGTPSA!(out = t*log(5) - log(5^t))) == 0 + @test @allocations(@FastGTPSA!(out = sinc(t) - sin(pi*t)/(pi*t))) == 0 + @test @allocations(@FastGTPSA!(out = sinhc(t/pi) - sinh(t)/t)) == 0 + @test @allocations(@FastGTPSA!(out = exp(im*t) - cos(t) - im*sin(t))) == 0 + @test @allocations(@FastGTPSA!(out = real(exp(im*t)) - cos(t))) == 0 + @test @allocations(@FastGTPSA!(out = imag(exp(im*t)) - sin(t))) == 0 + @test @allocations(@FastGTPSA!(out = sinh(t) - (exp(t) - exp(-t))/2)) == 0 + @test @allocations(@FastGTPSA!(out = cosh(t) - (exp(t) + exp(-t))/2)) == 0 + @test @allocations(@FastGTPSA!(out = tanh(t) - sinh(t)/cosh(t))) == 0 + @test @allocations(@FastGTPSA!(out = csch(t) - 1/sinh(t))) == 0 + @test @allocations(@FastGTPSA!(out = sech(t) - 1/cosh(t))) == 0 + @test @allocations(@FastGTPSA!(out = coth(t) - cosh(t)/sinh(t))) == 0 + @test @allocations(@FastGTPSA!(out = coth(t) - 1/tanh(t))) == 0 + @test @allocations(@FastGTPSA!(out = cosh(t)^2 - sinh(t)^2 - 1)) == 0 + @test @allocations(@FastGTPSA!(out = 1 - tanh(t)^2 - sech(t)^2)) == 0 + @test @allocations(@FastGTPSA!(out = coth(t)^2 - 1 - csch(t)^2)) == 0 + @test @allocations(@FastGTPSA!(out = asin(sin(t)) - t)) == 0 + @test @allocations(@FastGTPSA!(out = acos(cos(t)) - t)) == 0 + @test @allocations(@FastGTPSA!(out = atan(tan(t)) - t)) == 0 + @test @allocations(@FastGTPSA!(out = acsc(1/t) - asin(t))) == 0 + @test @allocations(@FastGTPSA!(out = asec(1/t) - acos(t))) == 0 + @test @allocations(@FastGTPSA!(out = acot(1/t) - atan(t))) == 0 + @test @allocations(@FastGTPSA!(out = asinh(sinh(t)) - t)) == 0 + @test @allocations(@FastGTPSA!(out = acosh(cosh(t)) - t)) == 0 + @test @allocations(@FastGTPSA!(out = atanh(tanh(t)) - t)) == 0 + @test @allocations(@FastGTPSA!(out = acsch(t) - asinh(1/t))) == 0 + @test @allocations(@FastGTPSA!(out = asech(t) - acosh(1/t))) == 0 + @test @allocations(@FastGTPSA!(out = acoth(1/t) - atanh(t))) == 0 + @test @allocations(@FastGTPSA!(out = asinc(t/pi) - asin(t)/t)) == 0 + @test @allocations(@FastGTPSA!(out = asinhc(t/pi) - asinh(t)/t)) == 0 + @test @allocations(@FastGTPSA!(out = erfc(t) - 1 + erf(t))) == 0 + @test @allocations(@FastGTPSA!(out = erf(-t) + erf(t))) == 0 + @test @allocations(@FastGTPSA!(out = angle(t))) == 0 + @test @allocations(@FastGTPSA!(out = complex(t) - t)) == 0 + @test @allocations(@FastGTPSA!(out = complex(t,t) - (t+im*t))) == 0 + t = ComplexTPS64(t) t[0] = 0.5+0.5im; t[[1]] = 2+2im; t[[2]] = 3+3im; t[[3]] = 4+4im; t[[4]] = 5+5im; t[[5]] = 6+6im @test @allocations(@FastGTPSA(normTPS(sin(t)^2+cos(t)^2 - 1))) == 0 @@ -1503,6 +2092,4113 @@ end @test @allocations(@FastGTPSA(normTPS(erf(-t) + erf(t)))) == 0 @test @allocations(@FastGTPSA(normTPS(angle(t) - atan(imag(t),real(t))))) == 0 @test @allocations(@FastGTPSA(normTPS(complex(t) - t))) == 0 + + @test @allocations(@FastGTPSA!(out = sin(t)^2+cos(t)^2 - 1)) == 0 + @test @allocations(@FastGTPSA!(out = 1/sin(t) - csc(t))) == 0 + @test @allocations(@FastGTPSA!(out = 1/cos(t) - sec(t))) == 0 + @test @allocations(@FastGTPSA!(out = 1/tan(t) - cot(t))) == 0 + @test @allocations(@FastGTPSA!(out = sin(t)/cos(t) - tan(t))) == 0 + @test @allocations(@FastGTPSA!(out = cos(2*t) - cos(t)^2 + sin(t)^2)) == 0 + @test @allocations(@FastGTPSA!(out = sec(t)^2 - 1 - tan(t)^2)) == 0 + @test @allocations(@FastGTPSA!(out = sin(t/2) - sqrt((1-cos(t))/2))) == 0 + @test @allocations(@FastGTPSA!(out = cos(t/2) - sqrt((1+cos(t))/2))) == 0 + @test @allocations(@FastGTPSA!(out = sqrt(t^2) - t)) == 0 + @test @allocations(@FastGTPSA!(out = csc(t)^2 - cot(t)^2 - 1)) == 0 + @test @allocations(@FastGTPSA!(out = exp(log(t)) - t)) == 0 + @test @allocations(@FastGTPSA!(out = log(exp(t)) - t)) == 0 + @test @allocations(@FastGTPSA!(out = log(exp(t)) - exp(log(t)))) == 0 + @test @allocations(@FastGTPSA!(out = log(t^2) - 2*log(t))) == 0 + @test @allocations(@FastGTPSA!(out = 5*log(t) - log(t^5) - 2*pi*im)) == 0 + @test @allocations(@FastGTPSA!(out = t*log(5) - log(5^t))) == 0 + @test @allocations(@FastGTPSA!(out = sinc(t/pi) - sin(t)/t)) == 0 + @test @allocations(@FastGTPSA!(out = sinhc(t/pi) - sinh(t)/t)) == 0 + @test @allocations(@FastGTPSA!(out = exp(im*t) - cos(t) - im*sin(t))) == 0 + @test @allocations(@FastGTPSA!(out = sinh(t) - (exp(t) - exp(-t))/2)) == 0 + @test @allocations(@FastGTPSA!(out = cosh(t) - (exp(t) + exp(-t))/2)) == 0 + @test @allocations(@FastGTPSA!(out = tanh(t) - sinh(t)/cosh(t))) == 0 + @test @allocations(@FastGTPSA!(out = csch(t) - 1/sinh(t))) == 0 + @test @allocations(@FastGTPSA!(out = sech(t) - 1/cosh(t))) == 0 + @test @allocations(@FastGTPSA!(out = coth(t) - cosh(t)/sinh(t))) == 0 + @test @allocations(@FastGTPSA!(out = coth(t) - 1/tanh(t))) == 0 + @test @allocations(@FastGTPSA!(out = cosh(t)^2 - sinh(t)^2 - 1)) == 0 + @test @allocations(@FastGTPSA!(out = 1 - tanh(t)^2 - sech(t)^2)) == 0 + @test @allocations(@FastGTPSA!(out = coth(t)^2 - 1 - csch(t)^2)) == 0 + @test @allocations(@FastGTPSA!(out = asin(sin(t)) - t)) == 0 + @test @allocations(@FastGTPSA!(out = acos(cos(t)) - t)) == 0 + @test @allocations(@FastGTPSA!(out = atan(tan(t)) - t)) == 0 + @test @allocations(@FastGTPSA!(out = acsc(t) - asin(1/t))) == 0 + @test @allocations(@FastGTPSA!(out = asec(t) - acos(1/t))) == 0 + @test @allocations(@FastGTPSA!(out = acot(t) - atan(1/t))) == 0 + @test @allocations(@FastGTPSA!(out = asinh(sinh(t)) - t)) == 0 + @test @allocations(@FastGTPSA!(out = acosh(cosh(t)) - t)) == 0 + @test @allocations(@FastGTPSA!(out = atanh(tanh(t)) - t)) == 0 + @test @allocations(@FastGTPSA!(out = acsch(t) - asinh(1/t))) == 0 + @test @allocations(@FastGTPSA!(out = asech(t) - acosh(1/t))) == 0 + @test @allocations(@FastGTPSA!(out = acoth(t) - atanh(1/t))) == 0 + @test @allocations(@FastGTPSA!(out = asinc(t/pi) - asin(t)/t)) == 0 + @test @allocations(@FastGTPSA!(out = asinhc(t/pi) - asinh(t)/t)) == 0 + @test @allocations(@FastGTPSA!(out = erfc(t) - 1 + erf(t))) == 0 + @test @allocations(@FastGTPSA!(out = erf(-t) + erf(t))) == 0 + @test @allocations(@FastGTPSA!(out = angle(t) - atan(imag(t),real(t)))) == 0 + @test @allocations(@FastGTPSA!(out = complex(t) - t)) == 0 + + @test GTPSA.checktemps() +end +end + +@testset "FastGTPSA - Broadcasting" begin + d = Descriptor(1, 5) + t = TPS(use=d) + ct = ComplexTPS64(t) + # Set scalar part so both TPSs are 1 + t[0] = 1 + ct[0] = 1 + # Now do operators + t1 = t + t1[0] = 1 + t2 = zero(t1) + t2[0] = 2 + t3 = zero(t1) + t3[0] = 3 + + ct1 = ct + ct1[0] = 1 + 1im + ct2 = zero(ct1) + ct2[0] = 2 + 2im + ct3 = zero(ct1) + ct3[0] = 3 + 3im + + tol = 1e-14 + + out = ComplexTPS64() + + # TPS: + @test @FastGTPSA(@.(normTPS(t1 + t2 - t3))) < tol + @test @FastGTPSA(@.(normTPS(t2 + t1 - t3))) < tol + @test @FastGTPSA(@.(normTPS(t1 + 2 - t3))) < tol + @test @FastGTPSA(@.(normTPS(2 + t1 - t3))) < tol + @test @FastGTPSA(@.(normTPS(t3 - t2 - t1))) < tol + @test @FastGTPSA(@.(normTPS(t2 - t3 - -t1))) < tol + @test @FastGTPSA(@.(normTPS(t3 - 2 - t1))) < tol + @test @FastGTPSA(@.(normTPS(2 - t3 - -t1))) < tol + @test @FastGTPSA(@.(normTPS(t2 * t3 - 6))) < tol + @test @FastGTPSA(@.(normTPS(t3 * t2 - 6))) < tol + @test @FastGTPSA(@.(normTPS(t2 * 5 - 10))) < tol + @test @FastGTPSA(@.(normTPS(5 * t2 - 10 * t1))) < tol + @test @FastGTPSA(@.(normTPS(t1 / t2 - 1/2))) < tol + @test @FastGTPSA(@.(normTPS(t2 / t1 - 2))) < tol + @test @FastGTPSA(@.(normTPS(1 / t2 - 1/2))) < tol + @test @FastGTPSA(@.(normTPS(t2 / 3 - 2/3))) < tol + @test @FastGTPSA(@.(normTPS(t2 / t2 - t1))) < tol + @test @FastGTPSA(@.(normTPS(t2 / t2 - 1))) < tol + @test @FastGTPSA(@.(normTPS(t2 ^ t3 - 8))) < tol + @test @FastGTPSA(@.(normTPS(t3 ^ t2 - 9))) < tol + @test @FastGTPSA(@.(normTPS(t2 ^ 3 - 8))) < tol + @test @FastGTPSA(@.(normTPS(t2 ^ (1/2) - sqrt(2)))) < tol + @test @FastGTPSA(@.(normTPS(t2 ^ (1/2) - sqrt(t2)))) < tol + @test @FastGTPSA(@.(normTPS(2 ^ t3 - 8))) < tol + @test @FastGTPSA(@.(normTPS(inv(t3) - 1/t3))) < tol + @test @FastGTPSA(@.(normTPS(inv(t3) - 1/3))) < tol + + # ComplexTPS: + @test @FastGTPSA(@.(normTPS(ct1 + ct2 - ct3))) < tol + @test @FastGTPSA(@.(normTPS(ct2 + ct1 - ct3))) < tol + @test @FastGTPSA(@.(normTPS(ct1 + (2+2im) - ct3))) < tol + @test @FastGTPSA(@.(normTPS((2+2im) + ct1 - ct3))) < tol + @test @FastGTPSA(@.(normTPS(ct3 - ct2 - ct1))) < tol + @test @FastGTPSA(@.(normTPS(ct2 - ct3 - -ct1))) < tol + @test @FastGTPSA(@.(normTPS(ct3 - (2+2im) - ct1))) < tol + @test @FastGTPSA(@.(normTPS((2+2im) - ct3 - -ct1))) < tol + @test @FastGTPSA(@.(normTPS(ct2 * ct3 - (2+2im)*(3+3im)))) < tol + @test @FastGTPSA(@.(normTPS(ct3 * ct2 - (2+2im)*(3+3im)))) < tol + @test @FastGTPSA(@.(normTPS(ct2 * 5 - (10+10im)))) < tol + @test @FastGTPSA(@.(normTPS(5 * ct2 - (10 * ct1)))) < tol + @test @FastGTPSA(@.(normTPS(ct1 / ct2 - (1+im)/(2+2im)))) < tol + @test @FastGTPSA(@.(normTPS(ct2 / ct1 - 2))) < tol + @test @FastGTPSA(@.(normTPS(1 / ct2 - 1/(2+2im)))) < tol + @test @FastGTPSA(@.(normTPS(ct2 / 3 - (2+2im)/3))) < tol + @test @FastGTPSA(@.(normTPS(ct2 / ct2 - 1))) < tol + @test @FastGTPSA(@.(normTPS(ct2 ^ ct3 - (2+2im)^(3+3im)))) < tol + @test @FastGTPSA(@.(normTPS(ct3 ^ ct2 - (3+3im)^(2+2im)))) < tol + @test @FastGTPSA(@.(normTPS(ct2 ^ 3 - (2+2im)^3))) < tol + @test @FastGTPSA(@.(normTPS(ct2 ^ (1/2) - sqrt(2+2im)))) < tol + @test @FastGTPSA(@.(normTPS(ct2 ^ (1/2) - sqrt(ct2)))) < tol + @test @FastGTPSA(@.(normTPS(2 ^ ct3 - 2^(3+3im)))) < tol + @test @FastGTPSA(@.(normTPS(inv(ct3) - 1/ct3))) < tol + @test @FastGTPSA(@.(normTPS(inv(ct3) - 1/(3+3im)))) < tol + + # Promotion of TPS to ComplexTPS + @test @FastGTPSA(@.(normTPS(t1 + ct2 - (1 + (2+2im))))) < tol + @test @FastGTPSA(@.(normTPS(ct2 + t1 - (1 + (2+2im))))) < tol + @test @FastGTPSA(@.(normTPS(t1 + (2+2im) - (1 + (2+2im))))) < tol + @test @FastGTPSA(@.(normTPS((2+2im) + t1 - (1 + (2+2im))))) < tol + @test @FastGTPSA(@.(normTPS(t3 - ct2 - (3 - (2+2im))))) < tol + @test @FastGTPSA(@.(normTPS(ct2 - t3 - ((2+2im) - 3)))) < tol + @test @FastGTPSA(@.(normTPS(t3 - (2+2im) - (3 - (2+2im))))) < tol + @test @FastGTPSA(@.(normTPS((2+2im) - t3 - ((2+2im) - 3)))) < tol + @test @FastGTPSA(@.(normTPS(t2 * ct3 - 2 * (3+3im)))) < tol + @test @FastGTPSA(@.(normTPS(ct3 * t2 - 2 * (3+3im)))) < tol + @test @FastGTPSA(@.(normTPS(t2 * (3+3im) - 2 * (3+3im)))) < tol + @test @FastGTPSA(@.(normTPS((3+3im) * t2 - 2 * (3+3im)))) < tol + @test @FastGTPSA(@.(normTPS(t2 / ct3 - 2/(3+3im)))) < tol + @test @FastGTPSA(@.(normTPS(ct3 / t2 - (3+3im)/2))) < tol + @test @FastGTPSA(@.(normTPS(t2 / (3+3im) - 2/(3+3im)))) < tol + @test @FastGTPSA(@.(normTPS((3+3im) / t2 - (3+3im)/2))) < tol + @test @FastGTPSA(@.(normTPS(t2 ^ ct3 - 2^(3+3im)))) < tol + @test @FastGTPSA(@.(normTPS(ct3 ^ t2 - (3+3im)^2))) < tol + @test @FastGTPSA(@.(normTPS(t2 ^ (3+3im) - 2^(3+3im)))) < tol + @test @FastGTPSA(@.(normTPS((3+3im)^t2 - (3+3im)^2))) < tol + + + @test (@FastGTPSA!(out = @. t1 + t2 - t3); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. t2 + t1 - t3); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. t1 + 2 - t3); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. 2 + t1 - t3); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. t3 - t2 - t1); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. t2 - t3 - -t1); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. t3 - 2 - t1); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. 2 - t3 - -t1); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. t2 * t3 - 6); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. t3 * t2 - 6); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. t2 * 5 - 10); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. 5 * t2 - 10 * t1); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. t1 / t2 - 1/2); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. t2 / t1 - 2); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. 1 / t2 - 1/2); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. t2 / 3 - 2/3); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. t2 / t2 - t1); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. t2 / t2 - 1); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. t2 ^ t3 - 8); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. t3 ^ t2 - 9); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. t2 ^ 3 - 8); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. t2 ^ (1/2) - sqrt(2)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. t2 ^ (1/2) - sqrt(t2)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. 2 ^ t3 - 8); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. inv(t3) - 1/t3); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. inv(t3) - 1/3); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. ct1 + ct2 - ct3); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. ct2 + ct1 - ct3); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. ct1 + (2+2im) - ct3); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. (2+2im) + ct1 - ct3); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. ct3 - ct2 - ct1); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. ct2 - ct3 - -ct1); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. ct3 - (2+2im) - ct1); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. (2+2im) - ct3 - -ct1); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. ct2 * ct3 - (2+2im)*(3+3im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. ct3 * ct2 - (2+2im)*(3+3im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. ct2 * 5 - (10+10im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. 5 * ct2 - (10 * ct1)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. ct1 / ct2 - (1+im)/(2+2im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. ct2 / ct1 - 2); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. 1 / ct2 - 1/(2+2im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. ct2 / 3 - (2+2im)/3); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. ct2 / ct2 - 1); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. ct2 ^ ct3 - (2+2im)^(3+3im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. ct3 ^ ct2 - (3+3im)^(2+2im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. ct2 ^ 3 - (2+2im)^3); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. ct2 ^ (1/2) - sqrt(2+2im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. ct2 ^ (1/2) - sqrt(ct2)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. 2 ^ ct3 - 2^(3+3im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. inv(ct3) - 1/ct3); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. inv(ct3) - 1/(3+3im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. t1 + ct2 - (1 + (2+2im))); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. ct2 + t1 - (1 + (2+2im))); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. t1 + (2+2im) - (1 + (2+2im))); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. (2+2im) + t1 - (1 + (2+2im))); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. t3 - ct2 - (3 - (2+2im))); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. ct2 - t3 - ((2+2im) - 3)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. t3 - (2+2im) - (3 - (2+2im))); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. (2+2im) - t3 - ((2+2im) - 3)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. t2 * ct3 - 2 * (3+3im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. ct3 * t2 - 2 * (3+3im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. t2 * (3+3im) - 2 * (3+3im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. (3+3im) * t2 - 2 * (3+3im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. t2 / ct3 - 2/(3+3im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. ct3 / t2 - (3+3im)/2); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. t2 / (3+3im) - 2/(3+3im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. (3+3im) / t2 - (3+3im)/2); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. t2 ^ ct3 - 2^(3+3im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. ct3 ^ t2 - (3+3im)^2); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. t2 ^ (3+3im) - 2^(3+3im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. (3+3im)^t2 - (3+3im)^2); normTPS(out)) < tol + + # Vectorized DOT: + t1 = [t1] + t2 = [t2] + t3 = [t3] + ct1 = [ct1] + ct2 = [ct2] + ct3 = [ct3] + out = [out] + + @test @FastGTPSA(norm(@.(normTPS(t1 + t2 - t3)))) < tol + @test @FastGTPSA(norm(@.(normTPS(t2 + t1 - t3)))) < tol + @test @FastGTPSA(norm(@.(normTPS(t1 + 2 - t3)))) < tol + @test @FastGTPSA(norm(@.(normTPS(2 + t1 - t3)))) < tol + @test @FastGTPSA(norm(@.(normTPS(t3 - t2 - t1)))) < tol + @test @FastGTPSA(norm(@.(normTPS(t2 - t3 - -t1)))) < tol + @test @FastGTPSA(norm(@.(normTPS(t3 - 2 - t1)))) < tol + @test @FastGTPSA(norm(@.(normTPS(2 - t3 - -t1)))) < tol + @test @FastGTPSA(norm(@.(normTPS(t2 * t3 - 6)))) < tol + @test @FastGTPSA(norm(@.(normTPS(t3 * t2 - 6)))) < tol + @test @FastGTPSA(norm(@.(normTPS(t2 * 5 - 10)))) < tol + @test @FastGTPSA(norm(@.(normTPS(5 * t2 - 10 * t1)))) < tol + @test @FastGTPSA(norm(@.(normTPS(t1 / t2 - 1/2)))) < tol + @test @FastGTPSA(norm(@.(normTPS(t2 / t1 - 2)))) < tol + @test @FastGTPSA(norm(@.(normTPS(1 / t2 - 1/2)))) < tol + @test @FastGTPSA(norm(@.(normTPS(t2 / 3 - 2/3)))) < tol + @test @FastGTPSA(norm(@.(normTPS(t2 / t2 - t1)))) < tol + @test @FastGTPSA(norm(@.(normTPS(t2 / t2 - 1)))) < tol + @test @FastGTPSA(norm(@.(normTPS(t2 ^ t3 - 8)))) < tol + @test @FastGTPSA(norm(@.(normTPS(t3 ^ t2 - 9)))) < tol + @test @FastGTPSA(norm(@.(normTPS(t2 ^ 3 - 8)))) < tol + @test @FastGTPSA(norm(@.(normTPS(t2 ^ (1/2) - sqrt(2))))) < tol + @test @FastGTPSA(norm(@.(normTPS(t2 ^ (1/2) - sqrt(t2))))) < tol + @test @FastGTPSA(norm(@.(normTPS(2 ^ t3 - 8)))) < tol + @test @FastGTPSA(norm(@.(normTPS(inv(t3) - 1/t3)))) < tol + @test @FastGTPSA(norm(@.(normTPS(inv(t3) - 1/3)))) < tol + + # ComplexTPS + @test @FastGTPSA(norm(@.(normTPS(ct1 + ct2 - ct3)))) < tol + @test @FastGTPSA(norm(@.(normTPS(ct2 + ct1 - ct3)))) < tol + @test @FastGTPSA(norm(@.(normTPS(ct1 + (2+2im) - ct3)))) < tol + @test @FastGTPSA(norm(@.(normTPS((2+2im) + ct1 - ct3)))) < tol + @test @FastGTPSA(norm(@.(normTPS(ct3 - ct2 - ct1)))) < tol + @test @FastGTPSA(norm(@.(normTPS(ct2 - ct3 - -ct1)))) < tol + @test @FastGTPSA(norm(@.(normTPS(ct3 - (2+2im) - ct1)))) < tol + @test @FastGTPSA(norm(@.(normTPS((2+2im) - ct3 - -ct1)))) < tol + @test @FastGTPSA(norm(@.(normTPS(ct2 * ct3 - (2+2im)*(3+3im))))) < tol + @test @FastGTPSA(norm(@.(normTPS(ct3 * ct2 - (2+2im)*(3+3im))))) < tol + @test @FastGTPSA(norm(@.(normTPS(ct2 * 5 - (10+10im))))) < tol + @test @FastGTPSA(norm(@.(normTPS(5 * ct2 - (10 * ct1))))) < tol + @test @FastGTPSA(norm(@.(normTPS(ct1 / ct2 - (1+im)/(2+2im))))) < tol + @test @FastGTPSA(norm(@.(normTPS(ct2 / ct1 - 2)))) < tol + @test @FastGTPSA(norm(@.(normTPS(1 / ct2 - 1/(2+2im))))) < tol + @test @FastGTPSA(norm(@.(normTPS(ct2 / 3 - (2+2im)/3)))) < tol + @test @FastGTPSA(norm(@.(normTPS(ct2 / ct2 - 1)))) < tol + @test @FastGTPSA(norm(@.(normTPS(ct2 ^ ct3 - (2+2im)^(3+3im))))) < tol + @test @FastGTPSA(norm(@.(normTPS(ct3 ^ ct2 - (3+3im)^(2+2im))))) < tol + @test @FastGTPSA(norm(@.(normTPS(ct2 ^ 3 - (2+2im)^3)))) < tol + @test @FastGTPSA(norm(@.(normTPS(ct2 ^ (1/2) - sqrt(2+2im))))) < tol + @test @FastGTPSA(norm(@.(normTPS(ct2 ^ (1/2) - sqrt(ct2))))) < tol + @test @FastGTPSA(norm(@.(normTPS(2 ^ ct3 - 2^(3+3im))))) < tol + @test @FastGTPSA(norm(@.(normTPS(inv(ct3) - 1/ct3)))) < tol + @test @FastGTPSA(norm(@.(normTPS(inv(ct3) - 1/(3+3im))))) < tol + + # Promotion of TPS to ComplexTPS + @test @FastGTPSA(norm(@.(normTPS(t1 + ct2 - (1 + (2+2im)))))) < tol + @test @FastGTPSA(norm(@.(normTPS(ct2 + t1 - (1 + (2+2im)))))) < tol + @test @FastGTPSA(norm(@.(normTPS(t1 + (2+2im) - (1 + (2+2im)))))) < tol + @test @FastGTPSA(norm(@.(normTPS((2+2im) + t1 - (1 + (2+2im)))))) < tol + @test @FastGTPSA(norm(@.(normTPS(t3 - ct2 - (3 - (2+2im)))))) < tol + @test @FastGTPSA(norm(@.(normTPS(ct2 - t3 - ((2+2im) - 3))))) < tol + @test @FastGTPSA(norm(@.(normTPS(t3 - (2+2im) - (3 - (2+2im)))))) < tol + @test @FastGTPSA(norm(@.(normTPS((2+2im) - t3 - ((2+2im) - 3))))) < tol + @test @FastGTPSA(norm(@.(normTPS(t2 * ct3 - 2 * (3+3im))))) < tol + @test @FastGTPSA(norm(@.(normTPS(ct3 * t2 - 2 * (3+3im))))) < tol + @test @FastGTPSA(norm(@.(normTPS(t2 * (3+3im) - 2 * (3+3im))))) < tol + @test @FastGTPSA(norm(@.(normTPS((3+3im) * t2 - 2 * (3+3im))))) < tol + @test @FastGTPSA(norm(@.(normTPS(t2 / ct3 - 2/(3+3im))))) < tol + @test @FastGTPSA(norm(@.(normTPS(ct3 / t2 - (3+3im)/2)))) < tol + @test @FastGTPSA(norm(@.(normTPS(t2 / (3+3im) - 2/(3+3im))))) < tol + @test @FastGTPSA(norm(@.(normTPS((3+3im) / t2 - (3+3im)/2)))) < tol + @test @FastGTPSA(norm(@.(normTPS(t2 ^ ct3 - 2^(3+3im))))) < tol + @test @FastGTPSA(norm(@.(normTPS(ct3 ^ t2 - (3+3im)^2)))) < tol + @test @FastGTPSA(norm(@.(normTPS(t2 ^ (3+3im) - 2^(3+3im))))) < tol + @test @FastGTPSA(norm(@.(normTPS((3+3im)^t2 - (3+3im)^2)))) < tol + + + @test (@FastGTPSA!(@. out = t1 + t2 - t3); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = t2 + t1 - t3); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = t1 + 2 - t3); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = 2 + t1 - t3); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = t3 - t2 - t1); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = t2 - t3 - -t1); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = t3 - 2 - t1); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = 2 - t3 - -t1); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = t2 * t3 - 6); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = t3 * t2 - 6); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = t2 * 5 - 10); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = 5 * t2 - 10 * t1); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = t1 / t2 - 1/2); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = t2 / t1 - 2); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = 1 / t2 - 1/2); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = t2 / 3 - 2/3); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = t2 / t2 - t1); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = t2 / t2 - 1); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = t2 ^ t3 - 8); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = t3 ^ t2 - 9); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = t2 ^ 3 - 8); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = t2 ^ (1/2) - sqrt(2)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = t2 ^ (1/2) - sqrt(t2)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = 2 ^ t3 - 8); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = inv(t3) - 1/t3); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = inv(t3) - 1/3); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = ct1 + ct2 - ct3); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = ct2 + ct1 - ct3); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = ct1 + (2+2im) - ct3); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = (2+2im) + ct1 - ct3); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = ct3 - ct2 - ct1); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = ct2 - ct3 - -ct1); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = ct3 - (2+2im) - ct1); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = (2+2im) - ct3 - -ct1); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = ct2 * ct3 - (2+2im)*(3+3im)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = ct3 * ct2 - (2+2im)*(3+3im)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = ct2 * 5 - (10+10im)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = 5 * ct2 - (10 * ct1)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = ct1 / ct2 - (1+im)/(2+2im)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = ct2 / ct1 - 2); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = 1 / ct2 - 1/(2+2im)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = ct2 / 3 - (2+2im)/3); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = ct2 / ct2 - 1); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = ct2 ^ ct3 - (2+2im)^(3+3im)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = ct3 ^ ct2 - (3+3im)^(2+2im)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = ct2 ^ 3 - (2+2im)^3); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = ct2 ^ (1/2) - sqrt(2+2im)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = ct2 ^ (1/2) - sqrt(ct2)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = 2 ^ ct3 - 2^(3+3im)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = inv(ct3) - 1/ct3); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = inv(ct3) - 1/(3+3im)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = t1 + ct2 - (1 + (2+2im))); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = ct2 + t1 - (1 + (2+2im))); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = t1 + (2+2im) - (1 + (2+2im))); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = (2+2im) + t1 - (1 + (2+2im))); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = t3 - ct2 - (3 - (2+2im))); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = ct2 - t3 - ((2+2im) - 3)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = t3 - (2+2im) - (3 - (2+2im))); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = (2+2im) - t3 - ((2+2im) - 3)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = t2 * ct3 - 2 * (3+3im)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = ct3 * t2 - 2 * (3+3im)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = t2 * (3+3im) - 2 * (3+3im)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = (3+3im) * t2 - 2 * (3+3im)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = t2 / ct3 - 2/(3+3im)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = ct3 / t2 - (3+3im)/2); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = t2 / (3+3im) - 2/(3+3im)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = (3+3im) / t2 - (3+3im)/2); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = t2 ^ ct3 - 2^(3+3im)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = ct3 ^ t2 - (3+3im)^2); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = t2 ^ (3+3im) - 2^(3+3im)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = (3+3im)^t2 - (3+3im)^2); norm(normTPS.(out))) < tol + + d = Descriptor(1, 5) + t = TPS(use=d) + v = 0.5 + t[0] = v + tol = 1e-14 + t1 = TPS(t) + t1[0] = 1 + t2 = zero(t1) + t2[0] = 2 + t3 = zero(t1) + t3[0] = 3 + out = ComplexTPS64() + + @test @FastGTPSA(@.(normTPS(abs(-t) - abs(-v) ))) < tol + @test @FastGTPSA(@.(normTPS(sqrt(t) - sqrt(v)))) < tol + @test @FastGTPSA(@.(normTPS(exp(t) - exp(v)))) < tol + @test @FastGTPSA(@.(normTPS(log(t) - log(v)))) < tol + @test @FastGTPSA(@.(normTPS(sin(t) - sin(v)))) < tol + @test @FastGTPSA(@.(normTPS(cos(t) - cos(v)))) < tol + @test @FastGTPSA(@.(normTPS(tan(t) - tan(v)))) < tol + @test @FastGTPSA(@.(normTPS(csc(t) - csc(v)))) < tol + @test @FastGTPSA(@.(normTPS(sec(t) - sec(v)))) < tol + @test @FastGTPSA(@.(normTPS(cot(t) - cot(v)))) < tol + @test @FastGTPSA(@.(normTPS(sinc(t) - sinc(v)))) < tol + @test @FastGTPSA(@.(normTPS(sinh(t) - sinh(v)))) < tol + @test @FastGTPSA(@.(normTPS(cosh(t) - cosh(v)))) < tol + @test @FastGTPSA(@.(normTPS(tanh(t) - tanh(v)))) < tol + @test @FastGTPSA(@.(normTPS(csch(t) - csch(v)))) < tol + @test @FastGTPSA(@.(normTPS(sech(t) - sech(v)))) < tol + @test @FastGTPSA(@.(normTPS(coth(t) - coth(v)))) < tol + @test @FastGTPSA(@.(normTPS(asin(t) - asin(v)))) < tol + @test @FastGTPSA(@.(normTPS(acos(t) - acos(v)))) < tol + @test @FastGTPSA(@.(normTPS(atan(t) - atan(v)))) < tol + @test @FastGTPSA(@.(normTPS(acsc(1/t) - acsc(1/v)))) < tol + @test @FastGTPSA(@.(normTPS(asec(1/t) - asec(1/v)))) < tol + @test @FastGTPSA(@.(normTPS(acot(1/t) - acot(1/v)))) < tol + @test @FastGTPSA(@.(normTPS(asinh(t) - asinh(v)))) < tol + @test @FastGTPSA(@.(normTPS(acosh(1/t) - acosh(1/v)))) < tol + @test @FastGTPSA(@.(normTPS(atanh(t) - atanh(v)))) < tol + @test @FastGTPSA(@.(normTPS(acsch(1/t) - acsch(1/v)))) < tol + @test @FastGTPSA(@.(normTPS(asech(t) - asech(v)))) < tol + @test @FastGTPSA(@.(normTPS(acoth(1/t) - acoth(1/v)))) < tol + @test @FastGTPSA(@.(normTPS(asinc(t/pi) - asin(v)/(v)))) < tol + @test @FastGTPSA(@.(normTPS(asinhc(t/pi) - asinh(v)/(v)))) < tol + @test @FastGTPSA(@.(normTPS(zero(t) - zero(v)))) < tol + @test @FastGTPSA(@.(normTPS(real(t) - real(v)))) < tol + @test @FastGTPSA(@.(normTPS(imag(t) - imag(v)))) < tol + @test @FastGTPSA(@.(normTPS(conj(t) - conj(v)))) < tol + @test @FastGTPSA(@.(normTPS(sinhc(t/pi) - sinh(v)/v))) < tol + @test @FastGTPSA(@.(normTPS(erf(t) - erf(v)))) < tol + @test @FastGTPSA(@.(normTPS(erfc(t) - erfc(v)))) < tol + @test @FastGTPSA(@.(normTPS(-im*erf(t*im) - erfi(v)))) < tol + @test @FastGTPSA(@.(normTPS(atan(t3,t2) - atan(3,2)))) < tol + @test @FastGTPSA(@.(normTPS(atan(t3,2) - atan(3,2)))) < tol + @test @FastGTPSA(@.(normTPS(atan(3,t2) - atan(3,2)))) < tol + @test @FastGTPSA(@.(normTPS(atan(t3,-t2) - atan(3,-2)))) < tol + @test @FastGTPSA(@.(normTPS(atan(t3,-2) - atan(3,-2)))) < tol + @test @FastGTPSA(@.(normTPS(atan(3,-t2) - atan(3,-2)))) < tol + @test @FastGTPSA(@.(normTPS(atan(-t3,-t2) - atan(-3,-2)))) < tol + @test @FastGTPSA(@.(normTPS(atan(-t3,-2) - atan(-3,-2)))) < tol + @test @FastGTPSA(@.(normTPS(atan(-3,-t2) - atan(-3,-2)))) < tol + @test @FastGTPSA(@.(normTPS(atan(-t3,t2) - atan(-3,2)))) < tol + @test @FastGTPSA(@.(normTPS(atan(-t3,2) - atan(-3,2)))) < tol + @test @FastGTPSA(@.(normTPS(atan(-3,t2) - atan(-3,2)))) < tol + + @test @FastGTPSA(@.(normTPS(hypot(t2,t3) - hypot(2,3)))) < tol + @test @FastGTPSA(@.(normTPS(hypot(2,t3) - hypot(2,3)))) < tol + @test @FastGTPSA(@.(normTPS(hypot(t2,3) - hypot(2,3)))) < tol + @test @FastGTPSA(@.(normTPS(hypot(t1,t2,t3) - hypot(1,2,3)))) < tol + @test @FastGTPSA(@.(normTPS(hypot(1, t2, t3) - hypot(1,2,3)))) < tol + @test @FastGTPSA(@.(normTPS(hypot(t1, 2, t3) - hypot(1,2,3)))) < tol + @test @FastGTPSA(@.(normTPS(hypot(t1, t2, 3) - hypot(1,2,3)))) < tol + @test @FastGTPSA(@.(normTPS(hypot(1, 2, t3) - hypot(1,2,3)))) < tol + @test @FastGTPSA(@.(normTPS(hypot(1, t2, 3) - hypot(1,2,3)))) < tol + @test @FastGTPSA(@.(normTPS(hypot(t1, 2, 3) - hypot(1,2,3)))) < tol + + @test @FastGTPSA(@.(normTPS(angle(t2) - angle(2)))) < tol + @test @FastGTPSA(@.(normTPS(angle(-t2) - angle(-2)))) < tol + @test @FastGTPSA(@.(normTPS(complex(t3) - complex(3)))) < tol + @test @FastGTPSA(@.(normTPS(complex(t2,t3) - complex(2,3)))) < tol + @test @FastGTPSA(@.(normTPS(polar(t2) - (abs(2)+im*atan(0,2))))) < tol + @test @FastGTPSA(@.(normTPS(polar(-t1) - (abs(-1)+im*atan(0,-1))))) < tol + @test @FastGTPSA(@.(normTPS(rect(t2) - (2*cos(0) + im*2*sin(0))))) < tol + @test @FastGTPSA(@.(normTPS(rect(-t1) - (-1*cos(0) + im*-1*sin(0))))) < tol + + + @test (@FastGTPSA!(out = @. abs(-t) - abs(-v) ); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. sqrt(t) - sqrt(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. exp(t) - exp(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. log(t) - log(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. sin(t) - sin(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. cos(t) - cos(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. tan(t) - tan(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. csc(t) - csc(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. sec(t) - sec(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. cot(t) - cot(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. sinc(t) - sinc(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. sinh(t) - sinh(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. cosh(t) - cosh(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. tanh(t) - tanh(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. csch(t) - csch(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. sech(t) - sech(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. coth(t) - coth(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. asin(t) - asin(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. acos(t) - acos(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. atan(t) - atan(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. acsc(1/t) - acsc(1/v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. asec(1/t) - asec(1/v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. acot(1/t) - acot(1/v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. asinh(t) - asinh(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. acosh(1/t) - acosh(1/v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. atanh(t) - atanh(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. acsch(1/t) - acsch(1/v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. asech(t) - asech(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. acoth(1/t) - acoth(1/v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. asinc(t/pi) - asin(v)/(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. asinhc(t/pi) - asinh(v)/(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. zero(t) - zero(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. real(t) - real(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. imag(t) - imag(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. conj(t) - conj(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. sinhc(t/pi) - sinh(v)/v); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. erf(t) - erf(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. erfc(t) - erfc(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. -im*erf(t*im) - erfi(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. atan(t3,t2) - atan(3,2)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. atan(t3,2) - atan(3,2)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. atan(3,t2) - atan(3,2)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. atan(t3,-t2) - atan(3,-2)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. atan(t3,-2) - atan(3,-2)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. atan(3,-t2) - atan(3,-2)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. atan(-t3,-t2) - atan(-3,-2)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. atan(-t3,-2) - atan(-3,-2)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. atan(-3,-t2) - atan(-3,-2)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. atan(-t3,t2) - atan(-3,2)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. atan(-t3,2) - atan(-3,2)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. atan(-3,t2) - atan(-3,2)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. hypot(t2,t3) - hypot(2,3)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. hypot(2,t3) - hypot(2,3)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. hypot(t2,3) - hypot(2,3)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. hypot(t1,t2,t3) - hypot(1,2,3)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. hypot(1, t2, t3) - hypot(1,2,3)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. hypot(t1, 2, t3) - hypot(1,2,3)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. hypot(t1, t2, 3) - hypot(1,2,3)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. hypot(1, 2, t3) - hypot(1,2,3)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. hypot(1, t2, 3) - hypot(1,2,3)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. hypot(t1, 2, 3) - hypot(1,2,3)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. angle(t2) - angle(2)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. angle(-t2) - angle(-2)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. complex(t3) - complex(3)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. complex(t2,t3) - complex(2,3)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. polar(t2) - (abs(2)+im*atan(0,2))); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. polar(-t1) - (abs(-1)+im*atan(0,-1))); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. rect(t2) - (2*cos(0) + im*2*sin(0))); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. rect(-t1) - (-1*cos(0) + im*-1*sin(0))); normTPS(out)) < tol + + + v = 0.5+0.5im + t = ComplexTPS64(t) + t[0] = v + ct1 = ComplexTPS64(t) + ct1[0] = 1 + 1im + ct2 = zero(ct1) + ct2[0] = 2 + 2im + ct3 = zero(ct1) + ct3[0] = 3 + 3im + @test @FastGTPSA(@.(normTPS(abs(-t) - abs(-v) ))) < tol + @test @FastGTPSA(@.(normTPS(sqrt(t) - sqrt(v)))) < tol + @test @FastGTPSA(@.(normTPS(exp(t) - exp(v)))) < tol + @test @FastGTPSA(@.(normTPS(log(t) - log(v)))) < tol + @test @FastGTPSA(@.(normTPS(sin(t) - sin(v)))) < tol + @test @FastGTPSA(@.(normTPS(cos(t) - cos(v)))) < tol + @test @FastGTPSA(@.(normTPS(tan(t) - tan(v)))) < tol + @test @FastGTPSA(@.(normTPS(csc(t) - csc(v)))) < tol + @test @FastGTPSA(@.(normTPS(sec(t) - sec(v)))) < tol + @test @FastGTPSA(@.(normTPS(cot(t) - cot(v)))) < tol + @test @FastGTPSA(@.(normTPS(sinc(t) - sinc(v)))) < tol + @test @FastGTPSA(@.(normTPS(sinh(t) - sinh(v)))) < tol + @test @FastGTPSA(@.(normTPS(cosh(t) - cosh(v)))) < tol + @test @FastGTPSA(@.(normTPS(tanh(t) - tanh(v)))) < tol + @test @FastGTPSA(@.(normTPS(csch(t) - csch(v)))) < tol + @test @FastGTPSA(@.(normTPS(sech(t) - sech(v)))) < tol + @test @FastGTPSA(@.(normTPS(coth(t) - coth(v)))) < tol + @test @FastGTPSA(@.(normTPS(asin(t) - asin(v)))) < tol + @test @FastGTPSA(@.(normTPS(acos(t) - acos(v)))) < tol + @test @FastGTPSA(@.(normTPS(atan(t) - atan(v)))) < tol + @test @FastGTPSA(@.(normTPS(acsc(t) - acsc(v)))) < tol + @test @FastGTPSA(@.(normTPS(asec(t) - asec(v)))) < tol + @test @FastGTPSA(@.(normTPS(acot(t) - acot(v)))) < tol + @test @FastGTPSA(@.(normTPS(asinh(t) - asinh(v)))) < tol + @test @FastGTPSA(@.(normTPS(acosh(t) - acosh(v)))) < tol + @test @FastGTPSA(@.(normTPS(atanh(t) - atanh(v)))) < tol + @test @FastGTPSA(@.(normTPS(acsch(t) - acsch(v)))) < tol + @test @FastGTPSA(@.(normTPS(asech(t) - asech(v)))) < tol + @test @FastGTPSA(@.(normTPS(acoth(t) - acoth(v)))) < tol + @test @FastGTPSA(@.(normTPS(asinc(t/pi) - asin(v)/v))) < tol + @test @FastGTPSA(@.(normTPS(asinhc(t/pi) - asinh(v)/v))) < tol + @test @FastGTPSA(@.(normTPS(zero(t) - zero(v)))) < tol + @test @FastGTPSA(@.(normTPS(real(t) - real(v)))) < tol + @test @FastGTPSA(@.(normTPS(imag(t) - imag(v)))) < tol + @test @FastGTPSA(@.(normTPS(conj(t) - conj(v)))) < tol + @test @FastGTPSA(@.(normTPS(sinhc(t/pi) - sinh(v)/v))) < tol + @test @FastGTPSA(@.(normTPS(erf(t) - erf(v)))) < tol + @test @FastGTPSA(@.(normTPS(erfc(t) - erfc(v)))) < tol + @test @FastGTPSA(@.(normTPS(-im*erf(t*im) - erfi(v)))) < tol + @test @FastGTPSA(@.(normTPS(hypot(ct2,ct3) - hypot(2+2im,3+3im)))) < tol + @test @FastGTPSA(@.(normTPS(hypot(2+2im,ct3) - hypot(2+2im,3+3im)))) < tol + @test @FastGTPSA(@.(normTPS(hypot(ct2,3+3im) - hypot(2+2im,3+3im)))) < tol + @test @FastGTPSA(@.(normTPS(hypot(ct1,ct2,ct3) - hypot(1+1im,2+2im,3+3im)))) < tol + @test @FastGTPSA(@.(normTPS(hypot(1+1im, ct2, ct3) - hypot(1+1im,2+2im,3+3im)))) < tol + @test @FastGTPSA(@.(normTPS(hypot(ct1, 2+2im, ct3) - hypot(1+1im,2+2im,3+3im)))) < tol + @test @FastGTPSA(@.(normTPS(hypot(ct1, ct2, 3+3im) - hypot(1+1im,2+2im,3+3im)))) < tol + @test @FastGTPSA(@.(normTPS(hypot(1+1im, 2+2im, ct3) - hypot(1+1im,2+2im,3+3im)))) < tol + @test @FastGTPSA(@.(normTPS(hypot(1+1im, ct2, 3+3im) - hypot(1+1im,2+2im,3+3im)))) < tol + @test @FastGTPSA(@.(normTPS(hypot(ct1, 2+2im, 3+3im) - hypot(1+1im,2+2im,3+3im)))) < tol + @test @FastGTPSA(@.(normTPS(angle(t2+im*t3) - angle(2+3im)))) < tol + @test @FastGTPSA(@.(normTPS(angle(t2-im*t3) - angle(2-3im)))) < tol + @test @FastGTPSA(@.(normTPS(angle(-t2-im*t3) - angle(-2-3im)))) < tol + @test @FastGTPSA(@.(normTPS(angle(-t2+im*t3) - angle(-2+3im)))) < tol + @test @FastGTPSA(@.(normTPS(angle(ct2) - angle(2+2im)))) < tol + @test @FastGTPSA(@.(normTPS(angle(-ct2) - angle(-2-2im)))) < tol + @test @FastGTPSA(@.(normTPS(complex(ct3) - complex(3+3im)))) < tol + @test @FastGTPSA(@.(normTPS(polar(ct2) - (abs(2+2im)+im*angle(2+2im))))) < tol + @test @FastGTPSA(@.(normTPS(polar(-ct1) - (abs(-1-im)+im*angle(-1-im))))) < tol + @test @FastGTPSA(@.(normTPS(rect(ct2) - (2*cos(2) + im*2*sin(2))))) < tol + @test @FastGTPSA(@.(normTPS(rect(-ct1) - (-1*cos(-1) + im*-1*sin(-1))))) < tol + @test @FastGTPSA(@.(normTPS(hypot(ct1, ct2, t3) - hypot(1+1im,2+2im,3)))) < tol + @test @FastGTPSA(@.(normTPS(hypot(ct1, t2, ct3) - hypot(1+1im,2,3+3im)))) < tol + @test @FastGTPSA(@.(normTPS(hypot(t1, ct2, ct3) - hypot(1,2+2im,3+3im)))) < tol + @test @FastGTPSA(@.(normTPS(hypot(ct1, t2, t3) - hypot(1+1im,2,3)))) < tol + @test @FastGTPSA(@.(normTPS(hypot(t1, ct2, t3) - hypot(1,2+2im,3)))) < tol + @test @FastGTPSA(@.(normTPS(hypot(t1, t2, ct3) - hypot(1,2,3+3im)))) < tol + @test @FastGTPSA(@.(normTPS(hypot(ct1,t2,3+3im) - hypot(1+1im,2,3+3im)))) < tol + @test @FastGTPSA(@.(normTPS(hypot(t1, ct2, 3+3im) - hypot(1,2+2im,3+3im)))) < tol + @test @FastGTPSA(@.(normTPS(hypot(ct1,2+2im,t3) - hypot(1+1im,2+2im,3)))) < tol + @test @FastGTPSA(@.(normTPS(hypot(t1,2+2im,ct3) - hypot(1,2+2im,3+3im)))) < tol + @test @FastGTPSA(@.(normTPS(hypot(1+1im,ct2,t3) - hypot(1+1im,2+2im,3)))) < tol + @test @FastGTPSA(@.(normTPS(hypot(1+1im, t2, ct3) - hypot(1+1im,2,3+3im)))) < tol + @test @FastGTPSA(@.(normTPS(hypot(t1,t2,3+3im) - hypot(1,2,3+3im)))) < tol + @test @FastGTPSA(@.(normTPS(hypot(t1,2+2im,t3) - hypot(1,2+2im,3)))) < tol + @test @FastGTPSA(@.(normTPS(hypot(1+1im,t2,t3) - hypot(1+1im,2,3)))) < tol + @test @FastGTPSA(@.(normTPS(hypot(t1,2,3+3im) - hypot(1,2,3+3im)))) < tol + @test @FastGTPSA(@.(normTPS(hypot(1,t2,3+3im) - hypot(1,2,3+3im)))) < tol + @test @FastGTPSA(@.(normTPS(hypot(1+1im,2,t3) - hypot(1+1im,2,3)))) < tol + + @test (@FastGTPSA!(out = @. abs(-t) - abs(-v) ); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. sqrt(t) - sqrt(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. exp(t) - exp(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. log(t) - log(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. sin(t) - sin(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. cos(t) - cos(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. tan(t) - tan(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. csc(t) - csc(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. sec(t) - sec(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. cot(t) - cot(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. sinc(t) - sinc(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. sinh(t) - sinh(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. cosh(t) - cosh(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. tanh(t) - tanh(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. csch(t) - csch(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. sech(t) - sech(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. coth(t) - coth(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. asin(t) - asin(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. acos(t) - acos(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. atan(t) - atan(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. acsc(t) - acsc(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. asec(t) - asec(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. acot(t) - acot(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. asinh(t) - asinh(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. acosh(t) - acosh(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. atanh(t) - atanh(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. acsch(t) - acsch(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. asech(t) - asech(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. acoth(t) - acoth(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. asinc(t/pi) - asin(v)/v); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. asinhc(t/pi) - asinh(v)/v); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. zero(t) - zero(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. real(t) - real(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. imag(t) - imag(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. conj(t) - conj(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. sinhc(t/pi) - sinh(v)/v); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. erf(t) - erf(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. erfc(t) - erfc(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. -im*erf(t*im) - erfi(v)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. hypot(ct2,ct3) - hypot(2+2im,3+3im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. hypot(2+2im,ct3) - hypot(2+2im,3+3im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. hypot(ct2,3+3im) - hypot(2+2im,3+3im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. hypot(ct1,ct2,ct3) - hypot(1+1im,2+2im,3+3im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. hypot(1+1im, ct2, ct3) - hypot(1+1im,2+2im,3+3im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. hypot(ct1, 2+2im, ct3) - hypot(1+1im,2+2im,3+3im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. hypot(ct1, ct2, 3+3im) - hypot(1+1im,2+2im,3+3im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. hypot(1+1im, 2+2im, ct3) - hypot(1+1im,2+2im,3+3im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. hypot(1+1im, ct2, 3+3im) - hypot(1+1im,2+2im,3+3im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. hypot(ct1, 2+2im, 3+3im) - hypot(1+1im,2+2im,3+3im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. angle(t2+im*t3) - angle(2+3im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. angle(t2-im*t3) - angle(2-3im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. angle(-t2-im*t3) - angle(-2-3im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. angle(-t2+im*t3) - angle(-2+3im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. angle(ct2) - angle(2+2im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. angle(-ct2) - angle(-2-2im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. complex(ct3) - complex(3+3im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. polar(ct2) - (abs(2+2im)+im*angle(2+2im))); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. polar(-ct1) - (abs(-1-im)+im*angle(-1-im))); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. rect(ct2) - (2*cos(2) + im*2*sin(2))); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. rect(-ct1) - (-1*cos(-1) + im*-1*sin(-1))); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. hypot(ct1, ct2, t3) - hypot(1+1im,2+2im,3)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. hypot(ct1, t2, ct3) - hypot(1+1im,2,3+3im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. hypot(t1, ct2, ct3) - hypot(1,2+2im,3+3im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. hypot(ct1, t2, t3) - hypot(1+1im,2,3)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. hypot(t1, ct2, t3) - hypot(1,2+2im,3)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. hypot(t1, t2, ct3) - hypot(1,2,3+3im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. hypot(ct1,t2,3+3im) - hypot(1+1im,2,3+3im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. hypot(t1, ct2, 3+3im) - hypot(1,2+2im,3+3im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. hypot(ct1,2+2im,t3) - hypot(1+1im,2+2im,3)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. hypot(t1,2+2im,ct3) - hypot(1,2+2im,3+3im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. hypot(1+1im,ct2,t3) - hypot(1+1im,2+2im,3)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. hypot(1+1im, t2, ct3) - hypot(1+1im,2,3+3im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. hypot(t1,t2,3+3im) - hypot(1,2,3+3im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. hypot(t1,2+2im,t3) - hypot(1,2+2im,3)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. hypot(1+1im,t2,t3) - hypot(1+1im,2,3)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. hypot(t1,2,3+3im) - hypot(1,2,3+3im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. hypot(1,t2,3+3im) - hypot(1,2,3+3im)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. hypot(1+1im,2,t3) - hypot(1+1im,2,3)); normTPS(out)) < tol + + + # Now with vectors: + d = Descriptor(1, 5) + t = TPS(use=d) + v = 0.5 + t[0] = v + tol = 1e-14 + t1 = TPS(t) + t1[0] = 1 + t2 = zero(t1) + t2[0] = 2 + t3 = zero(t1) + t3[0] = 3 + + t = [t] + v = [v] + t1 = [t1] + t2 = [t2] + t3 = [t3] + out = [out] + + + @test @FastGTPSA(norm(@.(normTPS(abs(-t) - abs(-v) )))) < tol + @test @FastGTPSA(norm(@.(normTPS(sqrt(t) - sqrt(v))))) < tol + @test @FastGTPSA(norm(@.(normTPS(exp(t) - exp(v))))) < tol + @test @FastGTPSA(norm(@.(normTPS(log(t) - log(v))))) < tol + @test @FastGTPSA(norm(@.(normTPS(sin(t) - sin(v))))) < tol + @test @FastGTPSA(norm(@.(normTPS(cos(t) - cos(v))))) < tol + @test @FastGTPSA(norm(@.(normTPS(tan(t) - tan(v))))) < tol + @test @FastGTPSA(norm(@.(normTPS(csc(t) - csc(v))))) < tol + @test @FastGTPSA(norm(@.(normTPS(sec(t) - sec(v))))) < tol + @test @FastGTPSA(norm(@.(normTPS(cot(t) - cot(v))))) < tol + @test @FastGTPSA(norm(@.(normTPS(sinc(t) - sinc(v))))) < tol + @test @FastGTPSA(norm(@.(normTPS(sinh(t) - sinh(v))))) < tol + @test @FastGTPSA(norm(@.(normTPS(cosh(t) - cosh(v))))) < tol + @test @FastGTPSA(norm(@.(normTPS(tanh(t) - tanh(v))))) < tol + @test @FastGTPSA(norm(@.(normTPS(csch(t) - csch(v))))) < tol + @test @FastGTPSA(norm(@.(normTPS(sech(t) - sech(v))))) < tol + @test @FastGTPSA(norm(@.(normTPS(coth(t) - coth(v))))) < tol + @test @FastGTPSA(norm(@.(normTPS(asin(t) - asin(v))))) < tol + @test @FastGTPSA(norm(@.(normTPS(acos(t) - acos(v))))) < tol + @test @FastGTPSA(norm(@.(normTPS(atan(t) - atan(v))))) < tol + @test @FastGTPSA(norm(@.(normTPS(acsc(1/t) - acsc(1/v))))) < tol + @test @FastGTPSA(norm(@.(normTPS(asec(1/t) - asec(1/v))))) < tol + @test @FastGTPSA(norm(@.(normTPS(acot(1/t) - acot(1/v))))) < tol + @test @FastGTPSA(norm(@.(normTPS(asinh(t) - asinh(v))))) < tol + @test @FastGTPSA(norm(@.(normTPS(acosh(1/t) - acosh(1/v))))) < tol + @test @FastGTPSA(norm(@.(normTPS(atanh(t) - atanh(v))))) < tol + @test @FastGTPSA(norm(@.(normTPS(acsch(1/t) - acsch(1/v))))) < tol + @test @FastGTPSA(norm(@.(normTPS(asech(t) - asech(v))))) < tol + @test @FastGTPSA(norm(@.(normTPS(acoth(1/t) - acoth(1/v))))) < tol + @test @FastGTPSA(norm(@.(normTPS(asinc(t/pi) - asin(v)/(v))))) < tol + @test @FastGTPSA(norm(@.(normTPS(asinhc(t/pi) - asinh(v)/(v))))) < tol + @test @FastGTPSA(norm(@.(normTPS(zero(t) - zero(v))))) < tol + @test @FastGTPSA(norm(@.(normTPS(real(t) - real(v))))) < tol + @test @FastGTPSA(norm(@.(normTPS(imag(t) - imag(v))))) < tol + @test @FastGTPSA(norm(@.(normTPS(conj(t) - conj(v))))) < tol + @test @FastGTPSA(norm(@.(normTPS(sinhc(t/pi) - sinh(v)/v)))) < tol + @test @FastGTPSA(norm(@.(normTPS(erf(t) - erf(v))))) < tol + @test @FastGTPSA(norm(@.(normTPS(erfc(t) - erfc(v))))) < tol + @test @FastGTPSA(norm(@.(normTPS(-im*erf(t*im) - erfi(v))))) < tol + @test @FastGTPSA(norm(@.(normTPS(atan(t3,t2) - atan(3,2))))) < tol + @test @FastGTPSA(norm(@.(normTPS(atan(t3,2) - atan(3,2))))) < tol + @test @FastGTPSA(norm(@.(normTPS(atan(3,t2) - atan(3,2))))) < tol + @test @FastGTPSA(norm(@.(normTPS(atan(t3,-t2) - atan(3,-2))))) < tol + @test @FastGTPSA(norm(@.(normTPS(atan(t3,-2) - atan(3,-2))))) < tol + @test @FastGTPSA(norm(@.(normTPS(atan(3,-t2) - atan(3,-2))))) < tol + @test @FastGTPSA(norm(@.(normTPS(atan(-t3,-t2) - atan(-3,-2))))) < tol + @test @FastGTPSA(norm(@.(normTPS(atan(-t3,-2) - atan(-3,-2))))) < tol + @test @FastGTPSA(norm(@.(normTPS(atan(-3,-t2) - atan(-3,-2))))) < tol + @test @FastGTPSA(norm(@.(normTPS(atan(-t3,t2) - atan(-3,2))))) < tol + @test @FastGTPSA(norm(@.(normTPS(atan(-t3,2) - atan(-3,2))))) < tol + @test @FastGTPSA(norm(@.(normTPS(atan(-3,t2) - atan(-3,2))))) < tol + @test @FastGTPSA(norm(@.(normTPS(hypot(t2,t3) - hypot(2,3))))) < tol + @test @FastGTPSA(norm(@.(normTPS(hypot(2,t3) - hypot(2,3))))) < tol + @test @FastGTPSA(norm(@.(normTPS(hypot(t2,3) - hypot(2,3))))) < tol + @test @FastGTPSA(norm(@.(normTPS(hypot(t1,t2,t3) - hypot(1,2,3))))) < tol + @test @FastGTPSA(norm(@.(normTPS(hypot(1, t2, t3) - hypot(1,2,3))))) < tol + @test @FastGTPSA(norm(@.(normTPS(hypot(t1, 2, t3) - hypot(1,2,3))))) < tol + @test @FastGTPSA(norm(@.(normTPS(hypot(t1, t2, 3) - hypot(1,2,3))))) < tol + @test @FastGTPSA(norm(@.(normTPS(hypot(1, 2, t3) - hypot(1,2,3))))) < tol + @test @FastGTPSA(norm(@.(normTPS(hypot(1, t2, 3) - hypot(1,2,3))))) < tol + @test @FastGTPSA(norm(@.(normTPS(hypot(t1, 2, 3) - hypot(1,2,3))))) < tol + @test @FastGTPSA(norm(@.(normTPS(angle(t2) - angle(2))))) < tol + @test @FastGTPSA(norm(@.(normTPS(angle(-t2) - angle(-2))))) < tol + @test @FastGTPSA(norm(@.(normTPS(complex(t3) - complex(3))))) < tol + @test @FastGTPSA(norm(@.(normTPS(complex(t2,t3) - complex(2,3))))) < tol + @test @FastGTPSA(norm(@.(normTPS(polar(t2) - (abs(2)+im*atan(0,2)))))) < tol + @test @FastGTPSA(norm(@.(normTPS(polar(-t1) - (abs(-1)+im*atan(0,-1)))))) < tol + @test @FastGTPSA(norm(@.(normTPS(rect(t2) - (2*cos(0) + im*2*sin(0)))))) < tol + @test @FastGTPSA(norm(@.(normTPS(rect(-t1) - (-1*cos(0) + im*-1*sin(0)))))) < tol + + + @test (@FastGTPSA!(@. out = abs(-t) - abs(-v) ); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = sqrt(t) - sqrt(v)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = exp(t) - exp(v)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = log(t) - log(v)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = sin(t) - sin(v)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = cos(t) - cos(v)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = tan(t) - tan(v)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = csc(t) - csc(v)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = sec(t) - sec(v)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = cot(t) - cot(v)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = sinc(t) - sinc(v)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = sinh(t) - sinh(v)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = cosh(t) - cosh(v)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = tanh(t) - tanh(v)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = csch(t) - csch(v)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = sech(t) - sech(v)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = coth(t) - coth(v)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = asin(t) - asin(v)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = acos(t) - acos(v)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = atan(t) - atan(v)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = acsc(1/t) - acsc(1/v)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = asec(1/t) - asec(1/v)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = acot(1/t) - acot(1/v)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = asinh(t) - asinh(v)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = acosh(1/t) - acosh(1/v)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = atanh(t) - atanh(v)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = acsch(1/t) - acsch(1/v)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = asech(t) - asech(v)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = acoth(1/t) - acoth(1/v)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = asinc(t/pi) - asin(v)/(v)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = asinhc(t/pi) - asinh(v)/(v)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = zero(t) - zero(v)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = real(t) - real(v)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = imag(t) - imag(v)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = conj(t) - conj(v)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = sinhc(t/pi) - sinh(v)/v); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = erf(t) - erf(v)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = erfc(t) - erfc(v)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = -im*erf(t*im) - erfi(v)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = atan(t3,t2) - atan(3,2)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = atan(t3,2) - atan(3,2)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = atan(3,t2) - atan(3,2)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = atan(t3,-t2) - atan(3,-2)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = atan(t3,-2) - atan(3,-2)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = atan(3,-t2) - atan(3,-2)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = atan(-t3,-t2) - atan(-3,-2)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = atan(-t3,-2) - atan(-3,-2)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = atan(-3,-t2) - atan(-3,-2)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = atan(-t3,t2) - atan(-3,2)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = atan(-t3,2) - atan(-3,2)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = atan(-3,t2) - atan(-3,2)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = hypot(t2,t3) - hypot(2,3)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = hypot(2,t3) - hypot(2,3)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = hypot(t2,3) - hypot(2,3)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = hypot(t1,t2,t3) - hypot(1,2,3)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = hypot(1, t2, t3) - hypot(1,2,3)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = hypot(t1, 2, t3) - hypot(1,2,3)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = hypot(t1, t2, 3) - hypot(1,2,3)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = hypot(1, 2, t3) - hypot(1,2,3)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = hypot(1, t2, 3) - hypot(1,2,3)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = hypot(t1, 2, 3) - hypot(1,2,3)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = angle(t2) - angle(2)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = angle(-t2) - angle(-2)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = complex(t3) - complex(3)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = complex(t2,t3) - complex(2,3)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = polar(t2) - (abs(2)+im*atan(0,2))); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = polar(-t1) - (abs(-1)+im*atan(0,-1))); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = rect(t2) - (2*cos(0) + im*2*sin(0))); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = rect(-t1) - (-1*cos(0) + im*-1*sin(0))); norm(normTPS.(out))) < tol + + + v = 0.5+0.5im + t = ComplexTPS64(first(t)) + t[0] = v + ct1 = ComplexTPS64(t) + ct1[0] = 1 + 1im + ct2 = zero(ct1) + ct2[0] = 2 + 2im + ct3 = zero(ct1) + ct3[0] = 3 + 3im + + t = [t] + v = [v] + ct1 = [ct1] + ct2 = [ct2] + ct3 = [ct3] + + @test @FastGTPSA(norm(@.(normTPS(abs(-t) - abs(-v) )))) < tol + @test @FastGTPSA(norm(@.(normTPS(sqrt(t) - sqrt(v))))) < tol + @test @FastGTPSA(norm(@.(normTPS(exp(t) - exp(v))))) < tol + @test @FastGTPSA(norm(@.(normTPS(log(t) - log(v))))) < tol + @test @FastGTPSA(norm(@.(normTPS(sin(t) - sin(v))))) < tol + @test @FastGTPSA(norm(@.(normTPS(cos(t) - cos(v))))) < tol + @test @FastGTPSA(norm(@.(normTPS(tan(t) - tan(v))))) < tol + @test @FastGTPSA(norm(@.(normTPS(csc(t) - csc(v))))) < tol + @test @FastGTPSA(norm(@.(normTPS(sec(t) - sec(v))))) < tol + @test @FastGTPSA(norm(@.(normTPS(cot(t) - cot(v))))) < tol + @test @FastGTPSA(norm(@.(normTPS(sinc(t) - sinc(v))))) < tol + @test @FastGTPSA(norm(@.(normTPS(sinh(t) - sinh(v))))) < tol + @test @FastGTPSA(norm(@.(normTPS(cosh(t) - cosh(v))))) < tol + @test @FastGTPSA(norm(@.(normTPS(tanh(t) - tanh(v))))) < tol + @test @FastGTPSA(norm(@.(normTPS(csch(t) - csch(v))))) < tol + @test @FastGTPSA(norm(@.(normTPS(sech(t) - sech(v))))) < tol + @test @FastGTPSA(norm(@.(normTPS(coth(t) - coth(v))))) < tol + @test @FastGTPSA(norm(@.(normTPS(asin(t) - asin(v))))) < tol + @test @FastGTPSA(norm(@.(normTPS(acos(t) - acos(v))))) < tol + @test @FastGTPSA(norm(@.(normTPS(atan(t) - atan(v))))) < tol + @test @FastGTPSA(norm(@.(normTPS(acsc(t) - acsc(v))))) < tol + @test @FastGTPSA(norm(@.(normTPS(asec(t) - asec(v))))) < tol + @test @FastGTPSA(norm(@.(normTPS(acot(t) - acot(v))))) < tol + @test @FastGTPSA(norm(@.(normTPS(asinh(t) - asinh(v))))) < tol + @test @FastGTPSA(norm(@.(normTPS(acosh(t) - acosh(v))))) < tol + @test @FastGTPSA(norm(@.(normTPS(atanh(t) - atanh(v))))) < tol + @test @FastGTPSA(norm(@.(normTPS(acsch(t) - acsch(v))))) < tol + @test @FastGTPSA(norm(@.(normTPS(asech(t) - asech(v))))) < tol + @test @FastGTPSA(norm(@.(normTPS(acoth(t) - acoth(v))))) < tol + @test @FastGTPSA(norm(@.(normTPS(asinc(t/pi) - asin(v)/v)))) < tol + @test @FastGTPSA(norm(@.(normTPS(asinhc(t/pi) - asinh(v)/v)))) < tol + @test @FastGTPSA(norm(@.(normTPS(zero(t) - zero(v))))) < tol + @test @FastGTPSA(norm(@.(normTPS(real(t) - real(v))))) < tol + @test @FastGTPSA(norm(@.(normTPS(imag(t) - imag(v))))) < tol + @test @FastGTPSA(norm(@.(normTPS(conj(t) - conj(v))))) < tol + @test @FastGTPSA(norm(@.(normTPS(sinhc(t/pi) - sinh(v)/v)))) < tol + @test @FastGTPSA(norm(@.(normTPS(erf(t) - erf(v))))) < tol + @test @FastGTPSA(norm(@.(normTPS(erfc(t) - erfc(v))))) < tol + @test @FastGTPSA(norm(@.(normTPS(-im*erf(t*im) - erfi(v))))) < tol + @test @FastGTPSA(norm(@.(normTPS(hypot(ct2,ct3) - hypot(2+2im,3+3im))))) < tol + @test @FastGTPSA(norm(@.(normTPS(hypot(2+2im,ct3) - hypot(2+2im,3+3im))))) < tol + @test @FastGTPSA(norm(@.(normTPS(hypot(ct2,3+3im) - hypot(2+2im,3+3im))))) < tol + @test @FastGTPSA(norm(@.(normTPS(hypot(ct1,ct2,ct3) - hypot(1+1im,2+2im,3+3im))))) < tol + @test @FastGTPSA(norm(@.(normTPS(hypot(1+1im, ct2, ct3) - hypot(1+1im,2+2im,3+3im))))) < tol + @test @FastGTPSA(norm(@.(normTPS(hypot(ct1, 2+2im, ct3) - hypot(1+1im,2+2im,3+3im))))) < tol + @test @FastGTPSA(norm(@.(normTPS(hypot(ct1, ct2, 3+3im) - hypot(1+1im,2+2im,3+3im))))) < tol + @test @FastGTPSA(norm(@.(normTPS(hypot(1+1im, 2+2im, ct3) - hypot(1+1im,2+2im,3+3im))))) < tol + @test @FastGTPSA(norm(@.(normTPS(hypot(1+1im, ct2, 3+3im) - hypot(1+1im,2+2im,3+3im))))) < tol + @test @FastGTPSA(norm(@.(normTPS(hypot(ct1, 2+2im, 3+3im) - hypot(1+1im,2+2im,3+3im))))) < tol + @test @FastGTPSA(norm(@.(normTPS(angle(t2+im*t3) - angle(2+3im))))) < tol + @test @FastGTPSA(norm(@.(normTPS(angle(t2-im*t3) - angle(2-3im))))) < tol + @test @FastGTPSA(norm(@.(normTPS(angle(-t2-im*t3) - angle(-2-3im))))) < tol + @test @FastGTPSA(norm(@.(normTPS(angle(-t2+im*t3) - angle(-2+3im))))) < tol + @test @FastGTPSA(norm(@.(normTPS(angle(ct2) - angle(2+2im))))) < tol + @test @FastGTPSA(norm(@.(normTPS(angle(-ct2) - angle(-2-2im))))) < tol + @test @FastGTPSA(norm(@.(normTPS(complex(ct3) - complex(3+3im))))) < tol + @test @FastGTPSA(norm(@.(normTPS(polar(ct2) - (abs(2+2im)+im*angle(2+2im)))))) < tol + @test @FastGTPSA(norm(@.(normTPS(polar(-ct1) - (abs(-1-im)+im*angle(-1-im)))))) < tol + @test @FastGTPSA(norm(@.(normTPS(rect(ct2) - (2*cos(2) + im*2*sin(2)))))) < tol + @test @FastGTPSA(norm(@.(normTPS(rect(-ct1) - (-1*cos(-1) + im*-1*sin(-1)))))) < tol + @test @FastGTPSA(norm(@.(normTPS(hypot(ct1, ct2, t3) - hypot(1+1im,2+2im,3))))) < tol + @test @FastGTPSA(norm(@.(normTPS(hypot(ct1, t2, ct3) - hypot(1+1im,2,3+3im))))) < tol + @test @FastGTPSA(norm(@.(normTPS(hypot(t1, ct2, ct3) - hypot(1,2+2im,3+3im))))) < tol + @test @FastGTPSA(norm(@.(normTPS(hypot(ct1, t2, t3) - hypot(1+1im,2,3))))) < tol + @test @FastGTPSA(norm(@.(normTPS(hypot(t1, ct2, t3) - hypot(1,2+2im,3))))) < tol + @test @FastGTPSA(norm(@.(normTPS(hypot(t1, t2, ct3) - hypot(1,2,3+3im))))) < tol + @test @FastGTPSA(norm(@.(normTPS(hypot(ct1,t2,3+3im) - hypot(1+1im,2,3+3im))))) < tol + @test @FastGTPSA(norm(@.(normTPS(hypot(t1, ct2, 3+3im) - hypot(1,2+2im,3+3im))))) < tol + @test @FastGTPSA(norm(@.(normTPS(hypot(ct1,2+2im,t3) - hypot(1+1im,2+2im,3))))) < tol + @test @FastGTPSA(norm(@.(normTPS(hypot(t1,2+2im,ct3) - hypot(1,2+2im,3+3im))))) < tol + @test @FastGTPSA(norm(@.(normTPS(hypot(1+1im,ct2,t3) - hypot(1+1im,2+2im,3))))) < tol + @test @FastGTPSA(norm(@.(normTPS(hypot(1+1im, t2, ct3) - hypot(1+1im,2,3+3im))))) < tol + @test @FastGTPSA(norm(@.(normTPS(hypot(t1,t2,3+3im) - hypot(1,2,3+3im))))) < tol + @test @FastGTPSA(norm(@.(normTPS(hypot(t1,2+2im,t3) - hypot(1,2+2im,3))))) < tol + @test @FastGTPSA(norm(@.(normTPS(hypot(1+1im,t2,t3) - hypot(1+1im,2,3))))) < tol + @test @FastGTPSA(norm(@.(normTPS(hypot(t1,2,3+3im) - hypot(1,2,3+3im))))) < tol + @test @FastGTPSA(norm(@.(normTPS(hypot(1,t2,3+3im) - hypot(1,2,3+3im))))) < tol + @test @FastGTPSA(norm(@.(normTPS(hypot(1+1im,2,t3) - hypot(1+1im,2,3))))) < tol + + + @test (@FastGTPSA!(@. out = abs(-t) - abs(-v) ); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = sqrt(t) - sqrt(v)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = exp(t) - exp(v)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = log(t) - log(v)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = sin(t) - sin(v)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = cos(t) - cos(v)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = tan(t) - tan(v)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = csc(t) - csc(v)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = sec(t) - sec(v)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = cot(t) - cot(v)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = sinc(t) - sinc(v)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = sinh(t) - sinh(v)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = cosh(t) - cosh(v)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = tanh(t) - tanh(v)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = csch(t) - csch(v)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = sech(t) - sech(v)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = coth(t) - coth(v)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = asin(t) - asin(v)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = acos(t) - acos(v)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = atan(t) - atan(v)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = acsc(t) - acsc(v)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = asec(t) - asec(v)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = acot(t) - acot(v)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = asinh(t) - asinh(v)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = acosh(t) - acosh(v)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = atanh(t) - atanh(v)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = acsch(t) - acsch(v)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = asech(t) - asech(v)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = acoth(t) - acoth(v)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = asinc(t/pi) - asin(v)/v); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = asinhc(t/pi) - asinh(v)/v); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = zero(t) - zero(v)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = real(t) - real(v)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = imag(t) - imag(v)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = conj(t) - conj(v)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = sinhc(t/pi) - sinh(v)/v); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = erf(t) - erf(v)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = erfc(t) - erfc(v)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = -im*erf(t*im) - erfi(v)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = hypot(ct2,ct3) - hypot(2+2im,3+3im)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = hypot(2+2im,ct3) - hypot(2+2im,3+3im)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = hypot(ct2,3+3im) - hypot(2+2im,3+3im)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = hypot(ct1,ct2,ct3) - hypot(1+1im,2+2im,3+3im)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = hypot(1+1im, ct2, ct3) - hypot(1+1im,2+2im,3+3im)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = hypot(ct1, 2+2im, ct3) - hypot(1+1im,2+2im,3+3im)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = hypot(ct1, ct2, 3+3im) - hypot(1+1im,2+2im,3+3im)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = hypot(1+1im, 2+2im, ct3) - hypot(1+1im,2+2im,3+3im)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = hypot(1+1im, ct2, 3+3im) - hypot(1+1im,2+2im,3+3im)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = hypot(ct1, 2+2im, 3+3im) - hypot(1+1im,2+2im,3+3im)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = angle(t2+im*t3) - angle(2+3im)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = angle(t2-im*t3) - angle(2-3im)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = angle(-t2-im*t3) - angle(-2-3im)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = angle(-t2+im*t3) - angle(-2+3im)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = angle(ct2) - angle(2+2im)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = angle(-ct2) - angle(-2-2im)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = complex(ct3) - complex(3+3im)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = polar(ct2) - (abs(2+2im)+im*angle(2+2im))); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = polar(-ct1) - (abs(-1-im)+im*angle(-1-im))); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = rect(ct2) - (2*cos(2) + im*2*sin(2))); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = rect(-ct1) - (-1*cos(-1) + im*-1*sin(-1))); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = hypot(ct1, ct2, t3) - hypot(1+1im,2+2im,3)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = hypot(ct1, t2, ct3) - hypot(1+1im,2,3+3im)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = hypot(t1, ct2, ct3) - hypot(1,2+2im,3+3im)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = hypot(ct1, t2, t3) - hypot(1+1im,2,3)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = hypot(t1, ct2, t3) - hypot(1,2+2im,3)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = hypot(t1, t2, ct3) - hypot(1,2,3+3im)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = hypot(ct1,t2,3+3im) - hypot(1+1im,2,3+3im)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = hypot(t1, ct2, 3+3im) - hypot(1,2+2im,3+3im)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = hypot(ct1,2+2im,t3) - hypot(1+1im,2+2im,3)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = hypot(t1,2+2im,ct3) - hypot(1,2+2im,3+3im)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = hypot(1+1im,ct2,t3) - hypot(1+1im,2+2im,3)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = hypot(1+1im, t2, ct3) - hypot(1+1im,2,3+3im)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = hypot(t1,t2,3+3im) - hypot(1,2,3+3im)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = hypot(t1,2+2im,t3) - hypot(1,2+2im,3)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = hypot(1+1im,t2,t3) - hypot(1+1im,2,3)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = hypot(t1,2,3+3im) - hypot(1,2,3+3im)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = hypot(1,t2,3+3im) - hypot(1,2,3+3im)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = hypot(1+1im,2,t3) - hypot(1+1im,2,3)); norm(normTPS.(out))) < tol + + + d = Descriptor(1, 5) + t = TPS(use=d) + t[0] = 0.5; t[[1]] = 2; t[[2]] = 3; t[[3]] = 4; t[[4]] = 5; t[[5]] = 6 + tol = 1e-10 + out = ComplexTPS64() + @test @FastGTPSA(@.(normTPS(sin(t)^2+cos(t)^2 - 1))) < tol + @test @FastGTPSA(@.(normTPS(1/sin(t) - csc(t)))) < tol + @test @FastGTPSA(@.(normTPS(1/cos(t) - sec(t)))) < tol + @test @FastGTPSA(@.(normTPS(1/tan(t) - cot(t)))) < tol + @test @FastGTPSA(@.(normTPS(sin(t)/cos(t) - tan(t)))) < tol + @test @FastGTPSA(@.(normTPS(cos(2*t) - cos(t)^2 + sin(t)^2))) < tol + @test @FastGTPSA(@.(normTPS(sec(t)^2 - 1 - tan(t)^2))) < tol + @test @FastGTPSA(@.(normTPS(sin(t/2) - sqrt((1-cos(t))/2)))) < tol + @test @FastGTPSA(@.(normTPS(cos(t/2) - sqrt((1+cos(t))/2)))) < tol + @test @FastGTPSA(@.(normTPS(sqrt(t^2) - abs(t)))) < tol + @test @FastGTPSA(@.(normTPS(csc(t)^2 - cot(t)^2 - 1))) < tol + @test @FastGTPSA(@.(normTPS(exp(log(t)) - t))) < tol + @test @FastGTPSA(@.(normTPS(log(exp(t)) - t))) < tol + @test @FastGTPSA(@.(normTPS(log(exp(t)) - exp(log(t))))) < tol + @test @FastGTPSA(@.(normTPS(log(t^2) - 2*log(t)))) < tol + @test @FastGTPSA(@.(normTPS(5*log(t) - log(t^5)))) < tol + @test @FastGTPSA(@.(normTPS(t*log(5) - log(5^t)))) < tol + @test @FastGTPSA(@.(normTPS(sinc(t) - sin(pi*t)/(pi*t)))) < tol + @test @FastGTPSA(@.(normTPS(sinhc(t/pi) - sinh(t)/t))) < tol + @test @FastGTPSA(@.(normTPS(exp(im*t) - cos(t) - im*sin(t)))) < tol + @test @FastGTPSA(@.(normTPS(real(exp(im*t)) - cos(t)))) < tol + @test @FastGTPSA(@.(normTPS(imag(exp(im*t)) - sin(t)))) < tol + @test @FastGTPSA(@.(normTPS(sinh(t) - (exp(t) - exp(-t))/2))) < tol + @test @FastGTPSA(@.(normTPS(cosh(t) - (exp(t) + exp(-t))/2))) < tol + @test @FastGTPSA(@.(normTPS(tanh(t) - sinh(t)/cosh(t)))) < tol + @test @FastGTPSA(@.(normTPS(csch(t) - 1/sinh(t)))) < tol + @test @FastGTPSA(@.(normTPS(sech(t) - 1/cosh(t)))) < tol + @test @FastGTPSA(@.(normTPS(coth(t) - cosh(t)/sinh(t)))) < tol + @test @FastGTPSA(@.(normTPS(coth(t) - 1/tanh(t)))) < tol + @test @FastGTPSA(@.(normTPS(cosh(t)^2 - sinh(t)^2 - 1))) < tol + @test @FastGTPSA(@.(normTPS(1 - tanh(t)^2 - sech(t)^2))) < tol + @test @FastGTPSA(@.(normTPS(coth(t)^2 - 1 - csch(t)^2))) < tol + @test @FastGTPSA(@.(normTPS(asin(sin(t)) - t))) < tol + @test @FastGTPSA(@.(normTPS(acos(cos(t)) - t))) < tol + @test @FastGTPSA(@.(normTPS(atan(tan(t)) - t))) < tol + @test @FastGTPSA(@.(normTPS(acsc(1/t) - asin(t)))) < tol + @test @FastGTPSA(@.(normTPS(asec(1/t) - acos(t)))) < tol + @test @FastGTPSA(@.(normTPS(acot(1/t) - atan(t)))) < tol + @test @FastGTPSA(@.(normTPS(asinh(sinh(t)) - t))) < tol + @test @FastGTPSA(@.(normTPS(acosh(cosh(t)) - t))) < tol + @test @FastGTPSA(@.(normTPS(atanh(tanh(t)) - t))) < tol + @test @FastGTPSA(@.(normTPS(acsch(t) - asinh(1/t)))) < tol + @test @FastGTPSA(@.(normTPS(asech(t) - acosh(1/t)))) < tol + @test @FastGTPSA(@.(normTPS(acoth(1/t) - atanh(t)))) < tol + @test @FastGTPSA(@.(normTPS(asinc(t/pi) - asin(t)/t))) < tol + @test @FastGTPSA(@.(normTPS(asinhc(t/pi) - asinh(t)/t))) < tol + @test @FastGTPSA(@.(normTPS(erfc(t) - 1 + erf(t)))) < tol + @test @FastGTPSA(@.(normTPS(erf(-t) + erf(t)))) < tol + @test @FastGTPSA(@.(normTPS(angle(t)))) < tol + @test @FastGTPSA(@.(normTPS(complex(t) - t))) < tol + @test @FastGTPSA(@.(normTPS(complex(t,t) - (t+im*t)))) < tol + + @test (@FastGTPSA!(out = @. sin(t)^2+cos(t)^2 - 1); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. 1/sin(t) - csc(t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. 1/cos(t) - sec(t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. 1/tan(t) - cot(t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. sin(t)/cos(t) - tan(t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. cos(2*t) - cos(t)^2 + sin(t)^2); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. sec(t)^2 - 1 - tan(t)^2); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. sin(t/2) - sqrt((1-cos(t))/2)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. cos(t/2) - sqrt((1+cos(t))/2)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. sqrt(t^2) - abs(t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. csc(t)^2 - cot(t)^2 - 1); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. exp(log(t)) - t); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. log(exp(t)) - t); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. log(exp(t)) - exp(log(t))); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. log(t^2) - 2*log(t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. 5*log(t) - log(t^5)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. t*log(5) - log(5^t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. sinc(t) - sin(pi*t)/(pi*t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. sinhc(t/pi) - sinh(t)/t); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. exp(im*t) - cos(t) - im*sin(t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. real(exp(im*t)) - cos(t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. imag(exp(im*t)) - sin(t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. sinh(t) - (exp(t) - exp(-t))/2); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. cosh(t) - (exp(t) + exp(-t))/2); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. tanh(t) - sinh(t)/cosh(t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. csch(t) - 1/sinh(t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. sech(t) - 1/cosh(t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. coth(t) - cosh(t)/sinh(t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. coth(t) - 1/tanh(t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. cosh(t)^2 - sinh(t)^2 - 1); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. 1 - tanh(t)^2 - sech(t)^2); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. coth(t)^2 - 1 - csch(t)^2); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. asin(sin(t)) - t); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. acos(cos(t)) - t); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. atan(tan(t)) - t); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. acsc(1/t) - asin(t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. asec(1/t) - acos(t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. acot(1/t) - atan(t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. asinh(sinh(t)) - t); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. acosh(cosh(t)) - t); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. atanh(tanh(t)) - t); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. acsch(t) - asinh(1/t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. asech(t) - acosh(1/t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. acoth(1/t) - atanh(t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. asinc(t/pi) - asin(t)/t); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. asinhc(t/pi) - asinh(t)/t); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. erfc(t) - 1 + erf(t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. erf(-t) + erf(t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. angle(t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. complex(t) - t); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. complex(t,t) - (t+im*t)); normTPS(out)) < tol + + t = ComplexTPS64(t) + t[0] = 0.5+0.5im; t[[1]] = 2+2im; t[[2]] = 3+3im; t[[3]] = 4+4im; t[[4]] = 5+5im; t[[5]] = 6+6im + @test @FastGTPSA(@.(normTPS(sin(t)^2+cos(t)^2 - 1))) < tol + @test @FastGTPSA(@.(normTPS(1/sin(t) - csc(t)))) < tol + @test @FastGTPSA(@.(normTPS(1/cos(t) - sec(t)))) < tol + @test @FastGTPSA(@.(normTPS(1/tan(t) - cot(t)))) < tol + @test @FastGTPSA(@.(normTPS(sin(t)/cos(t) - tan(t)))) < tol + @test @FastGTPSA(@.(normTPS(cos(2*t) - cos(t)^2 + sin(t)^2))) < tol + @test @FastGTPSA(@.(normTPS(sec(t)^2 - 1 - tan(t)^2))) < tol + @test @FastGTPSA(@.(normTPS(sin(t/2) - sqrt((1-cos(t))/2)))) < tol + @test @FastGTPSA(@.(normTPS(cos(t/2) - sqrt((1+cos(t))/2)))) < tol + @test @FastGTPSA(@.(normTPS(sqrt(t^2) - t))) < tol + @test @FastGTPSA(@.(normTPS(csc(t)^2 - cot(t)^2 - 1))) < tol + @test @FastGTPSA(@.(normTPS(exp(log(t)) - t))) < tol + @test @FastGTPSA(@.(normTPS(log(exp(t)) - t))) < tol + @test @FastGTPSA(@.(normTPS(log(exp(t)) - exp(log(t))))) < tol + @test @FastGTPSA(@.(normTPS(log(t^2) - 2*log(t)))) < tol + @test @FastGTPSA(@.(normTPS(5*log(t) - log(t^5) - 2*pi*im))) < tol + @test @FastGTPSA(@.(normTPS(t*log(5) - log(5^t)))) < tol + @test @FastGTPSA(@.(normTPS(sinc(t/pi) - sin(t)/t))) < tol + @test @FastGTPSA(@.(normTPS(sinhc(t/pi) - sinh(t)/t))) < tol + @test @FastGTPSA(@.(normTPS(exp(im*t) - cos(t) - im*sin(t)))) < tol + @test @FastGTPSA(@.(normTPS(sinh(t) - (exp(t) - exp(-t))/2))) < tol + @test @FastGTPSA(@.(normTPS(cosh(t) - (exp(t) + exp(-t))/2))) < tol + @test @FastGTPSA(@.(normTPS(tanh(t) - sinh(t)/cosh(t)))) < tol + @test @FastGTPSA(@.(normTPS(csch(t) - 1/sinh(t)))) < tol + @test @FastGTPSA(@.(normTPS(sech(t) - 1/cosh(t)))) < tol + @test @FastGTPSA(@.(normTPS(coth(t) - cosh(t)/sinh(t)))) < tol + @test @FastGTPSA(@.(normTPS(coth(t) - 1/tanh(t)))) < tol + @test @FastGTPSA(@.(normTPS(cosh(t)^2 - sinh(t)^2 - 1))) < tol + @test @FastGTPSA(@.(normTPS(1 - tanh(t)^2 - sech(t)^2))) < tol + @test @FastGTPSA(@.(normTPS(coth(t)^2 - 1 - csch(t)^2))) < tol + @test @FastGTPSA(@.(normTPS(asin(sin(t)) - t))) < tol + @test @FastGTPSA(@.(normTPS(acos(cos(t)) - t))) < tol + @test @FastGTPSA(@.(normTPS(atan(tan(t)) - t))) < tol + @test @FastGTPSA(@.(normTPS(acsc(t) - asin(1/t)))) < tol + @test @FastGTPSA(@.(normTPS(asec(t) - acos(1/t)))) < tol + @test @FastGTPSA(@.(normTPS(acot(t) - atan(1/t)))) < tol + @test @FastGTPSA(@.(normTPS(asinh(sinh(t)) - t))) < tol + @test @FastGTPSA(@.(normTPS(acosh(cosh(t)) - t))) < tol + @test @FastGTPSA(@.(normTPS(atanh(tanh(t)) - t))) < tol + @test @FastGTPSA(@.(normTPS(acsch(t) - asinh(1/t)))) < tol + @test @FastGTPSA(@.(normTPS(asech(t) - acosh(1/t)))) < tol + @test @FastGTPSA(@.(normTPS(acoth(t) - atanh(1/t)))) < tol + @test @FastGTPSA(@.(normTPS(asinc(t/pi) - asin(t)/t))) < tol + @test @FastGTPSA(@.(normTPS(asinhc(t/pi) - asinh(t)/t))) < tol + @test @FastGTPSA(@.(normTPS(erfc(t) - 1 + erf(t)))) < tol + @test @FastGTPSA(@.(normTPS(erf(-t) + erf(t)))) < tol + @test @FastGTPSA(@.(normTPS(angle(t) - atan(imag(t),real(t))))) < tol + @test @FastGTPSA(@.(normTPS(complex(t) - t))) < tol + + + @test (@FastGTPSA!(out = @. sin(t)^2+cos(t)^2 - 1); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. 1/sin(t) - csc(t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. 1/cos(t) - sec(t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. 1/tan(t) - cot(t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. sin(t)/cos(t) - tan(t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. cos(2*t) - cos(t)^2 + sin(t)^2); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. sec(t)^2 - 1 - tan(t)^2); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. sin(t/2) - sqrt((1-cos(t))/2)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. cos(t/2) - sqrt((1+cos(t))/2)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. sqrt(t^2) - t); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. csc(t)^2 - cot(t)^2 - 1); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. exp(log(t)) - t); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. log(exp(t)) - t); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. log(exp(t)) - exp(log(t))); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. log(t^2) - 2*log(t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. 5*log(t) - log(t^5) - 2*pi*im); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. t*log(5) - log(5^t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. sinc(t/pi) - sin(t)/t); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. sinhc(t/pi) - sinh(t)/t); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. exp(im*t) - cos(t) - im*sin(t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. sinh(t) - (exp(t) - exp(-t))/2); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. cosh(t) - (exp(t) + exp(-t))/2); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. tanh(t) - sinh(t)/cosh(t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. csch(t) - 1/sinh(t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. sech(t) - 1/cosh(t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. coth(t) - cosh(t)/sinh(t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. coth(t) - 1/tanh(t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. cosh(t)^2 - sinh(t)^2 - 1); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. 1 - tanh(t)^2 - sech(t)^2); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. coth(t)^2 - 1 - csch(t)^2); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. asin(sin(t)) - t); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. acos(cos(t)) - t); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. atan(tan(t)) - t); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. acsc(t) - asin(1/t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. asec(t) - acos(1/t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. acot(t) - atan(1/t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. asinh(sinh(t)) - t); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. acosh(cosh(t)) - t); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. atanh(tanh(t)) - t); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. acsch(t) - asinh(1/t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. asech(t) - acosh(1/t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. acoth(t) - atanh(1/t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. asinc(t/pi) - asin(t)/t); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. asinhc(t/pi) - asinh(t)/t); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. erfc(t) - 1 + erf(t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. erf(-t) + erf(t)); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. angle(t) - atan(imag(t),real(t))); normTPS(out)) < tol + @test (@FastGTPSA!(out = @. complex(t) - t); normTPS(out)) < tol + + d = Descriptor(1, 5) + t = TPS(use=d) + t[0] = 0.5; t[[1]] = 2; t[[2]] = 3; t[[3]] = 4; t[[4]] = 5; t[[5]] = 6 + tol = 1e-10 + t = [t] + out = [out] + @test @FastGTPSA(norm(@.(normTPS(sin(t)^2+cos(t)^2 - 1)))) < tol + @test @FastGTPSA(norm(@.(normTPS(1/sin(t) - csc(t))))) < tol + @test @FastGTPSA(norm(@.(normTPS(1/cos(t) - sec(t))))) < tol + @test @FastGTPSA(norm(@.(normTPS(1/tan(t) - cot(t))))) < tol + @test @FastGTPSA(norm(@.(normTPS(sin(t)/cos(t) - tan(t))))) < tol + @test @FastGTPSA(norm(@.(normTPS(cos(2*t) - cos(t)^2 + sin(t)^2)))) < tol + @test @FastGTPSA(norm(@.(normTPS(sec(t)^2 - 1 - tan(t)^2)))) < tol + @test @FastGTPSA(norm(@.(normTPS(sin(t/2) - sqrt((1-cos(t))/2))))) < tol + @test @FastGTPSA(norm(@.(normTPS(cos(t/2) - sqrt((1+cos(t))/2))))) < tol + @test @FastGTPSA(norm(@.(normTPS(sqrt(t^2) - abs(t))))) < tol + @test @FastGTPSA(norm(@.(normTPS(csc(t)^2 - cot(t)^2 - 1)))) < tol + @test @FastGTPSA(norm(@.(normTPS(exp(log(t)) - t)))) < tol + @test @FastGTPSA(norm(@.(normTPS(log(exp(t)) - t)))) < tol + @test @FastGTPSA(norm(@.(normTPS(log(exp(t)) - exp(log(t)))))) < tol + @test @FastGTPSA(norm(@.(normTPS(log(t^2) - 2*log(t))))) < tol + @test @FastGTPSA(norm(@.(normTPS(5*log(t) - log(t^5))))) < tol + @test @FastGTPSA(norm(@.(normTPS(t*log(5) - log(5^t))))) < tol + @test @FastGTPSA(norm(@.(normTPS(sinc(t) - sin(pi*t)/(pi*t))))) < tol + @test @FastGTPSA(norm(@.(normTPS(sinhc(t/pi) - sinh(t)/t)))) < tol + @test @FastGTPSA(norm(@.(normTPS(exp(im*t) - cos(t) - im*sin(t))))) < tol + @test @FastGTPSA(norm(@.(normTPS(real(exp(im*t)) - cos(t))))) < tol + @test @FastGTPSA(norm(@.(normTPS(imag(exp(im*t)) - sin(t))))) < tol + @test @FastGTPSA(norm(@.(normTPS(sinh(t) - (exp(t) - exp(-t))/2)))) < tol + @test @FastGTPSA(norm(@.(normTPS(cosh(t) - (exp(t) + exp(-t))/2)))) < tol + @test @FastGTPSA(norm(@.(normTPS(tanh(t) - sinh(t)/cosh(t))))) < tol + @test @FastGTPSA(norm(@.(normTPS(csch(t) - 1/sinh(t))))) < tol + @test @FastGTPSA(norm(@.(normTPS(sech(t) - 1/cosh(t))))) < tol + @test @FastGTPSA(norm(@.(normTPS(coth(t) - cosh(t)/sinh(t))))) < tol + @test @FastGTPSA(norm(@.(normTPS(coth(t) - 1/tanh(t))))) < tol + @test @FastGTPSA(norm(@.(normTPS(cosh(t)^2 - sinh(t)^2 - 1)))) < tol + @test @FastGTPSA(norm(@.(normTPS(1 - tanh(t)^2 - sech(t)^2)))) < tol + @test @FastGTPSA(norm(@.(normTPS(coth(t)^2 - 1 - csch(t)^2)))) < tol + @test @FastGTPSA(norm(@.(normTPS(asin(sin(t)) - t)))) < tol + @test @FastGTPSA(norm(@.(normTPS(acos(cos(t)) - t)))) < tol + @test @FastGTPSA(norm(@.(normTPS(atan(tan(t)) - t)))) < tol + @test @FastGTPSA(norm(@.(normTPS(acsc(1/t) - asin(t))))) < tol + @test @FastGTPSA(norm(@.(normTPS(asec(1/t) - acos(t))))) < tol + @test @FastGTPSA(norm(@.(normTPS(acot(1/t) - atan(t))))) < tol + @test @FastGTPSA(norm(@.(normTPS(asinh(sinh(t)) - t)))) < tol + @test @FastGTPSA(norm(@.(normTPS(acosh(cosh(t)) - t)))) < tol + @test @FastGTPSA(norm(@.(normTPS(atanh(tanh(t)) - t)))) < tol + @test @FastGTPSA(norm(@.(normTPS(acsch(t) - asinh(1/t))))) < tol + @test @FastGTPSA(norm(@.(normTPS(asech(t) - acosh(1/t))))) < tol + @test @FastGTPSA(norm(@.(normTPS(acoth(1/t) - atanh(t))))) < tol + @test @FastGTPSA(norm(@.(normTPS(asinc(t/pi) - asin(t)/t)))) < tol + @test @FastGTPSA(norm(@.(normTPS(asinhc(t/pi) - asinh(t)/t)))) < tol + @test @FastGTPSA(norm(@.(normTPS(erfc(t) - 1 + erf(t))))) < tol + @test @FastGTPSA(norm(@.(normTPS(erf(-t) + erf(t))))) < tol + @test @FastGTPSA(norm(@.(normTPS(angle(t))))) < tol + @test @FastGTPSA(norm(@.(normTPS(complex(t) - t)))) < tol + @test @FastGTPSA(norm(@.(normTPS(complex(t,t) - (t+im*t))))) < tol + + @test (@FastGTPSA!(@. out = sin(t)^2+cos(t)^2 - 1); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = 1/sin(t) - csc(t)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = 1/cos(t) - sec(t)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = 1/tan(t) - cot(t)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = sin(t)/cos(t) - tan(t)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = cos(2*t) - cos(t)^2 + sin(t)^2); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = sec(t)^2 - 1 - tan(t)^2); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = sin(t/2) - sqrt((1-cos(t))/2)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = cos(t/2) - sqrt((1+cos(t))/2)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = sqrt(t^2) - abs(t)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = csc(t)^2 - cot(t)^2 - 1); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = exp(log(t)) - t); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = log(exp(t)) - t); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = log(exp(t)) - exp(log(t))); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = log(t^2) - 2*log(t)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = 5*log(t) - log(t^5)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = t*log(5) - log(5^t)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = sinc(t) - sin(pi*t)/(pi*t)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = sinhc(t/pi) - sinh(t)/t); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = exp(im*t) - cos(t) - im*sin(t)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = real(exp(im*t)) - cos(t)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = imag(exp(im*t)) - sin(t)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = sinh(t) - (exp(t) - exp(-t))/2); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = cosh(t) - (exp(t) + exp(-t))/2); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = tanh(t) - sinh(t)/cosh(t)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = csch(t) - 1/sinh(t)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = sech(t) - 1/cosh(t)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = coth(t) - cosh(t)/sinh(t)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = coth(t) - 1/tanh(t)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = cosh(t)^2 - sinh(t)^2 - 1); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = 1 - tanh(t)^2 - sech(t)^2); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = coth(t)^2 - 1 - csch(t)^2); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = asin(sin(t)) - t); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = acos(cos(t)) - t); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = atan(tan(t)) - t); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = acsc(1/t) - asin(t)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = asec(1/t) - acos(t)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = acot(1/t) - atan(t)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = asinh(sinh(t)) - t); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = acosh(cosh(t)) - t); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = atanh(tanh(t)) - t); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = acsch(t) - asinh(1/t)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = asech(t) - acosh(1/t)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = acoth(1/t) - atanh(t)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = asinc(t/pi) - asin(t)/t); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = asinhc(t/pi) - asinh(t)/t); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = erfc(t) - 1 + erf(t)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = erf(-t) + erf(t)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = angle(t)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = complex(t) - t); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = complex(t,t) - (t+im*t)); norm(normTPS.(out))) < tol + + t = ComplexTPS64(first(t)) + t[0] = 0.5+0.5im; t[[1]] = 2+2im; t[[2]] = 3+3im; t[[3]] = 4+4im; t[[4]] = 5+5im; t[[5]] = 6+6im + t = [t] + @test @FastGTPSA(norm(@.(normTPS(sin(t)^2+cos(t)^2 - 1)))) < tol + @test @FastGTPSA(norm(@.(normTPS(1/sin(t) - csc(t))))) < tol + @test @FastGTPSA(norm(@.(normTPS(1/cos(t) - sec(t))))) < tol + @test @FastGTPSA(norm(@.(normTPS(1/tan(t) - cot(t))))) < tol + @test @FastGTPSA(norm(@.(normTPS(sin(t)/cos(t) - tan(t))))) < tol + @test @FastGTPSA(norm(@.(normTPS(cos(2*t) - cos(t)^2 + sin(t)^2)))) < tol + @test @FastGTPSA(norm(@.(normTPS(sec(t)^2 - 1 - tan(t)^2)))) < tol + @test @FastGTPSA(norm(@.(normTPS(sin(t/2) - sqrt((1-cos(t))/2))))) < tol + @test @FastGTPSA(norm(@.(normTPS(cos(t/2) - sqrt((1+cos(t))/2))))) < tol + @test @FastGTPSA(norm(@.(normTPS(sqrt(t^2) - t)))) < tol + @test @FastGTPSA(norm(@.(normTPS(csc(t)^2 - cot(t)^2 - 1)))) < tol + @test @FastGTPSA(norm(@.(normTPS(exp(log(t)) - t)))) < tol + @test @FastGTPSA(norm(@.(normTPS(log(exp(t)) - t)))) < tol + @test @FastGTPSA(norm(@.(normTPS(log(exp(t)) - exp(log(t)))))) < tol + @test @FastGTPSA(norm(@.(normTPS(log(t^2) - 2*log(t))))) < tol + @test @FastGTPSA(norm(@.(normTPS(5*log(t) - log(t^5) - 2*pi*im)))) < tol + @test @FastGTPSA(norm(@.(normTPS(t*log(5) - log(5^t))))) < tol + @test @FastGTPSA(norm(@.(normTPS(sinc(t/pi) - sin(t)/t)))) < tol + @test @FastGTPSA(norm(@.(normTPS(sinhc(t/pi) - sinh(t)/t)))) < tol + @test @FastGTPSA(norm(@.(normTPS(exp(im*t) - cos(t) - im*sin(t))))) < tol + @test @FastGTPSA(norm(@.(normTPS(sinh(t) - (exp(t) - exp(-t))/2)))) < tol + @test @FastGTPSA(norm(@.(normTPS(cosh(t) - (exp(t) + exp(-t))/2)))) < tol + @test @FastGTPSA(norm(@.(normTPS(tanh(t) - sinh(t)/cosh(t))))) < tol + @test @FastGTPSA(norm(@.(normTPS(csch(t) - 1/sinh(t))))) < tol + @test @FastGTPSA(norm(@.(normTPS(sech(t) - 1/cosh(t))))) < tol + @test @FastGTPSA(norm(@.(normTPS(coth(t) - cosh(t)/sinh(t))))) < tol + @test @FastGTPSA(norm(@.(normTPS(coth(t) - 1/tanh(t))))) < tol + @test @FastGTPSA(norm(@.(normTPS(cosh(t)^2 - sinh(t)^2 - 1)))) < tol + @test @FastGTPSA(norm(@.(normTPS(1 - tanh(t)^2 - sech(t)^2)))) < tol + @test @FastGTPSA(norm(@.(normTPS(coth(t)^2 - 1 - csch(t)^2)))) < tol + @test @FastGTPSA(norm(@.(normTPS(asin(sin(t)) - t)))) < tol + @test @FastGTPSA(norm(@.(normTPS(acos(cos(t)) - t)))) < tol + @test @FastGTPSA(norm(@.(normTPS(atan(tan(t)) - t)))) < tol + @test @FastGTPSA(norm(@.(normTPS(acsc(t) - asin(1/t))))) < tol + @test @FastGTPSA(norm(@.(normTPS(asec(t) - acos(1/t))))) < tol + @test @FastGTPSA(norm(@.(normTPS(acot(t) - atan(1/t))))) < tol + @test @FastGTPSA(norm(@.(normTPS(asinh(sinh(t)) - t)))) < tol + @test @FastGTPSA(norm(@.(normTPS(acosh(cosh(t)) - t)))) < tol + @test @FastGTPSA(norm(@.(normTPS(atanh(tanh(t)) - t)))) < tol + @test @FastGTPSA(norm(@.(normTPS(acsch(t) - asinh(1/t))))) < tol + @test @FastGTPSA(norm(@.(normTPS(asech(t) - acosh(1/t))))) < tol + @test @FastGTPSA(norm(@.(normTPS(acoth(t) - atanh(1/t))))) < tol + @test @FastGTPSA(norm(@.(normTPS(asinc(t/pi) - asin(t)/t)))) < tol + @test @FastGTPSA(norm(@.(normTPS(asinhc(t/pi) - asinh(t)/t)))) < tol + @test @FastGTPSA(norm(@.(normTPS(erfc(t) - 1 + erf(t))))) < tol + @test @FastGTPSA(norm(@.(normTPS(erf(-t) + erf(t))))) < tol + @test @FastGTPSA(norm(@.(normTPS(angle(t) - atan(imag(t),real(t)))))) < tol + @test @FastGTPSA(norm(@.(normTPS(complex(t) - t)))) < tol + + + @test (@FastGTPSA!(@. out = sin(t)^2+cos(t)^2 - 1); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = 1/sin(t) - csc(t)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = 1/cos(t) - sec(t)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = 1/tan(t) - cot(t)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = sin(t)/cos(t) - tan(t)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = cos(2*t) - cos(t)^2 + sin(t)^2); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = sec(t)^2 - 1 - tan(t)^2); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = sin(t/2) - sqrt((1-cos(t))/2)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = cos(t/2) - sqrt((1+cos(t))/2)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = sqrt(t^2) - t); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = csc(t)^2 - cot(t)^2 - 1); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = exp(log(t)) - t); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = log(exp(t)) - t); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = log(exp(t)) - exp(log(t))); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = log(t^2) - 2*log(t)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = 5*log(t) - log(t^5) - 2*pi*im); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = t*log(5) - log(5^t)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = sinc(t/pi) - sin(t)/t); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = sinhc(t/pi) - sinh(t)/t); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = exp(im*t) - cos(t) - im*sin(t)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = sinh(t) - (exp(t) - exp(-t))/2); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = cosh(t) - (exp(t) + exp(-t))/2); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = tanh(t) - sinh(t)/cosh(t)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = csch(t) - 1/sinh(t)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = sech(t) - 1/cosh(t)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = coth(t) - cosh(t)/sinh(t)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = coth(t) - 1/tanh(t)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = cosh(t)^2 - sinh(t)^2 - 1); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = 1 - tanh(t)^2 - sech(t)^2); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = coth(t)^2 - 1 - csch(t)^2); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = asin(sin(t)) - t); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = acos(cos(t)) - t); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = atan(tan(t)) - t); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = acsc(t) - asin(1/t)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = asec(t) - acos(1/t)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = acot(t) - atan(1/t)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = asinh(sinh(t)) - t); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = acosh(cosh(t)) - t); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = atanh(tanh(t)) - t); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = acsch(t) - asinh(1/t)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = asech(t) - acosh(1/t)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = acoth(t) - atanh(1/t)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = asinc(t/pi) - asin(t)/t); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = asinhc(t/pi) - asinh(t)/t); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = erfc(t) - 1 + erf(t)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = erf(-t) + erf(t)); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = angle(t) - atan(imag(t),real(t))); norm(normTPS.(out))) < tol + @test (@FastGTPSA!(@. out = complex(t) - t); norm(normTPS.(out))) < tol + + # Make sure stack is 0: + @test GTPSA.checktemps() +end + +@testset "FastGTPSA - Block" begin + d = Descriptor(3, 7); x = vars(d); y= rand(3) + tol = 1e-14 + @FastGTPSA begin + t1 = x[1]^3*sin(x[2])/log(2+x[3])-exp(x[1]*x[2])*im; + t2 = x[1]^3*sin(x[2])/log(2+x[3])-exp(x[1]*x[2])*im; + z = y[1]^3*sin(y[2])/log(2+y[3])-exp(y[1]*y[2])*im; + end + + begin + tt1 = x[1]^3*sin(x[2])/log(2+x[3])-exp(x[1]*x[2])*im; + tt2 = x[1]^3*sin(x[2])/log(2+x[3])-exp(x[1]*x[2])*im; + tz = y[1]^3*sin(y[2])/log(2+y[3])-exp(y[1]*y[2])*im; + end + @test normTPS(tt1-t1) < tol + @test normTPS(tt2-t2) < tol + @test norm(tz-z) < tol + + y = TPS.(y) + z = rand(3) + w = rand(3) + @FastGTPSA begin + t1 = @. x+sin(y)/log(2+x)*exp(y)*im+7*y + t2 = @. y+sin(x)/log(2+y)*exp(x)*im+7*x + a = @. z+sin(w)/log(2+z)*exp(w)*im+7*w + end + + begin + tt1 = @. x+sin(y)/log(2+x)*exp(y)*im+7*y + tt2 = @. y+sin(x)/log(2+y)*exp(x)*im+7*x + ta = @. z+sin(w)/log(2+z)*exp(w)*im+7*w + end + @test norm(normTPS.(tt1-t1)) < tol + @test norm(normTPS.(tt2-t2)) < tol + @test norm(ta-a) < tol + + + d = Descriptor(1, 5) + t = TPS(use=d) + ct = ComplexTPS64(t) + # Set scalar part so both TPSs are 1 + t[0] = 1 + ct[0] = 1 + # Now do operators + t1 = t + t1[0] = 1 + t2 = zero(t1) + t2[0] = 2 + t3 = zero(t1) + t3[0] = 3 + + ct1 = ct + ct1[0] = 1 + 1im + ct2 = zero(ct1) + ct2[0] = 2 + 2im + ct3 = zero(ct1) + ct3[0] = 3 + 3im + + t = ComplexTPS64(t) + t[0] = 0.5+0.5im; t[[1]] = 2+2im; t[[2]] = 3+3im; t[[3]] = 4+4im; t[[4]] = 5+5im; t[[5]] = 6+6im + v = 0.5+0.5im + tol = 1e-10 + + x = zeros(ComplexTPS64,248) + + a1 = @allocations @FastGTPSA begin + y1 = t1 + t2 - t3 + y2 = t2 + t1 - t3 + y3 = t1 + 2 - t3 + y4 = 2 + t1 - t3 + y5 = t3 - t2 - t1 + y6 = t2 - t3 - -t1 + y7 = t3 - 2 - t1 + y8 = 2 - t3 - -t1 + y9 = t2 * t3 - 6 + y10 = t3 * t2 - 6 + y11 = t2 * 5 - 10 + y12 = 5 * t2 - 10 * t1 + y13 = t1 / t2 - 1/2 + y14 = t2 / t1 - 2 + y15 = 1 / t2 - 1/2 + y16 = t2 / 3 - 2/3 + y17 = t2 / t2 - t1 + y18 = t2 / t2 - 1 + y19 = t2 ^ t3 - 8 + y20 = t3 ^ t2 - 9 + y21 = t2 ^ 3 - 8 + y22 = t2 ^ (1/2) - sqrt(2) + y23 = t2 ^ (1/2) - sqrt(t2) + y24 = 2 ^ t3 - 8 + y25 = inv(t3) - 1/t3 + y26 = inv(t3) - 1/3 + y27 = ct1 + ct2 - ct3 + y28 = ct2 + ct1 - ct3 + y29 = ct1 + (2+2im) - ct3 + y30 = (2+2im) + ct1 - ct3 + y31 = ct3 - ct2 - ct1 + y32 = ct2 - ct3 - -ct1 + y33 = ct3 - (2+2im) - ct1 + y34 = (2+2im) - ct3 - -ct1 + y35 = ct2 * ct3 - (2+2im)*(3+3im) + y36 = ct3 * ct2 - (2+2im)*(3+3im) + y37 = ct2 * 5 - (10+10im) + y38 = 5 * ct2 - (10 * ct1) + y39 = ct1 / ct2 - (1+im)/(2+2im) + y40 = ct2 / ct1 - 2 + y41 = 1 / ct2 - 1/(2+2im) + y42 = ct2 / 3 - (2+2im)/3 + y43 = ct2 / ct2 - 1 + y44 = ct2 ^ ct3 - (2+2im)^(3+3im) + y45 = ct3 ^ ct2 - (3+3im)^(2+2im) + y46 = ct2 ^ 3 - (2+2im)^3 + y47 = ct2 ^ (1/2) - sqrt(2+2im) + y48 = ct2 ^ (1/2) - sqrt(ct2) + y49 = 2 ^ ct3 - 2^(3+3im) + y50 = inv(ct3) - 1/ct3 + y51 = inv(ct3) - 1/(3+3im) + y52 = t1 + ct2 - (1 + (2+2im)) + y53 = ct2 + t1 - (1 + (2+2im)) + y54 = t1 + (2+2im) - (1 + (2+2im)) + y55 = (2+2im) + t1 - (1 + (2+2im)) + y56 = t3 - ct2 - (3 - (2+2im)) + y57 = ct2 - t3 - ((2+2im) - 3) + y58 = t3 - (2+2im) - (3 - (2+2im)) + y59 = (2+2im) - t3 - ((2+2im) - 3) + y60 = t2 * ct3 - 2 * (3+3im) + y61 = ct3 * t2 - 2 * (3+3im) + y62 = t2 * (3+3im) - 2 * (3+3im) + y63 = (3+3im) * t2 - 2 * (3+3im) + y64 = t2 / ct3 - 2/(3+3im) + y65 = ct3 / t2 - (3+3im)/2 + y66 = t2 / (3+3im) - 2/(3+3im) + y67 = (3+3im) / t2 - (3+3im)/2 + y68 = t2 ^ ct3 - 2^(3+3im) + y69 = ct3 ^ t2 - (3+3im)^2 + y70 = t2 ^ (3+3im) - 2^(3+3im) + y71 = (3+3im)^t2 - (3+3im)^2 + y72 = sin(t)^2+cos(t)^2 - 1 + y73 = 1/sin(t) - csc(t) + y74 = 1/cos(t) - sec(t) + y75 = 1/tan(t) - cot(t) + y76 = sin(t)/cos(t) - tan(t) + y77 = cos(2*t) - cos(t)^2 + sin(t)^2 + y78 = sec(t)^2 - 1 - tan(t)^2 + y79 = sin(t/2) - sqrt((1-cos(t))/2) + y80 = cos(t/2) - sqrt((1+cos(t))/2) + y81 = sqrt(real(t)^2) - abs(real(t)) + y82 = csc(t)^2 - cot(t)^2 - 1 + y83 = exp(log(t)) - t + y84 = log(exp(t)) - t + y85 = log(exp(t)) - exp(log(t)) + y86 = log(t^2) - 2*log(t) + y87 = 5*log(real(t)) - log(real(t)^5) + y88 = t*log(5) - log(5^t) + y89 = sinc(t) - sin(pi*t)/(pi*t) + y90 = sinhc(t/pi) - sinh(t)/t + y91 = exp(im*t) - cos(t) - im*sin(t) + y92 = real(exp(im*real(t))) - cos(real(t)) + y93 = imag(exp(im*real(t))) - sin(real(t)) + y94 = sinh(t) - (exp(t) - exp(-t))/2 + y95 = cosh(t) - (exp(t) + exp(-t))/2 + y96 = tanh(t) - sinh(t)/cosh(t) + y97 = csch(t) - 1/sinh(t) + y98 = sech(t) - 1/cosh(t) + y99 = coth(t) - cosh(t)/sinh(t) + y100 = coth(t) - 1/tanh(t) + y101 = cosh(t)^2 - sinh(t)^2 - 1 + y102 = 1 - tanh(t)^2 - sech(t)^2 + y103 = coth(t)^2 - 1 - csch(t)^2 + y104 = asin(sin(t)) - t + y105 = acos(cos(t)) - t + y106 = atan(tan(t)) - t + y107 = acsc(1/t) - asin(t) + y108 = asec(1/t) - acos(t) + y109 = acot(1/t) - atan(t) + y110 = asinh(sinh(t)) - t + y111 = acosh(cosh(t)) - t + y112 = atanh(tanh(t)) - t + y113 = acsch(t) - asinh(1/t) + y114 = asech(t) - acosh(1/t) + y115 = acoth(1/t) - atanh(t) + y116 = asinc(t/pi) - asin(t)/t + y117 = asinhc(t/pi) - asinh(t)/t + y118 = erfc(t) - 1 + erf(t) + y119 = erf(-t) + erf(t) + y120 = angle(real(t)) + y121 = complex(t) - t + y122 = complex(real(t),real(t)) - (real(t)+im*real(t)) + y123 = sin(t)^2+cos(t)^2 - 1 + y124 = 1/sin(t) - csc(t) + y125 = 1/cos(t) - sec(t) + y126 = 1/tan(t) - cot(t) + y127 = sin(t)/cos(t) - tan(t) + y128 = cos(2*t) - cos(t)^2 + sin(t)^2 + y129 = sec(t)^2 - 1 - tan(t)^2 + y130 = sin(t/2) - sqrt((1-cos(t))/2) + y131 = cos(t/2) - sqrt((1+cos(t))/2) + y132 = sqrt(t^2) - t + y133 = csc(t)^2 - cot(t)^2 - 1 + y134 = exp(log(t)) - t + y135 = log(exp(t)) - t + y136 = log(exp(t)) - exp(log(t)) + y137 = log(t^2) - 2*log(t) + y138 = 5*log(t) - log(t^5) - 2*pi*im + y139 = t*log(5) - log(5^t) + y140 = sinc(t/pi) - sin(t)/t + y141 = sinhc(t/pi) - sinh(t)/t + y142 = exp(im*t) - cos(t) - im*sin(t) + y143 = sinh(t) - (exp(t) - exp(-t))/2 + y144 = cosh(t) - (exp(t) + exp(-t))/2 + y145 = tanh(t) - sinh(t)/cosh(t) + y146 = csch(t) - 1/sinh(t) + y147 = sech(t) - 1/cosh(t) + y148 = coth(t) - cosh(t)/sinh(t) + y149 = coth(t) - 1/tanh(t) + y150 = cosh(t)^2 - sinh(t)^2 - 1 + y151 = 1 - tanh(t)^2 - sech(t)^2 + y152 = coth(t)^2 - 1 - csch(t)^2 + y153 = asin(sin(t)) - t + y154 = acos(cos(t)) - t + y155 = atan(tan(t)) - t + y156 = acsc(t) - asin(1/t) + y157 = asec(t) - acos(1/t) + y158 = acot(t) - atan(1/t) + y159 = asinh(sinh(t)) - t + y160 = acosh(cosh(t)) - t + y161 = atanh(tanh(t)) - t + y162 = acsch(t) - asinh(1/t) + y163 = asech(t) - acosh(1/t) + y164 = acoth(t) - atanh(1/t) + y165 = asinc(t/pi) - asin(t)/t + y166 = asinhc(t/pi) - asinh(t)/t + y167 = erfc(t) - 1 + erf(t) + y168 = erf(-t) + erf(t) + y169 = angle(t) - atan(imag(t),real(t)) + y170 = complex(t) - t + end + + @test VERSION < v"1.10" || a1 == 170*2 + a2 = @allocations @FastGTPSA! begin + x[1 ]= t1 + t2 - t3 + x[2 ]= t2 + t1 - t3 + x[3 ]= t1 + 2 - t3 + x[4 ]= 2 + t1 - t3 + x[5 ]= t3 - t2 - t1 + x[6 ]= t2 - t3 - -t1 + x[7 ]= t3 - 2 - t1 + x[8 ]= 2 - t3 - -t1 + x[9 ]=t2 * t3 - 6 + x[10 ]= t3 * t2 - 6 + x[11 ]= t2 * 5 - 10 + x[12 ]= 5 * t2 - 10 * t1 + x[13 ]= t1 / t2 - 1/2 + x[14 ]= t2 / t1 - 2 + x[15 ]= 1 / t2 - 1/2 + x[16 ]= t2 / 3 - 2/3 + x[17 ]= t2 / t2 - t1 + x[18 ]= t2 / t2 - 1 + x[19 ]= t2 ^ t3 - 8 + x[20 ]= t3 ^ t2 - 9 + x[21 ]= t2 ^ 3 - 8 + x[22 ]= t2 ^ (1/2) - sqrt(2) + x[23 ]= t2 ^ (1/2) - sqrt(t2) + x[24 ]= 2 ^ t3 - 8 + x[25 ]= inv(t3) - 1/t3 + x[26 ]= inv(t3) - 1/3 + x[27 ]= ct1 + ct2 - ct3 + x[28 ]= ct2 + ct1 - ct3 + x[29 ]= ct1 + (2+2im) - ct3 + x[30 ]= (2+2im) + ct1 - ct3 + x[31 ]= ct3 - ct2 - ct1 + x[32 ]= ct2 - ct3 - -ct1 + x[33 ]= ct3 - (2+2im) - ct1 + x[34 ]= (2+2im) - ct3 - -ct1 + x[35 ]= ct2 * ct3 - (2+2im)*(3+3im) + x[36 ]= ct3 * ct2 - (2+2im)*(3+3im) + x[37 ]= ct2 * 5 - (10+10im) + x[38 ]= 5 * ct2 - (10 * ct1) + x[39 ]= ct1 / ct2 - (1+im)/(2+2im) + x[40 ]= ct2 / ct1 - 2 + x[41 ]= 1 / ct2 - 1/(2+2im) + x[42 ]= ct2 / 3 - (2+2im)/3 + x[43 ]= ct2 / ct2 - 1 + x[44 ]= ct2 ^ ct3 - (2+2im)^(3+3im) + x[45 ]= ct3 ^ ct2 - (3+3im)^(2+2im) + x[46 ]= ct2 ^ 3 - (2+2im)^3 + x[47 ]= ct2 ^ (1/2) - sqrt(2+2im) + x[48 ]= ct2 ^ (1/2) - sqrt(ct2) + x[49 ]= 2 ^ ct3 - 2^(3+3im) + x[50 ]= inv(ct3) - 1/ct3 + x[51 ]= inv(ct3) - 1/(3+3im) + x[52 ]= t1 + ct2 - (1 + (2+2im)) + x[53 ]= ct2 + t1 - (1 + (2+2im)) + x[54 ]= t1 + (2+2im) - (1 + (2+2im)) + x[55 ]= (2+2im) + t1 - (1 + (2+2im)) + x[56 ]= t3 - ct2 - (3 - (2+2im)) + x[57 ]= ct2 - t3 - ((2+2im) - 3) + x[58 ]= t3 - (2+2im) - (3 - (2+2im)) + x[59 ]= (2+2im) - t3 - ((2+2im) - 3) + x[60 ]= t2 * ct3 - 2 * (3+3im) + x[61 ]= ct3 * t2 - 2 * (3+3im) + x[62 ]= t2 * (3+3im) - 2 * (3+3im) + x[63 ]= (3+3im) * t2 - 2 * (3+3im) + x[64 ]= t2 / ct3 - 2/(3+3im) + x[65 ]= ct3 / t2 - (3+3im)/2 + x[66 ]= t2 / (3+3im) - 2/(3+3im) + x[67 ]= (3+3im) / t2 - (3+3im)/2 + x[68 ]= t2 ^ ct3 - 2^(3+3im) + x[69 ]= ct3 ^ t2 - (3+3im)^2 + x[70 ]= t2 ^ (3+3im) - 2^(3+3im) + x[71 ]= (3+3im)^t2 - (3+3im)^2 + x[72 ]= sin(t)^2+cos(t)^2 - 1 + x[73 ]= 1/sin(t) - csc(t) + x[74 ]= 1/cos(t) - sec(t) + x[75 ]= 1/tan(t) - cot(t) + x[76 ]= sin(t)/cos(t) - tan(t) + x[77 ]= cos(2*t) - cos(t)^2 + sin(t)^2 + x[78 ]= sec(t)^2 - 1 - tan(t)^2 + x[79 ]= sin(t/2) - sqrt((1-cos(t))/2) + x[80 ]= cos(t/2) - sqrt((1+cos(t))/2) + x[81 ]= sqrt(real(t)^2) - abs(real(t)) + x[82 ]= csc(t)^2 - cot(t)^2 - 1 + x[83 ]= exp(log(t)) - t + x[84 ]= log(exp(t)) - t + x[85 ]= log(exp(t)) - exp(log(t)) + x[86 ]= log(t^2) - 2*log(t) + x[87 ]= 5*log(real(t)) - log(real(t)^5) + x[88 ]= t*log(5) - log(5^t) + x[89 ]= sinc(t) - sin(pi*t)/(pi*t) + x[90 ]= sinhc(t/pi) - sinh(t)/t + x[91 ]= exp(im*t) - cos(t) - im*sin(t) + x[92 ]= real(exp(im*real(t))) - cos(real(t)) + x[93 ]= imag(exp(im*real(t))) - sin(real(t)) + x[94 ]= sinh(t) - (exp(t) - exp(-t))/2 + x[95 ]= cosh(t) - (exp(t) + exp(-t))/2 + x[96 ]= tanh(t) - sinh(t)/cosh(t) + x[97 ]= csch(t) - 1/sinh(t) + x[98 ]= sech(t) - 1/cosh(t) + x[99 ]= coth(t) - cosh(t)/sinh(t) + x[100] = coth(t) - 1/tanh(t) + x[101] = cosh(t)^2 - sinh(t)^2 - 1 + x[102] = 1 - tanh(t)^2 - sech(t)^2 + x[103] = coth(t)^2 - 1 - csch(t)^2 + x[104] = asin(sin(t)) - t + x[105] = acos(cos(t)) - t + x[106] = atan(tan(t)) - t + x[107] = acsc(1/t) - asin(t) + x[108] = asec(1/t) - acos(t) + x[109] = acot(1/t) - atan(t) + x[110] = asinh(sinh(t)) - t + x[111] = acosh(cosh(t)) - t + x[112] = atanh(tanh(t)) - t + x[113] = acsch(t) - asinh(1/t) + x[114] = asech(t) - acosh(1/t) + x[115] = acoth(1/t) - atanh(t) + x[116] = asinc(t/pi) - asin(t)/t + x[117] = asinhc(t/pi) - asinh(t)/t + x[118] = erfc(t) - 1 + erf(t) + x[119] = erf(-t) + erf(t) + x[120] = angle(real(t)) + x[121] = complex(t) - t + x[122] = complex(real(t),real(t)) - (real(t)+im*real(t)) + x[123] = sin(t)^2+cos(t)^2 - 1 + x[124] = 1/sin(t) - csc(t) + x[125] = 1/cos(t) - sec(t) + x[126] = 1/tan(t) - cot(t) + x[127] = sin(t)/cos(t) - tan(t) + x[128] = cos(2*t) - cos(t)^2 + sin(t)^2 + x[129] = sec(t)^2 - 1 - tan(t)^2 + x[130] = sin(t/2) - sqrt((1-cos(t))/2) + x[131] = cos(t/2) - sqrt((1+cos(t))/2) + x[132] = sqrt(t^2) - t + x[133] = csc(t)^2 - cot(t)^2 - 1 + x[134] = exp(log(t)) - t + x[135] = log(exp(t)) - t + x[136] = log(exp(t)) - exp(log(t)) + x[137] = log(t^2) - 2*log(t) + x[138] = 5*log(t) - log(t^5) - 2*pi*im + x[139] = t*log(5) - log(5^t) + x[140] = sinc(t/pi) - sin(t)/t + x[141] = sinhc(t/pi) - sinh(t)/t + x[142] = exp(im*t) - cos(t) - im*sin(t) + x[143] = sinh(t) - (exp(t) - exp(-t))/2 + x[144] = cosh(t) - (exp(t) + exp(-t))/2 + x[145] = tanh(t) - sinh(t)/cosh(t) + x[146] = csch(t) - 1/sinh(t) + x[147] = sech(t) - 1/cosh(t) + x[148] = coth(t) - cosh(t)/sinh(t) + x[149] = coth(t) - 1/tanh(t) + x[150] = cosh(t)^2 - sinh(t)^2 - 1 + x[151] = 1 - tanh(t)^2 - sech(t)^2 + x[152] = coth(t)^2 - 1 - csch(t)^2 + x[153] = asin(sin(t)) - t + x[154] = acos(cos(t)) - t + x[155] = atan(tan(t)) - t + x[156] = acsc(t) - asin(1/t) + x[157] = asec(t) - acos(1/t) + x[158] = acot(t) - atan(1/t) + x[159] = asinh(sinh(t)) - t + x[160] = acosh(cosh(t)) - t + x[161] = atanh(tanh(t)) - t + x[162] = acsch(t) - asinh(1/t) + x[163] = asech(t) - acosh(1/t) + x[164] = acoth(t) - atanh(1/t) + x[165] = asinc(t/pi) - asin(t)/t + x[166] = asinhc(t/pi) - asinh(t)/t + x[167] = erfc(t) - 1 + erf(t) + x[168] = erf(-t) + erf(t) + x[169] = angle(t) - atan(imag(t),real(t)) + x[170] = complex(t) - t + end + @test VERSION < v"1.10" || a2 == 0 + + t = ComplexTPS64() + t[0] = 0.5+0.5im + v = 0.5+0.5im + a1 = @allocations @FastGTPSA begin + y171 = sqrt(t) - sqrt(v) + y172 = exp(t) - exp(v) + y173 = log(t) - log(v) + y174 = sin(t) - sin(v) + y175 = cos(t) - cos(v) + y176 = tan(t) - tan(v) + y177 = csc(t) - csc(v) + y178 = sec(t) - sec(v) + y179 = cot(t) - cot(v) + y180 = sinc(t) - sinc(v) + y181 = sinh(t) - sinh(v) + y182 = cosh(t) - cosh(v) + y183 = tanh(t) - tanh(v) + y184 = csch(t) - csch(v) + y185 = sech(t) - sech(v) + y186 = coth(t) - coth(v) + y187 = asin(t) - asin(v) + y188 = acos(t) - acos(v) + y189 = atan(t) - atan(v) + y190 = acsc(t) - acsc(v) + y191 = asec(t) - asec(v) + y192 = acot(t) - acot(v) + y193 = asinh(t) - asinh(v) + y194 = acosh(t) - acosh(v) + y195 = atanh(t) - atanh(v) + y196 = acsch(t) - acsch(v) + y197 = asech(t) - asech(v) + y198 = acoth(t) - acoth(v) + y199 = asinc(t/pi) - asin(v)/v + y200 = asinhc(t/pi) - asinh(v)/v + y201 = zero(t) - zero(v) + y202 = real(t) - real(v) + y203 = imag(t) - imag(v) + y204 = conj(t) - conj(v) + y205 = sinhc(t/pi) - sinh(v)/v + y206 = erf(t) - erf(v) + y207 = erfc(t) - erfc(v) + y208 = -im*erf(t*im) - erfi(v) + y219 = angle(t2+im*t3) - angle(2+3im) + y220 = angle(t2-im*t3) - angle(2-3im) + y221 = angle(-t2-im*t3) - angle(-2-3im) + y222 = angle(-t2+im*t3) - angle(-2+3im) + y223 = angle(ct2) - angle(2+2im) + y224 = angle(-ct2) - angle(-2-2im) + y225 = complex(ct3) - complex(3+3im) + y226 = polar(ct2) - (abs(2+2im)+im*angle(2+2im)) + y227 = polar(-ct1) - (abs(-1-im)+im*angle(-1-im)) + y228 = rect(ct2) - (2*cos(2) + im*2*sin(2)) + y229 = rect(-ct1) - (-1*cos(-1) + im*-1*sin(-1)) + y248 = abs(-t) - abs(-v) + end + @FastGTPSA begin + y209 = hypot(ct2,ct3) - hypot(2+2im,3+3im) + y210 = hypot(2+2im,ct3) - hypot(2+2im,3+3im) + y211 = hypot(ct2,3+3im) - hypot(2+2im,3+3im) + y212 = hypot(ct1,ct2,ct3) - hypot(1+1im,2+2im,3+3im) + y213 = hypot(1+1im, ct2, ct3) - hypot(1+1im,2+2im,3+3im) + y214 = hypot(ct1, 2+2im, ct3) - hypot(1+1im,2+2im,3+3im) + y215 = hypot(ct1, ct2, 3+3im) - hypot(1+1im,2+2im,3+3im) + y216 = hypot(1+1im, 2+2im, ct3) - hypot(1+1im,2+2im,3+3im) + y217 = hypot(1+1im, ct2, 3+3im) - hypot(1+1im,2+2im,3+3im) + y218 = hypot(ct1, 2+2im, 3+3im) - hypot(1+1im,2+2im,3+3im) + y230 = hypot(ct1, ct2, t3) - hypot(1+1im,2+2im,3) + y231 = hypot(ct1, t2, ct3) - hypot(1+1im,2,3+3im) + y232 = hypot(t1, ct2, ct3) - hypot(1,2+2im,3+3im) + y233 = hypot(ct1, t2, t3) - hypot(1+1im,2,3) + y234 = hypot(t1, ct2, t3) - hypot(1,2+2im,3) + y235 = hypot(t1, t2, ct3) - hypot(1,2,3+3im) + y236 = hypot(ct1,t2,3+3im) - hypot(1+1im,2,3+3im) + y237 = hypot(t1, ct2, 3+3im) - hypot(1,2+2im,3+3im) + y238 = hypot(ct1,2+2im,t3) - hypot(1+1im,2+2im,3) + y239 = hypot(t1,2+2im,ct3) - hypot(1,2+2im,3+3im) + y240 = hypot(1+1im,ct2,t3) - hypot(1+1im,2+2im,3) + y241 = hypot(1+1im, t2, ct3) - hypot(1+1im,2,3+3im) + y242 = hypot(t1,t2,3+3im) - hypot(1,2,3+3im) + y243 = hypot(t1,2+2im,t3) - hypot(1,2+2im,3) + y244 = hypot(1+1im,t2,t3) - hypot(1+1im,2,3) + y245 = hypot(t1,2,3+3im) - hypot(1,2,3+3im) + y246 = hypot(1,t2,3+3im) - hypot(1,2,3+3im) + y247 = hypot(1+1im,2,t3) - hypot(1+1im,2,3) + end + @test VERSION < v"1.10" || a1 == 50*2 + + a2 = @allocations @FastGTPSA! begin + x[171] = sqrt(t) - sqrt(v) + x[172] = exp(t) - exp(v) + x[173] = log(t) - log(v) + x[174] = sin(t) - sin(v) + x[175] = cos(t) - cos(v) + x[176] = tan(t) - tan(v) + x[177] = csc(t) - csc(v) + x[178] = sec(t) - sec(v) + x[179] = cot(t) - cot(v) + x[180] = sinc(t) - sinc(v) + x[181] = sinh(t) - sinh(v) + x[182] = cosh(t) - cosh(v) + x[183] = tanh(t) - tanh(v) + x[184] = csch(t) - csch(v) + x[185] = sech(t) - sech(v) + x[186] = coth(t) - coth(v) + x[187] = asin(t) - asin(v) + x[188] = acos(t) - acos(v) + x[189] = atan(t) - atan(v) + x[190] = acsc(t) - acsc(v) + x[191] = asec(t) - asec(v) + x[192] = acot(t) - acot(v) + x[193] = asinh(t) - asinh(v) + x[194] = acosh(t) - acosh(v) + x[195] = atanh(t) - atanh(v) + x[196] = acsch(t) - acsch(v) + x[197] = asech(t) - asech(v) + x[198] = acoth(t) - acoth(v) + x[199] = asinc(t/pi) - asin(v)/v + x[200] = asinhc(t/pi) - asinh(v)/v + x[201] = zero(t) - zero(v) + x[202] = real(t) - real(v) + x[203] = imag(t) - imag(v) + x[204] = conj(t) - conj(v) + x[205] = sinhc(t/pi) - sinh(v)/v + x[206] = erf(t) - erf(v) + x[207] = erfc(t) - erfc(v) + x[208] = -im*erf(t*im) - erfi(v) + x[219] = angle(t2+im*t3) - angle(2+3im) + x[220] = angle(t2-im*t3) - angle(2-3im) + x[221] = angle(-t2-im*t3) - angle(-2-3im) + x[222] = angle(-t2+im*t3) - angle(-2+3im) + x[223] = angle(ct2) - angle(2+2im) + x[224] = angle(-ct2) - angle(-2-2im) + x[225] = complex(ct3) - complex(3+3im) + x[226] = polar(ct2) - (abs(2+2im)+im*angle(2+2im)) + x[227] = polar(-ct1) - (abs(-1-im)+im*angle(-1-im)) + x[228] = rect(ct2) - (2*cos(2) + im*2*sin(2)) + x[229] = rect(-ct1) - (-1*cos(-1) + im*-1*sin(-1)) + x[248] = abs(-t) - abs(-v) + end + + @FastGTPSA! begin + x[209] = hypot(ct2,ct3) - hypot(2+2im,3+3im) + x[210] = hypot(2+2im,ct3) - hypot(2+2im,3+3im) + x[211] = hypot(ct2,3+3im) - hypot(2+2im,3+3im) + x[212] = hypot(ct1,ct2,ct3) - hypot(1+1im,2+2im,3+3im) + x[213] = hypot(1+1im, ct2, ct3) - hypot(1+1im,2+2im,3+3im) + x[214] = hypot(ct1, 2+2im, ct3) - hypot(1+1im,2+2im,3+3im) + x[215] = hypot(ct1, ct2, 3+3im) - hypot(1+1im,2+2im,3+3im) + x[216] = hypot(1+1im, 2+2im, ct3) - hypot(1+1im,2+2im,3+3im) + x[217] = hypot(1+1im, ct2, 3+3im) - hypot(1+1im,2+2im,3+3im) + x[218] = hypot(ct1, 2+2im, 3+3im) - hypot(1+1im,2+2im,3+3im) + x[230] = hypot(ct1, ct2, t3) - hypot(1+1im,2+2im,3) + x[231] = hypot(ct1, t2, ct3) - hypot(1+1im,2,3+3im) + x[232] = hypot(t1, ct2, ct3) - hypot(1,2+2im,3+3im) + x[233] = hypot(ct1, t2, t3) - hypot(1+1im,2,3) + x[234] = hypot(t1, ct2, t3) - hypot(1,2+2im,3) + x[235] = hypot(t1, t2, ct3) - hypot(1,2,3+3im) + x[236] = hypot(ct1,t2,3+3im) - hypot(1+1im,2,3+3im) + x[237] = hypot(t1, ct2, 3+3im) - hypot(1,2+2im,3+3im) + x[238] = hypot(ct1,2+2im,t3) - hypot(1+1im,2+2im,3) + x[239] = hypot(t1,2+2im,ct3) - hypot(1,2+2im,3+3im) + x[240] = hypot(1+1im,ct2,t3) - hypot(1+1im,2+2im,3) + x[241] = hypot(1+1im, t2, ct3) - hypot(1+1im,2,3+3im) + x[242] = hypot(t1,t2,3+3im) - hypot(1,2,3+3im) + x[243] = hypot(t1,2+2im,t3) - hypot(1,2+2im,3) + x[244] = hypot(1+1im,t2,t3) - hypot(1+1im,2,3) + x[245] = hypot(t1,2,3+3im) - hypot(1,2,3+3im) + x[246] = hypot(1,t2,3+3im) - hypot(1,2,3+3im) + x[247] = hypot(1+1im,2,t3) - hypot(1+1im,2,3) + end + + @test VERSION < v"1.10" || a2 == 0 + + @test normTPS(y1 ) < tol + @test normTPS(y2 ) < tol + @test normTPS(y3 ) < tol + @test normTPS(y4 ) < tol + @test normTPS(y5 ) < tol + @test normTPS(y6 ) < tol + @test normTPS(y7 ) < tol + @test normTPS(y8 ) < tol + @test normTPS(y9 ) < tol + @test normTPS(y10) < tol + @test normTPS(y11) < tol + @test normTPS(y12) < tol + @test normTPS(y13) < tol + @test normTPS(y14) < tol + @test normTPS(y15) < tol + @test normTPS(y16) < tol + @test normTPS(y17) < tol + @test normTPS(y18) < tol + @test normTPS(y19) < tol + @test normTPS(y20) < tol + @test normTPS(y21) < tol + @test normTPS(y22) < tol + @test normTPS(y23) < tol + @test normTPS(y24) < tol + @test normTPS(y25) < tol + @test normTPS(y26) < tol + @test normTPS(y27) < tol + @test normTPS(y28) < tol + @test normTPS(y29) < tol + @test normTPS(y30) < tol + @test normTPS(y31) < tol + @test normTPS(y32) < tol + @test normTPS(y33) < tol + @test normTPS(y34) < tol + @test normTPS(y35) < tol + @test normTPS(y36) < tol + @test normTPS(y37) < tol + @test normTPS(y38) < tol + @test normTPS(y39) < tol + @test normTPS(y40) < tol + @test normTPS(y41) < tol + @test normTPS(y42) < tol + @test normTPS(y43) < tol + @test normTPS(y44) < tol + @test normTPS(y45) < tol + @test normTPS(y46) < tol + @test normTPS(y47) < tol + @test normTPS(y48) < tol + @test normTPS(y49) < tol + @test normTPS(y50) < tol + @test normTPS(y51) < tol + @test normTPS(y52) < tol + @test normTPS(y53) < tol + @test normTPS(y54) < tol + @test normTPS(y55) < tol + @test normTPS(y56) < tol + @test normTPS(y57) < tol + @test normTPS(y58) < tol + @test normTPS(y59) < tol + @test normTPS(y60) < tol + @test normTPS(y61) < tol + @test normTPS(y62) < tol + @test normTPS(y63) < tol + @test normTPS(y64) < tol + @test normTPS(y65) < tol + @test normTPS(y66) < tol + @test normTPS(y67) < tol + @test normTPS(y68) < tol + @test normTPS(y69) < tol + @test normTPS(y70) < tol + @test normTPS(y71) < tol + @test normTPS(y72 ) < tol + @test normTPS(y73 ) < tol + @test normTPS(y74 ) < tol + @test normTPS(y75 ) < tol + @test normTPS(y76 ) < tol + @test normTPS(y77 ) < tol + @test normTPS(y78 ) < tol + @test normTPS(y79 ) < tol + @test normTPS(y80 ) < tol + @test normTPS(y81 ) < tol + @test normTPS(y82 ) < tol + @test normTPS(y83 ) < tol + @test normTPS(y84 ) < tol + @test normTPS(y85 ) < tol + @test normTPS(y86 ) < tol + @test normTPS(y87 ) < tol + @test normTPS(y88 ) < tol + @test normTPS(y89 ) < tol + @test normTPS(y90 ) < tol + @test normTPS(y91 ) < tol + @test normTPS(y92 ) < tol + @test normTPS(y93 ) < tol + @test normTPS(y94 ) < tol + @test normTPS(y95 ) < tol + @test normTPS(y96 ) < tol + @test normTPS(y97 ) < tol + @test normTPS(y98 ) < tol + @test normTPS(y99 ) < tol + @test normTPS(y100) < tol + @test normTPS(y101) < tol + @test normTPS(y102) < tol + @test normTPS(y103) < tol + @test normTPS(y104) < tol + @test normTPS(y105) < tol + @test normTPS(y106) < tol + @test normTPS(y107) < tol + @test normTPS(y108) < tol + @test normTPS(y109) < tol + @test normTPS(y110) < tol + @test normTPS(y111) < tol + @test normTPS(y112) < tol + @test normTPS(y113) < tol + @test normTPS(y114) < tol + @test normTPS(y115) < tol + @test normTPS(y116) < tol + @test normTPS(y117) < tol + @test normTPS(y118) < tol + @test normTPS(y119) < tol + @test normTPS(y120) < tol + @test normTPS(y121) < tol + @test normTPS(y122) < tol + @test normTPS(y123) < tol + @test normTPS(y124) < tol + @test normTPS(y125) < tol + @test normTPS(y126) < tol + @test normTPS(y127) < tol + @test normTPS(y128) < tol + @test normTPS(y129) < tol + @test normTPS(y130) < tol + @test normTPS(y131) < tol + @test normTPS(y132) < tol + @test normTPS(y133) < tol + @test normTPS(y134) < tol + @test normTPS(y135) < tol + @test normTPS(y136) < tol + @test normTPS(y137) < tol + @test normTPS(y138) < tol + @test normTPS(y139) < tol + @test normTPS(y140) < tol + @test normTPS(y141) < tol + @test normTPS(y142) < tol + @test normTPS(y143) < tol + @test normTPS(y144) < tol + @test normTPS(y145) < tol + @test normTPS(y146) < tol + @test normTPS(y147) < tol + @test normTPS(y148) < tol + @test normTPS(y149) < tol + @test normTPS(y150) < tol + @test normTPS(y151) < tol + @test normTPS(y152) < tol + @test normTPS(y153) < tol + @test normTPS(y154) < tol + @test normTPS(y155) < tol + @test normTPS(y156) < tol + @test normTPS(y157) < tol + @test normTPS(y158) < tol + @test normTPS(y159) < tol + @test normTPS(y160) < tol + @test normTPS(y161) < tol + @test normTPS(y162) < tol + @test normTPS(y163) < tol + @test normTPS(y164) < tol + @test normTPS(y165) < tol + @test normTPS(y166) < tol + @test normTPS(y167) < tol + @test normTPS(y168) < tol + @test normTPS(y169) < tol + @test normTPS(y170) < tol + @test normTPS(y171) < tol + @test normTPS(y172) < tol + @test normTPS(y173) < tol + @test normTPS(y174) < tol + @test normTPS(y175) < tol + @test normTPS(y176) < tol + @test normTPS(y177) < tol + @test normTPS(y178) < tol + @test normTPS(y179) < tol + @test normTPS(y180) < tol + @test normTPS(y181) < tol + @test normTPS(y182) < tol + @test normTPS(y183) < tol + @test normTPS(y184) < tol + @test normTPS(y185) < tol + @test normTPS(y186) < tol + @test normTPS(y187) < tol + @test normTPS(y188) < tol + @test normTPS(y189) < tol + @test normTPS(y190) < tol + @test normTPS(y191) < tol + @test normTPS(y192) < tol + @test normTPS(y193) < tol + @test normTPS(y194) < tol + @test normTPS(y195) < tol + @test normTPS(y196) < tol + @test normTPS(y197) < tol + @test normTPS(y198) < tol + @test normTPS(y199) < tol + @test normTPS(y200) < tol + @test normTPS(y201) < tol + @test normTPS(y202) < tol + @test normTPS(y203) < tol + @test normTPS(y204) < tol + @test normTPS(y205) < tol + @test normTPS(y206) < tol + @test normTPS(y207) < tol + @test normTPS(y208) < tol + @test normTPS(y209) < tol + @test normTPS(y210) < tol + @test normTPS(y211) < tol + @test normTPS(y212) < tol + @test normTPS(y213) < tol + @test normTPS(y214) < tol + @test normTPS(y215) < tol + @test normTPS(y216) < tol + @test normTPS(y217) < tol + @test normTPS(y218) < tol + @test normTPS(y219) < tol + @test normTPS(y220) < tol + @test normTPS(y221) < tol + @test normTPS(y222) < tol + @test normTPS(y223) < tol + @test normTPS(y224) < tol + @test normTPS(y225) < tol + @test normTPS(y226) < tol + @test normTPS(y227) < tol + @test normTPS(y228) < tol + @test normTPS(y229) < tol + @test normTPS(y230) < tol + @test normTPS(y231) < tol + @test normTPS(y232) < tol + @test normTPS(y233) < tol + @test normTPS(y234) < tol + @test normTPS(y235) < tol + @test normTPS(y236) < tol + @test normTPS(y237) < tol + @test normTPS(y238) < tol + @test normTPS(y239) < tol + @test normTPS(y240) < tol + @test normTPS(y241) < tol + @test normTPS(y242) < tol + @test normTPS(y243) < tol + @test normTPS(y244) < tol + @test normTPS(y245) < tol + @test normTPS(y246) < tol + @test normTPS(y247) < tol + @test normTPS(y248) < tol + + + @test normTPS(x[1 ]) < tol + @test normTPS(x[2 ]) < tol + @test normTPS(x[3 ]) < tol + @test normTPS(x[4 ]) < tol + @test normTPS(x[5 ]) < tol + @test normTPS(x[6 ]) < tol + @test normTPS(x[7 ]) < tol + @test normTPS(x[8 ]) < tol + @test normTPS(x[9 ]) < tol + @test normTPS(x[10 ]) < tol + @test normTPS(x[11 ]) < tol + @test normTPS(x[12 ]) < tol + @test normTPS(x[13 ]) < tol + @test normTPS(x[14 ]) < tol + @test normTPS(x[15 ]) < tol + @test normTPS(x[16 ]) < tol + @test normTPS(x[17 ]) < tol + @test normTPS(x[18 ]) < tol + @test normTPS(x[19 ]) < tol + @test normTPS(x[20 ]) < tol + @test normTPS(x[21 ]) < tol + @test normTPS(x[22 ]) < tol + @test normTPS(x[23 ]) < tol + @test normTPS(x[24 ]) < tol + @test normTPS(x[25 ]) < tol + @test normTPS(x[26 ]) < tol + @test normTPS(x[27 ]) < tol + @test normTPS(x[28 ]) < tol + @test normTPS(x[29 ]) < tol + @test normTPS(x[30 ]) < tol + @test normTPS(x[31 ]) < tol + @test normTPS(x[32 ]) < tol + @test normTPS(x[33 ]) < tol + @test normTPS(x[34 ]) < tol + @test normTPS(x[35 ]) < tol + @test normTPS(x[36 ]) < tol + @test normTPS(x[37 ]) < tol + @test normTPS(x[38 ]) < tol + @test normTPS(x[39 ]) < tol + @test normTPS(x[40 ]) < tol + @test normTPS(x[41 ]) < tol + @test normTPS(x[42 ]) < tol + @test normTPS(x[43 ]) < tol + @test normTPS(x[44 ]) < tol + @test normTPS(x[45 ]) < tol + @test normTPS(x[46 ]) < tol + @test normTPS(x[47 ]) < tol + @test normTPS(x[48 ]) < tol + @test normTPS(x[49 ]) < tol + @test normTPS(x[50 ]) < tol + @test normTPS(x[51 ]) < tol + @test normTPS(x[52 ]) < tol + @test normTPS(x[53 ]) < tol + @test normTPS(x[54 ]) < tol + @test normTPS(x[55 ]) < tol + @test normTPS(x[56 ]) < tol + @test normTPS(x[57 ]) < tol + @test normTPS(x[58 ]) < tol + @test normTPS(x[59 ]) < tol + @test normTPS(x[60 ]) < tol + @test normTPS(x[61 ]) < tol + @test normTPS(x[62 ]) < tol + @test normTPS(x[63 ]) < tol + @test normTPS(x[64 ]) < tol + @test normTPS(x[65 ]) < tol + @test normTPS(x[66 ]) < tol + @test normTPS(x[67 ]) < tol + @test normTPS(x[68 ]) < tol + @test normTPS(x[69 ]) < tol + @test normTPS(x[70 ]) < tol + @test normTPS(x[71 ]) < tol + @test normTPS(x[72 ]) < tol + @test normTPS(x[73 ]) < tol + @test normTPS(x[74 ]) < tol + @test normTPS(x[75 ]) < tol + @test normTPS(x[76 ]) < tol + @test normTPS(x[77 ]) < tol + @test normTPS(x[78 ]) < tol + @test normTPS(x[79 ]) < tol + @test normTPS(x[80 ]) < tol + @test normTPS(x[81 ]) < tol + @test normTPS(x[82 ]) < tol + @test normTPS(x[83 ]) < tol + @test normTPS(x[84 ]) < tol + @test normTPS(x[85 ]) < tol + @test normTPS(x[86 ]) < tol + @test normTPS(x[87 ]) < tol + @test normTPS(x[88 ]) < tol + @test normTPS(x[89 ]) < tol + @test normTPS(x[90 ]) < tol + @test normTPS(x[91 ]) < tol + @test normTPS(x[92 ]) < tol + @test normTPS(x[93 ]) < tol + @test normTPS(x[94 ]) < tol + @test normTPS(x[95 ]) < tol + @test normTPS(x[96 ]) < tol + @test normTPS(x[97 ]) < tol + @test normTPS(x[98 ]) < tol + @test normTPS(x[99 ]) < tol + @test normTPS(x[100]) < tol + @test normTPS(x[101]) < tol + @test normTPS(x[102]) < tol + @test normTPS(x[103]) < tol + @test normTPS(x[104]) < tol + @test normTPS(x[105]) < tol + @test normTPS(x[106]) < tol + @test normTPS(x[107]) < tol + @test normTPS(x[108]) < tol + @test normTPS(x[109]) < tol + @test normTPS(x[110]) < tol + @test normTPS(x[111]) < tol + @test normTPS(x[112]) < tol + @test normTPS(x[113]) < tol + @test normTPS(x[114]) < tol + @test normTPS(x[115]) < tol + @test normTPS(x[116]) < tol + @test normTPS(x[117]) < tol + @test normTPS(x[118]) < tol + @test normTPS(x[119]) < tol + @test normTPS(x[120]) < tol + @test normTPS(x[121]) < tol + @test normTPS(x[122]) < tol + @test normTPS(x[123]) < tol + @test normTPS(x[124]) < tol + @test normTPS(x[125]) < tol + @test normTPS(x[126]) < tol + @test normTPS(x[127]) < tol + @test normTPS(x[128]) < tol + @test normTPS(x[129]) < tol + @test normTPS(x[130]) < tol + @test normTPS(x[131]) < tol + @test normTPS(x[132]) < tol + @test normTPS(x[133]) < tol + @test normTPS(x[134]) < tol + @test normTPS(x[135]) < tol + @test normTPS(x[136]) < tol + @test normTPS(x[137]) < tol + @test normTPS(x[138]) < tol + @test normTPS(x[139]) < tol + @test normTPS(x[140]) < tol + @test normTPS(x[141]) < tol + @test normTPS(x[142]) < tol + @test normTPS(x[143]) < tol + @test normTPS(x[144]) < tol + @test normTPS(x[145]) < tol + @test normTPS(x[146]) < tol + @test normTPS(x[147]) < tol + @test normTPS(x[148]) < tol + @test normTPS(x[149]) < tol + @test normTPS(x[150]) < tol + @test normTPS(x[151]) < tol + @test normTPS(x[152]) < tol + @test normTPS(x[153]) < tol + @test normTPS(x[154]) < tol + @test normTPS(x[155]) < tol + @test normTPS(x[156]) < tol + @test normTPS(x[157]) < tol + @test normTPS(x[158]) < tol + @test normTPS(x[159]) < tol + @test normTPS(x[160]) < tol + @test normTPS(x[161]) < tol + @test normTPS(x[162]) < tol + @test normTPS(x[163]) < tol + @test normTPS(x[164]) < tol + @test normTPS(x[165]) < tol + @test normTPS(x[166]) < tol + @test normTPS(x[167]) < tol + @test normTPS(x[168]) < tol + @test normTPS(x[169]) < tol + @test normTPS(x[170]) < tol + @test normTPS(x[171]) < tol + @test normTPS(x[172]) < tol + @test normTPS(x[173]) < tol + @test normTPS(x[174]) < tol + @test normTPS(x[175]) < tol + @test normTPS(x[176]) < tol + @test normTPS(x[177]) < tol + @test normTPS(x[178]) < tol + @test normTPS(x[179]) < tol + @test normTPS(x[180]) < tol + @test normTPS(x[181]) < tol + @test normTPS(x[182]) < tol + @test normTPS(x[183]) < tol + @test normTPS(x[184]) < tol + @test normTPS(x[185]) < tol + @test normTPS(x[186]) < tol + @test normTPS(x[187]) < tol + @test normTPS(x[188]) < tol + @test normTPS(x[189]) < tol + @test normTPS(x[190]) < tol + @test normTPS(x[191]) < tol + @test normTPS(x[192]) < tol + @test normTPS(x[193]) < tol + @test normTPS(x[194]) < tol + @test normTPS(x[195]) < tol + @test normTPS(x[196]) < tol + @test normTPS(x[197]) < tol + @test normTPS(x[198]) < tol + @test normTPS(x[199]) < tol + @test normTPS(x[200]) < tol + @test normTPS(x[201]) < tol + @test normTPS(x[202]) < tol + @test normTPS(x[203]) < tol + @test normTPS(x[204]) < tol + @test normTPS(x[205]) < tol + @test normTPS(x[206]) < tol + @test normTPS(x[207]) < tol + @test normTPS(x[208]) < tol + @test normTPS(x[209]) < tol + @test normTPS(x[210]) < tol + @test normTPS(x[211]) < tol + @test normTPS(x[212]) < tol + @test normTPS(x[213]) < tol + @test normTPS(x[214]) < tol + @test normTPS(x[215]) < tol + @test normTPS(x[216]) < tol + @test normTPS(x[217]) < tol + @test normTPS(x[218]) < tol + @test normTPS(x[219]) < tol + @test normTPS(x[220]) < tol + @test normTPS(x[221]) < tol + @test normTPS(x[222]) < tol + @test normTPS(x[223]) < tol + @test normTPS(x[224]) < tol + @test normTPS(x[225]) < tol + @test normTPS(x[226]) < tol + @test normTPS(x[227]) < tol + @test normTPS(x[228]) < tol + @test normTPS(x[229]) < tol + @test normTPS(x[230]) < tol + @test normTPS(x[231]) < tol + @test normTPS(x[232]) < tol + @test normTPS(x[233]) < tol + @test normTPS(x[234]) < tol + @test normTPS(x[235]) < tol + @test normTPS(x[236]) < tol + @test normTPS(x[237]) < tol + @test normTPS(x[238]) < tol + @test normTPS(x[239]) < tol + @test normTPS(x[240]) < tol + @test normTPS(x[241]) < tol + @test normTPS(x[242]) < tol + @test normTPS(x[243]) < tol + @test normTPS(x[244]) < tol + @test normTPS(x[245]) < tol + @test normTPS(x[246]) < tol + @test normTPS(x[247]) < tol + @test normTPS(x[248]) < tol +end + +@testset "FastGTPSA - Block Broadcasting" begin + d = Descriptor(1,5) + w = [[ComplexTPS64()] for i in 1:248] + + t = [TPS(use=d)] + ct = [ComplexTPS64(use=d)] + # Set scalar part so both TPSs are 1 + t[1][0] = 1 + ct[1][0] = 1 + # Now do operators + t1 = TPS.(t) + t1[1][0] = 1 + t2 = TPS.(t) + t2[1][0] = 2 + t3 = TPS.(t) + t3[1][0] = 3 + + ct1 = ComplexTPS64.(ct) + ct1[1][0] = 1 + 1im + ct2 = ComplexTPS64.(ct) + ct2[1][0] = 2 + 2im + ct3 = ComplexTPS64.(ct) + ct3[1][0] = 3 + 3im + + t = ComplexTPS64.(t) + t[1][0] = 0.5+0.5im; t[1][[1]] = 2+2im; t[1][[2]] = 3+3im; t[1][[3]] = 4+4im; t[1][[4]] = 5+5im; t[1][[5]] = 6+6im + v = [0.5+0.5im] + tol = 1e-10 + + @FastGTPSA begin + y1 = @. t1 + t2 - t3 + y2 = @. t2 + t1 - t3 + y3 = @. t1 + 2 - t3 + y4 = @. 2 + t1 - t3 + y5 = @. t3 - t2 - t1 + y6 = @. t2 - t3 - -t1 + y7 = @. t3 - 2 - t1 + y8 = @. 2 - t3 - -t1 + y9 = @. t2 * t3 - 6 + y10 =@. t3 * t2 - 6 + y11 =@. t2 * 5 - 10 + y12 =@. 5 * t2 - 10 * t1 + y13 =@. t1 / t2 - 1/2 + y14 =@. t2 / t1 - 2 + y15 =@. 1 / t2 - 1/2 + y16 =@. t2 / 3 - 2/3 + y17 =@. t2 / t2 - t1 + y18 =@. t2 / t2 - 1 + y19 =@. t2 ^ t3 - 8 + y20 =@. t3 ^ t2 - 9 + y21 =@. t2 ^ 3 - 8 + y22 =@. t2 ^ (1/2) - sqrt(2) + y23 =@. t2 ^ (1/2) - sqrt(t2) + y24 =@. 2 ^ t3 - 8 + y25 =@. inv(t3) - 1/t3 + y26 =@. inv(t3) - 1/3 + y27 =@. ct1 + ct2 - ct3 + y28 =@. ct2 + ct1 - ct3 + y29 =@. ct1 + (2+2im) - ct3 + y30 =@. (2+2im) + ct1 - ct3 + y31 =@. ct3 - ct2 - ct1 + y32 =@. ct2 - ct3 - -ct1 + y33 =@. ct3 - (2+2im) - ct1 + y34 =@. (2+2im) - ct3 - -ct1 + y35 =@. ct2 * ct3 - (2+2im)*(3+3im) + y36 =@. ct3 * ct2 - (2+2im)*(3+3im) + y37 =@. ct2 * 5 - (10+10im) + y38 =@. 5 * ct2 - (10 * ct1) + y39 =@. ct1 / ct2 - (1+im)/(2+2im) + y40 =@. ct2 / ct1 - 2 + y41 =@. 1 / ct2 - 1/(2+2im) + y42 =@. ct2 / 3 - (2+2im)/3 + y43 =@. ct2 / ct2 - 1 + y44 =@. ct2 ^ ct3 - (2+2im)^(3+3im) + y45 =@. ct3 ^ ct2 - (3+3im)^(2+2im) + y46 =@. ct2 ^ 3 - (2+2im)^3 + y47 =@. ct2 ^ (1/2) - sqrt(2+2im) + y48 =@. ct2 ^ (1/2) - sqrt(ct2) + y49 =@. 2 ^ ct3 - 2^(3+3im) + y50 =@. inv(ct3) - 1/ct3 + y51 =@. inv(ct3) - 1/(3+3im) + y52 =@. t1 + ct2 - (1 + (2+2im)) + y53 =@. ct2 + t1 - (1 + (2+2im)) + y54 =@. t1 + (2+2im) - (1 + (2+2im)) + y55 =@. (2+2im) + t1 - (1 + (2+2im)) + y56 =@. t3 - ct2 - (3 - (2+2im)) + y57 =@. ct2 - t3 - ((2+2im) - 3) + y58 =@. t3 - (2+2im) - (3 - (2+2im)) + y59 =@. (2+2im) - t3 - ((2+2im) - 3) + y60 =@. t2 * ct3 - 2 * (3+3im) + y61 =@. ct3 * t2 - 2 * (3+3im) + y62 =@. t2 * (3+3im) - 2 * (3+3im) + y63 =@. (3+3im) * t2 - 2 * (3+3im) + y64 =@. t2 / ct3 - 2/(3+3im) + y65 =@. ct3 / t2 - (3+3im)/2 + y66 =@. t2 / (3+3im) - 2/(3+3im) + y67 =@. (3+3im) / t2 - (3+3im)/2 + y68 =@. t2 ^ ct3 - 2^(3+3im) + y69 =@. ct3 ^ t2 - (3+3im)^2 + y70 =@. t2 ^ (3+3im) - 2^(3+3im) + y71 =@. (3+3im)^t2 - (3+3im)^2 + y72 =@. sin(t)^2+cos(t)^2 - 1 + y73 =@. 1/sin(t) - csc(t) + y74 =@. 1/cos(t) - sec(t) + y75 =@. 1/tan(t) - cot(t) + y76 =@. sin(t)/cos(t) - tan(t) + y77 =@. cos(2*t) - cos(t)^2 + sin(t)^2 + y78 =@. sec(t)^2 - 1 - tan(t)^2 + y79 =@. sin(t/2) - sqrt((1-cos(t))/2) + y80 =@. cos(t/2) - sqrt((1+cos(t))/2) + y81 =@. sqrt(real(t)^2) - abs(real(t)) + y82 =@. csc(t)^2 - cot(t)^2 - 1 + y83 =@. exp(log(t)) - t + y84 =@. log(exp(t)) - t + y85 =@. log(exp(t)) - exp(log(t)) + y86 =@. log(t^2) - 2*log(t) + y87 =@. 5*log(real(t)) - log(real(t)^5) + y88 =@. t*log(5) - log(5^t) + y89 =@. sinc(t) - sin(pi*t)/(pi*t) + y90 =@. sinhc(t/pi) - sinh(t)/t + y91 =@. exp(im*t) - cos(t) - im*sin(t) + y92 =@. real(exp(im*real(t))) - cos(real(t)) + y93 =@. imag(exp(im*real(t))) - sin(real(t)) + y94 =@. sinh(t) - (exp(t) - exp(-t))/2 + y95 =@. cosh(t) - (exp(t) + exp(-t))/2 + y96 =@. tanh(t) - sinh(t)/cosh(t) + y97 =@. csch(t) - 1/sinh(t) + y98 =@. sech(t) - 1/cosh(t) + y99 =@. coth(t) - cosh(t)/sinh(t) + y100 =@. coth(t) - 1/tanh(t) + y101 =@. cosh(t)^2 - sinh(t)^2 - 1 + y102 =@. 1 - tanh(t)^2 - sech(t)^2 + y103 =@. coth(t)^2 - 1 - csch(t)^2 + y104 =@. asin(sin(t)) - t + y105 =@. acos(cos(t)) - t + y106 =@. atan(tan(t)) - t + y107 =@. acsc(1/t) - asin(t) + y108 =@. asec(1/t) - acos(t) + y109 =@. acot(1/t) - atan(t) + y110 =@. asinh(sinh(t)) - t + y111 =@. acosh(cosh(t)) - t + y112 =@. atanh(tanh(t)) - t + y113 =@. acsch(t) - asinh(1/t) + y114 =@. asech(t) - acosh(1/t) + y115 =@. acoth(1/t) - atanh(t) + y116 =@. asinc(t/pi) - asin(t)/t + y117 =@. asinhc(t/pi) - asinh(t)/t + y118 =@. erfc(t) - 1 + erf(t) + y119 =@. erf(-t) + erf(t) + y120 =@. angle(real(t)) + y121 =@. complex(t) - t + y122 =@. complex(real(t),real(t)) - (real(t)+im*real(t)) + y123 =@. sin(t)^2+cos(t)^2 - 1 + y124 =@. 1/sin(t) - csc(t) + y125 =@. 1/cos(t) - sec(t) + y126 =@. 1/tan(t) - cot(t) + y127 =@. sin(t)/cos(t) - tan(t) + y128 =@. cos(2*t) - cos(t)^2 + sin(t)^2 + y129 =@. sec(t)^2 - 1 - tan(t)^2 + y130 =@. sin(t/2) - sqrt((1-cos(t))/2) + y131 =@. cos(t/2) - sqrt((1+cos(t))/2) + y132 =@. sqrt(t^2) - t + y133 =@. csc(t)^2 - cot(t)^2 - 1 + y134 =@. exp(log(t)) - t + y135 =@. log(exp(t)) - t + y136 =@. log(exp(t)) - exp(log(t)) + y137 =@. log(t^2) - 2*log(t) + y138 =@. 5*log(t) - log(t^5) - 2*pi*im + y139 =@. t*log(5) - log(5^t) + y140 =@. sinc(t/pi) - sin(t)/t + y141 =@. sinhc(t/pi) - sinh(t)/t + y142 =@. exp(im*t) - cos(t) - im*sin(t) + y143 =@. sinh(t) - (exp(t) - exp(-t))/2 + y144 =@. cosh(t) - (exp(t) + exp(-t))/2 + y145 =@. tanh(t) - sinh(t)/cosh(t) + y146 =@. csch(t) - 1/sinh(t) + y147 =@. sech(t) - 1/cosh(t) + y148 =@. coth(t) - cosh(t)/sinh(t) + y149 =@. coth(t) - 1/tanh(t) + y150 =@. cosh(t)^2 - sinh(t)^2 - 1 + y151 =@. 1 - tanh(t)^2 - sech(t)^2 + y152 =@. coth(t)^2 - 1 - csch(t)^2 + y153 =@. asin(sin(t)) - t + y154 =@. acos(cos(t)) - t + y155 =@. atan(tan(t)) - t + y156 =@. acsc(t) - asin(1/t) + y157 =@. asec(t) - acos(1/t) + y158 =@. acot(t) - atan(1/t) + y159 =@. asinh(sinh(t)) - t + y160 =@. acosh(cosh(t)) - t + y161 =@. atanh(tanh(t)) - t + y162 =@. acsch(t) - asinh(1/t) + y163 =@. asech(t) - acosh(1/t) + y164 =@. acoth(t) - atanh(1/t) + y165 =@. asinc(t/pi) - asin(t)/t + y166 =@. asinhc(t/pi) - asinh(t)/t + y167 =@. erfc(t) - 1 + erf(t) + y168 =@. erf(-t) + erf(t) + y169 =@. angle(t) - atan(imag(t),real(t)) + y170 =@. complex(t) - t + end + + @FastGTPSA! begin + @. w[1 ]= t1 + t2 - t3 + @. w[2 ]= t2 + t1 - t3 + @. w[3 ]= t1 + 2 - t3 + @. w[4 ]= 2 + t1 - t3 + @. w[5 ]= t3 - t2 - t1 + @. w[6 ]= t2 - t3 - -t1 + @. w[7 ]= t3 - 2 - t1 + @. w[8 ]= 2 - t3 - -t1 + @. w[9 ]=t2 * t3 - 6 + @. w[10 ]= t3 * t2 - 6 + @. w[11 ]= t2 * 5 - 10 + @. w[12 ]= 5 * t2 - 10 * t1 + @. w[13 ]= t1 / t2 - 1/2 + @. w[14 ]= t2 / t1 - 2 + @. w[15 ]= 1 / t2 - 1/2 + @. w[16 ]= t2 / 3 - 2/3 + @. w[17 ]= t2 / t2 - t1 + @. w[18 ]= t2 / t2 - 1 + @. w[19 ]= t2 ^ t3 - 8 + @. w[20 ]= t3 ^ t2 - 9 + @. w[21 ]= t2 ^ 3 - 8 + @. w[22 ]= t2 ^ (1/2) - sqrt(2) + @. w[23 ]= t2 ^ (1/2) - sqrt(t2) + @. w[24 ]= 2 ^ t3 - 8 + @. w[25 ]= inv(t3) - 1/t3 + @. w[26 ]= inv(t3) - 1/3 + @. w[27 ]= ct1 + ct2 - ct3 + @. w[28 ]= ct2 + ct1 - ct3 + @. w[29 ]= ct1 + (2+2im) - ct3 + @. w[30 ]= (2+2im) + ct1 - ct3 + @. w[31 ]= ct3 - ct2 - ct1 + @. w[32 ]= ct2 - ct3 - -ct1 + @. w[33 ]= ct3 - (2+2im) - ct1 + @. w[34 ]= (2+2im) - ct3 - -ct1 + @. w[35 ]= ct2 * ct3 - (2+2im)*(3+3im) + @. w[36 ]= ct3 * ct2 - (2+2im)*(3+3im) + @. w[37 ]= ct2 * 5 - (10+10im) + @. w[38 ]= 5 * ct2 - (10 * ct1) + @. w[39 ]= ct1 / ct2 - (1+im)/(2+2im) + @. w[40 ]= ct2 / ct1 - 2 + @. w[41 ]= 1 / ct2 - 1/(2+2im) + @. w[42 ]= ct2 / 3 - (2+2im)/3 + @. w[43 ]= ct2 / ct2 - 1 + @. w[44 ]= ct2 ^ ct3 - (2+2im)^(3+3im) + @. w[45 ]= ct3 ^ ct2 - (3+3im)^(2+2im) + @. w[46 ]= ct2 ^ 3 - (2+2im)^3 + @. w[47 ]= ct2 ^ (1/2) - sqrt(2+2im) + @. w[48 ]= ct2 ^ (1/2) - sqrt(ct2) + @. w[49 ]= 2 ^ ct3 - 2^(3+3im) + @. w[50 ]= inv(ct3) - 1/ct3 + @. w[51 ]= inv(ct3) - 1/(3+3im) + @. w[52 ]= t1 + ct2 - (1 + (2+2im)) + @. w[53 ]= ct2 + t1 - (1 + (2+2im)) + @. w[54 ]= t1 + (2+2im) - (1 + (2+2im)) + @. w[55 ]= (2+2im) + t1 - (1 + (2+2im)) + @. w[56 ]= t3 - ct2 - (3 - (2+2im)) + @. w[57 ]= ct2 - t3 - ((2+2im) - 3) + @. w[58 ]= t3 - (2+2im) - (3 - (2+2im)) + @. w[59 ]= (2+2im) - t3 - ((2+2im) - 3) + @. w[60 ]= t2 * ct3 - 2 * (3+3im) + @. w[61 ]= ct3 * t2 - 2 * (3+3im) + @. w[62 ]= t2 * (3+3im) - 2 * (3+3im) + @. w[63 ]= (3+3im) * t2 - 2 * (3+3im) + @. w[64 ]= t2 / ct3 - 2/(3+3im) + @. w[65 ]= ct3 / t2 - (3+3im)/2 + @. w[66 ]= t2 / (3+3im) - 2/(3+3im) + @. w[67 ]= (3+3im) / t2 - (3+3im)/2 + @. w[68 ]= t2 ^ ct3 - 2^(3+3im) + @. w[69 ]= ct3 ^ t2 - (3+3im)^2 + @. w[70 ]= t2 ^ (3+3im) - 2^(3+3im) + @. w[71 ]= (3+3im)^t2 - (3+3im)^2 + @. w[72 ]= sin(t)^2+cos(t)^2 - 1 + @. w[73 ]= 1/sin(t) - csc(t) + @. w[74 ]= 1/cos(t) - sec(t) + @. w[75 ]= 1/tan(t) - cot(t) + @. w[76 ]= sin(t)/cos(t) - tan(t) + @. w[77 ]= cos(2*t) - cos(t)^2 + sin(t)^2 + @. w[78 ]= sec(t)^2 - 1 - tan(t)^2 + @. w[79 ]= sin(t/2) - sqrt((1-cos(t))/2) + @. w[80 ]= cos(t/2) - sqrt((1+cos(t))/2) + @. w[81 ]= sqrt(real(t)^2) - abs(real(t)) + @. w[82 ]= csc(t)^2 - cot(t)^2 - 1 + @. w[83 ]= exp(log(t)) - t + @. w[84 ]= log(exp(t)) - t + @. w[85 ]= log(exp(t)) - exp(log(t)) + @. w[86 ]= log(t^2) - 2*log(t) + @. w[87 ]= 5*log(real(t)) - log(real(t)^5) + @. w[88 ]= t*log(5) - log(5^t) + @. w[89 ]= sinc(t) - sin(pi*t)/(pi*t) + @. w[90 ]= sinhc(t/pi) - sinh(t)/t + @. w[91 ]= exp(im*t) - cos(t) - im*sin(t) + @. w[92 ]= real(exp(im*real(t))) - cos(real(t)) + @. w[93 ]= imag(exp(im*real(t))) - sin(real(t)) + @. w[94 ]= sinh(t) - (exp(t) - exp(-t))/2 + @. w[95 ]= cosh(t) - (exp(t) + exp(-t))/2 + @. w[96 ]= tanh(t) - sinh(t)/cosh(t) + @. w[97 ]= csch(t) - 1/sinh(t) + @. w[98 ]= sech(t) - 1/cosh(t) + @. w[99 ]= coth(t) - cosh(t)/sinh(t) + @. w[100] = coth(t) - 1/tanh(t) + @. w[101] = cosh(t)^2 - sinh(t)^2 - 1 + @. w[102] = 1 - tanh(t)^2 - sech(t)^2 + @. w[103] = coth(t)^2 - 1 - csch(t)^2 + @. w[104] = asin(sin(t)) - t + @. w[105] = acos(cos(t)) - t + @. w[106] = atan(tan(t)) - t + @. w[107] = acsc(1/t) - asin(t) + @. w[108] = asec(1/t) - acos(t) + @. w[109] = acot(1/t) - atan(t) + @. w[110] = asinh(sinh(t)) - t + @. w[111] = acosh(cosh(t)) - t + @. w[112] = atanh(tanh(t)) - t + @. w[113] = acsch(t) - asinh(1/t) + @. w[114] = asech(t) - acosh(1/t) + @. w[115] = acoth(1/t) - atanh(t) + @. w[116] = asinc(t/pi) - asin(t)/t + @. w[117] = asinhc(t/pi) - asinh(t)/t + @. w[118] = erfc(t) - 1 + erf(t) + @. w[119] = erf(-t) + erf(t) + @. w[120] = angle(real(t)) + @. w[121] = complex(t) - t + @. w[122] = complex(real(t),real(t)) - (real(t)+im*real(t)) + @. w[123] = sin(t)^2+cos(t)^2 - 1 + @. w[124] = 1/sin(t) - csc(t) + @. w[125] = 1/cos(t) - sec(t) + @. w[126] = 1/tan(t) - cot(t) + @. w[127] = sin(t)/cos(t) - tan(t) + @. w[128] = cos(2*t) - cos(t)^2 + sin(t)^2 + @. w[129] = sec(t)^2 - 1 - tan(t)^2 + @. w[130] = sin(t/2) - sqrt((1-cos(t))/2) + @. w[131] = cos(t/2) - sqrt((1+cos(t))/2) + @. w[132] = sqrt(t^2) - t + @. w[133] = csc(t)^2 - cot(t)^2 - 1 + @. w[134] = exp(log(t)) - t + @. w[135] = log(exp(t)) - t + @. w[136] = log(exp(t)) - exp(log(t)) + @. w[137] = log(t^2) - 2*log(t) + @. w[138] = 5*log(t) - log(t^5) - 2*pi*im + @. w[139] = t*log(5) - log(5^t) + @. w[140] = sinc(t/pi) - sin(t)/t + @. w[141] = sinhc(t/pi) - sinh(t)/t + @. w[142] = exp(im*t) - cos(t) - im*sin(t) + @. w[143] = sinh(t) - (exp(t) - exp(-t))/2 + @. w[144] = cosh(t) - (exp(t) + exp(-t))/2 + @. w[145] = tanh(t) - sinh(t)/cosh(t) + @. w[146] = csch(t) - 1/sinh(t) + @. w[147] = sech(t) - 1/cosh(t) + @. w[148] = coth(t) - cosh(t)/sinh(t) + @. w[149] = coth(t) - 1/tanh(t) + @. w[150] = cosh(t)^2 - sinh(t)^2 - 1 + @. w[151] = 1 - tanh(t)^2 - sech(t)^2 + @. w[152] = coth(t)^2 - 1 - csch(t)^2 + @. w[153] = asin(sin(t)) - t + @. w[154] = acos(cos(t)) - t + @. w[155] = atan(tan(t)) - t + @. w[156] = acsc(t) - asin(1/t) + @. w[157] = asec(t) - acos(1/t) + @. w[158] = acot(t) - atan(1/t) + @. w[159] = asinh(sinh(t)) - t + @. w[160] = acosh(cosh(t)) - t + @. w[161] = atanh(tanh(t)) - t + @. w[162] = acsch(t) - asinh(1/t) + @. w[163] = asech(t) - acosh(1/t) + @. w[164] = acoth(t) - atanh(1/t) + @. w[165] = asinc(t/pi) - asin(t)/t + @. w[166] = asinhc(t/pi) - asinh(t)/t + @. w[167] = erfc(t) - 1 + erf(t) + @. w[168] = erf(-t) + erf(t) + @. w[169] = angle(t) - atan(imag(t),real(t)) + @. w[170] = complex(t) - t + end + + #t = ComplexTPS64() + t[1] = ComplexTPS64(0.5+0.5im) + #v = 0.5+0.5im + @FastGTPSA begin + y171 = @. sqrt(t) - sqrt(v) + y172 = @. exp(t) - exp(v) + y173 = @. log(t) - log(v) + y174 = @. sin(t) - sin(v) + y175 = @. cos(t) - cos(v) + y176 = @. tan(t) - tan(v) + y177 = @. csc(t) - csc(v) + y178 = @. sec(t) - sec(v) + y179 = @. cot(t) - cot(v) + y180 = @. sinc(t) - sinc(v) + y181 = @. sinh(t) - sinh(v) + y182 = @. cosh(t) - cosh(v) + y183 = @. tanh(t) - tanh(v) + y184 = @. csch(t) - csch(v) + y185 = @. sech(t) - sech(v) + y186 = @. coth(t) - coth(v) + y187 = @. asin(t) - asin(v) + y188 = @. acos(t) - acos(v) + y189 = @. atan(t) - atan(v) + y190 = @. acsc(t) - acsc(v) + y191 = @. asec(t) - asec(v) + y192 = @. acot(t) - acot(v) + y193 = @. asinh(t) - asinh(v) + y194 = @. acosh(t) - acosh(v) + y195 = @. atanh(t) - atanh(v) + y196 = @. acsch(t) - acsch(v) + y197 = @. asech(t) - asech(v) + y198 = @. acoth(t) - acoth(v) + y199 = @. asinc(t/pi) - asin(v)/v + y200 = @. asinhc(t/pi) - asinh(v)/v + y201 = @. zero(t) - zero(v) + y202 = @. real(t) - real(v) + y203 = @. imag(t) - imag(v) + y204 = @. conj(t) - conj(v) + y205 = @. sinhc(t/pi) - sinh(v)/v + y206 = @. erf(t) - erf(v) + y207 = @. erfc(t) - erfc(v) + y208 = @. -im*erf(t*im) - erfi(v) + y219 = @. angle(t2+im*t3) - angle(2+3im) + y220 = @. angle(t2-im*t3) - angle(2-3im) + y221 = @. angle(-t2-im*t3) - angle(-2-3im) + y222 = @. angle(-t2+im*t3) - angle(-2+3im) + y223 = @. angle(ct2) - angle(2+2im) + y224 = @. angle(-ct2) - angle(-2-2im) + y225 = @. complex(ct3) - complex(3+3im) + y226 = @. polar(ct2) - (abs(2+2im)+im*angle(2+2im)) + y227 = @. polar(-ct1) - (abs(-1-im)+im*angle(-1-im)) + y228 = @. rect(ct2) - (2*cos(2) + im*2*sin(2)) + y229 = @. rect(-ct1) - (-1*cos(-1) + im*-1*sin(-1)) + y248 = @. abs(-t) - abs(-v) + end + @FastGTPSA begin + y209 = @. hypot(ct2,ct3) - hypot(2+2im,3+3im) + y210 = @. hypot(2+2im,ct3) - hypot(2+2im,3+3im) + y211 = @. hypot(ct2,3+3im) - hypot(2+2im,3+3im) + y212 = @. hypot(ct1,ct2,ct3) - hypot(1+1im,2+2im,3+3im) + y213 = @. hypot(1+1im, ct2, ct3) - hypot(1+1im,2+2im,3+3im) + y214 = @. hypot(ct1, 2+2im, ct3) - hypot(1+1im,2+2im,3+3im) + y215 = @. hypot(ct1, ct2, 3+3im) - hypot(1+1im,2+2im,3+3im) + y216 = @. hypot(1+1im, 2+2im, ct3) - hypot(1+1im,2+2im,3+3im) + y217 = @. hypot(1+1im, ct2, 3+3im) - hypot(1+1im,2+2im,3+3im) + y218 = @. hypot(ct1, 2+2im, 3+3im) - hypot(1+1im,2+2im,3+3im) + y230 = @. hypot(ct1, ct2, t3) - hypot(1+1im,2+2im,3) + y231 = @. hypot(ct1, t2, ct3) - hypot(1+1im,2,3+3im) + y232 = @. hypot(t1, ct2, ct3) - hypot(1,2+2im,3+3im) + y233 = @. hypot(ct1, t2, t3) - hypot(1+1im,2,3) + y234 = @. hypot(t1, ct2, t3) - hypot(1,2+2im,3) + y235 = @. hypot(t1, t2, ct3) - hypot(1,2,3+3im) + y236 = @. hypot(ct1,t2,3+3im) - hypot(1+1im,2,3+3im) + y237 = @. hypot(t1, ct2, 3+3im) - hypot(1,2+2im,3+3im) + y238 = @. hypot(ct1,2+2im,t3) - hypot(1+1im,2+2im,3) + y239 = @. hypot(t1,2+2im,ct3) - hypot(1,2+2im,3+3im) + y240 = @. hypot(1+1im,ct2,t3) - hypot(1+1im,2+2im,3) + y241 = @. hypot(1+1im, t2, ct3) - hypot(1+1im,2,3+3im) + y242 = @. hypot(t1,t2,3+3im) - hypot(1,2,3+3im) + y243 = @. hypot(t1,2+2im,t3) - hypot(1,2+2im,3) + y244 = @. hypot(1+1im,t2,t3) - hypot(1+1im,2,3) + y245 = @. hypot(t1,2,3+3im) - hypot(1,2,3+3im) + y246 = @. hypot(1,t2,3+3im) - hypot(1,2,3+3im) + y247 = @. hypot(1+1im,2,t3) - hypot(1+1im,2,3) + end + + @FastGTPSA! begin + @. w[171] = sqrt(t) - sqrt(v) + @. w[172] = exp(t) - exp(v) + @. w[173] = log(t) - log(v) + @. w[174] = sin(t) - sin(v) + @. w[175] = cos(t) - cos(v) + @. w[176] = tan(t) - tan(v) + @. w[177] = csc(t) - csc(v) + @. w[178] = sec(t) - sec(v) + @. w[179] = cot(t) - cot(v) + @. w[180] = sinc(t) - sinc(v) + @. w[181] = sinh(t) - sinh(v) + @. w[182] = cosh(t) - cosh(v) + @. w[183] = tanh(t) - tanh(v) + @. w[184] = csch(t) - csch(v) + @. w[185] = sech(t) - sech(v) + @. w[186] = coth(t) - coth(v) + @. w[187] = asin(t) - asin(v) + @. w[188] = acos(t) - acos(v) + @. w[189] = atan(t) - atan(v) + @. w[190] = acsc(t) - acsc(v) + @. w[191] = asec(t) - asec(v) + @. w[192] = acot(t) - acot(v) + @. w[193] = asinh(t) - asinh(v) + @. w[194] = acosh(t) - acosh(v) + @. w[195] = atanh(t) - atanh(v) + @. w[196] = acsch(t) - acsch(v) + @. w[197] = asech(t) - asech(v) + @. w[198] = acoth(t) - acoth(v) + @. w[199] = asinc(t/pi) - asin(v)/v + @. w[200] = asinhc(t/pi) - asinh(v)/v + @. w[201] = zero(t) - zero(v) + @. w[202] = real(t) - real(v) + @. w[203] = imag(t) - imag(v) + @. w[204] = conj(t) - conj(v) + @. w[205] = sinhc(t/pi) - sinh(v)/v + @. w[206] = erf(t) - erf(v) + @. w[207] = erfc(t) - erfc(v) + @. w[208] = -im*erf(t*im) - erfi(v) + @. w[219] = angle(t2+im*t3) - angle(2+3im) + @. w[220] = angle(t2-im*t3) - angle(2-3im) + @. w[221] = angle(-t2-im*t3) - angle(-2-3im) + @. w[222] = angle(-t2+im*t3) - angle(-2+3im) + @. w[223] = angle(ct2) - angle(2+2im) + @. w[224] = angle(-ct2) - angle(-2-2im) + @. w[225] = complex(ct3) - complex(3+3im) + @. w[226] = polar(ct2) - (abs(2+2im)+im*angle(2+2im)) + @. w[227] = polar(-ct1) - (abs(-1-im)+im*angle(-1-im)) + @. w[228] = rect(ct2) - (2*cos(2) + im*2*sin(2)) + @. w[229] = rect(-ct1) - (-1*cos(-1) + im*-1*sin(-1)) + @. w[248] = abs(-t) - abs(-v) + end + + @FastGTPSA! begin + @. w[209] = hypot(ct2,ct3) - hypot(2+2im,3+3im) + @. w[210] = hypot(2+2im,ct3) - hypot(2+2im,3+3im) + @. w[211] = hypot(ct2,3+3im) - hypot(2+2im,3+3im) + @. w[212] = hypot(ct1,ct2,ct3) - hypot(1+1im,2+2im,3+3im) + @. w[213] = hypot(1+1im, ct2, ct3) - hypot(1+1im,2+2im,3+3im) + @. w[214] = hypot(ct1, 2+2im, ct3) - hypot(1+1im,2+2im,3+3im) + @. w[215] = hypot(ct1, ct2, 3+3im) - hypot(1+1im,2+2im,3+3im) + @. w[216] = hypot(1+1im, 2+2im, ct3) - hypot(1+1im,2+2im,3+3im) + @. w[217] = hypot(1+1im, ct2, 3+3im) - hypot(1+1im,2+2im,3+3im) + @. w[218] = hypot(ct1, 2+2im, 3+3im) - hypot(1+1im,2+2im,3+3im) + @. w[230] = hypot(ct1, ct2, t3) - hypot(1+1im,2+2im,3) + @. w[231] = hypot(ct1, t2, ct3) - hypot(1+1im,2,3+3im) + @. w[232] = hypot(t1, ct2, ct3) - hypot(1,2+2im,3+3im) + @. w[233] = hypot(ct1, t2, t3) - hypot(1+1im,2,3) + @. w[234] = hypot(t1, ct2, t3) - hypot(1,2+2im,3) + @. w[235] = hypot(t1, t2, ct3) - hypot(1,2,3+3im) + @. w[236] = hypot(ct1,t2,3+3im) - hypot(1+1im,2,3+3im) + @. w[237] = hypot(t1, ct2, 3+3im) - hypot(1,2+2im,3+3im) + @. w[238] = hypot(ct1,2+2im,t3) - hypot(1+1im,2+2im,3) + @. w[239] = hypot(t1,2+2im,ct3) - hypot(1,2+2im,3+3im) + @. w[240] = hypot(1+1im,ct2,t3) - hypot(1+1im,2+2im,3) + @. w[241] = hypot(1+1im, t2, ct3) - hypot(1+1im,2,3+3im) + @. w[242] = hypot(t1,t2,3+3im) - hypot(1,2,3+3im) + @. w[243] = hypot(t1,2+2im,t3) - hypot(1,2+2im,3) + @. w[244] = hypot(1+1im,t2,t3) - hypot(1+1im,2,3) + @. w[245] = hypot(t1,2,3+3im) - hypot(1,2,3+3im) + @. w[246] = hypot(1,t2,3+3im) - hypot(1,2,3+3im) + @. w[247] = hypot(1+1im,2,t3) - hypot(1+1im,2,3) + end + + @test norm(normTPS.(y1 )) < tol + @test norm(normTPS.(y2 )) < tol + @test norm(normTPS.(y3 )) < tol + @test norm(normTPS.(y4 )) < tol + @test norm(normTPS.(y5 )) < tol + @test norm(normTPS.(y6 )) < tol + @test norm(normTPS.(y7 )) < tol + @test norm(normTPS.(y8 )) < tol + @test norm(normTPS.(y9 )) < tol + @test norm(normTPS.(y10)) < tol + @test norm(normTPS.(y11)) < tol + @test norm(normTPS.(y12)) < tol + @test norm(normTPS.(y13)) < tol + @test norm(normTPS.(y14)) < tol + @test norm(normTPS.(y15)) < tol + @test norm(normTPS.(y16)) < tol + @test norm(normTPS.(y17)) < tol + @test norm(normTPS.(y18)) < tol + @test norm(normTPS.(y19)) < tol + @test norm(normTPS.(y20)) < tol + @test norm(normTPS.(y21)) < tol + @test norm(normTPS.(y22)) < tol + @test norm(normTPS.(y23)) < tol + @test norm(normTPS.(y24)) < tol + @test norm(normTPS.(y25)) < tol + @test norm(normTPS.(y26)) < tol + @test norm(normTPS.(y27)) < tol + @test norm(normTPS.(y28)) < tol + @test norm(normTPS.(y29)) < tol + @test norm(normTPS.(y30)) < tol + @test norm(normTPS.(y31)) < tol + @test norm(normTPS.(y32)) < tol + @test norm(normTPS.(y33)) < tol + @test norm(normTPS.(y34)) < tol + @test norm(normTPS.(y35)) < tol + @test norm(normTPS.(y36)) < tol + @test norm(normTPS.(y37)) < tol + @test norm(normTPS.(y38)) < tol + @test norm(normTPS.(y39)) < tol + @test norm(normTPS.(y40)) < tol + @test norm(normTPS.(y41)) < tol + @test norm(normTPS.(y42)) < tol + @test norm(normTPS.(y43)) < tol + @test norm(normTPS.(y44)) < tol + @test norm(normTPS.(y45)) < tol + @test norm(normTPS.(y46)) < tol + @test norm(normTPS.(y47)) < tol + @test norm(normTPS.(y48)) < tol + @test norm(normTPS.(y49)) < tol + @test norm(normTPS.(y50)) < tol + @test norm(normTPS.(y51)) < tol + @test norm(normTPS.(y52)) < tol + @test norm(normTPS.(y53)) < tol + @test norm(normTPS.(y54)) < tol + @test norm(normTPS.(y55)) < tol + @test norm(normTPS.(y56)) < tol + @test norm(normTPS.(y57)) < tol + @test norm(normTPS.(y58)) < tol + @test norm(normTPS.(y59)) < tol + @test norm(normTPS.(y60)) < tol + @test norm(normTPS.(y61)) < tol + @test norm(normTPS.(y62)) < tol + @test norm(normTPS.(y63)) < tol + @test norm(normTPS.(y64)) < tol + @test norm(normTPS.(y65)) < tol + @test norm(normTPS.(y66)) < tol + @test norm(normTPS.(y67)) < tol + @test norm(normTPS.(y68)) < tol + @test norm(normTPS.(y69)) < tol + @test norm(normTPS.(y70)) < tol + @test norm(normTPS.(y71)) < tol + @test norm(normTPS.(y72 )) < tol + @test norm(normTPS.(y73 )) < tol + @test norm(normTPS.(y74 )) < tol + @test norm(normTPS.(y75 )) < tol + @test norm(normTPS.(y76 )) < tol + @test norm(normTPS.(y77 )) < tol + @test norm(normTPS.(y78 )) < tol + @test norm(normTPS.(y79 )) < tol + @test norm(normTPS.(y80 )) < tol + @test norm(normTPS.(y81 )) < tol + @test norm(normTPS.(y82 )) < tol + @test norm(normTPS.(y83 )) < tol + @test norm(normTPS.(y84 )) < tol + @test norm(normTPS.(y85 )) < tol + @test norm(normTPS.(y86 )) < tol + @test norm(normTPS.(y87 )) < tol + @test norm(normTPS.(y88 )) < tol + @test norm(normTPS.(y89 )) < tol + @test norm(normTPS.(y90 )) < tol + @test norm(normTPS.(y91 )) < tol + @test norm(normTPS.(y92 )) < tol + @test norm(normTPS.(y93 )) < tol + @test norm(normTPS.(y94 )) < tol + @test norm(normTPS.(y95 )) < tol + @test norm(normTPS.(y96 )) < tol + @test norm(normTPS.(y97 )) < tol + @test norm(normTPS.(y98 )) < tol + @test norm(normTPS.(y99 )) < tol + @test norm(normTPS.(y100)) < tol + @test norm(normTPS.(y101)) < tol + @test norm(normTPS.(y102)) < tol + @test norm(normTPS.(y103)) < tol + @test norm(normTPS.(y104)) < tol + @test norm(normTPS.(y105)) < tol + @test norm(normTPS.(y106)) < tol + @test norm(normTPS.(y107)) < tol + @test norm(normTPS.(y108)) < tol + @test norm(normTPS.(y109)) < tol + @test norm(normTPS.(y110)) < tol + @test norm(normTPS.(y111)) < tol + @test norm(normTPS.(y112)) < tol + @test norm(normTPS.(y113)) < tol + @test norm(normTPS.(y114)) < tol + @test norm(normTPS.(y115)) < tol + @test norm(normTPS.(y116)) < tol + @test norm(normTPS.(y117)) < tol + @test norm(normTPS.(y118)) < tol + @test norm(normTPS.(y119)) < tol + @test norm(normTPS.(y120)) < tol + @test norm(normTPS.(y121)) < tol + @test norm(normTPS.(y122)) < tol + @test norm(normTPS.(y123)) < tol + @test norm(normTPS.(y124)) < tol + @test norm(normTPS.(y125)) < tol + @test norm(normTPS.(y126)) < tol + @test norm(normTPS.(y127)) < tol + @test norm(normTPS.(y128)) < tol + @test norm(normTPS.(y129)) < tol + @test norm(normTPS.(y130)) < tol + @test norm(normTPS.(y131)) < tol + @test norm(normTPS.(y132)) < tol + @test norm(normTPS.(y133)) < tol + @test norm(normTPS.(y134)) < tol + @test norm(normTPS.(y135)) < tol + @test norm(normTPS.(y136)) < tol + @test norm(normTPS.(y137)) < tol + @test norm(normTPS.(y138)) < tol + @test norm(normTPS.(y139)) < tol + @test norm(normTPS.(y140)) < tol + @test norm(normTPS.(y141)) < tol + @test norm(normTPS.(y142)) < tol + @test norm(normTPS.(y143)) < tol + @test norm(normTPS.(y144)) < tol + @test norm(normTPS.(y145)) < tol + @test norm(normTPS.(y146)) < tol + @test norm(normTPS.(y147)) < tol + @test norm(normTPS.(y148)) < tol + @test norm(normTPS.(y149)) < tol + @test norm(normTPS.(y150)) < tol + @test norm(normTPS.(y151)) < tol + @test norm(normTPS.(y152)) < tol + @test norm(normTPS.(y153)) < tol + @test norm(normTPS.(y154)) < tol + @test norm(normTPS.(y155)) < tol + @test norm(normTPS.(y156)) < tol + @test norm(normTPS.(y157)) < tol + @test norm(normTPS.(y158)) < tol + @test norm(normTPS.(y159)) < tol + @test norm(normTPS.(y160)) < tol + @test norm(normTPS.(y161)) < tol + @test norm(normTPS.(y162)) < tol + @test norm(normTPS.(y163)) < tol + @test norm(normTPS.(y164)) < tol + @test norm(normTPS.(y165)) < tol + @test norm(normTPS.(y166)) < tol + @test norm(normTPS.(y167)) < tol + @test norm(normTPS.(y168)) < tol + @test norm(normTPS.(y169)) < tol + @test norm(normTPS.(y170)) < tol + @test norm(normTPS.(y171)) < tol + @test norm(normTPS.(y172)) < tol + @test norm(normTPS.(y173)) < tol + @test norm(normTPS.(y174)) < tol + @test norm(normTPS.(y175)) < tol + @test norm(normTPS.(y176)) < tol + @test norm(normTPS.(y177)) < tol + @test norm(normTPS.(y178)) < tol + @test norm(normTPS.(y179)) < tol + @test norm(normTPS.(y180)) < tol + @test norm(normTPS.(y181)) < tol + @test norm(normTPS.(y182)) < tol + @test norm(normTPS.(y183)) < tol + @test norm(normTPS.(y184)) < tol + @test norm(normTPS.(y185)) < tol + @test norm(normTPS.(y186)) < tol + @test norm(normTPS.(y187)) < tol + @test norm(normTPS.(y188)) < tol + @test norm(normTPS.(y189)) < tol + @test norm(normTPS.(y190)) < tol + @test norm(normTPS.(y191)) < tol + @test norm(normTPS.(y192)) < tol + @test norm(normTPS.(y193)) < tol + @test norm(normTPS.(y194)) < tol + @test norm(normTPS.(y195)) < tol + @test norm(normTPS.(y196)) < tol + @test norm(normTPS.(y197)) < tol + @test norm(normTPS.(y198)) < tol + @test norm(normTPS.(y199)) < tol + @test norm(normTPS.(y200)) < tol + @test norm(normTPS.(y201)) < tol + @test norm(normTPS.(y202)) < tol + @test norm(normTPS.(y203)) < tol + @test norm(normTPS.(y204)) < tol + @test norm(normTPS.(y205)) < tol + @test norm(normTPS.(y206)) < tol + @test norm(normTPS.(y207)) < tol + @test norm(normTPS.(y208)) < tol + @test norm(normTPS.(y209)) < tol + @test norm(normTPS.(y210)) < tol + @test norm(normTPS.(y211)) < tol + @test norm(normTPS.(y212)) < tol + @test norm(normTPS.(y213)) < tol + @test norm(normTPS.(y214)) < tol + @test norm(normTPS.(y215)) < tol + @test norm(normTPS.(y216)) < tol + @test norm(normTPS.(y217)) < tol + @test norm(normTPS.(y218)) < tol + @test norm(normTPS.(y219)) < tol + @test norm(normTPS.(y220)) < tol + @test norm(normTPS.(y221)) < tol + @test norm(normTPS.(y222)) < tol + @test norm(normTPS.(y223)) < tol + @test norm(normTPS.(y224)) < tol + @test norm(normTPS.(y225)) < tol + @test norm(normTPS.(y226)) < tol + @test norm(normTPS.(y227)) < tol + @test norm(normTPS.(y228)) < tol + @test norm(normTPS.(y229)) < tol + @test norm(normTPS.(y230)) < tol + @test norm(normTPS.(y231)) < tol + @test norm(normTPS.(y232)) < tol + @test norm(normTPS.(y233)) < tol + @test norm(normTPS.(y234)) < tol + @test norm(normTPS.(y235)) < tol + @test norm(normTPS.(y236)) < tol + @test norm(normTPS.(y237)) < tol + @test norm(normTPS.(y238)) < tol + @test norm(normTPS.(y239)) < tol + @test norm(normTPS.(y240)) < tol + @test norm(normTPS.(y241)) < tol + @test norm(normTPS.(y242)) < tol + @test norm(normTPS.(y243)) < tol + @test norm(normTPS.(y244)) < tol + @test norm(normTPS.(y245)) < tol + @test norm(normTPS.(y246)) < tol + @test norm(normTPS.(y247)) < tol + @test norm(normTPS.(y248)) < tol + + + @test norm(normTPS.(w[1 ])) < tol + @test norm(normTPS.(w[2 ])) < tol + @test norm(normTPS.(w[3 ])) < tol + @test norm(normTPS.(w[4 ])) < tol + @test norm(normTPS.(w[5 ])) < tol + @test norm(normTPS.(w[6 ])) < tol + @test norm(normTPS.(w[7 ])) < tol + @test norm(normTPS.(w[8 ])) < tol + @test norm(normTPS.(w[9 ])) < tol + @test norm(normTPS.(w[10 ])) < tol + @test norm(normTPS.(w[11 ])) < tol + @test norm(normTPS.(w[12 ])) < tol + @test norm(normTPS.(w[13 ])) < tol + @test norm(normTPS.(w[14 ])) < tol + @test norm(normTPS.(w[15 ])) < tol + @test norm(normTPS.(w[16 ])) < tol + @test norm(normTPS.(w[17 ])) < tol + @test norm(normTPS.(w[18 ])) < tol + @test norm(normTPS.(w[19 ])) < tol + @test norm(normTPS.(w[20 ])) < tol + @test norm(normTPS.(w[21 ])) < tol + @test norm(normTPS.(w[22 ])) < tol + @test norm(normTPS.(w[23 ])) < tol + @test norm(normTPS.(w[24 ])) < tol + @test norm(normTPS.(w[25 ])) < tol + @test norm(normTPS.(w[26 ])) < tol + @test norm(normTPS.(w[27 ])) < tol + @test norm(normTPS.(w[28 ])) < tol + @test norm(normTPS.(w[29 ])) < tol + @test norm(normTPS.(w[30 ])) < tol + @test norm(normTPS.(w[31 ])) < tol + @test norm(normTPS.(w[32 ])) < tol + @test norm(normTPS.(w[33 ])) < tol + @test norm(normTPS.(w[34 ])) < tol + @test norm(normTPS.(w[35 ])) < tol + @test norm(normTPS.(w[36 ])) < tol + @test norm(normTPS.(w[37 ])) < tol + @test norm(normTPS.(w[38 ])) < tol + @test norm(normTPS.(w[39 ])) < tol + @test norm(normTPS.(w[40 ])) < tol + @test norm(normTPS.(w[41 ])) < tol + @test norm(normTPS.(w[42 ])) < tol + @test norm(normTPS.(w[43 ])) < tol + @test norm(normTPS.(w[44 ])) < tol + @test norm(normTPS.(w[45 ])) < tol + @test norm(normTPS.(w[46 ])) < tol + @test norm(normTPS.(w[47 ])) < tol + @test norm(normTPS.(w[48 ])) < tol + @test norm(normTPS.(w[49 ])) < tol + @test norm(normTPS.(w[50 ])) < tol + @test norm(normTPS.(w[51 ])) < tol + @test norm(normTPS.(w[52 ])) < tol + @test norm(normTPS.(w[53 ])) < tol + @test norm(normTPS.(w[54 ])) < tol + @test norm(normTPS.(w[55 ])) < tol + @test norm(normTPS.(w[56 ])) < tol + @test norm(normTPS.(w[57 ])) < tol + @test norm(normTPS.(w[58 ])) < tol + @test norm(normTPS.(w[59 ])) < tol + @test norm(normTPS.(w[60 ])) < tol + @test norm(normTPS.(w[61 ])) < tol + @test norm(normTPS.(w[62 ])) < tol + @test norm(normTPS.(w[63 ])) < tol + @test norm(normTPS.(w[64 ])) < tol + @test norm(normTPS.(w[65 ])) < tol + @test norm(normTPS.(w[66 ])) < tol + @test norm(normTPS.(w[67 ])) < tol + @test norm(normTPS.(w[68 ])) < tol + @test norm(normTPS.(w[69 ])) < tol + @test norm(normTPS.(w[70 ])) < tol + @test norm(normTPS.(w[71 ])) < tol + @test norm(normTPS.(w[72 ])) < tol + @test norm(normTPS.(w[73 ])) < tol + @test norm(normTPS.(w[74 ])) < tol + @test norm(normTPS.(w[75 ])) < tol + @test norm(normTPS.(w[76 ])) < tol + @test norm(normTPS.(w[77 ])) < tol + @test norm(normTPS.(w[78 ])) < tol + @test norm(normTPS.(w[79 ])) < tol + @test norm(normTPS.(w[80 ])) < tol + @test norm(normTPS.(w[81 ])) < tol + @test norm(normTPS.(w[82 ])) < tol + @test norm(normTPS.(w[83 ])) < tol + @test norm(normTPS.(w[84 ])) < tol + @test norm(normTPS.(w[85 ])) < tol + @test norm(normTPS.(w[86 ])) < tol + @test norm(normTPS.(w[87 ])) < tol + @test norm(normTPS.(w[88 ])) < tol + @test norm(normTPS.(w[89 ])) < tol + @test norm(normTPS.(w[90 ])) < tol + @test norm(normTPS.(w[91 ])) < tol + @test norm(normTPS.(w[92 ])) < tol + @test norm(normTPS.(w[93 ])) < tol + @test norm(normTPS.(w[94 ])) < tol + @test norm(normTPS.(w[95 ])) < tol + @test norm(normTPS.(w[96 ])) < tol + @test norm(normTPS.(w[97 ])) < tol + @test norm(normTPS.(w[98 ])) < tol + @test norm(normTPS.(w[99 ])) < tol + @test norm(normTPS.(w[100])) < tol + @test norm(normTPS.(w[101])) < tol + @test norm(normTPS.(w[102])) < tol + @test norm(normTPS.(w[103])) < tol + @test norm(normTPS.(w[104])) < tol + @test norm(normTPS.(w[105])) < tol + @test norm(normTPS.(w[106])) < tol + @test norm(normTPS.(w[107])) < tol + @test norm(normTPS.(w[108])) < tol + @test norm(normTPS.(w[109])) < tol + @test norm(normTPS.(w[110])) < tol + @test norm(normTPS.(w[111])) < tol + @test norm(normTPS.(w[112])) < tol + @test norm(normTPS.(w[113])) < tol + @test norm(normTPS.(w[114])) < tol + @test norm(normTPS.(w[115])) < tol + @test norm(normTPS.(w[116])) < tol + @test norm(normTPS.(w[117])) < tol + @test norm(normTPS.(w[118])) < tol + @test norm(normTPS.(w[119])) < tol + @test norm(normTPS.(w[120])) < tol + @test norm(normTPS.(w[121])) < tol + @test norm(normTPS.(w[122])) < tol + @test norm(normTPS.(w[123])) < tol + @test norm(normTPS.(w[124])) < tol + @test norm(normTPS.(w[125])) < tol + @test norm(normTPS.(w[126])) < tol + @test norm(normTPS.(w[127])) < tol + @test norm(normTPS.(w[128])) < tol + @test norm(normTPS.(w[129])) < tol + @test norm(normTPS.(w[130])) < tol + @test norm(normTPS.(w[131])) < tol + @test norm(normTPS.(w[132])) < tol + @test norm(normTPS.(w[133])) < tol + @test norm(normTPS.(w[134])) < tol + @test norm(normTPS.(w[135])) < tol + @test norm(normTPS.(w[136])) < tol + @test norm(normTPS.(w[137])) < tol + @test norm(normTPS.(w[138])) < tol + @test norm(normTPS.(w[139])) < tol + @test norm(normTPS.(w[140])) < tol + @test norm(normTPS.(w[141])) < tol + @test norm(normTPS.(w[142])) < tol + @test norm(normTPS.(w[143])) < tol + @test norm(normTPS.(w[144])) < tol + @test norm(normTPS.(w[145])) < tol + @test norm(normTPS.(w[146])) < tol + @test norm(normTPS.(w[147])) < tol + @test norm(normTPS.(w[148])) < tol + @test norm(normTPS.(w[149])) < tol + @test norm(normTPS.(w[150])) < tol + @test norm(normTPS.(w[151])) < tol + @test norm(normTPS.(w[152])) < tol + @test norm(normTPS.(w[153])) < tol + @test norm(normTPS.(w[154])) < tol + @test norm(normTPS.(w[155])) < tol + @test norm(normTPS.(w[156])) < tol + @test norm(normTPS.(w[157])) < tol + @test norm(normTPS.(w[158])) < tol + @test norm(normTPS.(w[159])) < tol + @test norm(normTPS.(w[160])) < tol + @test norm(normTPS.(w[161])) < tol + @test norm(normTPS.(w[162])) < tol + @test norm(normTPS.(w[163])) < tol + @test norm(normTPS.(w[164])) < tol + @test norm(normTPS.(w[165])) < tol + @test norm(normTPS.(w[166])) < tol + @test norm(normTPS.(w[167])) < tol + @test norm(normTPS.(w[168])) < tol + @test norm(normTPS.(w[169])) < tol + @test norm(normTPS.(w[170])) < tol + @test norm(normTPS.(w[171])) < tol + @test norm(normTPS.(w[172])) < tol + @test norm(normTPS.(w[173])) < tol + @test norm(normTPS.(w[174])) < tol + @test norm(normTPS.(w[175])) < tol + @test norm(normTPS.(w[176])) < tol + @test norm(normTPS.(w[177])) < tol + @test norm(normTPS.(w[178])) < tol + @test norm(normTPS.(w[179])) < tol + @test norm(normTPS.(w[180])) < tol + @test norm(normTPS.(w[181])) < tol + @test norm(normTPS.(w[182])) < tol + @test norm(normTPS.(w[183])) < tol + @test norm(normTPS.(w[184])) < tol + @test norm(normTPS.(w[185])) < tol + @test norm(normTPS.(w[186])) < tol + @test norm(normTPS.(w[187])) < tol + @test norm(normTPS.(w[188])) < tol + @test norm(normTPS.(w[189])) < tol + @test norm(normTPS.(w[190])) < tol + @test norm(normTPS.(w[191])) < tol + @test norm(normTPS.(w[192])) < tol + @test norm(normTPS.(w[193])) < tol + @test norm(normTPS.(w[194])) < tol + @test norm(normTPS.(w[195])) < tol + @test norm(normTPS.(w[196])) < tol + @test norm(normTPS.(w[197])) < tol + @test norm(normTPS.(w[198])) < tol + @test norm(normTPS.(w[199])) < tol + @test norm(normTPS.(w[200])) < tol + @test norm(normTPS.(w[201])) < tol + @test norm(normTPS.(w[202])) < tol + @test norm(normTPS.(w[203])) < tol + @test norm(normTPS.(w[204])) < tol + @test norm(normTPS.(w[205])) < tol + @test norm(normTPS.(w[206])) < tol + @test norm(normTPS.(w[207])) < tol + @test norm(normTPS.(w[208])) < tol + @test norm(normTPS.(w[209])) < tol + @test norm(normTPS.(w[210])) < tol + @test norm(normTPS.(w[211])) < tol + @test norm(normTPS.(w[212])) < tol + @test norm(normTPS.(w[213])) < tol + @test norm(normTPS.(w[214])) < tol + @test norm(normTPS.(w[215])) < tol + @test norm(normTPS.(w[216])) < tol + @test norm(normTPS.(w[217])) < tol + @test norm(normTPS.(w[218])) < tol + @test norm(normTPS.(w[219])) < tol + @test norm(normTPS.(w[220])) < tol + @test norm(normTPS.(w[221])) < tol + @test norm(normTPS.(w[222])) < tol + @test norm(normTPS.(w[223])) < tol + @test norm(normTPS.(w[224])) < tol + @test norm(normTPS.(w[225])) < tol + @test norm(normTPS.(w[226])) < tol + @test norm(normTPS.(w[227])) < tol + @test norm(normTPS.(w[228])) < tol + @test norm(normTPS.(w[229])) < tol + @test norm(normTPS.(w[230])) < tol + @test norm(normTPS.(w[231])) < tol + @test norm(normTPS.(w[232])) < tol + @test norm(normTPS.(w[233])) < tol + @test norm(normTPS.(w[234])) < tol + @test norm(normTPS.(w[235])) < tol + @test norm(normTPS.(w[236])) < tol + @test norm(normTPS.(w[237])) < tol + @test norm(normTPS.(w[238])) < tol + @test norm(normTPS.(w[239])) < tol + @test norm(normTPS.(w[240])) < tol + @test norm(normTPS.(w[241])) < tol + @test norm(normTPS.(w[242])) < tol + @test norm(normTPS.(w[243])) < tol + @test norm(normTPS.(w[244])) < tol + @test norm(normTPS.(w[245])) < tol + @test norm(normTPS.(w[246])) < tol + @test norm(normTPS.(w[247])) < tol + @test norm(normTPS.(w[248])) < tol + + + + @test GTPSA.checktemps() +end + +if VERSION >= v"1.10" + +@testset "FastGTPSA - Broadcast allocations" begin + d = Descriptor(1,5) + w = [[ComplexTPS64()] for i in 1:248] + + t = [TPS(use=d)] + ct = [ComplexTPS64(use=d)] + # Set scalar part so both TPSs are 1 + t[1][0] = 1 + ct[1][0] = 1 + # Now do operators + t1 = TPS.(t) + t1[1][0] = 1 + t2 = TPS.(t) + t2[1][0] = 2 + t3 = TPS.(t) + t3[1][0] = 3 + + ct1 = ComplexTPS64.(ct) + ct1[1][0] = 1 + 1im + ct2 = ComplexTPS64.(ct) + ct2[1][0] = 2 + 2im + ct3 = ComplexTPS64.(ct) + ct3[1][0] = 3 + 3im + + t = ComplexTPS64.(t) + t[1][0] = 0.5+0.5im; t[1][[1]] = 2+2im; t[1][[2]] = 3+3im; t[1][[3]] = 4+4im; t[1][[4]] = 5+5im; t[1][[5]] = 6+6im + v = [0.5+0.5im] + tol = 1e-10 + + # Everything is JIT-ed already so only need 1 sample + # to correctly calculate allocations using interpolation + BenchmarkTools.DEFAULT_PARAMETERS.samples = 1 + + a1 = @benchmark @FastGTPSA begin + y1 = @. $t1 + $t2 - $t3 + y2 = @. $t2 + $t1 - $t3 + y3 = @. $t1 + 2 - $t3 + y4 = @. 2 + $t1 - $t3 + y5 = @. $t3 - $t2 - $t1 + y6 = @. $t2 - $t3 - -$t1 + y7 = @. $t3 - 2 - $t1 + y8 = @. 2 - $t3 - -$t1 + y9 = @. $t2 * $t3 - 6 + y10 =@. $t3 * $t2 - 6 + y11 =@. $t2 * 5 - 10 + y12 =@. 5 * $t2 - 10 * $t1 + y13 =@. $t1 / $t2 - 1/2 + y14 =@. $t2 / $t1 - 2 + y15 =@. 1 / $t2 - 1/2 + y16 =@. $t2 / 3 - 2/3 + y17 =@. $t2 / $t2 - $t1 + y18 =@. $t2 / $t2 - 1 + y19 =@. $t2 ^ $t3 - 8 + y20 =@. $t3 ^ $t2 - 9 + y21 =@. $t2 ^ 3 - 8 + y22 =@. $t2 ^ (1/2) - sqrt(2) + y23 =@. $t2 ^ (1/2) - sqrt($t2) + y24 =@. 2 ^ $t3 - 8 + y25 =@. inv($t3) - 1/$t3 + y26 =@. inv($t3) - 1/3 + y27 =@. $ct1 + $ct2 - $ct3 + y28 =@. $ct2 + $ct1 - $ct3 + y29 =@. $ct1 + (2+2im) - $ct3 + y30 =@. (2+2im) + $ct1 - $ct3 + y31 =@. $ct3 - $ct2 - $ct1 + y32 =@. $ct2 - $ct3 - -$ct1 + y33 =@. $ct3 - (2+2im) - $ct1 + y34 =@. (2+2im) - $ct3 - -$ct1 + y35 =@. $ct2 * $ct3 - (2+2im)*(3+3im) + y36 =@. $ct3 * $ct2 - (2+2im)*(3+3im) + y37 =@. $ct2 * 5 - (10+10im) + y38 =@. 5 * $ct2 - (10 * $ct1) + y39 =@. $ct1 / $ct2 - (1+im)/(2+2im) + y40 =@. $ct2 / $ct1 - 2 + y41 =@. 1 / $ct2 - 1/(2+2im) + y42 =@. $ct2 / 3 - (2+2im)/3 + y43 =@. $ct2 / $ct2 - 1 + y44 =@. $ct2 ^ $ct3 - (2+2im)^(3+3im) + y45 =@. $ct3 ^ $ct2 - (3+3im)^(2+2im) + y46 =@. $ct2 ^ 3 - (2+2im)^3 + y47 =@. $ct2 ^ (1/2) - sqrt(2+2im) + y48 =@. $ct2 ^ (1/2) - sqrt($ct2) + y49 =@. 2 ^ $ct3 - 2^(3+3im) + y50 =@. inv($ct3) - 1/$ct3 + y51 =@. inv($ct3) - 1/(3+3im) + y52 =@. $t1 + $ct2 - (1 + (2+2im)) + y53 =@. $ct2 + $t1 - (1 + (2+2im)) + y54 =@. $t1 + (2+2im) - (1 + (2+2im)) + y55 =@. (2+2im) + $t1 - (1 + (2+2im)) + y56 =@. $t3 - $ct2 - (3 - (2+2im)) + y57 =@. $ct2 - $t3 - ((2+2im) - 3) + y58 =@. $t3 - (2+2im) - (3 - (2+2im)) + y59 =@. (2+2im) - $t3 - ((2+2im) - 3) + y60 =@. $t2 * $ct3 - 2 * (3+3im) + y61 =@. $ct3 * $t2 - 2 * (3+3im) + y62 =@. $t2 * (3+3im) - 2 * (3+3im) + y63 =@. (3+3im) * $t2 - 2 * (3+3im) + y64 =@. $t2 / $ct3 - 2/(3+3im) + y65 =@. $ct3 / $t2 - (3+3im)/2 + y66 =@. $t2 / (3+3im) - 2/(3+3im) + y67 =@. (3+3im) / $t2 - (3+3im)/2 + y68 =@. $t2 ^ $ct3 - 2^(3+3im) + y69 =@. $ct3 ^ $t2 - (3+3im)^2 + y70 =@. $t2 ^ (3+3im) - 2^(3+3im) + y71 =@. (3+3im)^$t2 - (3+3im)^2 + y72 =@. sin($t)^2+cos($t)^2 - 1 + y73 =@. 1/sin($t) - csc($t) + y74 =@. 1/cos($t) - sec($t) + y75 =@. 1/tan($t) - cot($t) + y76 =@. sin($t)/cos($t) - tan($t) + y77 =@. cos(2*$t) - cos($t)^2 + sin($t)^2 + y78 =@. sec($t)^2 - 1 - tan($t)^2 + y79 =@. sin($t/2) - sqrt((1-cos($t))/2) + y80 =@. cos($t/2) - sqrt((1+cos($t))/2) + y81 =@. sqrt(real($t)^2) - abs(real($t)) + y82 =@. csc($t)^2 - cot($t)^2 - 1 + y83 =@. exp(log($t)) - $t + y84 =@. log(exp($t)) - $t + y85 =@. log(exp($t)) - exp(log($t)) + y86 =@. log($t^2) - 2*log($t) + y87 =@. 5*log(real($t)) - log(real($t)^5) + y88 =@. $t*log(5) - log(5^$t) + y89 =@. sinc($t) - sin(pi*$t)/(pi*$t) + y90 =@. sinhc($t/pi) - sinh($t)/$t + y91 =@. exp(im*$t) - cos($t) - im*sin($t) + y92 =@. real(exp(im*real($t))) - cos(real($t)) + y93 =@. imag(exp(im*real($t))) - sin(real($t)) + y94 =@. sinh($t) - (exp($t) - exp(-$t))/2 + y95 =@. cosh($t) - (exp($t) + exp(-$t))/2 + y96 =@. tanh($t) - sinh($t)/cosh($t) + y97 =@. csch($t) - 1/sinh($t) + y98 =@. sech($t) - 1/cosh($t) + y99 =@. coth($t) - cosh($t)/sinh($t) + y100 =@. coth($t) - 1/tanh($t) + y101 =@. cosh($t)^2 - sinh($t)^2 - 1 + y102 =@. 1 - tanh($t)^2 - sech($t)^2 + y103 =@. coth($t)^2 - 1 - csch($t)^2 + y104 =@. asin(sin($t)) - $t + y105 =@. acos(cos($t)) - $t + y106 =@. atan(tan($t)) - $t + y107 =@. acsc(1/$t) - asin($t) + y108 =@. asec(1/$t) - acos($t) + y109 =@. acot(1/$t) - atan($t) + y110 =@. asinh(sinh($t)) - $t + y111 =@. acosh(cosh($t)) - $t + y112 =@. atanh(tanh($t)) - $t + y113 =@. acsch($t) - asinh(1/$t) + y114 =@. asech($t) - acosh(1/$t) + y115 =@. acoth(1/$t) - atanh($t) + y116 =@. asinc($t/pi) - asin($t)/$t + y117 =@. asinhc($t/pi) - asinh($t)/$t + y118 =@. erfc($t) - 1 + erf($t) + y119 =@. erf(-$t) + erf($t) + y120 =@. angle(real($t)) + y121 =@. complex($t) - $t + y122 =@. complex(real($t),real($t)) - (real($t)+im*real($t)) + y123 =@. sin($t)^2+cos($t)^2 - 1 + y124 =@. 1/sin($t) - csc($t) + y125 =@. 1/cos($t) - sec($t) + y126 =@. 1/tan($t) - cot($t) + y127 =@. sin($t)/cos($t) - tan($t) + y128 =@. cos(2*$t) - cos($t)^2 + sin($t)^2 + y129 =@. sec($t)^2 - 1 - tan($t)^2 + y130 =@. sin($t/2) - sqrt((1-cos($t))/2) + y131 =@. cos($t/2) - sqrt((1+cos($t))/2) + y132 =@. sqrt($t^2) - $t + y133 =@. csc($t)^2 - cot($t)^2 - 1 + y134 =@. exp(log($t)) - $t + y135 =@. log(exp($t)) - $t + y136 =@. log(exp($t)) - exp(log($t)) + y137 =@. log($t^2) - 2*log($t) + y138 =@. 5*log($t) - log($t^5) - 2*pi*im + y139 =@. $t*log(5) - log(5^$t) + y140 =@. sinc($t/pi) - sin($t)/$t + y141 =@. sinhc($t/pi) - sinh($t)/$t + y142 =@. exp(im*$t) - cos($t) - im*sin($t) + y143 =@. sinh($t) - (exp($t) - exp(-$t))/2 + y144 =@. cosh($t) - (exp($t) + exp(-$t))/2 + y145 =@. tanh($t) - sinh($t)/cosh($t) + y146 =@. csch($t) - 1/sinh($t) + y147 =@. sech($t) - 1/cosh($t) + y148 =@. coth($t) - cosh($t)/sinh($t) + y149 =@. coth($t) - 1/tanh($t) + y150 =@. cosh($t)^2 - sinh($t)^2 - 1 + y151 =@. 1 - tanh($t)^2 - sech($t)^2 + y152 =@. coth($t)^2 - 1 - csch($t)^2 + y153 =@. asin(sin($t)) - $t + y154 =@. acos(cos($t)) - $t + y155 =@. atan(tan($t)) - $t + y156 =@. acsc($t) - asin(1/$t) + y157 =@. asec($t) - acos(1/$t) + y158 =@. acot($t) - atan(1/$t) + y159 =@. asinh(sinh($t)) - $t + y160 =@. acosh(cosh($t)) - $t + y161 =@. atanh(tanh($t)) - $t + y162 =@. acsch($t) - asinh(1/$t) + y163 =@. asech($t) - acosh(1/$t) + y164 =@. acoth($t) - atanh(1/$t) + y165 =@. asinc($t/pi) - asin($t)/$t + y166 =@. asinhc($t/pi) - asinh($t)/$t + y167 =@. erfc($t) - 1 + erf($t) + y168 =@. erf(-$t) + erf($t) + y169 =@. angle($t) - atan(imag($t),real($t)) + y170 =@. complex($t) - $t + end + + @test a1.allocs == 170*3 + a2 = @benchmark @FastGTPSA! begin + @. $w[1 ]= $t1 + $t2 - $t3 + @. $w[2 ]= $t2 + $t1 - $t3 + @. $w[3 ]= $t1 + 2 - $t3 + @. $w[4 ]= 2 + $t1 - $t3 + @. $w[5 ]= $t3 - $t2 - $t1 + @. $w[6 ]= $t2 - $t3 - -$t1 + @. $w[7 ]= $t3 - 2 - $t1 + @. $w[8 ]= 2 - $t3 - -$t1 + @. $w[9 ]=$t2 * $t3 - 6 + @. $w[10 ]= $t3 * $t2 - 6 + @. $w[11 ]= $t2 * 5 - 10 + @. $w[12 ]= 5 * $t2 - 10 * $t1 + @. $w[13 ]= $t1 / $t2 - 1/2 + @. $w[14 ]= $t2 / $t1 - 2 + @. $w[15 ]= 1 / $t2 - 1/2 + @. $w[16 ]= $t2 / 3 - 2/3 + @. $w[17 ]= $t2 / $t2 - $t1 + @. $w[18 ]= $t2 / $t2 - 1 + @. $w[19 ]= $t2 ^ $t3 - 8 + @. $w[20 ]= $t3 ^ $t2 - 9 + @. $w[21 ]= $t2 ^ 3 - 8 + @. $w[22 ]= $t2 ^ (1/2) - sqrt(2) + @. $w[23 ]= $t2 ^ (1/2) - sqrt($t2) + @. $w[24 ]= 2 ^ $t3 - 8 + @. $w[25 ]= inv($t3) - 1/$t3 + @. $w[26 ]= inv($t3) - 1/3 + @. $w[27 ]= $ct1 + $ct2 - $ct3 + @. $w[28 ]= $ct2 + $ct1 - $ct3 + @. $w[29 ]= $ct1 + (2+2im) - $ct3 + @. $w[30 ]= (2+2im) + $ct1 - $ct3 + @. $w[31 ]= $ct3 - $ct2 - $ct1 + @. $w[32 ]= $ct2 - $ct3 - -$ct1 + @. $w[33 ]= $ct3 - (2+2im) - $ct1 + @. $w[34 ]= (2+2im) - $ct3 - -$ct1 + @. $w[35 ]= $ct2 * $ct3 - (2+2im)*(3+3im) + @. $w[36 ]= $ct3 * $ct2 - (2+2im)*(3+3im) + @. $w[37 ]= $ct2 * 5 - (10+10im) + @. $w[38 ]= 5 * $ct2 - (10 * $ct1) + @. $w[39 ]= $ct1 / $ct2 - (1+im)/(2+2im) + @. $w[40 ]= $ct2 / $ct1 - 2 + @. $w[41 ]= 1 / $ct2 - 1/(2+2im) + @. $w[42 ]= $ct2 / 3 - (2+2im)/3 + @. $w[43 ]= $ct2 / $ct2 - 1 + @. $w[44 ]= $ct2 ^ $ct3 - (2+2im)^(3+3im) + @. $w[45 ]= $ct3 ^ $ct2 - (3+3im)^(2+2im) + @. $w[46 ]= $ct2 ^ 3 - (2+2im)^3 + @. $w[47 ]= $ct2 ^ (1/2) - sqrt(2+2im) + @. $w[48 ]= $ct2 ^ (1/2) - sqrt($ct2) + @. $w[49 ]= 2 ^ $ct3 - 2^(3+3im) + @. $w[50 ]= inv($ct3) - 1/$ct3 + @. $w[51 ]= inv($ct3) - 1/(3+3im) + @. $w[52 ]= $t1 + $ct2 - (1 + (2+2im)) + @. $w[53 ]= $ct2 + $t1 - (1 + (2+2im)) + @. $w[54 ]= $t1 + (2+2im) - (1 + (2+2im)) + @. $w[55 ]= (2+2im) + $t1 - (1 + (2+2im)) + @. $w[56 ]= $t3 - $ct2 - (3 - (2+2im)) + @. $w[57 ]= $ct2 - $t3 - ((2+2im) - 3) + @. $w[58 ]= $t3 - (2+2im) - (3 - (2+2im)) + @. $w[59 ]= (2+2im) - $t3 - ((2+2im) - 3) + @. $w[60 ]= $t2 * $ct3 - 2 * (3+3im) + @. $w[61 ]= $ct3 * $t2 - 2 * (3+3im) + @. $w[62 ]= $t2 * (3+3im) - 2 * (3+3im) + @. $w[63 ]= (3+3im) * $t2 - 2 * (3+3im) + @. $w[64 ]= $t2 / $ct3 - 2/(3+3im) + @. $w[65 ]= $ct3 / $t2 - (3+3im)/2 + @. $w[66 ]= $t2 / (3+3im) - 2/(3+3im) + @. $w[67 ]= (3+3im) / $t2 - (3+3im)/2 + @. $w[68 ]= $t2 ^ $ct3 - 2^(3+3im) + @. $w[69 ]= $ct3 ^ $t2 - (3+3im)^2 + @. $w[70 ]= $t2 ^ (3+3im) - 2^(3+3im) + @. $w[71 ]= (3+3im)^$t2 - (3+3im)^2 + @. $w[72 ]= sin($t)^2+cos($t)^2 - 1 + @. $w[73 ]= 1/sin($t) - csc($t) + @. $w[74 ]= 1/cos($t) - sec($t) + @. $w[75 ]= 1/tan($t) - cot($t) + @. $w[76 ]= sin($t)/cos($t) - tan($t) + @. $w[77 ]= cos(2*$t) - cos($t)^2 + sin($t)^2 + @. $w[78 ]= sec($t)^2 - 1 - tan($t)^2 + @. $w[79 ]= sin($t/2) - sqrt((1-cos($t))/2) + @. $w[80 ]= cos($t/2) - sqrt((1+cos($t))/2) + @. $w[81 ]= sqrt(real($t)^2) - abs(real($t)) + @. $w[82 ]= csc($t)^2 - cot($t)^2 - 1 + @. $w[83 ]= exp(log($t)) - $t + @. $w[84 ]= log(exp($t)) - $t + @. $w[85 ]= log(exp($t)) - exp(log($t)) + @. $w[86 ]= log($t^2) - 2*log($t) + @. $w[87 ]= 5*log(real($t)) - log(real($t)^5) + @. $w[88 ]= $t*log(5) - log(5^$t) + @. $w[89 ]= sinc($t) - sin(pi*$t)/(pi*$t) + @. $w[90 ]= sinhc($t/pi) - sinh($t)/$t + @. $w[91 ]= exp(im*$t) - cos($t) - im*sin($t) + @. $w[92 ]= real(exp(im*real($t))) - cos(real($t)) + @. $w[93 ]= imag(exp(im*real($t))) - sin(real($t)) + @. $w[94 ]= sinh($t) - (exp($t) - exp(-$t))/2 + @. $w[95 ]= cosh($t) - (exp($t) + exp(-$t))/2 + @. $w[96 ]= tanh($t) - sinh($t)/cosh($t) + @. $w[97 ]= csch($t) - 1/sinh($t) + @. $w[98 ]= sech($t) - 1/cosh($t) + @. $w[99 ]= coth($t) - cosh($t)/sinh($t) + @. $w[100] = coth($t) - 1/tanh($t) + @. $w[101] = cosh($t)^2 - sinh($t)^2 - 1 + @. $w[102] = 1 - tanh($t)^2 - sech($t)^2 + @. $w[103] = coth($t)^2 - 1 - csch($t)^2 + @. $w[104] = asin(sin($t)) - $t + @. $w[105] = acos(cos($t)) - $t + @. $w[106] = atan(tan($t)) - $t + @. $w[107] = acsc(1/$t) - asin($t) + @. $w[108] = asec(1/$t) - acos($t) + @. $w[109] = acot(1/$t) - atan($t) + @. $w[110] = asinh(sinh($t)) - $t + @. $w[111] = acosh(cosh($t)) - $t + @. $w[112] = atanh(tanh($t)) - $t + @. $w[113] = acsch($t) - asinh(1/$t) + @. $w[114] = asech($t) - acosh(1/$t) + @. $w[115] = acoth(1/$t) - atanh($t) + @. $w[116] = asinc($t/pi) - asin($t)/$t + @. $w[117] = asinhc($t/pi) - asinh($t)/$t + @. $w[118] = erfc($t) - 1 + erf($t) + @. $w[119] = erf(-$t) + erf($t) + @. $w[120] = angle(real($t)) + @. $w[121] = complex($t) - $t + @. $w[122] = complex(real($t),real($t)) - (real($t)+im*real($t)) + @. $w[123] = sin($t)^2+cos($t)^2 - 1 + @. $w[124] = 1/sin($t) - csc($t) + @. $w[125] = 1/cos($t) - sec($t) + @. $w[126] = 1/tan($t) - cot($t) + @. $w[127] = sin($t)/cos($t) - tan($t) + @. $w[128] = cos(2*$t) - cos($t)^2 + sin($t)^2 + @. $w[129] = sec($t)^2 - 1 - tan($t)^2 + @. $w[130] = sin($t/2) - sqrt((1-cos($t))/2) + @. $w[131] = cos($t/2) - sqrt((1+cos($t))/2) + @. $w[132] = sqrt($t^2) - $t + @. $w[133] = csc($t)^2 - cot($t)^2 - 1 + @. $w[134] = exp(log($t)) - $t + @. $w[135] = log(exp($t)) - $t + @. $w[136] = log(exp($t)) - exp(log($t)) + @. $w[137] = log($t^2) - 2*log($t) + @. $w[138] = 5*log($t) - log($t^5) - 2*pi*im + @. $w[139] = $t*log(5) - log(5^$t) + @. $w[140] = sinc($t/pi) - sin($t)/$t + @. $w[141] = sinhc($t/pi) - sinh($t)/$t + @. $w[142] = exp(im*$t) - cos($t) - im*sin($t) + @. $w[143] = sinh($t) - (exp($t) - exp(-$t))/2 + @. $w[144] = cosh($t) - (exp($t) + exp(-$t))/2 + @. $w[145] = tanh($t) - sinh($t)/cosh($t) + @. $w[146] = csch($t) - 1/sinh($t) + @. $w[147] = sech($t) - 1/cosh($t) + @. $w[148] = coth($t) - cosh($t)/sinh($t) + @. $w[149] = coth($t) - 1/tanh($t) + @. $w[150] = cosh($t)^2 - sinh($t)^2 - 1 + @. $w[151] = 1 - tanh($t)^2 - sech($t)^2 + @. $w[152] = coth($t)^2 - 1 - csch($t)^2 + @. $w[153] = asin(sin($t)) - $t + @. $w[154] = acos(cos($t)) - $t + @. $w[155] = atan(tan($t)) - $t + @. $w[156] = acsc($t) - asin(1/$t) + @. $w[157] = asec($t) - acos(1/$t) + @. $w[158] = acot($t) - atan(1/$t) + @. $w[159] = asinh(sinh($t)) - $t + @. $w[160] = acosh(cosh($t)) - $t + @. $w[161] = atanh(tanh($t)) - $t + @. $w[162] = acsch($t) - asinh(1/$t) + @. $w[163] = asech($t) - acosh(1/$t) + @. $w[164] = acoth($t) - atanh(1/$t) + @. $w[165] = asinc($t/pi) - asin($t)/$t + @. $w[166] = asinhc($t/pi) - asinh($t)/$t + @. $w[167] = erfc($t) - 1 + erf($t) + @. $w[168] = erf(-$t) + erf($t) + @. $w[169] = angle($t) - atan(imag($t),real($t)) + @. $w[170] = complex($t) - $t + end + @test a2.allocs == 0 + + t[1] = ComplexTPS64(0.5+0.5im) + a1 = @benchmark @FastGTPSA begin + y171 = @. sqrt($t) - sqrt($v) + y172 = @. exp($t) - exp($v) + y173 = @. log($t) - log($v) + y174 = @. sin($t) - sin($v) + y175 = @. cos($t) - cos($v) + y176 = @. tan($t) - tan($v) + y177 = @. csc($t) - csc($v) + y178 = @. sec($t) - sec($v) + y179 = @. cot($t) - cot($v) + y180 = @. sinc($t) - sinc($v) + y181 = @. sinh($t) - sinh($v) + y182 = @. cosh($t) - cosh($v) + y183 = @. tanh($t) - tanh($v) + y184 = @. csch($t) - csch($v) + y185 = @. sech($t) - sech($v) + y186 = @. coth($t) - coth($v) + y187 = @. asin($t) - asin($v) + y188 = @. acos($t) - acos($v) + y189 = @. atan($t) - atan($v) + y190 = @. acsc($t) - acsc($v) + y191 = @. asec($t) - asec($v) + y192 = @. acot($t) - acot($v) + y193 = @. asinh($t) - asinh($v) + y194 = @. acosh($t) - acosh($v) + y195 = @. atanh($t) - atanh($v) + y196 = @. acsch($t) - acsch($v) + y197 = @. asech($t) - asech($v) + y198 = @. acoth($t) - acoth($v) + y199 = @. asinc($t/pi) - asin($v)/$v + y200 = @. asinhc($t/pi) - asinh($v)/$v + y201 = @. zero($t) - zero($v) + y202 = @. real($t) - real($v) + y203 = @. imag($t) - imag($v) + y204 = @. conj($t) - conj($v) + y205 = @. sinhc($t/pi) - sinh($v)/$v + y206 = @. erf($t) - erf($v) + y207 = @. erfc($t) - erfc($v) + y208 = @. -im*erf($t*im) - erfi($v) + y219 = @. angle($t2+im*$t3) - angle(2+3im) + y220 = @. angle($t2-im*$t3) - angle(2-3im) + y221 = @. angle(-$t2-im*$t3) - angle(-2-3im) + y222 = @. angle(-$t2+im*$t3) - angle(-2+3im) + y223 = @. angle($ct2) - angle(2+2im) + y224 = @. angle(-$ct2) - angle(-2-2im) + y225 = @. complex($ct3) - complex(3+3im) + y226 = @. polar($ct2) - (abs(2+2im)+im*angle(2+2im)) + y227 = @. polar(-$ct1) - (abs(-1-im)+im*angle(-1-im)) + y228 = @. rect($ct2) - (2*cos(2) + im*2*sin(2)) + y229 = @. rect(-$ct1) - (-1*cos(-1) + im*-1*sin(-1)) + y248 = @. abs(-$t) - abs(-$v) + end + @test a1.allocs == 50*3 + + a2 = @benchmark @FastGTPSA! begin + @. $w[171] = sqrt($t) - sqrt($v) + @. $w[172] = exp($t) - exp($v) + @. $w[173] = log($t) - log($v) + @. $w[174] = sin($t) - sin($v) + @. $w[175] = cos($t) - cos($v) + @. $w[176] = tan($t) - tan($v) + @. $w[177] = csc($t) - csc($v) + @. $w[178] = sec($t) - sec($v) + @. $w[179] = cot($t) - cot($v) + @. $w[180] = sinc($t) - sinc($v) + @. $w[181] = sinh($t) - sinh($v) + @. $w[182] = cosh($t) - cosh($v) + @. $w[183] = tanh($t) - tanh($v) + @. $w[184] = csch($t) - csch($v) + @. $w[185] = sech($t) - sech($v) + @. $w[186] = coth($t) - coth($v) + @. $w[187] = asin($t) - asin($v) + @. $w[188] = acos($t) - acos($v) + @. $w[189] = atan($t) - atan($v) + @. $w[190] = acsc($t) - acsc($v) + @. $w[191] = asec($t) - asec($v) + @. $w[192] = acot($t) - acot($v) + @. $w[193] = asinh($t) - asinh($v) + @. $w[194] = acosh($t) - acosh($v) + @. $w[195] = atanh($t) - atanh($v) + @. $w[196] = acsch($t) - acsch($v) + @. $w[197] = asech($t) - asech($v) + @. $w[198] = acoth($t) - acoth($v) + @. $w[199] = asinc($t/pi) - asin($v)/$v + @. $w[200] = asinhc($t/pi) - asinh($v)/$v + @. $w[201] = zero($t) - zero($v) + @. $w[202] = real($t) - real($v) + @. $w[203] = imag($t) - imag($v) + @. $w[204] = conj($t) - conj($v) + @. $w[205] = sinhc($t/pi) - sinh($v)/$v + @. $w[206] = erf($t) - erf($v) + @. $w[207] = erfc($t) - erfc($v) + @. $w[208] = -im*erf($t*im) - erfi($v) + @. $w[219] = angle($t2+im*$t3) - angle(2+3im) + @. $w[220] = angle($t2-im*$t3) - angle(2-3im) + @. $w[221] = angle(-$t2-im*$t3) - angle(-2-3im) + @. $w[222] = angle(-$t2+im*$t3) - angle(-2+3im) + @. $w[223] = angle($ct2) - angle(2+2im) + @. $w[224] = angle(-$ct2) - angle(-2-2im) + @. $w[225] = complex($ct3) - complex(3+3im) + @. $w[226] = polar($ct2) - (abs(2+2im)+im*angle(2+2im)) + @. $w[227] = polar(-$ct1) - (abs(-1-im)+im*angle(-1-im)) + @. $w[228] = rect($ct2) - (2*cos(2) + im*2*sin(2)) + @. $w[229] = rect(-$ct1) - (-1*cos(-1) + im*-1*sin(-1)) + @. $w[248] = abs(-$t) - abs(-$v) + end + @test a2.allocs == 0 + @test GTPSA.checktemps() +end + end @testset "Taylor map benchmark against ForwardDiff" begin