Skip to content

Commit 7f29e5b

Browse files
committed
init
1 parent 5f9dd8a commit 7f29e5b

File tree

8 files changed

+725
-30
lines changed

8 files changed

+725
-30
lines changed

.codecov.yml

Lines changed: 0 additions & 1 deletion
This file was deleted.

.travis.yml

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,7 @@ notifications:
1010
email: false
1111
git:
1212
depth: 99999999
13-
14-
## uncomment the following lines to allow failures on nightly julia
15-
## (tests will run but not make your overall status red)
16-
#matrix:
17-
# allow_failures:
18-
# - julia: nightly
19-
20-
## uncomment and modify the following lines to manually install system packages
21-
#addons:
22-
# apt: # apt-get for linux
23-
# packages:
24-
# - gfortran
25-
#before_script: # homebrew for mac
26-
# - if [ $TRAVIS_OS_NAME = osx ]; then brew install gcc; fi
27-
28-
## uncomment the following lines to override the default test script
29-
#script:
30-
# - julia -e 'Pkg.clone(pwd()); Pkg.build("DiffResults"); Pkg.test("DiffResults"; coverage=true)'
3113
after_success:
32-
# push coverage results to Coveralls
3314
- julia -e 'cd(Pkg.dir("DiffResults")); Pkg.add("Coverage"); using Coverage; Coveralls.submit(Coveralls.process_folder())'
34-
# push coverage results to Codecov
35-
- julia -e 'cd(Pkg.dir("DiffResults")); Pkg.add("Coverage"); using Coverage; Codecov.submit(Codecov.process_folder())'
15+
- julia -e 'Pkg.add("Documenter")'
16+
- julia -e 'cd(Pkg.dir("DiffResults")); include(joinpath("docs", "make.jl"))'

README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
# DiffResults
22

3-
[![Build Status](https://travis-ci.org/jrevels/DiffResults.jl.svg?branch=master)](https://travis-ci.org/jrevels/DiffResults.jl)
3+
Many differentiation techniques can calculate primal values and multiple orders of
4+
derivatives simultaneously. In other words, there are techniques for computing `f(x)`,
5+
`∇f(x)` and `H(f(x))` in one fell swoop!
46

5-
[![Coverage Status](https://coveralls.io/repos/jrevels/DiffResults.jl/badge.svg?branch=master&service=github)](https://coveralls.io/github/jrevels/DiffResults.jl?branch=master)
6-
7-
[![codecov.io](http://codecov.io/github/jrevels/DiffResults.jl/coverage.svg?branch=master)](http://codecov.io/github/jrevels/DiffResults.jl?branch=master)
7+
For this purpose, DiffResults provides the `DiffResult` type, which can be passed
8+
to in-place differentiation methods instead of an output buffer. The method
9+
then loads all computed results into the given `DiffResult`, which the user
10+
can then query afterwards.

REQUIRE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
julia 0.6
2+
StaticArrays 0.5.0

docs/make.jl

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using Documenter, DiffResults
2+
3+
makedocs(modules=[DiffResults],
4+
doctest = false,
5+
format = :html,
6+
sitename = "DiffResults",
7+
pages = ["Documentation" => "index.md"])
8+
9+
deploydocs(repo = "github.com/JuliaDiff/DiffResults.jl.git",
10+
osname = "linux",
11+
julia = "0.6",
12+
target = "build",
13+
deps = nothing,
14+
make = nothing)

docs/src/index.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# DiffResults
2+
3+
```@meta
4+
CurrentModule = DiffResults
5+
```
6+
7+
Many differentiation techniques can calculate primal values and multiple orders of
8+
derivatives simultaneously. In other words, there are techniques for computing `f(x)`,
9+
`∇f(x)` and `H(f(x))` in one fell swoop!
10+
11+
For this purpose, DiffResults provides the `DiffResult` type, which can be passed
12+
to in-place differentiation methods instead of an output buffer. The method
13+
then loads all computed results into the given `DiffResult`, which the user
14+
can then query afterwards.
15+
16+
Here's an example of `DiffResult` in action using ForwardDiff:
17+
18+
```julia
19+
julia> using ForwardDiff, DiffResults
20+
21+
julia> f(x) = sum(sin, x) + prod(tan, x) * sum(sqrt, x);
22+
23+
julia> x = rand(4);
24+
25+
# construct a `DiffResult` with storage for a Hessian, gradient,
26+
# and primal value based on the type and shape of `x`.
27+
julia> result = DiffResults.HessianResult(x)
28+
29+
# Instead of passing an output buffer to `hessian!`, we pass `result`.
30+
# Note that we re-alias to `result` - this is important! See `hessian!`
31+
# docs for why we do this.
32+
julia> result = ForwardDiff.hessian!(result, f, x);
33+
34+
# ...and now we can get all the computed data from `result`
35+
julia> DiffResults.value(result) == f(x)
36+
true
37+
38+
julia> DiffResults.gradient(result) == ForwardDiff.gradient(f, x)
39+
true
40+
41+
julia> DiffResults.hessian(result) == ForwardDiff.hessian(f, x)
42+
true
43+
```
44+
45+
The rest of this document describes the API for constructing, accessing, and mutating
46+
`DiffResult` instances. For details on how to use a `DiffResult` with a specific
47+
package's methods, please consult that package's documentation.
48+
49+
## Constructing a `DiffResult`
50+
51+
```@docs
52+
DiffResults.DiffResult
53+
DiffResults.JacobianResult
54+
DiffResults.GradientResult
55+
DiffResults.HessianResult
56+
```
57+
58+
## Accessing data from a `DiffResult`
59+
60+
```@docs
61+
DiffResults.value
62+
DiffResults.derivative
63+
DiffResults.gradient
64+
DiffResults.jacobian
65+
DiffResults.hessian
66+
```
67+
68+
## Mutating a `DiffResult`
69+
70+
```@docs
71+
DiffResults.value!
72+
DiffResults.derivative!
73+
DiffResults.gradient!
74+
DiffResults.jacobian!
75+
DiffResults.hessian!
76+
```

0 commit comments

Comments
 (0)