Skip to content

Commit 99a3f37

Browse files
authored
In-place operators for FastDifferentiation (#152)
* In-place operators for FastDifferentiation * Fix READMEs
1 parent d2c6734 commit 99a3f37

5 files changed

Lines changed: 145 additions & 147 deletions

File tree

DifferentiationInterface/README.md

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
# DifferentiationInterface
22

33
[![Build Status](https://github.com/gdalle/DifferentiationInterface.jl/actions/workflows/CI.yml/badge.svg?branch=main)](https://github.com/gdalle/DifferentiationInterface.jl/actions/workflows/CI.yml?query=branch%3Amain)
4+
[![Coverage](https://codecov.io/gh/gdalle/DifferentiationInterface.jl/branch/main/graph/badge.svg)](https://app.codecov.io/gh/gdalle/DifferentiationInterface.jl)
45
[![Code Style: Blue](https://img.shields.io/badge/code%20style-blue-4495d1.svg)](https://github.com/invenia/BlueStyle)
56

6-
| Package | Documentation |
7-
|:-----------------------------|:------------------------------------------:|
8-
| DifferentiationInterface | [![Dev][docs-dev-badge]][docs-dev-url-DI] |
9-
| DifferentiationInterfaceTest | [![Dev][docs-dev-badge]][docs-dev-url-DIT] |
7+
| package | docs |
8+
| ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
9+
| DifferentiationInterface | [![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://gdalle.github.io/DifferentiationInterface.jl/DifferentiationInterface/dev/) |
10+
| DifferentiationInterfaceTest | [![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://gdalle.github.io/DifferentiationInterface.jl/DifferentiationInterfaceTest/dev/) |
1011

1112
An interface to various automatic differentiation (AD) backends in Julia.
1213

@@ -23,7 +24,7 @@ This package provides a backend-agnostic syntax to differentiate functions of th
2324
- In-place and out-of-place differentiation
2425
- Preparation mechanism (e.g. to create a config or tape)
2526
- Thorough validation on standard inputs and outputs (scalars, vectors, matrices)
26-
- Testing and benchmarking utilities accessible to users with [DifferentiationInterfaceTest](https://gdalle.github.io/DifferentiationInterface.jl/DifferentiationInterfaceTest/)
27+
- Testing and benchmarking utilities accessible to users with [DifferentiationInterfaceTest](https://github.com/gdalle/DifferentiationInterface.jl/tree/main/DifferentiationInterfaceTest)
2728

2829
## Compatibility
2930

@@ -82,8 +83,3 @@ julia> value_and_gradient(f, backend, [1., 2., 3.])
8283

8384
- [AbstractDifferentiation.jl](https://github.com/JuliaDiff/AbstractDifferentiation.jl) is the original inspiration for DifferentiationInterface.jl.
8485
- [AutoDiffOperators.jl](https://github.com/oschulz/AutoDiffOperators.jl) is an attempt to bridge ADTypes.jl with AbstractDifferentiation.jl.
85-
86-
[docs-dev-badge]: https://img.shields.io/badge/docs-dev-blue.svg
87-
[docs-dev-url-DI]: https://gdalle.github.io/DifferentiationInterface.jl/DifferentiationInterface/dev/
88-
[docs-dev-url-DIT]: https://gdalle.github.io/DifferentiationInterface.jl/DifferentiationInterfaceTest/dev/
89-

DifferentiationInterface/ext/DifferentiationInterfaceFastDifferentiationExt/DifferentiationInterfaceFastDifferentiationExt.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ using FastDifferentiation:
2323
make_variables,
2424
sparse_hessian,
2525
sparse_jacobian
26+
using FillArrays: Fill
2627
using LinearAlgebra: dot
2728
using FastDifferentiation.RuntimeGeneratedFunctions: RuntimeGeneratedFunction
2829

@@ -34,7 +35,9 @@ DI.mode(::AnyAutoFastDifferentiation) = ADTypes.AbstractSymbolicDifferentiationM
3435
DI.pushforward_performance(::AnyAutoFastDifferentiation) = DI.PushforwardFast()
3536
DI.pullback_performance(::AnyAutoFastDifferentiation) = DI.PullbackSlow()
3637

37-
myvec(x::Number) = [x]
38+
monovec(x::Number) = Fill(x, 1)
39+
40+
myvec(x::Number) = monovec(x)
3841
myvec(x::AbstractArray) = vec(x)
3942

4043
issparse(::AutoFastDifferentiation) = false

0 commit comments

Comments
 (0)