--- Begin Message ---
Subject: |
Re: Vectorization in gcc 4.1.1 |
Date: |
Wed, 04 Jul 2007 05:51:59 GMT |
rameshk <address@hidden> wrote in message...
> Hi,
> I was trying to get gcc to vectorize a simple loop:
>
> #include <vector>
// > int test(double *x , int size);
>
> int test(double *x, int size){
> int ret = 1;
> std::vector<double> v;
> v.resize(size);
> double *a = &v[0];
std::cout<<"sizeof(double)="<<sizeof(double)<<std::endl;
std::vector<double> vD( 10 );
std::cout<<"sizeof(vD)="<<sizeof(vD)<<std::endl;
/* - out -
sizeof(double)=8
sizeof(vD)=12
*/
> for(int i = 0;i < size; ++i )
> {
> a[i ] = 1/x[i]; // ka-boom
> }
>
> }
int test( double *x, int size ){
int ret = 1;
// std::vector<double> v( size );
// for( std::size_t a(0); a < v.size(); ++a ){ v.at( i ) = 1/x[i]; }
// for(a)
std::vector<double> v( x, x + size );
// .... do something with 'v'
return ret;
}
--
Bob R
POVrookie
--- End Message ---
--- Begin Message ---
Subject: |
confirm f4976f2c5dbb669c560603de53c8d6facf891f8c |
If you reply to this message, keeping the Subject: header intact,
Mailman will discard the held message. Do this if the message is
spam. If you reply to this message and include an Approved: header
with the list password in it, the message will be approved for posting
to the list. The Approved: header can also appear in the first line
of the body of the reply.
--- End Message ---