Dear Julien,
On Sun, Feb 17, 2008 at 03:53:05PM +0100, Julien Cristau wrote:
> I ran your test programs on sparc, with the following results:
Thank you!
> On Sat, Feb 16, 2008 at 23:17:09 +0530, Kumar Appaiah wrote:
>
> > 1. Please build and run the following programs
> > g++ <progfile>.cpp -lblas should do.
> >
> > Program 1
> > ---------
> >
> $ make blastest1 CXXFLAGS='-Wall -g' LDFLAGS=-lblas
> g++ -Wall -g -lblas blastest1.cpp -o blastest1
> $ ./blastest1
> Illegal instruction
>
> >
> > Program 2
> > ---------
> >
> $ make blastest2 CXXFLAGS='-Wall -g' LDFLAGS=-lblas
> g++ -Wall -g -lblas blastest2.cpp -o blastest2
> $ ./blastest2
> $ echo $?
> 1
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! :-)
Thanks!
Kumar
--
Kumar Appaiah,
458, Jamuna Hostel,
Indian Institute of Technology Madras,
Chennai - 600 036
Attachment:
signature.asc
Description: Digital signature