Rate This Document
Findability
Accuracy
Completeness
Readability

?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

  • 'G': Matrix A is a full matrix.
  • 'L': Matrix A is a lower triangular matrix.
  • 'U': Matrix A is an upper triangular matrix.
  • 'H': Matrix A is an upper Hessenberg matrix.
  • 'B': Matrix A is a symmetric band matrix whose lower bandwidth is KL and upper bandwidth is KU. It only stores the part below the diagonal
  • 'Q': Matrix A is a symmetric band matrix whose lower bandwidth is KL and upper bandwidth is KU. It only stores the part above the diagonal
  • 'Z': Matrix A is a band matrix whose lower bandwidth is KL and upper bandwidth is KU.

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

  • Single-precision floating-point type for slascl
  • Double-precision floating-point type for dlascl
  • Single-precision floating-point type for clascl
  • Double-precision floating-point type for zlascl

Denominator of the scalar value, that is, scalar = CTO/CFROM. It cannot be zero.

Input

CTO

  • Single-precision floating-point type for slascl
  • Double-precision floating-point type for dlascl
  • Single-precision floating-point type for clascl
  • Double-precision floating-point type for zlascl

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

  • A single-precision floating-point array for slascl
  • A double-precision floating-point array for dlascl
  • A complex single-precision array for clascl
  • A complex double-precision array for zlascl

Matrix A, with a dimension of (LDA, N).

Input, output

LDA

Integer

Leading dimension of matrix A.

  • If TYPE='G', 'L', 'U', or 'H', LDA≥max(1, M).
  • If TYPE='B', LDA≥KL+1.
  • If TYPE='Q', LDA≥KU+1.
  • If TYPE='Z', LDA≥2*KL+KU+1.

Input

INFO

Integer

  • 0: The execution is successful.
  • Smaller than 0: The value of the -info-th parameter is invalid.

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