-
-
Notifications
You must be signed in to change notification settings - Fork 117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Solving simple dynamics: ControlTerm piecewise product #358
Comments
You want
For this more general case, you can subclass |
Thanks, works fine! The getting started SDE part redirects to Terms page so I should have seen it ;) Also concerning the Brownian control, it seems changes in |
Ah, interesting point about the Brownian motion. FWIW since it's just a control then I think it shouldn't matter too much -- just switch them before passing them to the control. That said I'd be happy to add a PR that makes this "just work". (Ideally negating the generated samples if |
Hi,
Thanks first for developing this nice package.
For the context, I intend to use diffrax to implement a custom Langevin-like dynamic, but my issue can be reduced to the following. Let's say I want to implement a simple$n$ -dimensional Brownian motion:
$$dX = dB$$
I can try doing
but it wouldn't work because of this line defining the vf-contr product for$n dB$ , whereas I would generally require piecewise (Hadamard) product
ControlTerm
s. Whattensordot(vf, contr, axes=ndim(contr))
does is fully contracting tensors (on all the dimensions ofcontr
), so in my case it would return a scalarvf * contr
.For now, the only way I found to implement piecewise$O(n^2)$ ) and will not scale to my applications. And I am not sure some
ControlTerm
product is to increase the dimensionality of the vector field, e.g. in that case, writediffusion = lambda t, y, args: jnp.eye(n)
, which is way more expensive (jax.experimental.sparse
matrices would help.I understand matrix product, nay higher rank tensor products, may be required in some applications. This recent question, or this diffrax example of Neural SDE, have both matrix-valued diffusion vector field and vector-valued Brownian control. However, if I am not wrong, it seems that for that same reason of full tensor contraction, matrix product between matrix-valued vf and matrix-valued control is not currently easily implemented.
So my question would be: Did I miss a way to implement
ControlTerm
piecewise product?I think it should be possible to implement it:
I could not think of any
einsum
to replacetensordot(a,b,ndim(b))
that would fit well in all cases, but maybe having a way to specify which product_prod
function to use inControlTerm
could be an idea? Or maybe I just missed a simple way to do everything above.Thanks in advance!
The text was updated successfully, but these errors were encountered: