Skip to content

Commit

Permalink
Refactor functions (#99)
Browse files Browse the repository at this point in the history
* More homegeneous structure for * and / for Taylor1 and TaylorN

Among others, mulHomogCoeff -> mul! and divHomogCoeff -> div!, and
internal changes.

* Fix getindex for Taylor1 and TaylorN and get rid of fixorder in * and /

Also introduce div! for TaylorN polynomials

* Fix an evaluate method and remove fixorder

fixorder is not needed anymore since getindex was fixed and returns
zero of appropriate type whenever the requested coefficient is well
inside the maximum order, but not defined as such.

* Use Base.power_by_squaring instead of defining more methods

* Metaprogramming for * and mul!, and cleanup code

* Refactor ^, square and sqrt and related functions for homogeneous coefficients

The following functions for the homogeneous coefficients
have been renamed: powerHomogCoef -> pow!, squareHomogCoef -> sqr!,
sqrtHomogCoef -> sqrt!

* Metaprogramming for the elementary functions and recurrence relations

This allows a more smooth approach for Taylor1 and TaylorN functions.

* Some metaprogramming in other_functions.jl

* Adapt docs/src/api.md to changes in the naming of functions

* Fix two tests

* Add `add!` and `subst!` for completeness, and tests

* Add methods for zero and one and metaprogramming for auxiliary functions

* Add constant_term and max_order, and reduce repeated code

* Add zero_korder and reduce code duplication

Also, eliminate an unused function (fdot) in src/other_functions

* Address comments pointed out in code review, and rename reverse -> inverse

Some tests have been modified to reflect current functionality.

* Add tests related to new functions, some docstrings, and update api.md

* Improve memory allocation mainly for TaylorN using mul!

* Two more small changes

* Add more tests for TaylorN
  • Loading branch information
lbenet committed Mar 25, 2017
1 parent 487cb8b commit 0697deb
Show file tree
Hide file tree
Showing 13 changed files with 1,095 additions and 1,275 deletions.
48 changes: 18 additions & 30 deletions docs/src/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,6 @@ integrate
gradient
jacobian
hessian
*
/
^
sqrt
exp
log
sin
cos
tan
asin
acos
atan
sinh
cosh
tanh
abs
```

### Internals
Expand All @@ -57,20 +41,24 @@ generate_index_vectors
in_base
make_inverse_dict
order_posTb
max_order
resize_coeffs1!
resize_coeffsHP!
zero_korder
constant_term
mul!
mulHomogCoef
divHomogCoef
powHomogCoef
squareHomogCoef
sqrtHomogCoef
expHomogCoef
logHomogCoef
sincosHomogCoef
tanHomogCoef
asinHomogCoef
acosHomogCoef
atanHomogCoef
sinhcoshHomogCoef
tanhHomogCoef
div!
pow!
sqr!
sqrt!
exp!
log!
sincos!
tan!
asin!
acos!
atan!
sinhcosh!
tanh!
A_mul_B!
```
4 changes: 2 additions & 2 deletions src/TaylorSeries.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ import Base: zero, one, zeros, ones, isinf, isnan,
rem, mod, mod2pi, abs, gradient,
sqrt, exp, log, sin, cos, tan,
asin, acos, atan, sinh, cosh, tanh,
reverse, A_mul_B!,
A_mul_B!,
getindex, setindex!, endof

export Taylor1, TaylorN, HomogeneousPolynomial, AbstractSeries

export get_coeff, derivative, integrate,
evaluate, evaluate!,
evaluate, evaluate!, inverse,
show_params_TaylorN,
get_order, get_numvars,
set_variables, get_variables,
Expand Down
Loading

0 comments on commit 0697deb

Please sign in to comment.