Skip to content

Commit

Permalink
better wording
Browse files Browse the repository at this point in the history
  • Loading branch information
jrevels committed Oct 31, 2016
1 parent d2c2446 commit 3297662
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 27 deletions.
44 changes: 22 additions & 22 deletions docs/build/diffresult.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* [ReverseDiff](https://github.com/JuliaDiff/ReverseDiff.jl)


Many differentiation techniques can calculate primal values and multiple orders of derivatives simultaneously. In other words, there are techniques that allow one to compute `f(x)`, `∇f(x)` and `H(f(x))` in one fell swoop!
Many differentiation techniques can calculate primal values and multiple orders of derivatives simultaneously. In other words, there are techniques for computing `f(x)`, `∇f(x)` and `H(f(x))` in one fell swoop!


For this purpose, DiffBase provides the `DiffResult` type, which can be passed to in-place differentiation methods instead of an output buffer. All results computed by the method are loaded into the given `DiffResult`, which the user can then query using DiffBase's API.
Expand Down Expand Up @@ -69,7 +69,7 @@ Return a `DiffResult` instance where values will be stored in the provided `valu
Note that the arguments can be `Number`s or `AbstractArray`s, depending on the dimensionality of your target function.


<a target='_blank' href='https://github.com/JuliaDiff/DiffBase.jl/tree/ef761a393854a7db0ec0da9a1a05b6c71481dc03/src/results.jl#L11-L19' class='documenter-source'>source</a><br>
<a target='_blank' href='https://github.com/JuliaDiff/DiffBase.jl/tree/d2c2446410bd214a9db2560b04078cc2f8c2a4a7/src/results.jl#L11-L19' class='documenter-source'>source</a><br>


```
Expand All @@ -79,7 +79,7 @@ DiffResult(value, derivs...)
Equivalent to `DiffResult(value, derivs::Tuple)`, where `derivs...` is the splatted form of `derivs::Tuple`.


<a target='_blank' href='https://github.com/JuliaDiff/DiffBase.jl/tree/ef761a393854a7db0ec0da9a1a05b6c71481dc03/src/results.jl#L22-L26' class='documenter-source'>source</a><br>
<a target='_blank' href='https://github.com/JuliaDiff/DiffBase.jl/tree/d2c2446410bd214a9db2560b04078cc2f8c2a4a7/src/results.jl#L22-L26' class='documenter-source'>source</a><br>

<a id='DiffBase.JacobianResult' href='#DiffBase.JacobianResult'>#</a>
**`DiffBase.JacobianResult`** &mdash; *Function*.
Expand All @@ -95,7 +95,7 @@ Construct a `DiffResult` that can be used for Jacobian calculations where `x` is
Note that `JacobianResult` allocates its own storage; `x` is only used for type and shape information. If you want to allocate storage yourself, use the `DiffResult` constructor instead.


<a target='_blank' href='https://github.com/JuliaDiff/DiffBase.jl/tree/ef761a393854a7db0ec0da9a1a05b6c71481dc03/src/results.jl#L41-L51' class='documenter-source'>source</a><br>
<a target='_blank' href='https://github.com/JuliaDiff/DiffBase.jl/tree/d2c2446410bd214a9db2560b04078cc2f8c2a4a7/src/results.jl#L41-L51' class='documenter-source'>source</a><br>


```
Expand All @@ -107,7 +107,7 @@ Construct a `DiffResult` that can be used for Jacobian calculations where `x` is
Like the single argument version, `y` and `x` are only used for type and shape information and are not stored in the returned `DiffResult`.


<a target='_blank' href='https://github.com/JuliaDiff/DiffBase.jl/tree/ef761a393854a7db0ec0da9a1a05b6c71481dc03/src/results.jl#L54-L63' class='documenter-source'>source</a><br>
<a target='_blank' href='https://github.com/JuliaDiff/DiffBase.jl/tree/d2c2446410bd214a9db2560b04078cc2f8c2a4a7/src/results.jl#L54-L63' class='documenter-source'>source</a><br>

<a id='DiffBase.GradientResult' href='#DiffBase.GradientResult'>#</a>
**`DiffBase.GradientResult`** &mdash; *Function*.
Expand All @@ -123,7 +123,7 @@ Construct a `DiffResult` that can be used for gradient calculations where `x` is
Note that `GradientResult` allocates its own storage; `x` is only used for type and shape information. If you want to allocate storage yourself, use the `DiffResult` constructor instead.


<a target='_blank' href='https://github.com/JuliaDiff/DiffBase.jl/tree/ef761a393854a7db0ec0da9a1a05b6c71481dc03/src/results.jl#L29-L38' class='documenter-source'>source</a><br>
<a target='_blank' href='https://github.com/JuliaDiff/DiffBase.jl/tree/d2c2446410bd214a9db2560b04078cc2f8c2a4a7/src/results.jl#L29-L38' class='documenter-source'>source</a><br>

<a id='DiffBase.HessianResult' href='#DiffBase.HessianResult'>#</a>
**`DiffBase.HessianResult`** &mdash; *Function*.
Expand All @@ -139,7 +139,7 @@ Construct a `DiffResult` that can be used for Hessian calculations where `x` is
Note that `HessianResult` allocates its own storage; `x` is only used for type and shape information. If you want to allocate storage yourself, use the `DiffResult` constructor instead.


<a target='_blank' href='https://github.com/JuliaDiff/DiffBase.jl/tree/ef761a393854a7db0ec0da9a1a05b6c71481dc03/src/results.jl#L66-L75' class='documenter-source'>source</a><br>
<a target='_blank' href='https://github.com/JuliaDiff/DiffBase.jl/tree/d2c2446410bd214a9db2560b04078cc2f8c2a4a7/src/results.jl#L66-L75' class='documenter-source'>source</a><br>


<a id='Accessing-data-from-DiffResults-1'></a>
Expand All @@ -160,7 +160,7 @@ Return the primal value stored in `r`.
Note that this method returns a reference, not a copy. Thus, if `value(r)` is mutable, mutating `value(r)` will mutate `r`.


<a target='_blank' href='https://github.com/JuliaDiff/DiffBase.jl/tree/ef761a393854a7db0ec0da9a1a05b6c71481dc03/src/results.jl#L88-L95' class='documenter-source'>source</a><br>
<a target='_blank' href='https://github.com/JuliaDiff/DiffBase.jl/tree/d2c2446410bd214a9db2560b04078cc2f8c2a4a7/src/results.jl#L88-L95' class='documenter-source'>source</a><br>

<a id='DiffBase.derivative' href='#DiffBase.derivative'>#</a>
**`DiffBase.derivative`** &mdash; *Function*.
Expand All @@ -176,7 +176,7 @@ Return the `ith` derivative stored in `r`, defaulting to the first derivative.
Note that this method returns a reference, not a copy. Thus, if `derivative(r)` is mutable, mutating `derivative(r)` will mutate `r`.


<a target='_blank' href='https://github.com/JuliaDiff/DiffBase.jl/tree/ef761a393854a7db0ec0da9a1a05b6c71481dc03/src/results.jl#L117-L124' class='documenter-source'>source</a><br>
<a target='_blank' href='https://github.com/JuliaDiff/DiffBase.jl/tree/d2c2446410bd214a9db2560b04078cc2f8c2a4a7/src/results.jl#L117-L124' class='documenter-source'>source</a><br>

<a id='DiffBase.gradient' href='#DiffBase.gradient'>#</a>
**`DiffBase.gradient`** &mdash; *Function*.
Expand All @@ -192,7 +192,7 @@ Return the gradient stored in `r` (equivalent to `derivative(r)`).
Note that this method returns a reference, not a copy. Thus, if `gradient(r)` is mutable, mutating `gradient(r)` will mutate `r`.


<a target='_blank' href='https://github.com/JuliaDiff/DiffBase.jl/tree/ef761a393854a7db0ec0da9a1a05b6c71481dc03/src/results.jl#L167-L174' class='documenter-source'>source</a><br>
<a target='_blank' href='https://github.com/JuliaDiff/DiffBase.jl/tree/d2c2446410bd214a9db2560b04078cc2f8c2a4a7/src/results.jl#L167-L174' class='documenter-source'>source</a><br>

<a id='DiffBase.jacobian' href='#DiffBase.jacobian'>#</a>
**`DiffBase.jacobian`** &mdash; *Function*.
Expand All @@ -208,7 +208,7 @@ Return the Jacobian stored in `r` (equivalent to `derivative(r)`).
Note that this method returns a reference, not a copy. Thus, if `jacobian(r)` is mutable, mutating `jacobian(r)` will mutate `r`.


<a target='_blank' href='https://github.com/JuliaDiff/DiffBase.jl/tree/ef761a393854a7db0ec0da9a1a05b6c71481dc03/src/results.jl#L192-L199' class='documenter-source'>source</a><br>
<a target='_blank' href='https://github.com/JuliaDiff/DiffBase.jl/tree/d2c2446410bd214a9db2560b04078cc2f8c2a4a7/src/results.jl#L192-L199' class='documenter-source'>source</a><br>

<a id='DiffBase.hessian' href='#DiffBase.hessian'>#</a>
**`DiffBase.hessian`** &mdash; *Function*.
Expand All @@ -224,7 +224,7 @@ Return the Hessian stored in `r` (equivalent to `derivative(r, Val{2})`).
Note that this method returns a reference, not a copy. Thus, if `hessian(r)` is mutable, mutating `hessian(r)` will mutate `r`.


<a target='_blank' href='https://github.com/JuliaDiff/DiffBase.jl/tree/ef761a393854a7db0ec0da9a1a05b6c71481dc03/src/results.jl#L217-L224' class='documenter-source'>source</a><br>
<a target='_blank' href='https://github.com/JuliaDiff/DiffBase.jl/tree/d2c2446410bd214a9db2560b04078cc2f8c2a4a7/src/results.jl#L217-L224' class='documenter-source'>source</a><br>


<a id='Mutating-DiffResults-1'></a>
Expand All @@ -243,7 +243,7 @@ value!(r::DiffResult, x)
Copy `x` into `r`'s value storage, such that `value(r) == x`.


<a target='_blank' href='https://github.com/JuliaDiff/DiffBase.jl/tree/ef761a393854a7db0ec0da9a1a05b6c71481dc03/src/results.jl#L98-L102' class='documenter-source'>source</a><br>
<a target='_blank' href='https://github.com/JuliaDiff/DiffBase.jl/tree/d2c2446410bd214a9db2560b04078cc2f8c2a4a7/src/results.jl#L98-L102' class='documenter-source'>source</a><br>


```
Expand All @@ -253,7 +253,7 @@ value!(f, r::DiffResult, x)
Like `value!(r::DiffResult, x)`, but with `f` applied to each element, such that `value(r) == map(f, x)`.


<a target='_blank' href='https://github.com/JuliaDiff/DiffBase.jl/tree/ef761a393854a7db0ec0da9a1a05b6c71481dc03/src/results.jl#L106-L110' class='documenter-source'>source</a><br>
<a target='_blank' href='https://github.com/JuliaDiff/DiffBase.jl/tree/d2c2446410bd214a9db2560b04078cc2f8c2a4a7/src/results.jl#L106-L110' class='documenter-source'>source</a><br>

<a id='DiffBase.derivative!' href='#DiffBase.derivative!'>#</a>
**`DiffBase.derivative!`** &mdash; *Function*.
Expand All @@ -267,7 +267,7 @@ derivative!(r::DiffResult, x, ::Type{Val{i}} = Val{1})
Copy `x` into `r`'s `ith` derivative storage, such that `derivative(r, Val{i}) == x`.


<a target='_blank' href='https://github.com/JuliaDiff/DiffBase.jl/tree/ef761a393854a7db0ec0da9a1a05b6c71481dc03/src/results.jl#L127-L131' class='documenter-source'>source</a><br>
<a target='_blank' href='https://github.com/JuliaDiff/DiffBase.jl/tree/d2c2446410bd214a9db2560b04078cc2f8c2a4a7/src/results.jl#L127-L131' class='documenter-source'>source</a><br>


```
Expand All @@ -277,7 +277,7 @@ derivative!(f, r::DiffResult, x, ::Type{Val{i}} = Val{1})
Like `derivative!(r::DiffResult, x, Val{i})`, but with `f` applied to each element, such that `derivative(r, Val{i}) == map(f, x)`.


<a target='_blank' href='https://github.com/JuliaDiff/DiffBase.jl/tree/ef761a393854a7db0ec0da9a1a05b6c71481dc03/src/results.jl#L145-L150' class='documenter-source'>source</a><br>
<a target='_blank' href='https://github.com/JuliaDiff/DiffBase.jl/tree/d2c2446410bd214a9db2560b04078cc2f8c2a4a7/src/results.jl#L145-L150' class='documenter-source'>source</a><br>

<a id='DiffBase.gradient!' href='#DiffBase.gradient!'>#</a>
**`DiffBase.gradient!`** &mdash; *Function*.
Expand All @@ -291,7 +291,7 @@ gradient!(r::DiffResult, x)
Copy `x` into `r`'s gradient storage, such that `gradient(r) == x`.


<a target='_blank' href='https://github.com/JuliaDiff/DiffBase.jl/tree/ef761a393854a7db0ec0da9a1a05b6c71481dc03/src/results.jl#L177-L181' class='documenter-source'>source</a><br>
<a target='_blank' href='https://github.com/JuliaDiff/DiffBase.jl/tree/d2c2446410bd214a9db2560b04078cc2f8c2a4a7/src/results.jl#L177-L181' class='documenter-source'>source</a><br>


```
Expand All @@ -301,7 +301,7 @@ gradient!(f, r::DiffResult, x)
Like `gradient!(r::DiffResult, x)`, but with `f` applied to each element, such that `gradient(r) == map(f, x)`.


<a target='_blank' href='https://github.com/JuliaDiff/DiffBase.jl/tree/ef761a393854a7db0ec0da9a1a05b6c71481dc03/src/results.jl#L184-L189' class='documenter-source'>source</a><br>
<a target='_blank' href='https://github.com/JuliaDiff/DiffBase.jl/tree/d2c2446410bd214a9db2560b04078cc2f8c2a4a7/src/results.jl#L184-L189' class='documenter-source'>source</a><br>

<a id='DiffBase.jacobian!' href='#DiffBase.jacobian!'>#</a>
**`DiffBase.jacobian!`** &mdash; *Function*.
Expand All @@ -315,7 +315,7 @@ jacobian!(r::DiffResult, x)
Copy `x` into `r`'s Jacobian storage, such that `jacobian(r) == x`.


<a target='_blank' href='https://github.com/JuliaDiff/DiffBase.jl/tree/ef761a393854a7db0ec0da9a1a05b6c71481dc03/src/results.jl#L202-L206' class='documenter-source'>source</a><br>
<a target='_blank' href='https://github.com/JuliaDiff/DiffBase.jl/tree/d2c2446410bd214a9db2560b04078cc2f8c2a4a7/src/results.jl#L202-L206' class='documenter-source'>source</a><br>


```
Expand All @@ -325,7 +325,7 @@ jacobian!(f, r::DiffResult, x)
Like `jacobian!(r::DiffResult, x)`, but with `f` applied to each element, such that `jacobian(r) == map(f, x)`.


<a target='_blank' href='https://github.com/JuliaDiff/DiffBase.jl/tree/ef761a393854a7db0ec0da9a1a05b6c71481dc03/src/results.jl#L209-L214' class='documenter-source'>source</a><br>
<a target='_blank' href='https://github.com/JuliaDiff/DiffBase.jl/tree/d2c2446410bd214a9db2560b04078cc2f8c2a4a7/src/results.jl#L209-L214' class='documenter-source'>source</a><br>

<a id='DiffBase.hessian!' href='#DiffBase.hessian!'>#</a>
**`DiffBase.hessian!`** &mdash; *Function*.
Expand All @@ -339,7 +339,7 @@ hessian!(r::DiffResult, x)
Copy `x` into `r`'s Hessian storage, such that `hessian(r) == x`.


<a target='_blank' href='https://github.com/JuliaDiff/DiffBase.jl/tree/ef761a393854a7db0ec0da9a1a05b6c71481dc03/src/results.jl#L227-L231' class='documenter-source'>source</a><br>
<a target='_blank' href='https://github.com/JuliaDiff/DiffBase.jl/tree/d2c2446410bd214a9db2560b04078cc2f8c2a4a7/src/results.jl#L227-L231' class='documenter-source'>source</a><br>


```
Expand All @@ -349,5 +349,5 @@ hessian!(f, r::DiffResult, x)
Like `hessian!(r::DiffResult, x)`, but with `f` applied to each element, such that `hessian(r) == map(f, x)`.


<a target='_blank' href='https://github.com/JuliaDiff/DiffBase.jl/tree/ef761a393854a7db0ec0da9a1a05b6c71481dc03/src/results.jl#L234-L239' class='documenter-source'>source</a><br>
<a target='_blank' href='https://github.com/JuliaDiff/DiffBase.jl/tree/d2c2446410bd214a9db2560b04078cc2f8c2a4a7/src/results.jl#L234-L239' class='documenter-source'>source</a><br>

10 changes: 5 additions & 5 deletions docs/src/diffresult.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ CurrentModule = DiffBase
- [ReverseDiff](https://github.com/JuliaDiff/ReverseDiff.jl)

Many differentiation techniques can calculate primal values and multiple orders of
derivatives simultaneously. In other words, there are techniques that allow one to
compute `f(x)`, `∇f(x)` and `H(f(x))` in one fell swoop!
derivatives simultaneously. In other words, there are techniques for computing `f(x)`,
`∇f(x)` and `H(f(x))` in one fell swoop!

For this purpose, DiffBase provides the `DiffResult` type, which can be passed
to in-place differentiation methods instead of an output buffer. All results
computed by the method are loaded into the given `DiffResult`, which the user
can then query using DiffBase's API.
to in-place differentiation methods instead of an output buffer. The method
then loads all computed results into the given `DiffResult`, which the user
can query afterwards using DiffBase's API.

Here's an example of the `DiffResult` in action using ForwardDiff:

Expand Down

0 comments on commit 3297662

Please sign in to comment.