Commit Graph

10 Commits

Author SHA1 Message Date
Bård Skaflestad
6ed2b129cb Implement constant() and variable() in terms of function()
Specifically,

  - A constant is a function with zero derivative
  - A variable is a function with unit derivative with respect to
    itself.
2013-04-30 13:41:13 +02:00
Bård Skaflestad
134b9b1a7f Readjust whitespace to original conventions. 2013-04-30 11:52:03 +02:00
Atgeirr Flø Rasmussen
0bf693e8c0 Merge remote-tracking branch 'bska/master' 2013-04-30 11:07:13 +02:00
Atgeirr Flø Rasmussen
42cdfa27a0 Use named constructor pattern.
Made AutoDiff::Forward constructor private.
Added static methods constant(), variable(x) and function(x, dx).
2013-04-30 11:05:59 +02:00
Bård Skaflestad
6319c428a3 Don't return values from update operators.
Statements like

   a = b += c

make no sense
2013-04-30 10:47:00 +02:00
Bård Skaflestad
0ff3b721ee Rename members to better reflect purpose.
Specifically,

  - x_  -> val_
  - dx_ -> der_
2013-04-30 09:25:37 +02:00
Bård Skaflestad
011ab5ee93 Operator *=(): Use correct derivative chain rule
Updating the derivative using '*=' is just plain wrong.
2013-04-29 23:53:31 +02:00
Bård Skaflestad
72d6d32095 Don't use updated values for computing derivatives
We must not overwrite the current evaluation point until all the
derivative values have been calculated.  Otherwise, the derivatives
will differ from that of the actual values.
2013-04-29 23:28:49 +02:00
Bård Skaflestad
8105166c26 Fix misprint in Forward/Scalar case. 2013-04-29 14:51:28 +02:00
Bård Skaflestad
b05f65ae70 Add simple library for automatic differentiation
No build system or automatic test cases at this point.
2013-04-29 13:39:57 +02:00