Hi
utab wrote:
Dear all, I have a question regarding an assignment operation
This is the statement:
"If you know for sure that the left hand expression and the right hand
expression have no common storage, then assignment has no aliasing."
[...]
I could not understand this, can someone clarify that for me?
Consider the following assignment with matrices A and B
A = A * B
Clearly, the expression on the left hand side and the expression on the
right hand side refer to common storage, the storage of A. It is obvious
that you cannot assign the result of A*B directly into A, as you would
destroy your first operand. Therefore, in that case (and generally
whenever _some_ storage is shared among left and right hand side) you
need to store the result in some temporary storage before you can assign
them. If, on the other hand, there is no common storage, e.g. because
you have two _distinct_ matrices A and B, you know that you could store
directly into A in the expression
A = B * B
The documentation says that in those cases you can use noalias(A) to
speed things up.
hth
Markus