Skip to content

Commit

Permalink
clearord
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsignorelli committed May 3, 2024
1 parent 6c9e55e commit 8ec55c4
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 1 deletion.
2 changes: 2 additions & 0 deletions docs/src/man/k_methods.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# [TPS Methods](@id tpsmethods)
```@docs
clearord
clearord!
clear!
complex!
compose!
Expand Down
2 changes: 1 addition & 1 deletion docs/src/man/o_all.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ rand
**`LinearAlgebra`**: `norm`, `mul!`
**`SpecialFunctions`**: `erf`, `erfc`

`GTPSA.jl` also provides the following functions NOT included in Base or any of the above packages:
`GTPSA.jl` also provides the following functions NOT included in Base or any of the above packages (and not already documented in [TPS Methods](@ref tpsmethods)):
```
add!, sub!, div!, unit, sinhc, asinc, asinhc, polar, rect
```
Expand Down
1 change: 1 addition & 0 deletions src/GTPSA.jl
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ export
deriv, ∂, deriv!, ∂!,
getord, getord!,
cutord, cutord!,
clearord, clearord!,
translate, translate!,
par,
scalar,
Expand Down
24 changes: 24 additions & 0 deletions src/methods.jl
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,30 @@ function cutord(t1::Union{TPS, ComplexTPS}, order::Integer)
return t
end

# --- clearord! ---
clrord!(t::Ptr{RTPSA}, ord::Cuchar) = mad_tpsa_clrord!(t, ord)
clrord!(t::Ptr{CTPSA}, ord::Cuchar) = mad_ctpsa_clrord!(t, ord)

"""
clearord!(t::Union{TPS,ComplexTPS}, order::Integer)
Clears all monomial coefficients in `t` at order `order`.
"""
clearord!(t::Union{TPS,ComplexTPS}, order::Integer) = clrord!(t.tpsa, convert(Cuchar, order))

"""
clearord(t1::Union{TPS,ComplexTPS}, order::Integer)
Returns a new TPS equal to `t1` but with all monomial coefficients
at the given `order` cleared (set equal to 0).
"""
function clearord(t1::Union{TPS,ComplexTPS}, order::Integer)
t = zero(t1)
copy!(t,t1)
clearord!(t,order)
return t
end


# --- scalar ---
"""
Expand Down

0 comments on commit 8ec55c4

Please sign in to comment.