[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: zdotu_ problem on libblas3gf on sparc and alpha



On Sun, Feb 17, 2008 at 08:56:44PM +0530, Kumar Appaiah wrote:
[...] 
> It appears that the calling convention for the new gfortran does not
> like the direct conversion to std::complex<double>. I guess the
> following should work though:
> 
> #include <complex>
> typedef std::complex<double> cdouble;
> extern "C" {
>   double _Complex zdotu_(const int *, const cdouble *, const int *,
>                  const cdouble *, const int *);
> }
> 
> int main() {
>   const int incr = 1;
>   const int size = 6;
>   cdouble a[size] = {cdouble( 0.7219, 0.8871),
>   cdouble(0.7073,-0.7953),
>                      cdouble( 0.2610, 0.4325),
>   cdouble(-0.0565,-0.0719),
>                      cdouble( 0.7277,-0.9754), cdouble(-0.3780,  1.0718)};
>   cdouble b[size] = {cdouble(-0.0821,+0.8410), cdouble(-0.0749,  0.0729),
>                      cdouble(-0.6094,-0.2975), cdouble(0.2106,  -0.2026),
>                      cdouble( 0.1043,-0.8300), cdouble( 0.0806,  0.3698)};
>   cdouble x_ref(-2.01767031,-0.45861365);
>   cdouble x = std::complex<double>(zdotu_(&size, a, &incr, b, &incr));
>   return (std::abs(x - x_ref) < 1e-6) ? 0 : 1;
> }
> 
> Not tested, but should work. Confirmation would be appreciated! :-)

Runs fine, exit code is 0. Let me know if you still need log of that 
configure run.

Best regards,
-- 
Jurij Smakov                                           jurij@wooyd.org
Key: http://www.wooyd.org/pgpkey/                      KeyID: C99E03CC


Reply to: