?lascl
Perform scalar operations on a matrix.
Interface Definition
C interface:
void slascl_(const char *type, const int *kl, const int *ku, const float *cfrom, const float *cto, const int *m, const int *n, float *a, const int *lda, int *info);
void dlascl_(const char *type, const int *kl, const int *ku, const double *cfrom, const double *cto, const int *m, const int *n, double *a, const int *lda, int *info);
void clascl_(const char *type, const int *kl, const int *ku, const float *cfrom, const float *cto, const int *m, const int *n, float _Complex *a, const int *lda, int *info);
void zlascl_(const char *type, const int *kl, const int *ku, const double *cfrom, const double *cto, const int *m, const int *n, double _Complex *a, const int *lda, int *info);
Fortran interface:
SLASCL(TYPE, KL, KU, CFROM, CTO, M, N, A, LDA, INFO);
DLASCL(TYPE, KL, KU, CFROM, CTO, M, N, A, LDA, INFO);
CLASCL(TYPE, KL, KU, CFROM, CTO, M, N, A, LDA, INFO);
ZLASCL(TYPE, KL, KU, CFROM, CTO, M, N, A, LDA, INFO);
Parameters
Parameter |
Type |
Description |
Input/Output |
|---|---|---|---|
TYPE |
Character |
|
Input |
KL |
Integer |
Lower bandwidth of matrix A. This parameter is valid when TYPE is 'B', 'Q', or 'Z'. |
Input |
KU |
Integer |
Upper bandwidth of matrix A. This parameter is valid when TYPE is 'B', 'Q', or 'Z'. |
Input |
CFROM |
|
Denominator of the scalar value, that is, scalar = CTO/CFROM. It cannot be zero. |
Input |
CTO |
|
Numerator of the scalar value, that is, scalar = CTO/CFROM. |
Input |
M |
Integer |
Number of rows in matrix A, M ≥ 0. |
Input |
N |
Integer |
Number of columns in matrix A, N ≥ 0. |
Input |
A |
|
Matrix A, with a dimension of (LDA, N). |
Input, output |
LDA |
Integer |
Leading dimension of matrix A.
|
Input |
INFO |
Integer |
|
Output |
Dependency
#include "klapack.h"
Examples
C interface:
const char type = 'G';
const int n = 4;
const int m = 4;
const int kl = 2;
const int ku = 2;
const double cfrom = 2.0;
const double cto = 1.0;
const int lda = m;
int info = 0;
double a[] = {1.0, 1.0, 1.0, 1.0,
2.0, 2.0, 2.0, 2.0,
3.0, 3.0, 3.0, 3.0,
4.0, 4.0, 4.0, 4.0};
dlascl_(&type, &kl, &ku, &cfrom, &cto, &m, &n, a, &lda, &info);
/*
* Output:
* a output
*
* 0.500000 0.500000 0.500000 0.500000
* 1.000000 1.000000 1.000000 1.000000
* 1.500000 1.500000 1.500000 1.500000
* 2.000000 2.000000 2.000000 2.000000
Fortran interface:
CHARACTER :: type = "G"
PARAMETER (m = 4)
PARAMETER (n = 4)
PARAMETER (kl = 2)
PARAMETER (ku = 2)
PARAMETER (lda = 4)
REAL(8) :: cfrom
REAL(8) :: cto
REAL(8) :: a(lda, n)
DATA cfrom / 2.0 /
DATA cto / 1.0 /
DATA a / 1.0, 1.0, 1.0, 1.0,
2.0, 2.0, 2.0, 2.0,
3.0, 3.0, 3.0, 3.0,
4.0, 4.0, 4.0, 4.0 /
EXTERNAL DLASCL
CALL DLASCL(type, kl, ku, cfrom, cto, m, n, a, lda, info);
*
* Output:
* a output
*
* 0.500000 0.500000 0.500000 0.500000
* 1.000000 1.000000 1.000000 1.000000
* 1.500000 1.500000 1.500000 1.500000
* 2.000000 2.000000 2.000000 2.000000