Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.

Inplace permutation

asd__asdqwe
Beginner
635 Views

Hello,

I need to permute a vector according to an index array jpvt returned by ?geqp3.  In the example lapack/source/dgeqpfx.f it is done using an auxiliary array. I would like to do the transformation inplace (or at least with O(1) extra memory), but as you can see from the attached source code, I don’t seem to be able to use ?laswp correctly. Can this be used for this kind of transformation ? If yes, how ? If no, is there another way to do this ?

Thank you in advance.

 

0 Kudos
3 Replies
Ying_H_Intel
Employee
635 Views

Hi qweasd q.

The ?laswp  swaps the row in a cascading way. So it can't do the permutation directly.  you may use Array notation like A[:]=A[iptv[:]] in Intel Compiler  https://software.intel.com/en-us/blogs/2010/09/03/simd-parallelism-using-array-notation

Best Regards,

Ying.

0 Kudos
Alexander_K_Intel3
635 Views

Hi qweasd q.

Please try using dlapmt_, following code does the correct permutation for your example:

int _false = 0, ione = 1;
dlapmt_(&_false,&ione,&n,A,&ione,jpvt);

 

Best regards,

Alexander

0 Kudos
Charls_W_
Beginner
635 Views

@qweasd q.

Hello qweasd q.

I really benefited from the function ?lapmt you mentioned above. But now I'm confused with another problem.

I need to permute the 8 bits in a byte in the order specified in parameter pmt.

I wonder if there is a similar function as ?lampt, while permutation is carried out in bits . And inupt char output char would be better. Bits arranged in vector is also OK.

 

Thanks for you attention.

0 Kudos
Reply