This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Note: put `rga' in your PATH. -*- lexical-binding: t; -*- | |
(require 'consult) | |
(defcustom consult-ripgrep-all-args | |
"rga --null --line-buffered --color=never --max-columns=1000 --path-separator /\ --smart-case --no-heading --with-filename --line-number" | |
"Command line arguments for ripgrep, see `consult-ripgrep-all'. | |
The dynamically computed arguments are appended. | |
Can be either a string, or a list of strings or expressions." | |
:type '(choice string (repeat (choice string expression)))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using ForwardDiff | |
goo((x, y, z),) = [x^2*z, x*y*z, abs(z)-y] | |
foo((x, y, z),) = [x^2*z, x*y*z, abs(z)-y] | |
function foo(u::Vector{ForwardDiff.Dual{T,V,P}}) where {T,V,P} | |
# unpack: AoS -> SoA | |
vs = ForwardDiff.value.(u) | |
# you can play with the dimension here, sometimes it makes sense to transpose | |
ps = mapreduce(ForwardDiff.partials, hcat, u) | |
# get f(vs) | |
val = foo(vs) |