Re: cmplx(0.,-x) or -j*x



gh14tq5@xxxxxxxxx wrote:

Is there any speed advantage of using

z = cmplx(0,-x) over z = -j*x (or vice-versa)

where x is real and possible an array and j=sqrt(-1). Would this be
something that is compiler dependent?

Well, the CMPLX version should pretty much just copy the data. The second one possibly will actually do multiplication. I would hope an optimizing compiler would figure it out, but I wouldn't guarantee it.

-- glen

.