Skip to content

Is dlaswp functioning properly? #1086

Answered by langou
lapakost asked this question in Q&A
Discussion options

You must be logged in to vote

The representation of the permutation vector in LAPACK LASWP is not the one you expect. The vector p=[ 2, 1 ] means that you will do two elementary permutations. First swap (1,2) and then swap (2,1). (So yes, in this case, at the end, you end up as you started. So the output of your test example is correct.) If you want to swap row 1 and row 2, you can use the vector p=[2,2].

Maybe using an "N" larger than 2 would make it easier to understand. Try N=9 and p=[3,2,4,9,2,7,8,8,3] then this'll apply the nine elementary permutations (1,3), then (2,2), then (3,4), then (4,9), then (5,2), then (6,7), then (7,8), then (8,8), then (9,3). (In this order if INCX = 1.) So that an array [0.1, 0.2, 0.3…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@lapakost
Comment options

Answer selected by lapakost
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants