[patch] fix for outer product when using BLAS (issue #95)
Jules Bergmann
jules at codesourcery.com
Mon Dec 5 19:32:41 UTC 2005
Don,
This patch changes how complex outer products using BLAS to compute a
row-major matrix are done.
The current implementation modifies one of the input vectors to perform
conjugation. This causes the wrong results if the two input vectors
overlap. Since it is possible for input vectors to overlap even if they
aren't the same vector (for example, a row and column from a matrix), we
can't make this safe by checking that the pointers are different.
The patch changes the outer implementation to modify the output matrix
instead. Alas, this is more costly -- O(n^2) vs O(n), which is why we
didn't do it this way to begin with -- but safe.
As I type this email, another solution comes to mind that would allow us
to safely check between the original version and the new version. We
could do some modulo arithmetic to check for overlap (i.e. solve A_ptr +
i * A_stride == B_ptr + j * B_stride for a solution i, j where i <
A_size and j < B_size).
I think the safe thing to do is go with this patch for correctness, and
then perform the more complex modulo arithmetic check as an optimization.
OK to commit?
-- Jules
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 95.diff
URL: <http://sourcerytools.com/pipermail/vsipl++/attachments/20051205/5827b8b3/attachment.ksh>
More information about the vsipl++
mailing list