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
{{ message }}
Repository navigation
describe how to make sum-to-zero parameters "optional" in User's Guide #909
I liked this suggestion from @WardBrian and think it should be in the User's Guide, because it's a tricky edge case. The context is sum-to-zero vectors, but if there isn't a section on the optionality-with-arrays trick, we should add a whole section.
Note that the fix will just mean your code will be rejected with a nicer error -- you still won't be able to declare a size-0 `sum_to_zero_vector`, since the number of free parameters for this type is one fewer than the declared size, like a simplex.
To make one 'optional', you can either do array[NB] sum_to_zero_vector[S] or declare it as size-1 when it isn't needed, which will make it have no free parameters under the hood: sum_to_zero_vector[NB ? S : 1]
Activity