Can this loop be vectorized?

W

Wolfgang Thomsen

Hello,

is there a way to convince the Intel compiler to (auto-)vectorize the
following?

double a[N], b[N];
int c[2N];

for(int i=0; i<N; i++) {
a = b[c[i*2]];
}

It does not vectorize presumably because c[] is a different data type than
a[] and b[].


Any help greatly appreciated!
Wolf
 
Ï

ÏÑíÏ ÚÈÏ Çááå

Or why don't you type:

double a[N], b[N];
int c[2N];

for(int i=0; i<N; i++) {

a = b[c[i*2]];

}
 
Ï

ÏÑíÏ ÚÈÏ Çááå

Sory For Mistake
Tyy To Type:

double a[N], b[N];
int c[2N];

for(int i=0; i<N; i++) {
tmp = c[i*2]; // All now are integers
a = b[tmp];

}
Please try this..
But for knowing
I tryed your code on turbo c++ 4.5 . It was running..
 
R

red floyd

دريد عبد الله said:
Sory For Mistake
Tyy To Type:

double a[N], b[N];
int c[2N];

for(int i=0; i<N; i++) {
tmp = c[i*2]; // All now are integers
a = b[tmp];

}
Please try this..
But for knowing
I tryed your code on turbo c++ 4.5 . It was running..


That wasn't what OP was asking. To the OP, you're better off asking in
a group dedicated to your compiler -- ISO/IEC 14882:2003 doesn't discuss
vectorization at all.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top