You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've repeatedly encountered the issue that Devectorize won't recognize the + operation, if the number of addends is larger than 3, i.e.:
@devec foo[:] = a .* u + b .* x + c .* y + d .* z
In my experience, this will throw:
ERROR:DeError("Unrecognized function + with 4 arguments (in Devectorize)")
Is this intended behavior? Am I using Devectorize incorrectly for very long expressions like the following one (this is part of an analytical gradient I'm working with)?
@devec stor_g[ind, 3* n_covars + i] = covars[:, i] .*exp(-2.* d .* (l + u)) .* (
(8.* f1 .* (f2 + f3) .* (exp(d .* (2.* u + l)) -exp(d .* (2.* l + u))) +
(2.* f2.^2+2.* f2 .* f3 + f3.^2) .* (exp(2.* d .* u) .* (1+2.* d .*l) -exp(2.* d .* l) .* (1+2.* d .* u))) +
(8.* d .* f1 .* (f2 + f3) .* (exp(d .* (l +2.* u)) .* l -exp(d .* (u +2.* l)) .* u) +8.* d.^2.* f1 .* f3 .* (exp(d .* (l +2.* u)) .* l.^2-exp(d .* (u +2.* l)) .* u.^2)) +
(2.* d.^2.* f3 .* (4.* f2 + f3) .* (exp(2.* d .* u) .* l.^2-exp(2.* d .* l) .* u.^2) +4.* d.^3.* f3.^2.* (exp(2.* d .* u).* l.^3-exp(2.* d .* l) .* u.^3))
) ./ (4.* d)
The problem can easily be fixed by wrapping several of the chained + operations in parenthesis:
@devec foo[:] = (a .* u + b .* x) + (c .* y + d .* z)
However, this fix seems to be kind of dirty and messes up the code even more than it is already for such long expression.
Any ideas? Thanks!
The text was updated successfully, but these errors were encountered:
Hi,
I've repeatedly encountered the issue that Devectorize won't recognize the
+
operation, if the number of addends is larger than 3, i.e.:In my experience, this will throw:
Is this intended behavior? Am I using Devectorize incorrectly for very long expressions like the following one (this is part of an analytical gradient I'm working with)?
The problem can easily be fixed by wrapping several of the chained
+
operations in parenthesis:However, this fix seems to be kind of dirty and messes up the code even more than it is already for such long expression.
Any ideas? Thanks!
The text was updated successfully, but these errors were encountered: