mitsuba-renderer / enoki

Enoki: structured vectorization and differentiation on modern processor architectures

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

error: lvalue required as left operand of assignment

andyyankai opened this issue · comments

Trying to do this:

FloatD arr = {1.f,3.f,2.f,5.f,6.f,2.f,6.f};
FloatD t = 0.0f;
set_requires_gradient(t);

arr[2] = arr[2] + t
(error: lvalue required as left operand of assignment)

You will need to use mask-assignement for this. Something like this:

mask_t<FloatD> mask = {0, 1, 0, 0, ...};
arr[mask] += t;

You could also use arange to craft some fancier masks based on indexing.

Please note that you will often find answers to such questions by reading the documentation carefully. We would like to keep github issues for actual issues/bugs with the library 😉