Closed gbasler closed 13 years ago
Thanks for filing this. I can't reopen the issue on github because it's a pull request, but rest assured the issue itself is not closed.
Fixed in c94437f33e78ee93f65c.
The bug isn't actually it's picking the wrong implementation. There's no way for it to pick the right one without the static type. In other words, you can't write generic Scalala code using the more general types and have any hope it will be efficient. You have to do everything with the implementation types or with generic parametrized types and take the appropriate implicits for doing math on them.
The bug is in the default Tensor implementation of CanJoin.joinEitherNonZero when the left argument mutates.
Please have a look at this test case.
If I cast a DenseVector to a Tensor and do something like a :-= b then the wrong operator implementation and some optimization kicks. If an operation on an element results to zero then that operation is executed again... (Tensor.Scala: joinEitherNonZero)