Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
fix a const error in IndexSetIter::operator+() #94
There exists an const error in the IndexSetIter::operator+(), which affect the following codes.
where the += operator in the diffinition of operaotr+() actually modifies the value of x.
Hi, so thanks for catching this. However I think the correct fix is not to remove the const from the function argument, but rather to make it no longer a reference at all (i.e. pass by value). Then the copy of x inside the function can be modified by the += operation, and the resulting IndexSetIter returned. Can you test this alternate code and confirm?
added a commit
this pull request
Apr 8, 2016
One other comment: be careful about making a delta tensor with two indices of different size. I may actually forbid it because it's not a common use-case; theoretically if you use it to "shrink" an index it acts like a projector whereas if you use it to "grow" an index it pads with zeros.