(deep-primal v)
Version of [[tape-primal]] that will descend recursively into any perturbation
instance returned by [[tape-primal]] or emmy.dual/primal
until
encountering a non-perturbation.
Given a non-perturbation, acts as identity.
Version of [[tape-primal]] that will descend recursively into any perturbation instance returned by [[tape-primal]] or [[emmy.dual/primal]] until encountering a non-perturbation. Given a non-perturbation, acts as identity.
(inner-tag & tags)
Given any number of tags
, returns the tag most recently bound
via [[with-active-tag]] (i.e., the tag connected with the innermost call
to [[with-active-tag]]).
If none of the tags are bound, returns (apply max tags)
.
Given any number of `tags`, returns the tag most recently bound via [[with-active-tag]] (i.e., the tag connected with the _innermost_ call to [[with-active-tag]]). If none of the tags are bound, returns `(apply max tags)`.
(lift-1 f)
(lift-1 f df:dx)
Given:
f
df:dx
that computes the derivative of f
with respect to its
single argumentReturns a new unary function that operates on both the original type of
f
, [[TapeCell]] and [[emmy.dual/Dual]] instances.
If called without df:dx
, df:dx
defaults to (f :dfdx)
; this will return
the derivative registered to a generic function defined
with emmy.util.def/defgeneric
.
NOTE: df:dx
has to ALREADY be able to handle [[TapeCell]]
and [[emmy.dual/Dual]] instances. The best way to accomplish this is by
building df:dx
out of already-lifted functions, and declaring them by
forward reference if you need to.
Given: - some unary function `f` - a function `df:dx` that computes the derivative of `f` with respect to its single argument Returns a new unary function that operates on both the original type of `f`, [[TapeCell]] and [[emmy.dual/Dual]] instances. If called without `df:dx`, `df:dx` defaults to `(f :dfdx)`; this will return the derivative registered to a generic function defined with [[emmy.util.def/defgeneric]]. NOTE: `df:dx` has to ALREADY be able to handle [[TapeCell]] and [[emmy.dual/Dual]] instances. The best way to accomplish this is by building `df:dx` out of already-lifted functions, and declaring them by forward reference if you need to.
(lift-2 f)
(lift-2 f df:dx df:dy)
Given:
f
df:dx
that computes the derivative of f
with respect to its
single argumentdf:dy
, similar to df:dx
for the second argReturns a new binary function that operates on both the original type of
f
, [[TapeCell]] and [[emmy.dual/Dual]] instances.
NOTE: df:dx
and df:dy
have to ALREADY be able to handle [[TapeCell]]
and [[emmy.dual/Dual]] instances. The best way to accomplish this is
by building df:dx
and df:dy
out of already-lifted functions, and declaring
them by forward reference if you need to.
Given: - some binary function `f` - a function `df:dx` that computes the derivative of `f` with respect to its single argument - a function `df:dy`, similar to `df:dx` for the second arg Returns a new binary function that operates on both the original type of `f`, [[TapeCell]] and [[emmy.dual/Dual]] instances. NOTE: `df:dx` and `df:dy` have to ALREADY be able to handle [[TapeCell]] and [[emmy.dual/Dual]] instances. The best way to accomplish this is by building `df:dx` and `df:dy` out of already-lifted functions, and declaring them by forward reference if you need to.
(lift-n f df:dx df:dx1 df:dx2)
Given:
f
that can handle 0, 1 or 2 argumentsdf:dx
, a fn that returns the derivative wrt the single arg in the unary casedf:dx1
and df:dx2
, fns that return the derivative with respect to the
first and second args in the binary caseReturns a new any-arity function that operates on both the original type of
f
, [[TapeCell]] and [[emmy.dual/Dual]] instances.
NOTE: The n-ary case of f
is populated by nested calls to the binary case.
That means that this is NOT an appropriate lifting method for an n-ary
function that isn't built out of associative binary calls. If you need this
ability, please file an issue at the emmy issue
tracker.
Given: - some function `f` that can handle 0, 1 or 2 arguments - `df:dx`, a fn that returns the derivative wrt the single arg in the unary case - `df:dx1` and `df:dx2`, fns that return the derivative with respect to the first and second args in the binary case Returns a new any-arity function that operates on both the original type of `f`, [[TapeCell]] and [[emmy.dual/Dual]] instances. NOTE: The n-ary case of `f` is populated by nested calls to the binary case. That means that this is NOT an appropriate lifting method for an n-ary function that isn't built out of associative binary calls. If you need this ability, please file an issue at the [emmy issue tracker](https://github.com/mentat-collective/emmy/issues).
(primal-of v)
(primal-of v tag)
More permissive version of emmy.tape/tape-primal
that returns v
when passed a
non-perturbation.
More permissive version of [[emmy.tape/tape-primal]] that returns `v` when passed a non-perturbation.
(tag+perturbation & dxs)
Given any number of dxs
, returns a pair of the form
[<tag> <tape-or-dual-number>]
containing the tag and instance of [[emmy.dual/Dual]] or [[TapeCell]] associated with the inner-most call to [[with-active-tag]] in the current call stack.
If none of dxs
has an active tag, returns nil
.
Given any number of `dxs`, returns a pair of the form [<tag> <tape-or-dual-number>] containing the tag and instance of [[emmy.dual/Dual]] or [[TapeCell]] associated with the inner-most call to [[with-active-tag]] in the current call stack. If none of `dxs` has an active tag, returns `nil`.
(tag-of x)
More permissive version of emmy.tape/tape-tag
that returns nil
when
passed a non-perturbation.
More permissive version of [[emmy.tape/tape-tag]] that returns `nil` when passed a non-perturbation.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close