?laswp
Interface Definition
C interface:
void slaswp_(const int *n, float *a, const int *lda, const int *k1, const int *k2, const int *ipiv, const int *incx);
void dlaswp_(const int *n, double *a, const int *lda, const int *k1, const int *k2, const int *ipiv, const int *incx);
void claswp_(const int *n, float _Complex *a, const int *lda, const int *k1, const int *k2, const int *ipiv, const int *incx);
void zlaswp_(const int *n, double _Complex *a, const int *lda, const int *k1, const int *k2, const int *ipiv, const int *incx);
Fortran interface:
SLASWP(N, A, LDA, K1, K2, IPIV, INCX);
DLASWP(N, A, LDA, K1, K2, IPIV, INCX);
CLASWP(N, A, LDA, K1, K2, IPIV, INCX);
ZLASWP(N, A, LDA, K1, K2, IPIV, INCX);
Parameters
Parameter |
Type |
Description |
Input/Output |
|---|---|---|---|
N |
Integer |
Number of columns in matrix A. |
Input |
A |
|
Matrix A with a size of LDA*N.
|
Input, output |
LDA |
Integer |
Leading dimension of matrix A. |
Input |
K1 |
Integer |
Index value of IPIV. It indicates the start row of the swap. |
Input |
K2 |
Integer |
Index value of IPIV. It indicates the end row of the swap. |
Input |
IPIV |
Integer array |
Index array for the swap. The size is K1+(K2-K1)*abs(INCX). |
Input |
INCX |
Integer |
Step of the IPIV value. |
Input |
Dependency
#include "klapack.h"
Examples
C interface:
const int n = 4;
const int lda = n;
const int k1 = 1;
const int k2 = 2;
const int incx = 1;
double a[] = { 1.0, 1.0, 1.0, 1.0,
2.0, 2.0, 2.0, 2.0,
8.0, 3.0, 3.0, 3.0,
4.0, 4.0, 4.0, 4.0};
int ipiv[3] = {3,1};
dlaswp_(&n, a, &lda, &k1, &k2, ipiv, &incx);
/*
* Output:
* a output:
*
* 1.000000 1.000000 1.000000 1.000000
* 2.000000 2.000000 2.000000 2.000000
* 3.000000 3.000000 8.000000 3.000000
* 4.000000 4.000000 4.000000 4.000000
Fortran interface:
PARAMETER (n = 4) PARAMETER (lda = n) PARAMETER (k1 = 1) PARAMETER (k2 = 2) PARAMETER (incx = 1) REAL(8) :: a(lda, n) INTEGER :: ipiv(3) DATA a / 1.0, 1.0, 1.0, 1.0, $ 2.0, 2.0, 2.0, 2.0, $ 8.0, 3.0, 3.0, 3.0, $ 4.0, 4.0, 4.0, 4.0 / DATA ipiv / 3, 1 / EXTERNAL DLASWP CALL DLASWP(n, a, lda, k1, k2, ipiv, incx); * * Output: * a output (stored in column-major) * 1.000000 1.000000 1.000000 1.000000 * 2.000000 2.000000 2.000000 2.000000 * 3.000000 3.000000 8.000000 3.000000 * 4.000000 4.000000 4.000000 4.000000