In my (admittedly brief) experience, there have been instances in which the code got uglier because * == , and it would be possible to write more elegant code if it was defined to be 0 instead.
For an example of such a piece of code, this part is supposed to compute x in L*x=b (L being a lower triangular matrix):
x(1) = b(1)/A(1,1); for i=2:n x(i) = (b(i) - A(i,1:i-1)*x(1:i-1))/A(i,i); end
The problem is that I have to make it by two separate cases. I do not think I am obsessed with code beauty, but this is not pleasant for me.
My question is: is there a way to make this work in a single for loop (not using isempty)? Also, I'd love to know if there is a reason I am unaware of for this particular choice the developers made.